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