@feedmepos/mf-order-setting 0.0.48 → 0.0.49

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.
Files changed (48) hide show
  1. package/dist/{KioskDevicesView-iZTQ--DO.js → KioskDevicesView-Ch_mWJz9.js} +1 -1
  2. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-CPDemTBj.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-DV2HYd8u.js} +2 -2
  3. package/dist/{KioskSettingView-mN7UPNYu.js → KioskSettingView-CaBhf48e.js} +34 -33
  4. package/dist/{KioskView-NEpc7Ivb.js → KioskView-BGm-emCw.js} +4 -4
  5. package/dist/{OrderSettingsView-B5Nq_u9Z.js → OrderSettingsView-CRgoLOD2.js} +15016 -14688
  6. package/dist/{app-B3KtJhiw.js → app-CDTAjXj9.js} +35 -19
  7. package/dist/app.js +1 -1
  8. package/dist/{dayjs.min-GjkM9dM2.js → dayjs.min-dI_j30pv.js} +1 -1
  9. package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +2 -1
  10. package/dist/frontend/mf-order/src/app.d.ts +16 -0
  11. package/dist/frontend/mf-order/src/main.d.ts +16 -0
  12. package/dist/frontend/mf-order/src/stores/menu/menu.d.ts +1 -0
  13. package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +5 -2
  14. package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/ExternalSetting.vue.d.ts +8 -0
  15. package/dist/frontend/mf-order/src/views/order-settings/drive-thru/DriveThruSetting.vue.d.ts +2 -0
  16. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  17. package/dist/{index-Dwzta1U-.js → index-B8U5Sawr.js} +2 -2
  18. package/dist/{menu.dto-DgPhiIVk.js → menu.dto-qVeqpSdz.js} +25581 -25101
  19. package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +4 -4
  20. package/dist/package/entity/incoming-order/incoming-order.do.d.ts +63 -18
  21. package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +12 -12
  22. package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +1071 -0
  23. package/dist/package/entity/order/order-item/order-item.dto.d.ts +8 -0
  24. package/dist/package/entity/order/order.dto.d.ts +16 -8
  25. package/dist/package/entity/order-platform/deliveroo/deliveroo-dto.d.ts +2 -2
  26. package/dist/package/entity/order-platform/deliveroo/deliveroo-setting.do.d.ts +2 -2
  27. package/dist/package/entity/order-platform/external/setting/external-setting.do.d.ts +6 -0
  28. package/dist/package/entity/order-platform/external/setting/external-setting.dto.d.ts +6 -0
  29. package/dist/package/entity/order-platform/foodpanda/foodpanda-settings.do.d.ts +4 -4
  30. package/dist/package/entity/order-platform/foodpanda/foodpanda-settings.dto.d.ts +5 -5
  31. package/dist/package/entity/order-platform/grabfood/grabfood-settings.do.d.ts +2 -2
  32. package/dist/package/entity/order-platform/grabfood/grabfood.dto.d.ts +6 -6
  33. package/dist/package/entity/order-platform/shopeefood/shopeefood-settings.do.d.ts +2 -2
  34. package/dist/package/entity/order-platform/shopeefood/shopeefood-settings.dto.d.ts +2 -2
  35. package/dist/package/entity/queue/queue.do.d.ts +12 -0
  36. package/dist/package/entity/queue/queue.dto.d.ts +6 -6
  37. package/package.json +4 -4
  38. package/src/api/restaurant-setting/index.ts +6 -0
  39. package/src/locales/en-US.json +4 -0
  40. package/src/locales/ja-JP.json +4 -0
  41. package/src/locales/th-TH.json +4 -0
  42. package/src/locales/zh-CN.json +4 -0
  43. package/src/main.ts +2 -2
  44. package/src/stores/restaurant/index.ts +6 -0
  45. package/src/views/kiosk/settings/KioskPaymentTypeSection.vue +8 -3
  46. package/src/views/order-settings/OrderSettingsView.vue +6 -1
  47. package/src/views/order-settings/delivery/integrated-delivery/ExternalSetting.vue +22 -1
  48. package/src/views/order-settings/drive-thru/DriveThruSetting.vue +101 -0
@@ -3852,6 +3852,7 @@ export declare const RestaurantQueueDto: z.ZodObject<{
3852
3852
  target: "PAYMENT";
3853
3853
  };
3854
3854
  success: boolean;
3855
+ from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
3855
3856
  adjustment: {
3856
3857
  inclusive?: boolean | null | undefined;
3857
3858
  type: "BY_PERCENTAGE" | "BY_AMOUNT" | "TO_AMOUNT";
@@ -3861,7 +3862,6 @@ export declare const RestaurantQueueDto: z.ZodObject<{
3861
3862
  };
3862
3863
  };
3863
3864
  referenceId: string;
3864
- from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
3865
3865
  }, {
3866
3866
  reason?: string | null | undefined;
3867
3867
  priority?: number | null | undefined;
@@ -3943,6 +3943,7 @@ export declare const RestaurantQueueDto: z.ZodObject<{
3943
3943
  target: "PAYMENT";
3944
3944
  };
3945
3945
  success: boolean;
3946
+ from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
3946
3947
  adjustment: {
3947
3948
  inclusive?: boolean | null | undefined;
3948
3949
  type: "BY_PERCENTAGE" | "BY_AMOUNT" | "TO_AMOUNT";
@@ -3952,7 +3953,6 @@ export declare const RestaurantQueueDto: z.ZodObject<{
3952
3953
  };
3953
3954
  };
3954
3955
  referenceId: string;
3955
- from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
3956
3956
  }>>, "many">>;
3957
3957
  option: z.ZodDiscriminatedUnion<"type", z.Primitive, z.ZodObject<z.extendShape<{
3958
3958
  type: z.ZodEnum<["DINE_IN", "PICKUP", "DELIVERY"]>;
@@ -6059,6 +6059,7 @@ export declare const RestaurantQueueDto: z.ZodObject<{
6059
6059
  target: "PAYMENT";
6060
6060
  };
6061
6061
  success: boolean;
6062
+ from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
6062
6063
  adjustment: {
6063
6064
  inclusive?: boolean | null | undefined;
6064
6065
  type: "BY_PERCENTAGE" | "BY_AMOUNT" | "TO_AMOUNT";
@@ -6068,7 +6069,6 @@ export declare const RestaurantQueueDto: z.ZodObject<{
6068
6069
  };
6069
6070
  };
6070
6071
  referenceId: string;
6071
- from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
6072
6072
  })[];
6073
6073
  orderAt: string;
6074
6074
  }, {
@@ -6360,6 +6360,7 @@ export declare const RestaurantQueueDto: z.ZodObject<{
6360
6360
  target: "PAYMENT";
6361
6361
  };
6362
6362
  success: boolean;
6363
+ from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
6363
6364
  adjustment: {
6364
6365
  inclusive?: boolean | null | undefined;
6365
6366
  type: "BY_PERCENTAGE" | "BY_AMOUNT" | "TO_AMOUNT";
@@ -6369,7 +6370,6 @@ export declare const RestaurantQueueDto: z.ZodObject<{
6369
6370
  };
6370
6371
  };
6371
6372
  referenceId: string;
6372
- from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
6373
6373
  })[] | undefined;
6374
6374
  option: {
6375
6375
  remark?: string | null | undefined;
@@ -7441,6 +7441,7 @@ export declare const RestaurantQueueDto: z.ZodObject<{
7441
7441
  target: "PAYMENT";
7442
7442
  };
7443
7443
  success: boolean;
7444
+ from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
7444
7445
  adjustment: {
7445
7446
  inclusive?: boolean | null | undefined;
7446
7447
  type: "BY_PERCENTAGE" | "BY_AMOUNT" | "TO_AMOUNT";
@@ -7450,7 +7451,6 @@ export declare const RestaurantQueueDto: z.ZodObject<{
7450
7451
  };
7451
7452
  };
7452
7453
  referenceId: string;
7453
- from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
7454
7454
  })[];
7455
7455
  orderAt: string;
7456
7456
  } | null | undefined;
@@ -7878,6 +7878,7 @@ export declare const RestaurantQueueDto: z.ZodObject<{
7878
7878
  target: "PAYMENT";
7879
7879
  };
7880
7880
  success: boolean;
7881
+ from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
7881
7882
  adjustment: {
7882
7883
  inclusive?: boolean | null | undefined;
7883
7884
  type: "BY_PERCENTAGE" | "BY_AMOUNT" | "TO_AMOUNT";
@@ -7887,7 +7888,6 @@ export declare const RestaurantQueueDto: z.ZodObject<{
7887
7888
  };
7888
7889
  };
7889
7890
  referenceId: string;
7890
- from: "COUNTER" | "PROMOTION" | "VOUCHER" | "MEMBERSHIP" | "FREE_CREDIT";
7891
7891
  })[] | undefined;
7892
7892
  option: {
7893
7893
  remark?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-order-setting",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "type": "module",
5
5
  "module": "./dist/app.js",
6
6
  "license": "UNLICENSED",
@@ -26,8 +26,8 @@
26
26
  "format": "prettier --write src/"
27
27
  },
28
28
  "dependencies": {
29
- "@feedmepos/core": "^2.14.57",
30
- "@feedmepos/menu": "^1.7.30",
29
+ "@feedmepos/core": "^2.14.60",
30
+ "@feedmepos/menu": "^1.7.32",
31
31
  "@feedmepos/mf-common": "1.20.0-beta.2",
32
32
  "@feedmepos/ordering": "^0.0.3",
33
33
  "@feedmepos/ui-library": "1.5.2-beta.1",
@@ -70,4 +70,4 @@
70
70
  "vite": "^5.1.4",
71
71
  "vue-tsc": "^2.2.0"
72
72
  }
73
- }
73
+ }
@@ -6,6 +6,7 @@ import type { OrderSettingsDto } from '@entity'
6
6
  import {
7
7
  FdoQueueQrSetting,
8
8
  FdoRestaurantDineIn,
9
+ FdoRestaurantDriveThru,
9
10
  FdoRestaurantPickup,
10
11
  FdoRestaurantSetting,
11
12
  FdoServiceChargeSetting
@@ -34,6 +35,11 @@ export const restaurantApi = {
34
35
  return getData(result)
35
36
  },
36
37
 
38
+ async updateDriveThruSetting(setting: FdoRestaurantDriveThru) {
39
+ const result = await restaurantClientInstance().put('/drive-thru', setting)
40
+ return getData(result)
41
+ },
42
+
37
43
  async updateServiceCharge(setting: FdoServiceChargeSetting) {
38
44
  const result = await restaurantClientInstance().put('/service-charge-setting', setting)
39
45
  return getData(result)
@@ -97,6 +97,10 @@
97
97
  "deviceDetails": "Device Details",
98
98
  "dineIn": "Dine In",
99
99
  "dineInCanTakeaway": "Allow Takeaway",
100
+ "driveThru": "Drive Thru",
101
+ "driveThruSettingUpdated": "Drive thru setting updated.",
102
+ "enableDriveThru": "Enable Drive Thru",
103
+ "enableDriveThruSublabel": "Enable drive thru ordering for customers",
100
104
  "dineInType": "Dine In Type",
101
105
  "discountCampaign": "Discount Campaign",
102
106
  "displayStand": "Display Stand",
@@ -97,6 +97,10 @@
97
97
  "deviceDetails": "デバイス詳細",
98
98
  "dineIn": "店内飲食",
99
99
  "dineInCanTakeaway": "テイクアウト許可",
100
+ "driveThru": "ドライブスルー",
101
+ "driveThruSettingUpdated": "ドライブスルー設定が更新されました。",
102
+ "enableDriveThru": "ドライブスルーを有効にする",
103
+ "enableDriveThruSublabel": "お客様向けのドライブスルー注文を有効にする",
100
104
  "dineInType": "店内飲食タイプ",
101
105
  "discountCampaign": "割引キャンペーン",
102
106
  "displayStand": "ディスプレイスタンド",
@@ -97,6 +97,10 @@
97
97
  "deviceDetails": "รายละเอียดอุปกรณ์",
98
98
  "dineIn": "รับประทานอาหารที่ร้าน",
99
99
  "dineInCanTakeaway": "อนุญาตให้นำกลับบ้าน",
100
+ "driveThru": "ไดรฟ์ทรู",
101
+ "driveThruSettingUpdated": "อัปเดตการตั้งค่าไดรฟ์ทรูแล้ว",
102
+ "enableDriveThru": "เปิดใช้งานไดรฟ์ทรู",
103
+ "enableDriveThruSublabel": "เปิดใช้งานการสั่งอาหารไดรฟ์ทรูสำหรับลูกค้า",
100
104
  "dineInType": "ประเภทรับประทานอาหารที่ร้าน",
101
105
  "discountCampaign": "แคมเปญส่วนลด",
102
106
  "displayStand": "แท่นวางสินค้า",
@@ -98,6 +98,10 @@
98
98
  "deviceDetails": "设备详情",
99
99
  "dineIn": "堂食",
100
100
  "dineInCanTakeaway": "允许外带",
101
+ "driveThru": "得来速",
102
+ "driveThruSettingUpdated": "得来速设置已更新。",
103
+ "enableDriveThru": "启用得来速",
104
+ "enableDriveThruSublabel": "为顾客启用得来速点餐",
101
105
  "dineInType": "堂食类型",
102
106
  "discountCampaign": "促销活动",
103
107
  "displayStand": "桌牌",
package/src/main.ts CHANGED
@@ -38,9 +38,9 @@ app.use(FeedMeUI, {
38
38
  locale: detectLocale(),
39
39
  })
40
40
 
41
- app.use(createPinia())
41
+ app.use(createPinia() as any)
42
42
  app.use(router)
43
- app.use(initI18n())
43
+ app.use(initI18n() as any)
44
44
 
45
45
 
46
46
  const CoreStore = useCoreStore();
@@ -4,6 +4,7 @@ import {
4
4
  F_FEATURE,
5
5
  F_PAYOUT_ACCOUNT_STATUS,
6
6
  FdoRestaurantDineIn,
7
+ FdoRestaurantDriveThru,
7
8
  FdoRestaurantFeedmeDelivery,
8
9
  FdoRestaurantInHouseDelivery,
9
10
  FdoRestaurantPickup,
@@ -92,6 +93,10 @@ export const useRestaurantStore = defineStore('restaurant', () => {
92
93
  await restaurantApi.updatePickupSetting(setting)
93
94
  }
94
95
 
96
+ async function updateDriveThruSetting(setting: FdoRestaurantDriveThru) {
97
+ await restaurantApi.updateDriveThruSetting(setting)
98
+ }
99
+
95
100
  async function updateInhouseDelivery(restaurantId: string, dto: FdoRestaurantInHouseDelivery) {
96
101
  await remoteOrderApi.integratedDelivery.updateInhouse(restaurantId, dto)
97
102
  }
@@ -149,6 +154,7 @@ export const useRestaurantStore = defineStore('restaurant', () => {
149
154
  updateServiceCharge,
150
155
  updateDineInSetting,
151
156
  updatePickupSetting,
157
+ updateDriveThruSetting,
152
158
  updateInhouseDelivery,
153
159
  updateFeedmeDelivery,
154
160
  updateIntegratedFoodpandaDelivery,
@@ -72,9 +72,9 @@ const initializeCheckboxes = () => {
72
72
  parentCheckbox.value = initialValues.length === checkboxChildren.length
73
73
  if (!(Object.keys(props.ePaymentTypes).length === 0)) {
74
74
  if (props.ePaymentTypes.terminal) {
75
- useTerminal.value = true;
75
+ useTerminal.value = true
76
76
  }
77
-
77
+
78
78
  if (props.ePaymentTypes.card.terminal) {
79
79
  cardPaymentRadioVal.value = F_ORDER_E_PAYMENT_TYPE.enum.TERMINAL
80
80
  useCard.value = true
@@ -157,6 +157,7 @@ const handleChildUpdate = (ev: string[]) => {
157
157
 
158
158
  const handleEPaymentCardUpdate = (ev: string) => {
159
159
  const ePaymentObj = {
160
+ terminal: false,
160
161
  card: {
161
162
  terminal: false,
162
163
  nfc: false
@@ -195,6 +196,10 @@ const handleEPaymentCardUpdate = (ev: string) => {
195
196
  }
196
197
  }
197
198
 
199
+ if (useTerminal.value) {
200
+ ePaymentObj.terminal = true
201
+ }
202
+
198
203
  emits('update:ePaymentTypes', ePaymentObj)
199
204
  }
200
205
 
@@ -209,7 +214,7 @@ const handleEPaymentEWalletUpdate = () => {
209
214
  qrPay: false,
210
215
  scanPay: false,
211
216
  terminalScanPay: false,
212
- terminalQrPay: false,
217
+ terminalQrPay: false
213
218
  }
214
219
  } as FdoEPaymentMethod
215
220
 
@@ -19,6 +19,7 @@ import { type FmTabProps } from '@feedmepos/ui-library'
19
19
  import { ref, computed, onMounted, watch } from 'vue'
20
20
  import DeliverySetting from './delivery/DeliverySetting.vue'
21
21
  import DineInSetting from './dine-in/DineInSetting.vue'
22
+ import DriveThruSetting from './drive-thru/DriveThruSetting.vue'
22
23
  import PickUpSetting from './pickup/PickUpSetting.vue'
23
24
  import SmsSetting from './sms/SmsSetting.vue'
24
25
  // import ServiceChargeSetting from './servicecharge/ServiceChargeSetting.vue'
@@ -38,6 +39,7 @@ type OrderSettingMenuItemValue =
38
39
  | 'delivery'
39
40
  | 'pickup'
40
41
  | 'dinein'
42
+ | 'driveThru'
41
43
  // | 'servicecharge'
42
44
  | 'sms'
43
45
  // | 'discountRule'
@@ -49,6 +51,7 @@ const settingItem = computed<FmTabProps[]>(() => [
49
51
  { label: t('order.delivery'), value: 'delivery' },
50
52
  { label: t('order.pickup'), value: 'pickup' },
51
53
  { label: t('order.dineIn'), value: 'dinein' },
54
+ { label: t('order.driveThru'), value: 'driveThru' },
52
55
  // { label: t('order.serviceCharge'), value: 'servicecharge' },
53
56
  // { label: t('order.discountRule.title'), value: 'discountRule' },
54
57
  { label: t('order.sms'), value: 'sms' },
@@ -62,6 +65,8 @@ const currentComponent = computed(() => {
62
65
  return DeliverySetting
63
66
  case 'dinein':
64
67
  return DineInSetting
68
+ case 'driveThru':
69
+ return DriveThruSetting
65
70
  case 'pickup':
66
71
  return PickUpSetting
67
72
  case 'sms':
@@ -83,7 +88,7 @@ onMounted(async () => {
83
88
  }
84
89
  })
85
90
 
86
- watch(currentRestaurant, async (newRestaurant) => {
91
+ watch(currentRestaurant, async (newRestaurant: any) => {
87
92
  if (newRestaurant?._id) {
88
93
  await menuStore.loadCatalogOptions(newRestaurant._id)
89
94
  }
@@ -63,8 +63,22 @@
63
63
  />
64
64
  </div>
65
65
 
66
+ <div class="text-fm-color-neutral-gray-400 fm-typo-cn-body-md-400 mb-5 mt-5">
67
+ <div v-if="data.updatedAt">
68
+ {{ t('order.updatedAt') }}:
69
+ {{ Day(data.updatedAt).format('DD/MM/YYYY hh:mm a') }}
70
+ </div>
71
+ </div>
72
+
66
73
  <div class="flex flex-row mt-5">
67
74
  <FmButton variant="primary" :label="t('order.syncMenu')" @click="syncMenu()" />
75
+ <div
76
+ v-if="data.lastSynchronize"
77
+ class="m-2 ml-10 text-fm-color-neutral-gray-400 fm-typo-cn-body-md-400"
78
+ >
79
+ {{ t('order.lastSync') }}:
80
+ {{ Day(data.lastSynchronize).format('DD/MM/YYYY hh:mm a') }}
81
+ </div>
68
82
  </div>
69
83
  </FmCard>
70
84
  </div>
@@ -75,6 +89,7 @@
75
89
  import { type PropType, reactive, ref } from 'vue'
76
90
  import { F_ORDER_PLATFORM, type FdoExternalSetting } from '@entity'
77
91
  import { useI18n } from '@feedmepos/mf-common'
92
+ import Day from 'dayjs'
78
93
  import { clone } from '@/helpers/object'
79
94
  import { useMenuStore } from '@/stores/menu/menu'
80
95
  import { useLoading } from '@/composables/loading'
@@ -147,7 +162,13 @@ function updatePlatform(platform: F_ORDER_PLATFORM) {
147
162
  const { startAsyncCallWithErr } = useLoading()
148
163
  async function syncMenu() {
149
164
  await startAsyncCallWithErr(async () => {
150
- await remoteOrderApi.integratedDelivery.syncExternalMenu(data._id ?? '')
165
+ const res = await remoteOrderApi.integratedDelivery.syncExternalMenu(data._id ?? '')
166
+ if (res?.lastSynchronize) {
167
+ data.lastSynchronize = res.lastSynchronize
168
+ }
169
+ if (res?.updatedAt) {
170
+ data.updatedAt = res.updatedAt
171
+ }
151
172
  showSuccess(t('order.syncMenuSuccess'))
152
173
  })
153
174
  }
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div class="flex justify-between items-center">
3
+ <RestaurantSelector />
4
+ </div>
5
+ <div v-if="!isLoading">
6
+ <div class="p-[1.5rem] flex flex-col gap-5 m-5 w-2/3">
7
+ <div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.generalSetting') }}</div>
8
+ <FmSwitch
9
+ v-model="driveThruSetting.enabled"
10
+ value="enabled"
11
+ :label="t('order.enableDriveThru')"
12
+ :sublabel="t('order.enableDriveThruSublabel')"
13
+ label-placement="right"
14
+ />
15
+ <FmSelect
16
+ v-if="driveThruSetting.enabled"
17
+ class="w-1/2"
18
+ :placeholder="t('order.selectItem')"
19
+ :model-value="driveThruSetting.catalogId"
20
+ :label="t('order.catalog')"
21
+ :items="menuStore.catalogOptions"
22
+ @update:model-value="updateCatalogId"
23
+ />
24
+ </div>
25
+ <div class="fm-corner-radius-lg flex flex-col gap-5 m-5">
26
+ <FmButton
27
+ variant="primary"
28
+ :label="t('order.saveSetting')"
29
+ class="mr-auto"
30
+ @click="updateDriveThruSetting"
31
+ />
32
+ </div>
33
+ </div>
34
+ <FmCircularProgress size="xxl" v-else />
35
+ </template>
36
+
37
+ <script setup lang="ts">
38
+ import { type FdoRestaurantDriveThru } from '@feedmepos/core/entity'
39
+ import RestaurantSelector from '../components/RestaurantSelector.vue'
40
+ import { onMounted, ref, watch } from 'vue'
41
+ import { useRestaurantStore } from '@/stores/restaurant'
42
+ import { useLoading } from '@/composables/loading'
43
+ import { useCoreStore } from '@feedmepos/mf-common'
44
+ import { utils } from '@feedmepos/core'
45
+ import { useI18n } from '@feedmepos/mf-common'
46
+ import { useSnackbarFunctions } from '@/components/snackbar'
47
+ import { useMenuStore } from '@/stores/menu/menu'
48
+
49
+ const { t } = useI18n()
50
+
51
+ const { currentRestaurant } = useCoreStore()
52
+ const menuStore = useMenuStore()
53
+ const driveThruSetting = ref<FdoRestaurantDriveThru>(initDriveThruSetting())
54
+
55
+ function initDriveThruSetting(): FdoRestaurantDriveThru {
56
+ return {
57
+ enabled: false,
58
+ catalogId: null
59
+ }
60
+ }
61
+
62
+ function updateCatalogId(catalogId: string | null) {
63
+ driveThruSetting.value.catalogId = catalogId
64
+ }
65
+
66
+ const { showSuccess } = useSnackbarFunctions()
67
+ const restaurantStore = useRestaurantStore()
68
+ const { startAsyncCallWithErr, isLoading } = useLoading()
69
+
70
+ async function updateDriveThruSetting() {
71
+ await startAsyncCallWithErr(async () => {
72
+ const newDriveThruSetting = driveThruSetting.value
73
+ if (newDriveThruSetting) {
74
+ await restaurantStore.updateDriveThruSetting(newDriveThruSetting)
75
+ if (currentRestaurant.value) {
76
+ ;(currentRestaurant.value as any).driveThru = newDriveThruSetting
77
+ }
78
+ }
79
+ })
80
+ showSuccess(t('order.driveThruSettingUpdated'))
81
+ }
82
+
83
+ watch(
84
+ () => currentRestaurant.value,
85
+ async (newRestaurant) => {
86
+ if ((newRestaurant as any)?.driveThru) {
87
+ driveThruSetting.value = utils.clone((newRestaurant as any).driveThru)
88
+ } else {
89
+ driveThruSetting.value = initDriveThruSetting()
90
+ }
91
+ },
92
+ { immediate: true }
93
+ )
94
+
95
+ onMounted(async () => {
96
+ const newRestaurant = currentRestaurant.value as any
97
+ if (newRestaurant?.driveThru) {
98
+ driveThruSetting.value = utils.clone(newRestaurant.driveThru)
99
+ }
100
+ })
101
+ </script>