@feedmepos/mf-order-setting 0.0.24 → 0.0.26
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-DGkvW2mH.js → KioskDevicesView-BiF6v7Zj.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-BGZLd8T_.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-1r_DBAc-.js} +3 -3
- package/dist/{KioskSettingView-DLb5nnCu.js → KioskSettingView-COhGcRtP.js} +1 -1
- package/dist/{KioskView-kZZYSfUh.js → KioskView-C1T-n1MY.js} +38 -28
- package/dist/{OrderSettingsView-Cil4j9G5.js → OrderSettingsView-CI5bdVXr.js} +6297 -6251
- package/dist/{app-D47VRl5B.js → app-BfWp4ow3.js} +38 -26
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-R4180ukF.js → dayjs.min-BHDLv42p.js} +36 -36
- package/dist/frontend/mf-order/src/app.d.ts +12 -0
- package/dist/frontend/mf-order/src/main.d.ts +797 -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 +17 -722
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +449 -2369
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-DgLlDwJK.js → index-B5kfsi9C.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/order-setting.do.d.ts +8 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +16 -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 +19 -11
- package/dist/{queue.do-CNMuossU.js → queue.do-y-ubeoKZ.js} +17139 -16655
- package/package.json +3 -3
- package/src/Entry.vue +3 -3
- package/src/locales/en-US.json +6 -0
- package/src/locales/th-TH.json +257 -0
- package/src/locales/zh-CN.json +6 -0
- package/src/main.ts +9 -1
- 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 +12 -2
- package/src/stores/restaurant/index.ts +92 -84
- package/src/views/order-settings/delivery/DeliverySetting.vue +11 -11
- 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 -12
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +20 -8
|
@@ -12,13 +12,14 @@ import {
|
|
|
12
12
|
FdoShopeeFoodSettings,
|
|
13
13
|
type FdoAddress,
|
|
14
14
|
type FdoProfile,
|
|
15
|
-
|
|
15
|
+
FdoRestaurant,
|
|
16
16
|
} from '@feedmepos/core/entity'
|
|
17
17
|
import { FdoExternalSetting, FdoGrabfoodSettings } from '@entity'
|
|
18
18
|
import { FeatureFlag, Pos } from '@feedmepos/core'
|
|
19
19
|
import { SvcConfig } from '@/api'
|
|
20
20
|
import { remoteOrderApi } from '@/api/remoteOrder'
|
|
21
|
-
import { useI18n } from '@feedmepos/mf-common'
|
|
21
|
+
import { useI18n, useCoreStore} from '@feedmepos/mf-common'
|
|
22
|
+
import { computed, ref, watch} from 'vue'
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
export interface Profile extends FdoProfile {
|
|
@@ -42,10 +43,6 @@ export interface ExtendedRestaurant extends FdoRestaurant {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
interface RestaurantState {
|
|
45
|
-
adminRestaurants: FdoRestaurant[]
|
|
46
|
-
managableRestaurants: ExtendedRestaurant[]
|
|
47
|
-
businessRestaurants: ExtendedRestaurant[]
|
|
48
|
-
currentRestaurantId: string
|
|
49
46
|
restaurantSettings: { [restaurantId: string]: RestaurantSettingDoc }
|
|
50
47
|
}
|
|
51
48
|
|
|
@@ -53,90 +50,101 @@ export declare function setRestaurantId(id?: string | null): void
|
|
|
53
50
|
|
|
54
51
|
function initRestaurantState(): RestaurantState {
|
|
55
52
|
return {
|
|
56
|
-
adminRestaurants: [],
|
|
57
|
-
managableRestaurants: [],
|
|
58
|
-
businessRestaurants: [],
|
|
59
|
-
currentRestaurantId: '',
|
|
60
53
|
restaurantSettings: {}
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
56
|
|
|
64
|
-
export const useRestaurantStore = defineStore('restaurant', {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
getters: {
|
|
69
|
-
currentRestaurant: (state) =>
|
|
70
|
-
state.businessRestaurants.find((r) => r.id === state.currentRestaurantId),
|
|
71
|
-
currentRestaurantSetting: (state) => state.restaurantSettings[state.currentRestaurantId || '']
|
|
72
|
-
},
|
|
73
|
-
actions: {
|
|
74
|
-
async readRestaurantSetting(restaurantId: string) {
|
|
75
|
-
const restaurantSetting = await restaurantApi.readRestaurantSetting(restaurantId)
|
|
76
|
-
this.restaurantSettings = {
|
|
77
|
-
...this.restaurantSettings,
|
|
78
|
-
[restaurantId]: restaurantSetting
|
|
79
|
-
}
|
|
80
|
-
return restaurantSetting
|
|
81
|
-
},
|
|
82
|
-
async selectRestaurant(restaurantId: string) {
|
|
83
|
-
await this.readRestaurantSetting(restaurantId)
|
|
84
|
-
this.currentRestaurantId = restaurantId
|
|
85
|
-
SvcConfig.setRestaurantId(restaurantId)
|
|
86
|
-
setRestaurantId(restaurantId)
|
|
87
|
-
FeatureFlag.setRestaurant(restaurantId || undefined)
|
|
88
|
-
localStorage.set('feedme_restaurant', restaurantId)
|
|
89
|
-
},
|
|
90
|
-
async updateServiceCharge(serviceCharge: FdoServiceChargeSetting) {
|
|
91
|
-
await restaurantApi.updateServiceCharge(serviceCharge)
|
|
92
|
-
},
|
|
93
|
-
async updateDineInSetting(setting: FdoRestaurantDineIn) {
|
|
94
|
-
await restaurantApi.updateDineInSetting(setting)
|
|
95
|
-
},
|
|
96
|
-
async updatePickupSetting(setting: FdoRestaurantPickup) {
|
|
97
|
-
await restaurantApi.updatePickupSetting(setting)
|
|
98
|
-
},
|
|
57
|
+
export const useRestaurantStore = defineStore('restaurant', () => {
|
|
58
|
+
const CoreStore = useCoreStore()
|
|
59
|
+
const state = ref(initRestaurantState())
|
|
60
|
+
const currentRestaurantSetting = computed<RestaurantSettingDoc| undefined>(() => state.value.restaurantSettings[CoreStore.currentRestaurant.value?._id || ''])
|
|
99
61
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
await remoteOrderApi.integratedDelivery.updateExternal(restaurantId, dto)
|
|
117
|
-
},
|
|
118
|
-
getRestaurantEPayment(dto?: FdoRestaurant | undefined): true | string {
|
|
119
|
-
const { t } = useI18n()
|
|
120
|
-
if (!dto) {
|
|
121
|
-
return 'getRestaurantEPayment - Invalid restaurant ';
|
|
122
|
-
}
|
|
123
|
-
const { payoutAccount, posVersion } = dto;
|
|
124
|
-
const validPosVersion =
|
|
125
|
-
!!posVersion &&
|
|
126
|
-
Pos.canUse({
|
|
127
|
-
feature: F_FEATURE.enum.qrEPayment,
|
|
128
|
-
posVersion
|
|
129
|
-
})
|
|
62
|
+
async function readRestaurantSetting(restaurantId: string) {
|
|
63
|
+
const restaurantSetting = await restaurantApi.readRestaurantSetting(restaurantId)
|
|
64
|
+
state.value.restaurantSettings = {
|
|
65
|
+
...state.value.restaurantSettings,
|
|
66
|
+
[restaurantId]: restaurantSetting
|
|
67
|
+
}
|
|
68
|
+
return restaurantSetting
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function selectRestaurant(restaurantId: string) {
|
|
72
|
+
await readRestaurantSetting(restaurantId)
|
|
73
|
+
SvcConfig.setRestaurantId(restaurantId)
|
|
74
|
+
setRestaurantId(restaurantId)
|
|
75
|
+
FeatureFlag.setRestaurant(restaurantId || undefined)
|
|
76
|
+
localStorage.set('feedme_restaurant', restaurantId)
|
|
77
|
+
}
|
|
130
78
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
79
|
+
async function updateServiceCharge(serviceCharge: FdoServiceChargeSetting) {
|
|
80
|
+
await restaurantApi.updateServiceCharge(serviceCharge)
|
|
81
|
+
}
|
|
82
|
+
async function updateDineInSetting(setting: FdoRestaurantDineIn) {
|
|
83
|
+
await restaurantApi.updateDineInSetting(setting)
|
|
84
|
+
}
|
|
85
|
+
async function updatePickupSetting(setting: FdoRestaurantPickup) {
|
|
86
|
+
await restaurantApi.updatePickupSetting(setting)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function updateInhouseDelivery(restaurantId: string, dto: FdoRestaurantInHouseDelivery) {
|
|
90
|
+
await remoteOrderApi.integratedDelivery.updateInhouse(restaurantId, dto)
|
|
91
|
+
}
|
|
92
|
+
async function updateFeedmeDelivery(restaurantId: string, dto: FdoRestaurantFeedmeDelivery) {
|
|
93
|
+
return await remoteOrderApi.integratedDelivery.updateFeedme(restaurantId, dto)
|
|
94
|
+
}
|
|
95
|
+
async function updateIntegratedFoodpandaDelivery(restaurantId: string, dto: FdoFoodpandaSettings) {
|
|
96
|
+
await remoteOrderApi.integratedDelivery.updateFoodpanda(restaurantId, dto)
|
|
97
|
+
}
|
|
98
|
+
async function updateIntegratedGrabfoodDelivery(restaurantId: string, dto: FdoGrabfoodSettings) {
|
|
99
|
+
await remoteOrderApi.integratedDelivery.updateGrabfood(restaurantId, dto)
|
|
100
|
+
}
|
|
101
|
+
async function updateIntegratedShopeefoodDelivery(restaurantId: string, dto: FdoShopeeFoodSettings) {
|
|
102
|
+
await remoteOrderApi.integratedDelivery.updateShopeefood(restaurantId, dto)
|
|
103
|
+
}
|
|
104
|
+
async function updateExternalDelivery(restaurantId: string, dto: FdoExternalSetting) {
|
|
105
|
+
await remoteOrderApi.integratedDelivery.updateExternal(restaurantId, dto)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function getRestaurantEPayment(): true | string {
|
|
109
|
+
const { t } = useI18n()
|
|
110
|
+
if (!CoreStore.currentRestaurant.value) {
|
|
111
|
+
return 'getRestaurantEPayment - Invalid restaurant ';
|
|
112
|
+
}
|
|
113
|
+
const payoutAccount = CoreStore.currentRestaurant.value.payoutAccount;
|
|
114
|
+
const posVersion = CoreStore.currentRestaurant.value.posVersion;
|
|
115
|
+
|
|
116
|
+
const validPosVersion =
|
|
117
|
+
!!posVersion &&
|
|
118
|
+
Pos.canUse({
|
|
119
|
+
feature: F_FEATURE.enum.qrEPayment,
|
|
120
|
+
posVersion
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
if (!validPosVersion)
|
|
124
|
+
return t('order.payoutPosVersion', { version: Pos.minVersionToUse(F_FEATURE.enum.qrEPayment) })
|
|
125
|
+
if (!payoutAccount || !payoutAccount.enable) {
|
|
126
|
+
return t('order.payoutAccountIsRequired')
|
|
127
|
+
}
|
|
128
|
+
if (payoutAccount.status !== F_PAYOUT_ACCOUNT_STATUS.enum.APPROVED) {
|
|
129
|
+
return t('order.payoutAccountIsRequired')
|
|
140
130
|
}
|
|
131
|
+
return true
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
state: state.value,
|
|
136
|
+
currentRestaurantSetting : currentRestaurantSetting.value,
|
|
137
|
+
readRestaurantSetting,
|
|
138
|
+
selectRestaurant,
|
|
139
|
+
updateServiceCharge,
|
|
140
|
+
updateDineInSetting,
|
|
141
|
+
updatePickupSetting,
|
|
142
|
+
updateInhouseDelivery,
|
|
143
|
+
updateFeedmeDelivery,
|
|
144
|
+
updateIntegratedFoodpandaDelivery,
|
|
145
|
+
updateIntegratedGrabfoodDelivery,
|
|
146
|
+
updateIntegratedShopeefoodDelivery,
|
|
147
|
+
updateExternalDelivery,
|
|
148
|
+
getRestaurantEPayment
|
|
141
149
|
}
|
|
142
150
|
})
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col lg:flex-row md:flex-row sm:flex-row xs:flex-wrap justify-between">
|
|
3
|
-
<RestaurantSelector
|
|
4
|
-
:model-value="currentRestaurant?._id ?? undefined"
|
|
5
|
-
class="xs:order-2 xs:mb-3"
|
|
6
|
-
/>
|
|
3
|
+
<RestaurantSelector class="xs:order-2 xs:mb-3" />
|
|
7
4
|
<FmSearch
|
|
8
5
|
v-model="searchKey"
|
|
9
6
|
:placeholder="t('order.search')"
|
|
@@ -75,7 +72,7 @@
|
|
|
75
72
|
<InHouseDelivery
|
|
76
73
|
v-if="inHouseComponentProps.key === F_ORDER_PLATFORM.enum.IN_HOUSE"
|
|
77
74
|
:initial-value="inHouseComponentProps.initialValue"
|
|
78
|
-
:address="formatAddress(currentRestaurant
|
|
75
|
+
:address="formatAddress((currentRestaurant as any).profile.address)"
|
|
79
76
|
@update:model-value="handleModelValueUpdateInHouse"
|
|
80
77
|
/>
|
|
81
78
|
<ExternalSetting
|
|
@@ -380,7 +377,7 @@ async function updateInHouse({ key, setting }: IntegratedDeliveryRow) {
|
|
|
380
377
|
}
|
|
381
378
|
}
|
|
382
379
|
|
|
383
|
-
async function updateExternalDelivery(
|
|
380
|
+
async function updateExternalDelivery({ key, setting }: IntegratedDeliveryRow) {
|
|
384
381
|
clearComponentProps()
|
|
385
382
|
const externalSetting = setting as FdoExternalSetting
|
|
386
383
|
|
|
@@ -487,7 +484,7 @@ const external = computed<FdoExternalSetting>(() => {
|
|
|
487
484
|
...deliveryData.initExternalDelivery(),
|
|
488
485
|
...externalSetting.value
|
|
489
486
|
}
|
|
490
|
-
})
|
|
487
|
+
})
|
|
491
488
|
const localDeliveryCompanies = computed<DeliveryRow[]>(() => {
|
|
492
489
|
const res = filterLocalDeliveryCompanies(deliveryCompanies.value).map<DeliveryRow>((company) => {
|
|
493
490
|
const { name, paymentTypeKey, key } = company
|
|
@@ -619,9 +616,9 @@ const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
|
|
|
619
616
|
key: AUTO_INTEGRATION_CLIENT.external,
|
|
620
617
|
setting: external.value,
|
|
621
618
|
catalog: '-',
|
|
622
|
-
paymentType: '-',
|
|
623
|
-
status: [generateStatus(false, external.value.enable)]
|
|
624
|
-
}
|
|
619
|
+
paymentType: '-',
|
|
620
|
+
status: [generateStatus(false, external.value.enable)]
|
|
621
|
+
}
|
|
625
622
|
]
|
|
626
623
|
})
|
|
627
624
|
|
|
@@ -828,7 +825,10 @@ async function updateInHouseSetting() {
|
|
|
828
825
|
|
|
829
826
|
async function updateExternalDeliverySetting() {
|
|
830
827
|
sideSheetIntegrated.value = false
|
|
831
|
-
await restaurantStore.updateExternalDelivery(
|
|
828
|
+
await restaurantStore.updateExternalDelivery(
|
|
829
|
+
currentRestaurant.value?._id ?? '',
|
|
830
|
+
externalDoc.value
|
|
831
|
+
)
|
|
832
832
|
const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
|
|
833
833
|
if (!!res) {
|
|
834
834
|
await changeRestaurant(res)
|
|
@@ -80,16 +80,16 @@ const inhouse = reactive<InhouseDialogData>(
|
|
|
80
80
|
props.initialValue
|
|
81
81
|
? clone(props.initialValue)
|
|
82
82
|
: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
enable: false,
|
|
84
|
+
catalogId: null,
|
|
85
|
+
term: '',
|
|
86
|
+
areas: [],
|
|
87
|
+
ignoreStock: false,
|
|
88
|
+
paymentTypes: [],
|
|
89
|
+
offlinePaymentTypes: [],
|
|
90
|
+
deliveryTime: null,
|
|
91
|
+
taxes: {}
|
|
92
|
+
}
|
|
93
93
|
)
|
|
94
94
|
|
|
95
95
|
const tax = computed(() => ItemTax.taxSetting())
|
|
@@ -230,12 +230,13 @@ const actualDeliveryTime = computed({
|
|
|
230
230
|
</script>
|
|
231
231
|
|
|
232
232
|
<template>
|
|
233
|
-
<FmSwitch
|
|
234
|
-
:model-value="inhouse.enable"
|
|
235
|
-
:label="t('order.activateDeliveryCompany', {company:'In house'})"
|
|
233
|
+
<FmSwitch
|
|
234
|
+
:model-value="inhouse.enable"
|
|
235
|
+
:label="t('order.activateDeliveryCompany', { company: 'In house' })"
|
|
236
236
|
label-placement="right"
|
|
237
237
|
:sublabel="t('order.inhouseSwitchSublabel')"
|
|
238
|
-
@update:model-value="updateEnable"
|
|
238
|
+
@update:model-value="updateEnable"
|
|
239
|
+
/>
|
|
239
240
|
<div v-if="inhouse.enable">
|
|
240
241
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
241
242
|
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">{{ t('order.generalSetting') }}</div>
|
|
@@ -272,40 +273,39 @@ const actualDeliveryTime = computed({
|
|
|
272
273
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
273
274
|
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">
|
|
274
275
|
{{ t('order.taxSetting') }}
|
|
275
|
-
<span
|
|
276
|
-
|
|
277
|
-
v-if="!validPosVersion"
|
|
278
|
-
>
|
|
279
|
-
{{ t('order.taxSettingTerm', {validatePosVersion: minVersionForTax}) }}</span
|
|
276
|
+
<span class="text-fm-color-secondary-salmon fm-typo-en-body-sm-600" v-if="!validPosVersion">
|
|
277
|
+
{{ t('order.taxSettingTerm', { validatePosVersion: minVersionForTax }) }}</span
|
|
280
278
|
>
|
|
281
279
|
</div>
|
|
282
280
|
<div class="mb-5">
|
|
283
|
-
<FmSwitch
|
|
284
|
-
:model-value="hasInhouseDeliveryTax && validPosVersion"
|
|
281
|
+
<FmSwitch
|
|
282
|
+
:model-value="hasInhouseDeliveryTax && validPosVersion"
|
|
285
283
|
:disabled="!validPosVersion"
|
|
286
|
-
:label="t('order.inhouseDeliveryTaxLabel')"
|
|
287
|
-
label-placement="right"
|
|
284
|
+
:label="t('order.inhouseDeliveryTaxLabel')"
|
|
285
|
+
label-placement="right"
|
|
288
286
|
:sublabel="t('order.inhouseDeliveryTaxSublabel')"
|
|
289
|
-
@update:model-value="toggleTax"
|
|
287
|
+
@update:model-value="toggleTax"
|
|
288
|
+
/>
|
|
290
289
|
</div>
|
|
291
290
|
<div v-if="hasInhouseDeliveryTax && validPosVersion">
|
|
292
291
|
<div class="mb-5">
|
|
293
|
-
<TaxInput
|
|
294
|
-
:disable="!validPosVersion"
|
|
295
|
-
:model-value="taxSettings"
|
|
292
|
+
<TaxInput
|
|
293
|
+
:disable="!validPosVersion"
|
|
294
|
+
:model-value="taxSettings"
|
|
296
295
|
:tax-options="taxOptions"
|
|
297
296
|
:title="`${tax.systemCode} ${t('order.inhouseDeliveryInputLabel')}`"
|
|
298
|
-
@update:model-value="(ev) => updateTax(ev)"
|
|
297
|
+
@update:model-value="(ev) => updateTax(ev)"
|
|
299
298
|
/>
|
|
300
299
|
</div>
|
|
301
300
|
<div class="mb-5">
|
|
302
|
-
<FmRadioGroup
|
|
303
|
-
:disabled="!validPosVersion"
|
|
304
|
-
:model-value="taxInclusive"
|
|
305
|
-
label-mark="required"
|
|
301
|
+
<FmRadioGroup
|
|
302
|
+
:disabled="!validPosVersion"
|
|
303
|
+
:model-value="taxInclusive"
|
|
304
|
+
label-mark="required"
|
|
306
305
|
inline
|
|
307
306
|
:label="t('order.inhouseDeliveryTaxCalculation')"
|
|
308
|
-
@update:model-value="(ev) => updateTaxInclusive(ev as unknown as number)"
|
|
307
|
+
@update:model-value="(ev) => updateTaxInclusive(ev as unknown as number)"
|
|
308
|
+
>
|
|
309
309
|
<div v-for="option in taxInclusiveOptions" :key="option.value">
|
|
310
310
|
<FmRadio :value="option.value" :label="option.label" />
|
|
311
311
|
</div>
|
|
@@ -315,8 +315,12 @@ const actualDeliveryTime = computed({
|
|
|
315
315
|
</FmCard>
|
|
316
316
|
|
|
317
317
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
318
|
-
<PaymentSidesheet
|
|
319
|
-
:
|
|
318
|
+
<PaymentSidesheet
|
|
319
|
+
:paymentTypes="inhouse.paymentTypes"
|
|
320
|
+
:offlinePaymentTypes="inhouse.offlinePaymentTypes"
|
|
321
|
+
:allow-e-payment="restaurantStore.getRestaurantEPayment()"
|
|
322
|
+
@update:payments="updatePayment"
|
|
323
|
+
/>
|
|
320
324
|
</FmCard>
|
|
321
325
|
|
|
322
326
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
@@ -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>
|