@feedmepos/mf-order-setting 0.0.105 → 0.0.106
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-aLqc6lz9.js +9068 -0
- package/dist/{FoodCourtInvitationsView-Bo174yfB.js → FoodCourtInvitationsView-B30qld2i.js} +4 -4
- package/dist/{FoodCourtOrderSettingsView-uUe53O0Z.js → FoodCourtOrderSettingsView-CWmaKgbe.js} +1 -1
- package/dist/{FoodCourtOrdersView-CxC5oGp2.js → FoodCourtOrdersView-FfrganVo.js} +4 -4
- package/dist/{FoodCourtStallsView-BEpRBmSL.js → FoodCourtStallsView-CpGZNP6p.js} +2 -2
- package/dist/{FoodCourtStatusView-DA7mdsuf.js → FoodCourtStatusView-ljQUwIwk.js} +1 -1
- package/dist/{KioskDevicesView-BY9Egk75.js → KioskDevicesView-BwDAYIhX.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-CxroxD-b.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-VidDJfGG.js} +487 -473
- package/dist/KioskSettingView-mfhi9vuf.js +1240 -0
- package/dist/{KioskView-BYL0u6kj.js → KioskView-6p5h92fk.js} +173 -167
- package/dist/{OrderSettingsView-BBHAhgE9.js → OrderSettingsView-Cf_Ye9U_.js} +11 -11
- package/dist/{RestaurantSelector.vue_vue_type_script_setup_true_lang--9bdtLE1.js → RestaurantSelector.vue_vue_type_script_setup_true_lang-TJJ3PBlq.js} +1 -1
- package/dist/{app-BV2USn83.js → app-BorqCaJT.js} +6965 -6415
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-Bp4Kgnt_.js → dayjs.min-CTTY2vkL.js} +1 -1
- package/dist/display-preview/assets/{BandBoard-DIcfXsNV.js → BandBoard-BLwgs3WX.js} +1 -1
- package/dist/display-preview/assets/{CarouselBlock-XAhTyEWB.js → CarouselBlock-CUrVSbQp.js} +1 -1
- package/dist/display-preview/assets/{CategoryBoard-DBKe18hv.js → CategoryBoard-BkvpcxHR.js} +1 -1
- package/dist/display-preview/assets/{ImageBlock-BCbnYSHq.js → ImageBlock-0UYDHTm0.js} +1 -1
- package/dist/display-preview/assets/{PickupMode-Df_TPCh8.js → PickupMode-BY4iL0BH.js} +1 -1
- package/dist/display-preview/assets/{StatusBoard-28z3bPOf.js → StatusBoard-DGEZ6hvH.js} +1 -1
- package/dist/display-preview/assets/{TextBlock-CvJKITtx.js → TextBlock-CxKwtqoO.js} +1 -1
- package/dist/display-preview/assets/{VideoBlock-Dop43wDv.js → VideoBlock-BKkxdLAd.js} +1 -1
- package/dist/display-preview/assets/{index-cqMoOpSN.js → index-B1olKQmQ.js} +2 -2
- package/dist/display-preview/assets/{pickupView-DRMVXqrc.js → pickupView-CB9fV5jD.js} +1 -1
- package/dist/display-preview/images/feedme-bg-left-image.png +0 -0
- package/dist/display-preview/index.html +1 -1
- package/dist/{featureFlag-C1uGG7u6.js → featureFlag-DFenoxmg.js} +1 -1
- package/dist/frontend/mf-order/src/api/display-system/index.d.ts +2 -2
- package/dist/frontend/mf-order/src/app.d.ts +118 -12
- package/dist/frontend/mf-order/src/composables/useDisplaySystemPermission.d.ts +5 -0
- package/dist/frontend/mf-order/src/main.d.ts +118 -12
- package/dist/frontend/mf-order/src/modules/display-system/interface.d.ts +9 -11
- package/dist/frontend/mf-order/src/modules/display-system/legacy-ods/convert.d.ts +10 -0
- package/dist/frontend/mf-order/src/modules/kiosk/deviceCount.d.ts +18 -0
- package/dist/frontend/mf-order/src/modules/order-setting/kiosk/interface.d.ts +12 -0
- package/dist/frontend/mf-order/src/modules/order-setting/kiosk/tableNumberHint.d.ts +33 -0
- package/dist/frontend/mf-order/src/stores/display-system/index.d.ts +10 -70
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +51 -0
- package/dist/frontend/mf-order/src/views/display-system/DisplayTemplateEditor.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/display-system/legacy-ods/LegacyOdsTemplateList.vue.d.ts +11 -2
- package/dist/frontend/mf-order/src/views/display-system/view-selection.d.ts +1 -2
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-0GuybwuA.js → index-BZkJr7iu.js} +1 -1
- package/dist/{index-HF3qh9qG.js → index-C4Isv-r7.js} +1 -1
- package/dist/{index-CRNutZC_.js → index-DuJOWWP8.js} +4 -4
- package/dist/{index-D0ZIByef.js → index-nUvyt9Wm.js} +1 -1
- package/dist/{index-KWOCCun9.js → index-tLkJL436.js} +2 -2
- package/dist/{order.dto-GQaBESZq.js → order.dto-nVwtcdX2.js} +6049 -5992
- package/dist/package/entity/display/mediaHosts.d.ts +4 -0
- package/dist/package/entity/food-court/order-v2.do.d.ts +667 -0
- package/dist/package/entity/food-court/order-v2.dto.d.ts +262 -0
- package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +16 -0
- package/dist/package/entity/order-platform/menu.dto.d.ts +44 -44
- package/dist/package/entity/order-setting/kiosk/kiosk.do.d.ts +52 -0
- package/dist/package/entity/order-setting/kiosk/kiosk.dto.d.ts +293 -0
- package/dist/package/entity/order-setting/order-setting.do.d.ts +42 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +174 -0
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +42 -0
- package/dist/package/entity/websocket/websocket.dto.d.ts +92 -0
- package/dist/style.css +1 -1
- package/dist/{useInternalUser-C39xpsBU.js → useInternalUser-HhxjbzGl.js} +1 -1
- package/package.json +3 -3
- package/src/api/display-system/index.ts +2 -2
- package/src/composables/useDisplaySystemPermission.spec.ts +27 -0
- package/src/composables/useDisplaySystemPermission.ts +16 -0
- package/src/locales/en-US.json +51 -17
- package/src/locales/ja-JP.json +26 -11
- package/src/locales/th-TH.json +32 -17
- package/src/locales/zh-CN.json +51 -17
- package/src/modules/display-system/interface.spec.ts +1 -32
- package/src/modules/display-system/interface.ts +7 -24
- package/src/modules/display-system/legacy-ods/convert.spec.ts +65 -0
- package/src/modules/display-system/legacy-ods/convert.ts +95 -0
- package/src/modules/display-system/legacy-ods/media.spec.ts +16 -0
- package/src/modules/kiosk/deviceCount.spec.ts +23 -0
- package/src/modules/kiosk/deviceCount.ts +21 -0
- package/src/modules/order-setting/kiosk/interface.ts +13 -0
- package/src/modules/order-setting/kiosk/tableNumberHint.spec.ts +68 -0
- package/src/modules/order-setting/kiosk/tableNumberHint.ts +71 -0
- package/src/router/display-system-permission.spec.ts +13 -0
- package/src/router/routes.ts +2 -1
- package/src/stores/display-system/index.spec.ts +104 -0
- package/src/stores/display-system/index.ts +18 -7
- package/src/stores/order-setting/mapper.ts +11 -2
- package/src/views/display-system/DisplayInspector.vue +3 -0
- package/src/views/display-system/DisplayModulePickerDialog.vue +8 -0
- package/src/views/display-system/DisplaySystemView.conversion.spec.ts +164 -0
- package/src/views/display-system/DisplaySystemView.vue +72 -26
- package/src/views/display-system/DisplayTemplateEditor.spec.ts +18 -0
- package/src/views/display-system/DisplayTemplateEditor.vue +8 -2
- package/src/views/display-system/legacy-ods/LegacyOdsTemplateList.spec.ts +44 -4
- package/src/views/display-system/legacy-ods/LegacyOdsTemplateList.vue +12 -4
- package/src/views/display-system/view-selection.spec.ts +4 -17
- package/src/views/display-system/view-selection.ts +3 -4
- package/src/views/kiosk/devices/KioskDevicesView.vue +6 -2
- package/src/views/kiosk/devices/KioskLicenseSummary.spec.ts +45 -0
- package/src/views/kiosk/devices/KioskLicenseSummary.vue +9 -2
- package/src/views/kiosk/settings/KioskSettingView.vue +140 -6
- package/vitest.config.ts +1 -0
- package/dist/DisplaySystemView-CFr9DnaD.js +0 -8926
- package/dist/KioskSettingView-DPaQ7YFV.js +0 -1124
|
@@ -15,14 +15,13 @@ export function isPosV8(posVersion: string | null | undefined): boolean {
|
|
|
15
15
|
const isKnownV7 = (outlet: Outlet) => Boolean(outlet.posVersion) && !isPosV8(outlet.posVersion)
|
|
16
16
|
|
|
17
17
|
export function availableDisplaySystemViews(options: {
|
|
18
|
-
|
|
19
|
-
canManageBrandkit: boolean
|
|
18
|
+
canManageDisplaySystem: boolean
|
|
20
19
|
outlets: Outlet[]
|
|
21
20
|
hasLegacyOdsConfigs: boolean
|
|
22
21
|
}): DisplaySystemView[] {
|
|
23
|
-
const views: DisplaySystemView[] = options.
|
|
22
|
+
const views: DisplaySystemView[] = options.canManageDisplaySystem ? ['v8'] : []
|
|
24
23
|
if (
|
|
25
|
-
options.
|
|
24
|
+
options.canManageDisplaySystem &&
|
|
26
25
|
(options.outlets.some(isKnownV7) || options.hasLegacyOdsConfigs)
|
|
27
26
|
) {
|
|
28
27
|
views.push('v7')
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
@click="filterType = 'kiosk'"
|
|
89
89
|
/>
|
|
90
90
|
</FmMenu>
|
|
91
|
-
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-tertiary">
|
|
92
|
-
{{ t(
|
|
91
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" data-testid="device-count">
|
|
92
|
+
{{ t(countLabel.key, countLabel.params) }}
|
|
93
93
|
</span>
|
|
94
94
|
</div>
|
|
95
95
|
|
|
@@ -134,6 +134,7 @@ import KioskDeviceCard from './KioskDeviceCard.vue'
|
|
|
134
134
|
import KioskLicenseSummary from './KioskLicenseSummary.vue'
|
|
135
135
|
import type { MfKioskLicenseList, MfKioskLicenseType } from '@/modules/kiosk/license'
|
|
136
136
|
import KioskStatePanel from '@/views/kiosk/KioskStatePanel.vue'
|
|
137
|
+
import { deviceCountLabel } from '@/modules/kiosk/deviceCount'
|
|
137
138
|
import { useKioskPermission } from '@/composables/useKioskPermission'
|
|
138
139
|
|
|
139
140
|
const { t } = useI18n()
|
|
@@ -163,6 +164,9 @@ defineEmits<{
|
|
|
163
164
|
(e: 'retry'): void
|
|
164
165
|
}>()
|
|
165
166
|
|
|
167
|
+
/** Devices of this outlet only; the licence totals are in the cards above. */
|
|
168
|
+
const countLabel = computed(() => deviceCountLabel(filteredDevices.value.length, props.devices.length))
|
|
169
|
+
|
|
166
170
|
const searchQuery = ref('')
|
|
167
171
|
const filterType = ref<'all' | 'tablet' | 'kiosk'>('all')
|
|
168
172
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import enUS from '@/locales/en-US.json'
|
|
5
|
+
import type { MfKioskLicense, MfKioskLicenseList } from '@/modules/kiosk/license'
|
|
6
|
+
|
|
7
|
+
// Render keys through the real en-US strings so the test reads what support sees.
|
|
8
|
+
vi.mock('@feedmepos/mf-common', () => ({
|
|
9
|
+
useI18n: () => ({
|
|
10
|
+
t: (key: string, params: Record<string, unknown> = {}) => {
|
|
11
|
+
const raw = key.split('.').reduce<any>((o, k) => o?.[k], enUS) ?? key
|
|
12
|
+
return String(raw).replace(/\{(\w+)\}/g, (_: string, p: string) => String(params[p] ?? ''))
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
}))
|
|
16
|
+
|
|
17
|
+
import KioskLicenseSummary from './KioskLicenseSummary.vue'
|
|
18
|
+
|
|
19
|
+
const exp = '2027-11-09T15:00:00.000Z'
|
|
20
|
+
function tablets(total: number, inUse: number): MfKioskLicenseList {
|
|
21
|
+
const licenses: MfKioskLicense[] = Array.from({ length: total }, (_, i) => ({
|
|
22
|
+
id: `l${i}`,
|
|
23
|
+
type: 'TABLET',
|
|
24
|
+
expiredAt: exp,
|
|
25
|
+
status: i < inUse ? 'IN_USE' : 'FREE',
|
|
26
|
+
device: i < inUse ? { machineId: `m${i}`, restaurantId: 'r1', deviceAppType: 'TABLET_APP' } : null
|
|
27
|
+
}))
|
|
28
|
+
return { verified: true, unlimited: false, tabletMayUseKioskLicense: false, licenses }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('KioskLicenseSummary (ITS-003092)', () => {
|
|
32
|
+
const stubs = { FmIcon: true }
|
|
33
|
+
|
|
34
|
+
it('after one unbind the tablet card reads 37 / 38 in use, 1 free', () => {
|
|
35
|
+
const w = mount(KioskLicenseSummary, { props: { licenses: tablets(38, 37) }, global: { stubs } })
|
|
36
|
+
expect(w.get('[data-testid="license-summary-tablet-usage"]').text()).toBe('37 / 38 in use')
|
|
37
|
+
expect(w.get('[data-testid="license-summary-tablet"]').text()).toContain('1 free')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('the total stays the licence total when every licence is used', () => {
|
|
41
|
+
const w = mount(KioskLicenseSummary, { props: { licenses: tablets(38, 38) }, global: { stubs } })
|
|
42
|
+
expect(w.get('[data-testid="license-summary-tablet-usage"]').text()).toBe('38 / 38 in use')
|
|
43
|
+
expect(w.get('[data-testid="license-summary-tablet"]').text()).toContain('0 free')
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -29,8 +29,15 @@
|
|
|
29
29
|
{{ t(card.type === 'TABLET' ? 'order.licenseSummaryTablet' : 'order.licenseSummaryKiosk') }}
|
|
30
30
|
</span>
|
|
31
31
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
<!-- In use / total, the licence service's numbers: "37 / 38" after one unbind (ITS-003092). -->
|
|
33
|
+
<span
|
|
34
|
+
class="fm-typo-en-title-sm-600 text-fm-color-typo-primary"
|
|
35
|
+
:data-testid="`license-summary-${card.type.toLowerCase()}-usage`"
|
|
36
|
+
>
|
|
37
|
+
{{ t('order.licenseSummaryInUse', { used: card.used, total: card.total }) }}
|
|
38
|
+
</span>
|
|
39
|
+
<span class="fm-typo-en-body-md-400 text-fm-color-typo-secondary">
|
|
40
|
+
{{ t('order.licenseSummaryFree', { free: card.free }) }}
|
|
34
41
|
<template v-if="card.nextExpiry">
|
|
35
42
|
· {{ t('order.licenseSummaryNextExpiry', { date: formatDate(card.nextExpiry) }) }}
|
|
36
43
|
</template>
|
|
@@ -101,7 +101,12 @@
|
|
|
101
101
|
v-show="messagesOpen.pickUp"
|
|
102
102
|
class="border p-16 fm-corner-radius-lg flex flex-col gap-8"
|
|
103
103
|
>
|
|
104
|
-
<
|
|
104
|
+
<div class="flex flex-col gap-4">
|
|
105
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.submitOrderInstruction') }}</span>
|
|
106
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">{{
|
|
107
|
+
t('order.submitOrderInstructionHint')
|
|
108
|
+
}}</span>
|
|
109
|
+
</div>
|
|
105
110
|
<FmTextField
|
|
106
111
|
v-model="kioskOrderSettingForm.dineIn.pickUp.submitOrderInstruction.payAtCounter"
|
|
107
112
|
:label="t('order.payAtCounter')"
|
|
@@ -177,7 +182,12 @@
|
|
|
177
182
|
v-show="messagesOpen.displayStand"
|
|
178
183
|
class="border p-16 fm-corner-radius-lg flex flex-col gap-8"
|
|
179
184
|
>
|
|
180
|
-
<
|
|
185
|
+
<div class="flex flex-col gap-4">
|
|
186
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.submitOrderInstruction') }}</span>
|
|
187
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">{{
|
|
188
|
+
t('order.submitOrderInstructionHint')
|
|
189
|
+
}}</span>
|
|
190
|
+
</div>
|
|
181
191
|
<FmTextField
|
|
182
192
|
v-model="
|
|
183
193
|
kioskOrderSettingForm.dineIn.displayStand.submitOrderInstruction.payAtCounter
|
|
@@ -227,7 +237,12 @@
|
|
|
227
237
|
v-show="messagesOpen.takeaway"
|
|
228
238
|
class="border p-16 fm-corner-radius-lg flex flex-col gap-8"
|
|
229
239
|
>
|
|
230
|
-
<
|
|
240
|
+
<div class="flex flex-col gap-4">
|
|
241
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.submitOrderInstruction') }}</span>
|
|
242
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">{{
|
|
243
|
+
t('order.submitOrderInstructionHint')
|
|
244
|
+
}}</span>
|
|
245
|
+
</div>
|
|
231
246
|
<FmTextField
|
|
232
247
|
v-model="kioskOrderSettingForm.takeaway.submitOrderInstruction.payAtCounter"
|
|
233
248
|
:label="t('order.payAtCounter')"
|
|
@@ -270,6 +285,68 @@
|
|
|
270
285
|
label-placement="right"
|
|
271
286
|
/>
|
|
272
287
|
</div>
|
|
288
|
+
<!-- Table Number page (display stand): whether it shows the hint below the number pad
|
|
289
|
+
(portrait kiosks only), and the hint's text per kiosk language. Shown only while
|
|
290
|
+
dine-in and display stand are on, since the kiosk opens this page only then;
|
|
291
|
+
v-show keeps the texts in the form while hidden. The text inputs follow "Limit
|
|
292
|
+
the languages shown" (Look and photos); texts of unticked languages are kept.
|
|
293
|
+
Laid out like the Takeaway messages. The texts stay editable while the switch is
|
|
294
|
+
off, so a merchant can prepare them before turning the hint on; they are saved
|
|
295
|
+
either way. -->
|
|
296
|
+
<div
|
|
297
|
+
v-show="kioskOrderSettingForm.dineIn.enabled && kioskOrderSettingForm.dineIn.displayStand.enabled"
|
|
298
|
+
class="flex flex-col gap-8"
|
|
299
|
+
>
|
|
300
|
+
<span class="fm-typo-en-title-sm-600">{{ t('order.tableNumber') }}</span>
|
|
301
|
+
<FmSwitch
|
|
302
|
+
v-model="kioskOrderSettingForm.dineIn.displayStand.hint.show"
|
|
303
|
+
:label="t('order.showHintMessage')"
|
|
304
|
+
:sublabel="t('order.showHintMessageSublabel')"
|
|
305
|
+
label-placement="right"
|
|
306
|
+
/>
|
|
307
|
+
<div class="ml-[60px] xs:ml-0 flex flex-col gap-8">
|
|
308
|
+
<span
|
|
309
|
+
v-if="!kioskOrderSettingForm.dineIn.displayStand.hint.show"
|
|
310
|
+
class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
311
|
+
data-testid="kiosk-table-number-hint-off-note"
|
|
312
|
+
>
|
|
313
|
+
{{ t('order.hintMessageOffNote') }}
|
|
314
|
+
</span>
|
|
315
|
+
<div class="flex flex-row flex-wrap items-center gap-x-8">
|
|
316
|
+
<FmButton
|
|
317
|
+
class="-ml-[12px]"
|
|
318
|
+
variant="tertiary"
|
|
319
|
+
size="md"
|
|
320
|
+
:label="t('order.customiseMessages')"
|
|
321
|
+
:append-icon="messagesOpen.tableNumber ? 'expand_less' : 'expand_more'"
|
|
322
|
+
:aria-expanded="messagesOpen.tableNumber"
|
|
323
|
+
@click="messagesOpen.tableNumber = !messagesOpen.tableNumber"
|
|
324
|
+
/>
|
|
325
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">{{
|
|
326
|
+
hasCustomTableNumberHint ? t('order.messagesCustom') : t('order.messagesDefault')
|
|
327
|
+
}}</span>
|
|
328
|
+
</div>
|
|
329
|
+
<div
|
|
330
|
+
v-show="messagesOpen.tableNumber"
|
|
331
|
+
class="border p-16 fm-corner-radius-lg flex flex-col gap-8"
|
|
332
|
+
data-testid="kiosk-table-number-hint"
|
|
333
|
+
>
|
|
334
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.hintMessage') }}</span>
|
|
335
|
+
<FmTextField
|
|
336
|
+
v-for="option in tableNumberHintOptions"
|
|
337
|
+
:key="option.code"
|
|
338
|
+
:model-value="kioskOrderSettingForm.dineIn.displayStand.hint.messages?.[option.code] ?? ''"
|
|
339
|
+
:label="option.label"
|
|
340
|
+
:placeholder="tableNumberHintPlaceholder(option.code)"
|
|
341
|
+
:max-length="KIOSK_HINT_MESSAGE_MAX_LENGTH"
|
|
342
|
+
@update:model-value="(v: string) => setTableNumberHint(option.code, v)"
|
|
343
|
+
/>
|
|
344
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary">
|
|
345
|
+
{{ t('order.customiseHintMessageEmpty') }}
|
|
346
|
+
</span>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
273
350
|
<!-- Menu Item Section -->
|
|
274
351
|
<div class="flex flex-col gap-8">
|
|
275
352
|
<span class="fm-typo-en-title-sm-600">{{ t('order.menuItem') }}</span>
|
|
@@ -644,7 +721,7 @@ import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, toRaw, w
|
|
|
644
721
|
import KioskPaymentTypeSection from './KioskPaymentTypeSection.vue'
|
|
645
722
|
import { useRestaurantStore } from '@/stores/restaurant'
|
|
646
723
|
import { FdoOfflinePaymentMethod, F_ORDER_PAYMENT_TYPE as _F_ORDER_PAYMENT_TYPE } from '@feedmepos/core/entity'
|
|
647
|
-
import { FdoEPaymentMethod } from '@entity'
|
|
724
|
+
import { FdoEPaymentMethod, KIOSK_HINT_MESSAGE_MAX_LENGTH } from '@entity'
|
|
648
725
|
import type {
|
|
649
726
|
MfKioskOrderSetting,
|
|
650
727
|
MfKioskOrderSettingForm,
|
|
@@ -654,6 +731,13 @@ import {
|
|
|
654
731
|
KIOSK_LANGUAGE_OPTIONS,
|
|
655
732
|
type KioskLanguageOption
|
|
656
733
|
} from '@/modules/order-setting/kiosk/languages'
|
|
734
|
+
import {
|
|
735
|
+
defaultTableNumberHint,
|
|
736
|
+
normalizeTableNumberHint,
|
|
737
|
+
tableNumberHintLanguages,
|
|
738
|
+
type TableNumberHintMessage
|
|
739
|
+
} from '@/modules/order-setting/kiosk/tableNumberHint'
|
|
740
|
+
import type { KioskLocale } from '@entity'
|
|
657
741
|
import { useLoading } from '@/composables/loading'
|
|
658
742
|
import { useSnackbar } from '@feedmepos/ui-library'
|
|
659
743
|
import { useCoreStore, useI18n } from '@feedmepos/mf-common'
|
|
@@ -694,7 +778,12 @@ const SECTION_TEXT: Record<KioskSettingsSection, { title: string }> = {
|
|
|
694
778
|
}
|
|
695
779
|
const coverDialogOpen = ref(false)
|
|
696
780
|
/** The "Customise messages" boxes, closed until asked for: most merchants keep the defaults. */
|
|
697
|
-
const messagesOpen = reactive({
|
|
781
|
+
const messagesOpen = reactive({
|
|
782
|
+
pickUp: false,
|
|
783
|
+
displayStand: false,
|
|
784
|
+
takeaway: false,
|
|
785
|
+
tableNumber: false
|
|
786
|
+
})
|
|
698
787
|
|
|
699
788
|
interface Props {
|
|
700
789
|
restaurantId: string
|
|
@@ -752,6 +841,44 @@ function toggleLanguage(code: string, selected: boolean) {
|
|
|
752
841
|
: current.filter((c) => c !== code)
|
|
753
842
|
}
|
|
754
843
|
|
|
844
|
+
// Table number page hint: `hint.show` is the switch (on by default); `hint.messages` is
|
|
845
|
+
// the optional custom text per language, edited under "Customise messages".
|
|
846
|
+
|
|
847
|
+
/** One input per language the kiosk can show: the ticked ones, or all when not limited. */
|
|
848
|
+
const tableNumberHintOptions = computed(() =>
|
|
849
|
+
tableNumberHintLanguages(kioskOrderSettingForm.value.languages)
|
|
850
|
+
)
|
|
851
|
+
|
|
852
|
+
/** "Custom" when a shown language has text; otherwise the kiosk's own text ("Default"). */
|
|
853
|
+
const hasCustomTableNumberHint = computed(() => {
|
|
854
|
+
const messages = kioskOrderSettingForm.value.dineIn.displayStand.hint.messages
|
|
855
|
+
return tableNumberHintOptions.value.some((option) => !!messages?.[option.code]?.trim())
|
|
856
|
+
})
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Stores the typed text; an emptied field removes its language, and no language left
|
|
860
|
+
* = null, so typing and then clearing a field leaves the form as it was loaded and the
|
|
861
|
+
* dirty check (a JSON snapshot) does not report a change.
|
|
862
|
+
*/
|
|
863
|
+
function setTableNumberHint(code: KioskLocale, text: string) {
|
|
864
|
+
const displayStand = kioskOrderSettingForm.value.dineIn.displayStand
|
|
865
|
+
const next: TableNumberHintMessage = { ...(displayStand.hint.messages ?? {}) }
|
|
866
|
+
if (text) next[code] = text
|
|
867
|
+
else delete next[code]
|
|
868
|
+
displayStand.hint.messages = Object.keys(next).length > 0 ? next : null
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* The kiosk's own text for this language, so the merchant sees what they replace.
|
|
873
|
+
* Empty while the table range is incomplete.
|
|
874
|
+
*/
|
|
875
|
+
function tableNumberHintPlaceholder(code: KioskLocale): string {
|
|
876
|
+
const { prefix, standSlotRange } = kioskOrderSettingForm.value.dineIn.displayStand
|
|
877
|
+
return (
|
|
878
|
+
defaultTableNumberHint(code, { prefix, min: standSlotRange.min, max: standSlotRange.max }) ?? ''
|
|
879
|
+
)
|
|
880
|
+
}
|
|
881
|
+
|
|
755
882
|
// Validation rules
|
|
756
883
|
const nonNegativeRule = (val: any) => {
|
|
757
884
|
if (val < 0) return t('order.nonNegativeRule')
|
|
@@ -791,7 +918,14 @@ const validKioskOrderSetting = computed<MfKioskOrderSetting | null>(() => {
|
|
|
791
918
|
min: f.dineIn.displayStand.standSlotRange.min ?? 0,
|
|
792
919
|
max: f.dineIn.displayStand.standSlotRange.max ?? 10
|
|
793
920
|
},
|
|
794
|
-
prefix: f.dineIn.displayStand.prefix ?? ''
|
|
921
|
+
prefix: f.dineIn.displayStand.prefix ?? '',
|
|
922
|
+
// Every kiosk language's text, ticked or not, without empty ones; none left =
|
|
923
|
+
// the kiosk's own text. Saved whatever `hint.show` is: the texts can be prepared
|
|
924
|
+
// while the hint is off and show once it is switched on.
|
|
925
|
+
hint: {
|
|
926
|
+
show: f.dineIn.displayStand.hint.show,
|
|
927
|
+
messages: normalizeTableNumberHint(f.dineIn.displayStand.hint.messages)
|
|
928
|
+
}
|
|
795
929
|
}
|
|
796
930
|
}
|
|
797
931
|
}
|