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