@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.
- package/dist/KioskSettingView-DNN7VBM4.js +4 -0
- package/dist/{app-DnR4r5jW.js → app-CbKAPxxI.js} +42471 -41975
- package/dist/app.js +1 -1
- package/dist/frontend/mf-order/src/main.d.ts +472 -0
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +12 -0
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +1 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/DeliverySetting.vue.d.ts +1 -1
- package/dist/frontend/mf-order/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue.d.ts +0 -8
- package/dist/frontend/mf-order/src/views/order-settings/general/GeneralSetting.vue.d.ts +2 -0
- package/dist/frontend/mf-order/src/views/order-settings/pickup/PaymentSidesheet.vue.d.ts +2 -16
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/package/entity/booking/booking.do.d.ts +60 -1025
- package/dist/package/entity/delivery/delivery.dto.d.ts +39 -208
- package/dist/package/entity/delivery/gateway/pandago.dto.d.ts +6 -6
- package/dist/package/entity/food-court/order.dto.d.ts +1607 -13450
- package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +1413 -291
- package/dist/package/entity/incoming-order/incoming-order.do.d.ts +602 -99
- package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +1182 -154
- package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +66 -875
- package/dist/package/entity/order/delivery/delivery.do.d.ts +12 -0
- package/dist/package/entity/order/menu/menu.dto.d.ts +6 -1
- package/dist/package/entity/order/order-item/order-item.dto.d.ts +847 -40
- package/dist/package/entity/order/order.do.d.ts +9 -3
- package/dist/package/entity/order/order.dto.d.ts +2639 -8399
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +12 -205
- package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +12 -205
- package/dist/package/entity/order-platform/menu.dto.d.ts +48 -48
- package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +12 -205
- package/dist/package/entity/order-setting/order-setting.do.d.ts +8 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +16 -0
- package/dist/package/entity/order-setting/v3/v3.do.d.ts +3 -0
- package/dist/package/entity/order-setting/v3/v3.dto.d.ts +3 -0
- package/dist/package/entity/queue/queue.do.d.ts +50 -50
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +10 -0
- package/package.json +3 -2
- package/src/i18n.d.ts +11 -0
- package/src/locales/en-US.json +235 -0
- package/src/locales/zh-CN.json +235 -0
- package/src/main.ts +23 -1
- package/src/stores/restaurant/index.ts +31 -3
- package/src/stores/table-settings.ts +0 -5
- package/src/views/kiosk/KioskSummary.vue +16 -13
- package/src/views/kiosk/KioskView.vue +16 -11
- package/src/views/kiosk/devices/KioskDeviceCard.vue +10 -7
- package/src/views/kiosk/devices/KioskDevicesView.vue +6 -4
- package/src/views/kiosk/devices/KioskOtpDialog.vue +4 -1
- package/src/views/kiosk/devices/KioskUnbindConfirm.vue +3 -1
- package/src/views/kiosk/settings/KioskDineInSection.vue +4 -1
- package/src/views/kiosk/settings/KioskDisplayStandSection.vue +14 -11
- package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +4 -1
- package/src/views/kiosk/settings/KioskSettingView.vue +8 -5
- package/src/views/kiosk/settings/KioskTakeawaySection.vue +4 -1
- package/src/views/order-settings/OrderSettingsView.vue +13 -7
- package/src/views/order-settings/components/RestaurantSelector.vue +5 -2
- package/src/views/order-settings/delivery/DeliverySetting.vue +113 -60
- package/src/views/order-settings/delivery/components/ManualIntegratedDeliverySetting.vue +11 -8
- package/src/views/order-settings/delivery/components/TaxInput.vue +1 -1
- package/src/views/order-settings/delivery/inhouse/CurrencyInput.vue +2 -2
- package/src/views/order-settings/delivery/inhouse/DeliveryCustomTime.vue +31 -0
- package/src/views/order-settings/delivery/inhouse/DeliveryOrder.vue +12 -9
- package/src/views/order-settings/delivery/inhouse/DeliveryTime.vue +9 -6
- package/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue +63 -68
- package/src/views/order-settings/delivery/inhouse/TimePicker.vue +4 -1
- package/src/views/order-settings/delivery/inhouse/ZoneDialog.vue +7 -4
- package/src/views/order-settings/delivery/integrated-delivery/FeedmeDelivery.vue +38 -15
- package/src/views/order-settings/delivery/integrated-delivery/FoodpandaCampaignDialog.vue +7 -4
- package/src/views/order-settings/delivery/integrated-delivery/FoodpandaSetting.vue +7 -4
- package/src/views/order-settings/delivery/integrated-delivery/IntegratedDelivery.vue +99 -41
- package/src/views/order-settings/dinein/DineInSetting.vue +15 -12
- package/src/views/order-settings/dinein/OfflinePaymentTypeDialog.vue +9 -6
- package/src/views/order-settings/dinein/OfflinePaymentTypeDialogContent.vue +6 -3
- package/src/views/order-settings/dinein/PaymentType.vue +9 -6
- package/src/views/order-settings/general/GeneralSetting.vue +103 -0
- package/src/views/order-settings/pickup/AddressInput.vue +5 -2
- package/src/views/order-settings/pickup/CustomPayment.vue +10 -8
- package/src/views/order-settings/pickup/PaymentSidesheet.vue +114 -63
- package/src/views/order-settings/pickup/PickUpPointDialog.vue +7 -4
- package/src/views/order-settings/pickup/PickUpPointDialogContent.vue +7 -4
- package/src/views/order-settings/pickup/PickUpSetting.vue +13 -10
- package/src/views/order-settings/pickup/PickUpSettingDialog.vue +13 -8
- package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +37 -37
- package/src/views/order-settings/pickup/Preorder.vue +10 -8
- package/src/views/order-settings/servicecharge/RateInput.vue +12 -5
- package/src/views/order-settings/servicecharge/ServiceChargeRule.vue +44 -24
- package/src/views/order-settings/servicecharge/ServiceChargeSetting.vue +82 -29
- package/src/views/order-settings/sms/SmsSetting.vue +105 -29
- package/tsconfig.app.json +3 -1
- package/tsconfig.json +2 -1
- package/tsconfig.node.json +3 -1
- package/vite.config.ts +2 -1
- package/dist/KioskSettingView-YfMgLMyn.js +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col gap-5">
|
|
3
3
|
<div class="flex flex-col gap-16">
|
|
4
|
-
<FmSwitch v-model="form.enabled" label="
|
|
4
|
+
<FmSwitch v-model="form.enabled" :label="t('order.dineIn')" label-placement="right" />
|
|
5
5
|
<div v-show="form.enabled" class="flex flex-col gap-16">
|
|
6
6
|
<KioskPickAtCounterSection v-if="form.pickUp" :enabled="form.pickUp.enabled"
|
|
7
7
|
@update-pick-up="updatePickUp" />
|
|
@@ -17,6 +17,9 @@ import KioskDisplayStandSection from './KioskDisplayStandSection.vue';
|
|
|
17
17
|
import KioskPickAtCounterSection from './KioskPickAtCounterSection.vue';
|
|
18
18
|
import { ref, watch } from 'vue';
|
|
19
19
|
import { ObjectUtil } from '@/utils/object';
|
|
20
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
21
|
+
|
|
22
|
+
const { t } = useI18n()
|
|
20
23
|
|
|
21
24
|
interface Props {
|
|
22
25
|
getSetting: () => KioskDineInSettingForm,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<FmSwitch v-model="form.enabled" label="
|
|
3
|
+
<FmSwitch v-model="form.enabled" :label="t('order.displayStand')" label-placement="right"
|
|
4
4
|
@update:modelValue="updateEnabled" />
|
|
5
5
|
<div class="border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-2 my-5 w-11/12" v-show="form.enabled">
|
|
6
|
-
<span class="fm-typo-en-title-sm-600">
|
|
6
|
+
<span class="fm-typo-en-title-sm-600">{{ t('order.tableServiceSetting') }}</span>
|
|
7
7
|
<div class="flex flex-col gap-10">
|
|
8
8
|
<!-- prefix -->
|
|
9
9
|
<!-- TODO: How to let user know this field is do for what-->
|
|
10
|
-
<FmTextField v-model="form.prefix" label="
|
|
10
|
+
<FmTextField v-model="form.prefix" :label="t('order.prefix')" :placeholder="t('order.prefix')"
|
|
11
11
|
@update:modelValue="updatePrefix" />
|
|
12
12
|
</div>
|
|
13
13
|
<div class="flex flex-row gap-2">
|
|
14
14
|
<!-- <span class="fm-typo-en-title-sm-600">Table Stand Number Range</span> -->
|
|
15
|
-
<FmStepperField class="w-1/2" v-model="form.standSlotRange.min" label="
|
|
16
|
-
:rules="minRules" placeholder="
|
|
17
|
-
<FmStepperField class="w-1/2" v-model="form.standSlotRange.max" label="
|
|
18
|
-
:rules="maxRules" placeholder="
|
|
15
|
+
<FmStepperField class="w-1/2" v-model="form.standSlotRange.min" :label="t('order.start')" labelMark="required"
|
|
16
|
+
:rules="minRules" :placeholder="t('order.enterANumber')" @update:modelValue="updateMin" />
|
|
17
|
+
<FmStepperField class="w-1/2" v-model="form.standSlotRange.max" :label="t('order.end')" labelMark="required"
|
|
18
|
+
:rules="maxRules" :placeholder="t('order.enterANumber')" @update:modelValue="updateMax" />
|
|
19
19
|
</div>
|
|
20
20
|
<div>
|
|
21
21
|
<!-- pad digit -->
|
|
22
22
|
<!-- TODO: How to let user know this field is do for what-->
|
|
23
|
-
<FmStepperField v-model="form.padDigit" label="
|
|
24
|
-
placeholder="
|
|
23
|
+
<FmStepperField v-model="form.padDigit" :label="t('order.padDigit')" labelMark="required" :rules="padDigitRules"
|
|
24
|
+
:placeholder="t('order.padDigit')" @update:modelValue="updatePadDigit" />
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
@@ -31,6 +31,9 @@ import { computed, ref } from 'vue';
|
|
|
31
31
|
import { NumberUtil } from '@/utils/number';
|
|
32
32
|
import { ObjectUtil } from '@/utils/object';
|
|
33
33
|
import type { DisplayStandSettingForm } from '@/modules/order-setting/kiosk/interface';
|
|
34
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
35
|
+
|
|
36
|
+
const { t } = useI18n()
|
|
34
37
|
|
|
35
38
|
interface Props {
|
|
36
39
|
displayStand: DisplayStandSettingForm;
|
|
@@ -46,13 +49,13 @@ const form = ref<DisplayStandSettingForm>(ObjectUtil.clone<DisplayStandSettingFo
|
|
|
46
49
|
|
|
47
50
|
const nonNegativeRule = (val: any) => {
|
|
48
51
|
if (val < 0) {
|
|
49
|
-
return '
|
|
52
|
+
return t('order.nonNegativeRule');
|
|
50
53
|
}
|
|
51
54
|
return true;
|
|
52
55
|
}
|
|
53
56
|
const greaterThanMinRule = (val: any) => {
|
|
54
57
|
if (val <= (form.value.standSlotRange.min ?? 0)) {
|
|
55
|
-
return '
|
|
58
|
+
return t('order.greaterThanMinRule');
|
|
56
59
|
}
|
|
57
60
|
return true;
|
|
58
61
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<FmSwitch v-model="pickUpEnabled" label="
|
|
3
|
+
<FmSwitch v-model="pickUpEnabled" :label="t('order.pickAtCounter')" label-placement="right"
|
|
4
4
|
@update:modelValue="updatePickUp" />
|
|
5
5
|
</div>
|
|
6
6
|
</template>
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { ref } from 'vue';
|
|
9
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
10
|
+
|
|
11
|
+
const { t } = useI18n()
|
|
9
12
|
|
|
10
13
|
interface Props {
|
|
11
14
|
enabled: boolean,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="!!kioskOrderSettingForm" class="flex flex-col gap-32">
|
|
3
3
|
<div class="flex flex-col gap-2">
|
|
4
|
-
<span class="fm-typo-en-title-sm-600">
|
|
4
|
+
<span class="fm-typo-en-title-sm-600">{{ t('order.dineIn') }}</span>
|
|
5
5
|
<KioskDineInSection :key="'dine-in-' + restaurantId" :restaurant-id="restaurantId"
|
|
6
6
|
:is-apply-loading="isLoading" :get-setting="() => kioskOrderSettingForm!.dineIn"
|
|
7
7
|
@update-dine-in="updateDineInSetting" />
|
|
8
8
|
</div>
|
|
9
9
|
<div class="flex flex-col gap-2">
|
|
10
|
-
<span class="fm-typo-en-title-sm-600">
|
|
10
|
+
<span class="fm-typo-en-title-sm-600">{{ t('order.takeawayTitle') }}</span>
|
|
11
11
|
<KioskTakeawaySection :key="'takeaway-' + restaurantId" :restaurant-id="restaurantId"
|
|
12
12
|
:is-apply-loading="isLoading" :get-setting="() => kioskOrderSettingForm!.takeaway"
|
|
13
13
|
@update-takeaway="updateTakeawaySetting" />
|
|
14
14
|
</div>
|
|
15
|
-
<FmButton class="w-1/4 mb-10" variant="primary" label="
|
|
15
|
+
<FmButton class="w-1/4 mb-10" variant="primary" :label="t('order.updateSetting')" :disabled="!validKioskOrderSetting"
|
|
16
16
|
@click="submitForm" />
|
|
17
17
|
</div>
|
|
18
18
|
<div v-else>
|
|
19
|
-
|
|
19
|
+
{{ t('order.pleaseSelectRestaurant') }}
|
|
20
20
|
</div>
|
|
21
21
|
</template>
|
|
22
22
|
<script setup lang="ts">
|
|
@@ -26,6 +26,9 @@ import KioskTakeawaySection from './KioskTakeawaySection.vue';
|
|
|
26
26
|
import type { KioskDineInSettingForm, KioskTakeawaySettingForm, MfKioskOrderSetting, MfKioskOrderSettingForm, } from '@/modules/order-setting/kiosk/interface';
|
|
27
27
|
import { useLoading } from '@/composables/loading';
|
|
28
28
|
import { useSnackbar } from '@feedmepos/ui-library';
|
|
29
|
+
import { useI18n } from '@feedmepos/mf-common';
|
|
30
|
+
|
|
31
|
+
const { t } = useI18n();
|
|
29
32
|
|
|
30
33
|
interface Props {
|
|
31
34
|
restaurantId: string,
|
|
@@ -129,7 +132,7 @@ async function submitForm() {
|
|
|
129
132
|
});
|
|
130
133
|
} else {
|
|
131
134
|
SnackBar.open({
|
|
132
|
-
title: '
|
|
135
|
+
title: t('order.failedToUpdateSetting'),
|
|
133
136
|
type: 'error',
|
|
134
137
|
});
|
|
135
138
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<FmSwitch v-model="form.enabled" label="
|
|
3
|
+
<FmSwitch v-model="form.enabled" :label="t('order.takeaway')" label-placement="right"
|
|
4
4
|
@update:model-value="updateTakeawaySetting" class="mb-5" />
|
|
5
5
|
</div>
|
|
6
6
|
</template>
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
import type { KioskTakeawaySettingForm } from '@/modules/order-setting/kiosk/interface';
|
|
9
9
|
import { ref, watch } from 'vue';
|
|
10
10
|
import { ObjectUtil } from '@/utils/object';
|
|
11
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
12
|
+
|
|
13
|
+
const { t } = useI18n()
|
|
11
14
|
|
|
12
15
|
interface Props {
|
|
13
16
|
getSetting: () => KioskTakeawaySettingForm,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="py-[1.5rem]">
|
|
3
|
-
<FmPageHead title="
|
|
3
|
+
<FmPageHead :title="t('order.orderSetting')"/>
|
|
4
4
|
<div class="flex px-[1.5rem]">
|
|
5
5
|
<div class="flex-[2_2_0%] overflow-auto">
|
|
6
6
|
<FmTabs v-model:model-value="selectedOrderSetting" :items="settingItem" />
|
|
@@ -18,16 +18,20 @@ import DineInSetting from './dinein/DineInSetting.vue'
|
|
|
18
18
|
import PickUpSetting from './pickup/PickUpSetting.vue'
|
|
19
19
|
import SmsSetting from './sms/SmsSetting.vue'
|
|
20
20
|
import ServiceChargeSetting from './servicecharge/ServiceChargeSetting.vue'
|
|
21
|
+
import GeneralSetting from './general/GeneralSetting.vue'
|
|
22
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
const { t } = useI18n()
|
|
25
|
+
type OrderSettingMenuItemValue = 'delivery' | 'pickup' | 'dinein' | 'servicecharge' | 'sms' | 'general'
|
|
23
26
|
const selectedOrderSetting = ref<OrderSettingMenuItemValue>('delivery')
|
|
24
27
|
|
|
25
28
|
const settingItem = computed<FmTabProps[]>(() => [
|
|
26
|
-
{ label: '
|
|
27
|
-
{ label: '
|
|
28
|
-
{ label: '
|
|
29
|
-
{ label: '
|
|
30
|
-
{ label: '
|
|
29
|
+
{ label: t('order.delivery'), value: 'delivery' },
|
|
30
|
+
{ label: t('order.pickup'), value: 'pickup' },
|
|
31
|
+
{ label: t('order.dineIn'), value: 'dinein' },
|
|
32
|
+
{ label: t('order.serviceCharge'), value: 'servicecharge' },
|
|
33
|
+
{ label: t('order.sms'), value: 'sms' },
|
|
34
|
+
{ label: t('order.general'), value: 'general'},
|
|
31
35
|
])
|
|
32
36
|
|
|
33
37
|
const currentComponent = computed(() => {
|
|
@@ -42,6 +46,8 @@ const currentComponent = computed(() => {
|
|
|
42
46
|
return SmsSetting
|
|
43
47
|
case 'servicecharge':
|
|
44
48
|
return ServiceChargeSetting
|
|
49
|
+
case 'general':
|
|
50
|
+
return GeneralSetting
|
|
45
51
|
}
|
|
46
52
|
})
|
|
47
53
|
</script>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<FmIcon name="storefront" size="md" outline class="flex-shrink-0" />
|
|
6
6
|
<div class="flex-grow mx-2 min-w-0">
|
|
7
7
|
<span class="inline-block w-full break-words fm-typo-en-body-md-400">
|
|
8
|
-
{{ selectedRestaurant?.profile?.name ?? '
|
|
8
|
+
{{ selectedRestaurant?.profile?.name ?? t('order.noRestaurantSelected') }}
|
|
9
9
|
</span>
|
|
10
10
|
</div>
|
|
11
11
|
<FmIcon class="flex-shrink-0" :name="isOpen ? 'expand_less' : 'expand_more'"></FmIcon>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
class="absolute w-full mt-2 bg-white border border-gray-200 rounded-lg shadow-lg min-w-[350px] z-[9999]">
|
|
15
15
|
<ul class="overflow-y-auto">
|
|
16
16
|
<li class="mt-2 mx-2">
|
|
17
|
-
<FmSearch v-model="searchKey" placeholder="
|
|
17
|
+
<FmSearch v-model="searchKey" :placeholder="t('order.searchRestaurant')" />
|
|
18
18
|
</li>
|
|
19
19
|
<li v-for="(option, index) in filteredRestaurants" :key="index" class="p-3 hover:bg-gray-100 cursor-pointer"
|
|
20
20
|
@click="selectOption(option)">
|
|
@@ -30,6 +30,9 @@ import { ref, computed, onMounted, onUnmounted } from 'vue'
|
|
|
30
30
|
import { useCoreStore } from '@feedmepos/mf-common'
|
|
31
31
|
import useSearch from '@/composables/search'
|
|
32
32
|
import { FdoRestaurant } from '@feedmepos/core/entity'
|
|
33
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
34
|
+
|
|
35
|
+
const { t } = useI18n()
|
|
33
36
|
|
|
34
37
|
interface RestaurantItem {
|
|
35
38
|
label: string,
|
|
@@ -4,13 +4,17 @@
|
|
|
4
4
|
:model-value="currentRestaurant?._id ?? undefined"
|
|
5
5
|
class="xs:order-2 xs:mb-3"
|
|
6
6
|
/>
|
|
7
|
-
<FmSearch
|
|
7
|
+
<FmSearch
|
|
8
|
+
v-model="searchKey"
|
|
9
|
+
:placeholder="t('order.search')"
|
|
10
|
+
class="mx-5 xs:my-3 xs:order-1"
|
|
11
|
+
/>
|
|
8
12
|
</div>
|
|
9
13
|
<div class="block">
|
|
10
14
|
<FmPageHead
|
|
11
15
|
class="flex-grow"
|
|
12
|
-
title="
|
|
13
|
-
description="
|
|
16
|
+
:title="`${t('order.integratedDeliveryCompany')}`"
|
|
17
|
+
:description="t('order.deliveryDescription')"
|
|
14
18
|
/>
|
|
15
19
|
<div v-if="!isLoading">
|
|
16
20
|
<DeliveryList
|
|
@@ -71,7 +75,6 @@
|
|
|
71
75
|
<InHouseDelivery
|
|
72
76
|
v-if="inHouseComponentProps.key === F_ORDER_PLATFORM.enum.IN_HOUSE"
|
|
73
77
|
:initial-value="inHouseComponentProps.initialValue"
|
|
74
|
-
:allow-e-payment="inHouseComponentProps.allowEPayment"
|
|
75
78
|
:address="formatAddress(currentRestaurant?.profile.address)"
|
|
76
79
|
@update:model-value="handleModelValueUpdateInHouse"
|
|
77
80
|
/>
|
|
@@ -79,13 +82,13 @@
|
|
|
79
82
|
<div class="flex gap-8 items-center justify-start">
|
|
80
83
|
<FmButton
|
|
81
84
|
variant="primary"
|
|
82
|
-
label="
|
|
85
|
+
:label="t('order.save')"
|
|
83
86
|
size="lg"
|
|
84
87
|
@click="updateIntegratedDeliveryCompany"
|
|
85
88
|
/>
|
|
86
89
|
<FmButton
|
|
87
90
|
variant="secondary"
|
|
88
|
-
label="
|
|
91
|
+
:label="t('order.cancel')"
|
|
89
92
|
size="lg"
|
|
90
93
|
@click="closeIntegratedDeliverySideSheet"
|
|
91
94
|
/>
|
|
@@ -96,8 +99,8 @@
|
|
|
96
99
|
<div class="block">
|
|
97
100
|
<FmPageHead
|
|
98
101
|
class="flex-grow"
|
|
99
|
-
title="
|
|
100
|
-
description="
|
|
102
|
+
:title="t('order.localDeliveryCompany')"
|
|
103
|
+
:description="t('order.localDeliveryDescription')"
|
|
101
104
|
/>
|
|
102
105
|
<FmTable
|
|
103
106
|
v-model="model"
|
|
@@ -118,7 +121,7 @@
|
|
|
118
121
|
|
|
119
122
|
<div class="flex">
|
|
120
123
|
<FmSideSheet
|
|
121
|
-
header="
|
|
124
|
+
:header="t('order.updateDeliveryCompany')"
|
|
122
125
|
dismiss-away
|
|
123
126
|
:maxWidth="600"
|
|
124
127
|
:model-value="sideSheet"
|
|
@@ -132,10 +135,15 @@
|
|
|
132
135
|
/>
|
|
133
136
|
<template #side-sheet-footer>
|
|
134
137
|
<div class="flex gap-8 items-center justify-start">
|
|
135
|
-
<FmButton
|
|
138
|
+
<FmButton
|
|
139
|
+
variant="primary"
|
|
140
|
+
:label="t('order.save')"
|
|
141
|
+
size="lg"
|
|
142
|
+
@click="updateLocalDeliveryCompany"
|
|
143
|
+
/>
|
|
136
144
|
<FmButton
|
|
137
145
|
variant="secondary"
|
|
138
|
-
label="
|
|
146
|
+
:label="t('order.cancel')"
|
|
139
147
|
size="lg"
|
|
140
148
|
@click="closeLocalDeliverySideSheet"
|
|
141
149
|
/>
|
|
@@ -163,7 +171,8 @@ import {
|
|
|
163
171
|
F_DELIVERY_TYPE,
|
|
164
172
|
F_FEATURE,
|
|
165
173
|
F_ORDER_PLATFORM,
|
|
166
|
-
F_PAYOUT_ACCOUNT_STATUS
|
|
174
|
+
F_PAYOUT_ACCOUNT_STATUS,
|
|
175
|
+
F_RESTAURANT_FEATURE
|
|
167
176
|
} from '@feedmepos/core/entity'
|
|
168
177
|
import deliveryData from './delivery.data'
|
|
169
178
|
import { useDelivery, type DeliveryCompany, type LinkedDeliveryDoc } from './delivery'
|
|
@@ -185,11 +194,14 @@ import { useSnackbarFunctions } from '@/components/snackbar'
|
|
|
185
194
|
import useSearch from '@/composables/search'
|
|
186
195
|
import DeliveryList from './DeliveryList.vue'
|
|
187
196
|
import { Pos } from '@feedmepos/core'
|
|
197
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
188
198
|
|
|
199
|
+
const { t } = useI18n()
|
|
189
200
|
const { searchKey, filter } = useSearch()
|
|
190
201
|
const { showSuccess } = useSnackbarFunctions()
|
|
191
202
|
const restaurantStore = useRestaurantStore()
|
|
192
|
-
const { currentRestaurant, currentBusiness, readRestaurants, changeRestaurant } =
|
|
203
|
+
const { currentRestaurant, currentBusiness, readRestaurants, changeRestaurant, sessionUser } =
|
|
204
|
+
useCoreStore()
|
|
193
205
|
const menuStore = useMenuStore()
|
|
194
206
|
const linkedCompanies = ref<LinkedDeliveryDoc[]>([])
|
|
195
207
|
const deliveryCompanies = ref<DeliveryCompany[]>([])
|
|
@@ -237,23 +249,23 @@ async function toggleIntegratedSidesheet(data: any) {
|
|
|
237
249
|
sideSheetIntegrated.value = true
|
|
238
250
|
switch (selectedIntegratedRow.value) {
|
|
239
251
|
case AUTO_INTEGRATION_CLIENT.foodpanda:
|
|
240
|
-
title.value = '
|
|
252
|
+
title.value = `${t('order.manageDelivery', { company: 'foodpanda' })}`
|
|
241
253
|
updateIntegratedDeliveryType(rowData)
|
|
242
254
|
break
|
|
243
255
|
case AUTO_INTEGRATION_CLIENT.grabfood:
|
|
244
|
-
title.value = '
|
|
256
|
+
title.value = `${t('order.manageDelivery', { company: 'grabfood' })}`
|
|
245
257
|
updateIntegratedDeliveryType(rowData)
|
|
246
258
|
break
|
|
247
259
|
case AUTO_INTEGRATION_CLIENT.shopeefood:
|
|
248
|
-
title.value = '
|
|
260
|
+
title.value = `${t('order.manageDelivery', { company: 'shopeefood' })}`
|
|
249
261
|
updateIntegratedDeliveryType(rowData)
|
|
250
262
|
break
|
|
251
263
|
case F_ORDER_PLATFORM.enum.FEEDME:
|
|
252
|
-
title.value = '
|
|
264
|
+
title.value = `${t('order.feedmeExpressTitle')}`
|
|
253
265
|
updateFeedmeExpress(rowData)
|
|
254
266
|
break
|
|
255
267
|
case F_ORDER_PLATFORM.enum.IN_HOUSE:
|
|
256
|
-
title.value = '
|
|
268
|
+
title.value = `${t('order.inhouseDeliveryTitle')}`
|
|
257
269
|
updateInHouse(rowData)
|
|
258
270
|
break
|
|
259
271
|
}
|
|
@@ -276,8 +288,7 @@ const feedMeComponentProps = ref({
|
|
|
276
288
|
|
|
277
289
|
const inHouseComponentProps = ref({
|
|
278
290
|
key: '' as string,
|
|
279
|
-
initialValue: {} as InhouseDialogData
|
|
280
|
-
allowEPayment: false as boolean | string
|
|
291
|
+
initialValue: {} as InhouseDialogData
|
|
281
292
|
})
|
|
282
293
|
|
|
283
294
|
function clearComponentProps() {
|
|
@@ -288,8 +299,7 @@ function clearComponentProps() {
|
|
|
288
299
|
|
|
289
300
|
inHouseComponentProps.value = {
|
|
290
301
|
key: '',
|
|
291
|
-
initialValue: {} as any
|
|
292
|
-
allowEPayment: false
|
|
302
|
+
initialValue: {} as any
|
|
293
303
|
}
|
|
294
304
|
|
|
295
305
|
componentProps.value = {
|
|
@@ -334,31 +344,10 @@ async function updateFeedmeExpress({ key, setting }: IntegratedDeliveryRow) {
|
|
|
334
344
|
}
|
|
335
345
|
}
|
|
336
346
|
|
|
337
|
-
function getRestaurantEPayment({ posVersion, payoutAccount }: FdoRestaurant): true | string {
|
|
338
|
-
const validPosVersion =
|
|
339
|
-
!!posVersion &&
|
|
340
|
-
Pos.canUse({
|
|
341
|
-
feature: F_FEATURE.enum.qrEPayment,
|
|
342
|
-
posVersion
|
|
343
|
-
})
|
|
344
|
-
|
|
345
|
-
if (!validPosVersion) return `For POS ${Pos.minVersionToUse(F_FEATURE.enum.qrEPayment)} or above`
|
|
346
|
-
if (!payoutAccount || !payoutAccount.enable) {
|
|
347
|
-
return 'Payout account is required';
|
|
348
|
-
}
|
|
349
|
-
if (payoutAccount.status !== F_PAYOUT_ACCOUNT_STATUS.enum.APPROVED) {
|
|
350
|
-
return 'Payout account under review';
|
|
351
|
-
}
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
347
|
async function updateInHouse({ key, setting }: IntegratedDeliveryRow) {
|
|
356
348
|
clearComponentProps()
|
|
357
349
|
|
|
358
350
|
const inhouseSetting = setting as FdoRestaurantInHouseDelivery
|
|
359
|
-
const allowEPayment = currentRestaurant.value
|
|
360
|
-
? getRestaurantEPayment(currentRestaurant.value)
|
|
361
|
-
: false
|
|
362
351
|
|
|
363
352
|
inHouseComponentProps.value = {
|
|
364
353
|
key,
|
|
@@ -369,8 +358,7 @@ async function updateInHouse({ key, setting }: IntegratedDeliveryRow) {
|
|
|
369
358
|
offlinePaymentTypes: inhouseSetting.offlinePaymentTypes || [],
|
|
370
359
|
ignoreStock: inhouseSetting.ignoreStock || false,
|
|
371
360
|
taxes: inhouseSetting.taxes || {}
|
|
372
|
-
}
|
|
373
|
-
allowEPayment
|
|
361
|
+
}
|
|
374
362
|
}
|
|
375
363
|
}
|
|
376
364
|
|
|
@@ -378,22 +366,22 @@ const { startAsyncCallWithErr, isLoading } = useLoading()
|
|
|
378
366
|
const columns: ColumnDef<any>[] = [
|
|
379
367
|
{
|
|
380
368
|
accessorKey: 'name',
|
|
381
|
-
header: () => '
|
|
369
|
+
header: () => `${t('order.company')}`,
|
|
382
370
|
enableSorting: false
|
|
383
371
|
},
|
|
384
372
|
{
|
|
385
373
|
accessorKey: 'catalog',
|
|
386
|
-
header: () => '
|
|
374
|
+
header: () => `${t('order.catalog')}`,
|
|
387
375
|
enableSorting: false
|
|
388
376
|
},
|
|
389
377
|
{
|
|
390
378
|
accessorKey: 'paymentType',
|
|
391
|
-
header: () => '
|
|
379
|
+
header: () => `${t('order.paymentType')}`,
|
|
392
380
|
enableSorting: false
|
|
393
381
|
},
|
|
394
382
|
{
|
|
395
383
|
accessorKey: 'status',
|
|
396
|
-
header: () => '
|
|
384
|
+
header: () => `${t('order.status')}`,
|
|
397
385
|
meta: {
|
|
398
386
|
maxWidth: '50px'
|
|
399
387
|
},
|
|
@@ -408,14 +396,14 @@ const columns: ColumnDef<any>[] = [
|
|
|
408
396
|
}
|
|
409
397
|
]
|
|
410
398
|
|
|
411
|
-
export type StatusType =
|
|
399
|
+
export type StatusType = string
|
|
412
400
|
const getClassForStatus = (enabled: StatusType): string => {
|
|
413
401
|
switch (enabled) {
|
|
414
|
-
case '
|
|
402
|
+
case `${t('order.manual')}`:
|
|
415
403
|
return ' bg-fm-color-system-warning-100 fm-typo-en-body-md-600 border fm-corner-radius-lg w-max gap-8 p-4 text-fm-color-typo-warning'
|
|
416
|
-
case '
|
|
404
|
+
case `${t('order.active')}`:
|
|
417
405
|
return ' bg-fm-color-system-success-100 fm-typo-en-body-md-600 border fm-corner-radius-lg w-max gap-8 p-4 text-fm-color-typo-success'
|
|
418
|
-
case '
|
|
406
|
+
case `${t('order.inactive')}`:
|
|
419
407
|
return ' bg-fm-color-system-info-100 fm-typo-en-body-md-600 border fm-corner-radius-lg w-max gap-8 p-4 text-fm-color-typo-info'
|
|
420
408
|
default:
|
|
421
409
|
return ''
|
|
@@ -474,7 +462,7 @@ const localDeliveryCompanies = computed<DeliveryRow[]>(() => {
|
|
|
474
462
|
key,
|
|
475
463
|
name,
|
|
476
464
|
paymentType: getPaymentType(payment),
|
|
477
|
-
status: !!doc ? ['
|
|
465
|
+
status: !!doc ? [`${t('order.active')}`] : [`${t('order.inactive')}`],
|
|
478
466
|
doc: company,
|
|
479
467
|
catalog: getCatalog(doc?.catalogId || null)
|
|
480
468
|
}
|
|
@@ -489,7 +477,25 @@ function getCatalog(catalogId: string | null) {
|
|
|
489
477
|
return menuStore.catalogOptions.find(({ value }) => value === catalogId)?.label || ''
|
|
490
478
|
}
|
|
491
479
|
|
|
492
|
-
const
|
|
480
|
+
const reachMinPosVersion = computed<string | boolean>(() => {
|
|
481
|
+
const posVersion = currentRestaurant.value?.posVersion
|
|
482
|
+
if (!posVersion) return t('order.invalidPosVersion')
|
|
483
|
+
const res = Pos.canUse({ feature: F_FEATURE.enum.deliveryIntegration, posVersion })
|
|
484
|
+
return res === true ? true : res.toString()
|
|
485
|
+
})
|
|
486
|
+
|
|
487
|
+
function hasPurchaseFeature(deliveryType: string) {
|
|
488
|
+
const features = currentRestaurant.value?.features || []
|
|
489
|
+
const featureKey = equalKey(deliveryType, AUTO_INTEGRATION_CLIENT.foodpanda)
|
|
490
|
+
? F_RESTAURANT_FEATURE.enum.foodpanda
|
|
491
|
+
: F_RESTAURANT_FEATURE.enum.deliveryIntegration
|
|
492
|
+
return features.includes(featureKey) || t('order.restaurantHaveNotPurchase', { featureKey })
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function canUseAutoDeliveryIntegration(deliveryType: string) {
|
|
496
|
+
if (reachMinPosVersion.value !== true) return reachMinPosVersion.value
|
|
497
|
+
return hasPurchaseFeature(deliveryType)
|
|
498
|
+
}
|
|
493
499
|
|
|
494
500
|
const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
|
|
495
501
|
const fpManual = getLinkedDeliveryDoc(linkedCompanies.value, AUTO_INTEGRATION_CLIENT.foodpanda)
|
|
@@ -606,9 +612,17 @@ async function updateIntegratedDeliveryCompany(company: IntegratedDeliveryRow) {
|
|
|
606
612
|
}
|
|
607
613
|
|
|
608
614
|
const filteredCompanies = computed(() => {
|
|
609
|
-
return integratedCompanies.value
|
|
610
|
-
filter([name, paymentType, status.join(' ')])
|
|
611
|
-
|
|
615
|
+
return integratedCompanies.value
|
|
616
|
+
.filter(({ name, paymentType, status }) => filter([name, paymentType, status.join(' ')]))
|
|
617
|
+
.map((company) => {
|
|
618
|
+
const status = convertStatustoI18(company.status[0] as status)
|
|
619
|
+
const name = convertIntegratedCompanyName(company.name as companyName)
|
|
620
|
+
return {
|
|
621
|
+
...company,
|
|
622
|
+
status,
|
|
623
|
+
name
|
|
624
|
+
}
|
|
625
|
+
})
|
|
612
626
|
})
|
|
613
627
|
|
|
614
628
|
const grabfoodSetting = ref<FdoGrabfoodSettings | null>(null)
|
|
@@ -821,6 +835,45 @@ function handleValidationResult(v: boolean) {
|
|
|
821
835
|
feedmeValidate.value = v
|
|
822
836
|
}
|
|
823
837
|
|
|
838
|
+
type status = 'Manual' | 'Active' | 'Inactive'
|
|
839
|
+
|
|
840
|
+
function convertStatustoI18(status: status): [string] {
|
|
841
|
+
switch (status) {
|
|
842
|
+
case 'Manual':
|
|
843
|
+
return [`${t('order.manual')}`]
|
|
844
|
+
case 'Active':
|
|
845
|
+
return [`${t('order.active')}`]
|
|
846
|
+
case 'Inactive':
|
|
847
|
+
return [`${t('order.inactive')}`]
|
|
848
|
+
default:
|
|
849
|
+
throw new Error('convertStatustoI18 - Invalid status ')
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
type companyName =
|
|
854
|
+
| 'In house delivery'
|
|
855
|
+
| 'FeedMe express'
|
|
856
|
+
| 'FoodPanda delivery'
|
|
857
|
+
| 'GrabFood delivery'
|
|
858
|
+
| 'ShopeeFood delivery'
|
|
859
|
+
|
|
860
|
+
function convertIntegratedCompanyName(name: companyName): string {
|
|
861
|
+
switch (name) {
|
|
862
|
+
case 'In house delivery':
|
|
863
|
+
return `${t('order.deliveryTitle', { company: 'In House' })}`
|
|
864
|
+
case 'FeedMe express':
|
|
865
|
+
return `${t('order.feedMeExpress')}`
|
|
866
|
+
case 'FoodPanda delivery':
|
|
867
|
+
return `${t('order.deliveryTitle', { company: 'FoodPanda' })}`
|
|
868
|
+
case 'GrabFood delivery':
|
|
869
|
+
return `${t('order.deliveryTitle', { company: 'GrabFood' })}`
|
|
870
|
+
case 'ShopeeFood delivery':
|
|
871
|
+
return `${t('order.deliveryTitle', { company: 'ShopeeFood' })}`
|
|
872
|
+
default:
|
|
873
|
+
return ''
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
824
877
|
watch(
|
|
825
878
|
() => currentRestaurant.value,
|
|
826
879
|
|
|
@@ -833,9 +886,9 @@ watch(
|
|
|
833
886
|
)
|
|
834
887
|
|
|
835
888
|
watch(
|
|
836
|
-
() => currentBusiness.value,
|
|
889
|
+
[() => currentBusiness.value, () => sessionUser.value],
|
|
837
890
|
async (newBusiness) => {
|
|
838
|
-
if (newBusiness) {
|
|
891
|
+
if (newBusiness && sessionUser.value?.token) {
|
|
839
892
|
await menuStore.readMenu()
|
|
840
893
|
}
|
|
841
894
|
},
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { type PropType, computed, ref, watch } from 'vue'
|
|
3
3
|
import type { DeliveryCompany } from '../delivery'
|
|
4
4
|
import { F_PAYMENT_NAME, type FdoLinkedDelivery } from '@feedmepos/core/entity'
|
|
5
|
+
import { useI18n } from '@feedmepos/mf-common'
|
|
6
|
+
|
|
7
|
+
const { t } = useI18n()
|
|
5
8
|
|
|
6
9
|
interface LocalDeliverySettingData extends FdoLinkedDelivery {
|
|
7
10
|
active: boolean
|
|
@@ -67,11 +70,11 @@ watch(
|
|
|
67
70
|
const paymentTypeOptions = computed(() => {
|
|
68
71
|
return [
|
|
69
72
|
{
|
|
70
|
-
label: '
|
|
73
|
+
label: t('order.default'),
|
|
71
74
|
value: props.company.paymentTypeKey
|
|
72
75
|
},
|
|
73
76
|
{
|
|
74
|
-
label: '
|
|
77
|
+
label: t('order.cash'),
|
|
75
78
|
value: F_PAYMENT_NAME.enum.CASH
|
|
76
79
|
}
|
|
77
80
|
]
|
|
@@ -117,9 +120,9 @@ function updateCatalog(catalogId: string | null) {
|
|
|
117
120
|
<FmSwitch
|
|
118
121
|
:model-value="data.active"
|
|
119
122
|
value="first"
|
|
120
|
-
label="
|
|
123
|
+
:label="t('order.activateIntegration', {integrationType: t('order.manual')})"
|
|
121
124
|
label-placement="right"
|
|
122
|
-
:sublabel="
|
|
125
|
+
:sublabel="t('order.integrationDescription', {name: data.name})"
|
|
123
126
|
@update:model-value="updateActive"
|
|
124
127
|
/>
|
|
125
128
|
</div>
|
|
@@ -128,13 +131,13 @@ function updateCatalog(catalogId: string | null) {
|
|
|
128
131
|
<div class="mb-3">
|
|
129
132
|
<FmSelect
|
|
130
133
|
:model-value="data.catalogId"
|
|
131
|
-
label="
|
|
134
|
+
:label="t('order.catalog')"
|
|
132
135
|
:items="catalogOptions"
|
|
133
136
|
@update:model-value="updateCatalog"
|
|
134
137
|
/>
|
|
135
138
|
</div>
|
|
136
139
|
|
|
137
|
-
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">
|
|
140
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">{{ t('order.paymentType') }}</div>
|
|
138
141
|
<div class="mb-3">
|
|
139
142
|
<FmRadioGroup :model-value="data.paymentTypeKey" @update:model-value="updatePaymentType">
|
|
140
143
|
<div v-for="option in paymentTypeOptions" :key="option.value">
|
|
@@ -143,11 +146,11 @@ function updateCatalog(catalogId: string | null) {
|
|
|
143
146
|
</FmRadioGroup>
|
|
144
147
|
</div>
|
|
145
148
|
|
|
146
|
-
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">
|
|
149
|
+
<div class="flex-grow fm-typo-en-title-sm-600 mb-3 mt-7">{{ t('order.orderSetting') }}</div>
|
|
147
150
|
<FmCheckbox
|
|
148
151
|
:model-value="data.rounding as boolean"
|
|
149
152
|
value=""
|
|
150
|
-
label="
|
|
153
|
+
:label="t('order.billRounding')"
|
|
151
154
|
@update:model-value="updateRounding"
|
|
152
155
|
/>
|
|
153
156
|
</FmCard>
|