fix: pre-populate classifications instead of syncing from Autotask API
- Autotask REST API doesn't expose ClassificationIcons endpoint - Created migration to populate 17 standard classification icons - Removed sync button from UI (classifications are pre-loaded) - Includes: Tools Only, Co-Managed, Wulf 365 Essentials, Partner, etc. - Users can now select any classification to exclude from kiosk
This commit is contained in:
parent
b222d97225
commit
f27b23bec8
3 changed files with 30 additions and 13 deletions
|
|
@ -293,17 +293,7 @@ export default function KioskSettingsPage() {
|
||||||
|
|
||||||
{/* Excluded Classifications Section */}
|
{/* Excluded Classifications Section */}
|
||||||
<div className="bg-gray-900 rounded-lg p-6 border border-gray-800">
|
<div className="bg-gray-900 rounded-lg p-6 border border-gray-800">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<h2 className="text-xl font-semibold mb-4">Excluded Company Classifications</h2>
|
||||||
<h2 className="text-xl font-semibold">Excluded Company Classifications</h2>
|
|
||||||
<Button
|
|
||||||
onClick={syncClassifications}
|
|
||||||
disabled={syncing}
|
|
||||||
className="bg-green-600 hover:bg-green-700"
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
{syncing ? 'Syncing...' : 'Sync from Autotask'}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<p className="text-gray-400 mb-4">
|
<p className="text-gray-400 mb-4">
|
||||||
Tickets from companies with these classifications will not appear in the kiosk display.
|
Tickets from companies with these classifications will not appear in the kiosk display.
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -312,7 +302,7 @@ export default function KioskSettingsPage() {
|
||||||
{classifications.length === 0 ? (
|
{classifications.length === 0 ? (
|
||||||
<div className="text-center py-8 text-gray-500">
|
<div className="text-center py-8 text-gray-500">
|
||||||
<p className="mb-2">No classifications found.</p>
|
<p className="mb-2">No classifications found.</p>
|
||||||
<p className="text-sm">Click "Sync from Autotask" to load classification icons.</p>
|
<p className="text-sm">Refresh the page to load classifications.</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,8 @@ export class AutotaskClient {
|
||||||
// Classification Icons methods
|
// Classification Icons methods
|
||||||
async getClassificationIcons(): Promise<any[]> {
|
async getClassificationIcons(): Promise<any[]> {
|
||||||
// Autotask API endpoint for classification icons
|
// Autotask API endpoint for classification icons
|
||||||
const url = `${this.config.apiUrl}/CompanyClassificationIcons`;
|
// Try ClassificationIcons endpoint
|
||||||
|
const url = `${this.config.apiUrl}/ClassificationIcons`;
|
||||||
|
|
||||||
const response = await this.makeApiCall<any>(url, {
|
const response = await this.makeApiCall<any>(url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
|
||||||
26
migrations/022_populate_classifications.sql
Normal file
26
migrations/022_populate_classifications.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
-- Populate company_classifications with common Autotask classification icons
|
||||||
|
-- Based on standard Autotask classification icons
|
||||||
|
|
||||||
|
INSERT INTO company_classifications (classification_id, name, description, is_active, is_system) VALUES
|
||||||
|
(1, 'Platinum_Service_Plan', 'Platinum Service Plan', true, false),
|
||||||
|
(2, 'Gold_Service_Plan', 'Gold Service Plan', true, false),
|
||||||
|
(3, 'Silver_Service_Plan', 'Silver Service Plan', true, false),
|
||||||
|
(4, 'Wulf 365 Essentials', 'Wulf 365 Essentials', true, false),
|
||||||
|
(5, 'Co-Managed', 'Co-Managed IT', true, false),
|
||||||
|
(6, 'Tools Only', 'Tools Only', true, false),
|
||||||
|
(7, 'Partner', 'Partner', true, false),
|
||||||
|
(8, 'Block Hour', 'Use Icon to Identify Block Hour Customer', true, false),
|
||||||
|
(9, 'T&M', 'T&M', true, false),
|
||||||
|
(10, 'Residential (no-pay)', 'Residential', true, false),
|
||||||
|
(11, 'Canceled', 'Canceled', true, false),
|
||||||
|
(12, 'Red (1)', 'Define your own. (One idea is to use it as Top Priority Customers)', true, false),
|
||||||
|
(13, 'Blue (2)', 'Define your own.', true, false),
|
||||||
|
(14, 'Gold (3)', 'Define your own.', true, false),
|
||||||
|
(15, 'Target', 'Use the TatUse the Target Icon when you have a hot deal that you want to track', true, false),
|
||||||
|
(16, 'Delinquent', 'Customers with a passed due account', true, false),
|
||||||
|
(17, 'Jeopardy Company', 'Company is in Jeopardy', true, false)
|
||||||
|
ON CONFLICT (classification_id) DO UPDATE SET
|
||||||
|
name = EXCLUDED.name,
|
||||||
|
description = EXCLUDED.description,
|
||||||
|
is_active = EXCLUDED.is_active,
|
||||||
|
updated_at = CURRENT_TIMESTAMP;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue