@feedmepos/mf-report 5.8.1 → 5.8.2

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