From f27b23bec8a8dd8cc6804d727398d6dd7e2a69a0 Mon Sep 17 00:00:00 2001 From: lorentz Date: Tue, 3 Feb 2026 20:54:35 -0500 Subject: [PATCH] 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 --- app/kiosk/settings/page.tsx | 14 ++--------- lib/services/autotask-client.ts | 3 ++- migrations/022_populate_classifications.sql | 26 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 migrations/022_populate_classifications.sql diff --git a/app/kiosk/settings/page.tsx b/app/kiosk/settings/page.tsx index ddb7e61..a64b14f 100644 --- a/app/kiosk/settings/page.tsx +++ b/app/kiosk/settings/page.tsx @@ -293,17 +293,7 @@ export default function KioskSettingsPage() { {/* Excluded Classifications Section */}
-
-

Excluded Company Classifications

- -
+

Excluded Company Classifications

Tickets from companies with these classifications will not appear in the kiosk display.

@@ -312,7 +302,7 @@ export default function KioskSettingsPage() { {classifications.length === 0 ? (

No classifications found.

-

Click "Sync from Autotask" to load classification icons.

+

Refresh the page to load classifications.

) : (
diff --git a/lib/services/autotask-client.ts b/lib/services/autotask-client.ts index b944277..127cda5 100644 --- a/lib/services/autotask-client.ts +++ b/lib/services/autotask-client.ts @@ -490,7 +490,8 @@ export class AutotaskClient { // Classification Icons methods async getClassificationIcons(): Promise { // 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(url, { method: 'GET', diff --git a/migrations/022_populate_classifications.sql b/migrations/022_populate_classifications.sql new file mode 100644 index 0000000..efcf721 --- /dev/null +++ b/migrations/022_populate_classifications.sql @@ -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;