@feedmepos/mf-order-setting 0.0.71-dev → 0.0.72-prod
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/{KioskDevicesView-CP_cGMXE.js → KioskDevicesView-DIiEVc0i.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-CiNLqFw6.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-BD0Olm4_.js} +3 -3
- package/dist/{KioskSettingView-BiKYEjfe.js → KioskSettingView-Csm9he9M.js} +4 -4
- package/dist/{KioskView-BYxPrI7N.js → KioskView-Ho2ts0j6.js} +4 -4
- package/dist/{OrderSettingsView-C7Y-_y5U.js → OrderSettingsView-C0G8kP3v.js} +5 -5
- package/dist/{app-BN02cB5o.js → app-xl2InG-H.js} +213 -213
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-Bml-FvS7.js → dayjs.min-BVqlMLNE.js} +1 -1
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-BlKeAWPk.js → index-B4qdL9W3.js} +1 -1
- package/dist/index-kCI8JdNP.js +628 -0
- package/dist/{queue-transfer.dto-C7nRZOZH.js → queue-transfer.dto-BLyCakS5.js} +1 -1
- package/package.json +1 -1
- package/src/views/order-settings/dine-in/PaymentType.vue +9 -12
- package/dist/index-DZA8A0m4.js +0 -630
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { defineComponent as j, ref as R, resolveComponent as F, openBlock as g, createElementBlock as S, createElementVNode as h, toDisplayString as C, createVNode as D, unref as O, createBlock as L, computed as N, watch as ae, onMounted as ne, withCtx as Y, createTextVNode as re, createCommentVNode as x, Fragment as oe, renderList as se, renderSlot as le } from "vue";
|
|
2
|
+
import { e as w } from "./app-xl2InG-H.js";
|
|
3
|
+
import { useDialog as ue, useSnackbar as ie } from "@feedmepos/ui-library";
|
|
4
|
+
import { useI18n as M, useCoreStore as te } from "@feedmepos/mf-common";
|
|
5
|
+
import { defineStore as de } from "pinia";
|
|
6
|
+
import { r as $, g as n, w as V, S as q, f as B } from "./queue-transfer.dto-BLyCakS5.js";
|
|
7
|
+
const ce = /* @__PURE__ */ j({
|
|
8
|
+
__name: "OfflinePaymentTypeDialogContent",
|
|
9
|
+
props: {
|
|
10
|
+
name: {},
|
|
11
|
+
instruction: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:nameValue", "update:instructionValue"],
|
|
14
|
+
setup(e, { emit: a }) {
|
|
15
|
+
const { t: s } = M(), p = e, r = a, y = R("");
|
|
16
|
+
function f(b) {
|
|
17
|
+
r("update:nameValue", b);
|
|
18
|
+
}
|
|
19
|
+
function P(b) {
|
|
20
|
+
r("update:instructionValue", b);
|
|
21
|
+
}
|
|
22
|
+
return (b, v) => {
|
|
23
|
+
const _ = F("FmTextField"), c = F("FmTextarea");
|
|
24
|
+
return g(), S("div", null, [
|
|
25
|
+
h("span", null, C(p.name), 1),
|
|
26
|
+
D(_, {
|
|
27
|
+
"model-value": y.value,
|
|
28
|
+
"onUpdate:modelValue": f,
|
|
29
|
+
placeholder: O(s)("order.enterPaymentName"),
|
|
30
|
+
rules: [(i) => !!i || O(s)("order.fieldCannotBeEmpty")]
|
|
31
|
+
}, null, 8, ["model-value", "placeholder", "rules"]),
|
|
32
|
+
v[0] || (v[0] = h("div", { class: "mb-12" }, null, -1)),
|
|
33
|
+
h("span", null, C(p.instruction), 1),
|
|
34
|
+
D(c, {
|
|
35
|
+
"model-value": y.value,
|
|
36
|
+
"onUpdate:modelValue": P,
|
|
37
|
+
placeholder: O(s)("order.enterPaymentInstruction")
|
|
38
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
39
|
+
]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}), pe = /* @__PURE__ */ j({
|
|
43
|
+
__name: "OfflinePaymentTypeDialog",
|
|
44
|
+
emits: ["add:offline-payment-type"],
|
|
45
|
+
setup(e, { emit: a }) {
|
|
46
|
+
const { t: s } = M(), p = ue(), r = R(""), y = R(""), f = () => {
|
|
47
|
+
r.value = "", y.value = "", p.open({
|
|
48
|
+
title: s("order.addCustomPayment"),
|
|
49
|
+
contentComponent: ce,
|
|
50
|
+
contentComponentProps: {
|
|
51
|
+
name: s("order.name"),
|
|
52
|
+
instruction: s("order.instruction"),
|
|
53
|
+
"onUpdate:nameValue": (v) => {
|
|
54
|
+
r.value = v;
|
|
55
|
+
},
|
|
56
|
+
"onUpdate:instructionValue": (v) => {
|
|
57
|
+
y.value = v;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
primaryActions: { text: s("order.add"), close: !0 },
|
|
61
|
+
secondaryActions: { text: s("order.cancel"), close: !0 }
|
|
62
|
+
}).onPrimary(async () => {
|
|
63
|
+
const v = {
|
|
64
|
+
name: r.value,
|
|
65
|
+
instruction: y.value
|
|
66
|
+
};
|
|
67
|
+
await P(v);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
async function P(v) {
|
|
71
|
+
b("add:offline-payment-type", v);
|
|
72
|
+
}
|
|
73
|
+
const b = a;
|
|
74
|
+
return (v, _) => {
|
|
75
|
+
const c = F("FmButton");
|
|
76
|
+
return g(), L(c, {
|
|
77
|
+
label: O(s)("order.editOfflinePayment"),
|
|
78
|
+
onClick: f,
|
|
79
|
+
variant: "plain"
|
|
80
|
+
}, null, 8, ["label"]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}), ye = { class: "flex flex-col gap-3" }, fe = { class: "flex-grow fm-typo-en-title-sm-600" }, me = { class: "flex flex-row items-center" }, ve = { key: 0 }, ge = { key: 0 }, we = { class: "font-bold" }, he = { class: "mt-3" }, Pe = {
|
|
84
|
+
key: 1,
|
|
85
|
+
class: "text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7"
|
|
86
|
+
}, be = {
|
|
87
|
+
key: 2,
|
|
88
|
+
class: "ml-7"
|
|
89
|
+
}, _e = {
|
|
90
|
+
key: 4,
|
|
91
|
+
class: "text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7"
|
|
92
|
+
}, $e = /* @__PURE__ */ j({
|
|
93
|
+
__name: "PaymentType",
|
|
94
|
+
props: {
|
|
95
|
+
paymentTypes: {
|
|
96
|
+
type: Array,
|
|
97
|
+
required: !0
|
|
98
|
+
},
|
|
99
|
+
offlinePaymentTypes: {
|
|
100
|
+
type: Array,
|
|
101
|
+
required: !0
|
|
102
|
+
},
|
|
103
|
+
showDisabledOptions: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: !1
|
|
106
|
+
},
|
|
107
|
+
disabledSuffixes: {
|
|
108
|
+
type: Object,
|
|
109
|
+
default: () => ({})
|
|
110
|
+
},
|
|
111
|
+
allowEPayment: {
|
|
112
|
+
type: [Boolean, String],
|
|
113
|
+
required: !0
|
|
114
|
+
},
|
|
115
|
+
allowCredit: {
|
|
116
|
+
type: [Boolean, String],
|
|
117
|
+
default: !1
|
|
118
|
+
},
|
|
119
|
+
maxCustomPayment: {
|
|
120
|
+
type: Number,
|
|
121
|
+
default: void 0
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
emits: ["update:paymentTypes", "update:offlinePaymentTypes"],
|
|
125
|
+
setup(e, { emit: a }) {
|
|
126
|
+
const { t: s } = M(), { currentRestaurant: p } = te(), r = e, y = a;
|
|
127
|
+
async function f(l) {
|
|
128
|
+
y(
|
|
129
|
+
"update:offlinePaymentTypes",
|
|
130
|
+
r.offlinePaymentTypes.filter((d, t) => t !== l)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
const P = N(() => (r.paymentTypes || []).includes(w.F_ORDER_PAYMENT_TYPE.enum.ePayment)), b = N(() => (r.paymentTypes || []).includes(w.F_ORDER_PAYMENT_TYPE.enum.credit)), v = N(() => {
|
|
134
|
+
const l = r.paymentTypes || [], d = r.offlinePaymentTypes || [];
|
|
135
|
+
return l.includes(w.F_ORDER_PAYMENT_TYPE.enum.cash) || d.length > 0;
|
|
136
|
+
}), _ = R(!1), c = R([]), i = N(() => [
|
|
137
|
+
{ label: s("order.offlinePayment"), value: "offline" },
|
|
138
|
+
{
|
|
139
|
+
label: s("order.ePayment"),
|
|
140
|
+
value: "e-payment",
|
|
141
|
+
disable: !r.allowEPayment,
|
|
142
|
+
suffix: !r.allowEPayment && r.showDisabledOptions ? {
|
|
143
|
+
text: `(${r.disabledSuffixes["e-payment"] || s("order.notAllowed")})`,
|
|
144
|
+
class: "text-negative t-system"
|
|
145
|
+
} : void 0
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: s("order.credit"),
|
|
149
|
+
value: "credit",
|
|
150
|
+
disable: !r.allowCredit,
|
|
151
|
+
suffix: !r.allowCredit && r.showDisabledOptions ? {
|
|
152
|
+
text: `(${r.disabledSuffixes.credit || s("order.notAllowed")})`,
|
|
153
|
+
class: "text-negative t-system"
|
|
154
|
+
} : void 0
|
|
155
|
+
}
|
|
156
|
+
]), k = () => {
|
|
157
|
+
const l = [];
|
|
158
|
+
v.value && l.push("offline"), P.value && l.push("e-payment"), b.value && l.push("credit"), c.value = l;
|
|
159
|
+
let d = 0;
|
|
160
|
+
r.showDisabledOptions ? d = i.value.length : d = i.value.filter((t) => !(t.value === "e-payment" && !r.allowEPayment || t.value === "credit" && !r.allowCredit)).length, _.value = l.length === d && l.length > 0;
|
|
161
|
+
};
|
|
162
|
+
k();
|
|
163
|
+
const G = (l) => {
|
|
164
|
+
const d = i.value.filter((m) => !(m.value === "e-payment" && !r.allowEPayment || m.value === "credit" && !r.allowCredit));
|
|
165
|
+
c.value = l ? d.map((m) => m.value) : [], _.value = l;
|
|
166
|
+
const t = [], u = l ? r.offlinePaymentTypes || [] : [];
|
|
167
|
+
c.value.includes("e-payment") && t.push(w.F_ORDER_PAYMENT_TYPE.enum.ePayment), c.value.includes("offline") && t.push(w.F_ORDER_PAYMENT_TYPE.enum.cash), c.value.includes("credit") && t.push(w.F_ORDER_PAYMENT_TYPE.enum.credit), y("update:paymentTypes", t), y("update:offlinePaymentTypes", u);
|
|
168
|
+
}, A = (l) => {
|
|
169
|
+
c.value = l, r.showDisabledOptions ? i.value.length : i.value.filter((m) => !(m.value === "e-payment" && !r.allowEPayment || m.value === "credit" && !r.allowCredit)).length;
|
|
170
|
+
const d = i.value.filter((m) => !(m.value === "e-payment" && !r.allowEPayment || m.value === "credit" && !r.allowCredit)).length;
|
|
171
|
+
_.value = l.length === d && l.length > 0;
|
|
172
|
+
const t = [], u = l.includes("offline") ? r.offlinePaymentTypes || [] : [];
|
|
173
|
+
l.includes("e-payment") && t.push(w.F_ORDER_PAYMENT_TYPE.enum.ePayment), l.includes("offline") && t.push(w.F_ORDER_PAYMENT_TYPE.enum.cash), l.includes("credit") && t.push(w.F_ORDER_PAYMENT_TYPE.enum.credit), y("update:paymentTypes", t), y("update:offlinePaymentTypes", u);
|
|
174
|
+
};
|
|
175
|
+
return ae(
|
|
176
|
+
() => p.value,
|
|
177
|
+
(l) => {
|
|
178
|
+
k();
|
|
179
|
+
},
|
|
180
|
+
{ immediate: !0 }
|
|
181
|
+
), ne(() => {
|
|
182
|
+
k();
|
|
183
|
+
}), (l, d) => {
|
|
184
|
+
var Q, W, H, J, K, X, Z;
|
|
185
|
+
const t = F("FmCheckbox"), u = F("FmCardSection"), m = F("FmCard"), z = F("FmButton");
|
|
186
|
+
return g(), S("div", ye, [
|
|
187
|
+
h("div", fe, C(O(s)("order.acceptedPayment")), 1),
|
|
188
|
+
D(t, {
|
|
189
|
+
value: "",
|
|
190
|
+
"model-value": _.value,
|
|
191
|
+
label: O(s)("order.all"),
|
|
192
|
+
indeterminate: c.value.length > 0 && !_.value,
|
|
193
|
+
"onUpdate:modelValue": G
|
|
194
|
+
}, null, 8, ["model-value", "label", "indeterminate"]),
|
|
195
|
+
h("div", me, [
|
|
196
|
+
D(t, {
|
|
197
|
+
modelValue: c.value,
|
|
198
|
+
"onUpdate:modelValue": [
|
|
199
|
+
d[0] || (d[0] = (T) => c.value = T),
|
|
200
|
+
A
|
|
201
|
+
],
|
|
202
|
+
label: i.value[0].label,
|
|
203
|
+
value: i.value[0].value
|
|
204
|
+
}, null, 8, ["modelValue", "label", "value"])
|
|
205
|
+
]),
|
|
206
|
+
c.value.includes(i.value[0].value) ? (g(), S("div", ve, [
|
|
207
|
+
((Q = e.offlinePaymentTypes) == null ? void 0 : Q.length) === 0 ? (g(), S("div", ge, [
|
|
208
|
+
D(m, { variant: "outlined" }, {
|
|
209
|
+
default: Y(() => [
|
|
210
|
+
D(u, null, {
|
|
211
|
+
default: Y(() => [
|
|
212
|
+
re(C(O(s)("order.cash")), 1)
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
})
|
|
216
|
+
]),
|
|
217
|
+
_: 1
|
|
218
|
+
})
|
|
219
|
+
])) : x("", !0),
|
|
220
|
+
(g(!0), S(oe, null, se(e.offlinePaymentTypes, (T, ee) => (g(), S("p", { key: ee }, [
|
|
221
|
+
D(m, {
|
|
222
|
+
variant: "outlined",
|
|
223
|
+
class: "mb-3"
|
|
224
|
+
}, {
|
|
225
|
+
default: Y(() => [
|
|
226
|
+
D(u, { class: "flex items-center justify-between" }, {
|
|
227
|
+
default: Y(() => [
|
|
228
|
+
h("div", null, [
|
|
229
|
+
h("span", we, C(T.name), 1),
|
|
230
|
+
d[4] || (d[4] = h("br", null, null, -1)),
|
|
231
|
+
h("span", null, C(T.instruction), 1)
|
|
232
|
+
]),
|
|
233
|
+
h("div", null, [
|
|
234
|
+
D(z, {
|
|
235
|
+
"append-icon": "delete",
|
|
236
|
+
variant: "plain",
|
|
237
|
+
onClick: (Se) => f(ee)
|
|
238
|
+
}, null, 8, ["onClick"])
|
|
239
|
+
])
|
|
240
|
+
]),
|
|
241
|
+
_: 2
|
|
242
|
+
}, 1024)
|
|
243
|
+
]),
|
|
244
|
+
_: 2
|
|
245
|
+
}, 1024)
|
|
246
|
+
]))), 128)),
|
|
247
|
+
h("div", he, [
|
|
248
|
+
e.offlinePaymentTypes.length === 0 || e.showDisabledOptions ? (g(), L(pe, {
|
|
249
|
+
key: 0,
|
|
250
|
+
"onAdd:offlinePaymentType": d[1] || (d[1] = (T) => y("update:offlinePaymentTypes", [...r.offlinePaymentTypes, T]))
|
|
251
|
+
})) : x("", !0)
|
|
252
|
+
])
|
|
253
|
+
])) : x("", !0),
|
|
254
|
+
D(t, {
|
|
255
|
+
modelValue: c.value,
|
|
256
|
+
"onUpdate:modelValue": [
|
|
257
|
+
d[2] || (d[2] = (T) => c.value = T),
|
|
258
|
+
A
|
|
259
|
+
],
|
|
260
|
+
label: i.value[1].label,
|
|
261
|
+
value: i.value[1].value,
|
|
262
|
+
disabled: i.value[1].disable
|
|
263
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
264
|
+
i.value[1].suffix ? (g(), S("div", Pe, C((J = (H = (W = i.value) == null ? void 0 : W[1]) == null ? void 0 : H.suffix) == null ? void 0 : J.text), 1)) : x("", !0),
|
|
265
|
+
c.value.includes("e-payment") ? (g(), S("div", be, [
|
|
266
|
+
le(l.$slots, "e-payment-content")
|
|
267
|
+
])) : x("", !0),
|
|
268
|
+
e.allowCredit || e.showDisabledOptions ? (g(), L(t, {
|
|
269
|
+
key: 3,
|
|
270
|
+
modelValue: c.value,
|
|
271
|
+
"onUpdate:modelValue": [
|
|
272
|
+
d[3] || (d[3] = (T) => c.value = T),
|
|
273
|
+
A
|
|
274
|
+
],
|
|
275
|
+
label: i.value[2].label,
|
|
276
|
+
value: i.value[2].value,
|
|
277
|
+
disabled: i.value[2].disable
|
|
278
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"])) : x("", !0),
|
|
279
|
+
i.value[2].suffix ? (g(), S("div", _e, C((Z = (X = (K = i.value) == null ? void 0 : K[2]) == null ? void 0 : X.suffix) == null ? void 0 : Z.text), 1)) : x("", !0)
|
|
280
|
+
]);
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}), I = {
|
|
284
|
+
async readRestaurantSetting(e) {
|
|
285
|
+
const a = await V().get(`/restaurants/${e}/restaurant-setting`);
|
|
286
|
+
return n(a);
|
|
287
|
+
},
|
|
288
|
+
async updateDineInSetting(e) {
|
|
289
|
+
const a = await $().put("/dine-in", e);
|
|
290
|
+
return n(a);
|
|
291
|
+
},
|
|
292
|
+
async updatePickupSetting(e) {
|
|
293
|
+
const a = await $().put("/pickup", e);
|
|
294
|
+
return n(a);
|
|
295
|
+
},
|
|
296
|
+
async updateDriveThruSetting(e) {
|
|
297
|
+
const a = await $().put("/drive-thru", e);
|
|
298
|
+
return n(a);
|
|
299
|
+
},
|
|
300
|
+
async updateServiceCharge(e) {
|
|
301
|
+
const a = await $().put("/service-charge-setting", e);
|
|
302
|
+
return n(a);
|
|
303
|
+
},
|
|
304
|
+
async getMobileOrderSetting() {
|
|
305
|
+
return await n(await $().get("/order-settings"));
|
|
306
|
+
},
|
|
307
|
+
async updateQueueSetting(e, a) {
|
|
308
|
+
const s = await $().put("/queue", a);
|
|
309
|
+
return n(s);
|
|
310
|
+
}
|
|
311
|
+
}, o = (e) => {
|
|
312
|
+
const a = `/${e}`;
|
|
313
|
+
return V(a, "portal");
|
|
314
|
+
}, U = () => {
|
|
315
|
+
const e = q.getRestaurantId();
|
|
316
|
+
if (!e) throw new Error("Invalid restaurant ID");
|
|
317
|
+
const { linkedDeliveryBackend: a } = q.getBackendUrl(), s = `${a}/restaurants/${e}/linked-deliveries`;
|
|
318
|
+
return V("", "portal", { url: s });
|
|
319
|
+
}, E = {
|
|
320
|
+
async readLinkedDeliveryCompanies() {
|
|
321
|
+
return n(await U().get(""));
|
|
322
|
+
},
|
|
323
|
+
async readLocalDeliveryCompanies() {
|
|
324
|
+
return n(await V().get("/deliveries"));
|
|
325
|
+
},
|
|
326
|
+
async createDeliveryCompany(e) {
|
|
327
|
+
return n(await U().post("", e));
|
|
328
|
+
},
|
|
329
|
+
async updateDeliveryCompany(e) {
|
|
330
|
+
return n(await U().put(`/${e._id}`, e));
|
|
331
|
+
},
|
|
332
|
+
async deleteDeliveryCompany(e) {
|
|
333
|
+
return n(await U().delete(`/${e._id}`));
|
|
334
|
+
},
|
|
335
|
+
integratedDelivery: {
|
|
336
|
+
async updateInhouse(e, a) {
|
|
337
|
+
return n(await V().put(`/restaurants/${e}/in-house-delivery`, a));
|
|
338
|
+
},
|
|
339
|
+
async updateFeedme(e, a) {
|
|
340
|
+
return n(await V().put(`/restaurants/${e}/feedme-delivery`, a));
|
|
341
|
+
},
|
|
342
|
+
async readFoodpanda(e) {
|
|
343
|
+
return n(await o("foodpanda").get(`/setting/${e}`));
|
|
344
|
+
},
|
|
345
|
+
async readFoodpandaOrders(e) {
|
|
346
|
+
return n(await o("foodpanda").get("/order", { params: e }));
|
|
347
|
+
},
|
|
348
|
+
async reflowFoodpandaOrders(e) {
|
|
349
|
+
return n(await o("foodpanda").put(`/order/reflow/${e}`));
|
|
350
|
+
},
|
|
351
|
+
async rejectFoodpandaOrders(e) {
|
|
352
|
+
return n(await o("foodpanda").put(`/order/void/${e}`));
|
|
353
|
+
},
|
|
354
|
+
async updateFoodpanda(e, a) {
|
|
355
|
+
return n(await o("foodpanda").put(`/setting/${e}`, {
|
|
356
|
+
_id: e,
|
|
357
|
+
...a
|
|
358
|
+
}));
|
|
359
|
+
},
|
|
360
|
+
async syncFoodpandaMenu(e) {
|
|
361
|
+
return n(await o("foodpanda").put(`/menu-sync/${e}`));
|
|
362
|
+
},
|
|
363
|
+
async readGrabfood(e) {
|
|
364
|
+
return n(await o("grabfood").get(`/setting/${e}`));
|
|
365
|
+
},
|
|
366
|
+
async readGrabfoodOrders(e) {
|
|
367
|
+
return n(await o("grabfood").get("/order", { params: e }));
|
|
368
|
+
},
|
|
369
|
+
async reflowGrabfoodOrders(e) {
|
|
370
|
+
return n(await o("grabfood").put(`/order/reflow/${e}`));
|
|
371
|
+
},
|
|
372
|
+
async rejectGrabfoodOrders(e) {
|
|
373
|
+
return n(await o("grabfood").put(`/order/void/${e}`));
|
|
374
|
+
},
|
|
375
|
+
async updateGrabfood(e, a) {
|
|
376
|
+
return n(await o("grabfood").put(`/setting/${e}`, {
|
|
377
|
+
_id: e,
|
|
378
|
+
...a
|
|
379
|
+
}));
|
|
380
|
+
},
|
|
381
|
+
async syncGrabfoodMenu(e) {
|
|
382
|
+
return n(await o("grabfood").get(`/menu-sync/${e}`));
|
|
383
|
+
},
|
|
384
|
+
async startSelfServeFlow(e) {
|
|
385
|
+
return n(await o("grabfood").get(`/setting/integration-url/${e}`));
|
|
386
|
+
},
|
|
387
|
+
async readShopeefood(e) {
|
|
388
|
+
return n(await o("shopeefood").get(`/setting/${e}`));
|
|
389
|
+
},
|
|
390
|
+
async readShopeefoodOrders(e) {
|
|
391
|
+
return n(await o("shopeefood").get("/order", { params: e }));
|
|
392
|
+
},
|
|
393
|
+
async reflowShopeefoodOrders(e) {
|
|
394
|
+
return n(await o("shopeefood").put(`/order/reflow/${e}`));
|
|
395
|
+
},
|
|
396
|
+
async rejectShopeefoodOrders(e) {
|
|
397
|
+
return n(await o("shopeefood").put(`/order/void/${e}`));
|
|
398
|
+
},
|
|
399
|
+
async updateShopeefood(e, a) {
|
|
400
|
+
return n(await o("shopeefood").put(`/setting/${e}`, {
|
|
401
|
+
_id: e,
|
|
402
|
+
...a
|
|
403
|
+
}));
|
|
404
|
+
},
|
|
405
|
+
async syncShopeefoodMenu(e) {
|
|
406
|
+
return n(await o("shopeefood").get(`/menu-sync/${e}`));
|
|
407
|
+
},
|
|
408
|
+
async readGofood(e) {
|
|
409
|
+
return n(await o("gofood").get(`/setting/${e}`));
|
|
410
|
+
},
|
|
411
|
+
async updateGofood(e, a) {
|
|
412
|
+
return n(await o("gofood").put(`/setting/${e}`, {
|
|
413
|
+
...a,
|
|
414
|
+
_id: e
|
|
415
|
+
}));
|
|
416
|
+
},
|
|
417
|
+
async syncGofoodMenu(e) {
|
|
418
|
+
return n(await o("gofood").get(`/menu-sync/${e}`));
|
|
419
|
+
},
|
|
420
|
+
async updateDeliveroo(e, a) {
|
|
421
|
+
return n(await o("deliveroo").put(`/setting/${e}`, {
|
|
422
|
+
_id: e,
|
|
423
|
+
...a
|
|
424
|
+
}));
|
|
425
|
+
},
|
|
426
|
+
async readDeliveroo(e) {
|
|
427
|
+
return n(await o("deliveroo").get(`/setting/${e}`));
|
|
428
|
+
},
|
|
429
|
+
async syncDeliverooMernu(e) {
|
|
430
|
+
try {
|
|
431
|
+
return n(await o("deliveroo").get(`/menu-sync/${e}`));
|
|
432
|
+
} catch (a) {
|
|
433
|
+
throw a;
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
async readExternal(e) {
|
|
437
|
+
return n(await o("external").get(`/setting/${e}`));
|
|
438
|
+
},
|
|
439
|
+
async updateExternal(e, a) {
|
|
440
|
+
return n(await o("external").put(`setting/${e}`, {
|
|
441
|
+
...a
|
|
442
|
+
}));
|
|
443
|
+
},
|
|
444
|
+
async syncExternalMenu(e) {
|
|
445
|
+
return n(await o("external").get(`/menu-sync/${e}`));
|
|
446
|
+
},
|
|
447
|
+
async flowTestOrder(e, a) {
|
|
448
|
+
return n(
|
|
449
|
+
await o(a).put(`/test-order/${e}`)
|
|
450
|
+
);
|
|
451
|
+
},
|
|
452
|
+
async cancelTestOrder(e, a) {
|
|
453
|
+
return n(
|
|
454
|
+
await o(a).put(
|
|
455
|
+
`/test-order/cancel/${e}`
|
|
456
|
+
)
|
|
457
|
+
);
|
|
458
|
+
},
|
|
459
|
+
async reflowFpOrderNotInDb(e) {
|
|
460
|
+
return n(
|
|
461
|
+
await o("foodpanda").put("/order/reconcile", e)
|
|
462
|
+
);
|
|
463
|
+
},
|
|
464
|
+
async reflowGfOrderNotInDb(e) {
|
|
465
|
+
return n(
|
|
466
|
+
await o("grabfood").put("/order/reconcile", e)
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
function Te() {
|
|
472
|
+
return {
|
|
473
|
+
restaurantSettings: {}
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
const Ve = de("restaurant", () => {
|
|
477
|
+
const e = te(), a = R(Te()), s = N(() => {
|
|
478
|
+
var t;
|
|
479
|
+
return a.value.restaurantSettings[((t = e.currentRestaurant.value) == null ? void 0 : t._id) || ""];
|
|
480
|
+
});
|
|
481
|
+
async function p(t) {
|
|
482
|
+
const u = await I.readRestaurantSetting(t);
|
|
483
|
+
return a.value.restaurantSettings = {
|
|
484
|
+
...a.value.restaurantSettings,
|
|
485
|
+
[t]: u
|
|
486
|
+
}, u;
|
|
487
|
+
}
|
|
488
|
+
async function r(t) {
|
|
489
|
+
await p(t), q.setRestaurantId(t), setRestaurantId(t), B.FeatureFlag.setRestaurant(t || void 0), localStorage.set("feedme_restaurant", t);
|
|
490
|
+
}
|
|
491
|
+
async function y(t) {
|
|
492
|
+
await I.updateServiceCharge(t);
|
|
493
|
+
}
|
|
494
|
+
async function f(t) {
|
|
495
|
+
await I.updateDineInSetting(t);
|
|
496
|
+
}
|
|
497
|
+
async function P(t) {
|
|
498
|
+
await I.updatePickupSetting(t);
|
|
499
|
+
}
|
|
500
|
+
async function b(t) {
|
|
501
|
+
await I.updateDriveThruSetting(t);
|
|
502
|
+
}
|
|
503
|
+
async function v(t, u) {
|
|
504
|
+
await E.integratedDelivery.updateInhouse(t, u);
|
|
505
|
+
}
|
|
506
|
+
async function _(t, u) {
|
|
507
|
+
return await E.integratedDelivery.updateFeedme(t, u);
|
|
508
|
+
}
|
|
509
|
+
async function c(t, u) {
|
|
510
|
+
await E.integratedDelivery.updateFoodpanda(t, u);
|
|
511
|
+
}
|
|
512
|
+
async function i(t, u) {
|
|
513
|
+
await E.integratedDelivery.updateGrabfood(t, u);
|
|
514
|
+
}
|
|
515
|
+
async function k(t, u) {
|
|
516
|
+
await E.integratedDelivery.updateShopeefood(t, u);
|
|
517
|
+
}
|
|
518
|
+
async function G(t, u) {
|
|
519
|
+
await E.integratedDelivery.updateGofood(t, u);
|
|
520
|
+
}
|
|
521
|
+
async function A(t, u) {
|
|
522
|
+
await E.integratedDelivery.updateDeliveroo(t, u);
|
|
523
|
+
}
|
|
524
|
+
async function l(t, u) {
|
|
525
|
+
await E.integratedDelivery.updateExternal(t, u);
|
|
526
|
+
}
|
|
527
|
+
function d() {
|
|
528
|
+
const { t } = M();
|
|
529
|
+
if (!e.currentRestaurant.value)
|
|
530
|
+
return "getRestaurantEPayment - Invalid restaurant ";
|
|
531
|
+
const u = e.currentRestaurant.value.payoutAccount, m = e.currentRestaurant.value.posVersion;
|
|
532
|
+
return !!m && B.Pos.canUse({
|
|
533
|
+
feature: w.F_FEATURE.enum.qrEPayment,
|
|
534
|
+
posVersion: m
|
|
535
|
+
}) ? !u || !u.enable || u.status !== w.F_PAYOUT_ACCOUNT_STATUS.enum.APPROVED ? t("order.payoutAccountIsRequired") : !0 : t("order.payoutPosVersion", { version: B.Pos.minVersionToUse(w.F_FEATURE.enum.qrEPayment) });
|
|
536
|
+
}
|
|
537
|
+
return {
|
|
538
|
+
state: a.value,
|
|
539
|
+
currentRestaurantSetting: s.value,
|
|
540
|
+
readRestaurantSetting: p,
|
|
541
|
+
selectRestaurant: r,
|
|
542
|
+
updateServiceCharge: y,
|
|
543
|
+
updateDineInSetting: f,
|
|
544
|
+
updatePickupSetting: P,
|
|
545
|
+
updateDriveThruSetting: b,
|
|
546
|
+
updateInhouseDelivery: v,
|
|
547
|
+
updateFeedmeDelivery: _,
|
|
548
|
+
updateIntegratedFoodpandaDelivery: c,
|
|
549
|
+
updateIntegratedGrabfoodDelivery: i,
|
|
550
|
+
updateIntegratedShopeefoodDelivery: k,
|
|
551
|
+
updateIntegratedGofoodDelivery: G,
|
|
552
|
+
updateIntegratedDeliverooDelivery: A,
|
|
553
|
+
updateExternalDelivery: l,
|
|
554
|
+
getRestaurantEPayment: d
|
|
555
|
+
};
|
|
556
|
+
});
|
|
557
|
+
function De() {
|
|
558
|
+
const e = ie();
|
|
559
|
+
function a(f) {
|
|
560
|
+
e.open({
|
|
561
|
+
type: "success",
|
|
562
|
+
message: f,
|
|
563
|
+
position: "bottom"
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function s(f) {
|
|
567
|
+
e.open({
|
|
568
|
+
type: "error",
|
|
569
|
+
message: f,
|
|
570
|
+
position: "bottom"
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
let p = null;
|
|
574
|
+
function r(f) {
|
|
575
|
+
return p = e.open({
|
|
576
|
+
type: "neutral",
|
|
577
|
+
spinner: !0,
|
|
578
|
+
message: f,
|
|
579
|
+
position: "bottom",
|
|
580
|
+
persistent: !0
|
|
581
|
+
// Ensure the snackbar stays visible until manually closed
|
|
582
|
+
}), p;
|
|
583
|
+
}
|
|
584
|
+
function y() {
|
|
585
|
+
p && (e.close(p), p = null);
|
|
586
|
+
}
|
|
587
|
+
return { showSuccess: a, showError: s, showLoading: r, closeLoadingSnackbar: y };
|
|
588
|
+
}
|
|
589
|
+
const ke = () => {
|
|
590
|
+
const { showError: e } = De(), a = R(!1);
|
|
591
|
+
function s() {
|
|
592
|
+
a.value = !0;
|
|
593
|
+
}
|
|
594
|
+
function p() {
|
|
595
|
+
a.value = !1;
|
|
596
|
+
}
|
|
597
|
+
async function r(f) {
|
|
598
|
+
try {
|
|
599
|
+
return s(), await f();
|
|
600
|
+
} finally {
|
|
601
|
+
p();
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
async function y(f) {
|
|
605
|
+
try {
|
|
606
|
+
return s(), await f();
|
|
607
|
+
} catch (P) {
|
|
608
|
+
throw e(`${P}`), P;
|
|
609
|
+
} finally {
|
|
610
|
+
p();
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return {
|
|
614
|
+
isLoading: a,
|
|
615
|
+
startLoading: s,
|
|
616
|
+
stopLoading: p,
|
|
617
|
+
startAsyncCall: r,
|
|
618
|
+
startAsyncCallWithErr: y
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
export {
|
|
622
|
+
$e as _,
|
|
623
|
+
Ve as a,
|
|
624
|
+
De as b,
|
|
625
|
+
I as c,
|
|
626
|
+
E as r,
|
|
627
|
+
ke as u
|
|
628
|
+
};
|