@feedmepos/mf-order-setting 0.0.14 → 0.0.15-alpha
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/KioskSettingView-3xlRvB18.js +4 -0
- package/dist/{app-vuQcAuTZ.js → app-C1l6ceHc.js} +9016 -8539
- package/dist/app.js +5 -4
- package/dist/frontend/mf-order/src/app.d.ts +472 -0
- package/dist/frontend/mf-order/src/main.d.ts +0 -472
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/app.ts +8 -0
- package/src/main.ts +6 -13
- package/src/views/order-settings/pickup/PickUpSetting.vue +1 -1
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +67 -23
- package/dist/KioskSettingView-BYv2A8Xy.js +0 -4
package/package.json
CHANGED
package/src/app.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { App } from 'vue'
|
|
2
|
+
import enUS from "./locales/en-US.json"
|
|
3
|
+
import zhCN from "./locales/zh-CN.json"
|
|
4
|
+
|
|
2
5
|
export { default as FmApp } from './App.vue'
|
|
3
6
|
export { routes as routers } from '../src/router/routes'
|
|
4
7
|
|
|
8
|
+
export const i18nMessages = {
|
|
9
|
+
"en-US": enUS,
|
|
10
|
+
"zh-CN": zhCN
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
export function initOrderSettingApp(app: App) {
|
|
6
14
|
|
|
7
15
|
}
|
package/src/main.ts
CHANGED
|
@@ -11,13 +11,7 @@ import { getAuth, signInWithCustomToken } from 'firebase/auth'
|
|
|
11
11
|
import { initializeApp } from 'firebase/app'
|
|
12
12
|
import { useIframeStore } from './stores/iframe'
|
|
13
13
|
import { createFeedMeI18n, type I18n, detectLocale } from "@feedmepos/mf-common"
|
|
14
|
-
import
|
|
15
|
-
import zhCN from "./locales/zh-CN.json"
|
|
16
|
-
|
|
17
|
-
export const i18nMessages = {
|
|
18
|
-
"en-US": enUS,
|
|
19
|
-
"zh-CN": zhCN
|
|
20
|
-
}
|
|
14
|
+
import { i18nMessages } from './app'
|
|
21
15
|
|
|
22
16
|
function initI18n(): I18n {
|
|
23
17
|
const i18n = createFeedMeI18n({
|
|
@@ -30,16 +24,15 @@ function initI18n(): I18n {
|
|
|
30
24
|
|
|
31
25
|
const app = createApp(Entry)
|
|
32
26
|
|
|
33
|
-
app.use(initI18n())
|
|
34
|
-
app.use(createPinia())
|
|
35
|
-
app.use(router)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
27
|
app.use(FeedMeUI, {
|
|
40
28
|
locale: detectLocale(),
|
|
41
29
|
})
|
|
42
30
|
|
|
31
|
+
app.use(initI18n())
|
|
32
|
+
|
|
33
|
+
app.use(createPinia())
|
|
34
|
+
app.use(router)
|
|
35
|
+
|
|
43
36
|
const CoreStore = useCoreStore();
|
|
44
37
|
const iframeMode = computed(() => {
|
|
45
38
|
return new URLSearchParams(window.location.search).get('iframe') === 'true';
|
|
@@ -5,22 +5,40 @@
|
|
|
5
5
|
<div v-if="!isLoading">
|
|
6
6
|
<div class="p-[1.5rem] flex flex-col gap-5">
|
|
7
7
|
<FmCard variant="outlined" class="p-5 sm:w-2/3 md:w-2/3 lg:w-1/3 xl:w-1/3">
|
|
8
|
-
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">
|
|
9
|
-
|
|
8
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">
|
|
9
|
+
{{ t('order.enableServiceCharge') }}
|
|
10
|
+
</div>
|
|
11
|
+
<FmSwitch
|
|
12
|
+
v-model="data.active"
|
|
13
|
+
value="first"
|
|
10
14
|
:sublabel="t('order.serviceChargeSublabel')"
|
|
11
|
-
:label="t('order.serviceCharge')"
|
|
12
|
-
|
|
15
|
+
:label="t('order.serviceCharge')"
|
|
16
|
+
label-placement="right"
|
|
17
|
+
:disabled="!canUseServiceCharge"
|
|
18
|
+
/>
|
|
19
|
+
<div
|
|
20
|
+
v-if="!canUseServiceCharge"
|
|
21
|
+
class="fm-typo-en-body-md-400 text-fm-color-typo-error ml-14"
|
|
22
|
+
>
|
|
13
23
|
{{ t('order.serviceChargeRule') }}
|
|
14
24
|
</div>
|
|
15
25
|
|
|
16
26
|
<div class="flex flex-col gap-5 m-5" v-if="data.active">
|
|
17
|
-
<FmRadioGroup
|
|
27
|
+
<FmRadioGroup
|
|
28
|
+
:model-value="chargeTime"
|
|
29
|
+
:label="t('order.chargeWhen')"
|
|
30
|
+
@update:model-value="updateChargeWhen"
|
|
31
|
+
>
|
|
18
32
|
<FmRadio value="beforeDiscount" :label="t('order.beforeBillDiscount')" />
|
|
19
33
|
<FmRadio value="afterDiscount" :label="t('order.afterBillDiscount')" />
|
|
20
34
|
</FmRadioGroup>
|
|
21
35
|
<RateInput :model-value="data.rate" @update:model-value="handleUpdateRate" />
|
|
22
36
|
|
|
23
|
-
<FmRadioGroup
|
|
37
|
+
<FmRadioGroup
|
|
38
|
+
:model-value="chargeValue"
|
|
39
|
+
:label="t('order.selectServiceChargeType')"
|
|
40
|
+
@update:model-value="updateInclusive"
|
|
41
|
+
>
|
|
24
42
|
<FmRadio value="exclusive" :label="t('order.exclusive')" />
|
|
25
43
|
<FmRadio value="inclusive" :label="t('order.inclusive')" />
|
|
26
44
|
</FmRadioGroup>
|
|
@@ -29,24 +47,40 @@
|
|
|
29
47
|
</div>
|
|
30
48
|
<div v-if="data.active">
|
|
31
49
|
<div class="flex flex-col gap-5 m-5">
|
|
32
|
-
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-3">
|
|
50
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-3">
|
|
51
|
+
{{ t('order.customServiceCharge') }}
|
|
52
|
+
</div>
|
|
33
53
|
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-5">
|
|
34
54
|
<div v-for="(rule, index) in data.rules" :key="index" class="h-full">
|
|
35
55
|
<FmCard variant="outlined">
|
|
36
56
|
<FmCardSection>
|
|
37
|
-
<ServiceChargeRule
|
|
38
|
-
:
|
|
39
|
-
:
|
|
40
|
-
:
|
|
41
|
-
|
|
57
|
+
<ServiceChargeRule
|
|
58
|
+
:model-value="rule"
|
|
59
|
+
:inclusive="data.inclusive"
|
|
60
|
+
:charge-before-discount="isBeforeDiscountBoolean"
|
|
61
|
+
:items="menuStore.categorizedItems"
|
|
62
|
+
:tables="tableSettingStore.tables"
|
|
63
|
+
:is-loading-menu="isLoadingMenu"
|
|
64
|
+
:is-loading-table="isLoadingTables"
|
|
65
|
+
@delete="deleteRule(index)"
|
|
66
|
+
@update:model-value="(v: FdoServiceChargeRule) => updateRule(index, v)"
|
|
67
|
+
/>
|
|
42
68
|
</FmCardSection>
|
|
43
69
|
</FmCard>
|
|
44
70
|
</div>
|
|
45
71
|
<div>
|
|
46
|
-
<FmCard
|
|
72
|
+
<FmCard
|
|
73
|
+
variant="outlined"
|
|
74
|
+
class="flex items-center justify-center w-full h-full border-dashed"
|
|
75
|
+
>
|
|
47
76
|
<FmCardSection class="flex items-center justify-center w-full">
|
|
48
|
-
<FmButton
|
|
49
|
-
|
|
77
|
+
<FmButton
|
|
78
|
+
variant="plain"
|
|
79
|
+
:label="t('order.addServiceCharge')"
|
|
80
|
+
icon="add"
|
|
81
|
+
@click="createRule"
|
|
82
|
+
class="border fm-corner-radius-lg border-fm-color-primary"
|
|
83
|
+
/>
|
|
50
84
|
</FmCardSection>
|
|
51
85
|
</FmCard>
|
|
52
86
|
</div>
|
|
@@ -54,7 +88,12 @@
|
|
|
54
88
|
</div>
|
|
55
89
|
</div>
|
|
56
90
|
<div class="fm-corner-radius-lg flex flex-col gap-5 m-5">
|
|
57
|
-
<FmButton
|
|
91
|
+
<FmButton
|
|
92
|
+
variant="primary"
|
|
93
|
+
:label="t('order.saveSetting')"
|
|
94
|
+
class="mr-auto"
|
|
95
|
+
@click="updateServiceChargeSetting"
|
|
96
|
+
/>
|
|
58
97
|
</div>
|
|
59
98
|
</div>
|
|
60
99
|
<FmCircularProgress size="xxl" v-else />
|
|
@@ -145,11 +184,14 @@ function updateInclusive(inclusiveValue: string) {
|
|
|
145
184
|
}
|
|
146
185
|
|
|
147
186
|
function createRule() {
|
|
148
|
-
data.value.rules
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
187
|
+
data.value.rules = [
|
|
188
|
+
...data.value.rules,
|
|
189
|
+
{
|
|
190
|
+
rate: data.value.rate,
|
|
191
|
+
inclusive: data.value.inclusive,
|
|
192
|
+
condition: {}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
153
195
|
}
|
|
154
196
|
|
|
155
197
|
function updateRule(index: number, rule: FdoServiceChargeRule) {
|
|
@@ -157,7 +199,7 @@ function updateRule(index: number, rule: FdoServiceChargeRule) {
|
|
|
157
199
|
}
|
|
158
200
|
|
|
159
201
|
function deleteRule(index: number) {
|
|
160
|
-
data.value.rules.
|
|
202
|
+
data.value.rules = data.value.rules.filter((_, id) => id !== index)
|
|
161
203
|
}
|
|
162
204
|
|
|
163
205
|
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
@@ -170,7 +212,9 @@ async function updateServiceChargeSetting() {
|
|
|
170
212
|
await restaurantStore.updateServiceCharge(data.value)
|
|
171
213
|
showSuccess('Service charge setting updated. ')
|
|
172
214
|
})
|
|
173
|
-
const restaurantSetting = await restaurantStore.readRestaurantSetting(
|
|
215
|
+
const restaurantSetting = await restaurantStore.readRestaurantSetting(
|
|
216
|
+
currentRestaurant.value?._id || ''
|
|
217
|
+
)
|
|
174
218
|
initialize(restaurantSetting)
|
|
175
219
|
}
|
|
176
220
|
|