@feedmepos/mf-inventory-portal 0.0.22-dev.5 → 0.0.22-dev.50
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/ApprovalView-CyIOcyG5.js +140 -0
- package/dist/{BindingsDialog-DQJhC3Mo.js → BindingsDialog-BXePN5iL.js} +10 -10
- package/dist/{BindingsPicker-YfbPb_dG.js → BindingsPicker-Bd_qb0aO.js} +15 -15
- package/dist/{BindingsTable-D3MVcHXZ.js → BindingsTable-BV-nP9HU.js} +4 -4
- package/dist/ClosingTemplateView-CSvWLccZ.js +1829 -0
- package/dist/FmDroppableField-DwZ6ujPh.js +154 -0
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DpCoW_-F.js +266 -0
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js +435 -0
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-C8k7pSPT.js +51 -0
- package/dist/IngredientGroupView-C0hPeD41.js +608 -0
- package/dist/IngredientsView-CpwVIGXd.js +1608 -0
- package/dist/IntegrationView-Bt8pGAHS.js +1225 -0
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-wsBLYBpB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yA-qJUUz.js} +1 -1
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BqcqoKyN.js +116 -0
- package/dist/{PurchaseOrderPrintPreview-BcAmgmD8.js → PurchaseOrderPrintPreview-D3ugzCW_.js} +7 -7
- package/dist/ReceiveRequestView-D14YTEEe.js +4073 -0
- package/dist/RecipeView-D0WsMfKm.js +594 -0
- package/dist/Standalone.vue.d.ts +2 -0
- package/dist/StockView-sxI0L6MP.js +7770 -0
- package/dist/SupplierView-clAkARuW.js +1468 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9NU1m6S.js +1150 -0
- package/dist/TransferTemplateView-DpI6kVqX.js +1258 -0
- package/dist/{UnitView-B95q8Xrj.js → UnitView-CneJsDum.js} +18 -18
- package/dist/{WarehouseView-CHGXvyeS.js → WarehouseView-DYbFWTlh.js} +176 -177
- package/dist/api/bill.d.ts +84 -238
- package/dist/api/closing-template.d.ts +6 -4
- package/dist/api/inventory.d.ts +282 -91
- package/dist/api/netsuite.d.ts +71 -0
- package/dist/api/purchase-order-template.d.ts +4 -6
- package/dist/api/supplier.d.ts +1 -0
- package/dist/{app-CfXF4jdF.js → app-B4pi48sM.js} +26414 -24985
- package/dist/app.d.ts +88 -3
- package/dist/app.js +3 -3
- package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
- package/dist/components/FmMinMaxInputRules.d.ts +2 -0
- package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
- package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
- package/dist/components/FmUnitInputRules.d.ts +2 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
- package/dist/components/map/GoogleMap.vue.d.ts +4 -4
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
- package/dist/{decimal-BZ7tX47r.js → decimal-C8O2p3Sg.js} +1 -1
- package/dist/defineDeepModel-BXP1vLGf.js +13 -0
- package/dist/extensions/array.d.ts +1 -0
- package/dist/format-time-from-id-DgW7OJL_.js +15 -0
- package/dist/format-unit-display-BP4O0Pym.js +1195 -0
- package/dist/helper/rules.d.ts +7 -0
- package/dist/helper/rules.spec.d.ts +1 -0
- package/dist/helper/xlsx.util.d.ts +7 -0
- package/dist/router/name.d.ts +1 -0
- package/dist/stores/api.d.ts +1 -0
- package/dist/stores/feature.d.ts +0 -1
- package/dist/stores/helper/core-store-proxy.d.ts +3 -0
- package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
- package/dist/stores/integration/foodmarkethub.d.ts +391 -0
- package/dist/stores/integration/index.d.ts +7 -0
- package/dist/stores/integration/netsuite.d.ts +102 -0
- package/dist/stores/inventory.d.ts +294 -9
- package/dist/stores/location.d.ts +508 -503
- package/dist/stores/supplier.d.ts +124 -4
- package/dist/style.css +1 -1
- package/dist/supplier-D-8XhuF_.js +77 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/use-template-enabled-locations-2-C2E4j3k-.js +85 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +877 -1038
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1049
- package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
- package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
- package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
- package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
- package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
- package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
- package/dist/views/integration/NetSuite.vue.d.ts +2 -0
- package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
- package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1961 -87
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2377 -292
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2329 -244
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
- package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +32 -2
- package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
- package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
- package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
- package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
- package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
- package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
- package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
- package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1277 -1478
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1697 -906
- package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
- package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -247
- package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
- package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
- package/dist/{xlsx-BtP1Qjj6.js → xlsx-Dsy-fxZw.js} +1525 -1525
- package/dist/xlsx.util-CxGmvsp9.js +78 -0
- package/package.json +10 -7
- package/dist/ApprovalView-BdaNwUBc.js +0 -129
- package/dist/ClosingTemplateView-BpErgepi.js +0 -1030
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D3B7kOlU.js +0 -372
- package/dist/IngredientsView-GqrkpCm5.js +0 -1758
- package/dist/IntegrationView-7c3MpUzS.js +0 -1141
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BIwdObb1.js +0 -88
- package/dist/ReceiveRequestView-BAuXvzQW.js +0 -215
- package/dist/RecipeView-C6tZPQ-K.js +0 -581
- package/dist/StockView-4uXHYz4E.js +0 -1892
- package/dist/SupplierView-CuWvKCWY.js +0 -827
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CTQ9HIqf.js +0 -740
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang--6JoXOLD.js +0 -1409
- package/dist/TransferTemplateView-D1Lfi3aW.js +0 -1230
- package/dist/defineDeepModel-BKAs9qN6.js +0 -13
- package/dist/format-time-from-id-B7ZE4sdX.js +0 -15
- package/dist/id-to-date-D1lOqIir.js +0 -30
- package/dist/purchase-order-transaction-type-tZ7cj1dz.js +0 -702
- package/dist/supplier-BIDBk5S6.js +0 -69
- package/dist/use-template-enabled-locations-DlMnS9WJ.js +0 -57
- package/dist/xlsx.util-BKFiH-ig.js +0 -109
|
@@ -0,0 +1,1258 @@
|
|
|
1
|
+
import { defineComponent as Z, onMounted as ce, computed as R, ref as B, watch as pe, inject as We, resolveComponent as O, openBlock as D, createElementBlock as Q, createElementVNode as t, createVNode as p, withCtx as E, renderSlot as Ie, withDirectives as Ve, normalizeClass as ie, vModelText as De, reactive as Ze, h as W, toDisplayString as C, unref as e, createBlock as K, mergeProps as Ue, isRef as Ee, createCommentVNode as Y, Fragment as qe, renderList as Je, normalizeStyle as Xe, Teleport as Ye, normalizeProps as et, guardReactiveProps as tt } from "vue";
|
|
2
|
+
import { u as ot, _ as st, a as lt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js";
|
|
3
|
+
import { useI18n as J } from "@feedmepos/mf-common";
|
|
4
|
+
import { P as N, a as nt, f as rt, t as at, b as Re, u as it } from "./format-unit-display-BP4O0Pym.js";
|
|
5
|
+
import { F as ee, R as Ae } from "./row-action.enum-PMKMRrZR.js";
|
|
6
|
+
import { ah as ue, t as Pe, I as ut, ai as mt, aj as dt, a as G, ak as ct, D as Le, R as me, u as Ne, a3 as pt, a6 as ft, a4 as yt, s as ae, a5 as vt, m as bt, A as de, M as _t, b as ze, i as je, j as xt, l as ht, al as ne, G as gt } from "./app-B4pi48sM.js";
|
|
7
|
+
import { components as re, useDialog as Ft, useSnackbar as Tt, useProxiedModel as He, useBreakpoints as wt } from "@feedmepos/ui-library";
|
|
8
|
+
import { storeToRefs as Be } from "pinia";
|
|
9
|
+
import "vue-router";
|
|
10
|
+
import { d as Qe } from "./defineDeepModel-BXP1vLGf.js";
|
|
11
|
+
import { c as kt, u as Mt, _ as St } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DpCoW_-F.js";
|
|
12
|
+
import { u as $t } from "./supplier-D-8XhuF_.js";
|
|
13
|
+
import { F as j, _ as Ge } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
14
|
+
import { u as Ct } from "./use-template-enabled-locations-2-C2E4j3k-.js";
|
|
15
|
+
import { f as Ot } from "./format-time-from-id-DgW7OJL_.js";
|
|
16
|
+
const It = { class: "flex flex-col" }, Vt = { class: "flex flex-col" }, Dt = { class: "flex-1" }, Rt = { class: "flex items-center" }, At = { class: "flex-1" }, Pt = { class: "flex-1" }, Lt = /* @__PURE__ */ Z({
|
|
17
|
+
__name: "FmMinMaxInput",
|
|
18
|
+
props: {
|
|
19
|
+
rules: {},
|
|
20
|
+
label: {},
|
|
21
|
+
minPlaceholder: {},
|
|
22
|
+
maxPlaceholder: {},
|
|
23
|
+
modelValue: {},
|
|
24
|
+
precision: {},
|
|
25
|
+
minLength: {},
|
|
26
|
+
maxLength: {},
|
|
27
|
+
inputmode: {},
|
|
28
|
+
type: {},
|
|
29
|
+
readonly: { type: Boolean },
|
|
30
|
+
labelMark: {},
|
|
31
|
+
prependIcon: {},
|
|
32
|
+
appendIcon: {},
|
|
33
|
+
showValidBorder: { type: Boolean },
|
|
34
|
+
labelInfo: {},
|
|
35
|
+
showWordCount: { type: Boolean },
|
|
36
|
+
invalid: { type: Boolean },
|
|
37
|
+
autofocus: { type: Boolean },
|
|
38
|
+
formatter: { type: Function },
|
|
39
|
+
decimal: {},
|
|
40
|
+
datalist: {},
|
|
41
|
+
shiftDatalist: { type: Boolean },
|
|
42
|
+
datalistMaxHeight: {},
|
|
43
|
+
datalistMinHeight: {},
|
|
44
|
+
offsetDatalist: {},
|
|
45
|
+
datalistPlacement: {},
|
|
46
|
+
datalistZIndex: {},
|
|
47
|
+
datalistWidth: {},
|
|
48
|
+
disabled: { type: Boolean },
|
|
49
|
+
focused: { type: Boolean },
|
|
50
|
+
helperText: {},
|
|
51
|
+
helperState: {}
|
|
52
|
+
},
|
|
53
|
+
setup(b) {
|
|
54
|
+
const _ = b, d = Qe("modelValue"), l = ut();
|
|
55
|
+
ce(() => {
|
|
56
|
+
const { min: v, max: a } = d ?? {};
|
|
57
|
+
if (!(!v || !a) && v.precision !== a.precision) {
|
|
58
|
+
const h = Math.max(v.precision, a.precision), r = ue(v, h), y = ue(a, h);
|
|
59
|
+
d.min = r, d.max = y;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const c = R(() => {
|
|
63
|
+
const { min: v, max: a } = d ?? {};
|
|
64
|
+
return Math.max((v == null ? void 0 : v.precision) ?? 0, (a == null ? void 0 : a.precision) ?? 0, _.precision ?? 0);
|
|
65
|
+
}), m = (v) => {
|
|
66
|
+
if (!v) return "";
|
|
67
|
+
const a = mt(v), h = c.value, r = ue(a, h);
|
|
68
|
+
return dt(
|
|
69
|
+
+G(r),
|
|
70
|
+
r.precision
|
|
71
|
+
);
|
|
72
|
+
}, o = B(m(d.min)), u = B(m(d.max));
|
|
73
|
+
pe([o, u], ([v, a]) => {
|
|
74
|
+
const h = d ?? {}, r = l(v), y = l(a), s = c.value;
|
|
75
|
+
if (v !== "" && r === !0) {
|
|
76
|
+
const n = Pe(+v, s);
|
|
77
|
+
h.min = n;
|
|
78
|
+
} else
|
|
79
|
+
h.min = null;
|
|
80
|
+
if (a !== "" && y === !0) {
|
|
81
|
+
const n = Pe(+a, s);
|
|
82
|
+
h.max = n;
|
|
83
|
+
} else
|
|
84
|
+
h.max = null;
|
|
85
|
+
d.min = h.min, d.max = h.max;
|
|
86
|
+
});
|
|
87
|
+
const x = Symbol.for("fm:form-state"), T = We(x, null), S = R(() => _.disabled ?? (T == null ? void 0 : T.getDisabled()) ?? !1), I = B(), g = B(), f = B(!1), w = B(!1), L = R(() => f.value || w.value), q = R(() => [...[
|
|
88
|
+
function() {
|
|
89
|
+
return typeof l(o.value) == "string" || typeof l(u.value) == "string" ? "Must be a number" : !0;
|
|
90
|
+
},
|
|
91
|
+
function(h) {
|
|
92
|
+
return !h || !h.min || !h.max ? !0 : +G(h.min) > +G(h.max) ? "Min must be less than or equal to max" : !0;
|
|
93
|
+
}
|
|
94
|
+
], ..._.rules ?? []]);
|
|
95
|
+
return (v, a) => {
|
|
96
|
+
const h = O("FmLabel"), r = O("FmField"), y = O("FmFormGroup");
|
|
97
|
+
return D(), Q("div", It, [
|
|
98
|
+
t("div", Vt, [
|
|
99
|
+
t("div", Dt, [
|
|
100
|
+
p(h, {
|
|
101
|
+
label: v.label,
|
|
102
|
+
disabled: v.disabled,
|
|
103
|
+
required: v.labelMark === "required",
|
|
104
|
+
optional: v.labelMark === "optional"
|
|
105
|
+
}, null, 8, ["label", "disabled", "required", "optional"])
|
|
106
|
+
]),
|
|
107
|
+
p(r, { focused: L.value }, {
|
|
108
|
+
default: E(() => [
|
|
109
|
+
t("div", Rt, [
|
|
110
|
+
Ie(v.$slots, "prepend"),
|
|
111
|
+
a[6] || (a[6] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
|
|
112
|
+
t("div", At, [
|
|
113
|
+
Ve(t("input", {
|
|
114
|
+
type: "text",
|
|
115
|
+
ref_key: "minInputRef",
|
|
116
|
+
ref: I,
|
|
117
|
+
onFocus: a[0] || (a[0] = () => f.value = !0),
|
|
118
|
+
onBlur: a[1] || (a[1] = () => f.value = !1),
|
|
119
|
+
"onUpdate:modelValue": a[2] || (a[2] = (s) => o.value = s),
|
|
120
|
+
class: ie({
|
|
121
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
122
|
+
"text-fm-color-typo-primary": !S.value,
|
|
123
|
+
"text-fm-color-typo-disabled": S.value
|
|
124
|
+
})
|
|
125
|
+
}, null, 34), [
|
|
126
|
+
[De, o.value]
|
|
127
|
+
])
|
|
128
|
+
]),
|
|
129
|
+
a[7] || (a[7] = t("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
|
|
130
|
+
a[8] || (a[8] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
|
|
131
|
+
t("div", Pt, [
|
|
132
|
+
Ve(t("input", {
|
|
133
|
+
type: "text",
|
|
134
|
+
ref_key: "maxInputRef",
|
|
135
|
+
ref: g,
|
|
136
|
+
onFocus: a[3] || (a[3] = () => w.value = !0),
|
|
137
|
+
onBlur: a[4] || (a[4] = () => w.value = !1),
|
|
138
|
+
"onUpdate:modelValue": a[5] || (a[5] = (s) => u.value = s),
|
|
139
|
+
class: ie({
|
|
140
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
141
|
+
"text-fm-color-typo-primary": !S.value,
|
|
142
|
+
"text-fm-color-typo-disabled": S.value
|
|
143
|
+
})
|
|
144
|
+
}, null, 34), [
|
|
145
|
+
[De, u.value]
|
|
146
|
+
])
|
|
147
|
+
]),
|
|
148
|
+
Ie(v.$slots, "append")
|
|
149
|
+
])
|
|
150
|
+
]),
|
|
151
|
+
_: 3
|
|
152
|
+
}, 8, ["focused"])
|
|
153
|
+
]),
|
|
154
|
+
p(y, {
|
|
155
|
+
class: "flex-1",
|
|
156
|
+
"model-value": v.modelValue,
|
|
157
|
+
info: v.labelInfo,
|
|
158
|
+
rules: q.value,
|
|
159
|
+
"helper-text": v.helperText,
|
|
160
|
+
"helper-state": v.helperState
|
|
161
|
+
}, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
|
|
162
|
+
]);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
function Bt() {
|
|
167
|
+
return function(_) {
|
|
168
|
+
return !_ || !_.min || !_.max ? "Required" : !0;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function Ut(b, _) {
|
|
172
|
+
return function(l) {
|
|
173
|
+
return !l || !l.min || !l.max ? !0 : +G(l.min) < b ? `Must be between ${b} and ${_}` : +G(l.max) > _ ? `Must be between ${b} and ${_}` : !0;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function Et(b) {
|
|
177
|
+
const _ = ct(b), d = G(b);
|
|
178
|
+
return function(c) {
|
|
179
|
+
if (!(c != null && c.min) || !(c != null && c.max)) return !0;
|
|
180
|
+
const m = _(c.min) === !0, o = _(c.max) === !0;
|
|
181
|
+
return !m && !o ? `Min & max must be a multiple of ${d}` : m ? o ? !0 : `Max must be a multiple of ${d}` : `Min must be a multiple of ${d}`;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
var P = /* @__PURE__ */ ((b) => (b.Code = "Code", b.Name = "Name", b.DefaultAmount = "DefaultAmount", b.Limit = "Limit", b.MinimumAmount = "MinimumAmount", b.Step = "Step", b.Cost = "Cost", b.Delete = "Delete", b))(P || {});
|
|
185
|
+
function qt(b) {
|
|
186
|
+
const { t: _ } = J(), d = Ze({});
|
|
187
|
+
ce(() => {
|
|
188
|
+
for (const m of b.items) {
|
|
189
|
+
if (!m.totalCost)
|
|
190
|
+
continue;
|
|
191
|
+
const o = kt(m.sku, m.quantity, m.measurement, {
|
|
192
|
+
supplier: b.supplier
|
|
193
|
+
}), u = m.totalCost ?? Le.reset();
|
|
194
|
+
o ? d[m.sku._id] = o.amount !== u.amount || o.precision !== u.precision : d[m.sku._id] = !0;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const l = [
|
|
198
|
+
{
|
|
199
|
+
id: "Code",
|
|
200
|
+
header: () => _("inventory.transfer.form.items.table.Code"),
|
|
201
|
+
accessorKey: "code",
|
|
202
|
+
size: 96,
|
|
203
|
+
cell(m) {
|
|
204
|
+
const o = m.row.original;
|
|
205
|
+
return W(re.FmTextField, {
|
|
206
|
+
modelValue: o.code,
|
|
207
|
+
"onUpdate:modelValue": (u) => {
|
|
208
|
+
b.updateItem({
|
|
209
|
+
...o,
|
|
210
|
+
code: u
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
key: o.sku._id,
|
|
214
|
+
rules: [me()],
|
|
215
|
+
labelMark: "required"
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
enableSorting: !1
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
id: "Name",
|
|
222
|
+
header: () => _("inventory.transfer.form.items.table.Name"),
|
|
223
|
+
minSize: 300,
|
|
224
|
+
cell(m) {
|
|
225
|
+
const o = m.row.original;
|
|
226
|
+
return W(re.FmTextField, {
|
|
227
|
+
modelValue: o.name,
|
|
228
|
+
"onUpdate:modelValue": (u) => {
|
|
229
|
+
b.updateItem({
|
|
230
|
+
...o,
|
|
231
|
+
name: u
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
key: o.sku._id,
|
|
235
|
+
rules: [me()],
|
|
236
|
+
labelMark: "required"
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
enableSorting: !1
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: "DefaultAmount",
|
|
243
|
+
header: () => _("inventory.transfer.form.items.table.DefaultAmount"),
|
|
244
|
+
minSize: 200,
|
|
245
|
+
cell(m) {
|
|
246
|
+
var g;
|
|
247
|
+
const o = m.row.original, u = Ne(), x = u.skuById[o.sku._id], T = u.unitById[(g = x.unit) == null ? void 0 : g._id], S = T.measurements.find((f) => {
|
|
248
|
+
var w;
|
|
249
|
+
return ((w = o.measurement) == null ? void 0 : w.id) === f.id;
|
|
250
|
+
}), I = o.sku.unit._id !== x.unit._id || !T || o.measurement && !S;
|
|
251
|
+
return W(pt, {
|
|
252
|
+
style: {
|
|
253
|
+
flex: "1 1 0%"
|
|
254
|
+
},
|
|
255
|
+
modelValue: {
|
|
256
|
+
amount: o.quantity ?? { amount: 1, precision: 0 },
|
|
257
|
+
// NOTE: leave this reading from row.sku.unit and row.measurement instead,
|
|
258
|
+
measurement: o.measurement ?? (o.sku.unit._id !== x.unit._id ? { ...o.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
|
|
259
|
+
},
|
|
260
|
+
disabled: b.disabled,
|
|
261
|
+
key: o.sku._id,
|
|
262
|
+
unit: T,
|
|
263
|
+
"onUpdate:modelValue": (f) => {
|
|
264
|
+
b.updateItem({
|
|
265
|
+
...o,
|
|
266
|
+
sku: x,
|
|
267
|
+
quantity: f.amount,
|
|
268
|
+
measurement: f.measurement
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
rules: [
|
|
272
|
+
ft(o.quantityStep),
|
|
273
|
+
yt(
|
|
274
|
+
+G(
|
|
275
|
+
o.minimumQuantity ?? {
|
|
276
|
+
amount: 1,
|
|
277
|
+
// NOTE: leave this reading from row.sku.unit and row.measurement instead,
|
|
278
|
+
precision: ae(o.sku.unit, o.measurement)
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
),
|
|
282
|
+
vt(
|
|
283
|
+
o.maximumQuantity ? +G(o.maximumQuantity) : 1 / 0
|
|
284
|
+
),
|
|
285
|
+
function(w) {
|
|
286
|
+
return I ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
applyDefaultRules: !0
|
|
290
|
+
});
|
|
291
|
+
},
|
|
292
|
+
enableSorting: !1
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: "Limit",
|
|
296
|
+
header: () => "Limit",
|
|
297
|
+
// TODO: i18n,
|
|
298
|
+
minSize: 280,
|
|
299
|
+
cell(m) {
|
|
300
|
+
const o = m.row.original;
|
|
301
|
+
return W(Lt, {
|
|
302
|
+
style: {
|
|
303
|
+
flex: "1 1 0%"
|
|
304
|
+
},
|
|
305
|
+
modelValue: {
|
|
306
|
+
min: o.minimumQuantity,
|
|
307
|
+
max: o.maximumQuantity
|
|
308
|
+
},
|
|
309
|
+
disabled: b.disabled,
|
|
310
|
+
key: o.sku._id,
|
|
311
|
+
unit: o.sku.unit,
|
|
312
|
+
"onUpdate:modelValue": (u) => {
|
|
313
|
+
const x = { ...o };
|
|
314
|
+
u != null && u.min && (x.minimumQuantity = u.min), u != null && u.max && (x.maximumQuantity = u.max), b.updateItem(x);
|
|
315
|
+
},
|
|
316
|
+
rules: [
|
|
317
|
+
Bt(),
|
|
318
|
+
Et(o.quantityStep),
|
|
319
|
+
Ut(
|
|
320
|
+
+G({
|
|
321
|
+
amount: 1,
|
|
322
|
+
precision: ae(o.sku.unit, o.measurement)
|
|
323
|
+
}),
|
|
324
|
+
1 / 0
|
|
325
|
+
)
|
|
326
|
+
],
|
|
327
|
+
disableUnit: !0,
|
|
328
|
+
applyDefaultRules: !0
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: "Step",
|
|
334
|
+
header: () => _("inventory.transfer.form.items.table.Step"),
|
|
335
|
+
minSize: 100,
|
|
336
|
+
cell(m) {
|
|
337
|
+
const o = m.row.original;
|
|
338
|
+
return W(re.FmTextField, {
|
|
339
|
+
modelValue: G(o.quantityStep ?? Le.reset(), !1),
|
|
340
|
+
key: o.sku._id,
|
|
341
|
+
"onUpdate:modelValue": (u) => {
|
|
342
|
+
b.updateItem({
|
|
343
|
+
...o,
|
|
344
|
+
quantityStep: bt(+u)
|
|
345
|
+
});
|
|
346
|
+
},
|
|
347
|
+
rules: [
|
|
348
|
+
de({
|
|
349
|
+
amount: 1,
|
|
350
|
+
precision: ae(o.sku.unit, o.measurement)
|
|
351
|
+
}),
|
|
352
|
+
_t(o.sku.unit, o.measurement)
|
|
353
|
+
]
|
|
354
|
+
});
|
|
355
|
+
},
|
|
356
|
+
enableSorting: !1
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: "Delete",
|
|
360
|
+
header: "",
|
|
361
|
+
cell(m) {
|
|
362
|
+
const o = m.row.original;
|
|
363
|
+
return W(re.FmButton, {
|
|
364
|
+
class: "delete-button",
|
|
365
|
+
key: o.sku._id,
|
|
366
|
+
type: "button",
|
|
367
|
+
icon: "delete",
|
|
368
|
+
variant: "tertiary",
|
|
369
|
+
size: "md",
|
|
370
|
+
disabled: b.disabled,
|
|
371
|
+
onClick: () => {
|
|
372
|
+
b.deleteItem(o);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
enableSorting: !1,
|
|
377
|
+
size: 40,
|
|
378
|
+
meta: {
|
|
379
|
+
cellClass: "",
|
|
380
|
+
headerClass: ""
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
];
|
|
384
|
+
return {
|
|
385
|
+
columnDefs: R(() => ze().enableTotalCost && b.transferType === N.PURCHASE ? l : l.filter((o) => o.id !== "Cost"))
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
const Nt = { class: "flex flex-col gap-8 py-16" }, zt = { class: "flex items-center" }, jt = { class: "flex-1 flex gap-1 items-center" }, Ht = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Qt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Gt = { class: "flex gap-8 w-full" }, Kt = { class: "flex-1 flex flex-col gap-4" }, Wt = { class: "flex-1 flex flex-col gap-4" }, Zt = { class: "flex gap-8 w-full" }, Jt = { class: "flex-1 flex flex-col gap-4" }, Xt = { class: "flex-1 flex flex-col gap-4" }, Yt = { class: "flex gap-8 w-full" }, eo = { class: "flex-1 flex flex-col gap-4" }, to = /* @__PURE__ */ Z({
|
|
389
|
+
__name: "TransferTemplateItem",
|
|
390
|
+
props: {
|
|
391
|
+
cellByColId: {},
|
|
392
|
+
row: {}
|
|
393
|
+
},
|
|
394
|
+
setup(b) {
|
|
395
|
+
const { t: _ } = J();
|
|
396
|
+
return (d, l) => {
|
|
397
|
+
var m, o, u, x, T, S, I, g, f, w, L, q, v, a, h, r, y, s, n, i, $, V, k, F, A, z, H, M, U, X;
|
|
398
|
+
const c = O("FmLabel");
|
|
399
|
+
return D(), Q("div", Nt, [
|
|
400
|
+
t("div", zt, [
|
|
401
|
+
t("div", jt, [
|
|
402
|
+
t("span", Ht, " (" + C(d.row.original.sku.code) + ") ", 1),
|
|
403
|
+
t("span", Qt, C(d.row.original.sku.name), 1)
|
|
404
|
+
]),
|
|
405
|
+
t("div", null, [
|
|
406
|
+
p(e(j), {
|
|
407
|
+
render: (u = (o = (m = d.cellByColId.Delete) == null ? void 0 : m.column) == null ? void 0 : o.columnDef) == null ? void 0 : u.cell,
|
|
408
|
+
props: (T = (x = d.cellByColId.Delete) == null ? void 0 : x.getContext) == null ? void 0 : T.call(x)
|
|
409
|
+
}, null, 8, ["render", "props"])
|
|
410
|
+
])
|
|
411
|
+
]),
|
|
412
|
+
t("div", Gt, [
|
|
413
|
+
t("div", Kt, [
|
|
414
|
+
p(c, {
|
|
415
|
+
label: e(_)(`inventory.transfer.form.items.table.${e(P).Code}`)
|
|
416
|
+
}, null, 8, ["label"]),
|
|
417
|
+
p(e(j), {
|
|
418
|
+
render: (g = (I = (S = d.cellByColId[e(P).Code]) == null ? void 0 : S.column) == null ? void 0 : I.columnDef) == null ? void 0 : g.cell,
|
|
419
|
+
props: (w = (f = d.cellByColId[e(P).Code]) == null ? void 0 : f.getContext) == null ? void 0 : w.call(f)
|
|
420
|
+
}, null, 8, ["render", "props"]),
|
|
421
|
+
l[0] || (l[0] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
422
|
+
]),
|
|
423
|
+
t("div", Wt, [
|
|
424
|
+
p(c, {
|
|
425
|
+
label: e(_)(`inventory.transfer.form.items.table.${e(P).Name}`)
|
|
426
|
+
}, null, 8, ["label"]),
|
|
427
|
+
p(e(j), {
|
|
428
|
+
render: (v = (q = (L = d.cellByColId[e(P).Name]) == null ? void 0 : L.column) == null ? void 0 : q.columnDef) == null ? void 0 : v.cell,
|
|
429
|
+
props: (h = (a = d.cellByColId[e(P).Name]) == null ? void 0 : a.getContext) == null ? void 0 : h.call(a)
|
|
430
|
+
}, null, 8, ["render", "props"]),
|
|
431
|
+
l[1] || (l[1] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
432
|
+
])
|
|
433
|
+
]),
|
|
434
|
+
t("div", Zt, [
|
|
435
|
+
t("div", Jt, [
|
|
436
|
+
p(c, {
|
|
437
|
+
label: e(_)(`inventory.transfer.form.items.table.${e(P).DefaultAmount}`)
|
|
438
|
+
}, null, 8, ["label"]),
|
|
439
|
+
p(e(j), {
|
|
440
|
+
render: (s = (y = (r = d.cellByColId[e(P).DefaultAmount]) == null ? void 0 : r.column) == null ? void 0 : y.columnDef) == null ? void 0 : s.cell,
|
|
441
|
+
props: (i = (n = d.cellByColId[e(P).DefaultAmount]) == null ? void 0 : n.getContext) == null ? void 0 : i.call(n)
|
|
442
|
+
}, null, 8, ["render", "props"]),
|
|
443
|
+
l[2] || (l[2] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
444
|
+
]),
|
|
445
|
+
t("div", Xt, [
|
|
446
|
+
p(c, {
|
|
447
|
+
label: e(_)(`inventory.transfer.form.items.table.${e(P).Step}`)
|
|
448
|
+
}, null, 8, ["label"]),
|
|
449
|
+
p(e(j), {
|
|
450
|
+
render: (k = (V = ($ = d.cellByColId[e(P).Step]) == null ? void 0 : $.column) == null ? void 0 : V.columnDef) == null ? void 0 : k.cell,
|
|
451
|
+
props: (A = (F = d.cellByColId[e(P).Step]) == null ? void 0 : F.getContext) == null ? void 0 : A.call(F)
|
|
452
|
+
}, null, 8, ["render", "props"]),
|
|
453
|
+
l[3] || (l[3] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
454
|
+
])
|
|
455
|
+
]),
|
|
456
|
+
t("div", Yt, [
|
|
457
|
+
t("div", eo, [
|
|
458
|
+
p(c, {
|
|
459
|
+
label: e(_)(`inventory.transfer.form.items.table.${e(P).Limit}`)
|
|
460
|
+
}, null, 8, ["label"]),
|
|
461
|
+
p(e(j), {
|
|
462
|
+
render: (M = (H = (z = d.cellByColId[e(P).Limit]) == null ? void 0 : z.column) == null ? void 0 : H.columnDef) == null ? void 0 : M.cell,
|
|
463
|
+
props: (X = (U = d.cellByColId[e(P).Limit]) == null ? void 0 : U.getContext) == null ? void 0 : X.call(U)
|
|
464
|
+
}, null, 8, ["render", "props"]),
|
|
465
|
+
l[4] || (l[4] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
466
|
+
])
|
|
467
|
+
])
|
|
468
|
+
]);
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
}), oo = { class: "flex flex-col gap-16" }, so = { class: "flex flex-col gap-24" }, lo = { class: "flex flex-col gap-16" }, no = { class: "flex items-center" }, ro = { class: "flex flex-col" }, ao = { class: "flex flex-col gap-16" }, io = { class: "flex" }, uo = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, mo = /* @__PURE__ */ Z({
|
|
472
|
+
__name: "TransferTemplateForm",
|
|
473
|
+
props: {
|
|
474
|
+
modelValue: {},
|
|
475
|
+
disabled: { type: Boolean }
|
|
476
|
+
},
|
|
477
|
+
setup(b, { expose: _ }) {
|
|
478
|
+
const d = b, l = Qe(), { t: c } = J(), m = je(), o = Ne(), u = $t();
|
|
479
|
+
pe(
|
|
480
|
+
() => d.modelValue,
|
|
481
|
+
(s) => {
|
|
482
|
+
console.log("TransferTemplateForm.model", s);
|
|
483
|
+
}
|
|
484
|
+
), m.watchLocation(async () => {
|
|
485
|
+
location && (l.purchaseOrder.supplier || (l.purchaseOrder.supplier = u.suppliers.find((s) => s) ?? l.purchaseOrder.supplier));
|
|
486
|
+
});
|
|
487
|
+
const x = Ft(), T = Mt(
|
|
488
|
+
() => l.purchaseOrder,
|
|
489
|
+
(s) => {
|
|
490
|
+
l.purchaseOrder = {
|
|
491
|
+
...l.purchaseOrder,
|
|
492
|
+
supplier: s.supplier ?? (l == null ? void 0 : l.purchaseOrder.supplier)
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
), S = R({
|
|
496
|
+
get() {
|
|
497
|
+
var s, n;
|
|
498
|
+
return typeof ((n = (s = l.purchaseOrder) == null ? void 0 : s.supplier) == null ? void 0 : n.internal) == "string" ? N.TRANSFER : N.PURCHASE;
|
|
499
|
+
},
|
|
500
|
+
set(s) {
|
|
501
|
+
var i, $;
|
|
502
|
+
const n = typeof (($ = (i = l.purchaseOrder) == null ? void 0 : i.supplier) == null ? void 0 : $.internal) == "string" ? N.TRANSFER : N.PURCHASE;
|
|
503
|
+
s !== n && (l.purchaseOrder.supplier = s === N.PURCHASE ? T.locationOptionsTypePurchase.value[0] : T.locationOptionsTypeTransfer.value[0]);
|
|
504
|
+
}
|
|
505
|
+
}), I = R(() => T.transferLocationOptions.value), g = R({
|
|
506
|
+
get() {
|
|
507
|
+
var s;
|
|
508
|
+
return (s = l.purchaseOrder.supplier) == null ? void 0 : s._id;
|
|
509
|
+
},
|
|
510
|
+
set(s) {
|
|
511
|
+
T.transferLocationModel.value = s;
|
|
512
|
+
}
|
|
513
|
+
}), {
|
|
514
|
+
promptSelectLocations: f,
|
|
515
|
+
columnDefs: w,
|
|
516
|
+
rowData: L
|
|
517
|
+
} = Ct({
|
|
518
|
+
getLocations() {
|
|
519
|
+
return l.locations;
|
|
520
|
+
},
|
|
521
|
+
setLocations(s) {
|
|
522
|
+
l.locations = s;
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
function q() {
|
|
526
|
+
var s, n;
|
|
527
|
+
return (s = l.locations) != null && s.find((i) => {
|
|
528
|
+
var $, V;
|
|
529
|
+
return (($ = i.doc) == null ? void 0 : $._id) === ((V = l.purchaseOrder.supplier) == null ? void 0 : V._id);
|
|
530
|
+
}) ? `Location ${(n = l.purchaseOrder.supplier) == null ? void 0 : n.name} must be removed because template cannot be used to transfer to itself.` : !0;
|
|
531
|
+
}
|
|
532
|
+
const v = R({
|
|
533
|
+
get() {
|
|
534
|
+
return l.purchaseOrder.remark ?? void 0;
|
|
535
|
+
},
|
|
536
|
+
set(s) {
|
|
537
|
+
l.purchaseOrder.remark = s;
|
|
538
|
+
}
|
|
539
|
+
}), a = B();
|
|
540
|
+
_({
|
|
541
|
+
validateInputs: () => {
|
|
542
|
+
var s, n;
|
|
543
|
+
(n = (s = a.value) == null ? void 0 : s.validateInputs) == null || n.call(s);
|
|
544
|
+
},
|
|
545
|
+
resetInputsValidation: () => {
|
|
546
|
+
var s, n;
|
|
547
|
+
(n = (s = a.value) == null ? void 0 : s.resetInputsValidation) == null || n.call(s);
|
|
548
|
+
},
|
|
549
|
+
resetInputs: () => {
|
|
550
|
+
var s, n;
|
|
551
|
+
(n = (s = a.value) == null ? void 0 : s.resetInputs) == null || n.call(s);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
const h = qt({
|
|
555
|
+
updateItem: (s) => {
|
|
556
|
+
l.purchaseOrder.items = l.purchaseOrder.items.map((n) => n.sku._id !== s.sku._id ? n : s);
|
|
557
|
+
},
|
|
558
|
+
deleteItem: (s) => {
|
|
559
|
+
l.purchaseOrder.items = l.purchaseOrder.items.filter(
|
|
560
|
+
(n) => n.sku._id !== s.sku._id
|
|
561
|
+
);
|
|
562
|
+
},
|
|
563
|
+
get supplier() {
|
|
564
|
+
return l.purchaseOrder.supplier;
|
|
565
|
+
},
|
|
566
|
+
get items() {
|
|
567
|
+
return l.purchaseOrder.items;
|
|
568
|
+
},
|
|
569
|
+
get transferType() {
|
|
570
|
+
return N.PURCHASE;
|
|
571
|
+
},
|
|
572
|
+
get disabled() {
|
|
573
|
+
return d.disabled;
|
|
574
|
+
}
|
|
575
|
+
}), r = R(() => h.columnDefs.value);
|
|
576
|
+
function y() {
|
|
577
|
+
const s = o.skus.map((i) => ({
|
|
578
|
+
label: i.name,
|
|
579
|
+
sublabel: i.code,
|
|
580
|
+
value: i
|
|
581
|
+
})), n = s.filter((i) => {
|
|
582
|
+
var $;
|
|
583
|
+
return ($ = l.purchaseOrder.items) == null ? void 0 : $.find((V) => V.sku._id === i.value._id);
|
|
584
|
+
}).map((i) => i.value);
|
|
585
|
+
x.open({
|
|
586
|
+
title: c("inventory.transfer.form.items.selectItem"),
|
|
587
|
+
closeButton: !0,
|
|
588
|
+
contentComponent: xt,
|
|
589
|
+
contentComponentProps: {
|
|
590
|
+
modelValue: n,
|
|
591
|
+
items: s,
|
|
592
|
+
virtualScroll: !0
|
|
593
|
+
},
|
|
594
|
+
primaryActions: {
|
|
595
|
+
text: c("common.confirm"),
|
|
596
|
+
close: !0
|
|
597
|
+
},
|
|
598
|
+
secondaryActions: {
|
|
599
|
+
text: c("common.close"),
|
|
600
|
+
close: !0,
|
|
601
|
+
variant: "tertiary"
|
|
602
|
+
}
|
|
603
|
+
}).onPrimary((i) => {
|
|
604
|
+
const $ = l.purchaseOrder.items ?? [], V = i.map((k) => {
|
|
605
|
+
const F = $.find((H) => H.sku._id === k._id);
|
|
606
|
+
if (F)
|
|
607
|
+
return F;
|
|
608
|
+
const A = { amount: 1, precision: ae(k.unit) };
|
|
609
|
+
return {
|
|
610
|
+
sku: k,
|
|
611
|
+
code: k.code,
|
|
612
|
+
name: k.name,
|
|
613
|
+
quantity: A,
|
|
614
|
+
minimumQuantity: A,
|
|
615
|
+
maximumQuantity: ht(A, {
|
|
616
|
+
amount: 100,
|
|
617
|
+
precision: 0
|
|
618
|
+
}),
|
|
619
|
+
quantityStep: A
|
|
620
|
+
};
|
|
621
|
+
});
|
|
622
|
+
V.sort((k, F) => k.sku.code.localeCompare(F.sku.code)), l.purchaseOrder.items = V;
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
return (s, n) => {
|
|
626
|
+
const i = O("FmTextField"), $ = O("FmSelect"), V = O("FmTextarea"), k = O("FmButton"), F = O("FmTable"), A = O("FmFormGroup"), z = O("FmForm");
|
|
627
|
+
return D(), K(z, {
|
|
628
|
+
ref_key: "formRef",
|
|
629
|
+
ref: a,
|
|
630
|
+
class: "flex flex-col gap-32",
|
|
631
|
+
disabled: s.disabled
|
|
632
|
+
}, {
|
|
633
|
+
default: E(() => {
|
|
634
|
+
var H;
|
|
635
|
+
return [
|
|
636
|
+
t("div", oo, [
|
|
637
|
+
t("div", so, [
|
|
638
|
+
p(i, {
|
|
639
|
+
label: e(c)("inventory.transfer.form.name"),
|
|
640
|
+
"label-mark": "required",
|
|
641
|
+
modelValue: e(l).name,
|
|
642
|
+
"onUpdate:modelValue": n[0] || (n[0] = (M) => e(l).name = M),
|
|
643
|
+
rules: [e(me)()]
|
|
644
|
+
}, null, 8, ["label", "modelValue", "rules"]),
|
|
645
|
+
p($, {
|
|
646
|
+
label: e(c)("inventory.transfer.form.type.title"),
|
|
647
|
+
"model-value": S.value,
|
|
648
|
+
"onUpdate:modelValue": n[1] || (n[1] = (M) => S.value = M),
|
|
649
|
+
items: [
|
|
650
|
+
{
|
|
651
|
+
label: e(c)("inventory.transfer.form.type.purchase"),
|
|
652
|
+
value: e(N).PURCHASE,
|
|
653
|
+
disabled: !e(T).locationOptionsTypePurchase.value.length,
|
|
654
|
+
sublabel: e(T).locationOptionsTypePurchase.value.length ? void 0 : e(c)("inventory.transfer.form.noSupplierAvailable")
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
label: e(c)("inventory.transfer.form.type.transfer"),
|
|
658
|
+
value: e(N).TRANSFER,
|
|
659
|
+
disabled: !e(T).locationOptionsTypeTransfer.value.length,
|
|
660
|
+
sublabel: e(T).locationOptionsTypeTransfer.value.length ? void 0 : e(c)("inventory.transfer.form.noLocationAvailable")
|
|
661
|
+
}
|
|
662
|
+
],
|
|
663
|
+
rules: [e(de)(1)(I.value)]
|
|
664
|
+
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
665
|
+
p($, {
|
|
666
|
+
label: S.value === e(N).PURCHASE ? e(c)("inventory.transfer.form.purchaseFrom") : e(c)("inventory.transfer.form.transferFrom"),
|
|
667
|
+
modelValue: g.value,
|
|
668
|
+
"onUpdate:modelValue": n[2] || (n[2] = (M) => g.value = M),
|
|
669
|
+
items: I.value
|
|
670
|
+
}, {
|
|
671
|
+
"menu-wrapper": E((M) => {
|
|
672
|
+
var U;
|
|
673
|
+
return [
|
|
674
|
+
p(St, Ue(M, {
|
|
675
|
+
items: I.value,
|
|
676
|
+
"model-value": (U = s.modelValue.purchaseOrder.supplier) == null ? void 0 : U._id
|
|
677
|
+
}), null, 16, ["items", "model-value"])
|
|
678
|
+
];
|
|
679
|
+
}),
|
|
680
|
+
_: 1
|
|
681
|
+
}, 8, ["label", "modelValue", "items"]),
|
|
682
|
+
p(i, {
|
|
683
|
+
label: e(c)("inventory.transfer.form.reference"),
|
|
684
|
+
"label-mark": "optional",
|
|
685
|
+
modelValue: e(l).purchaseOrder.ref,
|
|
686
|
+
"onUpdate:modelValue": n[3] || (n[3] = (M) => e(l).purchaseOrder.ref = M)
|
|
687
|
+
}, null, 8, ["label", "modelValue"]),
|
|
688
|
+
p(V, {
|
|
689
|
+
label: e(c)("inventory.transfer.form.remark"),
|
|
690
|
+
"label-mark": "optional",
|
|
691
|
+
"max-length": 240,
|
|
692
|
+
modelValue: v.value,
|
|
693
|
+
"onUpdate:modelValue": n[4] || (n[4] = (M) => v.value = M),
|
|
694
|
+
class: ie({ "text-fm-color-typo-disabled": s.disabled })
|
|
695
|
+
}, null, 8, ["label", "modelValue", "class"])
|
|
696
|
+
])
|
|
697
|
+
]),
|
|
698
|
+
t("div", lo, [
|
|
699
|
+
t("div", no, [
|
|
700
|
+
n[6] || (n[6] = t("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
|
|
701
|
+
p(k, {
|
|
702
|
+
disabled: s.disabled,
|
|
703
|
+
label: "Select location",
|
|
704
|
+
"prepend-icon": "add",
|
|
705
|
+
variant: "plain",
|
|
706
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
707
|
+
onClick: e(f)
|
|
708
|
+
}, null, 8, ["disabled", "onClick"])
|
|
709
|
+
]),
|
|
710
|
+
p(F, {
|
|
711
|
+
"column-defs": e(w),
|
|
712
|
+
"row-data": e(L),
|
|
713
|
+
"shrink-at": 9999,
|
|
714
|
+
onRowClick: e(f),
|
|
715
|
+
"hide-footer": ""
|
|
716
|
+
}, null, 8, ["column-defs", "row-data", "onRowClick"]),
|
|
717
|
+
t("div", ro, [
|
|
718
|
+
p(A, {
|
|
719
|
+
"model-value": [
|
|
720
|
+
(H = d.modelValue.purchaseOrder.supplier) == null ? void 0 : H._id,
|
|
721
|
+
...d.modelValue.locations ?? []
|
|
722
|
+
].join(","),
|
|
723
|
+
rules: [q]
|
|
724
|
+
}, null, 8, ["model-value", "rules"])
|
|
725
|
+
])
|
|
726
|
+
]),
|
|
727
|
+
t("div", ao, [
|
|
728
|
+
t("div", io, [
|
|
729
|
+
t("div", uo, C(e(c)("inventory.transfer.form.items.title")), 1),
|
|
730
|
+
p(k, {
|
|
731
|
+
disabled: s.disabled,
|
|
732
|
+
label: e(c)("inventory.transfer.form.items.addItem"),
|
|
733
|
+
"prepend-icon": "add",
|
|
734
|
+
variant: "plain",
|
|
735
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
736
|
+
onClick: n[5] || (n[5] = (M) => y()),
|
|
737
|
+
size: "md"
|
|
738
|
+
}, null, 8, ["disabled", "label"])
|
|
739
|
+
]),
|
|
740
|
+
(D(), K(F, {
|
|
741
|
+
"column-defs": r.value,
|
|
742
|
+
"row-data": e(l).purchaseOrder.items,
|
|
743
|
+
key: e(l).purchaseOrder.items.map((M) => M.sku._id).join("."),
|
|
744
|
+
"hide-footer": "",
|
|
745
|
+
"page-size": e(l).purchaseOrder.items.length
|
|
746
|
+
}, {
|
|
747
|
+
"list-row": E((M) => [
|
|
748
|
+
(D(), K(Ge, {
|
|
749
|
+
row: M,
|
|
750
|
+
key: e(l).purchaseOrder.items.map((U) => U.sku._id).join(".")
|
|
751
|
+
}, {
|
|
752
|
+
default: E((U) => [
|
|
753
|
+
p(to, {
|
|
754
|
+
row: M,
|
|
755
|
+
"cell-by-col-id": U
|
|
756
|
+
}, null, 8, ["row", "cell-by-col-id"])
|
|
757
|
+
]),
|
|
758
|
+
_: 2
|
|
759
|
+
}, 1032, ["row"]))
|
|
760
|
+
]),
|
|
761
|
+
_: 1
|
|
762
|
+
}, 8, ["column-defs", "row-data", "page-size"])),
|
|
763
|
+
p(A, {
|
|
764
|
+
"model-value": e(l).purchaseOrder.items.length,
|
|
765
|
+
rules: [e(de)(1)]
|
|
766
|
+
}, null, 8, ["model-value", "rules"])
|
|
767
|
+
])
|
|
768
|
+
];
|
|
769
|
+
}),
|
|
770
|
+
_: 1
|
|
771
|
+
}, 8, ["disabled"]);
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
}), co = { class: "flex items-center" }, po = { class: "fm-typo-en-title-md-800" }, fo = { class: "flex gap-4" }, yo = /* @__PURE__ */ Z({
|
|
775
|
+
__name: "TransferTemplateDialog",
|
|
776
|
+
props: {
|
|
777
|
+
mode: {},
|
|
778
|
+
modelValue: {},
|
|
779
|
+
show: { type: Boolean }
|
|
780
|
+
},
|
|
781
|
+
emits: ["update:show", "submitted"],
|
|
782
|
+
setup(b, { expose: _, emit: d }) {
|
|
783
|
+
var h;
|
|
784
|
+
const l = b, c = d, m = nt(), o = Tt(), { t: u } = J(), x = He(l, "show");
|
|
785
|
+
function T() {
|
|
786
|
+
return {
|
|
787
|
+
_id: "",
|
|
788
|
+
name: "",
|
|
789
|
+
purchaseOrder: {
|
|
790
|
+
remark: void 0,
|
|
791
|
+
ref: void 0,
|
|
792
|
+
items: [],
|
|
793
|
+
supplier: {
|
|
794
|
+
_rev: void 0,
|
|
795
|
+
email: void 0,
|
|
796
|
+
internal: void 0,
|
|
797
|
+
contactName: void 0,
|
|
798
|
+
phoneNumber: void 0,
|
|
799
|
+
registrationNumber: void 0,
|
|
800
|
+
supplyItems: void 0,
|
|
801
|
+
_id: "",
|
|
802
|
+
name: "",
|
|
803
|
+
address: {
|
|
804
|
+
line2: void 0,
|
|
805
|
+
line1: "",
|
|
806
|
+
state: "",
|
|
807
|
+
city: "",
|
|
808
|
+
postcode: "",
|
|
809
|
+
country: ""
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
const S = B(l.modelValue ?? T()), I = B(((h = l.modelValue) == null ? void 0 : h._id) ?? `${Math.random()}`);
|
|
816
|
+
pe(
|
|
817
|
+
() => l.show,
|
|
818
|
+
(r) => {
|
|
819
|
+
var y;
|
|
820
|
+
r && (S.value = l.modelValue ?? T(), I.value = ((y = l.modelValue) == null ? void 0 : y._id) ?? `${Math.random()}`);
|
|
821
|
+
}
|
|
822
|
+
);
|
|
823
|
+
const g = B(!1), f = R(() => {
|
|
824
|
+
switch (l.mode) {
|
|
825
|
+
case ee.READ:
|
|
826
|
+
return "";
|
|
827
|
+
case ee.CREATE:
|
|
828
|
+
return u("inventory.transfer.template.create.title");
|
|
829
|
+
case ee.UPDATE:
|
|
830
|
+
return u("inventory.transfer.template.update.title");
|
|
831
|
+
}
|
|
832
|
+
return "";
|
|
833
|
+
}), w = B();
|
|
834
|
+
_({
|
|
835
|
+
validateInputs: () => {
|
|
836
|
+
var r, y;
|
|
837
|
+
(y = (r = w.value) == null ? void 0 : r.validateInputs) == null || y.call(r);
|
|
838
|
+
},
|
|
839
|
+
resetInputsValidation: () => {
|
|
840
|
+
var r, y;
|
|
841
|
+
(y = (r = w.value) == null ? void 0 : r.resetInputsValidation) == null || y.call(r);
|
|
842
|
+
},
|
|
843
|
+
resetInputs: () => {
|
|
844
|
+
var r, y;
|
|
845
|
+
(y = (r = w.value) == null ? void 0 : r.resetInputs) == null || y.call(r);
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
async function L() {
|
|
849
|
+
var y, s;
|
|
850
|
+
const r = S.value;
|
|
851
|
+
if (r) {
|
|
852
|
+
g.value = !0, (((y = r.purchaseOrder.supplier) == null ? void 0 : y.internal) === ne.enum.warehouse || ((s = r.purchaseOrder.supplier) == null ? void 0 : s.internal) === ne.enum.restaurant) && (r.purchaseOrder.items = r.purchaseOrder.items.map(
|
|
853
|
+
({ totalCost: n, ...i }) => i
|
|
854
|
+
));
|
|
855
|
+
try {
|
|
856
|
+
await m.createTemplate(r), await new Promise((n) => setTimeout(n, 1e3)), o.open({
|
|
857
|
+
title: u("inventory.transfer.template.create.success"),
|
|
858
|
+
message: u("inventory.transfer.template.create.successMessage"),
|
|
859
|
+
type: "success"
|
|
860
|
+
}), c("update:show", !1), c("submitted");
|
|
861
|
+
} catch (n) {
|
|
862
|
+
o.open({
|
|
863
|
+
title: u("inventory.transfer.template.create.error"),
|
|
864
|
+
message: u("inventory.transfer.template.create.errorMessage"),
|
|
865
|
+
type: "error"
|
|
866
|
+
}), console.error("Error in creating transfer template", n);
|
|
867
|
+
} finally {
|
|
868
|
+
g.value = !1;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
async function q() {
|
|
873
|
+
var y, s;
|
|
874
|
+
const r = S.value;
|
|
875
|
+
if (r) {
|
|
876
|
+
g.value = !0, (((y = r.purchaseOrder.supplier) == null ? void 0 : y.internal) === ne.enum.warehouse || ((s = r.purchaseOrder.supplier) == null ? void 0 : s.internal) === ne.enum.restaurant) && (r.purchaseOrder.items = r.purchaseOrder.items.map(
|
|
877
|
+
({ totalCost: n, ...i }) => i
|
|
878
|
+
));
|
|
879
|
+
try {
|
|
880
|
+
await m.updateTemplate(r), await new Promise((n) => setTimeout(n, 1e3)), o.open({
|
|
881
|
+
title: u("inventory.transfer.template.update.success"),
|
|
882
|
+
message: u("inventory.transfer.template.update.successMessage"),
|
|
883
|
+
type: "success"
|
|
884
|
+
}), c("update:show", !1), c("submitted");
|
|
885
|
+
} catch (n) {
|
|
886
|
+
o.open({
|
|
887
|
+
title: u("inventory.transfer.template.update.error"),
|
|
888
|
+
message: u("inventory.transfer.template.update.errorMessage"),
|
|
889
|
+
type: "error"
|
|
890
|
+
}), console.error("Error in updating transfer template", n);
|
|
891
|
+
} finally {
|
|
892
|
+
g.value = !1;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
function v() {
|
|
897
|
+
switch (l.mode) {
|
|
898
|
+
case ee.CREATE:
|
|
899
|
+
return L();
|
|
900
|
+
case ee.UPDATE:
|
|
901
|
+
return q();
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
function a() {
|
|
905
|
+
var r, y;
|
|
906
|
+
(y = (r = w.value) == null ? void 0 : r.validateInputs) == null || y.call(r);
|
|
907
|
+
}
|
|
908
|
+
return (r, y) => {
|
|
909
|
+
const s = O("FmButton"), n = O("FmSideSheet");
|
|
910
|
+
return D(), K(n, {
|
|
911
|
+
modelValue: e(x),
|
|
912
|
+
"onUpdate:modelValue": y[2] || (y[2] = (i) => Ee(x) ? x.value = i : null),
|
|
913
|
+
"dismiss-away": "",
|
|
914
|
+
"close-button": "",
|
|
915
|
+
"max-width": 1200
|
|
916
|
+
}, {
|
|
917
|
+
"side-sheet-header": E(() => [
|
|
918
|
+
t("div", co, [
|
|
919
|
+
t("div", po, C(f.value), 1)
|
|
920
|
+
])
|
|
921
|
+
]),
|
|
922
|
+
default: E(() => [
|
|
923
|
+
(D(), K(mo, {
|
|
924
|
+
class: "w-full",
|
|
925
|
+
ref_key: "formRef",
|
|
926
|
+
ref: w,
|
|
927
|
+
onValidationSuccess: v,
|
|
928
|
+
"model-value": S.value,
|
|
929
|
+
"onUpdate:modelValue": y[0] || (y[0] = (i) => S.value = i),
|
|
930
|
+
disabled: g.value,
|
|
931
|
+
key: I.value
|
|
932
|
+
}, null, 8, ["model-value", "disabled"]))
|
|
933
|
+
]),
|
|
934
|
+
"side-sheet-footer": E(() => [
|
|
935
|
+
t("div", fo, [
|
|
936
|
+
p(s, {
|
|
937
|
+
loading: g.value,
|
|
938
|
+
label: e(u)("common.save"),
|
|
939
|
+
onClick: a
|
|
940
|
+
}, null, 8, ["loading", "label"]),
|
|
941
|
+
p(s, {
|
|
942
|
+
disabled: g.value,
|
|
943
|
+
variant: "tertiary",
|
|
944
|
+
label: e(u)("common.close"),
|
|
945
|
+
onClick: y[1] || (y[1] = (i) => c("update:show", !1))
|
|
946
|
+
}, null, 8, ["disabled", "label"])
|
|
947
|
+
])
|
|
948
|
+
]),
|
|
949
|
+
_: 1
|
|
950
|
+
}, 8, ["modelValue"]);
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
}), vo = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, bo = { class: "flex justify-between" }, _o = { class: "fm-typo-en-body-lg-600" }, xo = { class: "fm-status-badge fm-status-badge-info-secondary" }, ho = { class: "flex flex-col gap-8" }, go = { class: "flex flex-col gap-4" }, Fo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, To = { class: "flex gap-1" }, wo = { class: "fm-typo-en-body-lg-600" }, ko = {
|
|
954
|
+
key: 0,
|
|
955
|
+
class: "flex flex-col gap-4"
|
|
956
|
+
}, Mo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, So = { class: "fm-typo-en-body-lg-600" }, $o = {
|
|
957
|
+
key: 1,
|
|
958
|
+
class: "flex flex-col gap-4"
|
|
959
|
+
}, Co = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oo = { class: "fm-typo-en-body-lg-600" }, Io = {
|
|
960
|
+
key: 2,
|
|
961
|
+
class: "flex flex-col gap-4"
|
|
962
|
+
}, Vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Do = { class: "fm-typo-en-body-lg-600" }, Ro = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ao = { class: "flex flex-col gap-8" }, Po = { class: "fm-typo-en-body-lg-600" }, Lo = { class: "flex w-full gap-4" }, Bo = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Uo = { class: "fm-typo-en-body-lg-600 shrink-0" }, Eo = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, qo = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, No = {
|
|
963
|
+
key: 0,
|
|
964
|
+
class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
965
|
+
}, zo = {
|
|
966
|
+
key: 0,
|
|
967
|
+
class: "flex gap-4 items-center"
|
|
968
|
+
}, jo = { class: "flex flex-col gap-12" }, Ho = { class: "flex flex-col gap-8" }, Qo = { class: "flex gap-8 xs:flex-col" }, Go = /* @__PURE__ */ Z({
|
|
969
|
+
__name: "TransferTemplateDetails",
|
|
970
|
+
props: {
|
|
971
|
+
template: {},
|
|
972
|
+
show: { type: Boolean }
|
|
973
|
+
},
|
|
974
|
+
emits: ["update:show", "action:edit"],
|
|
975
|
+
setup(b, { emit: _ }) {
|
|
976
|
+
const d = b, l = _, c = ze(), { t: m } = J(), o = R(() => {
|
|
977
|
+
var g;
|
|
978
|
+
return (g = d.template) == null ? void 0 : g.purchaseOrder;
|
|
979
|
+
}), u = [
|
|
980
|
+
{ accessorKey: "name", header: () => "Name" },
|
|
981
|
+
{ accessorKey: "type", header: () => "Type" }
|
|
982
|
+
], x = B(""), T = R(
|
|
983
|
+
() => {
|
|
984
|
+
var g, f, w, L;
|
|
985
|
+
return ((f = (g = o.value) == null ? void 0 : g.supplier) == null ? void 0 : f.internal) === "restaurant" || ((L = (w = o.value) == null ? void 0 : w.supplier) == null ? void 0 : L.internal) === "warehouse" ? N.TRANSFER : N.PURCHASE;
|
|
986
|
+
}
|
|
987
|
+
), S = B(!0), I = He(d, "show");
|
|
988
|
+
return (g, f) => {
|
|
989
|
+
var y;
|
|
990
|
+
const w = O("FmMenuDivider"), L = O("FmCard"), q = O("FmIcon"), v = O("FmTextField"), a = O("FmTable"), h = O("FmButton"), r = O("FmSideSheet");
|
|
991
|
+
return D(), K(r, {
|
|
992
|
+
header: e(m)("inventory.transfer.template.details.view", { template: (y = g.template) == null ? void 0 : y.name }),
|
|
993
|
+
modelValue: e(I),
|
|
994
|
+
"onUpdate:modelValue": f[2] || (f[2] = (s) => Ee(I) ? I.value = s : null),
|
|
995
|
+
"dismiss-away": S.value,
|
|
996
|
+
"close-button": "",
|
|
997
|
+
"max-width": 500
|
|
998
|
+
}, {
|
|
999
|
+
default: E(() => {
|
|
1000
|
+
var s, n;
|
|
1001
|
+
return [
|
|
1002
|
+
t("div", vo, [
|
|
1003
|
+
t("div", null, [
|
|
1004
|
+
p(L, {
|
|
1005
|
+
variant: "outlined",
|
|
1006
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1007
|
+
}, {
|
|
1008
|
+
default: E(() => {
|
|
1009
|
+
var i, $, V, k, F, A, z;
|
|
1010
|
+
return [
|
|
1011
|
+
t("div", bo, [
|
|
1012
|
+
t("div", _o, C(e(m)("inventory.transfer.template.details.templateSummary")), 1),
|
|
1013
|
+
t("div", xo, C(e(m)(
|
|
1014
|
+
`inventory.transfer.receiveRequest.details.type.${T.value.toLocaleLowerCase("en-US")}`
|
|
1015
|
+
)), 1)
|
|
1016
|
+
]),
|
|
1017
|
+
p(w),
|
|
1018
|
+
t("div", ho, [
|
|
1019
|
+
t("div", go, [
|
|
1020
|
+
t("div", Fo, [
|
|
1021
|
+
t("div", To, C(e(m)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
1022
|
+
]),
|
|
1023
|
+
t("div", wo, C(e(Ot)(((i = g.template) == null ? void 0 : i._id) ?? "")), 1)
|
|
1024
|
+
]),
|
|
1025
|
+
(V = ($ = o.value) == null ? void 0 : $.supplier) != null && V.name ? (D(), Q("div", ko, [
|
|
1026
|
+
t("div", Mo, C(e(m)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
1027
|
+
t("div", So, C((F = (k = o.value) == null ? void 0 : k.supplier) == null ? void 0 : F.name), 1)
|
|
1028
|
+
])) : Y("", !0),
|
|
1029
|
+
(A = o.value) != null && A.ref ? (D(), Q("div", $o, [
|
|
1030
|
+
t("div", Co, C(e(m)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
1031
|
+
t("div", Oo, C(o.value.ref), 1)
|
|
1032
|
+
])) : Y("", !0),
|
|
1033
|
+
(z = o.value) != null && z.remark ? (D(), Q("div", Io, [
|
|
1034
|
+
t("div", Vo, C(e(m)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
1035
|
+
t("div", Do, C(o.value.remark), 1)
|
|
1036
|
+
])) : Y("", !0)
|
|
1037
|
+
])
|
|
1038
|
+
];
|
|
1039
|
+
}),
|
|
1040
|
+
_: 1
|
|
1041
|
+
})
|
|
1042
|
+
]),
|
|
1043
|
+
t("div", Ro, [
|
|
1044
|
+
t("div", Ao, [
|
|
1045
|
+
t("div", Po, C(e(m)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
|
|
1046
|
+
(D(!0), Q(qe, null, Je(((s = o.value) == null ? void 0 : s.items) ?? [], (i) => (D(), Q("div", {
|
|
1047
|
+
key: i.code,
|
|
1048
|
+
class: "flex flex-col"
|
|
1049
|
+
}, [
|
|
1050
|
+
t("div", Lo, [
|
|
1051
|
+
t("div", Bo, C(i.name), 1),
|
|
1052
|
+
f[3] || (f[3] = t("div", { class: "flex-1 min-w-32" }, null, -1)),
|
|
1053
|
+
t("div", Uo, C(e(rt)(i.quantity, i.sku.unit, i.measurement)), 1)
|
|
1054
|
+
]),
|
|
1055
|
+
t("div", Eo, [
|
|
1056
|
+
t("div", qo, C(i.code), 1),
|
|
1057
|
+
i.totalCost && e(c).enableTotalCost ? (D(), Q("div", No, " (" + C(e(gt)(i.totalCost)) + ") ", 1)) : Y("", !0)
|
|
1058
|
+
]),
|
|
1059
|
+
e(at)(i) ? (D(), Q("div", zo, [
|
|
1060
|
+
p(q, {
|
|
1061
|
+
name: "error",
|
|
1062
|
+
color: "system-error-300",
|
|
1063
|
+
size: "sm"
|
|
1064
|
+
}),
|
|
1065
|
+
f[4] || (f[4] = t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400" }, " This item has invalid unit configuration. Apply update on this item. ", -1))
|
|
1066
|
+
])) : Y("", !0)
|
|
1067
|
+
]))), 128))
|
|
1068
|
+
])
|
|
1069
|
+
]),
|
|
1070
|
+
f[6] || (f[6] = t("div", null, null, -1)),
|
|
1071
|
+
f[7] || (f[7] = t("div", null, null, -1)),
|
|
1072
|
+
t("div", jo, [
|
|
1073
|
+
f[5] || (f[5] = t("div", { class: "flex flex-col" }, [
|
|
1074
|
+
t("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
|
|
1075
|
+
t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
|
|
1076
|
+
], -1)),
|
|
1077
|
+
t("div", Ho, [
|
|
1078
|
+
p(v, {
|
|
1079
|
+
modelValue: x.value,
|
|
1080
|
+
"onUpdate:modelValue": f[0] || (f[0] = (i) => x.value = i),
|
|
1081
|
+
placeholder: "Filter locations",
|
|
1082
|
+
"prepend-icon": "search"
|
|
1083
|
+
}, null, 8, ["modelValue"]),
|
|
1084
|
+
p(a, {
|
|
1085
|
+
"hide-footer": "",
|
|
1086
|
+
style: { height: "500px" },
|
|
1087
|
+
"column-defs": u,
|
|
1088
|
+
"search-value": x.value,
|
|
1089
|
+
"row-data": ((n = d.template) == null ? void 0 : n.locations) ?? [{ name: "All locations" }]
|
|
1090
|
+
}, null, 8, ["search-value", "row-data"])
|
|
1091
|
+
])
|
|
1092
|
+
])
|
|
1093
|
+
])
|
|
1094
|
+
];
|
|
1095
|
+
}),
|
|
1096
|
+
"side-sheet-footer": E(() => [
|
|
1097
|
+
t("div", Qo, [
|
|
1098
|
+
p(h, {
|
|
1099
|
+
label: e(m)("common.edit"),
|
|
1100
|
+
onClick: f[1] || (f[1] = (s) => l("action:edit")),
|
|
1101
|
+
variant: "tertiary"
|
|
1102
|
+
}, null, 8, ["label"])
|
|
1103
|
+
])
|
|
1104
|
+
]),
|
|
1105
|
+
_: 1
|
|
1106
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
}), Ko = { class: "flex-1 flex flex-col gap-8" }, Wo = { class: "flex flex-col" }, Zo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Jo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Xo = { class: "fm-typo-en-body-lg-400" }, Yo = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, es = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, vs = /* @__PURE__ */ Z({
|
|
1110
|
+
__name: "TransferTemplateView",
|
|
1111
|
+
setup(b) {
|
|
1112
|
+
const { t: _ } = J(), { createTemplate: d, viewTemplate: l, importTemplates: c, exportTemplates: m } = Re(), { templateDialogProps: o, templateDetailsProps: u } = Be(Re()), x = it(), { loading: T, templates: S } = Be(x), I = B(!1), g = ot(), f = je(), { breakpoints: w } = wt();
|
|
1113
|
+
ce(x.fetchTemplates);
|
|
1114
|
+
const L = R(
|
|
1115
|
+
() => I.value || T.value || !f._currentLocation
|
|
1116
|
+
), q = R(() => S.value), v = B(""), a = R(() => w.value.xs || w.value.sm), h = R(() => a.value ? 10 : 20);
|
|
1117
|
+
function r(n) {
|
|
1118
|
+
switch (n) {
|
|
1119
|
+
case Ae.Add:
|
|
1120
|
+
return d();
|
|
1121
|
+
case "refresh":
|
|
1122
|
+
return x.fetchTemplates();
|
|
1123
|
+
case "import":
|
|
1124
|
+
return c();
|
|
1125
|
+
case "export":
|
|
1126
|
+
return m();
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
function y(n) {
|
|
1130
|
+
return n;
|
|
1131
|
+
}
|
|
1132
|
+
const s = R(() => [
|
|
1133
|
+
{
|
|
1134
|
+
label: _("inventory.closing.template.create.title"),
|
|
1135
|
+
value: Ae.Add,
|
|
1136
|
+
isPrimary: !0,
|
|
1137
|
+
prependIcon: "add"
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
label: "Refresh",
|
|
1141
|
+
value: "refresh",
|
|
1142
|
+
isPrimary: !1
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
label: "Import",
|
|
1146
|
+
value: "import",
|
|
1147
|
+
isPrimary: !1
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
label: "Export",
|
|
1151
|
+
value: "export",
|
|
1152
|
+
isPrimary: !1
|
|
1153
|
+
}
|
|
1154
|
+
]);
|
|
1155
|
+
return (n, i) => {
|
|
1156
|
+
const $ = O("FmTable");
|
|
1157
|
+
return D(), Q(qe, null, [
|
|
1158
|
+
p(st, {
|
|
1159
|
+
title: e(_)("inventory.transfer.template.title2"),
|
|
1160
|
+
actions: s.value,
|
|
1161
|
+
"onClick:action": r
|
|
1162
|
+
}, {
|
|
1163
|
+
default: E(() => {
|
|
1164
|
+
var V;
|
|
1165
|
+
return [
|
|
1166
|
+
t("div", {
|
|
1167
|
+
class: ie([
|
|
1168
|
+
"flex flex-col gap-8 max-h-full",
|
|
1169
|
+
{
|
|
1170
|
+
"p-0": a.value,
|
|
1171
|
+
"px-24 ": !a.value
|
|
1172
|
+
}
|
|
1173
|
+
])
|
|
1174
|
+
}, [
|
|
1175
|
+
p(lt, {
|
|
1176
|
+
searchable: "",
|
|
1177
|
+
search: v.value,
|
|
1178
|
+
"onUpdate:search": i[0] || (i[0] = (k) => v.value = k)
|
|
1179
|
+
}, null, 8, ["search"]),
|
|
1180
|
+
(D(), K($, {
|
|
1181
|
+
style: Xe(e(g).tableHeight),
|
|
1182
|
+
"column-defs": e(x).columnDefs,
|
|
1183
|
+
"row-data": q.value,
|
|
1184
|
+
"search-value": v.value,
|
|
1185
|
+
loading: L.value,
|
|
1186
|
+
key: (V = e(f)._currentLocation) == null ? void 0 : V.dbName,
|
|
1187
|
+
onRowClick: i[1] || (i[1] = (k) => e(l)(k.original)),
|
|
1188
|
+
"page-size": h.value
|
|
1189
|
+
}, {
|
|
1190
|
+
"list-row": E((k) => [
|
|
1191
|
+
p(Ge, {
|
|
1192
|
+
row: k,
|
|
1193
|
+
onRowClick: (F) => e(l)(F)
|
|
1194
|
+
}, {
|
|
1195
|
+
default: E((F) => {
|
|
1196
|
+
var A, z, H, M, U, X, fe, ye, te, ve, be, _e, xe, oe, he, ge, Fe, Te, we, ke, se, Me, Se, $e, Ce, le, Oe;
|
|
1197
|
+
return [
|
|
1198
|
+
t("div", Ko, [
|
|
1199
|
+
t("div", Wo, [
|
|
1200
|
+
t("div", Zo, [
|
|
1201
|
+
p(e(j), {
|
|
1202
|
+
render: (H = (z = (A = F._id) == null ? void 0 : A.column) == null ? void 0 : z.columnDef) == null ? void 0 : H.cell,
|
|
1203
|
+
props: (U = (M = F._id) == null ? void 0 : M.getContext) == null ? void 0 : U.call(M)
|
|
1204
|
+
}, null, 8, ["render", "props"])
|
|
1205
|
+
]),
|
|
1206
|
+
t("div", Jo, [
|
|
1207
|
+
p(e(j), {
|
|
1208
|
+
render: (ye = (fe = (X = F.name) == null ? void 0 : X.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ye.cell,
|
|
1209
|
+
props: (ve = (te = F.name) == null ? void 0 : te.getContext) == null ? void 0 : ve.call(te)
|
|
1210
|
+
}, null, 8, ["render", "props"])
|
|
1211
|
+
]),
|
|
1212
|
+
t("div", Xo, [
|
|
1213
|
+
p(e(j), {
|
|
1214
|
+
render: (xe = (_e = (be = F.supplier) == null ? void 0 : be.column) == null ? void 0 : _e.columnDef) == null ? void 0 : xe.cell,
|
|
1215
|
+
props: (he = (oe = F.supplier) == null ? void 0 : oe.getContext) == null ? void 0 : he.call(oe)
|
|
1216
|
+
}, null, 8, ["render", "props"])
|
|
1217
|
+
]),
|
|
1218
|
+
t("div", null, C((ge = k.original.locations) != null && ge.length ? `Enabled for ${(Fe = k.original.locations) == null ? void 0 : Fe.length} outlets` : "Enabled for all outlets"), 1),
|
|
1219
|
+
t("div", Yo, C(k.original.purchaseOrder.items.length ? k.original.purchaseOrder.items.map((Ke) => Ke.name).join(", ") : "No items"), 1),
|
|
1220
|
+
t("div", es, [
|
|
1221
|
+
p(e(j), {
|
|
1222
|
+
render: (ke = (we = (Te = F.ref) == null ? void 0 : Te.column) == null ? void 0 : we.columnDef) == null ? void 0 : ke.cell,
|
|
1223
|
+
props: (Me = (se = F.ref) == null ? void 0 : se.getContext) == null ? void 0 : Me.call(se)
|
|
1224
|
+
}, null, 8, ["render", "props"])
|
|
1225
|
+
])
|
|
1226
|
+
]),
|
|
1227
|
+
t("div", null, [
|
|
1228
|
+
p(e(j), {
|
|
1229
|
+
render: (Ce = ($e = (Se = F.type) == null ? void 0 : Se.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Ce.cell,
|
|
1230
|
+
props: (Oe = (le = F.type) == null ? void 0 : le.getContext) == null ? void 0 : Oe.call(le)
|
|
1231
|
+
}, null, 8, ["render", "props"])
|
|
1232
|
+
])
|
|
1233
|
+
])
|
|
1234
|
+
];
|
|
1235
|
+
}),
|
|
1236
|
+
_: 2
|
|
1237
|
+
}, 1032, ["row", "onRowClick"])
|
|
1238
|
+
]),
|
|
1239
|
+
_: 1
|
|
1240
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1241
|
+
], 2)
|
|
1242
|
+
];
|
|
1243
|
+
}),
|
|
1244
|
+
_: 1
|
|
1245
|
+
}, 8, ["title", "actions"]),
|
|
1246
|
+
(D(), K(Ye, { to: "body" }, [
|
|
1247
|
+
p(Go, et(tt(e(u))), null, 16),
|
|
1248
|
+
p(yo, Ue(e(o), {
|
|
1249
|
+
onSubmitted: i[2] || (i[2] = (V) => e(x).fetchTemplates())
|
|
1250
|
+
}), null, 16)
|
|
1251
|
+
]))
|
|
1252
|
+
], 64);
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
export {
|
|
1257
|
+
vs as default
|
|
1258
|
+
};
|