@feedmepos/mf-order-setting 0.0.12 → 0.0.14-alpha

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 (91) hide show
  1. package/dist/KioskSettingView-DNN7VBM4.js +4 -0
  2. package/dist/{app-DnR4r5jW.js → app-CbKAPxxI.js} +42471 -41975
  3. package/dist/app.js +1 -1
  4. package/dist/frontend/mf-order/src/main.d.ts +472 -0
  5. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +12 -0
  6. package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +1 -0
  7. package/dist/frontend/mf-order/src/views/order-settings/delivery/DeliverySetting.vue.d.ts +1 -1
  8. package/dist/frontend/mf-order/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue.d.ts +0 -8
  9. package/dist/frontend/mf-order/src/views/order-settings/general/GeneralSetting.vue.d.ts +2 -0
  10. package/dist/frontend/mf-order/src/views/order-settings/pickup/PaymentSidesheet.vue.d.ts +2 -16
  11. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  12. package/dist/package/entity/booking/booking.do.d.ts +60 -1025
  13. package/dist/package/entity/delivery/delivery.dto.d.ts +39 -208
  14. package/dist/package/entity/delivery/gateway/pandago.dto.d.ts +6 -6
  15. package/dist/package/entity/food-court/order.dto.d.ts +1607 -13450
  16. package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +1413 -291
  17. package/dist/package/entity/incoming-order/incoming-order.do.d.ts +602 -99
  18. package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +1182 -154
  19. package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +66 -875
  20. package/dist/package/entity/order/delivery/delivery.do.d.ts +12 -0
  21. package/dist/package/entity/order/menu/menu.dto.d.ts +6 -1
  22. package/dist/package/entity/order/order-item/order-item.dto.d.ts +847 -40
  23. package/dist/package/entity/order/order.do.d.ts +9 -3
  24. package/dist/package/entity/order/order.dto.d.ts +2639 -8399
  25. package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +12 -205
  26. package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +12 -205
  27. package/dist/package/entity/order-platform/menu.dto.d.ts +48 -48
  28. package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +12 -205
  29. package/dist/package/entity/order-setting/order-setting.do.d.ts +8 -0
  30. package/dist/package/entity/order-setting/order-setting.dto.d.ts +16 -0
  31. package/dist/package/entity/order-setting/v3/v3.do.d.ts +3 -0
  32. package/dist/package/entity/order-setting/v3/v3.dto.d.ts +3 -0
  33. package/dist/package/entity/queue/queue.do.d.ts +50 -50
  34. package/dist/package/entity/restaurant/restaurant.dto.d.ts +10 -0
  35. package/package.json +3 -2
  36. package/src/i18n.d.ts +11 -0
  37. package/src/locales/en-US.json +235 -0
  38. package/src/locales/zh-CN.json +235 -0
  39. package/src/main.ts +23 -1
  40. package/src/stores/restaurant/index.ts +31 -3
  41. package/src/stores/table-settings.ts +0 -5
  42. package/src/views/kiosk/KioskSummary.vue +16 -13
  43. package/src/views/kiosk/KioskView.vue +16 -11
  44. package/src/views/kiosk/devices/KioskDeviceCard.vue +10 -7
  45. package/src/views/kiosk/devices/KioskDevicesView.vue +6 -4
  46. package/src/views/kiosk/devices/KioskOtpDialog.vue +4 -1
  47. package/src/views/kiosk/devices/KioskUnbindConfirm.vue +3 -1
  48. package/src/views/kiosk/settings/KioskDineInSection.vue +4 -1
  49. package/src/views/kiosk/settings/KioskDisplayStandSection.vue +14 -11
  50. package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +4 -1
  51. package/src/views/kiosk/settings/KioskSettingView.vue +8 -5
  52. package/src/views/kiosk/settings/KioskTakeawaySection.vue +4 -1
  53. package/src/views/order-settings/OrderSettingsView.vue +13 -7
  54. package/src/views/order-settings/components/RestaurantSelector.vue +5 -2
  55. package/src/views/order-settings/delivery/DeliverySetting.vue +113 -60
  56. package/src/views/order-settings/delivery/components/ManualIntegratedDeliverySetting.vue +11 -8
  57. package/src/views/order-settings/delivery/components/TaxInput.vue +1 -1
  58. package/src/views/order-settings/delivery/inhouse/CurrencyInput.vue +2 -2
  59. package/src/views/order-settings/delivery/inhouse/DeliveryCustomTime.vue +31 -0
  60. package/src/views/order-settings/delivery/inhouse/DeliveryOrder.vue +12 -9
  61. package/src/views/order-settings/delivery/inhouse/DeliveryTime.vue +9 -6
  62. package/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue +63 -68
  63. package/src/views/order-settings/delivery/inhouse/TimePicker.vue +4 -1
  64. package/src/views/order-settings/delivery/inhouse/ZoneDialog.vue +7 -4
  65. package/src/views/order-settings/delivery/integrated-delivery/FeedmeDelivery.vue +38 -15
  66. package/src/views/order-settings/delivery/integrated-delivery/FoodpandaCampaignDialog.vue +7 -4
  67. package/src/views/order-settings/delivery/integrated-delivery/FoodpandaSetting.vue +7 -4
  68. package/src/views/order-settings/delivery/integrated-delivery/IntegratedDelivery.vue +99 -41
  69. package/src/views/order-settings/dinein/DineInSetting.vue +15 -12
  70. package/src/views/order-settings/dinein/OfflinePaymentTypeDialog.vue +9 -6
  71. package/src/views/order-settings/dinein/OfflinePaymentTypeDialogContent.vue +6 -3
  72. package/src/views/order-settings/dinein/PaymentType.vue +9 -6
  73. package/src/views/order-settings/general/GeneralSetting.vue +103 -0
  74. package/src/views/order-settings/pickup/AddressInput.vue +5 -2
  75. package/src/views/order-settings/pickup/CustomPayment.vue +10 -8
  76. package/src/views/order-settings/pickup/PaymentSidesheet.vue +114 -63
  77. package/src/views/order-settings/pickup/PickUpPointDialog.vue +7 -4
  78. package/src/views/order-settings/pickup/PickUpPointDialogContent.vue +7 -4
  79. package/src/views/order-settings/pickup/PickUpSetting.vue +13 -10
  80. package/src/views/order-settings/pickup/PickUpSettingDialog.vue +13 -8
  81. package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +37 -37
  82. package/src/views/order-settings/pickup/Preorder.vue +10 -8
  83. package/src/views/order-settings/servicecharge/RateInput.vue +12 -5
  84. package/src/views/order-settings/servicecharge/ServiceChargeRule.vue +44 -24
  85. package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +82 -29
  86. package/src/views/order-settings/sms/SmsSetting.vue +105 -29
  87. package/tsconfig.app.json +3 -1
  88. package/tsconfig.json +2 -1
  89. package/tsconfig.node.json +3 -1
  90. package/vite.config.ts +2 -1
  91. package/dist/KioskSettingView-YfMgLMyn.js +0 -4
@@ -13,6 +13,9 @@ import { remoteOrderApi } from '@/api/remoteOrder'
13
13
  import { useDialog } from '@feedmepos/ui-library'
14
14
  import FoodpandaCampaignDialog, { type IFPDiscountCampaign } from './FoodpandaCampaignDialog.vue'
15
15
  import { DateRange } from '@/helpers/date'
16
+ import { useI18n } from '@feedmepos/mf-common'
17
+
18
+ const { t } = useI18n()
16
19
 
17
20
  export interface FoodpandaDeliveryData {
18
21
  manual: FdoLinkedDelivery | null
@@ -102,7 +105,7 @@ function addCampaign() {
102
105
  let updatedCampaign: IFPDiscountCampaign
103
106
 
104
107
  Dialog.open({
105
- title: 'Add campaign',
108
+ title: t('order.addCampaign'),
106
109
  contentComponent: FoodpandaCampaignDialog,
107
110
  contentComponentProps: {
108
111
  'onUpdate:modelValue': (v: IFPDiscountCampaign) => {
@@ -110,7 +113,7 @@ function addCampaign() {
110
113
  }
111
114
  },
112
115
  primaryActions: {
113
- text: 'Add',
116
+ text: t('order.add'),
114
117
  variant: 'primary',
115
118
  close: true
116
119
  }
@@ -223,8 +226,8 @@ async function cancelTestOrder() {
223
226
  :can-use-auto-delivery-integration="canUseAutoDeliveryIntegration" @update:model-value="updateDataPass"
224
227
  @sync-menu="syncMenu" @flow-test-order="flowTestOrder" @cancel-test-order="cancelTestOrder">
225
228
  <template #default="{ editable }">
226
- <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-10">Discount campaign</div>
227
- <FmButton label="Add new campaign" icon="add" variant="plain" @click="addCampaign" class="mb-3" />
229
+ <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-10">{{ t('order.discountCampaign')}}</div>
230
+ <FmButton :label="t('order.addNewCampaign')" icon="add" variant="plain" @click="addCampaign" class="mb-3" />
228
231
 
229
232
  <div v-if="campaigns.length > 0">
230
233
  <div v-for="(campaign, index) in campaigns" :key="index">
@@ -6,6 +6,9 @@ import type { DeliveryCompany } from '../delivery'
6
6
  import { useMenuStore } from '@/stores/menu/menu'
7
7
  import ManualIntegratedDeliverySetting from '../components/ManualIntegratedDeliverySetting.vue'
8
8
  import { useCoreStore } from '@feedmepos/mf-common'
9
+ import { useI18n } from '@feedmepos/mf-common'
10
+
11
+ const { t } = useI18n()
9
12
 
10
13
  export interface AutoIntegrateData {
11
14
  enable: boolean
@@ -42,7 +45,6 @@ const props = defineProps({
42
45
  }
43
46
  })
44
47
 
45
-
46
48
  const emits = defineEmits<{
47
49
  (event: 'update:model-value', v: IntegratedDeliverySettingData): void
48
50
  (event: 'syncMenu'): void
@@ -134,26 +136,26 @@ const orderSettingOptions = computed<
134
136
  label: string
135
137
  value: OrderSettingKey
136
138
  }[] = [
137
- {
138
- label: 'Allowed auto close bill',
139
- value: 'autoCloseBill'
140
- }
141
- ]
139
+ {
140
+ label: t('order.allowedAutoCloseBill'),
141
+ value: 'autoCloseBill'
142
+ }
143
+ ]
142
144
  if (props.modelValue.auto.autoAccept !== undefined) {
143
145
  options.unshift({
144
- label: 'Allowed auto accept order',
146
+ label: t('order.allowedAutoAcceptOrder'),
145
147
  value: 'autoAcceptOrder'
146
148
  })
147
149
  }
148
150
  if (props.modelValue.auto.autoAccept !== undefined) {
149
151
  options.push({
150
- label: 'Ignore Discount',
152
+ label: t('order.ignoreDiscount'),
151
153
  value: 'ignoreDiscount'
152
154
  })
153
155
  }
154
156
  if (props.modelValue.auto.sstInclusive !== undefined) {
155
157
  options.push({
156
- label: 'SST Inclusive',
158
+ label: t('order.sstInclusive'),
157
159
  value: 'sstInclusive'
158
160
  })
159
161
  }
@@ -169,63 +171,103 @@ function updateOrderSettings(orderSettingKeys: OrderSettingKey[]) {
169
171
  sstInclusive: orderSettingKeys.includes('sstInclusive')
170
172
  }))
171
173
  }
174
+
175
+ function convertStatusI18n(status: string) {
176
+ switch (status) {
177
+ case 'PROCESSING':
178
+ return t('order.processing')
179
+ case 'SUCCESS':
180
+ return t('order.success')
181
+ case 'FAILED':
182
+ return t('order.failed')
183
+ }
184
+ }
172
185
  </script>
173
186
 
174
187
  <template>
175
- <ManualIntegratedDeliverySetting :model-value="modelValue.manual" :company="company"
176
- :catalog-options="menuStore.catalogOptions" @update:model-value="updateManual" />
177
- <div class="mt-10">
178
- <FmSwitch :model-value="modelValue.auto.enable" label="Active auto integration" label-placement="right"
179
- @update:model-value="updateActive" />
188
+ <ManualIntegratedDeliverySetting
189
+ :model-value="modelValue.manual"
190
+ :company="company"
191
+ :catalog-options="menuStore.catalogOptions"
192
+ @update:model-value="updateManual"
193
+ />
194
+ <div v-if="canUseAutoDeliveryIntegration === true" class="mt-10">
195
+ <FmSwitch
196
+ :model-value="modelValue.auto.enable"
197
+ :label="t('order.activateIntegration', { integrationType: t('order.auto') })"
198
+ label-placement="right"
199
+ @update:model-value="updateActive"
200
+ />
180
201
  <!-- //disabled can edit -->
181
- <div v-if="canUseAutoDeliveryIntegration === true && modelValue.auto.enable">
202
+ <div v-if="modelValue.auto.enable">
182
203
  <FmCard variant="outlined" class="mt-10 p-5">
183
- <div class="flex-grow fm-typo-en-title-sm-600 mb-5">Integration</div>
184
-
185
- <FmTextField :model-value="modelValue.auto.integrationId" label="Remote ID"
186
- @update:model-value="updateIntegrateId" />
204
+ <FmTextField
205
+ :model-value="modelValue.auto.integrationId"
206
+ :label="t('order.remoteId')"
207
+ @update:model-value="updateIntegrateId"
208
+ />
187
209
  <div class="mb-5">
188
- <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">Order Setting</div>
210
+ <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">
211
+ {{ t('order.orderSetting') }}
212
+ </div>
189
213
 
190
214
  <div v-for="(item, index) in orderSettingOptions" :key="index" class="flex flex-col">
191
- <FmCheckbox :model-value="orderSettingValue" :label="item.label" :value="item.value"
192
- @update:model-value="updateOrderSettings" />
215
+ <FmCheckbox
216
+ :model-value="orderSettingValue"
217
+ :label="item.label"
218
+ :value="item.value"
219
+ @update:model-value="updateOrderSettings"
220
+ />
193
221
  </div>
194
222
  </div>
195
223
 
196
224
  <div class="mb-5">
197
- <FmTextField :model-value="modelValue.auto.commissionRate" label="Commission"
198
- @update:model-value="updateCommission">
225
+ <FmTextField
226
+ :model-value="modelValue.auto.commissionRate"
227
+ :label="t('order.commission')"
228
+ @update:model-value="updateCommission"
229
+ >
199
230
  <template #append>%</template>
200
231
  </FmTextField>
201
232
  </div>
202
233
  <div class="mb-3">
203
- <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">Sync Menu</div>
204
- <FmSelect :model-value="modelValue.auto.catalogId" label="Catalog" :items="menuStore.catalogOptions"
205
- @update:model-value="updateMenuCatalog" />
234
+ <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">{{ t('order.syncMenu') }}</div>
235
+ <FmSelect
236
+ :placeholder="t('order.selectItem')"
237
+ :model-value="modelValue.auto.catalogId"
238
+ :label="t('order.catalog')"
239
+ :items="menuStore.catalogOptions"
240
+ @update:model-value="updateMenuCatalog"
241
+ />
206
242
  </div>
207
243
 
208
244
  <div class="text-fm-color-neutral-gray-400 fm-typo-cn-body-md-400 mb-5 mt-5">
209
245
  <div class="flex flex-row">
210
246
  <div v-if="modelValue.auto.status" class="mr-4">
211
- Status: {{ modelValue.auto.status }}
247
+ {{ t('order.status') }}: {{ convertStatusI18n(modelValue.auto.status) }}
212
248
  </div>
213
- <FmTooltip v-if="modelValue.auto.status === 'FAILED' && modelValue.auto.menuSyncError !== null"
214
- :content="modelValue.auto.menuSyncError" :zIndex="1000">
249
+ <FmTooltip
250
+ v-if="modelValue.auto.status === 'FAILED' && modelValue.auto.menuSyncError !== null"
251
+ :content="modelValue.auto.menuSyncError"
252
+ :zIndex="1000"
253
+ >
215
254
  <FmIcon name="info" size="sm" />
216
255
  </FmTooltip>
217
256
  </div>
218
257
 
219
258
  <div v-if="modelValue.auto.updatedAt">
220
- Updated at: {{ Day(modelValue.auto.updatedAt).format('DD/MM/YYYY hh:mm a') }}
259
+ {{ t('order.updatedAt') }}:
260
+ {{ Day(modelValue.auto.updatedAt).format('DD/MM/YYYY hh:mm a') }}
221
261
  </div>
222
262
  </div>
223
263
  <div class="flex flex-row">
224
- <FmButton variant="primary" label="Sync Menu" @click="emits('syncMenu')" />
264
+ <FmButton variant="primary" :label="t('order.syncMenu')" @click="emits('syncMenu')" />
225
265
 
226
- <div v-if="modelValue.auto.lastSynchronize"
227
- class="m-2 ml-10 text-fm-color-neutral-gray-400 fm-typo-cn-body-md-400">
228
- Last synchronize:
266
+ <div
267
+ v-if="modelValue.auto.lastSynchronize"
268
+ class="m-2 ml-10 text-fm-color-neutral-gray-400 fm-typo-cn-body-md-400"
269
+ >
270
+ {{ t('order.lastSync') }}:
229
271
  {{ Day(modelValue.auto.lastSynchronize).format('DD/MM/YYYY hh:mm a') }}
230
272
  </div>
231
273
  </div>
@@ -233,11 +275,27 @@ function updateOrderSettings(orderSettingKeys: OrderSettingKey[]) {
233
275
  <slot :editable="canEdit" />
234
276
  </FmCard>
235
277
  </div>
236
- <div class="flex flex-row mt-5" v-if="canUseAutoDeliveryIntegration && canEdit">
237
- <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-5">Flow Test Order</div>
238
-
239
- <FmButton variant="primary" label="Flow" @click="emits('flowTestOrder')" class="m-1" />
240
- <FmButton variant="primary" label="Cancel" @click="emits('cancelTestOrder')" class="m-1" />
241
- </div>
278
+ </div>
279
+ <div v-else class="mt-10">
280
+ <FmSnackbar
281
+ :title="`${t('order.autoIntegration')}`"
282
+ :description="`${t('order.autoIntegrationWarning', { reason: canUseAutoDeliveryIntegration })}`"
283
+ variant="warning"
284
+ />
285
+ </div>
286
+ <div class="flex flex-row mt-5" v-if="canUseAutoDeliveryIntegration === true && canEdit">
287
+ <div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-5">{{ t('order.createTestOrder') }}</div>
288
+ <FmButton
289
+ variant="primary"
290
+ :label="t('order.create')"
291
+ @click="emits('flowTestOrder')"
292
+ class="m-1"
293
+ />
294
+ <FmButton
295
+ variant="primary"
296
+ :label="t('order.cancel')"
297
+ @click="emits('cancelTestOrder')"
298
+ class="m-1"
299
+ />
242
300
  </div>
243
301
  </template>
@@ -4,17 +4,17 @@
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
- <div class="flex-grow fm-typo-en-title-sm-600">General Setting</div>
8
- <FmSwitch v-model="dineInSetting.anonymousOrder" value="anonymousOrder" label="Anonymous Order"
9
- sublabel="Customer can order without login" label-placement="right" />
10
- <FmSwitch v-model="dineInSetting.ignoreStock as boolean" value="ignoreStock" label="Ignore stock"
11
- sublabel="Product can be order even out of stock" label-placement="right" />
12
- <FmSwitch v-model="dineInSetting.staticQr as boolean" value="staticQr" label="Static QR code"
13
- sublabel="Customer can order with static QR code" label-placement="right" />
14
- <FmSwitch v-model="disableItemRemarkNegated" value="disableItemRemark" label="Customer item remark"
15
- sublabel="Customer can attach remark to item" label-placement="right" />
16
- <FmSwitch v-model="dineInSetting.acceptQueue as boolean" value="acceptQueue" label="Accept queue"
17
- sublabel="Customer can use queue in FeedMe app" label-placement="right" />
7
+ <div class="flex-grow fm-typo-en-title-sm-600">{{ t('order.generalSetting') }}</div>
8
+ <FmSwitch v-model="dineInSetting.anonymousOrder" value="anonymousOrder" :label="t('order.anonymousOrder')"
9
+ :sublabel="t('order.anonymousOrderSublabel')" label-placement="right" />
10
+ <FmSwitch v-model="dineInSetting.ignoreStock as boolean" value="ignoreStock" :label="t('order.ignoreStock')"
11
+ :sublabel="t('order.ignoreStockSublabel')" label-placement="right" />
12
+ <FmSwitch v-model="dineInSetting.staticQr as boolean" value="staticQr" :label="t('order.staticQRcode')"
13
+ :sublabel="t('order.staticQRcodeSublabel')" label-placement="right" />
14
+ <FmSwitch v-model="disableItemRemarkNegated" value="disableItemRemark" :label="t('order.customerItemRemark')"
15
+ :sublabel="t('order.customerItemRemarkSublabel')" label-placement="right" />
16
+ <FmSwitch v-model="dineInSetting.acceptQueue as boolean" value="acceptQueue" :label="t('order.acceptQueue')"
17
+ :sublabel="t('order.acceptQueueSublabel')" label-placement="right" />
18
18
  </div>
19
19
  <div class="p-[1.5rem] flex flex-col gap-2 m-5 w-2/3">
20
20
  <PaymentType :payment-types="dineInSetting.paymentTypes ?? []" :allow-e-payment="allowEPayment"
@@ -24,7 +24,7 @@
24
24
  " />
25
25
  </div>
26
26
  <div class="fm-corner-radius-lg flex flex-col gap-5 m-5">
27
- <FmButton variant="primary" label="Save Setting" class="mr-auto" @click="updateDineInSetting" />
27
+ <FmButton variant="primary" :label="t('order.saveSetting')" class="mr-auto" @click="updateDineInSetting" />
28
28
  </div>
29
29
  </div>
30
30
  <FmCircularProgress size="xxl" v-else />
@@ -44,6 +44,9 @@ import { useLoading } from '@/composables/loading'
44
44
  import { useCoreStore } from '@feedmepos/mf-common'
45
45
  import PaymentType from './PaymentType.vue'
46
46
  import { utils } from '@feedmepos/core'
47
+ import { useI18n } from '@feedmepos/mf-common'
48
+
49
+ const { t } = useI18n()
47
50
 
48
51
  const { currentRestaurant } = useCoreStore()
49
52
  const dineInSetting = ref<FdoRestaurantDineIn>(initDineInSetting())
@@ -3,6 +3,9 @@ import { useDialog } from '@feedmepos/ui-library'
3
3
  import { ref } from 'vue'
4
4
  import OfflinePaymentTypeDialogContent from './OfflinePaymentTypeDialogContent.vue'
5
5
  import type { FdoOfflinePaymentMethod } from '@feedmepos/core/entity'
6
+ import { useI18n } from '@feedmepos/mf-common'
7
+
8
+ const { t } = useI18n()
6
9
 
7
10
  const dialog = useDialog()
8
11
  const nameTextValue = ref<string>('')
@@ -12,11 +15,11 @@ const openDialog = () => {
12
15
  instructionTextValue.value = ''
13
16
  dialog
14
17
  .open({
15
- title: 'Add custom payment',
18
+ title: t('order.addCustomPayment'),
16
19
  contentComponent: OfflinePaymentTypeDialogContent,
17
20
  contentComponentProps: {
18
- name: 'Name',
19
- instruction: 'Instruction',
21
+ name: t('order.name'),
22
+ instruction: t('order.instruction'),
20
23
  'onUpdate:nameValue': (v: string) => {
21
24
  nameTextValue.value = v
22
25
  },
@@ -24,8 +27,8 @@ const openDialog = () => {
24
27
  instructionTextValue.value = v
25
28
  }
26
29
  },
27
- primaryActions: { text: 'Add', close: true },
28
- secondaryActions: { text: 'Cancel', close: true }
30
+ primaryActions: { text: t('order.add'), close: true },
31
+ secondaryActions: { text: t('order.cancel'), close: true }
29
32
  })
30
33
  .onPrimary(async () => {
31
34
  const newPaymentType = {
@@ -47,5 +50,5 @@ const emits = defineEmits<{
47
50
  </script>
48
51
 
49
52
  <template>
50
- <FmButton label="Edit offline payment" @click="openDialog" variant="plain" />
53
+ <FmButton :label="t('order.editOfflinePayment')" @click="openDialog" variant="plain" />
51
54
  </template>
@@ -4,8 +4,8 @@
4
4
  <FmTextField
5
5
  :model-value="modelValue"
6
6
  @update:model-value="updateNameValue"
7
- placeholder="Enter payment name"
8
- :rules="[(val) => !!val || 'Field cannot be empty']"
7
+ :placeholder="t('order.enterPaymentName')"
8
+ :rules="[(val) => !!val || t('order.fieldCannotBeEmpty')]"
9
9
  ></FmTextField>
10
10
 
11
11
  <div class="mb-12"></div>
@@ -13,12 +13,15 @@
13
13
  <FmTextarea
14
14
  :model-value="modelValue"
15
15
  @update:model-value="updateInstructionValue"
16
- placeholder="Enter payment instruction"
16
+ :placeholder="t('order.enterPaymentInstruction')"
17
17
  ></FmTextarea>
18
18
  </div>
19
19
  </template>
20
20
  <script setup lang="ts">
21
21
  import { ref } from 'vue'
22
+ import { useI18n } from '@feedmepos/mf-common'
23
+
24
+ const { t } = useI18n()
22
25
 
23
26
  interface Emits {
24
27
  (e: 'update:nameValue', v: string): void
@@ -2,7 +2,10 @@
2
2
  import { F_ORDER_PAYMENT_TYPE, FdoOfflinePaymentMethod } from '@feedmepos/core/entity'
3
3
  import { type PropType, computed, onMounted, ref, watch } from 'vue'
4
4
  import OfflinePaymentTypeDialog from './OfflinePaymentTypeDialog.vue'
5
- import { useCoreStore } from '@feedmepos/mf-common'
5
+ import { useCoreStore, useI18n } from '@feedmepos/mf-common'
6
+
7
+ const { t } = useI18n()
8
+
6
9
  const props = defineProps({
7
10
  paymentTypes: {
8
11
  type: Array as PropType<F_ORDER_PAYMENT_TYPE[]>,
@@ -50,8 +53,8 @@ const parent = ref(false)
50
53
  const nestedVal = ref<string[]>([])
51
54
 
52
55
  const checkboxChildren = [
53
- { label: 'Offline Payment', value: 'offline' },
54
- { label: 'E-Payment', value: 'e-payment' }
56
+ { label: t('order.offlinePayment'), value: 'offline' },
57
+ { label: t('order.ePayment'), value: 'e-payment' }
55
58
  ]
56
59
 
57
60
  const initializeCheckboxes = () => {
@@ -114,8 +117,8 @@ onMounted(() => {
114
117
  </script>
115
118
 
116
119
  <template>
117
- <div class="flex-grow fm-typo-en-title-sm-600">Accepted Payment</div>
118
- <FmCheckbox value="" :model-value="parent" label="All"
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')"
119
122
  :indeterminate="nestedVal.length > 0 && nestedVal.length < checkboxChildren.length"
120
123
  @update:model-value="handleParentUpdate" />
121
124
 
@@ -131,7 +134,7 @@ onMounted(() => {
131
134
  <div v-if="nestedVal.includes('offline')">
132
135
  <div v-if="offlinePaymentTypes?.length === 0">
133
136
  <FmCard variant="outlined">
134
- <FmCardSection>Cash </FmCardSection>
137
+ <FmCardSection>{{ t('order.cash') }}</FmCardSection>
135
138
  </FmCard>
136
139
  </div>
137
140
  <p v-for="(type, i) in offlinePaymentTypes" :key="i">
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <div class="flex justify-between items-center">
3
+ <RestaurantSelector :model-value="currentRestaurant?._id ?? undefined" />
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
+ :disabled="!validPosVersion"
10
+ v-model="autoSendKitchen"
11
+ :label="t('order.autoSendKitchen')"
12
+ :sublabel="`${!validPosVersion ? `(${t('order.autoSendKitchenSublabel')})` : ''}`"
13
+ label-placement="right"
14
+ ></FmSwitch>
15
+
16
+ <FmSwitch
17
+ v-model="anonymousLoginDialog"
18
+ :label="t('order.promptAnonymousLoginDialog')"
19
+ label-placement="right"
20
+ ></FmSwitch>
21
+ </div>
22
+ <div class="fm-corner-radius-lg flex flex-col gap-5 m-5">
23
+ <FmButton
24
+ variant="primary"
25
+ :label="t('order.saveSetting')"
26
+ class="mr-auto"
27
+ @click="updateOrderSetting"
28
+ />
29
+ </div>
30
+ </div>
31
+ <FmCircularProgress size="xxl" v-else />
32
+ </template>
33
+
34
+ <script setup lang="ts">
35
+ import { useCoreStore } from '@feedmepos/mf-common'
36
+ import RestaurantSelector from '../components/RestaurantSelector.vue'
37
+ import { useLoading } from '@/composables/loading'
38
+ import { type OrderSettingsDto, type OrderV3Settings } from '@entity'
39
+ import { OrderSettingApi } from '@/api/order-setting'
40
+ import { computed, onMounted, ref, watch } from 'vue'
41
+ import { useSnackbarFunctions } from '@/components/snackbar'
42
+ import { useI18n } from '@feedmepos/mf-common'
43
+
44
+ const { t } = useI18n()
45
+
46
+ const { showSuccess } = useSnackbarFunctions()
47
+ const { currentRestaurant } = useCoreStore()
48
+ const { startAsyncCallWithErr, isLoading } = useLoading()
49
+
50
+ const orderSettingDefault = ref<OrderSettingsDto | undefined>(undefined)
51
+ const v3Settings = ref<OrderV3Settings | undefined>(undefined)
52
+ const autoSendKitchen = ref<boolean>(false)
53
+ const anonymousLoginDialog = ref<boolean>(false)
54
+
55
+ const validPosVersion = computed<boolean>(() => {
56
+ return currentRestaurant?.value?.posVersion?.startsWith('7') ?? false
57
+ })
58
+
59
+ async function init() {
60
+ 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
67
+ }
68
+ }
69
+
70
+ async function updateOrderSetting() {
71
+ 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()
83
+ showSuccess('General setting updated')
84
+ }
85
+ })
86
+ }
87
+
88
+ onMounted(() => init())
89
+
90
+ watch(
91
+ () => currentRestaurant.value,
92
+ () => {
93
+ init()
94
+ },
95
+ { immediate: true }
96
+ )
97
+
98
+ async function readOrderSetting(): Promise<OrderSettingsDto> {
99
+ return await startAsyncCallWithErr(async () => {
100
+ return await OrderSettingApi.getOrderSetting()
101
+ })
102
+ }
103
+ </script>
@@ -1,6 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, watch } from 'vue'
3
3
  import { googleMap } from '@/helpers/map'
4
+ import { useI18n } from '@feedmepos/mf-common'
5
+
6
+ const { t } = useI18n()
4
7
 
5
8
  const props = defineProps<{
6
9
  title?: string
@@ -42,7 +45,7 @@ watch(modelValue, (newVal) => {
42
45
  :model-value="modelValue"
43
46
  :datalist="placeOptions"
44
47
  @update:modelValue="modelValue = $event"
45
- placeholder="Enter address"
46
- :rules="[(val) => !!val || 'Field cannot be empty']"
48
+ :placeholder="t('order.enterAddress')"
49
+ :rules="[(val) => !!val || t('order.fieldCannotBeEmpty')]"
47
50
  />
48
51
  </template>
@@ -2,7 +2,9 @@
2
2
  import { ref, watch, computed } from 'vue'
3
3
  import OfflinePaymentTypeDialogContent from '../dinein/OfflinePaymentTypeDialogContent.vue'
4
4
  import type { FdoOfflinePaymentMethod } from '@feedmepos/core/entity'
5
+ import { useI18n } from '@feedmepos/mf-common'
5
6
 
7
+ const { t } = useI18n()
6
8
  const props = defineProps<{
7
9
  offlinePaymentTypes: FdoOfflinePaymentMethod[]
8
10
  }>()
@@ -46,8 +48,8 @@ const isSideSheetOpen = ref(false)
46
48
 
47
49
  const label = computed(() => {
48
50
  return (props.offlinePaymentTypes.length === 0)
49
- ? "Custom offline payment"
50
- : "Add offline payment";
51
+ ? t('order.customOfflinePayment')
52
+ : t('order.addOfflinePayment');
51
53
  });
52
54
 
53
55
  function closeSideSheet() {
@@ -61,22 +63,22 @@ function openSideSheet() {
61
63
 
62
64
 
63
65
  <template>
64
- <FmSideSheet header="Custom offline payment" dismiss-away :maxWidth="600" :model-value="isSideSheetOpen">
66
+ <FmSideSheet :header="t('order.customOfflinePaymentHeader')" dismiss-away :maxWidth="600" :model-value="isSideSheetOpen">
65
67
  <template #side-sheet-button>
66
68
  <FmButton :label="label" variant="plain" icon="add" @click="openSideSheet()"/>
67
69
  </template>
68
- <div class="fm-typo-en-title-sm-600 mb-5">General</div>
70
+ <div class="fm-typo-en-title-sm-600 mb-5">{{ t('order.general') }}</div>
69
71
  <OfflinePaymentTypeDialogContent
70
- name="Offline payment name"
71
- instruction="Instruction"
72
+ :name="t('order.offlinePaymentName')"
73
+ :instruction="t('order.instruction')"
72
74
  @update:nameValue="updateName"
73
75
  @update:instructionValue="updateInstruction"
74
76
 
75
77
  />
76
78
  <template #side-sheet-footer>
77
79
  <div class="flex gap-8 items-center justify-start">
78
- <FmButton variant="primary" label="Add" size="lg" @click="addOffline" close: true/>
79
- <FmButton variant="secondary" label="Cancel" size="lg" @click="closeSideSheet()"/>
80
+ <FmButton variant="primary" :label="t('order.add')" size="lg" @click="addOffline" close: true/>
81
+ <FmButton variant="secondary" :label="t('order.cancel')" size="lg" @click="closeSideSheet()"/>
80
82
  </div>
81
83
  </template>
82
84
  </FmSideSheet>