@feedmepos/mf-order-setting 0.0.7 → 0.0.12
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/.env +2 -0
- package/dist/KioskSettingView-YfMgLMyn.js +4 -0
- package/dist/app-DnR4r5jW.js +195091 -0
- package/dist/app.js +1 -1
- package/dist/common/util/index.d.ts +5 -1
- package/dist/frontend/mf-order/src/api/index.d.ts +1 -0
- package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +3 -8
- package/dist/frontend/mf-order/src/helpers/menu.d.ts +7 -0
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +9 -14
- package/dist/frontend/mf-order/src/views/all-orders/FilterRestaurant.vue.d.ts +4 -4
- package/dist/frontend/mf-order/src/views/all-orders/ReflowOrder.vue.d.ts +2 -2
- package/dist/frontend/mf-order/src/views/order-settings/delivery/components/TaxInput.vue.d.ts +67 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue.d.ts +4 -1
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/package/entity/auth/auth.dto.d.ts +9 -0
- package/dist/package/entity/booking/booking.do.d.ts +40 -40
- package/dist/package/entity/delivery/delivery.dto.d.ts +8 -8
- package/dist/package/entity/food-court/order.dto.d.ts +6025 -6065
- package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +9 -6
- package/dist/package/entity/incoming-order/incoming-order.do.d.ts +8 -8
- package/dist/package/entity/incoming-order/incoming-order.dto.d.ts +26 -16
- package/dist/package/entity/index.d.ts +6 -0
- package/dist/package/entity/kiosk/marketing/marketing.dto.d.ts +34 -34
- package/dist/package/entity/order/manager/manager.dto.d.ts +349 -0
- package/dist/package/entity/order/manager/manager.enum.d.ts +7 -0
- package/dist/package/entity/order/order.dto.d.ts +4649 -4706
- package/dist/package/entity/order/order.enum.d.ts +3 -1
- package/dist/package/entity/order/payment/payment.dto.d.ts +2525 -2529
- package/dist/package/entity/order-platform/foodpanda/foodpanda-order.dto.d.ts +8 -8
- package/dist/package/entity/order-platform/grabfood/grabfood-order.do.d.ts +8 -8
- package/dist/package/entity/order-platform/grabfood/grabfood-settings.do.d.ts +0 -3
- package/dist/package/entity/order-platform/menu.dto.d.ts +40 -40
- package/dist/package/entity/order-platform/shopeefood/shopeefood-order.do.d.ts +8 -8
- package/dist/package/entity/payment/payment.dto.d.ts +13 -13
- package/dist/package/entity/pubsub/ably/ably.do.d.ts +76 -0
- package/dist/package/entity/pubsub/ably/ably.enum.d.ts +3 -0
- package/dist/package/entity/pubsub/pubsub.enum.d.ts +3 -0
- package/dist/package/entity/queue/queue.do.d.ts +30 -30
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +43 -122
- package/dist/package/entity/websocket/websocket.dto.d.ts +31 -31
- package/dist/package/entity/websocket/websocket.enum.d.ts +1 -1
- package/package.json +3 -3
- package/src/api/index.ts +46 -33
- package/src/api/restaurant-setting/index.ts +7 -18
- package/src/helpers/menu.ts +15 -0
- package/src/stores/order-setting/index.ts +1 -1
- package/src/stores/order-setting/mapper.ts +2 -1
- package/src/stores/restaurant/index.ts +5 -19
- package/src/views/kiosk/settings/KioskDineInSection.vue +2 -3
- package/src/views/order-settings/delivery/DeliverySetting.vue +146 -42
- package/src/views/order-settings/delivery/components/TaxInput.vue +57 -0
- package/src/views/order-settings/delivery/inhouse/InHouseDelivery.vue +199 -20
- package/src/views/order-settings/delivery/integrated-delivery/FeedmeDelivery.vue +0 -2
- package/src/views/order-settings/delivery/integrated-delivery/GrabfoodSetting.vue +1 -5
- package/src/views/order-settings/delivery/integrated-delivery/ShopeefoodSetting.vue +0 -1
- package/src/views/order-settings/dinein/DineInSetting.vue +1 -1
- package/src/views/order-settings/pickup/PaymentSidesheet.vue +4 -3
- package/src/views/order-settings/pickup/PickUpSettingDialog.vue +1 -1
- package/dist/KioskSettingView-DqpBqjGG.js +0 -4
- package/dist/app-Bd8YKqAx.js +0 -196933
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedmepos/mf-order-setting",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./dist/app.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"format": "prettier --write src/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@feedmepos/core": "^2.12.
|
|
28
|
+
"@feedmepos/core": "^2.12.14",
|
|
29
29
|
"@feedmepos/menu": "^1.2.4",
|
|
30
30
|
"@feedmepos/mf-common": "^1.7.2-rc.2",
|
|
31
31
|
"@feedmepos/ordering": "^0.0.3",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"vue-router": "^4.2.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"dotenv-cli": "^7.4.2",
|
|
49
48
|
"@babel/types": "^7.24.7",
|
|
50
49
|
"@rushstack/eslint-patch": "^1.3.3",
|
|
51
50
|
"@tsconfig/node18": "^18.2.2",
|
|
@@ -57,6 +56,7 @@
|
|
|
57
56
|
"@vue/tsconfig": "^0.4.0",
|
|
58
57
|
"autoprefixer": "^10.4.16",
|
|
59
58
|
"cross-env": "^7.0.3",
|
|
59
|
+
"dotenv-cli": "^7.4.2",
|
|
60
60
|
"eslint": "^8.49.0",
|
|
61
61
|
"eslint-plugin-vue": "^9.17.0",
|
|
62
62
|
"npm-run-all2": "^6.0.6",
|
package/src/api/index.ts
CHANGED
|
@@ -3,15 +3,15 @@ import { F_COUNTRY } from '@feedmepos/core/entity'
|
|
|
3
3
|
import { useCoreStore } from '@feedmepos/mf-common'
|
|
4
4
|
|
|
5
5
|
export const defaultCountry = F_COUNTRY.enum.MY
|
|
6
|
-
type ApiVariant = 'portal' | 'auth' | 'localhost'
|
|
6
|
+
type ApiVariant = 'portal' | 'auth' | 'localhost'
|
|
7
7
|
|
|
8
8
|
interface ApiUrl {
|
|
9
9
|
portalBackendUrl: string
|
|
10
10
|
websocketBackendUrl: string
|
|
11
11
|
linkedDeliveryBackend: string
|
|
12
|
-
menuBackendUrl: string
|
|
13
|
-
smsBackendUrl: string
|
|
14
|
-
accountBackendUrl: string
|
|
12
|
+
menuBackendUrl: string
|
|
13
|
+
smsBackendUrl: string
|
|
14
|
+
accountBackendUrl: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
let apiUrl: ApiUrl | null = null
|
|
@@ -22,7 +22,7 @@ export const SvcConfig = {
|
|
|
22
22
|
return idToken ?? null
|
|
23
23
|
},
|
|
24
24
|
getBusinessId(): string | null {
|
|
25
|
-
return useCoreStore().currentBusiness.value?._id ?? null
|
|
25
|
+
return useCoreStore().currentBusiness.value?._id ?? null
|
|
26
26
|
},
|
|
27
27
|
getRestaurantId(): string | null {
|
|
28
28
|
return useCoreStore().currentRestaurant.value?._id ?? null
|
|
@@ -52,11 +52,11 @@ export const SvcConfig = {
|
|
|
52
52
|
|
|
53
53
|
function generateBackendUrl(country: F_COUNTRY): ApiUrl {
|
|
54
54
|
const { namespace } = useCoreStore()
|
|
55
|
-
const isDev = namespace.value ===
|
|
56
|
-
const area = country !== F_COUNTRY.enum.MY ? `.${country.toLowerCase()}` : ''
|
|
57
|
-
const domain = `${isDev ? '-dev' : ''}${area}.feedmeapi.com
|
|
58
|
-
const portalBackendUrl = `https://portal-v2${domain}
|
|
59
|
-
const accountBackendUrl = `https://account${domain}
|
|
55
|
+
const isDev = namespace.value === 'dev'
|
|
56
|
+
const area = country !== F_COUNTRY.enum.MY ? `.${country.toLowerCase()}` : ''
|
|
57
|
+
const domain = `${isDev ? '-dev' : ''}${area}.feedmeapi.com`
|
|
58
|
+
const portalBackendUrl = `https://portal-v2${domain}`
|
|
59
|
+
const accountBackendUrl = `https://account${domain}`
|
|
60
60
|
return {
|
|
61
61
|
portalBackendUrl,
|
|
62
62
|
websocketBackendUrl: `wss://94ilf9iqc0.execute-api.ap-southeast-1.amazonaws.com/${isDev ? 'dev' : 'prod'}`,
|
|
@@ -65,7 +65,7 @@ function generateBackendUrl(country: F_COUNTRY): ApiUrl {
|
|
|
65
65
|
smsBackendUrl: `https://sms${domain}`,
|
|
66
66
|
accountBackendUrl
|
|
67
67
|
}
|
|
68
|
-
}
|
|
68
|
+
}
|
|
69
69
|
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
71
71
|
interface SvcMasterCompanyResponse<T = {}> {
|
|
@@ -99,22 +99,22 @@ export class SvcCompanyApiError extends ApiError {
|
|
|
99
99
|
function getBaseUrl(variant: ApiVariant, port?: string): string {
|
|
100
100
|
switch (variant) {
|
|
101
101
|
case 'portal':
|
|
102
|
-
return SvcConfig.getBackendUrl().portalBackendUrl
|
|
102
|
+
return SvcConfig.getBackendUrl().portalBackendUrl
|
|
103
103
|
case 'auth':
|
|
104
|
-
return SvcConfig.getBackendUrl().accountBackendUrl
|
|
104
|
+
return SvcConfig.getBackendUrl().accountBackendUrl
|
|
105
105
|
case 'localhost':
|
|
106
|
-
return `http://localhost${port ? `:${port}` : ''}
|
|
106
|
+
return `http://localhost${port ? `:${port}` : ''}`
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export const baseClientInstance = (
|
|
111
111
|
path = '',
|
|
112
112
|
variant: ApiVariant = 'portal',
|
|
113
|
-
config?: { noIdRequired?: boolean
|
|
114
|
-
port?: string
|
|
113
|
+
config?: { noIdRequired?: boolean; url?: string; customIdToken?: string },
|
|
114
|
+
port?: string
|
|
115
115
|
): AxiosInstance => {
|
|
116
116
|
const url = config?.url ?? getBaseUrl(variant, port)
|
|
117
|
-
const idToken = SvcConfig.getIdToken()
|
|
117
|
+
const idToken = SvcConfig.getIdToken()
|
|
118
118
|
if (idToken || config?.noIdRequired || config?.customIdToken) {
|
|
119
119
|
const client = axios.create({
|
|
120
120
|
baseURL: `${url}${path}`,
|
|
@@ -139,32 +139,45 @@ export const baseClientInstance = (
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export const authInstance = (config?: {
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
export const authInstance = (config?: {
|
|
143
|
+
noIdRequired?: boolean
|
|
144
|
+
url?: string
|
|
145
|
+
customIdToken?: string
|
|
146
|
+
}): AxiosInstance => {
|
|
147
|
+
return baseClientInstance('/', 'auth', config)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const businessClientInstance = (businessId?: string): AxiosInstance => {
|
|
151
|
+
const path = `/businesses/${businessId}`
|
|
152
|
+
if (businessId) {
|
|
153
|
+
return baseClientInstance(path)
|
|
154
|
+
} else {
|
|
155
|
+
throw new Error('Invalid business')
|
|
156
|
+
}
|
|
157
|
+
}
|
|
145
158
|
|
|
146
159
|
export const restaurantClientInstance = (prefix?: string): AxiosInstance => {
|
|
147
|
-
const restaurantId = SvcConfig.getRestaurantId()
|
|
148
|
-
const restaurantPath = `${prefix ?? ''}/restaurants/${restaurantId}
|
|
160
|
+
const restaurantId = SvcConfig.getRestaurantId()
|
|
161
|
+
const restaurantPath = `${prefix ?? ''}/restaurants/${restaurantId}`
|
|
149
162
|
if (restaurantId) {
|
|
150
|
-
return baseClientInstance(restaurantPath)
|
|
163
|
+
return baseClientInstance(restaurantPath)
|
|
151
164
|
} else {
|
|
152
|
-
throw new Error('Invalid restaurant')
|
|
165
|
+
throw new Error('Invalid restaurant')
|
|
153
166
|
}
|
|
154
167
|
}
|
|
155
168
|
|
|
156
169
|
export const menuClientInstance = (): AxiosInstance => {
|
|
157
|
-
const businessId = SvcConfig.getBusinessId()
|
|
158
|
-
if (!businessId) throw new Error('Invalid business ID')
|
|
159
|
-
const { menuBackendUrl } = SvcConfig.getBackendUrl()
|
|
160
|
-
const url = `${menuBackendUrl}/businesses/${businessId}/menu-v4
|
|
161
|
-
return baseClientInstance('', 'portal', { url })
|
|
162
|
-
}
|
|
170
|
+
const businessId = SvcConfig.getBusinessId()
|
|
171
|
+
if (!businessId) throw new Error('Invalid business ID')
|
|
172
|
+
const { menuBackendUrl } = SvcConfig.getBackendUrl()
|
|
173
|
+
const url = `${menuBackendUrl}/businesses/${businessId}/menu-v4`
|
|
174
|
+
return baseClientInstance('', 'portal', { url })
|
|
175
|
+
}
|
|
163
176
|
|
|
164
177
|
export const smsBackendClientInstance = (): AxiosInstance => {
|
|
165
|
-
const { smsBackendUrl } = SvcConfig.getBackendUrl()
|
|
166
|
-
return baseClientInstance('', 'portal', { url: smsBackendUrl })
|
|
167
|
-
}
|
|
178
|
+
const { smsBackendUrl } = SvcConfig.getBackendUrl()
|
|
179
|
+
return baseClientInstance('', 'portal', { url: smsBackendUrl })
|
|
180
|
+
}
|
|
168
181
|
|
|
169
182
|
export function getData<T>(response: AxiosResponse<T>): T {
|
|
170
183
|
return response.data
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
getData,
|
|
3
|
+
restaurantClientInstance
|
|
4
|
+
} from '@/api'
|
|
3
5
|
import type { OrderSettingsDto } from '@entity'
|
|
4
6
|
import {
|
|
5
7
|
FdoRestaurantDineIn,
|
|
@@ -8,7 +10,6 @@ import {
|
|
|
8
10
|
FdoServiceChargeSetting
|
|
9
11
|
} from '@feedmepos/core/entity'
|
|
10
12
|
|
|
11
|
-
|
|
12
13
|
interface EntityDocument {
|
|
13
14
|
_rev: string
|
|
14
15
|
_id: string
|
|
@@ -17,22 +18,16 @@ interface EntityDocument {
|
|
|
17
18
|
export type RestaurantSettingDoc = EntityDocument & FdoRestaurantSetting
|
|
18
19
|
|
|
19
20
|
export const restaurantApi = {
|
|
20
|
-
async readRestaurantSetting(
|
|
21
|
+
async readRestaurantSetting(): Promise<RestaurantSettingDoc> {
|
|
21
22
|
const result = await restaurantClientInstance().get('/restaurant-setting')
|
|
22
23
|
return getData<RestaurantSettingDoc>(result)
|
|
23
24
|
},
|
|
24
|
-
|
|
25
|
-
async readRestaurant(restaurantId: string): Promise<ExtendedRestaurant> {
|
|
26
|
-
const result = await restaurantClientInstance().get('/restaurant-setting')
|
|
27
|
-
return getData(result)
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
async updateDineInSetting(restaurantId: string, setting: FdoRestaurantDineIn) {
|
|
25
|
+
async updateDineInSetting(setting: FdoRestaurantDineIn) {
|
|
31
26
|
const result = await restaurantClientInstance().put('/dine-in', setting)
|
|
32
27
|
return getData(result)
|
|
33
28
|
},
|
|
34
29
|
|
|
35
|
-
async updatePickupSetting(
|
|
30
|
+
async updatePickupSetting(setting: FdoRestaurantPickup) {
|
|
36
31
|
const result = await restaurantClientInstance().put('/pickup', setting)
|
|
37
32
|
return getData(result)
|
|
38
33
|
},
|
|
@@ -44,11 +39,5 @@ export const restaurantApi = {
|
|
|
44
39
|
|
|
45
40
|
async getMobileOrderSetting(): Promise<OrderSettingsDto> {
|
|
46
41
|
return await getData(await restaurantClientInstance().get('/order-settings'))
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
admin: {
|
|
50
|
-
async readAllManagable(): Promise<ExtendedRestaurant[]> {
|
|
51
|
-
return getData(await baseClientInstance().get('/my/restaurants'));
|
|
52
|
-
},
|
|
53
42
|
}
|
|
54
43
|
}
|
package/src/helpers/menu.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { fullVariantCombination } from '@feedmepos/menu';
|
|
2
2
|
import { FdoItemOverriderV4, FdoMenuV4Item, FdoItemVariant, FdoMenuV4VariantGroup, FdoProductTaxSetting, FdtoV4Tax } from '@feedmepos/menu/entity';
|
|
3
|
+
import { Country, Dinero } from '@feedmepos/core';
|
|
4
|
+
import { useAppStore } from '@/stores/app'
|
|
3
5
|
|
|
4
6
|
import { useMenuStore } from '@/stores/menu/menu';
|
|
5
7
|
import type { CheckboxOption, } from '@/components/type';
|
|
@@ -69,6 +71,19 @@ export class ItemTax {
|
|
|
69
71
|
return { systemCode, taxCode };
|
|
70
72
|
}
|
|
71
73
|
|
|
74
|
+
static taxSetting() {
|
|
75
|
+
const countryFlattenTaxes = Country.getCountryFlattenTaxes(useAppStore().country.code);
|
|
76
|
+
return {
|
|
77
|
+
systemCode: [...new Set(countryFlattenTaxes.map((tax) => tax.systemCode))].join('/'),
|
|
78
|
+
countryTaxOptions: countryFlattenTaxes.map((tax) => ({
|
|
79
|
+
label: `${tax.name} (${ Dinero.fromFdoDecimal({
|
|
80
|
+
decimal: tax.rate
|
|
81
|
+
}).multiply(100).toFormat(false)}%)`,
|
|
82
|
+
value: ItemTax.encodeTax(tax),
|
|
83
|
+
})),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
72
87
|
static getSelectedTax(tax: Tax, fallbackTax: Tax, taxOptions: { label: string, value: string }[]): string | undefined {
|
|
73
88
|
return (tax ?? fallbackTax ?? [])
|
|
74
89
|
.map((t) => ItemTax.encodeTax(t))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { OrderSettingApi } from '@/api/order-setting';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MfKioskOrderSetting } from '@/modules/order-setting/kiosk/interface'
|
|
4
4
|
import { OrderSettingMapper } from './mapper';
|
|
5
5
|
import { ref } from 'vue';
|
|
6
6
|
import { OrderSettingsDto, OrderSettingUpdateDto } from '@entity';
|
|
@@ -56,7 +56,7 @@ const toKioskDineInSetting = (kioskDineInSeq: OrderKioskDineInSequenceDto, kiosk
|
|
|
56
56
|
sequenceNumber: kioskDineInSeq,
|
|
57
57
|
pickUp,
|
|
58
58
|
displayStand: displayStand ? {
|
|
59
|
-
enabled:
|
|
59
|
+
enabled: displayStand.enabled,
|
|
60
60
|
standSlotRange: displayStand.standSlotRange,
|
|
61
61
|
prefix: displayStand.prefix,
|
|
62
62
|
padDigit: displayStand.padDigit,
|
|
@@ -103,6 +103,7 @@ const toOrderKioskSettingsDto = (kioskSetting: MfKioskOrderSetting): {
|
|
|
103
103
|
return {
|
|
104
104
|
kioskSettings: {
|
|
105
105
|
canTakeaway: kioskSetting.takeaway.enabled,
|
|
106
|
+
dineIn: undefined,
|
|
106
107
|
}
|
|
107
108
|
};
|
|
108
109
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defineStore } from 'pinia'
|
|
2
2
|
import { restaurantApi, type RestaurantSettingDoc } from '@/api/restaurant-setting'
|
|
3
3
|
import {
|
|
4
|
-
F_PAYOUT_ACCOUNT_STATUS,
|
|
5
4
|
FdoFoodpandaSettings,
|
|
6
|
-
FdoPayoutAccount,
|
|
7
5
|
FdoRestaurantDineIn,
|
|
8
6
|
FdoRestaurantFeedmeDelivery,
|
|
9
7
|
FdoRestaurantInHouseDelivery,
|
|
@@ -66,22 +64,10 @@ export const useRestaurantStore = defineStore('restaurant', {
|
|
|
66
64
|
getters: {
|
|
67
65
|
currentRestaurant: (state) => state.businessRestaurants.find((r) => r.id === state.currentRestaurantId),
|
|
68
66
|
currentRestaurantSetting: (state) => state.restaurantSettings[state.currentRestaurantId || ''],
|
|
69
|
-
payoutAccount() {
|
|
70
|
-
const account: FdoPayoutAccount = this.currentRestaurant?.payoutAccount || {
|
|
71
|
-
enable: false,
|
|
72
|
-
methods: [],
|
|
73
|
-
status: F_PAYOUT_ACCOUNT_STATUS.enum.NEW
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
isActive: account.enable,
|
|
77
|
-
canUpdate: account.status === F_PAYOUT_ACCOUNT_STATUS.enum.NEW,
|
|
78
|
-
approved: account.status === F_PAYOUT_ACCOUNT_STATUS.enum.APPROVED
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
67
|
},
|
|
82
68
|
actions: {
|
|
83
69
|
async readRestaurantSetting(restaurantId: string) {
|
|
84
|
-
const restaurantSetting = await restaurantApi.readRestaurantSetting(
|
|
70
|
+
const restaurantSetting = await restaurantApi.readRestaurantSetting()
|
|
85
71
|
this.restaurantSettings = {
|
|
86
72
|
...this.restaurantSettings,
|
|
87
73
|
[restaurantId]: restaurantSetting
|
|
@@ -99,11 +85,11 @@ export const useRestaurantStore = defineStore('restaurant', {
|
|
|
99
85
|
async updateServiceCharge(serviceCharge: FdoServiceChargeSetting) {
|
|
100
86
|
await restaurantApi.updateServiceCharge(serviceCharge)
|
|
101
87
|
},
|
|
102
|
-
async updateDineInSetting(
|
|
103
|
-
await restaurantApi.updateDineInSetting(
|
|
88
|
+
async updateDineInSetting(setting: FdoRestaurantDineIn) {
|
|
89
|
+
await restaurantApi.updateDineInSetting(setting)
|
|
104
90
|
},
|
|
105
|
-
async updatePickupSetting(
|
|
106
|
-
await restaurantApi.updatePickupSetting(
|
|
91
|
+
async updatePickupSetting(setting: FdoRestaurantPickup) {
|
|
92
|
+
await restaurantApi.updatePickupSetting(setting)
|
|
107
93
|
},
|
|
108
94
|
|
|
109
95
|
async updateInhouseDelivery(restaurantId: string, dto: FdoRestaurantInHouseDelivery) {
|
|
@@ -1,8 +1,8 @@
|
|
|
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="
|
|
5
|
-
<div v-show="
|
|
4
|
+
<FmSwitch v-model="form.enabled" label="Dine In" label-placement="right" />
|
|
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" />
|
|
8
8
|
<KioskDisplayStandSection v-if="form.displayStand" :display-stand="form.displayStand"
|
|
@@ -43,7 +43,6 @@ function updateDisplayStand(v: DisplayStandSettingForm) {
|
|
|
43
43
|
const props = defineProps<Props>();
|
|
44
44
|
const emits = defineEmits<Emits>();
|
|
45
45
|
const form = ref<KioskDineInSettingForm>(ObjectUtil.clone<KioskDineInSettingForm>(props.getSetting()));
|
|
46
|
-
const enableDineIn = ref<boolean>(ObjectUtil.clone(form.value.enabled));
|
|
47
46
|
|
|
48
47
|
watch(() => props.restaurantId, () => {
|
|
49
48
|
form.value = props.getSetting();
|
|
@@ -1,68 +1,144 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex flex-col lg:flex-row md:flex-row sm:flex-row xs:flex-wrap justify-between">
|
|
3
|
-
<RestaurantSelector
|
|
3
|
+
<RestaurantSelector
|
|
4
|
+
:model-value="currentRestaurant?._id ?? undefined"
|
|
5
|
+
class="xs:order-2 xs:mb-3"
|
|
6
|
+
/>
|
|
4
7
|
<FmSearch v-model="searchKey" placeholder="Search" class="mx-5 xs:my-3 xs:order-1" />
|
|
5
8
|
</div>
|
|
6
9
|
<div class="block">
|
|
7
|
-
<FmPageHead
|
|
8
|
-
|
|
10
|
+
<FmPageHead
|
|
11
|
+
class="flex-grow"
|
|
12
|
+
title="Integrated delivery company"
|
|
13
|
+
description="We integrated with these deliveries with your POS system. You can deliver meal to your customers in faster and more secure way."
|
|
14
|
+
/>
|
|
9
15
|
<div v-if="!isLoading">
|
|
10
|
-
<DeliveryList
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
<DeliveryList
|
|
17
|
+
:filteredCompanies="filteredCompanies"
|
|
18
|
+
class="mt-5 md:hidden lg:hidden xl:hidden"
|
|
19
|
+
@toggleIntegratedSidesheet="toggleIntegratedSidesheet"
|
|
20
|
+
></DeliveryList>
|
|
21
|
+
<FmTable
|
|
22
|
+
v-model="model"
|
|
23
|
+
class="h-[500px] m-5 xs:hidden sm:hidden"
|
|
24
|
+
:row-data="filteredCompanies"
|
|
25
|
+
:column-defs="columns"
|
|
26
|
+
:hideFooter="true"
|
|
27
|
+
:loading="loading"
|
|
28
|
+
@row-click="(rowData: any) => toggleIntegratedSidesheet(rowData)"
|
|
29
|
+
/>
|
|
15
30
|
</div>
|
|
16
31
|
<div v-else>
|
|
17
32
|
<FmCircularProgress size="xxl" />
|
|
18
33
|
</div>
|
|
19
34
|
</div>
|
|
20
35
|
|
|
21
|
-
<FmSideSheet
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
:initial-value="componentProps.initialValue"
|
|
31
|
-
:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
:initial-value="
|
|
36
|
+
<FmSideSheet
|
|
37
|
+
:header="title"
|
|
38
|
+
dismiss-away
|
|
39
|
+
:maxWidth="600"
|
|
40
|
+
:model-value="sideSheetIntegrated"
|
|
41
|
+
@update:model-value="sideSheetIntegrated = $event"
|
|
42
|
+
>
|
|
43
|
+
<FoodpandaSetting
|
|
44
|
+
v-if="componentProps.key === AUTO_INTEGRATION_CLIENT.foodpanda"
|
|
45
|
+
:initial-value="componentProps.initialValue"
|
|
46
|
+
:company="componentProps.company"
|
|
47
|
+
:can-use-auto-delivery-integration="componentProps.canUseAuto"
|
|
48
|
+
@update:model-value="handleModelValueUpdate"
|
|
49
|
+
/>
|
|
50
|
+
<GrabfoodSetting
|
|
51
|
+
v-if="componentProps.key === AUTO_INTEGRATION_CLIENT.grabfood"
|
|
52
|
+
:initial-value="componentProps.initialValue"
|
|
53
|
+
:company="componentProps.company"
|
|
54
|
+
:can-use-auto-delivery-integration="componentProps.canUseAuto"
|
|
55
|
+
@update:model-value="handleModelValueUpdate"
|
|
56
|
+
/>
|
|
57
|
+
<ShopeefoodSetting
|
|
58
|
+
v-if="componentProps.key === AUTO_INTEGRATION_CLIENT.shopeefood"
|
|
59
|
+
:initial-value="componentProps.initialValue"
|
|
60
|
+
:company="componentProps.company"
|
|
61
|
+
:can-use-auto-delivery-integration="componentProps.canUseAuto"
|
|
62
|
+
@update:model-value="handleModelValueUpdate"
|
|
63
|
+
/>
|
|
64
|
+
<FeedmeDelivery
|
|
65
|
+
v-if="feedMeComponentProps.key === F_ORDER_PLATFORM.enum.FEEDME"
|
|
66
|
+
:initial-value="feedMeComponentProps.initialValue"
|
|
67
|
+
@update:model-value="handleModelValueUpdateFeedme"
|
|
68
|
+
@validation-result="handleValidationResult"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<InHouseDelivery
|
|
72
|
+
v-if="inHouseComponentProps.key === F_ORDER_PLATFORM.enum.IN_HOUSE"
|
|
73
|
+
:initial-value="inHouseComponentProps.initialValue"
|
|
74
|
+
:allow-e-payment="inHouseComponentProps.allowEPayment"
|
|
38
75
|
:address="formatAddress(currentRestaurant?.profile.address)"
|
|
39
|
-
@update:model-value="handleModelValueUpdateInHouse"
|
|
76
|
+
@update:model-value="handleModelValueUpdateInHouse"
|
|
77
|
+
/>
|
|
40
78
|
<template #side-sheet-footer v-if="feedmeValidate !== false">
|
|
41
79
|
<div class="flex gap-8 items-center justify-start">
|
|
42
|
-
<FmButton
|
|
43
|
-
|
|
80
|
+
<FmButton
|
|
81
|
+
variant="primary"
|
|
82
|
+
label="Save"
|
|
83
|
+
size="lg"
|
|
84
|
+
@click="updateIntegratedDeliveryCompany"
|
|
85
|
+
/>
|
|
86
|
+
<FmButton
|
|
87
|
+
variant="secondary"
|
|
88
|
+
label="Cancel"
|
|
89
|
+
size="lg"
|
|
90
|
+
@click="closeIntegratedDeliverySideSheet"
|
|
91
|
+
/>
|
|
44
92
|
</div>
|
|
45
93
|
</template>
|
|
46
94
|
</FmSideSheet>
|
|
47
95
|
|
|
48
96
|
<div class="block">
|
|
49
|
-
<FmPageHead
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
97
|
+
<FmPageHead
|
|
98
|
+
class="flex-grow"
|
|
99
|
+
title="Local delivery company"
|
|
100
|
+
description="Activate the delivery companies to create new order at POS system."
|
|
101
|
+
/>
|
|
102
|
+
<FmTable
|
|
103
|
+
v-model="model"
|
|
104
|
+
class="h-[500px] m-5 xs:hidden sm:hidden"
|
|
105
|
+
:row-data="localDeliveryCompanies"
|
|
106
|
+
:column-defs="columns"
|
|
107
|
+
:hideFooter="true"
|
|
108
|
+
:pageSize="100"
|
|
109
|
+
:loading="loading"
|
|
110
|
+
@row-click="toggleLocalSidesheet"
|
|
111
|
+
/>
|
|
112
|
+
<DeliveryList
|
|
113
|
+
:filteredCompanies="localDeliveryCompanies"
|
|
114
|
+
class="mt-5 md:hidden lg:hidden xl:hidden"
|
|
115
|
+
@toggleIntegratedSidesheet="toggleLocalSidesheet"
|
|
116
|
+
></DeliveryList>
|
|
55
117
|
</div>
|
|
56
118
|
|
|
57
119
|
<div class="flex">
|
|
58
|
-
<FmSideSheet
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
120
|
+
<FmSideSheet
|
|
121
|
+
header="Update delivery company"
|
|
122
|
+
dismiss-away
|
|
123
|
+
:maxWidth="600"
|
|
124
|
+
:model-value="sideSheet"
|
|
125
|
+
@update:model-value="sideSheet = $event"
|
|
126
|
+
>
|
|
127
|
+
<ManualIntegratedDeliverySetting
|
|
128
|
+
:model-value="localDoc"
|
|
129
|
+
:company="selectedLocalRow.doc"
|
|
130
|
+
:catalog-options="menuStore.catalogOptions"
|
|
131
|
+
@update:model-value="(v: any) => (localDocUpdate = v)"
|
|
132
|
+
/>
|
|
62
133
|
<template #side-sheet-footer>
|
|
63
134
|
<div class="flex gap-8 items-center justify-start">
|
|
64
135
|
<FmButton variant="primary" label="Save" size="lg" @click="updateLocalDeliveryCompany" />
|
|
65
|
-
<FmButton
|
|
136
|
+
<FmButton
|
|
137
|
+
variant="secondary"
|
|
138
|
+
label="Cancel"
|
|
139
|
+
size="lg"
|
|
140
|
+
@click="closeLocalDeliverySideSheet"
|
|
141
|
+
/>
|
|
66
142
|
</div>
|
|
67
143
|
</template>
|
|
68
144
|
</FmSideSheet>
|
|
@@ -78,11 +154,17 @@ import { useCoreStore } from '@feedmepos/mf-common'
|
|
|
78
154
|
import type { FdoFoodpandaSettings } from '@entity'
|
|
79
155
|
import type {
|
|
80
156
|
FdoLinkedDelivery,
|
|
157
|
+
FdoRestaurant,
|
|
81
158
|
FdoRestaurantFeedmeDelivery,
|
|
82
159
|
FdoRestaurantInHouseDelivery
|
|
83
160
|
} from '@feedmepos/core/entity'
|
|
84
161
|
import { FdoGrabfoodSettings, FdoShopeeFoodSettings } from '@entity'
|
|
85
|
-
import {
|
|
162
|
+
import {
|
|
163
|
+
F_DELIVERY_TYPE,
|
|
164
|
+
F_FEATURE,
|
|
165
|
+
F_ORDER_PLATFORM,
|
|
166
|
+
F_PAYOUT_ACCOUNT_STATUS
|
|
167
|
+
} from '@feedmepos/core/entity'
|
|
86
168
|
import deliveryData from './delivery.data'
|
|
87
169
|
import { useDelivery, type DeliveryCompany, type LinkedDeliveryDoc } from './delivery'
|
|
88
170
|
import { useLoading } from '@/composables/loading'
|
|
@@ -102,6 +184,7 @@ import { formatAddress } from '@/helpers/profile'
|
|
|
102
184
|
import { useSnackbarFunctions } from '@/components/snackbar'
|
|
103
185
|
import useSearch from '@/composables/search'
|
|
104
186
|
import DeliveryList from './DeliveryList.vue'
|
|
187
|
+
import { Pos } from '@feedmepos/core'
|
|
105
188
|
|
|
106
189
|
const { searchKey, filter } = useSearch()
|
|
107
190
|
const { showSuccess } = useSnackbarFunctions()
|
|
@@ -251,11 +334,31 @@ async function updateFeedmeExpress({ key, setting }: IntegratedDeliveryRow) {
|
|
|
251
334
|
}
|
|
252
335
|
}
|
|
253
336
|
|
|
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
|
+
|
|
254
355
|
async function updateInHouse({ key, setting }: IntegratedDeliveryRow) {
|
|
255
356
|
clearComponentProps()
|
|
256
357
|
|
|
257
358
|
const inhouseSetting = setting as FdoRestaurantInHouseDelivery
|
|
258
|
-
const allowEPayment =
|
|
359
|
+
const allowEPayment = currentRestaurant.value
|
|
360
|
+
? getRestaurantEPayment(currentRestaurant.value)
|
|
361
|
+
: false
|
|
259
362
|
|
|
260
363
|
inHouseComponentProps.value = {
|
|
261
364
|
key,
|
|
@@ -264,7 +367,8 @@ async function updateInHouse({ key, setting }: IntegratedDeliveryRow) {
|
|
|
264
367
|
deliveryTime: inhouseSetting.deliveryTime || null,
|
|
265
368
|
paymentTypes: inhouseSetting.paymentTypes || [],
|
|
266
369
|
offlinePaymentTypes: inhouseSetting.offlinePaymentTypes || [],
|
|
267
|
-
ignoreStock: inhouseSetting.ignoreStock || false
|
|
370
|
+
ignoreStock: inhouseSetting.ignoreStock || false,
|
|
371
|
+
taxes: inhouseSetting.taxes || {}
|
|
268
372
|
},
|
|
269
373
|
allowEPayment
|
|
270
374
|
}
|