@feedmepos/mf-report 5.4.15-beta.1 → 5.4.15-beta.3

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