@feedmepos/mf-order-setting 0.0.21-beta.2 → 0.0.22
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-TgyDh8aI.js → KioskDevicesView-C6YmdLKc.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-CiYEoMoW.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-DiLHpWbm.js} +2 -2
- package/dist/{KioskSettingView-fbOxH9m8.js → KioskSettingView-D-muNxlb.js} +1 -1
- package/dist/KioskView-kcjjk4fF.js +371 -0
- package/dist/{OrderSettingsView-mYvRn7u9.js → OrderSettingsView-D_bGK-3J.js} +34007 -32820
- package/dist/{app-A306cfER.js → app-C5qwExhL.js} +41 -23
- package/dist/app.js +1 -1
- package/dist/common/convertor/index.d.ts +2 -0
- package/dist/common/sms/index.d.ts +1 -1
- package/dist/common/util/index.d.ts +6 -0
- package/dist/{dayjs.min-CLR5r0qf.js → dayjs.min-kEC9G7bx.js} +36 -36
- package/dist/frontend/mf-order/src/api/remoteOrder/index.d.ts +5 -2
- package/dist/frontend/mf-order/src/app.d.ts +18 -0
- package/dist/frontend/mf-order/src/helpers/menu.d.ts +1 -1
- package/dist/frontend/mf-order/src/stores/app/index.d.ts +14 -4
- package/dist/frontend/mf-order/src/stores/menu/menu.d.ts +45 -35
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +581 -716
- package/dist/frontend/mf-order/src/views/all-orders/ReflowOrder.vue.d.ts +140 -174
- package/dist/frontend/mf-order/src/views/kiosk/KioskSummary.vue.d.ts +1 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/DeliverySetting.vue.d.ts +2 -2
- package/dist/frontend/mf-order/src/views/order-settings/delivery/delivery.d.ts +2 -1
- package/dist/frontend/mf-order/src/views/order-settings/delivery/delivery.data.d.ts +3 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/ExternalSetting.vue.d.ts +97 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/ShopeefoodSetting.vue.d.ts +3 -3
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-BJuGDir8.js → index-C_53CwBa.js} +2 -2
- package/dist/package/entity/booking/booking.do.d.ts +1516 -1276
- package/dist/package/entity/delivery/delivery.dto.d.ts +298 -251
- package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +539 -0
- package/dist/package/entity/incoming-order/incoming-order.do.d.ts +114 -9
- package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +865 -4
- package/dist/package/entity/incoming-order/incoming-order.enum.d.ts +1 -1
- package/dist/package/entity/index.d.ts +34 -22
- package/dist/package/entity/kiosk/kiosk.do.d.ts +12 -12
- package/dist/package/entity/kiosk/kiosk.dto.d.ts +12 -12
- package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +1942 -1642
- package/dist/package/entity/member/member.dto.d.ts +33 -0
- package/dist/package/entity/order/order-item/order-item.dto.d.ts +15 -0
- package/dist/package/entity/order/order.do.d.ts +37 -0
- package/dist/package/entity/order/order.dto.d.ts +808 -17435
- package/dist/package/entity/order/order.enum.d.ts +2 -0
- package/dist/package/entity/order-platform/external/auth/external-auth.do.d.ts +12 -0
- package/dist/package/entity/order-platform/external/auth/external-auth.dto.d.ts +27 -0
- package/dist/package/entity/order-platform/external/menu/external-menu.do.d.ts +2868 -0
- package/dist/package/entity/order-platform/external/menu/external-menu.dto.d.ts +21 -0
- package/dist/package/entity/order-platform/external/menu/external-menu.enum.d.ts +3 -0
- package/dist/package/entity/order-platform/external/order/external-order.do.d.ts +1373 -0
- package/dist/package/entity/order-platform/external/order/external-order.dto.d.ts +2834 -0
- package/dist/package/entity/order-platform/external/order/external-order.enum.d.ts +9 -0
- package/dist/package/entity/order-platform/external/setting/external-setting.do.d.ts +127 -0
- package/dist/package/entity/order-platform/external/setting/external-setting.dto.d.ts +95 -0
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.do.d.ts +175 -82
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +372 -291
- package/dist/package/entity/order-platform/foodpanda/foodpanda-settings.do.d.ts +4 -4
- package/dist/package/entity/order-platform/foodpanda/foodpanda-settings.dto.d.ts +3 -3
- package/dist/package/entity/order-platform/grabfood/grabfood-menu.do.d.ts +66 -65
- package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +435 -263
- package/dist/package/entity/order-platform/grabfood/grabfood-settings.do.d.ts +2 -2
- package/dist/package/entity/order-platform/grabfood/grabfood.dto.d.ts +47 -7
- package/dist/package/entity/order-platform/menu.dto.d.ts +126 -0
- package/dist/package/entity/order-platform/order-platform.dto.d.ts +4 -4
- package/dist/package/entity/order-platform/order-platform.enum.d.ts +1 -1
- package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +298 -250
- package/dist/package/entity/order-setting/kiosk/kiosk.dto.d.ts +0 -41
- package/dist/package/entity/printer/printer.do.d.ts +2 -2
- package/dist/package/entity/pubsub/ably/ably.do.d.ts +60 -9
- package/dist/package/entity/pubsub/ably/ably.enum.d.ts +1 -1
- package/dist/package/entity/queue/queue.do.d.ts +40 -0
- package/dist/{auth.dto-C5PLip9a.js → queue.do-Vog69wnQ.js} +34049 -33284
- package/package.json +4 -3
- package/src/api/remoteOrder/index.ts +13 -2
- package/src/helpers/menu.ts +2 -2
- package/src/locales/en-US.json +11 -1
- package/src/locales/zh-CN.json +10 -1
- package/src/stores/restaurant/index.ts +4 -1
- package/src/views/kiosk/KioskSummary.vue +4 -3
- package/src/views/kiosk/KioskView.vue +36 -3
- package/src/views/order-settings/delivery/DeliverySetting.vue +83 -6
- package/src/views/order-settings/delivery/delivery.data.ts +16 -1
- package/src/views/order-settings/delivery/delivery.ts +1 -0
- package/src/views/order-settings/delivery/integrated-delivery/ExternalSetting.vue +114 -0
- package/src/views/order-settings/delivery/integrated-delivery/FoodpandaSetting.vue +23 -6
- package/src/views/order-settings/delivery/integrated-delivery/GrabfoodSetting.vue +21 -16
- package/src/views/order-settings/delivery/integrated-delivery/ShopeefoodSetting.vue +58 -59
- package/src/views/order-settings/pickup/PickUpSetting.vue +1 -1
- package/src/views/order-settings/servicecharge/ServiceChargeRule.vue +214 -158
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +1 -0
- package/dist/KioskView-C0Vn5S89.js +0 -334
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedmepos/mf-order-setting",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./dist/app.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
"format": "prettier --write src/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@feedmepos/core": "^2.
|
|
29
|
-
"@feedmepos/menu": "^1.
|
|
28
|
+
"@feedmepos/core": "^2.14.0",
|
|
29
|
+
"@feedmepos/menu": "^1.5.6",
|
|
30
30
|
"@feedmepos/mf-common": "^1.11.6",
|
|
31
31
|
"@feedmepos/ordering": "^0.0.3",
|
|
32
32
|
"@feedmepos/ui-library": "^1.2.27",
|
|
33
33
|
"@types/googlemaps": "^3.43.3",
|
|
34
34
|
"axios": "^1.7.2",
|
|
35
35
|
"change-case": "^5.4.4",
|
|
36
|
+
"zod-openapi": "^4.1.0",
|
|
36
37
|
"date-fns": "^3.6.0",
|
|
37
38
|
"dayjs": "^1.11.12",
|
|
38
39
|
"firebase": "^10.13.1",
|
|
@@ -2,9 +2,9 @@ import type { AxiosInstance } from 'axios';
|
|
|
2
2
|
import { baseClientInstance, getData, SvcConfig } from '..';
|
|
3
3
|
import type { DeliveryCompany, LinkedDeliveryDoc } from '../../views/order-settings/delivery/delivery';
|
|
4
4
|
import { FdoFoodpandaSettings, FdoLinkedDelivery, FdoRestaurant, FdoRestaurantFeedmeDelivery, FdoRestaurantInHouseDelivery, FdoShopeeFoodOrder } from '@feedmepos/core/entity';
|
|
5
|
-
import type { FdoFoodpandaOrderOutput, FdoGrabfoodOrderOutput, FdoGrabfoodSettings, FdoShopeeFoodOrderOutput, FdoShopeeFoodSettings, FdtoGetOrderReq } from '@entity';
|
|
5
|
+
import type { FdoExternalSetting, FdoFoodpandaOrderOutput, FdoGrabfoodOrderOutput, FdoGrabfoodSettings, FdoShopeeFoodOrderOutput, FdoShopeeFoodSettings, FdtoGetOrderReq } from '@entity';
|
|
6
6
|
|
|
7
|
-
type DeliveryCompanyUrl = 'foodpanda' | 'grabfood' | 'shopeefood'
|
|
7
|
+
type DeliveryCompanyUrl = 'foodpanda' | 'grabfood' | 'shopeefood' | 'external'
|
|
8
8
|
|
|
9
9
|
const deliveryClientInstance = (
|
|
10
10
|
deliveryCompany: DeliveryCompanyUrl
|
|
@@ -110,6 +110,17 @@ export const remoteOrderApi = {
|
|
|
110
110
|
async syncShopeefoodMenu(storeId: string): Promise<FdoShopeeFoodSettings> {
|
|
111
111
|
return getData(await deliveryClientInstance('shopeefood').get(`/menu-sync/${storeId}`));
|
|
112
112
|
},
|
|
113
|
+
async readExternal(restaurantId: string): Promise<FdoExternalSetting | null> {
|
|
114
|
+
return getData(await deliveryClientInstance('external').get(`/setting/${restaurantId}`))
|
|
115
|
+
},
|
|
116
|
+
async updateExternal(restaurantId: string, dto: FdoExternalSetting): Promise<FdoExternalSetting> {
|
|
117
|
+
return getData(await deliveryClientInstance('external').put(`setting/${restaurantId}`, {
|
|
118
|
+
...dto
|
|
119
|
+
}))
|
|
120
|
+
},
|
|
121
|
+
async syncExternalMenu(restaurantId: string): Promise<FdoExternalSetting> {
|
|
122
|
+
return getData(await deliveryClientInstance('external').get(`/menu-sync/${restaurantId}`));
|
|
123
|
+
},
|
|
113
124
|
async flowTestOrder(
|
|
114
125
|
restaurantId: string,
|
|
115
126
|
platform: DeliveryCompanyUrl
|
package/src/helpers/menu.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface Option {
|
|
|
11
11
|
value: string | null;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
type Item = Omit<FdoMenuV4Item, 'variant'> & {
|
|
14
|
+
export type Item = Omit<FdoMenuV4Item, 'variant'> & {
|
|
15
15
|
codeName: string;
|
|
16
16
|
variant?: Omit<FdoItemVariant, 'variantCombinations'> & {
|
|
17
17
|
variantCombinations: (VariantItem & { codeName: string })[]
|
|
@@ -76,7 +76,7 @@ export class ItemTax {
|
|
|
76
76
|
return {
|
|
77
77
|
systemCode: [...new Set(countryFlattenTaxes.map((tax) => tax.systemCode))].join('/'),
|
|
78
78
|
countryTaxOptions: countryFlattenTaxes.map((tax) => ({
|
|
79
|
-
label: `${tax.name} (${
|
|
79
|
+
label: `${tax.name} (${Dinero.fromFdoDecimal({
|
|
80
80
|
decimal: tax.rate
|
|
81
81
|
}).multiply(100).toFormat(false)}%)`,
|
|
82
82
|
value: ItemTax.encodeTax(tax),
|
package/src/locales/en-US.json
CHANGED
|
@@ -194,6 +194,7 @@
|
|
|
194
194
|
"scanPay": "Scan Pay",
|
|
195
195
|
"search": "Search",
|
|
196
196
|
"searchRestaurant": "Search restaurants",
|
|
197
|
+
"selectAllItemsIncludeCustomItem": "All (Including custom item)",
|
|
197
198
|
"selectItem": "Select item",
|
|
198
199
|
"selectRestaurant": "Select Restaurant",
|
|
199
200
|
"selectServiceChargeType": "Select service charge type",
|
|
@@ -214,6 +215,7 @@
|
|
|
214
215
|
"success": "SUCCESS",
|
|
215
216
|
"sunday": "Sunday",
|
|
216
217
|
"syncMenu": "Sync Menu",
|
|
218
|
+
"syncMenuSuccess": "Sync menu successfully",
|
|
217
219
|
"table": "Table",
|
|
218
220
|
"tableSelected": "table(s) selected",
|
|
219
221
|
"tableService": "Table Service",
|
|
@@ -245,6 +247,14 @@
|
|
|
245
247
|
"updatePickupSetting": "Update Pickup Setting",
|
|
246
248
|
"updateSetting": "Update setting",
|
|
247
249
|
"vendorBearPercentage": "Vendor bear percentage",
|
|
248
|
-
"wednesday": "Wednesday"
|
|
250
|
+
"wednesday": "Wednesday",
|
|
251
|
+
"integratedDeliveryCompany": "Integrated delivery company",
|
|
252
|
+
"externalDelivery": "External Delivery",
|
|
253
|
+
"manageExternalDelivery": "Manage external delivery",
|
|
254
|
+
"deliveryCatalog": "Delivery catalog",
|
|
255
|
+
"pickupCatalog": "Pickup catalog",
|
|
256
|
+
"DeliverySettingUpdated": "Delivery setting updated.",
|
|
257
|
+
"selectPlatform": "Select Platform",
|
|
258
|
+
"platform": "Platform"
|
|
249
259
|
}
|
|
250
260
|
}
|
package/src/locales/zh-CN.json
CHANGED
|
@@ -194,6 +194,7 @@
|
|
|
194
194
|
"scanPay": "扫码支付",
|
|
195
195
|
"search": "搜索",
|
|
196
196
|
"searchRestaurant": "搜索餐厅",
|
|
197
|
+
"selectAllItemsIncludeCustomItem": "全部 (包括自定义商品)",
|
|
197
198
|
"selectItem": "请选择",
|
|
198
199
|
"selectRestaurant": "选择餐厅",
|
|
199
200
|
"selectServiceChargeType": "选择服务费类型",
|
|
@@ -214,6 +215,7 @@
|
|
|
214
215
|
"success": "成功",
|
|
215
216
|
"sunday": "星期日",
|
|
216
217
|
"syncMenu": "同步菜单",
|
|
218
|
+
"syncMenuSuccess": "同步菜单成功",
|
|
217
219
|
"table": "餐桌",
|
|
218
220
|
"tableSelected": "已选择餐桌",
|
|
219
221
|
"tableService": "餐桌服务",
|
|
@@ -245,6 +247,13 @@
|
|
|
245
247
|
"updatePickupSetting": "更新自取设置",
|
|
246
248
|
"updateSetting": "更新设置",
|
|
247
249
|
"vendorBearPercentage": "供应商承担百分比",
|
|
248
|
-
"wednesday": "星期三"
|
|
250
|
+
"wednesday": "星期三",
|
|
251
|
+
"externalDelivery": "External 配送",
|
|
252
|
+
"manageExternalDelivery": "管理外部配送",
|
|
253
|
+
"deliveryCatalog": "配送目录",
|
|
254
|
+
"pickupCatalog": "自取目录",
|
|
255
|
+
"DeliverySettingUpdated": "配送设置已更新",
|
|
256
|
+
"selectPlatform": "选择平台",
|
|
257
|
+
"platform": "平台"
|
|
249
258
|
}
|
|
250
259
|
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type FdoProfile,
|
|
15
15
|
type FdoRestaurant
|
|
16
16
|
} from '@feedmepos/core/entity'
|
|
17
|
-
import { FdoGrabfoodSettings } from '@entity'
|
|
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'
|
|
@@ -112,6 +112,9 @@ export const useRestaurantStore = defineStore('restaurant', {
|
|
|
112
112
|
async updateIntegratedShopeefoodDelivery(restaurantId: string, dto: FdoShopeeFoodSettings) {
|
|
113
113
|
await remoteOrderApi.integratedDelivery.updateShopeefood(restaurantId, dto)
|
|
114
114
|
},
|
|
115
|
+
async updateExternalDelivery(restaurantId: string, dto: FdoExternalSetting) {
|
|
116
|
+
await remoteOrderApi.integratedDelivery.updateExternal(restaurantId, dto)
|
|
117
|
+
},
|
|
115
118
|
getRestaurantEPayment(dto?: FdoRestaurant | undefined): true | string {
|
|
116
119
|
const { t } = useI18n()
|
|
117
120
|
if (!dto) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="p-[1.5rem] border fm-corner-radius-lg flex flex-col gap-5">
|
|
3
|
-
<span class="fm-typo-en-title-sm-600">{{ t('order.kioskSummary') }}</span>
|
|
4
|
-
<hr class="my-[0.25rem]" />
|
|
2
|
+
<div :class="dialogType ? '' : ['p-[1.5rem] border fm-corner-radius-lg flex flex-col gap-5 fixed ml-40 w-[320px]']">
|
|
3
|
+
<span v-if="!dialogType" class="fm-typo-en-title-sm-600">{{ t('order.kioskSummary') }}</span>
|
|
4
|
+
<hr v-if="!dialogType" class="my-[0.25rem]" />
|
|
5
5
|
<div class="flex flex-col gap-1">
|
|
6
6
|
<div class="flex flex-col gap-1">
|
|
7
7
|
<span class="fm-typo-en-body-lg-400 text-fm-color-typo-secondary">{{ t('order.kioskDisplay') }}</span>
|
|
@@ -59,6 +59,7 @@ interface Props {
|
|
|
59
59
|
restaurantId: string,
|
|
60
60
|
devices: MfKioskDevice[],
|
|
61
61
|
kioskOrderSetting: MfKioskOrderSetting | undefined,
|
|
62
|
+
dialogType: boolean
|
|
62
63
|
// getOrderSetting : () => MfKioskOrderSetting | undefined,
|
|
63
64
|
}
|
|
64
65
|
const props = defineProps<Props>();
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="py-[1.5rem]">
|
|
3
|
-
<FmPageHead :title="t('order.kiosk')"
|
|
3
|
+
<FmPageHead :title="t('order.kiosk')">
|
|
4
|
+
<template #append>
|
|
5
|
+
<FmButton
|
|
6
|
+
v-show="isMobile"
|
|
7
|
+
icon="info"
|
|
8
|
+
variant="tertiary"
|
|
9
|
+
@click="openKioskSummaryDialog"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
</FmPageHead>
|
|
4
13
|
<div class="flex px-[1.5rem]">
|
|
5
14
|
<div class="flex-[2_2_0%]">
|
|
6
15
|
<FmTabs v-model:model-value="selectedMenuItem" :items="menuItems"></FmTabs>
|
|
@@ -32,20 +41,28 @@
|
|
|
32
41
|
</div>
|
|
33
42
|
</div>
|
|
34
43
|
</div>
|
|
35
|
-
<div class="flex-[1_1_0%]">
|
|
44
|
+
<div v-if="!isMobile" class="flex-[1_1_0%]">
|
|
36
45
|
<KioskSummary
|
|
37
46
|
:restaurant-id="currentRestaurantId"
|
|
38
47
|
:devices="devices"
|
|
39
48
|
:kiosk-order-setting="OrderSettingStore.state.kiosk"
|
|
49
|
+
:dialogType="false"
|
|
40
50
|
/>
|
|
41
51
|
</div>
|
|
42
52
|
</div>
|
|
43
53
|
</div>
|
|
44
54
|
</template>
|
|
55
|
+
|
|
45
56
|
<script setup lang="ts">
|
|
46
57
|
import KioskDevicesView from '@/views/kiosk/devices/KioskDevicesView.vue'
|
|
47
58
|
import KioskSummary from '@/views/kiosk/KioskSummary.vue'
|
|
48
|
-
import {
|
|
59
|
+
import {
|
|
60
|
+
useDialog,
|
|
61
|
+
useSnackbar,
|
|
62
|
+
type FmTabProps,
|
|
63
|
+
type ISelectItem,
|
|
64
|
+
useBreakpoints
|
|
65
|
+
} from '@feedmepos/ui-library'
|
|
49
66
|
import { ref, computed, defineAsyncComponent, watch } from 'vue'
|
|
50
67
|
import { useKioskStore } from '@/stores/kiosk'
|
|
51
68
|
import type { MfKioskDevice } from '@/modules/kiosk/interface'
|
|
@@ -71,6 +88,9 @@ const Dialog = useDialog()
|
|
|
71
88
|
const { currentRestaurant, restaurants, changeRestaurant } = useCoreStore()
|
|
72
89
|
const SnackBar = useSnackbar()
|
|
73
90
|
|
|
91
|
+
const breakpoint = useBreakpoints()
|
|
92
|
+
const isMobile = computed(() => breakpoint.breakpoints.value.xs)
|
|
93
|
+
|
|
74
94
|
const currentSelect = ref<string | undefined>(currentRestaurant.value?._id ?? undefined)
|
|
75
95
|
|
|
76
96
|
const restaurantItems = computed<ISelectItem[]>(() => {
|
|
@@ -82,6 +102,19 @@ const restaurantItems = computed<ISelectItem[]>(() => {
|
|
|
82
102
|
|
|
83
103
|
const currentRestaurantId = ref<string>(currentRestaurant.value?._id ?? '')
|
|
84
104
|
|
|
105
|
+
function openKioskSummaryDialog() {
|
|
106
|
+
Dialog.open({
|
|
107
|
+
title: capitalCase(t('order.kioskSummary')),
|
|
108
|
+
contentComponent: KioskSummary,
|
|
109
|
+
contentComponentProps: {
|
|
110
|
+
restaurantId: currentRestaurant.value?._id,
|
|
111
|
+
devices: KioskStore.state.devices,
|
|
112
|
+
kioskOrderSetting: OrderSettingStore.state.kiosk,
|
|
113
|
+
dialogType: true
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
85
118
|
async function selectRestaurant(v: string) {
|
|
86
119
|
const restaurant = restaurants.value.find((r) => r._id == v)
|
|
87
120
|
await changeRestaurant(restaurant)
|
|
@@ -78,6 +78,12 @@
|
|
|
78
78
|
:address="formatAddress(currentRestaurant?.profile.address)"
|
|
79
79
|
@update:model-value="handleModelValueUpdateInHouse"
|
|
80
80
|
/>
|
|
81
|
+
<ExternalSetting
|
|
82
|
+
v-if="externalComponentProps.key === AUTO_INTEGRATION_CLIENT.external"
|
|
83
|
+
:initial-value="externalComponentProps.initialValue"
|
|
84
|
+
@update:model-value="handleModelValueUpdateExternal"
|
|
85
|
+
/>
|
|
86
|
+
|
|
81
87
|
<template #side-sheet-footer v-if="feedmeValidate !== false">
|
|
82
88
|
<div class="flex gap-8 items-center justify-start">
|
|
83
89
|
<FmButton
|
|
@@ -157,7 +163,7 @@
|
|
|
157
163
|
import { computed, h, ref, watch } from 'vue'
|
|
158
164
|
import RestaurantSelector from '../components/RestaurantSelector.vue'
|
|
159
165
|
import { type ColumnDef } from '@feedmepos/ui-library'
|
|
160
|
-
import type { FdoFoodpandaSettings } from '@entity'
|
|
166
|
+
import type { FdoExternalSetting, FdoFoodpandaSettings } from '@entity'
|
|
161
167
|
import type {
|
|
162
168
|
FdoLinkedDelivery,
|
|
163
169
|
FdoRestaurantFeedmeDelivery,
|
|
@@ -182,6 +188,7 @@ import type { FdoRestaurantFeedme } from '../delivery/integrated-delivery/Feedme
|
|
|
182
188
|
import FoodpandaSetting from './integrated-delivery/FoodpandaSetting.vue'
|
|
183
189
|
import GrabfoodSetting from './integrated-delivery/GrabfoodSetting.vue'
|
|
184
190
|
import ShopeefoodSetting from './integrated-delivery/ShopeefoodSetting.vue'
|
|
191
|
+
import ExternalSetting from './integrated-delivery/ExternalSetting.vue'
|
|
185
192
|
import { useRestaurantStore } from '@/stores/restaurant'
|
|
186
193
|
import FeedmeDelivery from './integrated-delivery/FeedmeDelivery.vue'
|
|
187
194
|
import InHouseDelivery, { type InhouseDialogData } from './inhouse/InHouseDelivery.vue'
|
|
@@ -215,6 +222,7 @@ type IntegratedDeliveryCompany =
|
|
|
215
222
|
| FdoFoodpandaSettings
|
|
216
223
|
| FdoGrabfoodSettings
|
|
217
224
|
| FdoShopeeFoodSettings
|
|
225
|
+
| FdoExternalSetting
|
|
218
226
|
export interface IntegratedDeliveryRow extends DeliveryRow {
|
|
219
227
|
setting: IntegratedDeliveryCompany
|
|
220
228
|
company?: DeliveryCompany
|
|
@@ -264,6 +272,10 @@ async function toggleIntegratedSidesheet(data: any) {
|
|
|
264
272
|
title.value = `${t('order.inhouseDeliveryTitle')}`
|
|
265
273
|
updateInHouse(rowData)
|
|
266
274
|
break
|
|
275
|
+
case AUTO_INTEGRATION_CLIENT.external:
|
|
276
|
+
title.value = `${t('order.manageExternalDelivery')}`
|
|
277
|
+
updateExternalDelivery(rowData)
|
|
278
|
+
break
|
|
267
279
|
}
|
|
268
280
|
}
|
|
269
281
|
|
|
@@ -287,6 +299,11 @@ const inHouseComponentProps = ref({
|
|
|
287
299
|
initialValue: {} as InhouseDialogData
|
|
288
300
|
})
|
|
289
301
|
|
|
302
|
+
const externalComponentProps = ref({
|
|
303
|
+
key: '' as string,
|
|
304
|
+
initialValue: {} as FdoExternalSetting
|
|
305
|
+
})
|
|
306
|
+
|
|
290
307
|
function clearComponentProps() {
|
|
291
308
|
feedMeComponentProps.value = {
|
|
292
309
|
key: '',
|
|
@@ -307,6 +324,11 @@ function clearComponentProps() {
|
|
|
307
324
|
},
|
|
308
325
|
canUseAuto: {} as boolean | string
|
|
309
326
|
}
|
|
327
|
+
|
|
328
|
+
externalComponentProps.value = {
|
|
329
|
+
key: '',
|
|
330
|
+
initialValue: {} as any
|
|
331
|
+
}
|
|
310
332
|
}
|
|
311
333
|
|
|
312
334
|
async function updateIntegratedDeliveryType({
|
|
@@ -358,6 +380,18 @@ async function updateInHouse({ key, setting }: IntegratedDeliveryRow) {
|
|
|
358
380
|
}
|
|
359
381
|
}
|
|
360
382
|
|
|
383
|
+
async function updateExternalDelivery( {key, setting}: IntegratedDeliveryRow) {
|
|
384
|
+
clearComponentProps()
|
|
385
|
+
const externalSetting = setting as FdoExternalSetting
|
|
386
|
+
|
|
387
|
+
externalComponentProps.value = {
|
|
388
|
+
key,
|
|
389
|
+
initialValue: {
|
|
390
|
+
...externalSetting
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
361
395
|
const { startAsyncCallWithErr, isLoading } = useLoading()
|
|
362
396
|
const columns: ColumnDef<any>[] = [
|
|
363
397
|
{
|
|
@@ -447,6 +481,13 @@ const shopee = computed<FdoShopeeFoodSettings>(() => {
|
|
|
447
481
|
...shopeefoodSetting.value
|
|
448
482
|
}
|
|
449
483
|
})
|
|
484
|
+
|
|
485
|
+
const external = computed<FdoExternalSetting>(() => {
|
|
486
|
+
return {
|
|
487
|
+
...deliveryData.initExternalDelivery(),
|
|
488
|
+
...externalSetting.value
|
|
489
|
+
}
|
|
490
|
+
})
|
|
450
491
|
const localDeliveryCompanies = computed<DeliveryRow[]>(() => {
|
|
451
492
|
const res = filterLocalDeliveryCompanies(deliveryCompanies.value).map<DeliveryRow>((company) => {
|
|
452
493
|
const { name, paymentTypeKey, key } = company
|
|
@@ -571,7 +612,16 @@ const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
|
|
|
571
612
|
canUseAutoDeliveryIntegration: canUseAutoDeliveryIntegration(
|
|
572
613
|
AUTO_INTEGRATION_CLIENT.shopeefood
|
|
573
614
|
)
|
|
574
|
-
}
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
id: loadingKey.value.external,
|
|
618
|
+
name: 'External delivery',
|
|
619
|
+
key: AUTO_INTEGRATION_CLIENT.external,
|
|
620
|
+
setting: external.value,
|
|
621
|
+
catalog: '-',
|
|
622
|
+
paymentType: '-',
|
|
623
|
+
status: [generateStatus(false, external.value.enable)],
|
|
624
|
+
},
|
|
575
625
|
]
|
|
576
626
|
})
|
|
577
627
|
|
|
@@ -583,6 +633,7 @@ const loadingKey = computed(() => {
|
|
|
583
633
|
gf: `${id}_gf`,
|
|
584
634
|
sf: `${id}_sf`,
|
|
585
635
|
fm: `${id}_fm`,
|
|
636
|
+
external: `${id}_external`,
|
|
586
637
|
local: (deliveryName: string) => `${id}_${deliveryName}`
|
|
587
638
|
}
|
|
588
639
|
})
|
|
@@ -604,7 +655,11 @@ async function updateIntegratedDeliveryCompany(company: IntegratedDeliveryRow) {
|
|
|
604
655
|
case F_ORDER_PLATFORM.enum.IN_HOUSE:
|
|
605
656
|
await updateInHouseSetting()
|
|
606
657
|
break
|
|
658
|
+
case AUTO_INTEGRATION_CLIENT.external:
|
|
659
|
+
await updateExternalDeliverySetting()
|
|
660
|
+
break
|
|
607
661
|
}
|
|
662
|
+
await readData()
|
|
608
663
|
}
|
|
609
664
|
|
|
610
665
|
const filteredCompanies = computed(() => {
|
|
@@ -624,6 +679,7 @@ const filteredCompanies = computed(() => {
|
|
|
624
679
|
const grabfoodSetting = ref<FdoGrabfoodSettings | null>(null)
|
|
625
680
|
const foodpandaSetting = ref<FdoFoodpandaSettings | null>(null)
|
|
626
681
|
const shopeefoodSetting = ref<FdoShopeeFoodSettings | null>(null)
|
|
682
|
+
const externalSetting = ref<FdoExternalSetting | null>(null)
|
|
627
683
|
const loadingDpi = ref<boolean>(false)
|
|
628
684
|
|
|
629
685
|
async function readData() {
|
|
@@ -641,6 +697,9 @@ async function readData() {
|
|
|
641
697
|
shopeefoodSetting.value = await remoteOrderApi.integratedDelivery.readShopeefood(
|
|
642
698
|
currentRestaurant.value?._id || ''
|
|
643
699
|
)
|
|
700
|
+
externalSetting.value = await remoteOrderApi.integratedDelivery.readExternal(
|
|
701
|
+
currentRestaurant.value?._id || ''
|
|
702
|
+
)
|
|
644
703
|
})
|
|
645
704
|
loadingDpi.value = false
|
|
646
705
|
}
|
|
@@ -653,7 +712,7 @@ async function updateLocalDeliveryCompany() {
|
|
|
653
712
|
company: selectedLocalRow.value.doc,
|
|
654
713
|
data: localDocUpdate
|
|
655
714
|
})
|
|
656
|
-
showSuccess('
|
|
715
|
+
showSuccess(t('order.DeliverySettingUpdated'))
|
|
657
716
|
}
|
|
658
717
|
|
|
659
718
|
async function updateManualDelivery({
|
|
@@ -737,7 +796,7 @@ async function updateIntegratedDeliverySetting() {
|
|
|
737
796
|
componentProps.value.canUseAuto
|
|
738
797
|
)
|
|
739
798
|
})
|
|
740
|
-
showSuccess('
|
|
799
|
+
showSuccess(t('order.DeliverySettingUpdated'))
|
|
741
800
|
}
|
|
742
801
|
|
|
743
802
|
async function updateFeedmeExpressSetting() {
|
|
@@ -754,7 +813,7 @@ async function updateFeedmeExpressSetting() {
|
|
|
754
813
|
currentRestaurant.value.feedmeDelivery = restaurant.feedmeDelivery
|
|
755
814
|
}
|
|
756
815
|
})
|
|
757
|
-
showSuccess('
|
|
816
|
+
showSuccess(t('order.DeliverySettingUpdated'))
|
|
758
817
|
}
|
|
759
818
|
|
|
760
819
|
async function updateInHouseSetting() {
|
|
@@ -764,7 +823,17 @@ async function updateInHouseSetting() {
|
|
|
764
823
|
if (!!res) {
|
|
765
824
|
await changeRestaurant(res)
|
|
766
825
|
}
|
|
767
|
-
showSuccess('
|
|
826
|
+
showSuccess(t('order.DeliverySettingUpdated'))
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
async function updateExternalDeliverySetting() {
|
|
830
|
+
sideSheetIntegrated.value = false
|
|
831
|
+
await restaurantStore.updateExternalDelivery(currentRestaurant.value?._id ?? '', externalDoc.value)
|
|
832
|
+
const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
|
|
833
|
+
if (!!res) {
|
|
834
|
+
await changeRestaurant(res)
|
|
835
|
+
}
|
|
836
|
+
showSuccess(t('order.DeliverySettingUpdated'))
|
|
768
837
|
}
|
|
769
838
|
|
|
770
839
|
async function updateDelivery(
|
|
@@ -807,6 +876,7 @@ async function updateDelivery(
|
|
|
807
876
|
|
|
808
877
|
const feedMeDoc = computed(() => feedMeComponentProps.value.initialValue)
|
|
809
878
|
const inHouseDoc = computed(() => inHouseComponentProps.value.initialValue)
|
|
879
|
+
const externalDoc = computed(() => externalComponentProps.value.initialValue)
|
|
810
880
|
|
|
811
881
|
const localManual = ref<LinkedDeliveryDoc>(componentProps.value.initialValue.manual)
|
|
812
882
|
const localAuto = ref(componentProps.value.initialValue.integrated)
|
|
@@ -828,6 +898,10 @@ function handleModelValueUpdateInHouse(v: any) {
|
|
|
828
898
|
inHouseComponentProps.value.initialValue = v
|
|
829
899
|
}
|
|
830
900
|
|
|
901
|
+
function handleModelValueUpdateExternal(v: any) {
|
|
902
|
+
externalComponentProps.value.initialValue = v
|
|
903
|
+
}
|
|
904
|
+
|
|
831
905
|
const feedmeValidate = ref<boolean | null>(null)
|
|
832
906
|
function handleValidationResult(v: boolean) {
|
|
833
907
|
feedmeValidate.value = v
|
|
@@ -854,6 +928,7 @@ type companyName =
|
|
|
854
928
|
| 'FoodPanda delivery'
|
|
855
929
|
| 'GrabFood delivery'
|
|
856
930
|
| 'ShopeeFood delivery'
|
|
931
|
+
| 'External delivery'
|
|
857
932
|
|
|
858
933
|
function convertIntegratedCompanyName(name: companyName): string {
|
|
859
934
|
switch (name) {
|
|
@@ -867,6 +942,8 @@ function convertIntegratedCompanyName(name: companyName): string {
|
|
|
867
942
|
return `${t('order.deliveryTitle', { company: 'GrabFood' })}`
|
|
868
943
|
case 'ShopeeFood delivery':
|
|
869
944
|
return `${t('order.deliveryTitle', { company: 'ShopeeFood' })}`
|
|
945
|
+
case 'External delivery':
|
|
946
|
+
return `${t('order.externalDelivery')}`
|
|
870
947
|
default:
|
|
871
948
|
return ''
|
|
872
949
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FdoExternalSetting } from '@entity';
|
|
1
2
|
import {
|
|
2
3
|
FdoRestaurantFeedmeDelivery,
|
|
3
4
|
FdoGrabfoodSettings,
|
|
@@ -66,10 +67,24 @@ function initShopeefoodDelivery(): FdoShopeeFoodSettings {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
function initExternalDelivery(): FdoExternalSetting {
|
|
71
|
+
return {
|
|
72
|
+
_id: '',
|
|
73
|
+
enable: false,
|
|
74
|
+
config: {
|
|
75
|
+
autoAccept: false,
|
|
76
|
+
autoSend: false,
|
|
77
|
+
autoCloseBill: false,
|
|
78
|
+
},
|
|
79
|
+
platform: 'ZUS',
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
export default {
|
|
70
84
|
initInhouseDelivery,
|
|
71
85
|
initFeedmeExpress,
|
|
72
86
|
initFoodpandaDelivery,
|
|
73
87
|
initGrabfoodDelivery,
|
|
74
|
-
initShopeefoodDelivery
|
|
88
|
+
initShopeefoodDelivery,
|
|
89
|
+
initExternalDelivery
|
|
75
90
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-grow mb-3 mt-3">
|
|
3
|
+
<FmSwitch
|
|
4
|
+
:model-value="data.enable"
|
|
5
|
+
:label="t('order.activateIntegration', { integrationType: t('order.auto') })"
|
|
6
|
+
label-placement="right"
|
|
7
|
+
@update:model-value="updateEnable"
|
|
8
|
+
/>
|
|
9
|
+
<div v-if="data.enable">
|
|
10
|
+
<FmCard variant="outlined" class="mt-10 p-5">
|
|
11
|
+
<div class="mb-3">
|
|
12
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-5">{{ t('order.syncMenu') }}</div>
|
|
13
|
+
|
|
14
|
+
<FmSelect
|
|
15
|
+
:placeholder="t('order.selectPlatform')"
|
|
16
|
+
:model-value="data.platform"
|
|
17
|
+
:label="t('order.platform')"
|
|
18
|
+
:items="platformOptions"
|
|
19
|
+
@update:model-value="updatePlatform"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<FmSelect
|
|
23
|
+
class="mt-5"
|
|
24
|
+
:placeholder="t('order.selectItem')"
|
|
25
|
+
:model-value="data.delivery!.catalogId"
|
|
26
|
+
:label="t('order.deliveryCatalog')"
|
|
27
|
+
:items="menuStore.catalogOptions"
|
|
28
|
+
@update:model-value="updateDeliveryMenuCatalog"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<FmSelect
|
|
32
|
+
class="mt-5"
|
|
33
|
+
:placeholder="t('order.selectItem')"
|
|
34
|
+
:model-value="data.pickup!.catalogId"
|
|
35
|
+
:label="t('order.pickupCatalog')"
|
|
36
|
+
:items="menuStore.catalogOptions"
|
|
37
|
+
@update:model-value="updatePickupMenuCatalog"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="flex flex-row mt-5">
|
|
42
|
+
<FmButton variant="primary" :label="t('order.syncMenu')" @click="syncMenu()" />
|
|
43
|
+
</div>
|
|
44
|
+
</FmCard>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
import { type PropType, computed, reactive, ref, watch } from 'vue'
|
|
51
|
+
import { F_ORDER_PLATFORM, type FdoExternalSetting } from '@entity'
|
|
52
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
53
|
+
import { clone } from '@/helpers/object'
|
|
54
|
+
import { useMenuStore } from '@/stores/menu/menu'
|
|
55
|
+
import { useLoading } from '@/composables/loading'
|
|
56
|
+
import { remoteOrderApi } from '@/api/remoteOrder'
|
|
57
|
+
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
58
|
+
|
|
59
|
+
const { showSuccess } = useSnackbarFunctions()
|
|
60
|
+
const { t } = useI18n()
|
|
61
|
+
const menuStore = useMenuStore()
|
|
62
|
+
|
|
63
|
+
const props = defineProps({
|
|
64
|
+
initialValue: {
|
|
65
|
+
type: Object as PropType<FdoExternalSetting>,
|
|
66
|
+
required: true
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const data = reactive<FdoExternalSetting>({
|
|
71
|
+
...clone(props.initialValue),
|
|
72
|
+
platform: props.initialValue.platform ?? 'ZUS',
|
|
73
|
+
delivery: props.initialValue.delivery ?? { catalogId: null },
|
|
74
|
+
pickup: props.initialValue.pickup ?? { catalogId: null }
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const platformOptions = ref([{ label: 'ZUS', value: F_ORDER_PLATFORM.enum.ZUS }])
|
|
78
|
+
|
|
79
|
+
const emits = defineEmits<{
|
|
80
|
+
(event: 'update:model-value', v: FdoExternalSetting): void
|
|
81
|
+
}>()
|
|
82
|
+
|
|
83
|
+
function emitUpdatedValue() {
|
|
84
|
+
emits('update:model-value', { ...data })
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function updateEnable(value: boolean) {
|
|
88
|
+
data.enable = value
|
|
89
|
+
emitUpdatedValue()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function updateDeliveryMenuCatalog(catalogId: string) {
|
|
93
|
+
data.delivery!.catalogId = catalogId
|
|
94
|
+
emitUpdatedValue()
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function updatePickupMenuCatalog(catalogId: string) {
|
|
98
|
+
data.pickup!.catalogId = catalogId
|
|
99
|
+
emitUpdatedValue()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function updatePlatform(platform: F_ORDER_PLATFORM) {
|
|
103
|
+
data.platform = platform
|
|
104
|
+
emitUpdatedValue()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const { startAsyncCallWithErr } = useLoading()
|
|
108
|
+
async function syncMenu() {
|
|
109
|
+
await startAsyncCallWithErr(async () => {
|
|
110
|
+
await remoteOrderApi.integratedDelivery.syncExternalMenu(data._id ?? '')
|
|
111
|
+
showSuccess(t('order.syncMenuSuccess'))
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
</script>
|