@feedmepos/mf-inventory-portal 1.2.1 → 1.2.2-5.dev-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-DMkUg806.js +297 -0
- package/dist/{ApprovalView-DwRrbVDo.js → ApprovalView-DWJh2K6W.js} +65 -64
- package/dist/{BindingsDialog-DUVKv10-.js → BindingsDialog-EmHCvqJI.js} +2 -2
- package/dist/{BindingsPicker-Daib_iq4.js → BindingsPicker-h_9jm1s0.js} +3 -3
- package/dist/{BindingsTable-Bv9UmcJP.js → BindingsTable-BAVWGUoa.js} +1 -1
- package/dist/ClosingDraftView-Du4kOwIg.js +1899 -0
- package/dist/ClosingHistoryView-DuW2Vtrs.js +355 -0
- package/dist/ClosingTemplateView-CfPY8R5M.js +2001 -0
- package/dist/{DeliveryOrderPrintPreview-DZPcRAja.js → DeliveryOrderPrintPreview-C6Cj8mOp.js} +9 -9
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-WWIrybw_.js +230 -0
- package/dist/{FmMultiselectDialog-CZmwOkrb.js → FmMultiselectDialog-BzWrQOS4.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C-2V2bGc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DwqVRUFz.js} +36 -36
- package/dist/ImportView-lKlYeLay.js +1291 -0
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js} +5 -5
- package/dist/{IngredientGroupView-CAVYpEj3.js → IngredientGroupView-CrmwR2Xt.js} +34 -35
- package/dist/IngredientsView-1bAsyz-b.js +2254 -0
- package/dist/{IntegrationView-DdLFyZ4H.js → IntegrationView-D16qeEc_.js} +1773 -1635
- package/dist/{InventoryBindingForm-C7BdEDtM.js → InventoryBindingForm-BRwOXV_P.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js} +28 -28
- package/dist/{InventoryBindingSummary-IZ7F-Lti.js → InventoryBindingSummary-DKM2gX8_.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sgqVSlUB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js} +4 -4
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeF32bHu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B0OKeK5O.js} +7 -7
- package/dist/{PublishView-DkgfYneI.js → PublishView-D0NnU22l.js} +73 -63
- package/dist/{PurchaseOrderPrintPreview-CltLC4o4.js → PurchaseOrderPrintPreview-BmuwNbeL.js} +4 -4
- package/dist/{ReceiveRequestView-Dj7ji0DY.js → ReceiveRequestView-j79m7TKk.js} +343 -333
- package/dist/RecipeView-D_fNQQ-C.js +636 -0
- package/dist/StockView-DX_xeFBT.js +2385 -0
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bg49isUy.js +172 -0
- package/dist/{SupplierView-DE_M_9kd.js → SupplierView-DuFTqbOg.js} +1193 -1073
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-c428GXwc.js +3233 -0
- package/dist/{TransferTemplateView-gWGBCF3u.js → TransferTemplateView-Ccsfcetz.js} +104 -103
- package/dist/UnitView-BklpNsFN.js +674 -0
- package/dist/WarehouseView-BrURbU67.js +1066 -0
- package/dist/api/adjustment-template.d.ts +1 -0
- package/dist/api/bill.d.ts +140 -2
- package/dist/api/closing-template.d.ts +1 -0
- package/dist/api/closing.d.ts +1 -0
- package/dist/api/inventory.d.ts +405 -0
- package/dist/api/netsuite.d.ts +5 -1
- package/dist/api/purchase-order-template.d.ts +1 -0
- package/dist/api/purchase-order.d.ts +3 -0
- package/dist/api/shipment.d.ts +11 -0
- package/dist/api/stock.d.ts +2 -44
- package/dist/api/warehouse.d.ts +3 -1
- package/dist/{app-CruHLH1e.js → app-a9r50k3U.js} +68551 -67573
- package/dist/app.d.ts +643 -15
- package/dist/app.js +6 -6
- package/dist/components/FmAdminBadge.vue.d.ts +1 -4
- package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +16 -2
- package/dist/components/FmLockableField.vue.d.ts +3 -0
- package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
- package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +2 -0
- package/dist/composable/defineApi.d.ts +1 -1
- package/dist/composable/useIframe.d.ts +2 -2
- package/dist/{decimal-izbvCC1j.js → decimal-AusUnA1W.js} +1 -1
- package/dist/{format-unit-display-4SAdfyZB.js → format-unit-display-BqkHL-ph.js} +397 -429
- package/dist/helper/array.d.ts +1 -0
- package/dist/helper/core/country/utils.d.ts +3 -4
- package/dist/helper/country.d.ts +6 -255
- package/dist/helper/number.d.ts +1 -0
- package/dist/import-export.helper-PIyNeHfa.js +238 -0
- package/dist/{index-B6GGthLw.js → index-CjxirPvn.js} +283 -268
- package/dist/{index-CnQloOEo.js → index-Dj9-pdT9.js} +1 -1
- package/dist/layout/SingleColumnLayout.vue.d.ts +6 -3
- package/dist/purchase-order-template-CQikvY1p.js +41 -0
- package/dist/router/name.d.ts +2 -0
- package/dist/stock-CDZ2uWSF.js +83 -0
- package/dist/stock-Dw908dIC.js +74 -0
- package/dist/stores/feature.d.ts +12 -0
- package/dist/stores/integration/netsuite.d.ts +42 -0
- package/dist/stores/inventory.d.ts +28 -199
- package/dist/stores/location.d.ts +331 -1
- package/dist/stores/supplier.d.ts +96 -0
- package/dist/stores/warehouse.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-CTVE1lHO.js → supplier-BPPBUudN.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CM80TfX0.js → use-ingredient-select-dialog-C_fSKN3_.js} +5 -5
- package/dist/{use-inventory-binding-dialog-D_omdhgn.js → use-inventory-binding-dialog-ClAkJ864.js} +8 -8
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +60 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +60 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +9 -2
- package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +4 -1
- package/dist/views/closing-template/helpers/import-export.helper.d.ts +5 -0
- package/dist/views/import/ImportView.vue.d.ts +3 -0
- package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
- package/dist/views/import/helper/import-export.helper.d.ts +4 -0
- package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +1 -1
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +181 -12
- package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +6 -0
- package/dist/views/ingredients/helper/import-export.helper.d.ts +4 -1
- package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
- package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
- package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
- package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
- package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
- package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +21 -0
- package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +420 -2
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +99 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +644 -13
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +711 -14
- package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
- package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
- package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
- package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +70 -1
- package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
- package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
- package/dist/views/stock/components/dialog/StockAdjustmentSideSheet.vue.d.ts +20 -0
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +8 -0
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
- package/dist/views/supplier/composables/use-supplier-table.d.ts +4 -0
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -0
- package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +16 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -0
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -0
- package/dist/views/unit/UnitView.vue.d.ts +1 -0
- package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
- package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
- package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
- package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
- package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -0
- package/package.json +3 -3
- package/dist/App-BqaRC0Sb.js +0 -276
- package/dist/ClosingDraftView-sJ_zRPeo.js +0 -1687
- package/dist/ClosingTemplateView-cNgXHq1r.js +0 -1908
- package/dist/FmAdminBadge-oCnz8SW6.js +0 -34
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKR8C4p_.js +0 -224
- package/dist/IngredientsView-CHHeAJH_.js +0 -1858
- package/dist/RecipeView-BukmKdVG.js +0 -621
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
- package/dist/StockView-wxRCw_w-.js +0 -2087
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eqUOnJoM.js +0 -2336
- package/dist/UnitView-BgwDmGZo.js +0 -667
- package/dist/WarehouseView-BdccenhO.js +0 -1034
- package/dist/array-Ca8T3f_G.js +0 -44
- package/dist/helper/core/country/codes.d.ts +0 -255
- package/dist/stock-BJP5BB5b.js +0 -146
|
@@ -1,1687 +0,0 @@
|
|
|
1
|
-
import { defineComponent as je, ref as E, computed as P, onMounted as Pe, resolveComponent as T, openBlock as w, createElementBlock as R, Fragment as q, createTextVNode as G, createBlock as Z, withCtx as Y, createElementVNode as n, toDisplayString as K, unref as S, createVNode as D, createCommentVNode as Q, h as I, reactive as et, watch as tt, isRef as Ve, normalizeClass as me, renderList as ve, normalizeStyle as ze, Teleport as at, mergeProps as nt } from "vue";
|
|
2
|
-
import { a3 as ot, u as $e, ap as L, ah as Ne, aq as Oe, m as st, P as Me, j as N, t as rt, T as ye, r as lt, s as ct, v as it, ar as Ye, as as Ke, ac as Ge, at as se, ai as ut, a5 as Ie, a4 as re, a0 as Re, D as He, i as we, h as dt, f as mt, a as ft, B as pt, _ as vt, C as yt, E as gt, G as Ce } from "./app-CruHLH1e.js";
|
|
3
|
-
import { useCoreStore as bt, useI18n as qe } from "@feedmepos/mf-common";
|
|
4
|
-
import { useSnackbar as Ue, useDialog as At, useProxiedModel as Dt, components as de, useBreakpoints as kt } from "@feedmepos/ui-library";
|
|
5
|
-
import { defineStore as We, storeToRefs as _t } from "pinia";
|
|
6
|
-
import { a as Le, u as Ze } from "./stock-BJP5BB5b.js";
|
|
7
|
-
import { E as ht } from "./empty-placeholder-wf6-BWE8.js";
|
|
8
|
-
const Be = ot((l, o) => {
|
|
9
|
-
function e() {
|
|
10
|
-
return $e().currentLocation.dbName;
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
async getDraft(c) {
|
|
14
|
-
const f = e(), h = `${l.inventoryBackendUrl}/${f}/closing-draft/${c}`;
|
|
15
|
-
return o.get(h);
|
|
16
|
-
},
|
|
17
|
-
async readDrafts() {
|
|
18
|
-
const c = e(), f = `${l.inventoryBackendUrl}/${c}/closing-draft`;
|
|
19
|
-
return o.get(f);
|
|
20
|
-
},
|
|
21
|
-
async runOperation(c) {
|
|
22
|
-
const f = e(), h = `${l.inventoryBackendUrl}/${f}/closing-draft/run-operation`;
|
|
23
|
-
return o.post(h, c);
|
|
24
|
-
},
|
|
25
|
-
async sync(c) {
|
|
26
|
-
const f = e(), h = `${l.inventoryBackendUrl}/${f}/closing-draft/sync`;
|
|
27
|
-
return o.post(h, c);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}), xt = { class: "fm-typo-en-body-lg-400" }, wt = { class: "fm-typo-en-body-lg-600" }, Ct = {
|
|
31
|
-
key: 0,
|
|
32
|
-
class: "flex flex-col"
|
|
33
|
-
}, St = { class: "flex gap-12 py-8 justify-end w-full" }, Te = /* @__PURE__ */ je({
|
|
34
|
-
__name: "ClosingDraftAction",
|
|
35
|
-
props: {
|
|
36
|
-
draft: {},
|
|
37
|
-
action: {},
|
|
38
|
-
onCancel: { type: Function },
|
|
39
|
-
onFinished: { type: Function }
|
|
40
|
-
},
|
|
41
|
-
setup(l) {
|
|
42
|
-
const o = l, e = E(), c = Be(), f = Ue(), h = E(!1), v = E(null), M = E(!1), d = P(() => {
|
|
43
|
-
switch (o.action) {
|
|
44
|
-
case L.enum.approveDraft:
|
|
45
|
-
return "Approve";
|
|
46
|
-
case L.enum.rejectDraft:
|
|
47
|
-
return "Reject";
|
|
48
|
-
case L.enum.markAsFailed:
|
|
49
|
-
return "Mark as Failed";
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`Unknown action: ${o.action}`);
|
|
52
|
-
}), y = P(() => {
|
|
53
|
-
switch (o.action) {
|
|
54
|
-
case L.enum.approveDraft:
|
|
55
|
-
return "primary";
|
|
56
|
-
case L.enum.rejectDraft:
|
|
57
|
-
return "destructive";
|
|
58
|
-
case L.enum.markAsFailed:
|
|
59
|
-
return "destructive";
|
|
60
|
-
}
|
|
61
|
-
throw new Error(`Unknown action: ${o.action}`);
|
|
62
|
-
});
|
|
63
|
-
Pe(() => {
|
|
64
|
-
if (o.draft.effectiveAt)
|
|
65
|
-
v.value = new Date(o.draft.effectiveAt);
|
|
66
|
-
else {
|
|
67
|
-
const s = new Date(o.draft.createdAt);
|
|
68
|
-
s.setHours(23, 59, 59, 999), v.value = s;
|
|
69
|
-
}
|
|
70
|
-
M.value = !0;
|
|
71
|
-
});
|
|
72
|
-
const B = P({
|
|
73
|
-
get() {
|
|
74
|
-
return v.value === null ? "" : Ne(v.value);
|
|
75
|
-
},
|
|
76
|
-
set(s) {
|
|
77
|
-
if (s) {
|
|
78
|
-
const a = /* @__PURE__ */ new Date(`${s} ${H.value}`);
|
|
79
|
-
a.setSeconds(59, 999), v.value = a;
|
|
80
|
-
} else
|
|
81
|
-
v.value = null;
|
|
82
|
-
}
|
|
83
|
-
}), H = P({
|
|
84
|
-
get() {
|
|
85
|
-
return v.value === null ? "" : Oe(v.value);
|
|
86
|
-
},
|
|
87
|
-
set(s) {
|
|
88
|
-
if (s) {
|
|
89
|
-
const a = /* @__PURE__ */ new Date(`${B.value} ${s}`);
|
|
90
|
-
a.setSeconds(59, 999), v.value = a;
|
|
91
|
-
} else
|
|
92
|
-
v.value = null;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
async function O() {
|
|
96
|
-
h.value = !0;
|
|
97
|
-
try {
|
|
98
|
-
await c.runOperation({
|
|
99
|
-
_id: o.draft._id,
|
|
100
|
-
_rev: o.draft._rev ?? "",
|
|
101
|
-
action: o.action,
|
|
102
|
-
data: {
|
|
103
|
-
effectiveAt: v.value ? v.value.toISOString() : null,
|
|
104
|
-
remark: e.value
|
|
105
|
-
}
|
|
106
|
-
}).delayed(500), f.open({
|
|
107
|
-
title: "Success",
|
|
108
|
-
message: "Action submitted",
|
|
109
|
-
type: "success"
|
|
110
|
-
}), o.onFinished();
|
|
111
|
-
} catch (s) {
|
|
112
|
-
f.open({
|
|
113
|
-
title: "Something went wrong",
|
|
114
|
-
message: "Unable to submit action. Please try again",
|
|
115
|
-
type: "error"
|
|
116
|
-
}), console.error("error on submit closing draft action", s);
|
|
117
|
-
} finally {
|
|
118
|
-
h.value = !1;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return (s, a) => {
|
|
122
|
-
const k = T("FmLabel"), V = T("FmDatePicker"), m = T("FmTimePicker"), p = T("FmTextField"), C = T("FmButton"), $ = T("FmForm");
|
|
123
|
-
return M.value ? (w(), Z($, {
|
|
124
|
-
key: 1,
|
|
125
|
-
onValidationSuccess: O,
|
|
126
|
-
class: "flex flex-col gap-32",
|
|
127
|
-
disabled: h.value
|
|
128
|
-
}, {
|
|
129
|
-
default: Y(() => [
|
|
130
|
-
n("div", xt, [
|
|
131
|
-
a[4] || (a[4] = G(" You are about to ")),
|
|
132
|
-
n("span", wt, K(d.value), 1),
|
|
133
|
-
a[5] || (a[5] = G(" this draft. Please provide a remark to justify this action. "))
|
|
134
|
-
]),
|
|
135
|
-
s.action === S(L).enum.approveDraft ? (w(), R("div", Ct, [
|
|
136
|
-
D(k, { class: "fm-typo-en-body-lg-600" }, {
|
|
137
|
-
default: Y(() => a[6] || (a[6] = [
|
|
138
|
-
G("Closing Date")
|
|
139
|
-
])),
|
|
140
|
-
_: 1
|
|
141
|
-
}),
|
|
142
|
-
D(V, {
|
|
143
|
-
modelValue: B.value,
|
|
144
|
-
"onUpdate:modelValue": a[0] || (a[0] = (F) => B.value = F)
|
|
145
|
-
}, null, 8, ["modelValue"]),
|
|
146
|
-
D(k, { class: "fm-typo-en-body-lg-600" }, {
|
|
147
|
-
default: Y(() => a[7] || (a[7] = [
|
|
148
|
-
G("Closing Time")
|
|
149
|
-
])),
|
|
150
|
-
_: 1
|
|
151
|
-
}),
|
|
152
|
-
D(m, {
|
|
153
|
-
modelValue: H.value,
|
|
154
|
-
"onUpdate:modelValue": a[1] || (a[1] = (F) => H.value = F)
|
|
155
|
-
}, null, 8, ["modelValue"])
|
|
156
|
-
])) : Q("", !0),
|
|
157
|
-
D(p, {
|
|
158
|
-
modelValue: e.value,
|
|
159
|
-
"onUpdate:modelValue": a[2] || (a[2] = (F) => e.value = F),
|
|
160
|
-
label: "Remark",
|
|
161
|
-
"label-mark": "required",
|
|
162
|
-
rules: [S(st)()]
|
|
163
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
164
|
-
n("div", St, [
|
|
165
|
-
D(C, {
|
|
166
|
-
label: "Cancel",
|
|
167
|
-
variant: "tertiary",
|
|
168
|
-
onClick: a[3] || (a[3] = (F) => s.onCancel())
|
|
169
|
-
}),
|
|
170
|
-
D(C, {
|
|
171
|
-
label: d.value,
|
|
172
|
-
type: "submit",
|
|
173
|
-
variant: y.value,
|
|
174
|
-
loading: h.value
|
|
175
|
-
}, null, 8, ["label", "variant", "loading"])
|
|
176
|
-
])
|
|
177
|
-
]),
|
|
178
|
-
_: 1
|
|
179
|
-
}, 8, ["disabled"])) : (w(), R(q, { key: 0 }, [
|
|
180
|
-
G("Loading")
|
|
181
|
-
], 64));
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
}), Ft = ye(0);
|
|
185
|
-
function Je(l) {
|
|
186
|
-
const o = l.measurementsAmounts.groupBy((c) => c.measurement.id), e = l.sku.unit.measurements.reduce((c, f) => {
|
|
187
|
-
var M, d;
|
|
188
|
-
const h = ((d = (M = o.get(f.id)) == null ? void 0 : M[0]) == null ? void 0 : d.amount) ?? Ft, v = Me(f.conversion, h);
|
|
189
|
-
return c + +N(v);
|
|
190
|
-
}, +N(l.baseAmount));
|
|
191
|
-
return rt(e, l.baseAmount.precision);
|
|
192
|
-
}
|
|
193
|
-
const jt = ye(0), $t = ye(100);
|
|
194
|
-
function Bt(l, o, e) {
|
|
195
|
-
const c = Je(l), f = Ye(c, o), h = o.amount === 0 ? null : Ke(f, {
|
|
196
|
-
...o,
|
|
197
|
-
amount: Math.abs(o.amount)
|
|
198
|
-
}), v = h ? Me(h, $t) : null;
|
|
199
|
-
return {
|
|
200
|
-
code: l.sku.code,
|
|
201
|
-
name: l.sku.name,
|
|
202
|
-
baseUnit: l.sku.unit.abbrev,
|
|
203
|
-
baseUnitAmount: +N(l.baseAmount),
|
|
204
|
-
...l.measurementsAmounts.filter(
|
|
205
|
-
(d) => Tt(d.measurement) && e.includes(d.measurement.id)
|
|
206
|
-
).reduce(
|
|
207
|
-
(d, y, B) => (d[`measurementAbbrev${B}`] = `(${y.measurement.abbrev}) × ${N(y.measurement.conversion)}`, d[`measurementAmount${B}`] = +N(y.amount), d),
|
|
208
|
-
{}
|
|
209
|
-
),
|
|
210
|
-
systemBalance: +N(o),
|
|
211
|
-
physicalBalance: +N(c),
|
|
212
|
-
adjustedAmount: +N(f),
|
|
213
|
-
adjustedDiffPercentage: v ? +N(Ge(v, 2)) : null
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
function Tt(l) {
|
|
217
|
-
return !l.abbrev.toLocaleLowerCase().includes("inactive");
|
|
218
|
-
}
|
|
219
|
-
function It(l) {
|
|
220
|
-
const o = Qe(l);
|
|
221
|
-
return l.reduce(
|
|
222
|
-
(e, c) => {
|
|
223
|
-
var f;
|
|
224
|
-
return Math.max(e, ((f = o == null ? void 0 : o.get(c.sku._id)) == null ? void 0 : f[0].length) ?? 0);
|
|
225
|
-
},
|
|
226
|
-
0
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
function Qe(l) {
|
|
230
|
-
return l.groupBy(
|
|
231
|
-
(o) => o.sku._id,
|
|
232
|
-
(o) => o.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
function Rt(l) {
|
|
236
|
-
return [
|
|
237
|
-
{
|
|
238
|
-
id: "code",
|
|
239
|
-
name: "Code"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
id: "name",
|
|
243
|
-
name: "Name"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
id: "systemBalance",
|
|
247
|
-
name: "Balance"
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
id: "physicalBalance",
|
|
251
|
-
name: "Actual balance"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
id: "adjustedAmount",
|
|
255
|
-
name: "Adjusted balance"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
id: "adjustedDiffPercentage",
|
|
259
|
-
name: "Diff (%)"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
id: "baseUnitAmount",
|
|
263
|
-
name: "Base unit amount"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
id: "baseUnit",
|
|
267
|
-
name: "Base unit"
|
|
268
|
-
},
|
|
269
|
-
...Array.from({ length: l }).flatMap((e, c) => [
|
|
270
|
-
{
|
|
271
|
-
id: `measurementAmount${c}`,
|
|
272
|
-
name: `UOM amount ${c + 1}`
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
id: `measurementAbbrev${c}`,
|
|
276
|
-
name: `UOM ${c + 1}`
|
|
277
|
-
}
|
|
278
|
-
])
|
|
279
|
-
];
|
|
280
|
-
}
|
|
281
|
-
function Pt(l, o) {
|
|
282
|
-
var a, k, V, m, p, C, $;
|
|
283
|
-
const e = o.groupBy(
|
|
284
|
-
(F) => F.id,
|
|
285
|
-
(F) => F.balance
|
|
286
|
-
), c = [...l.items, ...l.negativeStockItems ?? []], f = Qe(c), h = c.map((F) => {
|
|
287
|
-
var W, le;
|
|
288
|
-
const X = ((W = e.get(F.sku._id)) == null ? void 0 : W[0]) ?? jt, J = ((le = f == null ? void 0 : f.get(F.sku._id)) == null ? void 0 : le[0]) ?? [];
|
|
289
|
-
return Bt(F, X, J);
|
|
290
|
-
}), v = It(c), d = bt().currentBusiness.value, y = Rt(v), B = [
|
|
291
|
-
["Business name:", d == null ? void 0 : d.name],
|
|
292
|
-
["Business ID:", d == null ? void 0 : d._id],
|
|
293
|
-
["Menu version", d == null ? void 0 : d.menuVersion],
|
|
294
|
-
["Created at", new Date(l.createdAt)],
|
|
295
|
-
["Created by", (a = l.createdBy) == null ? void 0 : a.name],
|
|
296
|
-
["Updated at", new Date(l.updatedAt)],
|
|
297
|
-
["Updated by", (k = l.updatedBy) == null ? void 0 : k.name],
|
|
298
|
-
["Recent action", l.approvedAt ? "Approve" : l.rejectionHistory ? "Reject" : ""],
|
|
299
|
-
[
|
|
300
|
-
"Action by",
|
|
301
|
-
l.approvedAt ? (V = l.approvedBy) == null ? void 0 : V.name : l.rejectionHistory ? (p = (m = l.rejectionHistory[0]) == null ? void 0 : m.rejectedBy) == null ? void 0 : p.name : ""
|
|
302
|
-
],
|
|
303
|
-
[
|
|
304
|
-
"Action at",
|
|
305
|
-
l.approvedAt ? new Date(l.approvedAt) : l.rejectionHistory ? new Date((C = l.rejectionHistory[0]) == null ? void 0 : C.rejectedAt) : ""
|
|
306
|
-
],
|
|
307
|
-
[
|
|
308
|
-
"Action remark",
|
|
309
|
-
l.approvedAt ? l.approveRemark : l.rejectionHistory ? new Date(($ = l.rejectionHistory[0]) == null ? void 0 : $.rejectRemark) : ""
|
|
310
|
-
],
|
|
311
|
-
[],
|
|
312
|
-
y.map((F) => F.name),
|
|
313
|
-
...h.map((F) => y.map((X) => F[X.id]))
|
|
314
|
-
], H = y.map((F) => `system:${F.id}`), O = lt(B, H), s = `[${d == null ? void 0 : d.name}] closing draft (${ct(new Date(l.updatedAt))}).xlsx`;
|
|
315
|
-
return it(O, s), s;
|
|
316
|
-
}
|
|
317
|
-
const Mt = { class: "flex flex-col" }, Ut = { class: "flex gap-12 py-8 justify-end w-full" }, Lt = /* @__PURE__ */ je({
|
|
318
|
-
__name: "RefreshBalanceAction",
|
|
319
|
-
props: {
|
|
320
|
-
draft: {},
|
|
321
|
-
onCancel: { type: Function },
|
|
322
|
-
onFinished: { type: Function }
|
|
323
|
-
},
|
|
324
|
-
setup(l) {
|
|
325
|
-
const o = l;
|
|
326
|
-
Le();
|
|
327
|
-
const e = E(!1), c = E(null), f = E(!1);
|
|
328
|
-
Pe(() => {
|
|
329
|
-
if (o.draft.effectiveAt)
|
|
330
|
-
c.value = new Date(o.draft.effectiveAt);
|
|
331
|
-
else {
|
|
332
|
-
const d = new Date(o.draft.createdAt);
|
|
333
|
-
d.setHours(23, 59, 59, 999), c.value = d;
|
|
334
|
-
}
|
|
335
|
-
f.value = !0;
|
|
336
|
-
});
|
|
337
|
-
const h = P({
|
|
338
|
-
get() {
|
|
339
|
-
return c.value === null ? "" : Ne(c.value);
|
|
340
|
-
},
|
|
341
|
-
set(d) {
|
|
342
|
-
if (d) {
|
|
343
|
-
const y = /* @__PURE__ */ new Date(`${d} ${v.value}`);
|
|
344
|
-
y.setSeconds(59, 999), c.value = y;
|
|
345
|
-
} else
|
|
346
|
-
c.value = null;
|
|
347
|
-
}
|
|
348
|
-
}), v = P({
|
|
349
|
-
get() {
|
|
350
|
-
return c.value === null ? "" : Oe(c.value);
|
|
351
|
-
},
|
|
352
|
-
set(d) {
|
|
353
|
-
if (d) {
|
|
354
|
-
const y = /* @__PURE__ */ new Date(`${h.value} ${d}`);
|
|
355
|
-
y.setSeconds(59, 999), c.value = y;
|
|
356
|
-
} else
|
|
357
|
-
c.value = null;
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
async function M() {
|
|
361
|
-
e.value = !0, o.onFinished(c.value.toISOString());
|
|
362
|
-
}
|
|
363
|
-
return (d, y) => {
|
|
364
|
-
const B = T("FmLabel"), H = T("FmDatePicker"), O = T("FmTimePicker"), s = T("FmButton"), a = T("FmForm");
|
|
365
|
-
return f.value ? (w(), Z(a, {
|
|
366
|
-
key: 1,
|
|
367
|
-
onValidationSuccess: M,
|
|
368
|
-
class: "flex flex-col gap-32",
|
|
369
|
-
disabled: e.value
|
|
370
|
-
}, {
|
|
371
|
-
default: Y(() => [
|
|
372
|
-
y[5] || (y[5] = n("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
373
|
-
n("p", null, [
|
|
374
|
-
G(" Performing "),
|
|
375
|
-
n("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
376
|
-
G(" until closing effective date and time. ")
|
|
377
|
-
]),
|
|
378
|
-
n("p", { class: "mt-2" }, [
|
|
379
|
-
G(" Please note that this action will "),
|
|
380
|
-
n("b", null, "update"),
|
|
381
|
-
G(" the effective date and time. ")
|
|
382
|
-
])
|
|
383
|
-
], -1)),
|
|
384
|
-
n("div", Mt, [
|
|
385
|
-
D(B, { class: "fm-typo-en-body-lg-600" }, {
|
|
386
|
-
default: Y(() => y[3] || (y[3] = [
|
|
387
|
-
G("Closing Date")
|
|
388
|
-
])),
|
|
389
|
-
_: 1
|
|
390
|
-
}),
|
|
391
|
-
D(H, {
|
|
392
|
-
modelValue: h.value,
|
|
393
|
-
"onUpdate:modelValue": y[0] || (y[0] = (k) => h.value = k)
|
|
394
|
-
}, null, 8, ["modelValue"]),
|
|
395
|
-
D(B, { class: "fm-typo-en-body-lg-600" }, {
|
|
396
|
-
default: Y(() => y[4] || (y[4] = [
|
|
397
|
-
G("Closing Time")
|
|
398
|
-
])),
|
|
399
|
-
_: 1
|
|
400
|
-
}),
|
|
401
|
-
D(O, {
|
|
402
|
-
modelValue: v.value,
|
|
403
|
-
"onUpdate:modelValue": y[1] || (y[1] = (k) => v.value = k)
|
|
404
|
-
}, null, 8, ["modelValue"])
|
|
405
|
-
]),
|
|
406
|
-
n("div", Ut, [
|
|
407
|
-
D(s, {
|
|
408
|
-
label: "Cancel",
|
|
409
|
-
variant: "tertiary",
|
|
410
|
-
onClick: y[2] || (y[2] = (k) => d.onCancel())
|
|
411
|
-
}),
|
|
412
|
-
D(s, {
|
|
413
|
-
label: "Refresh balance",
|
|
414
|
-
type: "submit",
|
|
415
|
-
variant: "primary",
|
|
416
|
-
loading: e.value
|
|
417
|
-
}, null, 8, ["loading"])
|
|
418
|
-
])
|
|
419
|
-
]),
|
|
420
|
-
_: 1
|
|
421
|
-
}, 8, ["disabled"])) : (w(), R(q, { key: 0 }, [
|
|
422
|
-
G("Loading")
|
|
423
|
-
], 64));
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
}), Fe = We(
|
|
427
|
-
"closingDraftActions",
|
|
428
|
-
function() {
|
|
429
|
-
const o = At(), e = Ue(), c = Le(), f = Be(), h = Ze(), v = E(!1), M = E();
|
|
430
|
-
function d(m) {
|
|
431
|
-
const p = {
|
|
432
|
-
draft: m
|
|
433
|
-
};
|
|
434
|
-
M.value = p, v.value = !0;
|
|
435
|
-
}
|
|
436
|
-
async function y(m) {
|
|
437
|
-
var C;
|
|
438
|
-
if (m.status === se.enum.COMPLETED) {
|
|
439
|
-
const $ = m.closingAdjustmentId;
|
|
440
|
-
if (!$)
|
|
441
|
-
return e.open({
|
|
442
|
-
title: "Something went wrong",
|
|
443
|
-
message: "Closing draft is completed but closing document cannot be found.",
|
|
444
|
-
type: "error"
|
|
445
|
-
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
446
|
-
draftId: m._id
|
|
447
|
-
}), [];
|
|
448
|
-
const F = await c.readAdjustmentById($);
|
|
449
|
-
return ((F == null ? void 0 : F.skus) ?? []).map((J) => ({
|
|
450
|
-
id: J.sku._id,
|
|
451
|
-
balance: J.fromBalance,
|
|
452
|
-
costs: J.fromCostBalances
|
|
453
|
-
}));
|
|
454
|
-
} else
|
|
455
|
-
return await h.readStockBalance(), ((C = h.stockBalance) == null ? void 0 : C.skus) ?? [];
|
|
456
|
-
}
|
|
457
|
-
async function B(m, p) {
|
|
458
|
-
p || (e.open({
|
|
459
|
-
title: "Exporting",
|
|
460
|
-
message: "Fetching data..."
|
|
461
|
-
}), p = await y(m)), Pt(m, p);
|
|
462
|
-
}
|
|
463
|
-
function H(m, p) {
|
|
464
|
-
o.open({
|
|
465
|
-
title: "Approve draft",
|
|
466
|
-
contentComponent: Te,
|
|
467
|
-
contentComponentProps: {
|
|
468
|
-
draft: m,
|
|
469
|
-
action: L.enum.approveDraft,
|
|
470
|
-
onFinished: () => {
|
|
471
|
-
o.close(), p == null || p();
|
|
472
|
-
},
|
|
473
|
-
onCancel: () => o.close()
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
function O(m, p) {
|
|
478
|
-
o.open({
|
|
479
|
-
title: "Reject draft",
|
|
480
|
-
contentComponent: Te,
|
|
481
|
-
contentComponentProps: {
|
|
482
|
-
draft: m,
|
|
483
|
-
action: L.enum.rejectDraft,
|
|
484
|
-
onFinished: () => {
|
|
485
|
-
o.close(), p == null || p();
|
|
486
|
-
},
|
|
487
|
-
onCancel: () => o.close()
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
function s(m, p) {
|
|
492
|
-
o.open({
|
|
493
|
-
title: "Mark draft as failed",
|
|
494
|
-
contentComponent: Te,
|
|
495
|
-
contentComponentProps: {
|
|
496
|
-
draft: m,
|
|
497
|
-
action: L.enum.markAsFailed,
|
|
498
|
-
onFinished: () => {
|
|
499
|
-
o.close(), p == null || p();
|
|
500
|
-
},
|
|
501
|
-
onCancel: () => o.close()
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
async function a(m, p) {
|
|
506
|
-
await f.sync({
|
|
507
|
-
_id: m._id,
|
|
508
|
-
_rev: m._rev ?? "",
|
|
509
|
-
action: L.enum.approveDraft,
|
|
510
|
-
data: {
|
|
511
|
-
remark: m.remark ?? ""
|
|
512
|
-
}
|
|
513
|
-
}).delayed(500), e.open({
|
|
514
|
-
title: "Success",
|
|
515
|
-
message: "Sync requested",
|
|
516
|
-
type: "success"
|
|
517
|
-
}), p == null || p();
|
|
518
|
-
}
|
|
519
|
-
function k() {
|
|
520
|
-
v.value = !1;
|
|
521
|
-
}
|
|
522
|
-
async function V(m, p, C) {
|
|
523
|
-
await o.open({
|
|
524
|
-
title: "Refresh balance",
|
|
525
|
-
contentComponent: Lt,
|
|
526
|
-
contentComponentProps: {
|
|
527
|
-
draft: m,
|
|
528
|
-
onFinished: ($) => {
|
|
529
|
-
o.close(), C == null || C($);
|
|
530
|
-
},
|
|
531
|
-
onCancel: async () => {
|
|
532
|
-
o.close(), p == null || p();
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
return {
|
|
538
|
-
viewDraft: d,
|
|
539
|
-
closeDraftDialog: k,
|
|
540
|
-
approveDraft: H,
|
|
541
|
-
rejectDraft: O,
|
|
542
|
-
markAsFailed: s,
|
|
543
|
-
syncDraft: a,
|
|
544
|
-
exportDraft: B,
|
|
545
|
-
refreshBalance: V,
|
|
546
|
-
viewClosingDraftShow: v,
|
|
547
|
-
viewClosingDraftProps: M
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
);
|
|
551
|
-
function Se(l) {
|
|
552
|
-
switch (l) {
|
|
553
|
-
case "DRAFT":
|
|
554
|
-
return "fm-status-badge-draft";
|
|
555
|
-
case "PROCESSING":
|
|
556
|
-
return "fm-status-badge-processing";
|
|
557
|
-
case "FAILED":
|
|
558
|
-
return "fm-status-badge-cancel";
|
|
559
|
-
case "COMPLETED":
|
|
560
|
-
return "fm-status-badge-complete";
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
const Et = We(
|
|
564
|
-
"closingDraftTable",
|
|
565
|
-
function() {
|
|
566
|
-
const { t: o } = qe(), e = Fe(), c = E(new Array()), f = E(!1), h = $e(), v = Be();
|
|
567
|
-
async function M() {
|
|
568
|
-
if (c.value = [], !!h._currentLocation) {
|
|
569
|
-
f.value = !0;
|
|
570
|
-
try {
|
|
571
|
-
const [s] = await Promise.all([v.readDrafts()]).delayed(1e3);
|
|
572
|
-
c.value = s.reverse();
|
|
573
|
-
} catch (s) {
|
|
574
|
-
console.log("Something went wrong when fetching drafts:", s);
|
|
575
|
-
} finally {
|
|
576
|
-
f.value = !1;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
async function d(s) {
|
|
581
|
-
if (!c.value.find((a) => a._id) && h._currentLocation) {
|
|
582
|
-
f.value = !0;
|
|
583
|
-
try {
|
|
584
|
-
const [a] = await Promise.all([
|
|
585
|
-
v.getDraft(s),
|
|
586
|
-
new Promise((k) => setTimeout(k, 1e3))
|
|
587
|
-
]);
|
|
588
|
-
c.value = [a];
|
|
589
|
-
} catch (a) {
|
|
590
|
-
console.log("Something went wrong when fetching drafts:", a);
|
|
591
|
-
} finally {
|
|
592
|
-
f.value = !1;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
function y(s) {
|
|
597
|
-
c.value = c.value.map((a) => a._id === s._id ? {
|
|
598
|
-
...s,
|
|
599
|
-
_rev: a._rev
|
|
600
|
-
} : a);
|
|
601
|
-
}
|
|
602
|
-
function B() {
|
|
603
|
-
e.closeDraftDialog(), M();
|
|
604
|
-
}
|
|
605
|
-
function H(s, a) {
|
|
606
|
-
switch (a = mt(a), s) {
|
|
607
|
-
case we.Details:
|
|
608
|
-
return e.viewDraft(a);
|
|
609
|
-
case we.Export:
|
|
610
|
-
return e.exportDraft(a);
|
|
611
|
-
case L.enum.approveDraft:
|
|
612
|
-
return e.approveDraft(a, B);
|
|
613
|
-
case L.enum.rejectDraft:
|
|
614
|
-
return e.rejectDraft(a, B);
|
|
615
|
-
case L.enum.markAsFailed:
|
|
616
|
-
return e.markAsFailed(a, B);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
return {
|
|
620
|
-
columnDefs: [
|
|
621
|
-
{
|
|
622
|
-
id: "_id",
|
|
623
|
-
accessorKey: "_id",
|
|
624
|
-
header: () => o("inventory.closing.table.createdAt"),
|
|
625
|
-
cell(s) {
|
|
626
|
-
return ut(`${s.getValue()}`);
|
|
627
|
-
},
|
|
628
|
-
enableSorting: !0
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
accessorKey: "effectiveAt",
|
|
632
|
-
header: () => "Effective at",
|
|
633
|
-
cell(s) {
|
|
634
|
-
const a = s.row.original;
|
|
635
|
-
let k = s.getValue();
|
|
636
|
-
return k || (k = Ie(a._id)), re(k);
|
|
637
|
-
},
|
|
638
|
-
enableSorting: !0,
|
|
639
|
-
size: 200
|
|
640
|
-
},
|
|
641
|
-
{
|
|
642
|
-
id: "updatedAt",
|
|
643
|
-
accessorFn: (s) => re(s.updatedAt),
|
|
644
|
-
header: () => "Updated at",
|
|
645
|
-
enableSorting: !0,
|
|
646
|
-
size: 200
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
id: "updatedBy",
|
|
650
|
-
accessorKey: "updatedBy.name",
|
|
651
|
-
header: () => "Last update by",
|
|
652
|
-
enableSorting: !0,
|
|
653
|
-
size: 200
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
id: "noOfItems",
|
|
657
|
-
accessorFn: (s) => {
|
|
658
|
-
var a;
|
|
659
|
-
return s.items.length + (((a = s.negativeStockItems) == null ? void 0 : a.length) ?? 0);
|
|
660
|
-
},
|
|
661
|
-
header: () => o("inventory.closing.table.noOfItems"),
|
|
662
|
-
enableSorting: !1,
|
|
663
|
-
meta: {
|
|
664
|
-
width: "10rem",
|
|
665
|
-
textAlign: "right"
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
id: "recentRemark",
|
|
670
|
-
accessorFn: (s) => {
|
|
671
|
-
var a;
|
|
672
|
-
return (s == null ? void 0 : s.approveRemark) ?? ((a = s == null ? void 0 : s.rejectionHistory) == null ? void 0 : a.computeFirst((k) => k.rejectRemark)) ?? s.remark;
|
|
673
|
-
},
|
|
674
|
-
header: () => "Recent remark"
|
|
675
|
-
},
|
|
676
|
-
{
|
|
677
|
-
id: "status",
|
|
678
|
-
accessorFn: (s) => s.status,
|
|
679
|
-
header: () => o("inventory.closing.table.status"),
|
|
680
|
-
enableSorting: !1,
|
|
681
|
-
cell(s) {
|
|
682
|
-
var C;
|
|
683
|
-
const a = s.row.original, k = a.status, V = new Date(a.updatedAt), m = (C = a == null ? void 0 : a.rejectionHistory) == null ? void 0 : C.computeFirst(($) => $.rejectedAt), p = m ? new Date(m) : null;
|
|
684
|
-
return k === "DRAFT" && p ? p.getTime() > V.getTime() ? I(
|
|
685
|
-
"div",
|
|
686
|
-
{
|
|
687
|
-
class: "flex"
|
|
688
|
-
},
|
|
689
|
-
I(
|
|
690
|
-
"div",
|
|
691
|
-
{
|
|
692
|
-
class: ["fm-status-badge", Se("FAILED")]
|
|
693
|
-
},
|
|
694
|
-
"Rejected"
|
|
695
|
-
)
|
|
696
|
-
) : I(
|
|
697
|
-
"div",
|
|
698
|
-
{
|
|
699
|
-
class: "flex"
|
|
700
|
-
},
|
|
701
|
-
I(
|
|
702
|
-
"div",
|
|
703
|
-
{
|
|
704
|
-
class: ["fm-status-badge", Se("PROCESSING")]
|
|
705
|
-
},
|
|
706
|
-
"Updated"
|
|
707
|
-
)
|
|
708
|
-
) : I(
|
|
709
|
-
"div",
|
|
710
|
-
{
|
|
711
|
-
class: "flex"
|
|
712
|
-
},
|
|
713
|
-
I(
|
|
714
|
-
"div",
|
|
715
|
-
{
|
|
716
|
-
class: ["fm-status-badge", Se(k)]
|
|
717
|
-
},
|
|
718
|
-
Re(k)
|
|
719
|
-
)
|
|
720
|
-
);
|
|
721
|
-
}
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
id: "action",
|
|
725
|
-
cell(s) {
|
|
726
|
-
const a = s.row.original, k = [
|
|
727
|
-
He[we.Details],
|
|
728
|
-
He[we.Export]
|
|
729
|
-
], V = [
|
|
730
|
-
{
|
|
731
|
-
translationKey: "inventory.closing.draft.approveDraft",
|
|
732
|
-
color: "text-fm-color-typo-primary",
|
|
733
|
-
value: L.enum.approveDraft
|
|
734
|
-
},
|
|
735
|
-
{
|
|
736
|
-
translationKey: "inventory.closing.draft.rejectDraft",
|
|
737
|
-
color: "text-fm-color-typo-error",
|
|
738
|
-
value: L.enum.rejectDraft
|
|
739
|
-
},
|
|
740
|
-
{
|
|
741
|
-
translationKey: "inventory.closing.draft.markAsFailed",
|
|
742
|
-
color: "text-fm-color-typo-error",
|
|
743
|
-
value: L.enum.markAsFailed
|
|
744
|
-
}
|
|
745
|
-
];
|
|
746
|
-
return dt(
|
|
747
|
-
[
|
|
748
|
-
...k,
|
|
749
|
-
...a.status === se.enum.DRAFT ? V : []
|
|
750
|
-
],
|
|
751
|
-
(m) => H(m, a)
|
|
752
|
-
);
|
|
753
|
-
},
|
|
754
|
-
enableSorting: !1,
|
|
755
|
-
size: 40,
|
|
756
|
-
meta: {
|
|
757
|
-
cellClass: "",
|
|
758
|
-
headerClass: ""
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
],
|
|
762
|
-
drafts: c,
|
|
763
|
-
loading: f,
|
|
764
|
-
fetchDrafts: M,
|
|
765
|
-
loadDraft: d,
|
|
766
|
-
updateDraftRef: y
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
), Ht = { class: "w-full flex flex-col gap-32" }, Vt = { class: "flex justify-between" }, zt = { class: "flex" }, Nt = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yt = { class: "flex gap-1" }, Kt = { class: "fm-typo-en-body-lg-600" }, Gt = { class: "flex flex-col gap-16" }, qt = { class: "flex items-center" }, Wt = {
|
|
770
|
-
key: 0,
|
|
771
|
-
class: "flex gap-8"
|
|
772
|
-
}, Zt = {
|
|
773
|
-
key: 0,
|
|
774
|
-
class: "w-full flex flex-col items-center"
|
|
775
|
-
}, Jt = { class: "flex items-center gap-8" }, Qt = { class: "flex flex-col gap-8" }, Xt = { class: "flex gap-8" }, ea = {
|
|
776
|
-
key: 0,
|
|
777
|
-
class: "flex gap-8"
|
|
778
|
-
}, ta = { class: "overflow-x-auto" }, aa = {
|
|
779
|
-
key: 1,
|
|
780
|
-
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
781
|
-
}, na = {
|
|
782
|
-
key: 0,
|
|
783
|
-
class: "flex flex-col items-center gap-8 h-full"
|
|
784
|
-
}, oa = ["src"], sa = {
|
|
785
|
-
key: 1,
|
|
786
|
-
class: "px-4 flex flex-col"
|
|
787
|
-
}, ra = { class: "flex gap-12 content-stretch" }, la = {
|
|
788
|
-
class: "flex flex-col w-24",
|
|
789
|
-
name: "circles"
|
|
790
|
-
}, ca = { class: "flex-1 flex flex-col items-center" }, ia = { class: "flex-1 flex flex-col items-center" }, ua = {
|
|
791
|
-
class: "py-12 flex flex-col gap-4",
|
|
792
|
-
name: "received-at header"
|
|
793
|
-
}, da = { class: "fm-typo-en-body-lg-400" }, ma = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, fa = { class: "flex gap-12 content-stretch" }, pa = {
|
|
794
|
-
class: "flex flex-col w-24",
|
|
795
|
-
name: "circles"
|
|
796
|
-
}, va = { class: "flex-1 flex flex-col items-center" }, ya = {
|
|
797
|
-
class: "py-12 flex flex-col gap-4 flex-1",
|
|
798
|
-
name: "delivery details"
|
|
799
|
-
}, ga = { class: "flex flex-col gap-8" }, ba = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Aa = { class: "flex flex-col gap-4" }, Da = { class: "flex gap-8" }, ka = /* @__PURE__ */ je({
|
|
800
|
-
__name: "ClosingDraftDialog",
|
|
801
|
-
props: {
|
|
802
|
-
show: { type: Boolean },
|
|
803
|
-
draft: {}
|
|
804
|
-
},
|
|
805
|
-
emits: ["submitted", "refresh"],
|
|
806
|
-
setup(l, { emit: o }) {
|
|
807
|
-
const e = l, c = Ze(), f = Fe(), h = Dt(e, "show"), v = E(!1), M = E(!1), d = E(!1), y = E(new Array()), B = Le(), H = Be(), O = Ue(), s = ft(), a = $e(), k = et({}), V = P(() => new Set(
|
|
808
|
-
s.skus.filter((r) => {
|
|
809
|
-
var t;
|
|
810
|
-
return k[(t = r.customAttributes) == null ? void 0 : t.tag];
|
|
811
|
-
}).map((r) => r._id)
|
|
812
|
-
)), m = o, p = E({
|
|
813
|
-
templateItem: !0,
|
|
814
|
-
nonTemplateItem: !0
|
|
815
|
-
}), C = P(() => {
|
|
816
|
-
var t, b;
|
|
817
|
-
const r = [...((t = e.draft) == null ? void 0 : t.items) ?? [], ...((b = e.draft) == null ? void 0 : b.negativeStockItems) ?? []];
|
|
818
|
-
return V.value.size ? r.filter((g) => V.value.has(g.sku._id)) : r;
|
|
819
|
-
}), $ = P(() => {
|
|
820
|
-
const r = C.value.map((t) => t.sku);
|
|
821
|
-
return r.sort((t, b) => t.code.localeCompare(b.code)), r;
|
|
822
|
-
}), F = P(() => C.value.groupBy(
|
|
823
|
-
(t) => t.sku._id,
|
|
824
|
-
(t) => t.measurementsAmounts.filter((b) => !b.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((b) => b.measurement.id)
|
|
825
|
-
));
|
|
826
|
-
Pe(W), tt(
|
|
827
|
-
() => e.show,
|
|
828
|
-
(r) => {
|
|
829
|
-
r && (oe.value = ne[0], W(), p.value = {
|
|
830
|
-
templateItem: !0,
|
|
831
|
-
nonTemplateItem: !0
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
);
|
|
835
|
-
const X = ye(0), J = ye(100);
|
|
836
|
-
async function W() {
|
|
837
|
-
var t, b, g;
|
|
838
|
-
if (!a._currentLocation) return;
|
|
839
|
-
v.value = !0;
|
|
840
|
-
const r = ((t = e.draft) == null ? void 0 : t.status) === se.enum.COMPLETED;
|
|
841
|
-
try {
|
|
842
|
-
if (await s.init(), r) {
|
|
843
|
-
const u = e.draft.closingAdjustmentId;
|
|
844
|
-
if (!u) {
|
|
845
|
-
O.open({
|
|
846
|
-
title: "Something went wrong",
|
|
847
|
-
message: "Closing draft is completed but closing document cannot be found.",
|
|
848
|
-
type: "error"
|
|
849
|
-
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
850
|
-
draftId: (b = e.draft) == null ? void 0 : b._id
|
|
851
|
-
});
|
|
852
|
-
return;
|
|
853
|
-
}
|
|
854
|
-
const i = await B.readAdjustmentById(u), A = (i == null ? void 0 : i.skus) ?? [];
|
|
855
|
-
y.value = A.map((j) => ({
|
|
856
|
-
id: j.sku._id,
|
|
857
|
-
balance: j.fromBalance,
|
|
858
|
-
costs: j.fromCostBalances
|
|
859
|
-
}));
|
|
860
|
-
} else
|
|
861
|
-
y.value = ((g = e.draft) == null ? void 0 : g.stockSnapshot) ?? [];
|
|
862
|
-
} catch (u) {
|
|
863
|
-
O.open({
|
|
864
|
-
title: "Something went wrong",
|
|
865
|
-
message: "Something went wrong when fetching info. Please try again.",
|
|
866
|
-
type: "error"
|
|
867
|
-
}), console.error("error on fetch stock balances", u);
|
|
868
|
-
} finally {
|
|
869
|
-
v.value = !1;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
async function le() {
|
|
873
|
-
var t, b;
|
|
874
|
-
if (!(((t = e.draft) == null ? void 0 : t.effectiveAt) ?? (e.draft ? Ie((b = e.draft) == null ? void 0 : b._id) : null))) {
|
|
875
|
-
O.open({
|
|
876
|
-
title: "Cannot refresh",
|
|
877
|
-
message: "Effective date is not available for this draft.",
|
|
878
|
-
type: "error"
|
|
879
|
-
});
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
await f.refreshBalance(
|
|
883
|
-
e.draft,
|
|
884
|
-
() => {
|
|
885
|
-
},
|
|
886
|
-
async (g) => {
|
|
887
|
-
var j;
|
|
888
|
-
M.value = !0;
|
|
889
|
-
const u = (j = e.draft) == null ? void 0 : j._rev, i = 30, A = 2e3;
|
|
890
|
-
try {
|
|
891
|
-
await B.recalculation.scheduleCalculateStockSnapshotAtDate(g, e.draft._id);
|
|
892
|
-
let x = null;
|
|
893
|
-
for (let te = 0; te < i && (x = await H.getDraft(e.draft._id).delayed(A), x._rev === u); te++)
|
|
894
|
-
;
|
|
895
|
-
if (!x || x._rev === u) {
|
|
896
|
-
O.open({
|
|
897
|
-
title: "Refresh failed",
|
|
898
|
-
message: "Failed to refresh stock balance. Please try again.",
|
|
899
|
-
type: "error"
|
|
900
|
-
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
m("refresh", x), y.value = x.stockSnapshot ?? [], O.open({
|
|
904
|
-
title: "Balance refreshed",
|
|
905
|
-
message: "Stock balance has been recalculated.",
|
|
906
|
-
type: "success"
|
|
907
|
-
});
|
|
908
|
-
} catch (x) {
|
|
909
|
-
O.open({
|
|
910
|
-
title: "Refresh failed",
|
|
911
|
-
message: "Failed to refresh stock balance. Please try again.",
|
|
912
|
-
type: "error"
|
|
913
|
-
}), console.error("error refreshing stock balances", x);
|
|
914
|
-
} finally {
|
|
915
|
-
M.value = !1;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
);
|
|
919
|
-
}
|
|
920
|
-
const ge = P(
|
|
921
|
-
() => y.value.groupBy(
|
|
922
|
-
(r) => r.id,
|
|
923
|
-
(r) => r.balance
|
|
924
|
-
)
|
|
925
|
-
), be = P(() => C.value.groupBy((r) => r.sku._id));
|
|
926
|
-
function ie(r) {
|
|
927
|
-
return I(
|
|
928
|
-
de.FmTooltip,
|
|
929
|
-
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
930
|
-
{
|
|
931
|
-
default() {
|
|
932
|
-
return r;
|
|
933
|
-
},
|
|
934
|
-
content() {
|
|
935
|
-
return "Differences are calculated using this formula: (Adjusted / System) × 100%";
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
const ce = P(() => {
|
|
941
|
-
const r = $.value.reduce((b, g) => {
|
|
942
|
-
var u, i;
|
|
943
|
-
return Math.max(b, ((i = (u = F.value) == null ? void 0 : u.get(g._id)) == null ? void 0 : i[0].length) ?? 0);
|
|
944
|
-
}, 0);
|
|
945
|
-
return [
|
|
946
|
-
{
|
|
947
|
-
id: "sku",
|
|
948
|
-
accessorFn: (b) => `${b.code} ${b.name}`,
|
|
949
|
-
header: () => "Name",
|
|
950
|
-
size: 350,
|
|
951
|
-
cell(b) {
|
|
952
|
-
const g = b.row.original, u = g.adjustedDiffPercentage, i = typeof u == "number" && Math.abs(u) > 10, A = I("div", { class: "flex flex-col gap-4" }, [
|
|
953
|
-
I(
|
|
954
|
-
"div",
|
|
955
|
-
{
|
|
956
|
-
class: [
|
|
957
|
-
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
958
|
-
i ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
959
|
-
]
|
|
960
|
-
},
|
|
961
|
-
g.name
|
|
962
|
-
),
|
|
963
|
-
I(
|
|
964
|
-
"div",
|
|
965
|
-
{
|
|
966
|
-
class: [
|
|
967
|
-
"line-clamp-1 fm-typo-en-body-md-400",
|
|
968
|
-
i ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
969
|
-
]
|
|
970
|
-
},
|
|
971
|
-
g.code
|
|
972
|
-
)
|
|
973
|
-
]);
|
|
974
|
-
return I(
|
|
975
|
-
de.FmTooltip,
|
|
976
|
-
{
|
|
977
|
-
zIndex: 51
|
|
978
|
-
},
|
|
979
|
-
{
|
|
980
|
-
content() {
|
|
981
|
-
return i ? "Adjustment difference is more than 10%." : `${g.code} - ${g.name}`;
|
|
982
|
-
},
|
|
983
|
-
default() {
|
|
984
|
-
return I("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
985
|
-
A
|
|
986
|
-
]);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
);
|
|
990
|
-
}
|
|
991
|
-
},
|
|
992
|
-
{
|
|
993
|
-
id: "baseUnit",
|
|
994
|
-
header: () => "Base unit",
|
|
995
|
-
accessorKey: "baseUnit"
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
id: "physicalBalance",
|
|
999
|
-
accessorKey: "physicalBalance",
|
|
1000
|
-
header: () => ie("Actual balance"),
|
|
1001
|
-
size: 200,
|
|
1002
|
-
meta: {
|
|
1003
|
-
textAlign: "right"
|
|
1004
|
-
}
|
|
1005
|
-
},
|
|
1006
|
-
{
|
|
1007
|
-
id: "systemBalance",
|
|
1008
|
-
accessorKey: "systemBalance",
|
|
1009
|
-
header: () => ie("Balance"),
|
|
1010
|
-
size: 200,
|
|
1011
|
-
meta: {
|
|
1012
|
-
textAlign: "right"
|
|
1013
|
-
}
|
|
1014
|
-
},
|
|
1015
|
-
{
|
|
1016
|
-
id: "adjustedAmount",
|
|
1017
|
-
accessorKey: "adjustedAmount",
|
|
1018
|
-
header: () => ie("Adjusted balance"),
|
|
1019
|
-
size: 200,
|
|
1020
|
-
meta: {
|
|
1021
|
-
textAlign: "right"
|
|
1022
|
-
}
|
|
1023
|
-
},
|
|
1024
|
-
{
|
|
1025
|
-
id: "adjustedDiffPercentage",
|
|
1026
|
-
accessorKey: "adjustedDiffPercentage",
|
|
1027
|
-
header: () => I(
|
|
1028
|
-
de.FmTooltip,
|
|
1029
|
-
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1030
|
-
{
|
|
1031
|
-
default() {
|
|
1032
|
-
return I("div", { class: "flex items-center gap-4" }, [
|
|
1033
|
-
"Diff (%)",
|
|
1034
|
-
I(de.FmIcon, { name: "info", color: "neutral-gray-400", size: "sm" })
|
|
1035
|
-
]);
|
|
1036
|
-
},
|
|
1037
|
-
content() {
|
|
1038
|
-
return "Differences are calculated using this formula: (Adjusted / System) × 100%";
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
),
|
|
1042
|
-
size: 200,
|
|
1043
|
-
cell(b) {
|
|
1044
|
-
const g = b.row.original.adjustedDiffPercentage;
|
|
1045
|
-
if (!g) return "N/A";
|
|
1046
|
-
const u = g.toFixed(2);
|
|
1047
|
-
if (u === "0.00")
|
|
1048
|
-
return I("div", { class: "flex items-center gap-4 justify-end" }, ["0.00"]);
|
|
1049
|
-
const i = g > 0;
|
|
1050
|
-
return I("div", { class: "flex items-center gap-4 justify-end" }, [
|
|
1051
|
-
I(de.FmIcon, {
|
|
1052
|
-
name: i ? "arrow_drop_up" : "arrow_drop_down",
|
|
1053
|
-
color: i ? "system-success-300" : "system-error-300",
|
|
1054
|
-
size: "md"
|
|
1055
|
-
}),
|
|
1056
|
-
u
|
|
1057
|
-
]);
|
|
1058
|
-
},
|
|
1059
|
-
meta: {
|
|
1060
|
-
textAlign: "right"
|
|
1061
|
-
}
|
|
1062
|
-
},
|
|
1063
|
-
{
|
|
1064
|
-
id: "physicalBalances",
|
|
1065
|
-
header: () => "Amounts",
|
|
1066
|
-
enableSorting: !1,
|
|
1067
|
-
cell(b) {
|
|
1068
|
-
const g = b.row.original, u = (A, j) => I(
|
|
1069
|
-
de.FmTooltip,
|
|
1070
|
-
{ zIndex: 50 },
|
|
1071
|
-
{
|
|
1072
|
-
default() {
|
|
1073
|
-
return I(
|
|
1074
|
-
"div",
|
|
1075
|
-
{
|
|
1076
|
-
class: "fm-typo-en-body-md-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1077
|
-
},
|
|
1078
|
-
[
|
|
1079
|
-
I("span", { class: "text-fm-color-typo-primary" }, `${A} `),
|
|
1080
|
-
I(
|
|
1081
|
-
"span",
|
|
1082
|
-
{
|
|
1083
|
-
class: "text-fm-color-typo-secondary",
|
|
1084
|
-
style: { maxWidth: "80px" }
|
|
1085
|
-
},
|
|
1086
|
-
j
|
|
1087
|
-
)
|
|
1088
|
-
]
|
|
1089
|
-
);
|
|
1090
|
-
},
|
|
1091
|
-
content() {
|
|
1092
|
-
return `${A} ${j}`;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
);
|
|
1096
|
-
let i = Array.from({ length: r }).map((A, j) => {
|
|
1097
|
-
if (!g[`measurementAmount${j}`])
|
|
1098
|
-
return null;
|
|
1099
|
-
const x = g[`measurementAmount${j}`], te = g[`measurementAbbrev${j}`];
|
|
1100
|
-
return u(x, te);
|
|
1101
|
-
}).filter((A) => A);
|
|
1102
|
-
return (g.baseUnitAmount || !i.length) && (i = [u(g.baseUnitAmount, g.baseUnit), ...i]), I(
|
|
1103
|
-
"div",
|
|
1104
|
-
{
|
|
1105
|
-
class: "flex gap-8 flex-nowrap",
|
|
1106
|
-
style: {
|
|
1107
|
-
minWidth: `${120 * i.length}px`
|
|
1108
|
-
}
|
|
1109
|
-
},
|
|
1110
|
-
i
|
|
1111
|
-
);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
];
|
|
1115
|
-
}), Ae = P(() => ce.value.map((r) => r.size ?? 0).reduce((r, t) => r + t)), ue = E(""), fe = P(() => {
|
|
1116
|
-
var b, g;
|
|
1117
|
-
const r = ((g = (b = e.draft) == null ? void 0 : b.negativeStockItems) == null ? void 0 : g.reduce(
|
|
1118
|
-
(u, i) => (u[i.sku._id] = i, u),
|
|
1119
|
-
{}
|
|
1120
|
-
)) ?? {};
|
|
1121
|
-
return $.value.map((u) => {
|
|
1122
|
-
var he, xe;
|
|
1123
|
-
const i = (he = be.value.get(u._id)) == null ? void 0 : he[0], A = ((xe = ge.value.get(u._id)) == null ? void 0 : xe[0]) ?? X;
|
|
1124
|
-
if (!i)
|
|
1125
|
-
return {
|
|
1126
|
-
code: u.code,
|
|
1127
|
-
name: u.name,
|
|
1128
|
-
baseUnit: u.unit.abbrev,
|
|
1129
|
-
baseUnitAmount: 0,
|
|
1130
|
-
systemBalance: +N(A),
|
|
1131
|
-
physicalBalance: 0,
|
|
1132
|
-
adjustedAmount: -+N(A),
|
|
1133
|
-
adjustedDiffPercentage: -100,
|
|
1134
|
-
isTemplateItem: !r[u._id]
|
|
1135
|
-
};
|
|
1136
|
-
const j = Je(i), x = Ye(j, A), te = A.amount === 0 ? null : Ke(x, {
|
|
1137
|
-
...A,
|
|
1138
|
-
amount: Math.abs(A.amount)
|
|
1139
|
-
}), ke = te ? Me(te, J) : null;
|
|
1140
|
-
return {
|
|
1141
|
-
code: u.code,
|
|
1142
|
-
name: u.name,
|
|
1143
|
-
baseUnit: u.unit.abbrev,
|
|
1144
|
-
baseUnitAmount: +N(i.baseAmount),
|
|
1145
|
-
...i.measurementsAmounts.filter((_) => {
|
|
1146
|
-
var U, z, ae;
|
|
1147
|
-
return (ae = (z = (U = F.value) == null ? void 0 : U.get(u._id)) == null ? void 0 : z[0]) == null ? void 0 : ae.includes(_.measurement.id);
|
|
1148
|
-
}).reduce((_, U, z) => (_[`measurementAbbrev${z}`] = `(${U.measurement.abbrev}) × ${N(U.measurement.conversion)}`, _[`measurementAmount${z}`] = +N(U.amount), _), {}),
|
|
1149
|
-
systemBalance: +N(A),
|
|
1150
|
-
physicalBalance: +N(j),
|
|
1151
|
-
adjustedAmount: +N(x),
|
|
1152
|
-
adjustedDiffPercentage: ke ? +N(Ge(ke, 2)) : null,
|
|
1153
|
-
isTemplateItem: !r[u._id]
|
|
1154
|
-
};
|
|
1155
|
-
}).filter((u) => !!(u.isTemplateItem && p.value.templateItem || !u.isTemplateItem && p.value.nonTemplateItem));
|
|
1156
|
-
}), De = P(() => {
|
|
1157
|
-
var t, b, g, u;
|
|
1158
|
-
if (!e.draft) return [];
|
|
1159
|
-
const r = e.draft.approvedAt ? {
|
|
1160
|
-
action: `Approve at ${re(e.draft.approvedAt)}`,
|
|
1161
|
-
// actionAt: props.draft.approvedAt,
|
|
1162
|
-
actionBy: e.draft.approvedBy,
|
|
1163
|
-
remark: e.draft.approveRemark
|
|
1164
|
-
} : (t = e.draft.rejectionHistory) == null ? void 0 : t.computeFirst((i) => ({
|
|
1165
|
-
action: `Reject at ${re(i.rejectedAt)}`,
|
|
1166
|
-
// actionAt: e.rejectedAt,
|
|
1167
|
-
actionBy: i.rejectedBy,
|
|
1168
|
-
remark: i.rejectRemark
|
|
1169
|
-
}));
|
|
1170
|
-
return [
|
|
1171
|
-
{
|
|
1172
|
-
label: "Created at",
|
|
1173
|
-
value: re(e.draft.createdAt)
|
|
1174
|
-
},
|
|
1175
|
-
{
|
|
1176
|
-
label: "Created by",
|
|
1177
|
-
value: e.draft.createdBy.name
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
label: "Updated at",
|
|
1181
|
-
value: re(e.draft.updatedAt)
|
|
1182
|
-
},
|
|
1183
|
-
{
|
|
1184
|
-
label: "Updated by",
|
|
1185
|
-
value: e.draft.updatedBy.name
|
|
1186
|
-
},
|
|
1187
|
-
{
|
|
1188
|
-
label: "Effective at",
|
|
1189
|
-
value: re(e.draft.effectiveAt ?? Ie((b = e.draft) == null ? void 0 : b._id))
|
|
1190
|
-
},
|
|
1191
|
-
{
|
|
1192
|
-
label: "Using template",
|
|
1193
|
-
value: ((g = e.draft.usingTemplates.find((i) => i)) == null ? void 0 : g.name) ?? "None"
|
|
1194
|
-
},
|
|
1195
|
-
e.draft.remark ? {
|
|
1196
|
-
label: "Remark",
|
|
1197
|
-
value: e.draft.remark
|
|
1198
|
-
} : null,
|
|
1199
|
-
r ? {
|
|
1200
|
-
label: "Last action",
|
|
1201
|
-
value: r.action
|
|
1202
|
-
} : null,
|
|
1203
|
-
r && r.actionBy ? {
|
|
1204
|
-
label: "Last action by",
|
|
1205
|
-
value: (u = r.actionBy) == null ? void 0 : u.name
|
|
1206
|
-
} : null,
|
|
1207
|
-
r && r.remark ? {
|
|
1208
|
-
label: "Action remark",
|
|
1209
|
-
value: r.remark
|
|
1210
|
-
} : null
|
|
1211
|
-
].filter((i) => i).map((i) => i);
|
|
1212
|
-
}), ne = [
|
|
1213
|
-
{
|
|
1214
|
-
label: "Overview",
|
|
1215
|
-
value: "overview"
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
label: "Action history",
|
|
1219
|
-
value: "history"
|
|
1220
|
-
}
|
|
1221
|
-
], oe = E(ne[0]), ee = P(() => {
|
|
1222
|
-
var g, u, i;
|
|
1223
|
-
const r = ((g = e.draft) == null ? void 0 : g.activityLogs) ?? [], t = ((u = e.draft) == null ? void 0 : u.rejectionHistory) ?? [];
|
|
1224
|
-
for (const A of t)
|
|
1225
|
-
r.find(
|
|
1226
|
-
(x) => `${x.action}_${x.performedAt}` == `${L.enum.rejectDraft}_${A.rejectedAt}`
|
|
1227
|
-
) || r.push({
|
|
1228
|
-
action: L.enum.rejectDraft,
|
|
1229
|
-
performedAt: A.rejectedAt,
|
|
1230
|
-
performedBy: A.rejectedBy,
|
|
1231
|
-
remark: A.rejectRemark
|
|
1232
|
-
});
|
|
1233
|
-
return (i = e.draft) != null && i.approvedAt && (r.find(
|
|
1234
|
-
(j) => {
|
|
1235
|
-
var x;
|
|
1236
|
-
return `${j.action}_${j.performedAt}` == `${L.enum.approveDraft}_${(x = e.draft) == null ? void 0 : x.approvedAt}`;
|
|
1237
|
-
}
|
|
1238
|
-
) || r.push({
|
|
1239
|
-
action: L.enum.approveDraft,
|
|
1240
|
-
performedAt: e.draft.approvedAt,
|
|
1241
|
-
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1242
|
-
remark: e.draft.approveRemark
|
|
1243
|
-
})), r.sort((A, j) => new Date(j.performedAt).getTime() - new Date(A.performedAt).getTime()).map(
|
|
1244
|
-
(A) => ({
|
|
1245
|
-
header: Re(A.action),
|
|
1246
|
-
date: re(A.performedAt),
|
|
1247
|
-
info: [
|
|
1248
|
-
{
|
|
1249
|
-
label: "Performed by",
|
|
1250
|
-
values: [A.performedBy.name]
|
|
1251
|
-
},
|
|
1252
|
-
{
|
|
1253
|
-
label: "Remark",
|
|
1254
|
-
values: [A.remark ?? ""]
|
|
1255
|
-
}
|
|
1256
|
-
]
|
|
1257
|
-
})
|
|
1258
|
-
);
|
|
1259
|
-
}), pe = P(() => {
|
|
1260
|
-
var u, i, A, j;
|
|
1261
|
-
if ((u = e == null ? void 0 : e.draft) != null && u.approvedAt) return "Draft is already approved.";
|
|
1262
|
-
if (((i = e.draft) == null ? void 0 : i.status) !== se.enum.DRAFT) return "Status is not draft.";
|
|
1263
|
-
const r = fe.value.some((x) => x.physicalBalance < 0), t = ((j = (A = c.stockBalance.skus) == null ? void 0 : A.filter((x) => x.balance.amount < 0)) == null ? void 0 : j.map((x) => x.id)) ?? [], b = new Set($.value.map((x) => x._id)), g = t.filter((x) => !b.has(x)).length;
|
|
1264
|
-
return [
|
|
1265
|
-
r ? "Negative total exist." : null,
|
|
1266
|
-
g ? "Negative stock is not included in this draft. Reopen draft in POS and apply changes." : null
|
|
1267
|
-
].filter((x) => x).join(" ");
|
|
1268
|
-
});
|
|
1269
|
-
return (r, t) => {
|
|
1270
|
-
const b = T("FmButtonGroup"), g = T("FmMenuDivider"), u = T("FmCard"), i = T("FmButton"), A = T("FmCircularProgress"), j = T("FmChip"), x = T("FmTextField"), te = T("FmIcon"), ke = T("FmTable"), _e = T("FmSpacer"), he = T("FmTooltip"), xe = T("FmSideSheet");
|
|
1271
|
-
return w(), Z(xe, {
|
|
1272
|
-
"dismiss-away": "",
|
|
1273
|
-
"max-width": 9999,
|
|
1274
|
-
"model-value": S(h),
|
|
1275
|
-
"onUpdate:modelValue": t[10] || (t[10] = (_) => Ve(h) ? h.value = _ : null),
|
|
1276
|
-
header: "Closing details"
|
|
1277
|
-
}, {
|
|
1278
|
-
"side-sheet-footer": Y(() => {
|
|
1279
|
-
var _, U, z, ae;
|
|
1280
|
-
return [
|
|
1281
|
-
n("div", Da, [
|
|
1282
|
-
((_ = e.draft) == null ? void 0 : _.status) === S(se).enum.DRAFT ? (w(), R(q, { key: 0 }, [
|
|
1283
|
-
pe.value ? (w(), Z(he, {
|
|
1284
|
-
key: 0,
|
|
1285
|
-
"z-index": 51
|
|
1286
|
-
}, {
|
|
1287
|
-
content: Y(() => [
|
|
1288
|
-
G(K(pe.value), 1)
|
|
1289
|
-
]),
|
|
1290
|
-
default: Y(() => [
|
|
1291
|
-
D(i, {
|
|
1292
|
-
disabled: "",
|
|
1293
|
-
key: "approve key",
|
|
1294
|
-
label: "Approve",
|
|
1295
|
-
onClick: t[5] || (t[5] = () => e.draft && S(f).approveDraft(e.draft, () => m("submitted")))
|
|
1296
|
-
})
|
|
1297
|
-
]),
|
|
1298
|
-
_: 1
|
|
1299
|
-
})) : (w(), Z(i, {
|
|
1300
|
-
key: "approve key",
|
|
1301
|
-
label: "Approve",
|
|
1302
|
-
onClick: t[6] || (t[6] = () => e.draft && S(f).approveDraft(e.draft, () => m("submitted")))
|
|
1303
|
-
}))
|
|
1304
|
-
], 64)) : Q("", !0),
|
|
1305
|
-
((U = e.draft) == null ? void 0 : U.status) === S(se).enum.DRAFT ? (w(), Z(i, {
|
|
1306
|
-
key: 1,
|
|
1307
|
-
label: "Reject",
|
|
1308
|
-
variant: "destructive",
|
|
1309
|
-
onClick: t[7] || (t[7] = () => e.draft && S(f).rejectDraft(e.draft, () => m("submitted")))
|
|
1310
|
-
})) : Q("", !0),
|
|
1311
|
-
(z = e.draft) != null && z.approvedAt && ((ae = e.draft) == null ? void 0 : ae.status) !== S(se).enum.COMPLETED ? (w(), Z(i, {
|
|
1312
|
-
key: 2,
|
|
1313
|
-
label: "Sync",
|
|
1314
|
-
loading: d.value,
|
|
1315
|
-
onClick: t[8] || (t[8] = () => {
|
|
1316
|
-
e.draft && (d.value = !0, S(f).syncDraft(e.draft, () => {
|
|
1317
|
-
d.value = !1, m("submitted");
|
|
1318
|
-
}));
|
|
1319
|
-
})
|
|
1320
|
-
}, null, 8, ["loading"])) : Q("", !0),
|
|
1321
|
-
D(i, {
|
|
1322
|
-
label: "Close",
|
|
1323
|
-
variant: "tertiary",
|
|
1324
|
-
onClick: t[9] || (t[9] = (Ee) => h.value = !1)
|
|
1325
|
-
})
|
|
1326
|
-
])
|
|
1327
|
-
];
|
|
1328
|
-
}),
|
|
1329
|
-
default: Y(() => [
|
|
1330
|
-
n("div", Ht, [
|
|
1331
|
-
n("div", null, [
|
|
1332
|
-
D(b, {
|
|
1333
|
-
items: ne,
|
|
1334
|
-
modelValue: oe.value,
|
|
1335
|
-
"onUpdate:modelValue": t[0] || (t[0] = (_) => oe.value = _)
|
|
1336
|
-
}, null, 8, ["modelValue"])
|
|
1337
|
-
]),
|
|
1338
|
-
oe.value.value === "overview" ? (w(), R(q, { key: 0 }, [
|
|
1339
|
-
D(u, {
|
|
1340
|
-
variant: "outlined",
|
|
1341
|
-
class: "flex flex-col gap-8 px-12 py-16"
|
|
1342
|
-
}, {
|
|
1343
|
-
default: Y(() => {
|
|
1344
|
-
var _, U;
|
|
1345
|
-
return [
|
|
1346
|
-
n("div", Vt, [
|
|
1347
|
-
t[11] || (t[11] = n("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
1348
|
-
n("div", zt, [
|
|
1349
|
-
n("div", {
|
|
1350
|
-
class: me(["fm-status-badge", S(Se)(((_ = r.draft) == null ? void 0 : _.status) ?? "DRAFT")])
|
|
1351
|
-
}, K(S(Re)(((U = r.draft) == null ? void 0 : U.status) ?? "")), 3)
|
|
1352
|
-
])
|
|
1353
|
-
]),
|
|
1354
|
-
D(g),
|
|
1355
|
-
n("div", Nt, [
|
|
1356
|
-
(w(!0), R(q, null, ve(De.value, (z, ae) => (w(), R("div", {
|
|
1357
|
-
class: "flex flex-col gap-4",
|
|
1358
|
-
key: ae
|
|
1359
|
-
}, [
|
|
1360
|
-
n("div", Ot, [
|
|
1361
|
-
n("div", Yt, K(z.label), 1)
|
|
1362
|
-
]),
|
|
1363
|
-
n("div", Kt, K(z.value), 1)
|
|
1364
|
-
]))), 128))
|
|
1365
|
-
])
|
|
1366
|
-
];
|
|
1367
|
-
}),
|
|
1368
|
-
_: 1
|
|
1369
|
-
}),
|
|
1370
|
-
n("div", Gt, [
|
|
1371
|
-
n("div", qt, [
|
|
1372
|
-
t[12] || (t[12] = n("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
1373
|
-
v.value ? Q("", !0) : (w(), R("div", Wt, [
|
|
1374
|
-
r.draft && r.draft.status !== S(se).enum.COMPLETED ? (w(), Z(i, {
|
|
1375
|
-
key: 0,
|
|
1376
|
-
label: "Refresh balance",
|
|
1377
|
-
"prepend-icon": "refresh",
|
|
1378
|
-
variant: "secondary",
|
|
1379
|
-
"text-color": "primary",
|
|
1380
|
-
"bg-color": "transparent",
|
|
1381
|
-
"border-color": "primary",
|
|
1382
|
-
loading: M.value,
|
|
1383
|
-
onClick: le
|
|
1384
|
-
}, null, 8, ["loading"])) : Q("", !0),
|
|
1385
|
-
D(i, {
|
|
1386
|
-
label: "Export data",
|
|
1387
|
-
"prepend-icon": "download",
|
|
1388
|
-
variant: "secondary",
|
|
1389
|
-
"text-color": "primary",
|
|
1390
|
-
"bg-color": "transparent",
|
|
1391
|
-
"border-color": "primary",
|
|
1392
|
-
onClick: t[1] || (t[1] = (_) => r.draft ? S(f).exportDraft(r.draft, y.value) : null)
|
|
1393
|
-
})
|
|
1394
|
-
]))
|
|
1395
|
-
]),
|
|
1396
|
-
v.value ? (w(), R("div", Zt, [
|
|
1397
|
-
t[14] || (t[14] = n("div", { class: "h-80" }, null, -1)),
|
|
1398
|
-
n("div", Jt, [
|
|
1399
|
-
n("div", null, [
|
|
1400
|
-
D(A, { size: "md" })
|
|
1401
|
-
]),
|
|
1402
|
-
t[13] || (t[13] = n("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
1403
|
-
]),
|
|
1404
|
-
t[15] || (t[15] = n("div", { class: "h-80" }, null, -1))
|
|
1405
|
-
])) : (w(), R(q, { key: 1 }, [
|
|
1406
|
-
n("div", Qt, [
|
|
1407
|
-
n("div", Xt, [
|
|
1408
|
-
D(j, {
|
|
1409
|
-
label: "Template Item(s)",
|
|
1410
|
-
selected: p.value.templateItem,
|
|
1411
|
-
onClick: t[2] || (t[2] = (_) => p.value.templateItem = !p.value.templateItem)
|
|
1412
|
-
}, null, 8, ["selected"]),
|
|
1413
|
-
D(j, {
|
|
1414
|
-
label: "Non-template Item(s)",
|
|
1415
|
-
selected: p.value.nonTemplateItem,
|
|
1416
|
-
onClick: t[3] || (t[3] = (_) => p.value.nonTemplateItem = !p.value.nonTemplateItem)
|
|
1417
|
-
}, null, 8, ["selected"])
|
|
1418
|
-
]),
|
|
1419
|
-
D(x, {
|
|
1420
|
-
modelValue: ue.value,
|
|
1421
|
-
"onUpdate:modelValue": t[4] || (t[4] = (_) => ue.value = _),
|
|
1422
|
-
placeholder: "Filter items"
|
|
1423
|
-
}, null, 8, ["modelValue"])
|
|
1424
|
-
]),
|
|
1425
|
-
S(s).skuTags.size ? (w(), R("div", ea, [
|
|
1426
|
-
(w(!0), R(q, null, ve(S(s).skuTags.keys(), (_) => (w(), Z(j, {
|
|
1427
|
-
key: `${_}`,
|
|
1428
|
-
label: `${_}`,
|
|
1429
|
-
selectable: "",
|
|
1430
|
-
selected: k[`${_}`],
|
|
1431
|
-
onClick: (U) => k[`${_}`] = !k[`${_}`]
|
|
1432
|
-
}, {
|
|
1433
|
-
default: Y(() => [
|
|
1434
|
-
k[`${_}`] ? (w(), Z(te, {
|
|
1435
|
-
key: 0,
|
|
1436
|
-
name: "check",
|
|
1437
|
-
class: "text-white",
|
|
1438
|
-
size: "sm"
|
|
1439
|
-
})) : Q("", !0),
|
|
1440
|
-
n("span", {
|
|
1441
|
-
class: me([
|
|
1442
|
-
"",
|
|
1443
|
-
{
|
|
1444
|
-
"text-white fm-typo-en-body-md-600": k[`${_}`],
|
|
1445
|
-
"text-fm-color-typo-primary fm-typo-en-body-md-400": !k[`${_}`]
|
|
1446
|
-
}
|
|
1447
|
-
])
|
|
1448
|
-
}, K(_), 3)
|
|
1449
|
-
]),
|
|
1450
|
-
_: 2
|
|
1451
|
-
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
1452
|
-
])) : Q("", !0),
|
|
1453
|
-
n("div", ta, [
|
|
1454
|
-
n("div", {
|
|
1455
|
-
style: ze({ minWidth: `${Ae.value}px` })
|
|
1456
|
-
}, [
|
|
1457
|
-
D(ke, {
|
|
1458
|
-
"column-defs": ce.value,
|
|
1459
|
-
"row-data": fe.value,
|
|
1460
|
-
"search-value": ue.value
|
|
1461
|
-
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
1462
|
-
], 4)
|
|
1463
|
-
])
|
|
1464
|
-
], 64))
|
|
1465
|
-
])
|
|
1466
|
-
], 64)) : Q("", !0),
|
|
1467
|
-
oe.value.value === "history" ? (w(), R("div", aa, [
|
|
1468
|
-
ee.value.length ? (w(), R("div", sa, [
|
|
1469
|
-
(w(!0), R(q, null, ve(ee.value, (_, U) => (w(), R(q, { key: U }, [
|
|
1470
|
-
n("div", ra, [
|
|
1471
|
-
n("div", la, [
|
|
1472
|
-
n("div", ca, [
|
|
1473
|
-
n("div", {
|
|
1474
|
-
class: me([
|
|
1475
|
-
{
|
|
1476
|
-
"bg-fm-color-primary": U !== 0,
|
|
1477
|
-
"bg-white": U === 0
|
|
1478
|
-
},
|
|
1479
|
-
"w-[2px] h-full"
|
|
1480
|
-
])
|
|
1481
|
-
}, null, 2)
|
|
1482
|
-
]),
|
|
1483
|
-
t[18] || (t[18] = n("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1484
|
-
n("div", ia, [
|
|
1485
|
-
n("div", {
|
|
1486
|
-
class: me([
|
|
1487
|
-
{
|
|
1488
|
-
"bg-fm-color-primary": U < ee.value.length - 1,
|
|
1489
|
-
"bg-white": U >= ee.value.length - 1
|
|
1490
|
-
},
|
|
1491
|
-
"w-[2px] h-full"
|
|
1492
|
-
])
|
|
1493
|
-
}, null, 2)
|
|
1494
|
-
])
|
|
1495
|
-
]),
|
|
1496
|
-
n("div", ua, [
|
|
1497
|
-
n("div", da, K(_.header), 1),
|
|
1498
|
-
n("div", ma, K(_.date), 1)
|
|
1499
|
-
])
|
|
1500
|
-
]),
|
|
1501
|
-
n("div", fa, [
|
|
1502
|
-
n("div", pa, [
|
|
1503
|
-
n("div", va, [
|
|
1504
|
-
n("div", {
|
|
1505
|
-
class: me([
|
|
1506
|
-
{
|
|
1507
|
-
"bg-fm-color-primary": U < ee.value.length - 1,
|
|
1508
|
-
"bg-white": U >= ee.value.length - 1
|
|
1509
|
-
},
|
|
1510
|
-
"w-[2px] h-full"
|
|
1511
|
-
])
|
|
1512
|
-
}, null, 2)
|
|
1513
|
-
])
|
|
1514
|
-
]),
|
|
1515
|
-
n("div", ya, [
|
|
1516
|
-
D(u, {
|
|
1517
|
-
variant: "outlined",
|
|
1518
|
-
class: "py-12 px-16"
|
|
1519
|
-
}, {
|
|
1520
|
-
default: Y(() => [
|
|
1521
|
-
n("div", ga, [
|
|
1522
|
-
(w(!0), R(q, null, ve(_.info, (z, ae) => (w(), R("div", {
|
|
1523
|
-
key: ae,
|
|
1524
|
-
class: "flex flex-col gap-4"
|
|
1525
|
-
}, [
|
|
1526
|
-
n("div", ba, K(z == null ? void 0 : z.label), 1),
|
|
1527
|
-
n("div", Aa, [
|
|
1528
|
-
(w(!0), R(q, null, ve(z == null ? void 0 : z.values, (Ee, Xe) => (w(), R("div", {
|
|
1529
|
-
key: Xe,
|
|
1530
|
-
class: "fm-typo-en-body-lg-600"
|
|
1531
|
-
}, K(Ee), 1))), 128))
|
|
1532
|
-
])
|
|
1533
|
-
]))), 128))
|
|
1534
|
-
])
|
|
1535
|
-
]),
|
|
1536
|
-
_: 2
|
|
1537
|
-
}, 1024)
|
|
1538
|
-
])
|
|
1539
|
-
])
|
|
1540
|
-
], 64))), 128))
|
|
1541
|
-
])) : (w(), R("div", na, [
|
|
1542
|
-
D(_e),
|
|
1543
|
-
n("div", null, [
|
|
1544
|
-
n("img", {
|
|
1545
|
-
src: S(ht),
|
|
1546
|
-
alt: "List is empty"
|
|
1547
|
-
}, null, 8, oa)
|
|
1548
|
-
]),
|
|
1549
|
-
t[16] || (t[16] = n("div", { class: "fm-typo-en-body-lg-600" }, K("No records found"), -1)),
|
|
1550
|
-
t[17] || (t[17] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, K("You can track approval and rejection history here"), -1)),
|
|
1551
|
-
D(_e),
|
|
1552
|
-
D(_e)
|
|
1553
|
-
]))
|
|
1554
|
-
])) : Q("", !0)
|
|
1555
|
-
])
|
|
1556
|
-
]),
|
|
1557
|
-
_: 1
|
|
1558
|
-
}, 8, ["model-value"]);
|
|
1559
|
-
};
|
|
1560
|
-
}
|
|
1561
|
-
}), _a = { class: "flex-1 flex flex-col gap-8" }, ha = { class: "flex flex-col" }, xa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wa = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ca = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Sa = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Pa = /* @__PURE__ */ je({
|
|
1562
|
-
__name: "ClosingDraftView",
|
|
1563
|
-
setup(l) {
|
|
1564
|
-
const { t: o } = qe(), { viewDraft: e } = Fe(), { viewClosingDraftProps: c, viewClosingDraftShow: f } = _t(Fe()), h = $e(), v = Et(), M = pt(), { breakpoints: d } = kt();
|
|
1565
|
-
h.watchLocation(v.fetchDrafts);
|
|
1566
|
-
const y = P(() => v.loading), B = E(""), H = P(() => d.value.xs || d.value.sm), O = P(() => H.value ? 10 : 20);
|
|
1567
|
-
function s(V) {
|
|
1568
|
-
switch (V) {
|
|
1569
|
-
case "refresh":
|
|
1570
|
-
return v.fetchDrafts();
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
function a(V) {
|
|
1574
|
-
return V;
|
|
1575
|
-
}
|
|
1576
|
-
const k = P(() => H.value ? [
|
|
1577
|
-
{
|
|
1578
|
-
label: o("inventory.common.refresh"),
|
|
1579
|
-
value: "refresh",
|
|
1580
|
-
isPrimary: !1
|
|
1581
|
-
}
|
|
1582
|
-
] : [
|
|
1583
|
-
{
|
|
1584
|
-
label: o("inventory.common.refresh"),
|
|
1585
|
-
value: "refresh",
|
|
1586
|
-
isPrimary: !1
|
|
1587
|
-
}
|
|
1588
|
-
]);
|
|
1589
|
-
return (V, m) => {
|
|
1590
|
-
const p = T("FmTable");
|
|
1591
|
-
return w(), R(q, null, [
|
|
1592
|
-
D(vt, {
|
|
1593
|
-
title: S(o)("inventory.closing.draft.title"),
|
|
1594
|
-
actions: k.value,
|
|
1595
|
-
"onClick:action": s
|
|
1596
|
-
}, {
|
|
1597
|
-
default: Y(() => [
|
|
1598
|
-
n("div", {
|
|
1599
|
-
class: me([
|
|
1600
|
-
"flex flex-col gap-8 max-h-full",
|
|
1601
|
-
{
|
|
1602
|
-
"p-0": H.value,
|
|
1603
|
-
"px-24 ": !H.value
|
|
1604
|
-
}
|
|
1605
|
-
])
|
|
1606
|
-
}, [
|
|
1607
|
-
D(yt, {
|
|
1608
|
-
"change-location": "",
|
|
1609
|
-
searchable: "",
|
|
1610
|
-
search: B.value,
|
|
1611
|
-
"onUpdate:search": m[0] || (m[0] = (C) => B.value = C)
|
|
1612
|
-
}, null, 8, ["search"]),
|
|
1613
|
-
D(p, {
|
|
1614
|
-
style: ze(S(M).tableHeight),
|
|
1615
|
-
"column-defs": S(v).columnDefs,
|
|
1616
|
-
"row-data": S(v).drafts,
|
|
1617
|
-
"search-value": B.value,
|
|
1618
|
-
loading: y.value,
|
|
1619
|
-
onRowClick: m[1] || (m[1] = (C) => S(e)(C.original)),
|
|
1620
|
-
"page-size": O.value
|
|
1621
|
-
}, {
|
|
1622
|
-
"list-row": Y((C) => [
|
|
1623
|
-
D(gt, {
|
|
1624
|
-
row: C,
|
|
1625
|
-
onRowClick: ($) => S(e)($)
|
|
1626
|
-
}, {
|
|
1627
|
-
default: Y(($) => {
|
|
1628
|
-
var F, X, J, W, le, ge, be, ie, ce, Ae, ue, fe, De, ne, oe, ee, pe, r, t, b;
|
|
1629
|
-
return [
|
|
1630
|
-
n("div", _a, [
|
|
1631
|
-
n("div", ha, [
|
|
1632
|
-
n("div", xa, [
|
|
1633
|
-
D(S(Ce), {
|
|
1634
|
-
render: (J = (X = (F = $._id) == null ? void 0 : F.column) == null ? void 0 : X.columnDef) == null ? void 0 : J.cell,
|
|
1635
|
-
props: (le = (W = $._id) == null ? void 0 : W.getContext) == null ? void 0 : le.call(W)
|
|
1636
|
-
}, null, 8, ["render", "props"])
|
|
1637
|
-
]),
|
|
1638
|
-
n("div", wa, [
|
|
1639
|
-
D(S(Ce), {
|
|
1640
|
-
render: (ie = (be = (ge = $.name) == null ? void 0 : ge.column) == null ? void 0 : be.columnDef) == null ? void 0 : ie.cell,
|
|
1641
|
-
props: (Ae = (ce = $.name) == null ? void 0 : ce.getContext) == null ? void 0 : Ae.call(ce)
|
|
1642
|
-
}, null, 8, ["render", "props"])
|
|
1643
|
-
]),
|
|
1644
|
-
n("div", Ca, K([
|
|
1645
|
-
...C.original.items.slice(0, 3).map((g) => g.sku.name),
|
|
1646
|
-
...C.original.items.length >= 3 ? [`and ${C.original.items.length - 3} more items`] : []
|
|
1647
|
-
].join(", ")), 1),
|
|
1648
|
-
n("div", Sa, [
|
|
1649
|
-
D(S(Ce), {
|
|
1650
|
-
render: (De = (fe = (ue = $.ref) == null ? void 0 : ue.column) == null ? void 0 : fe.columnDef) == null ? void 0 : De.cell,
|
|
1651
|
-
props: (oe = (ne = $.ref) == null ? void 0 : ne.getContext) == null ? void 0 : oe.call(ne)
|
|
1652
|
-
}, null, 8, ["render", "props"])
|
|
1653
|
-
])
|
|
1654
|
-
]),
|
|
1655
|
-
n("div", null, [
|
|
1656
|
-
D(S(Ce), {
|
|
1657
|
-
render: (r = (pe = (ee = $.status) == null ? void 0 : ee.column) == null ? void 0 : pe.columnDef) == null ? void 0 : r.cell,
|
|
1658
|
-
props: (b = (t = $.status) == null ? void 0 : t.getContext) == null ? void 0 : b.call(t)
|
|
1659
|
-
}, null, 8, ["render", "props"])
|
|
1660
|
-
])
|
|
1661
|
-
])
|
|
1662
|
-
];
|
|
1663
|
-
}),
|
|
1664
|
-
_: 2
|
|
1665
|
-
}, 1032, ["row", "onRowClick"])
|
|
1666
|
-
]),
|
|
1667
|
-
_: 1
|
|
1668
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1669
|
-
], 2)
|
|
1670
|
-
]),
|
|
1671
|
-
_: 1
|
|
1672
|
-
}, 8, ["title", "actions"]),
|
|
1673
|
-
(w(), Z(at, { to: "body" }, [
|
|
1674
|
-
D(ka, nt(S(c), {
|
|
1675
|
-
show: S(f),
|
|
1676
|
-
"onUpdate:show": m[2] || (m[2] = (C) => Ve(f) ? f.value = C : null),
|
|
1677
|
-
onSubmitted: m[3] || (m[3] = () => (f.value = !1, S(v).fetchDrafts())),
|
|
1678
|
-
onRefresh: m[4] || (m[4] = (C) => S(v).updateDraftRef(C))
|
|
1679
|
-
}), null, 16, ["show"])
|
|
1680
|
-
]))
|
|
1681
|
-
], 64);
|
|
1682
|
-
};
|
|
1683
|
-
}
|
|
1684
|
-
});
|
|
1685
|
-
export {
|
|
1686
|
-
Pa as default
|
|
1687
|
-
};
|