From 8b54145d9de8f701eae725462dd806b568bd4790 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Sun, 15 Mar 2026 16:52:23 -0700 Subject: [PATCH] Add IsServiceBell flag to task types Only Call Staff, Chat With Staff, and Pay With Cash should appear on the customer service bell. New column distinguishes service bell items from internal task types. Co-Authored-By: Claude Opus 4.6 --- api/setup/saveWizard.php | 7 ++----- api/tasks/listAllTypes.php | 2 ++ api/tasks/listTypes.php | 2 ++ api/tasks/saveType.php | 13 ++++++++++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/api/setup/saveWizard.php b/api/setup/saveWizard.php index 7abcfa1..6498b02 100644 --- a/api/setup/saveWizard.php +++ b/api/setup/saveWizard.php @@ -251,18 +251,15 @@ try { ['name' => 'Call Staff', 'icon' => 'notifications', 'color' => '#9C27B0', 'description' => 'Request staff assistance'], ['name' => 'Chat With Staff', 'icon' => 'chat', 'color' => '#2196F3', 'description' => 'Open a chat conversation'], ['name' => 'Pay With Cash', 'icon' => 'payments', 'color' => '#4CAF50', 'description' => 'Request to pay with cash'], - ['name' => 'Deliver to Table', 'icon' => 'restaurant', 'color' => '#FF9800', 'description' => 'Deliver completed order to table'], - ['name' => 'Order Ready for Pickup', 'icon' => 'shopping_bag', 'color' => '#00BCD4', 'description' => 'Notify customer their order is ready'], - ['name' => 'Deliver to Address', 'icon' => 'local_shipping', 'color' => '#795548', 'description' => 'Deliver order to customer address'], ]; foreach ($defaultTaskTypes as $sortOrder => $tt) { queryTimed( - "INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, BusinessID, SortOrder) VALUES (?, ?, ?, ?, ?, ?)", + "INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, BusinessID, SortOrder, IsServiceBell) VALUES (?, ?, ?, ?, ?, ?, 1)", [$tt['name'], $tt['description'], $tt['icon'], $tt['color'], $businessId, $sortOrder + 1] ); } - $response['steps'][] = 'Created 6 default task types'; + $response['steps'][] = 'Created 3 default task types'; // Default task categories $defaultTaskCategories = [ diff --git a/api/tasks/listAllTypes.php b/api/tasks/listAllTypes.php index cebc3e4..1674a38 100644 --- a/api/tasks/listAllTypes.php +++ b/api/tasks/listAllTypes.php @@ -27,6 +27,7 @@ try { Icon as TaskTypeIcon, Color as TaskTypeColor, RequiresServicePoint, + IsServiceBell, SortOrder, TaskCategoryID as CategoryID FROM tt_TaskTypes @@ -44,6 +45,7 @@ try { 'TaskTypeColor' => $row['TaskTypeColor'] ?? '#9C27B0', 'CategoryID' => $row['CategoryID'] ?? '', 'RequiresServicePoint' => ((int) ($row['RequiresServicePoint'] ?? 0)) === 1, + 'IsServiceBell' => ((int) ($row['IsServiceBell'] ?? 0)) === 1, ]; } diff --git a/api/tasks/listTypes.php b/api/tasks/listTypes.php index 48ee16a..5401757 100644 --- a/api/tasks/listTypes.php +++ b/api/tasks/listTypes.php @@ -27,6 +27,7 @@ try { Icon as TaskTypeIcon, Color as TaskTypeColor, RequiresServicePoint, + IsServiceBell, SortOrder FROM tt_TaskTypes WHERE BusinessID = ? @@ -42,6 +43,7 @@ try { 'TaskTypeIcon' => $row['TaskTypeIcon'] ?? 'notifications', 'TaskTypeColor' => $row['TaskTypeColor'] ?? '#9C27B0', 'RequiresServicePoint' => ((int) ($row['RequiresServicePoint'] ?? 0)) === 1, + 'IsServiceBell' => ((int) ($row['IsServiceBell'] ?? 0)) === 1, ]; } diff --git a/api/tasks/saveType.php b/api/tasks/saveType.php index 9bf92db..1990450 100644 --- a/api/tasks/saveType.php +++ b/api/tasks/saveType.php @@ -47,6 +47,11 @@ try { $requiresServicePoint = $data['RequiresServicePoint'] ? 1 : 0; } + $isServiceBell = 0; + if (isset($data['IsServiceBell'])) { + $isServiceBell = $data['IsServiceBell'] ? 1 : 0; + } + $categoryID = null; if (isset($data['TaskTypeCategoryID']) && is_numeric($data['TaskTypeCategoryID']) && (int) $data['TaskTypeCategoryID'] > 0) { $categoryID = (int) $data['TaskTypeCategoryID']; @@ -69,7 +74,7 @@ try { queryTimed(" UPDATE tt_TaskTypes SET Name = ?, Description = ?, Icon = ?, Color = ?, - RequiresServicePoint = ?, TaskCategoryID = ? + RequiresServicePoint = ?, IsServiceBell = ?, TaskCategoryID = ? WHERE ID = ? ", [ $taskTypeName, @@ -77,6 +82,7 @@ try { $taskTypeIcon, $taskTypeColor, $requiresServicePoint, + $isServiceBell, $categoryID, $taskTypeID, ]); @@ -85,14 +91,15 @@ try { } else { // INSERT queryTimed(" - INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, RequiresServicePoint, BusinessID, TaskCategoryID) - VALUES (?, ?, ?, ?, ?, ?, ?) + INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, RequiresServicePoint, IsServiceBell, BusinessID, TaskCategoryID) + VALUES (?, ?, ?, ?, ?, ?, ?, ?) ", [ $taskTypeName, !empty($taskTypeDescription) ? $taskTypeDescription : null, $taskTypeIcon, $taskTypeColor, $requiresServicePoint, + $isServiceBell, $businessID, $categoryID, ]);