@feedmepos/mf-inventory-portal 0.0.25-dev.3 → 0.0.25-dev.31
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-9X9XkRz2.js +280 -0
- package/dist/ApprovalView-CoIwMOje.js +146 -0
- package/dist/{BindingsDialog-DPvBW5cM.js → BindingsDialog-B3ul7-vn.js} +6 -6
- package/dist/{BindingsPicker-DHjUZp_W.js → BindingsPicker-CWMHp2sY.js} +7 -7
- package/dist/{BindingsTable-D29VX7KG.js → BindingsTable-BqST2NOr.js} +10 -10
- package/dist/ClosingDraftView-CeN0MagA.js +1340 -0
- package/dist/ClosingTemplateView-BmTacXGq.js +1859 -0
- package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js +34 -0
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CigELrfY.js +215 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DLVeADwI.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Bp2oPPMX.js} +37 -37
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-CbTEp_-D.js +51 -0
- package/dist/{IngredientGroupView-BZGkNkrt.js → IngredientGroupView-DPpznEXs.js} +1 -1
- package/dist/{IngredientsView-V_vDYAho.js → IngredientsView-D2RCvzFX.js} +394 -382
- package/dist/{IntegrationView-CK_4s6nJ.js → IntegrationView-Qxv2pvF6.js} +660 -623
- package/dist/{InventoryBindingForm-CAWQBqr1.js → InventoryBindingForm-Do7ElpgS.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BDWmhU7C.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-veh3riBN.js} +99 -99
- package/dist/{InventoryBindingSummary-BBppQstd.js → InventoryBindingSummary-By58hpzm.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-e54jzd1P.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dx3lo70J.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DKUl-kuR.js → PremiumBadge.vue_vue_type_script_setup_true_lang-E3HiIawC.js} +17 -17
- package/dist/PublishView-C7Sk1xx_.js +222 -0
- package/dist/{PurchaseOrderPrintPreview-DiDSTpNu.js → PurchaseOrderPrintPreview-Dm6VK50g.js} +1 -1
- package/dist/ReceiveRequestView-OjIHRXR0.js +2654 -0
- package/dist/{RecipeView-DmYWjO2j.js → RecipeView-DvUxMPcE.js} +32 -31
- package/dist/{index-CBXvWfSg.js → StockView-BmWtH5o7.js} +3577 -1764
- package/dist/{SupplierView-DKISIdqs.js → SupplierView-CSRJiF0L.js} +12 -11
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BQ1zIGI5.js +1831 -0
- package/dist/TransferTemplateView-DVZ-l-Qd.js +1524 -0
- package/dist/{UnitView-CvUayQQ1.js → UnitView-KxXsoPf-.js} +14 -14
- package/dist/{WarehouseView-IoiXm1I8.js → WarehouseView-pP_XFBL6.js} +332 -314
- package/dist/api/closing-draft.d.ts +1 -0
- package/dist/api/inventory.d.ts +9 -6
- package/dist/api/netsuite.d.ts +21 -4
- package/dist/api/purchase-order.d.ts +3 -1
- package/dist/{app-CX6n1ion.js → app-qP-te2rC.js} +28560 -28529
- package/dist/app.js +1 -1
- package/dist/components/FmAutocompleteTextField.vue.d.ts +31 -0
- package/dist/components/FmCustomAttribute.vue.d.ts +3 -8
- package/dist/components/FmLockableField.vue.d.ts +3 -0
- package/dist/components/FmMultiselectDialog.d.ts +46 -0
- package/dist/components/FmMultiselectDialog.vue.d.ts +20 -3
- package/dist/components/FmMultiselectDialogProps.d.ts +2 -0
- package/dist/components/MountListener.vue.d.ts +15 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -1
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -1
- package/dist/{decimal-CWOfT2lu.js → decimal-CNwkFnUQ.js} +1 -1
- package/dist/feature-D4R2fV5-.js +1011 -0
- package/dist/{format-unit-display-9aWRoLgP.js → format-unit-display-BmyzOzt2.js} +335 -328
- package/dist/helper/fuzzy.d.ts +10 -0
- package/dist/index-B6w232vo.js +35546 -0
- package/dist/{stock-C2QEA4Bf.js → stock-XRT7HXo1.js} +3 -3
- package/dist/stores/feature.d.ts +7 -7
- package/dist/stores/integration/netsuite.d.ts +26 -4
- package/dist/stores/inventory.d.ts +135 -8
- package/dist/stores/location.d.ts +100 -0
- package/dist/stores/warehouse.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-DNuzB_6-.js → supplier-BcKjL7Tk.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/use-ingredient-select-dialog-BjX2siCb.js +51 -0
- package/dist/{use-inventory-binding-dialog-D4We0HnY.js → use-inventory-binding-dialog-BypYql87.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +24 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +24 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +8 -4
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +48 -24
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +1 -1
- 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 +36 -12
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -12
- package/dist/views/dev/components/AutocompleteTextField.vue.d.ts +2 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +3 -3
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
- package/dist/views/ingredients/composables/use-ingredient-select-dialog.d.ts +16 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +1197 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +5 -1
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +3 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -2
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +6 -2
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +382 -2
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +4 -2
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +126 -35
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +114 -35
- package/dist/views/receive-request/helper/po-to-po-template.util.d.ts +1 -0
- package/dist/views/receive-request/helper/print-po.d.ts +9 -2
- package/dist/views/receive-request/import/XilnexImportDialog.vue.d.ts +22 -0
- package/dist/views/receive-request/import/XilnexImportForm.vue.d.ts +17 -0
- package/dist/views/receive-request/import/XilnexResult.vue.d.ts +17 -0
- package/dist/views/receive-request/import/export.d.ts +12 -0
- package/dist/views/receive-request/import/props.d.ts +7 -0
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +4 -2
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +220 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +8 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +1 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +6 -2
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +60 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +60 -12
- package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +305 -0
- package/dist/views/transfer-template/helpers/location-to-po-supplier.util.d.ts +75 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -0
- package/dist/{vue-i18n-D1f9MmwY.js → vue-i18n-BRVI-fYl.js} +194 -194
- package/package.json +2 -2
- package/dist/App-Du7DrI4b.js +0 -276
- package/dist/ApprovalView-CTZVmCbC.js +0 -138
- package/dist/ClosingDraftView-D6_mQmyF.js +0 -1225
- package/dist/ClosingTemplateView-DMConQNm.js +0 -1819
- package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-DuB-gluw.js +0 -142
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ttr6ec9b.js +0 -286
- package/dist/PublishView-BzUykEd5.js +0 -192
- package/dist/ReceiveRequestView-BWgm4e46.js +0 -1876
- package/dist/StockView--YVDLsgO.js +0 -1817
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CTy65dTx.js +0 -1327
- package/dist/TransferTemplateView-KOeBENZz.js +0 -1284
- package/dist/components/FmCustomAttribute2.vue.d.ts +0 -18
- package/dist/index-CCWsIAQX.js +0 -29202
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +0 -2628
|
@@ -0,0 +1,2654 @@
|
|
|
1
|
+
import { defineComponent as se, onMounted as ze, onUnmounted as $t, renderSlot as It, h as H, reactive as bt, computed as M, openBlock as S, createElementBlock as I, Fragment as le, renderList as Ce, createElementVNode as n, toDisplayString as R, unref as o, resolveComponent as $, createVNode as m, withCtx as T, createCommentVNode as L, ref as E, createBlock as Y, watch as be, normalizeClass as Q, normalizeStyle as gt, createTextVNode as $e, nextTick as Tt, mergeProps as Xe, isRef as xe, createSlots as Pt, Teleport as Rt, normalizeProps as Vt, guardReactiveProps as Et } from "vue";
|
|
2
|
+
import { H as Ze, b as He, Z as De, l as Ee, i as Se, a0 as Ge, K as At, as as Mt, A as Le, M as Ut, m as _t, ab as We, E as me, at as qt, a as Je, au as Ot, av as Nt, aw as Bt, G as ht, u as je, ax as Lt, ay as zt, $ as Ht, T as jt, az as Yt, B as kt, O as Qt, d as Ve, v as Kt, w as Xt, x as Zt, aA as Be, a5 as ct, y as Gt, _ as Wt, z as Jt, N as pt } from "./app-qP-te2rC.js";
|
|
3
|
+
import { u as et, a as eo, P as Ke, b as to, _ as oo, g as so } from "./TransferDetails.vue_vue_type_script_setup_true_lang-BQ1zIGI5.js";
|
|
4
|
+
import { _ as xt, u as ao, i as no, e as lo } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-E3HiIawC.js";
|
|
5
|
+
import { u as ro } from "./useTabStorage-BkIVScW_.js";
|
|
6
|
+
import { useDialog as St, useBreakpoints as tt, components as fe, FmButtonVariant as io, useSnackbar as Ie, useProxiedModel as Ct } from "@feedmepos/ui-library";
|
|
7
|
+
import { P as oe, u as wt } from "./format-unit-display-BmyzOzt2.js";
|
|
8
|
+
import { _ as uo, F as mo, a as co, b as po } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-Bp2oPPMX.js";
|
|
9
|
+
import { u as ot } from "./feature-D4R2fV5-.js";
|
|
10
|
+
import { c as ke, u as fo, _ as vo, l as yo } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CigELrfY.js";
|
|
11
|
+
import { useI18n as ce } from "@feedmepos/mf-common";
|
|
12
|
+
import { defineStore as bo } from "pinia";
|
|
13
|
+
import { u as st } from "./supplier-BcKjL7Tk.js";
|
|
14
|
+
import { _ as go } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
15
|
+
import { u as _o } from "./vue-i18n-BRVI-fYl.js";
|
|
16
|
+
import "./array-hChJVZLE.js";
|
|
17
|
+
const ho = /* @__PURE__ */ se({
|
|
18
|
+
__name: "MountListener",
|
|
19
|
+
emits: ["mounted", "unmounted"],
|
|
20
|
+
setup(c, { emit: y }) {
|
|
21
|
+
const r = y;
|
|
22
|
+
return ze(() => r("mounted")), $t(() => r("unmounted")), (l, h) => It(l.$slots, "default");
|
|
23
|
+
}
|
|
24
|
+
}), Ft = bo("inventoryMultiSelectDialog", () => {
|
|
25
|
+
const c = St(), { t: y } = ce();
|
|
26
|
+
return { multiSelect: async (t, u, d) => {
|
|
27
|
+
const b = d ?? ((a) => a), { promise: i, resolve: e } = Promise.withResolvers();
|
|
28
|
+
return c.open({
|
|
29
|
+
title: "Select items",
|
|
30
|
+
closeButton: !0,
|
|
31
|
+
contentComponent: Ze,
|
|
32
|
+
contentComponentProps: {
|
|
33
|
+
modelValue: u ?? [],
|
|
34
|
+
items: t,
|
|
35
|
+
virtualScroll: !0,
|
|
36
|
+
onClose: () => e(null)
|
|
37
|
+
},
|
|
38
|
+
primaryActions: {
|
|
39
|
+
text: y("common.confirm"),
|
|
40
|
+
close: !0
|
|
41
|
+
},
|
|
42
|
+
secondaryActions: {
|
|
43
|
+
text: y("common.close"),
|
|
44
|
+
close: !0,
|
|
45
|
+
variant: "tertiary"
|
|
46
|
+
}
|
|
47
|
+
}).onPrimary((a) => {
|
|
48
|
+
const k = a.map((f) => b(f));
|
|
49
|
+
e(k);
|
|
50
|
+
}), i;
|
|
51
|
+
}, singleSelect: async (t, u, d) => {
|
|
52
|
+
const b = d ?? ((a) => a), { promise: i, resolve: e } = Promise.withResolvers();
|
|
53
|
+
return c.open({
|
|
54
|
+
title: "Select items",
|
|
55
|
+
closeButton: !0,
|
|
56
|
+
contentComponent: Ze,
|
|
57
|
+
contentComponentProps: {
|
|
58
|
+
modelValue: u ? [u] : [],
|
|
59
|
+
items: t,
|
|
60
|
+
virtualScroll: !0,
|
|
61
|
+
onClose: () => e(void 0),
|
|
62
|
+
singleSelect: !0
|
|
63
|
+
},
|
|
64
|
+
primaryActions: {
|
|
65
|
+
text: y("common.confirm"),
|
|
66
|
+
close: !0
|
|
67
|
+
},
|
|
68
|
+
secondaryActions: {
|
|
69
|
+
text: y("common.close"),
|
|
70
|
+
close: !0,
|
|
71
|
+
variant: "tertiary"
|
|
72
|
+
}
|
|
73
|
+
}).onPrimary((a) => {
|
|
74
|
+
if (!a.length)
|
|
75
|
+
return e(null);
|
|
76
|
+
const k = b(a[0]);
|
|
77
|
+
e(k);
|
|
78
|
+
}), i;
|
|
79
|
+
}, confirmation: async (t, u, d, b, i) => {
|
|
80
|
+
const { promise: e, resolve: a } = Promise.withResolvers();
|
|
81
|
+
return c.open({
|
|
82
|
+
title: t,
|
|
83
|
+
message: typeof u == "string" ? u : void 0,
|
|
84
|
+
contentComponent: H(
|
|
85
|
+
ho,
|
|
86
|
+
{
|
|
87
|
+
onUnmounted: () => {
|
|
88
|
+
a(null);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
u
|
|
92
|
+
),
|
|
93
|
+
contentComponentProps: {},
|
|
94
|
+
primaryActions: d ?? {
|
|
95
|
+
text: y("common.confirm"),
|
|
96
|
+
close: !0
|
|
97
|
+
},
|
|
98
|
+
secondaryActions: b ?? {
|
|
99
|
+
text: y("common.close"),
|
|
100
|
+
close: !0,
|
|
101
|
+
variant: "tertiary"
|
|
102
|
+
},
|
|
103
|
+
tertiaryActions: i,
|
|
104
|
+
closeButton: !0,
|
|
105
|
+
dismissAway: !0
|
|
106
|
+
}).onPrimary(() => {
|
|
107
|
+
a((d == null ? void 0 : d.value) ?? !0);
|
|
108
|
+
}).onSecondary(() => {
|
|
109
|
+
a((b == null ? void 0 : b.value) ?? !1);
|
|
110
|
+
}).onTertiary(() => {
|
|
111
|
+
a((i == null ? void 0 : i.value) ?? void 0);
|
|
112
|
+
}), e;
|
|
113
|
+
} };
|
|
114
|
+
});
|
|
115
|
+
var G = /* @__PURE__ */ ((c) => (c.Code = "Code", c.Name = "Name", c.TemplateName = "TemplateName", c.Amount = "Amount", c.Cost = "Cost", c.Delete = "Delete", c))(G || {});
|
|
116
|
+
const ko = () => (ce(), H(
|
|
117
|
+
xt,
|
|
118
|
+
{
|
|
119
|
+
zIndex: 50,
|
|
120
|
+
class: "whitespace-nowrap"
|
|
121
|
+
},
|
|
122
|
+
`Total (${_t()})`
|
|
123
|
+
));
|
|
124
|
+
function xo(c) {
|
|
125
|
+
const { t: y } = ce(), r = bt({}), { breakpoints: l } = tt(), h = ot(), t = He();
|
|
126
|
+
Ft(), ze(() => {
|
|
127
|
+
for (const i of c.items) {
|
|
128
|
+
if (!i.totalCost)
|
|
129
|
+
continue;
|
|
130
|
+
const e = ke(i.sku, i.quantity, i.measurement, {
|
|
131
|
+
supplier: c.supplier
|
|
132
|
+
}), a = i.totalCost ?? De.reset();
|
|
133
|
+
e ? r[i.sku._id] = e.amount !== a.amount || e.precision !== a.precision : r[i.sku._id] = !0;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
function u(i) {
|
|
137
|
+
var a, k, f, g, w, F, p;
|
|
138
|
+
return !!(((k = (a = i.defaultCost) == null ? void 0 : a.costPerUnit) == null ? void 0 : k.amount) ?? ((p = (F = (w = (g = (f = c.supplier) == null ? void 0 : f.supplyItems) == null ? void 0 : g.find((v) => v.skuId === i._id)) == null ? void 0 : w.defaultCost) == null ? void 0 : F.costPerUnit) == null ? void 0 : p.amount));
|
|
139
|
+
}
|
|
140
|
+
const d = [
|
|
141
|
+
{
|
|
142
|
+
id: "Code",
|
|
143
|
+
header: () => y("inventory.transfer.form.items.table.Code"),
|
|
144
|
+
accessorKey: "code",
|
|
145
|
+
size: 200,
|
|
146
|
+
cell(i) {
|
|
147
|
+
const e = i.row.original;
|
|
148
|
+
return t.isEnabled ? H(
|
|
149
|
+
fe.FmTooltip,
|
|
150
|
+
{
|
|
151
|
+
content: e.code,
|
|
152
|
+
placement: "top",
|
|
153
|
+
variant: "plain",
|
|
154
|
+
zIndex: 50
|
|
155
|
+
},
|
|
156
|
+
H(
|
|
157
|
+
"span",
|
|
158
|
+
{
|
|
159
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
160
|
+
},
|
|
161
|
+
e.code
|
|
162
|
+
)
|
|
163
|
+
) : H(fe.FmTextField, {
|
|
164
|
+
modelValue: e.code,
|
|
165
|
+
"onUpdate:modelValue": (a) => {
|
|
166
|
+
c.updateItem({
|
|
167
|
+
...e,
|
|
168
|
+
code: a
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
key: e.sku._id,
|
|
172
|
+
rules: [Ee()],
|
|
173
|
+
labelMark: "required"
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
enableSorting: !1
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "Name",
|
|
180
|
+
header: () => y("inventory.transfer.form.items.table.Name"),
|
|
181
|
+
minSize: 300,
|
|
182
|
+
cell(i) {
|
|
183
|
+
const e = i.row.original;
|
|
184
|
+
return t.isEnabled ? H(
|
|
185
|
+
fe.FmTooltip,
|
|
186
|
+
{
|
|
187
|
+
content: e.name,
|
|
188
|
+
placement: "top",
|
|
189
|
+
variant: "plain",
|
|
190
|
+
zIndex: 50
|
|
191
|
+
},
|
|
192
|
+
H(
|
|
193
|
+
"span",
|
|
194
|
+
{
|
|
195
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
196
|
+
},
|
|
197
|
+
e.name
|
|
198
|
+
)
|
|
199
|
+
) : H(fe.FmTextField, {
|
|
200
|
+
modelValue: e.name,
|
|
201
|
+
"onUpdate:modelValue": (a) => {
|
|
202
|
+
c.updateItem({
|
|
203
|
+
...e,
|
|
204
|
+
name: a
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
key: e.sku._id,
|
|
208
|
+
rules: [Ee()],
|
|
209
|
+
labelMark: "required"
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
enableSorting: !1
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: "TemplateName",
|
|
216
|
+
header: () => y("inventory.transfer.form.items.table.Name"),
|
|
217
|
+
minSize: 300,
|
|
218
|
+
enableSorting: !1,
|
|
219
|
+
cell(i) {
|
|
220
|
+
const e = i.row.original, a = e.code, k = e.name;
|
|
221
|
+
return H(
|
|
222
|
+
fe.FmTooltip,
|
|
223
|
+
{ zIndex: 50 },
|
|
224
|
+
{
|
|
225
|
+
default() {
|
|
226
|
+
return H("div", { class: "flex flex-col w-full" }, [
|
|
227
|
+
H(
|
|
228
|
+
"div",
|
|
229
|
+
{ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
|
|
230
|
+
k
|
|
231
|
+
),
|
|
232
|
+
H(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
class: "line-clamp-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
236
|
+
},
|
|
237
|
+
a
|
|
238
|
+
)
|
|
239
|
+
]);
|
|
240
|
+
},
|
|
241
|
+
content() {
|
|
242
|
+
return k;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: "Amount",
|
|
250
|
+
header: () => y("inventory.transfer.form.items.table.Amount"),
|
|
251
|
+
minSize: 200,
|
|
252
|
+
cell(i) {
|
|
253
|
+
var k, f, g, w;
|
|
254
|
+
const e = i.row.original, a = (g = (f = (k = c.template) == null ? void 0 : k.purchaseOrder) == null ? void 0 : f.items) == null ? void 0 : g.find(
|
|
255
|
+
(F) => F.sku._id === e.sku._id
|
|
256
|
+
);
|
|
257
|
+
return H(uo, {
|
|
258
|
+
style: {
|
|
259
|
+
flex: "1 1 0%"
|
|
260
|
+
},
|
|
261
|
+
modelValue: {
|
|
262
|
+
amount: e.quantity ?? { amount: 1, precision: 0 },
|
|
263
|
+
measurement: e.measurement ?? null
|
|
264
|
+
},
|
|
265
|
+
key: e.sku._id,
|
|
266
|
+
unit: e.sku.unit,
|
|
267
|
+
"onUpdate:modelValue": (F) => {
|
|
268
|
+
if (!F) return;
|
|
269
|
+
const p = {
|
|
270
|
+
...e,
|
|
271
|
+
quantity: F.amount,
|
|
272
|
+
measurement: F.measurement
|
|
273
|
+
};
|
|
274
|
+
h.enableTotalCost && (p.totalCost = ke(e.sku, e.quantity, e.measurement, {
|
|
275
|
+
supplier: c.supplier,
|
|
276
|
+
// NOTE: set undefined here if `manualTotalCost[row.sku._id] = false`, so that the function
|
|
277
|
+
// will return the auto calculated default cost instead of the manual total cost
|
|
278
|
+
manualTotalCost: r[e.sku._id] ? p.totalCost : void 0
|
|
279
|
+
})), c.updateItem(p);
|
|
280
|
+
},
|
|
281
|
+
stepper: a == null ? void 0 : a.quantityStep,
|
|
282
|
+
disableUnit: !!a,
|
|
283
|
+
disabled: c.disabled,
|
|
284
|
+
rules: [
|
|
285
|
+
mo(
|
|
286
|
+
+Se(
|
|
287
|
+
((w = e.quantity) == null ? void 0 : w.amount) === 0 ? { amount: 0, precision: 0 } : (a == null ? void 0 : a.minimumQuantity) ?? { amount: 0, precision: 0 }
|
|
288
|
+
)
|
|
289
|
+
),
|
|
290
|
+
co(
|
|
291
|
+
a != null && a.maximumQuantity ? +Se(a == null ? void 0 : a.maximumQuantity) : 1 / 0
|
|
292
|
+
),
|
|
293
|
+
...a != null && a.quantityStep ? [po(a.quantityStep)] : []
|
|
294
|
+
],
|
|
295
|
+
applyDefaultRules: !0
|
|
296
|
+
});
|
|
297
|
+
},
|
|
298
|
+
enableSorting: !1
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: "Cost",
|
|
302
|
+
header: ko,
|
|
303
|
+
size: 180,
|
|
304
|
+
cell(i) {
|
|
305
|
+
const e = i.row.original, a = u(e.sku), k = l.value.xs || l.value.sm;
|
|
306
|
+
return !r[e.sku._id] && a ? H(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
class: [
|
|
310
|
+
"flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
311
|
+
c.disabled ? "text-fm-color-typo-disabled" : ""
|
|
312
|
+
],
|
|
313
|
+
key: e.sku._id
|
|
314
|
+
},
|
|
315
|
+
[
|
|
316
|
+
H(fe.FmButton, {
|
|
317
|
+
prependIcon: "edit",
|
|
318
|
+
variant: io.Tertiary,
|
|
319
|
+
disabled: c.disabled,
|
|
320
|
+
onClick() {
|
|
321
|
+
c.updateItem({
|
|
322
|
+
...e,
|
|
323
|
+
totalCost: ke(e.sku, e.quantity, e.measurement, {
|
|
324
|
+
supplier: c.supplier
|
|
325
|
+
})
|
|
326
|
+
}), r[e.sku._id] = !0;
|
|
327
|
+
}
|
|
328
|
+
}),
|
|
329
|
+
H(
|
|
330
|
+
"div",
|
|
331
|
+
{
|
|
332
|
+
class: "flex flex-col"
|
|
333
|
+
},
|
|
334
|
+
[
|
|
335
|
+
H(
|
|
336
|
+
"span",
|
|
337
|
+
k ? Ge(
|
|
338
|
+
ke(e.sku, e.quantity, e.measurement, {
|
|
339
|
+
supplier: c.supplier
|
|
340
|
+
})
|
|
341
|
+
) : Se(
|
|
342
|
+
ke(e.sku, e.quantity, e.measurement, {
|
|
343
|
+
supplier: c.supplier
|
|
344
|
+
})
|
|
345
|
+
)
|
|
346
|
+
),
|
|
347
|
+
H(
|
|
348
|
+
"span",
|
|
349
|
+
{
|
|
350
|
+
class: [
|
|
351
|
+
"fm-typo-en-body-sm-400",
|
|
352
|
+
c.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
y("inventory.transfer.form.items.autoCalculated")
|
|
356
|
+
)
|
|
357
|
+
]
|
|
358
|
+
)
|
|
359
|
+
]
|
|
360
|
+
) : H(
|
|
361
|
+
fe.FmTextField,
|
|
362
|
+
{
|
|
363
|
+
modelValue: Se(e.totalCost ?? { amount: 0, precision: 0 }),
|
|
364
|
+
key: e.sku._id,
|
|
365
|
+
"onUpdate:modelValue": (f) => {
|
|
366
|
+
c.updateItem({
|
|
367
|
+
...e,
|
|
368
|
+
totalCost: {
|
|
369
|
+
...At(+f),
|
|
370
|
+
currency: Mt()
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
rules: [Le(0), Ut(2)]
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
prepend() {
|
|
378
|
+
return k ? H(
|
|
379
|
+
"div",
|
|
380
|
+
{
|
|
381
|
+
class: [
|
|
382
|
+
"text-fm-typo-en-body-lg-400",
|
|
383
|
+
c.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
384
|
+
]
|
|
385
|
+
},
|
|
386
|
+
_t()
|
|
387
|
+
) : null;
|
|
388
|
+
},
|
|
389
|
+
append() {
|
|
390
|
+
return a ? H(fe.FmButton, {
|
|
391
|
+
prependIcon: "close",
|
|
392
|
+
variant: "tertiary",
|
|
393
|
+
disabled: c.disabled,
|
|
394
|
+
onClick() {
|
|
395
|
+
c.updateItem({
|
|
396
|
+
...e,
|
|
397
|
+
// NOTE: different from PO template, if a default cost is reenabled,
|
|
398
|
+
// the total cost will automatically assigned
|
|
399
|
+
totalCost: ke(e.sku, e.quantity, e.measurement, {
|
|
400
|
+
supplier: c.supplier
|
|
401
|
+
})
|
|
402
|
+
}), r[e.sku._id] = !1;
|
|
403
|
+
}
|
|
404
|
+
}) : null;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
},
|
|
409
|
+
enableSorting: !1
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
id: "Delete",
|
|
413
|
+
header: "",
|
|
414
|
+
cell(i) {
|
|
415
|
+
const e = i.row.original;
|
|
416
|
+
return H("div", { class: "flex justify-end" }, [
|
|
417
|
+
H(fe.FmButton, {
|
|
418
|
+
key: e.sku._id,
|
|
419
|
+
class: "delete-button",
|
|
420
|
+
type: "button",
|
|
421
|
+
icon: "delete",
|
|
422
|
+
variant: "tertiary",
|
|
423
|
+
size: "md",
|
|
424
|
+
disabled: c.disabled,
|
|
425
|
+
onClick: () => {
|
|
426
|
+
c.deleteItem(e);
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
]);
|
|
430
|
+
},
|
|
431
|
+
enableSorting: !1,
|
|
432
|
+
size: 40,
|
|
433
|
+
meta: {
|
|
434
|
+
cellClass: "",
|
|
435
|
+
headerClass: ""
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
];
|
|
439
|
+
return {
|
|
440
|
+
columnDefs: M(() => h.enableTotalCost && c.transferType === oe.PURCHASE ? d : d.filter(
|
|
441
|
+
(i) => i.id !== "Cost"
|
|
442
|
+
/* Cost */
|
|
443
|
+
))
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
const So = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, Co = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, wo = { class: "w-[450px] xs:w-full flex" }, Fo = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Do = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Dt = /* @__PURE__ */ se({
|
|
447
|
+
__name: "SupplierPriceHistory",
|
|
448
|
+
props: {
|
|
449
|
+
prices: {}
|
|
450
|
+
},
|
|
451
|
+
setup(c) {
|
|
452
|
+
const y = st();
|
|
453
|
+
function r(l) {
|
|
454
|
+
return y.suppliers.find((h) => h._id === l);
|
|
455
|
+
}
|
|
456
|
+
return (l, h) => (S(), I("div", So, [
|
|
457
|
+
(S(!0), I(le, null, Ce(Object.keys(l.prices), (t) => {
|
|
458
|
+
var u;
|
|
459
|
+
return S(), I("div", {
|
|
460
|
+
key: t,
|
|
461
|
+
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
462
|
+
}, [
|
|
463
|
+
n("div", Co, R((u = r(t)) == null ? void 0 : u.name), 1),
|
|
464
|
+
n("div", wo, [
|
|
465
|
+
(S(!0), I(le, null, Ce(l.prices[t].slice(0, 3), (d) => {
|
|
466
|
+
var b;
|
|
467
|
+
return S(), I("div", {
|
|
468
|
+
key: d.date,
|
|
469
|
+
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
470
|
+
}, [
|
|
471
|
+
n("div", Fo, [
|
|
472
|
+
n("span", null, R(d.totalCost ? o(Ge)(d.totalCost) : "No data"), 1),
|
|
473
|
+
h[0] || (h[0] = n("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
|
|
474
|
+
n("span", null, R(o(Se)(d.totalUnit, !1)), 1),
|
|
475
|
+
n("span", null, R(((b = d.measurement) == null ? void 0 : b.abbrev) ?? d.unit.abbrev), 1)
|
|
476
|
+
]),
|
|
477
|
+
n("div", Do, [
|
|
478
|
+
n("span", null, "(#" + R(d.seqNumber) + ")", 1),
|
|
479
|
+
h[1] || (h[1] = n("span", null, R(" "), -1)),
|
|
480
|
+
n("span", null, R(o(We)(new Date(d.date))), 1)
|
|
481
|
+
])
|
|
482
|
+
]);
|
|
483
|
+
}), 128))
|
|
484
|
+
])
|
|
485
|
+
]);
|
|
486
|
+
}), 128))
|
|
487
|
+
]));
|
|
488
|
+
}
|
|
489
|
+
}), $o = { class: "flex flex-col gap-8 py-16" }, Io = { class: "flex items-center" }, To = { class: "flex-1 flex gap-1 items-center" }, Po = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ro = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Vo = { class: "flex gap-8 w-full" }, Eo = { class: "flex-1 flex flex-col gap-4" }, Ao = { class: "flex-1 flex flex-col gap-4" }, Mo = { class: "flex gap-8 w-full" }, Uo = { class: "flex-1 flex flex-col gap-4" }, qo = {
|
|
490
|
+
key: 0,
|
|
491
|
+
class: "flex-1 flex flex-col gap-4"
|
|
492
|
+
}, Oo = /* @__PURE__ */ se({
|
|
493
|
+
__name: "TransferItem",
|
|
494
|
+
props: {
|
|
495
|
+
cellByColId: {},
|
|
496
|
+
comparePriceBySku: {},
|
|
497
|
+
showComparePrice: { type: Boolean },
|
|
498
|
+
row: {}
|
|
499
|
+
},
|
|
500
|
+
setup(c) {
|
|
501
|
+
const { t: y } = ce();
|
|
502
|
+
return (r, l) => {
|
|
503
|
+
var u, d, b, i, e, a, k, f, g, w, F, p, v, U, j, V, P, K, O, A, B, q, X, x, C, Z, ue;
|
|
504
|
+
const h = $("FmLabel"), t = $("FmSpacer");
|
|
505
|
+
return S(), I("div", $o, [
|
|
506
|
+
n("div", Io, [
|
|
507
|
+
n("div", To, [
|
|
508
|
+
n("span", Po, " (" + R(r.row.original.sku.code) + ") ", 1),
|
|
509
|
+
n("span", Ro, R(r.row.original.sku.name), 1)
|
|
510
|
+
]),
|
|
511
|
+
n("div", null, [
|
|
512
|
+
m(o(me), {
|
|
513
|
+
render: (b = (d = (u = r.cellByColId.Delete) == null ? void 0 : u.column) == null ? void 0 : d.columnDef) == null ? void 0 : b.cell,
|
|
514
|
+
props: (e = (i = r.cellByColId.Delete) == null ? void 0 : i.getContext) == null ? void 0 : e.call(i)
|
|
515
|
+
}, null, 8, ["render", "props"])
|
|
516
|
+
])
|
|
517
|
+
]),
|
|
518
|
+
n("div", Vo, [
|
|
519
|
+
n("div", Eo, [
|
|
520
|
+
m(h, {
|
|
521
|
+
label: o(y)(`inventory.transfer.form.items.table.${o(G).Code}`)
|
|
522
|
+
}, null, 8, ["label"]),
|
|
523
|
+
m(o(me), {
|
|
524
|
+
render: (f = (k = (a = r.cellByColId[o(G).Code]) == null ? void 0 : a.column) == null ? void 0 : k.columnDef) == null ? void 0 : f.cell,
|
|
525
|
+
props: (w = (g = r.cellByColId[o(G).Code]) == null ? void 0 : g.getContext) == null ? void 0 : w.call(g)
|
|
526
|
+
}, null, 8, ["render", "props"]),
|
|
527
|
+
l[0] || (l[0] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
528
|
+
]),
|
|
529
|
+
n("div", Ao, [
|
|
530
|
+
m(h, {
|
|
531
|
+
label: o(y)(`inventory.transfer.form.items.table.${o(G).Name}`)
|
|
532
|
+
}, null, 8, ["label"]),
|
|
533
|
+
m(o(me), {
|
|
534
|
+
render: (v = (p = (F = r.cellByColId[o(G).Name]) == null ? void 0 : F.column) == null ? void 0 : p.columnDef) == null ? void 0 : v.cell,
|
|
535
|
+
props: (j = (U = r.cellByColId[o(G).Name]) == null ? void 0 : U.getContext) == null ? void 0 : j.call(U)
|
|
536
|
+
}, null, 8, ["render", "props"]),
|
|
537
|
+
l[1] || (l[1] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
538
|
+
])
|
|
539
|
+
]),
|
|
540
|
+
n("div", Mo, [
|
|
541
|
+
n("div", Uo, [
|
|
542
|
+
m(h, {
|
|
543
|
+
label: o(y)(`inventory.transfer.form.items.table.${o(G).Amount}`)
|
|
544
|
+
}, null, 8, ["label"]),
|
|
545
|
+
m(o(me), {
|
|
546
|
+
render: (K = (P = (V = r.cellByColId[o(G).Amount]) == null ? void 0 : V.column) == null ? void 0 : P.columnDef) == null ? void 0 : K.cell,
|
|
547
|
+
props: (A = (O = r.cellByColId[o(G).Amount]) == null ? void 0 : O.getContext) == null ? void 0 : A.call(O)
|
|
548
|
+
}, null, 8, ["render", "props"]),
|
|
549
|
+
l[2] || (l[2] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
550
|
+
]),
|
|
551
|
+
r.cellByColId[o(G).Cost] ? (S(), I("div", qo, [
|
|
552
|
+
m(xt, { "z-index": 50 }, {
|
|
553
|
+
default: T(() => [
|
|
554
|
+
m(h, {
|
|
555
|
+
label: o(y)(`inventory.transfer.form.items.table.${o(G).Cost}2`)
|
|
556
|
+
}, null, 8, ["label"])
|
|
557
|
+
]),
|
|
558
|
+
_: 1
|
|
559
|
+
}),
|
|
560
|
+
m(o(me), {
|
|
561
|
+
render: (X = (q = (B = r.cellByColId[o(G).Cost]) == null ? void 0 : B.column) == null ? void 0 : q.columnDef) == null ? void 0 : X.cell,
|
|
562
|
+
props: (C = (x = r.cellByColId[o(G).Cost]) == null ? void 0 : x.getContext) == null ? void 0 : C.call(x)
|
|
563
|
+
}, null, 8, ["render", "props"]),
|
|
564
|
+
l[3] || (l[3] = n("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
565
|
+
])) : L("", !0)
|
|
566
|
+
]),
|
|
567
|
+
r.showComparePrice && Object.keys(r.comparePriceBySku[(Z = r.row.original.sku) == null ? void 0 : Z._id] ?? {}).length > 0 ? (S(), I(le, { key: 0 }, [
|
|
568
|
+
m(t, { class: "h-8" }),
|
|
569
|
+
m(Dt, {
|
|
570
|
+
prices: r.comparePriceBySku[(ue = r.row.original.sku) == null ? void 0 : ue._id]
|
|
571
|
+
}, null, 8, ["prices"])
|
|
572
|
+
], 64)) : L("", !0)
|
|
573
|
+
]);
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
function No(c) {
|
|
578
|
+
const y = M({
|
|
579
|
+
get() {
|
|
580
|
+
const t = c.getEffectiveAt();
|
|
581
|
+
return t ? new Date(t) : null;
|
|
582
|
+
},
|
|
583
|
+
set(t) {
|
|
584
|
+
c.setEffectiveAt((t == null ? void 0 : t.toISOString()) ?? null);
|
|
585
|
+
}
|
|
586
|
+
}), r = M({
|
|
587
|
+
get() {
|
|
588
|
+
return !!y.value;
|
|
589
|
+
},
|
|
590
|
+
set(t) {
|
|
591
|
+
t ? y.value = /* @__PURE__ */ new Date() : y.value = null;
|
|
592
|
+
}
|
|
593
|
+
}), l = M({
|
|
594
|
+
get() {
|
|
595
|
+
return y.value === null ? "" : We(y.value);
|
|
596
|
+
},
|
|
597
|
+
set(t) {
|
|
598
|
+
t ? y.value = /* @__PURE__ */ new Date(`${t} ${h.value}`) : y.value = null;
|
|
599
|
+
}
|
|
600
|
+
}), h = M({
|
|
601
|
+
get() {
|
|
602
|
+
return y.value === null ? "" : qt(y.value);
|
|
603
|
+
},
|
|
604
|
+
set(t) {
|
|
605
|
+
t ? y.value = /* @__PURE__ */ new Date(`${l.value} ${t}`) : y.value = null;
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
return {
|
|
609
|
+
backdatePo: y,
|
|
610
|
+
backdateSwitch: r,
|
|
611
|
+
backdateModel: l,
|
|
612
|
+
backdateTimeModel: h
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
const Bo = {
|
|
616
|
+
width: "24",
|
|
617
|
+
height: "24",
|
|
618
|
+
viewBox: "0 0 24 24",
|
|
619
|
+
fill: "none",
|
|
620
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
621
|
+
}, Lo = ["fill"], zo = ["fill"], Ho = ["stroke"], jo = ["stroke"], Yo = /* @__PURE__ */ se({
|
|
622
|
+
__name: "SparkIcon",
|
|
623
|
+
props: {
|
|
624
|
+
size: {
|
|
625
|
+
type: Number,
|
|
626
|
+
default: 24
|
|
627
|
+
},
|
|
628
|
+
color: {
|
|
629
|
+
type: String,
|
|
630
|
+
default: "#c7c7cc"
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
setup(c) {
|
|
634
|
+
return (y, r) => (S(), I("svg", Bo, [
|
|
635
|
+
n("path", {
|
|
636
|
+
d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
|
|
637
|
+
fill: c.color
|
|
638
|
+
}, null, 8, Lo),
|
|
639
|
+
n("path", {
|
|
640
|
+
d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
|
|
641
|
+
fill: c.color
|
|
642
|
+
}, null, 8, zo),
|
|
643
|
+
n("path", {
|
|
644
|
+
d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
|
|
645
|
+
stroke: c.color,
|
|
646
|
+
"stroke-width": "1.5",
|
|
647
|
+
"stroke-linecap": "round",
|
|
648
|
+
"stroke-linejoin": "round"
|
|
649
|
+
}, null, 8, Ho),
|
|
650
|
+
n("path", {
|
|
651
|
+
d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
|
|
652
|
+
stroke: c.color,
|
|
653
|
+
"stroke-width": "1.5",
|
|
654
|
+
"stroke-linecap": "round",
|
|
655
|
+
"stroke-linejoin": "round"
|
|
656
|
+
}, null, 8, jo)
|
|
657
|
+
]));
|
|
658
|
+
}
|
|
659
|
+
}), Qo = { class: "flex gap-8 items-center" }, Ko = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, Xo = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, Zo = { class: "flex items-center w-full" }, Go = { class: "flex-1" }, Wo = { class: "fm-typo-en-title-sm-800" }, Jo = { class: "flex items-start gap-8" }, es = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ts = { class: "flex gap-1" }, ft = /* @__PURE__ */ se({
|
|
660
|
+
__name: "ForecastStock",
|
|
661
|
+
props: {
|
|
662
|
+
disabled: { type: Boolean }
|
|
663
|
+
},
|
|
664
|
+
emits: ["update:poItems"],
|
|
665
|
+
setup(c, { emit: y }) {
|
|
666
|
+
const r = y, l = E(!1), h = E(7), t = ao(), u = Ie(), d = Je(), { t: b } = ce();
|
|
667
|
+
async function i() {
|
|
668
|
+
if (h.value < 1)
|
|
669
|
+
return;
|
|
670
|
+
l.value = !1, await t.readPurchaseOrder(h.value);
|
|
671
|
+
const e = [];
|
|
672
|
+
if (t.purchaseOrderForecast.skus.length <= 0) {
|
|
673
|
+
u.open({
|
|
674
|
+
message: b("inventory.transfer.form.items.forecastStock.notAvailable"),
|
|
675
|
+
type: "info"
|
|
676
|
+
});
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
const a = t.purchaseOrderForecast.skus.reduce((k, f) => {
|
|
680
|
+
const g = d.skus.find((p) => p._id === f.id);
|
|
681
|
+
if (k.find((p) => p.sku._id === f.id) || !g)
|
|
682
|
+
return k;
|
|
683
|
+
const F = {
|
|
684
|
+
sku: g,
|
|
685
|
+
code: g.code,
|
|
686
|
+
name: g.name,
|
|
687
|
+
quantity: {
|
|
688
|
+
amount: f.amount,
|
|
689
|
+
precision: 0
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
return k.push(F), k;
|
|
693
|
+
}, e);
|
|
694
|
+
r("update:poItems", a);
|
|
695
|
+
}
|
|
696
|
+
return (e, a) => {
|
|
697
|
+
const k = $("FmButton"), f = $("FmIcon"), g = $("FmStepperField"), w = $("FmPopover");
|
|
698
|
+
return S(), Y(w, {
|
|
699
|
+
disabled: e.disabled,
|
|
700
|
+
class: "flex",
|
|
701
|
+
"show-popover": l.value,
|
|
702
|
+
onPopoverChanged: a[3] || (a[3] = (F) => l.value = F)
|
|
703
|
+
}, {
|
|
704
|
+
"popover-button": T(() => [
|
|
705
|
+
m(k, {
|
|
706
|
+
label: "unused",
|
|
707
|
+
variant: "secondary",
|
|
708
|
+
"text-color": e.disabled ? "disabled" : "primary",
|
|
709
|
+
"bg-color": "transparent",
|
|
710
|
+
"border-color": e.disabled ? "disabled" : "primary",
|
|
711
|
+
disabled: e.disabled
|
|
712
|
+
}, {
|
|
713
|
+
default: T(() => [
|
|
714
|
+
n("div", Qo, [
|
|
715
|
+
m(Yo, {
|
|
716
|
+
size: 24,
|
|
717
|
+
color: e.disabled ? "#c7c7cc" : "#ff7823"
|
|
718
|
+
}, null, 8, ["color"]),
|
|
719
|
+
n("div", Ko, R(o(b)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
720
|
+
])
|
|
721
|
+
]),
|
|
722
|
+
_: 1
|
|
723
|
+
}, 8, ["text-color", "border-color", "disabled"])
|
|
724
|
+
]),
|
|
725
|
+
default: T(() => [
|
|
726
|
+
n("div", Xo, [
|
|
727
|
+
n("div", Zo, [
|
|
728
|
+
n("div", Go, [
|
|
729
|
+
m(go, { "z-index": 99 }, {
|
|
730
|
+
default: T(() => [
|
|
731
|
+
n("p", Wo, R(o(b)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
732
|
+
]),
|
|
733
|
+
_: 1
|
|
734
|
+
})
|
|
735
|
+
]),
|
|
736
|
+
m(k, {
|
|
737
|
+
icon: "close",
|
|
738
|
+
size: "md",
|
|
739
|
+
variant: "tertiary",
|
|
740
|
+
onClick: a[0] || (a[0] = (F) => l.value = !1)
|
|
741
|
+
})
|
|
742
|
+
]),
|
|
743
|
+
m(g, {
|
|
744
|
+
modelValue: h.value,
|
|
745
|
+
"onUpdate:modelValue": a[1] || (a[1] = (F) => h.value = F),
|
|
746
|
+
label: o(b)("inventory.transfer.form.items.forecastStock.days"),
|
|
747
|
+
rules: [o(Le)(1)]
|
|
748
|
+
}, {
|
|
749
|
+
"helper-text": T(() => [
|
|
750
|
+
n("div", Jo, [
|
|
751
|
+
m(f, {
|
|
752
|
+
name: "warning",
|
|
753
|
+
size: "sm",
|
|
754
|
+
class: "text-fm-color-system-warning-300"
|
|
755
|
+
}),
|
|
756
|
+
n("div", es, R(o(b)("inventory.transfer.form.items.forecastStock.replace")), 1)
|
|
757
|
+
])
|
|
758
|
+
]),
|
|
759
|
+
_: 1
|
|
760
|
+
}, 8, ["modelValue", "label", "rules"]),
|
|
761
|
+
n("div", ts, [
|
|
762
|
+
a[4] || (a[4] = n("div", { class: "grow" }, null, -1)),
|
|
763
|
+
m(k, {
|
|
764
|
+
label: o(b)("common.cancel"),
|
|
765
|
+
variant: "tertiary",
|
|
766
|
+
onClick: a[2] || (a[2] = (F) => l.value = !1)
|
|
767
|
+
}, null, 8, ["label"]),
|
|
768
|
+
m(k, {
|
|
769
|
+
label: o(b)("inventory.transfer.form.items.forecastStock.generate"),
|
|
770
|
+
onClick: i
|
|
771
|
+
}, null, 8, ["label"])
|
|
772
|
+
])
|
|
773
|
+
])
|
|
774
|
+
]),
|
|
775
|
+
_: 1
|
|
776
|
+
}, 8, ["disabled", "show-popover"]);
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
function os() {
|
|
781
|
+
const c = Ie(), y = et(), r = E(!1);
|
|
782
|
+
be(r, (u) => {
|
|
783
|
+
u && (h.value = !0, l().finally(() => {
|
|
784
|
+
h.value = !1;
|
|
785
|
+
}));
|
|
786
|
+
});
|
|
787
|
+
async function l() {
|
|
788
|
+
try {
|
|
789
|
+
const { startDate: u, endDate: d } = Ot(6), e = (await y.getPurchaseOrders({ start: u, end: d })).filter(
|
|
790
|
+
(a) => {
|
|
791
|
+
var k, f;
|
|
792
|
+
return a.status === Nt.enum.COMPLETE && ((k = a.supplier) == null ? void 0 : k.internal) !== "warehouse" && ((f = a.supplier) == null ? void 0 : f.internal) !== "restaurant";
|
|
793
|
+
}
|
|
794
|
+
).reduce((a, k) => {
|
|
795
|
+
const f = new Date(Bt(k._id)), g = k.supplier._id;
|
|
796
|
+
for (const w of k.items) {
|
|
797
|
+
if (!w.totalCost) continue;
|
|
798
|
+
const F = a[w.sku._id] ?? {}, p = F[g] ?? [];
|
|
799
|
+
p.push({
|
|
800
|
+
date: f.toISOString(),
|
|
801
|
+
totalUnit: w.quantity,
|
|
802
|
+
totalCost: w.totalCost,
|
|
803
|
+
unit: w.sku.unit,
|
|
804
|
+
measurement: w.measurement,
|
|
805
|
+
seqNumber: k.seqNumber
|
|
806
|
+
}), F[g] = p, a[w.sku._id] = F;
|
|
807
|
+
}
|
|
808
|
+
return a;
|
|
809
|
+
}, {});
|
|
810
|
+
t.value = e;
|
|
811
|
+
} catch {
|
|
812
|
+
c.open({
|
|
813
|
+
title: "Something went wrong",
|
|
814
|
+
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
815
|
+
}), r.value = !1;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
const h = E(!1), t = E({});
|
|
819
|
+
return {
|
|
820
|
+
comparePricesToggle: r,
|
|
821
|
+
comparePriceFetching: h,
|
|
822
|
+
comparePriceBySku: t
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
const ss = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, as = { key: 0 }, ns = ["colspan"], ls = /* @__PURE__ */ se({
|
|
826
|
+
__name: "TransferItemTable",
|
|
827
|
+
props: {
|
|
828
|
+
templateItem: {},
|
|
829
|
+
row: {},
|
|
830
|
+
comparePriceBySku: {},
|
|
831
|
+
showComparePrice: { type: Boolean },
|
|
832
|
+
disabled: { type: Boolean }
|
|
833
|
+
},
|
|
834
|
+
emits: ["update:item"],
|
|
835
|
+
setup(c) {
|
|
836
|
+
function y(r) {
|
|
837
|
+
return r.column.columnDef.meta;
|
|
838
|
+
}
|
|
839
|
+
return (r, l) => {
|
|
840
|
+
var h, t;
|
|
841
|
+
return S(), I(le, null, [
|
|
842
|
+
n("tr", {
|
|
843
|
+
class: Q(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
844
|
+
"bg-fm-color-neutral-gray-100": r.row.getIsSelected()
|
|
845
|
+
}])
|
|
846
|
+
}, [
|
|
847
|
+
(S(!0), I(le, null, Ce(r.row.getVisibleCells(), (u) => {
|
|
848
|
+
var d, b, i, e;
|
|
849
|
+
return S(), I("td", {
|
|
850
|
+
key: u.id,
|
|
851
|
+
class: Q(["h-[56px] text-fm-color-typo-primary", ((d = y(u)) == null ? void 0 : d.cellClass) ?? "px-16"]),
|
|
852
|
+
style: gt({
|
|
853
|
+
width: (b = y(u)) == null ? void 0 : b.width,
|
|
854
|
+
maxWidth: (i = y(u)) == null ? void 0 : i.maxWidth,
|
|
855
|
+
textAlign: ((e = y(u)) == null ? void 0 : e.textAlign) ?? "left"
|
|
856
|
+
})
|
|
857
|
+
}, [
|
|
858
|
+
n("span", ss, [
|
|
859
|
+
m(o(me), {
|
|
860
|
+
render: u.column.columnDef.cell,
|
|
861
|
+
props: u.getContext()
|
|
862
|
+
}, null, 8, ["render", "props"])
|
|
863
|
+
])
|
|
864
|
+
], 6);
|
|
865
|
+
}), 128))
|
|
866
|
+
], 2),
|
|
867
|
+
r.showComparePrice && Object.keys(r.comparePriceBySku[(h = r.row.original.sku) == null ? void 0 : h._id] ?? {}).length > 0 ? (S(), I("tr", as, [
|
|
868
|
+
n("td", {
|
|
869
|
+
colspan: r.row.getVisibleCells().length
|
|
870
|
+
}, [
|
|
871
|
+
m(Dt, {
|
|
872
|
+
prices: r.comparePriceBySku[(t = r.row.original.sku) == null ? void 0 : t._id]
|
|
873
|
+
}, null, 8, ["prices"])
|
|
874
|
+
], 8, ns)
|
|
875
|
+
])) : L("", !0)
|
|
876
|
+
], 64);
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
}), rs = {
|
|
880
|
+
key: 0,
|
|
881
|
+
class: "flex flex-col gap-8"
|
|
882
|
+
}, is = { class: "flex flex-col gap-4" }, us = { class: "flex items-center gap-4" }, ds = {
|
|
883
|
+
key: 0,
|
|
884
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-error"
|
|
885
|
+
}, ms = /* @__PURE__ */ se({
|
|
886
|
+
__name: "NetSuiteField",
|
|
887
|
+
props: {
|
|
888
|
+
required: { type: Boolean },
|
|
889
|
+
disabled: { type: Boolean },
|
|
890
|
+
supplier: {},
|
|
891
|
+
setting: {},
|
|
892
|
+
items: {},
|
|
893
|
+
onChange: { type: Function }
|
|
894
|
+
},
|
|
895
|
+
emits: ["netsuite:ready"],
|
|
896
|
+
setup(c, { emit: y }) {
|
|
897
|
+
const r = He(), l = c, h = y, { t } = _o(), u = E(!1), d = E();
|
|
898
|
+
ze(() => {
|
|
899
|
+
var a, k, f, g;
|
|
900
|
+
let e = {
|
|
901
|
+
id: "",
|
|
902
|
+
subsidiary: { id: "", name: "" },
|
|
903
|
+
errors: []
|
|
904
|
+
};
|
|
905
|
+
if (!r.isEnabled || !l.required) {
|
|
906
|
+
h("netsuite:ready", e);
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
try {
|
|
910
|
+
const w = r.currentLocationSubsidiary();
|
|
911
|
+
l.setting ? e = {
|
|
912
|
+
...l.setting,
|
|
913
|
+
subsidiary: {
|
|
914
|
+
id: w.id || "",
|
|
915
|
+
name: w.name
|
|
916
|
+
}
|
|
917
|
+
} : e = {
|
|
918
|
+
...e,
|
|
919
|
+
subsidiary: {
|
|
920
|
+
id: w.id || "",
|
|
921
|
+
name: w.name
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
const F = r.getAvailableItems(w.id), p = l.items.filter((v) => {
|
|
925
|
+
if (v.measurement != null) {
|
|
926
|
+
const U = r.getAvailableMeasurements(
|
|
927
|
+
v.sku._id,
|
|
928
|
+
w.id
|
|
929
|
+
);
|
|
930
|
+
return F.includes(v.sku._id) && U.includes(v.measurement.id);
|
|
931
|
+
}
|
|
932
|
+
return F.includes(v.sku._id);
|
|
933
|
+
}).map((v) => v.sku._id);
|
|
934
|
+
l.onChange(
|
|
935
|
+
l.items.filter((v) => p.includes(v.sku._id)),
|
|
936
|
+
e
|
|
937
|
+
);
|
|
938
|
+
} finally {
|
|
939
|
+
l.supplier.internal ? d.value = r.getNetSuiteLocation(
|
|
940
|
+
`${l.supplier.internal}_${l.supplier._id}`
|
|
941
|
+
) : d.value = r.getNetSuiteVendor(l.supplier._id);
|
|
942
|
+
const w = l.supplier.internal ? r.getLocationSubsidiary((a = d.value) == null ? void 0 : a.netSuiteId).id : (k = d.value) == null ? void 0 : k.subsidiaryId, F = l.supplier.internal ? (f = r.currentLocationSubsidiary()) == null ? void 0 : f.id : (g = r.currentVendorSubsidiary(l.supplier._id)) == null ? void 0 : g.id;
|
|
943
|
+
!r.isEnabled || w && r.isEnabled && w == F ? h("netsuite:ready", e) : u.value = !0;
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
const b = M(
|
|
947
|
+
() => l.supplier.internal ? r.currentLocationSubsidiary() : r.currentVendorSubsidiary(l.supplier._id)
|
|
948
|
+
), i = M(() => {
|
|
949
|
+
var e, a;
|
|
950
|
+
return d.value == null ? `Cannot find the NetSuite location for "${l.supplier.name}"` : `The subsidiary of the request
|
|
951
|
+
location is ${(a = r.getLocationSubsidiary((e = d.value) == null ? void 0 : e.netSuiteId)) == null ? void 0 : a.fullName}`;
|
|
952
|
+
});
|
|
953
|
+
return (e, a) => {
|
|
954
|
+
const k = $("FmLabel"), f = $("FmIcon"), g = $("FmField"), w = $("FmTooltip");
|
|
955
|
+
return o(r).isEnabled && l.required ? (S(), I("div", rs, [
|
|
956
|
+
m(k, {
|
|
957
|
+
label: `NetSuite ${o(t)("inventory.transfer.form.netsuite.subsidiary")}`
|
|
958
|
+
}, null, 8, ["label"]),
|
|
959
|
+
n("div", is, [
|
|
960
|
+
m(w, {
|
|
961
|
+
"z-index": 51,
|
|
962
|
+
placement: "left",
|
|
963
|
+
disabled: e.disabled
|
|
964
|
+
}, {
|
|
965
|
+
content: T(() => a[0] || (a[0] = [
|
|
966
|
+
$e("This field is locked and based on the location of the request.")
|
|
967
|
+
])),
|
|
968
|
+
default: T(() => [
|
|
969
|
+
m(g, null, {
|
|
970
|
+
default: T(() => {
|
|
971
|
+
var F;
|
|
972
|
+
return [
|
|
973
|
+
n("div", us, [
|
|
974
|
+
m(f, {
|
|
975
|
+
name: "lock_outline",
|
|
976
|
+
size: "sm",
|
|
977
|
+
color: e.disabled ? "neutral-gray-200" : "neutral-gray-400"
|
|
978
|
+
}, null, 8, ["color"]),
|
|
979
|
+
n("div", {
|
|
980
|
+
class: Q([e.disabled ? "text-fm-color-typo-disabled" : ""])
|
|
981
|
+
}, R((F = b.value) == null ? void 0 : F.fullName), 3)
|
|
982
|
+
])
|
|
983
|
+
];
|
|
984
|
+
}),
|
|
985
|
+
_: 1
|
|
986
|
+
})
|
|
987
|
+
]),
|
|
988
|
+
_: 1
|
|
989
|
+
}, 8, ["disabled"]),
|
|
990
|
+
u.value ? (S(), I("div", ds, R(i.value), 1)) : L("", !0)
|
|
991
|
+
])
|
|
992
|
+
])) : L("", !0);
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
}), cs = { class: "flex flex-col gap-4" }, ps = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, fs = { class: "flex flex-col gap-16" }, vs = { class: "flex flex-col gap-24" }, ys = { class: "flex flex-col gap-8" }, bs = { class: "flex flex-col gap-4" }, gs = { class: "flex items-center gap-4" }, _s = { class: "flex flex-col gap-8" }, hs = { class: "flex flex-col gap-4" }, ks = { class: "flex items-center gap-4" }, xs = {
|
|
996
|
+
key: 3,
|
|
997
|
+
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
998
|
+
}, Ss = {
|
|
999
|
+
key: 0,
|
|
1000
|
+
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
1001
|
+
}, Cs = { class: "flex-1" }, ws = { class: "flex-1" }, Fs = {
|
|
1002
|
+
key: 1,
|
|
1003
|
+
class: "flex items-center gap-4"
|
|
1004
|
+
}, Ds = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, $s = { class: "flex flex-col gap-16" }, Is = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, Ts = { class: "flex gap-8" }, Ps = { key: 0 }, Rs = /* @__PURE__ */ se({
|
|
1005
|
+
__name: "TransferForm2",
|
|
1006
|
+
props: {
|
|
1007
|
+
modelValue: {},
|
|
1008
|
+
request: {},
|
|
1009
|
+
disabled: { type: Boolean },
|
|
1010
|
+
returnFrom: {},
|
|
1011
|
+
lastClosingDate: {}
|
|
1012
|
+
},
|
|
1013
|
+
emits: ["validation-success", "form:ready"],
|
|
1014
|
+
setup(c, { expose: y, emit: r }) {
|
|
1015
|
+
const l = c, h = r, t = ht(), { t: u } = ce(), d = je(), b = Je(), i = He(), e = st(), a = ot(), k = wt(), { breakpoints: f } = tt(), g = M(() => f.value.xs || f.value.sm), w = bt({
|
|
1016
|
+
value: !1
|
|
1017
|
+
}), F = E(!1), p = M(
|
|
1018
|
+
() => {
|
|
1019
|
+
var s;
|
|
1020
|
+
return ((s = l.modelValue) == null ? void 0 : s.templateDoc) ?? k.templates.find((_) => _._id === t.template);
|
|
1021
|
+
}
|
|
1022
|
+
), v = M(() => t.status === "DRAFT" || !t._rev);
|
|
1023
|
+
be(p, (s) => {
|
|
1024
|
+
s && v.value && (t.supplier = (s == null ? void 0 : s.purchaseOrder.supplier) ?? t.supplier);
|
|
1025
|
+
}), ze(() => {
|
|
1026
|
+
var s;
|
|
1027
|
+
try {
|
|
1028
|
+
if (!t.templateDoc) return;
|
|
1029
|
+
t.items.length || (t.items = ((s = p.value) == null ? void 0 : s.purchaseOrder.items) ?? []);
|
|
1030
|
+
} finally {
|
|
1031
|
+
F.value = !0;
|
|
1032
|
+
}
|
|
1033
|
+
}), be([F, w], ([s, _], [z, re]) => {
|
|
1034
|
+
_.value && re.value && h("form:ready");
|
|
1035
|
+
});
|
|
1036
|
+
const U = M(
|
|
1037
|
+
() => d.currentLocation.type === Lt.enum.restaurant
|
|
1038
|
+
);
|
|
1039
|
+
d.watchLocation(async () => {
|
|
1040
|
+
location && (t.supplier || (t.supplier = e.suppliers.find((s) => s) ?? t.supplier));
|
|
1041
|
+
});
|
|
1042
|
+
const j = St(), V = fo(
|
|
1043
|
+
() => t,
|
|
1044
|
+
(s) => {
|
|
1045
|
+
Object.assign(t, s);
|
|
1046
|
+
},
|
|
1047
|
+
!0,
|
|
1048
|
+
!0
|
|
1049
|
+
), P = M({
|
|
1050
|
+
get() {
|
|
1051
|
+
var s;
|
|
1052
|
+
return typeof ((s = t == null ? void 0 : t.supplier) == null ? void 0 : s.internal) == "string" ? oe.TRANSFER : oe.PURCHASE;
|
|
1053
|
+
},
|
|
1054
|
+
set(s) {
|
|
1055
|
+
var z;
|
|
1056
|
+
const _ = typeof ((z = t == null ? void 0 : t.supplier) == null ? void 0 : z.internal) == "string" ? oe.TRANSFER : oe.PURCHASE;
|
|
1057
|
+
s !== _ && (t.supplier = s === oe.PURCHASE ? V.locationOptionsTypePurchase.value[0] : V.locationOptionsTypeTransfer.value[0]);
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
be(
|
|
1061
|
+
() => {
|
|
1062
|
+
var s;
|
|
1063
|
+
return (s = l.modelValue) == null ? void 0 : s.template;
|
|
1064
|
+
},
|
|
1065
|
+
(s) => {
|
|
1066
|
+
a.mustUsePoTemplate && !s && Tt(() => {
|
|
1067
|
+
var _, z;
|
|
1068
|
+
t.supplier = ((z = (_ = V.locationOptionsTypeTransfer.value) == null ? void 0 : _.filter(
|
|
1069
|
+
(re) => re.internal === "restaurant"
|
|
1070
|
+
)) == null ? void 0 : z[0]) ?? t.supplier;
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
{ immediate: !0 }
|
|
1074
|
+
);
|
|
1075
|
+
const K = M(() => {
|
|
1076
|
+
let s = V.transferLocationOptions.value;
|
|
1077
|
+
return a.mustUsePoTemplate && !t.templateDoc && (s = s.filter((_) => {
|
|
1078
|
+
var z;
|
|
1079
|
+
return (z = _.sublabel) == null ? void 0 : z.startsWith("restaurant");
|
|
1080
|
+
})), s;
|
|
1081
|
+
}), O = M({
|
|
1082
|
+
get() {
|
|
1083
|
+
return t.supplier._id;
|
|
1084
|
+
},
|
|
1085
|
+
set(s) {
|
|
1086
|
+
V.transferLocationModel.value = s;
|
|
1087
|
+
}
|
|
1088
|
+
}), A = M({
|
|
1089
|
+
get() {
|
|
1090
|
+
return t.remark ?? void 0;
|
|
1091
|
+
},
|
|
1092
|
+
set(s) {
|
|
1093
|
+
t.remark = s;
|
|
1094
|
+
}
|
|
1095
|
+
}), { backdatePo: B, backdateSwitch: q, backdateModel: X, backdateTimeModel: x } = No({
|
|
1096
|
+
getEffectiveAt() {
|
|
1097
|
+
return t.effectiveAt;
|
|
1098
|
+
},
|
|
1099
|
+
setEffectiveAt(s) {
|
|
1100
|
+
t.effectiveAt = s;
|
|
1101
|
+
}
|
|
1102
|
+
}), { comparePricesToggle: C, comparePriceFetching: Z, comparePriceBySku: ue } = os(), ae = E();
|
|
1103
|
+
y({
|
|
1104
|
+
validateInputs: () => {
|
|
1105
|
+
var s, _;
|
|
1106
|
+
(_ = (s = ae.value) == null ? void 0 : s.validateInputs) == null || _.call(s);
|
|
1107
|
+
},
|
|
1108
|
+
resetInputsValidation: () => {
|
|
1109
|
+
var s, _;
|
|
1110
|
+
(_ = (s = ae.value) == null ? void 0 : s.resetInputsValidation) == null || _.call(s);
|
|
1111
|
+
},
|
|
1112
|
+
resetInputs: () => {
|
|
1113
|
+
var s, _;
|
|
1114
|
+
(_ = (s = ae.value) == null ? void 0 : s.resetInputs) == null || _.call(s);
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
const we = M(() => ({
|
|
1118
|
+
updateItem: (s) => {
|
|
1119
|
+
const _ = zt.parse(s);
|
|
1120
|
+
t.items = t.items.map((z) => z.sku._id !== s.sku._id ? z : _);
|
|
1121
|
+
},
|
|
1122
|
+
deleteItem: (s) => {
|
|
1123
|
+
t.items = t.items.filter((_) => _.sku._id !== s.sku._id);
|
|
1124
|
+
}
|
|
1125
|
+
})), Fe = xo({
|
|
1126
|
+
updateItem: (s) => we.value.updateItem(s),
|
|
1127
|
+
deleteItem: (s) => we.value.deleteItem(s),
|
|
1128
|
+
get supplier() {
|
|
1129
|
+
return t.supplier;
|
|
1130
|
+
},
|
|
1131
|
+
get items() {
|
|
1132
|
+
return t.items;
|
|
1133
|
+
},
|
|
1134
|
+
get transferType() {
|
|
1135
|
+
return P.value;
|
|
1136
|
+
},
|
|
1137
|
+
get template() {
|
|
1138
|
+
return p.value;
|
|
1139
|
+
},
|
|
1140
|
+
get disabled() {
|
|
1141
|
+
return l.disabled;
|
|
1142
|
+
}
|
|
1143
|
+
}), Ae = M(() => Fe.columnDefs.value);
|
|
1144
|
+
function Me() {
|
|
1145
|
+
var ve, Te, qe, Oe, Pe;
|
|
1146
|
+
const s = (qe = (Te = (ve = p.value) == null ? void 0 : ve.purchaseOrder) == null ? void 0 : Te.items) == null ? void 0 : qe.groupBy((N) => N.sku._id), _ = i.isEnabled ? i.getAvailableItems((Pe = (Oe = t.netSuite) == null ? void 0 : Oe.subsidiary) == null ? void 0 : Pe.id) : [], z = s != null && s.size ? b.skus.filter((N) => s.has(N._id)) : b.skus, re = i.isEnabled ? z.filter((N) => {
|
|
1147
|
+
var te, ee, ne, de;
|
|
1148
|
+
const J = (ee = (te = p.value) == null ? void 0 : te.purchaseOrder) == null ? void 0 : ee.items.find(
|
|
1149
|
+
(pe) => pe.sku._id === N._id
|
|
1150
|
+
);
|
|
1151
|
+
if (J != null && J.measurement != null) {
|
|
1152
|
+
const pe = i.getAvailableMeasurements(
|
|
1153
|
+
J.sku._id,
|
|
1154
|
+
(de = (ne = t.netSuite) == null ? void 0 : ne.subsidiary) == null ? void 0 : de.id
|
|
1155
|
+
);
|
|
1156
|
+
return _.includes(J.sku._id) && pe.includes(J.measurement.id);
|
|
1157
|
+
}
|
|
1158
|
+
return _.includes(N._id);
|
|
1159
|
+
}).map((N) => N._id) : z.map((N) => N._id), ie = z.map(
|
|
1160
|
+
(N) => {
|
|
1161
|
+
var J, te, ee, ne;
|
|
1162
|
+
return {
|
|
1163
|
+
label: ((te = (J = s == null ? void 0 : s.get(N._id)) == null ? void 0 : J[0]) == null ? void 0 : te.name) ?? N.name,
|
|
1164
|
+
sublabel: ((ne = (ee = s == null ? void 0 : s.get(N._id)) == null ? void 0 : ee[0]) == null ? void 0 : ne.code) ?? N.code,
|
|
1165
|
+
value: N,
|
|
1166
|
+
disabled: !re.includes(N._id)
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
), _e = ie.filter((N) => {
|
|
1170
|
+
var J;
|
|
1171
|
+
return (J = t.items) == null ? void 0 : J.find((te) => te.sku._id === N.value._id);
|
|
1172
|
+
}).map((N) => N.value);
|
|
1173
|
+
j.open({
|
|
1174
|
+
title: u("inventory.transfer.form.items.selectItem"),
|
|
1175
|
+
closeButton: !0,
|
|
1176
|
+
contentComponent: Ze,
|
|
1177
|
+
contentComponentProps: {
|
|
1178
|
+
modelValue: _e,
|
|
1179
|
+
items: ie,
|
|
1180
|
+
virtualScroll: !0
|
|
1181
|
+
},
|
|
1182
|
+
primaryActions: {
|
|
1183
|
+
text: u("common.confirm"),
|
|
1184
|
+
close: !0
|
|
1185
|
+
},
|
|
1186
|
+
secondaryActions: {
|
|
1187
|
+
text: u("common.close"),
|
|
1188
|
+
close: !0,
|
|
1189
|
+
variant: "tertiary"
|
|
1190
|
+
}
|
|
1191
|
+
}).onPrimary((N) => {
|
|
1192
|
+
const J = t.items ?? [], te = N.map((ee) => {
|
|
1193
|
+
var pe, Re;
|
|
1194
|
+
const ne = J.find((he) => he.sku._id === ee._id);
|
|
1195
|
+
if (ne)
|
|
1196
|
+
return ne;
|
|
1197
|
+
const de = ((Re = (pe = p.value) == null ? void 0 : pe.purchaseOrder.items) == null ? void 0 : Re.find(
|
|
1198
|
+
(he) => he.sku._id === ee._id
|
|
1199
|
+
)) ?? {
|
|
1200
|
+
sku: ee,
|
|
1201
|
+
code: ee.code,
|
|
1202
|
+
name: ee.name,
|
|
1203
|
+
quantity: {
|
|
1204
|
+
amount: 1,
|
|
1205
|
+
precision: 0
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
return P.value == oe.PURCHASE && (de.totalCost = ke(
|
|
1209
|
+
de.sku,
|
|
1210
|
+
de.quantity,
|
|
1211
|
+
de.measurement,
|
|
1212
|
+
{
|
|
1213
|
+
supplier: t.supplier
|
|
1214
|
+
}
|
|
1215
|
+
)), de;
|
|
1216
|
+
});
|
|
1217
|
+
te.sort((ee, ne) => ee.sku.code.localeCompare(ne.sku.code)), t.items = te;
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
function Ye(s) {
|
|
1221
|
+
return s;
|
|
1222
|
+
}
|
|
1223
|
+
const Ue = M(() => {
|
|
1224
|
+
const s = [];
|
|
1225
|
+
return (!a.mustUsePoTemplate || a.mustUsePoTemplate && t.templateDoc) && s.push({
|
|
1226
|
+
label: u("inventory.transfer.form.type.purchase"),
|
|
1227
|
+
value: oe.PURCHASE
|
|
1228
|
+
}), s.push({
|
|
1229
|
+
label: u("inventory.transfer.form.type.transfer"),
|
|
1230
|
+
value: oe.TRANSFER
|
|
1231
|
+
}), s;
|
|
1232
|
+
}), ge = M(() => {
|
|
1233
|
+
var s;
|
|
1234
|
+
return (s = l.modelValue) == null ? void 0 : s.items.every((_) => _.quantity.amount <= 0);
|
|
1235
|
+
});
|
|
1236
|
+
return (s, _) => {
|
|
1237
|
+
var pe, Re;
|
|
1238
|
+
const z = $("FmChip"), re = $("FmLabel"), ie = $("FmIcon"), _e = $("FmField"), ve = $("FmTooltip"), Te = $("FmSelect"), qe = $("FmTextField"), Oe = $("FmTextarea"), Pe = $("FmSwitch"), N = $("FmDatePicker"), J = $("FmTimePicker"), te = $("FmFormGroup"), ee = $("FmButton"), ne = $("FmTable"), de = $("FmForm");
|
|
1239
|
+
return S(), I("div", cs, [
|
|
1240
|
+
n("div", ps, [
|
|
1241
|
+
(pe = l.modelValue) != null && pe.template ? (S(), Y(z, {
|
|
1242
|
+
key: 0,
|
|
1243
|
+
variant: s.disabled ? "warning" : void 0,
|
|
1244
|
+
label: `${o(u)("inventory.transfer.template.title")}: ${((Re = p.value) == null ? void 0 : Re.name) ?? o(u)("inventory.transfer.form.loading")}`,
|
|
1245
|
+
icon: "summarize",
|
|
1246
|
+
compact: ""
|
|
1247
|
+
}, null, 8, ["variant", "label"])) : L("", !0),
|
|
1248
|
+
s.returnFrom ? L("", !0) : (S(), Y(z, {
|
|
1249
|
+
key: 1,
|
|
1250
|
+
label: o(d).currentLocation.name,
|
|
1251
|
+
icon: "storefront",
|
|
1252
|
+
compact: ""
|
|
1253
|
+
}, null, 8, ["label"])),
|
|
1254
|
+
s.lastClosingDate ? (S(), Y(z, {
|
|
1255
|
+
key: 2,
|
|
1256
|
+
label: `${o(u)("inventory.transfer.form.lastClosing")}: ${o(We)(s.lastClosingDate)} ${o(Ht)(s.lastClosingDate)}`,
|
|
1257
|
+
icon: "calendar_month",
|
|
1258
|
+
compact: ""
|
|
1259
|
+
}, null, 8, ["label"])) : L("", !0)
|
|
1260
|
+
]),
|
|
1261
|
+
m(de, {
|
|
1262
|
+
ref_key: "formRef",
|
|
1263
|
+
ref: ae,
|
|
1264
|
+
class: "flex flex-col gap-32",
|
|
1265
|
+
disabled: s.disabled,
|
|
1266
|
+
onValidationFailed: console.log,
|
|
1267
|
+
onValidationSuccess: _[14] || (_[14] = (he) => h("validation-success"))
|
|
1268
|
+
}, {
|
|
1269
|
+
default: T(() => {
|
|
1270
|
+
var he, at, nt, lt, rt, it, ut, dt;
|
|
1271
|
+
return [
|
|
1272
|
+
n("div", fs, [
|
|
1273
|
+
n("div", vs, [
|
|
1274
|
+
(he = l.modelValue) != null && he.template ? (S(), I(le, { key: 0 }, [
|
|
1275
|
+
n("div", ys, [
|
|
1276
|
+
m(re, {
|
|
1277
|
+
label: o(u)("inventory.transfer.form.type.title")
|
|
1278
|
+
}, null, 8, ["label"]),
|
|
1279
|
+
n("div", bs, [
|
|
1280
|
+
m(ve, {
|
|
1281
|
+
"z-index": 51,
|
|
1282
|
+
placement: "left",
|
|
1283
|
+
disabled: s.disabled
|
|
1284
|
+
}, {
|
|
1285
|
+
content: T(() => _[15] || (_[15] = [
|
|
1286
|
+
$e("This field is locked from template.")
|
|
1287
|
+
])),
|
|
1288
|
+
default: T(() => [
|
|
1289
|
+
m(_e, null, {
|
|
1290
|
+
default: T(() => [
|
|
1291
|
+
n("div", gs, [
|
|
1292
|
+
m(ie, {
|
|
1293
|
+
name: "lock_outline",
|
|
1294
|
+
size: "sm",
|
|
1295
|
+
color: s.disabled ? "neutral-gray-200" : "neutral-gray-400"
|
|
1296
|
+
}, null, 8, ["color"]),
|
|
1297
|
+
n("div", {
|
|
1298
|
+
class: Q({ "text-fm-color-typo-disabled": s.disabled })
|
|
1299
|
+
}, R(o(u)(`inventory.transfer.form.type.${P.value.toLocaleLowerCase("en-us")}`)), 3)
|
|
1300
|
+
])
|
|
1301
|
+
]),
|
|
1302
|
+
_: 1
|
|
1303
|
+
})
|
|
1304
|
+
]),
|
|
1305
|
+
_: 1
|
|
1306
|
+
}, 8, ["disabled"]),
|
|
1307
|
+
n("div", {
|
|
1308
|
+
class: Q([
|
|
1309
|
+
"fm-typo-en-body-sm-400",
|
|
1310
|
+
s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
1311
|
+
])
|
|
1312
|
+
}, null, 2)
|
|
1313
|
+
])
|
|
1314
|
+
]),
|
|
1315
|
+
n("div", _s, [
|
|
1316
|
+
m(re, {
|
|
1317
|
+
label: s.returnFrom ? "Return to" : P.value === o(oe).PURCHASE ? o(u)("inventory.transfer.form.purchaseFrom") : o(u)("inventory.transfer.form.transferFrom")
|
|
1318
|
+
}, null, 8, ["label"]),
|
|
1319
|
+
n("div", hs, [
|
|
1320
|
+
m(ve, {
|
|
1321
|
+
"z-index": 51,
|
|
1322
|
+
placement: "left",
|
|
1323
|
+
disabled: s.disabled
|
|
1324
|
+
}, {
|
|
1325
|
+
content: T(() => _[16] || (_[16] = [
|
|
1326
|
+
$e("This field is locked from template.")
|
|
1327
|
+
])),
|
|
1328
|
+
default: T(() => [
|
|
1329
|
+
m(_e, null, {
|
|
1330
|
+
default: T(() => {
|
|
1331
|
+
var D, W, ye;
|
|
1332
|
+
return [
|
|
1333
|
+
n("div", ks, [
|
|
1334
|
+
m(ie, {
|
|
1335
|
+
name: "lock_outline",
|
|
1336
|
+
size: "sm",
|
|
1337
|
+
color: s.disabled ? "neutral-gray-200" : "neutral-gray-400"
|
|
1338
|
+
}, null, 8, ["color"]),
|
|
1339
|
+
n("div", {
|
|
1340
|
+
class: Q({ "text-fm-color-typo-disabled": s.disabled })
|
|
1341
|
+
}, R(((W = (D = s.returnFrom) == null ? void 0 : D.supplier) == null ? void 0 : W.name) ?? ((ye = K.value.find((Ne) => Ne.value === O.value)) == null ? void 0 : ye.label)), 3)
|
|
1342
|
+
])
|
|
1343
|
+
];
|
|
1344
|
+
}),
|
|
1345
|
+
_: 1
|
|
1346
|
+
})
|
|
1347
|
+
]),
|
|
1348
|
+
_: 1
|
|
1349
|
+
}, 8, ["disabled"])
|
|
1350
|
+
])
|
|
1351
|
+
])
|
|
1352
|
+
], 64)) : (S(), I(le, { key: 1 }, [
|
|
1353
|
+
m(Te, {
|
|
1354
|
+
label: o(u)("inventory.transfer.form.type.title"),
|
|
1355
|
+
"label-mark": "required",
|
|
1356
|
+
modelValue: P.value,
|
|
1357
|
+
"onUpdate:modelValue": _[0] || (_[0] = (D) => P.value = D),
|
|
1358
|
+
items: Ue.value,
|
|
1359
|
+
rules: [o(Le)(1)(K.value)]
|
|
1360
|
+
}, {
|
|
1361
|
+
default: T(() => [
|
|
1362
|
+
n("span", {
|
|
1363
|
+
class: Q([
|
|
1364
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1365
|
+
s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
1366
|
+
])
|
|
1367
|
+
}, R(o(jt)(P.value)), 3)
|
|
1368
|
+
]),
|
|
1369
|
+
_: 1
|
|
1370
|
+
}, 8, ["label", "modelValue", "items", "rules"]),
|
|
1371
|
+
m(Te, {
|
|
1372
|
+
label: P.value === o(oe).PURCHASE ? o(u)("inventory.transfer.form.purchaseFrom") : o(u)("inventory.transfer.form.transferFrom"),
|
|
1373
|
+
"label-mark": "required",
|
|
1374
|
+
modelValue: O.value,
|
|
1375
|
+
"onUpdate:modelValue": _[1] || (_[1] = (D) => O.value = D),
|
|
1376
|
+
items: K.value
|
|
1377
|
+
}, {
|
|
1378
|
+
"menu-wrapper": T((D) => {
|
|
1379
|
+
var W, ye;
|
|
1380
|
+
return [
|
|
1381
|
+
m(vo, Xe(D, {
|
|
1382
|
+
items: K.value,
|
|
1383
|
+
"model-value": (ye = (W = s.modelValue) == null ? void 0 : W.supplier) == null ? void 0 : ye._id
|
|
1384
|
+
}), null, 16, ["items", "model-value"])
|
|
1385
|
+
];
|
|
1386
|
+
}),
|
|
1387
|
+
default: T(() => {
|
|
1388
|
+
var D;
|
|
1389
|
+
return [
|
|
1390
|
+
n("span", {
|
|
1391
|
+
class: Q([
|
|
1392
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
1393
|
+
s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
1394
|
+
])
|
|
1395
|
+
}, R((D = K.value.find((W) => W.value === O.value)) == null ? void 0 : D.label), 3)
|
|
1396
|
+
];
|
|
1397
|
+
}),
|
|
1398
|
+
_: 1
|
|
1399
|
+
}, 8, ["label", "modelValue", "items"])
|
|
1400
|
+
], 64)),
|
|
1401
|
+
m(qe, {
|
|
1402
|
+
label: o(u)("inventory.transfer.form.reference"),
|
|
1403
|
+
"label-mark": "optional",
|
|
1404
|
+
modelValue: o(t).ref,
|
|
1405
|
+
"onUpdate:modelValue": _[2] || (_[2] = (D) => o(t).ref = D)
|
|
1406
|
+
}, null, 8, ["label", "modelValue"]),
|
|
1407
|
+
m(Oe, {
|
|
1408
|
+
label: o(u)("inventory.transfer.form.remark"),
|
|
1409
|
+
"label-mark": "optional",
|
|
1410
|
+
"max-length": 240,
|
|
1411
|
+
modelValue: A.value,
|
|
1412
|
+
"onUpdate:modelValue": _[3] || (_[3] = (D) => A.value = D),
|
|
1413
|
+
class: Q([s.disabled ? "text-fm-color-typo-disabled " : ""])
|
|
1414
|
+
}, null, 8, ["label", "modelValue", "class"]),
|
|
1415
|
+
F.value ? (S(), Y(ms, {
|
|
1416
|
+
key: 2,
|
|
1417
|
+
required: o(t).templateDoc != null,
|
|
1418
|
+
disabled: s.disabled,
|
|
1419
|
+
supplier: o(t).supplier,
|
|
1420
|
+
setting: o(t).netSuite,
|
|
1421
|
+
items: o(t).items,
|
|
1422
|
+
onChange: (D, W) => {
|
|
1423
|
+
o(t).items = D, o(t).netSuite = W;
|
|
1424
|
+
},
|
|
1425
|
+
"onNetsuite:ready": _[4] || (_[4] = (D) => {
|
|
1426
|
+
w.value = !0;
|
|
1427
|
+
})
|
|
1428
|
+
}, null, 8, ["required", "disabled", "supplier", "setting", "items", "onChange"])) : L("", !0),
|
|
1429
|
+
o(a).enableBackdatePo ? (S(), I("div", xs, [
|
|
1430
|
+
n("div", {
|
|
1431
|
+
class: Q([
|
|
1432
|
+
"flex",
|
|
1433
|
+
{
|
|
1434
|
+
"flex-col": g.value
|
|
1435
|
+
}
|
|
1436
|
+
])
|
|
1437
|
+
}, [
|
|
1438
|
+
m(Pe, {
|
|
1439
|
+
modelValue: o(q),
|
|
1440
|
+
"onUpdate:modelValue": _[5] || (_[5] = (D) => xe(q) ? q.value = D : null),
|
|
1441
|
+
label: o(u)("inventory.transfer.form.backdate.title"),
|
|
1442
|
+
sublabel: o(u)("inventory.transfer.form.backdate.subtitle"),
|
|
1443
|
+
"label-placement": "right",
|
|
1444
|
+
disabled: U.value && !s.lastClosingDate || s.disabled
|
|
1445
|
+
}, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
|
|
1446
|
+
n("div", {
|
|
1447
|
+
class: Q({ hidden: g.value, "w-16": !g.value })
|
|
1448
|
+
}, null, 2),
|
|
1449
|
+
o(q) ? (S(), I("div", Ss, [
|
|
1450
|
+
n("div", Cs, [
|
|
1451
|
+
m(N, {
|
|
1452
|
+
modelValue: o(X),
|
|
1453
|
+
"onUpdate:modelValue": _[6] || (_[6] = (D) => xe(X) ? X.value = D : null)
|
|
1454
|
+
}, null, 8, ["modelValue"])
|
|
1455
|
+
]),
|
|
1456
|
+
n("div", ws, [
|
|
1457
|
+
m(J, {
|
|
1458
|
+
modelValue: o(x),
|
|
1459
|
+
"onUpdate:modelValue": _[7] || (_[7] = (D) => xe(x) ? x.value = D : null)
|
|
1460
|
+
}, null, 8, ["modelValue"])
|
|
1461
|
+
])
|
|
1462
|
+
])) : L("", !0)
|
|
1463
|
+
], 2),
|
|
1464
|
+
o(B) ? (S(), Y(te, {
|
|
1465
|
+
key: 0,
|
|
1466
|
+
modelValue: o(B),
|
|
1467
|
+
"onUpdate:modelValue": _[8] || (_[8] = (D) => xe(B) ? B.value = D : null),
|
|
1468
|
+
rules: [o(Yt)(new Date(s.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
1469
|
+
}, null, 8, ["modelValue", "rules"])) : L("", !0),
|
|
1470
|
+
U.value && !s.lastClosingDate ? (S(), I("div", Fs, [
|
|
1471
|
+
m(ie, {
|
|
1472
|
+
name: "error",
|
|
1473
|
+
size: "sm",
|
|
1474
|
+
class: "text-fm-color-typo-warning"
|
|
1475
|
+
}),
|
|
1476
|
+
n("span", Ds, R(o(u)("inventory.transfer.form.backdate.error")), 1)
|
|
1477
|
+
])) : L("", !0)
|
|
1478
|
+
])) : L("", !0)
|
|
1479
|
+
])
|
|
1480
|
+
]),
|
|
1481
|
+
n("div", $s, [
|
|
1482
|
+
m(te, {
|
|
1483
|
+
"model-value": o(t).items,
|
|
1484
|
+
rules: [o(Le)(1)]
|
|
1485
|
+
}, null, 8, ["model-value", "rules"]),
|
|
1486
|
+
n("div", {
|
|
1487
|
+
class: Q([
|
|
1488
|
+
"flex gap-16",
|
|
1489
|
+
{
|
|
1490
|
+
"flex-col items-start": g.value,
|
|
1491
|
+
"items-center": !g.value
|
|
1492
|
+
}
|
|
1493
|
+
])
|
|
1494
|
+
}, [
|
|
1495
|
+
n("div", Is, R(o(u)("inventory.transfer.form.items.title")), 1),
|
|
1496
|
+
n("div", Ts, [
|
|
1497
|
+
m(ee, {
|
|
1498
|
+
disabled: s.disabled,
|
|
1499
|
+
label: o(u)("inventory.transfer.form.items.addItem"),
|
|
1500
|
+
"prepend-icon": "add",
|
|
1501
|
+
variant: "secondary",
|
|
1502
|
+
"text-color": "primary",
|
|
1503
|
+
"bg-color": "transparent",
|
|
1504
|
+
"border-color": "primary",
|
|
1505
|
+
onClick: _[9] || (_[9] = (D) => Me()),
|
|
1506
|
+
size: "md"
|
|
1507
|
+
}, null, 8, ["disabled", "label"]),
|
|
1508
|
+
o(t).templateDoc ? (S(), Y(ve, {
|
|
1509
|
+
key: 0,
|
|
1510
|
+
"z-index": 50
|
|
1511
|
+
}, {
|
|
1512
|
+
content: T(() => [
|
|
1513
|
+
n("div", null, R(o(u)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
|
|
1514
|
+
]),
|
|
1515
|
+
default: T(() => [
|
|
1516
|
+
m(ft, {
|
|
1517
|
+
"onUpdate:poItems": _[10] || (_[10] = (D) => o(t).items = D),
|
|
1518
|
+
disabled: ""
|
|
1519
|
+
})
|
|
1520
|
+
]),
|
|
1521
|
+
_: 1
|
|
1522
|
+
})) : (S(), Y(ft, {
|
|
1523
|
+
key: 1,
|
|
1524
|
+
"onUpdate:poItems": _[11] || (_[11] = (D) => o(t).items = D),
|
|
1525
|
+
disabled: s.disabled || !!o(t).templateDoc
|
|
1526
|
+
}, null, 8, ["disabled"]))
|
|
1527
|
+
])
|
|
1528
|
+
], 2),
|
|
1529
|
+
P.value === o(oe).PURCHASE && v.value && o(a).enableTotalCost && ((at = s.modelValue) != null && at.items.length) ? (S(), I("div", Ps, [
|
|
1530
|
+
m(Pe, {
|
|
1531
|
+
label: o(Z) ? o(u)("inventory.transfer.form.items.fetchingData") : o(u)("inventory.transfer.form.items.comparePriceHistory"),
|
|
1532
|
+
"prepend-icon": "compare_arrows",
|
|
1533
|
+
"label-placement": "right",
|
|
1534
|
+
"model-value": o(C),
|
|
1535
|
+
"onUpdate:modelValue": _[12] || (_[12] = (D) => xe(C) ? C.value = D : null),
|
|
1536
|
+
disabled: o(Z) || s.disabled
|
|
1537
|
+
}, null, 8, ["label", "model-value", "disabled"])
|
|
1538
|
+
])) : L("", !0),
|
|
1539
|
+
m(te, {
|
|
1540
|
+
"model-value": ge.value,
|
|
1541
|
+
rules: [() => ge.value ? "Must have at least one non-zero item" : !0]
|
|
1542
|
+
}, null, 8, ["model-value", "rules"]),
|
|
1543
|
+
(S(), Y(ne, {
|
|
1544
|
+
"column-defs": Ae.value,
|
|
1545
|
+
"column-visibility": {
|
|
1546
|
+
[o(G).Code]: !(((nt = s.modelValue) == null ? void 0 : nt.template) ?? ((lt = s.modelValue) == null ? void 0 : lt.templateDoc)),
|
|
1547
|
+
[o(G).Name]: !(((rt = s.modelValue) == null ? void 0 : rt.template) ?? ((it = s.modelValue) == null ? void 0 : it.templateDoc)),
|
|
1548
|
+
[o(G).TemplateName]: !!(((ut = s.modelValue) == null ? void 0 : ut.template) ?? ((dt = s.modelValue) == null ? void 0 : dt.templateDoc))
|
|
1549
|
+
},
|
|
1550
|
+
"row-data": o(t).items,
|
|
1551
|
+
key: o(t).items.map((D) => D.sku._id).join("."),
|
|
1552
|
+
"hide-footer": "",
|
|
1553
|
+
"page-size": o(t).items.length
|
|
1554
|
+
}, {
|
|
1555
|
+
"table-row": T((D) => {
|
|
1556
|
+
var W, ye, Ne, mt;
|
|
1557
|
+
return [
|
|
1558
|
+
m(ls, {
|
|
1559
|
+
"compare-price-by-sku": o(ue),
|
|
1560
|
+
"show-compare-price": P.value === o(oe).PURCHASE && o(C),
|
|
1561
|
+
row: D,
|
|
1562
|
+
"template-item": (mt = (Ne = (ye = (W = s.modelValue) == null ? void 0 : W.templateDoc) == null ? void 0 : ye.purchaseOrder) == null ? void 0 : Ne.items) == null ? void 0 : mt.find(
|
|
1563
|
+
(Qe) => Qe.sku._id === D.original.sku._id
|
|
1564
|
+
),
|
|
1565
|
+
"onUpdate:item": _[13] || (_[13] = (Qe) => we.value.updateItem(Qe)),
|
|
1566
|
+
disabled: s.disabled
|
|
1567
|
+
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "template-item", "disabled"])
|
|
1568
|
+
];
|
|
1569
|
+
}),
|
|
1570
|
+
"list-row": T((D) => [
|
|
1571
|
+
(S(), Y(kt, {
|
|
1572
|
+
row: D,
|
|
1573
|
+
key: o(t).items.map((W) => W.sku._id).join(".")
|
|
1574
|
+
}, {
|
|
1575
|
+
default: T((W) => [
|
|
1576
|
+
m(Oo, {
|
|
1577
|
+
"compare-price-by-sku": o(ue),
|
|
1578
|
+
"show-compare-price": P.value === o(oe).PURCHASE && o(C),
|
|
1579
|
+
row: D,
|
|
1580
|
+
"cell-by-col-id": W
|
|
1581
|
+
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
|
|
1582
|
+
]),
|
|
1583
|
+
_: 2
|
|
1584
|
+
}, 1032, ["row"]))
|
|
1585
|
+
]),
|
|
1586
|
+
_: 1
|
|
1587
|
+
}, 8, ["column-defs", "column-visibility", "row-data", "page-size"]))
|
|
1588
|
+
])
|
|
1589
|
+
];
|
|
1590
|
+
}),
|
|
1591
|
+
_: 1
|
|
1592
|
+
}, 8, ["disabled", "onValidationFailed"])
|
|
1593
|
+
]);
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
});
|
|
1597
|
+
function Vs(c, y) {
|
|
1598
|
+
y ?? (y = `Return to ${c.supplier.name}`);
|
|
1599
|
+
const l = je().currentLocation, h = yo(l), t = {};
|
|
1600
|
+
for (const d of c.items) {
|
|
1601
|
+
const b = d.sku._id;
|
|
1602
|
+
t[b] = De.reset();
|
|
1603
|
+
}
|
|
1604
|
+
const u = c.deliveryOrder.flatMap((d) => d.received);
|
|
1605
|
+
for (const d of u) {
|
|
1606
|
+
const b = d.sku._id;
|
|
1607
|
+
if (!t[b]) continue;
|
|
1608
|
+
const i = d.measurement ? De.multiply([d.measurement.conversion, d.amount]) : d.amount;
|
|
1609
|
+
t[b] = De.add([t[b], i]);
|
|
1610
|
+
}
|
|
1611
|
+
return {
|
|
1612
|
+
_id: c._id,
|
|
1613
|
+
name: y,
|
|
1614
|
+
purchaseOrder: {
|
|
1615
|
+
supplier: h,
|
|
1616
|
+
ref: c.ref,
|
|
1617
|
+
remark: c.remark,
|
|
1618
|
+
items: c.items.map((d) => {
|
|
1619
|
+
const b = d.measurement ? De.divide([t[d.sku._id], d.measurement.conversion]) : t[d.sku._id];
|
|
1620
|
+
return {
|
|
1621
|
+
sku: d.sku,
|
|
1622
|
+
code: d.code,
|
|
1623
|
+
name: d.name,
|
|
1624
|
+
quantityStep: {
|
|
1625
|
+
amount: 1,
|
|
1626
|
+
precision: Qt(d.sku.unit, d.measurement)
|
|
1627
|
+
},
|
|
1628
|
+
quantity: b,
|
|
1629
|
+
maximumQuantity: b
|
|
1630
|
+
};
|
|
1631
|
+
}).filter((d) => d.maximumQuantity.amount > 0)
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
const Es = { class: "flex items-center" }, As = { class: "fm-typo-en-title-md-800" }, Ms = { class: "flex gap-4" }, Us = /* @__PURE__ */ se({
|
|
1636
|
+
__name: "TransferDialog",
|
|
1637
|
+
props: {
|
|
1638
|
+
mode: {},
|
|
1639
|
+
modelValue: {},
|
|
1640
|
+
returnFrom: {},
|
|
1641
|
+
"onSubmit:returnStock": { type: Function },
|
|
1642
|
+
templateId: {},
|
|
1643
|
+
show: { type: Boolean },
|
|
1644
|
+
lastClosingDate: {}
|
|
1645
|
+
},
|
|
1646
|
+
emits: ["update:show", "submitted"],
|
|
1647
|
+
setup(c, { expose: y, emit: r }) {
|
|
1648
|
+
var X;
|
|
1649
|
+
const l = c, h = r, t = et(), u = wt(), d = Ie(), b = st(), i = je(), { t: e } = ce(), a = E(!1), k = E(!1), f = E(!1), g = Ft();
|
|
1650
|
+
async function w(x) {
|
|
1651
|
+
if (x) {
|
|
1652
|
+
k.value = !1;
|
|
1653
|
+
try {
|
|
1654
|
+
await b.readSuppliers(), k.value = !0;
|
|
1655
|
+
} catch {
|
|
1656
|
+
d.open({
|
|
1657
|
+
title: e("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
|
|
1658
|
+
message: e("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
|
|
1659
|
+
type: "error"
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
i.watchLocation(w);
|
|
1665
|
+
function F() {
|
|
1666
|
+
const x = {
|
|
1667
|
+
remark: void 0,
|
|
1668
|
+
ref: void 0,
|
|
1669
|
+
stockSnapshotId: void 0,
|
|
1670
|
+
effectiveAt: void 0,
|
|
1671
|
+
items: [],
|
|
1672
|
+
supplier: {
|
|
1673
|
+
_rev: void 0,
|
|
1674
|
+
email: void 0,
|
|
1675
|
+
internal: void 0,
|
|
1676
|
+
contactName: void 0,
|
|
1677
|
+
phoneNumber: void 0,
|
|
1678
|
+
registrationNumber: void 0,
|
|
1679
|
+
supplyItems: void 0,
|
|
1680
|
+
_id: "",
|
|
1681
|
+
name: "",
|
|
1682
|
+
address: {
|
|
1683
|
+
line2: void 0,
|
|
1684
|
+
line1: "",
|
|
1685
|
+
state: "",
|
|
1686
|
+
city: "",
|
|
1687
|
+
postcode: "",
|
|
1688
|
+
country: ""
|
|
1689
|
+
}
|
|
1690
|
+
},
|
|
1691
|
+
status: "DRAFT",
|
|
1692
|
+
_id: "",
|
|
1693
|
+
seqNumber: 0,
|
|
1694
|
+
deliveryOrder: [],
|
|
1695
|
+
template: l.templateId,
|
|
1696
|
+
templateDoc: u.templates.find((C) => C._id === l.templateId)
|
|
1697
|
+
};
|
|
1698
|
+
if (l.returnFrom) {
|
|
1699
|
+
const C = Vs(l.returnFrom);
|
|
1700
|
+
x.templateDoc = C, x.template = C._id, x.supplier = C.purchaseOrder.supplier ?? x.supplier, x.items = C.purchaseOrder.items ?? [], x.isReturnPo = !0;
|
|
1701
|
+
}
|
|
1702
|
+
return x;
|
|
1703
|
+
}
|
|
1704
|
+
const p = Ct(l, "show"), v = E(l.modelValue ?? F()), U = E(((X = l.modelValue) == null ? void 0 : X._id) ?? `${Math.random()}`);
|
|
1705
|
+
be(
|
|
1706
|
+
() => l.show,
|
|
1707
|
+
(x) => {
|
|
1708
|
+
var C;
|
|
1709
|
+
x && (f.value = !1, v.value = l.modelValue ?? F(), U.value = ((C = l.modelValue) == null ? void 0 : C._id) ?? `${Math.random()}`);
|
|
1710
|
+
}
|
|
1711
|
+
);
|
|
1712
|
+
const j = M(() => !k.value || !f.value), V = M(() => {
|
|
1713
|
+
if (l.returnFrom)
|
|
1714
|
+
return "Return transfer";
|
|
1715
|
+
switch (l.mode) {
|
|
1716
|
+
case Ve.READ:
|
|
1717
|
+
return "View transfer";
|
|
1718
|
+
case Ve.CREATE:
|
|
1719
|
+
return e("inventory.transfer.receiveRequest.create.title");
|
|
1720
|
+
case Ve.UPDATE:
|
|
1721
|
+
return e("inventory.transfer.receiveRequest.update.title");
|
|
1722
|
+
}
|
|
1723
|
+
return "";
|
|
1724
|
+
}), P = E();
|
|
1725
|
+
y({
|
|
1726
|
+
validateInputs: () => {
|
|
1727
|
+
var x, C;
|
|
1728
|
+
(C = (x = P.value) == null ? void 0 : x.validateInputs) == null || C.call(x);
|
|
1729
|
+
},
|
|
1730
|
+
resetInputsValidation: () => {
|
|
1731
|
+
var x, C;
|
|
1732
|
+
(C = (x = P.value) == null ? void 0 : x.resetInputsValidation) == null || C.call(x);
|
|
1733
|
+
},
|
|
1734
|
+
resetInputs: () => {
|
|
1735
|
+
var x, C;
|
|
1736
|
+
(C = (x = P.value) == null ? void 0 : x.resetInputs) == null || C.call(x);
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
async function K() {
|
|
1740
|
+
var C;
|
|
1741
|
+
if (!(!await g.confirmation(
|
|
1742
|
+
"Submit return stock request?",
|
|
1743
|
+
"Stock will be deducted upon confirmation."
|
|
1744
|
+
) || !v.value || !l.returnFrom)) {
|
|
1745
|
+
a.value = !0;
|
|
1746
|
+
try {
|
|
1747
|
+
await ((C = l["onSubmit:returnStock"]) == null ? void 0 : C.call(l, v.value, l.returnFrom));
|
|
1748
|
+
} catch (Z) {
|
|
1749
|
+
d.open({
|
|
1750
|
+
title: e("inventory.transfer.receiveRequest.create.error.title"),
|
|
1751
|
+
message: e("inventory.transfer.receiveRequest.create.error.message"),
|
|
1752
|
+
type: "error"
|
|
1753
|
+
}), console.error("Error in creating purchase order", Z);
|
|
1754
|
+
} finally {
|
|
1755
|
+
a.value = !1, h("update:show", !1);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
async function O() {
|
|
1760
|
+
const x = v.value;
|
|
1761
|
+
a.value = !0, (x.supplier.internal === "warehouse" || x.supplier.internal === "restaurant") && (x.items = x.items.map(({ totalCost: C, ...Z }) => Z));
|
|
1762
|
+
try {
|
|
1763
|
+
await t.createPurchaseOrder(x), await new Promise((C) => setTimeout(C, 1e3)), d.open({
|
|
1764
|
+
title: e("inventory.transfer.receiveRequest.create.success"),
|
|
1765
|
+
message: e("inventory.transfer.receiveRequest.create.successMessage"),
|
|
1766
|
+
type: "success"
|
|
1767
|
+
}), h("update:show", !1), h("submitted");
|
|
1768
|
+
} catch (C) {
|
|
1769
|
+
d.open({
|
|
1770
|
+
title: e("inventory.transfer.receiveRequest.create.error.title"),
|
|
1771
|
+
message: e("inventory.transfer.receiveRequest.create.error.message"),
|
|
1772
|
+
type: "error"
|
|
1773
|
+
}), console.error("Error in creating purchase order", C);
|
|
1774
|
+
} finally {
|
|
1775
|
+
a.value = !1;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
async function A() {
|
|
1779
|
+
const x = v.value;
|
|
1780
|
+
a.value = !0, (x.supplier.internal === "warehouse" || x.supplier.internal === "restaurant") && (x.items = x.items.map(({ totalCost: C, ...Z }) => Z));
|
|
1781
|
+
try {
|
|
1782
|
+
await t.updatePurchaseOrder(x), await new Promise((C) => setTimeout(C, 1e3)), d.open({
|
|
1783
|
+
title: e("inventory.transfer.receiveRequest.update.success"),
|
|
1784
|
+
message: e("inventory.transfer.receiveRequest.update.successMessage"),
|
|
1785
|
+
type: "success"
|
|
1786
|
+
}), h("update:show", !1), h("submitted");
|
|
1787
|
+
} catch (C) {
|
|
1788
|
+
d.open({
|
|
1789
|
+
title: e("inventory.transfer.receiveRequest.update.error.title"),
|
|
1790
|
+
message: e("inventory.transfer.receiveRequest.update.error.message"),
|
|
1791
|
+
type: "error"
|
|
1792
|
+
}), console.error("Error in updating purchase order", C);
|
|
1793
|
+
} finally {
|
|
1794
|
+
a.value = !1;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
function B() {
|
|
1798
|
+
switch (l.mode) {
|
|
1799
|
+
case Ve.CREATE:
|
|
1800
|
+
return l.returnFrom ? K() : O();
|
|
1801
|
+
case Ve.UPDATE:
|
|
1802
|
+
return A();
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
function q() {
|
|
1806
|
+
var x, C;
|
|
1807
|
+
(C = (x = P.value) == null ? void 0 : x.validateInputs) == null || C.call(x);
|
|
1808
|
+
}
|
|
1809
|
+
return (x, C) => {
|
|
1810
|
+
const Z = $("FmButton"), ue = $("FmSideSheet");
|
|
1811
|
+
return S(), Y(ue, {
|
|
1812
|
+
modelValue: o(p),
|
|
1813
|
+
"onUpdate:modelValue": C[3] || (C[3] = (ae) => xe(p) ? p.value = ae : null),
|
|
1814
|
+
"dismiss-away": "",
|
|
1815
|
+
"close-button": "",
|
|
1816
|
+
"max-width": 900
|
|
1817
|
+
}, {
|
|
1818
|
+
"side-sheet-header": T(() => [
|
|
1819
|
+
n("div", Es, [
|
|
1820
|
+
n("div", As, R(V.value), 1)
|
|
1821
|
+
])
|
|
1822
|
+
]),
|
|
1823
|
+
default: T(() => [
|
|
1824
|
+
(S(), Y(Rs, {
|
|
1825
|
+
class: "w-full",
|
|
1826
|
+
ref_key: "formRef",
|
|
1827
|
+
ref: P,
|
|
1828
|
+
"onForm:ready": C[0] || (C[0] = () => f.value = !0),
|
|
1829
|
+
onValidationSuccess: B,
|
|
1830
|
+
modelValue: v.value,
|
|
1831
|
+
"onUpdate:modelValue": C[1] || (C[1] = (ae) => v.value = ae),
|
|
1832
|
+
disabled: a.value || j.value,
|
|
1833
|
+
"return-from": x.returnFrom,
|
|
1834
|
+
key: U.value,
|
|
1835
|
+
"last-closing-date": x.lastClosingDate
|
|
1836
|
+
}, null, 8, ["modelValue", "disabled", "return-from", "last-closing-date"]))
|
|
1837
|
+
]),
|
|
1838
|
+
"side-sheet-footer": T(() => [
|
|
1839
|
+
n("div", Ms, [
|
|
1840
|
+
m(Z, {
|
|
1841
|
+
loading: a.value,
|
|
1842
|
+
disabled: j.value,
|
|
1843
|
+
label: o(e)("common.save"),
|
|
1844
|
+
onClick: q
|
|
1845
|
+
}, null, 8, ["loading", "disabled", "label"]),
|
|
1846
|
+
m(Z, {
|
|
1847
|
+
disabled: j.value,
|
|
1848
|
+
variant: "tertiary",
|
|
1849
|
+
label: o(e)("common.close"),
|
|
1850
|
+
onClick: C[2] || (C[2] = (ae) => h("update:show", !1))
|
|
1851
|
+
}, null, 8, ["disabled", "label"])
|
|
1852
|
+
])
|
|
1853
|
+
]),
|
|
1854
|
+
_: 1
|
|
1855
|
+
}, 8, ["modelValue"]);
|
|
1856
|
+
};
|
|
1857
|
+
}
|
|
1858
|
+
});
|
|
1859
|
+
function qs(c) {
|
|
1860
|
+
const [y, ...r] = Kt(c), l = y.map((d) => d.toLowerCase().trim().replace(/ /g, "_")), t = ["item_code", "quantity"].filter((d) => !l.includes(d));
|
|
1861
|
+
if (t.length)
|
|
1862
|
+
throw new Error(
|
|
1863
|
+
`Missing headers (${t.join()}). Excel file does not come from the template.`
|
|
1864
|
+
);
|
|
1865
|
+
return r.map((d, b) => {
|
|
1866
|
+
const i = {};
|
|
1867
|
+
for (const e in l) {
|
|
1868
|
+
const a = l[e];
|
|
1869
|
+
Object.assign(i, { [a]: d[e] });
|
|
1870
|
+
}
|
|
1871
|
+
return {
|
|
1872
|
+
index: b,
|
|
1873
|
+
data: i
|
|
1874
|
+
};
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
function Os(c) {
|
|
1878
|
+
const y = c.SheetNames;
|
|
1879
|
+
try {
|
|
1880
|
+
return y.reduce(
|
|
1881
|
+
(l, h) => {
|
|
1882
|
+
const t = new Array(), u = c.Sheets[h], d = Je(), b = qs(u), i = [];
|
|
1883
|
+
for (const { index: a, data: k } of b) {
|
|
1884
|
+
k.item_code === "" && t.push(`Row ${a + 1}: Item code is empty`), k.quantity === "" && t.push(`Row ${a + 1}: Quantity is empty`);
|
|
1885
|
+
const f = d.skus.find((w) => w.code === k.item_code);
|
|
1886
|
+
if (!f) {
|
|
1887
|
+
t.push(`Row ${a + 1}: SKU not found`);
|
|
1888
|
+
continue;
|
|
1889
|
+
}
|
|
1890
|
+
i.push({
|
|
1891
|
+
sku: f,
|
|
1892
|
+
code: k.item_code,
|
|
1893
|
+
name: f.name,
|
|
1894
|
+
quantity: De.fromNumber(Number(k.quantity)),
|
|
1895
|
+
measurement: null
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
const e = {
|
|
1899
|
+
type: "create",
|
|
1900
|
+
poItems: i,
|
|
1901
|
+
excelSheetName: h,
|
|
1902
|
+
errors: t
|
|
1903
|
+
};
|
|
1904
|
+
return l.importCreateResult.push(e), l;
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
invalidExcel: !1,
|
|
1908
|
+
importCreateResult: new Array()
|
|
1909
|
+
}
|
|
1910
|
+
);
|
|
1911
|
+
} catch (r) {
|
|
1912
|
+
return {
|
|
1913
|
+
invalidExcel: !0,
|
|
1914
|
+
invalidExcelMessage: (r == null ? void 0 : r.message) ?? "Invalid excel",
|
|
1915
|
+
importCreateResult: []
|
|
1916
|
+
};
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
const Ns = exports.FfCalculator, Bs = { class: "flex flex-col flex-1" }, Ls = { class: "flex flex-col" }, zs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Hs = {
|
|
1920
|
+
key: 0,
|
|
1921
|
+
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1922
|
+
}, js = { key: 0 }, Ys = {
|
|
1923
|
+
class: /* @__PURE__ */ Q(["fm-typo-en-body-lg-600"])
|
|
1924
|
+
}, Qs = { class: "flex-1" }, Ks = { class: "flex-auto line-clamp-2 text-ellipsis break-all fm-typo-en-body-sm-400" }, Xs = { class: "flex-auto line-clamp-2 text-ellipsis break-all" }, Zs = { class: "text-fm-color-typo-primary" }, Gs = { class: "ml-auto" }, Ws = { key: 0 }, Js = /* @__PURE__ */ se({
|
|
1925
|
+
__name: "XilnexResult",
|
|
1926
|
+
props: {
|
|
1927
|
+
type: {},
|
|
1928
|
+
name: {},
|
|
1929
|
+
items: {},
|
|
1930
|
+
errors: {}
|
|
1931
|
+
},
|
|
1932
|
+
setup(c) {
|
|
1933
|
+
const y = c, { t: r } = ce(), l = E(!1), h = () => {
|
|
1934
|
+
y.errors.length && (l.value = !l.value);
|
|
1935
|
+
};
|
|
1936
|
+
return (t, u) => {
|
|
1937
|
+
var i;
|
|
1938
|
+
const d = $("FmIcon"), b = $("FmTooltip");
|
|
1939
|
+
return S(), I("div", Bs, [
|
|
1940
|
+
n("div", {
|
|
1941
|
+
onClick: h,
|
|
1942
|
+
class: Q({
|
|
1943
|
+
"cursor-pointer": t.errors.length
|
|
1944
|
+
})
|
|
1945
|
+
}, [
|
|
1946
|
+
n("div", Ls, [
|
|
1947
|
+
n("div", zs, [
|
|
1948
|
+
n("div", {
|
|
1949
|
+
class: Q({
|
|
1950
|
+
"text-fm-color-system-error-300": t.errors.length
|
|
1951
|
+
})
|
|
1952
|
+
}, [
|
|
1953
|
+
$e(R(t.name) + " ", 1),
|
|
1954
|
+
t.type === "create" ? (S(), I("span", Hs, "(" + R(o(r)("inventory.closing.template.import.new")) + ")", 1)) : L("", !0)
|
|
1955
|
+
], 2),
|
|
1956
|
+
t.errors.length ? (S(), I("div", js, [
|
|
1957
|
+
m(d, {
|
|
1958
|
+
name: "error",
|
|
1959
|
+
size: "sm",
|
|
1960
|
+
color: "system-error-300"
|
|
1961
|
+
})
|
|
1962
|
+
])) : L("", !0)
|
|
1963
|
+
]),
|
|
1964
|
+
u[0] || (u[0] = n("hr", { class: "my-2" }, null, -1)),
|
|
1965
|
+
n("div", Ys, [
|
|
1966
|
+
(i = t.items) != null && i.length ? (S(!0), I(le, { key: 0 }, Ce(t.items, (e, a) => (S(), I("div", {
|
|
1967
|
+
key: a,
|
|
1968
|
+
class: "flex gap-4 mt-2 items-center"
|
|
1969
|
+
}, [
|
|
1970
|
+
n("div", Qs, [
|
|
1971
|
+
m(b, {
|
|
1972
|
+
content: e.code,
|
|
1973
|
+
placement: "top",
|
|
1974
|
+
"z-index": 51
|
|
1975
|
+
}, {
|
|
1976
|
+
default: T(() => [
|
|
1977
|
+
n("span", Ks, R(e.code), 1)
|
|
1978
|
+
]),
|
|
1979
|
+
_: 2
|
|
1980
|
+
}, 1032, ["content"]),
|
|
1981
|
+
m(b, {
|
|
1982
|
+
content: e.name,
|
|
1983
|
+
placement: "top",
|
|
1984
|
+
"z-index": 51
|
|
1985
|
+
}, {
|
|
1986
|
+
default: T(() => [
|
|
1987
|
+
n("span", Xs, R(e.name), 1)
|
|
1988
|
+
]),
|
|
1989
|
+
_: 2
|
|
1990
|
+
}, 1032, ["content"])
|
|
1991
|
+
]),
|
|
1992
|
+
n("div", null, [
|
|
1993
|
+
n("span", Zs, R(o(Ns).toFormatString({
|
|
1994
|
+
value: e.quantity
|
|
1995
|
+
})), 1),
|
|
1996
|
+
$e(" " + R(e.measurement ? e.measurement.abbrev : e.sku.unit.abbrev), 1)
|
|
1997
|
+
])
|
|
1998
|
+
]))), 128)) : L("", !0)
|
|
1999
|
+
])
|
|
2000
|
+
]),
|
|
2001
|
+
n("div", Gs, [
|
|
2002
|
+
t.errors.length ? (S(), Y(d, {
|
|
2003
|
+
key: 0,
|
|
2004
|
+
name: l.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
|
|
2005
|
+
size: "md"
|
|
2006
|
+
}, null, 8, ["name"])) : L("", !0)
|
|
2007
|
+
])
|
|
2008
|
+
], 2),
|
|
2009
|
+
l.value ? (S(), I("div", {
|
|
2010
|
+
key: 0,
|
|
2011
|
+
class: Q(["flex flex-col gap-4 pl-8 fm-typo-en-body-sm-400", {
|
|
2012
|
+
"text-fm-color-typo-secondary": !t.errors.length,
|
|
2013
|
+
"text-fm-color-system-error-300": t.errors.length
|
|
2014
|
+
}])
|
|
2015
|
+
}, [
|
|
2016
|
+
t.errors.length ? (S(), I("div", Ws, [
|
|
2017
|
+
n("ol", null, [
|
|
2018
|
+
(S(!0), I(le, null, Ce(t.errors, (e, a) => (S(), I("li", { key: a }, R(e), 1))), 128))
|
|
2019
|
+
])
|
|
2020
|
+
])) : L("", !0)
|
|
2021
|
+
], 2)) : L("", !0)
|
|
2022
|
+
]);
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
}), ea = { class: "flex flex-col gap-24" }, ta = {
|
|
2026
|
+
key: 0,
|
|
2027
|
+
class: "flex items-center gap-8"
|
|
2028
|
+
}, oa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, sa = { class: "flex flex-col gap-8" }, aa = { class: "line-clamp-2 text-ellipsis break-all" }, na = {
|
|
2029
|
+
key: 2,
|
|
2030
|
+
class: "shrink-0"
|
|
2031
|
+
}, la = {
|
|
2032
|
+
key: 0,
|
|
2033
|
+
class: "flex flex-col"
|
|
2034
|
+
}, ra = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, ia = {
|
|
2035
|
+
key: 0,
|
|
2036
|
+
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
2037
|
+
}, ua = { class: "fm-typo-en-body-lg-600" }, vt = "Transfer note", da = /* @__PURE__ */ se({
|
|
2038
|
+
__name: "XilnexImportForm",
|
|
2039
|
+
setup(c, { expose: y }) {
|
|
2040
|
+
const r = E(null), l = Ie(), h = E(!1), t = E(!1), u = ht();
|
|
2041
|
+
E(!1), He();
|
|
2042
|
+
const d = E([
|
|
2043
|
+
{
|
|
2044
|
+
label: "LMSL389 MSU Medical Centre",
|
|
2045
|
+
value: {
|
|
2046
|
+
netsuiteId: "1279",
|
|
2047
|
+
name: "LMSL389 MSU Medical Centre"
|
|
2048
|
+
}
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
label: "LMSL540 Central I-City",
|
|
2052
|
+
value: {
|
|
2053
|
+
netsuiteId: "1463",
|
|
2054
|
+
name: "LMSL540 Central I-City"
|
|
2055
|
+
}
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
label: "LMSL572 Giant Shah Alam Stadium",
|
|
2059
|
+
value: {
|
|
2060
|
+
netsuiteId: "1521",
|
|
2061
|
+
name: "LMSL572 Giant Shah Alam Stadium"
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
]), b = M({
|
|
2065
|
+
get() {
|
|
2066
|
+
var p;
|
|
2067
|
+
return ((p = u.supplier) == null ? void 0 : p.name) ?? "";
|
|
2068
|
+
},
|
|
2069
|
+
set(p) {
|
|
2070
|
+
p && (u.supplier = {
|
|
2071
|
+
name: p.name,
|
|
2072
|
+
registrationNumber: "",
|
|
2073
|
+
_id: p.netsuiteId,
|
|
2074
|
+
internal: "restaurant",
|
|
2075
|
+
address: {
|
|
2076
|
+
line1: "",
|
|
2077
|
+
line2: "",
|
|
2078
|
+
city: "",
|
|
2079
|
+
state: "",
|
|
2080
|
+
country: "",
|
|
2081
|
+
postcode: ""
|
|
2082
|
+
}
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
}), i = M({
|
|
2086
|
+
get() {
|
|
2087
|
+
return "";
|
|
2088
|
+
},
|
|
2089
|
+
set(p) {
|
|
2090
|
+
if (p) {
|
|
2091
|
+
const v = u.effectiveAt ? new Date(u.effectiveAt) : /* @__PURE__ */ new Date(), [U, j, V] = p.split("-");
|
|
2092
|
+
v.setFullYear(parseInt(U)), v.setMonth(parseInt(j) - 1), v.setDate(parseInt(V)), u.effectiveAt = v.toISOString();
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}), e = M({
|
|
2096
|
+
get() {
|
|
2097
|
+
return null;
|
|
2098
|
+
},
|
|
2099
|
+
set(p) {
|
|
2100
|
+
if (p) {
|
|
2101
|
+
const v = u.effectiveAt ? new Date(u.effectiveAt) : /* @__PURE__ */ new Date(), [U, j] = p.split(":");
|
|
2102
|
+
v.setHours(parseInt(U)), v.setMinutes(parseInt(j)), v.setSeconds(0), v.setMilliseconds(0), u.effectiveAt = v.toISOString();
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
}), a = E(new Array()), k = E([]), f = M(
|
|
2106
|
+
() => !!a.value.length || k.value.some((p) => p.errors.length)
|
|
2107
|
+
), g = E();
|
|
2108
|
+
y({
|
|
2109
|
+
validateInputs: () => {
|
|
2110
|
+
var p, v;
|
|
2111
|
+
(v = (p = g.value) == null ? void 0 : p.validateInputs) == null || v.call(p);
|
|
2112
|
+
},
|
|
2113
|
+
resetInputsValidation: () => {
|
|
2114
|
+
var p, v;
|
|
2115
|
+
(v = (p = g.value) == null ? void 0 : p.resetInputsValidation) == null || v.call(p);
|
|
2116
|
+
},
|
|
2117
|
+
resetInputs: () => {
|
|
2118
|
+
var p, v;
|
|
2119
|
+
(v = (p = g.value) == null ? void 0 : p.resetInputs) == null || v.call(p);
|
|
2120
|
+
}
|
|
2121
|
+
});
|
|
2122
|
+
const { t: w } = ce();
|
|
2123
|
+
async function F(p) {
|
|
2124
|
+
a.value = [], k.value = [];
|
|
2125
|
+
try {
|
|
2126
|
+
h.value = !0;
|
|
2127
|
+
const [v] = await Promise.all([
|
|
2128
|
+
Zt(p),
|
|
2129
|
+
// fake buffer
|
|
2130
|
+
new Promise((j) => setTimeout(j, 1e3))
|
|
2131
|
+
]), U = Os(v);
|
|
2132
|
+
if (U.invalidExcel) {
|
|
2133
|
+
a.value.push(
|
|
2134
|
+
U.invalidExcelMessage ?? w("inventory.ingredient.import.fileError.invalidExcel")
|
|
2135
|
+
);
|
|
2136
|
+
return;
|
|
2137
|
+
}
|
|
2138
|
+
if (k.value = U.importCreateResult, !k.value.length) {
|
|
2139
|
+
a.value.push(w("inventory.ingredient.import.fileError.noData"));
|
|
2140
|
+
return;
|
|
2141
|
+
}
|
|
2142
|
+
u.items = k.value.map((j) => j.poItems).flat();
|
|
2143
|
+
} catch (v) {
|
|
2144
|
+
l.open({
|
|
2145
|
+
title: w("inventory.ingredient.import.fileError.unableToRead"),
|
|
2146
|
+
message: v == null ? void 0 : v.message,
|
|
2147
|
+
type: "error"
|
|
2148
|
+
}), console.error("Error in reading file", v);
|
|
2149
|
+
} finally {
|
|
2150
|
+
a.value.length && l.open({
|
|
2151
|
+
title: w("inventory.ingredient.import.fileError.invalidExcel"),
|
|
2152
|
+
type: "error"
|
|
2153
|
+
}), h.value = !1;
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
return be(r, (p) => {
|
|
2157
|
+
p && F(p);
|
|
2158
|
+
}), (p, v) => {
|
|
2159
|
+
const U = $("FmSelect"), j = $("FmDatePicker"), V = $("FmTimePicker"), P = $("FmCircularProgress"), K = $("FmLabel"), O = $("FmIcon"), A = $("FmButton"), B = $("FmForm");
|
|
2160
|
+
return S(), Y(B, {
|
|
2161
|
+
ref_key: "formRef",
|
|
2162
|
+
ref: g
|
|
2163
|
+
}, {
|
|
2164
|
+
default: T(() => [
|
|
2165
|
+
n("div", ea, [
|
|
2166
|
+
m(U, {
|
|
2167
|
+
modelValue: b.value,
|
|
2168
|
+
"onUpdate:modelValue": v[0] || (v[0] = (q) => b.value = q),
|
|
2169
|
+
label: "Transfer from",
|
|
2170
|
+
searchable: "",
|
|
2171
|
+
searchTarget: "label",
|
|
2172
|
+
items: d.value,
|
|
2173
|
+
rules: [o(Ee)()]
|
|
2174
|
+
}, null, 8, ["modelValue", "items", "rules"]),
|
|
2175
|
+
m(j, {
|
|
2176
|
+
modelValue: i.value,
|
|
2177
|
+
"onUpdate:modelValue": v[1] || (v[1] = (q) => i.value = q),
|
|
2178
|
+
label: "Transfer date",
|
|
2179
|
+
rules: [o(Ee)()]
|
|
2180
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
2181
|
+
m(V, {
|
|
2182
|
+
modelValue: e.value,
|
|
2183
|
+
"onUpdate:modelValue": v[2] || (v[2] = (q) => e.value = q),
|
|
2184
|
+
label: "Transfer time",
|
|
2185
|
+
rules: [o(Ee)()]
|
|
2186
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
2187
|
+
t.value ? (S(), I("div", ta, [
|
|
2188
|
+
n("div", null, [
|
|
2189
|
+
m(P, {
|
|
2190
|
+
size: "md",
|
|
2191
|
+
color: "neutral-gray-200"
|
|
2192
|
+
})
|
|
2193
|
+
]),
|
|
2194
|
+
n("div", oa, R(o(w)("inventory.formField.loading")), 1)
|
|
2195
|
+
])) : (S(), I(le, { key: 1 }, [
|
|
2196
|
+
m(Xt, {
|
|
2197
|
+
"max-file-size": 5,
|
|
2198
|
+
class: Q({
|
|
2199
|
+
"w-full": !0,
|
|
2200
|
+
"h-[200px]": !r.value
|
|
2201
|
+
}),
|
|
2202
|
+
accept: ".xlsx,.xls,.csv",
|
|
2203
|
+
label: vt,
|
|
2204
|
+
onFileUpload: v[3] || (v[3] = (q) => r.value = q),
|
|
2205
|
+
"button-label": o(w)("inventory.ingredient.import.selectFile")
|
|
2206
|
+
}, Pt({ _: 2 }, [
|
|
2207
|
+
r.value ? {
|
|
2208
|
+
name: "default",
|
|
2209
|
+
fn: T(({ openFileDialog: q }) => [
|
|
2210
|
+
m(K, null, {
|
|
2211
|
+
default: T(() => [
|
|
2212
|
+
$e(R(vt))
|
|
2213
|
+
]),
|
|
2214
|
+
_: 1
|
|
2215
|
+
}),
|
|
2216
|
+
n("div", sa, [
|
|
2217
|
+
n("div", {
|
|
2218
|
+
class: Q([
|
|
2219
|
+
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
2220
|
+
{
|
|
2221
|
+
"border border-fm-color-neutral-gray-100": h.value,
|
|
2222
|
+
"border border-fm-color-neutral-gray-200": !h.value && !f.value,
|
|
2223
|
+
"border border-fm-color-system-error-200": f.value
|
|
2224
|
+
}
|
|
2225
|
+
])
|
|
2226
|
+
}, [
|
|
2227
|
+
h.value ? (S(), Y(P, {
|
|
2228
|
+
key: 0,
|
|
2229
|
+
size: "md",
|
|
2230
|
+
color: "neutral-gray-200"
|
|
2231
|
+
})) : (S(), Y(O, {
|
|
2232
|
+
key: 1,
|
|
2233
|
+
name: f.value ? "error" : "attach_file",
|
|
2234
|
+
outline: "",
|
|
2235
|
+
color: f.value ? "system-error-300" : void 0
|
|
2236
|
+
}, null, 8, ["name", "color"])),
|
|
2237
|
+
n("div", {
|
|
2238
|
+
class: Q([
|
|
2239
|
+
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
2240
|
+
{
|
|
2241
|
+
"text-fm-color-typo-disabled": h.value,
|
|
2242
|
+
"text-fm-color-typo-primary": !h.value
|
|
2243
|
+
}
|
|
2244
|
+
])
|
|
2245
|
+
}, [
|
|
2246
|
+
n("div", aa, R(r.value.name), 1)
|
|
2247
|
+
], 2),
|
|
2248
|
+
h.value ? L("", !0) : (S(), I("div", na, [
|
|
2249
|
+
m(A, {
|
|
2250
|
+
label: o(w)("inventory.ingredient.import.replaceFile"),
|
|
2251
|
+
variant: f.value ? "destructive" : "secondary",
|
|
2252
|
+
"prepend-icon": f.value ? void 0 : "autorenew",
|
|
2253
|
+
onClick: q
|
|
2254
|
+
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
2255
|
+
]))
|
|
2256
|
+
], 2),
|
|
2257
|
+
a.value.length ? (S(), I("div", la, [
|
|
2258
|
+
(S(!0), I(le, null, Ce(a.value, (X, x) => (S(), I("div", {
|
|
2259
|
+
key: x,
|
|
2260
|
+
class: "flex gap-8 items-center"
|
|
2261
|
+
}, [
|
|
2262
|
+
m(O, {
|
|
2263
|
+
name: "error",
|
|
2264
|
+
size: "sm",
|
|
2265
|
+
color: "system-error-300"
|
|
2266
|
+
}),
|
|
2267
|
+
n("div", ra, R(X), 1)
|
|
2268
|
+
]))), 128))
|
|
2269
|
+
])) : L("", !0)
|
|
2270
|
+
])
|
|
2271
|
+
]),
|
|
2272
|
+
key: "0"
|
|
2273
|
+
} : void 0
|
|
2274
|
+
]), 1032, ["class", "button-label"]),
|
|
2275
|
+
r.value ? (S(), I("div", ia, [
|
|
2276
|
+
n("div", ua, R(o(w)("inventory.ingredient.import.summary")), 1),
|
|
2277
|
+
(S(!0), I(le, null, Ce(k.value, (q, X) => (S(), Y(Js, {
|
|
2278
|
+
key: X,
|
|
2279
|
+
name: `Transfer Note ${X + 1}`,
|
|
2280
|
+
items: q.poItems,
|
|
2281
|
+
errors: q.errors,
|
|
2282
|
+
type: "create"
|
|
2283
|
+
}, null, 8, ["name", "items", "errors"]))), 128))
|
|
2284
|
+
])) : L("", !0)
|
|
2285
|
+
], 64))
|
|
2286
|
+
])
|
|
2287
|
+
]),
|
|
2288
|
+
_: 1
|
|
2289
|
+
}, 512);
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
}), ma = { class: "w-[480px]" }, ca = /* @__PURE__ */ se({
|
|
2293
|
+
__name: "XilnexImportDialog",
|
|
2294
|
+
props: {
|
|
2295
|
+
show: { type: Boolean }
|
|
2296
|
+
},
|
|
2297
|
+
emits: ["update:show", "submitted"],
|
|
2298
|
+
setup(c, { expose: y, emit: r }) {
|
|
2299
|
+
const l = r, t = Ct(c, "show"), u = Ie(), d = et(), b = E(!1), i = E(), e = E();
|
|
2300
|
+
y({
|
|
2301
|
+
validateInputs: () => {
|
|
2302
|
+
var f, g;
|
|
2303
|
+
(g = (f = i.value) == null ? void 0 : f.validateInputs) == null || g.call(f);
|
|
2304
|
+
},
|
|
2305
|
+
resetInputsValidation: () => {
|
|
2306
|
+
var f, g;
|
|
2307
|
+
(g = (f = i.value) == null ? void 0 : f.resetInputsValidation) == null || g.call(f);
|
|
2308
|
+
},
|
|
2309
|
+
resetInputs: () => {
|
|
2310
|
+
var f, g;
|
|
2311
|
+
(g = (f = i.value) == null ? void 0 : f.resetInputs) == null || g.call(f);
|
|
2312
|
+
}
|
|
2313
|
+
});
|
|
2314
|
+
function a() {
|
|
2315
|
+
var f, g;
|
|
2316
|
+
(g = (f = i.value) == null ? void 0 : f.validateInputs) == null || g.call(f);
|
|
2317
|
+
}
|
|
2318
|
+
async function k() {
|
|
2319
|
+
var g, w, F, p, v;
|
|
2320
|
+
if (!((w = (g = e.value) == null ? void 0 : g.supplier) != null && w.name)) {
|
|
2321
|
+
u.open({
|
|
2322
|
+
title: "Upload failed",
|
|
2323
|
+
message: "Location is required",
|
|
2324
|
+
type: "error"
|
|
2325
|
+
});
|
|
2326
|
+
return;
|
|
2327
|
+
}
|
|
2328
|
+
if (!((F = e.value) != null && F.items) || ((v = (p = e.value) == null ? void 0 : p.items) == null ? void 0 : v.length) === 0) {
|
|
2329
|
+
u.open({
|
|
2330
|
+
title: "Upload failed",
|
|
2331
|
+
message: "No data to upload",
|
|
2332
|
+
type: "error"
|
|
2333
|
+
});
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
const f = e.value.effectiveAt ? new Date(e.value.effectiveAt) : null;
|
|
2337
|
+
if (!f) {
|
|
2338
|
+
u.open({
|
|
2339
|
+
title: "Invalid date",
|
|
2340
|
+
message: "Transfer date is required",
|
|
2341
|
+
type: "error"
|
|
2342
|
+
});
|
|
2343
|
+
return;
|
|
2344
|
+
}
|
|
2345
|
+
if (f.getTime() > (/* @__PURE__ */ new Date()).getTime()) {
|
|
2346
|
+
u.open({
|
|
2347
|
+
title: "Invalid date",
|
|
2348
|
+
message: "Transfer date cannot be in the future",
|
|
2349
|
+
type: "error"
|
|
2350
|
+
});
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
b.value = !0;
|
|
2354
|
+
try {
|
|
2355
|
+
await d.importFromXilnex(e.value), l("update:show", !1);
|
|
2356
|
+
} catch (U) {
|
|
2357
|
+
await new Promise((j) => setTimeout(j, 1e3)), u.open({
|
|
2358
|
+
title: "Upload failed",
|
|
2359
|
+
message: U == null ? void 0 : U.message,
|
|
2360
|
+
type: "error"
|
|
2361
|
+
});
|
|
2362
|
+
} finally {
|
|
2363
|
+
b.value = !1;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
return (f, g) => {
|
|
2367
|
+
const w = $("FmSpacer"), F = $("FmButton"), p = $("FmDialog");
|
|
2368
|
+
return S(), Y(p, {
|
|
2369
|
+
modelValue: o(t),
|
|
2370
|
+
"onUpdate:modelValue": g[2] || (g[2] = (v) => xe(t) ? t.value = v : null),
|
|
2371
|
+
overlay: !0,
|
|
2372
|
+
"close-button": !1
|
|
2373
|
+
}, {
|
|
2374
|
+
"dialog-header": T(() => g[3] || (g[3] = [
|
|
2375
|
+
n("div", null, "Xilnex transfer order", -1)
|
|
2376
|
+
])),
|
|
2377
|
+
"dialog-footer": T(() => [
|
|
2378
|
+
m(w, { class: "sm:hidden xs:hidden" }),
|
|
2379
|
+
m(F, {
|
|
2380
|
+
disabled: b.value,
|
|
2381
|
+
class: "sm:w-full xs:w-full",
|
|
2382
|
+
label: "Cancel",
|
|
2383
|
+
size: "md",
|
|
2384
|
+
variant: "tertiary",
|
|
2385
|
+
onClick: g[1] || (g[1] = (v) => l("update:show", !1))
|
|
2386
|
+
}, null, 8, ["disabled"]),
|
|
2387
|
+
m(F, {
|
|
2388
|
+
disabled: b.value,
|
|
2389
|
+
loading: b.value,
|
|
2390
|
+
class: "sm:w-full xs:w-full",
|
|
2391
|
+
label: "Upload",
|
|
2392
|
+
size: "md",
|
|
2393
|
+
variant: "primary",
|
|
2394
|
+
onClick: a
|
|
2395
|
+
}, null, 8, ["disabled", "loading"])
|
|
2396
|
+
]),
|
|
2397
|
+
default: T(() => [
|
|
2398
|
+
n("div", ma, [
|
|
2399
|
+
m(da, {
|
|
2400
|
+
ref_key: "formRef",
|
|
2401
|
+
ref: i,
|
|
2402
|
+
onValidationSuccess: k,
|
|
2403
|
+
modelValue: e.value,
|
|
2404
|
+
"onUpdate:modelValue": g[0] || (g[0] = (v) => e.value = v)
|
|
2405
|
+
}, null, 8, ["modelValue"])
|
|
2406
|
+
])
|
|
2407
|
+
]),
|
|
2408
|
+
_: 1
|
|
2409
|
+
}, 8, ["modelValue"]);
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
}), pa = { class: "flex flex-col py-8" }, fa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, va = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, ya = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, ba = {
|
|
2413
|
+
key: 0,
|
|
2414
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
|
|
2415
|
+
}, ga = { class: "pt-8" }, yt = "ReceiveRequestViewSearchCriteria", Aa = /* @__PURE__ */ se({
|
|
2416
|
+
__name: "ReceiveRequestView",
|
|
2417
|
+
setup(c) {
|
|
2418
|
+
const { t: y } = ce(), r = Ie();
|
|
2419
|
+
Be.object({
|
|
2420
|
+
name: Be.string().optional().nullable(),
|
|
2421
|
+
startDate: Be.string().optional().nullable(),
|
|
2422
|
+
endDate: Be.string().optional().nullable()
|
|
2423
|
+
});
|
|
2424
|
+
const l = M(
|
|
2425
|
+
() => !a._currentLocation || i.loading.value
|
|
2426
|
+
), h = ro(), t = ot();
|
|
2427
|
+
function u() {
|
|
2428
|
+
const V = {
|
|
2429
|
+
name: "",
|
|
2430
|
+
...ct()
|
|
2431
|
+
}, P = h.getItem(yt);
|
|
2432
|
+
if (!P)
|
|
2433
|
+
return V;
|
|
2434
|
+
try {
|
|
2435
|
+
return JSON.parse(P);
|
|
2436
|
+
} catch {
|
|
2437
|
+
return V;
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
function d() {
|
|
2441
|
+
h.setItem(yt, JSON.stringify(b.value));
|
|
2442
|
+
}
|
|
2443
|
+
const b = E(u()), i = eo(
|
|
2444
|
+
Ke.RECEIVE_REQUEST,
|
|
2445
|
+
b.value
|
|
2446
|
+
), { columnDefs: e } = to(
|
|
2447
|
+
Ke.RECEIVE_REQUEST,
|
|
2448
|
+
i
|
|
2449
|
+
), a = je();
|
|
2450
|
+
async function k() {
|
|
2451
|
+
const V = `inventory-record_${pt(b.value.startDate).format("DD-MM-YYYY_HH-mm")}-${pt(b.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, P = i.purchaseOrders.value.flatMap(
|
|
2452
|
+
(O) => O.items.map((A) => {
|
|
2453
|
+
const B = new Date(no(O._id) ?? ""), q = O.effectiveAt ? new Date(O.effectiveAt) : void 0, X = Se(
|
|
2454
|
+
so(A.sku, O.deliveryOrder || [])
|
|
2455
|
+
), x = Se(A.quantity);
|
|
2456
|
+
return {
|
|
2457
|
+
"SKU code": A.code,
|
|
2458
|
+
"SKU name": A.name,
|
|
2459
|
+
"PO #": O.seqNumber,
|
|
2460
|
+
"Effective at": q,
|
|
2461
|
+
Date: B,
|
|
2462
|
+
Status: O.status,
|
|
2463
|
+
Reference: O.ref ?? "",
|
|
2464
|
+
"Received quantity": X,
|
|
2465
|
+
"Ordered quantity": x,
|
|
2466
|
+
Unit: A.sku.unit.abbrev,
|
|
2467
|
+
"Total cost": A.totalCost ? Ge(A.totalCost) : null
|
|
2468
|
+
};
|
|
2469
|
+
})
|
|
2470
|
+
), K = [
|
|
2471
|
+
"SKU code",
|
|
2472
|
+
"SKU name",
|
|
2473
|
+
"PO #",
|
|
2474
|
+
"Date",
|
|
2475
|
+
"Status",
|
|
2476
|
+
"Reference",
|
|
2477
|
+
"Received quantity",
|
|
2478
|
+
"Ordered quantity",
|
|
2479
|
+
"Unit"
|
|
2480
|
+
];
|
|
2481
|
+
t.enableBackdatePo && K.insert("Effective at", 4), t.enableTotalCost && K.push("Total cost"), await lo(
|
|
2482
|
+
[
|
|
2483
|
+
{
|
|
2484
|
+
name: "purchases",
|
|
2485
|
+
data: P,
|
|
2486
|
+
columns: K
|
|
2487
|
+
}
|
|
2488
|
+
],
|
|
2489
|
+
V
|
|
2490
|
+
), r.open({
|
|
2491
|
+
title: y("inventory.transfer.receiveRequest.export.success"),
|
|
2492
|
+
message: y("inventory.transfer.receiveRequest.export.message", [V]),
|
|
2493
|
+
type: "success"
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
const f = E(ct()), g = E("");
|
|
2497
|
+
be([() => f.value], ([V]) => {
|
|
2498
|
+
!V.startDate || !V.endDate || (b.value.startDate = V.startDate, b.value.endDate = V.endDate, i.updateDateRange(
|
|
2499
|
+
b.value.startDate,
|
|
2500
|
+
b.value.endDate
|
|
2501
|
+
), d());
|
|
2502
|
+
}), be([() => g.value], () => {
|
|
2503
|
+
d();
|
|
2504
|
+
});
|
|
2505
|
+
function w(V) {
|
|
2506
|
+
if (V === "create") {
|
|
2507
|
+
if (l.value) {
|
|
2508
|
+
r.open({
|
|
2509
|
+
title: "Loading data...",
|
|
2510
|
+
message: "Please wait.",
|
|
2511
|
+
type: "info"
|
|
2512
|
+
});
|
|
2513
|
+
return;
|
|
2514
|
+
}
|
|
2515
|
+
return i.promptCreateTransferDialog();
|
|
2516
|
+
}
|
|
2517
|
+
if (V === "upload" && t.enableXilnexTransferNote)
|
|
2518
|
+
return i.promptUploadTransferDialog();
|
|
2519
|
+
if (V === "refresh")
|
|
2520
|
+
return i.fetchData();
|
|
2521
|
+
if (V === "export")
|
|
2522
|
+
return k();
|
|
2523
|
+
}
|
|
2524
|
+
const { breakpoints: F } = tt(), p = M(() => F.value.xs || F.value.sm), v = M(() => p.value ? 10 : 20), U = Gt(), j = M(() => [
|
|
2525
|
+
{
|
|
2526
|
+
label: y("inventory.transfer.receiveRequest.actions.create"),
|
|
2527
|
+
value: "create",
|
|
2528
|
+
isPrimary: !0,
|
|
2529
|
+
prependIcon: "add"
|
|
2530
|
+
},
|
|
2531
|
+
...t.enableXilnexTransferNote ? [
|
|
2532
|
+
{
|
|
2533
|
+
label: "Upload",
|
|
2534
|
+
value: "upload"
|
|
2535
|
+
}
|
|
2536
|
+
] : [],
|
|
2537
|
+
{
|
|
2538
|
+
label: y("common.refresh"),
|
|
2539
|
+
value: "refresh"
|
|
2540
|
+
},
|
|
2541
|
+
{
|
|
2542
|
+
label: y("common.export"),
|
|
2543
|
+
value: "export"
|
|
2544
|
+
}
|
|
2545
|
+
]);
|
|
2546
|
+
return (V, P) => {
|
|
2547
|
+
const K = $("FmTable");
|
|
2548
|
+
return S(), Y(Wt, {
|
|
2549
|
+
title: o(y)("inventory.transfer.receiveRequest.title2"),
|
|
2550
|
+
actions: j.value,
|
|
2551
|
+
"onClick:action": w
|
|
2552
|
+
}, {
|
|
2553
|
+
default: T(() => {
|
|
2554
|
+
var O;
|
|
2555
|
+
return [
|
|
2556
|
+
n("div", {
|
|
2557
|
+
class: Q([
|
|
2558
|
+
"flex flex-col gap-8 max-h-full",
|
|
2559
|
+
{
|
|
2560
|
+
"p-0": p.value,
|
|
2561
|
+
"px-24 ": !p.value
|
|
2562
|
+
}
|
|
2563
|
+
])
|
|
2564
|
+
}, [
|
|
2565
|
+
m(Jt, {
|
|
2566
|
+
"date-range-query": "",
|
|
2567
|
+
"date-range": f.value,
|
|
2568
|
+
"onUpdate:dateRange": P[0] || (P[0] = (A) => f.value = A),
|
|
2569
|
+
searchable: "",
|
|
2570
|
+
"change-location": "",
|
|
2571
|
+
search: g.value,
|
|
2572
|
+
"onUpdate:search": P[1] || (P[1] = (A) => g.value = A)
|
|
2573
|
+
}, null, 8, ["date-range", "search"]),
|
|
2574
|
+
(S(), Y(K, {
|
|
2575
|
+
style: gt(o(U).tableHeight),
|
|
2576
|
+
"column-defs": o(e),
|
|
2577
|
+
"row-data": o(i).purchaseOrders.value,
|
|
2578
|
+
"search-value": g.value,
|
|
2579
|
+
loading: l.value,
|
|
2580
|
+
onRowClick: P[2] || (P[2] = (A) => o(i).promptShowTransferDetails(A.original)),
|
|
2581
|
+
key: (O = o(a)._currentLocation) == null ? void 0 : O.dbName,
|
|
2582
|
+
"page-size": v.value
|
|
2583
|
+
}, {
|
|
2584
|
+
"list-row": T((A) => [
|
|
2585
|
+
m(kt, {
|
|
2586
|
+
row: A,
|
|
2587
|
+
onRowClick: o(i).promptShowTransferDetails
|
|
2588
|
+
}, {
|
|
2589
|
+
default: T((B) => {
|
|
2590
|
+
var q, X, x, C, Z, ue, ae, we, Fe, Ae, Me, Ye, Ue, ge, s, _, z, re, ie, _e;
|
|
2591
|
+
return [
|
|
2592
|
+
n("div", pa, [
|
|
2593
|
+
n("div", fa, [
|
|
2594
|
+
m(o(me), {
|
|
2595
|
+
render: (x = (X = (q = B._id) == null ? void 0 : q.column) == null ? void 0 : X.columnDef) == null ? void 0 : x.cell,
|
|
2596
|
+
props: (Z = (C = B._id) == null ? void 0 : C.getContext) == null ? void 0 : Z.call(C)
|
|
2597
|
+
}, null, 8, ["render", "props"])
|
|
2598
|
+
]),
|
|
2599
|
+
n("div", va, [
|
|
2600
|
+
m(o(me), {
|
|
2601
|
+
render: (we = (ae = (ue = B.supplier_name) == null ? void 0 : ue.column) == null ? void 0 : ae.columnDef) == null ? void 0 : we.cell,
|
|
2602
|
+
props: (Ae = (Fe = B.supplier_name) == null ? void 0 : Fe.getContext) == null ? void 0 : Ae.call(Fe)
|
|
2603
|
+
}, null, 8, ["render", "props"])
|
|
2604
|
+
]),
|
|
2605
|
+
n("div", ya, R(A.original.items.map((ve) => `${ve.name}`).join(", ")), 1),
|
|
2606
|
+
A.original.ref ? (S(), I("div", ba, [
|
|
2607
|
+
m(o(me), {
|
|
2608
|
+
render: (Ue = (Ye = (Me = B.ref) == null ? void 0 : Me.column) == null ? void 0 : Ye.columnDef) == null ? void 0 : Ue.cell,
|
|
2609
|
+
props: (s = (ge = B.ref) == null ? void 0 : ge.getContext) == null ? void 0 : s.call(ge)
|
|
2610
|
+
}, null, 8, ["render", "props"])
|
|
2611
|
+
])) : L("", !0),
|
|
2612
|
+
n("div", ga, [
|
|
2613
|
+
m(o(me), {
|
|
2614
|
+
render: (re = (z = (_ = B.status) == null ? void 0 : _.column) == null ? void 0 : z.columnDef) == null ? void 0 : re.cell,
|
|
2615
|
+
props: (_e = (ie = B.status) == null ? void 0 : ie.getContext) == null ? void 0 : _e.call(ie)
|
|
2616
|
+
}, null, 8, ["render", "props"])
|
|
2617
|
+
])
|
|
2618
|
+
])
|
|
2619
|
+
];
|
|
2620
|
+
}),
|
|
2621
|
+
_: 2
|
|
2622
|
+
}, 1032, ["row", "onRowClick"])
|
|
2623
|
+
]),
|
|
2624
|
+
_: 1
|
|
2625
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2626
|
+
], 2),
|
|
2627
|
+
(S(), Y(Rt, { to: "body" }, [
|
|
2628
|
+
m(Us, Xe(o(i).transferDialogProps.value, {
|
|
2629
|
+
onSubmitted: o(i).fetchData,
|
|
2630
|
+
"on-submit:return-stock": (A, B) => o(i).submitAction(
|
|
2631
|
+
A,
|
|
2632
|
+
"returnStock",
|
|
2633
|
+
void 0,
|
|
2634
|
+
B
|
|
2635
|
+
)
|
|
2636
|
+
}), null, 16, ["onSubmitted", "on-submit:return-stock"]),
|
|
2637
|
+
m(oo, Xe({
|
|
2638
|
+
scope: o(Ke).RECEIVE_REQUEST
|
|
2639
|
+
}, o(i).transferDetailsProps.value, {
|
|
2640
|
+
onSubmitted: o(i).fetchData,
|
|
2641
|
+
onReturnStock: o(i).promptReturnTransferDialog
|
|
2642
|
+
}), null, 16, ["scope", "onSubmitted", "onReturnStock"]),
|
|
2643
|
+
m(ca, Vt(Et(o(i).xilnexImportDialogProps.value)), null, 16)
|
|
2644
|
+
]))
|
|
2645
|
+
];
|
|
2646
|
+
}),
|
|
2647
|
+
_: 1
|
|
2648
|
+
}, 8, ["title", "actions"]);
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
});
|
|
2652
|
+
export {
|
|
2653
|
+
Aa as default
|
|
2654
|
+
};
|