@feedmepos/mf-order-setting 0.0.102 → 0.0.103
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-jnt6letY.js → DisplaySystemView-BBiZqcWq.js} +1497 -1468
- package/dist/{FoodCourtInvitationsView-DoynqFWB.js → FoodCourtInvitationsView-DwOkVs9m.js} +4 -4
- package/dist/{FoodCourtOrderSettingsView-DYZLhTHy.js → FoodCourtOrderSettingsView-C9Ag5Bsg.js} +1 -1
- package/dist/FoodCourtOrdersView-y4EwK3sn.js +1173 -0
- package/dist/{FoodCourtStallsView-CRMTt5BB.js → FoodCourtStallsView-Bi8H-yR7.js} +2 -2
- package/dist/{FoodCourtStatusView-C-b-eI-8.js → FoodCourtStatusView-jugAzTKg.js} +1 -1
- package/dist/KioskDevicesView-CYiew4X5.js +4 -0
- package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-BCvbeo7R.js +1497 -0
- package/dist/KioskSettingView-AKBiij9a.js +1124 -0
- package/dist/KioskView-zKB6mC8I.js +765 -0
- package/dist/{OrderSettingsView-BBCnekaj.js → OrderSettingsView-CoV_yX3m.js} +22064 -21635
- package/dist/{RestaurantSelector.vue_vue_type_script_setup_true_lang-DjoTyV6m.js → RestaurantSelector.vue_vue_type_script_setup_true_lang-KSMU_jGl.js} +1 -1
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/{app-Dvk30CIa.js → app-CmuI6uSl.js} +3589 -2902
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-DUFHhM7O.js → dayjs.min-B3MssMma.js} +1 -1
- package/dist/{featureFlag-BvcirzHS.js → featureFlag-CWvkPOBY.js} +123 -130
- package/dist/frontend/mf-order/src/api/food-court/index.d.ts +51 -0
- package/dist/frontend/mf-order/src/api/kiosk/index.d.ts +4 -0
- package/dist/frontend/mf-order/src/api/payment/index.d.ts +8 -0
- package/dist/frontend/mf-order/src/api/queue/index.d.ts +13 -0
- package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +9 -1
- package/dist/frontend/mf-order/src/app.d.ts +687 -0
- package/dist/frontend/mf-order/src/main.d.ts +687 -0
- package/dist/frontend/mf-order/src/modules/display-system/interface.d.ts +5 -0
- package/dist/frontend/mf-order/src/modules/kiosk/interface.d.ts +4 -0
- package/dist/frontend/mf-order/src/modules/kiosk/license.d.ts +92 -0
- package/dist/frontend/mf-order/src/modules/kiosk/outletLoad.d.ts +15 -0
- package/dist/frontend/mf-order/src/modules/kiosk/settingsSections.d.ts +24 -0
- package/dist/frontend/mf-order/src/modules/kiosk/useKioskSettings.d.ts +29 -0
- package/dist/frontend/mf-order/src/modules/payment/paymentDevice.d.ts +58 -0
- package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +67 -1
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +19 -10
- package/dist/frontend/mf-order/src/stores/payment/index.d.ts +59 -1
- package/dist/frontend/mf-order/src/views/food-court/food-court-export.d.ts +38 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDeviceCard.vue.d.ts +3 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDevicesView.vue.d.ts +7 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicenseSummary.vue.d.ts +7 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicensesView.vue.d.ts +6 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskOtpDialog.vue.d.ts +3 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskPaymentDeviceCard.vue.d.ts +17 -0
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskSettingView.vue.d.ts +5 -2
- package/dist/frontend/mf-order/src/views/order-settings/pickup/PickUpSettingDialogContent.vue.d.ts +0 -9
- package/dist/frontend/mf-order/src/views/order-settings/pos-status/PosOrderingStatus.vue.d.ts +17 -0
- package/dist/frontend/mf-order/src/views/order-settings/pos-status/pos-status.d.ts +44 -0
- package/dist/frontend/mf-order/src/views/order-settings/queue/called-message.d.ts +1 -0
- package/dist/frontend/mf-order/src/views/order-settings/queue/phone-join-mode.d.ts +25 -0
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-C4n5H7t3.js → index-BQa8AudZ.js} +3 -3
- package/dist/index-CMOvrim4.js +147 -0
- package/dist/{index-CW4VlFWz.js → index-D5qh2_4b.js} +1 -1
- package/dist/{index-C5n6lil6.js → index-Dup6kWLX.js} +6 -6
- package/dist/{index-CGxCWKHB.js → index-wuFIsXHT.js} +188 -179
- package/dist/{order.dto-Cb_gh3iB.js → order.dto-BD9raQG5.js} +2782 -2735
- package/dist/package/entity/display/blocks.d.ts +12 -2
- package/dist/package/entity/marketing/marketing.dto.d.ts +18 -18
- package/dist/package/entity/order-platform/external/reconciliation/external-reconciliation.do.d.ts +24 -24
- package/dist/package/entity/order-platform/menu.dto.d.ts +20 -20
- package/dist/package/entity/order-setting/order-setting.do.d.ts +10 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +26 -0
- package/dist/package/entity/order-setting/queue/queue.do.d.ts +23 -0
- package/dist/package/entity/order-setting/queue/queue.dto.d.ts +14 -0
- package/dist/package/entity/queue/queue.do.d.ts +153 -0
- package/dist/package/entity/queue/queue.dto.d.ts +221 -2
- package/dist/package/entity/queue/queue.enum.d.ts +5 -0
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +20 -0
- package/dist/style.css +1 -1
- package/dist/{index-ILnighyU.js → useInternalUser-CHtaur9A.js} +93 -81
- package/package.json +2 -1
- package/src/api/food-court/index.ts +63 -0
- package/src/api/kiosk/index.ts +8 -0
- package/src/api/payment/index.ts +18 -1
- package/src/api/queue/index.ts +39 -0
- package/src/api/restaurant-setting/index.ts +14 -0
- package/src/locales/en-US.json +197 -26
- package/src/locales/ja-JP.json +193 -23
- package/src/locales/th-TH.json +193 -21
- package/src/locales/zh-CN.json +197 -23
- package/src/modules/display-system/interface.spec.ts +26 -1
- package/src/modules/display-system/interface.ts +20 -0
- package/src/modules/kiosk/interface.ts +4 -0
- package/src/modules/kiosk/license.spec.ts +167 -0
- package/src/modules/kiosk/license.ts +175 -0
- package/src/modules/kiosk/outletLoad.spec.ts +25 -0
- package/src/modules/kiosk/outletLoad.ts +19 -0
- package/src/modules/kiosk/settingsSections.spec.ts +85 -0
- package/src/modules/kiosk/settingsSections.ts +82 -0
- package/src/modules/kiosk/useKioskSettings.spec.ts +157 -0
- package/src/modules/kiosk/useKioskSettings.ts +61 -0
- package/src/modules/payment/paymentDevice.spec.ts +175 -0
- package/src/modules/payment/paymentDevice.ts +156 -0
- package/src/stores/kiosk/index.ts +16 -1
- package/src/stores/kiosk/mapper.ts +2 -0
- package/src/stores/order-setting/index.spec.ts +83 -0
- package/src/stores/order-setting/index.ts +49 -27
- package/src/stores/payment/index.spec.ts +86 -0
- package/src/stores/payment/index.ts +48 -2
- package/src/views/display-system/DisplayInspector.vue +17 -8
- package/src/views/display-system/DisplayTemplateEditor.vue +3 -1
- package/src/views/food-court/FoodCourtOrdersView.vue +46 -1
- package/src/views/food-court/food-court-export.spec.ts +151 -0
- package/src/views/food-court/food-court-export.ts +283 -0
- package/src/views/kiosk/KioskStatePanel.vue +2 -2
- package/src/views/kiosk/KioskView.vue +219 -82
- package/src/views/kiosk/devices/KioskDeviceCard.vue +148 -23
- package/src/views/kiosk/devices/KioskDevicesView.vue +48 -10
- package/src/views/kiosk/devices/KioskLicenseSummary.vue +79 -0
- package/src/views/kiosk/devices/KioskLicensesView.vue +152 -0
- package/src/views/kiosk/devices/KioskOtpDialog.vue +41 -1
- package/src/views/kiosk/devices/KioskPaymentDeviceCard.spec.ts +97 -0
- package/src/views/kiosk/devices/KioskPaymentDeviceCard.vue +221 -0
- package/src/views/kiosk/settings/KioskPaymentTypeSection.vue +1 -1
- package/src/views/kiosk/settings/KioskSettingView.vue +702 -419
- package/src/views/order-settings/delivery/DeliverySetting.vue +4 -0
- package/src/views/order-settings/dine-in/DineInSetting.vue +4 -0
- package/src/views/order-settings/pickup/PickUpSetting.vue +4 -4
- package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +0 -23
- package/src/views/order-settings/pos-status/PosOrderingStatus.spec.ts +207 -0
- package/src/views/order-settings/pos-status/PosOrderingStatus.vue +209 -0
- package/src/views/order-settings/pos-status/pos-status.spec.ts +103 -0
- package/src/views/order-settings/pos-status/pos-status.ts +86 -0
- package/src/views/order-settings/queue/QueueSetting.source.spec.ts +43 -0
- package/src/views/order-settings/queue/QueueSetting.vue +289 -15
- package/src/views/order-settings/queue/called-message.spec.ts +29 -1
- package/src/views/order-settings/queue/called-message.ts +18 -0
- package/src/views/order-settings/queue/phone-join-mode.spec.ts +90 -0
- package/src/views/order-settings/queue/phone-join-mode.ts +49 -0
- package/dist/FoodCourtOrdersView-CAPOycT3.js +0 -544
- package/dist/KioskDevicesView-B0U9JxRl.js +0 -4
- package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-V3ai4FVI.js +0 -937
- package/dist/KioskSettingView-rdom_aS8.js +0 -880
- package/dist/KioskView-DOON9zR6.js +0 -516
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskDisplayStandSection.vue.d.ts +0 -10
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskInstructionSection.vue.d.ts +0 -15
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskPickAtCounterSection.vue.d.ts +0 -10
- package/dist/index-CaHG3M7C.js +0 -135
- package/src/views/kiosk/settings/KioskDisplayStandSection.vue +0 -189
- package/src/views/kiosk/settings/KioskInstructionSection.vue +0 -40
- package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +0 -68
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div class="flex flex-col gap-4">
|
|
4
|
-
|
|
4
|
+
<!-- Stacks on a phone (xs) so the Bind button keeps its full label. -->
|
|
5
|
+
<div class="flex flex-row items-center justify-between gap-12 xs:flex-col xs:items-start">
|
|
5
6
|
<div class="flex flex-col gap-2">
|
|
6
7
|
<span class="fm-typo-en-title-sm-600 block"> {{ t('order.kioskDisplay') }} </span>
|
|
7
|
-
<span class="fm-typo-en-body-md-400 block">
|
|
8
|
+
<span class="fm-typo-en-body-md-400 block text-fm-color-typo-secondary">
|
|
9
|
+
{{ t('order.kioskDisplayDescription') }}
|
|
10
|
+
</span>
|
|
8
11
|
</div>
|
|
9
12
|
<FmButton
|
|
10
13
|
v-if="canBindDevice"
|
|
14
|
+
class="shrink-0"
|
|
11
15
|
variant="primary"
|
|
12
16
|
:label="t('order.bindDevice')"
|
|
13
17
|
size="md"
|
|
@@ -25,6 +29,14 @@
|
|
|
25
29
|
:message="t('order.deviceAccessDeniedMessage')"
|
|
26
30
|
/>
|
|
27
31
|
|
|
32
|
+
<!-- First load of this outlet's devices -->
|
|
33
|
+
<KioskStatePanel
|
|
34
|
+
v-else-if="loading && devices.length === 0"
|
|
35
|
+
icon="hourglass_empty"
|
|
36
|
+
:title="t('order.devicesLoading')"
|
|
37
|
+
message=""
|
|
38
|
+
/>
|
|
39
|
+
|
|
28
40
|
<!-- Any other load failure -->
|
|
29
41
|
<KioskStatePanel
|
|
30
42
|
v-else-if="loadError === 'error'"
|
|
@@ -41,6 +53,9 @@
|
|
|
41
53
|
</KioskStatePanel>
|
|
42
54
|
|
|
43
55
|
<template v-else>
|
|
56
|
+
<!-- Kiosk and tablet licence summary (business-wide) -->
|
|
57
|
+
<KioskLicenseSummary :licenses="licenses" />
|
|
58
|
+
|
|
44
59
|
<!-- Search and Filter Bar -->
|
|
45
60
|
<div class="flex items-center gap-3 flex-wrap">
|
|
46
61
|
<FmSearch
|
|
@@ -78,25 +93,34 @@
|
|
|
78
93
|
</span>
|
|
79
94
|
</div>
|
|
80
95
|
|
|
81
|
-
<!-- Device Cards -->
|
|
82
|
-
<div class="grid grid-cols-2 gap-
|
|
96
|
+
<!-- Device Cards: two columns, one on a phone (xs) -->
|
|
97
|
+
<div class="grid grid-cols-2 xs:grid-cols-1 gap-8 py-8">
|
|
83
98
|
<KioskDeviceCard
|
|
84
99
|
v-for="device in filteredDevices"
|
|
85
100
|
:key="device.machineId"
|
|
86
101
|
:device="device"
|
|
102
|
+
:license-type="device.licenseId ? licenseTypeById.get(device.licenseId) : undefined"
|
|
87
103
|
/>
|
|
88
104
|
<div
|
|
89
105
|
v-if="filteredDevices.length === 0 && devices.length > 0"
|
|
90
|
-
class="text-center py-8 text-fm-color-typo-
|
|
106
|
+
class="text-center py-8 text-fm-color-typo-secondary fm-typo-en-body-md-400 col-span-full"
|
|
91
107
|
>
|
|
92
108
|
{{ t('order.noDevicesMatch') }}
|
|
93
109
|
</div>
|
|
94
|
-
<
|
|
110
|
+
<KioskStatePanel
|
|
95
111
|
v-if="devices.length === 0"
|
|
96
|
-
|
|
112
|
+
icon="devices"
|
|
113
|
+
:title="t('order.noDevicesBoundTitle')"
|
|
114
|
+
:message="t('order.noDevicesBound')"
|
|
97
115
|
>
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
<FmButton
|
|
117
|
+
v-if="canBindDevice"
|
|
118
|
+
variant="primary"
|
|
119
|
+
:label="t('order.bindDevice')"
|
|
120
|
+
prepend-icon="link"
|
|
121
|
+
@click="$emit('requestOtp')"
|
|
122
|
+
/>
|
|
123
|
+
</KioskStatePanel>
|
|
100
124
|
</div>
|
|
101
125
|
</template>
|
|
102
126
|
</div>
|
|
@@ -107,6 +131,8 @@ import type { MfKioskDevice } from '@/modules/kiosk/interface'
|
|
|
107
131
|
import { useI18n } from '@feedmepos/mf-common'
|
|
108
132
|
import { computed, ref } from 'vue'
|
|
109
133
|
import KioskDeviceCard from './KioskDeviceCard.vue'
|
|
134
|
+
import KioskLicenseSummary from './KioskLicenseSummary.vue'
|
|
135
|
+
import type { MfKioskLicenseList, MfKioskLicenseType } from '@/modules/kiosk/license'
|
|
110
136
|
import KioskStatePanel from '@/views/kiosk/KioskStatePanel.vue'
|
|
111
137
|
import { useKioskPermission } from '@/composables/useKioskPermission'
|
|
112
138
|
|
|
@@ -115,11 +141,23 @@ const { canBindDevice } = useKioskPermission()
|
|
|
115
141
|
|
|
116
142
|
interface Props {
|
|
117
143
|
devices: MfKioskDevice[]
|
|
144
|
+
/** The business's licences; null when they could not be loaded. */
|
|
145
|
+
licenses?: MfKioskLicenseList | null
|
|
118
146
|
/** Why the device list failed to load, if at all. 'forbidden' === HTTP 403. */
|
|
119
147
|
loadError?: 'forbidden' | 'error' | null
|
|
148
|
+
/** True while the device list is loading; an empty list then means "not loaded yet". */
|
|
149
|
+
loading?: boolean
|
|
120
150
|
}
|
|
121
151
|
|
|
122
|
-
const props = withDefaults(defineProps<Props>(), { loadError: null })
|
|
152
|
+
const props = withDefaults(defineProps<Props>(), { loadError: null, licenses: null, loading: false })
|
|
153
|
+
|
|
154
|
+
/** Licence id -> type, so a card can warn when a tablet holds a kiosk licence. */
|
|
155
|
+
const licenseTypeById = computed(
|
|
156
|
+
() =>
|
|
157
|
+
new Map<string, MfKioskLicenseType>(
|
|
158
|
+
(props.licenses?.licenses ?? []).map((l) => [l.id, l.type])
|
|
159
|
+
)
|
|
160
|
+
)
|
|
123
161
|
defineEmits<{
|
|
124
162
|
(e: 'requestOtp'): void
|
|
125
163
|
(e: 'retry'): void
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-2">
|
|
3
|
+
<div
|
|
4
|
+
v-if="!licenses || !licenses.verified"
|
|
5
|
+
class="border fm-corner-radius-lg p-12 flex items-center gap-2 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
6
|
+
data-testid="license-summary-error"
|
|
7
|
+
>
|
|
8
|
+
<FmIcon name="info" />
|
|
9
|
+
{{ t('order.licenseLoadError') }}
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
v-else-if="licenses.unlimited"
|
|
13
|
+
class="border fm-corner-radius-lg p-12 flex items-center gap-2 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
14
|
+
data-testid="license-summary-unlimited"
|
|
15
|
+
>
|
|
16
|
+
<FmIcon name="all_inclusive" />
|
|
17
|
+
{{ t('order.licenseSummaryUnlimited') }}
|
|
18
|
+
</div>
|
|
19
|
+
<div v-else class="grid grid-cols-2 xs:grid-cols-1 gap-8">
|
|
20
|
+
<div
|
|
21
|
+
v-for="card in cards"
|
|
22
|
+
:key="card.type"
|
|
23
|
+
class="border fm-corner-radius-lg p-12 flex flex-col gap-1"
|
|
24
|
+
:data-testid="`license-summary-${card.type.toLowerCase()}`"
|
|
25
|
+
>
|
|
26
|
+
<div class="flex items-center gap-2">
|
|
27
|
+
<FmIcon :name="card.type === 'TABLET' ? 'tablet' : 'point_of_sale'" />
|
|
28
|
+
<span class="fm-typo-en-body-md-600 text-fm-color-typo-primary">
|
|
29
|
+
{{ t(card.type === 'TABLET' ? 'order.licenseSummaryTablet' : 'order.licenseSummaryKiosk') }}
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
<span class="fm-typo-en-body-md-400 text-fm-color-typo-primary">
|
|
33
|
+
{{ t('order.licenseSummaryUsage', { used: card.used, total: card.total, free: card.free }) }}
|
|
34
|
+
<template v-if="card.nextExpiry">
|
|
35
|
+
· {{ t('order.licenseSummaryNextExpiry', { date: formatDate(card.nextExpiry) }) }}
|
|
36
|
+
</template>
|
|
37
|
+
</span>
|
|
38
|
+
<span
|
|
39
|
+
v-if="card.free === 0"
|
|
40
|
+
class="fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
|
|
41
|
+
>
|
|
42
|
+
{{ t('order.licenseSummaryNoFree') }}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<span
|
|
47
|
+
v-if="licenses?.verified && !licenses.unlimited"
|
|
48
|
+
class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
49
|
+
>
|
|
50
|
+
{{ t('order.licenseSharedNote') }}
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { computed } from 'vue'
|
|
56
|
+
import dayjs from 'dayjs'
|
|
57
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
58
|
+
import { summariseLicenses, type MfKioskLicenseList } from '@/modules/kiosk/license'
|
|
59
|
+
|
|
60
|
+
const { t } = useI18n()
|
|
61
|
+
|
|
62
|
+
const props = defineProps<{
|
|
63
|
+
/** Null when the licence list could not be loaded; `verified: false` when the licence service was down. */
|
|
64
|
+
licenses: MfKioskLicenseList | null
|
|
65
|
+
}>()
|
|
66
|
+
|
|
67
|
+
const cards = computed(() =>
|
|
68
|
+
props.licenses
|
|
69
|
+
? [
|
|
70
|
+
summariseLicenses(props.licenses.licenses, 'KIOSK'),
|
|
71
|
+
summariseLicenses(props.licenses.licenses, 'TABLET')
|
|
72
|
+
]
|
|
73
|
+
: []
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
function formatDate(date: Date): string {
|
|
77
|
+
return dayjs(date).format('DD MMM YYYY')
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col gap-4">
|
|
3
|
+
<span class="fm-typo-en-title-sm-600 block">{{ t('order.licensesTab') }}</span>
|
|
4
|
+
<KioskLicenseSummary :licenses="licenses" />
|
|
5
|
+
<template v-if="licenses?.verified">
|
|
6
|
+
<template v-if="rows.length">
|
|
7
|
+
<FmTable
|
|
8
|
+
:row-data="rows"
|
|
9
|
+
:column-defs="columns"
|
|
10
|
+
:hide-footer="true"
|
|
11
|
+
:page-size="1000"
|
|
12
|
+
class="w-full xs:hidden"
|
|
13
|
+
data-testid="license-table"
|
|
14
|
+
/>
|
|
15
|
+
<!-- On a phone the table drops its column labels, so each licence is a small
|
|
16
|
+
labelled card instead. -->
|
|
17
|
+
<div class="hidden xs:flex flex-col gap-8" data-testid="license-list">
|
|
18
|
+
<div
|
|
19
|
+
v-for="license in rows"
|
|
20
|
+
:key="license.id"
|
|
21
|
+
class="border fm-corner-radius-lg p-12 flex flex-col gap-8"
|
|
22
|
+
>
|
|
23
|
+
<div class="flex items-center justify-between gap-8">
|
|
24
|
+
<div class="flex flex-col min-w-0">
|
|
25
|
+
<span class="fm-typo-en-body-md-600">{{ typeLabel(license.type) }}</span>
|
|
26
|
+
<span class="fm-typo-en-body-sm-400 text-fm-color-typo-secondary font-mono">
|
|
27
|
+
{{ shortLicenseId(license.id) }}
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
<FmChip
|
|
31
|
+
:variant="licenseRowChip(license).variant"
|
|
32
|
+
:label="t(licenseRowChip(license).labelKey, licenseRowChip(license).params)"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="grid grid-cols-[auto_1fr] gap-x-12 gap-y-4 fm-typo-en-body-sm-400">
|
|
36
|
+
<span class="text-fm-color-typo-secondary">{{ t('order.licenseColumnDevice') }}</span>
|
|
37
|
+
<component :is="deviceCell(license)" v-if="license.device" class="min-w-0 break-words" />
|
|
38
|
+
<span v-else>-</span>
|
|
39
|
+
<span class="text-fm-color-typo-secondary">{{ t('order.licenseColumnOutlet') }}</span>
|
|
40
|
+
<span class="min-w-0 break-words">{{ license.device?.restaurantName || '-' }}</span>
|
|
41
|
+
<span class="text-fm-color-typo-secondary">{{ t('order.licenseColumnExpires') }}</span>
|
|
42
|
+
<span>{{ formatDate(license.expiredAt) }}</span>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
<div
|
|
48
|
+
v-else
|
|
49
|
+
class="text-center py-32 text-fm-color-typo-secondary fm-typo-en-body-md-400"
|
|
50
|
+
>
|
|
51
|
+
{{ t('order.licensesEmpty') }}
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
<script setup lang="ts">
|
|
57
|
+
import { computed, h } from 'vue'
|
|
58
|
+
import dayjs from 'dayjs'
|
|
59
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
60
|
+
import { components, type ColumnDef } from '@feedmepos/ui-library'
|
|
61
|
+
import {
|
|
62
|
+
licenseMismatchKey,
|
|
63
|
+
licenseRowChip,
|
|
64
|
+
shortLicenseId,
|
|
65
|
+
type MfKioskLicense,
|
|
66
|
+
type MfKioskLicenseList
|
|
67
|
+
} from '@/modules/kiosk/license'
|
|
68
|
+
import KioskLicenseSummary from './KioskLicenseSummary.vue'
|
|
69
|
+
|
|
70
|
+
const { t } = useI18n()
|
|
71
|
+
|
|
72
|
+
const props = defineProps<{
|
|
73
|
+
licenses: MfKioskLicenseList | null
|
|
74
|
+
}>()
|
|
75
|
+
|
|
76
|
+
/** In use first, then free, then expired; within each, the one ending soonest first. */
|
|
77
|
+
const STATUS_ORDER = { IN_USE: 0, FREE: 1, EXPIRED: 2 } as const
|
|
78
|
+
|
|
79
|
+
const rows = computed<MfKioskLicense[]>(() =>
|
|
80
|
+
[...(props.licenses?.licenses ?? [])].sort(
|
|
81
|
+
(a, b) =>
|
|
82
|
+
STATUS_ORDER[a.status] - STATUS_ORDER[b.status] ||
|
|
83
|
+
a.expiredAt.localeCompare(b.expiredAt)
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
function formatDate(date: string): string {
|
|
88
|
+
return dayjs(date).format('DD MMM YYYY')
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function typeLabel(type: MfKioskLicense['type']): string {
|
|
92
|
+
return t(type === 'TABLET' ? 'order.licenseTypeTablet' : 'order.licenseTypeKiosk')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function deviceCell(license: MfKioskLicense) {
|
|
96
|
+
if (!license.device) return '-'
|
|
97
|
+
const mismatch = licenseMismatchKey(license.device.deviceAppType, license.type)
|
|
98
|
+
const kind = license.device.deviceAppType === 'TABLET_APP' ? 'licenseTypeTablet' : 'licenseTypeKiosk'
|
|
99
|
+
return h('div', { class: 'flex flex-col min-w-0' }, [
|
|
100
|
+
h('span', license.device.name || license.device.machineId),
|
|
101
|
+
h(
|
|
102
|
+
'span',
|
|
103
|
+
{ class: 'fm-typo-en-body-sm-400 text-fm-color-typo-tertiary' },
|
|
104
|
+
mismatch ? `${t(`order.${kind}`)} · ${t(mismatch)}` : t(`order.${kind}`)
|
|
105
|
+
)
|
|
106
|
+
])
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const columns = computed<ColumnDef<MfKioskLicense>[]>(() => [
|
|
110
|
+
{
|
|
111
|
+
id: 'type',
|
|
112
|
+
header: () => t('order.licenseColumnType'),
|
|
113
|
+
cell: ({ row }) =>
|
|
114
|
+
h('div', { class: 'flex flex-col' }, [
|
|
115
|
+
h('span', typeLabel(row.original.type)),
|
|
116
|
+
h(
|
|
117
|
+
'span',
|
|
118
|
+
{ class: 'fm-typo-en-body-sm-400 text-fm-color-typo-tertiary font-mono' },
|
|
119
|
+
shortLicenseId(row.original.id)
|
|
120
|
+
)
|
|
121
|
+
]),
|
|
122
|
+
enableSorting: false
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'status',
|
|
126
|
+
header: () => t('order.licenseColumnStatus'),
|
|
127
|
+
cell: ({ row }) => {
|
|
128
|
+
const chip = licenseRowChip(row.original)
|
|
129
|
+
return h(components.FmChip, { variant: chip.variant, label: t(chip.labelKey, chip.params) })
|
|
130
|
+
},
|
|
131
|
+
enableSorting: false
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 'device',
|
|
135
|
+
header: () => t('order.licenseColumnDevice'),
|
|
136
|
+
cell: ({ row }) => deviceCell(row.original),
|
|
137
|
+
enableSorting: false
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: 'outlet',
|
|
141
|
+
header: () => t('order.licenseColumnOutlet'),
|
|
142
|
+
cell: ({ row }) => row.original.device?.restaurantName || '-',
|
|
143
|
+
enableSorting: false
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 'expires',
|
|
147
|
+
header: () => t('order.licenseColumnExpires'),
|
|
148
|
+
cell: ({ row }) => formatDate(row.original.expiredAt),
|
|
149
|
+
enableSorting: false
|
|
150
|
+
}
|
|
151
|
+
])
|
|
152
|
+
</script>
|
|
@@ -3,16 +3,56 @@
|
|
|
3
3
|
<!--Show otp here-->
|
|
4
4
|
<span class="fm-typo-en-body-md-400 block">{{ t('order.bindDeviceMessage') }}</span>
|
|
5
5
|
<div class="fm-typo-en-title-md-600">{{ otp }}</div>
|
|
6
|
+
<!-- Which licence the new device will use (only when the licence list loaded) -->
|
|
7
|
+
<div
|
|
8
|
+
v-if="licenseLines.length"
|
|
9
|
+
class="flex flex-col gap-2 border-t pt-4"
|
|
10
|
+
data-testid="bind-license-plan"
|
|
11
|
+
>
|
|
12
|
+
<span class="fm-typo-en-body-md-600">{{ t('order.bindLicenseTitle') }}</span>
|
|
13
|
+
<div
|
|
14
|
+
v-for="line in licenseLines"
|
|
15
|
+
:key="line.key"
|
|
16
|
+
class="flex items-start gap-2 fm-typo-en-body-md-400"
|
|
17
|
+
:class="line.warn ? 'text-fm-color-system-warning-400' : 'text-fm-color-typo-secondary'"
|
|
18
|
+
>
|
|
19
|
+
<FmIcon :name="line.icon" />
|
|
20
|
+
<span>{{ t(line.key) }}</span>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
6
23
|
</div>
|
|
7
24
|
</template>
|
|
8
25
|
<script setup lang="ts">
|
|
26
|
+
import { computed } from 'vue'
|
|
9
27
|
import { useI18n } from '@feedmepos/mf-common'
|
|
28
|
+
import { bindLicensePlan, type MfKioskLicenseList } from '@/modules/kiosk/license'
|
|
10
29
|
|
|
11
30
|
const { t } = useI18n()
|
|
12
31
|
|
|
13
32
|
interface Props {
|
|
14
33
|
otp: string
|
|
34
|
+
/** The business's licences, when they loaded. */
|
|
35
|
+
licenses?: MfKioskLicenseList | null
|
|
15
36
|
}
|
|
16
37
|
|
|
17
38
|
const props = defineProps<Props>();
|
|
18
|
-
|
|
39
|
+
|
|
40
|
+
const licenseLines = computed(() => {
|
|
41
|
+
const list = props.licenses
|
|
42
|
+
if (!list?.verified) return []
|
|
43
|
+
if (list.unlimited) {
|
|
44
|
+
return [{ key: 'order.bindLicenseUnlimited', icon: 'all_inclusive', warn: false }]
|
|
45
|
+
}
|
|
46
|
+
const plan = bindLicensePlan(list)
|
|
47
|
+
return [
|
|
48
|
+
plan.kiosk === 'KIOSK'
|
|
49
|
+
? { key: 'order.bindLicenseKiosk', icon: 'point_of_sale', warn: false }
|
|
50
|
+
: { key: 'order.bindLicenseNoKiosk', icon: 'warning', warn: true },
|
|
51
|
+
plan.tablet === 'TABLET'
|
|
52
|
+
? { key: 'order.bindLicenseTablet', icon: 'tablet', warn: false }
|
|
53
|
+
: plan.tablet === 'KIOSK'
|
|
54
|
+
? { key: 'order.bindLicenseTabletFallback', icon: 'tablet', warn: true }
|
|
55
|
+
: { key: 'order.bindLicenseNoTablet', icon: 'warning', warn: true }
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
</script>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import { defineComponent, h } from 'vue'
|
|
5
|
+
import type { KioskPaymentDevice } from '@/modules/payment/paymentDevice'
|
|
6
|
+
|
|
7
|
+
vi.mock('@feedmepos/mf-common', () => ({
|
|
8
|
+
useI18n: () => ({ t: (key: string) => key })
|
|
9
|
+
}))
|
|
10
|
+
vi.mock('@feedmepos/ui-library', () => ({ useSnackbar: () => ({ open: vi.fn() }) }))
|
|
11
|
+
|
|
12
|
+
import KioskPaymentDeviceCard from './KioskPaymentDeviceCard.vue'
|
|
13
|
+
|
|
14
|
+
const FmButton = defineComponent({
|
|
15
|
+
props: { label: String },
|
|
16
|
+
emits: ['click'],
|
|
17
|
+
setup:
|
|
18
|
+
(props, { emit }) =>
|
|
19
|
+
() =>
|
|
20
|
+
h('button', { class: 'fm-button', onClick: () => emit('click') }, props.label)
|
|
21
|
+
})
|
|
22
|
+
const FmChip = defineComponent({
|
|
23
|
+
props: { label: String, variant: String },
|
|
24
|
+
setup: (props) => () => h('span', { class: `fm-chip ${props.variant}` }, props.label)
|
|
25
|
+
})
|
|
26
|
+
const FmIcon = defineComponent({ setup: () => () => h('i') })
|
|
27
|
+
|
|
28
|
+
const DEVICE: KioskPaymentDevice = {
|
|
29
|
+
id: '6aa6053380198fa2d7f0f64d',
|
|
30
|
+
name: 'Kiosk right',
|
|
31
|
+
deviceId: 'r1-m1',
|
|
32
|
+
status: 'Active',
|
|
33
|
+
softPosGateways: ['Softspace'],
|
|
34
|
+
ecrs: [{ gateway: 'Ghl', merchantId: 'GHL-M1', terminalId: 'GHL-T1' }],
|
|
35
|
+
ecrIntegrations: ['Revenue'],
|
|
36
|
+
qrGateways: []
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function mountCard(props: Partial<InstanceType<typeof KioskPaymentDeviceCard>['$props']> = {}) {
|
|
40
|
+
return mount(KioskPaymentDeviceCard, {
|
|
41
|
+
props: {
|
|
42
|
+
paymentDevice: null,
|
|
43
|
+
loading: false,
|
|
44
|
+
loadError: false,
|
|
45
|
+
expectedDeviceId: 'r1-m1',
|
|
46
|
+
portalUrl: null,
|
|
47
|
+
...props
|
|
48
|
+
},
|
|
49
|
+
global: { stubs: { FmButton, FmChip, FmIcon } }
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe('KioskPaymentDeviceCard', () => {
|
|
54
|
+
it('shows the linked payment device, its gateways and the payment portal link', () => {
|
|
55
|
+
const w = mountCard({ paymentDevice: DEVICE, portalUrl: 'https://portal.feedme.cc/payment/admin/terminal/kiosk/x' })
|
|
56
|
+
expect(w.find('[data-testid="payment-device-found"]').text()).toContain('6aa6053380198fa2d7f0f64d')
|
|
57
|
+
expect(w.find('[data-testid="payment-device-found"]').text()).toContain('Active')
|
|
58
|
+
const gateways = w.find('[data-testid="payment-device-gateways"]').text()
|
|
59
|
+
expect(gateways).toContain('Softspace')
|
|
60
|
+
expect(gateways).toContain('Ghl · order.paymentDeviceMerchantId GHL-M1 · order.paymentDeviceTerminalId GHL-T1')
|
|
61
|
+
expect(gateways).toContain('Revenue')
|
|
62
|
+
expect(gateways).toContain('order.paymentDeviceNone') // no QR gateway
|
|
63
|
+
const link = w.find('[data-testid="payment-device-portal-link"]')
|
|
64
|
+
expect(link.attributes('href')).toBe('https://portal.feedme.cc/payment/admin/terminal/kiosk/x')
|
|
65
|
+
expect(link.attributes('target')).toBe('_blank')
|
|
66
|
+
expect(link.attributes('rel')).toContain('noopener')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('shows the expected device id when no payment device matches', () => {
|
|
70
|
+
const w = mountCard()
|
|
71
|
+
expect(w.find('[data-testid="payment-device-missing"]').text()).toContain('r1-m1')
|
|
72
|
+
expect(w.find('[data-testid="payment-device-portal-link"]').exists()).toBe(false)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('shows loading, then an error with retry', async () => {
|
|
76
|
+
expect(mountCard({ loading: true }).find('[data-testid="payment-device-loading"]').exists()).toBe(true)
|
|
77
|
+
const w = mountCard({ loadError: true })
|
|
78
|
+
expect(w.find('[data-testid="payment-device-error"]').exists()).toBe(true)
|
|
79
|
+
await w.find('.fm-button').trigger('click')
|
|
80
|
+
expect(w.emitted('retry')).toHaveLength(1)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('warns when the kiosk reports a different GHL terminal', () => {
|
|
84
|
+
const same = mountCard({
|
|
85
|
+
paymentDevice: DEVICE,
|
|
86
|
+
reported: { gateway: 'E_GHL', merchantId: 'GHL-M1', terminalId: 'GHL-T1' }
|
|
87
|
+
})
|
|
88
|
+
expect(same.find('[data-testid="payment-device-reported"]').exists()).toBe(true)
|
|
89
|
+
expect(same.find('[data-testid="payment-device-reported-differs"]').exists()).toBe(false)
|
|
90
|
+
|
|
91
|
+
const differs = mountCard({
|
|
92
|
+
paymentDevice: DEVICE,
|
|
93
|
+
reported: { gateway: 'E_GHL', merchantId: 'GHL-M1', terminalId: 'OLD-T9' }
|
|
94
|
+
})
|
|
95
|
+
expect(differs.find('[data-testid="payment-device-reported-differs"]').exists()).toBe(true)
|
|
96
|
+
})
|
|
97
|
+
})
|