@feedmepos/mf-report 5.4.11-beta.0 → 5.4.11-beta.1
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/{App-Dy-jH-Bo.js → App-lTSlttIs.js} +1 -1
- package/dist/Integration-Dg8PYOrr.js +3532 -0
- package/dist/app.js +2 -2
- package/package.json +1 -1
- package/dist/Integration-CN8IrFBP.js +0 -3553
|
@@ -0,0 +1,3532 @@
|
|
|
1
|
+
import { defineComponent as z, mergeModels as ve, useModel as G, computed as Y, resolveComponent as h, createElementBlock as $, openBlock as p, createElementVNode as t, createCommentVNode as H, normalizeClass as Te, Fragment as B, renderList as q, createBlock as I, createVNode as n, withCtx as ue, toDisplayString as pe, unref as J, ref as j, watch as de, isRef as ge, h as D, resolveDynamicComponent as ce, onMounted as Ie, mergeProps as Pe } from "vue";
|
|
2
|
+
import { useRouter as se, useRoute as Ke } from "vue-router";
|
|
3
|
+
import { I as ne, f as Me, c as fe, d as ye, a as ie, o as Ae, p as Ne, k as Re, n as xe, q as _e, r as we, s as be, t as Ce, A as me, v as Fe, w as Be, x as je } from "./global-loader-D0HoIQuN.js";
|
|
4
|
+
import { u as he } from "./message-dialog-UoMWOnil.js";
|
|
5
|
+
import { useSnackbar as re } from "@feedmepos/ui-library";
|
|
6
|
+
import { storeToRefs as Ve } from "pinia";
|
|
7
|
+
import { _ as ke } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-CpiR4ObD.js";
|
|
8
|
+
import { s as Le } from "./index-CoXjL8fr.js";
|
|
9
|
+
const Oe = { class: "flex flex-row items-center w-[100%] gap-[4px] justify-between" }, Ee = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "w-[50%]"
|
|
12
|
+
}, He = { class: "text-nowrap w-[100%] overflow-hidden text-ellipsis" }, Ye = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "w-[24px] flex items-center"
|
|
15
|
+
}, U = /* @__PURE__ */ z({
|
|
16
|
+
__name: "MappingField",
|
|
17
|
+
props: /* @__PURE__ */ ve({
|
|
18
|
+
removable: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
options: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({})
|
|
25
|
+
},
|
|
26
|
+
type: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "text"
|
|
29
|
+
},
|
|
30
|
+
rules: {
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => []
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
modelValue: { required: !0 },
|
|
36
|
+
modelModifiers: {}
|
|
37
|
+
}),
|
|
38
|
+
emits: /* @__PURE__ */ ve(["remove"], ["update:modelValue"]),
|
|
39
|
+
setup(k, { emit: e }) {
|
|
40
|
+
const g = G(k, "modelValue"), s = k, y = Y(
|
|
41
|
+
() => Object.keys(s.options).map((C) => {
|
|
42
|
+
const f = s.options[C];
|
|
43
|
+
return {
|
|
44
|
+
placeholder: f.placeholder,
|
|
45
|
+
key: C,
|
|
46
|
+
editable: f.editable
|
|
47
|
+
};
|
|
48
|
+
})
|
|
49
|
+
), x = e;
|
|
50
|
+
return (C, f) => {
|
|
51
|
+
const F = h("FmTextField"), i = h("FmTooltip"), c = h("FmIcon");
|
|
52
|
+
return p(), $("div", Oe, [
|
|
53
|
+
t("div", {
|
|
54
|
+
class: Te(`${k.removable ? "w-[calc(100%-24px)]" : "w-[100%]"} flex flex-row items-center gap-[4px]`)
|
|
55
|
+
}, [
|
|
56
|
+
(p(!0), $(B, null, q(y.value, (_) => {
|
|
57
|
+
var v;
|
|
58
|
+
return p(), $(B, {
|
|
59
|
+
key: _.key
|
|
60
|
+
}, [
|
|
61
|
+
_.editable ? (p(), $("div", Ee, [
|
|
62
|
+
n(F, {
|
|
63
|
+
"model-value": g.value[_.key],
|
|
64
|
+
placeholder: _.placeholder,
|
|
65
|
+
type: k.type,
|
|
66
|
+
rules: k.rules,
|
|
67
|
+
"onUpdate:modelValue": (V) => {
|
|
68
|
+
let o = V;
|
|
69
|
+
k.type === "number" && (o = Number(V)), g.value = {
|
|
70
|
+
...g.value,
|
|
71
|
+
[_.key]: o
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}, null, 8, ["model-value", "placeholder", "type", "rules", "onUpdate:modelValue"])
|
|
75
|
+
])) : (p(), I(i, {
|
|
76
|
+
key: 1,
|
|
77
|
+
content: (v = g.value[_.key]) == null ? void 0 : v.toString(),
|
|
78
|
+
class: "w-[50%]"
|
|
79
|
+
}, {
|
|
80
|
+
default: ue(() => [
|
|
81
|
+
t("div", He, pe(g.value[_.key]), 1)
|
|
82
|
+
]),
|
|
83
|
+
_: 2
|
|
84
|
+
}, 1032, ["content"]))
|
|
85
|
+
], 64);
|
|
86
|
+
}), 128))
|
|
87
|
+
], 2),
|
|
88
|
+
k.removable ? (p(), $("div", Ye, [
|
|
89
|
+
n(c, {
|
|
90
|
+
color: "system-error-300",
|
|
91
|
+
class: "cursor-pointer",
|
|
92
|
+
name: "close",
|
|
93
|
+
size: "md",
|
|
94
|
+
onClick: f[0] || (f[0] = (_) => x("remove"))
|
|
95
|
+
})
|
|
96
|
+
])) : H("", !0)
|
|
97
|
+
]);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}), qe = { class: "flex flex-row items-center" }, ze = { class: "flex flex-row items-center fm-typo-en-title-sm-800 h-[36px]" }, Ge = { class: "flex flex-row items-center w-[100%] justify-start" }, Qe = {
|
|
101
|
+
key: 0,
|
|
102
|
+
class: "flex flex-row items-center w-[100%] justify-start"
|
|
103
|
+
}, Xe = { class: "w-[calc(75%+4px)]" }, Je = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, We = { class: "flex flex-row items-center w-[100%] justify-between" }, Ze = { class: "text-nowrap w-[50%] overflow-hidden text-ellipsis" }, et = { class: "w-[50%]" }, $e = /* @__PURE__ */ z({
|
|
104
|
+
__name: "UploadSection",
|
|
105
|
+
props: /* @__PURE__ */ ve({
|
|
106
|
+
label: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: "upload"
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
modelValue: { required: !0 },
|
|
112
|
+
modelModifiers: {}
|
|
113
|
+
}),
|
|
114
|
+
emits: ["update:modelValue"],
|
|
115
|
+
setup(k) {
|
|
116
|
+
const e = G(k, "modelValue"), g = Y(() => {
|
|
117
|
+
switch (e.value.name) {
|
|
118
|
+
case ne.AutoCount:
|
|
119
|
+
case ne.SQL:
|
|
120
|
+
case ne.iFlexi_HRMS:
|
|
121
|
+
return !0;
|
|
122
|
+
default:
|
|
123
|
+
return !1;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return (s, y) => {
|
|
127
|
+
var F, i;
|
|
128
|
+
const x = h("FmSwitch"), C = h("FmTextField"), f = h("FmTimePicker");
|
|
129
|
+
return p(), $(B, null, [
|
|
130
|
+
t("div", qe, [
|
|
131
|
+
t("div", ze, "Auto " + pe(k.label), 1)
|
|
132
|
+
]),
|
|
133
|
+
t("div", Ge, [
|
|
134
|
+
y[4] || (y[4] = t("div", { class: "text-nowrap w-[calc(25%-4px)] overflow-hidden text-ellipsis" }, "Enable", -1)),
|
|
135
|
+
n(x, {
|
|
136
|
+
modelValue: e.value.enable,
|
|
137
|
+
"onUpdate:modelValue": y[0] || (y[0] = (c) => e.value.enable = c),
|
|
138
|
+
style: { gap: "0px" }
|
|
139
|
+
}, null, 8, ["modelValue"])
|
|
140
|
+
]),
|
|
141
|
+
g.value ? (p(), $("div", Qe, [
|
|
142
|
+
y[5] || (y[5] = t("div", { class: "text-nowrap w-[calc(25%-4px)] overflow-hidden text-ellipsis" }, "Email", -1)),
|
|
143
|
+
t("div", Xe, [
|
|
144
|
+
n(C, {
|
|
145
|
+
"model-value": (e.value.emails || []).join(","),
|
|
146
|
+
placeholder: "Email",
|
|
147
|
+
"onUpdate:modelValue": y[1] || (y[1] = (c) => {
|
|
148
|
+
switch (e.value.name) {
|
|
149
|
+
case J(ne).AutoCount:
|
|
150
|
+
case J(ne).SQL:
|
|
151
|
+
case J(ne).iFlexi_HRMS:
|
|
152
|
+
e.value.emails = c.split(",");
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
}, null, 8, ["model-value"])
|
|
157
|
+
])
|
|
158
|
+
])) : H("", !0),
|
|
159
|
+
t("div", Je, [
|
|
160
|
+
t("div", We, [
|
|
161
|
+
t("div", Ze, pe(J(Le)(k.label)) + " time ", 1),
|
|
162
|
+
t("div", et, [
|
|
163
|
+
n(f, {
|
|
164
|
+
class: "gap-[0px]",
|
|
165
|
+
"model-value": J(Me)().hour(((F = e.value.triggerTime) == null ? void 0 : F.hour) ?? 0).minute(((i = e.value.triggerTime) == null ? void 0 : i.minute) ?? 0).format("HH:mm"),
|
|
166
|
+
"onUpdate:modelValue": y[2] || (y[2] = (c) => {
|
|
167
|
+
c && (e.value.triggerTime.hour = Number(c.split(":")[0]), e.value.triggerTime.minute = Number(c.split(":")[1]));
|
|
168
|
+
})
|
|
169
|
+
}, null, 8, ["model-value"])
|
|
170
|
+
])
|
|
171
|
+
]),
|
|
172
|
+
n(U, {
|
|
173
|
+
"model-value": {
|
|
174
|
+
label: "Delay day",
|
|
175
|
+
delayDay: e.value.delayDay
|
|
176
|
+
},
|
|
177
|
+
type: "number",
|
|
178
|
+
options: {
|
|
179
|
+
label: { placeholder: "Delay day", editable: !1 },
|
|
180
|
+
delayDay: { placeholder: "Delay day", editable: !0 }
|
|
181
|
+
},
|
|
182
|
+
rules: [(c) => c > 0 || "Delay days must be greater than 0"],
|
|
183
|
+
"onUpdate:modelValue": y[3] || (y[3] = (c) => {
|
|
184
|
+
e.value.delayDay = c.delayDay;
|
|
185
|
+
})
|
|
186
|
+
}, null, 8, ["model-value", "rules"])
|
|
187
|
+
])
|
|
188
|
+
], 64);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}), tt = {
|
|
192
|
+
key: 0,
|
|
193
|
+
class: "flex flex-col h-full"
|
|
194
|
+
}, at = { class: "flex flex-col gap-[16px] pb-[24px]" }, lt = { class: "flex flex-row justify-between items-center gap-2" }, ot = { class: "flex flex-row gap-2 items-center" }, nt = { class: "relative group cursor-pointer" }, st = { class: "flex flex-col gap-16 pt-[24px] overflow-scroll" }, it = { class: "flex flex-row items-center justify-between gap-2" }, rt = { class: "w-[25%]" }, mt = { class: "flex flex-col gap-[16px]" }, dt = { class: "flex flex-row items-center max-w-[100%] justify-between" }, ut = { class: "flex-grow" }, pt = { class: "flex flex-row items-center max-w-[100%] justify-between" }, ct = { class: "flex flex-col gap-[16px]" }, ft = { class: "flex flex-row items-center max-w-[100%] justify-between" }, vt = { class: "flex-grow" }, gt = { class: "flex flex-row items-center max-w-[100%] justify-between" }, yt = { class: "flex-grow" }, xt = {
|
|
195
|
+
key: 0,
|
|
196
|
+
class: "flex flex-row items-center max-w-[100%] justify-between"
|
|
197
|
+
}, _t = { class: "flex-grow" }, wt = { class: "w-[25%]" }, bt = { class: "flex-grow" }, ht = { class: "flex-grow" }, Vt = { class: "w-[25%]" }, kt = { class: "flex-grow" }, St = { class: "w-[25%]" }, $t = { class: "flex-grow" }, Ct = /* @__PURE__ */ z({
|
|
198
|
+
__name: "Setting",
|
|
199
|
+
props: {
|
|
200
|
+
modelValue: { required: !0 },
|
|
201
|
+
modelModifiers: {}
|
|
202
|
+
},
|
|
203
|
+
emits: ["update:modelValue"],
|
|
204
|
+
setup(k) {
|
|
205
|
+
const e = G(k, "modelValue"), g = re(), s = fe(), y = se(), { promptLoader: x } = ye(), { promptMessage: C } = he(), { restaurants: f } = ie(), F = j(!1), i = Y(
|
|
206
|
+
() => f.map((w) => ({ label: w.name, value: w.id }))
|
|
207
|
+
), c = j([]), _ = Y(() => {
|
|
208
|
+
var w, u;
|
|
209
|
+
return F.value ? "Connecting" : (u = (w = e.value) == null ? void 0 : w.platform) != null && u.accessToken ? "Disconnect" : "Connect";
|
|
210
|
+
});
|
|
211
|
+
de(
|
|
212
|
+
() => {
|
|
213
|
+
var w;
|
|
214
|
+
return (w = e.value.platform) == null ? void 0 : w.accessToken;
|
|
215
|
+
},
|
|
216
|
+
(w) => {
|
|
217
|
+
w && V();
|
|
218
|
+
},
|
|
219
|
+
{ immediate: !0 }
|
|
220
|
+
);
|
|
221
|
+
const v = j(0);
|
|
222
|
+
async function V() {
|
|
223
|
+
e.value._id && (c.value = (await Ae(e.value._id)).map((w) => ({
|
|
224
|
+
value: w.id,
|
|
225
|
+
label: w.name
|
|
226
|
+
})));
|
|
227
|
+
}
|
|
228
|
+
async function o() {
|
|
229
|
+
var w, u, N;
|
|
230
|
+
if (F.value)
|
|
231
|
+
g.open({ type: "error", message: "Connecting in progress" });
|
|
232
|
+
else if ((w = e.value.platform) != null && w.accessToken)
|
|
233
|
+
await C({
|
|
234
|
+
message: `Confirm disconnect ${(N = (u = e.value.platform) == null ? void 0 : u.tenant) == null ? void 0 : N.name}`,
|
|
235
|
+
title: "Disconnect Xero"
|
|
236
|
+
}) && (await Ne(e.value._id), await s.getSettings(), c.value = []);
|
|
237
|
+
else if (e.value._id)
|
|
238
|
+
try {
|
|
239
|
+
const K = await Re(e.value._id);
|
|
240
|
+
F.value = !0;
|
|
241
|
+
const L = setInterval(async () => {
|
|
242
|
+
var R;
|
|
243
|
+
v.value += 1;
|
|
244
|
+
try {
|
|
245
|
+
await s.getSettings();
|
|
246
|
+
} finally {
|
|
247
|
+
(v.value === 12 || (R = e.value.platform) != null && R.accessToken) && (F.value = !1, L && clearInterval(L), v.value = 0);
|
|
248
|
+
}
|
|
249
|
+
}, 5e3);
|
|
250
|
+
window.open(K.redirect, "_blank");
|
|
251
|
+
} catch (K) {
|
|
252
|
+
g.open({ type: "error", message: K.message });
|
|
253
|
+
}
|
|
254
|
+
else
|
|
255
|
+
g.open({ type: "error", message: `invalid accounting ${e.value._id}` });
|
|
256
|
+
}
|
|
257
|
+
async function l() {
|
|
258
|
+
await C({
|
|
259
|
+
message: `Confirm delete ${e.value.name}?`,
|
|
260
|
+
title: "Delete"
|
|
261
|
+
}) && await x(async () => {
|
|
262
|
+
try {
|
|
263
|
+
await xe(e.value._id), await s.getSettings(), y.back();
|
|
264
|
+
} catch (u) {
|
|
265
|
+
g.open({ type: "error", message: u.message });
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
async function d() {
|
|
270
|
+
await x(async () => {
|
|
271
|
+
try {
|
|
272
|
+
await _e(e.value._id, e.value), await s.getSettings();
|
|
273
|
+
} catch (w) {
|
|
274
|
+
g.open({ type: "error", message: w.message });
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
function m(w) {
|
|
279
|
+
const u = c.value.find((N) => N.value === w);
|
|
280
|
+
u && e.value.platform && (e.value.platform.tenant = {
|
|
281
|
+
id: u.value,
|
|
282
|
+
name: u.label
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
async function a() {
|
|
286
|
+
await x(async () => {
|
|
287
|
+
try {
|
|
288
|
+
await we(e.value._id), await s.getSettings();
|
|
289
|
+
} catch (w) {
|
|
290
|
+
g.open({ type: "error", message: w.message });
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return (w, u) => {
|
|
295
|
+
var A, X, O, Q, E, W, Z, ee, te, ae, le, S;
|
|
296
|
+
const N = h("FmIcon"), K = h("FmButton"), L = h("FmMenuDivider"), R = h("FmSelect"), M = h("FmTextField"), P = h("FmSwitch");
|
|
297
|
+
return (X = (A = e.value) == null ? void 0 : A.platform) != null && X.mappings ? (p(), $("div", tt, [
|
|
298
|
+
t("div", at, [
|
|
299
|
+
t("div", lt, [
|
|
300
|
+
u[6] || (u[6] = t("div", { class: "fm-typo-en-title-sm-800" }, "Connect", -1)),
|
|
301
|
+
t("div", ot, [
|
|
302
|
+
t("div", nt, [
|
|
303
|
+
n(N, {
|
|
304
|
+
name: "refresh",
|
|
305
|
+
class: "p-2 bg-gray-100 rounded-full",
|
|
306
|
+
onClick: a
|
|
307
|
+
}),
|
|
308
|
+
u[5] || (u[5] = t("span", { class: "absolute left-1/2 -translate-x-2/3 top-full mt-2 w-max bg-gray-900 text-white text-sm px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity" }, " Repopulate the fields based on the dates selected in Preview. ", -1))
|
|
309
|
+
]),
|
|
310
|
+
n(K, {
|
|
311
|
+
variant: "tertiary",
|
|
312
|
+
label: "Delete",
|
|
313
|
+
onClick: l
|
|
314
|
+
}),
|
|
315
|
+
n(K, {
|
|
316
|
+
variant: "primary",
|
|
317
|
+
label: "Update",
|
|
318
|
+
onClick: d
|
|
319
|
+
})
|
|
320
|
+
])
|
|
321
|
+
])
|
|
322
|
+
]),
|
|
323
|
+
n(L, { style: { margin: 0 } }),
|
|
324
|
+
t("div", st, [
|
|
325
|
+
u[15] || (u[15] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Authenticate with your official Xero account to enable FeedMe to securely upload data to Xero. ", -1)),
|
|
326
|
+
t("div", it, [
|
|
327
|
+
t("div", rt, [
|
|
328
|
+
n(K, {
|
|
329
|
+
disabled: F.value,
|
|
330
|
+
variant: "primary",
|
|
331
|
+
label: _.value,
|
|
332
|
+
onClick: o
|
|
333
|
+
}, null, 8, ["disabled", "label"])
|
|
334
|
+
]),
|
|
335
|
+
c.value.length > 0 ? (p(), I(R, {
|
|
336
|
+
key: 0,
|
|
337
|
+
class: "flex-grow",
|
|
338
|
+
items: c.value,
|
|
339
|
+
"model-value": (O = e.value.platform.tenant) == null ? void 0 : O.id,
|
|
340
|
+
placeholder: "Select tenant",
|
|
341
|
+
"onUpdate:modelValue": m
|
|
342
|
+
}, null, 8, ["items", "model-value"])) : H("", !0)
|
|
343
|
+
]),
|
|
344
|
+
t("div", mt, [
|
|
345
|
+
u[9] || (u[9] = t("div", { class: "flex flex-row items-center fm-typo-en-title-sm-800 h-[36px]" }, "General", -1)),
|
|
346
|
+
t("div", dt, [
|
|
347
|
+
u[7] || (u[7] = t("div", { class: "w-[25%]" }, "Name", -1)),
|
|
348
|
+
t("div", ut, [
|
|
349
|
+
n(M, {
|
|
350
|
+
modelValue: e.value.name,
|
|
351
|
+
"onUpdate:modelValue": u[0] || (u[0] = (r) => e.value.name = r)
|
|
352
|
+
}, null, 8, ["modelValue"])
|
|
353
|
+
])
|
|
354
|
+
]),
|
|
355
|
+
t("div", pt, [
|
|
356
|
+
u[8] || (u[8] = t("div", { class: "w-[25%]" }, "Location", -1)),
|
|
357
|
+
n(R, {
|
|
358
|
+
modelValue: e.value.platform.locationIds,
|
|
359
|
+
"onUpdate:modelValue": u[1] || (u[1] = (r) => e.value.platform.locationIds = r),
|
|
360
|
+
multiselect: !0,
|
|
361
|
+
items: i.value,
|
|
362
|
+
placeholder: "Select location",
|
|
363
|
+
class: "flex-grow"
|
|
364
|
+
}, null, 8, ["modelValue", "items"])
|
|
365
|
+
])
|
|
366
|
+
]),
|
|
367
|
+
t("div", ct, [
|
|
368
|
+
u[13] || (u[13] = t("div", { class: "flex flex-row items-center fm-typo-en-title-sm-800 h-[36px]" }, "Mapping", -1)),
|
|
369
|
+
t("div", ft, [
|
|
370
|
+
u[10] || (u[10] = t("div", { class: "w-[25%]" }, "Contact", -1)),
|
|
371
|
+
t("div", vt, [
|
|
372
|
+
n(M, {
|
|
373
|
+
modelValue: e.value.platform.mappings.contact.xero.key,
|
|
374
|
+
"onUpdate:modelValue": u[2] || (u[2] = (r) => e.value.platform.mappings.contact.xero.key = r),
|
|
375
|
+
placeholder: "Contact account number"
|
|
376
|
+
}, null, 8, ["modelValue"])
|
|
377
|
+
])
|
|
378
|
+
]),
|
|
379
|
+
t("div", gt, [
|
|
380
|
+
u[11] || (u[11] = t("div", { class: "w-[25%]" }, "Discount as Item", -1)),
|
|
381
|
+
t("div", yt, [
|
|
382
|
+
n(P, {
|
|
383
|
+
"model-value": e.value.platform.discountItem ?? !1,
|
|
384
|
+
style: { gap: 0 },
|
|
385
|
+
"onUpdate:modelValue": u[3] || (u[3] = (r) => {
|
|
386
|
+
e.value.platform.discountItem = r;
|
|
387
|
+
})
|
|
388
|
+
}, null, 8, ["model-value"])
|
|
389
|
+
])
|
|
390
|
+
]),
|
|
391
|
+
e.value.platform.mappings.rounding ? (p(), $("div", xt, [
|
|
392
|
+
u[12] || (u[12] = t("div", { class: "w-[25%]" }, "Rounding", -1)),
|
|
393
|
+
t("div", _t, [
|
|
394
|
+
n(M, {
|
|
395
|
+
modelValue: e.value.platform.mappings.rounding.xero.key,
|
|
396
|
+
"onUpdate:modelValue": u[4] || (u[4] = (r) => e.value.platform.mappings.rounding.xero.key = r),
|
|
397
|
+
placeholder: "Item account code"
|
|
398
|
+
}, null, 8, ["modelValue"])
|
|
399
|
+
])
|
|
400
|
+
])) : H("", !0),
|
|
401
|
+
(p(!0), $(B, null, q((W = (E = (Q = e.value) == null ? void 0 : Q.platform) == null ? void 0 : E.mappings) == null ? void 0 : W.items, (r, b) => (p(), $("div", {
|
|
402
|
+
key: `item-${b}`,
|
|
403
|
+
class: "flex flex-row items-center max-w-[100%] justify-between"
|
|
404
|
+
}, [
|
|
405
|
+
t("div", wt, pe(r.feedme.name), 1),
|
|
406
|
+
t("div", bt, [
|
|
407
|
+
r.xeroTax ? (p(), I(M, {
|
|
408
|
+
key: 0,
|
|
409
|
+
modelValue: r.xeroTax.key,
|
|
410
|
+
"onUpdate:modelValue": (T) => r.xeroTax.key = T,
|
|
411
|
+
placeholder: "Tax name"
|
|
412
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : H("", !0)
|
|
413
|
+
]),
|
|
414
|
+
t("div", ht, [
|
|
415
|
+
n(M, {
|
|
416
|
+
modelValue: r.xero.key,
|
|
417
|
+
"onUpdate:modelValue": (T) => r.xero.key = T,
|
|
418
|
+
placeholder: "Item account code"
|
|
419
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
420
|
+
])
|
|
421
|
+
]))), 128)),
|
|
422
|
+
(p(!0), $(B, null, q((te = (ee = (Z = e.value) == null ? void 0 : Z.platform) == null ? void 0 : ee.mappings) == null ? void 0 : te.charges, (r, b) => (p(), $("div", {
|
|
423
|
+
key: `charge-${b}`,
|
|
424
|
+
class: "flex flex-row items-center max-w-[100%] justify-between"
|
|
425
|
+
}, [
|
|
426
|
+
t("div", Vt, pe(r.feedme.name), 1),
|
|
427
|
+
t("div", kt, [
|
|
428
|
+
n(M, {
|
|
429
|
+
modelValue: r.xero.key,
|
|
430
|
+
"onUpdate:modelValue": (T) => r.xero.key = T,
|
|
431
|
+
placeholder: "Item account code"
|
|
432
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
433
|
+
])
|
|
434
|
+
]))), 128)),
|
|
435
|
+
u[14] || (u[14] = t("div", { class: "flex flex-row items-center fm-typo-en-title-sm-800 h-[36px]" }, "Payments", -1)),
|
|
436
|
+
(p(!0), $(B, null, q((S = (le = (ae = e.value) == null ? void 0 : ae.platform) == null ? void 0 : le.mappings) == null ? void 0 : S.payments, (r, b) => (p(), $("div", {
|
|
437
|
+
key: `payment-${b}`,
|
|
438
|
+
class: "flex flex-row items-center max-w-[100%] justify-between"
|
|
439
|
+
}, [
|
|
440
|
+
t("div", St, pe(r.feedme.name), 1),
|
|
441
|
+
t("div", $t, [
|
|
442
|
+
n(M, {
|
|
443
|
+
modelValue: r.xero.key,
|
|
444
|
+
"onUpdate:modelValue": (T) => r.xero.key = T,
|
|
445
|
+
placeholder: "Payment account code"
|
|
446
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])
|
|
447
|
+
])
|
|
448
|
+
]))), 128))
|
|
449
|
+
])
|
|
450
|
+
])
|
|
451
|
+
])) : H("", !0);
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}), Ft = { class: "h-full flex flex-col gap-16" }, Dt = { class: "flex flex-row gap-2 justify-between items-center" }, Ut = {
|
|
455
|
+
key: 0,
|
|
456
|
+
class: "flex gap-24 w-full h-full justify-center items-center overflow-scroll"
|
|
457
|
+
}, Tt = /* @__PURE__ */ z({
|
|
458
|
+
__name: "Preview",
|
|
459
|
+
props: {
|
|
460
|
+
modelValue: { required: !0 },
|
|
461
|
+
modelModifiers: {}
|
|
462
|
+
},
|
|
463
|
+
emits: ["update:modelValue"],
|
|
464
|
+
setup(k) {
|
|
465
|
+
const e = j([]), g = Y(
|
|
466
|
+
() => e.value.reduce((i, c) => {
|
|
467
|
+
const _ = i.length, { invoice: v, payments: V } = c;
|
|
468
|
+
i[_] = {
|
|
469
|
+
date: v.Date,
|
|
470
|
+
contact: v.Contact.ContactID,
|
|
471
|
+
status: v.Status,
|
|
472
|
+
ref: v.Reference
|
|
473
|
+
};
|
|
474
|
+
for (let o = 0; o < Math.max(v.LineItems.length, V.length); o++) {
|
|
475
|
+
const l = _ + o;
|
|
476
|
+
i[l] || (i[l] = {}), v.LineItems[o] && (i[l] = {
|
|
477
|
+
...i[l],
|
|
478
|
+
itemDescription: v.LineItems[o].Description,
|
|
479
|
+
itemQuantity: v.LineItems[o].Quantity,
|
|
480
|
+
itemUnitAmount: v.LineItems[o].UnitAmount,
|
|
481
|
+
itemCode: v.LineItems[o].ItemCode,
|
|
482
|
+
itemAccount: v.LineItems[o].AccountCode,
|
|
483
|
+
itemTax: v.LineItems[o].TaxAmount,
|
|
484
|
+
itemTaxType: v.LineItems[o].TaxType,
|
|
485
|
+
itemAmount: v.LineItems[o].LineAmount,
|
|
486
|
+
itemDiscount: v.LineItems[o].DiscountAmount
|
|
487
|
+
}), V[o] && (i[l] = {
|
|
488
|
+
...i[l],
|
|
489
|
+
paymentAccount: V[o].Account.Code,
|
|
490
|
+
paymentReference: V[o].Reference,
|
|
491
|
+
paymentAmount: V[o].Amount
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
return i;
|
|
495
|
+
}, [])
|
|
496
|
+
), s = [
|
|
497
|
+
{
|
|
498
|
+
accessorKey: "date",
|
|
499
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
500
|
+
enableSorting: !1
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
accessorKey: "status",
|
|
504
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Status"),
|
|
505
|
+
enableSorting: !1
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
accessorKey: "ref",
|
|
509
|
+
header: "Reference",
|
|
510
|
+
enableSorting: !1
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
accessorKey: "itemDescription",
|
|
514
|
+
header: () => D("p", { class: "min-w-[140px] text-nowrap text-ellipsis" }, "Item Description"),
|
|
515
|
+
enableSorting: !1
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
accessorKey: "itemQuantity",
|
|
519
|
+
header: "Item Quantity",
|
|
520
|
+
enableSorting: !1
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
accessorKey: "itemUnitAmount",
|
|
524
|
+
header: "Item Unit Amount",
|
|
525
|
+
enableSorting: !1
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
accessorKey: "itemCode",
|
|
529
|
+
header: "Item Code",
|
|
530
|
+
enableSorting: !1
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
accessorKey: "itemAccount",
|
|
534
|
+
header: () => D("p", { class: "min-w-[100px] text-nowrap text-ellipsis" }, "Item Account"),
|
|
535
|
+
enableSorting: !1
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
accessorKey: "itemTaxType",
|
|
539
|
+
header: "Item Tax Type",
|
|
540
|
+
enableSorting: !1
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
accessorKey: "itemTax",
|
|
544
|
+
header: "Item Tax",
|
|
545
|
+
enableSorting: !1
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
accessorKey: "itemAmount",
|
|
549
|
+
header: "Item Amount",
|
|
550
|
+
enableSorting: !1
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
accessorKey: "itemDiscount",
|
|
554
|
+
header: "Item Discount",
|
|
555
|
+
enableSorting: !1
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
accessorKey: "paymentAccount",
|
|
559
|
+
header: "Payment Account",
|
|
560
|
+
enableSorting: !1
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
accessorKey: "paymentReference",
|
|
564
|
+
header: "Payment Reference",
|
|
565
|
+
enableSorting: !1
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
accessorKey: "paymentAmount",
|
|
569
|
+
header: "Payment Amount",
|
|
570
|
+
enableSorting: !1
|
|
571
|
+
}
|
|
572
|
+
], y = G(k, "modelValue"), x = j(!1), C = re(), { dateRange: f } = Ve(ie());
|
|
573
|
+
de(
|
|
574
|
+
() => f.value,
|
|
575
|
+
async () => {
|
|
576
|
+
if (y.value._id)
|
|
577
|
+
try {
|
|
578
|
+
x.value = !0, e.value = await be(y.value._id);
|
|
579
|
+
} catch (i) {
|
|
580
|
+
C.open({ message: i.message, type: "error" });
|
|
581
|
+
} finally {
|
|
582
|
+
x.value = !1;
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
immediate: !0
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
async function F() {
|
|
590
|
+
try {
|
|
591
|
+
y.value._id ? (x.value = !0, await Ce(y.value._id), C.open({ message: "Upload successful", type: "success" })) : C.open({ message: "Invalid accounting setting", type: "error" });
|
|
592
|
+
} catch {
|
|
593
|
+
C.open({ message: "Failed to upload", type: "error" });
|
|
594
|
+
} finally {
|
|
595
|
+
x.value = !1;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return (i, c) => {
|
|
599
|
+
const _ = h("FmButton"), v = h("FmCircularProgress"), V = h("FmTable");
|
|
600
|
+
return p(), $("div", Ft, [
|
|
601
|
+
t("div", Dt, [
|
|
602
|
+
n(ke, {
|
|
603
|
+
"date-range": J(f),
|
|
604
|
+
"onUpdate:dateRange": c[0] || (c[0] = (o) => ge(f) ? f.value = o : null),
|
|
605
|
+
compare: !1
|
|
606
|
+
}, null, 8, ["date-range"]),
|
|
607
|
+
n(_, {
|
|
608
|
+
loading: x.value,
|
|
609
|
+
variant: "primary",
|
|
610
|
+
label: "Upload",
|
|
611
|
+
onClick: F
|
|
612
|
+
}, null, 8, ["loading"])
|
|
613
|
+
]),
|
|
614
|
+
x.value ? (p(), $("div", Ut, [
|
|
615
|
+
n(v, { size: "xl" }),
|
|
616
|
+
c[1] || (c[1] = t("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Loading data... ", -1))
|
|
617
|
+
])) : g.value.length > 0 ? (p(), I(V, {
|
|
618
|
+
key: 1,
|
|
619
|
+
class: "flex overflow-scroll",
|
|
620
|
+
"row-data": g.value,
|
|
621
|
+
"column-defs": s
|
|
622
|
+
}, null, 8, ["row-data"])) : H("", !0)
|
|
623
|
+
]);
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
}), It = { class: "h-full relative flex flex-col" }, Pt = { class: "py-16 px-16 overflow-hidden flex-grow relative" }, Kt = /* @__PURE__ */ z({
|
|
627
|
+
__name: "Xero",
|
|
628
|
+
props: {
|
|
629
|
+
modelValue: {},
|
|
630
|
+
modelModifiers: {}
|
|
631
|
+
},
|
|
632
|
+
emits: ["update:modelValue"],
|
|
633
|
+
setup(k) {
|
|
634
|
+
const e = G(k, "modelValue"), g = j("setting"), s = [
|
|
635
|
+
{
|
|
636
|
+
label: "Setting",
|
|
637
|
+
value: "setting",
|
|
638
|
+
icon: "settings"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
label: "Preview",
|
|
642
|
+
value: "preview",
|
|
643
|
+
icon: "table"
|
|
644
|
+
}
|
|
645
|
+
], y = se(), x = Y(() => {
|
|
646
|
+
switch (g.value) {
|
|
647
|
+
case "preview":
|
|
648
|
+
return Tt;
|
|
649
|
+
case "setting":
|
|
650
|
+
return Ct;
|
|
651
|
+
default:
|
|
652
|
+
return null;
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
return (C, f) => {
|
|
656
|
+
var c;
|
|
657
|
+
const F = h("FmPageHead"), i = h("FmTabs");
|
|
658
|
+
return p(), $("div", It, [
|
|
659
|
+
n(F, {
|
|
660
|
+
title: ((c = e.value) == null ? void 0 : c.name) || "Xero",
|
|
661
|
+
"back-button": !0,
|
|
662
|
+
style: { paddingLeft: "0px", paddingRight: "0px" },
|
|
663
|
+
"onClick:back": J(y).back
|
|
664
|
+
}, {
|
|
665
|
+
description: ue(() => f[2] || (f[2] = [
|
|
666
|
+
t("div", null, null, -1)
|
|
667
|
+
])),
|
|
668
|
+
_: 1
|
|
669
|
+
}, 8, ["title", "onClick:back"]),
|
|
670
|
+
n(i, {
|
|
671
|
+
"model-value": g.value,
|
|
672
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => g.value = _),
|
|
673
|
+
items: s
|
|
674
|
+
}, null, 8, ["model-value"]),
|
|
675
|
+
t("div", Pt, [
|
|
676
|
+
(p(), I(ce(x.value), {
|
|
677
|
+
modelValue: e.value,
|
|
678
|
+
"onUpdate:modelValue": f[1] || (f[1] = (_) => e.value = _)
|
|
679
|
+
}, null, 8, ["modelValue"]))
|
|
680
|
+
])
|
|
681
|
+
]);
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
}), Mt = {
|
|
685
|
+
key: 0,
|
|
686
|
+
class: "flex flex-col h-full"
|
|
687
|
+
}, At = { class: "flex flex-col gap-16 pb-[24px]" }, Nt = { class: "flex flex-row justify-between items-center gap-2" }, Rt = { class: "flex flex-row gap-2 items-center" }, Bt = { class: "relative group cursor-pointer" }, jt = { class: "flex flex-col gap-24 pt-[24px] overflow-scroll" }, Lt = { class: "flex flex-row items-center justify-between" }, Ot = { class: "flex-grow" }, Et = { class: "flex flex-row items-center justify-between" }, Ht = { class: "flex-grow" }, Yt = { class: "flex flex-col gap-16" }, qt = { class: "flex flex-row items-center max-w-[100%]" }, zt = { class: "flex-grow" }, Gt = { class: "flex flex-row items-center max-w-[100%]" }, Qt = { class: "flex flex-row items-center max-w-[100%]" }, Xt = { class: "flex flex-col gap-16" }, Jt = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Wt = { class: "flex flex-row items-center gap-x-16" }, Zt = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, ea = { class: "flex flex-row items-center gap-x-16" }, ta = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, aa = { class: "flex flex-row items-center gap-x-16" }, la = { class: "flex flex-row items-center" }, oa = /* @__PURE__ */ z({
|
|
688
|
+
__name: "Setting",
|
|
689
|
+
props: {
|
|
690
|
+
modelValue: { required: !0 },
|
|
691
|
+
modelModifiers: {}
|
|
692
|
+
},
|
|
693
|
+
emits: ["update:modelValue"],
|
|
694
|
+
setup(k) {
|
|
695
|
+
const e = G(k, "modelValue"), g = re(), s = fe(), y = se(), { promptLoader: x } = ye(), { promptMessage: C } = he(), { restaurants: f } = ie(), F = Y(
|
|
696
|
+
() => f.map((m) => ({ label: m.name, value: m.id }))
|
|
697
|
+
);
|
|
698
|
+
async function i() {
|
|
699
|
+
await C({
|
|
700
|
+
message: `Confirm delete ${e.value.name}?`,
|
|
701
|
+
title: "Delete"
|
|
702
|
+
}) && await x(async () => {
|
|
703
|
+
try {
|
|
704
|
+
await xe(e.value._id), await s.getSettings(), y.back();
|
|
705
|
+
} catch (a) {
|
|
706
|
+
g.open({ type: "error", message: a.message });
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
async function c() {
|
|
711
|
+
await x(async () => {
|
|
712
|
+
try {
|
|
713
|
+
await _e(e.value._id, e.value), await s.getSettings();
|
|
714
|
+
} catch (m) {
|
|
715
|
+
g.open({ type: "error", message: m.message });
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function _(m, a) {
|
|
720
|
+
var w, u;
|
|
721
|
+
(u = (w = e.value.platform) == null ? void 0 : w.mappings) != null && u[m] && (e.value.platform.mappings[m] = e.value.platform.mappings[m].filter(
|
|
722
|
+
(N, K) => K !== a
|
|
723
|
+
));
|
|
724
|
+
}
|
|
725
|
+
function v(m) {
|
|
726
|
+
var a, w;
|
|
727
|
+
if ((w = (a = e.value.platform) == null ? void 0 : a.mappings) != null && w[m]) {
|
|
728
|
+
let u;
|
|
729
|
+
switch (m) {
|
|
730
|
+
case "items":
|
|
731
|
+
u = {
|
|
732
|
+
key: "",
|
|
733
|
+
account: "",
|
|
734
|
+
accountName: ""
|
|
735
|
+
};
|
|
736
|
+
break;
|
|
737
|
+
case "payments":
|
|
738
|
+
u = {
|
|
739
|
+
key: "",
|
|
740
|
+
account: "",
|
|
741
|
+
accountName: "",
|
|
742
|
+
method: ""
|
|
743
|
+
};
|
|
744
|
+
break;
|
|
745
|
+
default:
|
|
746
|
+
u = {
|
|
747
|
+
key: "",
|
|
748
|
+
account: ""
|
|
749
|
+
};
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
e.value.platform.mappings[m] = [
|
|
753
|
+
...e.value.platform.mappings[m],
|
|
754
|
+
u
|
|
755
|
+
];
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
const V = [
|
|
759
|
+
{
|
|
760
|
+
label: "By day",
|
|
761
|
+
value: me.BY_DAY
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
label: "By day and item",
|
|
765
|
+
value: me.BY_DAY_ITEM
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
label: "By invoice",
|
|
769
|
+
value: me.BY_INVOICE
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
label: "By day and separate payment",
|
|
773
|
+
value: me.BY_DAY_SEPARATE_PAYMENT
|
|
774
|
+
}
|
|
775
|
+
];
|
|
776
|
+
function o({
|
|
777
|
+
key: m,
|
|
778
|
+
value: a
|
|
779
|
+
}) {
|
|
780
|
+
var w, u;
|
|
781
|
+
(u = (w = e.value) == null ? void 0 : w.platform) != null && u.mappings && (e.value.platform.mappings[m] = a);
|
|
782
|
+
}
|
|
783
|
+
function l(m) {
|
|
784
|
+
return {
|
|
785
|
+
key: { placeholder: m, editable: !1 },
|
|
786
|
+
account: { placeholder: m, editable: !0 }
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
async function d() {
|
|
790
|
+
await x(async () => {
|
|
791
|
+
try {
|
|
792
|
+
await we(e.value._id), await s.getSettings();
|
|
793
|
+
} catch (m) {
|
|
794
|
+
g.open({ type: "error", message: m.message });
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
return (m, a) => {
|
|
799
|
+
var M, P, A, X, O, Q, E, W, Z, ee, te, ae, le, S;
|
|
800
|
+
const w = h("FmIcon"), u = h("FmButton"), N = h("FmMenuDivider"), K = h("FmTextField"), L = h("FmSelect"), R = h("FmCheckbox");
|
|
801
|
+
return (P = (M = e.value) == null ? void 0 : M.platform) != null && P.mappings ? (p(), $("div", Mt, [
|
|
802
|
+
t("div", At, [
|
|
803
|
+
t("div", Nt, [
|
|
804
|
+
a[16] || (a[16] = t("div", { class: "fm-typo-en-title-sm-800" }, "Connect", -1)),
|
|
805
|
+
t("div", Rt, [
|
|
806
|
+
t("div", Bt, [
|
|
807
|
+
n(w, {
|
|
808
|
+
name: "refresh",
|
|
809
|
+
class: "p-2 bg-gray-100 rounded-full",
|
|
810
|
+
onClick: d
|
|
811
|
+
}),
|
|
812
|
+
a[15] || (a[15] = t("span", { class: "absolute left-1/2 -translate-x-2/3 top-full mt-2 w-max bg-gray-900 text-white text-sm px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity" }, " Repopulate the fields based on the dates selected in Preview. ", -1))
|
|
813
|
+
]),
|
|
814
|
+
n(u, {
|
|
815
|
+
variant: "tertiary",
|
|
816
|
+
label: "Delete",
|
|
817
|
+
onClick: i
|
|
818
|
+
}),
|
|
819
|
+
n(u, {
|
|
820
|
+
variant: "primary",
|
|
821
|
+
label: "Update",
|
|
822
|
+
onClick: c
|
|
823
|
+
})
|
|
824
|
+
])
|
|
825
|
+
])
|
|
826
|
+
]),
|
|
827
|
+
n(N, { style: { margin: 0 } }),
|
|
828
|
+
t("div", jt, [
|
|
829
|
+
a[26] || (a[26] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Authenticate with your official Bukku account to enable FeedMe to securely upload data to Bukku. ", -1)),
|
|
830
|
+
t("div", Lt, [
|
|
831
|
+
a[17] || (a[17] = t("div", { class: "w-[25%]" }, "Subdomain", -1)),
|
|
832
|
+
t("div", Ot, [
|
|
833
|
+
n(K, {
|
|
834
|
+
modelValue: e.value.platform.subdomain,
|
|
835
|
+
"onUpdate:modelValue": a[0] || (a[0] = (r) => e.value.platform.subdomain = r),
|
|
836
|
+
placeholder: "Subdomain"
|
|
837
|
+
}, null, 8, ["modelValue"])
|
|
838
|
+
])
|
|
839
|
+
]),
|
|
840
|
+
t("div", Et, [
|
|
841
|
+
a[18] || (a[18] = t("div", { class: "w-[25%]" }, "Token", -1)),
|
|
842
|
+
t("div", Ht, [
|
|
843
|
+
n(K, {
|
|
844
|
+
modelValue: e.value.platform.token,
|
|
845
|
+
"onUpdate:modelValue": a[1] || (a[1] = (r) => e.value.platform.token = r),
|
|
846
|
+
placeholder: "Token"
|
|
847
|
+
}, null, 8, ["modelValue"])
|
|
848
|
+
])
|
|
849
|
+
]),
|
|
850
|
+
t("div", Yt, [
|
|
851
|
+
a[22] || (a[22] = t("div", { class: "fm-typo-en-title-sm-800" }, "General", -1)),
|
|
852
|
+
t("div", qt, [
|
|
853
|
+
a[19] || (a[19] = t("div", { class: "w-[25%]" }, "Name", -1)),
|
|
854
|
+
t("div", zt, [
|
|
855
|
+
n(K, {
|
|
856
|
+
modelValue: e.value.name,
|
|
857
|
+
"onUpdate:modelValue": a[2] || (a[2] = (r) => e.value.name = r)
|
|
858
|
+
}, null, 8, ["modelValue"])
|
|
859
|
+
])
|
|
860
|
+
]),
|
|
861
|
+
t("div", Gt, [
|
|
862
|
+
a[20] || (a[20] = t("div", { class: "w-[25%]" }, "Location", -1)),
|
|
863
|
+
n(L, {
|
|
864
|
+
modelValue: e.value.platform.locationIds,
|
|
865
|
+
"onUpdate:modelValue": a[3] || (a[3] = (r) => e.value.platform.locationIds = r),
|
|
866
|
+
multiselect: !0,
|
|
867
|
+
items: F.value,
|
|
868
|
+
placeholder: "Select location",
|
|
869
|
+
class: "flex-grow"
|
|
870
|
+
}, null, 8, ["modelValue", "items"])
|
|
871
|
+
]),
|
|
872
|
+
t("div", Qt, [
|
|
873
|
+
a[21] || (a[21] = t("div", { class: "w-[25%]" }, "Grouping", -1)),
|
|
874
|
+
n(L, {
|
|
875
|
+
modelValue: e.value.platform.grouping,
|
|
876
|
+
"onUpdate:modelValue": a[4] || (a[4] = (r) => e.value.platform.grouping = r),
|
|
877
|
+
multiselect: !1,
|
|
878
|
+
items: V,
|
|
879
|
+
placeholder: "Select grouping",
|
|
880
|
+
class: "flex-grow"
|
|
881
|
+
}, null, 8, ["modelValue"])
|
|
882
|
+
])
|
|
883
|
+
]),
|
|
884
|
+
t("div", Xt, [
|
|
885
|
+
t("div", Jt, [
|
|
886
|
+
n(U, {
|
|
887
|
+
"model-value": {
|
|
888
|
+
key: "Contact",
|
|
889
|
+
account: e.value.platform.mappings.contact.account
|
|
890
|
+
},
|
|
891
|
+
options: {
|
|
892
|
+
key: { placeholder: "Contact", editable: !1 },
|
|
893
|
+
account: { placeholder: "Contact", editable: !0 }
|
|
894
|
+
},
|
|
895
|
+
"onUpdate:modelValue": a[5] || (a[5] = (r) => {
|
|
896
|
+
var b, T, oe;
|
|
897
|
+
(oe = (T = (b = e.value) == null ? void 0 : b.platform) == null ? void 0 : T.mappings) != null && oe.contact && (e.value.platform.mappings.contact.account = r.account);
|
|
898
|
+
})
|
|
899
|
+
}, null, 8, ["model-value"]),
|
|
900
|
+
n(U, {
|
|
901
|
+
"model-value": {
|
|
902
|
+
key: "Invoice no",
|
|
903
|
+
account: e.value.platform.mappings.invoiceDocNo
|
|
904
|
+
},
|
|
905
|
+
options: l("Invoice no"),
|
|
906
|
+
"onUpdate:modelValue": a[6] || (a[6] = (r) => o({ key: "invoiceDocNo", value: r.account }))
|
|
907
|
+
}, null, 8, ["model-value", "options"]),
|
|
908
|
+
n(U, {
|
|
909
|
+
"model-value": {
|
|
910
|
+
key: "Credit note no",
|
|
911
|
+
account: e.value.platform.mappings.creditNoteDocNo
|
|
912
|
+
},
|
|
913
|
+
options: l("Credit note no"),
|
|
914
|
+
"onUpdate:modelValue": a[7] || (a[7] = (r) => o({ key: "creditNoteDocNo", value: r.account }))
|
|
915
|
+
}, null, 8, ["model-value", "options"]),
|
|
916
|
+
n(U, {
|
|
917
|
+
"model-value": {
|
|
918
|
+
key: "Payment no",
|
|
919
|
+
account: e.value.platform.mappings.paymentDocNo
|
|
920
|
+
},
|
|
921
|
+
options: l("Payment no"),
|
|
922
|
+
"onUpdate:modelValue": a[8] || (a[8] = (r) => o({ key: "paymentDocNo", value: r.account }))
|
|
923
|
+
}, null, 8, ["model-value", "options"]),
|
|
924
|
+
n(U, {
|
|
925
|
+
"model-value": {
|
|
926
|
+
key: "Refund no",
|
|
927
|
+
account: e.value.platform.mappings.refundDocNo
|
|
928
|
+
},
|
|
929
|
+
options: l("Refund no"),
|
|
930
|
+
"onUpdate:modelValue": a[9] || (a[9] = (r) => o({ key: "refundDocNo", value: r.account }))
|
|
931
|
+
}, null, 8, ["model-value", "options"]),
|
|
932
|
+
n(U, {
|
|
933
|
+
"model-value": {
|
|
934
|
+
key: "Rounding",
|
|
935
|
+
account: e.value.platform.mappings.rounding.account
|
|
936
|
+
},
|
|
937
|
+
options: l("Rounding"),
|
|
938
|
+
"onUpdate:modelValue": a[10] || (a[10] = (r) => {
|
|
939
|
+
var b, T, oe;
|
|
940
|
+
(oe = (T = (b = e.value) == null ? void 0 : b.platform) == null ? void 0 : T.mappings) != null && oe.rounding && (e.value.platform.mappings.rounding.account = r.account);
|
|
941
|
+
})
|
|
942
|
+
}, null, 8, ["model-value", "options"]),
|
|
943
|
+
(p(!0), $(B, null, q((O = (X = (A = e.value) == null ? void 0 : A.platform) == null ? void 0 : X.mappings) == null ? void 0 : O.charges, (r, b) => (p(), I(U, {
|
|
944
|
+
key: `charge-${b}`,
|
|
945
|
+
modelValue: e.value.platform.mappings.charges[b],
|
|
946
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.charges[b] = T,
|
|
947
|
+
options: {
|
|
948
|
+
key: { placeholder: "Key", editable: !1 },
|
|
949
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
950
|
+
}
|
|
951
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
952
|
+
])
|
|
953
|
+
]),
|
|
954
|
+
n($e, {
|
|
955
|
+
modelValue: e.value.platform,
|
|
956
|
+
"onUpdate:modelValue": a[11] || (a[11] = (r) => e.value.platform = r),
|
|
957
|
+
label: "upload"
|
|
958
|
+
}, null, 8, ["modelValue"]),
|
|
959
|
+
t("div", Wt, [
|
|
960
|
+
a[23] || (a[23] = t("div", { class: "fm-typo-en-title-sm-800" }, "Items", -1)),
|
|
961
|
+
n(u, {
|
|
962
|
+
variant: "primary",
|
|
963
|
+
icon: "add",
|
|
964
|
+
onClick: a[12] || (a[12] = () => v("items"))
|
|
965
|
+
})
|
|
966
|
+
]),
|
|
967
|
+
t("div", Zt, [
|
|
968
|
+
(p(!0), $(B, null, q((W = (E = (Q = e.value) == null ? void 0 : Q.platform) == null ? void 0 : E.mappings) == null ? void 0 : W.items, (r, b) => (p(), I(U, {
|
|
969
|
+
key: `item-${b}`,
|
|
970
|
+
modelValue: e.value.platform.mappings.items[b],
|
|
971
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.items[b] = T,
|
|
972
|
+
options: {
|
|
973
|
+
key: { placeholder: "Key", editable: !0 },
|
|
974
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
975
|
+
},
|
|
976
|
+
removable: !0,
|
|
977
|
+
onRemove: () => _("items", b)
|
|
978
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
979
|
+
]),
|
|
980
|
+
t("div", ea, [
|
|
981
|
+
a[24] || (a[24] = t("div", { class: "fm-typo-en-title-sm-800" }, "Taxes", -1)),
|
|
982
|
+
n(u, {
|
|
983
|
+
variant: "primary",
|
|
984
|
+
icon: "add",
|
|
985
|
+
onClick: a[13] || (a[13] = () => v("taxes"))
|
|
986
|
+
})
|
|
987
|
+
]),
|
|
988
|
+
t("div", ta, [
|
|
989
|
+
(p(!0), $(B, null, q((te = (ee = (Z = e.value) == null ? void 0 : Z.platform) == null ? void 0 : ee.mappings) == null ? void 0 : te.taxes, (r, b) => (p(), I(U, {
|
|
990
|
+
key: `tax-${b}`,
|
|
991
|
+
modelValue: e.value.platform.mappings.taxes[b],
|
|
992
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.taxes[b] = T,
|
|
993
|
+
options: {
|
|
994
|
+
key: { placeholder: "Key", editable: !0 },
|
|
995
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
996
|
+
},
|
|
997
|
+
removable: !0,
|
|
998
|
+
onRemove: () => _("taxes", b)
|
|
999
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
1000
|
+
]),
|
|
1001
|
+
t("div", aa, [
|
|
1002
|
+
a[25] || (a[25] = t("div", { class: "fm-typo-en-title-sm-800" }, "Payments", -1)),
|
|
1003
|
+
n(u, {
|
|
1004
|
+
variant: "primary",
|
|
1005
|
+
icon: "add",
|
|
1006
|
+
onClick: a[14] || (a[14] = () => v("payments"))
|
|
1007
|
+
})
|
|
1008
|
+
]),
|
|
1009
|
+
(p(!0), $(B, null, q((S = (le = (ae = e.value) == null ? void 0 : ae.platform) == null ? void 0 : le.mappings) == null ? void 0 : S.payments, (r, b) => (p(), $("div", {
|
|
1010
|
+
key: `payment-${b}`,
|
|
1011
|
+
class: "grid-cols-1 grid gap-x-16"
|
|
1012
|
+
}, [
|
|
1013
|
+
t("div", la, [
|
|
1014
|
+
n(R, {
|
|
1015
|
+
"model-value": !e.value.platform.mappings.payments[b].skip,
|
|
1016
|
+
value: "",
|
|
1017
|
+
"onUpdate:modelValue": (T) => {
|
|
1018
|
+
var oe, Se;
|
|
1019
|
+
(Se = (oe = e.value.platform) == null ? void 0 : oe.mappings) != null && Se.payments[b] && (e.value.platform.mappings.payments[b].skip = !T);
|
|
1020
|
+
}
|
|
1021
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1022
|
+
n(U, {
|
|
1023
|
+
modelValue: e.value.platform.mappings.payments[b],
|
|
1024
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.payments[b] = T,
|
|
1025
|
+
options: {
|
|
1026
|
+
key: { placeholder: "Key", editable: !0 },
|
|
1027
|
+
method: { placeholder: "Method", editable: !0 },
|
|
1028
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
1029
|
+
},
|
|
1030
|
+
removable: !0,
|
|
1031
|
+
onRemove: () => _("payments", b)
|
|
1032
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"])
|
|
1033
|
+
])
|
|
1034
|
+
]))), 128))
|
|
1035
|
+
])
|
|
1036
|
+
])) : H("", !0);
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
}), na = { class: "h-full flex flex-col gap-16" }, sa = { class: "flex flex-row gap-2 justify-between items-center" }, ia = {
|
|
1040
|
+
key: 0,
|
|
1041
|
+
class: "flex gap-24 w-full h-full justify-center items-center overflow-scroll"
|
|
1042
|
+
}, ra = /* @__PURE__ */ z({
|
|
1043
|
+
__name: "Preview",
|
|
1044
|
+
props: {
|
|
1045
|
+
modelValue: { required: !0 },
|
|
1046
|
+
modelModifiers: {}
|
|
1047
|
+
},
|
|
1048
|
+
emits: ["update:modelValue"],
|
|
1049
|
+
setup(k) {
|
|
1050
|
+
const e = j([]), g = Y(
|
|
1051
|
+
() => e.value.reduce((i, c) => {
|
|
1052
|
+
const _ = i.length, { invoice: v, payments: V } = c;
|
|
1053
|
+
i[_] = {
|
|
1054
|
+
no: v.number,
|
|
1055
|
+
date: v.date,
|
|
1056
|
+
contact: v._contact_name,
|
|
1057
|
+
status: v.status,
|
|
1058
|
+
title: v.title
|
|
1059
|
+
};
|
|
1060
|
+
for (let o = 0; o < Math.max(v.form_items.length, V.length); o++) {
|
|
1061
|
+
const l = _ + o;
|
|
1062
|
+
i[l] || (i[l] = {});
|
|
1063
|
+
const d = v.form_items[o];
|
|
1064
|
+
d && (i[l] = {
|
|
1065
|
+
...i[l],
|
|
1066
|
+
itemDescription: d.description,
|
|
1067
|
+
itemQuantity: d.quantity,
|
|
1068
|
+
itemUnitPrice: d.unit_price,
|
|
1069
|
+
itemAccount: d._account_name,
|
|
1070
|
+
itemTaxCode: d._tax_code_name,
|
|
1071
|
+
itemDiscount: d.discount
|
|
1072
|
+
});
|
|
1073
|
+
const m = V[o];
|
|
1074
|
+
m && (i[l] = {
|
|
1075
|
+
...i[l],
|
|
1076
|
+
paymentNo: m.number,
|
|
1077
|
+
paymentMethod: m.deposit_items[0]._payment_method_name,
|
|
1078
|
+
paymentAccount: m.deposit_items[0]._account_name,
|
|
1079
|
+
paymentDescription: m.description,
|
|
1080
|
+
paymentAmount: m.amount,
|
|
1081
|
+
paymentSkip: m.skip
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
return i;
|
|
1085
|
+
}, [])
|
|
1086
|
+
), s = [
|
|
1087
|
+
{
|
|
1088
|
+
accessorKey: "date",
|
|
1089
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
1090
|
+
enableSorting: !1
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
accessorKey: "no",
|
|
1094
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "No"),
|
|
1095
|
+
enableSorting: !1
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
accessorKey: "contact",
|
|
1099
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Contact"),
|
|
1100
|
+
enableSorting: !1
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
accessorKey: "status",
|
|
1104
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Status"),
|
|
1105
|
+
enableSorting: !1
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
accessorKey: "title",
|
|
1109
|
+
header: "Title",
|
|
1110
|
+
enableSorting: !1
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
accessorKey: "itemDescription",
|
|
1114
|
+
header: () => D("p", { class: "min-w-[140px] text-nowrap text-ellipsis" }, "Item Description"),
|
|
1115
|
+
enableSorting: !1
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
accessorKey: "itemQuantity",
|
|
1119
|
+
header: "Item Quantity",
|
|
1120
|
+
enableSorting: !1
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
accessorKey: "itemUnitPrice",
|
|
1124
|
+
header: "Item Unit Price",
|
|
1125
|
+
enableSorting: !1
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
accessorKey: "itemAccount",
|
|
1129
|
+
header: () => D("p", { class: "min-w-[100px] text-nowrap text-ellipsis" }, "Item Account"),
|
|
1130
|
+
enableSorting: !1
|
|
1131
|
+
},
|
|
1132
|
+
{
|
|
1133
|
+
accessorKey: "itemTaxCode",
|
|
1134
|
+
header: "Item Tax Code",
|
|
1135
|
+
enableSorting: !1
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
accessorKey: "itemDiscount",
|
|
1139
|
+
header: "Item Discount",
|
|
1140
|
+
enableSorting: !1
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
accessorKey: "paymentNo",
|
|
1144
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment No"),
|
|
1145
|
+
enableSorting: !1
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
accessorKey: "paymentMethod",
|
|
1149
|
+
header: "Payment Method",
|
|
1150
|
+
enableSorting: !1
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
accessorKey: "paymentAccount",
|
|
1154
|
+
header: "Payment Account",
|
|
1155
|
+
enableSorting: !1
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
accessorKey: "paymentDescription",
|
|
1159
|
+
header: "Payment Description",
|
|
1160
|
+
enableSorting: !1
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
accessorKey: "paymentAmount",
|
|
1164
|
+
header: "Payment Amount",
|
|
1165
|
+
enableSorting: !1
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
accessorKey: "paymentSkip",
|
|
1169
|
+
header: "Skip",
|
|
1170
|
+
enableSorting: !1
|
|
1171
|
+
}
|
|
1172
|
+
], y = G(k, "modelValue"), x = j(!1), C = re(), { dateRange: f } = Ve(ie());
|
|
1173
|
+
de(
|
|
1174
|
+
() => f.value,
|
|
1175
|
+
async () => {
|
|
1176
|
+
if (y.value._id)
|
|
1177
|
+
try {
|
|
1178
|
+
x.value = !0, e.value = await be(y.value._id);
|
|
1179
|
+
} catch (i) {
|
|
1180
|
+
C.open({ message: i.message, type: "error" });
|
|
1181
|
+
} finally {
|
|
1182
|
+
x.value = !1;
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
immediate: !0
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
async function F() {
|
|
1190
|
+
try {
|
|
1191
|
+
y.value._id ? (x.value = !0, await Ce(y.value._id), C.open({ message: "Upload successful", type: "success" })) : C.open({ message: "Invalid accounting setting", type: "error" });
|
|
1192
|
+
} catch (i) {
|
|
1193
|
+
C.open({ message: i.message, type: "error" });
|
|
1194
|
+
} finally {
|
|
1195
|
+
x.value = !1;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
return (i, c) => {
|
|
1199
|
+
const _ = h("FmButton"), v = h("FmCircularProgress"), V = h("FmTable");
|
|
1200
|
+
return p(), $("div", na, [
|
|
1201
|
+
t("div", sa, [
|
|
1202
|
+
n(ke, {
|
|
1203
|
+
"date-range": J(f),
|
|
1204
|
+
"onUpdate:dateRange": c[0] || (c[0] = (o) => ge(f) ? f.value = o : null),
|
|
1205
|
+
compare: !1
|
|
1206
|
+
}, null, 8, ["date-range"]),
|
|
1207
|
+
n(_, {
|
|
1208
|
+
loading: x.value,
|
|
1209
|
+
variant: "primary",
|
|
1210
|
+
label: "Upload",
|
|
1211
|
+
onClick: F
|
|
1212
|
+
}, null, 8, ["loading"])
|
|
1213
|
+
]),
|
|
1214
|
+
x.value ? (p(), $("div", ia, [
|
|
1215
|
+
n(v, { size: "xl" }),
|
|
1216
|
+
c[1] || (c[1] = t("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Loading data... ", -1))
|
|
1217
|
+
])) : g.value.length > 0 ? (p(), I(V, {
|
|
1218
|
+
key: 1,
|
|
1219
|
+
class: "flex overflow-scroll",
|
|
1220
|
+
"row-data": g.value,
|
|
1221
|
+
"column-defs": s
|
|
1222
|
+
}, null, 8, ["row-data"])) : H("", !0)
|
|
1223
|
+
]);
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
}), ma = { class: "h-full relative flex flex-col" }, da = { class: "py-16 px-16 overflow-hidden flex-grow relative" }, ua = /* @__PURE__ */ z({
|
|
1227
|
+
__name: "Bukku",
|
|
1228
|
+
props: {
|
|
1229
|
+
modelValue: {},
|
|
1230
|
+
modelModifiers: {}
|
|
1231
|
+
},
|
|
1232
|
+
emits: ["update:modelValue"],
|
|
1233
|
+
setup(k) {
|
|
1234
|
+
const e = G(k, "modelValue"), g = j("setting"), s = [
|
|
1235
|
+
{
|
|
1236
|
+
label: "Setting",
|
|
1237
|
+
value: "setting",
|
|
1238
|
+
icon: "settings"
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
label: "Preview",
|
|
1242
|
+
value: "preview",
|
|
1243
|
+
icon: "table"
|
|
1244
|
+
}
|
|
1245
|
+
], y = se(), x = Y(() => {
|
|
1246
|
+
switch (g.value) {
|
|
1247
|
+
case "preview":
|
|
1248
|
+
return ra;
|
|
1249
|
+
case "setting":
|
|
1250
|
+
return oa;
|
|
1251
|
+
default:
|
|
1252
|
+
return null;
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
return (C, f) => {
|
|
1256
|
+
var c;
|
|
1257
|
+
const F = h("FmPageHead"), i = h("FmTabs");
|
|
1258
|
+
return p(), $("div", ma, [
|
|
1259
|
+
n(F, {
|
|
1260
|
+
title: ((c = e.value) == null ? void 0 : c.name) || "Bukku",
|
|
1261
|
+
"back-button": !0,
|
|
1262
|
+
style: { paddingLeft: "0px", paddingRight: "0px" },
|
|
1263
|
+
"onClick:back": J(y).back
|
|
1264
|
+
}, {
|
|
1265
|
+
description: ue(() => f[2] || (f[2] = [
|
|
1266
|
+
t("div", null, null, -1)
|
|
1267
|
+
])),
|
|
1268
|
+
_: 1
|
|
1269
|
+
}, 8, ["title", "onClick:back"]),
|
|
1270
|
+
n(i, {
|
|
1271
|
+
"model-value": g.value,
|
|
1272
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => g.value = _),
|
|
1273
|
+
items: s
|
|
1274
|
+
}, null, 8, ["model-value"]),
|
|
1275
|
+
t("div", da, [
|
|
1276
|
+
(p(), I(ce(x.value), {
|
|
1277
|
+
modelValue: e.value,
|
|
1278
|
+
"onUpdate:modelValue": f[1] || (f[1] = (_) => e.value = _)
|
|
1279
|
+
}, null, 8, ["modelValue"]))
|
|
1280
|
+
])
|
|
1281
|
+
]);
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
}), pa = {
|
|
1285
|
+
key: 0,
|
|
1286
|
+
class: "flex flex-col h-full"
|
|
1287
|
+
}, ca = { class: "flex flex-col gap-16 pb-[24px]" }, fa = { class: "flex flex-row justify-between items-center gap-2" }, va = { class: "flex flex-row gap-2 items-center" }, ga = { class: "relative group cursor-pointer" }, ya = { class: "flex flex-col gap-24 pt-[24px] overflow-scroll" }, xa = { class: "flex flex-col gap-16" }, _a = { class: "flex flex-row items-center max-w-[100%]" }, wa = { class: "flex-grow" }, ba = { class: "flex flex-row items-center max-w-[100%]" }, ha = { class: "flex flex-row items-center max-w-[100%]" }, Va = { class: "flex flex-col gap-16" }, ka = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Sa = { class: "flex flex-row items-center gap-x-16" }, $a = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Ca = { class: "flex flex-row items-center gap-x-16" }, Fa = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Da = { class: "flex flex-row items-center gap-x-16" }, Ua = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Ta = /* @__PURE__ */ z({
|
|
1288
|
+
__name: "Setting",
|
|
1289
|
+
props: {
|
|
1290
|
+
modelValue: { required: !0 },
|
|
1291
|
+
modelModifiers: {}
|
|
1292
|
+
},
|
|
1293
|
+
emits: ["update:modelValue"],
|
|
1294
|
+
setup(k) {
|
|
1295
|
+
const e = G(k, "modelValue"), g = re(), s = fe(), y = se(), { promptLoader: x } = ye(), { promptMessage: C } = he(), { restaurants: f } = ie(), F = Y(
|
|
1296
|
+
() => f.map((m) => ({ label: m.name, value: m.id }))
|
|
1297
|
+
);
|
|
1298
|
+
async function i() {
|
|
1299
|
+
await C({
|
|
1300
|
+
message: `Confirm delete ${e.value.name}?`,
|
|
1301
|
+
title: "Delete"
|
|
1302
|
+
}) && await x(async () => {
|
|
1303
|
+
try {
|
|
1304
|
+
await xe(e.value._id), await s.getSettings(), y.back();
|
|
1305
|
+
} catch (a) {
|
|
1306
|
+
g.open({ type: "error", message: a.message });
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
async function c() {
|
|
1311
|
+
await x(async () => {
|
|
1312
|
+
try {
|
|
1313
|
+
await _e(e.value._id, e.value), await s.getSettings();
|
|
1314
|
+
} catch (m) {
|
|
1315
|
+
g.open({ type: "error", message: m.message });
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
function _(m, a) {
|
|
1320
|
+
var w, u;
|
|
1321
|
+
(u = (w = e.value.platform) == null ? void 0 : w.mappings) != null && u[m] && (e.value.platform.mappings[m] = e.value.platform.mappings[m].filter(
|
|
1322
|
+
(N, K) => K !== a
|
|
1323
|
+
));
|
|
1324
|
+
}
|
|
1325
|
+
function v(m) {
|
|
1326
|
+
var a, w;
|
|
1327
|
+
(w = (a = e.value.platform) == null ? void 0 : a.mappings) != null && w[m] && (e.value.platform.mappings[m] = [
|
|
1328
|
+
...e.value.platform.mappings[m],
|
|
1329
|
+
m === "items" ? {
|
|
1330
|
+
key: "",
|
|
1331
|
+
account: "",
|
|
1332
|
+
description: ""
|
|
1333
|
+
} : {
|
|
1334
|
+
key: "",
|
|
1335
|
+
account: ""
|
|
1336
|
+
}
|
|
1337
|
+
]);
|
|
1338
|
+
}
|
|
1339
|
+
const V = [
|
|
1340
|
+
{
|
|
1341
|
+
label: "By day",
|
|
1342
|
+
value: me.BY_DAY
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
label: "By invoice",
|
|
1346
|
+
value: me.BY_INVOICE
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
label: "By day and category",
|
|
1350
|
+
value: me.BY_DAY_CATEGORY
|
|
1351
|
+
}
|
|
1352
|
+
];
|
|
1353
|
+
function o({
|
|
1354
|
+
key: m,
|
|
1355
|
+
value: a
|
|
1356
|
+
}) {
|
|
1357
|
+
var w, u;
|
|
1358
|
+
(u = (w = e.value) == null ? void 0 : w.platform) != null && u.mappings && (e.value.platform.mappings[m] = a);
|
|
1359
|
+
}
|
|
1360
|
+
function l(m) {
|
|
1361
|
+
return {
|
|
1362
|
+
key: { placeholder: m, editable: !1 },
|
|
1363
|
+
account: { placeholder: m, editable: !0 }
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
async function d() {
|
|
1367
|
+
await x(async () => {
|
|
1368
|
+
try {
|
|
1369
|
+
await we(e.value._id), await s.getSettings();
|
|
1370
|
+
} catch (m) {
|
|
1371
|
+
g.open({ type: "error", message: m.message });
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
return (m, a) => {
|
|
1376
|
+
var R, M, P, A, X, O, Q, E, W, Z, ee, te, ae, le;
|
|
1377
|
+
const w = h("FmIcon"), u = h("FmButton"), N = h("FmMenuDivider"), K = h("FmTextField"), L = h("FmSelect");
|
|
1378
|
+
return (M = (R = e.value) == null ? void 0 : R.platform) != null && M.mappings ? (p(), $("div", pa, [
|
|
1379
|
+
t("div", ca, [
|
|
1380
|
+
t("div", fa, [
|
|
1381
|
+
a[15] || (a[15] = t("div", { class: "fm-typo-en-title-sm-800" }, null, -1)),
|
|
1382
|
+
t("div", va, [
|
|
1383
|
+
t("div", ga, [
|
|
1384
|
+
n(w, {
|
|
1385
|
+
name: "refresh",
|
|
1386
|
+
class: "p-2 bg-gray-100 rounded-full",
|
|
1387
|
+
onClick: d
|
|
1388
|
+
}),
|
|
1389
|
+
a[14] || (a[14] = t("span", { class: "absolute left-1/2 -translate-x-2/3 top-full mt-2 w-max bg-gray-900 text-white text-sm px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity" }, " Repopulate the fields based on the dates selected in Preview. ", -1))
|
|
1390
|
+
]),
|
|
1391
|
+
n(u, {
|
|
1392
|
+
variant: "tertiary",
|
|
1393
|
+
label: "Delete",
|
|
1394
|
+
onClick: i
|
|
1395
|
+
}),
|
|
1396
|
+
n(u, {
|
|
1397
|
+
variant: "primary",
|
|
1398
|
+
label: "Update",
|
|
1399
|
+
onClick: c
|
|
1400
|
+
})
|
|
1401
|
+
])
|
|
1402
|
+
])
|
|
1403
|
+
]),
|
|
1404
|
+
n(N, { style: { margin: 0 } }),
|
|
1405
|
+
t("div", ya, [
|
|
1406
|
+
t("div", xa, [
|
|
1407
|
+
a[19] || (a[19] = t("div", { class: "fm-typo-en-title-sm-800" }, "General", -1)),
|
|
1408
|
+
t("div", _a, [
|
|
1409
|
+
a[16] || (a[16] = t("div", { class: "w-[25%]" }, "Name", -1)),
|
|
1410
|
+
t("div", wa, [
|
|
1411
|
+
n(K, {
|
|
1412
|
+
modelValue: e.value.name,
|
|
1413
|
+
"onUpdate:modelValue": a[0] || (a[0] = (S) => e.value.name = S)
|
|
1414
|
+
}, null, 8, ["modelValue"])
|
|
1415
|
+
])
|
|
1416
|
+
]),
|
|
1417
|
+
t("div", ba, [
|
|
1418
|
+
a[17] || (a[17] = t("div", { class: "w-[25%]" }, "Location", -1)),
|
|
1419
|
+
n(L, {
|
|
1420
|
+
modelValue: e.value.platform.locationIds,
|
|
1421
|
+
"onUpdate:modelValue": a[1] || (a[1] = (S) => e.value.platform.locationIds = S),
|
|
1422
|
+
multiselect: !0,
|
|
1423
|
+
items: F.value,
|
|
1424
|
+
placeholder: "Select location",
|
|
1425
|
+
class: "flex-grow",
|
|
1426
|
+
rules: [(S) => S.length !== 0 || "Please select at least 1 location"]
|
|
1427
|
+
}, null, 8, ["modelValue", "items", "rules"])
|
|
1428
|
+
]),
|
|
1429
|
+
t("div", ha, [
|
|
1430
|
+
a[18] || (a[18] = t("div", { class: "w-[25%]" }, "Grouping", -1)),
|
|
1431
|
+
n(L, {
|
|
1432
|
+
modelValue: e.value.platform.grouping,
|
|
1433
|
+
"onUpdate:modelValue": a[2] || (a[2] = (S) => e.value.platform.grouping = S),
|
|
1434
|
+
multiselect: !1,
|
|
1435
|
+
items: V,
|
|
1436
|
+
placeholder: "Select grouping",
|
|
1437
|
+
class: "flex-grow"
|
|
1438
|
+
}, null, 8, ["modelValue"])
|
|
1439
|
+
])
|
|
1440
|
+
]),
|
|
1441
|
+
t("div", Va, [
|
|
1442
|
+
t("div", ka, [
|
|
1443
|
+
n(U, {
|
|
1444
|
+
"model-value": { key: "Project", account: e.value.platform.mappings.project },
|
|
1445
|
+
options: l("Project"),
|
|
1446
|
+
"onUpdate:modelValue": a[3] || (a[3] = (S) => o({ key: "project", value: S.account }))
|
|
1447
|
+
}, null, 8, ["model-value", "options"]),
|
|
1448
|
+
n(U, {
|
|
1449
|
+
"model-value": { key: "Debtor", account: e.value.platform.mappings.debtor },
|
|
1450
|
+
options: l("Debtor"),
|
|
1451
|
+
"onUpdate:modelValue": a[4] || (a[4] = (S) => o({ key: "debtor", value: S.account }))
|
|
1452
|
+
}, null, 8, ["model-value", "options"]),
|
|
1453
|
+
n(U, {
|
|
1454
|
+
"model-value": {
|
|
1455
|
+
key: "Invoice no",
|
|
1456
|
+
account: e.value.platform.mappings.invoiceDocNo
|
|
1457
|
+
},
|
|
1458
|
+
options: l("Invoice no"),
|
|
1459
|
+
"onUpdate:modelValue": a[5] || (a[5] = (S) => o({ key: "invoiceDocNo", value: S.account }))
|
|
1460
|
+
}, null, 8, ["model-value", "options"]),
|
|
1461
|
+
n(U, {
|
|
1462
|
+
"model-value": {
|
|
1463
|
+
key: "Credit note no",
|
|
1464
|
+
account: e.value.platform.mappings.creditNoteDocNo
|
|
1465
|
+
},
|
|
1466
|
+
options: l("Credit note no"),
|
|
1467
|
+
"onUpdate:modelValue": a[6] || (a[6] = (S) => o({ key: "creditNoteDocNo", value: S.account }))
|
|
1468
|
+
}, null, 8, ["model-value", "options"]),
|
|
1469
|
+
n(U, {
|
|
1470
|
+
"model-value": {
|
|
1471
|
+
key: "Payment no",
|
|
1472
|
+
account: e.value.platform.mappings.paymentDocNo
|
|
1473
|
+
},
|
|
1474
|
+
options: l("Payment no"),
|
|
1475
|
+
"onUpdate:modelValue": a[7] || (a[7] = (S) => o({ key: "paymentDocNo", value: S.account }))
|
|
1476
|
+
}, null, 8, ["model-value", "options"]),
|
|
1477
|
+
n(U, {
|
|
1478
|
+
"model-value": {
|
|
1479
|
+
key: "Refund no",
|
|
1480
|
+
account: e.value.platform.mappings.refundDocNo
|
|
1481
|
+
},
|
|
1482
|
+
options: l("Refund no"),
|
|
1483
|
+
"onUpdate:modelValue": a[8] || (a[8] = (S) => o({ key: "refundDocNo", value: S.account }))
|
|
1484
|
+
}, null, 8, ["model-value", "options"]),
|
|
1485
|
+
n(U, {
|
|
1486
|
+
"model-value": {
|
|
1487
|
+
key: "Rounding",
|
|
1488
|
+
account: e.value.platform.mappings.rounding.account
|
|
1489
|
+
},
|
|
1490
|
+
options: l("Rounding"),
|
|
1491
|
+
"onUpdate:modelValue": a[9] || (a[9] = (S) => {
|
|
1492
|
+
var r, b, T;
|
|
1493
|
+
(T = (b = (r = e.value) == null ? void 0 : r.platform) == null ? void 0 : b.mappings) != null && T.rounding && (e.value.platform.mappings.rounding.account = S.account);
|
|
1494
|
+
})
|
|
1495
|
+
}, null, 8, ["model-value", "options"]),
|
|
1496
|
+
(p(!0), $(B, null, q((X = (A = (P = e.value) == null ? void 0 : P.platform) == null ? void 0 : A.mappings) == null ? void 0 : X.charges, (S, r) => (p(), I(U, {
|
|
1497
|
+
key: `charge-${r}`,
|
|
1498
|
+
modelValue: e.value.platform.mappings.charges[r],
|
|
1499
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.charges[r] = b,
|
|
1500
|
+
options: {
|
|
1501
|
+
key: { placeholder: "Key", editable: !1 },
|
|
1502
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
1503
|
+
}
|
|
1504
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
1505
|
+
])
|
|
1506
|
+
]),
|
|
1507
|
+
n($e, {
|
|
1508
|
+
modelValue: e.value.platform,
|
|
1509
|
+
"onUpdate:modelValue": a[10] || (a[10] = (S) => e.value.platform = S),
|
|
1510
|
+
label: "email"
|
|
1511
|
+
}, null, 8, ["modelValue"]),
|
|
1512
|
+
t("div", Sa, [
|
|
1513
|
+
a[20] || (a[20] = t("div", { class: "fm-typo-en-title-sm-800" }, "Items", -1)),
|
|
1514
|
+
n(u, {
|
|
1515
|
+
variant: "primary",
|
|
1516
|
+
icon: "add",
|
|
1517
|
+
onClick: a[11] || (a[11] = () => v("items"))
|
|
1518
|
+
})
|
|
1519
|
+
]),
|
|
1520
|
+
t("div", $a, [
|
|
1521
|
+
(p(!0), $(B, null, q((E = (Q = (O = e.value) == null ? void 0 : O.platform) == null ? void 0 : Q.mappings) == null ? void 0 : E.items, (S, r) => (p(), I(U, {
|
|
1522
|
+
key: `item-${r}`,
|
|
1523
|
+
modelValue: e.value.platform.mappings.items[r],
|
|
1524
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.items[r] = b,
|
|
1525
|
+
options: {
|
|
1526
|
+
key: { placeholder: "Key", editable: !0 },
|
|
1527
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
1528
|
+
},
|
|
1529
|
+
removable: !0,
|
|
1530
|
+
onRemove: () => _("items", r)
|
|
1531
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
1532
|
+
]),
|
|
1533
|
+
t("div", Ca, [
|
|
1534
|
+
a[21] || (a[21] = t("div", { class: "fm-typo-en-title-sm-800" }, "Taxes", -1)),
|
|
1535
|
+
n(u, {
|
|
1536
|
+
variant: "primary",
|
|
1537
|
+
icon: "add",
|
|
1538
|
+
onClick: a[12] || (a[12] = () => v("taxes"))
|
|
1539
|
+
})
|
|
1540
|
+
]),
|
|
1541
|
+
t("div", Fa, [
|
|
1542
|
+
(p(!0), $(B, null, q((ee = (Z = (W = e.value) == null ? void 0 : W.platform) == null ? void 0 : Z.mappings) == null ? void 0 : ee.taxes, (S, r) => (p(), I(U, {
|
|
1543
|
+
key: `tax-${r}`,
|
|
1544
|
+
modelValue: e.value.platform.mappings.taxes[r],
|
|
1545
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.taxes[r] = b,
|
|
1546
|
+
options: {
|
|
1547
|
+
key: { placeholder: "Key", editable: !0 },
|
|
1548
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
1549
|
+
},
|
|
1550
|
+
removable: !0,
|
|
1551
|
+
onRemove: () => _("taxes", r)
|
|
1552
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
1553
|
+
]),
|
|
1554
|
+
t("div", Da, [
|
|
1555
|
+
a[22] || (a[22] = t("div", { class: "fm-typo-en-title-sm-800" }, "Payments", -1)),
|
|
1556
|
+
n(u, {
|
|
1557
|
+
variant: "primary",
|
|
1558
|
+
icon: "add",
|
|
1559
|
+
onClick: a[13] || (a[13] = () => v("payments"))
|
|
1560
|
+
})
|
|
1561
|
+
]),
|
|
1562
|
+
t("div", Ua, [
|
|
1563
|
+
(p(!0), $(B, null, q((le = (ae = (te = e.value) == null ? void 0 : te.platform) == null ? void 0 : ae.mappings) == null ? void 0 : le.payments, (S, r) => (p(), I(U, {
|
|
1564
|
+
key: `payment-${r}`,
|
|
1565
|
+
modelValue: e.value.platform.mappings.payments[r],
|
|
1566
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.payments[r] = b,
|
|
1567
|
+
options: {
|
|
1568
|
+
key: { placeholder: "Key", editable: !0 },
|
|
1569
|
+
account: { placeholder: "Payment name", editable: !0 }
|
|
1570
|
+
},
|
|
1571
|
+
removable: !0,
|
|
1572
|
+
onRemove: () => _("payments", r)
|
|
1573
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
1574
|
+
])
|
|
1575
|
+
])
|
|
1576
|
+
])) : H("", !0);
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
}), Ia = { class: "h-full flex flex-col gap-16" }, Pa = { class: "flex flex-row gap-2 justify-between items-center" }, Ka = {
|
|
1580
|
+
key: 0,
|
|
1581
|
+
class: "flex gap-24 w-full h-full justify-center items-center overflow-scroll"
|
|
1582
|
+
}, Ma = /* @__PURE__ */ z({
|
|
1583
|
+
__name: "Preview",
|
|
1584
|
+
props: {
|
|
1585
|
+
modelValue: { required: !0 },
|
|
1586
|
+
modelModifiers: {}
|
|
1587
|
+
},
|
|
1588
|
+
emits: ["update:modelValue"],
|
|
1589
|
+
setup(k) {
|
|
1590
|
+
const e = j([]), g = Y(
|
|
1591
|
+
() => e.value.reduce((i, c) => {
|
|
1592
|
+
const _ = i.length, { invoice: v, payments: V } = c;
|
|
1593
|
+
i[_] = {
|
|
1594
|
+
date: v.DocDate,
|
|
1595
|
+
docNo: v.DocNo,
|
|
1596
|
+
projNo: v.ProjNo,
|
|
1597
|
+
debtor: v.DebtorCode,
|
|
1598
|
+
description: v.Description
|
|
1599
|
+
};
|
|
1600
|
+
for (let o = 0; o < Math.max(v._items.length, V.length); o++) {
|
|
1601
|
+
const l = _ + o;
|
|
1602
|
+
i[l] || (i[l] = {}), v._items[o] && (i[l] = {
|
|
1603
|
+
...i[l],
|
|
1604
|
+
itemDescription: v._items[o].DetailDescription,
|
|
1605
|
+
itemUnitPrice: v._items[o].Amount,
|
|
1606
|
+
itemAccount: v._items[o].AccNo,
|
|
1607
|
+
itemTaxCode: v._items[o].TaxType,
|
|
1608
|
+
itemTax: v._items[o].Tax
|
|
1609
|
+
}), V[o] && (i[l] = {
|
|
1610
|
+
...i[l],
|
|
1611
|
+
paymentDocNo: V[o].DocNo,
|
|
1612
|
+
paymentMethod: V[o].paymentMethod,
|
|
1613
|
+
paymentDescription: V[o].Description,
|
|
1614
|
+
paymentAmount: V[o].PaymentAmt
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
return i;
|
|
1618
|
+
}, [])
|
|
1619
|
+
), s = [
|
|
1620
|
+
{
|
|
1621
|
+
accessorKey: "date",
|
|
1622
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
1623
|
+
enableSorting: !1
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
accessorKey: "docNo",
|
|
1627
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Doc No"),
|
|
1628
|
+
enableSorting: !1
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
accessorKey: "projNo",
|
|
1632
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Project"),
|
|
1633
|
+
enableSorting: !1
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
accessorKey: "debtor",
|
|
1637
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Debtor"),
|
|
1638
|
+
enableSorting: !1
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
accessorKey: "description",
|
|
1642
|
+
header: "Description",
|
|
1643
|
+
enableSorting: !1
|
|
1644
|
+
},
|
|
1645
|
+
{
|
|
1646
|
+
accessorKey: "itemAccount",
|
|
1647
|
+
header: () => D("p", { class: "min-w-[100px] text-nowrap text-ellipsis" }, "Item Account"),
|
|
1648
|
+
enableSorting: !1
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
accessorKey: "itemTaxCode",
|
|
1652
|
+
header: "Item Tax Code",
|
|
1653
|
+
enableSorting: !1
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
accessorKey: "itemDescription",
|
|
1657
|
+
header: () => D("p", { class: "min-w-[140px] text-nowrap text-ellipsis" }, "Item Description"),
|
|
1658
|
+
enableSorting: !1
|
|
1659
|
+
},
|
|
1660
|
+
{
|
|
1661
|
+
accessorKey: "itemUnitPrice",
|
|
1662
|
+
header: "Item Unit Price",
|
|
1663
|
+
enableSorting: !1
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
accessorKey: "itemTax",
|
|
1667
|
+
header: "Item Tax",
|
|
1668
|
+
enableSorting: !1
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
accessorKey: "paymentDocNo",
|
|
1672
|
+
header: "Payment Doc No",
|
|
1673
|
+
enableSorting: !1
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
accessorKey: "paymentMethod",
|
|
1677
|
+
header: "Payment Method",
|
|
1678
|
+
enableSorting: !1
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
accessorKey: "paymentDescription",
|
|
1682
|
+
header: "Payment Description",
|
|
1683
|
+
enableSorting: !1
|
|
1684
|
+
},
|
|
1685
|
+
{
|
|
1686
|
+
accessorKey: "paymentAmount",
|
|
1687
|
+
header: "Payment Amount",
|
|
1688
|
+
enableSorting: !1
|
|
1689
|
+
}
|
|
1690
|
+
], y = G(k, "modelValue"), x = j(!1), C = re(), { dateRange: f } = Ve(ie());
|
|
1691
|
+
de(
|
|
1692
|
+
() => f.value,
|
|
1693
|
+
async () => {
|
|
1694
|
+
if (y.value._id)
|
|
1695
|
+
try {
|
|
1696
|
+
x.value = !0, e.value = await be(y.value._id);
|
|
1697
|
+
} catch (i) {
|
|
1698
|
+
C.open({ message: i.message, type: "error" });
|
|
1699
|
+
} finally {
|
|
1700
|
+
x.value = !1;
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
immediate: !0
|
|
1705
|
+
}
|
|
1706
|
+
);
|
|
1707
|
+
async function F() {
|
|
1708
|
+
try {
|
|
1709
|
+
y.value._id ? (x.value = !0, await Fe(y.value._id)) : C.open({ message: "Invalid accounting setting", type: "error" });
|
|
1710
|
+
} catch (i) {
|
|
1711
|
+
C.open({ message: i.message, type: "error" });
|
|
1712
|
+
} finally {
|
|
1713
|
+
x.value = !1;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
return (i, c) => {
|
|
1717
|
+
const _ = h("FmButton"), v = h("FmCircularProgress"), V = h("FmTable");
|
|
1718
|
+
return p(), $("div", Ia, [
|
|
1719
|
+
t("div", Pa, [
|
|
1720
|
+
n(ke, {
|
|
1721
|
+
"date-range": J(f),
|
|
1722
|
+
"onUpdate:dateRange": c[0] || (c[0] = (o) => ge(f) ? f.value = o : null),
|
|
1723
|
+
compare: !1
|
|
1724
|
+
}, null, 8, ["date-range"]),
|
|
1725
|
+
n(_, {
|
|
1726
|
+
loading: x.value,
|
|
1727
|
+
variant: "primary",
|
|
1728
|
+
label: "Download",
|
|
1729
|
+
onClick: F
|
|
1730
|
+
}, null, 8, ["loading"])
|
|
1731
|
+
]),
|
|
1732
|
+
x.value ? (p(), $("div", Ka, [
|
|
1733
|
+
n(v, { size: "xl" }),
|
|
1734
|
+
c[1] || (c[1] = t("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Loading data... ", -1))
|
|
1735
|
+
])) : g.value.length > 0 ? (p(), I(V, {
|
|
1736
|
+
key: 1,
|
|
1737
|
+
class: "flex overflow-scroll",
|
|
1738
|
+
"row-data": g.value,
|
|
1739
|
+
"column-defs": s
|
|
1740
|
+
}, null, 8, ["row-data"])) : H("", !0)
|
|
1741
|
+
]);
|
|
1742
|
+
};
|
|
1743
|
+
}
|
|
1744
|
+
}), Aa = { class: "h-full relative flex flex-col" }, Na = { class: "py-16 px-16 overflow-hidden flex-grow relative" }, Ra = /* @__PURE__ */ z({
|
|
1745
|
+
__name: "AutoCount",
|
|
1746
|
+
props: {
|
|
1747
|
+
modelValue: {},
|
|
1748
|
+
modelModifiers: {}
|
|
1749
|
+
},
|
|
1750
|
+
emits: ["update:modelValue"],
|
|
1751
|
+
setup(k) {
|
|
1752
|
+
const e = G(k, "modelValue"), g = j("setting"), s = [
|
|
1753
|
+
{
|
|
1754
|
+
label: "Setting",
|
|
1755
|
+
value: "setting",
|
|
1756
|
+
icon: "settings"
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
label: "Preview",
|
|
1760
|
+
value: "preview",
|
|
1761
|
+
icon: "table"
|
|
1762
|
+
}
|
|
1763
|
+
], y = se(), x = Y(() => {
|
|
1764
|
+
switch (g.value) {
|
|
1765
|
+
case "preview":
|
|
1766
|
+
return Ma;
|
|
1767
|
+
case "setting":
|
|
1768
|
+
return Ta;
|
|
1769
|
+
default:
|
|
1770
|
+
return null;
|
|
1771
|
+
}
|
|
1772
|
+
});
|
|
1773
|
+
return (C, f) => {
|
|
1774
|
+
var c;
|
|
1775
|
+
const F = h("FmPageHead"), i = h("FmTabs");
|
|
1776
|
+
return p(), $("div", Aa, [
|
|
1777
|
+
n(F, {
|
|
1778
|
+
title: ((c = e.value) == null ? void 0 : c.name) || "AutoCount",
|
|
1779
|
+
"back-button": !0,
|
|
1780
|
+
style: { paddingLeft: "0px", paddingRight: "0px" },
|
|
1781
|
+
"onClick:back": J(y).back
|
|
1782
|
+
}, {
|
|
1783
|
+
description: ue(() => f[2] || (f[2] = [
|
|
1784
|
+
t("div", null, null, -1)
|
|
1785
|
+
])),
|
|
1786
|
+
_: 1
|
|
1787
|
+
}, 8, ["title", "onClick:back"]),
|
|
1788
|
+
n(i, {
|
|
1789
|
+
"model-value": g.value,
|
|
1790
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => g.value = _),
|
|
1791
|
+
items: s
|
|
1792
|
+
}, null, 8, ["model-value"]),
|
|
1793
|
+
t("div", Na, [
|
|
1794
|
+
(p(), I(ce(x.value), {
|
|
1795
|
+
modelValue: e.value,
|
|
1796
|
+
"onUpdate:modelValue": f[1] || (f[1] = (_) => e.value = _)
|
|
1797
|
+
}, null, 8, ["modelValue"]))
|
|
1798
|
+
])
|
|
1799
|
+
]);
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
}), Ba = {
|
|
1803
|
+
key: 0,
|
|
1804
|
+
class: "flex flex-col h-full"
|
|
1805
|
+
}, ja = { class: "flex flex-col gap-16 pb-[24px]" }, La = { class: "flex flex-row justify-between items-center gap-2" }, Oa = { class: "flex flex-row gap-2 items-center" }, Ea = { class: "relative group cursor-pointer" }, Ha = { class: "flex flex-col gap-24 pt-[24px] overflow-scroll" }, Ya = { class: "flex flex-col gap-16" }, qa = { class: "flex flex-row items-center max-w-[100%]" }, za = { class: "flex-grow" }, Ga = { class: "flex flex-row items-center max-w-[100%]" }, Qa = { class: "flex flex-row items-center max-w-[100%]" }, Xa = { class: "flex flex-col gap-16" }, Ja = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Wa = { class: "grid-cols-1 grid gap-16" }, Za = { class: "flex flex-row items-center gap-x-16" }, el = { class: "grid-cols-1 grid gap-16" }, tl = { class: "flex flex-row items-center gap-x-16" }, al = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, ll = { class: "flex flex-row items-center gap-x-16" }, ol = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, nl = /* @__PURE__ */ z({
|
|
1806
|
+
__name: "Setting",
|
|
1807
|
+
props: {
|
|
1808
|
+
modelValue: { required: !0 },
|
|
1809
|
+
modelModifiers: {}
|
|
1810
|
+
},
|
|
1811
|
+
emits: ["update:modelValue"],
|
|
1812
|
+
setup(k) {
|
|
1813
|
+
const e = G(k, "modelValue"), g = re(), s = fe(), y = se(), { promptLoader: x } = ye(), { promptMessage: C } = he(), { restaurants: f } = ie(), F = Y(
|
|
1814
|
+
() => f.map((m) => ({ label: m.name, value: m.id }))
|
|
1815
|
+
);
|
|
1816
|
+
async function i() {
|
|
1817
|
+
await C({
|
|
1818
|
+
message: `Confirm delete ${e.value.name}?`,
|
|
1819
|
+
title: "Delete"
|
|
1820
|
+
}) && await x(async () => {
|
|
1821
|
+
try {
|
|
1822
|
+
await xe(e.value._id), await s.getSettings(), y.back();
|
|
1823
|
+
} catch (a) {
|
|
1824
|
+
g.open({ type: "error", message: a.message });
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
async function c() {
|
|
1829
|
+
await x(async () => {
|
|
1830
|
+
try {
|
|
1831
|
+
await _e(e.value._id, e.value), await s.getSettings();
|
|
1832
|
+
} catch (m) {
|
|
1833
|
+
g.open({ type: "error", message: m.message });
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
function _(m, a) {
|
|
1838
|
+
var w, u;
|
|
1839
|
+
(u = (w = e.value.platform) == null ? void 0 : w.mappings) != null && u[m] && (e.value.platform.mappings[m] = e.value.platform.mappings[m].filter(
|
|
1840
|
+
(N, K) => K !== a
|
|
1841
|
+
));
|
|
1842
|
+
}
|
|
1843
|
+
function v(m) {
|
|
1844
|
+
var a, w;
|
|
1845
|
+
(w = (a = e.value.platform) == null ? void 0 : a.mappings) != null && w[m] && (e.value.platform.mappings[m] = [
|
|
1846
|
+
...e.value.platform.mappings[m],
|
|
1847
|
+
m === "items" ? {
|
|
1848
|
+
key: "",
|
|
1849
|
+
account: "",
|
|
1850
|
+
description: ""
|
|
1851
|
+
} : {
|
|
1852
|
+
key: "",
|
|
1853
|
+
account: ""
|
|
1854
|
+
}
|
|
1855
|
+
]);
|
|
1856
|
+
}
|
|
1857
|
+
const V = [
|
|
1858
|
+
{
|
|
1859
|
+
label: "By day",
|
|
1860
|
+
value: me.BY_DAY
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
label: "By invoice",
|
|
1864
|
+
value: me.BY_INVOICE
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
label: "By day and category",
|
|
1868
|
+
value: me.BY_DAY_CATEGORY
|
|
1869
|
+
}
|
|
1870
|
+
];
|
|
1871
|
+
function o({
|
|
1872
|
+
key: m,
|
|
1873
|
+
value: a
|
|
1874
|
+
}) {
|
|
1875
|
+
var w, u;
|
|
1876
|
+
(u = (w = e.value) == null ? void 0 : w.platform) != null && u.mappings && (e.value.platform.mappings[m] = a);
|
|
1877
|
+
}
|
|
1878
|
+
function l(m) {
|
|
1879
|
+
return {
|
|
1880
|
+
key: { placeholder: m, editable: !1 },
|
|
1881
|
+
account: { placeholder: m, editable: !0 }
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
async function d() {
|
|
1885
|
+
await x(async () => {
|
|
1886
|
+
try {
|
|
1887
|
+
await we(e.value._id), await s.getSettings();
|
|
1888
|
+
} catch (m) {
|
|
1889
|
+
g.open({ type: "error", message: m.message });
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
return (m, a) => {
|
|
1894
|
+
var R, M, P, A, X, O, Q, E, W, Z, ee, te, ae, le;
|
|
1895
|
+
const w = h("FmIcon"), u = h("FmButton"), N = h("FmMenuDivider"), K = h("FmTextField"), L = h("FmSelect");
|
|
1896
|
+
return (M = (R = e.value) == null ? void 0 : R.platform) != null && M.mappings ? (p(), $("div", Ba, [
|
|
1897
|
+
t("div", ja, [
|
|
1898
|
+
t("div", La, [
|
|
1899
|
+
a[16] || (a[16] = t("div", { class: "fm-typo-en-title-sm-800" }, null, -1)),
|
|
1900
|
+
t("div", Oa, [
|
|
1901
|
+
t("div", Ea, [
|
|
1902
|
+
n(w, {
|
|
1903
|
+
name: "refresh",
|
|
1904
|
+
class: "p-2 bg-gray-100 rounded-full",
|
|
1905
|
+
onClick: d
|
|
1906
|
+
}),
|
|
1907
|
+
a[15] || (a[15] = t("span", { class: "absolute left-1/2 -translate-x-2/3 top-full mt-2 w-max bg-gray-900 text-white text-sm px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity" }, " Repopulate the fields based on the dates selected in Preview. ", -1))
|
|
1908
|
+
]),
|
|
1909
|
+
n(u, {
|
|
1910
|
+
variant: "tertiary",
|
|
1911
|
+
label: "Delete",
|
|
1912
|
+
onClick: i
|
|
1913
|
+
}),
|
|
1914
|
+
n(u, {
|
|
1915
|
+
variant: "primary",
|
|
1916
|
+
label: "Update",
|
|
1917
|
+
onClick: c
|
|
1918
|
+
})
|
|
1919
|
+
])
|
|
1920
|
+
])
|
|
1921
|
+
]),
|
|
1922
|
+
n(N, { style: { margin: 0 } }),
|
|
1923
|
+
t("div", Ha, [
|
|
1924
|
+
t("div", Ya, [
|
|
1925
|
+
a[20] || (a[20] = t("div", { class: "fm-typo-en-title-sm-800" }, "General", -1)),
|
|
1926
|
+
t("div", qa, [
|
|
1927
|
+
a[17] || (a[17] = t("div", { class: "w-[25%]" }, "Name", -1)),
|
|
1928
|
+
t("div", za, [
|
|
1929
|
+
n(K, {
|
|
1930
|
+
modelValue: e.value.name,
|
|
1931
|
+
"onUpdate:modelValue": a[0] || (a[0] = (S) => e.value.name = S)
|
|
1932
|
+
}, null, 8, ["modelValue"])
|
|
1933
|
+
])
|
|
1934
|
+
]),
|
|
1935
|
+
t("div", Ga, [
|
|
1936
|
+
a[18] || (a[18] = t("div", { class: "w-[25%]" }, "Location", -1)),
|
|
1937
|
+
n(L, {
|
|
1938
|
+
modelValue: e.value.platform.locationIds,
|
|
1939
|
+
"onUpdate:modelValue": a[1] || (a[1] = (S) => e.value.platform.locationIds = S),
|
|
1940
|
+
multiselect: !0,
|
|
1941
|
+
items: F.value,
|
|
1942
|
+
placeholder: "Select location",
|
|
1943
|
+
class: "flex-grow",
|
|
1944
|
+
rules: [(S) => S.length !== 0 || "Please select at least 1 location"]
|
|
1945
|
+
}, null, 8, ["modelValue", "items", "rules"])
|
|
1946
|
+
]),
|
|
1947
|
+
t("div", Qa, [
|
|
1948
|
+
a[19] || (a[19] = t("div", { class: "w-[25%]" }, "Grouping", -1)),
|
|
1949
|
+
n(L, {
|
|
1950
|
+
modelValue: e.value.platform.grouping,
|
|
1951
|
+
"onUpdate:modelValue": a[2] || (a[2] = (S) => e.value.platform.grouping = S),
|
|
1952
|
+
multiselect: !1,
|
|
1953
|
+
items: V,
|
|
1954
|
+
placeholder: "Select grouping",
|
|
1955
|
+
class: "flex-grow"
|
|
1956
|
+
}, null, 8, ["modelValue"])
|
|
1957
|
+
])
|
|
1958
|
+
]),
|
|
1959
|
+
t("div", Xa, [
|
|
1960
|
+
t("div", Ja, [
|
|
1961
|
+
n(U, {
|
|
1962
|
+
"model-value": { key: "Debtor", account: e.value.platform.mappings.debtor },
|
|
1963
|
+
options: l("Debtor"),
|
|
1964
|
+
"onUpdate:modelValue": a[3] || (a[3] = (S) => o({ key: "debtor", value: S.account }))
|
|
1965
|
+
}, null, 8, ["model-value", "options"]),
|
|
1966
|
+
n(U, {
|
|
1967
|
+
"model-value": {
|
|
1968
|
+
key: "Invoice no",
|
|
1969
|
+
account: e.value.platform.mappings.invoiceDocNo
|
|
1970
|
+
},
|
|
1971
|
+
options: l("Invoice no"),
|
|
1972
|
+
"onUpdate:modelValue": a[4] || (a[4] = (S) => o({ key: "invoiceDocNo", value: S.account }))
|
|
1973
|
+
}, null, 8, ["model-value", "options"]),
|
|
1974
|
+
n(U, {
|
|
1975
|
+
"model-value": {
|
|
1976
|
+
key: "Credit note no",
|
|
1977
|
+
account: e.value.platform.mappings.creditNoteDocNo
|
|
1978
|
+
},
|
|
1979
|
+
options: l("Credit note no"),
|
|
1980
|
+
"onUpdate:modelValue": a[5] || (a[5] = (S) => o({ key: "creditNoteDocNo", value: S.account }))
|
|
1981
|
+
}, null, 8, ["model-value", "options"]),
|
|
1982
|
+
n(U, {
|
|
1983
|
+
"model-value": {
|
|
1984
|
+
key: "Payment no",
|
|
1985
|
+
account: e.value.platform.mappings.paymentDocNo
|
|
1986
|
+
},
|
|
1987
|
+
options: l("Payment no"),
|
|
1988
|
+
"onUpdate:modelValue": a[6] || (a[6] = (S) => o({ key: "paymentDocNo", value: S.account }))
|
|
1989
|
+
}, null, 8, ["model-value", "options"]),
|
|
1990
|
+
n(U, {
|
|
1991
|
+
"model-value": {
|
|
1992
|
+
key: "Refund no",
|
|
1993
|
+
account: e.value.platform.mappings.refundDocNo
|
|
1994
|
+
},
|
|
1995
|
+
options: l("Refund no"),
|
|
1996
|
+
"onUpdate:modelValue": a[7] || (a[7] = (S) => o({ key: "refundDocNo", value: S.account }))
|
|
1997
|
+
}, null, 8, ["model-value", "options"]),
|
|
1998
|
+
n(U, {
|
|
1999
|
+
"model-value": {
|
|
2000
|
+
key: "Project header",
|
|
2001
|
+
account: e.value.platform.mappings.projectHeader
|
|
2002
|
+
},
|
|
2003
|
+
options: l("Project header"),
|
|
2004
|
+
"onUpdate:modelValue": a[8] || (a[8] = (S) => o({ key: "projectHeader", value: S.account }))
|
|
2005
|
+
}, null, 8, ["model-value", "options"]),
|
|
2006
|
+
n(U, {
|
|
2007
|
+
"model-value": {
|
|
2008
|
+
key: "Project detail",
|
|
2009
|
+
account: e.value.platform.mappings.projectDetail
|
|
2010
|
+
},
|
|
2011
|
+
options: l("Project detail"),
|
|
2012
|
+
"onUpdate:modelValue": a[9] || (a[9] = (S) => o({ key: "projectDetail", value: S.account }))
|
|
2013
|
+
}, null, 8, ["model-value", "options"])
|
|
2014
|
+
]),
|
|
2015
|
+
t("div", Wa, [
|
|
2016
|
+
n(U, {
|
|
2017
|
+
"model-value": {
|
|
2018
|
+
key: "Rounding",
|
|
2019
|
+
account: e.value.platform.mappings.rounding.account,
|
|
2020
|
+
code: e.value.platform.mappings.rounding.code
|
|
2021
|
+
},
|
|
2022
|
+
options: {
|
|
2023
|
+
key: { placeholder: "Rounding", editable: !1 },
|
|
2024
|
+
account: { placeholder: "Account code", editable: !0 },
|
|
2025
|
+
code: { placeholder: "Item code", editable: !0 }
|
|
2026
|
+
},
|
|
2027
|
+
"onUpdate:modelValue": a[10] || (a[10] = (S) => {
|
|
2028
|
+
var r, b, T;
|
|
2029
|
+
(T = (b = (r = e.value) == null ? void 0 : r.platform) == null ? void 0 : b.mappings) != null && T.rounding && (e.value.platform.mappings.rounding.account = S.account, e.value.platform.mappings.rounding.code = S.code);
|
|
2030
|
+
})
|
|
2031
|
+
}, null, 8, ["model-value"]),
|
|
2032
|
+
(p(!0), $(B, null, q((X = (A = (P = e.value) == null ? void 0 : P.platform) == null ? void 0 : A.mappings) == null ? void 0 : X.charges, (S, r) => (p(), I(U, {
|
|
2033
|
+
key: `charge-${r}`,
|
|
2034
|
+
modelValue: e.value.platform.mappings.charges[r],
|
|
2035
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.charges[r] = b,
|
|
2036
|
+
options: {
|
|
2037
|
+
key: { placeholder: "Key", editable: !1 },
|
|
2038
|
+
account: { placeholder: "Account code", editable: !0 },
|
|
2039
|
+
code: { placeholder: "Item code", editable: !0 }
|
|
2040
|
+
}
|
|
2041
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
2042
|
+
])
|
|
2043
|
+
]),
|
|
2044
|
+
n($e, {
|
|
2045
|
+
modelValue: e.value.platform,
|
|
2046
|
+
"onUpdate:modelValue": a[11] || (a[11] = (S) => e.value.platform = S),
|
|
2047
|
+
label: "email"
|
|
2048
|
+
}, null, 8, ["modelValue"]),
|
|
2049
|
+
t("div", Za, [
|
|
2050
|
+
a[21] || (a[21] = t("div", { class: "fm-typo-en-title-sm-800" }, "Items", -1)),
|
|
2051
|
+
n(u, {
|
|
2052
|
+
variant: "primary",
|
|
2053
|
+
icon: "add",
|
|
2054
|
+
onClick: a[12] || (a[12] = () => v("items"))
|
|
2055
|
+
})
|
|
2056
|
+
]),
|
|
2057
|
+
t("div", el, [
|
|
2058
|
+
(p(!0), $(B, null, q((E = (Q = (O = e.value) == null ? void 0 : O.platform) == null ? void 0 : Q.mappings) == null ? void 0 : E.items, (S, r) => (p(), I(U, {
|
|
2059
|
+
key: `item-${r}`,
|
|
2060
|
+
modelValue: e.value.platform.mappings.items[r],
|
|
2061
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.items[r] = b,
|
|
2062
|
+
options: {
|
|
2063
|
+
key: { placeholder: "Key", editable: !0 },
|
|
2064
|
+
account: { placeholder: "Account code", editable: !0 },
|
|
2065
|
+
code: { placeholder: "Item code", editable: !0 }
|
|
2066
|
+
},
|
|
2067
|
+
removable: !0,
|
|
2068
|
+
onRemove: () => _("items", r)
|
|
2069
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
2070
|
+
]),
|
|
2071
|
+
t("div", tl, [
|
|
2072
|
+
a[22] || (a[22] = t("div", { class: "fm-typo-en-title-sm-800" }, "Taxes", -1)),
|
|
2073
|
+
n(u, {
|
|
2074
|
+
variant: "primary",
|
|
2075
|
+
icon: "add",
|
|
2076
|
+
onClick: a[13] || (a[13] = () => v("taxes"))
|
|
2077
|
+
})
|
|
2078
|
+
]),
|
|
2079
|
+
t("div", al, [
|
|
2080
|
+
(p(!0), $(B, null, q((ee = (Z = (W = e.value) == null ? void 0 : W.platform) == null ? void 0 : Z.mappings) == null ? void 0 : ee.taxes, (S, r) => (p(), I(U, {
|
|
2081
|
+
key: `tax-${r}`,
|
|
2082
|
+
modelValue: e.value.platform.mappings.taxes[r],
|
|
2083
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.taxes[r] = b,
|
|
2084
|
+
options: {
|
|
2085
|
+
key: { placeholder: "Key", editable: !0 },
|
|
2086
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
2087
|
+
},
|
|
2088
|
+
removable: !0,
|
|
2089
|
+
onRemove: () => _("taxes", r)
|
|
2090
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
2091
|
+
]),
|
|
2092
|
+
t("div", ll, [
|
|
2093
|
+
a[23] || (a[23] = t("div", { class: "fm-typo-en-title-sm-800" }, "Payments", -1)),
|
|
2094
|
+
n(u, {
|
|
2095
|
+
variant: "primary",
|
|
2096
|
+
icon: "add",
|
|
2097
|
+
onClick: a[14] || (a[14] = () => v("payments"))
|
|
2098
|
+
})
|
|
2099
|
+
]),
|
|
2100
|
+
t("div", ol, [
|
|
2101
|
+
(p(!0), $(B, null, q((le = (ae = (te = e.value) == null ? void 0 : te.platform) == null ? void 0 : ae.mappings) == null ? void 0 : le.payments, (S, r) => (p(), I(U, {
|
|
2102
|
+
key: `payment-${r}`,
|
|
2103
|
+
modelValue: e.value.platform.mappings.payments[r],
|
|
2104
|
+
"onUpdate:modelValue": (b) => e.value.platform.mappings.payments[r] = b,
|
|
2105
|
+
options: {
|
|
2106
|
+
key: { placeholder: "Key", editable: !0 },
|
|
2107
|
+
account: { placeholder: "Method", editable: !0 }
|
|
2108
|
+
},
|
|
2109
|
+
removable: !0,
|
|
2110
|
+
onRemove: () => _("payments", r)
|
|
2111
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
2112
|
+
])
|
|
2113
|
+
])
|
|
2114
|
+
])) : H("", !0);
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
}), sl = { class: "h-full flex flex-col gap-16" }, il = { class: "flex flex-row gap-2 justify-between items-center" }, rl = {
|
|
2118
|
+
key: 0,
|
|
2119
|
+
class: "flex gap-24 w-full h-full justify-center items-center overflow-scroll"
|
|
2120
|
+
}, ml = /* @__PURE__ */ z({
|
|
2121
|
+
__name: "Preview",
|
|
2122
|
+
props: {
|
|
2123
|
+
modelValue: { required: !0 },
|
|
2124
|
+
modelModifiers: {}
|
|
2125
|
+
},
|
|
2126
|
+
emits: ["update:modelValue"],
|
|
2127
|
+
setup(k) {
|
|
2128
|
+
const e = j([]), g = Y(
|
|
2129
|
+
() => e.value.reduce((i, c) => {
|
|
2130
|
+
const _ = i.length, { invoice: v, payments: V } = c;
|
|
2131
|
+
i[_] = {
|
|
2132
|
+
date: v.DocDate,
|
|
2133
|
+
docNo: v.DocNo,
|
|
2134
|
+
debtor: v.Code,
|
|
2135
|
+
description: v.Description_HDR
|
|
2136
|
+
};
|
|
2137
|
+
for (let o = 0; o < Math.max(v._items.length, V.length); o++) {
|
|
2138
|
+
const l = _ + o;
|
|
2139
|
+
i[l] || (i[l] = {}), v._items[o] && (i[l] = {
|
|
2140
|
+
...i[l],
|
|
2141
|
+
itemDescription: v._items[o].Description_DTL,
|
|
2142
|
+
itemUnitPrice: v._items[o].UnitPrice,
|
|
2143
|
+
itemAccount: v._items[o].ACCOUNT,
|
|
2144
|
+
itemTaxCode: v._items[o].Tax,
|
|
2145
|
+
itemTax: v._items[o].TaxAmt
|
|
2146
|
+
}), V[o] && (i[l] = {
|
|
2147
|
+
...i[l],
|
|
2148
|
+
paymentDocNo: V[o].DOCNO_Header,
|
|
2149
|
+
paymentMethod: V[o].PAYMENTMETHOD,
|
|
2150
|
+
paymentAccount: V[o].CODE,
|
|
2151
|
+
paymentDescription: V[o].DESCRIPTION,
|
|
2152
|
+
paymentAmount: V[o].KOAMT
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
return i;
|
|
2156
|
+
}, [])
|
|
2157
|
+
), s = [
|
|
2158
|
+
{
|
|
2159
|
+
accessorKey: "date",
|
|
2160
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
2161
|
+
enableSorting: !1
|
|
2162
|
+
},
|
|
2163
|
+
{
|
|
2164
|
+
accessorKey: "docNo",
|
|
2165
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Doc No"),
|
|
2166
|
+
enableSorting: !1
|
|
2167
|
+
},
|
|
2168
|
+
{
|
|
2169
|
+
accessorKey: "debtor",
|
|
2170
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Debtor"),
|
|
2171
|
+
enableSorting: !1
|
|
2172
|
+
},
|
|
2173
|
+
{
|
|
2174
|
+
accessorKey: "description",
|
|
2175
|
+
header: "Description",
|
|
2176
|
+
enableSorting: !1
|
|
2177
|
+
},
|
|
2178
|
+
{
|
|
2179
|
+
accessorKey: "itemAccount",
|
|
2180
|
+
header: () => D("p", { class: "min-w-[100px] text-nowrap text-ellipsis" }, "Item Account"),
|
|
2181
|
+
enableSorting: !1
|
|
2182
|
+
},
|
|
2183
|
+
{
|
|
2184
|
+
accessorKey: "itemTaxCode",
|
|
2185
|
+
header: "Item Tax Code",
|
|
2186
|
+
enableSorting: !1
|
|
2187
|
+
},
|
|
2188
|
+
{
|
|
2189
|
+
accessorKey: "itemDescription",
|
|
2190
|
+
header: () => D("p", { class: "min-w-[140px] text-nowrap text-ellipsis" }, "Item Description"),
|
|
2191
|
+
enableSorting: !1
|
|
2192
|
+
},
|
|
2193
|
+
{
|
|
2194
|
+
accessorKey: "itemUnitPrice",
|
|
2195
|
+
header: "Item Unit Price",
|
|
2196
|
+
enableSorting: !1
|
|
2197
|
+
},
|
|
2198
|
+
{
|
|
2199
|
+
accessorKey: "itemTax",
|
|
2200
|
+
header: "Item Tax",
|
|
2201
|
+
enableSorting: !1
|
|
2202
|
+
},
|
|
2203
|
+
{
|
|
2204
|
+
accessorKey: "paymentDocNo",
|
|
2205
|
+
header: "Payment Doc No",
|
|
2206
|
+
enableSorting: !1
|
|
2207
|
+
},
|
|
2208
|
+
{
|
|
2209
|
+
accessorKey: "paymentMethod",
|
|
2210
|
+
header: "Payment Method",
|
|
2211
|
+
enableSorting: !1
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
accessorKey: "paymentDescription",
|
|
2215
|
+
header: "Payment Description",
|
|
2216
|
+
enableSorting: !1
|
|
2217
|
+
},
|
|
2218
|
+
{
|
|
2219
|
+
accessorKey: "paymentAmount",
|
|
2220
|
+
header: "Payment Amount",
|
|
2221
|
+
enableSorting: !1
|
|
2222
|
+
}
|
|
2223
|
+
], y = G(k, "modelValue"), x = j(!1), C = re(), { dateRange: f } = Ve(ie());
|
|
2224
|
+
de(
|
|
2225
|
+
() => f.value,
|
|
2226
|
+
async () => {
|
|
2227
|
+
if (y.value._id)
|
|
2228
|
+
try {
|
|
2229
|
+
x.value = !0, e.value = await be(y.value._id);
|
|
2230
|
+
} catch (i) {
|
|
2231
|
+
C.open({ message: i.message, type: "error" });
|
|
2232
|
+
} finally {
|
|
2233
|
+
x.value = !1;
|
|
2234
|
+
}
|
|
2235
|
+
},
|
|
2236
|
+
{
|
|
2237
|
+
immediate: !0
|
|
2238
|
+
}
|
|
2239
|
+
);
|
|
2240
|
+
async function F() {
|
|
2241
|
+
try {
|
|
2242
|
+
y.value._id ? (x.value = !0, await Fe(y.value._id)) : C.open({ message: "Invalid accounting setting", type: "error" });
|
|
2243
|
+
} catch (i) {
|
|
2244
|
+
C.open({ message: i.message, type: "error" });
|
|
2245
|
+
} finally {
|
|
2246
|
+
x.value = !1;
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
return (i, c) => {
|
|
2250
|
+
const _ = h("FmButton"), v = h("FmCircularProgress"), V = h("FmTable");
|
|
2251
|
+
return p(), $("div", sl, [
|
|
2252
|
+
t("div", il, [
|
|
2253
|
+
n(ke, {
|
|
2254
|
+
"date-range": J(f),
|
|
2255
|
+
"onUpdate:dateRange": c[0] || (c[0] = (o) => ge(f) ? f.value = o : null),
|
|
2256
|
+
compare: !1
|
|
2257
|
+
}, null, 8, ["date-range"]),
|
|
2258
|
+
n(_, {
|
|
2259
|
+
loading: x.value,
|
|
2260
|
+
variant: "primary",
|
|
2261
|
+
label: "Download",
|
|
2262
|
+
onClick: F
|
|
2263
|
+
}, null, 8, ["loading"])
|
|
2264
|
+
]),
|
|
2265
|
+
x.value ? (p(), $("div", rl, [
|
|
2266
|
+
n(v, { size: "xl" }),
|
|
2267
|
+
c[1] || (c[1] = t("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Loading data... ", -1))
|
|
2268
|
+
])) : g.value.length > 0 ? (p(), I(V, {
|
|
2269
|
+
key: 1,
|
|
2270
|
+
class: "flex overflow-scroll",
|
|
2271
|
+
"row-data": g.value,
|
|
2272
|
+
"column-defs": s
|
|
2273
|
+
}, null, 8, ["row-data"])) : H("", !0)
|
|
2274
|
+
]);
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
}), dl = { class: "h-full relative flex flex-col" }, ul = { class: "py-16 px-16 overflow-hidden flex-grow relative" }, pl = /* @__PURE__ */ z({
|
|
2278
|
+
__name: "SQL",
|
|
2279
|
+
props: {
|
|
2280
|
+
modelValue: {},
|
|
2281
|
+
modelModifiers: {}
|
|
2282
|
+
},
|
|
2283
|
+
emits: ["update:modelValue"],
|
|
2284
|
+
setup(k) {
|
|
2285
|
+
const e = G(k, "modelValue"), g = j("setting"), s = [
|
|
2286
|
+
{
|
|
2287
|
+
label: "Setting",
|
|
2288
|
+
value: "setting",
|
|
2289
|
+
icon: "settings"
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
label: "Preview",
|
|
2293
|
+
value: "preview",
|
|
2294
|
+
icon: "table"
|
|
2295
|
+
}
|
|
2296
|
+
], y = se(), x = Y(() => {
|
|
2297
|
+
switch (g.value) {
|
|
2298
|
+
case "preview":
|
|
2299
|
+
return ml;
|
|
2300
|
+
case "setting":
|
|
2301
|
+
return nl;
|
|
2302
|
+
default:
|
|
2303
|
+
return null;
|
|
2304
|
+
}
|
|
2305
|
+
});
|
|
2306
|
+
return (C, f) => {
|
|
2307
|
+
var c;
|
|
2308
|
+
const F = h("FmPageHead"), i = h("FmTabs");
|
|
2309
|
+
return p(), $("div", dl, [
|
|
2310
|
+
n(F, {
|
|
2311
|
+
title: ((c = e.value) == null ? void 0 : c.name) || "SQL",
|
|
2312
|
+
"back-button": !0,
|
|
2313
|
+
style: { paddingLeft: "0px", paddingRight: "0px" },
|
|
2314
|
+
"onClick:back": J(y).back
|
|
2315
|
+
}, {
|
|
2316
|
+
description: ue(() => f[2] || (f[2] = [
|
|
2317
|
+
t("div", null, null, -1)
|
|
2318
|
+
])),
|
|
2319
|
+
_: 1
|
|
2320
|
+
}, 8, ["title", "onClick:back"]),
|
|
2321
|
+
n(i, {
|
|
2322
|
+
"model-value": g.value,
|
|
2323
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => g.value = _),
|
|
2324
|
+
items: s
|
|
2325
|
+
}, null, 8, ["model-value"]),
|
|
2326
|
+
t("div", ul, [
|
|
2327
|
+
(p(), I(ce(x.value), {
|
|
2328
|
+
modelValue: e.value,
|
|
2329
|
+
"onUpdate:modelValue": f[1] || (f[1] = (_) => e.value = _)
|
|
2330
|
+
}, null, 8, ["modelValue"]))
|
|
2331
|
+
])
|
|
2332
|
+
]);
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
}), cl = { class: "flex flex-row items-center w-[100%] gap-[4px] justify-between" }, fl = {
|
|
2336
|
+
key: 0,
|
|
2337
|
+
class: "w-[50%]"
|
|
2338
|
+
}, vl = { class: "text-nowrap w-[100%] overflow-hidden text-ellipsis" }, gl = {
|
|
2339
|
+
key: 0,
|
|
2340
|
+
class: "w-[24px] flex items-center"
|
|
2341
|
+
}, Ue = /* @__PURE__ */ z({
|
|
2342
|
+
__name: "MappingDropdown",
|
|
2343
|
+
props: /* @__PURE__ */ ve({
|
|
2344
|
+
removable: {
|
|
2345
|
+
type: Boolean,
|
|
2346
|
+
default: !1
|
|
2347
|
+
},
|
|
2348
|
+
singleValueMode: {
|
|
2349
|
+
type: Boolean,
|
|
2350
|
+
default: !1
|
|
2351
|
+
},
|
|
2352
|
+
options: {
|
|
2353
|
+
type: Object,
|
|
2354
|
+
default: () => ({})
|
|
2355
|
+
},
|
|
2356
|
+
type: {
|
|
2357
|
+
type: String,
|
|
2358
|
+
default: "text"
|
|
2359
|
+
},
|
|
2360
|
+
rules: {
|
|
2361
|
+
type: Array,
|
|
2362
|
+
default: () => []
|
|
2363
|
+
}
|
|
2364
|
+
}, {
|
|
2365
|
+
modelValue: { required: !0 },
|
|
2366
|
+
modelModifiers: {}
|
|
2367
|
+
}),
|
|
2368
|
+
emits: /* @__PURE__ */ ve(["remove"], ["update:modelValue"]),
|
|
2369
|
+
setup(k, { emit: e }) {
|
|
2370
|
+
const g = G(k, "modelValue"), s = k, y = Y(
|
|
2371
|
+
() => Object.keys(s.options).map((i) => {
|
|
2372
|
+
const c = s.options[i];
|
|
2373
|
+
return {
|
|
2374
|
+
placeholder: c.placeholder,
|
|
2375
|
+
key: i,
|
|
2376
|
+
editable: c.editable,
|
|
2377
|
+
dropdownOptions: c.dropdownOptions
|
|
2378
|
+
};
|
|
2379
|
+
})
|
|
2380
|
+
), x = (i, c) => {
|
|
2381
|
+
s.singleValueMode ? g.value = s.type === "number" ? Number(i) : i : c && (g.value = {
|
|
2382
|
+
...g.value,
|
|
2383
|
+
[c]: s.type === "number" ? Number(i) : i
|
|
2384
|
+
});
|
|
2385
|
+
}, C = (i) => {
|
|
2386
|
+
var c;
|
|
2387
|
+
return s.singleValueMode ? s.options.key.placeholder : (c = g.value[i.key]) == null ? void 0 : c.toString();
|
|
2388
|
+
}, f = (i) => s.singleValueMode ? g.value : g.value[i.key], F = e;
|
|
2389
|
+
return (i, c) => {
|
|
2390
|
+
const _ = h("FmSelect"), v = h("FmTextField"), V = h("FmTooltip"), o = h("FmIcon");
|
|
2391
|
+
return p(), $("div", cl, [
|
|
2392
|
+
t("div", {
|
|
2393
|
+
class: Te(`${k.removable ? "w-[calc(100%-24px)]" : "w-[100%]"} flex flex-row items-center gap-[4px]`)
|
|
2394
|
+
}, [
|
|
2395
|
+
(p(!0), $(B, null, q(y.value, (l) => (p(), $(B, {
|
|
2396
|
+
key: l.key
|
|
2397
|
+
}, [
|
|
2398
|
+
l.editable ? (p(), $("div", fl, [
|
|
2399
|
+
l.dropdownOptions ? (p(), I(_, {
|
|
2400
|
+
key: 0,
|
|
2401
|
+
"model-value": f(l),
|
|
2402
|
+
placeholder: l.placeholder,
|
|
2403
|
+
items: l.dropdownOptions,
|
|
2404
|
+
"shift-menu": !0,
|
|
2405
|
+
"onUpdate:modelValue": (d) => x(d, l.key)
|
|
2406
|
+
}, null, 8, ["model-value", "placeholder", "items", "onUpdate:modelValue"])) : (p(), I(v, {
|
|
2407
|
+
key: 1,
|
|
2408
|
+
"model-value": f(l),
|
|
2409
|
+
placeholder: l.placeholder,
|
|
2410
|
+
type: k.type,
|
|
2411
|
+
rules: k.rules,
|
|
2412
|
+
"onUpdate:modelValue": (d) => x(d, l.key)
|
|
2413
|
+
}, null, 8, ["model-value", "placeholder", "type", "rules", "onUpdate:modelValue"]))
|
|
2414
|
+
])) : (p(), I(V, {
|
|
2415
|
+
key: 1,
|
|
2416
|
+
content: C(l),
|
|
2417
|
+
class: "w-[50%]"
|
|
2418
|
+
}, {
|
|
2419
|
+
default: ue(() => [
|
|
2420
|
+
t("div", vl, pe(C(l)), 1)
|
|
2421
|
+
]),
|
|
2422
|
+
_: 2
|
|
2423
|
+
}, 1032, ["content"]))
|
|
2424
|
+
], 64))), 128))
|
|
2425
|
+
], 2),
|
|
2426
|
+
k.removable ? (p(), $("div", gl, [
|
|
2427
|
+
n(o, {
|
|
2428
|
+
color: "system-error-300",
|
|
2429
|
+
class: "cursor-pointer",
|
|
2430
|
+
name: "close",
|
|
2431
|
+
size: "md",
|
|
2432
|
+
onClick: c[0] || (c[0] = (l) => F("remove"))
|
|
2433
|
+
})
|
|
2434
|
+
])) : H("", !0)
|
|
2435
|
+
]);
|
|
2436
|
+
};
|
|
2437
|
+
}
|
|
2438
|
+
}), yl = {
|
|
2439
|
+
key: 0,
|
|
2440
|
+
class: "flex flex-col h-full"
|
|
2441
|
+
}, xl = { class: "flex flex-col gap-16 pb-[24px]" }, _l = { class: "flex flex-row justify-between items-center gap-2" }, wl = { class: "flex flex-row gap-2 items-center" }, bl = { class: "flex flex-row gap-2 items-center" }, hl = { class: "relative group cursor-pointer" }, Vl = { class: "flex flex-col gap-24 pt-[24px] overflow-y-auto overflow-x-hidden" }, kl = { class: "flex flex-row items-center max-w-[100%]" }, Sl = { class: "flex-grow" }, $l = { class: "flex flex-col gap-24 pt-[24px] overflow-y-auto overflow-x-hidden" }, Cl = { class: "flex flex-row items-center justify-between" }, Fl = { class: "flex-grow" }, Dl = { class: "flex flex-row items-center justify-between" }, Ul = { class: "flex-grow" }, Tl = { class: "flex flex-col gap-16" }, Il = { class: "flex flex-row items-center max-w-[100%]" }, Pl = { class: "flex-grow" }, Kl = { class: "flex flex-row items-center max-w-[100%]" }, Ml = { class: "flex flex-row items-center max-w-[100%]" }, Al = { class: "flex flex-col gap-16" }, Nl = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Rl = { class: "flex flex-row items-center gap-x-16" }, Bl = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, jl = { class: "flex flex-row items-center gap-x-16" }, Ll = { class: "xs:grid-cols-1 grid-cols-2 grid gap-16" }, Ol = { class: "flex flex-row items-center gap-x-16" }, El = { class: "flex flex-row items-center justify-between" }, Hl = { class: "flex-grow" }, Yl = {
|
|
2442
|
+
key: 0,
|
|
2443
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2444
|
+
}, ql = {
|
|
2445
|
+
key: 1,
|
|
2446
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2447
|
+
}, zl = {
|
|
2448
|
+
key: 3,
|
|
2449
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
2450
|
+
}, Gl = {
|
|
2451
|
+
key: 0,
|
|
2452
|
+
class: "flex flex-row items-center"
|
|
2453
|
+
}, Ql = /* @__PURE__ */ z({
|
|
2454
|
+
__name: "Setting",
|
|
2455
|
+
props: /* @__PURE__ */ ve({
|
|
2456
|
+
retrievedMethods: {
|
|
2457
|
+
type: Object,
|
|
2458
|
+
required: !0
|
|
2459
|
+
},
|
|
2460
|
+
retrievedCustomers: {
|
|
2461
|
+
type: Object,
|
|
2462
|
+
required: !0
|
|
2463
|
+
}
|
|
2464
|
+
}, {
|
|
2465
|
+
modelValue: { required: !0 },
|
|
2466
|
+
modelModifiers: {}
|
|
2467
|
+
}),
|
|
2468
|
+
emits: ["update:modelValue"],
|
|
2469
|
+
setup(k) {
|
|
2470
|
+
const e = G(k, "modelValue"), g = re(), s = fe(), y = se(), { promptLoader: x } = ye(), { promptMessage: C } = he(), { restaurants: f } = ie(), F = Y(
|
|
2471
|
+
() => f.map((l) => ({ label: l.name, value: l.id }))
|
|
2472
|
+
);
|
|
2473
|
+
async function i() {
|
|
2474
|
+
await C({
|
|
2475
|
+
message: `Confirm delete ${e.value.name}?`,
|
|
2476
|
+
title: "Delete"
|
|
2477
|
+
}) && await x(async () => {
|
|
2478
|
+
try {
|
|
2479
|
+
await xe(e.value._id), await s.getSettings(), y.back();
|
|
2480
|
+
} catch (d) {
|
|
2481
|
+
g.open({ type: "error", message: d.message });
|
|
2482
|
+
}
|
|
2483
|
+
});
|
|
2484
|
+
}
|
|
2485
|
+
async function c() {
|
|
2486
|
+
await x(async () => {
|
|
2487
|
+
try {
|
|
2488
|
+
await _e(e.value._id, e.value), await s.getSettings();
|
|
2489
|
+
} catch (l) {
|
|
2490
|
+
g.open({ type: "error", message: l.message });
|
|
2491
|
+
}
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
function _(l, d) {
|
|
2495
|
+
var m, a;
|
|
2496
|
+
(a = (m = e.value.platform) == null ? void 0 : m.mappings) != null && a[l] && (e.value.platform.mappings[l] = e.value.platform.mappings[l].filter(
|
|
2497
|
+
(w, u) => u !== d
|
|
2498
|
+
));
|
|
2499
|
+
}
|
|
2500
|
+
function v(l) {
|
|
2501
|
+
var d, m;
|
|
2502
|
+
(m = (d = e.value.platform) == null ? void 0 : d.mappings) != null && m[l] && (e.value.platform.mappings[l] = [
|
|
2503
|
+
...e.value.platform.mappings[l],
|
|
2504
|
+
l === "items" ? {
|
|
2505
|
+
key: "",
|
|
2506
|
+
account: "",
|
|
2507
|
+
description: ""
|
|
2508
|
+
} : l === "taxes" ? {
|
|
2509
|
+
key: "",
|
|
2510
|
+
account: "SST-"
|
|
2511
|
+
} : {
|
|
2512
|
+
key: "",
|
|
2513
|
+
account: ""
|
|
2514
|
+
}
|
|
2515
|
+
]);
|
|
2516
|
+
}
|
|
2517
|
+
const V = [
|
|
2518
|
+
{
|
|
2519
|
+
label: "By day",
|
|
2520
|
+
value: me.BY_DAY
|
|
2521
|
+
}
|
|
2522
|
+
];
|
|
2523
|
+
de(() => {
|
|
2524
|
+
var l, d, m;
|
|
2525
|
+
return (m = (d = (l = e.value) == null ? void 0 : l.platform) == null ? void 0 : d.mappings) == null ? void 0 : m.taxes;
|
|
2526
|
+
}, (l) => {
|
|
2527
|
+
l && l.forEach((d, m) => {
|
|
2528
|
+
var u;
|
|
2529
|
+
const a = d.key || "";
|
|
2530
|
+
let w = d.account;
|
|
2531
|
+
if (!w && a) {
|
|
2532
|
+
switch (a) {
|
|
2533
|
+
case "SST_SV":
|
|
2534
|
+
w = "SST-6";
|
|
2535
|
+
break;
|
|
2536
|
+
case "SST_SV8":
|
|
2537
|
+
w = "SST-8";
|
|
2538
|
+
break;
|
|
2539
|
+
case "SST_EX":
|
|
2540
|
+
w = "SST-0";
|
|
2541
|
+
break;
|
|
2542
|
+
}
|
|
2543
|
+
(u = e.value.platform) != null && u.mappings && (e.value.platform.mappings.taxes[m] = {
|
|
2544
|
+
...d,
|
|
2545
|
+
account: w
|
|
2546
|
+
});
|
|
2547
|
+
}
|
|
2548
|
+
});
|
|
2549
|
+
}, { immediate: !0, deep: !0 });
|
|
2550
|
+
async function o() {
|
|
2551
|
+
await x(async () => {
|
|
2552
|
+
try {
|
|
2553
|
+
await we(e.value._id), await s.getSettings();
|
|
2554
|
+
} catch (l) {
|
|
2555
|
+
g.open({ type: "error", message: l.message });
|
|
2556
|
+
}
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
return (l, d) => {
|
|
2560
|
+
var R, M, P, A, X, O, Q, E, W, Z, ee, te, ae, le, S;
|
|
2561
|
+
const m = h("FmIcon"), a = h("FmButton"), w = h("FmSelect"), u = h("FmMenuDivider"), N = h("FmTextField"), K = h("FmCircularProgress"), L = h("FmCheckbox");
|
|
2562
|
+
return (M = (R = e.value) == null ? void 0 : R.platform) != null && M.mappings ? (p(), $("div", yl, [
|
|
2563
|
+
t("div", xl, [
|
|
2564
|
+
t("div", _l, [
|
|
2565
|
+
d[13] || (d[13] = t("div", { class: "fm-typo-en-title-sm-800" }, "Connect", -1)),
|
|
2566
|
+
t("div", wl, [
|
|
2567
|
+
t("div", bl, [
|
|
2568
|
+
t("div", hl, [
|
|
2569
|
+
n(m, {
|
|
2570
|
+
name: "refresh",
|
|
2571
|
+
class: "p-2 bg-gray-100 rounded-full",
|
|
2572
|
+
onClick: o
|
|
2573
|
+
}),
|
|
2574
|
+
d[12] || (d[12] = t("span", { class: "absolute left-1/2 -translate-x-2/3 top-full mt-2 w-max bg-gray-900 text-white text-sm px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity" }, " Repopulate the fields based on the dates selected in Preview. ", -1))
|
|
2575
|
+
]),
|
|
2576
|
+
n(a, {
|
|
2577
|
+
variant: "tertiary",
|
|
2578
|
+
label: "Delete",
|
|
2579
|
+
onClick: i
|
|
2580
|
+
}),
|
|
2581
|
+
n(a, {
|
|
2582
|
+
variant: "primary",
|
|
2583
|
+
label: "Update",
|
|
2584
|
+
onClick: c
|
|
2585
|
+
})
|
|
2586
|
+
])
|
|
2587
|
+
])
|
|
2588
|
+
])
|
|
2589
|
+
]),
|
|
2590
|
+
t("div", Vl, [
|
|
2591
|
+
d[25] || (d[25] = t("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Authenticate with your official Biztory account to enable FeedMe to securely upload data to Biztory. ", -1)),
|
|
2592
|
+
t("div", kl, [
|
|
2593
|
+
d[14] || (d[14] = t("div", { class: "w-[25%]" }, "Biztory Version", -1)),
|
|
2594
|
+
t("div", Sl, [
|
|
2595
|
+
n(w, {
|
|
2596
|
+
modelValue: e.value.platform.mappings.version,
|
|
2597
|
+
"onUpdate:modelValue": d[0] || (d[0] = (r) => e.value.platform.mappings.version = r),
|
|
2598
|
+
items: [{ label: "v1", value: "v1" }],
|
|
2599
|
+
placeholder: "Select Version"
|
|
2600
|
+
}, null, 8, ["modelValue"])
|
|
2601
|
+
])
|
|
2602
|
+
]),
|
|
2603
|
+
n(u, { style: { margin: 0 } }),
|
|
2604
|
+
t("div", $l, [
|
|
2605
|
+
t("div", Cl, [
|
|
2606
|
+
d[15] || (d[15] = t("div", { class: "w-[25%]" }, "Subdomain", -1)),
|
|
2607
|
+
t("div", Fl, [
|
|
2608
|
+
n(N, {
|
|
2609
|
+
modelValue: e.value.platform.subdomain,
|
|
2610
|
+
"onUpdate:modelValue": d[1] || (d[1] = (r) => e.value.platform.subdomain = r),
|
|
2611
|
+
placeholder: "Subdomain"
|
|
2612
|
+
}, null, 8, ["modelValue"])
|
|
2613
|
+
])
|
|
2614
|
+
]),
|
|
2615
|
+
t("div", Dl, [
|
|
2616
|
+
d[16] || (d[16] = t("div", { class: "w-[25%]" }, "API Key", -1)),
|
|
2617
|
+
t("div", Ul, [
|
|
2618
|
+
n(N, {
|
|
2619
|
+
modelValue: e.value.platform.api_key,
|
|
2620
|
+
"onUpdate:modelValue": d[2] || (d[2] = (r) => e.value.platform.api_key = r),
|
|
2621
|
+
placeholder: "API Key"
|
|
2622
|
+
}, null, 8, ["modelValue"])
|
|
2623
|
+
])
|
|
2624
|
+
]),
|
|
2625
|
+
t("div", Tl, [
|
|
2626
|
+
d[20] || (d[20] = t("div", { class: "fm-typo-en-title-sm-800" }, "General", -1)),
|
|
2627
|
+
t("div", Il, [
|
|
2628
|
+
d[17] || (d[17] = t("div", { class: "w-[25%]" }, "Name", -1)),
|
|
2629
|
+
t("div", Pl, [
|
|
2630
|
+
n(N, {
|
|
2631
|
+
modelValue: e.value.name,
|
|
2632
|
+
"onUpdate:modelValue": d[3] || (d[3] = (r) => e.value.name = r)
|
|
2633
|
+
}, null, 8, ["modelValue"])
|
|
2634
|
+
])
|
|
2635
|
+
]),
|
|
2636
|
+
t("div", Kl, [
|
|
2637
|
+
d[18] || (d[18] = t("div", { class: "w-[25%]" }, "Location", -1)),
|
|
2638
|
+
n(w, {
|
|
2639
|
+
modelValue: e.value.platform.locationIds,
|
|
2640
|
+
"onUpdate:modelValue": d[4] || (d[4] = (r) => e.value.platform.locationIds = r),
|
|
2641
|
+
multiselect: !0,
|
|
2642
|
+
items: F.value,
|
|
2643
|
+
placeholder: "Select location",
|
|
2644
|
+
class: "flex-grow"
|
|
2645
|
+
}, null, 8, ["modelValue", "items"])
|
|
2646
|
+
]),
|
|
2647
|
+
t("div", Ml, [
|
|
2648
|
+
d[19] || (d[19] = t("div", { class: "w-[25%]" }, "Grouping", -1)),
|
|
2649
|
+
n(w, {
|
|
2650
|
+
modelValue: e.value.platform.grouping,
|
|
2651
|
+
"onUpdate:modelValue": d[5] || (d[5] = (r) => e.value.platform.grouping = r),
|
|
2652
|
+
multiselect: !1,
|
|
2653
|
+
items: V,
|
|
2654
|
+
placeholder: "Select grouping",
|
|
2655
|
+
class: "flex-grow",
|
|
2656
|
+
disabled: ""
|
|
2657
|
+
}, null, 8, ["modelValue"])
|
|
2658
|
+
])
|
|
2659
|
+
]),
|
|
2660
|
+
t("div", Al, [
|
|
2661
|
+
t("div", Nl, [
|
|
2662
|
+
e.value.platform.mappings.version == "v2" ? (p(), I(Ue, {
|
|
2663
|
+
key: 0,
|
|
2664
|
+
modelValue: e.value.platform.mappings.payeeId,
|
|
2665
|
+
"onUpdate:modelValue": d[6] || (d[6] = (r) => e.value.platform.mappings.payeeId = r),
|
|
2666
|
+
options: {
|
|
2667
|
+
key: { placeholder: "Payee", editable: !1 },
|
|
2668
|
+
customer: {
|
|
2669
|
+
placeholder: "Select payee",
|
|
2670
|
+
editable: !0,
|
|
2671
|
+
dropdownOptions: ((P = k.retrievedCustomers) == null ? void 0 : P.data) ?? []
|
|
2672
|
+
}
|
|
2673
|
+
},
|
|
2674
|
+
removable: !1,
|
|
2675
|
+
"single-value-mode": ""
|
|
2676
|
+
}, null, 8, ["modelValue", "options"])) : H("", !0),
|
|
2677
|
+
(p(!0), $(B, null, q((O = (X = (A = e.value) == null ? void 0 : A.platform) == null ? void 0 : X.mappings) == null ? void 0 : O.charges, (r, b) => (p(), I(U, {
|
|
2678
|
+
key: `charge-${b}`,
|
|
2679
|
+
modelValue: e.value.platform.mappings.charges[b],
|
|
2680
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.charges[b] = T,
|
|
2681
|
+
options: {
|
|
2682
|
+
key: { placeholder: "Key", editable: !1 },
|
|
2683
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
2684
|
+
}
|
|
2685
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 128))
|
|
2686
|
+
])
|
|
2687
|
+
]),
|
|
2688
|
+
n($e, {
|
|
2689
|
+
modelValue: e.value.platform,
|
|
2690
|
+
"onUpdate:modelValue": d[7] || (d[7] = (r) => e.value.platform = r),
|
|
2691
|
+
label: "upload"
|
|
2692
|
+
}, null, 8, ["modelValue"]),
|
|
2693
|
+
t("div", Rl, [
|
|
2694
|
+
d[21] || (d[21] = t("div", { class: "fm-typo-en-title-sm-800" }, "Items", -1)),
|
|
2695
|
+
n(a, {
|
|
2696
|
+
variant: "primary",
|
|
2697
|
+
icon: "add",
|
|
2698
|
+
onClick: d[8] || (d[8] = () => v("items"))
|
|
2699
|
+
})
|
|
2700
|
+
]),
|
|
2701
|
+
t("div", Bl, [
|
|
2702
|
+
(p(!0), $(B, null, q((W = (E = (Q = e.value) == null ? void 0 : Q.platform) == null ? void 0 : E.mappings) == null ? void 0 : W.items, (r, b) => (p(), I(U, {
|
|
2703
|
+
key: `item-${b}`,
|
|
2704
|
+
modelValue: e.value.platform.mappings.items[b],
|
|
2705
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.items[b] = T,
|
|
2706
|
+
options: {
|
|
2707
|
+
key: { placeholder: "Key", editable: !0 },
|
|
2708
|
+
code: { placeholder: "Account code", editable: !0 }
|
|
2709
|
+
},
|
|
2710
|
+
removable: !0,
|
|
2711
|
+
onRemove: () => _("items", b)
|
|
2712
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
2713
|
+
]),
|
|
2714
|
+
t("div", jl, [
|
|
2715
|
+
d[22] || (d[22] = t("div", { class: "fm-typo-en-title-sm-800" }, "Taxes", -1)),
|
|
2716
|
+
n(a, {
|
|
2717
|
+
variant: "primary",
|
|
2718
|
+
icon: "add",
|
|
2719
|
+
onClick: d[9] || (d[9] = () => v("taxes"))
|
|
2720
|
+
})
|
|
2721
|
+
]),
|
|
2722
|
+
t("div", Ll, [
|
|
2723
|
+
(p(!0), $(B, null, q((te = (ee = (Z = e.value) == null ? void 0 : Z.platform) == null ? void 0 : ee.mappings) == null ? void 0 : te.taxes, (r, b) => (p(), I(U, {
|
|
2724
|
+
key: `tax-${b}`,
|
|
2725
|
+
modelValue: e.value.platform.mappings.taxes[b],
|
|
2726
|
+
"onUpdate:modelValue": (T) => e.value.platform.mappings.taxes[b] = T,
|
|
2727
|
+
options: {
|
|
2728
|
+
key: { placeholder: "Key", editable: !0 },
|
|
2729
|
+
account: { placeholder: "Account code", editable: !0 }
|
|
2730
|
+
},
|
|
2731
|
+
removable: !0,
|
|
2732
|
+
onRemove: () => _("taxes", b)
|
|
2733
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
2734
|
+
]),
|
|
2735
|
+
t("div", Ol, [
|
|
2736
|
+
d[23] || (d[23] = t("div", { class: "fm-typo-en-title-sm-800" }, "Payments", -1)),
|
|
2737
|
+
n(a, {
|
|
2738
|
+
variant: "primary",
|
|
2739
|
+
icon: "add",
|
|
2740
|
+
onClick: d[10] || (d[10] = () => v("paymentMethods"))
|
|
2741
|
+
})
|
|
2742
|
+
]),
|
|
2743
|
+
t("div", El, [
|
|
2744
|
+
d[24] || (d[24] = t("div", { class: "w-[25%]" }, "Payment Term", -1)),
|
|
2745
|
+
t("div", Hl, [
|
|
2746
|
+
n(U, {
|
|
2747
|
+
modelValue: e.value.platform.mappings.paymentTerm,
|
|
2748
|
+
"onUpdate:modelValue": d[11] || (d[11] = (r) => e.value.platform.mappings.paymentTerm = r),
|
|
2749
|
+
options: {
|
|
2750
|
+
id: { placeholder: "ID", editable: !0 },
|
|
2751
|
+
name: { placeholder: "Name", editable: !0 }
|
|
2752
|
+
},
|
|
2753
|
+
removable: !1
|
|
2754
|
+
}, null, 8, ["modelValue"])
|
|
2755
|
+
])
|
|
2756
|
+
]),
|
|
2757
|
+
k.retrievedMethods.isError ? H("", !0) : (p(), $("div", Yl, " The dropdown options are based on your Biztory account's payment method setting. ")),
|
|
2758
|
+
k.retrievedMethods.isLoaded && k.retrievedMethods.data && k.retrievedMethods.data.length == 0 && !k.retrievedMethods.isError ? (p(), $("span", ql, "No payment methods found. Please set up in Biztory.")) : H("", !0),
|
|
2759
|
+
k.retrievedMethods.isLoaded ? H("", !0) : (p(), I(K, {
|
|
2760
|
+
key: 2,
|
|
2761
|
+
size: "xl"
|
|
2762
|
+
})),
|
|
2763
|
+
k.retrievedMethods.isError ? (p(), $("span", zl, "Error fetching payment methods. Please ensure the subdomain, api key, and location are filled.")) : H("", !0),
|
|
2764
|
+
(p(!0), $(B, null, q((S = (le = (ae = e.value) == null ? void 0 : ae.platform) == null ? void 0 : le.mappings) == null ? void 0 : S.paymentMethods, (r, b) => {
|
|
2765
|
+
var T;
|
|
2766
|
+
return p(), $("div", {
|
|
2767
|
+
key: `payment-${b}`,
|
|
2768
|
+
class: "grid-cols-1 grid gap-x-16"
|
|
2769
|
+
}, [
|
|
2770
|
+
k.retrievedMethods.isLoaded && k.retrievedMethods.data && ((T = k.retrievedMethods.data) == null ? void 0 : T.length) != 0 ? (p(), $("div", Gl, [
|
|
2771
|
+
n(L, {
|
|
2772
|
+
"model-value": !e.value.platform.mappings.paymentMethods[b].skip,
|
|
2773
|
+
value: "",
|
|
2774
|
+
"onUpdate:modelValue": (oe) => {
|
|
2775
|
+
var Se, De;
|
|
2776
|
+
(De = (Se = e.value.platform) == null ? void 0 : Se.mappings) != null && De.paymentMethods[b] && (e.value.platform.mappings.paymentMethods[b].skip = !oe);
|
|
2777
|
+
}
|
|
2778
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
2779
|
+
n(Ue, {
|
|
2780
|
+
modelValue: e.value.platform.mappings.paymentMethods[b],
|
|
2781
|
+
"onUpdate:modelValue": (oe) => e.value.platform.mappings.paymentMethods[b] = oe,
|
|
2782
|
+
options: {
|
|
2783
|
+
key: {
|
|
2784
|
+
placeholder: "Enter key",
|
|
2785
|
+
editable: !0
|
|
2786
|
+
},
|
|
2787
|
+
id: {
|
|
2788
|
+
placeholder: "Select mapping",
|
|
2789
|
+
editable: !0,
|
|
2790
|
+
dropdownOptions: k.retrievedMethods.data
|
|
2791
|
+
}
|
|
2792
|
+
},
|
|
2793
|
+
removable: !0,
|
|
2794
|
+
onRemove: () => _("paymentMethods", b)
|
|
2795
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "options", "onRemove"])
|
|
2796
|
+
])) : H("", !0)
|
|
2797
|
+
]);
|
|
2798
|
+
}), 128))
|
|
2799
|
+
])
|
|
2800
|
+
])
|
|
2801
|
+
])) : H("", !0);
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
});
|
|
2805
|
+
function Xl(k) {
|
|
2806
|
+
return k.reduce((e, g) => {
|
|
2807
|
+
var x, C, f, F, i, c, _, v, V, o, l, d, m, a, w, u, N, K, L, R, M, P, A, X;
|
|
2808
|
+
const { invoice: s } = g, y = e.length;
|
|
2809
|
+
e[y] = {
|
|
2810
|
+
invoice_date: s.invoice_date,
|
|
2811
|
+
ref_num: s.ref_num,
|
|
2812
|
+
grandTotal: s.grandTotal,
|
|
2813
|
+
// tax_code: invoice.tax[0].tax_code,
|
|
2814
|
+
// tax: invoice.tax.reduce((sum, tax) => sum + tax.tax, 0),
|
|
2815
|
+
// service_charge: invoice.service_charge.total,
|
|
2816
|
+
item_code: (x = s.items[0]) == null ? void 0 : x.code,
|
|
2817
|
+
item_desc: ((C = s.items[0]) == null ? void 0 : C.description) == "SALES" ? `SALES ${(((f = s.items[0]) == null ? void 0 : f.tax_value) || 0) * 100}%` : (F = s.items[0]) == null ? void 0 : F.description,
|
|
2818
|
+
item_price: (i = s.items[0]) == null ? void 0 : i.price,
|
|
2819
|
+
item_tax: (c = s.items[0]) == null ? void 0 : c.total_tax,
|
|
2820
|
+
item_tax_label: ((_ = s.items[0]) == null ? void 0 : _.tax_label) || "-",
|
|
2821
|
+
payment_amount: ((V = (v = s.transactions) == null ? void 0 : v[0]) == null ? void 0 : V.amount) || void 0,
|
|
2822
|
+
payment_method: ((l = (o = s.transactions) == null ? void 0 : o[0]) == null ? void 0 : l.payment_method) || "-",
|
|
2823
|
+
payment_term: ((d = s == null ? void 0 : s.payment_term) == null ? void 0 : d.name) || "* -"
|
|
2824
|
+
};
|
|
2825
|
+
for (let O = 1; O < Math.max(((m = s.items) == null ? void 0 : m.length) || 0, ((a = s.transactions) == null ? void 0 : a.length) || 0); O++) {
|
|
2826
|
+
const Q = y + O;
|
|
2827
|
+
e[Q] || (e[Q] = {});
|
|
2828
|
+
const E = s.items[O];
|
|
2829
|
+
E ? e[Q] = {
|
|
2830
|
+
...e[Q],
|
|
2831
|
+
item_code: E.code,
|
|
2832
|
+
item_desc: E.description == "SALES" ? `SALES ${(E.tax_value || 0) * 100}%` : E.description,
|
|
2833
|
+
item_price: E.price,
|
|
2834
|
+
item_tax: E.total_tax,
|
|
2835
|
+
item_tax_label: E.tax_label || "-",
|
|
2836
|
+
payment_amount: ((u = (w = s.transactions) == null ? void 0 : w[O]) == null ? void 0 : u.amount) || void 0,
|
|
2837
|
+
payment_method: ((K = (N = s.transactions) == null ? void 0 : N[O]) == null ? void 0 : K.payment_method) || "-",
|
|
2838
|
+
payment_term: ((L = s == null ? void 0 : s.payment_term) == null ? void 0 : L.name) || "* -"
|
|
2839
|
+
} : e[Q] = {
|
|
2840
|
+
payment_amount: ((M = (R = s.transactions) == null ? void 0 : R[O]) == null ? void 0 : M.amount) || void 0,
|
|
2841
|
+
payment_method: ((A = (P = s.transactions) == null ? void 0 : P[O]) == null ? void 0 : A.payment_method) || "-",
|
|
2842
|
+
payment_term: ((X = s == null ? void 0 : s.payment_term) == null ? void 0 : X.name) || "* -"
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
return e;
|
|
2846
|
+
}, []);
|
|
2847
|
+
}
|
|
2848
|
+
const Jl = [
|
|
2849
|
+
{
|
|
2850
|
+
accessorKey: "invoice_date",
|
|
2851
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
2852
|
+
enableSorting: !1
|
|
2853
|
+
},
|
|
2854
|
+
{
|
|
2855
|
+
accessorKey: "ref_num",
|
|
2856
|
+
header: () => D("p", { class: "min-w-[130px] text-nowrap text-ellipsis" }, "Doc No"),
|
|
2857
|
+
enableSorting: !1
|
|
2858
|
+
},
|
|
2859
|
+
{
|
|
2860
|
+
accessorKey: "grandTotal",
|
|
2861
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Total"),
|
|
2862
|
+
enableSorting: !1
|
|
2863
|
+
},
|
|
2864
|
+
// {
|
|
2865
|
+
// accessorKey: "tax_code",
|
|
2866
|
+
// header: () => h("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Tax Code"),
|
|
2867
|
+
// enableSorting: false
|
|
2868
|
+
// },
|
|
2869
|
+
// {
|
|
2870
|
+
// accessorKey: "tax",
|
|
2871
|
+
// header: () => h("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Tax"),
|
|
2872
|
+
// enableSorting: false
|
|
2873
|
+
// },
|
|
2874
|
+
// {
|
|
2875
|
+
// accessorKey: "service_charge",
|
|
2876
|
+
// header: () => h("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Service Charge"),
|
|
2877
|
+
// enableSorting: false
|
|
2878
|
+
// },
|
|
2879
|
+
{
|
|
2880
|
+
accessorKey: "item_code",
|
|
2881
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Code"),
|
|
2882
|
+
enableSorting: !1
|
|
2883
|
+
},
|
|
2884
|
+
{
|
|
2885
|
+
accessorKey: "item_desc",
|
|
2886
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Description"),
|
|
2887
|
+
enableSorting: !1
|
|
2888
|
+
},
|
|
2889
|
+
{
|
|
2890
|
+
accessorKey: "item_price",
|
|
2891
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Price"),
|
|
2892
|
+
enableSorting: !1
|
|
2893
|
+
},
|
|
2894
|
+
{
|
|
2895
|
+
accessorKey: "item_tax",
|
|
2896
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Tax"),
|
|
2897
|
+
enableSorting: !1
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
accessorKey: "item_tax_label",
|
|
2901
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Tax Label"),
|
|
2902
|
+
enableSorting: !1
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
accessorKey: "payment_amount",
|
|
2906
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment Amount"),
|
|
2907
|
+
enableSorting: !1
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
accessorKey: "payment_term",
|
|
2911
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment Term"),
|
|
2912
|
+
enableSorting: !1
|
|
2913
|
+
},
|
|
2914
|
+
{
|
|
2915
|
+
accessorKey: "payment_method",
|
|
2916
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment Method"),
|
|
2917
|
+
enableSorting: !1
|
|
2918
|
+
}
|
|
2919
|
+
];
|
|
2920
|
+
function Wl(k) {
|
|
2921
|
+
return k.reduce((e, g) => {
|
|
2922
|
+
var C, f, F, i, c, _, v, V, o, l, d, m, a, w, u, N, K, L, R;
|
|
2923
|
+
const { invoice: s, payments: y } = g, x = e.length;
|
|
2924
|
+
e[x] = {
|
|
2925
|
+
invoice_date: s.invoice_date,
|
|
2926
|
+
ref_num: s.ref_num,
|
|
2927
|
+
total: s.total,
|
|
2928
|
+
item_code: (C = s.items[0]) == null ? void 0 : C.code,
|
|
2929
|
+
item_description: (f = s.items[0]) == null ? void 0 : f.description,
|
|
2930
|
+
item_price: (F = s.items[0]) == null ? void 0 : F.price,
|
|
2931
|
+
item_tax_label: ((i = s.items[0]) == null ? void 0 : i.tax_label) ?? "-",
|
|
2932
|
+
item_tax_amount: ((c = s.items[0]) == null ? void 0 : c.total_tax) ?? "-",
|
|
2933
|
+
service_charge_amount: ((_ = s.service_charges[0]) == null ? void 0 : _.total) ?? "-",
|
|
2934
|
+
rounding: s.rounding ?? 0,
|
|
2935
|
+
payment_term_id: s.payment_term.name ?? "-",
|
|
2936
|
+
payment_term_amount: ((v = s.terms[x]) == null ? void 0 : v.amount) ?? "-",
|
|
2937
|
+
payment_method: ((o = (V = y[0]) == null ? void 0 : V.payment_method_id) == null ? void 0 : o.toString()) || "* " + ((l = y[0]) == null ? void 0 : l.payment_method_name)
|
|
2938
|
+
};
|
|
2939
|
+
for (let M = 1; M < Math.max((d = s.items) == null ? void 0 : d.length, y == null ? void 0 : y.length); M++) {
|
|
2940
|
+
const P = x + M;
|
|
2941
|
+
e[P] || (e[P] = {});
|
|
2942
|
+
const A = s.items[M];
|
|
2943
|
+
A ? e[P] = {
|
|
2944
|
+
...e[P],
|
|
2945
|
+
item_code: A.code,
|
|
2946
|
+
item_description: A.description,
|
|
2947
|
+
item_price: A.total,
|
|
2948
|
+
// check again
|
|
2949
|
+
item_tax_label: A.tax_label ?? "-",
|
|
2950
|
+
item_tax_amount: A.total_tax ?? "-",
|
|
2951
|
+
payment_term_id: s.payment_term.name ?? "-",
|
|
2952
|
+
payment_term_amount: ((m = s.terms[P]) == null ? void 0 : m.amount) ?? "-",
|
|
2953
|
+
payment_method: ((w = (a = y[P]) == null ? void 0 : a.payment_method_id) == null ? void 0 : w.toString()) || "* " + ((u = y[P]) == null ? void 0 : u.payment_method_name)
|
|
2954
|
+
} : e[P] = {
|
|
2955
|
+
payment_term_id: s.payment_term.name ?? "-",
|
|
2956
|
+
payment_term_amount: ((N = s.terms[P]) == null ? void 0 : N.amount) ?? "-",
|
|
2957
|
+
payment_method: ((L = (K = y[P]) == null ? void 0 : K.payment_method_id) == null ? void 0 : L.toString()) || "* " + ((R = y[P]) == null ? void 0 : R.payment_method_name)
|
|
2958
|
+
};
|
|
2959
|
+
}
|
|
2960
|
+
return e;
|
|
2961
|
+
}, []);
|
|
2962
|
+
}
|
|
2963
|
+
const Zl = [
|
|
2964
|
+
{
|
|
2965
|
+
accessorKey: "invoice_date",
|
|
2966
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
2967
|
+
enableSorting: !1
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
accessorKey: "ref_num",
|
|
2971
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Doc No"),
|
|
2972
|
+
enableSorting: !1
|
|
2973
|
+
},
|
|
2974
|
+
{
|
|
2975
|
+
accessorKey: "total",
|
|
2976
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Total"),
|
|
2977
|
+
enableSorting: !1
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
accessorKey: "item_code",
|
|
2981
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Code"),
|
|
2982
|
+
enableSorting: !1
|
|
2983
|
+
},
|
|
2984
|
+
{
|
|
2985
|
+
accessorKey: "item_description",
|
|
2986
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Item Description"),
|
|
2987
|
+
enableSorting: !1
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
accessorKey: "item_price",
|
|
2991
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Price"),
|
|
2992
|
+
enableSorting: !1
|
|
2993
|
+
},
|
|
2994
|
+
{
|
|
2995
|
+
accessorKey: "item_tax_label",
|
|
2996
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Tax Label"),
|
|
2997
|
+
enableSorting: !1
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
accessorKey: "item_tax_amount",
|
|
3001
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Tax Amount"),
|
|
3002
|
+
enableSorting: !1
|
|
3003
|
+
},
|
|
3004
|
+
{
|
|
3005
|
+
accessorKey: "service_charge_amount",
|
|
3006
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Service Charge Amount"),
|
|
3007
|
+
enableSorting: !1
|
|
3008
|
+
},
|
|
3009
|
+
{
|
|
3010
|
+
accessorKey: "rounding",
|
|
3011
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Rounding"),
|
|
3012
|
+
enableSorting: !1
|
|
3013
|
+
},
|
|
3014
|
+
{
|
|
3015
|
+
accessorKey: "payment_term_id",
|
|
3016
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment Term"),
|
|
3017
|
+
enableSorting: !1
|
|
3018
|
+
},
|
|
3019
|
+
{
|
|
3020
|
+
accessorKey: "payment_term_amount",
|
|
3021
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment Term Amount"),
|
|
3022
|
+
enableSorting: !1
|
|
3023
|
+
},
|
|
3024
|
+
{
|
|
3025
|
+
accessorKey: "payment_method",
|
|
3026
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Payment Method"),
|
|
3027
|
+
enableSorting: !1
|
|
3028
|
+
}
|
|
3029
|
+
], eo = { class: "h-full flex flex-col gap-16" }, to = { class: "flex flex-row gap-2 justify-between items-center" }, ao = {
|
|
3030
|
+
key: 0,
|
|
3031
|
+
class: "flex gap-24 w-full h-full justify-center items-center overflow-scroll"
|
|
3032
|
+
}, lo = /* @__PURE__ */ z({
|
|
3033
|
+
__name: "Preview",
|
|
3034
|
+
props: {
|
|
3035
|
+
modelValue: { required: !0 },
|
|
3036
|
+
modelModifiers: {}
|
|
3037
|
+
},
|
|
3038
|
+
emits: ["update:modelValue"],
|
|
3039
|
+
setup(k) {
|
|
3040
|
+
const e = G(k, "modelValue"), g = j(!1), s = re(), { dateRange: y } = Ve(ie()), x = j([]);
|
|
3041
|
+
de(
|
|
3042
|
+
() => y.value,
|
|
3043
|
+
async () => {
|
|
3044
|
+
if (e.value._id)
|
|
3045
|
+
try {
|
|
3046
|
+
g.value = !0, x.value = await be(e.value._id);
|
|
3047
|
+
} catch (i) {
|
|
3048
|
+
s.open({ message: i.message, type: "error" });
|
|
3049
|
+
} finally {
|
|
3050
|
+
g.value = !1;
|
|
3051
|
+
}
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
immediate: !0
|
|
3055
|
+
}
|
|
3056
|
+
);
|
|
3057
|
+
const C = Y(() => {
|
|
3058
|
+
switch (e.value.platform.mappings.version) {
|
|
3059
|
+
case "v1":
|
|
3060
|
+
return Xl(x.value);
|
|
3061
|
+
case "v2":
|
|
3062
|
+
return Wl(x.value);
|
|
3063
|
+
}
|
|
3064
|
+
}), f = Y(() => {
|
|
3065
|
+
switch (e.value.platform.mappings.version) {
|
|
3066
|
+
case "v1":
|
|
3067
|
+
return Jl;
|
|
3068
|
+
case "v2":
|
|
3069
|
+
return Zl;
|
|
3070
|
+
}
|
|
3071
|
+
});
|
|
3072
|
+
async function F() {
|
|
3073
|
+
try {
|
|
3074
|
+
e.value._id && e.value.platform.subdomain && e.value.platform.api_key ? (g.value = !0, await Ce(e.value._id), s.open({ message: "Upload successful", type: "success" })) : s.open({ message: "Invalid accounting setting", type: "error" });
|
|
3075
|
+
} catch (i) {
|
|
3076
|
+
i.errors && i.errors.forEach((c) => s.open({ message: c, type: "error" })), i.message && s.open({ message: i.message, type: "error" });
|
|
3077
|
+
} finally {
|
|
3078
|
+
g.value = !1;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
return (i, c) => {
|
|
3082
|
+
const _ = h("FmButton"), v = h("FmCircularProgress"), V = h("FmTable");
|
|
3083
|
+
return p(), $("div", eo, [
|
|
3084
|
+
t("div", to, [
|
|
3085
|
+
n(ke, {
|
|
3086
|
+
"date-range": J(y),
|
|
3087
|
+
"onUpdate:dateRange": c[0] || (c[0] = (o) => ge(y) ? y.value = o : null),
|
|
3088
|
+
compare: !1
|
|
3089
|
+
}, null, 8, ["date-range"]),
|
|
3090
|
+
n(_, {
|
|
3091
|
+
loading: g.value,
|
|
3092
|
+
variant: "primary",
|
|
3093
|
+
label: "Upload",
|
|
3094
|
+
onClick: F
|
|
3095
|
+
}, null, 8, ["loading"])
|
|
3096
|
+
]),
|
|
3097
|
+
g.value ? (p(), $("div", ao, [
|
|
3098
|
+
n(v, { size: "xl" }),
|
|
3099
|
+
c[1] || (c[1] = t("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Loading data... ", -1))
|
|
3100
|
+
])) : (p(), I(V, {
|
|
3101
|
+
key: 1,
|
|
3102
|
+
class: "flex overflow-scroll",
|
|
3103
|
+
"row-data": C.value,
|
|
3104
|
+
"column-defs": f.value
|
|
3105
|
+
}, null, 8, ["row-data", "column-defs"]))
|
|
3106
|
+
]);
|
|
3107
|
+
};
|
|
3108
|
+
}
|
|
3109
|
+
}), oo = { class: "h-full relative flex flex-col" }, no = { class: "py-16 px-16 overflow-hidden flex-grow relative" }, so = /* @__PURE__ */ z({
|
|
3110
|
+
__name: "Biztory",
|
|
3111
|
+
props: {
|
|
3112
|
+
modelValue: { required: !0 },
|
|
3113
|
+
modelModifiers: {}
|
|
3114
|
+
},
|
|
3115
|
+
emits: ["update:modelValue"],
|
|
3116
|
+
setup(k) {
|
|
3117
|
+
const e = G(k, "modelValue"), g = j("setting"), s = [
|
|
3118
|
+
{
|
|
3119
|
+
label: "Setting",
|
|
3120
|
+
value: "setting",
|
|
3121
|
+
icon: "settings"
|
|
3122
|
+
},
|
|
3123
|
+
{
|
|
3124
|
+
label: "Preview",
|
|
3125
|
+
value: "preview",
|
|
3126
|
+
icon: "table"
|
|
3127
|
+
}
|
|
3128
|
+
], y = se(), x = Y(() => {
|
|
3129
|
+
switch (g.value) {
|
|
3130
|
+
case "preview":
|
|
3131
|
+
return {
|
|
3132
|
+
component: lo
|
|
3133
|
+
};
|
|
3134
|
+
case "setting":
|
|
3135
|
+
return {
|
|
3136
|
+
component: Ql,
|
|
3137
|
+
props: {
|
|
3138
|
+
retrievedMethods: C.value,
|
|
3139
|
+
retrievedCustomers: f.value
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
default:
|
|
3143
|
+
return null;
|
|
3144
|
+
}
|
|
3145
|
+
}), C = j({}), f = j({}), F = (V, o) => V.map((l) => ({
|
|
3146
|
+
label: o.length > 2 ? `ID:${l[o[2]]} [${l[o[0]]}] ${l[o[1]]}` : `[${l[o[0]]}] ${l[o[1]]}`,
|
|
3147
|
+
value: l.id
|
|
3148
|
+
})), i = (V) => F(V, ["wallet", "name", "id"]), c = (V) => F(V, ["id", "name"]), _ = async (V, o, l, d) => {
|
|
3149
|
+
try {
|
|
3150
|
+
const m = await V(e.value._id);
|
|
3151
|
+
l.value.data = o(m);
|
|
3152
|
+
} catch (m) {
|
|
3153
|
+
console.error(d, m), l.value.isError = !0;
|
|
3154
|
+
} finally {
|
|
3155
|
+
l.value.isLoaded = !0;
|
|
3156
|
+
}
|
|
3157
|
+
}, v = async () => {
|
|
3158
|
+
var V, o;
|
|
3159
|
+
(V = e.value.platform.mappings) != null && V.version && await _(Be, i, C, "Failed to fetch payment methods:"), ((o = e.value.platform.mappings) == null ? void 0 : o.version) == "v2" && await _(je, c, f, "Failed to fetch customers:");
|
|
3160
|
+
};
|
|
3161
|
+
return Ie(v), de(() => {
|
|
3162
|
+
var V;
|
|
3163
|
+
return (V = e.value.platform.mappings) == null ? void 0 : V.version;
|
|
3164
|
+
}, v), (V, o) => {
|
|
3165
|
+
var m, a, w;
|
|
3166
|
+
const l = h("FmPageHead"), d = h("FmTabs");
|
|
3167
|
+
return p(), $("div", oo, [
|
|
3168
|
+
n(l, {
|
|
3169
|
+
title: ((m = e.value) == null ? void 0 : m.name) || "Biztory",
|
|
3170
|
+
"back-button": !0,
|
|
3171
|
+
style: { paddingLeft: "0px", paddingRight: "0px" },
|
|
3172
|
+
"onClick:back": J(y).back
|
|
3173
|
+
}, {
|
|
3174
|
+
description: ue(() => o[2] || (o[2] = [
|
|
3175
|
+
t("div", null, null, -1)
|
|
3176
|
+
])),
|
|
3177
|
+
_: 1
|
|
3178
|
+
}, 8, ["title", "onClick:back"]),
|
|
3179
|
+
n(d, {
|
|
3180
|
+
"model-value": g.value,
|
|
3181
|
+
"onUpdate:modelValue": o[0] || (o[0] = (u) => g.value = u),
|
|
3182
|
+
items: s
|
|
3183
|
+
}, null, 8, ["model-value"]),
|
|
3184
|
+
t("div", no, [
|
|
3185
|
+
(p(), I(ce((a = x.value) == null ? void 0 : a.component), Pe({
|
|
3186
|
+
modelValue: e.value,
|
|
3187
|
+
"onUpdate:modelValue": o[1] || (o[1] = (u) => e.value = u)
|
|
3188
|
+
}, (w = x.value) == null ? void 0 : w.props), null, 16, ["modelValue"]))
|
|
3189
|
+
])
|
|
3190
|
+
]);
|
|
3191
|
+
};
|
|
3192
|
+
}
|
|
3193
|
+
}), io = {
|
|
3194
|
+
key: 0,
|
|
3195
|
+
class: "flex flex-col h-full"
|
|
3196
|
+
}, ro = { class: "flex flex-col gap-16 pb-[24px]" }, mo = { class: "flex flex-row justify-between items-center gap-2" }, uo = { class: "flex flex-row gap-2 items-center" }, po = { class: "relative group cursor-pointer" }, co = { class: "flex flex-col gap-24 pt-[24px] overflow-scroll" }, fo = { class: "flex flex-col gap-16" }, vo = { class: "flex flex-row items-center max-w-[100%]" }, go = { class: "flex-grow" }, yo = { class: "flex flex-row items-center max-w-[100%]" }, xo = { class: "flex flex-row items-center gap-x-16" }, _o = { class: "grid-cols-1 grid gap-16" }, wo = /* @__PURE__ */ z({
|
|
3197
|
+
__name: "Setting",
|
|
3198
|
+
props: {
|
|
3199
|
+
modelValue: { required: !0 },
|
|
3200
|
+
modelModifiers: {}
|
|
3201
|
+
},
|
|
3202
|
+
emits: ["update:modelValue"],
|
|
3203
|
+
setup(k) {
|
|
3204
|
+
const e = G(k, "modelValue"), g = re(), s = fe(), y = se(), { promptLoader: x } = ye(), { promptMessage: C } = he(), { restaurants: f } = ie(), F = Y(
|
|
3205
|
+
() => f.map((o) => ({ label: o.name, value: o.id }))
|
|
3206
|
+
);
|
|
3207
|
+
async function i() {
|
|
3208
|
+
await C({
|
|
3209
|
+
message: `Confirm delete ${e.value.name}?`,
|
|
3210
|
+
title: "Delete"
|
|
3211
|
+
}) && await x(async () => {
|
|
3212
|
+
try {
|
|
3213
|
+
await xe(e.value._id), await s.getSettings(), y.back();
|
|
3214
|
+
} catch (l) {
|
|
3215
|
+
g.open({ type: "error", message: l.message });
|
|
3216
|
+
}
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
async function c() {
|
|
3220
|
+
await x(async () => {
|
|
3221
|
+
try {
|
|
3222
|
+
await _e(e.value._id, e.value), await s.getSettings();
|
|
3223
|
+
} catch (o) {
|
|
3224
|
+
g.open({ type: "error", message: o.message });
|
|
3225
|
+
}
|
|
3226
|
+
});
|
|
3227
|
+
}
|
|
3228
|
+
function _(o, l) {
|
|
3229
|
+
var d, m;
|
|
3230
|
+
(m = (d = e.value.platform) == null ? void 0 : d.mappings) != null && m[o] && (e.value.platform.mappings[o] = e.value.platform.mappings[o].filter(
|
|
3231
|
+
(a, w) => w !== l
|
|
3232
|
+
));
|
|
3233
|
+
}
|
|
3234
|
+
function v(o) {
|
|
3235
|
+
var l, d;
|
|
3236
|
+
(d = (l = e.value.platform) == null ? void 0 : l.mappings) != null && d[o] && (e.value.platform.mappings[o] = [
|
|
3237
|
+
...e.value.platform.mappings[o],
|
|
3238
|
+
{
|
|
3239
|
+
key: "",
|
|
3240
|
+
name: "",
|
|
3241
|
+
badgeNo: "",
|
|
3242
|
+
employeeNo: ""
|
|
3243
|
+
}
|
|
3244
|
+
]);
|
|
3245
|
+
}
|
|
3246
|
+
async function V() {
|
|
3247
|
+
await x(async () => {
|
|
3248
|
+
try {
|
|
3249
|
+
await we(e.value._id), await s.getSettings();
|
|
3250
|
+
} catch (o) {
|
|
3251
|
+
g.open({ type: "error", message: o.message });
|
|
3252
|
+
}
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3255
|
+
return (o, l) => {
|
|
3256
|
+
var N, K, L, R, M;
|
|
3257
|
+
const d = h("FmIcon"), m = h("FmButton"), a = h("FmMenuDivider"), w = h("FmTextField"), u = h("FmSelect");
|
|
3258
|
+
return (K = (N = e.value) == null ? void 0 : N.platform) != null && K.mappings ? (p(), $("div", io, [
|
|
3259
|
+
t("div", ro, [
|
|
3260
|
+
t("div", mo, [
|
|
3261
|
+
l[5] || (l[5] = t("div", { class: "fm-typo-en-title-sm-800" }, null, -1)),
|
|
3262
|
+
t("div", uo, [
|
|
3263
|
+
t("div", po, [
|
|
3264
|
+
n(d, {
|
|
3265
|
+
name: "refresh",
|
|
3266
|
+
class: "p-2 bg-gray-100 rounded-full",
|
|
3267
|
+
onClick: V
|
|
3268
|
+
}),
|
|
3269
|
+
l[4] || (l[4] = t("span", { class: "absolute left-1/2 -translate-x-2/3 top-full mt-2 w-max bg-gray-900 text-white text-sm px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity" }, " Repopulate the fields based on the dates selected in Preview. ", -1))
|
|
3270
|
+
]),
|
|
3271
|
+
n(m, {
|
|
3272
|
+
variant: "tertiary",
|
|
3273
|
+
label: "Delete",
|
|
3274
|
+
onClick: i
|
|
3275
|
+
}),
|
|
3276
|
+
n(m, {
|
|
3277
|
+
variant: "primary",
|
|
3278
|
+
label: "Update",
|
|
3279
|
+
onClick: c
|
|
3280
|
+
})
|
|
3281
|
+
])
|
|
3282
|
+
])
|
|
3283
|
+
]),
|
|
3284
|
+
n(a, { style: { margin: 0 } }),
|
|
3285
|
+
t("div", co, [
|
|
3286
|
+
t("div", fo, [
|
|
3287
|
+
l[8] || (l[8] = t("div", { class: "fm-typo-en-title-sm-800" }, "General", -1)),
|
|
3288
|
+
t("div", vo, [
|
|
3289
|
+
l[6] || (l[6] = t("div", { class: "w-[25%]" }, "Name", -1)),
|
|
3290
|
+
t("div", go, [
|
|
3291
|
+
n(w, {
|
|
3292
|
+
modelValue: e.value.name,
|
|
3293
|
+
"onUpdate:modelValue": l[0] || (l[0] = (P) => e.value.name = P)
|
|
3294
|
+
}, null, 8, ["modelValue"])
|
|
3295
|
+
])
|
|
3296
|
+
]),
|
|
3297
|
+
t("div", yo, [
|
|
3298
|
+
l[7] || (l[7] = t("div", { class: "w-[25%]" }, "Location", -1)),
|
|
3299
|
+
n(u, {
|
|
3300
|
+
"model-value": e.value.platform.locationIds[0],
|
|
3301
|
+
multiselect: !1,
|
|
3302
|
+
items: F.value,
|
|
3303
|
+
placeholder: "Select location",
|
|
3304
|
+
class: "flex-grow",
|
|
3305
|
+
"onUpdate:modelValue": l[1] || (l[1] = (P) => e.value.platform.locationIds[0] = P)
|
|
3306
|
+
}, null, 8, ["model-value", "items"])
|
|
3307
|
+
])
|
|
3308
|
+
]),
|
|
3309
|
+
n($e, {
|
|
3310
|
+
modelValue: e.value.platform,
|
|
3311
|
+
"onUpdate:modelValue": l[2] || (l[2] = (P) => e.value.platform = P),
|
|
3312
|
+
label: "email"
|
|
3313
|
+
}, null, 8, ["modelValue"]),
|
|
3314
|
+
t("div", xo, [
|
|
3315
|
+
l[9] || (l[9] = t("div", { class: "fm-typo-en-title-sm-800" }, "Employees", -1)),
|
|
3316
|
+
n(m, {
|
|
3317
|
+
variant: "primary",
|
|
3318
|
+
icon: "add",
|
|
3319
|
+
onClick: l[3] || (l[3] = () => v("employees"))
|
|
3320
|
+
})
|
|
3321
|
+
]),
|
|
3322
|
+
t("div", _o, [
|
|
3323
|
+
(p(!0), $(B, null, q((M = (R = (L = e.value) == null ? void 0 : L.platform) == null ? void 0 : R.mappings) == null ? void 0 : M.employees, (P, A) => (p(), I(U, {
|
|
3324
|
+
key: `employee-${A}`,
|
|
3325
|
+
modelValue: e.value.platform.mappings.employees[A],
|
|
3326
|
+
"onUpdate:modelValue": (X) => e.value.platform.mappings.employees[A] = X,
|
|
3327
|
+
options: {
|
|
3328
|
+
key: { placeholder: "Name", editable: !0 },
|
|
3329
|
+
badgeNo: { placeholder: "Badge No", editable: !0 },
|
|
3330
|
+
employeeNo: { placeholder: "Employee No", editable: !0 }
|
|
3331
|
+
},
|
|
3332
|
+
removable: !0,
|
|
3333
|
+
onRemove: () => _("employees", A)
|
|
3334
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onRemove"]))), 128))
|
|
3335
|
+
])
|
|
3336
|
+
])
|
|
3337
|
+
])) : H("", !0);
|
|
3338
|
+
};
|
|
3339
|
+
}
|
|
3340
|
+
}), bo = { class: "h-full flex flex-col gap-16" }, ho = { class: "flex flex-row gap-2 justify-between items-center" }, Vo = {
|
|
3341
|
+
key: 0,
|
|
3342
|
+
class: "flex gap-24 w-full h-full justify-center items-center overflow-scroll"
|
|
3343
|
+
}, ko = /* @__PURE__ */ z({
|
|
3344
|
+
__name: "Preview",
|
|
3345
|
+
props: {
|
|
3346
|
+
modelValue: { required: !0 },
|
|
3347
|
+
modelModifiers: {}
|
|
3348
|
+
},
|
|
3349
|
+
emits: ["update:modelValue"],
|
|
3350
|
+
setup(k) {
|
|
3351
|
+
const e = j([]), g = [
|
|
3352
|
+
{
|
|
3353
|
+
accessorKey: "name",
|
|
3354
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Name"),
|
|
3355
|
+
enableSorting: !1
|
|
3356
|
+
},
|
|
3357
|
+
{
|
|
3358
|
+
accessorKey: "badgeNo",
|
|
3359
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Badge No"),
|
|
3360
|
+
enableSorting: !1
|
|
3361
|
+
},
|
|
3362
|
+
{
|
|
3363
|
+
accessorKey: "employeeNo",
|
|
3364
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Employee No"),
|
|
3365
|
+
enableSorting: !1
|
|
3366
|
+
},
|
|
3367
|
+
{
|
|
3368
|
+
accessorKey: "date",
|
|
3369
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Date"),
|
|
3370
|
+
enableSorting: !1
|
|
3371
|
+
},
|
|
3372
|
+
{
|
|
3373
|
+
accessorKey: "time",
|
|
3374
|
+
header: () => D("p", { class: "min-w-[90px] text-nowrap text-ellipsis" }, "Time"),
|
|
3375
|
+
enableSorting: !1
|
|
3376
|
+
}
|
|
3377
|
+
], s = G(k, "modelValue"), y = j(!1), x = re(), { dateRange: C } = Ve(ie());
|
|
3378
|
+
de(
|
|
3379
|
+
() => C.value,
|
|
3380
|
+
async () => {
|
|
3381
|
+
if (s.value._id)
|
|
3382
|
+
try {
|
|
3383
|
+
y.value = !0, e.value = await be(s.value._id);
|
|
3384
|
+
} catch (F) {
|
|
3385
|
+
x.open({ message: F.message, type: "error" });
|
|
3386
|
+
} finally {
|
|
3387
|
+
y.value = !1;
|
|
3388
|
+
}
|
|
3389
|
+
},
|
|
3390
|
+
{
|
|
3391
|
+
immediate: !0
|
|
3392
|
+
}
|
|
3393
|
+
);
|
|
3394
|
+
async function f() {
|
|
3395
|
+
try {
|
|
3396
|
+
s.value._id ? (y.value = !0, await Fe(s.value._id)) : x.open({ message: "Invalid setting", type: "error" });
|
|
3397
|
+
} catch (F) {
|
|
3398
|
+
x.open({ message: F.message, type: "error" });
|
|
3399
|
+
} finally {
|
|
3400
|
+
y.value = !1;
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
return (F, i) => {
|
|
3404
|
+
const c = h("FmButton"), _ = h("FmCircularProgress"), v = h("FmTable");
|
|
3405
|
+
return p(), $("div", bo, [
|
|
3406
|
+
t("div", ho, [
|
|
3407
|
+
n(ke, {
|
|
3408
|
+
"date-range": J(C),
|
|
3409
|
+
"onUpdate:dateRange": i[0] || (i[0] = (V) => ge(C) ? C.value = V : null),
|
|
3410
|
+
compare: !1
|
|
3411
|
+
}, null, 8, ["date-range"]),
|
|
3412
|
+
n(c, {
|
|
3413
|
+
loading: y.value,
|
|
3414
|
+
variant: "primary",
|
|
3415
|
+
label: "Download",
|
|
3416
|
+
onClick: f
|
|
3417
|
+
}, null, 8, ["loading"])
|
|
3418
|
+
]),
|
|
3419
|
+
y.value ? (p(), $("div", Vo, [
|
|
3420
|
+
n(_, { size: "xl" }),
|
|
3421
|
+
i[1] || (i[1] = t("span", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Loading data... ", -1))
|
|
3422
|
+
])) : e.value.length > 0 ? (p(), I(v, {
|
|
3423
|
+
key: 1,
|
|
3424
|
+
class: "flex overflow-scroll",
|
|
3425
|
+
"row-data": e.value,
|
|
3426
|
+
"column-defs": g
|
|
3427
|
+
}, null, 8, ["row-data"])) : H("", !0)
|
|
3428
|
+
]);
|
|
3429
|
+
};
|
|
3430
|
+
}
|
|
3431
|
+
}), So = { class: "h-full relative flex flex-col" }, $o = { class: "py-16 px-16 overflow-hidden flex-grow relative" }, Co = /* @__PURE__ */ z({
|
|
3432
|
+
__name: "IFlexiHRMS",
|
|
3433
|
+
props: {
|
|
3434
|
+
modelValue: {},
|
|
3435
|
+
modelModifiers: {}
|
|
3436
|
+
},
|
|
3437
|
+
emits: ["update:modelValue"],
|
|
3438
|
+
setup(k) {
|
|
3439
|
+
const e = G(k, "modelValue"), g = j("setting"), s = [
|
|
3440
|
+
{
|
|
3441
|
+
label: "Setting",
|
|
3442
|
+
value: "setting",
|
|
3443
|
+
icon: "settings"
|
|
3444
|
+
},
|
|
3445
|
+
{
|
|
3446
|
+
label: "Preview",
|
|
3447
|
+
value: "preview",
|
|
3448
|
+
icon: "table"
|
|
3449
|
+
}
|
|
3450
|
+
], y = se(), x = Y(() => {
|
|
3451
|
+
switch (g.value) {
|
|
3452
|
+
case "preview":
|
|
3453
|
+
return ko;
|
|
3454
|
+
case "setting":
|
|
3455
|
+
return wo;
|
|
3456
|
+
default:
|
|
3457
|
+
return null;
|
|
3458
|
+
}
|
|
3459
|
+
});
|
|
3460
|
+
return (C, f) => {
|
|
3461
|
+
var c;
|
|
3462
|
+
const F = h("FmPageHead"), i = h("FmTabs");
|
|
3463
|
+
return p(), $("div", So, [
|
|
3464
|
+
n(F, {
|
|
3465
|
+
title: ((c = e.value) == null ? void 0 : c.name) || "AutoCount",
|
|
3466
|
+
"back-button": !0,
|
|
3467
|
+
style: { paddingLeft: "0px", paddingRight: "0px" },
|
|
3468
|
+
"onClick:back": J(y).back
|
|
3469
|
+
}, {
|
|
3470
|
+
description: ue(() => f[2] || (f[2] = [
|
|
3471
|
+
t("div", null, null, -1)
|
|
3472
|
+
])),
|
|
3473
|
+
_: 1
|
|
3474
|
+
}, 8, ["title", "onClick:back"]),
|
|
3475
|
+
n(i, {
|
|
3476
|
+
"model-value": g.value,
|
|
3477
|
+
"onUpdate:modelValue": f[0] || (f[0] = (_) => g.value = _),
|
|
3478
|
+
items: s
|
|
3479
|
+
}, null, 8, ["model-value"]),
|
|
3480
|
+
t("div", $o, [
|
|
3481
|
+
(p(), I(ce(x.value), {
|
|
3482
|
+
modelValue: e.value,
|
|
3483
|
+
"onUpdate:modelValue": f[1] || (f[1] = (_) => e.value = _)
|
|
3484
|
+
}, null, 8, ["modelValue"]))
|
|
3485
|
+
])
|
|
3486
|
+
]);
|
|
3487
|
+
};
|
|
3488
|
+
}
|
|
3489
|
+
}), Fo = { class: "px-24 h-full relative" }, No = /* @__PURE__ */ z({
|
|
3490
|
+
__name: "Integration",
|
|
3491
|
+
setup(k) {
|
|
3492
|
+
const e = j(void 0), { params: g } = Ke(), s = fe(), y = j();
|
|
3493
|
+
Ie(async () => {
|
|
3494
|
+
s.settings.length === 0 && await s.getSettings();
|
|
3495
|
+
}), de(
|
|
3496
|
+
() => s.settings,
|
|
3497
|
+
(C) => {
|
|
3498
|
+
var F;
|
|
3499
|
+
const f = C.find((i) => i._id === g.id);
|
|
3500
|
+
f && (y.value = f, e.value = (F = y.value.platform) == null ? void 0 : F.name);
|
|
3501
|
+
},
|
|
3502
|
+
{ immediate: !0 }
|
|
3503
|
+
);
|
|
3504
|
+
const x = Y(() => {
|
|
3505
|
+
switch (e.value) {
|
|
3506
|
+
case ne.Xero:
|
|
3507
|
+
return Kt;
|
|
3508
|
+
case ne.Bukku:
|
|
3509
|
+
return ua;
|
|
3510
|
+
case ne.AutoCount:
|
|
3511
|
+
return Ra;
|
|
3512
|
+
case ne.SQL:
|
|
3513
|
+
return pl;
|
|
3514
|
+
case ne.iFlexi_HRMS:
|
|
3515
|
+
return Co;
|
|
3516
|
+
case ne.Biztory:
|
|
3517
|
+
return so;
|
|
3518
|
+
default:
|
|
3519
|
+
return null;
|
|
3520
|
+
}
|
|
3521
|
+
});
|
|
3522
|
+
return (C, f) => (p(), $("div", Fo, [
|
|
3523
|
+
(p(), I(ce(x.value), {
|
|
3524
|
+
modelValue: y.value,
|
|
3525
|
+
"onUpdate:modelValue": f[0] || (f[0] = (F) => y.value = F)
|
|
3526
|
+
}, null, 8, ["modelValue"]))
|
|
3527
|
+
]));
|
|
3528
|
+
}
|
|
3529
|
+
});
|
|
3530
|
+
export {
|
|
3531
|
+
No as default
|
|
3532
|
+
};
|