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