@feedmepos/mf-inventory-portal 1.5.12 → 1.6.0-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-DBEmTaMX.js → App-BWiKiRD2.js} +4 -4
- package/dist/{ApprovalView-BvzIwH1r.js → ApprovalView-TFet-Rht.js} +7 -7
- package/dist/{BindingsDialog-DnqHoU0Y.js → BindingsDialog-ByO16R7B.js} +2 -2
- package/dist/{BindingsPicker-Bjpj0zdJ.js → BindingsPicker-BzeipJDM.js} +2 -2
- package/dist/{BindingsTable-S5Nqq4Qv.js → BindingsTable-CATRwDGx.js} +3 -3
- package/dist/ClosingDraftView-Bilo3C7N.js +4318 -0
- package/dist/{ClosingHistoryView-B2ccrB2K.js → ClosingHistoryView-DJEhuzBh.js} +5 -5
- package/dist/ClosingTemplateView-DTS__1eO.js +2221 -0
- package/dist/{DefaultView-DQhLe6LE.js → DefaultView-Dpwvllot.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-Cup9mzpO.js → DeliveryOrderPrintPreview-BZ-BDWlS.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DuZFuSbw.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BMJVOiL_.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoPyc0aE.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-QvgQwP6t.js} +2 -2
- package/dist/{FmMultiselectDialog-Cwazmlw3.js → FmMultiselectDialog-B1rAOXTC.js} +2 -2
- package/dist/{FmMultiselectDialog-DnuUrW7h.js → FmMultiselectDialog-W0_FfMmH.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BMzzUsa4.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DNpKzzVC.js} +5 -5
- package/dist/{ImportView-CXtrdABV.js → ImportView-B_3OeL5b.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cfp95IvX.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CdNdnCp-.js} +1 -1
- package/dist/{IngredientGroupView-Bm-2yK8J.js → IngredientGroupView-B_v-UNeR.js} +5 -5
- package/dist/{IngredientsView-Bo8w9LSr.js → IngredientsView-DTXevc-8.js} +15 -15
- package/dist/{IntegrationExplorerView-DUqQ64CE.js → IntegrationExplorerView-C6JUipFs.js} +352 -352
- package/dist/IntegrationView-DX4hhKYv.js +5100 -0
- package/dist/{InventoryBindingForm-DWJRCTf8.js → InventoryBindingForm-BpNKhiGF.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DH-xUQ5m.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BWy-YpCv.js} +5 -5
- package/dist/{InventoryBindingSummary-DSwCvTnu.js → InventoryBindingSummary-BL4AkZY3.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-KDWRZCxm.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DURnZteR.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-Wuv2teWn.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BR0Hc9cL.js} +1 -1
- package/dist/{PublishView-BSahQbqy.js → PublishView-CELngZXP.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-C8umjCEU.js → PurchaseOrderPrintPreview-HCGMQWdo.js} +2 -2
- package/dist/{ReceiveRequestView-Bf5dAcun.js → ReceiveRequestView-DfrpsGeI.js} +26 -26
- package/dist/{RecipeView-wU9u23Zp.js → RecipeView-DCrrdrhp.js} +1104 -1117
- package/dist/{SettingsView-C5Uc6h0A.js → SettingsView-CHoDkUIF.js} +4 -4
- package/dist/{StockView-QF68mXtU.js → StockView-DlP1-pbq.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cgw8EDXb.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-NZcNoQ6u.js} +1 -1
- package/dist/{SupplierView-xBONJSsg.js → SupplierView-DqQbgLqh.js} +12 -12
- package/dist/{SurchargeView-BK8aNKZl.js → SurchargeView-CtlXOPJ3.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-tsuedeNl.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BRrHPAJj.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BXVa7pt5.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bw3UN_Zn.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CVRD5iri.js → TransferDetails.vue_vue_type_script_setup_true_lang-atZZPJBf.js} +20 -20
- package/dist/TransferTemplateView-Dl0k38tD.js +2327 -0
- package/dist/{UnitCostHistoryView-BS0nrbkD.js → UnitCostHistoryView-Dh-yAgvG.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CeD0qWRC.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-FqnqY9bU.js} +5 -5
- package/dist/{UnitView-DsKX7DM0.js → UnitView-D5Zvz2xm.js} +7 -7
- package/dist/{WarehouseView-DRZaGu80.js → WarehouseView-s5g9AQq5.js} +5 -5
- package/dist/{WastageTemplateView-CtMSWKFj.js → WastageTemplateView-XzJSsB29.js} +14 -14
- package/dist/api/closing-draft.d.ts +6 -0
- package/dist/api/codemax.d.ts +11 -0
- package/dist/api/inventory.d.ts +1 -0
- package/dist/api/netsuite.d.ts +5 -4
- package/dist/api/surcharge.d.ts +1 -0
- package/dist/{app-DYMYQwvV.js → app-D-l9FM2n.js} +15762 -13683
- package/dist/app.d.ts +288 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-Cxsa4j_W.js → closing-template-C56_2aLc.js} +1 -1
- package/dist/{date2-BdXL0GG5.js → date2-CRMgo5NH.js} +1 -1
- package/dist/{dayjs.min-LoBFKjU2.js → dayjs.min-9bo3vPqj.js} +1 -1
- package/dist/{decimal-BFFta-yv.js → decimal-CsE7mms2.js} +2 -2
- package/dist/{defineDeepModel-CCZ3fqXQ.js → defineDeepModel-DDX70CM6.js} +1 -1
- package/dist/{duplicate-template-C2Qho2Ig.js → duplicate-template-BrEOP-1V.js} +1 -1
- package/dist/{feature-Dt5ZFkZR.js → feature-Bl6yUhw_.js} +2 -2
- package/dist/{format-time-from-id-LqoWbcB4.js → format-time-from-id-BuMdYlM9.js} +1 -1
- package/dist/format-unit-display-CMfuvGP6.js +1432 -0
- package/dist/{import-export.helper-DogBd6aS.js → import-export.helper-C9F9d-rh.js} +6 -6
- package/dist/{index-IMHyRNdu.js → index-BcOtIfdU.js} +1 -1
- package/dist/index-BdSVteJV.js +257 -0
- package/dist/{index-D0xsiYLO.js → index-cbmIhZ6F.js} +1 -1
- package/dist/{inventory-core-dart.default-BkcD7c_a.js → inventory-core-dart.default-DewosGoK.js} +1 -1
- package/dist/{lz-string-CgecKowu.js → lz-string-Ye-dLAix.js} +1 -1
- package/dist/modules/print-template/api/print-template.d.ts +1 -0
- package/dist/{netsuite-9qEVrdMv.js → netsuite-Dyw1JtQL.js} +2 -2
- package/dist/{number-DSMFbPf0.js → number-YiCgPFTE.js} +3 -3
- package/dist/{predefined-templates-OZoiOUoA.js → predefined-templates-B0Eto9Jx.js} +1 -1
- package/dist/{purchase-order-template-CUee1L_x.js → purchase-order-template-zHPLRQDQ.js} +1 -1
- package/dist/{recalculationUtils-CPcCUHIm.js → recalculationUtils-DZLZlctO.js} +1 -1
- package/dist/{rules-CMNaUkUU.js → rules-BsVkaxL5.js} +2 -2
- package/dist/{stock-BOaUT0Y3.js → stock-DlQopDTl.js} +1 -1
- package/dist/stores/api.d.ts +1 -0
- package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
- package/dist/stores/integration/codemax.d.ts +432 -0
- package/dist/stores/integration/index.d.ts +4 -1
- package/dist/{supplier-BAbQZL7x.js → supplier-UPX_1aFs.js} +2 -2
- package/dist/{surcharge-C5tQ0vs0.js → surcharge-DO3-kAit.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-CSmRb5Ds.js → uom-rules-DbhFLCUC.js} +1 -1
- package/dist/{use-ingredient-select-dialog-B9XYlxjA.js → use-ingredient-select-dialog-BASkk3-u.js} +16 -16
- package/dist/{use-inventory-binding-dialog-BzIb4yxm.js → use-inventory-binding-dialog-DTc48xUU.js} +2 -2
- package/dist/use-template-enabled-locations-gwYjb6_p.js +132 -0
- package/dist/{use-transfer-locations-Di5ozOgU.js → use-transfer-locations-BJ0xIECi.js} +2 -2
- package/dist/{useHrmPermission-N8GPw9P_.js → useHrmPermission-G4mfvYF8.js} +1 -1
- package/dist/{useNavigationMenu-BLnGMLsm.js → useNavigationMenu-Be-99JmQ.js} +2 -2
- package/dist/{useSseClient-BQtJfryY.js → useSseClient-D1h38l_K.js} +3 -3
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +800 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +40 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupAction.vue.d.ts +21 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupCard.vue.d.ts +20 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +823 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupGrid.vue.d.ts +20 -0
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +10 -0
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1400 -133
- package/dist/views/closing-draft/helpers/closing-draft-summary.helper.d.ts +11 -0
- package/dist/views/closing-draft/helpers/closing-group-detail.helper.d.ts +68 -0
- package/dist/views/closing-draft/helpers/closing-group-status.helper.d.ts +6 -0
- package/dist/views/closing-draft/helpers/closing-groups.helper.d.ts +28 -0
- package/dist/views/closing-draft/helpers/merge-closing-draft-items.helper.d.ts +9 -0
- package/dist/views/closing-template/components/closing-template-form/components/ClosingTemplateGroupsEditor.vue.d.ts +31 -0
- package/dist/views/closing-template/components/closing-template-form/components/ClosingTemplateItem.vue.d.ts +164 -7
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +24 -88
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +108 -0
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +108 -0
- package/dist/views/ingredients/composables/use-ingredient-select-dialog.d.ts +3 -3
- package/dist/views/integration/Codemax.vue.d.ts +2 -0
- package/dist/views/integration/components/ApplyProductCodemax.vue.d.ts +341 -0
- package/dist/views/integration/components/ApplyProductDialogCodemax.vue.d.ts +298 -0
- package/dist/views/integration/components/ApplyProductDialogPropsCodemax.d.ts +17 -0
- package/dist/views/integration/components/CodemaxDialog.vue.d.ts +519 -0
- package/dist/views/recipe/composables/use-recipe-bulk-editor.d.ts +3 -3
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorDialog.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep1.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep2.vue.d.ts +8 -0
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep3.vue.d.ts +2 -0
- package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +3225 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +4 -1
- package/dist/views/transfer-template/helpers/template-item-bulk-editor-export.d.ts +9 -0
- package/dist/{vue-i18n-DR8I1LQH.js → vue-i18n-fX3C6wjd.js} +306 -306
- package/dist/{xlsx-D5-Cqx-l.js → xlsx-BsL1DoEA.js} +1 -1
- package/dist/{xlsx.util-DEdsfN6W.js → xlsx.util-D_XTOHMv.js} +3 -3
- package/package.json +4 -4
- package/dist/ClosingDraftView-Y074sSoz.js +0 -3343
- package/dist/ClosingTemplateView-BcvKBWVJ.js +0 -2077
- package/dist/IntegrationView-CtkbKPzC.js +0 -4586
- package/dist/TransferTemplateView-Cm4evaK3.js +0 -1564
- package/dist/format-unit-display-CWqmpVa_.js +0 -1268
- package/dist/index-2DNXazDV.js +0 -164
- package/dist/use-template-enabled-locations-V5iE0ywc.js +0 -146
|
@@ -1,2077 +0,0 @@
|
|
|
1
|
-
import { ref as A, h as P, defineComponent as K, resolveComponent as E, openBlock as $, createElementBlock as D, createElementVNode as _, normalizeClass as q, createTextVNode as ae, toDisplayString as I, unref as p, createCommentVNode as O, createVNode as C, withCtx as V, Fragment as j, renderList as Z, computed as L, watch as Pe, createSlots as Ee, createBlock as U, isRef as Ye, normalizeStyle as Ge, Teleport as Ke, normalizeProps as We, guardReactiveProps as qe, mergeProps as Je } from "vue";
|
|
2
|
-
import { u as Xe, _ as Qe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
|
-
import { useI18n as W, useCoreStore as de } from "@feedmepos/mf-common";
|
|
4
|
-
import { useDialog as pe, useDialogChild as Ze, useSnackbar as ce, FmButtonVariant as oe, components as Y, FmAdvancedSort as et, useProxiedModel as tt, useBreakpoints as nt } from "@feedmepos/ui-library";
|
|
5
|
-
import { defineStore as Ve, storeToRefs as Ne } from "pinia";
|
|
6
|
-
import { F as G } from "./form-mode.enum-BKiNVH6A.js";
|
|
7
|
-
import { a as me } from "./closing-template-Cxsa4j_W.js";
|
|
8
|
-
import { u as fe, c as Ue, a as ve, l as ot } from "./app-DYMYQwvV.js";
|
|
9
|
-
import { t as re, a as ge, d as ye, s as Le, r as st } from "./xlsx.util-DEdsfN6W.js";
|
|
10
|
-
import { F as lt } from "./FmDroppableField-J0xUsOTV.js";
|
|
11
|
-
import { f as Be, a as le } from "./date2-BdXL0GG5.js";
|
|
12
|
-
import { D as se, R as z } from "./row-action.enum-DQ9bJ_uv.js";
|
|
13
|
-
import { c as at } from "./component-kqxARxvM.js";
|
|
14
|
-
import { f as rt } from "./format-time-from-id-LqoWbcB4.js";
|
|
15
|
-
import { _ as it } from "./TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BXVa7pt5.js";
|
|
16
|
-
import { u as ct } from "./netsuite-9qEVrdMv.js";
|
|
17
|
-
import { u as mt } from "./duplicate-template-C2Qho2Ig.js";
|
|
18
|
-
import { _ as ut } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoPyc0aE.js";
|
|
19
|
-
import { R as dt, A as pt } from "./rules-CMNaUkUU.js";
|
|
20
|
-
import { u as ft } from "./use-ingredient-select-dialog-B9XYlxjA.js";
|
|
21
|
-
import { d as vt } from "./defineDeepModel-CCZ3fqXQ.js";
|
|
22
|
-
import { F as X, _ as ze } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
23
|
-
import { u as gt } from "./use-template-enabled-locations-V5iE0ywc.js";
|
|
24
|
-
import { _ as yt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-tsuedeNl.js";
|
|
25
|
-
import { _ as ht } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
26
|
-
const ue = Ve(
|
|
27
|
-
"closingTemplateTable",
|
|
28
|
-
function() {
|
|
29
|
-
const { t: r } = W(), a = pe(), u = A({}), t = ie(), n = A({}), v = A(new Array()), b = A(!1), c = fe(), l = me();
|
|
30
|
-
function g(o) {
|
|
31
|
-
const f = {
|
|
32
|
-
title: o.name,
|
|
33
|
-
doc: o,
|
|
34
|
-
controller: {
|
|
35
|
-
publishAll: async (T) => {
|
|
36
|
-
const e = T || o.locations, k = await l.publishSingleDoc(
|
|
37
|
-
o._id,
|
|
38
|
-
e == null ? void 0 : e.map((M) => M.dbName)
|
|
39
|
-
);
|
|
40
|
-
return u.value = k.publishedRevByLocation || {}, u.value;
|
|
41
|
-
},
|
|
42
|
-
publishAtLocation: async (T) => {
|
|
43
|
-
const e = await l.publishSingleDoc(o._id, [T.dbName]);
|
|
44
|
-
return u.value = e.publishedRevByLocation || {}, u.value;
|
|
45
|
-
},
|
|
46
|
-
unpublishAll: async (T) => {
|
|
47
|
-
const e = T || o.locations, k = await l.unpublishSingleDoc(
|
|
48
|
-
o._id,
|
|
49
|
-
e == null ? void 0 : e.map((M) => M.dbName)
|
|
50
|
-
);
|
|
51
|
-
return u.value = k.publishedRevByLocation || {}, u.value;
|
|
52
|
-
},
|
|
53
|
-
unpublishAtLocation: async (T) => {
|
|
54
|
-
const e = await l.unpublishSingleDoc(o._id, [
|
|
55
|
-
T.dbName
|
|
56
|
-
]);
|
|
57
|
-
return u.value = e.publishedRevByLocation || {}, u.value;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
initialPublishedRev: u.value,
|
|
61
|
-
locations: c.locations,
|
|
62
|
-
enabledLocations: o.locations
|
|
63
|
-
};
|
|
64
|
-
a.open({
|
|
65
|
-
title: "Publish template",
|
|
66
|
-
contentComponent: it,
|
|
67
|
-
contentComponentProps: f,
|
|
68
|
-
closeButton: !0,
|
|
69
|
-
minWidth: 700,
|
|
70
|
-
maxHeight: "80vh",
|
|
71
|
-
contentScrollable: !1,
|
|
72
|
-
primaryActions: {
|
|
73
|
-
text: r("common.close"),
|
|
74
|
-
close: !0,
|
|
75
|
-
variant: "tertiary"
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async function i() {
|
|
80
|
-
if (v.value = [], !!c._currentLocation) {
|
|
81
|
-
b.value = !0;
|
|
82
|
-
try {
|
|
83
|
-
const [o, f, T] = await Promise.all([
|
|
84
|
-
l.readTemplates(),
|
|
85
|
-
l.getRecentPublishingJob(),
|
|
86
|
-
l.getRecentPublishInfo()
|
|
87
|
-
]).delayed(1e3);
|
|
88
|
-
v.value = o, n.value = f, u.value = T.publishedRevByLocation || {};
|
|
89
|
-
} catch (o) {
|
|
90
|
-
console.log("Something went wrong when fetching templates:", o);
|
|
91
|
-
} finally {
|
|
92
|
-
b.value = !1;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
async function h(o) {
|
|
97
|
-
if (!v.value.find((f) => f._id) && c._currentLocation) {
|
|
98
|
-
b.value = !0;
|
|
99
|
-
try {
|
|
100
|
-
const [f] = await Promise.all([
|
|
101
|
-
l.getTemplate(o),
|
|
102
|
-
new Promise((T) => setTimeout(T, 1e3))
|
|
103
|
-
]);
|
|
104
|
-
v.value = [f];
|
|
105
|
-
} catch (f) {
|
|
106
|
-
console.log("Something went wrong when fetching templates:", f);
|
|
107
|
-
} finally {
|
|
108
|
-
b.value = !1;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function w(o, f) {
|
|
113
|
-
switch (f = Ue(f), o) {
|
|
114
|
-
case z.Details:
|
|
115
|
-
return t.viewTemplate(f);
|
|
116
|
-
case z.Edit:
|
|
117
|
-
return t.updateTemplate(f);
|
|
118
|
-
case z.Delete:
|
|
119
|
-
return t.deleteTemplate(f, b, i);
|
|
120
|
-
case z.Publish:
|
|
121
|
-
return g(f);
|
|
122
|
-
case z.Duplicate:
|
|
123
|
-
return t.duplicateTemplate(f, b, i);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
columnDefs: [
|
|
128
|
-
{
|
|
129
|
-
id: "_id",
|
|
130
|
-
accessorKey: "_id",
|
|
131
|
-
header: () => r("inventory.closing.table.createdAt"),
|
|
132
|
-
cell(o) {
|
|
133
|
-
return rt(`${o.getValue()}`);
|
|
134
|
-
},
|
|
135
|
-
enableSorting: !0
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
id: "name",
|
|
139
|
-
accessorKey: "name",
|
|
140
|
-
header: () => r("inventory.closing.table.name"),
|
|
141
|
-
enableSorting: !0,
|
|
142
|
-
size: 200
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: "noOfItems",
|
|
146
|
-
accessorKey: "items.length",
|
|
147
|
-
header: () => r("inventory.closing.table.noOfItems"),
|
|
148
|
-
enableSorting: !1,
|
|
149
|
-
meta: {
|
|
150
|
-
width: "10rem",
|
|
151
|
-
textAlign: "right"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
id: "enabledLocations",
|
|
156
|
-
accessorKey: "locations.length",
|
|
157
|
-
header: () => r("inventory.closing.table.enabledOutlets"),
|
|
158
|
-
cell(o) {
|
|
159
|
-
var T;
|
|
160
|
-
const f = (T = o.row.original.locations) == null ? void 0 : T.length;
|
|
161
|
-
return f ? `${f}` : "All";
|
|
162
|
-
},
|
|
163
|
-
enableSorting: !1,
|
|
164
|
-
meta: {
|
|
165
|
-
width: "10rem",
|
|
166
|
-
textAlign: "right"
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
id: "ref",
|
|
171
|
-
accessorKey: "ref",
|
|
172
|
-
header: () => r("inventory.closing.table.reference"),
|
|
173
|
-
enableSorting: !1,
|
|
174
|
-
size: "auto"
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
id: "status",
|
|
178
|
-
header: () => r("inventory.adjustment.template.table.status"),
|
|
179
|
-
enableSorting: !1,
|
|
180
|
-
cell(o) {
|
|
181
|
-
const f = o.row.original, e = (o.row.original.locations || c.locations).filter((d) => !!c.locationByDbName[d.dbName]), k = e.filter((d) => !!(u.value[d.dbName] || []).find(
|
|
182
|
-
(x) => x._id === f._id && (x.updatedAt ? x.updatedAt === f.updatedAt : x._rev === f._rev)
|
|
183
|
-
)).length, M = e.length > 0 && k === e.length;
|
|
184
|
-
return P(
|
|
185
|
-
"div",
|
|
186
|
-
{
|
|
187
|
-
class: "flex items-center gap-8"
|
|
188
|
-
},
|
|
189
|
-
P(
|
|
190
|
-
"div",
|
|
191
|
-
{
|
|
192
|
-
class: [
|
|
193
|
-
"fm-status-badge",
|
|
194
|
-
M ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
|
|
195
|
-
]
|
|
196
|
-
},
|
|
197
|
-
M ? "Published" : "Unpublished"
|
|
198
|
-
)
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
id: "action",
|
|
204
|
-
cell(o) {
|
|
205
|
-
const f = o.row.original, T = [
|
|
206
|
-
se[z.Edit],
|
|
207
|
-
se[z.Duplicate],
|
|
208
|
-
se[z.Delete],
|
|
209
|
-
se[z.Publish]
|
|
210
|
-
];
|
|
211
|
-
return at(T, (e) => w(e, f));
|
|
212
|
-
},
|
|
213
|
-
enableSorting: !1,
|
|
214
|
-
size: 40,
|
|
215
|
-
meta: {
|
|
216
|
-
cellClass: "",
|
|
217
|
-
headerClass: ""
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
],
|
|
221
|
-
recentPublish: n,
|
|
222
|
-
templates: v,
|
|
223
|
-
loading: b,
|
|
224
|
-
fetchTemplates: i,
|
|
225
|
-
loadTemplate: h
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
var he = /* @__PURE__ */ ((m) => (m.Ingredients = "Ingredients", m))(he || {});
|
|
230
|
-
function He(m) {
|
|
231
|
-
const r = m.sku, a = new Set(m.disabledMeasurements);
|
|
232
|
-
return [
|
|
233
|
-
{
|
|
234
|
-
code: r.code,
|
|
235
|
-
name: r.name,
|
|
236
|
-
unit: r.unit.abbrev,
|
|
237
|
-
enabled: !a.has(r.unit._id)
|
|
238
|
-
},
|
|
239
|
-
...r.unit.measurements.map((n) => ({
|
|
240
|
-
unit: n.abbrev,
|
|
241
|
-
enabled: !a.has(n.id)
|
|
242
|
-
}))
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
|
-
function Oe() {
|
|
246
|
-
return [
|
|
247
|
-
{
|
|
248
|
-
id: "code",
|
|
249
|
-
name: "Code"
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
id: "name",
|
|
253
|
-
name: "Name"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
id: "unit",
|
|
257
|
-
name: "Unit"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
id: "enabled",
|
|
261
|
-
name: "Enabled"
|
|
262
|
-
}
|
|
263
|
-
];
|
|
264
|
-
}
|
|
265
|
-
function bt(m) {
|
|
266
|
-
var b;
|
|
267
|
-
const a = de().currentBusiness.value, t = (b = m.map((c) => {
|
|
268
|
-
var y;
|
|
269
|
-
const l = c.items.flatMap(He), g = Oe(), i = [
|
|
270
|
-
["Template ID", c._id],
|
|
271
|
-
["Template name", c.name],
|
|
272
|
-
["Business name", a == null ? void 0 : a.name],
|
|
273
|
-
["Business ID", a == null ? void 0 : a._id],
|
|
274
|
-
["Menu version", a == null ? void 0 : a.menuVersion],
|
|
275
|
-
[
|
|
276
|
-
"Locations",
|
|
277
|
-
...(y = c.locations) != null && y.length ? c.locations.map((o) => `${o.name} (${o.dbName})`) : ["All"]
|
|
278
|
-
],
|
|
279
|
-
["Reference", c.ref ?? ""],
|
|
280
|
-
[],
|
|
281
|
-
g.map((o) => o.name),
|
|
282
|
-
...l.map((o) => g.map((f) => o[f.id]))
|
|
283
|
-
], h = g.map((o) => `system:${o.id}`), w = re(i, h);
|
|
284
|
-
return { name: c.name, sheet: w };
|
|
285
|
-
}).reduce(
|
|
286
|
-
(c, l) => {
|
|
287
|
-
var i;
|
|
288
|
-
const g = l.name.slice(0, 12);
|
|
289
|
-
return (i = c.sheetOccurence)[g] ?? (i[g] = 0), c.sheetOccurence[g] += 1, c.sheets[`${g} (${c.sheetOccurence[g]})`] = l.sheet, c;
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
sheets: {},
|
|
293
|
-
sheetOccurence: {}
|
|
294
|
-
}
|
|
295
|
-
)) == null ? void 0 : b.sheets, n = `${a == null ? void 0 : a.name} closing templates (${Be(/* @__PURE__ */ new Date())}).xlsx`, v = ge(t);
|
|
296
|
-
return ye(v, n), n;
|
|
297
|
-
}
|
|
298
|
-
function _t(m) {
|
|
299
|
-
de().currentBusiness.value;
|
|
300
|
-
const a = 3, u = (i) => {
|
|
301
|
-
const h = [], w = i.sku, y = new Set(i.disabledMeasurements || []);
|
|
302
|
-
y.has(w.unit._id) || h.push(w.unit.abbrev);
|
|
303
|
-
for (const o of w.unit.measurements) {
|
|
304
|
-
if (h.length >= a) break;
|
|
305
|
-
y.has(o.id) || h.push(o.abbrev);
|
|
306
|
-
}
|
|
307
|
-
return h;
|
|
308
|
-
}, t = ["#", "Code", "Name", "UOM"], n = [
|
|
309
|
-
["Template:", m.name],
|
|
310
|
-
["Reference:", m.ref ?? ""],
|
|
311
|
-
[],
|
|
312
|
-
t,
|
|
313
|
-
...m.items.map((i, h) => {
|
|
314
|
-
const w = u(i);
|
|
315
|
-
return [
|
|
316
|
-
h + 1,
|
|
317
|
-
// Index starting from 1
|
|
318
|
-
i.sku.code,
|
|
319
|
-
i.sku.name,
|
|
320
|
-
// Add UOM columns (up to MAX_UOM_COLUMNS)
|
|
321
|
-
...Array(a).fill("").map(
|
|
322
|
-
(y, o) => w[o] ? `_____ ${w[o]}` : ""
|
|
323
|
-
)
|
|
324
|
-
];
|
|
325
|
-
})
|
|
326
|
-
], v = re(n, t);
|
|
327
|
-
if (v["!ref"]) {
|
|
328
|
-
const i = {
|
|
329
|
-
top: { style: "thin", color: { rgb: "000000" } },
|
|
330
|
-
bottom: { style: "thin", color: { rgb: "000000" } },
|
|
331
|
-
left: { style: "thin", color: { rgb: "000000" } },
|
|
332
|
-
right: { style: "thin", color: { rgb: "000000" } }
|
|
333
|
-
}, h = 4, w = h + m.items.length, y = t.map((o, f) => String.fromCharCode(65 + f));
|
|
334
|
-
for (let o = h; o <= w; o++)
|
|
335
|
-
y.forEach((f) => {
|
|
336
|
-
const T = `${f}${o}`;
|
|
337
|
-
v[T] || (v[T] = { t: "s", v: "" }), v[T].s = {
|
|
338
|
-
border: i
|
|
339
|
-
};
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
v["!cols"] = [
|
|
343
|
-
{ wch: 5 },
|
|
344
|
-
// Index column - narrow
|
|
345
|
-
{ wch: 15 },
|
|
346
|
-
// Code column
|
|
347
|
-
{ wch: 30 },
|
|
348
|
-
// Name column - adjusted for more columns
|
|
349
|
-
...Array.from({ length: a }, () => ({ wch: 15 }))
|
|
350
|
-
// UOM columns
|
|
351
|
-
], v["!margins"] = {
|
|
352
|
-
left: 0.7,
|
|
353
|
-
right: 0.7,
|
|
354
|
-
top: 0.75,
|
|
355
|
-
bottom: 0.75,
|
|
356
|
-
header: 0.3,
|
|
357
|
-
footer: 0.3
|
|
358
|
-
};
|
|
359
|
-
const c = m.name.slice(0, 31), l = ge({ [c]: v }), g = `${m.name} - Closing Template (${Be(/* @__PURE__ */ new Date())}).xlsx`;
|
|
360
|
-
return ye(l, g), g;
|
|
361
|
-
}
|
|
362
|
-
function xt() {
|
|
363
|
-
const m = de(), r = ve(), a = ct(), u = He({
|
|
364
|
-
sku: {
|
|
365
|
-
unit: {
|
|
366
|
-
_id: "",
|
|
367
|
-
name: "Unit",
|
|
368
|
-
abbrev: "Unit",
|
|
369
|
-
precision: 0,
|
|
370
|
-
measurements: []
|
|
371
|
-
},
|
|
372
|
-
code: "ING001",
|
|
373
|
-
_id: "",
|
|
374
|
-
name: "Sugar"
|
|
375
|
-
}
|
|
376
|
-
})[0], t = m.currentBusiness.value, n = Oe(), v = [
|
|
377
|
-
["Template ID (leave empty to create new)", ""],
|
|
378
|
-
["Template Name", "New template"],
|
|
379
|
-
["Business name", t == null ? void 0 : t.name],
|
|
380
|
-
["Business ID", t == null ? void 0 : t._id],
|
|
381
|
-
["Menu version", t == null ? void 0 : t.menuVersion],
|
|
382
|
-
[
|
|
383
|
-
"Location codes (leave empty to enable all)",
|
|
384
|
-
"Example outlet (restaurant_xxx)",
|
|
385
|
-
"Example outlet 2 (restaurant_xxx)"
|
|
386
|
-
],
|
|
387
|
-
["Reference:"],
|
|
388
|
-
[],
|
|
389
|
-
n.map((y) => y.name),
|
|
390
|
-
n.map((y) => u[y.id])
|
|
391
|
-
], b = n.map((y) => `system:${y.id}`), c = re(v, b), l = a.isEnabled ? a.state.setting.childItems ?? [] : [], g = l.reduce(
|
|
392
|
-
(y, o) => {
|
|
393
|
-
var M, d;
|
|
394
|
-
const f = (M = a.netSuiteItemIdToSkuId.get(o.parentNetSuiteId)) == null ? void 0 : M[0], T = (d = a.netSuiteMeasurementIdToMeasurementId.get(
|
|
395
|
-
o.unitOfMeasureId
|
|
396
|
-
)) == null ? void 0 : d[0];
|
|
397
|
-
if (!o.externalId)
|
|
398
|
-
return y;
|
|
399
|
-
if (!f)
|
|
400
|
-
return console.error(`Item ${o.externalId} cannot be mapped to parent FdoInventorySku.`, o), y;
|
|
401
|
-
const e = r.skuById[f], k = e.unit.measurements.find((s) => s.id === T);
|
|
402
|
-
return k ? (y[o.externalId] = {
|
|
403
|
-
sku: e,
|
|
404
|
-
measurement: k
|
|
405
|
-
}, y) : (console.error(
|
|
406
|
-
`Item ${o.externalId} found parent FdoInventorySku of ${e.code} ${e.name} but the measurement of netsuite id ${o.unitOfMeasureId} cannot be found.`,
|
|
407
|
-
o
|
|
408
|
-
), y);
|
|
409
|
-
},
|
|
410
|
-
{}
|
|
411
|
-
), i = re(
|
|
412
|
-
[
|
|
413
|
-
...r.skus.flatMap((y) => [
|
|
414
|
-
[y.code, y.name, y.unit.abbrev, !0],
|
|
415
|
-
...y.unit.measurements.map((f) => [
|
|
416
|
-
"",
|
|
417
|
-
"",
|
|
418
|
-
f.abbrev,
|
|
419
|
-
!f.abbrev.toLocaleLowerCase("en-us").includes("inactive")
|
|
420
|
-
])
|
|
421
|
-
]),
|
|
422
|
-
...Object.entries(g).map(([y, { sku: o, measurement: f }]) => [
|
|
423
|
-
o.code,
|
|
424
|
-
o.name,
|
|
425
|
-
f.abbrev,
|
|
426
|
-
!f.abbrev.toLocaleLowerCase("en-us").includes("inactive"),
|
|
427
|
-
y
|
|
428
|
-
])
|
|
429
|
-
],
|
|
430
|
-
[
|
|
431
|
-
"Code",
|
|
432
|
-
"Name",
|
|
433
|
-
"Units",
|
|
434
|
-
"Enabled (true/false)",
|
|
435
|
-
...l.length ? ["Netsuite Parent"] : []
|
|
436
|
-
]
|
|
437
|
-
), h = ge({
|
|
438
|
-
Template: c,
|
|
439
|
-
Ingredients: i
|
|
440
|
-
}), w = `${t == null ? void 0 : t.name} transfer templates import.xlsx`;
|
|
441
|
-
return ye(h, w), w;
|
|
442
|
-
}
|
|
443
|
-
function wt(m) {
|
|
444
|
-
if (!m.length || `${m[0]}`.toLocaleLowerCase() === "all")
|
|
445
|
-
return [];
|
|
446
|
-
const r = /(.*) \(((warehouse_|restaurant_).{24,})\)/, u = fe().locationByDbName;
|
|
447
|
-
return m.map((t) => {
|
|
448
|
-
const n = new Array(), v = t.trim(), b = r.exec(v);
|
|
449
|
-
if (!b)
|
|
450
|
-
return n.push(`Enabled location value of ${v} cannot be read.`), {
|
|
451
|
-
errors: n
|
|
452
|
-
};
|
|
453
|
-
const c = b[1], l = b[2], g = u[l];
|
|
454
|
-
return g ? (c !== g.name && n.push(
|
|
455
|
-
`Location id ${l} has non-matching name. Found ${c} but expected ${g.name}`
|
|
456
|
-
), {
|
|
457
|
-
errors: n,
|
|
458
|
-
location: g
|
|
459
|
-
}) : (n.push(`Location (${c}) of id ${l} is not found.`), {
|
|
460
|
-
errors: n
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
function kt(m) {
|
|
465
|
-
const [
|
|
466
|
-
r,
|
|
467
|
-
a,
|
|
468
|
-
u,
|
|
469
|
-
t,
|
|
470
|
-
n,
|
|
471
|
-
v,
|
|
472
|
-
b,
|
|
473
|
-
c
|
|
474
|
-
] = Le(m);
|
|
475
|
-
return {
|
|
476
|
-
id: `${a[1] ?? ""}`.trim(),
|
|
477
|
-
name: `${u[1] ?? ""}`.trim(),
|
|
478
|
-
locations: b.slice(1).map((l) => `${l}`.trim()).filter((l) => l),
|
|
479
|
-
reference: `${c[1] ?? ""}`.trim()
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
function Tt(m) {
|
|
483
|
-
const [
|
|
484
|
-
r,
|
|
485
|
-
a,
|
|
486
|
-
u,
|
|
487
|
-
t,
|
|
488
|
-
n,
|
|
489
|
-
v,
|
|
490
|
-
b,
|
|
491
|
-
c,
|
|
492
|
-
l,
|
|
493
|
-
g,
|
|
494
|
-
...i
|
|
495
|
-
] = Le(m);
|
|
496
|
-
if (!r || !r.length || r.some((f) => f.length && !f.startsWith("system:")))
|
|
497
|
-
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
498
|
-
const h = r.map((f) => f.split(":")[1]), y = ["code", "name", "unit", "enabled"].filter((f) => !h.includes(f));
|
|
499
|
-
if (y.length)
|
|
500
|
-
throw new Error(
|
|
501
|
-
`Missing meta headers (${y.join()}). Excel file does not come from the template.`
|
|
502
|
-
);
|
|
503
|
-
return i.map((f, T) => {
|
|
504
|
-
const e = {};
|
|
505
|
-
for (const k in h) {
|
|
506
|
-
const M = h[k];
|
|
507
|
-
Object.assign(e, { [M]: f[k] });
|
|
508
|
-
}
|
|
509
|
-
return {
|
|
510
|
-
index: T,
|
|
511
|
-
data: e
|
|
512
|
-
};
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
function $t(m) {
|
|
516
|
-
return m.reduce(
|
|
517
|
-
(r, a) => {
|
|
518
|
-
var n;
|
|
519
|
-
const u = a.data, t = a.index;
|
|
520
|
-
return u.unit && (u.code ? r.result.push({ parent: a, children: [] }) : r.result.length ? (n = r.result.at(-1)) == null || n.children.push(a) : r.errors.push(`Cannot find parent for row ${t + 9}`)), r;
|
|
521
|
-
},
|
|
522
|
-
{ result: new Array(), errors: new Array() }
|
|
523
|
-
);
|
|
524
|
-
}
|
|
525
|
-
function Ct(m) {
|
|
526
|
-
const r = m.parent.data, a = new Array(), t = ve().skuByCode[r.code ?? ""];
|
|
527
|
-
if (!t)
|
|
528
|
-
return a.push(`Cannot find ingredient of code ${r.code} ${r.name}`), { errors: a };
|
|
529
|
-
const n = {
|
|
530
|
-
sku: t
|
|
531
|
-
}, v = /* @__PURE__ */ new Set([t.unit._id, ...t.unit.measurements.map((c) => c.id)]), b = t.unit.measurements.find((c) => c.abbrev === r.unit);
|
|
532
|
-
r.unit !== t.unit.abbrev && !b ? a.push(
|
|
533
|
-
`Cannot find measurement unit of ${r.unit} for (${r.code}) ${r.name}.`
|
|
534
|
-
) : (r.enabled === !0 || `${r.enabled}`.toLocaleLowerCase() === "true") && v.delete(t.unit._id);
|
|
535
|
-
for (const c of m.children) {
|
|
536
|
-
const l = c.data, g = l.unit === t.unit.abbrev ? t.unit : void 0, i = t.unit.measurements.find((h) => h.abbrev === l.unit);
|
|
537
|
-
if (!i && !g) {
|
|
538
|
-
a.push(
|
|
539
|
-
`Cannot find measurement unit of ${l.unit} for (${r.code}) ${r.name}.`
|
|
540
|
-
);
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
(l.enabled === !0 || `${l.enabled}`.toLocaleLowerCase() === "true") && v.delete((i == null ? void 0 : i.id) ?? (g == null ? void 0 : g._id) ?? "");
|
|
544
|
-
}
|
|
545
|
-
return v.has(t.unit._id) && n.sku.unit.measurements.every((c) => v.has(c.id)) && a.push(`Ingredient ${t.code} - ${t.name} must have at least one unit enabled.`), n.disabledMeasurements = [...v], { errors: a, templateItem: n };
|
|
546
|
-
}
|
|
547
|
-
function It(m) {
|
|
548
|
-
const r = m.SheetNames.filter(
|
|
549
|
-
(n) => !Object.values(he).map(String).includes(n)
|
|
550
|
-
), u = ue().templates, t = ot(u, "_id");
|
|
551
|
-
try {
|
|
552
|
-
return r.reduce(
|
|
553
|
-
(n, v) => {
|
|
554
|
-
const b = new Array(), c = m.Sheets[v], l = kt(c), g = wt(l.locations), i = g.filter((e) => e.location).map((e) => e.location);
|
|
555
|
-
b.push(...g.flatMap((e) => e.errors));
|
|
556
|
-
const h = Tt(c).filter(
|
|
557
|
-
(e) => e.data.code || e.data.unit
|
|
558
|
-
), w = $t(h);
|
|
559
|
-
b.push(...w.errors);
|
|
560
|
-
const y = w.result.map(
|
|
561
|
-
(e) => Ct(e)
|
|
562
|
-
);
|
|
563
|
-
b.push(...y.flatMap((e) => e.errors));
|
|
564
|
-
const o = y.filter((e) => e.templateItem).map((e) => e.templateItem);
|
|
565
|
-
if (l.id) {
|
|
566
|
-
const e = t[l.id];
|
|
567
|
-
if (!e) {
|
|
568
|
-
const M = {
|
|
569
|
-
_id: l.id,
|
|
570
|
-
_rev: "",
|
|
571
|
-
name: l.name || `(unnamed from sheet ${v || "<unnamed sheet>"})`,
|
|
572
|
-
items: []
|
|
573
|
-
};
|
|
574
|
-
return b.push(`Template ID ${l.id} is not found.`), n.importUpdateResult.push({
|
|
575
|
-
type: "update",
|
|
576
|
-
original: M,
|
|
577
|
-
template: M,
|
|
578
|
-
excelSheetName: v,
|
|
579
|
-
errors: b
|
|
580
|
-
}), n;
|
|
581
|
-
}
|
|
582
|
-
const k = {
|
|
583
|
-
type: "update",
|
|
584
|
-
original: e,
|
|
585
|
-
template: {
|
|
586
|
-
...e,
|
|
587
|
-
name: l.name,
|
|
588
|
-
locations: i.length ? i : null,
|
|
589
|
-
ref: l.reference,
|
|
590
|
-
items: o
|
|
591
|
-
},
|
|
592
|
-
excelSheetName: v,
|
|
593
|
-
errors: b
|
|
594
|
-
};
|
|
595
|
-
return n.importUpdateResult.push(k), n;
|
|
596
|
-
}
|
|
597
|
-
const T = {
|
|
598
|
-
type: "create",
|
|
599
|
-
template: {
|
|
600
|
-
name: l.name,
|
|
601
|
-
locations: i.length ? i : null,
|
|
602
|
-
ref: l.reference,
|
|
603
|
-
items: o
|
|
604
|
-
},
|
|
605
|
-
excelSheetName: v,
|
|
606
|
-
errors: b
|
|
607
|
-
};
|
|
608
|
-
return n.importCreateResult.push(T), n;
|
|
609
|
-
},
|
|
610
|
-
{
|
|
611
|
-
invalidExcel: !1,
|
|
612
|
-
importCreateResult: new Array(),
|
|
613
|
-
importUpdateResult: new Array()
|
|
614
|
-
}
|
|
615
|
-
);
|
|
616
|
-
} catch (n) {
|
|
617
|
-
return {
|
|
618
|
-
invalidExcel: !0,
|
|
619
|
-
invalidExcelMessage: (n == null ? void 0 : n.message) ?? "Invalid excel",
|
|
620
|
-
importCreateResult: [],
|
|
621
|
-
importUpdateResult: []
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
const St = { class: "flex items-center gap-12 pl-8" }, Dt = { class: "flex flex-col" }, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Ft = {
|
|
626
|
-
key: 0,
|
|
627
|
-
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
628
|
-
}, At = { key: 0 }, Re = /* @__PURE__ */ K({
|
|
629
|
-
__name: "ClosingTemplateImportItem",
|
|
630
|
-
props: {
|
|
631
|
-
type: {},
|
|
632
|
-
name: {},
|
|
633
|
-
locations: {},
|
|
634
|
-
items: {},
|
|
635
|
-
errors: {}
|
|
636
|
-
},
|
|
637
|
-
setup(m) {
|
|
638
|
-
const { t: r } = W();
|
|
639
|
-
return (a, u) => {
|
|
640
|
-
var v, b, c;
|
|
641
|
-
const t = E("FmIcon"), n = E("FmTooltip");
|
|
642
|
-
return $(), D("div", St, [
|
|
643
|
-
u[0] || (u[0] = _("div", null, "•", -1)),
|
|
644
|
-
_("div", Dt, [
|
|
645
|
-
_("div", Mt, [
|
|
646
|
-
_("div", {
|
|
647
|
-
class: q({
|
|
648
|
-
"text-fm-color-system-error-300": a.errors.length
|
|
649
|
-
})
|
|
650
|
-
}, [
|
|
651
|
-
ae(I(a.name) + " ", 1),
|
|
652
|
-
a.type === "create" ? ($(), D("span", Ft, "(" + I(p(r)("inventory.closing.template.import.new")) + ")", 1)) : O("", !0)
|
|
653
|
-
], 2),
|
|
654
|
-
a.errors.length ? ($(), D("div", At, [
|
|
655
|
-
C(n, { "z-index": 50 }, {
|
|
656
|
-
content: V(() => [
|
|
657
|
-
_("ol", null, [
|
|
658
|
-
($(!0), D(j, null, Z(a.errors, (l, g) => ($(), D("li", { key: g }, I(l), 1))), 128))
|
|
659
|
-
])
|
|
660
|
-
]),
|
|
661
|
-
default: V(() => [
|
|
662
|
-
C(t, {
|
|
663
|
-
name: "error",
|
|
664
|
-
size: "sm",
|
|
665
|
-
color: "system-error-300"
|
|
666
|
-
})
|
|
667
|
-
]),
|
|
668
|
-
_: 1
|
|
669
|
-
})
|
|
670
|
-
])) : O("", !0)
|
|
671
|
-
]),
|
|
672
|
-
_("div", {
|
|
673
|
-
class: q([
|
|
674
|
-
"fm-typo-en-body-sm-400",
|
|
675
|
-
{
|
|
676
|
-
"text-fm-color-system-error-200": a.errors.length,
|
|
677
|
-
"text-fm-color-typo-secondary": !a.errors.length
|
|
678
|
-
}
|
|
679
|
-
])
|
|
680
|
-
}, I((v = a.locations) != null && v.length ? p(r)("inventory.closing.template.import.nLocations", { count: (b = a.locations) == null ? void 0 : b.length }) : p(r)("inventory.closing.template.import.allLocations")) + ", " + I(p(r)("inventory.closing.template.import.nItems", { count: (c = a.items) == null ? void 0 : c.length })), 3)
|
|
681
|
-
])
|
|
682
|
-
]);
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
}), Rt = { class: "flex flex-col gap-24" }, Pt = { class: "fm-typo-en-body-md-400" }, Et = {
|
|
686
|
-
key: 0,
|
|
687
|
-
class: "flex items-center gap-8"
|
|
688
|
-
}, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nt = { class: "flex flex-col gap-8" }, Ut = { class: "line-clamp-2 text-ellipsis break-all" }, Lt = {
|
|
689
|
-
key: 2,
|
|
690
|
-
class: "shrink-0"
|
|
691
|
-
}, Bt = {
|
|
692
|
-
key: 0,
|
|
693
|
-
class: "flex flex-col"
|
|
694
|
-
}, zt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Ht = {
|
|
695
|
-
key: 0,
|
|
696
|
-
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
697
|
-
}, Ot = { class: "fm-typo-en-body-lg-600" }, jt = /* @__PURE__ */ K({
|
|
698
|
-
__name: "ClosingTemplateImport",
|
|
699
|
-
setup(m) {
|
|
700
|
-
const r = A(null), a = Ze(), u = ce(), t = A(!1), n = A(!1), v = A(new Array()), b = A([]), c = A([]), l = L(
|
|
701
|
-
() => !!v.value.length || b.value.some((w) => w.errors.length) || c.value.some((w) => w.errors.length)
|
|
702
|
-
), g = L(
|
|
703
|
-
() => !!b.value.length || !!c.value.length
|
|
704
|
-
), { t: i } = W();
|
|
705
|
-
async function h(w) {
|
|
706
|
-
v.value = [], b.value = [], c.value = [];
|
|
707
|
-
try {
|
|
708
|
-
t.value = !0;
|
|
709
|
-
const [y] = await Promise.all([
|
|
710
|
-
st(w),
|
|
711
|
-
// fake buffer
|
|
712
|
-
new Promise((e) => setTimeout(e, 1e3))
|
|
713
|
-
]);
|
|
714
|
-
if (!y.SheetNames.filter(
|
|
715
|
-
(e) => !Object.values(he).map(String).includes(e)
|
|
716
|
-
).find((e) => e)) {
|
|
717
|
-
v.value.push(i("inventory.ingredient.import.fileError.noSheet"));
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
const T = It(y);
|
|
721
|
-
if (T.invalidExcel) {
|
|
722
|
-
v.value.push(
|
|
723
|
-
T.invalidExcelMessage ?? i("inventory.ingredient.import.fileError.invalidExcel")
|
|
724
|
-
);
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
if (b.value = T.importCreateResult, c.value = T.importUpdateResult, !b.value.length && !c.value.length) {
|
|
728
|
-
v.value.push(i("inventory.ingredient.import.fileError.noData"));
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
a.emitData(T);
|
|
732
|
-
} catch (y) {
|
|
733
|
-
u.open({
|
|
734
|
-
title: i("inventory.ingredient.import.fileError.unableToRead"),
|
|
735
|
-
message: y == null ? void 0 : y.message,
|
|
736
|
-
type: "error"
|
|
737
|
-
}), console.error("Error in reading file", y);
|
|
738
|
-
} finally {
|
|
739
|
-
v.value.length && u.open({
|
|
740
|
-
title: i("inventory.ingredient.import.fileError.invalidExcel"),
|
|
741
|
-
type: "error"
|
|
742
|
-
}), t.value = !1;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
return Pe(r, (w) => {
|
|
746
|
-
w && h(w);
|
|
747
|
-
}), (w, y) => {
|
|
748
|
-
const o = E("FmCircularProgress"), f = E("FmIcon"), T = E("FmButton");
|
|
749
|
-
return $(), D("div", Rt, [
|
|
750
|
-
_("div", Pt, I(p(i)("inventory.closing.template.import.message")), 1),
|
|
751
|
-
n.value ? ($(), D("div", Et, [
|
|
752
|
-
_("div", null, [
|
|
753
|
-
C(o, {
|
|
754
|
-
size: "md",
|
|
755
|
-
color: "neutral-gray-200"
|
|
756
|
-
})
|
|
757
|
-
]),
|
|
758
|
-
_("div", Vt, I(p(i)("inventory.formField.loading")), 1)
|
|
759
|
-
])) : ($(), D(j, { key: 1 }, [
|
|
760
|
-
C(lt, {
|
|
761
|
-
class: q({
|
|
762
|
-
"w-full": !0,
|
|
763
|
-
"h-[200px]": !r.value
|
|
764
|
-
}),
|
|
765
|
-
accept: ".xlsx",
|
|
766
|
-
onFileUpload: y[0] || (y[0] = (e) => r.value = e),
|
|
767
|
-
label: p(i)("inventory.ingredient.import.uploadTemplate"),
|
|
768
|
-
"button-label": p(i)("inventory.ingredient.import.selectFile")
|
|
769
|
-
}, Ee({ _: 2 }, [
|
|
770
|
-
r.value ? {
|
|
771
|
-
name: "default",
|
|
772
|
-
fn: V(({ openFileDialog: e }) => [
|
|
773
|
-
_("div", Nt, [
|
|
774
|
-
_("div", {
|
|
775
|
-
class: q([
|
|
776
|
-
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
777
|
-
{
|
|
778
|
-
"border border-fm-color-neutral-gray-100": t.value,
|
|
779
|
-
"border border-fm-color-neutral-gray-200": !t.value && !l.value,
|
|
780
|
-
"border border-fm-color-system-error-200": l.value
|
|
781
|
-
}
|
|
782
|
-
])
|
|
783
|
-
}, [
|
|
784
|
-
t.value ? ($(), U(o, {
|
|
785
|
-
key: 0,
|
|
786
|
-
size: "md",
|
|
787
|
-
color: "neutral-gray-200"
|
|
788
|
-
})) : ($(), U(f, {
|
|
789
|
-
key: 1,
|
|
790
|
-
name: l.value ? "error" : "attach_file",
|
|
791
|
-
outline: "",
|
|
792
|
-
color: l.value ? "system-error-300" : void 0
|
|
793
|
-
}, null, 8, ["name", "color"])),
|
|
794
|
-
_("div", {
|
|
795
|
-
class: q([
|
|
796
|
-
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
797
|
-
{
|
|
798
|
-
"text-fm-color-typo-disabled": t.value,
|
|
799
|
-
"text-fm-color-typo-primary": !t.value
|
|
800
|
-
}
|
|
801
|
-
])
|
|
802
|
-
}, [
|
|
803
|
-
_("div", Ut, I(r.value.name), 1)
|
|
804
|
-
], 2),
|
|
805
|
-
t.value ? O("", !0) : ($(), D("div", Lt, [
|
|
806
|
-
C(T, {
|
|
807
|
-
label: p(i)("inventory.ingredient.import.replaceFile"),
|
|
808
|
-
variant: l.value ? "destructive" : "secondary",
|
|
809
|
-
"prepend-icon": l.value ? void 0 : "autorenew",
|
|
810
|
-
onClick: e
|
|
811
|
-
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
812
|
-
]))
|
|
813
|
-
], 2),
|
|
814
|
-
v.value.length ? ($(), D("div", Bt, [
|
|
815
|
-
($(!0), D(j, null, Z(v.value, (k, M) => ($(), D("div", {
|
|
816
|
-
key: M,
|
|
817
|
-
class: "flex gap-8 items-center"
|
|
818
|
-
}, [
|
|
819
|
-
C(f, {
|
|
820
|
-
name: "error",
|
|
821
|
-
size: "sm",
|
|
822
|
-
color: "system-error-300"
|
|
823
|
-
}),
|
|
824
|
-
_("div", zt, I(k), 1)
|
|
825
|
-
]))), 128))
|
|
826
|
-
])) : O("", !0)
|
|
827
|
-
])
|
|
828
|
-
]),
|
|
829
|
-
key: "0"
|
|
830
|
-
} : void 0
|
|
831
|
-
]), 1032, ["class", "label", "button-label"]),
|
|
832
|
-
g.value ? ($(), D("div", Ht, [
|
|
833
|
-
_("div", Ot, I(p(i)("inventory.ingredient.import.summary")), 1),
|
|
834
|
-
($(!0), D(j, null, Z(b.value, (e, k) => ($(), U(Re, {
|
|
835
|
-
key: k,
|
|
836
|
-
name: e.template.name,
|
|
837
|
-
locations: e.template.locations,
|
|
838
|
-
items: e.template.items,
|
|
839
|
-
errors: e.errors,
|
|
840
|
-
type: "create"
|
|
841
|
-
}, null, 8, ["name", "locations", "items", "errors"]))), 128)),
|
|
842
|
-
($(!0), D(j, null, Z(c.value, (e) => ($(), U(Re, {
|
|
843
|
-
key: e.template._id,
|
|
844
|
-
name: e.template.name,
|
|
845
|
-
locations: e.template.locations,
|
|
846
|
-
items: e.template.items,
|
|
847
|
-
errors: e.errors,
|
|
848
|
-
type: "update"
|
|
849
|
-
}, null, 8, ["name", "locations", "items", "errors"]))), 128))
|
|
850
|
-
])) : O("", !0)
|
|
851
|
-
], 64))
|
|
852
|
-
]);
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
}), ie = Ve("closingTemplateActions", () => {
|
|
856
|
-
const { t: m } = W(), r = pe(), a = ce(), u = me(), t = mt(), n = ue(), { loading: v } = Ne(n), b = A({});
|
|
857
|
-
function c() {
|
|
858
|
-
b.value = {
|
|
859
|
-
mode: G.CREATE,
|
|
860
|
-
show: !0,
|
|
861
|
-
"onUpdate:show"(e) {
|
|
862
|
-
b.value.show = e;
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
|
-
}
|
|
866
|
-
function l(e) {
|
|
867
|
-
b.value = {
|
|
868
|
-
mode: G.UPDATE,
|
|
869
|
-
modelValue: e,
|
|
870
|
-
show: !0,
|
|
871
|
-
"onUpdate:show"(k) {
|
|
872
|
-
b.value.show = k;
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
function g(e, k, M) {
|
|
877
|
-
r.open({
|
|
878
|
-
title: `Confirm deleting template ${e.name}?`,
|
|
879
|
-
message: "Deleted template can no longer be retrieved",
|
|
880
|
-
primaryActions: {
|
|
881
|
-
text: "Delete",
|
|
882
|
-
variant: oe.Destructive,
|
|
883
|
-
close: !0
|
|
884
|
-
},
|
|
885
|
-
secondaryActions: {
|
|
886
|
-
text: "Cancel",
|
|
887
|
-
variant: oe.Plain,
|
|
888
|
-
close: !0
|
|
889
|
-
}
|
|
890
|
-
}).onPrimary(async () => {
|
|
891
|
-
a.open({
|
|
892
|
-
title: `Deleting ${e.name}`,
|
|
893
|
-
type: "info"
|
|
894
|
-
});
|
|
895
|
-
try {
|
|
896
|
-
k.value = !0;
|
|
897
|
-
const [d] = await Promise.allSettled([
|
|
898
|
-
u.deleteTemplate(e),
|
|
899
|
-
new Promise((s) => setTimeout(s, 1e3))
|
|
900
|
-
]);
|
|
901
|
-
if (d.status === "rejected") throw d.reason;
|
|
902
|
-
a.open({
|
|
903
|
-
title: `Deleted "${e.name}"`,
|
|
904
|
-
type: "success"
|
|
905
|
-
});
|
|
906
|
-
} catch (d) {
|
|
907
|
-
a.open({
|
|
908
|
-
title: `Unable to delete "${e.name}"`,
|
|
909
|
-
message: d.message,
|
|
910
|
-
type: "error"
|
|
911
|
-
});
|
|
912
|
-
} finally {
|
|
913
|
-
k.value = !1, M();
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
function i(e, k, M) {
|
|
918
|
-
let d;
|
|
919
|
-
r.open({
|
|
920
|
-
title: `Confirm duplicating template "${e.name}"?`,
|
|
921
|
-
message: "Duplicated template can be edited after creation",
|
|
922
|
-
primaryActions: {
|
|
923
|
-
text: "Duplicate",
|
|
924
|
-
variant: oe.Destructive,
|
|
925
|
-
close: !0
|
|
926
|
-
},
|
|
927
|
-
secondaryActions: {
|
|
928
|
-
text: "Cancel",
|
|
929
|
-
variant: oe.Plain,
|
|
930
|
-
close: !0
|
|
931
|
-
},
|
|
932
|
-
contentComponent: K({
|
|
933
|
-
props: ["modelValue"],
|
|
934
|
-
emits: ["update:modelValue"],
|
|
935
|
-
setup(s) {
|
|
936
|
-
return () => P(Y.FmTextField, {
|
|
937
|
-
modelValue: s.modelValue,
|
|
938
|
-
"onUpdate:modelValue": (x) => d = x,
|
|
939
|
-
label: "New Template Name",
|
|
940
|
-
size: "md",
|
|
941
|
-
variant: "primary"
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
})
|
|
945
|
-
}).onPrimary(async () => {
|
|
946
|
-
a.open({
|
|
947
|
-
title: `Duplicating "${e.name}"`,
|
|
948
|
-
type: "info"
|
|
949
|
-
});
|
|
950
|
-
try {
|
|
951
|
-
k.value = !0;
|
|
952
|
-
const [s] = await Promise.allSettled([
|
|
953
|
-
t.duplicateClosingTemplate(e._id, d),
|
|
954
|
-
new Promise((x) => setTimeout(x, 1e3))
|
|
955
|
-
]);
|
|
956
|
-
if (s.status === "rejected") throw s.reason;
|
|
957
|
-
a.open({
|
|
958
|
-
title: `Duplicated "${e.name}"`,
|
|
959
|
-
type: "success"
|
|
960
|
-
});
|
|
961
|
-
} catch (s) {
|
|
962
|
-
a.open({
|
|
963
|
-
title: `Unable to duplicate "${e.name}"`,
|
|
964
|
-
message: `See error from server: ${s}`,
|
|
965
|
-
type: "error"
|
|
966
|
-
}), console.error("error on duplicating closing template", s);
|
|
967
|
-
} finally {
|
|
968
|
-
k.value = !1, M();
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
const h = A({});
|
|
973
|
-
function w(e) {
|
|
974
|
-
h.value = {
|
|
975
|
-
template: e,
|
|
976
|
-
show: !0,
|
|
977
|
-
"onUpdate:show"(k) {
|
|
978
|
-
h.value.show = k;
|
|
979
|
-
},
|
|
980
|
-
"onAction:edit"() {
|
|
981
|
-
h.value.show = !1, l(Ue(e));
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
}
|
|
985
|
-
function y() {
|
|
986
|
-
if (!n.templates.length) {
|
|
987
|
-
a.open({
|
|
988
|
-
title: "No data to export",
|
|
989
|
-
type: "error"
|
|
990
|
-
});
|
|
991
|
-
return;
|
|
992
|
-
}
|
|
993
|
-
const e = bt(n.templates);
|
|
994
|
-
a.open({
|
|
995
|
-
title: m("inventory.ingredient.export.success"),
|
|
996
|
-
message: m("inventory.ingredient.export.filename", [e]),
|
|
997
|
-
type: "success"
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
function o(e) {
|
|
1001
|
-
if (!e.items.length) {
|
|
1002
|
-
a.open({
|
|
1003
|
-
title: "No items in template to export",
|
|
1004
|
-
type: "error"
|
|
1005
|
-
});
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
const k = _t(e);
|
|
1009
|
-
a.open({
|
|
1010
|
-
title: m("inventory.ingredient.export.success"),
|
|
1011
|
-
message: m("inventory.ingredient.export.filename", [k]),
|
|
1012
|
-
type: "success"
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
function f() {
|
|
1016
|
-
n.loading || r.open({
|
|
1017
|
-
title: m("inventory.ingredient.import.title"),
|
|
1018
|
-
contentComponent: jt,
|
|
1019
|
-
overlay: !0,
|
|
1020
|
-
closeButton: !0,
|
|
1021
|
-
primaryActions: {
|
|
1022
|
-
text: m("common.import"),
|
|
1023
|
-
close: !1
|
|
1024
|
-
},
|
|
1025
|
-
secondaryActions: {
|
|
1026
|
-
text: m("common.close"),
|
|
1027
|
-
close: !0
|
|
1028
|
-
},
|
|
1029
|
-
tertiaryActions: {
|
|
1030
|
-
text: m("inventory.ingredient.import.actions.downloadTemplate"),
|
|
1031
|
-
close: !1,
|
|
1032
|
-
variant: "plain"
|
|
1033
|
-
}
|
|
1034
|
-
}).onPrimary((e) => {
|
|
1035
|
-
if (!e) {
|
|
1036
|
-
a.open({
|
|
1037
|
-
title: m("inventory.ingredient.import.error.noData"),
|
|
1038
|
-
type: "error"
|
|
1039
|
-
});
|
|
1040
|
-
return;
|
|
1041
|
-
}
|
|
1042
|
-
if (!e.importCreateResult.length && !e.importUpdateResult.length) {
|
|
1043
|
-
a.open({
|
|
1044
|
-
title: m("inventory.ingredient.import.error.invalidContent"),
|
|
1045
|
-
message: m("inventory.ingredient.import.error.noImportData"),
|
|
1046
|
-
type: "error"
|
|
1047
|
-
});
|
|
1048
|
-
return;
|
|
1049
|
-
}
|
|
1050
|
-
if (e.importCreateResult.some((k) => k.errors.length) || e.importUpdateResult.some((k) => k.errors.length)) {
|
|
1051
|
-
a.open({
|
|
1052
|
-
title: m("inventory.ingredient.import.error.invalidContent"),
|
|
1053
|
-
message: m("inventory.ingredient.import.error.hasErrors"),
|
|
1054
|
-
type: "error"
|
|
1055
|
-
});
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
r.close(), T(e);
|
|
1059
|
-
}).onTertiary(xt);
|
|
1060
|
-
}
|
|
1061
|
-
async function T(e) {
|
|
1062
|
-
v.value = !0;
|
|
1063
|
-
try {
|
|
1064
|
-
const k = [
|
|
1065
|
-
...e.importCreateResult.map(
|
|
1066
|
-
(x) => x.template
|
|
1067
|
-
),
|
|
1068
|
-
...e.importUpdateResult.map(
|
|
1069
|
-
(x) => x.template
|
|
1070
|
-
)
|
|
1071
|
-
], M = 100;
|
|
1072
|
-
let d = 0;
|
|
1073
|
-
const s = () => {
|
|
1074
|
-
d += M, a.open({
|
|
1075
|
-
title: m("inventory.ingredient.import.progress", [
|
|
1076
|
-
Math.min(d, k.length),
|
|
1077
|
-
k.length
|
|
1078
|
-
])
|
|
1079
|
-
});
|
|
1080
|
-
};
|
|
1081
|
-
for (const x of k.chunk(100))
|
|
1082
|
-
s(), await u.importTemplates(x);
|
|
1083
|
-
a.open({
|
|
1084
|
-
title: m("inventory.ingredient.import.success"),
|
|
1085
|
-
type: "success"
|
|
1086
|
-
});
|
|
1087
|
-
} catch (k) {
|
|
1088
|
-
a.open({
|
|
1089
|
-
title: m("inventory.ingredient.import.error.failed"),
|
|
1090
|
-
message: m("inventory.ingredient.import.error.systemMessage", [k == null ? void 0 : k.message]),
|
|
1091
|
-
type: "error"
|
|
1092
|
-
}), console.error("Error in importing skus", e, k);
|
|
1093
|
-
} finally {
|
|
1094
|
-
v.value = !1, n.fetchTemplates();
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
return {
|
|
1098
|
-
createTemplate: c,
|
|
1099
|
-
viewTemplate: w,
|
|
1100
|
-
updateTemplate: l,
|
|
1101
|
-
deleteTemplate: g,
|
|
1102
|
-
duplicateTemplate: i,
|
|
1103
|
-
exportTemplates: y,
|
|
1104
|
-
exportSingleTemplate: o,
|
|
1105
|
-
importTemplates: f,
|
|
1106
|
-
templateDialogProps: b,
|
|
1107
|
-
templateDetailsProps: h
|
|
1108
|
-
};
|
|
1109
|
-
});
|
|
1110
|
-
var Q = /* @__PURE__ */ ((m) => (m.Name = "Name", m.Unit = "Unit", m.Delete = "Delete", m))(Q || {});
|
|
1111
|
-
function Yt(m) {
|
|
1112
|
-
return {
|
|
1113
|
-
columnDefs: L(() => {
|
|
1114
|
-
const a = m.items.map((t) => t.sku.unit.measurements.length).reduce((t, n) => Math.max(t, n), 0);
|
|
1115
|
-
return [
|
|
1116
|
-
{
|
|
1117
|
-
id: "Name",
|
|
1118
|
-
header: () => "Name",
|
|
1119
|
-
enableSorting: !1,
|
|
1120
|
-
size: 400,
|
|
1121
|
-
minSize: 400,
|
|
1122
|
-
accessorFn: (t) => `${t.sku.name} ${t.sku.code}`,
|
|
1123
|
-
cell(t) {
|
|
1124
|
-
const n = t.row.original;
|
|
1125
|
-
return P(
|
|
1126
|
-
"div",
|
|
1127
|
-
{
|
|
1128
|
-
class: "flex flex-col",
|
|
1129
|
-
style: { minWidth: "400px" }
|
|
1130
|
-
},
|
|
1131
|
-
[
|
|
1132
|
-
P(
|
|
1133
|
-
"span",
|
|
1134
|
-
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1" },
|
|
1135
|
-
n.sku.name
|
|
1136
|
-
),
|
|
1137
|
-
P(
|
|
1138
|
-
"span",
|
|
1139
|
-
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
|
|
1140
|
-
n.sku.code
|
|
1141
|
-
)
|
|
1142
|
-
]
|
|
1143
|
-
);
|
|
1144
|
-
}
|
|
1145
|
-
},
|
|
1146
|
-
{
|
|
1147
|
-
id: "Unit",
|
|
1148
|
-
header: () => "Enable unit",
|
|
1149
|
-
enableSorting: !1,
|
|
1150
|
-
minSize: 200,
|
|
1151
|
-
maxSize: 400,
|
|
1152
|
-
cell(t) {
|
|
1153
|
-
var v, b, c;
|
|
1154
|
-
const n = t.row.original;
|
|
1155
|
-
return P("div", { class: "flex items-center gap-32" }, [
|
|
1156
|
-
P(
|
|
1157
|
-
Y.FmFormGroup,
|
|
1158
|
-
{
|
|
1159
|
-
value: n.sku.unit._id,
|
|
1160
|
-
modelValue: !((v = n.disabledMeasurements) != null && v.includes(n.sku.unit._id))
|
|
1161
|
-
},
|
|
1162
|
-
P(
|
|
1163
|
-
"div",
|
|
1164
|
-
{
|
|
1165
|
-
class: "flex items-center gap-4",
|
|
1166
|
-
style: { width: "120px" }
|
|
1167
|
-
},
|
|
1168
|
-
[
|
|
1169
|
-
P(Y.FmCheckbox, {
|
|
1170
|
-
value: n.sku.unit._id,
|
|
1171
|
-
modelValue: !((b = n.disabledMeasurements) != null && b.includes(n.sku.unit._id)),
|
|
1172
|
-
disabled: m.disabled || !((c = n.disabledMeasurements) != null && c.includes(n.sku.unit._id)) && n.sku.unit.measurements.every(
|
|
1173
|
-
(l) => {
|
|
1174
|
-
var g;
|
|
1175
|
-
return (g = n.disabledMeasurements) == null ? void 0 : g.includes(l.id);
|
|
1176
|
-
}
|
|
1177
|
-
),
|
|
1178
|
-
"onUpdate:modelValue"(l) {
|
|
1179
|
-
var g;
|
|
1180
|
-
if (l)
|
|
1181
|
-
m.updateItem({
|
|
1182
|
-
...n,
|
|
1183
|
-
disabledMeasurements: (g = n.disabledMeasurements) == null ? void 0 : g.filter(
|
|
1184
|
-
(i) => i !== n.sku.unit._id
|
|
1185
|
-
)
|
|
1186
|
-
});
|
|
1187
|
-
else {
|
|
1188
|
-
const i = n.disabledMeasurements ?? [];
|
|
1189
|
-
m.updateItem({
|
|
1190
|
-
...n,
|
|
1191
|
-
disabledMeasurements: [...i, n.sku.unit._id]
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
}),
|
|
1196
|
-
P(
|
|
1197
|
-
Y.FmTooltip,
|
|
1198
|
-
{ zIndex: 51 },
|
|
1199
|
-
{
|
|
1200
|
-
content() {
|
|
1201
|
-
return n.sku.unit.abbrev;
|
|
1202
|
-
},
|
|
1203
|
-
default() {
|
|
1204
|
-
return P(
|
|
1205
|
-
"div",
|
|
1206
|
-
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
1207
|
-
n.sku.unit.abbrev
|
|
1208
|
-
);
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
)
|
|
1212
|
-
]
|
|
1213
|
-
)
|
|
1214
|
-
),
|
|
1215
|
-
...Array.from({ length: Math.max(a, 0) }).map((l, g) => {
|
|
1216
|
-
var w, y, o, f;
|
|
1217
|
-
const i = t.row.original, h = i.sku.unit.measurements[g];
|
|
1218
|
-
return h ? P(
|
|
1219
|
-
Y.FmFormGroup,
|
|
1220
|
-
{
|
|
1221
|
-
modelValue: !((w = i.disabledMeasurements) != null && w.includes(h.id)),
|
|
1222
|
-
value: h.id
|
|
1223
|
-
},
|
|
1224
|
-
P(
|
|
1225
|
-
"div",
|
|
1226
|
-
{
|
|
1227
|
-
class: "flex items-center gap-4",
|
|
1228
|
-
style: { width: "120px" }
|
|
1229
|
-
},
|
|
1230
|
-
[
|
|
1231
|
-
P(Y.FmCheckbox, {
|
|
1232
|
-
value: h.id,
|
|
1233
|
-
modelValue: !((y = i.disabledMeasurements) != null && y.includes(h.id)),
|
|
1234
|
-
disabled: m.disabled || !((o = i.disabledMeasurements) != null && o.includes(h.id)) && ((f = i.disabledMeasurements) == null ? void 0 : f.includes(i.sku.unit._id)) && i.sku.unit.measurements.filter((T) => T.id != h.id).every((T) => {
|
|
1235
|
-
var e;
|
|
1236
|
-
return (e = i.disabledMeasurements) == null ? void 0 : e.includes(T.id);
|
|
1237
|
-
}),
|
|
1238
|
-
"onUpdate:modelValue"(T) {
|
|
1239
|
-
var e;
|
|
1240
|
-
if (T)
|
|
1241
|
-
m.updateItem({
|
|
1242
|
-
...i,
|
|
1243
|
-
disabledMeasurements: (e = i.disabledMeasurements) == null ? void 0 : e.filter(
|
|
1244
|
-
(k) => k !== h.id
|
|
1245
|
-
)
|
|
1246
|
-
});
|
|
1247
|
-
else {
|
|
1248
|
-
const k = i.disabledMeasurements ?? [];
|
|
1249
|
-
m.updateItem({
|
|
1250
|
-
...i,
|
|
1251
|
-
disabledMeasurements: [...k, h.id]
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
}),
|
|
1256
|
-
P(
|
|
1257
|
-
Y.FmTooltip,
|
|
1258
|
-
{ zIndex: 51 },
|
|
1259
|
-
{
|
|
1260
|
-
content() {
|
|
1261
|
-
return h.abbrev;
|
|
1262
|
-
},
|
|
1263
|
-
default() {
|
|
1264
|
-
return P(
|
|
1265
|
-
"div",
|
|
1266
|
-
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
1267
|
-
h.abbrev
|
|
1268
|
-
);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
)
|
|
1272
|
-
]
|
|
1273
|
-
)
|
|
1274
|
-
) : null;
|
|
1275
|
-
})
|
|
1276
|
-
]);
|
|
1277
|
-
}
|
|
1278
|
-
},
|
|
1279
|
-
{
|
|
1280
|
-
id: "Delete",
|
|
1281
|
-
header: "",
|
|
1282
|
-
cell(t) {
|
|
1283
|
-
const n = t.row.original;
|
|
1284
|
-
return P(
|
|
1285
|
-
"div",
|
|
1286
|
-
{ class: "w-full flex justify-end" },
|
|
1287
|
-
P(Y.FmButton, {
|
|
1288
|
-
class: "delete-button",
|
|
1289
|
-
key: n.sku._id,
|
|
1290
|
-
type: "button",
|
|
1291
|
-
icon: "delete",
|
|
1292
|
-
variant: "tertiary",
|
|
1293
|
-
size: "md",
|
|
1294
|
-
disabled: m.disabled,
|
|
1295
|
-
onClick: () => {
|
|
1296
|
-
m.deleteItem(n);
|
|
1297
|
-
}
|
|
1298
|
-
})
|
|
1299
|
-
);
|
|
1300
|
-
},
|
|
1301
|
-
enableSorting: !1,
|
|
1302
|
-
size: 40,
|
|
1303
|
-
meta: {
|
|
1304
|
-
cellClass: "",
|
|
1305
|
-
headerClass: ""
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
];
|
|
1309
|
-
})
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
const Gt = { class: "flex flex-col gap-16 py-12" }, Kt = { class: "flex" }, Wt = { class: "flex-1 flex flex-col" }, qt = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, Jt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Xt = { class: "flex flex-col gap-4" }, Qt = /* @__PURE__ */ K({
|
|
1313
|
-
__name: "ClosingTemplateItem",
|
|
1314
|
-
props: {
|
|
1315
|
-
cellByColId: {},
|
|
1316
|
-
row: {}
|
|
1317
|
-
},
|
|
1318
|
-
setup(m) {
|
|
1319
|
-
const r = m, a = L(() => r.row), u = L(
|
|
1320
|
-
() => a.value.getVisibleCells().filter((t) => t.column.id !== Q.Name && t.column.id !== Q.Delete)
|
|
1321
|
-
);
|
|
1322
|
-
return (t, n) => {
|
|
1323
|
-
var v, b, c, l, g;
|
|
1324
|
-
return $(), D("div", Gt, [
|
|
1325
|
-
_("div", Kt, [
|
|
1326
|
-
_("div", Wt, [
|
|
1327
|
-
_("div", qt, I(a.value.original.sku.name), 1),
|
|
1328
|
-
_("div", Jt, I(a.value.original.sku.code), 1)
|
|
1329
|
-
]),
|
|
1330
|
-
_("div", null, [
|
|
1331
|
-
C(p(X), {
|
|
1332
|
-
render: (c = (b = (v = t.cellByColId[p(Q).Delete]) == null ? void 0 : v.column) == null ? void 0 : b.columnDef) == null ? void 0 : c.cell,
|
|
1333
|
-
props: (g = (l = t.cellByColId[p(Q).Delete]) == null ? void 0 : l.getContext) == null ? void 0 : g.call(l)
|
|
1334
|
-
}, null, 8, ["render", "props"])
|
|
1335
|
-
])
|
|
1336
|
-
]),
|
|
1337
|
-
_("div", Xt, [
|
|
1338
|
-
n[0] || (n[0] = _("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, null, -1)),
|
|
1339
|
-
($(!0), D(j, null, Z(u.value, (i) => {
|
|
1340
|
-
var h, w, y;
|
|
1341
|
-
return $(), D("div", {
|
|
1342
|
-
key: i.id
|
|
1343
|
-
}, [
|
|
1344
|
-
C(p(X), {
|
|
1345
|
-
render: (w = (h = i.column) == null ? void 0 : h.columnDef) == null ? void 0 : w.cell,
|
|
1346
|
-
props: (y = i.getContext) == null ? void 0 : y.call(i)
|
|
1347
|
-
}, null, 8, ["render", "props"])
|
|
1348
|
-
]);
|
|
1349
|
-
}), 128))
|
|
1350
|
-
])
|
|
1351
|
-
]);
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
}), Zt = { class: "flex flex-col gap-16" }, en = { class: "flex flex-col gap-24" }, tn = { class: "flex flex-col gap-16" }, nn = { class: "flex items-center" }, on = { class: "flex-1 fm-typo-en-title-sm-600" }, sn = { class: "flex flex-col gap-16" }, ln = { class: "flex items-center" }, an = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, rn = { class: "flex gap-8" }, cn = { key: 0 }, mn = /* @__PURE__ */ K({
|
|
1355
|
-
__name: "ClosingTemplateForm",
|
|
1356
|
-
props: {
|
|
1357
|
-
modelValue: {},
|
|
1358
|
-
disabled: { type: Boolean }
|
|
1359
|
-
},
|
|
1360
|
-
setup(m, { expose: r }) {
|
|
1361
|
-
const a = m, u = vt(), { t } = W(), n = ve(), {
|
|
1362
|
-
promptSelectLocations: v,
|
|
1363
|
-
columnDefs: b,
|
|
1364
|
-
rowData: c
|
|
1365
|
-
} = gt({
|
|
1366
|
-
getLocations() {
|
|
1367
|
-
return u.locations;
|
|
1368
|
-
},
|
|
1369
|
-
setLocations(d) {
|
|
1370
|
-
u.locations = d;
|
|
1371
|
-
}
|
|
1372
|
-
}), l = A(), g = A(""), i = A(null), h = A(!1), w = [
|
|
1373
|
-
{
|
|
1374
|
-
key: "name",
|
|
1375
|
-
label: "Name",
|
|
1376
|
-
getter: (d) => {
|
|
1377
|
-
var s;
|
|
1378
|
-
return (s = d.sku) == null ? void 0 : s.name;
|
|
1379
|
-
}
|
|
1380
|
-
},
|
|
1381
|
-
{
|
|
1382
|
-
key: "code",
|
|
1383
|
-
label: "Code",
|
|
1384
|
-
getter: (d) => {
|
|
1385
|
-
var s;
|
|
1386
|
-
return (s = d.sku) == null ? void 0 : s.code;
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
], y = A([]), o = L(() => u.items.map((d, s) => ({ item: d, originalIndex: s })).sort((d, s) => {
|
|
1390
|
-
const x = d.item.position ?? d.originalIndex, F = s.item.position ?? s.originalIndex;
|
|
1391
|
-
return x - F;
|
|
1392
|
-
}).map(({ item: d }) => d));
|
|
1393
|
-
function f() {
|
|
1394
|
-
h.value ? u.items = y.value.map(({ id: d, label: s, ...x }, F) => ({
|
|
1395
|
-
...x,
|
|
1396
|
-
position: F
|
|
1397
|
-
})) : y.value = o.value.map((d) => ({
|
|
1398
|
-
...d,
|
|
1399
|
-
id: d.sku._id,
|
|
1400
|
-
label: `${d.sku.code} ${d.sku.name}`
|
|
1401
|
-
})), h.value = !h.value;
|
|
1402
|
-
}
|
|
1403
|
-
r({
|
|
1404
|
-
validateInputs: () => {
|
|
1405
|
-
var d, s;
|
|
1406
|
-
(s = (d = l.value) == null ? void 0 : d.validateInputs) == null || s.call(d);
|
|
1407
|
-
},
|
|
1408
|
-
resetInputsValidation: () => {
|
|
1409
|
-
var d, s;
|
|
1410
|
-
(s = (d = l.value) == null ? void 0 : d.resetInputsValidation) == null || s.call(d);
|
|
1411
|
-
},
|
|
1412
|
-
resetInputs: () => {
|
|
1413
|
-
var d, s;
|
|
1414
|
-
(s = (d = l.value) == null ? void 0 : d.resetInputs) == null || s.call(d);
|
|
1415
|
-
}
|
|
1416
|
-
});
|
|
1417
|
-
const T = Yt({
|
|
1418
|
-
updateItem: (d) => {
|
|
1419
|
-
u.items = u.items.map((s) => s.sku._id !== d.sku._id ? s : d);
|
|
1420
|
-
},
|
|
1421
|
-
deleteItem: (d) => {
|
|
1422
|
-
u.items = u.items.filter((s) => s.sku._id !== d.sku._id);
|
|
1423
|
-
},
|
|
1424
|
-
get items() {
|
|
1425
|
-
return o.value;
|
|
1426
|
-
},
|
|
1427
|
-
get disabled() {
|
|
1428
|
-
return a.disabled;
|
|
1429
|
-
}
|
|
1430
|
-
}), e = L(() => T.columnDefs.value), { promptSelectIngredients: k } = ft();
|
|
1431
|
-
async function M() {
|
|
1432
|
-
const s = n.skus.map((S) => ({
|
|
1433
|
-
label: S.name,
|
|
1434
|
-
sublabel: S.code,
|
|
1435
|
-
value: S
|
|
1436
|
-
})).filter((S) => {
|
|
1437
|
-
var N;
|
|
1438
|
-
return (N = u.items) == null ? void 0 : N.find((H) => H.sku._id === S.value._id);
|
|
1439
|
-
}).map((S) => S.value), x = u.items ?? [], F = await k(
|
|
1440
|
-
s.map((S) => S._id),
|
|
1441
|
-
(S) => {
|
|
1442
|
-
const N = n.skuById[S], H = x.find((R) => R.sku._id === N._id);
|
|
1443
|
-
return H || {
|
|
1444
|
-
sku: N
|
|
1445
|
-
};
|
|
1446
|
-
}
|
|
1447
|
-
);
|
|
1448
|
-
F && (F.sort((S, N) => S.sku.code.localeCompare(N.sku.code)), u.items = F);
|
|
1449
|
-
}
|
|
1450
|
-
return (d, s) => {
|
|
1451
|
-
const x = E("FmTextField"), F = E("FmButton"), S = E("FmTable"), N = E("FmIcon"), H = E("FmFormGroup"), B = E("FmForm");
|
|
1452
|
-
return $(), U(B, {
|
|
1453
|
-
ref_key: "formRef",
|
|
1454
|
-
ref: l,
|
|
1455
|
-
class: "flex flex-col gap-32",
|
|
1456
|
-
disabled: d.disabled
|
|
1457
|
-
}, {
|
|
1458
|
-
default: V(() => [
|
|
1459
|
-
_("div", Zt, [
|
|
1460
|
-
_("div", en, [
|
|
1461
|
-
C(x, {
|
|
1462
|
-
label: p(t)("inventory.closing.form.name"),
|
|
1463
|
-
"label-mark": "required",
|
|
1464
|
-
modelValue: p(u).name,
|
|
1465
|
-
"onUpdate:modelValue": s[0] || (s[0] = (R) => p(u).name = R),
|
|
1466
|
-
rules: [p(dt)()]
|
|
1467
|
-
}, null, 8, ["label", "modelValue", "rules"]),
|
|
1468
|
-
C(x, {
|
|
1469
|
-
label: p(t)("inventory.closing.form.reference"),
|
|
1470
|
-
"label-mark": "optional",
|
|
1471
|
-
modelValue: p(u).ref,
|
|
1472
|
-
"onUpdate:modelValue": s[1] || (s[1] = (R) => p(u).ref = R)
|
|
1473
|
-
}, null, 8, ["label", "modelValue"])
|
|
1474
|
-
])
|
|
1475
|
-
]),
|
|
1476
|
-
_("div", tn, [
|
|
1477
|
-
_("div", nn, [
|
|
1478
|
-
_("div", on, I(p(t)("inventory.closing.form.locations")), 1),
|
|
1479
|
-
C(F, {
|
|
1480
|
-
disabled: d.disabled,
|
|
1481
|
-
label: p(t)("inventory.closing.form.selectLocation"),
|
|
1482
|
-
"prepend-icon": "add",
|
|
1483
|
-
variant: "plain",
|
|
1484
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
1485
|
-
onClick: p(v)
|
|
1486
|
-
}, null, 8, ["disabled", "label", "onClick"])
|
|
1487
|
-
]),
|
|
1488
|
-
C(S, {
|
|
1489
|
-
"column-defs": p(b),
|
|
1490
|
-
"row-data": p(c),
|
|
1491
|
-
"shrink-at": 9999,
|
|
1492
|
-
onRowClick: p(v),
|
|
1493
|
-
"hide-footer": ""
|
|
1494
|
-
}, null, 8, ["column-defs", "row-data", "onRowClick"])
|
|
1495
|
-
]),
|
|
1496
|
-
_("div", sn, [
|
|
1497
|
-
_("div", ln, [
|
|
1498
|
-
_("div", an, I(p(t)("inventory.closing.form.items.title")), 1),
|
|
1499
|
-
_("div", rn, [
|
|
1500
|
-
p(u).items.length > 0 ? ($(), U(F, {
|
|
1501
|
-
key: 0,
|
|
1502
|
-
disabled: d.disabled,
|
|
1503
|
-
label: h.value ? p(t)("inventory.common.done") : p(t)("inventory.common.rearrange"),
|
|
1504
|
-
"prepend-icon": h.value ? "check" : "swap_vert",
|
|
1505
|
-
variant: h.value ? "primary" : "secondary",
|
|
1506
|
-
class: q(["border-2 rounded-lg", h.value ? "" : "border-fm-color-secondary"]),
|
|
1507
|
-
onClick: f,
|
|
1508
|
-
size: "md"
|
|
1509
|
-
}, null, 8, ["disabled", "label", "prepend-icon", "variant", "class"])) : O("", !0),
|
|
1510
|
-
h.value ? O("", !0) : ($(), U(F, {
|
|
1511
|
-
key: 1,
|
|
1512
|
-
disabled: d.disabled,
|
|
1513
|
-
label: p(t)("inventory.closing.form.items.addItem"),
|
|
1514
|
-
"prepend-icon": "add",
|
|
1515
|
-
variant: "plain",
|
|
1516
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
1517
|
-
onClick: s[2] || (s[2] = (R) => M()),
|
|
1518
|
-
size: "md"
|
|
1519
|
-
}, null, 8, ["disabled", "label"]))
|
|
1520
|
-
])
|
|
1521
|
-
]),
|
|
1522
|
-
h.value ? ($(), D("div", cn, [
|
|
1523
|
-
C(p(et), {
|
|
1524
|
-
modelValue: y.value,
|
|
1525
|
-
"onUpdate:modelValue": s[3] || (s[3] = (R) => y.value = R),
|
|
1526
|
-
"sort-fields": w,
|
|
1527
|
-
"left-column-label": p(t)("inventory.closing.form.items.availableItems"),
|
|
1528
|
-
"right-column-label": p(t)("inventory.closing.form.items.organizedGroups"),
|
|
1529
|
-
height: "600px"
|
|
1530
|
-
}, null, 8, ["modelValue", "left-column-label", "right-column-label"])
|
|
1531
|
-
])) : ($(), D(j, { key: 1 }, [
|
|
1532
|
-
C(x, {
|
|
1533
|
-
placeholder: p(t)("inventory.formField.filterItems"),
|
|
1534
|
-
modelValue: g.value,
|
|
1535
|
-
"onUpdate:modelValue": s[5] || (s[5] = (R) => g.value = R)
|
|
1536
|
-
}, Ee({ _: 2 }, [
|
|
1537
|
-
g.value ? {
|
|
1538
|
-
name: "append",
|
|
1539
|
-
fn: V(() => [
|
|
1540
|
-
C(N, {
|
|
1541
|
-
name: "close",
|
|
1542
|
-
onClick: s[4] || (s[4] = (R) => g.value = ""),
|
|
1543
|
-
class: "cursor-pointer"
|
|
1544
|
-
})
|
|
1545
|
-
]),
|
|
1546
|
-
key: "0"
|
|
1547
|
-
} : void 0
|
|
1548
|
-
]), 1032, ["placeholder", "modelValue"]),
|
|
1549
|
-
_("div", {
|
|
1550
|
-
ref_key: "itemsTableRef",
|
|
1551
|
-
ref: i
|
|
1552
|
-
}, [
|
|
1553
|
-
($(), U(S, {
|
|
1554
|
-
"search-value": g.value,
|
|
1555
|
-
"column-defs": e.value,
|
|
1556
|
-
"row-data": o.value,
|
|
1557
|
-
key: o.value.map((R) => R.sku._id).join("."),
|
|
1558
|
-
"hide-footer": o.value.length <= 10,
|
|
1559
|
-
"page-size": Math.min(10, o.value.length)
|
|
1560
|
-
}, {
|
|
1561
|
-
"list-row": V((R) => [
|
|
1562
|
-
($(), U(ze, {
|
|
1563
|
-
row: R,
|
|
1564
|
-
key: o.value.map((J) => J.sku._id).join(".")
|
|
1565
|
-
}, {
|
|
1566
|
-
default: V((J) => [
|
|
1567
|
-
C(Qt, {
|
|
1568
|
-
row: R,
|
|
1569
|
-
"cell-by-col-id": J
|
|
1570
|
-
}, null, 8, ["row", "cell-by-col-id"])
|
|
1571
|
-
]),
|
|
1572
|
-
_: 2
|
|
1573
|
-
}, 1032, ["row"]))
|
|
1574
|
-
]),
|
|
1575
|
-
_: 1
|
|
1576
|
-
}, 8, ["search-value", "column-defs", "row-data", "hide-footer", "page-size"]))
|
|
1577
|
-
], 512)
|
|
1578
|
-
], 64)),
|
|
1579
|
-
C(H, {
|
|
1580
|
-
"model-value": p(u).items.length,
|
|
1581
|
-
rules: [p(pt)(1)]
|
|
1582
|
-
}, null, 8, ["model-value", "rules"])
|
|
1583
|
-
])
|
|
1584
|
-
]),
|
|
1585
|
-
_: 1
|
|
1586
|
-
}, 8, ["disabled"]);
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
}), un = { class: "flex items-center" }, dn = { class: "fm-typo-en-title-md-600" }, pn = { class: "flex justify-between" }, fn = { class: "fm-typo-en-body-lg-600" }, vn = { class: "flex flex-col gap-8" }, gn = { class: "flex flex-col gap-4" }, yn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, hn = { class: "flex items-center gap-8" }, bn = { class: "fm-typo-en-body-lg-600" }, _n = { class: "flex gap-4" }, xn = /* @__PURE__ */ K({
|
|
1590
|
-
__name: "ClosingTemplateDialog",
|
|
1591
|
-
props: {
|
|
1592
|
-
mode: {},
|
|
1593
|
-
modelValue: {},
|
|
1594
|
-
show: { type: Boolean }
|
|
1595
|
-
},
|
|
1596
|
-
emits: ["update:show", "submitted"],
|
|
1597
|
-
setup(m, { expose: r, emit: a }) {
|
|
1598
|
-
var d;
|
|
1599
|
-
const u = m, t = a, n = me(), v = ie(), b = ce(), { t: c } = W(), l = tt(u, "show");
|
|
1600
|
-
function g() {
|
|
1601
|
-
return {
|
|
1602
|
-
_id: "",
|
|
1603
|
-
name: "",
|
|
1604
|
-
items: []
|
|
1605
|
-
};
|
|
1606
|
-
}
|
|
1607
|
-
const i = A(u.modelValue ?? g()), h = A(((d = u.modelValue) == null ? void 0 : d._id) ?? `${Math.random()}`);
|
|
1608
|
-
Pe(
|
|
1609
|
-
() => u.show,
|
|
1610
|
-
(s) => {
|
|
1611
|
-
var x;
|
|
1612
|
-
s && (i.value = u.modelValue ?? g(), h.value = ((x = u.modelValue) == null ? void 0 : x._id) ?? `${Math.random()}`);
|
|
1613
|
-
}
|
|
1614
|
-
);
|
|
1615
|
-
const w = A(!1), y = L(() => {
|
|
1616
|
-
switch (u.mode) {
|
|
1617
|
-
case G.READ:
|
|
1618
|
-
return "";
|
|
1619
|
-
case G.CREATE:
|
|
1620
|
-
return c("inventory.closing.template.create.title");
|
|
1621
|
-
case G.UPDATE:
|
|
1622
|
-
return c("inventory.closing.template.update.title");
|
|
1623
|
-
}
|
|
1624
|
-
return "";
|
|
1625
|
-
}), o = A();
|
|
1626
|
-
r({
|
|
1627
|
-
validateInputs: () => {
|
|
1628
|
-
var s, x;
|
|
1629
|
-
(x = (s = o.value) == null ? void 0 : s.validateInputs) == null || x.call(s);
|
|
1630
|
-
},
|
|
1631
|
-
resetInputsValidation: () => {
|
|
1632
|
-
var s, x;
|
|
1633
|
-
(x = (s = o.value) == null ? void 0 : s.resetInputsValidation) == null || x.call(s);
|
|
1634
|
-
},
|
|
1635
|
-
resetInputs: () => {
|
|
1636
|
-
var s, x;
|
|
1637
|
-
(x = (s = o.value) == null ? void 0 : s.resetInputs) == null || x.call(s);
|
|
1638
|
-
}
|
|
1639
|
-
});
|
|
1640
|
-
async function f() {
|
|
1641
|
-
const s = i.value;
|
|
1642
|
-
if (s) {
|
|
1643
|
-
w.value = !0;
|
|
1644
|
-
try {
|
|
1645
|
-
await n.createTemplate(s), await new Promise((x) => setTimeout(x, 1e3)), b.open({
|
|
1646
|
-
title: c("inventory.closing.template.create.success"),
|
|
1647
|
-
message: c("inventory.closing.template.create.successMessage"),
|
|
1648
|
-
type: "success"
|
|
1649
|
-
}), t("update:show", !1), t("submitted");
|
|
1650
|
-
} catch (x) {
|
|
1651
|
-
b.open({
|
|
1652
|
-
title: c("inventory.closing.template.create.error"),
|
|
1653
|
-
message: c("inventory.closing.template.create.errorMessage"),
|
|
1654
|
-
type: "error"
|
|
1655
|
-
}), console.error("Error in creating closing template", x);
|
|
1656
|
-
} finally {
|
|
1657
|
-
w.value = !1;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
async function T() {
|
|
1662
|
-
const s = i.value;
|
|
1663
|
-
if (s) {
|
|
1664
|
-
w.value = !0, delete s.updatedAt;
|
|
1665
|
-
try {
|
|
1666
|
-
await n.updateTemplate({
|
|
1667
|
-
...s,
|
|
1668
|
-
_rev: s._rev ?? ""
|
|
1669
|
-
}), await new Promise((x) => setTimeout(x, 1e3)), b.open({
|
|
1670
|
-
title: c("inventory.closing.template.update.success"),
|
|
1671
|
-
message: c("inventory.closing.template.update.successMessage"),
|
|
1672
|
-
type: "success"
|
|
1673
|
-
}), t("update:show", !1), t("submitted");
|
|
1674
|
-
} catch (x) {
|
|
1675
|
-
b.open({
|
|
1676
|
-
title: c("inventory.closing.template.update.error"),
|
|
1677
|
-
message: c("inventory.closing.template.update.errorMessage"),
|
|
1678
|
-
type: "error"
|
|
1679
|
-
}), console.error("Error in updating closing template", x);
|
|
1680
|
-
} finally {
|
|
1681
|
-
w.value = !1;
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
function e() {
|
|
1686
|
-
switch (u.mode) {
|
|
1687
|
-
case G.CREATE:
|
|
1688
|
-
return f();
|
|
1689
|
-
case G.UPDATE:
|
|
1690
|
-
return T();
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
function k() {
|
|
1694
|
-
var s, x;
|
|
1695
|
-
(x = (s = o.value) == null ? void 0 : s.validateInputs) == null || x.call(s);
|
|
1696
|
-
}
|
|
1697
|
-
function M() {
|
|
1698
|
-
i.value && v.exportSingleTemplate(i.value);
|
|
1699
|
-
}
|
|
1700
|
-
return (s, x) => {
|
|
1701
|
-
const F = E("FmMenuDivider"), S = E("FmCard"), N = E("FmButton"), H = E("FmSideSheet");
|
|
1702
|
-
return $(), U(H, {
|
|
1703
|
-
modelValue: p(l),
|
|
1704
|
-
"onUpdate:modelValue": x[2] || (x[2] = (B) => Ye(l) ? l.value = B : null),
|
|
1705
|
-
"dismiss-away": "",
|
|
1706
|
-
"close-button": "",
|
|
1707
|
-
"max-width": 9999
|
|
1708
|
-
}, {
|
|
1709
|
-
"side-sheet-header": V(() => [
|
|
1710
|
-
_("div", un, [
|
|
1711
|
-
_("div", dn, I(y.value), 1)
|
|
1712
|
-
])
|
|
1713
|
-
]),
|
|
1714
|
-
default: V(() => [
|
|
1715
|
-
i.value.updatedAt ? ($(), U(S, {
|
|
1716
|
-
key: 0,
|
|
1717
|
-
variant: "outlined",
|
|
1718
|
-
class: "flex flex-col gap-8 px-12 py-16 mb-16"
|
|
1719
|
-
}, {
|
|
1720
|
-
default: V(() => {
|
|
1721
|
-
var B;
|
|
1722
|
-
return [
|
|
1723
|
-
_("div", pn, [
|
|
1724
|
-
_("div", fn, I(p(c)("inventory.transfer.template.details.templateSummary")), 1)
|
|
1725
|
-
]),
|
|
1726
|
-
C(F),
|
|
1727
|
-
_("div", vn, [
|
|
1728
|
-
_("div", gn, [
|
|
1729
|
-
_("div", yn, I(p(c)("inventory.transfer.receiveRequest.details.updatedAt")), 1),
|
|
1730
|
-
_("div", hn, [
|
|
1731
|
-
_("div", bn, [
|
|
1732
|
-
ae(I(p(le)(i.value.updatedAt)) + " ", 1),
|
|
1733
|
-
(B = i.value.updatedBy) != null && B.name ? ($(), D(j, { key: 0 }, [
|
|
1734
|
-
ae(" (" + I(i.value.updatedBy.name) + ") ", 1)
|
|
1735
|
-
], 64)) : O("", !0)
|
|
1736
|
-
]),
|
|
1737
|
-
C(yt, {
|
|
1738
|
-
"closing-id": i.value._id
|
|
1739
|
-
}, null, 8, ["closing-id"])
|
|
1740
|
-
])
|
|
1741
|
-
])
|
|
1742
|
-
])
|
|
1743
|
-
];
|
|
1744
|
-
}),
|
|
1745
|
-
_: 1
|
|
1746
|
-
})) : O("", !0),
|
|
1747
|
-
($(), U(mn, {
|
|
1748
|
-
class: "w-full",
|
|
1749
|
-
ref_key: "formRef",
|
|
1750
|
-
ref: o,
|
|
1751
|
-
onValidationSuccess: e,
|
|
1752
|
-
"model-value": i.value,
|
|
1753
|
-
"onUpdate:modelValue": x[0] || (x[0] = (B) => i.value = B),
|
|
1754
|
-
disabled: w.value,
|
|
1755
|
-
key: h.value
|
|
1756
|
-
}, null, 8, ["model-value", "disabled"]))
|
|
1757
|
-
]),
|
|
1758
|
-
"side-sheet-footer": V(() => [
|
|
1759
|
-
_("div", _n, [
|
|
1760
|
-
C(N, {
|
|
1761
|
-
loading: w.value,
|
|
1762
|
-
label: p(c)("common.save"),
|
|
1763
|
-
onClick: k
|
|
1764
|
-
}, null, 8, ["loading", "label"]),
|
|
1765
|
-
s.mode === p(G).UPDATE ? ($(), U(N, {
|
|
1766
|
-
key: 0,
|
|
1767
|
-
disabled: w.value,
|
|
1768
|
-
variant: "secondary",
|
|
1769
|
-
label: p(c)("inventory.common.export"),
|
|
1770
|
-
"prepend-icon": "download",
|
|
1771
|
-
onClick: M
|
|
1772
|
-
}, null, 8, ["disabled", "label"])) : O("", !0),
|
|
1773
|
-
C(N, {
|
|
1774
|
-
disabled: w.value,
|
|
1775
|
-
variant: "tertiary",
|
|
1776
|
-
label: p(c)("common.close"),
|
|
1777
|
-
onClick: x[1] || (x[1] = (B) => t("update:show", !1))
|
|
1778
|
-
}, null, 8, ["disabled", "label"])
|
|
1779
|
-
])
|
|
1780
|
-
]),
|
|
1781
|
-
_: 1
|
|
1782
|
-
}, 8, ["modelValue"]);
|
|
1783
|
-
};
|
|
1784
|
-
}
|
|
1785
|
-
}), wn = {};
|
|
1786
|
-
function kn(m, r) {
|
|
1787
|
-
return $(), D("div");
|
|
1788
|
-
}
|
|
1789
|
-
const Tn = /* @__PURE__ */ ht(wn, [["render", kn]]), $n = { class: "flex flex-col gap-40" }, Cn = { key: 0 }, In = {
|
|
1790
|
-
key: 1,
|
|
1791
|
-
class: "flex gap-8 items-center"
|
|
1792
|
-
}, Sn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, Dn = {
|
|
1793
|
-
key: 2,
|
|
1794
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
|
|
1795
|
-
}, Mn = {
|
|
1796
|
-
key: 3,
|
|
1797
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
|
|
1798
|
-
}, Fn = { class: "fm-typo-en-body-md-600" }, An = { class: "fm-typo-en-body-md-600" }, Rn = { key: 4 }, Pn = { class: "fm-typo-en-body-md-600" }, En = { class: "fm-typo-en-body-md-600" }, Vn = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, Nn = /* @__PURE__ */ K({
|
|
1799
|
-
__name: "ClosingTemplatePublish",
|
|
1800
|
-
emits: ["close"],
|
|
1801
|
-
setup(m, { emit: r }) {
|
|
1802
|
-
const a = A(!1), u = ce(), t = me(), n = ue(), { t: v } = W(), b = r;
|
|
1803
|
-
async function c() {
|
|
1804
|
-
a.value = !0;
|
|
1805
|
-
try {
|
|
1806
|
-
await t.startNewPublish().delayed(1e3), u.open({
|
|
1807
|
-
title: "Success",
|
|
1808
|
-
message: "You may refresh after a while to review publish status",
|
|
1809
|
-
type: "success"
|
|
1810
|
-
}), i();
|
|
1811
|
-
} catch (h) {
|
|
1812
|
-
u.open({
|
|
1813
|
-
title: "Something went wrong",
|
|
1814
|
-
message: "Please try again",
|
|
1815
|
-
type: "error"
|
|
1816
|
-
}), console.error("error on creating publish task", h);
|
|
1817
|
-
} finally {
|
|
1818
|
-
a.value = !1;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
const l = L(() => n.recentPublish.recentJob), g = L(
|
|
1822
|
-
() => n.templates.length && (!l.value || l.value.outlets.length === l.value.completed.length)
|
|
1823
|
-
);
|
|
1824
|
-
function i() {
|
|
1825
|
-
b("close");
|
|
1826
|
-
}
|
|
1827
|
-
return (h, w) => {
|
|
1828
|
-
const y = E("FmCircularProgress"), o = E("i18n-t"), f = E("FmButton");
|
|
1829
|
-
return $(), D("div", $n, [
|
|
1830
|
-
p(n).templates.length ? a.value ? ($(), D("div", In, [
|
|
1831
|
-
_("div", null, [
|
|
1832
|
-
C(y, {
|
|
1833
|
-
size: "md",
|
|
1834
|
-
color: "neutral-gray-300"
|
|
1835
|
-
})
|
|
1836
|
-
]),
|
|
1837
|
-
_("div", Sn, [
|
|
1838
|
-
_("span", null, I(p(v)("inventory.closing.template.publish.publishing")), 1)
|
|
1839
|
-
])
|
|
1840
|
-
])) : l.value ? l.value.outlets.length === l.value.completed.length ? ($(), D("div", Mn, [
|
|
1841
|
-
C(o, {
|
|
1842
|
-
keypath: "inventory.closing.template.publish.recentlyPublishedAt",
|
|
1843
|
-
tag: "p"
|
|
1844
|
-
}, {
|
|
1845
|
-
started: V(() => [
|
|
1846
|
-
_("span", Fn, I(p(le)(new Date(l.value.createdAt))), 1)
|
|
1847
|
-
]),
|
|
1848
|
-
finished: V(() => [
|
|
1849
|
-
_("span", An, I(p(le)(new Date(l.value.updatedAt))), 1)
|
|
1850
|
-
]),
|
|
1851
|
-
_: 1
|
|
1852
|
-
}),
|
|
1853
|
-
_("p", null, I(p(v)("inventory.closing.template.publish.message")), 1)
|
|
1854
|
-
])) : ($(), D("div", Rn, [
|
|
1855
|
-
C(o, {
|
|
1856
|
-
keypath: "inventory.closing.template.publish.stillPublishing",
|
|
1857
|
-
tag: "p"
|
|
1858
|
-
}, {
|
|
1859
|
-
started: V(() => [
|
|
1860
|
-
_("span", Pn, I(p(le)(new Date(l.value.createdAt))), 1)
|
|
1861
|
-
]),
|
|
1862
|
-
progress: V(() => [
|
|
1863
|
-
_("span", En, " (" + I(l.value.completed.length) + "/" + I(l.value.outlets.length) + " completed) ", 1)
|
|
1864
|
-
]),
|
|
1865
|
-
_: 1
|
|
1866
|
-
}),
|
|
1867
|
-
ae(" Your recent publishing task is still pending (" + I(l.value.completed.length) + " / " + I(l.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
|
|
1868
|
-
])) : ($(), D("div", Dn, [
|
|
1869
|
-
_("p", null, I(p(v)("inventory.closing.template.publish.noRecentActivity")), 1),
|
|
1870
|
-
_("p", null, I(p(v)("inventory.closing.template.publish.message")), 1)
|
|
1871
|
-
])) : ($(), D("div", Cn, [
|
|
1872
|
-
_("p", null, I(p(v)("inventory.closing.template.publish.nothingToPublish")), 1)
|
|
1873
|
-
])),
|
|
1874
|
-
_("div", Vn, [
|
|
1875
|
-
C(f, {
|
|
1876
|
-
disabled: !g.value,
|
|
1877
|
-
loading: a.value,
|
|
1878
|
-
label: "Publish to all outlets",
|
|
1879
|
-
onClick: c
|
|
1880
|
-
}, null, 8, ["disabled", "loading"]),
|
|
1881
|
-
C(f, {
|
|
1882
|
-
variant: "tertiary",
|
|
1883
|
-
label: "Close",
|
|
1884
|
-
onClick: i
|
|
1885
|
-
})
|
|
1886
|
-
])
|
|
1887
|
-
]);
|
|
1888
|
-
};
|
|
1889
|
-
}
|
|
1890
|
-
}), Un = { class: "flex-1 flex flex-col gap-8" }, Ln = { class: "flex flex-col" }, Bn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, zn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Hn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, On = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, go = /* @__PURE__ */ K({
|
|
1891
|
-
__name: "ClosingTemplateView",
|
|
1892
|
-
setup(m) {
|
|
1893
|
-
const { t: r } = W(), { createTemplate: a, updateTemplate: u, exportTemplates: t, importTemplates: n } = ie(), { templateDialogProps: v, templateDetailsProps: b } = Ne(ie()), c = fe(), l = pe(), g = ue(), i = Xe(), { breakpoints: h } = nt();
|
|
1894
|
-
c.watchLocation(g.fetchTemplates);
|
|
1895
|
-
const w = L(() => g.loading), y = A(""), o = L(() => h.value.xs || h.value.sm), f = L(() => o.value ? 10 : 20);
|
|
1896
|
-
function T(d) {
|
|
1897
|
-
switch (d) {
|
|
1898
|
-
case z.Add:
|
|
1899
|
-
return a();
|
|
1900
|
-
case "publish":
|
|
1901
|
-
return e();
|
|
1902
|
-
case "import":
|
|
1903
|
-
return n();
|
|
1904
|
-
case "export":
|
|
1905
|
-
return t();
|
|
1906
|
-
case "refresh":
|
|
1907
|
-
return g.fetchTemplates();
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
function e() {
|
|
1911
|
-
l.open({
|
|
1912
|
-
title: "Publish closing templates",
|
|
1913
|
-
contentComponent: Nn,
|
|
1914
|
-
contentComponentProps: {
|
|
1915
|
-
onClose() {
|
|
1916
|
-
l.close();
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
});
|
|
1920
|
-
}
|
|
1921
|
-
function k(d) {
|
|
1922
|
-
return d;
|
|
1923
|
-
}
|
|
1924
|
-
const M = L(() => o.value ? [
|
|
1925
|
-
{
|
|
1926
|
-
label: r("inventory.closing.template.create.title"),
|
|
1927
|
-
value: z.Add,
|
|
1928
|
-
isPrimary: !0,
|
|
1929
|
-
prependIcon: "add"
|
|
1930
|
-
},
|
|
1931
|
-
{
|
|
1932
|
-
label: r("inventory.common.refresh"),
|
|
1933
|
-
value: "refresh",
|
|
1934
|
-
isPrimary: !1
|
|
1935
|
-
},
|
|
1936
|
-
{
|
|
1937
|
-
label: r("inventory.common.publish"),
|
|
1938
|
-
value: "publish",
|
|
1939
|
-
isPrimary: !1
|
|
1940
|
-
},
|
|
1941
|
-
{
|
|
1942
|
-
label: r("inventory.common.import"),
|
|
1943
|
-
value: "import",
|
|
1944
|
-
isPrimary: !1
|
|
1945
|
-
},
|
|
1946
|
-
{
|
|
1947
|
-
label: r("inventory.common.export"),
|
|
1948
|
-
value: "export",
|
|
1949
|
-
isPrimary: !1
|
|
1950
|
-
}
|
|
1951
|
-
] : [
|
|
1952
|
-
{
|
|
1953
|
-
label: r("inventory.closing.template.create.title"),
|
|
1954
|
-
value: z.Add,
|
|
1955
|
-
isPrimary: !0,
|
|
1956
|
-
prependIcon: "add"
|
|
1957
|
-
},
|
|
1958
|
-
{
|
|
1959
|
-
label: r("inventory.common.publish"),
|
|
1960
|
-
value: "publish",
|
|
1961
|
-
isPrimary: !1
|
|
1962
|
-
},
|
|
1963
|
-
{
|
|
1964
|
-
label: r("inventory.common.import"),
|
|
1965
|
-
value: "import",
|
|
1966
|
-
isPrimary: !1
|
|
1967
|
-
},
|
|
1968
|
-
{
|
|
1969
|
-
label: r("inventory.common.refresh"),
|
|
1970
|
-
value: "refresh",
|
|
1971
|
-
isPrimary: !1
|
|
1972
|
-
},
|
|
1973
|
-
{
|
|
1974
|
-
label: r("inventory.common.export"),
|
|
1975
|
-
value: "export",
|
|
1976
|
-
isPrimary: !1
|
|
1977
|
-
}
|
|
1978
|
-
]);
|
|
1979
|
-
return (d, s) => {
|
|
1980
|
-
const x = E("FmTable");
|
|
1981
|
-
return $(), D(j, null, [
|
|
1982
|
-
C(Qe, {
|
|
1983
|
-
title: p(r)("inventory.closing.template.title"),
|
|
1984
|
-
actions: M.value,
|
|
1985
|
-
"onClick:action": T
|
|
1986
|
-
}, {
|
|
1987
|
-
default: V(() => [
|
|
1988
|
-
_("div", {
|
|
1989
|
-
class: q([
|
|
1990
|
-
"flex flex-col gap-8 max-h-full",
|
|
1991
|
-
{
|
|
1992
|
-
"p-0": o.value,
|
|
1993
|
-
"px-24 ": !o.value
|
|
1994
|
-
}
|
|
1995
|
-
])
|
|
1996
|
-
}, [
|
|
1997
|
-
C(ut, {
|
|
1998
|
-
searchable: "",
|
|
1999
|
-
search: y.value,
|
|
2000
|
-
"onUpdate:search": s[0] || (s[0] = (F) => y.value = F)
|
|
2001
|
-
}, null, 8, ["search"]),
|
|
2002
|
-
C(x, {
|
|
2003
|
-
style: Ge(p(i).tableHeight),
|
|
2004
|
-
"column-defs": p(g).columnDefs,
|
|
2005
|
-
"row-data": p(g).templates,
|
|
2006
|
-
"search-value": y.value,
|
|
2007
|
-
loading: w.value,
|
|
2008
|
-
onRowClick: s[1] || (s[1] = (F) => p(u)(F.original)),
|
|
2009
|
-
"page-size": f.value
|
|
2010
|
-
}, {
|
|
2011
|
-
"list-row": V((F) => [
|
|
2012
|
-
C(ze, {
|
|
2013
|
-
row: F,
|
|
2014
|
-
onRowClick: (S) => p(u)(S)
|
|
2015
|
-
}, {
|
|
2016
|
-
default: V((S) => {
|
|
2017
|
-
var N, H, B, R, J, be, _e, xe, ee, we, ke, Te, $e, Ce, Ie, te, Se, De, Me, Fe, ne, Ae;
|
|
2018
|
-
return [
|
|
2019
|
-
_("div", Un, [
|
|
2020
|
-
_("div", Ln, [
|
|
2021
|
-
_("div", Bn, [
|
|
2022
|
-
C(p(X), {
|
|
2023
|
-
render: (B = (H = (N = S._id) == null ? void 0 : N.column) == null ? void 0 : H.columnDef) == null ? void 0 : B.cell,
|
|
2024
|
-
props: (J = (R = S._id) == null ? void 0 : R.getContext) == null ? void 0 : J.call(R)
|
|
2025
|
-
}, null, 8, ["render", "props"])
|
|
2026
|
-
]),
|
|
2027
|
-
_("div", zn, [
|
|
2028
|
-
C(p(X), {
|
|
2029
|
-
render: (xe = (_e = (be = S.name) == null ? void 0 : be.column) == null ? void 0 : _e.columnDef) == null ? void 0 : xe.cell,
|
|
2030
|
-
props: (we = (ee = S.name) == null ? void 0 : ee.getContext) == null ? void 0 : we.call(ee)
|
|
2031
|
-
}, null, 8, ["render", "props"])
|
|
2032
|
-
]),
|
|
2033
|
-
_("div", null, I((ke = F.original.locations) != null && ke.length ? p(r)("inventory.closing.table.enabledForN", {
|
|
2034
|
-
count: ((Te = F.original.locations) == null ? void 0 : Te.length) ?? 0
|
|
2035
|
-
}) : p(r)("inventory.closing.table.enabledForAll")), 1),
|
|
2036
|
-
_("div", Hn, I([
|
|
2037
|
-
...F.original.items.slice(0, 3).map((je) => je.sku.name),
|
|
2038
|
-
...F.original.items.length >= 3 ? [`and ${F.original.items.length - 3} more items`] : []
|
|
2039
|
-
].join(", ")), 1),
|
|
2040
|
-
_("div", On, [
|
|
2041
|
-
C(p(X), {
|
|
2042
|
-
render: (Ie = (Ce = ($e = S.ref) == null ? void 0 : $e.column) == null ? void 0 : Ce.columnDef) == null ? void 0 : Ie.cell,
|
|
2043
|
-
props: (Se = (te = S.ref) == null ? void 0 : te.getContext) == null ? void 0 : Se.call(te)
|
|
2044
|
-
}, null, 8, ["render", "props"])
|
|
2045
|
-
])
|
|
2046
|
-
]),
|
|
2047
|
-
_("div", null, [
|
|
2048
|
-
C(p(X), {
|
|
2049
|
-
render: (Fe = (Me = (De = S.status) == null ? void 0 : De.column) == null ? void 0 : Me.columnDef) == null ? void 0 : Fe.cell,
|
|
2050
|
-
props: (Ae = (ne = S.status) == null ? void 0 : ne.getContext) == null ? void 0 : Ae.call(ne)
|
|
2051
|
-
}, null, 8, ["render", "props"])
|
|
2052
|
-
])
|
|
2053
|
-
])
|
|
2054
|
-
];
|
|
2055
|
-
}),
|
|
2056
|
-
_: 2
|
|
2057
|
-
}, 1032, ["row", "onRowClick"])
|
|
2058
|
-
]),
|
|
2059
|
-
_: 1
|
|
2060
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
2061
|
-
], 2)
|
|
2062
|
-
]),
|
|
2063
|
-
_: 1
|
|
2064
|
-
}, 8, ["title", "actions"]),
|
|
2065
|
-
($(), U(Ke, { to: "body" }, [
|
|
2066
|
-
C(Tn, We(qe(p(b))), null, 16),
|
|
2067
|
-
C(xn, Je(p(v), {
|
|
2068
|
-
onSubmitted: s[2] || (s[2] = (F) => p(g).fetchTemplates())
|
|
2069
|
-
}), null, 16)
|
|
2070
|
-
]))
|
|
2071
|
-
], 64);
|
|
2072
|
-
};
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
export {
|
|
2076
|
-
go as default
|
|
2077
|
-
};
|