@feedmepos/mf-order-setting 0.0.95 → 0.0.96
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-rCw3DE0u.js → DisplaySystemView-BH8SkCOF.js} +4 -4
- package/dist/FoodCourtInvitationsView-3cA0Z-5m.js +383 -0
- package/dist/FoodCourtOrderSettingsView-DysrLZJD.js +294 -0
- package/dist/FoodCourtOrdersView-CbZqHIXO.js +544 -0
- package/dist/FoodCourtStallsView-CTZzPUQ6.js +635 -0
- package/dist/FoodCourtStatusView-C71y7ghx.js +113 -0
- package/dist/{KioskDevicesView-B4dgvMq_.js → KioskDevicesView-BJpbuSzp.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-B-Oi8ZLq.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-CQFpwn28.js} +7 -6
- package/dist/{KioskSettingView-DXx6wQQQ.js → KioskSettingView-CJxhMf7N.js} +3 -3
- package/dist/{KioskView-BmSHCl13.js → KioskView-BZsdRID1.js} +6 -6
- package/dist/{OrderSettingsView-9NOSAxLf.js → OrderSettingsView-gnyXaJjf.js} +10631 -10601
- package/dist/{app-y20uA-tu.js → app-CeEFBB-w.js} +4484 -3672
- package/dist/app.js +1 -1
- package/dist/dayjs.min-zBHHlxAP.js +285 -0
- package/dist/{featureFlag-GHmH1G2d.js → featureFlag-BTY_R78k.js} +1 -1
- package/dist/food-court-member-piX3gesl.js +212 -0
- package/dist/frontend/mf-order/src/api/food-court/index.d.ts +269 -0
- package/dist/frontend/mf-order/src/api/food-court/invitation.d.ts +55 -0
- package/dist/frontend/mf-order/src/app.d.ts +676 -0
- package/dist/frontend/mf-order/src/main.d.ts +676 -0
- package/dist/frontend/mf-order/src/stores/business/index.d.ts +3 -3
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +6 -0
- package/dist/frontend/mf-order/src/utils/constants/route.d.ts +4 -0
- package/dist/frontend/mf-order/src/views/food-court/FoodCourtInvitationsView.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/food-court/FoodCourtOrdersView.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/food-court/FoodCourtStallsView.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/food-court/FoodCourtStatusView.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/food-court/food-court-member.d.ts +150 -0
- package/dist/frontend/mf-order/src/views/food-court/food-court-order.d.ts +66 -0
- package/dist/frontend/mf-order/src/views/food-court/invitations/JoinFoodCourtCard.vue.d.ts +13 -0
- package/dist/frontend/mf-order/src/views/food-court/invitations/MembershipRowActions.vue.d.ts +11 -0
- package/dist/frontend/mf-order/src/views/food-court/orders/FoodCourtOrderSheet.vue.d.ts +16 -0
- package/dist/frontend/mf-order/src/views/food-court/stalls/EditStallSheet.vue.d.ts +15 -0
- package/dist/frontend/mf-order/src/views/food-court/stalls/GenerateJoinCodeSheet.vue.d.ts +21 -0
- package/dist/frontend/mf-order/src/views/food-court/stalls/StallAssignmentFields.vue.d.ts +16 -0
- package/dist/frontend/mf-order/src/views/food-court/stalls/StallRowActions.vue.d.ts +11 -0
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-CmdP_QXF.js → index-601eG3_R.js} +1 -1
- package/dist/index-BeBZTUcq.js +122 -0
- package/dist/index-BtudnkMi.js +1065 -0
- package/dist/{index-BlG6mIU4.js → index-CGiWgTn1.js} +38 -37
- package/dist/{index-wMygvJpP.js → index-D5nv3ncu.js} +2 -2
- package/dist/index-DLDihONy.js +25142 -0
- package/dist/order.dto-JM_fmWnQ.js +14842 -0
- package/dist/package/entity/food-court/food-court.do.d.ts +1 -1
- package/dist/package/entity/food-court/food-court.dto.d.ts +7 -7
- package/dist/package/entity/food-court/order-v2.dto.d.ts +4 -4
- package/dist/package/entity/order-platform/order-platform.dto.d.ts +190 -92
- package/dist/package/entity/order-setting/order-setting.do.d.ts +10 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +20 -0
- package/dist/package/entity/order-setting/queue/queue.do.d.ts +22 -0
- package/dist/package/entity/order-setting/queue/queue.dto.d.ts +7 -0
- package/dist/package/entity/queue/queue.do.d.ts +1 -0
- package/dist/package/entity/queue/queue.dto.d.ts +8 -8
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +20 -0
- package/dist/search-BAPEUu1R.js +15 -0
- package/dist/useFoodCourtContext-2p5sJMcB.js +16 -0
- package/package.json +3 -3
- package/src/api/food-court/index.ts +357 -0
- package/src/api/food-court/invitation.ts +81 -0
- package/src/locales/en-US.json +171 -2
- package/src/locales/ja-JP.json +171 -2
- package/src/locales/th-TH.json +171 -2
- package/src/locales/zh-CN.json +171 -2
- package/src/router/routes.ts +44 -0
- package/src/utils/constants/route.ts +8 -0
- package/src/views/food-court/FoodCourtInvitationsView.vue +187 -0
- package/src/views/food-court/FoodCourtOrdersView.vue +263 -0
- package/src/views/food-court/FoodCourtStallsView.vue +369 -0
- package/src/views/food-court/FoodCourtStatusView.vue +111 -0
- package/src/views/food-court/food-court-member.spec.ts +339 -0
- package/src/views/food-court/food-court-member.ts +397 -0
- package/src/views/food-court/food-court-order.spec.ts +137 -0
- package/src/views/food-court/food-court-order.ts +206 -0
- package/src/views/food-court/invitations/JoinFoodCourtCard.vue +201 -0
- package/src/views/food-court/invitations/MembershipRowActions.vue +19 -0
- package/src/views/food-court/orders/FoodCourtOrderSheet.vue +226 -0
- package/src/views/food-court/stalls/EditStallSheet.vue +91 -0
- package/src/views/food-court/stalls/GenerateJoinCodeSheet.vue +281 -0
- package/src/views/food-court/stalls/StallAssignmentFields.vue +36 -0
- package/src/views/food-court/stalls/StallRowActions.vue +31 -0
- package/src/views/order-settings/OrderSettingsView.vue +2 -4
- package/src/views/order-settings/dine-in/DineInSetting.vue +1 -4
- package/src/views/order-settings/queue/QueueSetting.vue +27 -0
- package/src/views/order-settings/reservation/ReservationSetting.vue +8 -0
- package/dist/FoodCourtOrderSettingsView-DUQXCKzB.js +0 -323
- package/dist/index-CUI1lL9F.js +0 -1347
- package/dist/order.dto-CyHtvyly.js +0 -38829
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FmSideSheet
|
|
3
|
+
:model-value="modelValue"
|
|
4
|
+
:header="t('order.foodCourt.stalls.editTitle')"
|
|
5
|
+
dismiss-away
|
|
6
|
+
:max-width="480"
|
|
7
|
+
@update:model-value="(v: boolean) => emit('update:modelValue', v)"
|
|
8
|
+
>
|
|
9
|
+
<div v-if="member" class="flex flex-col gap-5">
|
|
10
|
+
<div class="flex flex-col">
|
|
11
|
+
<span class="fm-typo-en-body-lg-600">{{ member.restaurantName || member.restaurantId }}</span>
|
|
12
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-tertiary">{{ member.restaurantId }}</span>
|
|
13
|
+
</div>
|
|
14
|
+
<StallAssignmentFields v-model:unit-no="unitNo" v-model:display-name="displayName" />
|
|
15
|
+
</div>
|
|
16
|
+
<template #side-sheet-footer>
|
|
17
|
+
<div class="flex gap-8 items-center justify-start">
|
|
18
|
+
<FmButton
|
|
19
|
+
variant="primary"
|
|
20
|
+
:label="t('order.save')"
|
|
21
|
+
size="lg"
|
|
22
|
+
:disabled="isSaving || !member"
|
|
23
|
+
@click="save"
|
|
24
|
+
/>
|
|
25
|
+
<FmButton
|
|
26
|
+
variant="secondary"
|
|
27
|
+
:label="t('order.cancel')"
|
|
28
|
+
size="lg"
|
|
29
|
+
@click="emit('update:modelValue', false)"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
</FmSideSheet>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { ref, watch } from 'vue'
|
|
38
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
39
|
+
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
40
|
+
import { FoodCourtMemberApi } from '@/api/food-court'
|
|
41
|
+
import { errorMessage, stallToSave, type MemberStallRow } from '../food-court-member'
|
|
42
|
+
import StallAssignmentFields from './StallAssignmentFields.vue'
|
|
43
|
+
|
|
44
|
+
/** Stalls › Edit: the court's stall number and display name for one stall (KDI-4919). */
|
|
45
|
+
const props = defineProps<{
|
|
46
|
+
modelValue: boolean
|
|
47
|
+
foodCourtId: string
|
|
48
|
+
member: MemberStallRow | null
|
|
49
|
+
}>()
|
|
50
|
+
const emit = defineEmits<{
|
|
51
|
+
(e: 'update:modelValue', value: boolean): void
|
|
52
|
+
(e: 'saved'): void
|
|
53
|
+
}>()
|
|
54
|
+
|
|
55
|
+
const { t } = useI18n()
|
|
56
|
+
const { showSuccess, showError } = useSnackbarFunctions()
|
|
57
|
+
|
|
58
|
+
const unitNo = ref('')
|
|
59
|
+
const displayName = ref('')
|
|
60
|
+
const isSaving = ref(false)
|
|
61
|
+
|
|
62
|
+
// Prefill on every open: the court's display name, else the outlet's own name.
|
|
63
|
+
watch(
|
|
64
|
+
() => [props.modelValue, props.member] as const,
|
|
65
|
+
([open, member]) => {
|
|
66
|
+
if (!open || !member) return
|
|
67
|
+
unitNo.value = member.unitNo ?? ''
|
|
68
|
+
displayName.value = member.displayName ?? member.restaurantName ?? ''
|
|
69
|
+
},
|
|
70
|
+
{ immediate: true }
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
async function save(): Promise<void> {
|
|
74
|
+
const member = props.member
|
|
75
|
+
if (!member || isSaving.value) return
|
|
76
|
+
isSaving.value = true
|
|
77
|
+
try {
|
|
78
|
+
await FoodCourtMemberApi.updateMember(props.foodCourtId, {
|
|
79
|
+
memberId: member.memberId,
|
|
80
|
+
stall: stallToSave(unitNo.value, displayName.value, member.restaurantName)
|
|
81
|
+
})
|
|
82
|
+
showSuccess(t('order.foodCourt.stalls.updated'))
|
|
83
|
+
emit('saved')
|
|
84
|
+
emit('update:modelValue', false)
|
|
85
|
+
} catch (e) {
|
|
86
|
+
showError(errorMessage(e))
|
|
87
|
+
} finally {
|
|
88
|
+
isSaving.value = false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FmSideSheet
|
|
3
|
+
:model-value="modelValue"
|
|
4
|
+
:header="header"
|
|
5
|
+
:dismiss-away="!created"
|
|
6
|
+
:max-width="480"
|
|
7
|
+
@update:model-value="(v: boolean) => emit('update:modelValue', v)"
|
|
8
|
+
>
|
|
9
|
+
<!--
|
|
10
|
+
Step 1: how many codes. One code may carry the stall number and display
|
|
11
|
+
name the stall joins with; several are made blank.
|
|
12
|
+
-->
|
|
13
|
+
<div v-if="!created" class="flex flex-col gap-5">
|
|
14
|
+
<span class="fm-typo-en-body-md-400 text-fm-color-typo-secondary">
|
|
15
|
+
{{
|
|
16
|
+
count > 1
|
|
17
|
+
? t('order.foodCourt.stalls.generateIntroMany')
|
|
18
|
+
: t('order.foodCourt.stalls.generateIntro')
|
|
19
|
+
}}
|
|
20
|
+
</span>
|
|
21
|
+
<FmStepperField
|
|
22
|
+
:model-value="countInput"
|
|
23
|
+
:label="t('order.foodCourt.stalls.codeCount')"
|
|
24
|
+
:helper-text="t('order.foodCourt.stalls.codeCountHint')"
|
|
25
|
+
:placeholder="String(JOIN_CODE_COUNT.min)"
|
|
26
|
+
:min="JOIN_CODE_COUNT.min"
|
|
27
|
+
:max="JOIN_CODE_COUNT.max"
|
|
28
|
+
:max-fraction-digits="0"
|
|
29
|
+
:use-grouping="false"
|
|
30
|
+
data-testid="food-court-join-code-count"
|
|
31
|
+
@update:model-value="onCountInput"
|
|
32
|
+
/>
|
|
33
|
+
<StallAssignmentFields
|
|
34
|
+
v-if="count === 1"
|
|
35
|
+
v-model:unit-no="unitNo"
|
|
36
|
+
v-model:display-name="displayName"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Step 2, one code: shown this once. -->
|
|
41
|
+
<div v-else-if="shownCodes.length === 1" class="flex flex-col gap-4">
|
|
42
|
+
<div class="flex flex-col items-center gap-3 p-6 rounded-lg bg-fm-color-neutral-gray-100">
|
|
43
|
+
<span
|
|
44
|
+
class="font-mono text-[2rem] leading-tight font-semibold tracking-[0.12em] select-all break-all text-center"
|
|
45
|
+
data-testid="food-court-join-code"
|
|
46
|
+
>
|
|
47
|
+
{{ shownCodes[0].code }}
|
|
48
|
+
</span>
|
|
49
|
+
<FmButton
|
|
50
|
+
variant="secondary"
|
|
51
|
+
prepend-icon="content_copy"
|
|
52
|
+
:label="t('order.copy')"
|
|
53
|
+
@click="copyText(shownCodes[0].code, 'order.foodCourt.stalls.joinCode')"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
<span class="fm-typo-en-body-md-600">
|
|
57
|
+
{{ t('order.foodCourt.stalls.codeExpires', { date: expiresAt }) }}
|
|
58
|
+
</span>
|
|
59
|
+
<span class="fm-typo-en-body-md-400 text-fm-color-typo-secondary">
|
|
60
|
+
{{ t('order.foodCourt.stalls.codeShareHint') }}
|
|
61
|
+
</span>
|
|
62
|
+
<span v-if="stallLine" class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">
|
|
63
|
+
{{ stallLine }}
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<!-- Step 2, several codes: each shown this once, with its own Copy, and Copy all. -->
|
|
68
|
+
<div v-else class="flex flex-col gap-4">
|
|
69
|
+
<ul class="flex flex-col px-4 rounded-lg bg-fm-color-neutral-gray-100">
|
|
70
|
+
<li
|
|
71
|
+
v-for="item in shownCodes"
|
|
72
|
+
:key="item.id"
|
|
73
|
+
class="flex items-center justify-between gap-3 py-2 border-b border-fm-color-neutral-gray-200 last:border-b-0"
|
|
74
|
+
>
|
|
75
|
+
<span
|
|
76
|
+
class="font-mono text-[1.25rem] leading-tight font-semibold tracking-[0.12em] select-all"
|
|
77
|
+
data-testid="food-court-join-code"
|
|
78
|
+
>
|
|
79
|
+
{{ item.code }}
|
|
80
|
+
</span>
|
|
81
|
+
<FmButton
|
|
82
|
+
variant="tertiary"
|
|
83
|
+
prepend-icon="content_copy"
|
|
84
|
+
:label="t('order.copy')"
|
|
85
|
+
@click="copyText(item.code, 'order.foodCourt.stalls.joinCode')"
|
|
86
|
+
/>
|
|
87
|
+
</li>
|
|
88
|
+
</ul>
|
|
89
|
+
<div>
|
|
90
|
+
<FmButton
|
|
91
|
+
variant="secondary"
|
|
92
|
+
prepend-icon="content_copy"
|
|
93
|
+
:label="t('order.foodCourt.stalls.copyAll')"
|
|
94
|
+
data-testid="food-court-join-codes-copy-all"
|
|
95
|
+
@click="copyText(copyAllText, 'order.foodCourt.stalls.joinCodes')"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
<span class="fm-typo-en-body-md-600">
|
|
99
|
+
{{ t('order.foodCourt.stalls.codeExpires', { date: expiresAt }) }}
|
|
100
|
+
</span>
|
|
101
|
+
<span class="fm-typo-en-body-md-400 text-fm-color-typo-secondary">
|
|
102
|
+
{{ t('order.foodCourt.stalls.codesShareHint') }}
|
|
103
|
+
</span>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<template #side-sheet-footer>
|
|
107
|
+
<div v-if="!created" class="flex gap-8 items-center justify-start">
|
|
108
|
+
<FmButton
|
|
109
|
+
variant="primary"
|
|
110
|
+
:label="
|
|
111
|
+
count > 1
|
|
112
|
+
? t('order.foodCourt.stalls.generateCodes', { count })
|
|
113
|
+
: t('order.foodCourt.stalls.generateCode')
|
|
114
|
+
"
|
|
115
|
+
size="lg"
|
|
116
|
+
:disabled="isCreating"
|
|
117
|
+
@click="generate"
|
|
118
|
+
/>
|
|
119
|
+
<FmButton
|
|
120
|
+
variant="secondary"
|
|
121
|
+
:label="t('order.cancel')"
|
|
122
|
+
size="lg"
|
|
123
|
+
@click="emit('update:modelValue', false)"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
<div v-else class="flex gap-8 items-center justify-start">
|
|
127
|
+
<FmButton
|
|
128
|
+
variant="primary"
|
|
129
|
+
:label="t('order.foodCourt.stalls.codeDone')"
|
|
130
|
+
size="lg"
|
|
131
|
+
@click="emit('update:modelValue', false)"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
</template>
|
|
135
|
+
</FmSideSheet>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<script setup lang="ts">
|
|
139
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
140
|
+
import dayjs from 'dayjs'
|
|
141
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
142
|
+
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
143
|
+
import { FoodCourtJoinCodeApi, type FoodCourtCreateJoinCodeRes } from '@/api/food-court'
|
|
144
|
+
import {
|
|
145
|
+
JOIN_CODE_COUNT,
|
|
146
|
+
clampJoinCodeCount,
|
|
147
|
+
errorMessage,
|
|
148
|
+
formatJoinCode,
|
|
149
|
+
joinCodeStall,
|
|
150
|
+
joinCodesCopyText
|
|
151
|
+
} from '../food-court-member'
|
|
152
|
+
import StallAssignmentFields from './StallAssignmentFields.vue'
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Stalls › Generate join codes (KDI-4915 join by code). The owner picks how
|
|
156
|
+
* many codes (1 to 50). One code may carry the stall number and display name
|
|
157
|
+
* the stall will join with; no outlet is known yet, so nothing is prefilled.
|
|
158
|
+
* Several codes are made blank, in one request, all or none. Each code is
|
|
159
|
+
* shown once, here: the service keeps only its hash. A stall redeems its code
|
|
160
|
+
* in Restaurant Operation › Food Courts, and its request then waits in the
|
|
161
|
+
* Stalls list for approval.
|
|
162
|
+
*/
|
|
163
|
+
const props = defineProps<{ modelValue: boolean; foodCourtId: string }>()
|
|
164
|
+
const emit = defineEmits<{
|
|
165
|
+
(e: 'update:modelValue', value: boolean): void
|
|
166
|
+
(e: 'created'): void
|
|
167
|
+
}>()
|
|
168
|
+
|
|
169
|
+
const { t } = useI18n()
|
|
170
|
+
const { showSuccess, showError } = useSnackbarFunctions()
|
|
171
|
+
|
|
172
|
+
const unitNo = ref('')
|
|
173
|
+
const displayName = ref('')
|
|
174
|
+
/** "How many?" as typed; null while the field is blank. */
|
|
175
|
+
const countInput = ref<number | null>(JOIN_CODE_COUNT.min)
|
|
176
|
+
const count = computed(() => clampJoinCodeCount(countInput.value))
|
|
177
|
+
const isCreating = ref(false)
|
|
178
|
+
/** Set once the codes are created: the sheet then shows them, and can't be dismissed by a stray click. */
|
|
179
|
+
const created = ref<FoodCourtCreateJoinCodeRes[] | null>(null)
|
|
180
|
+
/** Counts every open and close, so a reply to a request made before the last one is ignored. */
|
|
181
|
+
let session = 0
|
|
182
|
+
|
|
183
|
+
const header = computed(() => {
|
|
184
|
+
if (!created.value) return t('order.foodCourt.stalls.generateTitle')
|
|
185
|
+
return created.value.length > 1
|
|
186
|
+
? t('order.foodCourt.stalls.codesTitle')
|
|
187
|
+
: t('order.foodCourt.stalls.codeTitle')
|
|
188
|
+
})
|
|
189
|
+
/** Every code made, in creation order, as it is shown and shared: `ABCDE-FGHJK`. */
|
|
190
|
+
const shownCodes = computed(() =>
|
|
191
|
+
(created.value ?? []).map((item) => ({ id: item.joinCode._id, code: formatJoinCode(item.code) }))
|
|
192
|
+
)
|
|
193
|
+
const copyAllText = computed(() =>
|
|
194
|
+
joinCodesCopyText((created.value ?? []).map((item) => item.code))
|
|
195
|
+
)
|
|
196
|
+
// Codes made together share one expiry.
|
|
197
|
+
const expiresAt = computed(() => {
|
|
198
|
+
const first = created.value?.[0]
|
|
199
|
+
return first ? dayjs(first.joinCode.expiresAt).format('DD MMM YYYY, h:mm A') : ''
|
|
200
|
+
})
|
|
201
|
+
const stallLine = computed(() => {
|
|
202
|
+
const stall = created.value?.[0]?.joinCode.stall
|
|
203
|
+
const parts = [
|
|
204
|
+
stall?.unitNo ? t('order.foodCourt.invitations.stallBadge', { number: stall.unitNo }) : null,
|
|
205
|
+
stall?.displayName || null
|
|
206
|
+
].filter(Boolean)
|
|
207
|
+
return parts.length
|
|
208
|
+
? t('order.foodCourt.stalls.codeForStall', { stall: parts.join(' · ') })
|
|
209
|
+
: null
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
// Every open starts from an empty form. Closing drops the codes, which are
|
|
213
|
+
// shown once and kept nowhere after that.
|
|
214
|
+
watch(
|
|
215
|
+
() => props.modelValue,
|
|
216
|
+
(open) => {
|
|
217
|
+
session++
|
|
218
|
+
created.value = null
|
|
219
|
+
if (!open) return
|
|
220
|
+
unitNo.value = ''
|
|
221
|
+
displayName.value = ''
|
|
222
|
+
countInput.value = JOIN_CODE_COUNT.min
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Keeps "How many?" a whole number from 1 to 50; blank stays blank (1). The
|
|
228
|
+
* typed value is set first, so the clamped one re-renders the field even when
|
|
229
|
+
* it equals the value it had before the keystroke.
|
|
230
|
+
*/
|
|
231
|
+
async function onCountInput(value: number | null): Promise<void> {
|
|
232
|
+
countInput.value = value
|
|
233
|
+
if (value === null) return
|
|
234
|
+
const clamped = clampJoinCodeCount(value)
|
|
235
|
+
if (clamped === value) return
|
|
236
|
+
await nextTick()
|
|
237
|
+
countInput.value = clamped
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
async function generate(): Promise<void> {
|
|
241
|
+
if (isCreating.value) return
|
|
242
|
+
const foodCourtId = props.foodCourtId
|
|
243
|
+
const startedIn = session
|
|
244
|
+
const howMany = count.value
|
|
245
|
+
isCreating.value = true
|
|
246
|
+
try {
|
|
247
|
+
// One code is the original request, with its optional stall; several are made blank.
|
|
248
|
+
const codes =
|
|
249
|
+
howMany > 1
|
|
250
|
+
? (await FoodCourtJoinCodeApi.createJoinCodes(foodCourtId, howMany)).codes
|
|
251
|
+
: [
|
|
252
|
+
await FoodCourtJoinCodeApi.createJoinCode(
|
|
253
|
+
foodCourtId,
|
|
254
|
+
joinCodeStall(unitNo.value, displayName.value)
|
|
255
|
+
)
|
|
256
|
+
]
|
|
257
|
+
// Closed (or closed and opened again), or the portal switched court,
|
|
258
|
+
// meanwhile: the codes stay listed under their own court, where they can
|
|
259
|
+
// be cancelled.
|
|
260
|
+
if (startedIn !== session || foodCourtId !== props.foodCourtId) return
|
|
261
|
+
created.value = codes
|
|
262
|
+
} catch (e) {
|
|
263
|
+
showError(errorMessage(e))
|
|
264
|
+
} finally {
|
|
265
|
+
isCreating.value = false
|
|
266
|
+
// The list reloads after a failure too: a reply lost after the codes were
|
|
267
|
+
// stored would otherwise hide them, and a retry would make more.
|
|
268
|
+
emit('created')
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async function copyText(text: string, labelKey: string): Promise<void> {
|
|
273
|
+
const label = t(labelKey)
|
|
274
|
+
try {
|
|
275
|
+
await navigator.clipboard.writeText(text)
|
|
276
|
+
showSuccess(t('order.copiedToClipboard', { label }))
|
|
277
|
+
} catch {
|
|
278
|
+
showError(t('order.copyToClipboardFailed', { label }))
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-5">
|
|
3
|
+
<FmTextField
|
|
4
|
+
:model-value="unitNo"
|
|
5
|
+
:label="t('order.foodCourt.stalls.stallNumber')"
|
|
6
|
+
label-mark="optional"
|
|
7
|
+
:max-length="STALL_TEXT_MAX_LENGTH"
|
|
8
|
+
@update:model-value="(v: string) => emit('update:unitNo', v)"
|
|
9
|
+
/>
|
|
10
|
+
<FmTextField
|
|
11
|
+
:model-value="displayName"
|
|
12
|
+
:label="t('order.foodCourt.stalls.displayName')"
|
|
13
|
+
label-mark="optional"
|
|
14
|
+
:helper-text="t('order.foodCourt.stalls.displayNameHint')"
|
|
15
|
+
:max-length="STALL_TEXT_MAX_LENGTH"
|
|
16
|
+
@update:model-value="(v: string) => emit('update:displayName', v)"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
23
|
+
import { STALL_TEXT_MAX_LENGTH } from '../food-court-member'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The court's own stall number and display name for a stall (KDI-4919). They
|
|
27
|
+
* belong to the court only; the stall's restaurant is not changed.
|
|
28
|
+
*/
|
|
29
|
+
defineProps<{ unitNo: string; displayName: string }>()
|
|
30
|
+
const emit = defineEmits<{
|
|
31
|
+
(e: 'update:unitNo', value: string): void
|
|
32
|
+
(e: 'update:displayName', value: string): void
|
|
33
|
+
}>()
|
|
34
|
+
|
|
35
|
+
const { t } = useI18n()
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FmMenu v-if="actions.length" stop-click-propagation>
|
|
3
|
+
<template #menu-button>
|
|
4
|
+
<FmButton variant="tertiary" icon="more_vert" />
|
|
5
|
+
</template>
|
|
6
|
+
<FmMenuItem
|
|
7
|
+
v-for="action in actions"
|
|
8
|
+
:key="action"
|
|
9
|
+
:label="t(STALL_ACTION_LABEL_KEY[action])"
|
|
10
|
+
@click="emit('action', action)"
|
|
11
|
+
/>
|
|
12
|
+
</FmMenu>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { computed } from 'vue'
|
|
17
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
18
|
+
import {
|
|
19
|
+
STALL_ACTIONS,
|
|
20
|
+
STALL_ACTION_LABEL_KEY,
|
|
21
|
+
type StallAction,
|
|
22
|
+
type StallListStatus
|
|
23
|
+
} from '../food-court-member'
|
|
24
|
+
|
|
25
|
+
/** A Stalls row's ⋮ menu: what the owner can do with the stall in its current state. */
|
|
26
|
+
const props = defineProps<{ listStatus: StallListStatus }>()
|
|
27
|
+
const emit = defineEmits<{ (e: 'action', action: StallAction): void }>()
|
|
28
|
+
|
|
29
|
+
const { t } = useI18n()
|
|
30
|
+
const actions = computed(() => STALL_ACTIONS[props.listStatus] ?? [])
|
|
31
|
+
</script>
|
|
@@ -34,9 +34,7 @@ import { useSnackbarFunctions } from '@/components/snackbar'
|
|
|
34
34
|
import { useQrOrderingEnabled } from '@/composables/useQrOrderingEnabled'
|
|
35
35
|
|
|
36
36
|
const { t } = useI18n()
|
|
37
|
-
const { currentRestaurant
|
|
38
|
-
// Reservations are FeedMe-admin only during the pilot (as the Dine-in switch).
|
|
39
|
-
const isAdmin = computed(() => sessionUser.value?.role?.isAdmin ?? false)
|
|
37
|
+
const { currentRestaurant } = useCoreStore()
|
|
40
38
|
const menuStore = useMenuStore()
|
|
41
39
|
const { showError } = useSnackbarFunctions()
|
|
42
40
|
const qrEnabled = useQrOrderingEnabled()
|
|
@@ -68,7 +66,7 @@ const settingItem = computed<FmTabProps[]>(() => {
|
|
|
68
66
|
{ label: t('order.notifications'), value: 'sms' },
|
|
69
67
|
{ label: t('order.general'), value: 'general' },
|
|
70
68
|
{ label: t('order.queue'), value: 'queue' },
|
|
71
|
-
|
|
69
|
+
{ label: t('order.reservation'), value: 'reservation' }
|
|
72
70
|
]
|
|
73
71
|
})
|
|
74
72
|
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
label-placement="right"
|
|
62
62
|
/>
|
|
63
63
|
<FmSwitch
|
|
64
|
-
v-if="isAdmin"
|
|
65
64
|
v-model="dineInSetting.acceptReservation as boolean"
|
|
66
65
|
value="acceptReservation"
|
|
67
66
|
:label="t('order.acceptReservation')"
|
|
@@ -209,10 +208,8 @@ const { t } = useI18n()
|
|
|
209
208
|
|
|
210
209
|
type OrderDineInSettings = NonNullable<OrderSettingsDto['dineInSettings']>
|
|
211
210
|
|
|
212
|
-
const { currentRestaurant
|
|
211
|
+
const { currentRestaurant } = useCoreStore()
|
|
213
212
|
const restaurantStore = useRestaurantStore()
|
|
214
|
-
// Reservations are switched on per outlet by FeedMe admins during the pilot.
|
|
215
|
-
const isAdmin = computed(() => sessionUser.value?.role?.isAdmin ?? false)
|
|
216
213
|
const dineInSetting = ref<FdoRestaurantDineIn>(initDineInSetting())
|
|
217
214
|
const orderSetting = ref<OrderSettingsDto | undefined>(undefined)
|
|
218
215
|
const lastOrderBeforeCloseEnable = ref<boolean>(false)
|
|
@@ -111,6 +111,12 @@ function updateQueueSetting<K extends keyof FdoOrderQueueSettings>(
|
|
|
111
111
|
queueSettings.value[key] = value
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/** Whole minutes in the range the server accepts (0 = off, at most a day). */
|
|
115
|
+
function autoCancelMinutes(value: string | number): number {
|
|
116
|
+
const minutes = Math.floor(Number(value))
|
|
117
|
+
return Number.isFinite(minutes) ? Math.min(1440, Math.max(0, minutes)) : 0
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
function addCodeSetting() {
|
|
115
121
|
if (!queueSettings.value.codeSettings) {
|
|
116
122
|
queueSettings.value.codeSettings = []
|
|
@@ -446,6 +452,18 @@ async function saveAllowOverrideQueueCode(value: boolean) {
|
|
|
446
452
|
"
|
|
447
453
|
/>
|
|
448
454
|
</div>
|
|
455
|
+
<div class="flex flex-col gap-2">
|
|
456
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.autoCancelCalledMinutes') }}</span>
|
|
457
|
+
<FmTextField
|
|
458
|
+
type="number"
|
|
459
|
+
:model-value="queueSettings.autoCancelCalledMinutes ?? 0"
|
|
460
|
+
@update:model-value="
|
|
461
|
+
(v: string | number) =>
|
|
462
|
+
updateQueueSetting('autoCancelCalledMinutes', autoCancelMinutes(v))
|
|
463
|
+
"
|
|
464
|
+
/>
|
|
465
|
+
<span class="text-xs text-gray-500">{{ t('order.autoCancelCalledMinutesHint') }}</span>
|
|
466
|
+
</div>
|
|
449
467
|
</div>
|
|
450
468
|
|
|
451
469
|
<FmSwitch
|
|
@@ -475,6 +493,15 @@ async function saveAllowOverrideQueueCode(value: boolean) {
|
|
|
475
493
|
@update:model-value="(v) => updateQueueSetting('channels', v)"
|
|
476
494
|
/>
|
|
477
495
|
|
|
496
|
+
<!-- Absent means notify: the behaviour before this switch existed. -->
|
|
497
|
+
<FmSwitch
|
|
498
|
+
v-if="!queueSettings.disableSMS"
|
|
499
|
+
:model-value="queueSettings.notifyOnCancel ?? true"
|
|
500
|
+
@update:model-value="(v: boolean) => updateQueueSetting('notifyOnCancel', v)"
|
|
501
|
+
:label="t('order.queueNotifyOnCancel')"
|
|
502
|
+
label-placement="right"
|
|
503
|
+
/>
|
|
504
|
+
|
|
478
505
|
<FmSwitch
|
|
479
506
|
:model-value="queueSettings.printChecklist ?? false"
|
|
480
507
|
@update:model-value="(v: boolean) => updateQueueSetting('printChecklist', v)"
|
|
@@ -233,6 +233,10 @@ const reservationSettings = ref<FdoOrderReservationSettingsV2>({
|
|
|
233
233
|
const rangeSetting = ref<FdoReservationRange>(createDefaultRange(0))
|
|
234
234
|
|
|
235
235
|
const isSaving = ref(false)
|
|
236
|
+
// The outlet whose stored settings the form holds; null until a read succeeds. Save is
|
|
237
|
+
// disabled otherwise, so a failed read can't write the defaults (or the previous outlet's
|
|
238
|
+
// form) over this outlet's settings.
|
|
239
|
+
const loadedRestaurantId = ref<string | null>(null)
|
|
236
240
|
|
|
237
241
|
const optionText = ref('')
|
|
238
242
|
const selectedPreviewDay = ref(1) // Monday by default
|
|
@@ -416,6 +420,7 @@ async function readReservationSetting(): Promise<FdoOrderReservationSettingsV2>
|
|
|
416
420
|
}
|
|
417
421
|
|
|
418
422
|
async function updateReservationSetting() {
|
|
423
|
+
if (loadedRestaurantId.value !== currentRestaurant.value?._id) return
|
|
419
424
|
// Check for lead duration validation errors
|
|
420
425
|
const leadDurationError = validateLeadDurationLocal()
|
|
421
426
|
if (leadDurationError) {
|
|
@@ -466,6 +471,7 @@ async function updateReservationSetting() {
|
|
|
466
471
|
}
|
|
467
472
|
|
|
468
473
|
async function init() {
|
|
474
|
+
loadedRestaurantId.value = null
|
|
469
475
|
if (currentRestaurant.value) {
|
|
470
476
|
const restaurantId = currentRestaurant.value._id
|
|
471
477
|
const settings = await readReservationSetting()
|
|
@@ -508,6 +514,7 @@ async function init() {
|
|
|
508
514
|
|
|
509
515
|
// Reset custom mode - let the computed property determine the initial state
|
|
510
516
|
isCustomMode.value = false
|
|
517
|
+
loadedRestaurantId.value = restaurantId
|
|
511
518
|
}
|
|
512
519
|
}
|
|
513
520
|
|
|
@@ -1543,6 +1550,7 @@ function handleCopySettings(copiedSettings: Partial<FdoOrderReservationSettingsV
|
|
|
1543
1550
|
class="mr-auto"
|
|
1544
1551
|
@click="updateReservationSetting"
|
|
1545
1552
|
:loading="isSaving"
|
|
1553
|
+
:disabled="loadedRestaurantId !== currentRestaurant?._id"
|
|
1546
1554
|
/>
|
|
1547
1555
|
</div>
|
|
1548
1556
|
</div>
|