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