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' => '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 = [

View file

@ -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,
];
}

View file

@ -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,
];
}

View file

@ -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,
]);