@feedmepos/mf-order-setting 0.0.24 → 0.0.26

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-BiF6v7Zj.js} +1 -1
  2. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-BGZLd8T_.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-1r_DBAc-.js} +3 -3
  3. package/dist/{KioskSettingView-DLb5nnCu.js → KioskSettingView-COhGcRtP.js} +1 -1
  4. package/dist/{KioskView-kZZYSfUh.js → KioskView-C1T-n1MY.js} +38 -28
  5. package/dist/{OrderSettingsView-Cil4j9G5.js → OrderSettingsView-CI5bdVXr.js} +6297 -6251
  6. package/dist/{app-D47VRl5B.js → app-BfWp4ow3.js} +38 -26
  7. package/dist/app.js +1 -1
  8. package/dist/{dayjs.min-R4180ukF.js → dayjs.min-BHDLv42p.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 +449 -2369
  15. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  16. package/dist/{index-DgLlDwJK.js → index-B5kfsi9C.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-y-ubeoKZ.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 +92 -84
  49. package/src/views/order-settings/delivery/DeliverySetting.vue +11 -11
  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 -12
  55. package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +20 -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">
@@ -54,11 +68,9 @@ import PaymentSidesheet from './PaymentSidesheet.vue'
54
68
  import { utils } from '@feedmepos/core'
55
69
  import { useI18n } from '@feedmepos/mf-common'
56
70
  import { useRestaurantStore } from '@/stores/restaurant'
57
- import { useCoreStore } from '@feedmepos/mf-common'
58
71
 
59
72
  const { t } = useI18n()
60
73
  const restaurantStore = useRestaurantStore()
61
- const { currentRestaurant } = useCoreStore()
62
74
 
63
75
  const emits = defineEmits<{
64
76
  (event: 'update-pickup', v: FdoRestaurantPickup): void
@@ -107,8 +119,7 @@ const checkboxChildren = [
107
119
  const initializeCheckboxes = () => {
108
120
  const initialValues: string[] = []
109
121
  if (allowOfflinePayment.value) initialValues.push('offline')
110
- if (restaurantStore.getRestaurantEPayment(currentRestaurant.value))
111
- initialValues.push('e-payment')
122
+ if (restaurantStore.getRestaurantEPayment()) initialValues.push('e-payment')
112
123
  nestedVal.value = initialValues
113
124
  parent.value = initialValues.length === checkboxChildren.length
114
125
  }
@@ -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,11 @@
29
29
  :label="t('order.chargeWhen')"
30
30
  @update:model-value="updateChargeWhen"
31
31
  >
32
- <FmRadio value="beforeDiscount" :label="t('order.beforeBillDiscount')" />
32
+ <FmRadio
33
+ value="beforeDiscount"
34
+ :label="t('order.beforeBillDiscount')"
35
+ :disabled="disableBeforeDiscount"
36
+ />
33
37
  <FmRadio value="afterDiscount" :label="t('order.afterBillDiscount')" />
34
38
  </FmRadioGroup>
35
39
  <RateInput :model-value="data.rate" @update:model-value="handleUpdateRate" />
@@ -40,7 +44,7 @@
40
44
  @update:model-value="updateInclusive"
41
45
  >
42
46
  <FmRadio value="exclusive" :label="t('order.exclusive')" />
43
- <FmRadio value="inclusive" :label="t('order.inclusive')" />
47
+ <FmRadio value="inclusive" :label="t('order.inclusive')" :disabled="disableInclusive" />
44
48
  </FmRadioGroup>
45
49
  </div>
46
50
  </FmCard>
@@ -165,6 +169,14 @@ const chargeValue = computed(() => {
165
169
  return data.value.inclusive ? inclusiveKey : exclusiveKey
166
170
  })
167
171
 
172
+ const disableInclusive = computed(() => {
173
+ return data.value.beforeDiscount ?? false
174
+ })
175
+
176
+ const disableBeforeDiscount = computed(() => {
177
+ return data.value.inclusive
178
+ })
179
+
168
180
  function updateChargeWhen(key: string) {
169
181
  data.value.beforeDiscount = key === beforeDiscountKey
170
182
  if (data.value.beforeDiscount) updateInclusive(exclusiveKey)
@@ -181,6 +193,7 @@ function updateInclusive(inclusiveValue: string) {
181
193
  ...rule,
182
194
  inclusive: inclusive
183
195
  }))
196
+ if (data.value.inclusive) updateChargeWhen(afterDiscountKey)
184
197
  }
185
198
 
186
199
  function createRule() {
@@ -234,10 +247,9 @@ const isLoadingTables = ref(false)
234
247
  const tableSettingStore = useTableSettingStore()
235
248
 
236
249
  onMounted(async () => {
237
- const resId = currentRestaurant.value?._id
238
- if (resId) {
239
- await restaurantStore.readRestaurantSetting(resId)
240
- const restaurantSetting = restaurantStore.restaurantSettings[resId]
250
+ const res = currentRestaurant.value
251
+ if (res) {
252
+ const restaurantSetting = await restaurantStore.readRestaurantSetting(res._id)
241
253
  initialize(restaurantSetting)
242
254
  await startAsyncCallWithErr(tableSettingStore.readTables)
243
255
  }
@@ -247,7 +259,7 @@ watch(
247
259
  () => currentRestaurant.value,
248
260
  async (newValue) => {
249
261
  if (newValue) {
250
- let restaurantSetting = restaurantStore.restaurantSettings[newValue._id]
262
+ let restaurantSetting = restaurantStore.currentRestaurantSetting
251
263
  if (!restaurantSetting) {
252
264
  restaurantSetting = await restaurantStore.readRestaurantSetting(newValue._id)
253
265
  }