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 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-15 16:52:23 -07:00
parent 5761ed3e88
commit 8b54145d9d
4 changed files with 16 additions and 8 deletions

View file

@ -251,18 +251,15 @@ try {
['name' => 'Call Staff', 'icon' => 'notifications', 'color' => '#9C27B0', 'description' => 'Request staff assistance'], ['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' => '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' => '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) { foreach ($defaultTaskTypes as $sortOrder => $tt) {
queryTimed( 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] [$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 // Default task categories
$defaultTaskCategories = [ $defaultTaskCategories = [

View file

@ -27,6 +27,7 @@ try {
Icon as TaskTypeIcon, Icon as TaskTypeIcon,
Color as TaskTypeColor, Color as TaskTypeColor,
RequiresServicePoint, RequiresServicePoint,
IsServiceBell,
SortOrder, SortOrder,
TaskCategoryID as CategoryID TaskCategoryID as CategoryID
FROM tt_TaskTypes FROM tt_TaskTypes
@ -44,6 +45,7 @@ try {
'TaskTypeColor' => $row['TaskTypeColor'] ?? '#9C27B0', 'TaskTypeColor' => $row['TaskTypeColor'] ?? '#9C27B0',
'CategoryID' => $row['CategoryID'] ?? '', 'CategoryID' => $row['CategoryID'] ?? '',
'RequiresServicePoint' => ((int) ($row['RequiresServicePoint'] ?? 0)) === 1, 'RequiresServicePoint' => ((int) ($row['RequiresServicePoint'] ?? 0)) === 1,
'IsServiceBell' => ((int) ($row['IsServiceBell'] ?? 0)) === 1,
]; ];
} }

View file

@ -27,6 +27,7 @@ try {
Icon as TaskTypeIcon, Icon as TaskTypeIcon,
Color as TaskTypeColor, Color as TaskTypeColor,
RequiresServicePoint, RequiresServicePoint,
IsServiceBell,
SortOrder SortOrder
FROM tt_TaskTypes FROM tt_TaskTypes
WHERE BusinessID = ? WHERE BusinessID = ?
@ -42,6 +43,7 @@ try {
'TaskTypeIcon' => $row['TaskTypeIcon'] ?? 'notifications', 'TaskTypeIcon' => $row['TaskTypeIcon'] ?? 'notifications',
'TaskTypeColor' => $row['TaskTypeColor'] ?? '#9C27B0', 'TaskTypeColor' => $row['TaskTypeColor'] ?? '#9C27B0',
'RequiresServicePoint' => ((int) ($row['RequiresServicePoint'] ?? 0)) === 1, 'RequiresServicePoint' => ((int) ($row['RequiresServicePoint'] ?? 0)) === 1,
'IsServiceBell' => ((int) ($row['IsServiceBell'] ?? 0)) === 1,
]; ];
} }

View file

@ -47,6 +47,11 @@ try {
$requiresServicePoint = $data['RequiresServicePoint'] ? 1 : 0; $requiresServicePoint = $data['RequiresServicePoint'] ? 1 : 0;
} }
$isServiceBell = 0;
if (isset($data['IsServiceBell'])) {
$isServiceBell = $data['IsServiceBell'] ? 1 : 0;
}
$categoryID = null; $categoryID = null;
if (isset($data['TaskTypeCategoryID']) && is_numeric($data['TaskTypeCategoryID']) && (int) $data['TaskTypeCategoryID'] > 0) { if (isset($data['TaskTypeCategoryID']) && is_numeric($data['TaskTypeCategoryID']) && (int) $data['TaskTypeCategoryID'] > 0) {
$categoryID = (int) $data['TaskTypeCategoryID']; $categoryID = (int) $data['TaskTypeCategoryID'];
@ -69,7 +74,7 @@ try {
queryTimed(" queryTimed("
UPDATE tt_TaskTypes UPDATE tt_TaskTypes
SET Name = ?, Description = ?, Icon = ?, Color = ?, SET Name = ?, Description = ?, Icon = ?, Color = ?,
RequiresServicePoint = ?, TaskCategoryID = ? RequiresServicePoint = ?, IsServiceBell = ?, TaskCategoryID = ?
WHERE ID = ? WHERE ID = ?
", [ ", [
$taskTypeName, $taskTypeName,
@ -77,6 +82,7 @@ try {
$taskTypeIcon, $taskTypeIcon,
$taskTypeColor, $taskTypeColor,
$requiresServicePoint, $requiresServicePoint,
$isServiceBell,
$categoryID, $categoryID,
$taskTypeID, $taskTypeID,
]); ]);
@ -85,14 +91,15 @@ try {
} else { } else {
// INSERT // INSERT
queryTimed(" queryTimed("
INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, RequiresServicePoint, BusinessID, TaskCategoryID) INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, RequiresServicePoint, IsServiceBell, BusinessID, TaskCategoryID)
VALUES (?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
", [ ", [
$taskTypeName, $taskTypeName,
!empty($taskTypeDescription) ? $taskTypeDescription : null, !empty($taskTypeDescription) ? $taskTypeDescription : null,
$taskTypeIcon, $taskTypeIcon,
$taskTypeColor, $taskTypeColor,
$requiresServicePoint, $requiresServicePoint,
$isServiceBell,
$businessID, $businessID,
$categoryID, $categoryID,
]); ]);