@feedmepos/mf-order-setting 0.0.56-dev.1 → 0.0.56-dev.2

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 (64) hide show
  1. package/.tsbuildinfo +1 -1
  2. package/dist/{KioskDevicesView-CccsAZqK.js → KioskDevicesView-Qv-xd_kZ.js} +1 -1
  3. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-dF1jgi53.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-CCF1mKni.js} +2 -2
  4. package/dist/KioskSettingView-CvvrK6Bv.js +643 -0
  5. package/dist/{KioskView-DmaCjLcw.js → KioskView-CppTVBv-.js} +117 -117
  6. package/dist/OrderSettingsView-C38N61dM.js +36564 -0
  7. package/dist/{app-EGmxrjDM.js → app-Bss1GkKY.js} +4 -4
  8. package/dist/app.js +1 -1
  9. package/dist/{dayjs.min-lCwCAXUZ.js → dayjs.min-DZfxGUk4.js} +1 -1
  10. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +3 -0
  11. package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +1 -1
  12. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskPaymentTypeSection.vue.d.ts +13 -3
  13. package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/ExternalSetting.vue.d.ts +12 -4
  14. package/dist/frontend/mf-order/src/views/order-settings/dine-in/OfflinePaymentTypeDialog.vue.d.ts +4 -4
  15. package/dist/frontend/mf-order/src/views/order-settings/dine-in/PaymentType.vue.d.ts +38 -4
  16. package/dist/frontend/mf-order/src/views/order-settings/pickup/PaymentSidesheet.vue.d.ts +1 -0
  17. package/dist/frontend/mf-order/src/views/order-settings/reservation/CustomTimePicker.vue.d.ts +1 -0
  18. package/dist/{index-CWrX79Jg.js → index-B6AGCsrw.js} +6 -6
  19. package/dist/index-BpKR-Cxd.js +19757 -0
  20. package/dist/{menu.dto-CgymySda.js → menu.dto-C_B3M2fs.js} +44222 -46755
  21. package/dist/package/entity/incoming-order/incoming-order.do.d.ts +22443 -3
  22. package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +3 -3
  23. package/dist/package/entity/incoming-order/incoming-order.enum.d.ts +1 -1
  24. package/dist/package/entity/index.d.ts +1 -0
  25. package/dist/package/entity/marketing/marketing.dto.d.ts +1 -1
  26. package/dist/package/entity/order/dine-in/qr.dto.d.ts +38 -0
  27. package/dist/package/entity/order/order.do.d.ts +6358 -2
  28. package/dist/package/entity/order/order.dto.d.ts +22 -0
  29. package/dist/package/entity/order-platform/deliveroo/deliveroo-dto.d.ts +3 -0
  30. package/dist/package/entity/order-platform/deliveroo/deliveroo-setting.do.d.ts +3 -0
  31. package/dist/package/entity/order-platform/external/order/external-order.do.d.ts +12 -12
  32. package/dist/package/entity/order-platform/external/order/external-order.dto.d.ts +32 -32
  33. package/dist/package/entity/order-platform/external/setting/external-setting.do.d.ts +21 -3
  34. package/dist/package/entity/order-platform/external/setting/external-setting.dto.d.ts +12 -2
  35. package/dist/package/entity/order-platform/foodpanda/foodpanda-settings.do.d.ts +3 -0
  36. package/dist/package/entity/order-platform/foodpanda/foodpanda-settings.dto.d.ts +3 -0
  37. package/dist/package/entity/order-platform/grabfood/grabfood-edit-order.do.d.ts +9 -1
  38. package/dist/package/entity/order-platform/grabfood/grabfood-settings.do.d.ts +2 -2
  39. package/dist/package/entity/order-platform/grabfood/grabfood.dto.d.ts +3 -3
  40. package/dist/package/entity/order-platform/order-platform.dto.d.ts +2 -2
  41. package/dist/package/entity/order-platform/shopeefood/shopeefood-settings.do.d.ts +3 -0
  42. package/dist/package/entity/order-platform/shopeefood/shopeefood-settings.dto.d.ts +3 -0
  43. package/dist/package/entity/order-setting/order-setting.do.d.ts +3 -0
  44. package/dist/package/entity/order-setting/order-setting.dto.d.ts +6 -0
  45. package/dist/package/entity/queue/queue.do.d.ts +3 -8
  46. package/dist/package/entity/queue/queue.dto.d.ts +10 -0
  47. package/dist/package/entity/reservation/reservation.do.d.ts +4 -0
  48. package/dist/package/entity/reservation/reservation.dto.d.ts +10 -0
  49. package/dist/package/entity/reservation/reservation.utils.d.ts +2 -2
  50. package/dist/style.css +1 -1
  51. package/package.json +1 -1
  52. package/src/views/kiosk/KioskSummary.vue +3 -0
  53. package/src/views/kiosk/settings/KioskPaymentTypeSection.vue +99 -211
  54. package/src/views/kiosk/settings/KioskSettingView.vue +27 -11
  55. package/src/views/order-settings/dine-in/DineInSetting.vue +1 -0
  56. package/src/views/order-settings/dine-in/OfflinePaymentTypeDialog.vue +2 -3
  57. package/src/views/order-settings/dine-in/PaymentType.vue +151 -43
  58. package/src/views/order-settings/pickup/PaymentSidesheet.vue +33 -172
  59. package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +1 -0
  60. package/src/views/order-settings/reservation/CustomTimePicker.vue +129 -49
  61. package/src/views/order-settings/reservation/ReservationSetting.vue +547 -303
  62. package/dist/KioskSettingView-8GY7AT-N.js +0 -722
  63. package/dist/OrderSettingsView-BZcU4t9L.js +0 -56240
  64. package/dist/index-BXsnV_eO.js +0 -150
@@ -15,10 +15,22 @@ const props = defineProps({
15
15
  type: Array as PropType<FdoOfflinePaymentMethod[]>,
16
16
  required: true
17
17
  },
18
+ showDisabledOptions: {
19
+ type: Boolean,
20
+ default: false
21
+ },
22
+ disabledSuffixes: {
23
+ type: Object as PropType<Record<string, string>>,
24
+ default: () => ({})
25
+ },
18
26
  allowEPayment: {
19
27
  type: [Boolean, String],
20
28
  required: true
21
29
  },
30
+ allowCredit: {
31
+ type: [Boolean, String],
32
+ default: false
33
+ },
22
34
  maxCustomPayment: {
23
35
  type: Number,
24
36
  default: undefined
@@ -42,6 +54,11 @@ const allowEPayment = computed(() => {
42
54
  return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.ePayment)
43
55
  })
44
56
 
57
+ const allowCreditPayment = computed(() => {
58
+ const paymentTypes = props.paymentTypes || []
59
+ return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.credit)
60
+ })
61
+
45
62
  const allowOfflinePayment = computed(() => {
46
63
  const paymentTypes = props.paymentTypes || []
47
64
  const offlinePaymentTypes = props.offlinePaymentTypes || []
@@ -52,23 +69,68 @@ const allowOfflinePayment = computed(() => {
52
69
  const parent = ref(false)
53
70
  const nestedVal = ref<string[]>([])
54
71
 
55
- const checkboxChildren = [
56
- { label: t('order.offlinePayment'), value: 'offline' },
57
- { label: t('order.ePayment'), value: 'e-payment' }
58
- ]
72
+ const checkboxChildren = computed(() => {
73
+ const options = [
74
+ { label: t('order.offlinePayment'), value: 'offline' },
75
+ {
76
+ label: t('order.ePayment'),
77
+ value: 'e-payment',
78
+ disable: !props.allowEPayment,
79
+ suffix: !props.allowEPayment && props.showDisabledOptions
80
+ ? {
81
+ text: `(${props.disabledSuffixes['e-payment'] || t('order.notAllowed')})`,
82
+ class: 'text-negative t-system'
83
+ }
84
+ : undefined
85
+ },
86
+ {
87
+ label: t('order.credit'),
88
+ value: 'credit',
89
+ disable: !props.allowCredit,
90
+ suffix: !props.allowCredit && props.showDisabledOptions
91
+ ? {
92
+ text: `(${props.disabledSuffixes['credit'] || t('order.notAllowed')})`,
93
+ class: 'text-negative t-system'
94
+ }
95
+ : undefined
96
+ }
97
+ ]
98
+ return options
99
+ })
59
100
 
60
101
  const initializeCheckboxes = () => {
61
102
  const initialValues: string[] = []
62
103
  if (allowOfflinePayment.value) initialValues.push('offline')
63
104
  if (allowEPayment.value) initialValues.push('e-payment')
105
+ if (allowCreditPayment.value) initialValues.push('credit')
64
106
  nestedVal.value = initialValues
65
- parent.value = initialValues.length === checkboxChildren.length
107
+
108
+ let availableOptionsCount = 0
109
+ if (props.showDisabledOptions) {
110
+ availableOptionsCount = checkboxChildren.value.length
111
+ } else {
112
+ availableOptionsCount = checkboxChildren.value.filter(item => {
113
+ if (item.value === 'e-payment' && !props.allowEPayment) return false
114
+ if (item.value === 'credit' && !props.allowCredit) return false
115
+ return true
116
+ }).length
117
+ }
118
+
119
+ parent.value = initialValues.length === availableOptionsCount && initialValues.length > 0
66
120
  }
67
121
 
68
122
  initializeCheckboxes()
69
123
 
70
124
  const handleParentUpdate = (ev: boolean) => {
71
- nestedVal.value = ev ? checkboxChildren.map((item) => item.value) : []
125
+ const availableOptions = checkboxChildren.value.filter(item => {
126
+ // If showDisabledOptions is true, we might allow selecting it? NO, usually disabled checkboxes are not selectable.
127
+ // So we should only select enabled ones.
128
+ if (item.value === 'e-payment' && !props.allowEPayment) return false
129
+ if (item.value === 'credit' && !props.allowCredit) return false
130
+ return true
131
+ })
132
+
133
+ nestedVal.value = ev ? availableOptions.map((item) => item.value) : []
72
134
  parent.value = ev
73
135
 
74
136
  const updatedPaymentTypes: F_ORDER_PAYMENT_TYPE[] = []
@@ -80,6 +142,9 @@ const handleParentUpdate = (ev: boolean) => {
80
142
  if (nestedVal.value.includes('offline')) {
81
143
  updatedPaymentTypes.push(F_ORDER_PAYMENT_TYPE.enum.cash)
82
144
  }
145
+ if (nestedVal.value.includes('credit')) {
146
+ updatedPaymentTypes.push(F_ORDER_PAYMENT_TYPE.enum.credit)
147
+ }
83
148
 
84
149
  emits('update:paymentTypes', updatedPaymentTypes)
85
150
  emits('update:offlinePaymentTypes', updatedOfflinePaymentTypes)
@@ -87,7 +152,30 @@ const handleParentUpdate = (ev: boolean) => {
87
152
 
88
153
  const handleChildUpdate = (ev: string[]) => {
89
154
  nestedVal.value = ev
90
- parent.value = ev.length === checkboxChildren.length
155
+
156
+ let availableOptionsCount = 0
157
+ if (props.showDisabledOptions) {
158
+ availableOptionsCount = checkboxChildren.value.length
159
+ } else {
160
+ availableOptionsCount = checkboxChildren.value.filter(item => {
161
+ if (item.value === 'e-payment' && !props.allowEPayment) return false
162
+ if (item.value === 'credit' && !props.allowCredit) return false
163
+ return true
164
+ }).length
165
+ }
166
+
167
+ // If we have disabled options shown, the parent checkbox logic might be tricky.
168
+ // Usually parent is checked if ALL *checked* options are checked? No, all *available* options.
169
+ // If e-payment is disabled, can we toggle parent?
170
+ // Let's assume parent toggles all ENABLED options.
171
+ // And parent is checked if all ENABLED options are checked.
172
+ const enabledOptionsCount = checkboxChildren.value.filter(item => {
173
+ if (item.value === 'e-payment' && !props.allowEPayment) return false
174
+ if (item.value === 'credit' && !props.allowCredit) return false
175
+ return true
176
+ }).length
177
+
178
+ parent.value = ev.length === enabledOptionsCount && ev.length > 0
91
179
 
92
180
  const updatedPaymentTypes: F_ORDER_PAYMENT_TYPE[] = []
93
181
  const updatedOfflinePaymentTypes = ev.includes('offline') ? props.offlinePaymentTypes || [] : []
@@ -98,6 +186,9 @@ const handleChildUpdate = (ev: string[]) => {
98
186
  if (ev.includes('offline')) {
99
187
  updatedPaymentTypes.push(F_ORDER_PAYMENT_TYPE.enum.cash)
100
188
  }
189
+ if (ev.includes('credit')) {
190
+ updatedPaymentTypes.push(F_ORDER_PAYMENT_TYPE.enum.credit)
191
+ }
101
192
 
102
193
  emits('update:paymentTypes', updatedPaymentTypes)
103
194
  emits('update:offlinePaymentTypes', updatedOfflinePaymentTypes)
@@ -117,41 +208,58 @@ onMounted(() => {
117
208
  </script>
118
209
 
119
210
  <template>
120
- <div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.acceptedPayment') }}</div>
121
- <FmCheckbox value="" :model-value="parent" :label="t('order.all')"
122
- :indeterminate="nestedVal.length > 0 && nestedVal.length < checkboxChildren.length"
123
- @update:model-value="handleParentUpdate" />
124
-
125
- <div class="flex flex-row items-center">
126
- <FmCheckbox v-model="nestedVal" :label="checkboxChildren[0].label" :value="checkboxChildren[0].value"
127
- @update:model-value="handleChildUpdate" />
128
- </div>
129
- <div v-if="nestedVal.includes(checkboxChildren[0].value) && offlinePaymentTypes?.length === 0">
130
- <OfflinePaymentTypeDialog @update:offline-payment-types="(v: FdoOfflinePaymentMethod[] | undefined | null) => emits('update:offlinePaymentTypes', v)
131
- " />
132
- </div>
133
-
134
- <div v-if="nestedVal.includes('offline')">
135
- <div v-if="offlinePaymentTypes?.length === 0">
136
- <FmCard variant="outlined">
137
- <FmCardSection>{{ t('order.cash') }}</FmCardSection>
138
- </FmCard>
211
+ <div class="flex flex-col gap-3">
212
+ <div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.acceptedPayment') }}</div>
213
+ <FmCheckbox value="" :model-value="parent" :label="t('order.all')"
214
+ :indeterminate="nestedVal.length > 0 && !parent"
215
+ @update:model-value="handleParentUpdate" />
216
+
217
+ <div class="flex flex-row items-center">
218
+ <FmCheckbox v-model="nestedVal" :label="checkboxChildren[0].label" :value="checkboxChildren[0].value"
219
+ @update:model-value="handleChildUpdate" />
220
+ </div>
221
+ <div v-if="nestedVal.includes(checkboxChildren[0].value)">
222
+ <div v-if="offlinePaymentTypes?.length === 0">
223
+ <FmCard variant="outlined">
224
+ <FmCardSection>{{ t('order.cash') }}</FmCardSection>
225
+ </FmCard>
226
+ </div>
227
+ <p v-for="(type, i) in offlinePaymentTypes" :key="i">
228
+ <FmCard variant="outlined" class="mb-3">
229
+ <FmCardSection class="flex items-center justify-between">
230
+ <div>
231
+ <span class="font-bold">{{ type.name }}</span>
232
+ <br />
233
+ <span>{{ type.instruction }}</span>
234
+ </div>
235
+ <div>
236
+ <FmButton append-icon="delete" variant="plain" @click="deleteOfflinePayment(i)" />
237
+ </div>
238
+ </FmCardSection>
239
+ </FmCard>
240
+ </p>
241
+ <div class="mt-3">
242
+ <OfflinePaymentTypeDialog v-if="offlinePaymentTypes.length === 0 || showDisabledOptions" @add:offline-payment-type="(v: FdoOfflinePaymentMethod) => emits('update:offlinePaymentTypes', [...props.offlinePaymentTypes, v])
243
+ " />
244
+ </div>
245
+ </div>
246
+
247
+ <FmCheckbox v-model="nestedVal" :label="checkboxChildren[1].label" :value="checkboxChildren[1].value"
248
+ @update:model-value="handleChildUpdate" :disabled="checkboxChildren[1].disable" />
249
+
250
+ <div class="text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7" v-if="checkboxChildren[1].suffix">
251
+ {{ checkboxChildren?.[1]?.suffix?.text }}
252
+ </div>
253
+
254
+ <div v-if="nestedVal.includes('e-payment')" class="ml-7">
255
+ <slot name="e-payment-content"></slot>
256
+ </div>
257
+
258
+ <FmCheckbox v-if="allowCredit || showDisabledOptions" v-model="nestedVal" :label="checkboxChildren[2].label" :value="checkboxChildren[2].value"
259
+ @update:model-value="handleChildUpdate" :disabled="checkboxChildren[2].disable" />
260
+
261
+ <div class="text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7" v-if="checkboxChildren[2].suffix">
262
+ {{ checkboxChildren?.[2]?.suffix?.text }}
139
263
  </div>
140
- <p v-for="(type, i) in offlinePaymentTypes" :key="i">
141
- <FmCard variant="outlined">
142
- <FmCardSection class="flex items-center justify-between">
143
- <div>
144
- <span class="font-bold">{{ type.name }}</span>
145
- <br />
146
- <span>{{ type.instruction }}</span>
147
- </div>
148
- <div v-for="(payment, index) in offlinePaymentTypes">
149
- <FmButton append-icon="delete" variant="tertiary" @click="deleteOfflinePayment(index)" />
150
- </div>
151
- </FmCardSection>
152
- </FmCard>
153
- </p>
154
- </div>
155
- <FmCheckbox v-model="nestedVal" :label="checkboxChildren[1].label" :value="checkboxChildren[1].value"
156
- @update:model-value="handleChildUpdate" />
264
+ </div>
157
265
  </template>
@@ -1,78 +1,12 @@
1
- <template>
2
- <div>
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
- />
11
- <div class="flex flex-row items-center">
12
- <FmCheckbox
13
- v-model="nestedVal"
14
- :label="checkboxChildren[0].label"
15
- :value="checkboxChildren[0].value"
16
- @update:model-value="handleUpdate"
17
- />
18
- </div>
19
- <div class="mt-3 mb-3">
20
- <CustomPayment
21
- :offlinePaymentTypes="localOfflinePaymentTypeCopy ?? []"
22
- @update:offlinePaymentTypes="updateOfflinePaymentTypes"
23
- />
24
- </div>
25
-
26
- <div v-if="nestedVal.includes(F_ORDER_PAYMENT_TYPE.enum.cash)">
27
- <div v-if="localOfflinePaymentTypes?.length === 0">
28
- <FmCard variant="outlined">
29
- <FmCardSection>{{ t('order.cash') }}</FmCardSection>
30
- </FmCard>
31
- </div>
32
- <p v-for="(type, i) in localOfflinePaymentTypes || []" :key="i">
33
- <FmCard variant="outlined" class="mb-3">
34
- <FmCardSection class="flex items-center justify-between">
35
- <div>
36
- <span class="font-bold">{{ type.name }}</span>
37
- <br />
38
- <span>{{ type.instruction }}</span>
39
- </div>
40
- <div>
41
- <FmButton append-icon="delete" variant="plain" @click="deleteOfflinePayment(i)" />
42
- </div>
43
- </FmCardSection>
44
- </FmCard>
45
- </p>
46
- </div>
47
-
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>
62
- </div>
63
- </template>
64
-
65
1
  <script setup lang="ts">
66
2
  import {
67
3
  F_ORDER_PAYMENT_TYPE,
68
- FdoRestaurantPickup,
69
4
  FdoOfflinePaymentMethod
70
5
  } from '@feedmepos/core/entity'
71
- import CustomPayment from './CustomPayment.vue'
72
6
  import { useI18n } from '@feedmepos/mf-common'
7
+ import PaymentType from '../dine-in/PaymentType.vue'
73
8
 
74
- import { computed, onMounted, ref } from 'vue'
75
- import type { CheckboxOption } from '../../../components/type'
9
+ import { computed } from 'vue'
76
10
 
77
11
  const { t } = useI18n()
78
12
  const emits = defineEmits<{
@@ -89,118 +23,45 @@ const props = defineProps<{
89
23
  paymentTypes: F_ORDER_PAYMENT_TYPE[] | null | undefined
90
24
  offlinePaymentTypes: any
91
25
  allowEPayment: Boolean | String
26
+ allowCredit?: Boolean | String
92
27
  }>()
93
28
 
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
- })
102
- const nestedVal = ref<string[]>([])
103
-
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
- })
128
-
129
- const allowEPayment = computed(() => {
130
- const paymentTypes = props.paymentTypes || []
131
- return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.ePayment)
132
- })
133
-
134
- const allowOfflinePayment = computed(() => {
135
- const paymentTypes = props.paymentTypes || []
136
- const offlinePaymentTypes = props.offlinePaymentTypes || []
29
+ const allowEPaymentBool = computed(() => props.allowEPayment === true)
30
+ const allowCreditBool = computed(() => props.allowCredit === true)
137
31
 
138
- return paymentTypes.includes(F_ORDER_PAYMENT_TYPE.enum.cash) || offlinePaymentTypes.length > 0
139
- })
140
-
141
- onMounted(() => {
142
- initializeCheckboxes()
143
- })
144
-
145
- const initializeCheckboxes = () => {
146
- const initialValues: string[] = []
147
- if (allowOfflinePayment.value) {
148
- initialValues.push(F_ORDER_PAYMENT_TYPE.enum.cash)
32
+ const disabledSuffixes = computed(() => {
33
+ const suffixes: Record<string, string> = {}
34
+ if (!allowEPaymentBool.value) {
35
+ suffixes['e-payment'] = typeof props.allowEPayment === 'string' ? props.allowEPayment : t('order.notAllowed')
149
36
  }
150
- if (allowEPayment.value) {
151
- initialValues.push(F_ORDER_PAYMENT_TYPE.enum.ePayment)
37
+ if (!allowCreditBool.value) {
38
+ suffixes['credit'] = typeof props.allowCredit === 'string' ? props.allowCredit : t('order.notAllowed')
152
39
  }
153
- nestedVal.value = initialValues
154
- }
155
-
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
166
- }
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
- })
178
- }
179
-
180
- const localOfflinePaymentTypes = ref<FdoRestaurantPickup['offlinePaymentTypes']>(
181
- props.offlinePaymentTypes ?? []
182
- )
183
-
184
- // Create a computed copy of `localOfflinePaymentTypes.value`
185
- const localOfflinePaymentTypeCopy = computed(() => {
186
- return localOfflinePaymentTypes.value ? [...localOfflinePaymentTypes.value] : []
40
+ return suffixes
187
41
  })
188
42
 
189
- function updateOfflinePaymentTypes(v: FdoRestaurantPickup['offlinePaymentTypes']) {
190
- localOfflinePaymentTypes.value = v || []
43
+ function updatePayments(
44
+ paymentTypes: F_ORDER_PAYMENT_TYPE[],
45
+ offlinePaymentTypes: FdoOfflinePaymentMethod[] | null | undefined
46
+ ) {
191
47
  emits('update:payments', {
192
- paymentTypes: props.paymentTypes??[],
193
- offlinePaymentTypes: localOfflinePaymentTypes.value
48
+ paymentTypes,
49
+ offlinePaymentTypes
194
50
  })
195
51
  }
196
-
197
- function deleteOfflinePayment(index: number) {
198
- if (localOfflinePaymentTypes.value) {
199
- localOfflinePaymentTypes.value.splice(index, 1)
200
- emits('update:payments', {
201
- paymentTypes: props.paymentTypes?? [],
202
- offlinePaymentTypes: localOfflinePaymentTypes.value
203
- })
204
- }
205
- }
206
52
  </script>
53
+
54
+ <template>
55
+ <div>
56
+ <PaymentType
57
+ :payment-types="paymentTypes || []"
58
+ :offline-payment-types="offlinePaymentTypes || []"
59
+ :allow-e-payment="allowEPaymentBool"
60
+ :allow-credit="allowCreditBool"
61
+ :show-disabled-options="true"
62
+ :disabled-suffixes="disabledSuffixes"
63
+ @update:payment-types="(v) => updatePayments(v, offlinePaymentTypes)"
64
+ @update:offline-payment-types="(v) => updatePayments(paymentTypes || [], v)"
65
+ />
66
+ </div>
67
+ </template>
@@ -16,6 +16,7 @@
16
16
  <PaymentSidesheet
17
17
  :offline-payment-types="pickupSetting.offlinePaymentTypes"
18
18
  :allow-e-payment="restaurantStore.getRestaurantEPayment()"
19
+ :allow-credit="true"
19
20
  :payment-types="pickupSetting.paymentTypes"
20
21
  @update:payments="updatePayments"
21
22
  />