@feedmepos/mf-order-setting 0.0.23 → 0.0.25
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/{KioskDevicesView-BdJCcotz.js → KioskDevicesView-gzH9-zL_.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-DUPfN7ti.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-CLpClo-r.js} +3 -3
- package/dist/KioskSettingView-D1WdpaQN.js +821 -0
- package/dist/{KioskView-DPU-oQ1H.js → KioskView-D6-1bn1n.js} +90 -76
- package/dist/{OrderSettingsView-BOiflwB_.js → OrderSettingsView-CqZREmjo.js} +6155 -6096
- package/dist/{app-CaYWSLe1.js → app-i4N2c7ms.js} +54 -38
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-8NyoNely.js → dayjs.min-CA-XbgTY.js} +36 -36
- package/dist/frontend/mf-order/src/app.d.ts +16 -0
- package/dist/frontend/mf-order/src/main.d.ts +797 -0
- package/dist/frontend/mf-order/src/modules/order-setting/kiosk/interface.d.ts +4 -0
- package/dist/frontend/mf-order/src/stores/iframe/index.d.ts +6 -6
- package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +8 -260
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +29 -710
- package/dist/frontend/mf-order/src/stores/order-setting/mapper.d.ts +3 -2
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +1456 -2239
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskEnablePaxDialogSection.vue.d.ts +9 -0
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-B7GFhkAE.js → index-C4HI1NS4.js} +2 -2
- package/dist/package/entity/delivery/delivery.dto.d.ts +11 -6
- package/dist/package/entity/food-court/food-court.dto.d.ts +1 -1
- package/dist/package/entity/food-court/order.dto.d.ts +727 -378
- package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +6 -6
- package/dist/package/entity/incoming-order/incoming-order.do.d.ts +8 -8
- package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +16 -16
- package/dist/package/entity/index.d.ts +1 -0
- package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +1337 -656
- package/dist/package/entity/order/order.dto.d.ts +4942 -2401
- package/dist/package/entity/order/order.enum.d.ts +1 -1
- package/dist/package/entity/order/payment/payment.dto.d.ts +2899 -1419
- package/dist/package/entity/order-platform/external/order/external-order.do.d.ts +9 -21
- package/dist/package/entity/order-platform/external/order/external-order.dto.d.ts +19 -51
- package/dist/package/entity/order-setting/kiosk/kiosk.do.d.ts +14 -0
- package/dist/package/entity/order-setting/kiosk/kiosk.dto.d.ts +30 -0
- package/dist/package/entity/order-setting/order-setting.do.d.ts +26 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +52 -0
- package/dist/package/entity/order-setting/v3/v3.do.d.ts +3 -0
- package/dist/package/entity/order-setting/v3/v3.dto.d.ts +3 -0
- package/dist/package/entity/order-setting/v3/v3.enum.d.ts +3 -0
- package/dist/package/entity/payment/payment.dto.d.ts +3 -3
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +37 -11
- package/dist/package/entity/websocket/websocket.dto.d.ts +40 -0
- package/dist/{queue.do-CIyIpp22.js → queue.do-DcOVgeUq.js} +17143 -16655
- package/package.json +3 -3
- package/src/Entry.vue +3 -3
- package/src/locales/en-US.json +8 -0
- package/src/locales/th-TH.json +257 -0
- package/src/locales/zh-CN.json +8 -0
- package/src/main.ts +9 -1
- package/src/modules/order-setting/kiosk/interface.ts +4 -0
- package/src/stores/iframe/index.ts +1 -1
- package/src/stores/kiosk/index.ts +1 -1
- package/src/stores/order-setting/index.ts +1 -1
- package/src/stores/order-setting/mapper.ts +27 -11
- package/src/stores/restaurant/index.ts +106 -85
- package/src/views/kiosk/settings/KioskEnablePaxDialogSection.vue +33 -0
- package/src/views/kiosk/settings/KioskSettingView.vue +26 -0
- package/src/views/order-settings/delivery/DeliverySetting.vue +12 -12
- package/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue +39 -35
- package/src/views/order-settings/dine-in/DineInSetting.vue +158 -24
- package/src/views/order-settings/general/GeneralSetting.vue +29 -33
- package/src/views/order-settings/pickup/PickUpSetting.vue +4 -2
- package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +23 -10
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +17 -8
- package/dist/KioskSettingView-BChhriPk.js +0 -782
|
@@ -1,34 +1,98 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex justify-between items-center">
|
|
3
|
-
<RestaurantSelector
|
|
3
|
+
<RestaurantSelector />
|
|
4
4
|
</div>
|
|
5
5
|
<div v-if="!isLoading">
|
|
6
6
|
<div class="p-[1.5rem] flex flex-col gap-5 m-5 w-2/3">
|
|
7
7
|
<div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.generalSetting') }}</div>
|
|
8
|
-
<FmSwitch
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
<FmSwitch
|
|
9
|
+
v-model="dineInSetting.anonymousOrder"
|
|
10
|
+
value="anonymousOrder"
|
|
11
|
+
:label="t('order.anonymousOrder')"
|
|
12
|
+
:sublabel="t('order.anonymousOrderSublabel')"
|
|
13
|
+
label-placement="right"
|
|
14
|
+
/>
|
|
15
|
+
<FmSwitch
|
|
16
|
+
v-model="dineInSetting.ignoreStock as boolean"
|
|
17
|
+
value="ignoreStock"
|
|
18
|
+
:label="t('order.ignoreStock')"
|
|
19
|
+
:sublabel="t('order.ignoreStockSublabel')"
|
|
20
|
+
label-placement="right"
|
|
21
|
+
/>
|
|
22
|
+
<FmSwitch
|
|
23
|
+
v-model="dineInSetting.staticQr as boolean"
|
|
24
|
+
value="staticQr"
|
|
25
|
+
:label="t('order.staticQRcode')"
|
|
26
|
+
:sublabel="t('order.staticQRcodeSublabel')"
|
|
27
|
+
label-placement="right"
|
|
28
|
+
/>
|
|
29
|
+
<FmSwitch
|
|
30
|
+
v-model="disableItemRemarkNegated"
|
|
31
|
+
value="disableItemRemark"
|
|
32
|
+
:label="t('order.customerItemRemark')"
|
|
33
|
+
:sublabel="t('order.customerItemRemarkSublabel')"
|
|
34
|
+
label-placement="right"
|
|
35
|
+
/>
|
|
36
|
+
<FmSwitch
|
|
37
|
+
v-model="dineInSetting.acceptQueue as boolean"
|
|
38
|
+
value="acceptQueue"
|
|
39
|
+
:label="t('order.acceptQueue')"
|
|
40
|
+
:sublabel="t('order.acceptQueueSublabel')"
|
|
41
|
+
label-placement="right"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<FmSwitch
|
|
45
|
+
:model-value="lastOrderBeforeCloseEnable"
|
|
46
|
+
@update:model-value="enableLastOrder"
|
|
47
|
+
:label="t('order.lastOrderBeforeClosing')"
|
|
48
|
+
:sublabel="t('order.lastOrderBeforeClosingDescription')"
|
|
49
|
+
label-placement="right"
|
|
50
|
+
></FmSwitch>
|
|
51
|
+
|
|
52
|
+
<div
|
|
53
|
+
v-if="lastOrderBeforeCloseEnable"
|
|
54
|
+
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-2 ml-5"
|
|
55
|
+
>
|
|
56
|
+
<FmStepperField
|
|
57
|
+
:model-value="orderSetting?.lastOrderMinutesBeforeClose ?? 0"
|
|
58
|
+
:label="t('order.minutes')"
|
|
59
|
+
@update:model-value="updateLastOrderMinutesBeforeClose"
|
|
60
|
+
placeholder="0"
|
|
61
|
+
:show-steppers="true"
|
|
62
|
+
:rules="lastOrderSettingRules"
|
|
63
|
+
:min="0"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<FmSwitch
|
|
68
|
+
:model-value="orderSetting?.v3Settings.dineInCanTakeaway ?? false"
|
|
69
|
+
:label="t('order.dineInCanTakeaway')"
|
|
70
|
+
label-placement="right"
|
|
71
|
+
@update:model-value="updateDineInCanTakeaway"
|
|
72
|
+
></FmSwitch>
|
|
18
73
|
</div>
|
|
19
74
|
<div class="p-[1.5rem] flex flex-col gap-2 m-5 w-2/3">
|
|
20
|
-
<PaymentType
|
|
75
|
+
<PaymentType
|
|
76
|
+
:payment-types="dineInSetting.paymentTypes ?? []"
|
|
77
|
+
:allow-e-payment="allowEPayment"
|
|
21
78
|
:offline-payment-types="dineInSetting.offlinePaymentTypes ?? []"
|
|
22
79
|
@update:payment-types="(v: F_ORDER_PAYMENT_TYPE[]) => (dineInSetting.paymentTypes = v)"
|
|
23
|
-
@update:offline-payment-types="
|
|
24
|
-
|
|
80
|
+
@update:offline-payment-types="
|
|
81
|
+
(v: FdoOfflinePaymentMethod[] | undefined | null) =>
|
|
82
|
+
(dineInSetting.offlinePaymentTypes = v)
|
|
83
|
+
"
|
|
84
|
+
/>
|
|
25
85
|
</div>
|
|
26
86
|
<div class="fm-corner-radius-lg flex flex-col gap-5 m-5">
|
|
27
|
-
<FmButton
|
|
87
|
+
<FmButton
|
|
88
|
+
variant="primary"
|
|
89
|
+
:label="t('order.saveSetting')"
|
|
90
|
+
class="mr-auto"
|
|
91
|
+
@click="updateDineInSetting"
|
|
92
|
+
/>
|
|
28
93
|
</div>
|
|
29
94
|
</div>
|
|
30
95
|
<FmCircularProgress size="xxl" v-else />
|
|
31
|
-
|
|
32
96
|
</template>
|
|
33
97
|
|
|
34
98
|
<script setup lang="ts">
|
|
@@ -45,17 +109,38 @@ import { useCoreStore } from '@feedmepos/mf-common'
|
|
|
45
109
|
import PaymentType from './PaymentType.vue'
|
|
46
110
|
import { utils } from '@feedmepos/core'
|
|
47
111
|
import { useI18n } from '@feedmepos/mf-common'
|
|
112
|
+
import { OrderSettingApi } from '@/api/order-setting'
|
|
113
|
+
import { type OrderSettingsDto } from '@entity'
|
|
114
|
+
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
48
115
|
|
|
49
116
|
const { t } = useI18n()
|
|
50
117
|
|
|
51
118
|
const { currentRestaurant } = useCoreStore()
|
|
52
119
|
const dineInSetting = ref<FdoRestaurantDineIn>(initDineInSetting())
|
|
120
|
+
const orderSetting = ref<OrderSettingsDto | undefined>(undefined)
|
|
121
|
+
const lastOrderBeforeCloseEnable = ref<boolean>(false)
|
|
53
122
|
|
|
54
123
|
const allowEPayment = computed(() => {
|
|
55
124
|
const paymentTypes = dineInSetting.value.paymentTypes || []
|
|
56
125
|
return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.ePayment)
|
|
57
126
|
})
|
|
58
127
|
|
|
128
|
+
const lastOrderSettingRules = computed(() => {
|
|
129
|
+
return [
|
|
130
|
+
() =>
|
|
131
|
+
(orderSetting.value?.lastOrderMinutesBeforeClose ?? 0) >= 0 ||
|
|
132
|
+
t('order.lastOrderMinutesBeforeCloseRule')
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
const isDineInsettingValid = computed(() => {
|
|
137
|
+
return lastOrderSettingRules.value.every((rule) => rule() === true)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const errors = computed(() => {
|
|
141
|
+
return `${lastOrderSettingRules.value.filter((rule) => typeof rule() === 'string').map((rule) => rule())}`
|
|
142
|
+
})
|
|
143
|
+
|
|
59
144
|
const disableItemRemarkNegated = computed({
|
|
60
145
|
get: () => !dineInSetting.value.disableItemRemark,
|
|
61
146
|
set: (value) => {
|
|
@@ -63,6 +148,30 @@ const disableItemRemarkNegated = computed({
|
|
|
63
148
|
}
|
|
64
149
|
})
|
|
65
150
|
|
|
151
|
+
function enableLastOrder(v: boolean) {
|
|
152
|
+
lastOrderBeforeCloseEnable.value = v
|
|
153
|
+
if (orderSetting.value) {
|
|
154
|
+
if (v) {
|
|
155
|
+
// By default - 15 mins
|
|
156
|
+
orderSetting.value.lastOrderMinutesBeforeClose = 15
|
|
157
|
+
} else {
|
|
158
|
+
orderSetting.value.lastOrderMinutesBeforeClose = 0
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function updateDineInCanTakeaway(v: boolean) {
|
|
164
|
+
if (orderSetting.value) {
|
|
165
|
+
orderSetting.value.v3Settings.dineInCanTakeaway = v
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function updateLastOrderMinutesBeforeClose(minutes: number) {
|
|
170
|
+
if (orderSetting.value) {
|
|
171
|
+
orderSetting.value.lastOrderMinutesBeforeClose = minutes
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
66
175
|
function initDineInSetting(): FdoRestaurantDineIn {
|
|
67
176
|
return {
|
|
68
177
|
ignoreStock: false,
|
|
@@ -75,31 +184,55 @@ function initDineInSetting(): FdoRestaurantDineIn {
|
|
|
75
184
|
}
|
|
76
185
|
}
|
|
77
186
|
|
|
78
|
-
|
|
79
|
-
|
|
187
|
+
async function orderSettingInit() {
|
|
188
|
+
if (currentRestaurant.value) {
|
|
189
|
+
orderSetting.value = (await readOrderSetting()) ?? {
|
|
190
|
+
_id: currentRestaurant.value._id
|
|
191
|
+
}
|
|
192
|
+
lastOrderBeforeCloseEnable.value = !!orderSetting.value.lastOrderMinutesBeforeClose
|
|
193
|
+
}
|
|
194
|
+
}
|
|
80
195
|
|
|
196
|
+
const { showSuccess, showError } = useSnackbarFunctions()
|
|
81
197
|
const restaurantStore = useRestaurantStore()
|
|
82
198
|
const { startAsyncCallWithErr, isLoading } = useLoading()
|
|
83
199
|
async function updateDineInSetting() {
|
|
200
|
+
if (!isDineInsettingValid.value) {
|
|
201
|
+
showError(errors.value)
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
|
|
84
205
|
await startAsyncCallWithErr(async () => {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
await restaurantStore.updateDineInSetting(orderSetting)
|
|
206
|
+
const newDineInSetting = dineInSetting.value
|
|
207
|
+
if (newDineInSetting) {
|
|
208
|
+
await restaurantStore.updateDineInSetting(newDineInSetting)
|
|
89
209
|
if (currentRestaurant.value) {
|
|
90
|
-
currentRestaurant.value.dineIn =
|
|
210
|
+
currentRestaurant.value.dineIn = newDineInSetting
|
|
91
211
|
}
|
|
92
212
|
}
|
|
213
|
+
|
|
214
|
+
if (orderSetting.value) {
|
|
215
|
+
await OrderSettingApi.updateOrderSetting({
|
|
216
|
+
...orderSetting.value
|
|
217
|
+
})
|
|
218
|
+
}
|
|
93
219
|
})
|
|
94
220
|
showSuccess('Dine in setting updated. ')
|
|
95
221
|
}
|
|
96
222
|
|
|
223
|
+
async function readOrderSetting(): Promise<OrderSettingsDto> {
|
|
224
|
+
return await startAsyncCallWithErr(async () => {
|
|
225
|
+
return await OrderSettingApi.getOrderSetting()
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
|
|
97
229
|
watch(
|
|
98
230
|
() => currentRestaurant.value,
|
|
99
|
-
(newRestaurant) => {
|
|
231
|
+
async (newRestaurant) => {
|
|
100
232
|
if (newRestaurant?.dineIn) {
|
|
101
233
|
dineInSetting.value = utils.clone(newRestaurant.dineIn)
|
|
102
234
|
}
|
|
235
|
+
await orderSettingInit()
|
|
103
236
|
},
|
|
104
237
|
{ immediate: true }
|
|
105
238
|
)
|
|
@@ -109,5 +242,6 @@ onMounted(async () => {
|
|
|
109
242
|
if (newRestaurant?.dineIn) {
|
|
110
243
|
dineInSetting.value = utils.clone(newRestaurant.dineIn)
|
|
111
244
|
}
|
|
245
|
+
await orderSettingInit()
|
|
112
246
|
})
|
|
113
247
|
</script>
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex justify-between items-center">
|
|
3
|
-
<RestaurantSelector
|
|
3
|
+
<RestaurantSelector />
|
|
4
4
|
</div>
|
|
5
5
|
<div v-if="!isLoading">
|
|
6
6
|
<div class="p-[1.5rem] flex flex-col gap-5 m-5 w-2/3">
|
|
7
7
|
<div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.generalSetting') }}</div>
|
|
8
8
|
<FmSwitch
|
|
9
|
-
:
|
|
10
|
-
|
|
11
|
-
:
|
|
12
|
-
:sublabel="`${!validPosVersion ? `(${t('order.autoSendKitchenSublabel')})` : ''}`"
|
|
9
|
+
:model-value="orderSetting?.v3Settings?.anonymousLoginDialog ?? true"
|
|
10
|
+
:label="t('order.promptAnonymousLoginDialog')"
|
|
11
|
+
@update:model-value="updateAnonymousLoginDialog"
|
|
13
12
|
label-placement="right"
|
|
14
13
|
></FmSwitch>
|
|
15
|
-
|
|
16
14
|
<FmSwitch
|
|
17
|
-
|
|
18
|
-
:label="t('order.
|
|
15
|
+
:model-value="!!orderSetting?.v3Settings?.subItemDisplayMode"
|
|
16
|
+
:label="t('order.subItemDisplayModeListView')"
|
|
17
|
+
@update:model-value="updateSubItemDisplayMode"
|
|
19
18
|
label-placement="right"
|
|
20
19
|
></FmSwitch>
|
|
21
20
|
</div>
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
import { useCoreStore } from '@feedmepos/mf-common'
|
|
36
35
|
import RestaurantSelector from '../components/RestaurantSelector.vue'
|
|
37
36
|
import { useLoading } from '@/composables/loading'
|
|
38
|
-
import { type OrderSettingsDto, type OrderV3Settings } from '@entity'
|
|
37
|
+
import { type OrderSettingsDto, type OrderV3Settings, F_ORDER_SUBITEM_DISPLAY_MODE } from '@entity'
|
|
39
38
|
import { OrderSettingApi } from '@/api/order-setting'
|
|
40
39
|
import { computed, onMounted, ref, watch } from 'vue'
|
|
41
40
|
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
@@ -47,39 +46,36 @@ const { showSuccess } = useSnackbarFunctions()
|
|
|
47
46
|
const { currentRestaurant } = useCoreStore()
|
|
48
47
|
const { startAsyncCallWithErr, isLoading } = useLoading()
|
|
49
48
|
|
|
50
|
-
const
|
|
49
|
+
const orderSetting = ref<OrderSettingsDto | undefined>(undefined)
|
|
51
50
|
const v3Settings = ref<OrderV3Settings | undefined>(undefined)
|
|
52
|
-
const autoSendKitchen = ref<boolean>(false)
|
|
53
51
|
const anonymousLoginDialog = ref<boolean>(false)
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
return currentRestaurant?.value?.posVersion?.startsWith('7') ?? false
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
async function init() {
|
|
53
|
+
async function init(): Promise<void> {
|
|
60
54
|
if (currentRestaurant.value) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
orderSetting.value = await readOrderSetting()
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function updateAnonymousLoginDialog(v: boolean) {
|
|
60
|
+
if (orderSetting.value) {
|
|
61
|
+
orderSetting.value.v3Settings.anonymousLoginDialog = v
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function updateSubItemDisplayMode(v: boolean) {
|
|
66
|
+
if (orderSetting.value) {
|
|
67
|
+
if (v) {
|
|
68
|
+
orderSetting.value.v3Settings.subItemDisplayMode = F_ORDER_SUBITEM_DISPLAY_MODE.enum.LIST
|
|
69
|
+
} else {
|
|
70
|
+
orderSetting.value.v3Settings.subItemDisplayMode = undefined
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
async function updateOrderSetting() {
|
|
71
76
|
await startAsyncCallWithErr(async () => {
|
|
72
|
-
if (
|
|
73
|
-
await OrderSettingApi.updateOrderSetting(
|
|
74
|
-
...orderSettingDefault.value,
|
|
75
|
-
autoSendKitchen: autoSendKitchen.value,
|
|
76
|
-
v3Settings: {
|
|
77
|
-
...(v3Settings.value ?? {}),
|
|
78
|
-
dineInCanTakeaway: v3Settings.value?.dineInCanTakeaway ?? true,
|
|
79
|
-
anonymousLoginDialog: anonymousLoginDialog.value
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
await init()
|
|
77
|
+
if (orderSetting.value) {
|
|
78
|
+
await OrderSettingApi.updateOrderSetting(orderSetting.value)
|
|
83
79
|
showSuccess('General setting updated')
|
|
84
80
|
}
|
|
85
81
|
})
|
|
@@ -51,7 +51,7 @@ const currentRestaurants = ref<FmpRestaurant[]>([])
|
|
|
51
51
|
|
|
52
52
|
const pickupSetting = computed<RestaurantPickup[]>(() => {
|
|
53
53
|
return currentRestaurants.value.map((r: FmpRestaurant) => {
|
|
54
|
-
const restaurantSetting = restaurantStore.restaurantSettings[r._id]
|
|
54
|
+
const restaurantSetting = restaurantStore.state.restaurantSettings[r._id]
|
|
55
55
|
|
|
56
56
|
return {
|
|
57
57
|
enable: restaurantSetting?.acceptPickup,
|
|
@@ -98,7 +98,9 @@ async function toggleSideSheet(rowData: any) {
|
|
|
98
98
|
const v = rowData?.original?.restaurantId ?? rowData?.restaurantId
|
|
99
99
|
originalRestaurant = currentRestaurant.value
|
|
100
100
|
|
|
101
|
-
const restaurant = currentRestaurants.value.find(
|
|
101
|
+
const restaurant: FmpRestaurant | undefined = currentRestaurants.value.find(
|
|
102
|
+
(r: FmpRestaurant) => r._id === v
|
|
103
|
+
)
|
|
102
104
|
if (restaurant) {
|
|
103
105
|
await changeRestaurant(restaurant as any)
|
|
104
106
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-3">{{ t('order.generalSetting') }}</div>
|
|
3
|
-
<FmSwitch
|
|
4
|
-
:
|
|
3
|
+
<FmSwitch
|
|
4
|
+
:model-value="pickupSetting.ignoreStock ?? false"
|
|
5
|
+
value="ignoreStock"
|
|
6
|
+
:label="t('order.ignoreStock')"
|
|
7
|
+
:sublabel="t('order.ignoreStockSublabel')"
|
|
8
|
+
label-placement="right"
|
|
9
|
+
@update:model-value="updateIgnoreStock"
|
|
10
|
+
/>
|
|
5
11
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
6
12
|
<Preorder :model-value="pickupData" @update:model-value="updatePickupSetting" />
|
|
7
13
|
</FmCard>
|
|
@@ -9,7 +15,7 @@
|
|
|
9
15
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
10
16
|
<PaymentSidesheet
|
|
11
17
|
:offline-payment-types="pickupSetting.offlinePaymentTypes"
|
|
12
|
-
:allow-e-payment="restaurantStore.getRestaurantEPayment(
|
|
18
|
+
:allow-e-payment="restaurantStore.getRestaurantEPayment()"
|
|
13
19
|
:payment-types="pickupSetting.paymentTypes"
|
|
14
20
|
@update:payments="updatePayments"
|
|
15
21
|
/>
|
|
@@ -17,14 +23,22 @@
|
|
|
17
23
|
|
|
18
24
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
19
25
|
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">{{ t('order.pickupPoint') }}</div>
|
|
20
|
-
<FmSwitch
|
|
21
|
-
:
|
|
22
|
-
|
|
26
|
+
<FmSwitch
|
|
27
|
+
:model-value="!!pickupSetting.pickupPointConfig"
|
|
28
|
+
value="pickuppoint"
|
|
29
|
+
:label="t('order.multiplePickupPoint')"
|
|
30
|
+
:sublabel="t('order.allowMultiplePickupSublabel')"
|
|
31
|
+
label-placement="right"
|
|
32
|
+
@update:model-value="toggleMultiplePickupPoint"
|
|
33
|
+
/>
|
|
23
34
|
|
|
24
35
|
<template v-if="pickupSetting.pickupPointConfig">
|
|
25
36
|
<div class="mt-3">
|
|
26
|
-
<FmCheckbox
|
|
27
|
-
|
|
37
|
+
<FmCheckbox
|
|
38
|
+
v-model="pickupSetting.pickupPointConfig.restaurantEnable"
|
|
39
|
+
:label="t('order.restaurantAsPickupPoint')"
|
|
40
|
+
value="restaurant"
|
|
41
|
+
/>
|
|
28
42
|
</div>
|
|
29
43
|
<PickUpPointDialog @update:address="updatePickupPoints" :pickup-setting="pickupSetting" />
|
|
30
44
|
<div v-if="pickupSetting.pickupPointConfig">
|
|
@@ -107,8 +121,7 @@ const checkboxChildren = [
|
|
|
107
121
|
const initializeCheckboxes = () => {
|
|
108
122
|
const initialValues: string[] = []
|
|
109
123
|
if (allowOfflinePayment.value) initialValues.push('offline')
|
|
110
|
-
if (restaurantStore.getRestaurantEPayment(
|
|
111
|
-
initialValues.push('e-payment')
|
|
124
|
+
if (restaurantStore.getRestaurantEPayment()) initialValues.push('e-payment')
|
|
112
125
|
nestedVal.value = initialValues
|
|
113
126
|
parent.value = initialValues.length === checkboxChildren.length
|
|
114
127
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex justify-between items-center">
|
|
3
|
-
<RestaurantSelector
|
|
3
|
+
<RestaurantSelector />
|
|
4
4
|
</div>
|
|
5
5
|
<div v-if="!isLoading">
|
|
6
6
|
<div class="p-[1.5rem] flex flex-col gap-5">
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
:label="t('order.chargeWhen')"
|
|
30
30
|
@update:model-value="updateChargeWhen"
|
|
31
31
|
>
|
|
32
|
-
<FmRadio value="beforeDiscount" :label="t('order.beforeBillDiscount')"
|
|
32
|
+
<FmRadio value="beforeDiscount" :label="t('order.beforeBillDiscount')" :disabled="disableBeforeDiscount"
|
|
33
|
+
/>
|
|
33
34
|
<FmRadio value="afterDiscount" :label="t('order.afterBillDiscount')" />
|
|
34
35
|
</FmRadioGroup>
|
|
35
36
|
<RateInput :model-value="data.rate" @update:model-value="handleUpdateRate" />
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
@update:model-value="updateInclusive"
|
|
41
42
|
>
|
|
42
43
|
<FmRadio value="exclusive" :label="t('order.exclusive')" />
|
|
43
|
-
<FmRadio value="inclusive" :label="t('order.inclusive')" />
|
|
44
|
+
<FmRadio value="inclusive" :label="t('order.inclusive')" :disabled="disableInclusive" />
|
|
44
45
|
</FmRadioGroup>
|
|
45
46
|
</div>
|
|
46
47
|
</FmCard>
|
|
@@ -165,6 +166,14 @@ const chargeValue = computed(() => {
|
|
|
165
166
|
return data.value.inclusive ? inclusiveKey : exclusiveKey
|
|
166
167
|
})
|
|
167
168
|
|
|
169
|
+
const disableInclusive = computed(() => {
|
|
170
|
+
return data.value.beforeDiscount ?? false
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
const disableBeforeDiscount = computed(() => {
|
|
174
|
+
return data.value.inclusive
|
|
175
|
+
})
|
|
176
|
+
|
|
168
177
|
function updateChargeWhen(key: string) {
|
|
169
178
|
data.value.beforeDiscount = key === beforeDiscountKey
|
|
170
179
|
if (data.value.beforeDiscount) updateInclusive(exclusiveKey)
|
|
@@ -181,6 +190,7 @@ function updateInclusive(inclusiveValue: string) {
|
|
|
181
190
|
...rule,
|
|
182
191
|
inclusive: inclusive
|
|
183
192
|
}))
|
|
193
|
+
if (data.value.inclusive) updateChargeWhen(afterDiscountKey)
|
|
184
194
|
}
|
|
185
195
|
|
|
186
196
|
function createRule() {
|
|
@@ -234,10 +244,9 @@ const isLoadingTables = ref(false)
|
|
|
234
244
|
const tableSettingStore = useTableSettingStore()
|
|
235
245
|
|
|
236
246
|
onMounted(async () => {
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
239
|
-
await restaurantStore.readRestaurantSetting(
|
|
240
|
-
const restaurantSetting = restaurantStore.restaurantSettings[resId]
|
|
247
|
+
const res = restaurantStore.currentRestaurant
|
|
248
|
+
if (res) {
|
|
249
|
+
const restaurantSetting = await restaurantStore.readRestaurantSetting(res._id)
|
|
241
250
|
initialize(restaurantSetting)
|
|
242
251
|
await startAsyncCallWithErr(tableSettingStore.readTables)
|
|
243
252
|
}
|
|
@@ -247,7 +256,7 @@ watch(
|
|
|
247
256
|
() => currentRestaurant.value,
|
|
248
257
|
async (newValue) => {
|
|
249
258
|
if (newValue) {
|
|
250
|
-
let restaurantSetting = restaurantStore.
|
|
259
|
+
let restaurantSetting = restaurantStore.currentRestaurantSetting
|
|
251
260
|
if (!restaurantSetting) {
|
|
252
261
|
restaurantSetting = await restaurantStore.readRestaurantSetting(newValue._id)
|
|
253
262
|
}
|