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