@feedmepos/mf-inventory-portal 1.2.59 → 1.2.60-dev.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.
- package/dist/{App-Nwc0Ha2r.js → App-B_yr-6yL.js} +82 -78
- package/dist/{ApprovalView-Y5f915s3.js → ApprovalView-DoYBBuSD.js} +5 -5
- package/dist/{BindingsDialog-5N7R_u4c.js → BindingsDialog-DG7HOy6J.js} +5 -5
- package/dist/{BindingsPicker-BJwvLu2s.js → BindingsPicker-DVCYpyrR.js} +3 -3
- package/dist/{BindingsTable-B8sq-qXH.js → BindingsTable-CCel2b_W.js} +5 -5
- package/dist/{ClosingDraftView-BsyYOZsz.js → ClosingDraftView-CfM7gNBX.js} +891 -893
- package/dist/{ClosingHistoryView-BNpsMNy1.js → ClosingHistoryView-DWH4bFgg.js} +36 -36
- package/dist/{ClosingTemplateView-BBqbq07d.js → ClosingTemplateView-JYnnvm7L.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-CmOO7wuE.js → DeliveryOrderPrintPreview-BihBTJGj.js} +7 -7
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BXlY-Gu1.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CWjtQajS.js} +17 -17
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CAMkZRFI.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js} +2 -2
- package/dist/{FmMultiselectDialog-CwJUv9tG.js → FmMultiselectDialog-CxDviJZM.js} +16 -16
- package/dist/{FmMultiselectDialog-LagHyTQP.js → FmMultiselectDialog-D51nW6yj.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BmHFIkt1.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DLqUnROc.js} +16 -15
- package/dist/{ImportView-wQ_bNesb.js → ImportView-C52rZFib.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DtMrJIVs.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjZmd-Sa.js} +1 -1
- package/dist/{IngredientGroupView-DsGMhdwu.js → IngredientGroupView-DTHpZP2L.js} +5 -5
- package/dist/{IngredientsView-JdjcLdOx.js → IngredientsView-CrCW6heJ.js} +25 -24
- package/dist/{IntegrationView-CMmSIRUk.js → IntegrationView--DZANrHj.js} +18 -17
- package/dist/{InventoryBindingForm-UL-UKtYW.js → InventoryBindingForm-DLTpv-zQ.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-r875PDKP.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-hkIg4Rbp.js} +17 -16
- package/dist/{InventoryBindingSummary-BDAuT62b.js → InventoryBindingSummary-D9ptV8Cw.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C5zOYiqR.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdPxhkg0.js} +5 -5
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-B2zppgqk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Ci3esisT.js} +2 -2
- package/dist/{PublishView-CSoZCSHT.js → PublishView-DxzL_D61.js} +8 -8
- package/dist/{PurchaseOrderPrintPreview-D5Qw44xo.js → PurchaseOrderPrintPreview-D0tg-2TC.js} +11 -11
- package/dist/{ReceiveRequestView-Chntp08E.js → ReceiveRequestView-2U534J1_.js} +251 -250
- package/dist/RecipeView-VZRyX3Mm.js +1558 -0
- package/dist/{StockView-CuCK7tD2.js → StockView-CvWbnYGz.js} +653 -651
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CxjceLuZ.js +183 -0
- package/dist/{SupplierView-CA17Tz02.js → SupplierView-DMIunLvv.js} +20 -19
- package/dist/{SurchargeView-EIftjMCa.js → SurchargeView-jteWYvQz.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CqA6RmPy.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CyoUVoDH.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CYXsAP0i.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DAkKiy0Z.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BbbAEIcW.js → TransferDetails.vue_vue_type_script_setup_true_lang-CEXA3vvS.js} +77 -78
- package/dist/{TransferTemplateView-CYfbm9aS.js → TransferTemplateView-DMQ1WIij.js} +22 -21
- package/dist/UnitCostHistoryView-DQ3sXVAQ.js +651 -0
- package/dist/{UnitView-6s5CsGEQ.js → UnitView-p6eZ8G2C.js} +9 -9
- package/dist/{WarehouseView-BXDQOyFZ.js → WarehouseView-BIShkEPs.js} +5 -5
- package/dist/{WastageTemplateView-Cq92TiRs.js → WastageTemplateView-DCbczB_0.js} +14 -14
- package/dist/api/inventory.d.ts +126 -36
- package/dist/api/netsuite.d.ts +8 -1
- package/dist/api/stock-estimate.d.ts +2 -0
- package/dist/api/unit-cost-history.d.ts +28 -0
- package/dist/{app-DJuq_faF.js → app-BAVBNKKH.js} +7461 -6448
- package/dist/app.d.ts +236 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-D_zbp5V1.js → closing-template-DqxA750a.js} +1 -1
- package/dist/components/StockForecastProps.d.ts +6 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +37 -1
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +14 -0
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +16 -1
- package/dist/{date2-4vrHarNG.js → date2-CgwRU403.js} +1 -1
- package/dist/{dayjs.min-Dwp8614O.js → dayjs.min-CjWVK_Fe.js} +16 -16
- package/dist/{defineDeepModel-DVt2Wz9r.js → defineDeepModel-B1j_kSRA.js} +1 -1
- package/dist/{duplicate-template-CkYWeFtL.js → duplicate-template-iHtqE_uw.js} +1 -1
- package/dist/{feature-Beh-qc03.js → feature-DEryk-Cv.js} +94 -89
- package/dist/{format-time-from-id-84iLSxVu.js → format-time-from-id-C-mbWMLS.js} +1 -1
- package/dist/{format-unit-display-DfeNpWk4.js → format-unit-display-C8Hzskg0.js} +16 -15
- package/dist/helper/number.d.ts +2 -0
- package/dist/helper/type.d.ts +5 -0
- package/dist/{import-export.helper-fAVzQM2q.js → import-export.helper-DGg16RXI.js} +17 -16
- package/dist/{index-CoEqhZLm.js → index-BAkoTUB0.js} +1 -1
- package/dist/{index-B2_16R5E.js → index-BLowSL6G.js} +1471 -1412
- package/dist/{index-Chogzhcq.js → index-CLr4DPan.js} +3 -3
- package/dist/{lodash-Cx8BU1GH.js → lodash-D1_0uR01.js} +1 -1
- package/dist/{netsuite-C1bml-v1.js → netsuite-Bbxz8tiD.js} +60 -60
- package/dist/number-Cof88Fjz.js +232 -0
- package/dist/{purchase-order-template-BqFnJ-6B.js → purchase-order-template-B-sXEbRE.js} +1 -1
- package/dist/router/name.d.ts +1 -0
- package/dist/rules-CzPUVxD_.js +98 -0
- package/dist/{stock-KxT4JbNf.js → stock-BYPFH5a_.js} +1 -1
- package/dist/stock-D9E1uFb1.js +75 -0
- package/dist/stores/feature.d.ts +2 -0
- package/dist/stores/integration/netsuite.d.ts +8 -1
- package/dist/stores/inventory.d.ts +119 -30
- package/dist/{supplier-C7wUB1zT.js → supplier-wQYh275s.js} +2 -2
- package/dist/{surcharge-CjB_Qtbv.js → surcharge-Bi21qFa0.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-D5KSqA4Z.js → use-ingredient-select-dialog-DH-mXl8H.js} +2 -2
- package/dist/{use-inventory-binding-dialog-eGOvztV3.js → use-inventory-binding-dialog-i8E2CNuV.js} +2 -2
- package/dist/{use-template-enabled-locations-2-3kcVWPQm.js → use-template-enabled-locations-2-DRk9TskI.js} +2 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +64 -8
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +192 -24
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +8 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +96 -12
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +96 -12
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +18 -18
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +14 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +32 -4
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +28 -0
- package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +169 -0
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingAlternative.vue.d.ts +43 -0
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryBindingRule.vue.d.ts +25 -0
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +125 -0
- package/dist/views/ingredients/components/inventory-binding/v2/components/InventorySkuBindingV2Field.vue.d.ts +129 -0
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-alternative-table.d.ts +30 -0
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +4 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +8 -1
- package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +16 -2
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +33 -5
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +16 -2
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +32 -4
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +8 -1
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +41 -6
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +246 -36
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +287 -42
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +16 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -0
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +16 -2
- package/dist/views/stock/type.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +16 -2
- package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +16 -2
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +16 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -1
- package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +24 -3
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -12
- package/dist/views/unit-cost-history/UnitCostHistoryView.vue.d.ts +2 -0
- package/dist/views/unit-cost-history/components/UnitCostDetailsSideSheet.vue.d.ts +19 -0
- package/dist/views/unit-cost-history/components/UnitCostRecalculationDialog.vue.d.ts +11 -0
- package/dist/views/unit-cost-history/composables/use-unit-cost-history.d.ts +65 -0
- package/dist/{vue-i18n-C6XNfngV.js → vue-i18n-Cf9iDkfk.js} +398 -398
- package/dist/{xlsx-BwNUbN_O.js → xlsx-lp5RXzSw.js} +398 -398
- package/dist/{xlsx.util-B_DE3inS.js → xlsx.util-BxpZNkEZ.js} +1 -1
- package/package.json +2 -2
- package/dist/RecipeView-Ck3Pa4fg.js +0 -646
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-fMji2qKG.js +0 -172
- package/dist/decimal-Bf6AG_d3.js +0 -99
- package/dist/rules-y2OYGOro.js +0 -201
- package/dist/stock-BWUzlDTa.js +0 -75
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import { defineComponent as Ve, ref as Y, computed as
|
|
2
|
-
import { F as
|
|
3
|
-
import { useCoreStore as
|
|
4
|
-
import { useSnackbar as
|
|
5
|
-
import { o as
|
|
6
|
-
import { defineStore as
|
|
7
|
-
import { d as
|
|
8
|
-
import { R as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { u as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
1
|
+
import { defineComponent as Ve, ref as Y, computed as U, onMounted as et, resolveComponent as O, openBlock as A, createElementBlock as R, Fragment as ce, createTextVNode as ue, createBlock as pe, withCtx as q, createElementVNode as n, toDisplayString as W, unref as v, createVNode as _, createCommentVNode as se, h as S, watch as He, renderList as je, reactive as Lt, isRef as _t, normalizeClass as Ie, normalizeStyle as xt, Teleport as Et, mergeProps as zt } from "vue";
|
|
2
|
+
import { F as bt, u as Ht, _ as Ot } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
|
|
3
|
+
import { useCoreStore as Dt, useI18n as tt } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as at, useDialog as Kt, components as ke, useProxiedModel as Yt, useBreakpoints as qt } from "@feedmepos/ui-library";
|
|
5
|
+
import { o as Gt, u as Ge, K as Z, y as H, s as At, v as Ue, L as _e, D as Oe, c as Qt, a as wt } from "./app-BAVBNKKH.js";
|
|
6
|
+
import { defineStore as St, storeToRefs as Wt } from "pinia";
|
|
7
|
+
import { d as Ye, e as Ct, f as Zt, a as De } from "./date2-CgwRU403.js";
|
|
8
|
+
import { R as Jt } from "./rules-CzPUVxD_.js";
|
|
9
|
+
import { e as nt, a as Xe, t as Xt, c as Re, m as $t, o as Ft, k as Bt, l as Tt, p as te, F as ea } from "./number-Cof88Fjz.js";
|
|
10
|
+
import { b as ta, d as aa } from "./xlsx.util-BxpZNkEZ.js";
|
|
11
|
+
import { u as jt } from "./stock-D9E1uFb1.js";
|
|
12
|
+
import { u as ot } from "./stock-BYPFH5a_.js";
|
|
13
|
+
import { D as ht, R as Te } from "./row-action.enum-BcW_L_nE.js";
|
|
14
|
+
import { c as na } from "./component-DpCUABT3.js";
|
|
15
|
+
import { f as oa } from "./format-time-from-id-C-mbWMLS.js";
|
|
16
|
+
import { _ as sa } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUIrR73y.js";
|
|
17
|
+
import { E as ra } from "./empty-placeholder-wf6-BWE8.js";
|
|
18
|
+
import { u as la } from "./vue-i18n-Cf9iDkfk.js";
|
|
19
|
+
import { _ as ia, F as ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
20
|
+
const Qe = Gt((c, s) => {
|
|
20
21
|
function e() {
|
|
21
22
|
return Ge().currentLocation.dbName;
|
|
22
23
|
}
|
|
23
24
|
return {
|
|
24
25
|
async getDraft(u) {
|
|
25
|
-
const
|
|
26
|
-
return
|
|
26
|
+
const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/${u}`;
|
|
27
|
+
return s.get(h);
|
|
27
28
|
},
|
|
28
29
|
async readDrafts() {
|
|
29
|
-
const u = e(),
|
|
30
|
-
return
|
|
30
|
+
const u = e(), k = `${c.inventoryBackendUrl}/${u}/closing-draft`;
|
|
31
|
+
return s.get(k);
|
|
31
32
|
},
|
|
32
33
|
async runOperation(u) {
|
|
33
|
-
const
|
|
34
|
-
return
|
|
34
|
+
const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/run-operation`;
|
|
35
|
+
return s.post(h, u);
|
|
35
36
|
},
|
|
36
37
|
async runOperationV1(u) {
|
|
37
|
-
const
|
|
38
|
-
return
|
|
38
|
+
const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/v1/run-operation`;
|
|
39
|
+
return s.post(h, u);
|
|
39
40
|
},
|
|
40
41
|
async sync(u) {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
42
|
+
const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/sync`;
|
|
43
|
+
return s.post(h, u);
|
|
43
44
|
},
|
|
44
45
|
async cloneDraft(u) {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
46
|
+
const k = e(), h = `${c.inventoryBackendUrl}/${k}/closing-draft/${u}/clone`;
|
|
47
|
+
return s.post(h, {});
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
|
-
}),
|
|
50
|
+
}), ca = { class: "fm-typo-en-body-lg-400" }, ua = { class: "fm-typo-en-body-lg-600" }, da = {
|
|
50
51
|
key: 0,
|
|
51
52
|
class: "flex flex-col"
|
|
52
|
-
},
|
|
53
|
+
}, ma = {
|
|
53
54
|
key: 0,
|
|
54
55
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
55
|
-
},
|
|
56
|
+
}, fa = { class: "flex gap-12 py-8 justify-end w-full" }, Je = /* @__PURE__ */ Ve({
|
|
56
57
|
__name: "ClosingDraftAction",
|
|
57
58
|
props: {
|
|
58
59
|
draft: {},
|
|
@@ -61,8 +62,8 @@ const Qe = Yt((c, o) => {
|
|
|
61
62
|
onFinished: { type: Function }
|
|
62
63
|
},
|
|
63
64
|
setup(c) {
|
|
64
|
-
const
|
|
65
|
-
switch (
|
|
65
|
+
const s = c, e = Y(), u = Qe(), k = at(), h = Y(!1), r = Y(null), L = Y(!1), V = U(() => {
|
|
66
|
+
switch (s.action) {
|
|
66
67
|
case Z.enum.approveDraft:
|
|
67
68
|
return "Approve";
|
|
68
69
|
case Z.enum.rejectDraft:
|
|
@@ -70,9 +71,9 @@ const Qe = Yt((c, o) => {
|
|
|
70
71
|
case Z.enum.markAsFailed:
|
|
71
72
|
return "Mark as Failed";
|
|
72
73
|
}
|
|
73
|
-
throw new Error(`Unknown action: ${
|
|
74
|
-
}), I =
|
|
75
|
-
switch (
|
|
74
|
+
throw new Error(`Unknown action: ${s.action}`);
|
|
75
|
+
}), I = U(() => {
|
|
76
|
+
switch (s.action) {
|
|
76
77
|
case Z.enum.approveDraft:
|
|
77
78
|
return "primary";
|
|
78
79
|
case Z.enum.rejectDraft:
|
|
@@ -80,20 +81,20 @@ const Qe = Yt((c, o) => {
|
|
|
80
81
|
case Z.enum.markAsFailed:
|
|
81
82
|
return "destructive";
|
|
82
83
|
}
|
|
83
|
-
throw new Error(`Unknown action: ${
|
|
84
|
+
throw new Error(`Unknown action: ${s.action}`);
|
|
84
85
|
});
|
|
85
|
-
|
|
86
|
-
if (
|
|
87
|
-
r.value = new Date(
|
|
86
|
+
et(() => {
|
|
87
|
+
if (s.draft.effectiveAt)
|
|
88
|
+
r.value = new Date(s.draft.effectiveAt);
|
|
88
89
|
else {
|
|
89
|
-
const d = new Date(
|
|
90
|
+
const d = new Date(s.draft.createdAt);
|
|
90
91
|
d.setHours(23, 59, 59, 999), r.value = d;
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
L.value = !0;
|
|
93
94
|
});
|
|
94
|
-
const x =
|
|
95
|
+
const x = U({
|
|
95
96
|
get() {
|
|
96
|
-
return r.value === null ? "" :
|
|
97
|
+
return r.value === null ? "" : Ye(r.value);
|
|
97
98
|
},
|
|
98
99
|
set(d) {
|
|
99
100
|
if (d) {
|
|
@@ -102,9 +103,9 @@ const Qe = Yt((c, o) => {
|
|
|
102
103
|
} else
|
|
103
104
|
r.value = null;
|
|
104
105
|
}
|
|
105
|
-
}), M =
|
|
106
|
+
}), M = U({
|
|
106
107
|
get() {
|
|
107
|
-
return r.value === null ? "" :
|
|
108
|
+
return r.value === null ? "" : Ct(r.value);
|
|
108
109
|
},
|
|
109
110
|
set(d) {
|
|
110
111
|
if (d) {
|
|
@@ -113,144 +114,144 @@ const Qe = Yt((c, o) => {
|
|
|
113
114
|
} else
|
|
114
115
|
r.value = null;
|
|
115
116
|
}
|
|
116
|
-
}), G =
|
|
117
|
+
}), G = U(() => r.value ? r.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
117
118
|
async function K(d) {
|
|
118
|
-
|
|
119
|
+
h.value = !0;
|
|
119
120
|
try {
|
|
120
121
|
d ? await u.runOperationV1({
|
|
121
|
-
_id:
|
|
122
|
-
_rev:
|
|
123
|
-
action:
|
|
122
|
+
_id: s.draft._id,
|
|
123
|
+
_rev: s.draft._rev ?? "",
|
|
124
|
+
action: s.action,
|
|
124
125
|
data: {
|
|
125
126
|
effectiveAt: r.value ? r.value.toISOString() : null,
|
|
126
127
|
remark: e.value
|
|
127
128
|
}
|
|
128
129
|
}).delayed(500) : await u.runOperation({
|
|
129
|
-
_id:
|
|
130
|
-
_rev:
|
|
131
|
-
action:
|
|
130
|
+
_id: s.draft._id,
|
|
131
|
+
_rev: s.draft._rev ?? "",
|
|
132
|
+
action: s.action,
|
|
132
133
|
data: {
|
|
133
134
|
effectiveAt: r.value ? r.value.toISOString() : null,
|
|
134
135
|
remark: e.value
|
|
135
136
|
}
|
|
136
|
-
}).delayed(500),
|
|
137
|
+
}).delayed(500), k.open({
|
|
137
138
|
title: "Success",
|
|
138
139
|
message: "Action submitted",
|
|
139
140
|
type: "success"
|
|
140
|
-
}),
|
|
141
|
+
}), s.onFinished();
|
|
141
142
|
} catch (t) {
|
|
142
|
-
|
|
143
|
+
k.open({
|
|
143
144
|
title: "Something went wrong",
|
|
144
145
|
message: (t == null ? void 0 : t.message) ?? "Unable to submit action. Please try again",
|
|
145
146
|
type: "error"
|
|
146
147
|
}), console.error("error on submit closing draft action", t);
|
|
147
148
|
} finally {
|
|
148
|
-
|
|
149
|
+
h.value = !1;
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
return (d, t) => {
|
|
152
|
-
const j = O("FmLabel"), D = O("FmDatePicker"), Q = O("FmTimePicker"),
|
|
153
|
-
return
|
|
153
|
+
const j = O("FmLabel"), D = O("FmDatePicker"), Q = O("FmTimePicker"), y = O("FmTextField"), m = O("FmButton"), F = O("FmForm");
|
|
154
|
+
return L.value ? (A(), pe(F, {
|
|
154
155
|
key: 1,
|
|
155
156
|
onValidationSuccess: K,
|
|
156
157
|
class: "flex flex-col gap-32",
|
|
157
|
-
disabled:
|
|
158
|
+
disabled: h.value
|
|
158
159
|
}, {
|
|
159
160
|
default: q(() => [
|
|
160
|
-
n("div",
|
|
161
|
-
t[4] || (t[4] =
|
|
162
|
-
n("span",
|
|
163
|
-
t[5] || (t[5] =
|
|
161
|
+
n("div", ca, [
|
|
162
|
+
t[4] || (t[4] = ue(" You are about to ")),
|
|
163
|
+
n("span", ua, W(V.value), 1),
|
|
164
|
+
t[5] || (t[5] = ue(" this draft. Please provide a remark to justify this action. "))
|
|
164
165
|
]),
|
|
165
|
-
d.action === v(Z).enum.approveDraft ? (A(),
|
|
166
|
-
|
|
166
|
+
d.action === v(Z).enum.approveDraft ? (A(), R("div", da, [
|
|
167
|
+
_(j, { class: "fm-typo-en-body-lg-600" }, {
|
|
167
168
|
default: q(() => t[6] || (t[6] = [
|
|
168
|
-
|
|
169
|
+
ue("Closing Date")
|
|
169
170
|
])),
|
|
170
171
|
_: 1
|
|
171
172
|
}),
|
|
172
|
-
|
|
173
|
+
_(D, {
|
|
173
174
|
modelValue: x.value,
|
|
174
175
|
"onUpdate:modelValue": t[0] || (t[0] = (z) => x.value = z),
|
|
175
|
-
max: v(
|
|
176
|
+
max: v(Ye)(/* @__PURE__ */ new Date())
|
|
176
177
|
}, null, 8, ["modelValue", "max"]),
|
|
177
|
-
|
|
178
|
+
_(j, { class: "fm-typo-en-body-lg-600" }, {
|
|
178
179
|
default: q(() => t[7] || (t[7] = [
|
|
179
|
-
|
|
180
|
+
ue("Closing Time")
|
|
180
181
|
])),
|
|
181
182
|
_: 1
|
|
182
183
|
}),
|
|
183
|
-
|
|
184
|
+
_(Q, {
|
|
184
185
|
modelValue: M.value,
|
|
185
186
|
"onUpdate:modelValue": t[1] || (t[1] = (z) => M.value = z)
|
|
186
187
|
}, null, 8, ["modelValue"]),
|
|
187
|
-
G.value ? (A(),
|
|
188
|
-
])) :
|
|
189
|
-
|
|
188
|
+
G.value ? (A(), R("div", ma, " Cannot select future date ")) : se("", !0)
|
|
189
|
+
])) : se("", !0),
|
|
190
|
+
_(y, {
|
|
190
191
|
modelValue: e.value,
|
|
191
192
|
"onUpdate:modelValue": t[2] || (t[2] = (z) => e.value = z),
|
|
192
193
|
label: "Remark",
|
|
193
194
|
"label-mark": "required",
|
|
194
|
-
rules: [v(
|
|
195
|
+
rules: [v(Jt)()]
|
|
195
196
|
}, null, 8, ["modelValue", "rules"]),
|
|
196
|
-
n("div",
|
|
197
|
-
|
|
197
|
+
n("div", fa, [
|
|
198
|
+
_(m, {
|
|
198
199
|
label: "Cancel",
|
|
199
200
|
variant: "tertiary",
|
|
200
201
|
onClick: t[3] || (t[3] = (z) => d.onCancel())
|
|
201
202
|
}),
|
|
202
|
-
|
|
203
|
-
label:
|
|
203
|
+
_(m, {
|
|
204
|
+
label: V.value,
|
|
204
205
|
type: "submit",
|
|
205
206
|
variant: I.value,
|
|
206
|
-
loading:
|
|
207
|
+
loading: h.value
|
|
207
208
|
}, null, 8, ["label", "variant", "loading"])
|
|
208
209
|
])
|
|
209
210
|
]),
|
|
210
211
|
_: 1
|
|
211
|
-
}, 8, ["disabled"])) : (A(),
|
|
212
|
-
|
|
212
|
+
}, 8, ["disabled"])) : (A(), R(ce, { key: 0 }, [
|
|
213
|
+
ue("Loading")
|
|
213
214
|
], 64));
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
|
-
}),
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
var
|
|
220
|
-
const
|
|
221
|
-
return u + +
|
|
222
|
-
}, +
|
|
223
|
-
return
|
|
217
|
+
}), pa = Re(0);
|
|
218
|
+
function It(c) {
|
|
219
|
+
const s = c.measurementsAmounts.groupBy((u) => u.measurement.id), e = c.sku.unit.measurements.reduce((u, k) => {
|
|
220
|
+
var L, V;
|
|
221
|
+
const h = ((V = (L = s.get(k.id)) == null ? void 0 : L[0]) == null ? void 0 : V.amount) ?? pa, r = nt(k.conversion, h);
|
|
222
|
+
return u + +Xe(r);
|
|
223
|
+
}, +Xe(c.baseAmount));
|
|
224
|
+
return Xt(e, c.baseAmount.precision);
|
|
224
225
|
}
|
|
225
|
-
const
|
|
226
|
-
function
|
|
227
|
-
var
|
|
228
|
-
const
|
|
229
|
-
...
|
|
230
|
-
amount: Math.abs(
|
|
231
|
-
}), M = x ?
|
|
226
|
+
const va = Re(0), ya = Re(100);
|
|
227
|
+
function ga(c, s, e, u, k, h, r) {
|
|
228
|
+
var ne, le, me, $, w;
|
|
229
|
+
const L = It(c), V = u ?? L, I = $t(V, s), x = s.amount === 0 ? null : Ft(I, {
|
|
230
|
+
...s,
|
|
231
|
+
amount: Math.abs(s.amount)
|
|
232
|
+
}), M = x ? nt(x, ya) : null, G = ((ne = c.sku.defaultCost) == null ? void 0 : ne.costPerUnit) ?? { amount: 0, precision: 0 }, K = Number(H.toFormatString({ value: G })), d = ((me = (le = c.sku.defaultCost) == null ? void 0 : le.measurement) == null ? void 0 : me.conversion) ?? {
|
|
232
233
|
amount: 1,
|
|
233
234
|
precision: 0
|
|
234
235
|
}, t = Number(
|
|
235
236
|
H.toFormatString({ value: d })
|
|
236
|
-
), j =
|
|
237
|
-
return r &&
|
|
238
|
-
const
|
|
237
|
+
), j = k ? Number(H.toFormatString({ value: k })) : 0, D = Number(H.toFormatString({ value: s })), Q = Number(H.toFormatString({ value: V })), y = Q - D, m = y * K / t, F = Q * K / t, z = D * K / t, ae = {};
|
|
238
|
+
return r && h && r.forEach((g) => {
|
|
239
|
+
const P = { amount: 0, precision: 0 }, J = h[g];
|
|
239
240
|
if (J) {
|
|
240
|
-
const ee =
|
|
241
|
-
|
|
241
|
+
const ee = Bt(P, J);
|
|
242
|
+
ae[`adjustment_${g}`] = Xe(ee);
|
|
242
243
|
} else
|
|
243
|
-
|
|
244
|
+
ae[`adjustment_${g}`] = "0";
|
|
244
245
|
}), {
|
|
245
246
|
code: c.sku.code,
|
|
246
247
|
name: c.sku.name,
|
|
247
248
|
baseUnit: c.sku.unit.abbrev,
|
|
248
|
-
costUnit: ((w = (
|
|
249
|
+
costUnit: ((w = ($ = c.sku.defaultCost) == null ? void 0 : $.measurement) == null ? void 0 : w.abbrev) ?? null,
|
|
249
250
|
baseUnitAmount: Number(H.toFormatString({ value: c.baseAmount })),
|
|
250
251
|
...c.measurementsAmounts.filter(
|
|
251
|
-
(
|
|
252
|
+
(g) => ba(g.measurement) && e.includes(g.measurement.id)
|
|
252
253
|
).reduce(
|
|
253
|
-
(
|
|
254
|
+
(g, P, J) => (g[`measurementAbbrev${J}`] = `(${P.measurement.abbrev}) × ${H.toFormatString({ value: P.measurement.conversion })}`, g[`measurementAmount${J}`] = Number(H.toFormatString({ value: P.amount })), g),
|
|
254
255
|
{}
|
|
255
256
|
),
|
|
256
257
|
systemBalance: D,
|
|
@@ -258,39 +259,39 @@ function pa(c, o, e, u, _, b, r) {
|
|
|
258
259
|
adjustedAmount: Number(H.toFormatString({ value: I })),
|
|
259
260
|
adjustedDiffPercentage: M ? Number(
|
|
260
261
|
H.toFormatString({
|
|
261
|
-
value:
|
|
262
|
+
value: Tt(M, 2)
|
|
262
263
|
})
|
|
263
264
|
) : null,
|
|
264
265
|
costPerUnit: K,
|
|
265
266
|
opening: j,
|
|
266
|
-
...
|
|
267
|
-
varianceQty:
|
|
267
|
+
...ae,
|
|
268
|
+
varianceQty: y,
|
|
268
269
|
varianceInCost: m,
|
|
269
|
-
stockTakeValue:
|
|
270
|
+
stockTakeValue: F,
|
|
270
271
|
systemValue: z
|
|
271
272
|
};
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
+
function ba(c) {
|
|
274
275
|
return !c.abbrev.toLocaleLowerCase().includes("inactive");
|
|
275
276
|
}
|
|
276
|
-
function
|
|
277
|
-
const
|
|
277
|
+
function ha(c) {
|
|
278
|
+
const s = Pt(c);
|
|
278
279
|
return c.reduce(
|
|
279
280
|
(e, u) => {
|
|
280
|
-
var
|
|
281
|
-
return Math.max(e, ((
|
|
281
|
+
var k;
|
|
282
|
+
return Math.max(e, ((k = s == null ? void 0 : s.get(u.sku._id)) == null ? void 0 : k[0].length) ?? 0);
|
|
282
283
|
},
|
|
283
284
|
0
|
|
284
285
|
);
|
|
285
286
|
}
|
|
286
|
-
function
|
|
287
|
+
function Pt(c) {
|
|
287
288
|
return c.groupBy(
|
|
288
|
-
(
|
|
289
|
-
(
|
|
289
|
+
(s) => s.sku._id,
|
|
290
|
+
(s) => s.measurementsAmounts.filter((e) => !e.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((e) => e.measurement.id)
|
|
290
291
|
);
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
-
const e =
|
|
293
|
+
function ka(c, s = []) {
|
|
294
|
+
const e = At(), u = e === "MYR" ? "RM" : e;
|
|
294
295
|
return [
|
|
295
296
|
{
|
|
296
297
|
id: "code",
|
|
@@ -317,9 +318,9 @@ function ya(c, o = []) {
|
|
|
317
318
|
name: "Opening (B/F)"
|
|
318
319
|
},
|
|
319
320
|
// Dynamic adjustment type columns
|
|
320
|
-
...
|
|
321
|
-
id: `adjustment_${
|
|
322
|
-
name: Ue(
|
|
321
|
+
...s.map((h) => ({
|
|
322
|
+
id: `adjustment_${h}`,
|
|
323
|
+
name: Ue(h)
|
|
323
324
|
})),
|
|
324
325
|
{
|
|
325
326
|
id: "systemBalance",
|
|
@@ -353,7 +354,7 @@ function ya(c, o = []) {
|
|
|
353
354
|
id: "baseUnitAmount",
|
|
354
355
|
name: "Base unit amount"
|
|
355
356
|
},
|
|
356
|
-
...Array.from({ length: c }).flatMap((
|
|
357
|
+
...Array.from({ length: c }).flatMap((h, r) => [
|
|
357
358
|
{
|
|
358
359
|
id: `measurementAmount${r}`,
|
|
359
360
|
name: `UOM amount ${r + 1}`
|
|
@@ -365,69 +366,69 @@ function ya(c, o = []) {
|
|
|
365
366
|
])
|
|
366
367
|
];
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
-
var
|
|
370
|
-
const u =
|
|
371
|
-
(
|
|
372
|
-
(
|
|
373
|
-
),
|
|
374
|
-
(
|
|
375
|
-
(
|
|
376
|
-
),
|
|
369
|
+
function _a(c, s, e) {
|
|
370
|
+
var ae, de, ne, le, me, $, w;
|
|
371
|
+
const u = s.groupBy(
|
|
372
|
+
(g) => g.id,
|
|
373
|
+
(g) => g.balance
|
|
374
|
+
), k = e.groupBy(
|
|
375
|
+
(g) => g.id,
|
|
376
|
+
(g) => g.balance
|
|
377
|
+
), h = /* @__PURE__ */ new Map();
|
|
377
378
|
if (c.opening)
|
|
378
|
-
for (const
|
|
379
|
-
|
|
380
|
-
const r = /* @__PURE__ */ new Set(),
|
|
379
|
+
for (const g of c.opening)
|
|
380
|
+
h.set(g.skuId, g.balance);
|
|
381
|
+
const r = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Map();
|
|
381
382
|
if (c.adjustmentSnapshot)
|
|
382
|
-
for (const
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
r.has(
|
|
383
|
+
for (const g of c.adjustmentSnapshot)
|
|
384
|
+
g.adjustmentsByType && (Object.keys(g.adjustmentsByType).forEach((P) => r.add(P)), L.set(g.skuId, g.adjustmentsByType));
|
|
385
|
+
const V = ["receive", "sales", "wastage"], I = [];
|
|
386
|
+
V.forEach((g) => {
|
|
387
|
+
r.has(g) && (I.push(g), r.delete(g));
|
|
387
388
|
});
|
|
388
|
-
const x = Array.from(r).sort(), M = [...I, ...x], G = [...c.items, ...c.negativeStockItems ?? []], K =
|
|
389
|
-
var
|
|
390
|
-
const
|
|
391
|
-
return
|
|
392
|
-
|
|
393
|
-
|
|
389
|
+
const x = Array.from(r).sort(), M = [...I, ...x], G = [...c.items, ...c.negativeStockItems ?? []], K = Pt(G), d = G.map((g) => {
|
|
390
|
+
var xe, Ae, be;
|
|
391
|
+
const P = ((xe = u.get(g.sku._id)) == null ? void 0 : xe[0]) ?? va, J = ((Ae = K == null ? void 0 : K.get(g.sku._id)) == null ? void 0 : Ae[0]) ?? [], ee = h.get(g.sku._id), X = L.get(g.sku._id);
|
|
392
|
+
return ga(
|
|
393
|
+
g,
|
|
394
|
+
P,
|
|
394
395
|
J,
|
|
395
|
-
(
|
|
396
|
+
(be = k.get(g.sku._id)) == null ? void 0 : be[0],
|
|
396
397
|
ee,
|
|
397
398
|
X,
|
|
398
399
|
M
|
|
399
400
|
);
|
|
400
|
-
}), t =
|
|
401
|
+
}), t = ha(G), D = Dt().currentBusiness.value, Q = ka(t, M), y = [
|
|
401
402
|
["Business name:", D == null ? void 0 : D.name],
|
|
402
403
|
["Business ID:", D == null ? void 0 : D._id],
|
|
403
404
|
["Menu version", D == null ? void 0 : D.menuVersion],
|
|
404
405
|
["Created at", new Date(c.createdAt)],
|
|
405
|
-
["Created by", (
|
|
406
|
+
["Created by", (ae = c.createdBy) == null ? void 0 : ae.name],
|
|
406
407
|
["Updated at", new Date(c.updatedAt)],
|
|
407
|
-
["Updated by", (
|
|
408
|
+
["Updated by", (de = c.updatedBy) == null ? void 0 : de.name],
|
|
408
409
|
["Recent action", c.approvedAt ? "Approve" : c.rejectionHistory ? "Reject" : ""],
|
|
409
410
|
[
|
|
410
411
|
"Action by",
|
|
411
|
-
c.approvedAt ? (
|
|
412
|
+
c.approvedAt ? (ne = c.approvedBy) == null ? void 0 : ne.name : c.rejectionHistory ? (me = (le = c.rejectionHistory[0]) == null ? void 0 : le.rejectedBy) == null ? void 0 : me.name : ""
|
|
412
413
|
],
|
|
413
414
|
[
|
|
414
415
|
"Action at",
|
|
415
|
-
c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date((
|
|
416
|
+
c.approvedAt ? new Date(c.approvedAt) : c.rejectionHistory ? new Date(($ = c.rejectionHistory[0]) == null ? void 0 : $.rejectedAt) : ""
|
|
416
417
|
],
|
|
417
418
|
[
|
|
418
419
|
"Action remark",
|
|
419
420
|
c.approvedAt ? c.approveRemark : c.rejectionHistory ? new Date((w = c.rejectionHistory[0]) == null ? void 0 : w.rejectRemark) : ""
|
|
420
421
|
],
|
|
421
422
|
[],
|
|
422
|
-
Q.map((
|
|
423
|
-
...d.map((
|
|
424
|
-
], m = Q.map((
|
|
425
|
-
return
|
|
423
|
+
Q.map((g) => g.name),
|
|
424
|
+
...d.map((g) => Q.map((P) => g[P.id]))
|
|
425
|
+
], m = Q.map((g) => `system:${g.id}`), F = ta(y, m), z = `[${D == null ? void 0 : D.name}] closing draft (${Zt(new Date(c.updatedAt))}).xlsx`;
|
|
426
|
+
return aa(F, z), z;
|
|
426
427
|
}
|
|
427
|
-
const
|
|
428
|
+
const xa = { class: "flex flex-col" }, Da = {
|
|
428
429
|
key: 0,
|
|
429
430
|
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error mt-4"
|
|
430
|
-
},
|
|
431
|
+
}, Aa = { class: "flex gap-12 py-8 justify-end w-full" }, wa = /* @__PURE__ */ Ve({
|
|
431
432
|
__name: "RefreshBalanceAction",
|
|
432
433
|
props: {
|
|
433
434
|
draft: {},
|
|
@@ -435,21 +436,21 @@ const ha = { class: "flex flex-col" }, _a = {
|
|
|
435
436
|
onFinished: { type: Function }
|
|
436
437
|
},
|
|
437
438
|
setup(c) {
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
const e = Y(!1), u = Y(null),
|
|
441
|
-
|
|
442
|
-
if (
|
|
443
|
-
u.value = new Date(
|
|
439
|
+
const s = c;
|
|
440
|
+
ot();
|
|
441
|
+
const e = Y(!1), u = Y(null), k = Y(!1);
|
|
442
|
+
et(() => {
|
|
443
|
+
if (s.draft.effectiveAt)
|
|
444
|
+
u.value = new Date(s.draft.effectiveAt);
|
|
444
445
|
else {
|
|
445
|
-
const I = new Date(
|
|
446
|
+
const I = new Date(s.draft.createdAt);
|
|
446
447
|
I.setHours(23, 59, 59, 999), u.value = I;
|
|
447
448
|
}
|
|
448
|
-
|
|
449
|
+
k.value = !0;
|
|
449
450
|
});
|
|
450
|
-
const
|
|
451
|
+
const h = U({
|
|
451
452
|
get() {
|
|
452
|
-
return u.value === null ? "" :
|
|
453
|
+
return u.value === null ? "" : Ye(u.value);
|
|
453
454
|
},
|
|
454
455
|
set(I) {
|
|
455
456
|
if (I) {
|
|
@@ -458,177 +459,177 @@ const ha = { class: "flex flex-col" }, _a = {
|
|
|
458
459
|
} else
|
|
459
460
|
u.value = null;
|
|
460
461
|
}
|
|
461
|
-
}), r =
|
|
462
|
+
}), r = U({
|
|
462
463
|
get() {
|
|
463
|
-
return u.value === null ? "" :
|
|
464
|
+
return u.value === null ? "" : Ct(u.value);
|
|
464
465
|
},
|
|
465
466
|
set(I) {
|
|
466
467
|
if (I) {
|
|
467
|
-
const x = /* @__PURE__ */ new Date(`${
|
|
468
|
+
const x = /* @__PURE__ */ new Date(`${h.value} ${I}`);
|
|
468
469
|
x.setSeconds(59, 999), u.value = x;
|
|
469
470
|
} else
|
|
470
471
|
u.value = null;
|
|
471
472
|
}
|
|
472
|
-
}),
|
|
473
|
-
async function
|
|
474
|
-
e.value = !0,
|
|
473
|
+
}), L = U(() => u.value ? u.value.getTime() > (/* @__PURE__ */ new Date()).getTime() : !1);
|
|
474
|
+
async function V() {
|
|
475
|
+
e.value = !0, s.onFinished(u.value.toISOString());
|
|
475
476
|
}
|
|
476
477
|
return (I, x) => {
|
|
477
478
|
const M = O("FmLabel"), G = O("FmDatePicker"), K = O("FmTimePicker"), d = O("FmButton"), t = O("FmForm");
|
|
478
|
-
return
|
|
479
|
+
return k.value ? (A(), pe(t, {
|
|
479
480
|
key: 1,
|
|
480
|
-
onValidationSuccess:
|
|
481
|
+
onValidationSuccess: V,
|
|
481
482
|
class: "flex flex-col gap-32",
|
|
482
483
|
disabled: e.value
|
|
483
484
|
}, {
|
|
484
485
|
default: q(() => [
|
|
485
486
|
x[5] || (x[5] = n("div", { class: "fm-typo-en-body-lg-400" }, [
|
|
486
487
|
n("p", null, [
|
|
487
|
-
|
|
488
|
+
ue(" Performing "),
|
|
488
489
|
n("span", { class: "fm-typo-en-body-lg-600" }, '"Refresh Balance"'),
|
|
489
|
-
|
|
490
|
+
ue(" until closing effective date and time. ")
|
|
490
491
|
]),
|
|
491
492
|
n("p", { class: "mt-2" }, [
|
|
492
|
-
|
|
493
|
+
ue(" Please note that this action will "),
|
|
493
494
|
n("b", null, "update"),
|
|
494
|
-
|
|
495
|
+
ue(" the effective date and time. ")
|
|
495
496
|
])
|
|
496
497
|
], -1)),
|
|
497
|
-
n("div",
|
|
498
|
-
|
|
498
|
+
n("div", xa, [
|
|
499
|
+
_(M, { class: "fm-typo-en-body-lg-600" }, {
|
|
499
500
|
default: q(() => x[3] || (x[3] = [
|
|
500
|
-
|
|
501
|
+
ue("Closing Date")
|
|
501
502
|
])),
|
|
502
503
|
_: 1
|
|
503
504
|
}),
|
|
504
|
-
|
|
505
|
-
modelValue:
|
|
506
|
-
"onUpdate:modelValue": x[0] || (x[0] = (j) =>
|
|
507
|
-
max: v(
|
|
505
|
+
_(G, {
|
|
506
|
+
modelValue: h.value,
|
|
507
|
+
"onUpdate:modelValue": x[0] || (x[0] = (j) => h.value = j),
|
|
508
|
+
max: v(Ye)(/* @__PURE__ */ new Date())
|
|
508
509
|
}, null, 8, ["modelValue", "max"]),
|
|
509
|
-
|
|
510
|
+
_(M, { class: "fm-typo-en-body-lg-600" }, {
|
|
510
511
|
default: q(() => x[4] || (x[4] = [
|
|
511
|
-
|
|
512
|
+
ue("Closing Time")
|
|
512
513
|
])),
|
|
513
514
|
_: 1
|
|
514
515
|
}),
|
|
515
|
-
|
|
516
|
+
_(K, {
|
|
516
517
|
modelValue: r.value,
|
|
517
518
|
"onUpdate:modelValue": x[1] || (x[1] = (j) => r.value = j)
|
|
518
519
|
}, null, 8, ["modelValue"]),
|
|
519
|
-
|
|
520
|
+
L.value ? (A(), R("div", Da, " Cannot select future date ")) : se("", !0)
|
|
520
521
|
]),
|
|
521
|
-
n("div",
|
|
522
|
-
|
|
522
|
+
n("div", Aa, [
|
|
523
|
+
_(d, {
|
|
523
524
|
label: "Cancel",
|
|
524
525
|
variant: "tertiary",
|
|
525
526
|
onClick: x[2] || (x[2] = (j) => I.onCancel())
|
|
526
527
|
}),
|
|
527
|
-
|
|
528
|
+
_(d, {
|
|
528
529
|
label: "Refresh balance",
|
|
529
530
|
type: "submit",
|
|
530
531
|
variant: "primary",
|
|
531
532
|
loading: e.value,
|
|
532
|
-
disabled:
|
|
533
|
+
disabled: L.value
|
|
533
534
|
}, null, 8, ["loading", "disabled"])
|
|
534
535
|
])
|
|
535
536
|
]),
|
|
536
537
|
_: 1
|
|
537
|
-
}, 8, ["disabled"])) : (A(),
|
|
538
|
-
|
|
538
|
+
}, 8, ["disabled"])) : (A(), R(ce, { key: 0 }, [
|
|
539
|
+
ue("Loading")
|
|
539
540
|
], 64));
|
|
540
541
|
};
|
|
541
542
|
}
|
|
542
|
-
}), qe =
|
|
543
|
+
}), qe = St(
|
|
543
544
|
"closingDraftActions",
|
|
544
545
|
function() {
|
|
545
|
-
const
|
|
546
|
-
function
|
|
546
|
+
const s = Kt(), e = at(), u = ot(), k = Qe(), h = jt(), r = Y(!1), L = Y();
|
|
547
|
+
function V(y) {
|
|
547
548
|
const m = {
|
|
548
|
-
draft:
|
|
549
|
+
draft: y
|
|
549
550
|
};
|
|
550
|
-
|
|
551
|
+
L.value = m, r.value = !0;
|
|
551
552
|
}
|
|
552
|
-
async function I(
|
|
553
|
-
var
|
|
554
|
-
if (
|
|
555
|
-
const z =
|
|
553
|
+
async function I(y) {
|
|
554
|
+
var F;
|
|
555
|
+
if (y.status === _e.enum.COMPLETED) {
|
|
556
|
+
const z = y.closingAdjustmentId;
|
|
556
557
|
if (!z)
|
|
557
558
|
return e.open({
|
|
558
559
|
title: "Something went wrong",
|
|
559
560
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
560
561
|
type: "error"
|
|
561
562
|
}), console.error("Closing draft is completed but closing document cannot be found.", {
|
|
562
|
-
draftId:
|
|
563
|
+
draftId: y._id
|
|
563
564
|
}), [];
|
|
564
|
-
const
|
|
565
|
-
return ((
|
|
566
|
-
id:
|
|
567
|
-
balance:
|
|
568
|
-
costs:
|
|
565
|
+
const ae = await u.readAdjustmentById(z);
|
|
566
|
+
return ((ae == null ? void 0 : ae.skus) ?? []).map((ne) => ({
|
|
567
|
+
id: ne.sku._id,
|
|
568
|
+
balance: ne.fromBalance,
|
|
569
|
+
costs: ne.fromCostBalances
|
|
569
570
|
}));
|
|
570
571
|
} else
|
|
571
|
-
return await
|
|
572
|
+
return await h.readStockBalance(), ((F = h.stockBalance) == null ? void 0 : F.skus) ?? [];
|
|
572
573
|
}
|
|
573
|
-
async function x(
|
|
574
|
+
async function x(y, m, F) {
|
|
574
575
|
m || (e.open({
|
|
575
576
|
title: "Exporting",
|
|
576
577
|
message: "Fetching data..."
|
|
577
|
-
}), m = await I(
|
|
578
|
+
}), m = await I(y)), _a(y, m, F ?? []);
|
|
578
579
|
}
|
|
579
|
-
function M(
|
|
580
|
-
|
|
580
|
+
function M(y, m, F) {
|
|
581
|
+
s.open({
|
|
581
582
|
title: "Approve draft",
|
|
582
583
|
contentComponent: Je,
|
|
583
584
|
contentComponentProps: {
|
|
584
|
-
draft:
|
|
585
|
+
draft: y,
|
|
585
586
|
action: Z.enum.approveDraft,
|
|
586
587
|
onFinished: () => {
|
|
587
|
-
|
|
588
|
+
s.close(), m == null || m();
|
|
588
589
|
},
|
|
589
590
|
onCancel: () => {
|
|
590
|
-
|
|
591
|
+
s.close();
|
|
591
592
|
}
|
|
592
593
|
}
|
|
593
594
|
}).onClose(() => {
|
|
594
|
-
|
|
595
|
+
F == null || F();
|
|
595
596
|
});
|
|
596
597
|
}
|
|
597
|
-
function G(
|
|
598
|
-
|
|
598
|
+
function G(y, m) {
|
|
599
|
+
s.open({
|
|
599
600
|
title: "Reject draft",
|
|
600
601
|
contentComponent: Je,
|
|
601
602
|
contentComponentProps: {
|
|
602
|
-
draft:
|
|
603
|
+
draft: y,
|
|
603
604
|
action: Z.enum.rejectDraft,
|
|
604
605
|
onFinished: () => {
|
|
605
|
-
|
|
606
|
+
s.close(), m == null || m();
|
|
606
607
|
},
|
|
607
|
-
onCancel: () =>
|
|
608
|
+
onCancel: () => s.close()
|
|
608
609
|
}
|
|
609
610
|
});
|
|
610
611
|
}
|
|
611
|
-
function K(
|
|
612
|
-
|
|
612
|
+
function K(y, m) {
|
|
613
|
+
s.open({
|
|
613
614
|
title: "Mark draft as failed",
|
|
614
615
|
contentComponent: Je,
|
|
615
616
|
contentComponentProps: {
|
|
616
|
-
draft:
|
|
617
|
+
draft: y,
|
|
617
618
|
action: Z.enum.markAsFailed,
|
|
618
619
|
onFinished: () => {
|
|
619
|
-
|
|
620
|
+
s.close(), m == null || m();
|
|
620
621
|
},
|
|
621
|
-
onCancel: () =>
|
|
622
|
+
onCancel: () => s.close()
|
|
622
623
|
}
|
|
623
624
|
});
|
|
624
625
|
}
|
|
625
|
-
async function d(
|
|
626
|
-
await
|
|
627
|
-
_id:
|
|
628
|
-
_rev:
|
|
626
|
+
async function d(y, m) {
|
|
627
|
+
await k.sync({
|
|
628
|
+
_id: y._id,
|
|
629
|
+
_rev: y._rev ?? "",
|
|
629
630
|
action: Z.enum.approveDraft,
|
|
630
631
|
data: {
|
|
631
|
-
remark:
|
|
632
|
+
remark: y.remark ?? ""
|
|
632
633
|
}
|
|
633
634
|
}).delayed(500), e.open({
|
|
634
635
|
title: "Success",
|
|
@@ -639,55 +640,55 @@ const ha = { class: "flex flex-col" }, _a = {
|
|
|
639
640
|
function t() {
|
|
640
641
|
r.value = !1;
|
|
641
642
|
}
|
|
642
|
-
async function j(
|
|
643
|
-
await
|
|
643
|
+
async function j(y, m, F) {
|
|
644
|
+
await s.open({
|
|
644
645
|
title: "Refresh balance",
|
|
645
|
-
contentComponent:
|
|
646
|
+
contentComponent: wa,
|
|
646
647
|
contentComponentProps: {
|
|
647
|
-
draft:
|
|
648
|
+
draft: y,
|
|
648
649
|
onFinished: (z) => {
|
|
649
|
-
|
|
650
|
+
s.close(), F == null || F(z);
|
|
650
651
|
},
|
|
651
652
|
onCancel: async () => {
|
|
652
|
-
|
|
653
|
+
s.close(), m == null || m();
|
|
653
654
|
}
|
|
654
655
|
}
|
|
655
656
|
});
|
|
656
657
|
}
|
|
657
|
-
async function D(
|
|
658
|
-
await
|
|
658
|
+
async function D(y) {
|
|
659
|
+
await s.open({
|
|
659
660
|
title: "Invalidate closing draft cache",
|
|
660
661
|
message: "It will invalidate opening and stock movement cache for this draft.",
|
|
661
662
|
primaryActions: { text: "Proceed", close: !0 },
|
|
662
663
|
secondaryActions: { text: "Cancel", close: !0 }
|
|
663
664
|
}).onPrimary(async () => {
|
|
664
|
-
await u.recalculation.scheduleInvalidateClosingDraftCache([
|
|
665
|
+
await u.recalculation.scheduleInvalidateClosingDraftCache([y._id]), e.open({
|
|
665
666
|
title: "Success",
|
|
666
667
|
message: "Invalidate cache requested",
|
|
667
668
|
type: "success"
|
|
668
669
|
});
|
|
669
670
|
});
|
|
670
671
|
}
|
|
671
|
-
async function Q(
|
|
672
|
+
async function Q(y, m) {
|
|
672
673
|
try {
|
|
673
674
|
e.open({
|
|
674
675
|
title: "Cloning",
|
|
675
676
|
message: "Creating a copy of the draft..."
|
|
676
|
-
}), await
|
|
677
|
+
}), await k.cloneDraft(y._id), e.open({
|
|
677
678
|
title: "Success",
|
|
678
679
|
message: "Draft cloned successfully",
|
|
679
680
|
type: "success"
|
|
680
681
|
}), m == null || m();
|
|
681
|
-
} catch (
|
|
682
|
+
} catch (F) {
|
|
682
683
|
e.open({
|
|
683
684
|
title: "Error",
|
|
684
|
-
message: (
|
|
685
|
+
message: (F == null ? void 0 : F.message) || "Failed to clone draft",
|
|
685
686
|
type: "error"
|
|
686
687
|
});
|
|
687
688
|
}
|
|
688
689
|
}
|
|
689
690
|
return {
|
|
690
|
-
viewDraft:
|
|
691
|
+
viewDraft: V,
|
|
691
692
|
closeDraftDialog: t,
|
|
692
693
|
approveDraft: M,
|
|
693
694
|
rejectDraft: G,
|
|
@@ -697,12 +698,12 @@ const ha = { class: "flex flex-col" }, _a = {
|
|
|
697
698
|
refreshBalance: j,
|
|
698
699
|
cloneDraft: Q,
|
|
699
700
|
viewClosingDraftShow: r,
|
|
700
|
-
viewClosingDraftProps:
|
|
701
|
+
viewClosingDraftProps: L,
|
|
701
702
|
invalidateDraftCache: D
|
|
702
703
|
};
|
|
703
704
|
}
|
|
704
705
|
);
|
|
705
|
-
function
|
|
706
|
+
function Ke(c) {
|
|
706
707
|
switch (c) {
|
|
707
708
|
case "DRAFT":
|
|
708
709
|
return "fm-status-badge-draft";
|
|
@@ -714,53 +715,53 @@ function Oe(c) {
|
|
|
714
715
|
return "fm-status-badge-complete";
|
|
715
716
|
}
|
|
716
717
|
}
|
|
717
|
-
const
|
|
718
|
+
const Sa = St(
|
|
718
719
|
"closingDraftTable",
|
|
719
720
|
function() {
|
|
720
|
-
const { t:
|
|
721
|
-
async function
|
|
722
|
-
if (
|
|
723
|
-
|
|
721
|
+
const { t: s } = tt(), e = Dt(), u = qe(), k = Y(new Array()), h = Y(!1), r = Ge(), L = Qe();
|
|
722
|
+
async function V() {
|
|
723
|
+
if (k.value = [], !!r._currentLocation) {
|
|
724
|
+
h.value = !0;
|
|
724
725
|
try {
|
|
725
|
-
const [d] = await Promise.all([
|
|
726
|
-
|
|
726
|
+
const [d] = await Promise.all([L.readDrafts()]).delayed(1e3);
|
|
727
|
+
k.value = d.reverse();
|
|
727
728
|
} catch (d) {
|
|
728
729
|
console.log("Something went wrong when fetching drafts:", d);
|
|
729
730
|
} finally {
|
|
730
|
-
|
|
731
|
+
h.value = !1;
|
|
731
732
|
}
|
|
732
733
|
}
|
|
733
734
|
}
|
|
734
735
|
async function I(d) {
|
|
735
|
-
if (!
|
|
736
|
-
|
|
736
|
+
if (!k.value.find((t) => t._id) && r._currentLocation) {
|
|
737
|
+
h.value = !0;
|
|
737
738
|
try {
|
|
738
739
|
const [t] = await Promise.all([
|
|
739
|
-
|
|
740
|
+
L.getDraft(d),
|
|
740
741
|
new Promise((j) => setTimeout(j, 1e3))
|
|
741
742
|
]);
|
|
742
|
-
|
|
743
|
+
k.value = [t];
|
|
743
744
|
} catch (t) {
|
|
744
745
|
console.log("Something went wrong when fetching drafts:", t);
|
|
745
746
|
} finally {
|
|
746
|
-
|
|
747
|
+
h.value = !1;
|
|
747
748
|
}
|
|
748
749
|
}
|
|
749
750
|
}
|
|
750
751
|
function x(d) {
|
|
751
|
-
|
|
752
|
+
k.value = k.value.map((t) => t._id === d._id ? {
|
|
752
753
|
...d,
|
|
753
754
|
_rev: t._rev
|
|
754
755
|
} : t);
|
|
755
756
|
}
|
|
756
757
|
function M() {
|
|
757
|
-
u.closeDraftDialog(),
|
|
758
|
+
u.closeDraftDialog(), V();
|
|
758
759
|
}
|
|
759
760
|
function G(d, t) {
|
|
760
|
-
switch (t =
|
|
761
|
-
case
|
|
761
|
+
switch (t = Qt(t), d) {
|
|
762
|
+
case Te.Details:
|
|
762
763
|
return u.viewDraft(t);
|
|
763
|
-
case
|
|
764
|
+
case Te.Export:
|
|
764
765
|
return u.exportDraft(t);
|
|
765
766
|
case Z.enum.approveDraft:
|
|
766
767
|
return u.approveDraft(t, M);
|
|
@@ -768,7 +769,7 @@ const Da = At(
|
|
|
768
769
|
return u.rejectDraft(t, M);
|
|
769
770
|
case Z.enum.markAsFailed:
|
|
770
771
|
return u.markAsFailed(t, M);
|
|
771
|
-
case
|
|
772
|
+
case Te.Duplicate:
|
|
772
773
|
return u.cloneDraft(t, M);
|
|
773
774
|
}
|
|
774
775
|
}
|
|
@@ -777,9 +778,9 @@ const Da = At(
|
|
|
777
778
|
{
|
|
778
779
|
id: "_id",
|
|
779
780
|
accessorKey: "_id",
|
|
780
|
-
header: () =>
|
|
781
|
+
header: () => s("inventory.closing.table.createdAt"),
|
|
781
782
|
cell(d) {
|
|
782
|
-
return
|
|
783
|
+
return oa(`${d.getValue()}`);
|
|
783
784
|
},
|
|
784
785
|
enableSorting: !0
|
|
785
786
|
},
|
|
@@ -789,14 +790,14 @@ const Da = At(
|
|
|
789
790
|
cell(d) {
|
|
790
791
|
const t = d.row.original;
|
|
791
792
|
let j = d.getValue();
|
|
792
|
-
return j || (j =
|
|
793
|
+
return j || (j = Oe(t._id)), De(j);
|
|
793
794
|
},
|
|
794
795
|
enableSorting: !0,
|
|
795
796
|
size: 200
|
|
796
797
|
},
|
|
797
798
|
{
|
|
798
799
|
id: "updatedAt",
|
|
799
|
-
accessorFn: (d) =>
|
|
800
|
+
accessorFn: (d) => De(d.updatedAt),
|
|
800
801
|
header: () => "Updated at",
|
|
801
802
|
enableSorting: !0,
|
|
802
803
|
size: 200
|
|
@@ -814,7 +815,7 @@ const Da = At(
|
|
|
814
815
|
var t;
|
|
815
816
|
return d.items.length + (((t = d.negativeStockItems) == null ? void 0 : t.length) ?? 0);
|
|
816
817
|
},
|
|
817
|
-
header: () =>
|
|
818
|
+
header: () => s("inventory.closing.table.noOfItems"),
|
|
818
819
|
enableSorting: !1,
|
|
819
820
|
meta: {
|
|
820
821
|
width: "10rem",
|
|
@@ -832,44 +833,44 @@ const Da = At(
|
|
|
832
833
|
{
|
|
833
834
|
id: "status",
|
|
834
835
|
accessorFn: (d) => d.status,
|
|
835
|
-
header: () =>
|
|
836
|
+
header: () => s("inventory.closing.table.status"),
|
|
836
837
|
enableSorting: !1,
|
|
837
838
|
cell(d) {
|
|
838
839
|
var m;
|
|
839
|
-
const t = d.row.original, j = t.status, D = new Date(t.updatedAt), Q = (m = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : m.computeFirst((
|
|
840
|
-
return j === "DRAFT" &&
|
|
840
|
+
const t = d.row.original, j = t.status, D = new Date(t.updatedAt), Q = (m = t == null ? void 0 : t.rejectionHistory) == null ? void 0 : m.computeFirst((F) => F.rejectedAt), y = Q ? new Date(Q) : null;
|
|
841
|
+
return j === "DRAFT" && y ? y.getTime() > D.getTime() ? S(
|
|
841
842
|
"div",
|
|
842
843
|
{
|
|
843
844
|
class: "flex"
|
|
844
845
|
},
|
|
845
|
-
|
|
846
|
+
S(
|
|
846
847
|
"div",
|
|
847
848
|
{
|
|
848
|
-
class: ["fm-status-badge",
|
|
849
|
+
class: ["fm-status-badge", Ke("FAILED")]
|
|
849
850
|
},
|
|
850
851
|
"Rejected"
|
|
851
852
|
)
|
|
852
|
-
) :
|
|
853
|
+
) : S(
|
|
853
854
|
"div",
|
|
854
855
|
{
|
|
855
856
|
class: "flex"
|
|
856
857
|
},
|
|
857
|
-
|
|
858
|
+
S(
|
|
858
859
|
"div",
|
|
859
860
|
{
|
|
860
|
-
class: ["fm-status-badge",
|
|
861
|
+
class: ["fm-status-badge", Ke("PROCESSING")]
|
|
861
862
|
},
|
|
862
863
|
"Updated"
|
|
863
864
|
)
|
|
864
|
-
) :
|
|
865
|
+
) : S(
|
|
865
866
|
"div",
|
|
866
867
|
{
|
|
867
868
|
class: "flex"
|
|
868
869
|
},
|
|
869
|
-
|
|
870
|
+
S(
|
|
870
871
|
"div",
|
|
871
872
|
{
|
|
872
|
-
class: ["fm-status-badge",
|
|
873
|
+
class: ["fm-status-badge", Ke(j)]
|
|
873
874
|
},
|
|
874
875
|
Ue(j)
|
|
875
876
|
)
|
|
@@ -881,8 +882,8 @@ const Da = At(
|
|
|
881
882
|
cell(d) {
|
|
882
883
|
var m;
|
|
883
884
|
const t = d.row.original, j = ((m = e.sessionUser.value) == null ? void 0 : m.role.isAdmin) ?? !1, D = [
|
|
884
|
-
|
|
885
|
-
|
|
885
|
+
ht[Te.Details],
|
|
886
|
+
ht[Te.Export]
|
|
886
887
|
], Q = [
|
|
887
888
|
{
|
|
888
889
|
translationKey: "inventory.closing.draft.approveDraft",
|
|
@@ -899,20 +900,20 @@ const Da = At(
|
|
|
899
900
|
color: "text-fm-color-typo-error",
|
|
900
901
|
value: Z.enum.markAsFailed
|
|
901
902
|
}
|
|
902
|
-
],
|
|
903
|
+
], y = j && t.status !== _e.enum.DRAFT ? [
|
|
903
904
|
{
|
|
904
905
|
translationKey: "inventory.closing.draft.cloneDraft",
|
|
905
906
|
color: "text-fm-color-typo-primary",
|
|
906
|
-
value:
|
|
907
|
+
value: Te.Duplicate
|
|
907
908
|
}
|
|
908
909
|
] : [];
|
|
909
|
-
return
|
|
910
|
+
return na(
|
|
910
911
|
[
|
|
911
912
|
...D,
|
|
912
913
|
...t.status === _e.enum.DRAFT ? Q : []
|
|
913
914
|
],
|
|
914
|
-
(
|
|
915
|
-
|
|
915
|
+
(F) => G(F, t),
|
|
916
|
+
y
|
|
916
917
|
);
|
|
917
918
|
},
|
|
918
919
|
enableSorting: !1,
|
|
@@ -923,26 +924,26 @@ const Da = At(
|
|
|
923
924
|
}
|
|
924
925
|
}
|
|
925
926
|
],
|
|
926
|
-
drafts:
|
|
927
|
-
loading:
|
|
928
|
-
fetchDrafts:
|
|
927
|
+
drafts: k,
|
|
928
|
+
loading: h,
|
|
929
|
+
fetchDrafts: V,
|
|
929
930
|
loadDraft: I,
|
|
930
931
|
updateDraftRef: x
|
|
931
932
|
};
|
|
932
933
|
}
|
|
933
|
-
),
|
|
934
|
+
), Ca = { class: "fm-typo-en-heading-lg-600" }, $a = { class: "py-4" }, Fa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ba = { key: 0 }, Ta = { class: "mt-4 flex gap-4" }, ja = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, Ia = { key: 0 }, Pa = {
|
|
934
935
|
key: 0,
|
|
935
936
|
class: "mb-4"
|
|
936
|
-
},
|
|
937
|
+
}, Ua = { class: "flex flex-col gap-1 max-h-200 overflow-auto w-full" }, Ra = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Va = {
|
|
937
938
|
key: 0,
|
|
938
939
|
class: "text-fm-color-system-success-300 mr-1"
|
|
939
|
-
},
|
|
940
|
+
}, Ma = {
|
|
940
941
|
key: 1,
|
|
941
942
|
class: "text-fm-color-system-error-300 mr-1"
|
|
942
|
-
},
|
|
943
|
+
}, Na = { class: "fm-typo-en-body-md-400" }, La = { class: "mt-4 flex gap-4" }, Ea = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-4" }, za = {
|
|
943
944
|
key: 0,
|
|
944
945
|
class: "flex gap-4"
|
|
945
|
-
},
|
|
946
|
+
}, Ha = /* @__PURE__ */ Ve({
|
|
946
947
|
__name: "ClosingDraftApprovalDialog",
|
|
947
948
|
props: {
|
|
948
949
|
show: { type: Boolean },
|
|
@@ -951,207 +952,207 @@ const Da = At(
|
|
|
951
952
|
draft: {}
|
|
952
953
|
},
|
|
953
954
|
emits: ["update:show", "refresh", "approve"],
|
|
954
|
-
setup(c, { emit:
|
|
955
|
-
const { FmStepper: e, FmStep: u, FmDialog:
|
|
955
|
+
setup(c, { emit: s }) {
|
|
956
|
+
const { FmStepper: e, FmStep: u, FmDialog: k, FmButton: h } = ke, { t: r } = la(), L = wt(), V = c, I = s, x = U(
|
|
956
957
|
() => {
|
|
957
|
-
var
|
|
958
|
-
return ((
|
|
958
|
+
var $, w;
|
|
959
|
+
return (($ = V.draft) == null ? void 0 : $.stockSnapshot) && ((w = V.draft) == null ? void 0 : w.stockSnapshot) !== void 0;
|
|
959
960
|
}
|
|
960
|
-
), M =
|
|
961
|
-
var
|
|
962
|
-
const
|
|
961
|
+
), M = U(() => {
|
|
962
|
+
var g, P, J;
|
|
963
|
+
const $ = ((g = V.draft) == null ? void 0 : g.items.map((ee) => ({
|
|
963
964
|
id: ee.sku._id,
|
|
964
965
|
code: ee.sku.code,
|
|
965
966
|
name: ee.sku.name
|
|
966
|
-
}))) ?? [], w = ((J = (
|
|
967
|
+
}))) ?? [], w = ((J = (P = V.draft) == null ? void 0 : P.negativeStockItems) == null ? void 0 : J.map((ee) => ({
|
|
967
968
|
id: ee.sku._id,
|
|
968
969
|
code: ee.sku.code,
|
|
969
970
|
name: ee.sku.name
|
|
970
971
|
}))) ?? [];
|
|
971
|
-
return [
|
|
972
|
+
return [...$, ...w].reduce(
|
|
972
973
|
(ee, X) => (ee[X.id] = X, ee),
|
|
973
974
|
{}
|
|
974
975
|
);
|
|
975
|
-
}), G =
|
|
976
|
+
}), G = U(
|
|
976
977
|
() => {
|
|
977
|
-
var
|
|
978
|
-
return (((
|
|
979
|
-
const J =
|
|
978
|
+
var $, w, g;
|
|
979
|
+
return (((g = (w = ($ = V.draft) == null ? void 0 : $.stockSnapshot) == null ? void 0 : w.filter((P) => P.balance.amount < 0)) == null ? void 0 : g.map((P) => {
|
|
980
|
+
const J = L.skuById[P.id];
|
|
980
981
|
return J ? {
|
|
981
982
|
id: J._id,
|
|
982
983
|
code: J.code,
|
|
983
984
|
name: J.name
|
|
984
985
|
} : null;
|
|
985
|
-
})) ?? []).filter((
|
|
986
|
+
})) ?? []).filter((P) => P !== null);
|
|
986
987
|
}
|
|
987
|
-
), K =
|
|
988
|
-
var
|
|
989
|
-
return x.value ? ((
|
|
990
|
-
}), d =
|
|
991
|
-
get: () =>
|
|
992
|
-
set: (
|
|
988
|
+
), K = U(() => {
|
|
989
|
+
var $;
|
|
990
|
+
return x.value ? (($ = G.value) == null ? void 0 : $.filter((w) => !M.value[w.id]).map((w) => w.id)) ?? [] : [];
|
|
991
|
+
}), d = U({
|
|
992
|
+
get: () => V.show,
|
|
993
|
+
set: ($) => I("update:show", $)
|
|
993
994
|
}), t = Y(1), j = () => t.value > 1, D = () => t.value > 2, Q = () => !1;
|
|
994
|
-
function
|
|
995
|
-
return
|
|
995
|
+
function y($) {
|
|
996
|
+
return $ === 1 ? x.value : $ === 2 ? K.value.length == 0 : !1;
|
|
996
997
|
}
|
|
997
|
-
const m =
|
|
998
|
-
function $
|
|
999
|
-
let w =
|
|
1000
|
-
for (; w <= 3 &&
|
|
998
|
+
const m = U(() => !x.value || K.value.length > 0);
|
|
999
|
+
function F($) {
|
|
1000
|
+
let w = $ + 1;
|
|
1001
|
+
for (; w <= 3 && y(w); ) w++;
|
|
1001
1002
|
return w > 3 ? 3 : w;
|
|
1002
1003
|
}
|
|
1003
|
-
function z(
|
|
1004
|
-
let w =
|
|
1005
|
-
for (; w >= 1 &&
|
|
1004
|
+
function z($) {
|
|
1005
|
+
let w = $ - 1;
|
|
1006
|
+
for (; w >= 1 && y(w); ) w--;
|
|
1006
1007
|
return w < 1 ? 1 : w;
|
|
1007
1008
|
}
|
|
1008
|
-
function
|
|
1009
|
+
function ae() {
|
|
1009
1010
|
return x.value ? m.value ? 3 : 2 : 1;
|
|
1010
1011
|
}
|
|
1011
|
-
|
|
1012
|
-
() =>
|
|
1013
|
-
(
|
|
1014
|
-
|
|
1012
|
+
He(
|
|
1013
|
+
() => V.show,
|
|
1014
|
+
($) => {
|
|
1015
|
+
$ && (t.value = ae());
|
|
1015
1016
|
}
|
|
1016
|
-
),
|
|
1017
|
+
), He(
|
|
1017
1018
|
() => x.value,
|
|
1018
|
-
(
|
|
1019
|
-
|
|
1019
|
+
($) => {
|
|
1020
|
+
$ && t.value === 1 && (t.value = F(1));
|
|
1020
1021
|
}
|
|
1021
|
-
),
|
|
1022
|
+
), He(
|
|
1022
1023
|
() => K.value.length,
|
|
1023
|
-
(
|
|
1024
|
-
|
|
1024
|
+
($) => {
|
|
1025
|
+
$ === 0 && t.value === 2 && (t.value = F(2));
|
|
1025
1026
|
}
|
|
1026
1027
|
);
|
|
1027
|
-
function
|
|
1028
|
+
function de() {
|
|
1028
1029
|
I("refresh");
|
|
1029
1030
|
}
|
|
1030
|
-
function
|
|
1031
|
-
t.value < 3 && (t.value =
|
|
1031
|
+
function ne() {
|
|
1032
|
+
t.value < 3 && (t.value = F(t.value));
|
|
1032
1033
|
}
|
|
1033
|
-
function
|
|
1034
|
+
function le() {
|
|
1034
1035
|
t.value > 1 && (t.value = z(t.value));
|
|
1035
1036
|
}
|
|
1036
|
-
function
|
|
1037
|
+
function me() {
|
|
1037
1038
|
I("approve");
|
|
1038
1039
|
}
|
|
1039
|
-
return (
|
|
1040
|
-
const
|
|
1041
|
-
return A(),
|
|
1040
|
+
return ($, w) => {
|
|
1041
|
+
const g = O("FmIcon");
|
|
1042
|
+
return A(), pe(v(k), {
|
|
1042
1043
|
modelValue: d.value,
|
|
1043
|
-
"onUpdate:modelValue": w[1] || (w[1] = (
|
|
1044
|
+
"onUpdate:modelValue": w[1] || (w[1] = (P) => d.value = P),
|
|
1044
1045
|
"max-width": 600
|
|
1045
1046
|
}, {
|
|
1046
1047
|
"dialog-header": q(() => [
|
|
1047
|
-
n("div",
|
|
1048
|
+
n("div", Ca, W(v(r)("inventory.closing.approval.title")), 1)
|
|
1048
1049
|
]),
|
|
1049
1050
|
default: q(() => [
|
|
1050
|
-
n("div",
|
|
1051
|
-
|
|
1051
|
+
n("div", $a, [
|
|
1052
|
+
_(v(e), {
|
|
1052
1053
|
modelValue: t.value,
|
|
1053
|
-
"onUpdate:modelValue": w[0] || (w[0] = (
|
|
1054
|
+
"onUpdate:modelValue": w[0] || (w[0] = (P) => t.value = P),
|
|
1054
1055
|
orientation: "vertical"
|
|
1055
1056
|
}, {
|
|
1056
1057
|
default: q(() => [
|
|
1057
|
-
|
|
1058
|
+
_(v(u), {
|
|
1058
1059
|
value: 1,
|
|
1059
1060
|
title: v(r)("inventory.closing.approval.step.generateReport.title"),
|
|
1060
1061
|
complete: j
|
|
1061
1062
|
}, {
|
|
1062
1063
|
default: q(() => [
|
|
1063
|
-
n("div",
|
|
1064
|
-
t.value === 1 ? (A(),
|
|
1065
|
-
|
|
1064
|
+
n("div", Fa, W(v(r)("inventory.closing.approval.step.generateReport.description")), 1),
|
|
1065
|
+
t.value === 1 ? (A(), R("div", Ba, [
|
|
1066
|
+
_(v(h), {
|
|
1066
1067
|
label: v(r)("inventory.stock.stock_balance.refreshBalance"),
|
|
1067
1068
|
"prepend-icon": "refresh",
|
|
1068
1069
|
variant: "secondary",
|
|
1069
|
-
loading:
|
|
1070
|
-
onClick:
|
|
1070
|
+
loading: $.refreshing,
|
|
1071
|
+
onClick: de
|
|
1071
1072
|
}, null, 8, ["label", "loading"]),
|
|
1072
|
-
n("div",
|
|
1073
|
-
|
|
1073
|
+
n("div", Ta, [
|
|
1074
|
+
_(v(h), {
|
|
1074
1075
|
label: v(r)("inventory.common.continue"),
|
|
1075
1076
|
disabled: !x.value,
|
|
1076
|
-
onClick:
|
|
1077
|
+
onClick: ne
|
|
1077
1078
|
}, null, 8, ["label", "disabled"])
|
|
1078
1079
|
])
|
|
1079
|
-
])) :
|
|
1080
|
+
])) : se("", !0)
|
|
1080
1081
|
]),
|
|
1081
1082
|
_: 1
|
|
1082
1083
|
}, 8, ["title"]),
|
|
1083
|
-
|
|
1084
|
+
_(v(u), {
|
|
1084
1085
|
value: 2,
|
|
1085
1086
|
title: v(r)("inventory.closing.approval.step.negativeItems.title"),
|
|
1086
1087
|
disabled: () => !x.value,
|
|
1087
1088
|
complete: D
|
|
1088
1089
|
}, {
|
|
1089
1090
|
default: q(() => [
|
|
1090
|
-
n("div",
|
|
1091
|
-
t.value === 2 ? (A(),
|
|
1092
|
-
G.value.length > 0 ? (A(),
|
|
1091
|
+
n("div", ja, W(G.value.length > 0 ? `${v(r)("inventory.closing.approval.step.negativeItems.resolveMessage")} [${v(r)("inventory.closing.approval.step.negativeItems.itemsHeader")} (${K.value.length})]` : v(r)("inventory.closing.approval.step.negativeItems.noItemsMessage")), 1),
|
|
1092
|
+
t.value === 2 ? (A(), R("div", Ia, [
|
|
1093
|
+
G.value.length > 0 ? (A(), R("div", Pa, [
|
|
1093
1094
|
w[2] || (w[2] = n("div", { class: "fm-typo-en-body-md-600 mb-2" }, null, -1)),
|
|
1094
|
-
n("div",
|
|
1095
|
-
(A(!0),
|
|
1096
|
-
key:
|
|
1095
|
+
n("div", Ua, [
|
|
1096
|
+
(A(!0), R(ce, null, je(G.value, (P) => (A(), R("div", {
|
|
1097
|
+
key: P.id,
|
|
1097
1098
|
class: "flex gap-8"
|
|
1098
1099
|
}, [
|
|
1099
|
-
n("div",
|
|
1100
|
-
M.value[
|
|
1101
|
-
|
|
1100
|
+
n("div", Ra, [
|
|
1101
|
+
M.value[P.id] ? (A(), R("span", Va, [
|
|
1102
|
+
_(g, {
|
|
1102
1103
|
name: "check_circle",
|
|
1103
1104
|
size: "sm"
|
|
1104
1105
|
})
|
|
1105
|
-
])) : (A(),
|
|
1106
|
-
|
|
1106
|
+
])) : (A(), R("span", Ma, [
|
|
1107
|
+
_(g, {
|
|
1107
1108
|
name: "error",
|
|
1108
1109
|
size: "sm"
|
|
1109
1110
|
})
|
|
1110
1111
|
])),
|
|
1111
|
-
|
|
1112
|
+
ue(" " + W(P.code), 1)
|
|
1112
1113
|
]),
|
|
1113
|
-
n("div",
|
|
1114
|
+
n("div", Na, W(P.name), 1)
|
|
1114
1115
|
]))), 128))
|
|
1115
1116
|
])
|
|
1116
|
-
])) :
|
|
1117
|
-
n("div",
|
|
1118
|
-
|
|
1117
|
+
])) : se("", !0),
|
|
1118
|
+
n("div", La, [
|
|
1119
|
+
_(v(h), {
|
|
1119
1120
|
label: v(r)("inventory.common.back"),
|
|
1120
1121
|
variant: "secondary",
|
|
1121
|
-
onClick:
|
|
1122
|
+
onClick: le
|
|
1122
1123
|
}, null, 8, ["label"]),
|
|
1123
|
-
|
|
1124
|
+
_(v(h), {
|
|
1124
1125
|
label: v(r)("inventory.common.continue"),
|
|
1125
1126
|
disabled: m.value,
|
|
1126
|
-
onClick:
|
|
1127
|
+
onClick: ne
|
|
1127
1128
|
}, null, 8, ["label", "disabled"])
|
|
1128
1129
|
])
|
|
1129
|
-
])) :
|
|
1130
|
+
])) : se("", !0)
|
|
1130
1131
|
]),
|
|
1131
1132
|
_: 1
|
|
1132
1133
|
}, 8, ["title", "disabled"]),
|
|
1133
|
-
|
|
1134
|
+
_(v(u), {
|
|
1134
1135
|
value: 3,
|
|
1135
1136
|
title: v(r)("inventory.closing.approval.step.approval.title"),
|
|
1136
1137
|
disabled: () => m.value,
|
|
1137
1138
|
complete: Q
|
|
1138
1139
|
}, {
|
|
1139
1140
|
default: q(() => [
|
|
1140
|
-
n("div",
|
|
1141
|
-
t.value === 3 ? (A(),
|
|
1142
|
-
|
|
1141
|
+
n("div", Ea, W(v(r)("inventory.closing.approval.step.approval.warning")), 1),
|
|
1142
|
+
t.value === 3 ? (A(), R("div", za, [
|
|
1143
|
+
_(v(h), {
|
|
1143
1144
|
label: v(r)("inventory.common.back"),
|
|
1144
1145
|
variant: "secondary",
|
|
1145
|
-
onClick:
|
|
1146
|
+
onClick: le
|
|
1146
1147
|
}, null, 8, ["label"]),
|
|
1147
|
-
|
|
1148
|
+
_(v(h), {
|
|
1148
1149
|
label: v(r)("inventory.common.approve"),
|
|
1149
1150
|
variant: "destructive",
|
|
1150
1151
|
disabled: m.value,
|
|
1151
|
-
loading:
|
|
1152
|
-
onClick:
|
|
1152
|
+
loading: $.approving,
|
|
1153
|
+
onClick: me
|
|
1153
1154
|
}, null, 8, ["label", "disabled", "loading"])
|
|
1154
|
-
])) :
|
|
1155
|
+
])) : se("", !0)
|
|
1155
1156
|
]),
|
|
1156
1157
|
_: 1
|
|
1157
1158
|
}, 8, ["title", "disabled"])
|
|
@@ -1164,89 +1165,89 @@ const Da = At(
|
|
|
1164
1165
|
}, 8, ["modelValue"]);
|
|
1165
1166
|
};
|
|
1166
1167
|
}
|
|
1167
|
-
}),
|
|
1168
|
+
}), Oa = { class: "w-full flex flex-col gap-32" }, Ka = { class: "flex justify-between" }, Ya = { class: "flex" }, qa = { class: "grid grid-cols-[repeat(4,1fr)] xs:flex xs:flex-col sm:flex sm:flex-col gap-8" }, Ga = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qa = { class: "flex gap-1" }, Wa = { class: "fm-typo-en-body-lg-600" }, Za = { class: "flex flex-col gap-16" }, Ja = { class: "flex items-center" }, Xa = {
|
|
1168
1169
|
key: 0,
|
|
1169
1170
|
class: "flex gap-8"
|
|
1170
|
-
},
|
|
1171
|
+
}, en = {
|
|
1171
1172
|
key: 0,
|
|
1172
1173
|
class: "w-full flex flex-col items-center"
|
|
1173
|
-
},
|
|
1174
|
+
}, tn = { class: "flex items-center gap-8" }, an = { class: "flex flex-col gap-8" }, nn = { class: "flex gap-8" }, on = {
|
|
1174
1175
|
key: 0,
|
|
1175
1176
|
class: "flex gap-8"
|
|
1176
|
-
},
|
|
1177
|
+
}, sn = { class: "overflow-x-auto" }, rn = {
|
|
1177
1178
|
key: 1,
|
|
1178
1179
|
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1179
|
-
},
|
|
1180
|
+
}, ln = {
|
|
1180
1181
|
key: 0,
|
|
1181
1182
|
class: "flex flex-col items-center gap-8 h-full"
|
|
1182
|
-
},
|
|
1183
|
+
}, cn = ["src"], un = {
|
|
1183
1184
|
key: 1,
|
|
1184
1185
|
class: "px-4 flex flex-col"
|
|
1185
|
-
},
|
|
1186
|
+
}, dn = { class: "flex gap-12 content-stretch" }, mn = {
|
|
1186
1187
|
class: "flex flex-col w-24",
|
|
1187
1188
|
name: "circles"
|
|
1188
|
-
},
|
|
1189
|
+
}, fn = { class: "flex-1 flex flex-col items-center" }, pn = { class: "flex-1 flex flex-col items-center" }, vn = {
|
|
1189
1190
|
class: "py-12 flex flex-col gap-4",
|
|
1190
1191
|
name: "received-at header"
|
|
1191
|
-
},
|
|
1192
|
+
}, yn = { class: "fm-typo-en-body-lg-400" }, gn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, bn = { class: "flex gap-12 content-stretch" }, hn = {
|
|
1192
1193
|
class: "flex flex-col w-24",
|
|
1193
1194
|
name: "circles"
|
|
1194
|
-
},
|
|
1195
|
+
}, kn = { class: "flex-1 flex flex-col items-center" }, _n = {
|
|
1195
1196
|
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1196
1197
|
name: "delivery details"
|
|
1197
|
-
},
|
|
1198
|
+
}, xn = { class: "flex flex-col gap-8" }, Dn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, An = { class: "flex flex-col gap-4" }, wn = { class: "flex items-center justify-between gap-8 w-full" }, Sn = { class: "flex items-center gap-8" }, Cn = { class: "flex flex-col items-end" }, $n = { class: "text-2xl font-semibold" }, kt = "N/A", Fn = /* @__PURE__ */ Ve({
|
|
1198
1199
|
__name: "ClosingDraftDialog",
|
|
1199
1200
|
props: {
|
|
1200
1201
|
show: { type: Boolean },
|
|
1201
1202
|
draft: {}
|
|
1202
1203
|
},
|
|
1203
1204
|
emits: ["submitted", "refresh"],
|
|
1204
|
-
setup(c, { emit:
|
|
1205
|
-
|
|
1206
|
-
const e = c, u =
|
|
1207
|
-
const
|
|
1208
|
-
return
|
|
1205
|
+
setup(c, { emit: s }) {
|
|
1206
|
+
tt();
|
|
1207
|
+
const e = c, u = U(() => {
|
|
1208
|
+
const l = At();
|
|
1209
|
+
return l === "MYR" ? "RM" : l;
|
|
1209
1210
|
});
|
|
1210
|
-
|
|
1211
|
-
const
|
|
1212
|
-
t.skus.filter((
|
|
1211
|
+
jt();
|
|
1212
|
+
const k = qe(), h = Yt(e, "show"), r = Y(!1), L = Y(!1), V = Y(!1), I = Y(new Array()), x = Y(new Array()), M = Y([]), G = ot(), K = Qe(), d = at(), t = wt(), j = Ge(), D = Lt({}), Q = U(() => new Set(
|
|
1213
|
+
t.skus.filter((l) => {
|
|
1213
1214
|
var a;
|
|
1214
|
-
return D[(a =
|
|
1215
|
-
}).map((
|
|
1216
|
-
)),
|
|
1215
|
+
return D[(a = l.customAttributes) == null ? void 0 : a.tag];
|
|
1216
|
+
}).map((l) => l._id)
|
|
1217
|
+
)), y = s, m = Y({
|
|
1217
1218
|
templateItem: !0,
|
|
1218
1219
|
nonTemplateItem: !0
|
|
1219
|
-
}),
|
|
1220
|
+
}), F = U(() => {
|
|
1220
1221
|
var a, p;
|
|
1221
|
-
const
|
|
1222
|
-
return Q.value.size ?
|
|
1223
|
-
}), z =
|
|
1224
|
-
const
|
|
1225
|
-
return
|
|
1226
|
-
}),
|
|
1222
|
+
const l = [...((a = e.draft) == null ? void 0 : a.items) ?? [], ...((p = e.draft) == null ? void 0 : p.negativeStockItems) ?? []];
|
|
1223
|
+
return Q.value.size ? l.filter((o) => Q.value.has(o.sku._id)) : l;
|
|
1224
|
+
}), z = U(() => {
|
|
1225
|
+
const l = F.value.map((a) => a.sku);
|
|
1226
|
+
return l.sort((a, p) => a.code.localeCompare(p.code)), l;
|
|
1227
|
+
}), ae = U(() => F.value.groupBy(
|
|
1227
1228
|
(a) => a.sku._id,
|
|
1228
1229
|
(a) => a.measurementsAmounts.filter((p) => !p.measurement.abbrev.toLocaleLowerCase().includes("inactive")).map((p) => p.measurement.id)
|
|
1229
1230
|
));
|
|
1230
|
-
|
|
1231
|
+
et(me), He(
|
|
1231
1232
|
() => e.show,
|
|
1232
|
-
(
|
|
1233
|
-
|
|
1233
|
+
(l) => {
|
|
1234
|
+
l && (we.value = $e[0], me(), m.value = {
|
|
1234
1235
|
templateItem: !0,
|
|
1235
1236
|
nonTemplateItem: !0
|
|
1236
1237
|
});
|
|
1237
1238
|
}
|
|
1238
1239
|
);
|
|
1239
|
-
const
|
|
1240
|
-
async function
|
|
1241
|
-
var a, p,
|
|
1240
|
+
const de = U(() => Pe.value.reduce((l, a) => l + Number(a.stockTakeValue), 0)), ne = Re(0), le = Re(100);
|
|
1241
|
+
async function me() {
|
|
1242
|
+
var a, p, o, i;
|
|
1242
1243
|
if (!j._currentLocation) return;
|
|
1243
1244
|
r.value = !0;
|
|
1244
|
-
const
|
|
1245
|
+
const l = ((a = e.draft) == null ? void 0 : a.status) === _e.enum.COMPLETED;
|
|
1245
1246
|
x.value = [];
|
|
1246
1247
|
try {
|
|
1247
|
-
if (await t.init(),
|
|
1248
|
-
const
|
|
1249
|
-
if (!
|
|
1248
|
+
if (await t.init(), l) {
|
|
1249
|
+
const N = e.draft.closingAdjustmentId;
|
|
1250
|
+
if (!N) {
|
|
1250
1251
|
d.open({
|
|
1251
1252
|
title: "Something went wrong",
|
|
1252
1253
|
message: "Closing draft is completed but closing document cannot be found.",
|
|
@@ -1256,31 +1257,31 @@ const Da = At(
|
|
|
1256
1257
|
});
|
|
1257
1258
|
return;
|
|
1258
1259
|
}
|
|
1259
|
-
const E = await G.readAdjustmentById(
|
|
1260
|
-
for (const
|
|
1261
|
-
const
|
|
1262
|
-
id:
|
|
1263
|
-
balance:
|
|
1264
|
-
costs:
|
|
1260
|
+
const E = await G.readAdjustmentById(N), fe = (E == null ? void 0 : E.skus) ?? [];
|
|
1261
|
+
for (const ve of fe) {
|
|
1262
|
+
const Se = {
|
|
1263
|
+
id: ve.sku._id,
|
|
1264
|
+
balance: ve.fromBalance,
|
|
1265
|
+
costs: ve.fromCostBalances
|
|
1265
1266
|
}, T = {
|
|
1266
|
-
id:
|
|
1267
|
-
balance:
|
|
1268
|
-
costs:
|
|
1267
|
+
id: ve.sku._id,
|
|
1268
|
+
balance: ve.toBalance,
|
|
1269
|
+
costs: ve.toCostBalances
|
|
1269
1270
|
};
|
|
1270
|
-
I.value.push(
|
|
1271
|
+
I.value.push(Se), x.value.push(T);
|
|
1271
1272
|
}
|
|
1272
1273
|
} else
|
|
1273
|
-
I.value = ((
|
|
1274
|
+
I.value = ((o = e.draft) == null ? void 0 : o.stockSnapshot) ?? [];
|
|
1274
1275
|
const f = /* @__PURE__ */ new Set();
|
|
1275
|
-
if ((
|
|
1276
|
-
for (const
|
|
1277
|
-
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1280
|
-
f.has(
|
|
1276
|
+
if ((i = e.draft) != null && i.adjustmentSnapshot)
|
|
1277
|
+
for (const N of e.draft.adjustmentSnapshot)
|
|
1278
|
+
N.adjustmentsByType && Object.keys(N.adjustmentsByType).forEach((E) => f.add(E));
|
|
1279
|
+
const b = ["receive", "sales", "wastage"], B = [];
|
|
1280
|
+
b.forEach((N) => {
|
|
1281
|
+
f.has(N) && (B.push(N), f.delete(N));
|
|
1281
1282
|
});
|
|
1282
|
-
const
|
|
1283
|
-
M.value = [...B, ...
|
|
1283
|
+
const C = Array.from(f).sort();
|
|
1284
|
+
M.value = [...B, ...C];
|
|
1284
1285
|
} catch (f) {
|
|
1285
1286
|
d.open({
|
|
1286
1287
|
title: "Something went wrong",
|
|
@@ -1291,9 +1292,9 @@ const Da = At(
|
|
|
1291
1292
|
r.value = !1;
|
|
1292
1293
|
}
|
|
1293
1294
|
}
|
|
1294
|
-
async function
|
|
1295
|
+
async function $() {
|
|
1295
1296
|
var a, p;
|
|
1296
|
-
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ?
|
|
1297
|
+
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Oe((p = e.draft) == null ? void 0 : p._id) : null))) {
|
|
1297
1298
|
d.open({
|
|
1298
1299
|
title: "Cannot refresh",
|
|
1299
1300
|
message: "Effective date is not available for this draft.",
|
|
@@ -1301,20 +1302,20 @@ const Da = At(
|
|
|
1301
1302
|
});
|
|
1302
1303
|
return;
|
|
1303
1304
|
}
|
|
1304
|
-
await
|
|
1305
|
+
await k.refreshBalance(
|
|
1305
1306
|
e.draft,
|
|
1306
1307
|
() => {
|
|
1307
1308
|
},
|
|
1308
|
-
async (
|
|
1309
|
+
async (o) => {
|
|
1309
1310
|
var B;
|
|
1310
|
-
|
|
1311
|
-
const
|
|
1311
|
+
L.value = !0;
|
|
1312
|
+
const i = (B = e.draft) == null ? void 0 : B._rev, f = 30, b = 2e3;
|
|
1312
1313
|
try {
|
|
1313
|
-
await G.recalculation.scheduleCalculateStockSnapshotAtDate(
|
|
1314
|
-
let
|
|
1315
|
-
for (let
|
|
1314
|
+
await G.recalculation.scheduleCalculateStockSnapshotAtDate(o, e.draft._id);
|
|
1315
|
+
let C = null;
|
|
1316
|
+
for (let N = 0; N < f && (C = await K.getDraft(e.draft._id).delayed(b), C._rev === i); N++)
|
|
1316
1317
|
;
|
|
1317
|
-
if (!
|
|
1318
|
+
if (!C || C._rev === i) {
|
|
1318
1319
|
d.open({
|
|
1319
1320
|
title: "Refresh failed",
|
|
1320
1321
|
message: "Failed to refresh stock balance. Please try again.",
|
|
@@ -1322,26 +1323,26 @@ const Da = At(
|
|
|
1322
1323
|
}), console.error("error refreshing stock balances: there is no change in _rev");
|
|
1323
1324
|
return;
|
|
1324
1325
|
}
|
|
1325
|
-
|
|
1326
|
+
y("refresh", C), I.value = C.stockSnapshot ?? [], d.open({
|
|
1326
1327
|
title: "Balance refreshed",
|
|
1327
1328
|
message: "Stock balance has been recalculated.",
|
|
1328
1329
|
type: "success"
|
|
1329
|
-
}),
|
|
1330
|
-
} catch (
|
|
1330
|
+
}), h.value = !1;
|
|
1331
|
+
} catch (C) {
|
|
1331
1332
|
d.open({
|
|
1332
1333
|
title: "Refresh failed",
|
|
1333
1334
|
message: "Failed to refresh stock balance. Please try again.",
|
|
1334
1335
|
type: "error"
|
|
1335
|
-
}), console.error("error refreshing stock balances",
|
|
1336
|
+
}), console.error("error refreshing stock balances", C);
|
|
1336
1337
|
} finally {
|
|
1337
|
-
|
|
1338
|
+
L.value = !1;
|
|
1338
1339
|
}
|
|
1339
1340
|
}
|
|
1340
1341
|
);
|
|
1341
1342
|
}
|
|
1342
1343
|
async function w() {
|
|
1343
1344
|
var a, p;
|
|
1344
|
-
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ?
|
|
1345
|
+
if (!(((a = e.draft) == null ? void 0 : a.effectiveAt) ?? (e.draft ? Oe((p = e.draft) == null ? void 0 : p._id) : null))) {
|
|
1345
1346
|
d.open({
|
|
1346
1347
|
title: "Cannot refresh",
|
|
1347
1348
|
message: "Effective date is not available for this draft.",
|
|
@@ -1349,38 +1350,38 @@ const Da = At(
|
|
|
1349
1350
|
});
|
|
1350
1351
|
return;
|
|
1351
1352
|
}
|
|
1352
|
-
await
|
|
1353
|
+
await k.invalidateDraftCache(e.draft);
|
|
1353
1354
|
}
|
|
1354
|
-
const
|
|
1355
|
+
const g = U(
|
|
1355
1356
|
() => I.value.groupBy(
|
|
1356
|
-
(
|
|
1357
|
-
(
|
|
1357
|
+
(l) => l.id,
|
|
1358
|
+
(l) => l.balance
|
|
1358
1359
|
)
|
|
1359
|
-
),
|
|
1360
|
-
var
|
|
1361
|
-
return (
|
|
1362
|
-
}), ee =
|
|
1363
|
-
var
|
|
1364
|
-
return (
|
|
1360
|
+
), P = U(() => F.value.groupBy((l) => l.sku._id)), J = U(() => {
|
|
1361
|
+
var l;
|
|
1362
|
+
return (l = e.draft) != null && l.adjustmentSnapshot ? new Map(e.draft.adjustmentSnapshot.map((a) => [a.skuId, a.adjustmentsByType])) : /* @__PURE__ */ new Map();
|
|
1363
|
+
}), ee = U(() => {
|
|
1364
|
+
var l;
|
|
1365
|
+
return (l = e.draft) != null && l.opening ? new Map(e.draft.opening.map((a) => [a.skuId, a.balance])) : /* @__PURE__ */ new Map();
|
|
1365
1366
|
});
|
|
1366
|
-
function X(
|
|
1367
|
-
return
|
|
1368
|
-
|
|
1367
|
+
function X(l, a) {
|
|
1368
|
+
return S(
|
|
1369
|
+
ke.FmTooltip,
|
|
1369
1370
|
{ zIndex: 51, placement: "left", class: "w-full flex justify-end" },
|
|
1370
1371
|
{
|
|
1371
1372
|
default() {
|
|
1372
|
-
return
|
|
1373
|
+
return l;
|
|
1373
1374
|
},
|
|
1374
1375
|
content() {
|
|
1375
|
-
return a ||
|
|
1376
|
+
return a || l;
|
|
1376
1377
|
}
|
|
1377
1378
|
}
|
|
1378
1379
|
);
|
|
1379
1380
|
}
|
|
1380
|
-
const
|
|
1381
|
-
const
|
|
1382
|
-
var
|
|
1383
|
-
return Math.max(p, ((f = (
|
|
1381
|
+
const xe = U(() => {
|
|
1382
|
+
const l = z.value.reduce((p, o) => {
|
|
1383
|
+
var i, f;
|
|
1384
|
+
return Math.max(p, ((f = (i = ae.value) == null ? void 0 : i.get(o._id)) == null ? void 0 : f[0].length) ?? 0);
|
|
1384
1385
|
}, 0);
|
|
1385
1386
|
return [
|
|
1386
1387
|
{
|
|
@@ -1389,8 +1390,8 @@ const Da = At(
|
|
|
1389
1390
|
header: () => "Name",
|
|
1390
1391
|
size: 350,
|
|
1391
1392
|
cell(p) {
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1393
|
+
const o = p.row.original, i = o.adjustedDiffPercentage, f = typeof i == "number" && Math.abs(i) > 10, b = S("div", { class: "flex flex-col gap-4" }, [
|
|
1394
|
+
S(
|
|
1394
1395
|
"div",
|
|
1395
1396
|
{
|
|
1396
1397
|
class: [
|
|
@@ -1398,9 +1399,9 @@ const Da = At(
|
|
|
1398
1399
|
f ? " text-fm-color-system-error-300" : "text-fm-color-typo-primary"
|
|
1399
1400
|
]
|
|
1400
1401
|
},
|
|
1401
|
-
|
|
1402
|
+
o.name
|
|
1402
1403
|
),
|
|
1403
|
-
|
|
1404
|
+
S(
|
|
1404
1405
|
"div",
|
|
1405
1406
|
{
|
|
1406
1407
|
class: [
|
|
@@ -1408,21 +1409,21 @@ const Da = At(
|
|
|
1408
1409
|
f ? " text-fm-color-system-error-300" : "text-fm-color-typo-secondary"
|
|
1409
1410
|
]
|
|
1410
1411
|
},
|
|
1411
|
-
|
|
1412
|
+
o.code
|
|
1412
1413
|
)
|
|
1413
1414
|
]);
|
|
1414
|
-
return
|
|
1415
|
-
|
|
1415
|
+
return S(
|
|
1416
|
+
ke.FmTooltip,
|
|
1416
1417
|
{
|
|
1417
1418
|
zIndex: 51
|
|
1418
1419
|
},
|
|
1419
1420
|
{
|
|
1420
1421
|
content() {
|
|
1421
|
-
return f ? "Adjustment difference is more than 10%." : `${
|
|
1422
|
+
return f ? "Adjustment difference is more than 10%." : `${o.code} - ${o.name}`;
|
|
1422
1423
|
},
|
|
1423
1424
|
default() {
|
|
1424
|
-
return
|
|
1425
|
-
|
|
1425
|
+
return S("div", { class: "flex items-center gap-4 justify-start w-full" }, [
|
|
1426
|
+
b
|
|
1426
1427
|
]);
|
|
1427
1428
|
}
|
|
1428
1429
|
}
|
|
@@ -1435,8 +1436,8 @@ const Da = At(
|
|
|
1435
1436
|
header: () => X("Cost per unit"),
|
|
1436
1437
|
size: 160,
|
|
1437
1438
|
cell(p) {
|
|
1438
|
-
const
|
|
1439
|
-
return
|
|
1439
|
+
const o = p.row.original.costPerUnit;
|
|
1440
|
+
return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1440
1441
|
},
|
|
1441
1442
|
meta: {
|
|
1442
1443
|
textAlign: "right"
|
|
@@ -1448,27 +1449,27 @@ const Da = At(
|
|
|
1448
1449
|
size: 120,
|
|
1449
1450
|
cell(p) {
|
|
1450
1451
|
var B;
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1453
|
-
const
|
|
1454
|
-
if (
|
|
1455
|
-
const E =
|
|
1456
|
-
return
|
|
1457
|
-
|
|
1452
|
+
const o = p.row.original, i = o.costUnit, f = o.baseUnit, b = i ?? f;
|
|
1453
|
+
if (i && i !== f) {
|
|
1454
|
+
const C = z.value.find((E) => E._id === o.id), N = (B = C == null ? void 0 : C.defaultCost) == null ? void 0 : B.measurement;
|
|
1455
|
+
if (N) {
|
|
1456
|
+
const E = N.conversion.amount / Math.pow(10, N.conversion.precision);
|
|
1457
|
+
return S("div", { class: "flex flex-col" }, [
|
|
1458
|
+
S(
|
|
1458
1459
|
"span",
|
|
1459
1460
|
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1460
|
-
|
|
1461
|
+
b
|
|
1461
1462
|
),
|
|
1462
|
-
|
|
1463
|
+
S("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, [
|
|
1463
1464
|
"1 ",
|
|
1464
|
-
|
|
1465
|
+
S("span", { class: "fm-typo-en-body-sm-600" }, i),
|
|
1465
1466
|
` = ${E} `,
|
|
1466
|
-
|
|
1467
|
+
S("span", { class: "fm-typo-en-body-sm-600" }, f)
|
|
1467
1468
|
])
|
|
1468
1469
|
]);
|
|
1469
1470
|
}
|
|
1470
1471
|
}
|
|
1471
|
-
return
|
|
1472
|
+
return b;
|
|
1472
1473
|
}
|
|
1473
1474
|
},
|
|
1474
1475
|
{
|
|
@@ -1477,8 +1478,8 @@ const Da = At(
|
|
|
1477
1478
|
header: () => X("Opening (B/F)", "The opening balance brought forward from previous period."),
|
|
1478
1479
|
size: 150,
|
|
1479
1480
|
cell(p) {
|
|
1480
|
-
const
|
|
1481
|
-
return
|
|
1481
|
+
const o = p.row.original.opening;
|
|
1482
|
+
return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1482
1483
|
},
|
|
1483
1484
|
meta: {
|
|
1484
1485
|
textAlign: "right"
|
|
@@ -1488,12 +1489,12 @@ const Da = At(
|
|
|
1488
1489
|
...M.value.map(
|
|
1489
1490
|
(p) => ({
|
|
1490
1491
|
id: `adjustment_${p}`,
|
|
1491
|
-
accessorFn: (
|
|
1492
|
+
accessorFn: (o) => o.adjustmentAmounts[p] ?? { amount: 0, precision: 0 },
|
|
1492
1493
|
header: () => X(Ue(p)),
|
|
1493
1494
|
size: 150,
|
|
1494
|
-
cell(
|
|
1495
|
-
const
|
|
1496
|
-
return
|
|
1495
|
+
cell(o) {
|
|
1496
|
+
const i = o.row.original.adjustmentAmounts[p] ?? { amount: 0, precision: 0 };
|
|
1497
|
+
return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(i));
|
|
1497
1498
|
},
|
|
1498
1499
|
meta: {
|
|
1499
1500
|
textAlign: "right"
|
|
@@ -1505,6 +1506,10 @@ const Da = At(
|
|
|
1505
1506
|
accessorKey: "systemBalance",
|
|
1506
1507
|
header: () => X("System Balance", "The system calculated balance before stock take."),
|
|
1507
1508
|
size: 200,
|
|
1509
|
+
cell(p) {
|
|
1510
|
+
const o = p.row.original.systemBalance;
|
|
1511
|
+
return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1512
|
+
},
|
|
1508
1513
|
meta: {
|
|
1509
1514
|
textAlign: "right"
|
|
1510
1515
|
}
|
|
@@ -1512,29 +1517,27 @@ const Da = At(
|
|
|
1512
1517
|
{
|
|
1513
1518
|
id: "physicalBalance",
|
|
1514
1519
|
accessorFn: (p) => {
|
|
1515
|
-
var
|
|
1516
|
-
const
|
|
1517
|
-
return
|
|
1520
|
+
var i;
|
|
1521
|
+
const o = (i = x.value.find((f) => f.id === p.id)) == null ? void 0 : i.balance;
|
|
1522
|
+
return o ? ea.toDouble(o) : p.physicalBalance;
|
|
1518
1523
|
},
|
|
1519
1524
|
header: () => X("Stock Take balance", "The physical balance recorded during stock take."),
|
|
1520
1525
|
cell(p) {
|
|
1521
|
-
var
|
|
1522
|
-
const
|
|
1523
|
-
let f = !0
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
}) || (f = !1, h = Number(H.toFormatString({ value: B })))), C("div", { class: "flex flex-col" }, [
|
|
1529
|
-
C(
|
|
1526
|
+
var C;
|
|
1527
|
+
const o = p.row.original, i = H.fromNumber(o.physicalBalance);
|
|
1528
|
+
let f = !0;
|
|
1529
|
+
const b = (C = x.value.find((N) => N.id === o.id)) == null ? void 0 : C.balance;
|
|
1530
|
+
let B;
|
|
1531
|
+
return b && !H.equals({ a: i, b }) ? (f = !1, B = te(b)) : B = te(o.physicalBalance), S("div", { class: "flex flex-col" }, [
|
|
1532
|
+
S(
|
|
1530
1533
|
"span",
|
|
1531
1534
|
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
1532
|
-
|
|
1535
|
+
B
|
|
1533
1536
|
),
|
|
1534
|
-
f ? null :
|
|
1537
|
+
f ? null : S(
|
|
1535
1538
|
"span",
|
|
1536
|
-
{ class: "fm-typo-en-body-
|
|
1537
|
-
`Draft: ${
|
|
1539
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1540
|
+
`Draft: ${te(o.physicalBalance)}`
|
|
1538
1541
|
)
|
|
1539
1542
|
]);
|
|
1540
1543
|
},
|
|
@@ -1548,6 +1551,10 @@ const Da = At(
|
|
|
1548
1551
|
accessorKey: "adjustedAmount",
|
|
1549
1552
|
header: () => X("Variance", "The difference between Stock Take balance and System Balance."),
|
|
1550
1553
|
size: 200,
|
|
1554
|
+
cell(p) {
|
|
1555
|
+
const o = p.row.original.adjustedAmount;
|
|
1556
|
+
return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1557
|
+
},
|
|
1551
1558
|
meta: {
|
|
1552
1559
|
textAlign: "right"
|
|
1553
1560
|
}
|
|
@@ -1558,12 +1565,8 @@ const Da = At(
|
|
|
1558
1565
|
header: () => X(`Variance (${u.value})`),
|
|
1559
1566
|
size: 150,
|
|
1560
1567
|
cell(p) {
|
|
1561
|
-
const
|
|
1562
|
-
return
|
|
1563
|
-
"div",
|
|
1564
|
-
{ class: "text-right" },
|
|
1565
|
-
s.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 4 })
|
|
1566
|
-
);
|
|
1568
|
+
const o = p.row.original.varianceInCost;
|
|
1569
|
+
return S("div", { class: "text-right fm-typo-en-body-lg-400" }, te(o));
|
|
1567
1570
|
},
|
|
1568
1571
|
meta: {
|
|
1569
1572
|
textAlign: "right"
|
|
@@ -1578,19 +1581,26 @@ const Da = At(
|
|
|
1578
1581
|
),
|
|
1579
1582
|
size: 200,
|
|
1580
1583
|
cell(p) {
|
|
1581
|
-
const
|
|
1582
|
-
if (
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1584
|
+
const o = p.row.original.adjustedDiffPercentage;
|
|
1585
|
+
if (o == null)
|
|
1586
|
+
return S(
|
|
1587
|
+
"div",
|
|
1588
|
+
{ class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" },
|
|
1589
|
+
kt
|
|
1590
|
+
);
|
|
1591
|
+
const i = te(o);
|
|
1592
|
+
if (o === 0)
|
|
1593
|
+
return S("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1594
|
+
te(0)
|
|
1595
|
+
]);
|
|
1596
|
+
const f = o > 0;
|
|
1597
|
+
return S("div", { class: "flex items-center gap-4 justify-end fm-typo-en-body-lg-400" }, [
|
|
1598
|
+
S(ke.FmIcon, {
|
|
1589
1599
|
name: f ? "arrow_drop_up" : "arrow_drop_down",
|
|
1590
1600
|
color: f ? "system-success-300" : "system-error-300",
|
|
1591
1601
|
size: "md"
|
|
1592
1602
|
}),
|
|
1593
|
-
|
|
1603
|
+
i
|
|
1594
1604
|
]);
|
|
1595
1605
|
},
|
|
1596
1606
|
meta: {
|
|
@@ -1603,46 +1613,40 @@ const Da = At(
|
|
|
1603
1613
|
header: () => X(`Stock take value (${u.value})`),
|
|
1604
1614
|
size: 180,
|
|
1605
1615
|
cell(p) {
|
|
1606
|
-
var
|
|
1607
|
-
const
|
|
1608
|
-
if (
|
|
1609
|
-
const E = H.toFormatString({ value:
|
|
1610
|
-
return
|
|
1611
|
-
|
|
1616
|
+
var N;
|
|
1617
|
+
const o = p.row.original, i = o.stockTakeValue, f = z.value.find((E) => E._id === o.id), b = (N = f == null ? void 0 : f.defaultCost) == null ? void 0 : N.measurement, B = o.physicalBalance, C = o.costPerUnit;
|
|
1618
|
+
if (b) {
|
|
1619
|
+
const E = H.toFormatString({ value: b.conversion }), fe = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} ÷ ${E} × ${C} ${u.value}`;
|
|
1620
|
+
return S(
|
|
1621
|
+
ke.FmTooltip,
|
|
1612
1622
|
{ zIndex: 51 },
|
|
1613
1623
|
{
|
|
1614
1624
|
content() {
|
|
1615
|
-
return
|
|
1625
|
+
return fe;
|
|
1616
1626
|
},
|
|
1617
1627
|
default() {
|
|
1618
|
-
return
|
|
1628
|
+
return S(
|
|
1619
1629
|
"div",
|
|
1620
|
-
{ class: "text-right" },
|
|
1621
|
-
|
|
1622
|
-
minimumFractionDigits: 2,
|
|
1623
|
-
maximumFractionDigits: 4
|
|
1624
|
-
})
|
|
1630
|
+
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1631
|
+
te(i)
|
|
1625
1632
|
);
|
|
1626
1633
|
}
|
|
1627
1634
|
}
|
|
1628
1635
|
);
|
|
1629
1636
|
} else {
|
|
1630
|
-
const E = `${B
|
|
1631
|
-
return
|
|
1632
|
-
|
|
1637
|
+
const E = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} × ${C} ${u.value}`;
|
|
1638
|
+
return S(
|
|
1639
|
+
ke.FmTooltip,
|
|
1633
1640
|
{ zIndex: 51 },
|
|
1634
1641
|
{
|
|
1635
1642
|
content() {
|
|
1636
1643
|
return E;
|
|
1637
1644
|
},
|
|
1638
1645
|
default() {
|
|
1639
|
-
return
|
|
1646
|
+
return S(
|
|
1640
1647
|
"div",
|
|
1641
|
-
{ class: "text-right" },
|
|
1642
|
-
|
|
1643
|
-
minimumFractionDigits: 2,
|
|
1644
|
-
maximumFractionDigits: 4
|
|
1645
|
-
})
|
|
1648
|
+
{ class: "text-right w-full fm-typo-en-body-lg-400" },
|
|
1649
|
+
te(i)
|
|
1646
1650
|
);
|
|
1647
1651
|
}
|
|
1648
1652
|
}
|
|
@@ -1659,46 +1663,40 @@ const Da = At(
|
|
|
1659
1663
|
header: () => X(`System value (${u.value})`),
|
|
1660
1664
|
size: 180,
|
|
1661
1665
|
cell(p) {
|
|
1662
|
-
var
|
|
1663
|
-
const
|
|
1664
|
-
if (
|
|
1665
|
-
const E = H.toFormatString({ value:
|
|
1666
|
-
return
|
|
1667
|
-
|
|
1666
|
+
var N;
|
|
1667
|
+
const o = p.row.original, i = o.systemValue, f = z.value.find((E) => E._id === o.id), b = (N = f == null ? void 0 : f.defaultCost) == null ? void 0 : N.measurement, B = o.systemBalance, C = o.costPerUnit;
|
|
1668
|
+
if (b) {
|
|
1669
|
+
const E = H.toFormatString({ value: b.conversion }), fe = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} ÷ ${E} × ${C} ${u.value}`;
|
|
1670
|
+
return S(
|
|
1671
|
+
ke.FmTooltip,
|
|
1668
1672
|
{ zIndex: 51 },
|
|
1669
1673
|
{
|
|
1670
1674
|
content() {
|
|
1671
|
-
return
|
|
1675
|
+
return fe;
|
|
1672
1676
|
},
|
|
1673
1677
|
default() {
|
|
1674
|
-
return
|
|
1678
|
+
return S(
|
|
1675
1679
|
"div",
|
|
1676
|
-
{ class: "text-right" },
|
|
1677
|
-
|
|
1678
|
-
minimumFractionDigits: 2,
|
|
1679
|
-
maximumFractionDigits: 4
|
|
1680
|
-
})
|
|
1680
|
+
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1681
|
+
te(i)
|
|
1681
1682
|
);
|
|
1682
1683
|
}
|
|
1683
1684
|
}
|
|
1684
1685
|
);
|
|
1685
1686
|
} else {
|
|
1686
|
-
const E = `${B
|
|
1687
|
-
return
|
|
1688
|
-
|
|
1687
|
+
const E = `${te(B, { minPrecision: 2, maxPrecision: 4 })} ${o.baseUnit} × ${C} ${u.value}`;
|
|
1688
|
+
return S(
|
|
1689
|
+
ke.FmTooltip,
|
|
1689
1690
|
{ zIndex: 51 },
|
|
1690
1691
|
{
|
|
1691
1692
|
content() {
|
|
1692
1693
|
return E;
|
|
1693
1694
|
},
|
|
1694
1695
|
default() {
|
|
1695
|
-
return
|
|
1696
|
+
return S(
|
|
1696
1697
|
"div",
|
|
1697
|
-
{ class: "text-right" },
|
|
1698
|
-
|
|
1699
|
-
minimumFractionDigits: 2,
|
|
1700
|
-
maximumFractionDigits: 4
|
|
1701
|
-
})
|
|
1698
|
+
{ class: "text-right fm-typo-en-body-lg-400" },
|
|
1699
|
+
te(i)
|
|
1702
1700
|
);
|
|
1703
1701
|
}
|
|
1704
1702
|
}
|
|
@@ -1714,19 +1712,19 @@ const Da = At(
|
|
|
1714
1712
|
header: () => "Amounts",
|
|
1715
1713
|
enableSorting: !1,
|
|
1716
1714
|
cell(p) {
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1715
|
+
const o = p.row.original, i = (b, B) => S(
|
|
1716
|
+
ke.FmTooltip,
|
|
1719
1717
|
{ zIndex: 50 },
|
|
1720
1718
|
{
|
|
1721
1719
|
default() {
|
|
1722
|
-
return
|
|
1720
|
+
return S(
|
|
1723
1721
|
"div",
|
|
1724
1722
|
{
|
|
1725
|
-
class: "fm-typo-en-body-
|
|
1723
|
+
class: "fm-typo-en-body-lg-400 py-4 px-8 border-1 border-fm-color-typo-secondary fm-corner-radius-md line-clamp-1"
|
|
1726
1724
|
},
|
|
1727
1725
|
[
|
|
1728
|
-
|
|
1729
|
-
|
|
1726
|
+
S("span", { class: "text-fm-color-typo-primary" }, `${b} `),
|
|
1727
|
+
S(
|
|
1730
1728
|
"span",
|
|
1731
1729
|
{
|
|
1732
1730
|
class: "text-fm-color-typo-secondary",
|
|
@@ -1738,17 +1736,17 @@ const Da = At(
|
|
|
1738
1736
|
);
|
|
1739
1737
|
},
|
|
1740
1738
|
content() {
|
|
1741
|
-
return `${
|
|
1739
|
+
return `${b} ${B}`;
|
|
1742
1740
|
}
|
|
1743
1741
|
}
|
|
1744
1742
|
);
|
|
1745
|
-
let f = Array.from({ length:
|
|
1746
|
-
if (!
|
|
1743
|
+
let f = Array.from({ length: l }).map((b, B) => {
|
|
1744
|
+
if (!o[`measurementAmount${B}`])
|
|
1747
1745
|
return null;
|
|
1748
|
-
const
|
|
1749
|
-
return
|
|
1750
|
-
}).filter((
|
|
1751
|
-
return (
|
|
1746
|
+
const C = o[`measurementAmount${B}`], N = o[`measurementAbbrev${B}`];
|
|
1747
|
+
return i(C, N);
|
|
1748
|
+
}).filter((b) => b);
|
|
1749
|
+
return (o.baseUnitAmount || !f.length) && (f = [i(o.baseUnitAmount, o.baseUnit), ...f]), S(
|
|
1752
1750
|
"div",
|
|
1753
1751
|
{
|
|
1754
1752
|
class: "flex gap-8 flex-nowrap",
|
|
@@ -1761,106 +1759,106 @@ const Da = At(
|
|
|
1761
1759
|
}
|
|
1762
1760
|
}
|
|
1763
1761
|
];
|
|
1764
|
-
}),
|
|
1765
|
-
var p,
|
|
1766
|
-
const
|
|
1767
|
-
(
|
|
1762
|
+
}), Ae = U(() => xe.value.map((l) => l.size ?? 0).reduce((l, a) => l + a)), be = Y(""), Pe = U(() => {
|
|
1763
|
+
var p, o;
|
|
1764
|
+
const l = ((o = (p = e.draft) == null ? void 0 : p.negativeStockItems) == null ? void 0 : o.reduce(
|
|
1765
|
+
(i, f) => (i[f.sku._id] = f, i),
|
|
1768
1766
|
{}
|
|
1769
1767
|
)) ?? {};
|
|
1770
|
-
return z.value.map((
|
|
1771
|
-
var
|
|
1772
|
-
const f = (
|
|
1768
|
+
return z.value.map((i) => {
|
|
1769
|
+
var lt, it, ct, ut, dt, mt, ft, pt, vt, yt, gt;
|
|
1770
|
+
const f = (lt = P.value.get(i._id)) == null ? void 0 : lt[0], b = ((it = g.value.get(i._id)) == null ? void 0 : it[0]) ?? ne, B = ((ct = i.defaultCost) == null ? void 0 : ct.costPerUnit) ?? ne, C = Number(H.toFormatString({ value: B })), N = ((dt = (ut = i.defaultCost) == null ? void 0 : ut.measurement) == null ? void 0 : dt.conversion) ?? {
|
|
1773
1771
|
amount: 1,
|
|
1774
1772
|
precision: 0
|
|
1775
1773
|
}, E = Number(
|
|
1776
|
-
H.toFormatString({ value:
|
|
1777
|
-
),
|
|
1778
|
-
if (M.value.forEach((
|
|
1779
|
-
const
|
|
1780
|
-
ge && (T[
|
|
1774
|
+
H.toFormatString({ value: N })
|
|
1775
|
+
), fe = ee.value.get(i._id), ve = fe ? Number(H.toFormatString({ value: fe })) : 0, Se = J.value.get(i._id), T = {};
|
|
1776
|
+
if (M.value.forEach((re) => {
|
|
1777
|
+
const ye = T[re] ?? { amount: 0, precision: 0 }, ge = Se == null ? void 0 : Se[re];
|
|
1778
|
+
ge && (T[re] = Bt(ye, ge));
|
|
1781
1779
|
}), !f) {
|
|
1782
|
-
const
|
|
1780
|
+
const re = Number(H.toFormatString({ value: b })), ye = 0 - re, ge = ye * C / E, Ee = 0, Nt = re * C / E;
|
|
1783
1781
|
return {
|
|
1784
|
-
id:
|
|
1785
|
-
code:
|
|
1786
|
-
name:
|
|
1787
|
-
costUnit: ((
|
|
1788
|
-
baseUnit:
|
|
1782
|
+
id: i._id,
|
|
1783
|
+
code: i.code,
|
|
1784
|
+
name: i.name,
|
|
1785
|
+
costUnit: ((ft = (mt = i.defaultCost) == null ? void 0 : mt.measurement) == null ? void 0 : ft.abbrev) ?? null,
|
|
1786
|
+
baseUnit: i.unit.abbrev,
|
|
1789
1787
|
baseUnitAmount: 0,
|
|
1790
|
-
systemBalance:
|
|
1788
|
+
systemBalance: re,
|
|
1791
1789
|
physicalBalance: 0,
|
|
1792
|
-
adjustedAmount: -
|
|
1790
|
+
adjustedAmount: -re,
|
|
1793
1791
|
adjustedDiffPercentage: -100,
|
|
1794
|
-
isTemplateItem: !i
|
|
1795
|
-
costPerUnit:
|
|
1796
|
-
opening:
|
|
1797
|
-
varianceQty:
|
|
1792
|
+
isTemplateItem: !l[i._id],
|
|
1793
|
+
costPerUnit: C,
|
|
1794
|
+
opening: ve,
|
|
1795
|
+
varianceQty: ye,
|
|
1798
1796
|
varianceInCost: ge,
|
|
1799
|
-
stockTakeValue:
|
|
1800
|
-
systemValue:
|
|
1797
|
+
stockTakeValue: Ee,
|
|
1798
|
+
systemValue: Nt,
|
|
1801
1799
|
adjustmentAmounts: T
|
|
1802
1800
|
};
|
|
1803
1801
|
}
|
|
1804
|
-
const
|
|
1805
|
-
(
|
|
1806
|
-
)) == null ? void 0 :
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
),
|
|
1810
|
-
...
|
|
1811
|
-
amount: Math.abs(
|
|
1812
|
-
}), Le =
|
|
1802
|
+
const oe = It(f), ie = (vt = (pt = x.value) == null ? void 0 : pt.find(
|
|
1803
|
+
(re) => re.id === i._id
|
|
1804
|
+
)) == null ? void 0 : vt.balance, he = $t(
|
|
1805
|
+
ie ?? oe,
|
|
1806
|
+
b
|
|
1807
|
+
), Be = b.amount === 0 ? null : Ft(he, {
|
|
1808
|
+
...b,
|
|
1809
|
+
amount: Math.abs(b.amount)
|
|
1810
|
+
}), Le = Be ? nt(Be, le) : null, We = Number(H.toFormatString({ value: b })), Ze = Number(H.toFormatString({ value: oe })), rt = Ze - We, Rt = rt * C / E, Vt = Ze * C / E, Mt = We * C / E;
|
|
1813
1811
|
return {
|
|
1814
|
-
id:
|
|
1815
|
-
code:
|
|
1816
|
-
name:
|
|
1817
|
-
costUnit: ((gt = (
|
|
1818
|
-
baseUnit:
|
|
1812
|
+
id: i._id,
|
|
1813
|
+
code: i.code,
|
|
1814
|
+
name: i.name,
|
|
1815
|
+
costUnit: ((gt = (yt = i.defaultCost) == null ? void 0 : yt.measurement) == null ? void 0 : gt.abbrev) ?? null,
|
|
1816
|
+
baseUnit: i.unit.abbrev,
|
|
1819
1817
|
baseUnitAmount: Number(H.toFormatString({ value: f.baseAmount })),
|
|
1820
|
-
...f.measurementsAmounts.filter((
|
|
1821
|
-
var
|
|
1822
|
-
return (
|
|
1823
|
-
}).reduce((
|
|
1818
|
+
...f.measurementsAmounts.filter((re) => {
|
|
1819
|
+
var ye, ge, Ee;
|
|
1820
|
+
return (Ee = (ge = (ye = ae.value) == null ? void 0 : ye.get(i._id)) == null ? void 0 : ge[0]) == null ? void 0 : Ee.includes(re.measurement.id);
|
|
1821
|
+
}).reduce((re, ye, ge) => (re[`measurementAbbrev${ge}`] = `(${ye.measurement.abbrev}) × ${H.toFormatString({ value: ye.measurement.conversion })}`, re[`measurementAmount${ge}`] = Number(H.toFormatString({ value: ye.amount })), re), {}),
|
|
1824
1822
|
systemBalance: We,
|
|
1825
1823
|
physicalBalance: Ze,
|
|
1826
|
-
adjustedAmount: Number(H.toFormatString({ value:
|
|
1824
|
+
adjustedAmount: Number(H.toFormatString({ value: he })),
|
|
1827
1825
|
adjustedDiffPercentage: Le ? Number(
|
|
1828
1826
|
H.toFormatString({
|
|
1829
|
-
value:
|
|
1827
|
+
value: Tt(Le, 2)
|
|
1830
1828
|
})
|
|
1831
1829
|
) : null,
|
|
1832
|
-
isTemplateItem: !i
|
|
1833
|
-
costPerUnit:
|
|
1834
|
-
opening:
|
|
1835
|
-
varianceQty:
|
|
1836
|
-
varianceInCost:
|
|
1837
|
-
stockTakeValue:
|
|
1838
|
-
systemValue:
|
|
1830
|
+
isTemplateItem: !l[i._id],
|
|
1831
|
+
costPerUnit: C,
|
|
1832
|
+
opening: ve,
|
|
1833
|
+
varianceQty: rt,
|
|
1834
|
+
varianceInCost: Rt,
|
|
1835
|
+
stockTakeValue: Vt,
|
|
1836
|
+
systemValue: Mt,
|
|
1839
1837
|
adjustmentAmounts: T
|
|
1840
1838
|
};
|
|
1841
|
-
}).filter((
|
|
1842
|
-
}),
|
|
1843
|
-
var a, p,
|
|
1839
|
+
}).filter((i) => !!(i.isTemplateItem && m.value.templateItem || !i.isTemplateItem && m.value.nonTemplateItem));
|
|
1840
|
+
}), Ce = U(() => {
|
|
1841
|
+
var a, p, o, i, f;
|
|
1844
1842
|
if (!e.draft) return [];
|
|
1845
|
-
const
|
|
1846
|
-
action: `Approve at ${
|
|
1843
|
+
const l = e.draft.approvedAt ? {
|
|
1844
|
+
action: `Approve at ${De(e.draft.approvedAt)}`,
|
|
1847
1845
|
// actionAt: props.draft.approvedAt,
|
|
1848
1846
|
actionBy: e.draft.approvedBy,
|
|
1849
1847
|
remark: e.draft.approveRemark
|
|
1850
|
-
} : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((
|
|
1851
|
-
action: `Reject at ${
|
|
1848
|
+
} : (a = e.draft.rejectionHistory) == null ? void 0 : a.computeFirst((b) => ({
|
|
1849
|
+
action: `Reject at ${De(b.rejectedAt)}`,
|
|
1852
1850
|
// actionAt: e.rejectedAt,
|
|
1853
|
-
actionBy:
|
|
1854
|
-
remark:
|
|
1851
|
+
actionBy: b.rejectedBy,
|
|
1852
|
+
remark: b.rejectRemark
|
|
1855
1853
|
}));
|
|
1856
1854
|
return [
|
|
1857
1855
|
{
|
|
1858
1856
|
label: "Location",
|
|
1859
|
-
value: ((p = j._currentLocation) == null ? void 0 : p.name) ??
|
|
1857
|
+
value: ((p = j._currentLocation) == null ? void 0 : p.name) ?? kt
|
|
1860
1858
|
},
|
|
1861
1859
|
{
|
|
1862
1860
|
label: "Created at",
|
|
1863
|
-
value:
|
|
1861
|
+
value: De(e.draft.createdAt)
|
|
1864
1862
|
},
|
|
1865
1863
|
{
|
|
1866
1864
|
label: "Created by",
|
|
@@ -1868,7 +1866,7 @@ const Da = At(
|
|
|
1868
1866
|
},
|
|
1869
1867
|
{
|
|
1870
1868
|
label: "Updated at",
|
|
1871
|
-
value:
|
|
1869
|
+
value: De(e.draft.updatedAt)
|
|
1872
1870
|
},
|
|
1873
1871
|
{
|
|
1874
1872
|
label: "Updated by",
|
|
@@ -1876,30 +1874,30 @@ const Da = At(
|
|
|
1876
1874
|
},
|
|
1877
1875
|
{
|
|
1878
1876
|
label: "Effective at",
|
|
1879
|
-
value:
|
|
1877
|
+
value: De(e.draft.effectiveAt ?? Oe((o = e.draft) == null ? void 0 : o._id))
|
|
1880
1878
|
},
|
|
1881
1879
|
{
|
|
1882
1880
|
label: "Using template",
|
|
1883
|
-
value: ((
|
|
1881
|
+
value: ((i = e.draft.usingTemplates.find((b) => b)) == null ? void 0 : i.name) ?? "None"
|
|
1884
1882
|
},
|
|
1885
1883
|
e.draft.remark ? {
|
|
1886
1884
|
label: "Remark",
|
|
1887
1885
|
value: e.draft.remark
|
|
1888
1886
|
} : null,
|
|
1889
|
-
|
|
1887
|
+
l ? {
|
|
1890
1888
|
label: "Last action",
|
|
1891
|
-
value:
|
|
1889
|
+
value: l.action
|
|
1892
1890
|
} : null,
|
|
1893
|
-
|
|
1891
|
+
l && l.actionBy ? {
|
|
1894
1892
|
label: "Last action by",
|
|
1895
|
-
value: (f =
|
|
1893
|
+
value: (f = l.actionBy) == null ? void 0 : f.name
|
|
1896
1894
|
} : null,
|
|
1897
|
-
|
|
1895
|
+
l && l.remark ? {
|
|
1898
1896
|
label: "Action remark",
|
|
1899
|
-
value:
|
|
1897
|
+
value: l.remark
|
|
1900
1898
|
} : null
|
|
1901
|
-
].filter((
|
|
1902
|
-
}),
|
|
1899
|
+
].filter((b) => b).map((b) => b);
|
|
1900
|
+
}), $e = [
|
|
1903
1901
|
{
|
|
1904
1902
|
label: "Overview",
|
|
1905
1903
|
value: "overview"
|
|
@@ -1908,176 +1906,176 @@ const Da = At(
|
|
|
1908
1906
|
label: "Action history",
|
|
1909
1907
|
value: "history"
|
|
1910
1908
|
}
|
|
1911
|
-
],
|
|
1912
|
-
var
|
|
1913
|
-
const
|
|
1914
|
-
for (const
|
|
1915
|
-
|
|
1916
|
-
(
|
|
1917
|
-
) ||
|
|
1909
|
+
], we = Y($e[0]), Fe = U(() => {
|
|
1910
|
+
var o, i, f;
|
|
1911
|
+
const l = ((o = e.draft) == null ? void 0 : o.activityLogs) ?? [], a = ((i = e.draft) == null ? void 0 : i.rejectionHistory) ?? [];
|
|
1912
|
+
for (const b of a)
|
|
1913
|
+
l.find(
|
|
1914
|
+
(C) => `${C.action}_${C.performedAt}` == `${Z.enum.rejectDraft}_${b.rejectedAt}`
|
|
1915
|
+
) || l.push({
|
|
1918
1916
|
action: Z.enum.rejectDraft,
|
|
1919
|
-
performedAt:
|
|
1920
|
-
performedBy:
|
|
1921
|
-
remark:
|
|
1917
|
+
performedAt: b.rejectedAt,
|
|
1918
|
+
performedBy: b.rejectedBy,
|
|
1919
|
+
remark: b.rejectRemark
|
|
1922
1920
|
});
|
|
1923
|
-
return (f = e.draft) != null && f.approvedAt && (
|
|
1921
|
+
return (f = e.draft) != null && f.approvedAt && (l.find(
|
|
1924
1922
|
(B) => {
|
|
1925
|
-
var
|
|
1926
|
-
return `${B.action}_${B.performedAt}` == `${Z.enum.approveDraft}_${(
|
|
1923
|
+
var C;
|
|
1924
|
+
return `${B.action}_${B.performedAt}` == `${Z.enum.approveDraft}_${(C = e.draft) == null ? void 0 : C.approvedAt}`;
|
|
1927
1925
|
}
|
|
1928
|
-
) ||
|
|
1926
|
+
) || l.push({
|
|
1929
1927
|
action: Z.enum.approveDraft,
|
|
1930
1928
|
performedAt: e.draft.approvedAt,
|
|
1931
1929
|
performedBy: e.draft.approvedBy ?? { name: "Unknown", id: "unknown" },
|
|
1932
1930
|
remark: e.draft.approveRemark
|
|
1933
|
-
})),
|
|
1934
|
-
(
|
|
1935
|
-
header: Ue(
|
|
1936
|
-
date:
|
|
1931
|
+
})), l.sort((b, B) => new Date(B.performedAt).getTime() - new Date(b.performedAt).getTime()).map(
|
|
1932
|
+
(b) => ({
|
|
1933
|
+
header: Ue(b.action),
|
|
1934
|
+
date: De(b.performedAt),
|
|
1937
1935
|
info: [
|
|
1938
1936
|
{
|
|
1939
1937
|
label: "Performed by",
|
|
1940
|
-
values: [
|
|
1938
|
+
values: [b.performedBy.name]
|
|
1941
1939
|
},
|
|
1942
1940
|
{
|
|
1943
1941
|
label: "Remark",
|
|
1944
|
-
values: [
|
|
1942
|
+
values: [b.remark ?? ""]
|
|
1945
1943
|
}
|
|
1946
1944
|
]
|
|
1947
1945
|
})
|
|
1948
1946
|
);
|
|
1949
|
-
}),
|
|
1950
|
-
var
|
|
1951
|
-
return ((
|
|
1947
|
+
}), Me = Y(!1), Ne = Y(!1), st = U(() => {
|
|
1948
|
+
var l;
|
|
1949
|
+
return ((l = e.draft) == null ? void 0 : l.status) !== _e.enum.DRAFT ? "Status is not draft." : null;
|
|
1952
1950
|
});
|
|
1953
|
-
function
|
|
1954
|
-
e.draft && (
|
|
1951
|
+
function Ut() {
|
|
1952
|
+
e.draft && (Ne.value = !0, k.approveDraft(
|
|
1955
1953
|
e.draft,
|
|
1956
1954
|
() => {
|
|
1957
|
-
|
|
1955
|
+
Ne.value = !1, Me.value = !1, y("submitted");
|
|
1958
1956
|
},
|
|
1959
1957
|
() => {
|
|
1960
|
-
|
|
1958
|
+
Ne.value = !1;
|
|
1961
1959
|
}
|
|
1962
1960
|
));
|
|
1963
1961
|
}
|
|
1964
|
-
return (
|
|
1965
|
-
const p = O("FmButtonGroup"),
|
|
1966
|
-
return A(),
|
|
1967
|
-
|
|
1962
|
+
return (l, a) => {
|
|
1963
|
+
const p = O("FmButtonGroup"), o = O("FmMenuDivider"), i = O("FmCard"), f = O("FmButton"), b = O("FmCircularProgress"), B = O("FmChip"), C = O("FmTextField"), N = O("FmIcon"), E = O("FmTable"), fe = O("FmSpacer"), ve = O("FmTooltip"), Se = O("FmSideSheet");
|
|
1964
|
+
return A(), R(ce, null, [
|
|
1965
|
+
_(Se, {
|
|
1968
1966
|
"dismiss-away": "",
|
|
1969
1967
|
"max-width": 9999,
|
|
1970
|
-
"model-value": v(
|
|
1971
|
-
"onUpdate:modelValue": a[9] || (a[9] = (T) =>
|
|
1968
|
+
"model-value": v(h),
|
|
1969
|
+
"onUpdate:modelValue": a[9] || (a[9] = (T) => _t(h) ? h.value = T : null),
|
|
1972
1970
|
header: "Closing details"
|
|
1973
1971
|
}, {
|
|
1974
1972
|
"side-sheet-footer": q(() => {
|
|
1975
|
-
var T,
|
|
1973
|
+
var T, oe, ie, he;
|
|
1976
1974
|
return [
|
|
1977
|
-
n("div",
|
|
1978
|
-
n("div",
|
|
1979
|
-
((T = e.draft) == null ? void 0 : T.status) === v(_e).enum.DRAFT ? (A(),
|
|
1980
|
-
|
|
1975
|
+
n("div", wn, [
|
|
1976
|
+
n("div", Sn, [
|
|
1977
|
+
((T = e.draft) == null ? void 0 : T.status) === v(_e).enum.DRAFT ? (A(), R(ce, { key: 0 }, [
|
|
1978
|
+
st.value ? (A(), pe(ve, {
|
|
1981
1979
|
key: 0,
|
|
1982
1980
|
"z-index": 51,
|
|
1983
1981
|
placement: "right"
|
|
1984
1982
|
}, {
|
|
1985
1983
|
content: q(() => [
|
|
1986
|
-
|
|
1984
|
+
ue(W(st.value), 1)
|
|
1987
1985
|
]),
|
|
1988
1986
|
default: q(() => [
|
|
1989
|
-
|
|
1987
|
+
_(f, {
|
|
1990
1988
|
disabled: "",
|
|
1991
1989
|
key: "approve key",
|
|
1992
1990
|
label: "Approve"
|
|
1993
1991
|
})
|
|
1994
1992
|
]),
|
|
1995
1993
|
_: 1
|
|
1996
|
-
})) : (A(),
|
|
1994
|
+
})) : (A(), pe(f, {
|
|
1997
1995
|
key: "approve key",
|
|
1998
1996
|
label: "Approve",
|
|
1999
|
-
onClick: a[5] || (a[5] = (
|
|
1997
|
+
onClick: a[5] || (a[5] = (Be) => Me.value = !0)
|
|
2000
1998
|
}))
|
|
2001
|
-
], 64)) :
|
|
2002
|
-
((
|
|
1999
|
+
], 64)) : se("", !0),
|
|
2000
|
+
((oe = e.draft) == null ? void 0 : oe.status) === v(_e).enum.DRAFT ? (A(), pe(f, {
|
|
2003
2001
|
key: 1,
|
|
2004
2002
|
label: "Reject",
|
|
2005
2003
|
variant: "destructive",
|
|
2006
|
-
onClick: a[6] || (a[6] = () => e.draft && v(
|
|
2007
|
-
})) :
|
|
2008
|
-
|
|
2004
|
+
onClick: a[6] || (a[6] = () => e.draft && v(k).rejectDraft(e.draft, () => y("submitted")))
|
|
2005
|
+
})) : se("", !0),
|
|
2006
|
+
_(f, {
|
|
2009
2007
|
label: "Close",
|
|
2010
2008
|
variant: "tertiary",
|
|
2011
|
-
onClick: a[7] || (a[7] = (
|
|
2009
|
+
onClick: a[7] || (a[7] = (Be) => h.value = !1)
|
|
2012
2010
|
}),
|
|
2013
|
-
(
|
|
2011
|
+
(ie = e.draft) != null && ie.approvedAt && ((he = e.draft) == null ? void 0 : he.status) !== v(_e).enum.COMPLETED ? (A(), pe(bt, { key: 2 }, {
|
|
2014
2012
|
default: q(() => [
|
|
2015
|
-
|
|
2013
|
+
_(f, {
|
|
2016
2014
|
label: "Sync",
|
|
2017
|
-
loading:
|
|
2015
|
+
loading: V.value,
|
|
2018
2016
|
onClick: a[8] || (a[8] = () => {
|
|
2019
|
-
e.draft && (
|
|
2020
|
-
|
|
2017
|
+
e.draft && (V.value = !0, v(k).syncDraft(e.draft, () => {
|
|
2018
|
+
V.value = !1, y("submitted");
|
|
2021
2019
|
}));
|
|
2022
2020
|
})
|
|
2023
2021
|
}, null, 8, ["loading"])
|
|
2024
2022
|
]),
|
|
2025
2023
|
_: 1
|
|
2026
|
-
})) :
|
|
2024
|
+
})) : se("", !0)
|
|
2027
2025
|
]),
|
|
2028
|
-
n("div",
|
|
2026
|
+
n("div", Cn, [
|
|
2029
2027
|
a[19] || (a[19] = n("div", { class: "text-xs text-gray-500 uppercase tracking-wide" }, " Total stock take value ", -1)),
|
|
2030
|
-
n("div",
|
|
2028
|
+
n("div", $n, W(u.value) + " " + W(de.value.toFixed(2)), 1)
|
|
2031
2029
|
])
|
|
2032
2030
|
])
|
|
2033
2031
|
];
|
|
2034
2032
|
}),
|
|
2035
2033
|
default: q(() => [
|
|
2036
|
-
n("div",
|
|
2034
|
+
n("div", Oa, [
|
|
2037
2035
|
n("div", null, [
|
|
2038
|
-
|
|
2039
|
-
items:
|
|
2040
|
-
modelValue:
|
|
2041
|
-
"onUpdate:modelValue": a[0] || (a[0] = (T) =>
|
|
2036
|
+
_(p, {
|
|
2037
|
+
items: $e,
|
|
2038
|
+
modelValue: we.value,
|
|
2039
|
+
"onUpdate:modelValue": a[0] || (a[0] = (T) => we.value = T)
|
|
2042
2040
|
}, null, 8, ["modelValue"])
|
|
2043
2041
|
]),
|
|
2044
|
-
|
|
2045
|
-
|
|
2042
|
+
we.value.value === "overview" ? (A(), R(ce, { key: 0 }, [
|
|
2043
|
+
_(i, {
|
|
2046
2044
|
variant: "outlined",
|
|
2047
2045
|
class: "flex flex-col gap-8 px-12 py-16"
|
|
2048
2046
|
}, {
|
|
2049
2047
|
default: q(() => {
|
|
2050
|
-
var T,
|
|
2048
|
+
var T, oe;
|
|
2051
2049
|
return [
|
|
2052
|
-
n("div",
|
|
2050
|
+
n("div", Ka, [
|
|
2053
2051
|
a[11] || (a[11] = n("div", { class: "fm-typo-en-body-lg-600" }, "Closing summary", -1)),
|
|
2054
|
-
n("div",
|
|
2052
|
+
n("div", Ya, [
|
|
2055
2053
|
n("div", {
|
|
2056
|
-
class:
|
|
2057
|
-
}, W(v(Ue)(((
|
|
2054
|
+
class: Ie(["fm-status-badge", v(Ke)(((T = l.draft) == null ? void 0 : T.status) ?? "DRAFT")])
|
|
2055
|
+
}, W(v(Ue)(((oe = l.draft) == null ? void 0 : oe.status) ?? "")), 3)
|
|
2058
2056
|
])
|
|
2059
2057
|
]),
|
|
2060
|
-
|
|
2061
|
-
n("div",
|
|
2062
|
-
(A(!0),
|
|
2058
|
+
_(o),
|
|
2059
|
+
n("div", qa, [
|
|
2060
|
+
(A(!0), R(ce, null, je(Ce.value, (ie, he) => (A(), R("div", {
|
|
2063
2061
|
class: "flex flex-col gap-4",
|
|
2064
|
-
key:
|
|
2062
|
+
key: he
|
|
2065
2063
|
}, [
|
|
2066
|
-
n("div",
|
|
2067
|
-
n("div",
|
|
2064
|
+
n("div", Ga, [
|
|
2065
|
+
n("div", Qa, W(ie.label), 1)
|
|
2068
2066
|
]),
|
|
2069
|
-
n("div",
|
|
2067
|
+
n("div", Wa, W(ie.value), 1)
|
|
2070
2068
|
]))), 128))
|
|
2071
2069
|
])
|
|
2072
2070
|
];
|
|
2073
2071
|
}),
|
|
2074
2072
|
_: 1
|
|
2075
2073
|
}),
|
|
2076
|
-
n("div",
|
|
2077
|
-
n("div",
|
|
2074
|
+
n("div", Za, [
|
|
2075
|
+
n("div", Ja, [
|
|
2078
2076
|
a[12] || (a[12] = n("div", { class: "flex-1 fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, " Closing items ", -1)),
|
|
2079
|
-
r.value ?
|
|
2080
|
-
|
|
2077
|
+
r.value ? se("", !0) : (A(), R("div", Xa, [
|
|
2078
|
+
l.draft && l.draft.status !== v(_e).enum.COMPLETED ? (A(), pe(f, {
|
|
2081
2079
|
key: 0,
|
|
2082
2080
|
label: "Refresh balance",
|
|
2083
2081
|
"prepend-icon": "refresh",
|
|
@@ -2085,85 +2083,85 @@ const Da = At(
|
|
|
2085
2083
|
"text-color": "primary",
|
|
2086
2084
|
"bg-color": "transparent",
|
|
2087
2085
|
"border-color": "primary",
|
|
2088
|
-
loading:
|
|
2089
|
-
onClick:
|
|
2090
|
-
}, null, 8, ["loading"])) :
|
|
2091
|
-
|
|
2086
|
+
loading: L.value,
|
|
2087
|
+
onClick: $
|
|
2088
|
+
}, null, 8, ["loading"])) : se("", !0),
|
|
2089
|
+
_(bt, null, {
|
|
2092
2090
|
default: q(() => [
|
|
2093
|
-
|
|
2091
|
+
_(f, {
|
|
2094
2092
|
label: "Invalidate Draft Cache",
|
|
2095
2093
|
"prepend-icon": "refresh",
|
|
2096
2094
|
variant: "secondary",
|
|
2097
2095
|
"text-color": "primary",
|
|
2098
2096
|
"bg-color": "transparent",
|
|
2099
2097
|
"border-color": "primary",
|
|
2100
|
-
loading:
|
|
2098
|
+
loading: L.value,
|
|
2101
2099
|
onClick: w
|
|
2102
2100
|
}, null, 8, ["loading"])
|
|
2103
2101
|
]),
|
|
2104
2102
|
_: 1
|
|
2105
2103
|
}),
|
|
2106
|
-
|
|
2104
|
+
_(f, {
|
|
2107
2105
|
label: "Export data",
|
|
2108
2106
|
"prepend-icon": "download",
|
|
2109
2107
|
variant: "secondary",
|
|
2110
2108
|
"text-color": "primary",
|
|
2111
2109
|
"bg-color": "transparent",
|
|
2112
2110
|
"border-color": "primary",
|
|
2113
|
-
onClick: a[1] || (a[1] = (T) =>
|
|
2114
|
-
|
|
2111
|
+
onClick: a[1] || (a[1] = (T) => l.draft ? v(k).exportDraft(
|
|
2112
|
+
l.draft,
|
|
2115
2113
|
I.value,
|
|
2116
2114
|
x.value
|
|
2117
2115
|
) : null)
|
|
2118
2116
|
})
|
|
2119
2117
|
]))
|
|
2120
2118
|
]),
|
|
2121
|
-
r.value ? (A(),
|
|
2119
|
+
r.value ? (A(), R("div", en, [
|
|
2122
2120
|
a[14] || (a[14] = n("div", { class: "h-80" }, null, -1)),
|
|
2123
|
-
n("div",
|
|
2121
|
+
n("div", tn, [
|
|
2124
2122
|
n("div", null, [
|
|
2125
|
-
|
|
2123
|
+
_(b, { size: "md" })
|
|
2126
2124
|
]),
|
|
2127
2125
|
a[13] || (a[13] = n("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Fetching info... ", -1))
|
|
2128
2126
|
]),
|
|
2129
2127
|
a[15] || (a[15] = n("div", { class: "h-80" }, null, -1))
|
|
2130
|
-
])) : (A(),
|
|
2131
|
-
n("div",
|
|
2132
|
-
n("div",
|
|
2133
|
-
|
|
2128
|
+
])) : (A(), R(ce, { key: 1 }, [
|
|
2129
|
+
n("div", an, [
|
|
2130
|
+
n("div", nn, [
|
|
2131
|
+
_(B, {
|
|
2134
2132
|
label: "Template Item(s)",
|
|
2135
2133
|
selected: m.value.templateItem,
|
|
2136
2134
|
onClick: a[2] || (a[2] = (T) => m.value.templateItem = !m.value.templateItem)
|
|
2137
2135
|
}, null, 8, ["selected"]),
|
|
2138
|
-
|
|
2136
|
+
_(B, {
|
|
2139
2137
|
label: "Non-template Item(s)",
|
|
2140
2138
|
selected: m.value.nonTemplateItem,
|
|
2141
2139
|
onClick: a[3] || (a[3] = (T) => m.value.nonTemplateItem = !m.value.nonTemplateItem)
|
|
2142
2140
|
}, null, 8, ["selected"])
|
|
2143
2141
|
]),
|
|
2144
|
-
|
|
2145
|
-
modelValue:
|
|
2146
|
-
"onUpdate:modelValue": a[4] || (a[4] = (T) =>
|
|
2142
|
+
_(C, {
|
|
2143
|
+
modelValue: be.value,
|
|
2144
|
+
"onUpdate:modelValue": a[4] || (a[4] = (T) => be.value = T),
|
|
2147
2145
|
placeholder: "Filter items"
|
|
2148
2146
|
}, null, 8, ["modelValue"])
|
|
2149
2147
|
]),
|
|
2150
|
-
v(t).skuTags.size ? (A(),
|
|
2151
|
-
(A(!0),
|
|
2148
|
+
v(t).skuTags.size ? (A(), R("div", on, [
|
|
2149
|
+
(A(!0), R(ce, null, je(v(t).skuTags.keys(), (T) => (A(), pe(B, {
|
|
2152
2150
|
key: `${T}`,
|
|
2153
2151
|
label: `${T}`,
|
|
2154
2152
|
selectable: "",
|
|
2155
2153
|
selected: D[`${T}`],
|
|
2156
|
-
onClick: (
|
|
2154
|
+
onClick: (oe) => D[`${T}`] = !D[`${T}`]
|
|
2157
2155
|
}, {
|
|
2158
2156
|
default: q(() => [
|
|
2159
|
-
D[`${T}`] ? (A(),
|
|
2157
|
+
D[`${T}`] ? (A(), pe(N, {
|
|
2160
2158
|
key: 0,
|
|
2161
2159
|
name: "check",
|
|
2162
2160
|
class: "text-white",
|
|
2163
2161
|
size: "sm"
|
|
2164
|
-
})) :
|
|
2162
|
+
})) : se("", !0),
|
|
2165
2163
|
n("span", {
|
|
2166
|
-
class:
|
|
2164
|
+
class: Ie([
|
|
2167
2165
|
"",
|
|
2168
2166
|
{
|
|
2169
2167
|
"text-white fm-typo-en-body-md-600": D[`${T}`],
|
|
@@ -2174,86 +2172,86 @@ const Da = At(
|
|
|
2174
2172
|
]),
|
|
2175
2173
|
_: 2
|
|
2176
2174
|
}, 1032, ["label", "selected", "onClick"]))), 128))
|
|
2177
|
-
])) :
|
|
2178
|
-
n("div",
|
|
2175
|
+
])) : se("", !0),
|
|
2176
|
+
n("div", sn, [
|
|
2179
2177
|
n("div", {
|
|
2180
|
-
style:
|
|
2178
|
+
style: xt({ height: "600px", minWidth: `${Ae.value}px` })
|
|
2181
2179
|
}, [
|
|
2182
|
-
|
|
2183
|
-
"column-defs":
|
|
2184
|
-
"row-data":
|
|
2185
|
-
"search-value":
|
|
2180
|
+
_(E, {
|
|
2181
|
+
"column-defs": xe.value,
|
|
2182
|
+
"row-data": Pe.value,
|
|
2183
|
+
"search-value": be.value
|
|
2186
2184
|
}, null, 8, ["column-defs", "row-data", "search-value"])
|
|
2187
2185
|
], 4)
|
|
2188
2186
|
])
|
|
2189
2187
|
], 64))
|
|
2190
2188
|
])
|
|
2191
|
-
], 64)) :
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
(A(!0),
|
|
2195
|
-
n("div",
|
|
2196
|
-
n("div",
|
|
2197
|
-
n("div",
|
|
2189
|
+
], 64)) : se("", !0),
|
|
2190
|
+
we.value.value === "history" ? (A(), R("div", rn, [
|
|
2191
|
+
Fe.value.length ? (A(), R("div", un, [
|
|
2192
|
+
(A(!0), R(ce, null, je(Fe.value, (T, oe) => (A(), R(ce, { key: oe }, [
|
|
2193
|
+
n("div", dn, [
|
|
2194
|
+
n("div", mn, [
|
|
2195
|
+
n("div", fn, [
|
|
2198
2196
|
n("div", {
|
|
2199
|
-
class:
|
|
2197
|
+
class: Ie([
|
|
2200
2198
|
{
|
|
2201
|
-
"bg-fm-color-primary":
|
|
2202
|
-
"bg-white":
|
|
2199
|
+
"bg-fm-color-primary": oe !== 0,
|
|
2200
|
+
"bg-white": oe === 0
|
|
2203
2201
|
},
|
|
2204
2202
|
"w-[2px] h-full"
|
|
2205
2203
|
])
|
|
2206
2204
|
}, null, 2)
|
|
2207
2205
|
]),
|
|
2208
2206
|
a[18] || (a[18] = n("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
2209
|
-
n("div",
|
|
2207
|
+
n("div", pn, [
|
|
2210
2208
|
n("div", {
|
|
2211
|
-
class:
|
|
2209
|
+
class: Ie([
|
|
2212
2210
|
{
|
|
2213
|
-
"bg-fm-color-primary":
|
|
2214
|
-
"bg-white":
|
|
2211
|
+
"bg-fm-color-primary": oe < Fe.value.length - 1,
|
|
2212
|
+
"bg-white": oe >= Fe.value.length - 1
|
|
2215
2213
|
},
|
|
2216
2214
|
"w-[2px] h-full"
|
|
2217
2215
|
])
|
|
2218
2216
|
}, null, 2)
|
|
2219
2217
|
])
|
|
2220
2218
|
]),
|
|
2221
|
-
n("div",
|
|
2222
|
-
n("div",
|
|
2223
|
-
n("div",
|
|
2219
|
+
n("div", vn, [
|
|
2220
|
+
n("div", yn, W(T.header), 1),
|
|
2221
|
+
n("div", gn, W(T.date), 1)
|
|
2224
2222
|
])
|
|
2225
2223
|
]),
|
|
2226
|
-
n("div",
|
|
2227
|
-
n("div",
|
|
2228
|
-
n("div",
|
|
2224
|
+
n("div", bn, [
|
|
2225
|
+
n("div", hn, [
|
|
2226
|
+
n("div", kn, [
|
|
2229
2227
|
n("div", {
|
|
2230
|
-
class:
|
|
2228
|
+
class: Ie([
|
|
2231
2229
|
{
|
|
2232
|
-
"bg-fm-color-primary":
|
|
2233
|
-
"bg-white":
|
|
2230
|
+
"bg-fm-color-primary": oe < Fe.value.length - 1,
|
|
2231
|
+
"bg-white": oe >= Fe.value.length - 1
|
|
2234
2232
|
},
|
|
2235
2233
|
"w-[2px] h-full"
|
|
2236
2234
|
])
|
|
2237
2235
|
}, null, 2)
|
|
2238
2236
|
])
|
|
2239
2237
|
]),
|
|
2240
|
-
n("div",
|
|
2241
|
-
|
|
2238
|
+
n("div", _n, [
|
|
2239
|
+
_(i, {
|
|
2242
2240
|
variant: "outlined",
|
|
2243
2241
|
class: "py-12 px-16"
|
|
2244
2242
|
}, {
|
|
2245
2243
|
default: q(() => [
|
|
2246
|
-
n("div",
|
|
2247
|
-
(A(!0),
|
|
2248
|
-
key:
|
|
2244
|
+
n("div", xn, [
|
|
2245
|
+
(A(!0), R(ce, null, je(T.info, (ie, he) => (A(), R("div", {
|
|
2246
|
+
key: he,
|
|
2249
2247
|
class: "flex flex-col gap-4"
|
|
2250
2248
|
}, [
|
|
2251
|
-
n("div",
|
|
2252
|
-
n("div",
|
|
2253
|
-
(A(!0),
|
|
2249
|
+
n("div", Dn, W(ie == null ? void 0 : ie.label), 1),
|
|
2250
|
+
n("div", An, [
|
|
2251
|
+
(A(!0), R(ce, null, je(ie == null ? void 0 : ie.values, (Be, Le) => (A(), R("div", {
|
|
2254
2252
|
key: Le,
|
|
2255
2253
|
class: "fm-typo-en-body-lg-600"
|
|
2256
|
-
}, W(
|
|
2254
|
+
}, W(Be), 1))), 128))
|
|
2257
2255
|
])
|
|
2258
2256
|
]))), 128))
|
|
2259
2257
|
])
|
|
@@ -2263,43 +2261,43 @@ const Da = At(
|
|
|
2263
2261
|
])
|
|
2264
2262
|
])
|
|
2265
2263
|
], 64))), 128))
|
|
2266
|
-
])) : (A(),
|
|
2267
|
-
|
|
2264
|
+
])) : (A(), R("div", ln, [
|
|
2265
|
+
_(fe),
|
|
2268
2266
|
n("div", null, [
|
|
2269
2267
|
n("img", {
|
|
2270
|
-
src: v(
|
|
2268
|
+
src: v(ra),
|
|
2271
2269
|
alt: "List is empty"
|
|
2272
|
-
}, null, 8,
|
|
2270
|
+
}, null, 8, cn)
|
|
2273
2271
|
]),
|
|
2274
2272
|
a[16] || (a[16] = n("div", { class: "fm-typo-en-body-lg-600" }, W("No records found"), -1)),
|
|
2275
2273
|
a[17] || (a[17] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, W("You can track approval and rejection history here"), -1)),
|
|
2276
|
-
|
|
2277
|
-
|
|
2274
|
+
_(fe),
|
|
2275
|
+
_(fe)
|
|
2278
2276
|
]))
|
|
2279
|
-
])) :
|
|
2277
|
+
])) : se("", !0)
|
|
2280
2278
|
])
|
|
2281
2279
|
]),
|
|
2282
2280
|
_: 1
|
|
2283
2281
|
}, 8, ["model-value"]),
|
|
2284
|
-
v(
|
|
2282
|
+
v(h) && e.draft ? (A(), pe(Ha, {
|
|
2285
2283
|
key: 0,
|
|
2286
|
-
show:
|
|
2287
|
-
"onUpdate:show": a[10] || (a[10] = (T) =>
|
|
2288
|
-
refreshing:
|
|
2289
|
-
approving:
|
|
2284
|
+
show: Me.value,
|
|
2285
|
+
"onUpdate:show": a[10] || (a[10] = (T) => Me.value = T),
|
|
2286
|
+
refreshing: L.value,
|
|
2287
|
+
approving: Ne.value,
|
|
2290
2288
|
draft: e.draft,
|
|
2291
|
-
onRefresh:
|
|
2292
|
-
onApprove:
|
|
2293
|
-
}, null, 8, ["show", "refreshing", "approving", "draft"])) :
|
|
2289
|
+
onRefresh: $,
|
|
2290
|
+
onApprove: Ut
|
|
2291
|
+
}, null, 8, ["show", "refreshing", "approving", "draft"])) : se("", !0)
|
|
2294
2292
|
], 64);
|
|
2295
2293
|
};
|
|
2296
2294
|
}
|
|
2297
|
-
}),
|
|
2295
|
+
}), Bn = { class: "flex-1 flex flex-col gap-8" }, Tn = { class: "flex flex-col" }, jn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, In = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Pn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Un = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, no = /* @__PURE__ */ Ve({
|
|
2298
2296
|
__name: "ClosingDraftView",
|
|
2299
2297
|
setup(c) {
|
|
2300
|
-
const { t:
|
|
2301
|
-
|
|
2302
|
-
const I =
|
|
2298
|
+
const { t: s } = tt(), { viewDraft: e } = qe(), { viewClosingDraftProps: u, viewClosingDraftShow: k } = Wt(qe()), h = Ge(), r = Sa(), L = Ht(), { breakpoints: V } = qt();
|
|
2299
|
+
h.watchLocation(r.fetchDrafts);
|
|
2300
|
+
const I = U(() => r.loading), x = Y(""), M = U(() => V.value.xs || V.value.sm), G = U(() => M.value ? 10 : 20);
|
|
2303
2301
|
function K(j) {
|
|
2304
2302
|
switch (j) {
|
|
2305
2303
|
case "refresh":
|
|
@@ -2309,30 +2307,30 @@ const Da = At(
|
|
|
2309
2307
|
function d(j) {
|
|
2310
2308
|
return j;
|
|
2311
2309
|
}
|
|
2312
|
-
const t =
|
|
2310
|
+
const t = U(() => M.value ? [
|
|
2313
2311
|
{
|
|
2314
|
-
label:
|
|
2312
|
+
label: s("inventory.common.refresh"),
|
|
2315
2313
|
value: "refresh",
|
|
2316
2314
|
isPrimary: !1
|
|
2317
2315
|
}
|
|
2318
2316
|
] : [
|
|
2319
2317
|
{
|
|
2320
|
-
label:
|
|
2318
|
+
label: s("inventory.common.refresh"),
|
|
2321
2319
|
value: "refresh",
|
|
2322
2320
|
isPrimary: !1
|
|
2323
2321
|
}
|
|
2324
2322
|
]);
|
|
2325
2323
|
return (j, D) => {
|
|
2326
2324
|
const Q = O("FmTable");
|
|
2327
|
-
return A(),
|
|
2328
|
-
|
|
2329
|
-
title: v(
|
|
2325
|
+
return A(), R(ce, null, [
|
|
2326
|
+
_(Ot, {
|
|
2327
|
+
title: v(s)("inventory.closing.draft.title"),
|
|
2330
2328
|
actions: t.value,
|
|
2331
2329
|
"onClick:action": K
|
|
2332
2330
|
}, {
|
|
2333
2331
|
default: q(() => [
|
|
2334
2332
|
n("div", {
|
|
2335
|
-
class:
|
|
2333
|
+
class: Ie([
|
|
2336
2334
|
"flex flex-col gap-8 max-h-full",
|
|
2337
2335
|
{
|
|
2338
2336
|
"p-0": M.value,
|
|
@@ -2340,58 +2338,58 @@ const Da = At(
|
|
|
2340
2338
|
}
|
|
2341
2339
|
])
|
|
2342
2340
|
}, [
|
|
2343
|
-
|
|
2341
|
+
_(sa, {
|
|
2344
2342
|
"change-location": "",
|
|
2345
2343
|
searchable: "",
|
|
2346
2344
|
search: x.value,
|
|
2347
|
-
"onUpdate:search": D[0] || (D[0] = (
|
|
2345
|
+
"onUpdate:search": D[0] || (D[0] = (y) => x.value = y)
|
|
2348
2346
|
}, null, 8, ["search"]),
|
|
2349
|
-
|
|
2350
|
-
style:
|
|
2347
|
+
_(Q, {
|
|
2348
|
+
style: xt(v(L).tableHeight),
|
|
2351
2349
|
"column-defs": v(r).columnDefs,
|
|
2352
2350
|
"row-data": v(r).drafts,
|
|
2353
2351
|
"search-value": x.value,
|
|
2354
2352
|
loading: I.value,
|
|
2355
|
-
onRowClick: D[1] || (D[1] = (
|
|
2353
|
+
onRowClick: D[1] || (D[1] = (y) => v(e)(y.original)),
|
|
2356
2354
|
"page-size": G.value
|
|
2357
2355
|
}, {
|
|
2358
|
-
"list-row": q((
|
|
2359
|
-
|
|
2360
|
-
row:
|
|
2356
|
+
"list-row": q((y) => [
|
|
2357
|
+
_(ia, {
|
|
2358
|
+
row: y,
|
|
2361
2359
|
onRowClick: (m) => v(e)(m)
|
|
2362
2360
|
}, {
|
|
2363
2361
|
default: q((m) => {
|
|
2364
|
-
var
|
|
2362
|
+
var F, z, ae, de, ne, le, me, $, w, g, P, J, ee, X, xe, Ae, be, Pe, Ce, $e;
|
|
2365
2363
|
return [
|
|
2366
|
-
n("div",
|
|
2367
|
-
n("div",
|
|
2368
|
-
n("div",
|
|
2369
|
-
|
|
2370
|
-
render: (
|
|
2371
|
-
props: (
|
|
2364
|
+
n("div", Bn, [
|
|
2365
|
+
n("div", Tn, [
|
|
2366
|
+
n("div", jn, [
|
|
2367
|
+
_(v(ze), {
|
|
2368
|
+
render: (ae = (z = (F = m._id) == null ? void 0 : F.column) == null ? void 0 : z.columnDef) == null ? void 0 : ae.cell,
|
|
2369
|
+
props: (ne = (de = m._id) == null ? void 0 : de.getContext) == null ? void 0 : ne.call(de)
|
|
2372
2370
|
}, null, 8, ["render", "props"])
|
|
2373
2371
|
]),
|
|
2374
|
-
n("div",
|
|
2375
|
-
|
|
2376
|
-
render: (
|
|
2377
|
-
props: (
|
|
2372
|
+
n("div", In, [
|
|
2373
|
+
_(v(ze), {
|
|
2374
|
+
render: ($ = (me = (le = m.name) == null ? void 0 : le.column) == null ? void 0 : me.columnDef) == null ? void 0 : $.cell,
|
|
2375
|
+
props: (g = (w = m.name) == null ? void 0 : w.getContext) == null ? void 0 : g.call(w)
|
|
2378
2376
|
}, null, 8, ["render", "props"])
|
|
2379
2377
|
]),
|
|
2380
|
-
n("div",
|
|
2381
|
-
...
|
|
2382
|
-
...
|
|
2378
|
+
n("div", Pn, W([
|
|
2379
|
+
...y.original.items.slice(0, 3).map((we) => we.sku.name),
|
|
2380
|
+
...y.original.items.length >= 3 ? [`and ${y.original.items.length - 3} more items`] : []
|
|
2383
2381
|
].join(", ")), 1),
|
|
2384
|
-
n("div",
|
|
2385
|
-
|
|
2386
|
-
render: (ee = (J = (
|
|
2387
|
-
props: (
|
|
2382
|
+
n("div", Un, [
|
|
2383
|
+
_(v(ze), {
|
|
2384
|
+
render: (ee = (J = (P = m.ref) == null ? void 0 : P.column) == null ? void 0 : J.columnDef) == null ? void 0 : ee.cell,
|
|
2385
|
+
props: (xe = (X = m.ref) == null ? void 0 : X.getContext) == null ? void 0 : xe.call(X)
|
|
2388
2386
|
}, null, 8, ["render", "props"])
|
|
2389
2387
|
])
|
|
2390
2388
|
]),
|
|
2391
2389
|
n("div", null, [
|
|
2392
|
-
|
|
2393
|
-
render: (
|
|
2394
|
-
props: (
|
|
2390
|
+
_(v(ze), {
|
|
2391
|
+
render: (Pe = (be = (Ae = m.status) == null ? void 0 : Ae.column) == null ? void 0 : be.columnDef) == null ? void 0 : Pe.cell,
|
|
2392
|
+
props: ($e = (Ce = m.status) == null ? void 0 : Ce.getContext) == null ? void 0 : $e.call(Ce)
|
|
2395
2393
|
}, null, 8, ["render", "props"])
|
|
2396
2394
|
])
|
|
2397
2395
|
])
|
|
@@ -2406,12 +2404,12 @@ const Da = At(
|
|
|
2406
2404
|
]),
|
|
2407
2405
|
_: 1
|
|
2408
2406
|
}, 8, ["title", "actions"]),
|
|
2409
|
-
(A(),
|
|
2410
|
-
|
|
2411
|
-
show: v(
|
|
2412
|
-
"onUpdate:show": D[2] || (D[2] = (
|
|
2413
|
-
onSubmitted: D[3] || (D[3] = () => (
|
|
2414
|
-
onRefresh: D[4] || (D[4] = (
|
|
2407
|
+
(A(), pe(Et, { to: "body" }, [
|
|
2408
|
+
_(Fn, zt(v(u), {
|
|
2409
|
+
show: v(k),
|
|
2410
|
+
"onUpdate:show": D[2] || (D[2] = (y) => _t(k) ? k.value = y : null),
|
|
2411
|
+
onSubmitted: D[3] || (D[3] = () => (k.value = !1, v(r).fetchDrafts())),
|
|
2412
|
+
onRefresh: D[4] || (D[4] = (y) => v(r).updateDraftRef(y))
|
|
2415
2413
|
}), null, 16, ["show"])
|
|
2416
2414
|
]))
|
|
2417
2415
|
], 64);
|
|
@@ -2419,5 +2417,5 @@ const Da = At(
|
|
|
2419
2417
|
}
|
|
2420
2418
|
});
|
|
2421
2419
|
export {
|
|
2422
|
-
|
|
2420
|
+
no as default
|
|
2423
2421
|
};
|