@feedmepos/mf-order-setting 0.0.24 → 0.0.25

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 (55) hide show
  1. package/dist/{KioskDevicesView-DGkvW2mH.js → KioskDevicesView-gzH9-zL_.js} +1 -1
  2. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-BGZLd8T_.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-CLpClo-r.js} +3 -3
  3. package/dist/{KioskSettingView-DLb5nnCu.js → KioskSettingView-D1WdpaQN.js} +1 -1
  4. package/dist/{KioskView-kZZYSfUh.js → KioskView-D6-1bn1n.js} +38 -28
  5. package/dist/{OrderSettingsView-Cil4j9G5.js → OrderSettingsView-CqZREmjo.js} +6155 -6096
  6. package/dist/{app-D47VRl5B.js → app-i4N2c7ms.js} +38 -26
  7. package/dist/app.js +1 -1
  8. package/dist/{dayjs.min-R4180ukF.js → dayjs.min-CA-XbgTY.js} +36 -36
  9. package/dist/frontend/mf-order/src/app.d.ts +12 -0
  10. package/dist/frontend/mf-order/src/main.d.ts +797 -0
  11. package/dist/frontend/mf-order/src/stores/iframe/index.d.ts +6 -6
  12. package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +8 -260
  13. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +17 -722
  14. package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +1456 -2239
  15. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  16. package/dist/{index-DgLlDwJK.js → index-C4HI1NS4.js} +2 -2
  17. package/dist/package/entity/delivery/delivery.dto.d.ts +11 -6
  18. package/dist/package/entity/food-court/food-court.dto.d.ts +1 -1
  19. package/dist/package/entity/food-court/order.dto.d.ts +727 -378
  20. package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +6 -6
  21. package/dist/package/entity/incoming-order/incoming-order.do.d.ts +8 -8
  22. package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +16 -16
  23. package/dist/package/entity/index.d.ts +1 -0
  24. package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +1337 -656
  25. package/dist/package/entity/order/order.dto.d.ts +4942 -2401
  26. package/dist/package/entity/order/order.enum.d.ts +1 -1
  27. package/dist/package/entity/order/payment/payment.dto.d.ts +2899 -1419
  28. package/dist/package/entity/order-platform/external/order/external-order.do.d.ts +9 -21
  29. package/dist/package/entity/order-platform/external/order/external-order.dto.d.ts +19 -51
  30. package/dist/package/entity/order-setting/order-setting.do.d.ts +8 -0
  31. package/dist/package/entity/order-setting/order-setting.dto.d.ts +16 -0
  32. package/dist/package/entity/order-setting/v3/v3.do.d.ts +3 -0
  33. package/dist/package/entity/order-setting/v3/v3.dto.d.ts +3 -0
  34. package/dist/package/entity/order-setting/v3/v3.enum.d.ts +3 -0
  35. package/dist/package/entity/payment/payment.dto.d.ts +3 -3
  36. package/dist/package/entity/restaurant/restaurant.dto.d.ts +19 -11
  37. package/dist/{queue.do-CNMuossU.js → queue.do-DcOVgeUq.js} +17139 -16655
  38. package/package.json +3 -3
  39. package/src/Entry.vue +3 -3
  40. package/src/locales/en-US.json +6 -0
  41. package/src/locales/th-TH.json +257 -0
  42. package/src/locales/zh-CN.json +6 -0
  43. package/src/main.ts +9 -1
  44. package/src/stores/iframe/index.ts +1 -1
  45. package/src/stores/kiosk/index.ts +1 -1
  46. package/src/stores/order-setting/index.ts +1 -1
  47. package/src/stores/order-setting/mapper.ts +12 -2
  48. package/src/stores/restaurant/index.ts +106 -85
  49. package/src/views/order-settings/delivery/DeliverySetting.vue +12 -12
  50. package/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue +39 -35
  51. package/src/views/order-settings/dine-in/DineInSetting.vue +158 -24
  52. package/src/views/order-settings/general/GeneralSetting.vue +29 -33
  53. package/src/views/order-settings/pickup/PickUpSetting.vue +4 -2
  54. package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +23 -10
  55. package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +17 -8
@@ -1,21 +1,20 @@
1
1
  <template>
2
2
  <div class="flex justify-between items-center">
3
- <RestaurantSelector :model-value="currentRestaurant?._id ?? undefined" />
3
+ <RestaurantSelector />
4
4
  </div>
5
5
  <div v-if="!isLoading">
6
6
  <div class="p-[1.5rem] flex flex-col gap-5 m-5 w-2/3">
7
7
  <div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.generalSetting') }}</div>
8
8
  <FmSwitch
9
- :disabled="!validPosVersion"
10
- v-model="autoSendKitchen"
11
- :label="t('order.autoSendKitchen')"
12
- :sublabel="`${!validPosVersion ? `(${t('order.autoSendKitchenSublabel')})` : ''}`"
9
+ :model-value="orderSetting?.v3Settings?.anonymousLoginDialog ?? true"
10
+ :label="t('order.promptAnonymousLoginDialog')"
11
+ @update:model-value="updateAnonymousLoginDialog"
13
12
  label-placement="right"
14
13
  ></FmSwitch>
15
-
16
14
  <FmSwitch
17
- v-model="anonymousLoginDialog"
18
- :label="t('order.promptAnonymousLoginDialog')"
15
+ :model-value="!!orderSetting?.v3Settings?.subItemDisplayMode"
16
+ :label="t('order.subItemDisplayModeListView')"
17
+ @update:model-value="updateSubItemDisplayMode"
19
18
  label-placement="right"
20
19
  ></FmSwitch>
21
20
  </div>
@@ -35,7 +34,7 @@
35
34
  import { useCoreStore } from '@feedmepos/mf-common'
36
35
  import RestaurantSelector from '../components/RestaurantSelector.vue'
37
36
  import { useLoading } from '@/composables/loading'
38
- import { type OrderSettingsDto, type OrderV3Settings } from '@entity'
37
+ import { type OrderSettingsDto, type OrderV3Settings, F_ORDER_SUBITEM_DISPLAY_MODE } from '@entity'
39
38
  import { OrderSettingApi } from '@/api/order-setting'
40
39
  import { computed, onMounted, ref, watch } from 'vue'
41
40
  import { useSnackbarFunctions } from '@/components/snackbar'
@@ -47,39 +46,36 @@ const { showSuccess } = useSnackbarFunctions()
47
46
  const { currentRestaurant } = useCoreStore()
48
47
  const { startAsyncCallWithErr, isLoading } = useLoading()
49
48
 
50
- const orderSettingDefault = ref<OrderSettingsDto | undefined>(undefined)
49
+ const orderSetting = ref<OrderSettingsDto | undefined>(undefined)
51
50
  const v3Settings = ref<OrderV3Settings | undefined>(undefined)
52
- const autoSendKitchen = ref<boolean>(false)
53
51
  const anonymousLoginDialog = ref<boolean>(false)
54
52
 
55
- const validPosVersion = computed<boolean>(() => {
56
- return currentRestaurant?.value?.posVersion?.startsWith('7') ?? false
57
- })
58
-
59
- async function init() {
53
+ async function init(): Promise<void> {
60
54
  if (currentRestaurant.value) {
61
- orderSettingDefault.value = await readOrderSetting()
62
- v3Settings.value = orderSettingDefault.value.v3Settings
63
- autoSendKitchen.value = validPosVersion.value
64
- ? (orderSettingDefault.value.autoSendKitchen ?? true)
65
- : false
66
- anonymousLoginDialog.value = v3Settings.value.anonymousLoginDialog ?? true
55
+ orderSetting.value = await readOrderSetting()
56
+ }
57
+ }
58
+
59
+ function updateAnonymousLoginDialog(v: boolean) {
60
+ if (orderSetting.value) {
61
+ orderSetting.value.v3Settings.anonymousLoginDialog = v
62
+ }
63
+ }
64
+
65
+ function updateSubItemDisplayMode(v: boolean) {
66
+ if (orderSetting.value) {
67
+ if (v) {
68
+ orderSetting.value.v3Settings.subItemDisplayMode = F_ORDER_SUBITEM_DISPLAY_MODE.enum.LIST
69
+ } else {
70
+ orderSetting.value.v3Settings.subItemDisplayMode = undefined
71
+ }
67
72
  }
68
73
  }
69
74
 
70
75
  async function updateOrderSetting() {
71
76
  await startAsyncCallWithErr(async () => {
72
- if (orderSettingDefault.value) {
73
- await OrderSettingApi.updateOrderSetting({
74
- ...orderSettingDefault.value,
75
- autoSendKitchen: autoSendKitchen.value,
76
- v3Settings: {
77
- ...(v3Settings.value ?? {}),
78
- dineInCanTakeaway: v3Settings.value?.dineInCanTakeaway ?? true,
79
- anonymousLoginDialog: anonymousLoginDialog.value
80
- }
81
- })
82
- await init()
77
+ if (orderSetting.value) {
78
+ await OrderSettingApi.updateOrderSetting(orderSetting.value)
83
79
  showSuccess('General setting updated')
84
80
  }
85
81
  })
@@ -51,7 +51,7 @@ const currentRestaurants = ref<FmpRestaurant[]>([])
51
51
 
52
52
  const pickupSetting = computed<RestaurantPickup[]>(() => {
53
53
  return currentRestaurants.value.map((r: FmpRestaurant) => {
54
- const restaurantSetting = restaurantStore.restaurantSettings[r._id]
54
+ const restaurantSetting = restaurantStore.state.restaurantSettings[r._id]
55
55
 
56
56
  return {
57
57
  enable: restaurantSetting?.acceptPickup,
@@ -98,7 +98,9 @@ async function toggleSideSheet(rowData: any) {
98
98
  const v = rowData?.original?.restaurantId ?? rowData?.restaurantId
99
99
  originalRestaurant = currentRestaurant.value
100
100
 
101
- const restaurant = currentRestaurants.value.find((r: FmpRestaurant) => r._id === v)
101
+ const restaurant: FmpRestaurant | undefined = currentRestaurants.value.find(
102
+ (r: FmpRestaurant) => r._id === v
103
+ )
102
104
  if (restaurant) {
103
105
  await changeRestaurant(restaurant as any)
104
106
  }
@@ -1,7 +1,13 @@
1
1
  <template>
2
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" />
3
+ <FmSwitch
4
+ :model-value="pickupSetting.ignoreStock ?? false"
5
+ value="ignoreStock"
6
+ :label="t('order.ignoreStock')"
7
+ :sublabel="t('order.ignoreStockSublabel')"
8
+ label-placement="right"
9
+ @update:model-value="updateIgnoreStock"
10
+ />
5
11
  <FmCard variant="outlined" class="p-5 mt-10">
6
12
  <Preorder :model-value="pickupData" @update:model-value="updatePickupSetting" />
7
13
  </FmCard>
@@ -9,7 +15,7 @@
9
15
  <FmCard variant="outlined" class="p-5 mt-10">
10
16
  <PaymentSidesheet
11
17
  :offline-payment-types="pickupSetting.offlinePaymentTypes"
12
- :allow-e-payment="restaurantStore.getRestaurantEPayment(currentRestaurant)"
18
+ :allow-e-payment="restaurantStore.getRestaurantEPayment()"
13
19
  :payment-types="pickupSetting.paymentTypes"
14
20
  @update:payments="updatePayments"
15
21
  />
@@ -17,14 +23,22 @@
17
23
 
18
24
  <FmCard variant="outlined" class="p-5 mt-10">
19
25
  <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"
22
- @update:model-value="toggleMultiplePickupPoint" />
26
+ <FmSwitch
27
+ :model-value="!!pickupSetting.pickupPointConfig"
28
+ value="pickuppoint"
29
+ :label="t('order.multiplePickupPoint')"
30
+ :sublabel="t('order.allowMultiplePickupSublabel')"
31
+ label-placement="right"
32
+ @update:model-value="toggleMultiplePickupPoint"
33
+ />
23
34
 
24
35
  <template v-if="pickupSetting.pickupPointConfig">
25
36
  <div class="mt-3">
26
- <FmCheckbox v-model="pickupSetting.pickupPointConfig.restaurantEnable" :label="t('order.restaurantAsPickupPoint')"
27
- value="restaurant" />
37
+ <FmCheckbox
38
+ v-model="pickupSetting.pickupPointConfig.restaurantEnable"
39
+ :label="t('order.restaurantAsPickupPoint')"
40
+ value="restaurant"
41
+ />
28
42
  </div>
29
43
  <PickUpPointDialog @update:address="updatePickupPoints" :pickup-setting="pickupSetting" />
30
44
  <div v-if="pickupSetting.pickupPointConfig">
@@ -107,8 +121,7 @@ const checkboxChildren = [
107
121
  const initializeCheckboxes = () => {
108
122
  const initialValues: string[] = []
109
123
  if (allowOfflinePayment.value) initialValues.push('offline')
110
- if (restaurantStore.getRestaurantEPayment(currentRestaurant.value))
111
- initialValues.push('e-payment')
124
+ if (restaurantStore.getRestaurantEPayment()) initialValues.push('e-payment')
112
125
  nestedVal.value = initialValues
113
126
  parent.value = initialValues.length === checkboxChildren.length
114
127
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="flex justify-between items-center">
3
- <RestaurantSelector :model-value="currentRestaurant?._id ?? undefined" />
3
+ <RestaurantSelector />
4
4
  </div>
5
5
  <div v-if="!isLoading">
6
6
  <div class="p-[1.5rem] flex flex-col gap-5">
@@ -29,7 +29,8 @@
29
29
  :label="t('order.chargeWhen')"
30
30
  @update:model-value="updateChargeWhen"
31
31
  >
32
- <FmRadio value="beforeDiscount" :label="t('order.beforeBillDiscount')" />
32
+ <FmRadio value="beforeDiscount" :label="t('order.beforeBillDiscount')" :disabled="disableBeforeDiscount"
33
+ />
33
34
  <FmRadio value="afterDiscount" :label="t('order.afterBillDiscount')" />
34
35
  </FmRadioGroup>
35
36
  <RateInput :model-value="data.rate" @update:model-value="handleUpdateRate" />
@@ -40,7 +41,7 @@
40
41
  @update:model-value="updateInclusive"
41
42
  >
42
43
  <FmRadio value="exclusive" :label="t('order.exclusive')" />
43
- <FmRadio value="inclusive" :label="t('order.inclusive')" />
44
+ <FmRadio value="inclusive" :label="t('order.inclusive')" :disabled="disableInclusive" />
44
45
  </FmRadioGroup>
45
46
  </div>
46
47
  </FmCard>
@@ -165,6 +166,14 @@ const chargeValue = computed(() => {
165
166
  return data.value.inclusive ? inclusiveKey : exclusiveKey
166
167
  })
167
168
 
169
+ const disableInclusive = computed(() => {
170
+ return data.value.beforeDiscount ?? false
171
+ })
172
+
173
+ const disableBeforeDiscount = computed(() => {
174
+ return data.value.inclusive
175
+ })
176
+
168
177
  function updateChargeWhen(key: string) {
169
178
  data.value.beforeDiscount = key === beforeDiscountKey
170
179
  if (data.value.beforeDiscount) updateInclusive(exclusiveKey)
@@ -181,6 +190,7 @@ function updateInclusive(inclusiveValue: string) {
181
190
  ...rule,
182
191
  inclusive: inclusive
183
192
  }))
193
+ if (data.value.inclusive) updateChargeWhen(afterDiscountKey)
184
194
  }
185
195
 
186
196
  function createRule() {
@@ -234,10 +244,9 @@ const isLoadingTables = ref(false)
234
244
  const tableSettingStore = useTableSettingStore()
235
245
 
236
246
  onMounted(async () => {
237
- const resId = currentRestaurant.value?._id
238
- if (resId) {
239
- await restaurantStore.readRestaurantSetting(resId)
240
- const restaurantSetting = restaurantStore.restaurantSettings[resId]
247
+ const res = restaurantStore.currentRestaurant
248
+ if (res) {
249
+ const restaurantSetting = await restaurantStore.readRestaurantSetting(res._id)
241
250
  initialize(restaurantSetting)
242
251
  await startAsyncCallWithErr(tableSettingStore.readTables)
243
252
  }
@@ -247,7 +256,7 @@ watch(
247
256
  () => currentRestaurant.value,
248
257
  async (newValue) => {
249
258
  if (newValue) {
250
- let restaurantSetting = restaurantStore.restaurantSettings[newValue._id]
259
+ let restaurantSetting = restaurantStore.currentRestaurantSetting
251
260
  if (!restaurantSetting) {
252
261
  restaurantSetting = await restaurantStore.readRestaurantSetting(newValue._id)
253
262
  }