@feedmepos/mf-order-setting 0.0.13 → 0.0.14
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-BYv2A8Xy.js +4 -0
- package/dist/{app-E2uM-UYx.js → app-vuQcAuTZ.js} +42464 -41973
- package/dist/app.js +1 -1
- package/dist/frontend/mf-order/src/main.d.ts +472 -0
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +12 -0
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +1 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/DeliverySetting.vue.d.ts +1 -1
- package/dist/frontend/mf-order/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue.d.ts +0 -8
- package/dist/frontend/mf-order/src/views/order-settings/general/GeneralSetting.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/order-settings/pickup/PaymentSidesheet.vue.d.ts +2 -16
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/package/entity/booking/booking.do.d.ts +60 -1025
- package/dist/package/entity/delivery/delivery.dto.d.ts +39 -208
- package/dist/package/entity/delivery/gateway/pandago.dto.d.ts +6 -6
- package/dist/package/entity/food-court/order.dto.d.ts +1607 -13450
- package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +1413 -291
- package/dist/package/entity/incoming-order/incoming-order.do.d.ts +602 -99
- package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +1182 -154
- package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +66 -875
- package/dist/package/entity/order/delivery/delivery.do.d.ts +12 -0
- package/dist/package/entity/order/menu/menu.dto.d.ts +6 -1
- package/dist/package/entity/order/order-item/order-item.dto.d.ts +847 -40
- package/dist/package/entity/order/order.do.d.ts +9 -3
- package/dist/package/entity/order/order.dto.d.ts +2639 -8399
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +12 -205
- package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +12 -205
- package/dist/package/entity/order-platform/menu.dto.d.ts +48 -48
- package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +12 -205
- 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/queue/queue.do.d.ts +50 -50
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +10 -0
- package/package.json +3 -2
- package/src/i18n.d.ts +11 -0
- package/src/locales/en-US.json +235 -0
- package/src/locales/zh-CN.json +235 -0
- package/src/main.ts +23 -1
- package/src/stores/restaurant/index.ts +31 -3
- package/src/stores/table-settings.ts +0 -5
- package/src/views/kiosk/KioskSummary.vue +16 -13
- package/src/views/kiosk/KioskView.vue +13 -10
- package/src/views/kiosk/devices/KioskDeviceCard.vue +10 -7
- package/src/views/kiosk/devices/KioskDevicesView.vue +6 -4
- package/src/views/kiosk/devices/KioskOtpDialog.vue +4 -1
- package/src/views/kiosk/devices/KioskUnbindConfirm.vue +3 -1
- package/src/views/kiosk/settings/KioskDineInSection.vue +4 -1
- package/src/views/kiosk/settings/KioskDisplayStandSection.vue +14 -11
- package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +4 -1
- package/src/views/kiosk/settings/KioskSettingView.vue +8 -5
- package/src/views/kiosk/settings/KioskTakeawaySection.vue +4 -1
- package/src/views/order-settings/OrderSettingsView.vue +13 -7
- package/src/views/order-settings/components/RestaurantSelector.vue +5 -2
- package/src/views/order-settings/delivery/DeliverySetting.vue +113 -60
- package/src/views/order-settings/delivery/components/ManualIntegratedDeliverySetting.vue +11 -8
- package/src/views/order-settings/delivery/components/TaxInput.vue +1 -1
- package/src/views/order-settings/delivery/inhouse/CurrencyInput.vue +2 -2
- package/src/views/order-settings/delivery/inhouse/DeliveryCustomTime.vue +31 -0
- package/src/views/order-settings/delivery/inhouse/DeliveryOrder.vue +12 -9
- package/src/views/order-settings/delivery/inhouse/DeliveryTime.vue +9 -6
- package/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue +63 -68
- package/src/views/order-settings/delivery/inhouse/TimePicker.vue +4 -1
- package/src/views/order-settings/delivery/inhouse/ZoneDialog.vue +7 -4
- package/src/views/order-settings/delivery/integrated-delivery/FeedmeDelivery.vue +38 -15
- package/src/views/order-settings/delivery/integrated-delivery/FoodpandaCampaignDialog.vue +7 -4
- package/src/views/order-settings/delivery/integrated-delivery/FoodpandaSetting.vue +7 -4
- package/src/views/order-settings/delivery/integrated-delivery/IntegratedDelivery.vue +99 -41
- package/src/views/order-settings/dinein/DineInSetting.vue +15 -12
- package/src/views/order-settings/dinein/OfflinePaymentTypeDialog.vue +9 -6
- package/src/views/order-settings/dinein/OfflinePaymentTypeDialogContent.vue +6 -3
- package/src/views/order-settings/dinein/PaymentType.vue +9 -6
- package/src/views/order-settings/general/GeneralSetting.vue +103 -0
- package/src/views/order-settings/pickup/AddressInput.vue +5 -2
- package/src/views/order-settings/pickup/CustomPayment.vue +10 -8
- package/src/views/order-settings/pickup/PaymentSidesheet.vue +114 -63
- package/src/views/order-settings/pickup/PickUpPointDialog.vue +7 -4
- package/src/views/order-settings/pickup/PickUpPointDialogContent.vue +7 -4
- package/src/views/order-settings/pickup/PickUpSetting.vue +13 -10
- package/src/views/order-settings/pickup/PickUpSettingDialog.vue +13 -8
- package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +37 -37
- package/src/views/order-settings/pickup/Preorder.vue +10 -8
- package/src/views/order-settings/servicecharge/RateInput.vue +12 -5
- package/src/views/order-settings/servicecharge/ServiceChargeRule.vue +44 -24
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +16 -13
- package/src/views/order-settings/sms/SmsSetting.vue +105 -29
- package/tsconfig.app.json +3 -1
- package/tsconfig.json +2 -1
- package/tsconfig.node.json +3 -1
- package/vite.config.ts +2 -1
- package/dist/KioskSettingView-_h6R-Crz.js +0 -4
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<div class="flex-grow fm-typo-en-title-sm-600">
|
|
4
|
-
<FmCheckbox
|
|
5
|
-
:
|
|
3
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">{{ t('order.acceptedPayment') }}</div>
|
|
4
|
+
<FmCheckbox
|
|
5
|
+
:model-value="parent"
|
|
6
|
+
value=""
|
|
7
|
+
:label="t('order.all')"
|
|
8
|
+
@update:model-value="handleUpdate"
|
|
9
|
+
:indeterminate="nestedVal.length > 0 && nestedVal.length < checkboxChildren.length"
|
|
10
|
+
/>
|
|
6
11
|
<div class="flex flex-row items-center">
|
|
7
|
-
<FmCheckbox
|
|
8
|
-
|
|
12
|
+
<FmCheckbox
|
|
13
|
+
v-model="nestedVal"
|
|
14
|
+
:label="checkboxChildren[0].label"
|
|
15
|
+
:value="checkboxChildren[0].value"
|
|
16
|
+
@update:model-value="handleUpdate"
|
|
17
|
+
/>
|
|
9
18
|
</div>
|
|
10
19
|
<div class="mt-3 mb-3">
|
|
11
|
-
<CustomPayment
|
|
12
|
-
|
|
20
|
+
<CustomPayment
|
|
21
|
+
:offlinePaymentTypes="localOfflinePaymentTypeCopy ?? []"
|
|
22
|
+
@update:offlinePaymentTypes="updateOfflinePaymentTypes"
|
|
23
|
+
/>
|
|
13
24
|
</div>
|
|
14
25
|
|
|
15
|
-
<div v-if="nestedVal.includes(
|
|
26
|
+
<div v-if="nestedVal.includes(F_ORDER_PAYMENT_TYPE.enum.cash)">
|
|
16
27
|
<div v-if="localOfflinePaymentTypes?.length === 0">
|
|
17
28
|
<FmCard variant="outlined">
|
|
18
|
-
<FmCardSection>
|
|
29
|
+
<FmCardSection>{{ t('order.cash') }}</FmCardSection>
|
|
19
30
|
</FmCard>
|
|
20
31
|
</div>
|
|
21
32
|
<p v-for="(type, i) in localOfflinePaymentTypes || []" :key="i">
|
|
@@ -34,47 +45,86 @@
|
|
|
34
45
|
</p>
|
|
35
46
|
</div>
|
|
36
47
|
|
|
37
|
-
<
|
|
38
|
-
|
|
48
|
+
<div class="m-5"></div>
|
|
49
|
+
|
|
50
|
+
<FmCheckbox
|
|
51
|
+
v-model="nestedVal"
|
|
52
|
+
:label="checkboxChildren[1].label"
|
|
53
|
+
:value="checkboxChildren[1].value"
|
|
54
|
+
@update:model-value="handleUpdate"
|
|
55
|
+
:disabled="checkboxChildren[1].disable"
|
|
56
|
+
>
|
|
57
|
+
</FmCheckbox>
|
|
58
|
+
|
|
59
|
+
<div class="text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7">
|
|
60
|
+
{{ checkboxChildren?.[1]?.suffix?.text }}
|
|
61
|
+
</div>
|
|
39
62
|
</div>
|
|
40
63
|
</template>
|
|
41
64
|
|
|
42
65
|
<script setup lang="ts">
|
|
43
66
|
import {
|
|
44
67
|
F_ORDER_PAYMENT_TYPE,
|
|
45
|
-
FdoRestaurantInHouseDelivery,
|
|
46
68
|
FdoRestaurantPickup,
|
|
47
69
|
FdoOfflinePaymentMethod
|
|
48
70
|
} from '@feedmepos/core/entity'
|
|
49
71
|
import CustomPayment from './CustomPayment.vue'
|
|
50
|
-
import {
|
|
72
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
51
73
|
|
|
74
|
+
import { computed, onMounted, ref } from 'vue'
|
|
75
|
+
import type { CheckboxOption } from '../../../components/type'
|
|
76
|
+
|
|
77
|
+
const { t } = useI18n()
|
|
52
78
|
const emits = defineEmits<{
|
|
53
|
-
(event: 'update:paymentTypes', v: F_ORDER_PAYMENT_TYPE[]): void
|
|
54
|
-
(
|
|
55
|
-
event: 'update:offlinePaymentTypes',
|
|
56
|
-
v:
|
|
57
|
-
| FdoRestaurantPickup['offlinePaymentTypes']
|
|
58
|
-
| FdoRestaurantInHouseDelivery['offlinePaymentTypes']
|
|
59
|
-
): void,
|
|
60
79
|
(
|
|
61
80
|
event: 'update:payments',
|
|
62
|
-
v: {
|
|
81
|
+
v: {
|
|
82
|
+
paymentTypes: F_ORDER_PAYMENT_TYPE[],
|
|
83
|
+
offlinePaymentTypes: FdoOfflinePaymentMethod[] | undefined | null
|
|
84
|
+
}
|
|
63
85
|
): void
|
|
64
86
|
}>()
|
|
65
87
|
|
|
66
88
|
const props = defineProps<{
|
|
67
89
|
paymentTypes: F_ORDER_PAYMENT_TYPE[] | null | undefined
|
|
68
90
|
offlinePaymentTypes: any
|
|
91
|
+
allowEPayment: Boolean | String
|
|
69
92
|
}>()
|
|
70
93
|
|
|
71
|
-
const parent =
|
|
94
|
+
const parent = computed<boolean>(() => {
|
|
95
|
+
return (
|
|
96
|
+
nestedVal.value.length ===
|
|
97
|
+
(props.allowEPayment === true
|
|
98
|
+
? checkboxChildren.value.length
|
|
99
|
+
: checkboxChildren.value.length - 1)
|
|
100
|
+
)
|
|
101
|
+
})
|
|
72
102
|
const nestedVal = ref<string[]>([])
|
|
73
103
|
|
|
74
|
-
const checkboxChildren =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
104
|
+
const checkboxChildren = computed(() => {
|
|
105
|
+
const allowedEPayment = props.allowEPayment === true
|
|
106
|
+
const options: CheckboxOption[] = [
|
|
107
|
+
{
|
|
108
|
+
label: `${t('order.offlinePayment')}`,
|
|
109
|
+
value: F_ORDER_PAYMENT_TYPE.enum.cash
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: `${t('order.ePayment')}`,
|
|
113
|
+
disable: !allowedEPayment,
|
|
114
|
+
suffix: !allowedEPayment
|
|
115
|
+
? {
|
|
116
|
+
text: `(${props.allowEPayment || t('order.notAllowed')})`,
|
|
117
|
+
class: 'text-negative t-system'
|
|
118
|
+
}
|
|
119
|
+
: {
|
|
120
|
+
text: '',
|
|
121
|
+
class: ''
|
|
122
|
+
},
|
|
123
|
+
value: F_ORDER_PAYMENT_TYPE.enum.ePayment
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
return options
|
|
127
|
+
})
|
|
78
128
|
|
|
79
129
|
const allowEPayment = computed(() => {
|
|
80
130
|
const paymentTypes = props.paymentTypes || []
|
|
@@ -88,48 +138,43 @@ const allowOfflinePayment = computed(() => {
|
|
|
88
138
|
return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.cash) || offlinePaymentTypes.length > 0
|
|
89
139
|
})
|
|
90
140
|
|
|
141
|
+
onMounted(() => {
|
|
142
|
+
initializeCheckboxes()
|
|
143
|
+
})
|
|
144
|
+
|
|
91
145
|
const initializeCheckboxes = () => {
|
|
92
146
|
const initialValues: string[] = []
|
|
93
|
-
if (allowOfflinePayment.value)
|
|
94
|
-
|
|
95
|
-
nestedVal.value = initialValues
|
|
96
|
-
parent.value = initialValues.length === checkboxChildren.length
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
initializeCheckboxes()
|
|
100
|
-
|
|
101
|
-
const handleParentUpdate = (ev: boolean) => {
|
|
102
|
-
nestedVal.value = ev ? checkboxChildren.map((item) => item.value) : []
|
|
103
|
-
parent.value = ev
|
|
104
|
-
|
|
105
|
-
const updatedPaymentTypes: F_ORDER_PAYMENT_TYPE[] = []
|
|
106
|
-
const updatedOfflinePaymentTypes = ev ? props.offlinePaymentTypes || [] : []
|
|
107
|
-
|
|
108
|
-
if (nestedVal.value.includes('e-payment')) {
|
|
109
|
-
updatedPaymentTypes.push(F_ORDER_PAYMENT_TYPE.enum.ePayment)
|
|
147
|
+
if (allowOfflinePayment.value) {
|
|
148
|
+
initialValues.push(F_ORDER_PAYMENT_TYPE.enum.cash)
|
|
110
149
|
}
|
|
111
|
-
if (
|
|
112
|
-
|
|
150
|
+
if (allowEPayment.value) {
|
|
151
|
+
initialValues.push(F_ORDER_PAYMENT_TYPE.enum.ePayment)
|
|
113
152
|
}
|
|
114
|
-
|
|
115
|
-
emits('update:offlinePaymentTypes', updatedOfflinePaymentTypes)
|
|
153
|
+
nestedVal.value = initialValues
|
|
116
154
|
}
|
|
117
155
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (ev.includes('offline')) {
|
|
129
|
-
updatedPaymentTypes.push(F_ORDER_PAYMENT_TYPE.enum.cash)
|
|
156
|
+
const handleUpdate = (ev: boolean | string[]) => {
|
|
157
|
+
if (typeof ev === 'boolean') {
|
|
158
|
+
const filteredCheckboxChildren = checkboxChildren.value.filter(
|
|
159
|
+
(item) =>
|
|
160
|
+
(item.value === F_ORDER_PAYMENT_TYPE.enum.ePayment && props.allowEPayment === true) ||
|
|
161
|
+
item.value !== F_ORDER_PAYMENT_TYPE.enum.ePayment
|
|
162
|
+
)
|
|
163
|
+
nestedVal.value = ev ? filteredCheckboxChildren.map((item) => item.value) : []
|
|
164
|
+
} else {
|
|
165
|
+
nestedVal.value = ev
|
|
130
166
|
}
|
|
131
|
-
|
|
132
|
-
|
|
167
|
+
const updatedPaymentTypes: F_ORDER_PAYMENT_TYPE[] = nestedVal.value.map((v) =>
|
|
168
|
+
F_ORDER_PAYMENT_TYPE.parse(v)
|
|
169
|
+
)
|
|
170
|
+
const updatedOfflinePaymentTypes = nestedVal.value.includes(F_ORDER_PAYMENT_TYPE.enum.cash)
|
|
171
|
+
? props.offlinePaymentTypes || []
|
|
172
|
+
: []
|
|
173
|
+
|
|
174
|
+
emits('update:payments', {
|
|
175
|
+
paymentTypes: updatedPaymentTypes,
|
|
176
|
+
offlinePaymentTypes: updatedOfflinePaymentTypes
|
|
177
|
+
})
|
|
133
178
|
}
|
|
134
179
|
|
|
135
180
|
const localOfflinePaymentTypes = ref<FdoRestaurantPickup['offlinePaymentTypes']>(
|
|
@@ -143,13 +188,19 @@ const localOfflinePaymentTypeCopy = computed(() => {
|
|
|
143
188
|
|
|
144
189
|
function updateOfflinePaymentTypes(v: FdoRestaurantPickup['offlinePaymentTypes']) {
|
|
145
190
|
localOfflinePaymentTypes.value = v || []
|
|
146
|
-
emits('update:
|
|
191
|
+
emits('update:payments', {
|
|
192
|
+
paymentTypes: props.paymentTypes??[],
|
|
193
|
+
offlinePaymentTypes: localOfflinePaymentTypes.value
|
|
194
|
+
})
|
|
147
195
|
}
|
|
148
196
|
|
|
149
197
|
function deleteOfflinePayment(index: number) {
|
|
150
198
|
if (localOfflinePaymentTypes.value) {
|
|
151
199
|
localOfflinePaymentTypes.value.splice(index, 1)
|
|
152
|
-
emits('update:
|
|
200
|
+
emits('update:payments', {
|
|
201
|
+
paymentTypes: props.paymentTypes?? [],
|
|
202
|
+
offlinePaymentTypes: localOfflinePaymentTypes.value
|
|
203
|
+
})
|
|
153
204
|
}
|
|
154
205
|
}
|
|
155
206
|
</script>
|
|
@@ -4,6 +4,9 @@ import { ref } from 'vue'
|
|
|
4
4
|
import PickUpPointDialogContent from './PickUpPointDialogContent.vue'
|
|
5
5
|
import type { FdoPickupPoint } from '@entity'
|
|
6
6
|
import type { FdoRestaurantPickup } from '@feedmepos/core/entity'
|
|
7
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
8
|
+
|
|
9
|
+
const { t } = useI18n()
|
|
7
10
|
|
|
8
11
|
interface Props {
|
|
9
12
|
pickupSetting: FdoRestaurantPickup
|
|
@@ -22,7 +25,7 @@ const openDialog = () => {
|
|
|
22
25
|
nameTextValue.value = ''
|
|
23
26
|
addressTextValue.value = ''
|
|
24
27
|
coordinatesValue.value = []
|
|
25
|
-
const title = currentIndex.value === null ? '
|
|
28
|
+
const title = currentIndex.value === null ? t('order.addPickupPoint') : t('order.editPickupPoint')
|
|
26
29
|
const point = currentIndex.value !== null ? pickupPoints.value[currentIndex.value] : null
|
|
27
30
|
|
|
28
31
|
if (point) {
|
|
@@ -49,8 +52,8 @@ const openDialog = () => {
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
},
|
|
52
|
-
primaryActions: { text: currentIndex.value === null ? '
|
|
53
|
-
secondaryActions: { text: '
|
|
55
|
+
primaryActions: { text: currentIndex.value === null ? t('order.add') : 'Update', close: true },
|
|
56
|
+
secondaryActions: { text: t('order.cancel'), close: true }
|
|
54
57
|
})
|
|
55
58
|
.onPrimary(async () => {
|
|
56
59
|
const updatedPoint = {
|
|
@@ -102,7 +105,7 @@ const emits = defineEmits<{
|
|
|
102
105
|
|
|
103
106
|
<template>
|
|
104
107
|
<div class="m-2">
|
|
105
|
-
<FmButton label="
|
|
108
|
+
<FmButton :label="t('order.addPickupPoint')" @click="addPickupPoint" variant="plain" icon="add" />
|
|
106
109
|
</div>
|
|
107
110
|
<div v-if="pickupPoints.length">
|
|
108
111
|
<div v-for="(point, index) in pickupPoints" :key="point.address" class="mb-5">
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<span>
|
|
3
|
+
<span>{{ t('order.name') }}</span>
|
|
4
4
|
<FmTextField
|
|
5
5
|
:model-value="data.name"
|
|
6
6
|
@update:model-value="updateNameValue"
|
|
7
|
-
placeholder="
|
|
8
|
-
:rules="[(val) => !!val || '
|
|
7
|
+
:placeholder="t('order.enterName')"
|
|
8
|
+
:rules="[(val) => !!val || t('order.fieldCannotBeEmpty')]"
|
|
9
9
|
/>
|
|
10
10
|
|
|
11
11
|
<div class="mb-12"></div>
|
|
12
|
-
<span>
|
|
12
|
+
<span>{{ t('order.address') }}</span>
|
|
13
13
|
<AddressInput :initial-value="data.address" @update:model-value="setLocation" />
|
|
14
14
|
|
|
15
15
|
<FmCard variant="outlined" class="mt-5">
|
|
@@ -35,7 +35,10 @@ import type { FdoPickupPoint } from '@feedmepos/core/entity'
|
|
|
35
35
|
import { computed, reactive, ref, watch } from 'vue'
|
|
36
36
|
import { GoogleMap } from '@/components'
|
|
37
37
|
import AddressInput from './AddressInput.vue'
|
|
38
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
38
39
|
|
|
40
|
+
const { t } = useI18n();
|
|
41
|
+
|
|
39
42
|
const props = defineProps<{
|
|
40
43
|
initialValue: FdoPickupPoint
|
|
41
44
|
}>()
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
</div>
|
|
5
5
|
<div v-else class="block m-3">
|
|
6
6
|
<div class="flex justify-end items-center mb-3">
|
|
7
|
-
<FmSearch v-model="searchKey" placeholder="
|
|
7
|
+
<FmSearch v-model="searchKey" :placeholder="t('order.search')" />
|
|
8
8
|
</div>
|
|
9
9
|
<PickupList :pickupSettingData="pickupSettingData" @toggleSideSheet="toggleSideSheet"
|
|
10
10
|
class="mt-5 md:hidden lg:hidden xl:hidden" />
|
|
11
11
|
<FmTable class="h-[500px] xs:hidden sm:hidden" :row-data="pickupSettingData" :hideFooter="true"
|
|
12
|
-
:column-defs="columns" :loading="isLoading" @row-click="toggleSideSheet"
|
|
12
|
+
:column-defs="columns" :loading="isLoading" @row-click="toggleSideSheet" :pageSize="pickupSettingData.length">
|
|
13
|
+
</FmTable>
|
|
13
14
|
<PickUpSettingDialog :showPickupDialog="sideSheet" @closeSideSheet="closeSideSheet" />
|
|
14
15
|
</div>
|
|
15
16
|
</template>
|
|
@@ -25,7 +26,9 @@ import { sentenceCase } from 'change-case'
|
|
|
25
26
|
import PickUpSettingDialog from './PickUpSettingDialog.vue'
|
|
26
27
|
import { useLoading } from '@/composables/loading'
|
|
27
28
|
import PickupList from './PickupList.vue'
|
|
29
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
28
30
|
|
|
31
|
+
const { t } = useI18n()
|
|
29
32
|
const { searchKey, filter } = useSearch()
|
|
30
33
|
const { restaurants, changeRestaurant, currentRestaurant } = useCoreStore()
|
|
31
34
|
const restaurantStore = useRestaurantStore()
|
|
@@ -120,10 +123,10 @@ const pickupSettingData = computed<PickupSettingData[]>(() => {
|
|
|
120
123
|
.filter((v) => !!v)
|
|
121
124
|
.join(', ')
|
|
122
125
|
|
|
123
|
-
const onlineStatus = item.enable ? '
|
|
126
|
+
const onlineStatus = item.enable ? t('order.activated') : t('order.inactive')
|
|
124
127
|
|
|
125
128
|
const preorderRange = item.pickupTime
|
|
126
|
-
? `${item.pickupTime.day.min} to ${item.pickupTime.day.max - 1}
|
|
129
|
+
? `${item.pickupTime.day.min} ${t('order.to')} ${item.pickupTime.day.max - 1} ${t('order.day')}`
|
|
127
130
|
: '-'
|
|
128
131
|
const pickupPointCount = item.pickupPointConfig?.points.length || 0
|
|
129
132
|
|
|
@@ -134,7 +137,7 @@ const pickupSettingData = computed<PickupSettingData[]>(() => {
|
|
|
134
137
|
online: onlineStatus,
|
|
135
138
|
enable: item.enable,
|
|
136
139
|
preorder: preorderRange,
|
|
137
|
-
pickuppoint: `${pickupPointCount}
|
|
140
|
+
pickuppoint: `${pickupPointCount} ${t('order.pickupPoint')}`
|
|
138
141
|
}
|
|
139
142
|
})
|
|
140
143
|
})
|
|
@@ -166,7 +169,7 @@ const getClassForOnline = (enabled: boolean) => {
|
|
|
166
169
|
const columns: ColumnDef<any>[] = [
|
|
167
170
|
{
|
|
168
171
|
accessorKey: 'restaurant',
|
|
169
|
-
header: () => '
|
|
172
|
+
header: () => t('order.restaurant'),
|
|
170
173
|
meta: {
|
|
171
174
|
maxWidth: '150px'
|
|
172
175
|
},
|
|
@@ -174,12 +177,12 @@ const columns: ColumnDef<any>[] = [
|
|
|
174
177
|
},
|
|
175
178
|
{
|
|
176
179
|
accessorKey: 'paymentmethod',
|
|
177
|
-
header: () => '
|
|
180
|
+
header: () => t('order.paymentMethod'),
|
|
178
181
|
enableSorting: false
|
|
179
182
|
},
|
|
180
183
|
{
|
|
181
184
|
accessorKey: 'online',
|
|
182
|
-
header: () => '
|
|
185
|
+
header: () => t('order.online'),
|
|
183
186
|
cell: (info: any) => {
|
|
184
187
|
const enabled = info.row.original.enable
|
|
185
188
|
const onlineStatus = info.getValue()
|
|
@@ -189,12 +192,12 @@ const columns: ColumnDef<any>[] = [
|
|
|
189
192
|
},
|
|
190
193
|
{
|
|
191
194
|
accessorKey: 'preorder',
|
|
192
|
-
header: () => '
|
|
195
|
+
header: () => t('order.preOrder'),
|
|
193
196
|
enableSorting: false
|
|
194
197
|
},
|
|
195
198
|
{
|
|
196
199
|
accessorKey: 'pickuppoint',
|
|
197
|
-
header: () => '
|
|
200
|
+
header: () => t('order.pickupPoint'),
|
|
198
201
|
enableSorting: false
|
|
199
202
|
}
|
|
200
203
|
]
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FmSideSheet header="
|
|
2
|
+
<FmSideSheet :header="t('order.updatePickupSetting')" dismiss-away class="w-full fm-typo-en-title-md-600" :maxWidth="600"
|
|
3
3
|
:model-value="props.showPickupDialog" @update:model-value="togglePickupDialog">
|
|
4
4
|
<PickUpSettingDialogContent @updatePickup="updatePickupSetting" :pickup="pickupSetting" />
|
|
5
5
|
<template #side-sheet-footer>
|
|
6
6
|
<div class="flex gap-8 items-center justify-start">
|
|
7
|
-
<FmButton variant="primary" label="
|
|
8
|
-
<FmButton variant="secondary" label="
|
|
7
|
+
<FmButton variant="primary" :label="t('order.apply')" size="lg" @click="onSave" />
|
|
8
|
+
<FmButton variant="secondary" :label="t('order.cancel')" size="lg" @click="togglePickupDialog" />
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
11
|
</FmSideSheet>
|
|
@@ -19,6 +19,9 @@ import { useLoading } from '@/composables/loading'
|
|
|
19
19
|
import { useRestaurantStore } from '@/stores/restaurant'
|
|
20
20
|
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
21
21
|
import { F_ORDER_PAYMENT_TYPE, FdoRestaurantPickup } from '@feedmepos/core/entity'
|
|
22
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
23
|
+
|
|
24
|
+
const { t } = useI18n()
|
|
22
25
|
|
|
23
26
|
const { currentRestaurant } = useCoreStore()
|
|
24
27
|
const { startAsyncCallWithErr } = useLoading()
|
|
@@ -26,7 +29,6 @@ const restaurantStore = useRestaurantStore()
|
|
|
26
29
|
const { showSuccess } = useSnackbarFunctions()
|
|
27
30
|
|
|
28
31
|
const pickupSetting = ref<FdoRestaurantPickup>(initDefaultPickupSetting())
|
|
29
|
-
|
|
30
32
|
const props = defineProps({
|
|
31
33
|
showPickupDialog: {
|
|
32
34
|
type: Boolean,
|
|
@@ -68,9 +70,12 @@ async function onSave() {
|
|
|
68
70
|
await restaurantStore.readRestaurantSetting(currentRestaurant.value?._id || '')
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
watch(
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
watch(
|
|
74
|
+
() => props.showPickupDialog,
|
|
75
|
+
() => {
|
|
76
|
+
if (currentRestaurant.value) {
|
|
77
|
+
pickupSetting.value = currentRestaurant.value.pickup ?? initDefaultPickupSetting()
|
|
78
|
+
}
|
|
74
79
|
}
|
|
75
|
-
|
|
80
|
+
)
|
|
76
81
|
</script>
|
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-3">
|
|
3
|
-
<FmSwitch :model-value="pickupSetting.ignoreStock ?? false" value="ignoreStock" label="
|
|
4
|
-
sublabel="
|
|
2
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-3">{{ t('order.generalSetting') }}</div>
|
|
3
|
+
<FmSwitch :model-value="pickupSetting.ignoreStock ?? false" value="ignoreStock" :label="t('order.ignoreStock')"
|
|
4
|
+
:sublabel="t('order.ignoreStockSublabel')" label-placement="right" @update:model-value="updateIgnoreStock" />
|
|
5
5
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
6
6
|
<Preorder :model-value="pickupData" @update:model-value="updatePickupSetting" />
|
|
7
7
|
</FmCard>
|
|
8
8
|
|
|
9
9
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
10
|
-
<PaymentSidesheet
|
|
11
|
-
:payment-types="pickupSetting.
|
|
12
|
-
|
|
10
|
+
<PaymentSidesheet
|
|
11
|
+
:offline-payment-types="pickupSetting.offlinePaymentTypes"
|
|
12
|
+
:allow-e-payment="restaurantStore.getRestaurantEPayment(currentRestaurant)"
|
|
13
|
+
:payment-types="pickupSetting.paymentTypes"
|
|
14
|
+
@update:payments="updatePayments"
|
|
15
|
+
/>
|
|
13
16
|
</FmCard>
|
|
14
17
|
|
|
15
18
|
<FmCard variant="outlined" class="p-5 mt-10">
|
|
16
|
-
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">
|
|
17
|
-
<FmSwitch :model-value="!!pickupSetting.pickupPointConfig" value="pickuppoint" label="
|
|
18
|
-
sublabel="
|
|
19
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">{{ t('order.pickupPoint') }}</div>
|
|
20
|
+
<FmSwitch :model-value="!!pickupSetting.pickupPointConfig" value="pickuppoint" :label="t('order.multiplePickupPoint')"
|
|
21
|
+
:sublabel="t('order.allowMultiplePickupSublabel')" label-placement="right"
|
|
19
22
|
@update:model-value="toggleMultiplePickupPoint" />
|
|
20
23
|
|
|
21
24
|
<template v-if="pickupSetting.pickupPointConfig">
|
|
22
25
|
<div class="mt-3">
|
|
23
|
-
<FmCheckbox v-model="pickupSetting.pickupPointConfig.restaurantEnable" label="
|
|
26
|
+
<FmCheckbox v-model="pickupSetting.pickupPointConfig.restaurantEnable" :label="t('order.restaurantAsPickupPoint')"
|
|
24
27
|
value="restaurant" />
|
|
25
28
|
</div>
|
|
26
29
|
<PickUpPointDialog @update:address="updatePickupPoints" :pickup-setting="pickupSetting" />
|
|
27
30
|
<div v-if="pickupSetting.pickupPointConfig">
|
|
28
|
-
<div
|
|
31
|
+
<div
|
|
32
|
+
v-for="point in pickupSetting.pickupPointConfig.points"
|
|
33
|
+
:key="point.address"
|
|
34
|
+
class="mb-5"
|
|
35
|
+
></div>
|
|
29
36
|
</div>
|
|
30
37
|
</template>
|
|
31
38
|
</FmCard>
|
|
@@ -36,18 +43,22 @@ import {
|
|
|
36
43
|
F_ORDER_PAYMENT_TYPE,
|
|
37
44
|
FdoOfflinePaymentMethod,
|
|
38
45
|
FdoPickupPoint,
|
|
39
|
-
FdoRestaurantPickup
|
|
40
|
-
FdoPickupTime,
|
|
41
|
-
FdoRestaurant
|
|
46
|
+
FdoRestaurantPickup
|
|
42
47
|
} from '@feedmepos/core/entity'
|
|
43
48
|
|
|
44
|
-
import { useCoreStore } from '@feedmepos/mf-common'
|
|
45
49
|
import { computed, ref, watch, type PropType } from 'vue'
|
|
46
50
|
import PickUpPointDialog from './PickUpPointDialog.vue'
|
|
47
51
|
import Preorder, { type PreorderData } from './Preorder.vue'
|
|
48
52
|
|
|
49
53
|
import PaymentSidesheet from './PaymentSidesheet.vue'
|
|
50
54
|
import { utils } from '@feedmepos/core'
|
|
55
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
56
|
+
import { useRestaurantStore } from '@/stores/restaurant'
|
|
57
|
+
import { useCoreStore } from '@feedmepos/mf-common'
|
|
58
|
+
|
|
59
|
+
const { t } = useI18n()
|
|
60
|
+
const restaurantStore = useRestaurantStore()
|
|
61
|
+
const { currentRestaurant } = useCoreStore()
|
|
51
62
|
|
|
52
63
|
const emits = defineEmits<{
|
|
53
64
|
(event: 'update-pickup', v: FdoRestaurantPickup): void
|
|
@@ -57,12 +68,12 @@ const props = defineProps({
|
|
|
57
68
|
pickup: {
|
|
58
69
|
type: Object as PropType<FdoRestaurantPickup>,
|
|
59
70
|
required: true
|
|
60
|
-
}
|
|
71
|
+
}
|
|
61
72
|
})
|
|
62
73
|
const pickupSetting = ref<FdoRestaurantPickup>(defaultPickupSetting())
|
|
63
74
|
const pickupData = computed<PreorderData | null>(() => {
|
|
64
75
|
if (!pickupSetting.value.pickupTime) {
|
|
65
|
-
return null
|
|
76
|
+
return null
|
|
66
77
|
}
|
|
67
78
|
const { min, max } = pickupSetting.value.pickupTime.day
|
|
68
79
|
return {
|
|
@@ -78,10 +89,6 @@ function defaultPickupSetting(): FdoRestaurantPickup {
|
|
|
78
89
|
paymentTypes: [F_ORDER_PAYMENT_TYPE.enum.cash]
|
|
79
90
|
}
|
|
80
91
|
}
|
|
81
|
-
const allowEPayment = computed(() => {
|
|
82
|
-
const paymentTypes = pickupSetting.value.paymentTypes || []
|
|
83
|
-
return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.ePayment)
|
|
84
|
-
})
|
|
85
92
|
|
|
86
93
|
const allowOfflinePayment = computed(() => {
|
|
87
94
|
const paymentTypes = pickupSetting.value.paymentTypes || []
|
|
@@ -100,7 +107,8 @@ const checkboxChildren = [
|
|
|
100
107
|
const initializeCheckboxes = () => {
|
|
101
108
|
const initialValues: string[] = []
|
|
102
109
|
if (allowOfflinePayment.value) initialValues.push('offline')
|
|
103
|
-
if (
|
|
110
|
+
if (restaurantStore.getRestaurantEPayment(currentRestaurant.value))
|
|
111
|
+
initialValues.push('e-payment')
|
|
104
112
|
nestedVal.value = initialValues
|
|
105
113
|
parent.value = initialValues.length === checkboxChildren.length
|
|
106
114
|
}
|
|
@@ -120,26 +128,16 @@ function toggleMultiplePickupPoint(value: boolean) {
|
|
|
120
128
|
emits('update-pickup', pickup)
|
|
121
129
|
}
|
|
122
130
|
|
|
123
|
-
function updatePayments(payments: {
|
|
131
|
+
function updatePayments(payments: {
|
|
132
|
+
paymentTypes: F_ORDER_PAYMENT_TYPE[]
|
|
133
|
+
offlinePaymentTypes: FdoOfflinePaymentMethod[] | undefined | null
|
|
134
|
+
}) {
|
|
124
135
|
const pickup = utils.clone(pickupSetting.value)
|
|
125
136
|
pickup.paymentTypes = payments.paymentTypes
|
|
126
137
|
pickup.offlinePaymentTypes = payments.offlinePaymentTypes
|
|
127
138
|
emits('update-pickup', pickup)
|
|
128
139
|
}
|
|
129
140
|
|
|
130
|
-
function updatePaymentTypes(paymentTypes: F_ORDER_PAYMENT_TYPE[]) {
|
|
131
|
-
const pickup = utils.clone(pickupSetting.value)
|
|
132
|
-
pickup.paymentTypes = paymentTypes
|
|
133
|
-
emits('update-pickup', pickup)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function updateOfflinePaymentTypes(offlinePaymentTypes: FdoOfflinePaymentMethod[] | undefined | null) {
|
|
137
|
-
const pickup = utils.clone(pickupSetting.value)
|
|
138
|
-
|
|
139
|
-
pickup.offlinePaymentTypes = offlinePaymentTypes
|
|
140
|
-
emits('update-pickup', pickup)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
141
|
async function updatePickupPoints(newPoints: FdoPickupPoint[]) {
|
|
144
142
|
const pickup = utils.clone(pickupSetting.value)
|
|
145
143
|
|
|
@@ -150,7 +148,9 @@ async function updatePickupPoints(newPoints: FdoPickupPoint[]) {
|
|
|
150
148
|
}
|
|
151
149
|
}
|
|
152
150
|
const existingPoints = pickup.pickupPointConfig.points || []
|
|
153
|
-
const existingPointsMap = new Map(
|
|
151
|
+
const existingPointsMap = new Map(
|
|
152
|
+
existingPoints.map((point: FdoPickupPoint) => [point.address, point])
|
|
153
|
+
)
|
|
154
154
|
const newPointsMap = new Map(newPoints.map((point) => [point.address, point]))
|
|
155
155
|
const updatedPoints = [
|
|
156
156
|
...newPoints.filter((point: FdoPickupPoint) => !existingPointsMap.has(point.address)),
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import Day from 'dayjs'
|
|
3
3
|
import { type PropType, computed } from 'vue'
|
|
4
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
5
|
+
|
|
6
|
+
const { t } = useI18n()
|
|
4
7
|
|
|
5
8
|
export interface PreorderData {
|
|
6
9
|
day: {
|
|
@@ -101,24 +104,23 @@ const endTimeRule = computed(() => (value: number) => {
|
|
|
101
104
|
</script>
|
|
102
105
|
|
|
103
106
|
<template>
|
|
104
|
-
<div class="flex-grow fm-typo-en-title-sm-600">
|
|
107
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3">{{ t('order.orderType') }}</div>
|
|
105
108
|
<FmRadioGroup :model-value="pickupType" @update:model-value="updatePickupType">
|
|
106
|
-
<FmRadio value="asap" label="
|
|
107
|
-
<FmRadio value="preorder" label="
|
|
109
|
+
<FmRadio value="asap" :label="t('order.asap')" />
|
|
110
|
+
<FmRadio value="preorder" :label="t('order.preOrder')" />
|
|
108
111
|
</FmRadioGroup>
|
|
109
112
|
<div v-if="pickupType === 'preorder'" class="flex items-center">
|
|
110
|
-
|
|
113
|
+
{{ t('order.orderFrom') }}
|
|
111
114
|
<div class="w-20 ml-3 mr-3">
|
|
112
115
|
<FmTextField :model-value="min" @update:model-value="updateStartTime" :rules="[startTimeRule]" />
|
|
113
116
|
</div>
|
|
114
|
-
|
|
117
|
+
{{ t('order.daysTo') }}
|
|
115
118
|
<div class="w-20 ml-3 mr-3">
|
|
116
119
|
<FmTextField :model-value="max" @update:model-value="updateEndTime" :rules="[endTimeRule]" />
|
|
117
120
|
</div>
|
|
118
|
-
days
|
|
121
|
+
{{ t('order.days') }}
|
|
119
122
|
</div>
|
|
120
123
|
<div v-if="pickupType === 'preorder'" class="text-fm-color-overlay-background fm-typo-en-body-sm-400 mt-3">
|
|
121
|
-
|
|
122
|
-
{{ preorderHint.end }}. Max 7 days.
|
|
124
|
+
{{ t('order.preOrderHint', {today: preorderHint.today, start: preorderHint.start, end:preorderHint.end}) }}
|
|
123
125
|
</div>
|
|
124
126
|
</template>
|