@feedmepos/mf-order-setting 0.0.98 → 0.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DisplaySystemView-B3xrnpj3.js → DisplaySystemView-Brrexhuz.js} +4 -4
- package/dist/FoodCourtInvitationsView-wmZ1J7dm.js +402 -0
- package/dist/{FoodCourtOrderSettingsView-BR5PgIx5.js → FoodCourtOrderSettingsView-CNZs4q-x.js} +1 -1
- package/dist/{FoodCourtOrdersView-BZ8YxJ9y.js → FoodCourtOrdersView-DMvZ_Z_C.js} +4 -4
- package/dist/{FoodCourtStallsView-zZyzPDe2.js → FoodCourtStallsView-B3egjtKo.js} +3 -3
- package/dist/{FoodCourtStatusView-D42wymS-.js → FoodCourtStatusView-YdiL94wn.js} +2 -2
- package/dist/{KioskDevicesView-PuAwkC1s.js → KioskDevicesView-DsXy1LWl.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-CUriyLui.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-Byoci4Fo.js} +5 -5
- package/dist/{KioskSettingView-CuA3Lvdr.js → KioskSettingView-DqUpOq_Y.js} +3 -3
- package/dist/{KioskView-E5ePu5Zf.js → KioskView-CdRnNSU0.js} +6 -6
- package/dist/{OrderSettingsView-DZP2aZ58.js → OrderSettingsView-CjXph68w.js} +21844 -21729
- package/dist/RestaurantSelector.vue_vue_type_script_setup_true_lang-BG71fNkx.js +92 -0
- package/dist/{app-CWx14lJE.js → app-moKDIx07.js} +413 -353
- package/dist/app.js +1 -1
- package/dist/common/queue/called-sms.d.ts +45 -0
- package/dist/common/sms/sms-parts.d.ts +23 -0
- package/dist/{dayjs.min-sDkYDUoj.js → dayjs.min-DQqlQ2dX.js} +1 -1
- package/dist/{featureFlag-Dh37Fdlx.js → featureFlag-qLUdllY9.js} +1 -1
- package/dist/{food-court-member-piX3gesl.js → food-court-member-CfV5vmHz.js} +24 -20
- package/dist/frontend/mf-order/src/app.d.ts +60 -0
- package/dist/frontend/mf-order/src/main.d.ts +60 -0
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +3 -0
- package/dist/frontend/mf-order/src/views/food-court/food-court-member.d.ts +5 -0
- package/dist/frontend/mf-order/src/views/order-settings/components/RestaurantSelector.vue.d.ts +7 -1
- package/dist/frontend/mf-order/src/views/order-settings/dine-in/reservation-pos.d.ts +8 -0
- package/dist/frontend/mf-order/src/views/order-settings/queue/auto-cancel-minutes.d.ts +2 -2
- package/dist/frontend/mf-order/src/views/order-settings/queue/called-message.d.ts +31 -0
- package/dist/frontend/mf-order/src/views/order-settings/reservation/CopySettingsSheet.vue.d.ts +8 -0
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-dcHvfBC0.js → index-BDgJZqqD.js} +4 -4
- package/dist/{index-BsryfWF5.js → index-BthRwhFh.js} +1 -1
- package/dist/{index-EXn8TQyw.js → index-By3yKf-8.js} +1 -1
- package/dist/{index-EVX4Oil9.js → index-C44A5dgm.js} +1 -1
- package/dist/{index-D5bW0yrg.js → index-D5T7zJ3M.js} +1 -1
- package/dist/{index-DToeF1mu.js → index-Dy5GRKwA.js} +2 -2
- package/dist/{order.dto-DewGFVgb.js → order.dto-DvP9y_72.js} +850 -832
- package/dist/package/entity/order-setting/order-setting.do.d.ts +39 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +10 -0
- package/dist/package/entity/order-setting/queue/queue.do.d.ts +12 -0
- package/dist/package/entity/order-setting/queue/queue.dto.d.ts +3 -0
- package/dist/package/entity/order-setting/reservationV2/reservation.do.d.ts +56 -0
- package/dist/package/entity/queue/queue.dto.d.ts +2 -2
- package/dist/package/entity/reservation/reservation-pos.do.d.ts +5 -0
- package/dist/package/entity/reservation/reservation.dto.d.ts +9 -0
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +10 -0
- package/package.json +1 -1
- package/src/locales/en-US.json +16 -1
- package/src/locales/ja-JP.json +16 -1
- package/src/locales/th-TH.json +16 -1
- package/src/locales/zh-CN.json +16 -1
- package/src/views/food-court/FoodCourtInvitationsView.vue +72 -38
- package/src/views/food-court/food-court-member.spec.ts +11 -0
- package/src/views/food-court/food-court-member.ts +10 -0
- package/src/views/order-settings/OrderSettingsView.vue +5 -2
- package/src/views/order-settings/components/RestaurantSelector.vue +11 -3
- package/src/views/order-settings/dine-in/DineInSetting.vue +19 -1
- package/src/views/order-settings/dine-in/reservation-pos.spec.ts +27 -0
- package/src/views/order-settings/dine-in/reservation-pos.ts +17 -0
- package/src/views/order-settings/queue/QueueSetting.source.spec.ts +1 -1
- package/src/views/order-settings/queue/QueueSetting.vue +111 -3
- package/src/views/order-settings/queue/auto-cancel-minutes.ts +2 -4
- package/src/views/order-settings/queue/called-message.spec.ts +124 -0
- package/src/views/order-settings/queue/called-message.ts +84 -0
- package/src/views/order-settings/reservation/CopySettingsSheet.vue +4 -1
- package/src/views/order-settings/reservation/ReservationSetting.vue +54 -1
- package/dist/FoodCourtInvitationsView-D9rNuL-B.js +0 -383
package/src/locales/th-TH.json
CHANGED
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
"invitations": {
|
|
141
141
|
"title": "ศูนย์อาหาร",
|
|
142
142
|
"noRestaurant": "เลือกร้านอาหารเพื่อจัดการศูนย์อาหาร",
|
|
143
|
+
"noAccess": "คุณไม่สามารถจัดการศูนย์อาหารของร้านอาหารนี้ได้ เลือกร้านอาหารอื่นด้านบน หรือขอสิทธิ์จากเจ้าของธุรกิจ",
|
|
143
144
|
"loadFailed": "ไม่สามารถโหลดศูนย์อาหารได้",
|
|
144
145
|
"searchPlaceholder": "ค้นหาศูนย์อาหาร",
|
|
145
146
|
"noMatch": "ไม่มีศูนย์อาหารที่ตรงกับการค้นหา",
|
|
@@ -343,7 +344,8 @@
|
|
|
343
344
|
"acceptQueue": "จองคิว",
|
|
344
345
|
"acceptQueueSublabel": "ลูกค้าสามารถจองคิวผ่านแอป FeedMe",
|
|
345
346
|
"acceptReservation": "รับการจองโต๊ะ",
|
|
346
|
-
"acceptReservationSublabel": "ลูกค้าสามารถจองโต๊ะได้",
|
|
347
|
+
"acceptReservationSublabel": "ลูกค้าสามารถจองโต๊ะได้ เฉพาะพนักงาน FeedMe",
|
|
348
|
+
"acceptReservationRequiresPosVersion": "ต้องใช้ POS {min} ขึ้นไปเป็น Main POS (สาขานี้ใช้ {version})",
|
|
347
349
|
"actiavteFeedmeExpress": "เปิดใช้งาน FeedMe Express",
|
|
348
350
|
"activated": "เปิดใช้งานแล้ว",
|
|
349
351
|
"activatedDate": "วันที่เปิดใช้งาน",
|
|
@@ -625,6 +627,19 @@
|
|
|
625
627
|
"allowOverrideQueueCode": "อนุญาตให้แก้ไขรหัสคิว",
|
|
626
628
|
"disableSMS": "ปิดใช้งานการแจ้งเตือน",
|
|
627
629
|
"queueNotifyOnCancel": "แจ้งลูกค้าเมื่อคิวถูกยกเลิก",
|
|
630
|
+
"queueCalledMessage": "ข้อความ SMS เมื่อเรียกคิว",
|
|
631
|
+
"queueCalledMessageDescription": "แทนที่บรรทัดสุดท้ายของ SMS ที่ส่งเมื่อเรียกคิว ชื่อร้านและหมายเลขคิวจะแสดงเสมอ เว้นว่างไว้เพื่อใช้ข้อความเริ่มต้น",
|
|
632
|
+
"queueCalledMessagePlaceholder": "เช่น กรุณามาภายใน 15 นาที มิฉะนั้นคิวของคุณจะถูกยกเลิก",
|
|
633
|
+
"queueCalledMessageInsertMinutes": "แทรกจำนวนนาทีของการยกเลิกอัตโนมัติ",
|
|
634
|
+
"queueCalledMessageCount": "{length} ตัวอักษร · SMS {parts} ข้อความ",
|
|
635
|
+
"queueCalledMessagePreview": "ตัวอย่าง",
|
|
636
|
+
"queueCalledMessageMultiPart": "ข้อความนี้จะถูกส่งเป็น SMS {parts} ข้อความ การเรียกแต่ละครั้งจึงใช้เครดิต SMS {parts} ข้อความ",
|
|
637
|
+
"queueCalledMessageNotSevenBit": "อีโมจิ ตัวอักษรไทยหรือจีน หรือเครื่องหมายคำพูดแบบโค้ง (’) จะจำกัด SMS แต่ละข้อความไว้ที่ 70 ตัวอักษร",
|
|
638
|
+
"queueCalledMessageLinkOrPhone": "ผู้ให้บริการในมาเลเซียอาจบล็อก SMS ที่มีลิงก์หรือหมายเลขโทรศัพท์",
|
|
639
|
+
"queueCalledMessageTimerNotMentioned": "เปิดการยกเลิกอัตโนมัติอยู่ แต่ข้อความนี้ไม่ได้กล่าวถึง เพิ่ม {placeholder} เพื่อแจ้งลูกค้าว่ามีเวลาเท่าไร",
|
|
640
|
+
"queueCalledMessagePlaceholderWhileTimerOff": "ปิดการยกเลิกอัตโนมัติอยู่ ระบบจึงส่งข้อความเริ่มต้นแทนข้อความนี้",
|
|
641
|
+
"queueCalledMessageUnknownPlaceholder": "ลบ {names} ออก ตัวแทนที่รองรับมีเพียง {placeholder}",
|
|
642
|
+
"queueCalledMessageTooLong": "ข้อความ SMS เมื่อเรียกคิวต้องไม่เกิน {max} ตัวอักษร",
|
|
628
643
|
"codeSettings": "ตั้งค่ารหัสคิว",
|
|
629
644
|
"addCodeSetting": "เพิ่มการตั้งค่ารหัสคิว",
|
|
630
645
|
"current": "ปัจจุบัน",
|
package/src/locales/zh-CN.json
CHANGED
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
"invitations": {
|
|
141
141
|
"title": "美食广场",
|
|
142
142
|
"noRestaurant": "请选择一家餐厅以管理其美食广场。",
|
|
143
|
+
"noAccess": "您无法管理此餐厅的美食广场。请在上方选择其他餐厅,或向商家所有者申请权限。",
|
|
143
144
|
"loadFailed": "无法加载美食广场。",
|
|
144
145
|
"searchPlaceholder": "搜索美食广场",
|
|
145
146
|
"noMatch": "没有符合搜索条件的美食广场。",
|
|
@@ -343,7 +344,8 @@
|
|
|
343
344
|
"acceptQueue": "接受队列",
|
|
344
345
|
"acceptQueueSublabel": "客户可以在FeedMe应用中使用排队功能",
|
|
345
346
|
"acceptReservation": "接受预订",
|
|
346
|
-
"acceptReservationSublabel": "
|
|
347
|
+
"acceptReservationSublabel": "客户可以预订餐桌。仅限 FeedMe 员工",
|
|
348
|
+
"acceptReservationRequiresPosVersion": "主 POS 需为 POS {min} 或更高版本(此门店当前为 {version})",
|
|
347
349
|
"actiavteFeedmeExpress": "激活FeedMe外卖配送",
|
|
348
350
|
"activated": "已激活",
|
|
349
351
|
"activatedDate": "激活日期",
|
|
@@ -627,6 +629,19 @@
|
|
|
627
629
|
"allowOverrideQueueCode": "允许覆盖排队号码",
|
|
628
630
|
"disableSMS": "禁用通知",
|
|
629
631
|
"queueNotifyOnCancel": "取消排队时通知顾客",
|
|
632
|
+
"queueCalledMessage": "叫号短信内容",
|
|
633
|
+
"queueCalledMessageDescription": "替换叫号时所发短信的最后一行。门店名称和排队号码始终保留。留空则使用默认内容。",
|
|
634
|
+
"queueCalledMessagePlaceholder": "例如:请在15分钟内到店,否则您的排队将被取消。",
|
|
635
|
+
"queueCalledMessageInsertMinutes": "插入自动取消分钟数",
|
|
636
|
+
"queueCalledMessageCount": "{length} 个字符 · {parts} 条短信",
|
|
637
|
+
"queueCalledMessagePreview": "预览",
|
|
638
|
+
"queueCalledMessageMultiPart": "此内容将以 {parts} 条短信发送,每次叫号消耗 {parts} 条短信额度。",
|
|
639
|
+
"queueCalledMessageNotSevenBit": "表情符号、中文或泰文、或弯引号(’)会使每条短信最多只能容纳 70 个字符。",
|
|
640
|
+
"queueCalledMessageLinkOrPhone": "马来西亚的电信运营商可能会拦截包含链接或电话号码的短信。",
|
|
641
|
+
"queueCalledMessageTimerNotMentioned": "已开启自动取消,但此内容未提及。添加 {placeholder} 告诉顾客还有多长时间。",
|
|
642
|
+
"queueCalledMessagePlaceholderWhileTimerOff": "自动取消已关闭,因此将发送默认内容而非此内容。",
|
|
643
|
+
"queueCalledMessageUnknownPlaceholder": "请删除 {names}:仅支持占位符 {placeholder}。",
|
|
644
|
+
"queueCalledMessageTooLong": "叫号短信内容请不要超过 {max} 个字符。",
|
|
630
645
|
"codeSettings": "代码设置",
|
|
631
646
|
"addCodeSetting": "添加代码设置",
|
|
632
647
|
"current": "当前",
|
|
@@ -1,44 +1,68 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<!-- At least window-tall: App.vue's wrapper is only as tall as the page and clips
|
|
3
|
+
the outlet picker's dropdown (56px = the portal top bar). -->
|
|
4
|
+
<div class="min-h-[calc(100vh-56px)]">
|
|
5
|
+
<div class="py-[1.5rem]">
|
|
6
|
+
<FmPageHead :title="t('order.foodCourt.invitations.title')" :line-height="1.7" />
|
|
7
|
+
</div>
|
|
8
|
+
<div class="pb-16">
|
|
9
|
+
<RestaurantSelector :fallback-to-first="false" />
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
v-if="!restaurantId"
|
|
13
|
+
class="px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
14
|
+
>
|
|
15
|
+
{{ t('order.foodCourt.invitations.noRestaurant') }}
|
|
16
|
+
</div>
|
|
17
|
+
<div v-else-if="noAccess" class="px-[1.5rem] flex flex-col gap-3 items-start">
|
|
18
|
+
<span class="fm-typo-en-body-md-400 text-fm-color-typo-secondary">{{
|
|
19
|
+
t('order.foodCourt.invitations.noAccess')
|
|
20
|
+
}}</span>
|
|
21
|
+
<!-- Re-checks after the owner grants access. -->
|
|
22
|
+
<FmButton variant="secondary" :label="t('order.foodCourt.retry')" @click="load" />
|
|
23
|
+
</div>
|
|
24
|
+
<div v-else class="px-[1.5rem] flex flex-col gap-6">
|
|
25
|
+
<!-- Not before the first answer: it may say the user cannot manage this outlet. -->
|
|
26
|
+
<JoinFoodCourtCard
|
|
27
|
+
v-if="!isLoading || memberships.length"
|
|
28
|
+
:restaurant-id="restaurantId"
|
|
29
|
+
:restaurant-name="restaurantName"
|
|
30
|
+
/>
|
|
10
31
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<span class="fm-typo-en-body-md-400">{{
|
|
15
|
-
t('order.foodCourt.invitations.loadFailed')
|
|
32
|
+
<div class="flex flex-col gap-16">
|
|
33
|
+
<span class="fm-typo-en-title-sm-600">{{
|
|
34
|
+
t('order.foodCourt.invitations.listTitle')
|
|
16
35
|
}}</span>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class="max-w-[400px]"
|
|
23
|
-
:placeholder="t('order.foodCourt.invitations.searchPlaceholder')"
|
|
24
|
-
/>
|
|
25
|
-
<FmTable
|
|
26
|
-
v-if="isLoading || filteredMemberships.length"
|
|
27
|
-
:row-data="filteredMemberships"
|
|
28
|
-
:column-defs="columns"
|
|
29
|
-
:loading="isLoading"
|
|
30
|
-
:hide-footer="true"
|
|
31
|
-
:page-size="1000"
|
|
32
|
-
class="w-full"
|
|
33
|
-
/>
|
|
34
|
-
<div v-else class="text-center py-32 text-fm-color-typo-tertiary fm-typo-en-body-md-400">
|
|
35
|
-
{{
|
|
36
|
-
memberships.length
|
|
37
|
-
? t('order.foodCourt.invitations.noMatch')
|
|
38
|
-
: t('order.foodCourt.invitations.empty')
|
|
39
|
-
}}
|
|
36
|
+
<div v-if="loadFailed" class="flex flex-col gap-3 items-start">
|
|
37
|
+
<span class="fm-typo-en-body-md-400">{{
|
|
38
|
+
t('order.foodCourt.invitations.loadFailed')
|
|
39
|
+
}}</span>
|
|
40
|
+
<FmButton variant="secondary" :label="t('order.foodCourt.retry')" @click="load" />
|
|
40
41
|
</div>
|
|
41
|
-
|
|
42
|
+
<template v-else>
|
|
43
|
+
<FmSearch
|
|
44
|
+
v-model="searchKey"
|
|
45
|
+
class="max-w-[400px]"
|
|
46
|
+
:placeholder="t('order.foodCourt.invitations.searchPlaceholder')"
|
|
47
|
+
/>
|
|
48
|
+
<FmTable
|
|
49
|
+
v-if="isLoading || filteredMemberships.length"
|
|
50
|
+
:row-data="filteredMemberships"
|
|
51
|
+
:column-defs="columns"
|
|
52
|
+
:loading="isLoading"
|
|
53
|
+
:hide-footer="true"
|
|
54
|
+
:page-size="1000"
|
|
55
|
+
class="w-full"
|
|
56
|
+
/>
|
|
57
|
+
<div v-else class="text-center py-32 text-fm-color-typo-tertiary fm-typo-en-body-md-400">
|
|
58
|
+
{{
|
|
59
|
+
memberships.length
|
|
60
|
+
? t('order.foodCourt.invitations.noMatch')
|
|
61
|
+
: t('order.foodCourt.invitations.empty')
|
|
62
|
+
}}
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
</div>
|
|
42
66
|
</div>
|
|
43
67
|
</div>
|
|
44
68
|
</template>
|
|
@@ -54,11 +78,13 @@ import { FoodCourtInvitationApi } from '@/api/food-court/invitation'
|
|
|
54
78
|
import {
|
|
55
79
|
MEMBERSHIP_STATUS_CHIP,
|
|
56
80
|
errorMessage,
|
|
81
|
+
isRestaurantNotFound,
|
|
57
82
|
toMembershipViews,
|
|
58
83
|
type FoodCourtMembershipView
|
|
59
84
|
} from './food-court-member'
|
|
60
85
|
import MembershipRowActions from './invitations/MembershipRowActions.vue'
|
|
61
86
|
import JoinFoodCourtCard from './invitations/JoinFoodCourtCard.vue'
|
|
87
|
+
import RestaurantSelector from '../order-settings/components/RestaurantSelector.vue'
|
|
62
88
|
|
|
63
89
|
/**
|
|
64
90
|
* Restaurant Operation › Food Courts (route `/food-court/invitations`,
|
|
@@ -67,7 +93,8 @@ import JoinFoodCourtCard from './invitations/JoinFoodCourtCard.vue'
|
|
|
67
93
|
* approves the request), and lists the courts it has a row in; a joined court
|
|
68
94
|
* can be left (D1: the stall's deactivate is leave, and rejoining needs a new
|
|
69
95
|
* code). Invitations from before join codes are listed but can no longer be
|
|
70
|
-
* accepted.
|
|
96
|
+
* accepted. The outlet picker on top switches the portal's current outlet,
|
|
97
|
+
* so an account with many outlets can pick the one to join as.
|
|
71
98
|
*/
|
|
72
99
|
const { t } = useI18n()
|
|
73
100
|
const { showSuccess, showError } = useSnackbarFunctions()
|
|
@@ -81,6 +108,8 @@ const restaurantName = computed(() => currentRestaurant.value?.profile?.name ??
|
|
|
81
108
|
const memberships = ref<FoodCourtMembershipView[]>([])
|
|
82
109
|
const isLoading = ref(false)
|
|
83
110
|
const loadFailed = ref(false)
|
|
111
|
+
/** The user cannot manage the selected outlet; nothing here can act for it. */
|
|
112
|
+
const noAccess = ref(false)
|
|
84
113
|
|
|
85
114
|
const courtName = (membership: FoodCourtMembershipView): string =>
|
|
86
115
|
membership.courtName || t('order.foodCourt.invitations.unnamedCourt')
|
|
@@ -92,6 +121,7 @@ const filteredMemberships = computed(() =>
|
|
|
92
121
|
async function load(): Promise<void> {
|
|
93
122
|
const id = restaurantId.value
|
|
94
123
|
loadFailed.value = false
|
|
124
|
+
noAccess.value = false
|
|
95
125
|
if (!id) {
|
|
96
126
|
memberships.value = []
|
|
97
127
|
return
|
|
@@ -102,6 +132,10 @@ async function load(): Promise<void> {
|
|
|
102
132
|
if (id === restaurantId.value) memberships.value = rows
|
|
103
133
|
} catch (e) {
|
|
104
134
|
if (id !== restaurantId.value) return
|
|
135
|
+
if (isRestaurantNotFound(e)) {
|
|
136
|
+
noAccess.value = true
|
|
137
|
+
return
|
|
138
|
+
}
|
|
105
139
|
loadFailed.value = true
|
|
106
140
|
showError(errorMessage(e))
|
|
107
141
|
} finally {
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
clampJoinCodeCount,
|
|
14
14
|
formatCourtAddress,
|
|
15
15
|
formatJoinCode,
|
|
16
|
+
isRestaurantNotFound,
|
|
16
17
|
isWellFormedJoinCode,
|
|
17
18
|
joinCodeErrorKey,
|
|
18
19
|
joinCodeListStatus,
|
|
@@ -276,6 +277,16 @@ describe('join codes', () => {
|
|
|
276
277
|
expect(joinCodeErrorKey('JOIN_CODE_INVALID')).toBeNull()
|
|
277
278
|
expect(joinCodeErrorKey(null)).toBeNull()
|
|
278
279
|
})
|
|
280
|
+
|
|
281
|
+
it('tells "you cannot manage this outlet" apart from other load failures', () => {
|
|
282
|
+
const error = (code?: unknown) => Object.assign(new Error('Restaurant not found'), { code })
|
|
283
|
+
expect(isRestaurantNotFound(error('RESTAURANT_NOT_FOUND'))).toBe(true)
|
|
284
|
+
expect(isRestaurantNotFound(error('FOODCOURT_NOT_FOUND'))).toBe(false)
|
|
285
|
+
expect(isRestaurantNotFound(error())).toBe(false)
|
|
286
|
+
expect(isRestaurantNotFound(new Error('Restaurant not found'))).toBe(false)
|
|
287
|
+
expect(isRestaurantNotFound('RESTAURANT_NOT_FOUND')).toBe(false)
|
|
288
|
+
expect(isRestaurantNotFound(null)).toBe(false)
|
|
289
|
+
})
|
|
279
290
|
})
|
|
280
291
|
|
|
281
292
|
describe('Food Courts list, stall side', () => {
|
|
@@ -282,6 +282,16 @@ export function joinCodeErrorKey(e: unknown): string | null {
|
|
|
282
282
|
: null
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
+
/**
|
|
286
|
+
* The memberships list refused the outlet: the user cannot manage it (the
|
|
287
|
+
* backend answers 404 RESTAURANT_NOT_FOUND rather than reveal it).
|
|
288
|
+
*/
|
|
289
|
+
export function isRestaurantNotFound(e: unknown): boolean {
|
|
290
|
+
return (
|
|
291
|
+
typeof e === 'object' && e !== null && (e as { code?: unknown }).code === 'RESTAURANT_NOT_FOUND'
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
|
|
285
295
|
/** A court as the stall's Food Courts list shows its row there. */
|
|
286
296
|
export type FoodCourtMembershipStatus = 'INVITED' | 'JOINED' | 'DECLINED' | 'CANCELLED' | 'LEFT'
|
|
287
297
|
|
|
@@ -32,9 +32,11 @@ import { useI18n, useCoreStore } from '@feedmepos/mf-common'
|
|
|
32
32
|
import { useMenuStore } from '@/stores/menu/menu'
|
|
33
33
|
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
34
34
|
import { useQrOrderingEnabled } from '@/composables/useQrOrderingEnabled'
|
|
35
|
+
import { useInternalUser } from '@/composables/useInternalUser'
|
|
35
36
|
|
|
36
37
|
const { t } = useI18n()
|
|
37
38
|
const { currentRestaurant } = useCoreStore()
|
|
39
|
+
const { isInternal } = useInternalUser()
|
|
38
40
|
const menuStore = useMenuStore()
|
|
39
41
|
const { showError } = useSnackbarFunctions()
|
|
40
42
|
const qrEnabled = useQrOrderingEnabled()
|
|
@@ -66,7 +68,8 @@ const settingItem = computed<FmTabProps[]>(() => {
|
|
|
66
68
|
{ label: t('order.notifications'), value: 'sms' },
|
|
67
69
|
{ label: t('order.general'), value: 'general' },
|
|
68
70
|
{ label: t('order.queue'), value: 'queue' },
|
|
69
|
-
|
|
71
|
+
// Reservations are configured by FeedMe staff only (KDI-4039).
|
|
72
|
+
...(isInternal.value ? [{ label: t('order.reservation'), value: 'reservation' }] : [])
|
|
70
73
|
]
|
|
71
74
|
})
|
|
72
75
|
|
|
@@ -101,7 +104,7 @@ const currentComponent = computed(() => {
|
|
|
101
104
|
case 'queue':
|
|
102
105
|
return QueueSetting
|
|
103
106
|
case 'reservation':
|
|
104
|
-
return ReservationSetting
|
|
107
|
+
return isInternal.value ? ReservationSetting : DeliverySetting
|
|
105
108
|
default:
|
|
106
109
|
return DeliverySetting
|
|
107
110
|
}
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
</div>
|
|
13
13
|
<div v-if="isOpen"
|
|
14
14
|
class="absolute w-full mt-2 bg-white border border-gray-200 rounded-lg shadow-lg min-w-[350px] z-[9999]">
|
|
15
|
-
<ul class="overflow-y-auto">
|
|
16
|
-
<li class="
|
|
15
|
+
<ul class="overflow-y-auto max-h-[60vh]">
|
|
16
|
+
<li class="sticky top-0 z-10 bg-white pt-[0.5rem] px-[0.5rem]">
|
|
17
17
|
<FmSearch v-model="searchKey" :placeholder="t('order.searchRestaurant')" />
|
|
18
18
|
</li>
|
|
19
19
|
<li v-for="(option, index) in filteredRestaurants" :key="index" class="p-3 hover:bg-gray-100 cursor-pointer"
|
|
@@ -39,12 +39,20 @@ interface RestaurantItem {
|
|
|
39
39
|
value: string
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
const props = withDefaults(
|
|
43
|
+
defineProps<{
|
|
44
|
+
/** With no current outlet, name the first one (false: "No restaurant selected"). */
|
|
45
|
+
fallbackToFirst?: boolean
|
|
46
|
+
}>(),
|
|
47
|
+
{ fallbackToFirst: true }
|
|
48
|
+
)
|
|
49
|
+
|
|
42
50
|
const { restaurants, changeRestaurant, currentRestaurant } = useCoreStore()
|
|
43
51
|
const { searchKey, filter } = useSearch()
|
|
44
52
|
|
|
45
53
|
const selectedRestaurant = computed(() => {
|
|
46
54
|
let restaurant = currentRestaurant.value
|
|
47
|
-
if (!restaurant) {
|
|
55
|
+
if (!restaurant && props.fallbackToFirst) {
|
|
48
56
|
restaurant = restaurants.value[0]
|
|
49
57
|
}
|
|
50
58
|
return restaurant
|
|
@@ -61,10 +61,19 @@
|
|
|
61
61
|
label-placement="right"
|
|
62
62
|
/>
|
|
63
63
|
<FmSwitch
|
|
64
|
+
v-if="isInternal"
|
|
64
65
|
v-model="dineInSetting.acceptReservation as boolean"
|
|
65
66
|
value="acceptReservation"
|
|
67
|
+
:disabled="!reservationPosSupported && !dineInSetting.acceptReservation"
|
|
66
68
|
:label="t('order.acceptReservation')"
|
|
67
|
-
:sublabel="
|
|
69
|
+
:sublabel="
|
|
70
|
+
reservationPosSupported
|
|
71
|
+
? t('order.acceptReservationSublabel')
|
|
72
|
+
: t('order.acceptReservationRequiresPosVersion', {
|
|
73
|
+
min: RESERVATION_MIN_POS_VERSION,
|
|
74
|
+
version: currentRestaurant?.posVersion ?? '-'
|
|
75
|
+
})
|
|
76
|
+
"
|
|
68
77
|
label-placement="right"
|
|
69
78
|
/>
|
|
70
79
|
|
|
@@ -195,9 +204,11 @@ import { computed, onMounted, ref, watch } from 'vue'
|
|
|
195
204
|
import { useRestaurantStore } from '@/stores/restaurant'
|
|
196
205
|
import { useLoading } from '@/composables/loading'
|
|
197
206
|
import { useCoreStore } from '@feedmepos/mf-common'
|
|
207
|
+
import { useInternalUser } from '@/composables/useInternalUser'
|
|
198
208
|
import PaymentType from './PaymentType.vue'
|
|
199
209
|
import { utils } from '@feedmepos/core'
|
|
200
210
|
import semver from 'semver'
|
|
211
|
+
import { posSupportsReservations, RESERVATION_MIN_POS_VERSION } from './reservation-pos'
|
|
201
212
|
import { useI18n } from '@feedmepos/mf-common'
|
|
202
213
|
import { OrderSettingApi } from '@/api/order-setting'
|
|
203
214
|
import { type OrderSettingsDto } from '@entity'
|
|
@@ -209,7 +220,14 @@ const { t } = useI18n()
|
|
|
209
220
|
type OrderDineInSettings = NonNullable<OrderSettingsDto['dineInSettings']>
|
|
210
221
|
|
|
211
222
|
const { currentRestaurant } = useCoreStore()
|
|
223
|
+
// Reservations are switched on per outlet by FeedMe staff only (KDI-4039).
|
|
224
|
+
const { isInternal } = useInternalUser()
|
|
212
225
|
const restaurantStore = useRestaurantStore()
|
|
226
|
+
// Accept reservation can be turned on only for a Main POS that shows reservations;
|
|
227
|
+
// an outlet already on can still turn it off.
|
|
228
|
+
const reservationPosSupported = computed<boolean>(() =>
|
|
229
|
+
posSupportsReservations(currentRestaurant.value?.posVersion)
|
|
230
|
+
)
|
|
213
231
|
const dineInSetting = ref<FdoRestaurantDineIn>(initDineInSetting())
|
|
214
232
|
const orderSetting = ref<OrderSettingsDto | undefined>(undefined)
|
|
215
233
|
const lastOrderBeforeCloseEnable = ref<boolean>(false)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { posSupportsReservations } from './reservation-pos'
|
|
3
|
+
|
|
4
|
+
describe('posSupportsReservations', () => {
|
|
5
|
+
it('needs POS 8.0.2 or later', () => {
|
|
6
|
+
expect(posSupportsReservations('8.0.2')).toBe(true)
|
|
7
|
+
expect(posSupportsReservations('8.0.3')).toBe(true)
|
|
8
|
+
expect(posSupportsReservations('8.1.0-beta.1')).toBe(true)
|
|
9
|
+
expect(posSupportsReservations('10.0.0')).toBe(true)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('refuses v7, 8.0.1 and earlier v8 builds', () => {
|
|
13
|
+
expect(posSupportsReservations('8.0.1')).toBe(false)
|
|
14
|
+
expect(posSupportsReservations('7.12.38+1391')).toBe(false)
|
|
15
|
+
expect(posSupportsReservations('8.0.0-beta.28')).toBe(false)
|
|
16
|
+
expect(posSupportsReservations('8.0.2-beta.1')).toBe(false)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('reads loose versions and never throws', () => {
|
|
20
|
+
expect(posSupportsReservations('8.0.2 (123)')).toBe(true)
|
|
21
|
+
expect(posSupportsReservations('8')).toBe(false)
|
|
22
|
+
expect(posSupportsReservations('not a version')).toBe(false)
|
|
23
|
+
expect(posSupportsReservations('')).toBe(false)
|
|
24
|
+
expect(posSupportsReservations(null)).toBe(false)
|
|
25
|
+
expect(posSupportsReservations(undefined)).toBe(false)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import semver from 'semver'
|
|
2
|
+
|
|
3
|
+
// Reservations reach staff only from pos-v8 8.0.2 (#599): POS v7 and v8 8.0.1 have
|
|
4
|
+
// no reservation screens, so bookings taken for them would reach nobody.
|
|
5
|
+
export const RESERVATION_MIN_POS_VERSION = '8.0.2'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Whether the outlet's Main POS can show reservations. A version that does not
|
|
9
|
+
* parse as semver is read leniently ("8.0.2 (123)" → 8.0.2) and counts as
|
|
10
|
+
* unsupported when nothing can be read, rather than throwing during render.
|
|
11
|
+
* A pre-release of 8.0.2 counts as below it; none was ever built.
|
|
12
|
+
*/
|
|
13
|
+
export function posSupportsReservations(posVersion: string | null | undefined): boolean {
|
|
14
|
+
if (!posVersion) return false
|
|
15
|
+
const version = semver.parse(posVersion) ?? semver.coerce(posVersion)
|
|
16
|
+
return version ? semver.gte(version, RESERVATION_MIN_POS_VERSION) : false
|
|
17
|
+
}
|
|
@@ -25,7 +25,7 @@ describe('QueueSetting pax cap wiring (ITS-002270)', () => {
|
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
it('refuses to save a band no party can match, before the wait-estimate checks', () => {
|
|
28
|
-
expect(body('updateOrderSetting')).toMatch(/clampPaxBands\(\)\n\s+const problem
|
|
28
|
+
expect(body('updateOrderSetting')).toMatch(/clampPaxBands\(\)\n\s+const problem =\s+validatePaxBands\(\) \?\? validateEstimates\(\)/)
|
|
29
29
|
expect(body('validatePaxBands')).toMatch(/!isPaxBandValid\(setting\.pax\)/)
|
|
30
30
|
expect(body('validatePaxBands')).toMatch(/t\('order\.paxBandInvalid'/)
|
|
31
31
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, watch, onMounted } from 'vue'
|
|
2
|
+
import { ref, watch, onMounted, computed } from 'vue'
|
|
3
3
|
import { OrderSettingApi } from '@/api/order-setting'
|
|
4
4
|
import { restaurantApi, type RestaurantSettingDoc } from '@/api/restaurant-setting'
|
|
5
5
|
import { useLoading } from '@/composables/loading'
|
|
@@ -25,10 +25,18 @@ import {
|
|
|
25
25
|
isAutoCancelMinutesValid,
|
|
26
26
|
isAutoCancelOn
|
|
27
27
|
} from './auto-cancel-minutes'
|
|
28
|
+
import { CALLED_MESSAGE_MAX_LENGTH } from '@common/queue/called-sms'
|
|
29
|
+
import {
|
|
30
|
+
AUTO_CANCEL_TOKEN,
|
|
31
|
+
checkCalledMessage,
|
|
32
|
+
previewQueueCode,
|
|
33
|
+
withAutoCancelToken,
|
|
34
|
+
type CalledMessageWarning
|
|
35
|
+
} from './called-message'
|
|
28
36
|
|
|
29
37
|
const { t } = useI18n()
|
|
30
38
|
const { showSuccess, showError } = useSnackbarFunctions()
|
|
31
|
-
const { currentRestaurant } = useCoreStore()
|
|
39
|
+
const { currentRestaurant, currentCountry } = useCoreStore()
|
|
32
40
|
const { isLoading, startAsyncCallWithErr, startLoading } = useLoading()
|
|
33
41
|
|
|
34
42
|
// The DTO, not the stored document. `OrderSettingUpdateDto` omits the injected
|
|
@@ -72,7 +80,8 @@ async function readOrderSetting(): Promise<OrderSettingsDto> {
|
|
|
72
80
|
|
|
73
81
|
async function updateOrderSetting() {
|
|
74
82
|
clampPaxBands()
|
|
75
|
-
const problem =
|
|
83
|
+
const problem =
|
|
84
|
+
validatePaxBands() ?? validateEstimates() ?? validateAutoCancel() ?? validateCalledMessage()
|
|
76
85
|
if (problem) {
|
|
77
86
|
showError(problem)
|
|
78
87
|
return
|
|
@@ -132,6 +141,57 @@ function enableAutoCancel(on: boolean) {
|
|
|
132
141
|
updateQueueSetting('autoCancelCalledMinutes', on ? AUTO_CANCEL_DEFAULT_MINUTES : 0)
|
|
133
142
|
}
|
|
134
143
|
|
|
144
|
+
/** The called SMS as it would go out now, its SMS count, and what to tell the merchant about it. */
|
|
145
|
+
const calledCheck = computed(() =>
|
|
146
|
+
checkCalledMessage({
|
|
147
|
+
calledMessage: queueSettings.value.calledMessage,
|
|
148
|
+
autoCancelCalledMinutes: queueSettings.value.autoCancelCalledMinutes,
|
|
149
|
+
restaurantName: currentRestaurant.value?.profile?.name ?? '',
|
|
150
|
+
queueCode: previewQueueCode(queueSettings.value.codeSettings),
|
|
151
|
+
country: currentCountry.value
|
|
152
|
+
})
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
const calledWarningText: Record<CalledMessageWarning, () => string> = {
|
|
156
|
+
multiPart: () => t('order.queueCalledMessageMultiPart', { parts: calledCheck.value.parts }),
|
|
157
|
+
notSevenBit: () => t('order.queueCalledMessageNotSevenBit'),
|
|
158
|
+
linkOrPhone: () => t('order.queueCalledMessageLinkOrPhone'),
|
|
159
|
+
timerNotMentioned: () =>
|
|
160
|
+
t('order.queueCalledMessageTimerNotMentioned', { placeholder: AUTO_CANCEL_TOKEN }),
|
|
161
|
+
placeholderWhileTimerOff: () => t('order.queueCalledMessagePlaceholderWhileTimerOff')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function insertAutoCancelToken() {
|
|
165
|
+
updateQueueSetting('calledMessage', withAutoCancelToken(queueSettings.value.calledMessage))
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* A placeholder we cannot fill would reach the customer as typed, so it is not saved.
|
|
170
|
+
* The server does not cap the length (a schema rule would fail reads of stored
|
|
171
|
+
* settings), so the cap the textarea shows is enforced here too: the insert
|
|
172
|
+
* button can push past the textarea's own maxLength.
|
|
173
|
+
* Skipped while notifications are off: the box is hidden then, and an error
|
|
174
|
+
* about it would block every save on this page.
|
|
175
|
+
*/
|
|
176
|
+
const calledMessageError = computed((): string | null => {
|
|
177
|
+
if (queueSettings.value.disableSMS) return null
|
|
178
|
+
const names = calledCheck.value.unknownTokens
|
|
179
|
+
if (names.length) {
|
|
180
|
+
return t('order.queueCalledMessageUnknownPlaceholder', {
|
|
181
|
+
names: names.map((name) => `{{${name}}}`).join(', '),
|
|
182
|
+
placeholder: AUTO_CANCEL_TOKEN
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
if ((queueSettings.value.calledMessage?.length ?? 0) > CALLED_MESSAGE_MAX_LENGTH) {
|
|
186
|
+
return t('order.queueCalledMessageTooLong', { max: CALLED_MESSAGE_MAX_LENGTH })
|
|
187
|
+
}
|
|
188
|
+
return null
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
function validateCalledMessage(): string | null {
|
|
192
|
+
return calledMessageError.value
|
|
193
|
+
}
|
|
194
|
+
|
|
135
195
|
function validateAutoCancel(): string | null {
|
|
136
196
|
return autoCancelEnabled.value &&
|
|
137
197
|
!isAutoCancelMinutesValid(queueSettings.value.autoCancelCalledMinutes)
|
|
@@ -532,6 +592,54 @@ async function saveAllowOverrideQueueCode(value: boolean) {
|
|
|
532
592
|
label-placement="right"
|
|
533
593
|
/>
|
|
534
594
|
|
|
595
|
+
<!-- The merchant writes only the last line: the outlet and queue code stay ours. -->
|
|
596
|
+
<div v-if="!queueSettings.disableSMS" class="flex flex-col gap-2">
|
|
597
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.queueCalledMessage') }}</span>
|
|
598
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">
|
|
599
|
+
{{ t('order.queueCalledMessageDescription') }}
|
|
600
|
+
</span>
|
|
601
|
+
<FmTextarea
|
|
602
|
+
:model-value="queueSettings.calledMessage ?? ''"
|
|
603
|
+
@update:model-value="(v: string) => updateQueueSetting('calledMessage', v)"
|
|
604
|
+
:maxLength="CALLED_MESSAGE_MAX_LENGTH"
|
|
605
|
+
:placeholder="t('order.queueCalledMessagePlaceholder')"
|
|
606
|
+
/>
|
|
607
|
+
<div class="flex justify-between items-center gap-2">
|
|
608
|
+
<FmButton
|
|
609
|
+
variant="secondary"
|
|
610
|
+
:label="t('order.queueCalledMessageInsertMinutes')"
|
|
611
|
+
@click="insertAutoCancelToken"
|
|
612
|
+
/>
|
|
613
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-tertiary">
|
|
614
|
+
{{
|
|
615
|
+
t('order.queueCalledMessageCount', {
|
|
616
|
+
length: calledCheck.length,
|
|
617
|
+
parts: calledCheck.parts
|
|
618
|
+
})
|
|
619
|
+
}}
|
|
620
|
+
</span>
|
|
621
|
+
</div>
|
|
622
|
+
<span class="fm-typo-en-body-sm-600">{{ t('order.queueCalledMessagePreview') }}</span>
|
|
623
|
+
<div
|
|
624
|
+
class="rounded-lg p-3 bg-fm-color-neutral-gray-100 whitespace-pre-wrap fm-typo-en-body-md-400"
|
|
625
|
+
>
|
|
626
|
+
{{ calledCheck.preview }}
|
|
627
|
+
</div>
|
|
628
|
+
<span
|
|
629
|
+
v-for="warning in calledCheck.warnings"
|
|
630
|
+
:key="warning"
|
|
631
|
+
class="fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
|
|
632
|
+
>
|
|
633
|
+
{{ calledWarningText[warning]() }}
|
|
634
|
+
</span>
|
|
635
|
+
<span
|
|
636
|
+
v-if="calledMessageError"
|
|
637
|
+
class="fm-typo-en-body-sm-400 text-fm-color-system-error-300"
|
|
638
|
+
>
|
|
639
|
+
{{ calledMessageError }}
|
|
640
|
+
</span>
|
|
641
|
+
</div>
|
|
642
|
+
|
|
535
643
|
<FmSwitch
|
|
536
644
|
:model-value="queueSettings.printChecklist ?? false"
|
|
537
645
|
@update:model-value="(v: boolean) => updateQueueSetting('printChecklist', v)"
|
|
@@ -4,10 +4,8 @@ export const AUTO_CANCEL_DEFAULT_MINUTES = 60
|
|
|
4
4
|
export const AUTO_CANCEL_MIN_MINUTES = 1
|
|
5
5
|
export const AUTO_CANCEL_MAX_MINUTES = 1440
|
|
6
6
|
|
|
7
|
-
/** On when a positive number of minutes is stored; 0, null and absent all mean off
|
|
8
|
-
export
|
|
9
|
-
return typeof minutes === 'number' && minutes > 0
|
|
10
|
-
}
|
|
7
|
+
/** On when a positive number of minutes is stored; 0, null and absent all mean off. The server's own rule. */
|
|
8
|
+
export { isAutoCancelOn } from '@common/queue/called-sms'
|
|
11
9
|
|
|
12
10
|
/** Whether `minutes` can be saved while auto-cancel is on: a whole number from 1 to 1440. */
|
|
13
11
|
export function isAutoCancelMinutesValid(minutes: number | null | undefined): boolean {
|