@feedmepos/mf-inventory-portal 1.7.5-dev.1 → 1.7.5-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-Cajcbi7C.js → App-D4pfsscT.js} +4 -4
- package/dist/{ApprovalView-pn-qHYIX.js → ApprovalView-CYnp3Gv5.js} +25 -24
- package/dist/{BindingsDialog-zcBevwFb.js → BindingsDialog-Dm0kKlg-.js} +2 -2
- package/dist/{BindingsPicker-DRWl6zQ4.js → BindingsPicker-CdGHTlqD.js} +2 -2
- package/dist/{BindingsTable-8m6QfTWo.js → BindingsTable-DEZHwIgw.js} +3 -3
- package/dist/BulkReceiveRequestView-ClvGD9vp.js +2584 -0
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CJlb8KSr.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DVFOpysl.js} +1 -1
- package/dist/{ClosingDraftView-DSB7J84e.js → ClosingDraftView-CXTf30OO.js} +21 -21
- package/dist/{ClosingHistoryView-BmVm5PZ0.js → ClosingHistoryView-3yfjab3s.js} +5 -5
- package/dist/{ClosingTemplateView-D8epJry0.js → ClosingTemplateView-DhDRDJfg.js} +18 -18
- package/dist/CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-C0DjydRr.js +145 -0
- package/dist/{DefaultView-5NqNxkyj.js → DefaultView-BQyve9e7.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-hUWHCkIg.js → DeliveryOrderPrintPreview-Cx85J915.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-D2Am8ZDJ.js → EmailDialog.vue_vue_type_script_setup_true_lang-BjSzg-to.js} +3612 -3575
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DB2tvpP6.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DOY0FHF8.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-KCBmg5AJ.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DRLRTNJn.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B_0D62ne.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CnQPXIkP.js} +2 -2
- package/dist/{FmMultiselectDialog-DU7IzWG_.js → FmMultiselectDialog-DK737zIz.js} +1 -1
- package/dist/{FmMultiselectDialog-Ds_f8gua.js → FmMultiselectDialog-IIFXWxUT.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DSDqCW3P.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Bonb9Hnk.js} +5 -5
- package/dist/{ImportView-0gnR-m1B.js → ImportView-D4xpncdw.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BXsS60iO.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CYjvjRhH.js} +1 -1
- package/dist/{IngredientGroupView-D3M3aA_H.js → IngredientGroupView-Bh7ShplN.js} +7 -7
- package/dist/{IngredientsView-BoJUcVQE.js → IngredientsView-B03s_wbT.js} +17 -17
- package/dist/{IntegrationExplorerView-CANrFCne.js → IntegrationExplorerView-DgsllLAF.js} +4 -4
- package/dist/{IntegrationView-CNA-8zrj.js → IntegrationView-9BCyzPdb.js} +14 -14
- package/dist/{InventoryBindingForm-DT-YXt4c.js → InventoryBindingForm-C8LY1sc4.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CxNSflJ8.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang--mFdjT9b.js} +5 -5
- package/dist/{InventoryBindingSummary-BCnTxQhc.js → InventoryBindingSummary-BEvw0lWr.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DyRx5MmF.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CxgaZqAW.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CJf9wT6o.js → PremiumBadge.vue_vue_type_script_setup_true_lang--sxV3FYV.js} +1 -1
- package/dist/{ProductionView-09wAcGA-.js → ProductionView-B86EyiCZ.js} +7 -7
- package/dist/{PublishView-glA2ipo1.js → PublishView-DlETEaGs.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DpLO-1KW.js → PurchaseOrderPrintPreview-Be0U7Ler.js} +2 -2
- package/dist/{ReceiveRequestView-CzAVket3.js → ReceiveRequestView-DucbkxwJ.js} +80 -79
- package/dist/{RecipeView-LT5XJ6kA.js → RecipeView-BIlGYL8-.js} +19 -19
- package/dist/{SettingsView-BZfh4JMs.js → SettingsView-CUAHre50.js} +4 -4
- package/dist/{StockView-DFY1LgMH.js → StockView-kf_zhpO5.js} +22 -22
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CK6SIQza.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bpr7q8r9.js} +1 -1
- package/dist/{SupplierView-CL2IuwVZ.js → SupplierView-caFI7Yd6.js} +14 -14
- package/dist/{SurchargeView-BhfGyNu5.js → SurchargeView-DyO0ZOGa.js} +8 -8
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang--QyVwKtB.js +263 -0
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Bw8cubwk.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-2JCHCRHp.js} +1 -1
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dhll972g.js +4717 -0
- package/dist/{TransferTemplateView-DLOjb7km.js → TransferTemplateView-DUlH8K4Y.js} +21 -21
- package/dist/{UnitCostHistoryView-BtPucyKW.js → UnitCostHistoryView-OXv6kJgE.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DJ6kRWhP.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-1ekj_uc6.js} +4 -4
- package/dist/{UnitView-BvfkCvbb.js → UnitView-iwIzfipw.js} +9 -9
- package/dist/{WarehouseView-DqQY_NXe.js → WarehouseView-C9rSeAaV.js} +7 -7
- package/dist/{WastageTemplateView--Wrq7ge5.js → WastageTemplateView-OvD51JSq.js} +16 -16
- package/dist/api/purchase-order.d.ts +46 -0
- package/dist/{app-D_hKuHEq.js → app-D-nwdsYm.js} +19305 -19130
- package/dist/app.d.ts +64 -36
- package/dist/app.js +1 -1
- package/dist/{closing-template-mf0Hz0sS.js → closing-template-jWeRa4dz.js} +1 -1
- package/dist/component-BmLAdDiY.js +79 -0
- package/dist/components/job-progress/BulkJobProgressPanel.vue.d.ts +2 -0
- package/dist/components/row-action.enum.d.ts +1 -0
- package/dist/{date2-C3dcj9fz.js → date2-B_xDuM7M.js} +1 -1
- package/dist/{dayjs.min-BI88EzTz.js → dayjs.min-B-AZ8_mI.js} +5 -5
- package/dist/{decimal-BxOL6Gld.js → decimal-0ev5Hr6J.js} +2 -2
- package/dist/{defineDeepModel-Cvl7eN3k.js → defineDeepModel-DvI75jvB.js} +1 -1
- package/dist/{duplicate-template-DgS5Tm9P.js → duplicate-template-CVOoyyS0.js} +1 -1
- package/dist/{feature-Dd8HiMBk.js → feature-Cb-HS1Qb.js} +2 -2
- package/dist/{format-time-from-id-Cp2E5196.js → format-time-from-id-BCqZq29n.js} +1 -1
- package/dist/{format-unit-display-MACP_q07.js → format-unit-display-kSYRHsdn.js} +16 -16
- package/dist/{import-export.helper-DWMCTOY0.js → import-export.helper-B3bnD5gf.js} +6 -6
- package/dist/{index-D3jWqvZX.js → index-BmjXNcEU.js} +1 -1
- package/dist/{index-B2RsNEfe.js → index-CDiyP2Ua.js} +3 -3
- package/dist/{index-DFK8bQ6j.js → index-G6SYSs1V.js} +1 -1
- package/dist/{inventory-core-dart.default-D942GWzb.js → inventory-core-dart.default-B0kHPJ3I.js} +1 -1
- package/dist/{lz-string-CBjMP9eH.js → lz-string-CUfkGubt.js} +1 -1
- package/dist/{netsuite-D2953JgL.js → netsuite-CYNhS6XV.js} +2 -2
- package/dist/{number-DPVL24ED.js → number-BZuHTNem.js} +3 -3
- package/dist/{predefined-templates-C-1kU49_.js → predefined-templates-D--Y4747.js} +1 -1
- package/dist/{purchase-order-template-Dr2otb_Q.js → purchase-order-template-DGzn629O.js} +1 -1
- package/dist/{recalculationUtils-DOLRXWIr.js → recalculationUtils-B2mxdDHX.js} +1 -1
- package/dist/{row-action.enum-DQ9bJ_uv.js → row-action.enum-ncgDYAjP.js} +7 -1
- package/dist/{rules-CgbPIL_A.js → rules-C9dDCNg3.js} +2 -2
- package/dist/{stock-Bqj8CPcA.js → stock-Bys68KZZ.js} +3 -3
- package/dist/{stock-No7BQLB4.js → stock-DL4oech9.js} +1 -1
- package/dist/stores/bulk-job.d.ts +192 -0
- package/dist/stores/bulk-job.spec.d.ts +1 -0
- package/dist/{supplier-DNlISdQo.js → supplier-DPVpEG2w.js} +2 -2
- package/dist/{surcharge-BGZGoC81.js → surcharge-SHYN1X8A.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-B6ZB1FSB.js → uom-rules-nPqfI8Yz.js} +1 -1
- package/dist/{use-ingredient-select-dialog-CU5OTWPl.js → use-ingredient-select-dialog-BMvWiKB6.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DhxC5qLq.js → use-inventory-binding-dialog-CNOe57bY.js} +2 -2
- package/dist/{use-template-enabled-locations-Bv5HpHAV.js → use-template-enabled-locations-B7JBvvZ4.js} +2 -2
- package/dist/{use-transfer-locations-CRR5I64l.js → use-transfer-locations-BCu9xHNr.js} +2 -2
- package/dist/{useHrmPermission-bZrxydnr.js → useHrmPermission-WM9TCd_D.js} +1 -1
- package/dist/{useNavigationMenu-CazRNUsz.js → useNavigationMenu-6DdsN1jP.js} +2 -2
- package/dist/{useSseClient-l9O1iPny.js → useSseClient-B9Z0kGeF.js} +1 -1
- package/dist/views/receive-request/components/email-dialog/EmailDialogProps.d.ts +11 -0
- package/dist/views/receive-request/composables/fn.spec.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +13 -1
- package/dist/views/receive-request/helper/extra-items.d.ts +12 -2
- package/dist/views/receive-request/helper/format-unit-display.d.ts +1 -1
- package/dist/views/receive-request-bulk/components/PdfPreviewDialog.vue.d.ts +23 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +6 -18
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.spec.d.ts +1 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +3 -4
- package/dist/{vue-i18n-eAaLOca6.js → vue-i18n-DWcHQ0rm.js} +51 -51
- package/dist/{xlsx.util-Dp7SqdrI.js → xlsx.util-DC2xGyFF.js} +2 -2
- package/package.json +4 -5
- package/dist/BulkReceiveRequestView-MxPx0Gio.js +0 -2208
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-Du8ygQNn.js +0 -209
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dy79I2YB.js +0 -4712
- package/dist/component-kqxARxvM.js +0 -91
- package/dist/jszip.min-Pl_JnG-H.js +0 -2322
|
@@ -0,0 +1,4717 @@
|
|
|
1
|
+
import { f as it, p as ks } from "./format-time-from-id-BCqZq29n.js";
|
|
2
|
+
import { defineComponent as qe, ref as se, watch as Xe, createElementBlock as y, openBlock as i, createCommentVNode as V, createElementVNode as e, withDirectives as Os, toDisplayString as b, unref as v, vModelText as xs, toRaw as ws, shallowRef as dt, onUnmounted as rs, triggerRef as $s, computed as H, readonly as Cs, h as ee, resolveComponent as te, createVNode as T, Fragment as $e, renderList as Ie, reactive as As, onMounted as os, createBlock as ye, withCtx as ie, createTextVNode as We, normalizeClass as Qe, renderSlot as Ds, isRef as Rs, resolveDynamicComponent as Ns } from "vue";
|
|
3
|
+
import { c as Ht } from "./component-BmLAdDiY.js";
|
|
4
|
+
import { D as Ee, R as De } from "./row-action.enum-ncgDYAjP.js";
|
|
5
|
+
import { q as Ce, H as rt, m as Ps, u as Ke, U, Z as ns, _ as yt, T as _e, a as Dt, $ as Gt, a0 as Fs, a1 as Is, G as Ts, s as Rt, c as wt, M as Wt, a2 as as, r as lt, C as Me, w as Ne, B as mt, a3 as Es } from "./app-D-nwdsYm.js";
|
|
6
|
+
import { h as Nt, d as qs, t as Vs, a as tt } from "./date2-B_xDuM7M.js";
|
|
7
|
+
import { j as Ls, c as js, a as we, t as Ye, d as ut } from "./number-BZuHTNem.js";
|
|
8
|
+
import { F as ze, a as Us, b as Qt, d as St } from "./inventory-core-dart.default-B0kHPJ3I.js";
|
|
9
|
+
import { L as Ms } from "./lz-string-CUfkGubt.js";
|
|
10
|
+
import { useI18n as ht, useCoreStore as bt } from "@feedmepos/mf-common";
|
|
11
|
+
import { useDialog as gt, useSnackbar as Je, components as pt, FmButtonVariant as Ue, useProxiedModel as Bs } from "@feedmepos/ui-library";
|
|
12
|
+
import { u as _t, a as Pt, S as Be } from "./netsuite-CYNhS6XV.js";
|
|
13
|
+
import { F as st } from "./FmAdminBadge-DlplQOHb.js";
|
|
14
|
+
import { u as Ze } from "./feature-Cb-HS1Qb.js";
|
|
15
|
+
import { _ as Yt } from "./empty-placeholder-B0QU467o.js";
|
|
16
|
+
import { a as zs, b as Ks, f as ft } from "./format-unit-display-kSYRHsdn.js";
|
|
17
|
+
import { u as et, _ as Hs } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang--QyVwKtB.js";
|
|
18
|
+
import { _ as Gs, a as Ws, b as Qs } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-Bonb9Hnk.js";
|
|
19
|
+
import { u as Ys, R as Jt } from "./usePromise-CbVUCxhj.js";
|
|
20
|
+
import { e as Js } from "./index-CDiyP2Ua.js";
|
|
21
|
+
import { i as Zs } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DOY0FHF8.js";
|
|
22
|
+
import { F as Zt } from "./form-mode.enum-BKiNVH6A.js";
|
|
23
|
+
import { u as ls } from "./supplier-DPVpEG2w.js";
|
|
24
|
+
import { u as Xs } from "./surcharge-SHYN1X8A.js";
|
|
25
|
+
import { f as er, h as tr, r as sr, s as rr } from "./predefined-templates-D--Y4747.js";
|
|
26
|
+
import { F as or } from "./decimal-0ev5Hr6J.js";
|
|
27
|
+
import { d as is } from "./defineDeepModel-DvI75jvB.js";
|
|
28
|
+
import { u as nr } from "./vue-i18n-DWcHQ0rm.js";
|
|
29
|
+
import { u as ar } from "./useHrmPermission-WM9TCd_D.js";
|
|
30
|
+
function us(m, t) {
|
|
31
|
+
return t.reduce(
|
|
32
|
+
(n, p) => {
|
|
33
|
+
const u = p.received.find((d) => d.sku._id === m._id);
|
|
34
|
+
return u && (n = Ls(n, u.amount)), n;
|
|
35
|
+
},
|
|
36
|
+
or.toPrecision(js(0), m.unit.precision)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function cs(m) {
|
|
40
|
+
var n;
|
|
41
|
+
const t = Ce(), r = (n = m.supplier.supplyItems) != null && n.length ? { ...m.supplier, registrationNumber: m.supplier.registrationNumber ?? "" } : void 0;
|
|
42
|
+
return (p) => {
|
|
43
|
+
var u, d;
|
|
44
|
+
if ((u = p.totalCost) != null && u.amount) return p.totalCost;
|
|
45
|
+
if (!p.isCustomCost)
|
|
46
|
+
try {
|
|
47
|
+
const { cost: s } = ze.calculateDefaultCost({
|
|
48
|
+
item: p.sku,
|
|
49
|
+
amount: p.quantity,
|
|
50
|
+
measurement: p.measurement,
|
|
51
|
+
overrides: r ? { supplier: r } : void 0,
|
|
52
|
+
defaultCurrency: t
|
|
53
|
+
});
|
|
54
|
+
return s.amount ? s : void 0;
|
|
55
|
+
} catch (s) {
|
|
56
|
+
console.warn("[print] cost auto-calculation failed for item", (d = p.sku) == null ? void 0 : d._id, s);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function lr(m) {
|
|
62
|
+
var Se, Ae, B, ge, R, w, j;
|
|
63
|
+
const { po: t, currentLocation: r, business: n, fulfilling: p, por: u } = m, d = r.doc.profile || {}, { name: s, address: a, regNo: S, legalName: f } = d, C = {
|
|
64
|
+
name: s || r.name || "",
|
|
65
|
+
legalName: f || void 0,
|
|
66
|
+
registrationNumber: S || void 0,
|
|
67
|
+
line1: (a == null ? void 0 : a.line1) || "",
|
|
68
|
+
line2: (a == null ? void 0 : a.line2) || void 0,
|
|
69
|
+
postcode: (a == null ? void 0 : a.postcode) || "",
|
|
70
|
+
city: (a == null ? void 0 : a.city) || "",
|
|
71
|
+
state: (a == null ? void 0 : a.state) || "",
|
|
72
|
+
country: (a == null ? void 0 : a.country) || ""
|
|
73
|
+
}, A = {
|
|
74
|
+
name: t.supplier.name,
|
|
75
|
+
phoneNumber: t.supplier.phoneNumber || void 0,
|
|
76
|
+
registrationNumber: t.supplier.registrationNumber || void 0,
|
|
77
|
+
line1: ((Se = t.supplier.address) == null ? void 0 : Se.line1) || "",
|
|
78
|
+
line2: ((Ae = t.supplier.address) == null ? void 0 : Ae.line2) || void 0,
|
|
79
|
+
postcode: ((B = t.supplier.address) == null ? void 0 : B.postcode) || "",
|
|
80
|
+
city: ((ge = t.supplier.address) == null ? void 0 : ge.city) || "",
|
|
81
|
+
state: ((R = t.supplier.address) == null ? void 0 : R.state) || "",
|
|
82
|
+
country: ((w = t.supplier.address) == null ? void 0 : w.country) || ""
|
|
83
|
+
}, N = cs(t), h = [], M = t.items.filter((L) => L.sku).map((L) => {
|
|
84
|
+
var P;
|
|
85
|
+
const { sku: X, measurement: fe } = L, xe = we(
|
|
86
|
+
us(L.sku, t.deliveryOrder || []),
|
|
87
|
+
!1
|
|
88
|
+
), D = N(L);
|
|
89
|
+
return D && h.push(D), {
|
|
90
|
+
code: X.code,
|
|
91
|
+
description: X.name,
|
|
92
|
+
quantity: we(L.quantity, !1),
|
|
93
|
+
unit: (fe == null ? void 0 : fe.abbrev) || ((P = X.unit) == null ? void 0 : P.abbrev) || "",
|
|
94
|
+
received: xe,
|
|
95
|
+
unitCost: D ? `${D.currency} ${ze.toFormatString({
|
|
96
|
+
value: L.quantity.amount === 0 ? ze.fromNumber(0) : ze.divide([D, L.quantity])
|
|
97
|
+
})}` : void 0,
|
|
98
|
+
cost: D ? `${D.currency} ${ze.toFormatString({
|
|
99
|
+
value: D
|
|
100
|
+
})}` : void 0
|
|
101
|
+
};
|
|
102
|
+
}), E = h.length ? `${h[0].currency} ${ze.toFormatString({
|
|
103
|
+
value: h.reduce((L, X) => ze.add([L, X]), ze.reset())
|
|
104
|
+
})}` : void 0, re = (t.deliveryOrder || []).map((L) => ({
|
|
105
|
+
createdAt: Nt(new Date(L.createdAt)),
|
|
106
|
+
ref: L.deliveryOrderNumber,
|
|
107
|
+
remark: L.remark || "",
|
|
108
|
+
items: (L.received || []).map((X) => {
|
|
109
|
+
var fe, xe, D, P, le;
|
|
110
|
+
return {
|
|
111
|
+
code: ((fe = X.sku) == null ? void 0 : fe.code) || "",
|
|
112
|
+
description: ((xe = X.sku) == null ? void 0 : xe.name) || "",
|
|
113
|
+
quantity: we(X.amount),
|
|
114
|
+
unit: ((D = X.measurement) == null ? void 0 : D.abbrev) || ((le = (P = X.sku) == null ? void 0 : P.unit) == null ? void 0 : le.abbrev) || ""
|
|
115
|
+
};
|
|
116
|
+
})
|
|
117
|
+
}));
|
|
118
|
+
let J = rt.Enum.purchaseOrder, W = "Inventory Receive Note";
|
|
119
|
+
if (t.supplier.internal ? (W = "Inventory Transfer Note", J = rt.Enum.transferOrder) : (W = "Purchase Order", J = rt.Enum.purchaseOrder), (j = u == null ? void 0 : u.from) != null && j.dbName) {
|
|
120
|
+
const L = u.from.dbName;
|
|
121
|
+
r.dbName === L || (W = "Inventory Receive Note", J = rt.Enum.goodsReceivedNote);
|
|
122
|
+
}
|
|
123
|
+
const pe = {
|
|
124
|
+
title: W,
|
|
125
|
+
businessName: n == null ? void 0 : n.name,
|
|
126
|
+
logo: n == null ? void 0 : n.thumbnail,
|
|
127
|
+
orderNumber: t.seqNumber.toString(),
|
|
128
|
+
createdAt: it(t._id),
|
|
129
|
+
ref: t.ref || "",
|
|
130
|
+
remark: t.remark || "",
|
|
131
|
+
buyer: C,
|
|
132
|
+
supplier: A,
|
|
133
|
+
items: M,
|
|
134
|
+
grandTotal: E,
|
|
135
|
+
status: t.status,
|
|
136
|
+
deliveryOrders: re
|
|
137
|
+
}, oe = p && (t.deliveryFullfillment || []).length > 0;
|
|
138
|
+
return oe && (J = rt.Enum.deliveryOrder), { printData: pe, templateType: J, isDeliveryPrint: oe };
|
|
139
|
+
}
|
|
140
|
+
function ds(m) {
|
|
141
|
+
var f;
|
|
142
|
+
const { printData: t, templateType: r } = lr(m), p = er().getTemplateByType(r), u = !!((f = p == null ? void 0 : p.blocks) != null && f.length), d = tr(r), s = u ? p.blocks : d.blocks, a = u ? p.name : d.name, S = !u;
|
|
143
|
+
try {
|
|
144
|
+
const C = sr(s, t), A = C.match(/<style>([\s\S]*?)<\/style>/), N = A ? `<style>${A[1]}</style>` : "", h = C.replace(/<style>[\s\S]*?<\/style>/, "");
|
|
145
|
+
return {
|
|
146
|
+
html: `<!DOCTYPE html>
|
|
147
|
+
<html>
|
|
148
|
+
<head>
|
|
149
|
+
<meta charset="utf-8">
|
|
150
|
+
<title>Print Preview</title>
|
|
151
|
+
<style>
|
|
152
|
+
@page { margin: 0; }
|
|
153
|
+
@media print {
|
|
154
|
+
body { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
|
|
155
|
+
}
|
|
156
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
157
|
+
</style>
|
|
158
|
+
${N}
|
|
159
|
+
</head>
|
|
160
|
+
<body>${h}</body>
|
|
161
|
+
</html>`,
|
|
162
|
+
templateName: a,
|
|
163
|
+
isDefault: S
|
|
164
|
+
};
|
|
165
|
+
} catch {
|
|
166
|
+
return alert("Failed to render print template. Please try recreating the template."), null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const ir = Ps((m, t) => {
|
|
170
|
+
const r = Ke();
|
|
171
|
+
return {
|
|
172
|
+
async getShipments({
|
|
173
|
+
start: n,
|
|
174
|
+
end: p
|
|
175
|
+
}) {
|
|
176
|
+
const u = r.currentLocationDBName, d = `${m.inventoryBackendUrl}/${u}/shipments`;
|
|
177
|
+
return await t.get(`${d}?start=${n}&end=${p}`);
|
|
178
|
+
},
|
|
179
|
+
async getShipmentsByIds(n) {
|
|
180
|
+
if (n.length === 0)
|
|
181
|
+
return [];
|
|
182
|
+
const p = r.currentLocationDBName, u = `${m.inventoryBackendUrl}/${p}/shipments/get`;
|
|
183
|
+
return await t.post(u, { shipmentIds: n });
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}), ms = {
|
|
187
|
+
[U.enum.confirmDraft]: {
|
|
188
|
+
primaryActions: {
|
|
189
|
+
text: "Confirm draft",
|
|
190
|
+
close: !0
|
|
191
|
+
},
|
|
192
|
+
title: "Confirm draft?",
|
|
193
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
194
|
+
successMessage: "Purchase order draft has been confirmed"
|
|
195
|
+
},
|
|
196
|
+
[U.enum.cancelDraft]: {
|
|
197
|
+
primaryActions: {
|
|
198
|
+
text: "Cancel draft",
|
|
199
|
+
close: !0,
|
|
200
|
+
variant: "destructive"
|
|
201
|
+
},
|
|
202
|
+
title: "Cancel draft?",
|
|
203
|
+
message: "Purchase order cannot be changed after cancelled draft.",
|
|
204
|
+
successMessage: "Purchase order draft has been cancelled"
|
|
205
|
+
},
|
|
206
|
+
[U.enum.approveDraft]: {
|
|
207
|
+
primaryActions: {
|
|
208
|
+
text: "Approve draft",
|
|
209
|
+
close: !0
|
|
210
|
+
},
|
|
211
|
+
title: "Approve draft?",
|
|
212
|
+
message: "Purchase order request will be accepted.",
|
|
213
|
+
successMessage: "Purchase order has been approved"
|
|
214
|
+
},
|
|
215
|
+
[U.enum.rejectDraft]: {
|
|
216
|
+
primaryActions: {
|
|
217
|
+
text: "Reject draft",
|
|
218
|
+
close: !0
|
|
219
|
+
},
|
|
220
|
+
title: "Reject draft?",
|
|
221
|
+
message: "Purchase order request will be rejected. You may provide an optional reason for rejection.",
|
|
222
|
+
successMessage: "Purchase order has been rejected"
|
|
223
|
+
},
|
|
224
|
+
[U.enum.submitRequest]: {
|
|
225
|
+
primaryActions: {
|
|
226
|
+
text: "Submit request",
|
|
227
|
+
close: !0
|
|
228
|
+
},
|
|
229
|
+
title: "Confirm draft?",
|
|
230
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
231
|
+
successMessage: "Purchase order draft has been submitted"
|
|
232
|
+
},
|
|
233
|
+
[U.enum.completeReceive]: {
|
|
234
|
+
primaryActions: {
|
|
235
|
+
text: "Mark received",
|
|
236
|
+
close: !0
|
|
237
|
+
},
|
|
238
|
+
title: "Mark as received",
|
|
239
|
+
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
240
|
+
successMessage: "Purchase order has been marked as received"
|
|
241
|
+
},
|
|
242
|
+
[U.enum.approveRequest]: {
|
|
243
|
+
primaryActions: {
|
|
244
|
+
text: "Accept request",
|
|
245
|
+
close: !0
|
|
246
|
+
},
|
|
247
|
+
title: "Accept request?",
|
|
248
|
+
message: "Transfer out request will be accepted.",
|
|
249
|
+
successMessage: "Transfer out request has been approved"
|
|
250
|
+
},
|
|
251
|
+
[U.enum.rejectRequest]: {
|
|
252
|
+
primaryActions: {
|
|
253
|
+
text: "Reject request",
|
|
254
|
+
close: !0,
|
|
255
|
+
variant: "destructive"
|
|
256
|
+
},
|
|
257
|
+
title: "Reject request?",
|
|
258
|
+
message: "Purchase order will be rejected.",
|
|
259
|
+
successMessage: "Purchase order has been rejected"
|
|
260
|
+
},
|
|
261
|
+
[U.enum.processRequest]: {
|
|
262
|
+
primaryActions: {
|
|
263
|
+
text: "Process request",
|
|
264
|
+
close: !0,
|
|
265
|
+
variant: "destructive"
|
|
266
|
+
},
|
|
267
|
+
title: "Process request?",
|
|
268
|
+
message: "Purchase order will be processed.",
|
|
269
|
+
successMessage: "Purchase order has been processed"
|
|
270
|
+
}
|
|
271
|
+
}, ur = { class: "p-4" }, cr = {
|
|
272
|
+
key: 0,
|
|
273
|
+
class: "fm-typo-en-body-md-400 mb-3"
|
|
274
|
+
}, dr = { class: "fm-typo-en-body-md-400" }, ps = /* @__PURE__ */ qe({
|
|
275
|
+
__name: "RejectDraftForm",
|
|
276
|
+
props: {
|
|
277
|
+
message: {},
|
|
278
|
+
confirm: { type: Function },
|
|
279
|
+
onChange: { type: Function }
|
|
280
|
+
},
|
|
281
|
+
setup(m) {
|
|
282
|
+
const t = m, { t: r } = ht(), n = se("");
|
|
283
|
+
Xe(n, (u) => {
|
|
284
|
+
var d;
|
|
285
|
+
(d = t.onChange) == null || d.call(t, u ?? "");
|
|
286
|
+
});
|
|
287
|
+
function p() {
|
|
288
|
+
n.value = "";
|
|
289
|
+
}
|
|
290
|
+
return (u, d) => (i(), y("div", ur, [
|
|
291
|
+
t.message ? (i(), y("div", cr, b(t.message), 1)) : V("", !0),
|
|
292
|
+
e("label", dr, b(v(r)("inventory.transfer.receiveRequest.details.rejectionReason")) + " (" + b(v(r)("inventory.common.optional")) + ")", 1),
|
|
293
|
+
Os(e("textarea", {
|
|
294
|
+
"onUpdate:modelValue": d[0] || (d[0] = (s) => n.value = s),
|
|
295
|
+
rows: "4",
|
|
296
|
+
class: "w-full mt-2 p-2 border rounded"
|
|
297
|
+
}, null, 512), [
|
|
298
|
+
[xs, n.value]
|
|
299
|
+
]),
|
|
300
|
+
e("div", { class: "mt-3 flex gap-2" }, [
|
|
301
|
+
e("button", {
|
|
302
|
+
type: "button",
|
|
303
|
+
class: "fm-btn fm-btn-tertiary",
|
|
304
|
+
onClick: p
|
|
305
|
+
}, "Clear")
|
|
306
|
+
])
|
|
307
|
+
]));
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
function vt(m) {
|
|
311
|
+
if (m.items == null)
|
|
312
|
+
return {};
|
|
313
|
+
const t = ns.safeParse(m);
|
|
314
|
+
if (!t.success) {
|
|
315
|
+
const r = t.error.issues.map((n) => `${n.path.join(".") || "(root)"}: ${n.message}`).join("; ");
|
|
316
|
+
return console.error(
|
|
317
|
+
`Cannot compute receive status for PO ${m == null ? void 0 : m._id}: invalid shape at ${r}`
|
|
318
|
+
), {};
|
|
319
|
+
}
|
|
320
|
+
return yt.generatedPOReceivedMap({
|
|
321
|
+
purchaseOrder: m
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function mr(m) {
|
|
325
|
+
return yt.validatePOItemReceivedStatus({
|
|
326
|
+
dto: m
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function $t(m) {
|
|
330
|
+
return yt.validatePOReceivedStatus({
|
|
331
|
+
receivedMap: m
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function Ct(m, t, r) {
|
|
335
|
+
if (!_e.safeParse(m).success)
|
|
336
|
+
throw new Error(`Invalid purchase order status: ${m}`);
|
|
337
|
+
const n = _e.parse(m);
|
|
338
|
+
return yt.orderStatusCombination({
|
|
339
|
+
status: n,
|
|
340
|
+
isPOPartialReceive: t,
|
|
341
|
+
isPOOverReceive: r
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function fs() {
|
|
345
|
+
const m = Ke(), t = et(), r = Ze();
|
|
346
|
+
async function n(u, d) {
|
|
347
|
+
const s = m.currentLocationDBName;
|
|
348
|
+
return u.doc.supplier.internal && u.operation === U.enum.confirmDraft && (u.operation = U.enum.submitRequest), await t.processPurchaseOrder(u, d || s);
|
|
349
|
+
}
|
|
350
|
+
async function p(u, d) {
|
|
351
|
+
const s = m.currentLocationDBName;
|
|
352
|
+
return await t.processPurchaseOrderV2(u, d || s);
|
|
353
|
+
}
|
|
354
|
+
return (u) => r.useOperatePurchaseOrderV2 ? p(u.operateV2, u.transferTo) : n(u.operate, u.transferTo);
|
|
355
|
+
}
|
|
356
|
+
function Ge(m) {
|
|
357
|
+
const t = ws(m);
|
|
358
|
+
if (Array.isArray(t))
|
|
359
|
+
return t.map(Ge);
|
|
360
|
+
if (t !== null && typeof t == "object") {
|
|
361
|
+
const r = {};
|
|
362
|
+
for (const n in t)
|
|
363
|
+
Object.prototype.hasOwnProperty.call(t, n) && (r[n] = Ge(t[n]));
|
|
364
|
+
return r;
|
|
365
|
+
}
|
|
366
|
+
return t;
|
|
367
|
+
}
|
|
368
|
+
const kt = {
|
|
369
|
+
set: "set",
|
|
370
|
+
add: "add",
|
|
371
|
+
delete: "delete"
|
|
372
|
+
};
|
|
373
|
+
function Xt(m) {
|
|
374
|
+
return {
|
|
375
|
+
dbName: m.dbName,
|
|
376
|
+
type: m.type,
|
|
377
|
+
name: m.name,
|
|
378
|
+
acceptRequest: m.acceptRequest ?? !1,
|
|
379
|
+
doc: m.doc
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
const vs = { line1: "", state: "", city: "", postcode: "", country: "" };
|
|
383
|
+
function ot(m) {
|
|
384
|
+
return m == null ? "" : String(m);
|
|
385
|
+
}
|
|
386
|
+
function ys(m) {
|
|
387
|
+
const t = m.address, r = t != null ? {
|
|
388
|
+
...t,
|
|
389
|
+
line1: ot(t.line1),
|
|
390
|
+
state: ot(t.state),
|
|
391
|
+
city: ot(t.city),
|
|
392
|
+
postcode: ot(t.postcode),
|
|
393
|
+
country: ot(t.country)
|
|
394
|
+
} : { ...vs };
|
|
395
|
+
return {
|
|
396
|
+
...m,
|
|
397
|
+
registrationNumber: m.registrationNumber ?? "",
|
|
398
|
+
address: r
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function es(m, t, r, n, p) {
|
|
402
|
+
const u = Ge(m.suppliers ?? []).map(ys), d = Ge(t.allLocations ?? []).map(Xt), s = t._currentLocation ? Xt(Ge(t._currentLocation)) : null, a = r.inventory ? [Ge(r.inventory)] : [], S = n.state.setting ? Ge(n.state.setting) : null, f = Ge(p.surcharges ?? []);
|
|
403
|
+
return {
|
|
404
|
+
suppliers: u,
|
|
405
|
+
locations: d,
|
|
406
|
+
currentLocation: s,
|
|
407
|
+
inventoryDoc: a,
|
|
408
|
+
netSuiteSetting: S,
|
|
409
|
+
surcharges: f
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function hs() {
|
|
413
|
+
const m = ls(), t = Ke(), r = Dt(), n = _t(), p = Xs(), u = es(
|
|
414
|
+
m,
|
|
415
|
+
t,
|
|
416
|
+
r,
|
|
417
|
+
n,
|
|
418
|
+
p
|
|
419
|
+
), d = dt(Us({ env: u }));
|
|
420
|
+
d.value.setUsePartialUpdates(!0);
|
|
421
|
+
const s = dt(d.value.state()), a = (A) => {
|
|
422
|
+
s.value = d.value.state();
|
|
423
|
+
};
|
|
424
|
+
d.value.addListener(a);
|
|
425
|
+
const S = (A, N, h) => {
|
|
426
|
+
switch (A) {
|
|
427
|
+
case kt.set:
|
|
428
|
+
Gt(s.value, N, h);
|
|
429
|
+
break;
|
|
430
|
+
case kt.add:
|
|
431
|
+
Is(s.value, N, h);
|
|
432
|
+
break;
|
|
433
|
+
case kt.delete:
|
|
434
|
+
Fs(s.value, N);
|
|
435
|
+
break;
|
|
436
|
+
default:
|
|
437
|
+
console.warn(`Unknown partial update operation: ${A}, falling back to 'set'`), Gt(s.value, N, h);
|
|
438
|
+
}
|
|
439
|
+
N !== "remark" && N !== "ref" && $s(s);
|
|
440
|
+
};
|
|
441
|
+
d.value.addPartialListener(S);
|
|
442
|
+
function f() {
|
|
443
|
+
const A = es(
|
|
444
|
+
m,
|
|
445
|
+
t,
|
|
446
|
+
r,
|
|
447
|
+
n,
|
|
448
|
+
p
|
|
449
|
+
);
|
|
450
|
+
try {
|
|
451
|
+
d.value.updateFullEnv(A), s.value = d.value.state();
|
|
452
|
+
} catch (N) {
|
|
453
|
+
console.error("[PurchaseOrderFormController] updateFullEnv failed", N);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
Xe(
|
|
457
|
+
[
|
|
458
|
+
() => m.suppliers,
|
|
459
|
+
() => t.allLocations,
|
|
460
|
+
() => t._currentLocation,
|
|
461
|
+
() => r.inventory,
|
|
462
|
+
() => n.state.setting,
|
|
463
|
+
() => p.surcharges
|
|
464
|
+
],
|
|
465
|
+
() => {
|
|
466
|
+
f();
|
|
467
|
+
},
|
|
468
|
+
{ deep: !0 }
|
|
469
|
+
), rs(() => {
|
|
470
|
+
d.value.removeListener(a), d.value.removePartialListener(S);
|
|
471
|
+
});
|
|
472
|
+
function C(A) {
|
|
473
|
+
var N;
|
|
474
|
+
if (A != null && A._id) {
|
|
475
|
+
const h = /* @__PURE__ */ new Set(["1", "2"]), M = A, E = M.supplier, re = E != null ? ys(E) : { _id: "", name: "", registrationNumber: "", address: { ...vs } }, J = {
|
|
476
|
+
...A,
|
|
477
|
+
version: h.has(A.version) ? A.version : null,
|
|
478
|
+
supplier: re,
|
|
479
|
+
// items/deliveryOrder may be absent or contain null/corrupted elements.
|
|
480
|
+
// The Dart bridge has no null guards on sku, sku.unit, and quantity —
|
|
481
|
+
// all three produce "Uncaught (in promise) TypeError: $index on null".
|
|
482
|
+
items: (M.items ?? []).filter((W) => {
|
|
483
|
+
if (W == null || W.sku == null || typeof W.sku != "object") return !1;
|
|
484
|
+
const he = W;
|
|
485
|
+
return he.sku.unit != null && he.quantity != null && typeof he.quantity == "object";
|
|
486
|
+
}),
|
|
487
|
+
// received[].sku/sku.unit/amount have the exact same Dart-bridge null-guard
|
|
488
|
+
// gap as items[].sku/sku.unit/quantity above — filter the same way.
|
|
489
|
+
deliveryOrder: (M.deliveryOrder ?? []).filter((W) => W != null).map((W) => ({
|
|
490
|
+
...W,
|
|
491
|
+
received: (W.received ?? []).filter((he) => {
|
|
492
|
+
if (he == null || he.sku == null || typeof he.sku != "object") return !1;
|
|
493
|
+
const pe = he;
|
|
494
|
+
return pe.sku.unit != null && pe.amount != null && typeof pe.amount == "object";
|
|
495
|
+
})
|
|
496
|
+
}))
|
|
497
|
+
};
|
|
498
|
+
try {
|
|
499
|
+
d.value.loadPurchaseOrder(J);
|
|
500
|
+
} catch (W) {
|
|
501
|
+
console.error("[PurchaseOrderFormController] loadPurchaseOrder failed", W);
|
|
502
|
+
}
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (!Ze().mustUsePoTemplate) {
|
|
506
|
+
d.value.init();
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
A != null && A.template && ((N = A.templateDoc) != null && N.purchaseOrder) ? (A.items = A.templateDoc.purchaseOrder.items, d.value.initFromTemplate(A)) : d.value.initOutletToOutlet();
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
controller: d,
|
|
513
|
+
state: s,
|
|
514
|
+
init: C
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
var At = /* @__PURE__ */ ((m) => (m.RECEIVE_REQUEST = "receive/request", m.APPROVAL = "approval", m))(At || {});
|
|
518
|
+
const nt = se(), Ot = se(), xt = se();
|
|
519
|
+
function bi(m, t) {
|
|
520
|
+
const r = gt(), n = Ke(), p = Ze(), u = ls(), d = bt(), s = zs(), a = Ks(), S = se(!1), f = Je(), C = et(), A = ir(), N = se(new Array()), h = se(new Array()), M = se(
|
|
521
|
+
t != null && t.startDate && (t != null && t.endDate) ? t : Zs()
|
|
522
|
+
), E = H(() => {
|
|
523
|
+
const D = new Date(M.value.startDate), P = new Date(M.value.endDate);
|
|
524
|
+
return {
|
|
525
|
+
start: Vs(D).toISOString(),
|
|
526
|
+
end: qs(P).toISOString()
|
|
527
|
+
};
|
|
528
|
+
}), re = se(new Array()), J = Ts(), W = se(null);
|
|
529
|
+
async function he(D) {
|
|
530
|
+
function P(ce) {
|
|
531
|
+
const $ = {
|
|
532
|
+
mode: Zt.CREATE,
|
|
533
|
+
modelValue: D || void 0,
|
|
534
|
+
show: !0,
|
|
535
|
+
"onUpdate:show"(_) {
|
|
536
|
+
nt.value.show = _;
|
|
537
|
+
},
|
|
538
|
+
templateId: ce,
|
|
539
|
+
lastClosingDate: W.value
|
|
540
|
+
};
|
|
541
|
+
nt.value = $;
|
|
542
|
+
}
|
|
543
|
+
let le;
|
|
544
|
+
p.mustUsePoTemplate && !(D != null && D.template) ? r.open({
|
|
545
|
+
title: "Create transfer",
|
|
546
|
+
message: "",
|
|
547
|
+
primaryActions: {
|
|
548
|
+
text: "Select a template",
|
|
549
|
+
close: !0
|
|
550
|
+
},
|
|
551
|
+
secondaryActions: {
|
|
552
|
+
text: "Outlet to Outlet",
|
|
553
|
+
variant: "secondary",
|
|
554
|
+
close: !0
|
|
555
|
+
}
|
|
556
|
+
}).onPrimary(async () => {
|
|
557
|
+
le = await s.getTemplateId(), le && P(le);
|
|
558
|
+
}).onSecondary(() => {
|
|
559
|
+
P(void 0);
|
|
560
|
+
}) : P(le);
|
|
561
|
+
}
|
|
562
|
+
function pe(D) {
|
|
563
|
+
const P = {
|
|
564
|
+
mode: Zt.UPDATE,
|
|
565
|
+
modelValue: wt(D),
|
|
566
|
+
show: !0,
|
|
567
|
+
"onUpdate:show"(le) {
|
|
568
|
+
nt.value.show = le;
|
|
569
|
+
},
|
|
570
|
+
lastClosingDate: W.value
|
|
571
|
+
};
|
|
572
|
+
nt.value = P;
|
|
573
|
+
}
|
|
574
|
+
function oe(D) {
|
|
575
|
+
if (!d.currentBusiness.value) return;
|
|
576
|
+
const P = n.currentLocation;
|
|
577
|
+
if (P.type === "restaurant") {
|
|
578
|
+
const q = n.locationRestaurantFromCore(P.doc._id);
|
|
579
|
+
q !== null && (P.doc = q);
|
|
580
|
+
}
|
|
581
|
+
const le = ds({
|
|
582
|
+
po: D,
|
|
583
|
+
currentLocation: P,
|
|
584
|
+
business: d.currentBusiness.value,
|
|
585
|
+
fulfilling: m === "approval",
|
|
586
|
+
por: D.request
|
|
587
|
+
});
|
|
588
|
+
if (!le) return;
|
|
589
|
+
const ce = rr(le.html), $ = u.supplierById[D.supplier._id], _ = {
|
|
590
|
+
recipientName: $.name,
|
|
591
|
+
email: ($ == null ? void 0 : $.email) ?? "",
|
|
592
|
+
business: d.currentBusiness.value,
|
|
593
|
+
modelValue: ce,
|
|
594
|
+
show: !0,
|
|
595
|
+
"onUpdate:show"(q) {
|
|
596
|
+
Ot.value.show = q;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
Ot.value = _;
|
|
600
|
+
}
|
|
601
|
+
async function Se() {
|
|
602
|
+
N.value = [], h.value = [], S.value = !0;
|
|
603
|
+
try {
|
|
604
|
+
const D = await C.getPurchaseOrders(E.value);
|
|
605
|
+
N.value = D.sort((q, Z) => Z._id.localeCompare(q._id));
|
|
606
|
+
const P = D.flatMap((q) => q.shipmentIds || []).filter(Boolean), le = P.length > 0 ? await A.getShipmentsByIds(P) : [];
|
|
607
|
+
h.value = le;
|
|
608
|
+
const ce = await J.readCurrentLocationLastClosing(!0), $ = ce == null ? void 0 : ce._id;
|
|
609
|
+
$ && (W.value = ks($)), await p.awaitFeatureLoaded(() => p.mustUsePoTemplate) && await a.fetchTemplates();
|
|
610
|
+
const _ = N.value.map((q) => {
|
|
611
|
+
var Z;
|
|
612
|
+
return ((Z = q.request) == null ? void 0 : Z.id) ?? "";
|
|
613
|
+
}).filter((q) => q);
|
|
614
|
+
re.value = await C.readRequestByIds(_);
|
|
615
|
+
} catch {
|
|
616
|
+
f.open({
|
|
617
|
+
title: "Something went wrong",
|
|
618
|
+
message: "Error at fetching purchase orders",
|
|
619
|
+
type: "error"
|
|
620
|
+
});
|
|
621
|
+
} finally {
|
|
622
|
+
S.value = !1;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
async function Ae() {
|
|
626
|
+
re.value = [], S.value = !0;
|
|
627
|
+
try {
|
|
628
|
+
re.value = await C.readRequests(
|
|
629
|
+
void 0,
|
|
630
|
+
E.value.start,
|
|
631
|
+
E.value.end
|
|
632
|
+
).then((D) => D.reverse());
|
|
633
|
+
} catch {
|
|
634
|
+
f.open({
|
|
635
|
+
title: "Something went wrong",
|
|
636
|
+
message: "Error at fetching purchase requests",
|
|
637
|
+
type: "error"
|
|
638
|
+
});
|
|
639
|
+
} finally {
|
|
640
|
+
S.value = !1;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
function B() {
|
|
644
|
+
switch (m) {
|
|
645
|
+
case "receive/request":
|
|
646
|
+
return Se();
|
|
647
|
+
case "approval":
|
|
648
|
+
return Ae();
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
function ge(D, P) {
|
|
652
|
+
M.value = {
|
|
653
|
+
startDate: D,
|
|
654
|
+
endDate: P
|
|
655
|
+
}, B();
|
|
656
|
+
}
|
|
657
|
+
n.watchLocation(async (D) => {
|
|
658
|
+
if (!D) {
|
|
659
|
+
N.value = [];
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
await B();
|
|
663
|
+
});
|
|
664
|
+
async function R(D) {
|
|
665
|
+
return D;
|
|
666
|
+
}
|
|
667
|
+
const w = se(), j = se(Math.random().toString());
|
|
668
|
+
async function L(D, P) {
|
|
669
|
+
const le = Math.random().toString();
|
|
670
|
+
j.value = le, P ?? (P = re.value.computeFirst(
|
|
671
|
+
(q) => q.purchaseOrderId === D._id ? q : null
|
|
672
|
+
) ?? void 0);
|
|
673
|
+
const ce = m === "receive/request" ? n.currentLocation : P == null ? void 0 : P.to, $ = m === "approval", _ = {
|
|
674
|
+
poRequest: P,
|
|
675
|
+
purchaseOrder: {
|
|
676
|
+
...D,
|
|
677
|
+
status: $ && (P != null && P.rejectedAt) ? _e.Enum.REJECT : D.status
|
|
678
|
+
},
|
|
679
|
+
transferTo: ce == null ? void 0 : ce.name,
|
|
680
|
+
transferToDbName: ce == null ? void 0 : ce.dbName,
|
|
681
|
+
show: !0,
|
|
682
|
+
canResubmit: !1,
|
|
683
|
+
canApprove: $,
|
|
684
|
+
"onUpdate:show"(q) {
|
|
685
|
+
w.value && (w.value = { ...w.value, show: q });
|
|
686
|
+
},
|
|
687
|
+
scope: m,
|
|
688
|
+
receivedMap: vt(D) ?? {},
|
|
689
|
+
shipments: h.value
|
|
690
|
+
};
|
|
691
|
+
w.value = _;
|
|
692
|
+
}
|
|
693
|
+
async function X(D, P, le, ce, $) {
|
|
694
|
+
const _ = fs();
|
|
695
|
+
S.value = !0;
|
|
696
|
+
try {
|
|
697
|
+
await _({
|
|
698
|
+
operate: {
|
|
699
|
+
operation: P,
|
|
700
|
+
doc: D,
|
|
701
|
+
options: (
|
|
702
|
+
// auto receive for supplier to warehouse
|
|
703
|
+
(P === U.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
704
|
+
P === U.enum.completeReceive) && p.autoReceiveWarehouse ? {
|
|
705
|
+
autoReceive: !0
|
|
706
|
+
} : void 0
|
|
707
|
+
)
|
|
708
|
+
},
|
|
709
|
+
operateV2: {
|
|
710
|
+
_id: D._id,
|
|
711
|
+
_rev: D._rev ?? "",
|
|
712
|
+
action: P === U.enum.submitRequest ? U.enum.confirmDraft : P,
|
|
713
|
+
payloads: $ ?? []
|
|
714
|
+
},
|
|
715
|
+
transferTo: ce
|
|
716
|
+
}), await new Promise((de) => setTimeout(de, 1e3));
|
|
717
|
+
const Z = Ke().currentLocationDBName.startsWith("restaurant_");
|
|
718
|
+
P === U.enum.confirmDraft && D.effectiveAt && Z ? f.open({
|
|
719
|
+
title: "Success",
|
|
720
|
+
message: `${le}. The backdate will be reflected once your POS has received this change.`,
|
|
721
|
+
type: "success"
|
|
722
|
+
}) : f.open({
|
|
723
|
+
title: "Success",
|
|
724
|
+
message: le,
|
|
725
|
+
type: "success"
|
|
726
|
+
});
|
|
727
|
+
} catch (q) {
|
|
728
|
+
f.open({
|
|
729
|
+
title: "Something went wrong",
|
|
730
|
+
message: q instanceof Error ? q.message : "Please try again.",
|
|
731
|
+
type: "error"
|
|
732
|
+
}), console.error("Error when submitting PO operation", P, D, q);
|
|
733
|
+
} finally {
|
|
734
|
+
S.value = !1, B();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
async function fe(D, P, le) {
|
|
738
|
+
const ce = ms[P];
|
|
739
|
+
if (!ce) {
|
|
740
|
+
f.open({
|
|
741
|
+
title: "Something went wrong",
|
|
742
|
+
message: `Cannot process order: ${Rt(P)}`,
|
|
743
|
+
type: "error"
|
|
744
|
+
});
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
const { successMessage: $, ..._ } = ce;
|
|
748
|
+
if (P === U.enum.rejectDraft) {
|
|
749
|
+
let de = "";
|
|
750
|
+
r.open({
|
|
751
|
+
title: _.title,
|
|
752
|
+
message: _.message,
|
|
753
|
+
primaryActions: _.primaryActions,
|
|
754
|
+
contentComponent: ps,
|
|
755
|
+
contentComponentProps: {
|
|
756
|
+
message: _.message,
|
|
757
|
+
onChange: (ke) => de = ke
|
|
758
|
+
}
|
|
759
|
+
}).onPrimary(() => {
|
|
760
|
+
const ke = [];
|
|
761
|
+
ke.push({
|
|
762
|
+
action: "rejectDraft",
|
|
763
|
+
payload: {
|
|
764
|
+
rejectReason: de
|
|
765
|
+
}
|
|
766
|
+
}), X(D, P, $, le, ke);
|
|
767
|
+
});
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const q = [], Z = hs();
|
|
771
|
+
Z.init(D), (P === U.enum.confirmDraft || P === U.enum.submitRequest) && q.push({
|
|
772
|
+
action: "confirmDraft",
|
|
773
|
+
payload: Z.controller.value.toConfirmDraftData(Ce())
|
|
774
|
+
}), r.open({
|
|
775
|
+
title: _.title,
|
|
776
|
+
message: _.message,
|
|
777
|
+
primaryActions: _.primaryActions
|
|
778
|
+
}).onPrimary(() => {
|
|
779
|
+
X(D, P, $, le, q);
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
async function xe() {
|
|
783
|
+
r.open({
|
|
784
|
+
title: "Upload Transfer",
|
|
785
|
+
primaryActions: {
|
|
786
|
+
text: "Xilnex transfer note",
|
|
787
|
+
close: !0
|
|
788
|
+
},
|
|
789
|
+
secondaryActions: {
|
|
790
|
+
text: "Cancel",
|
|
791
|
+
close: !0
|
|
792
|
+
}
|
|
793
|
+
}).onPrimary(() => {
|
|
794
|
+
const D = {
|
|
795
|
+
show: !0,
|
|
796
|
+
"onUpdate:show"(P) {
|
|
797
|
+
xt.value.show = P;
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
xt.value = D;
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
return {
|
|
804
|
+
purchaseOrders: N,
|
|
805
|
+
shipments: h,
|
|
806
|
+
purchaseRequests: re,
|
|
807
|
+
updateDateRange: ge,
|
|
808
|
+
fetchData: B,
|
|
809
|
+
loading: S,
|
|
810
|
+
transferDialogProps: nt,
|
|
811
|
+
promptCreateTransferDialog: he,
|
|
812
|
+
promptUpdateTransferDialog: pe,
|
|
813
|
+
transferDetailsProps: w,
|
|
814
|
+
promptShowTransferDetails: L,
|
|
815
|
+
resolvePO: R,
|
|
816
|
+
submitAction: fe,
|
|
817
|
+
xilnexImportDialogProps: xt,
|
|
818
|
+
promptUploadTransferDialog: xe,
|
|
819
|
+
emailDialogProps: Ot,
|
|
820
|
+
promptEmailDialog: oe
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function pr(m) {
|
|
824
|
+
var oe, Se, Ae, B, ge, R;
|
|
825
|
+
const { po: t, currentLocation: r, business: n, fulfilling: p, por: u } = m, { name: d, address: s, regNo: a, legalName: S } = r.doc.profile, f = {
|
|
826
|
+
name: d,
|
|
827
|
+
legalName: S,
|
|
828
|
+
registrationNumber: a,
|
|
829
|
+
line1: s == null ? void 0 : s.line1,
|
|
830
|
+
line2: s == null ? void 0 : s.line2,
|
|
831
|
+
postcode: s == null ? void 0 : s.postcode,
|
|
832
|
+
city: s == null ? void 0 : s.city,
|
|
833
|
+
state: s == null ? void 0 : s.state,
|
|
834
|
+
country: s == null ? void 0 : s.country
|
|
835
|
+
}, C = {
|
|
836
|
+
name: t.supplier.name,
|
|
837
|
+
phoneNumber: t.supplier.phoneNumber,
|
|
838
|
+
registrationNumber: t.supplier.registrationNumber,
|
|
839
|
+
line1: (oe = t.supplier.address) == null ? void 0 : oe.line1,
|
|
840
|
+
line2: (Se = t.supplier.address) == null ? void 0 : Se.line2,
|
|
841
|
+
postcode: (Ae = t.supplier.address) == null ? void 0 : Ae.postcode,
|
|
842
|
+
city: (B = t.supplier.address) == null ? void 0 : B.city,
|
|
843
|
+
state: (ge = t.supplier.address) == null ? void 0 : ge.state,
|
|
844
|
+
country: (R = t.supplier.address) == null ? void 0 : R.country
|
|
845
|
+
}, A = cs(t), N = t.items.map((w) => {
|
|
846
|
+
const { sku: j, measurement: L } = w, X = we(
|
|
847
|
+
us(w.sku, t.deliveryOrder || []),
|
|
848
|
+
!1
|
|
849
|
+
), fe = A(w);
|
|
850
|
+
return {
|
|
851
|
+
code: j.code,
|
|
852
|
+
description: j.name,
|
|
853
|
+
quantity: we(w.quantity, !1),
|
|
854
|
+
unit: (L == null ? void 0 : L.abbrev) || j.unit.abbrev,
|
|
855
|
+
received: X,
|
|
856
|
+
cost: fe ? `${fe.currency} ${ze.toFormatString({
|
|
857
|
+
value: fe
|
|
858
|
+
})}` : void 0
|
|
859
|
+
};
|
|
860
|
+
}), h = t.deliveryOrder.map((w) => ({
|
|
861
|
+
createdAt: Nt(new Date(w.createdAt)),
|
|
862
|
+
ref: w.deliveryOrderNumber,
|
|
863
|
+
remark: w.remark || "",
|
|
864
|
+
items: w.received.map((j) => {
|
|
865
|
+
var L;
|
|
866
|
+
return {
|
|
867
|
+
code: j.sku.code,
|
|
868
|
+
description: j.sku.name,
|
|
869
|
+
quantity: we(j.amount),
|
|
870
|
+
unit: ((L = j.measurement) == null ? void 0 : L.abbrev) || j.sku.unit.abbrev
|
|
871
|
+
};
|
|
872
|
+
})
|
|
873
|
+
})), M = [
|
|
874
|
+
// Production
|
|
875
|
+
"67ca5d2c80bd0e001c5bf5bc",
|
|
876
|
+
// Dev
|
|
877
|
+
"6880b36a3054c5001db19218"
|
|
878
|
+
];
|
|
879
|
+
let E = "Inventory Receive Note";
|
|
880
|
+
if (t.supplier.internal ? (E = "Inventory Transfer Note", M.includes((n == null ? void 0 : n._id) || "") && (E = "Stock Request")) : E = "Purchase Order", u) {
|
|
881
|
+
const w = u.from.dbName;
|
|
882
|
+
r.dbName === w || (E = "Inventory Receive Note");
|
|
883
|
+
}
|
|
884
|
+
const J = {
|
|
885
|
+
title: E,
|
|
886
|
+
businessName: n == null ? void 0 : n.name,
|
|
887
|
+
logo: n == null ? void 0 : n.thumbnail,
|
|
888
|
+
orderNumber: t.seqNumber.toString(),
|
|
889
|
+
createdAt: it(t._id),
|
|
890
|
+
ref: t.ref || "",
|
|
891
|
+
remark: t.remark || "",
|
|
892
|
+
buyer: f,
|
|
893
|
+
supplier: C,
|
|
894
|
+
items: N,
|
|
895
|
+
status: t.status,
|
|
896
|
+
deliveryOrders: h
|
|
897
|
+
}, W = new URL(window.location.href), he = p && (t.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
|
|
898
|
+
W.pathname = W.hostname.includes("portal.feedme") ? `/inventory/${he}` : `/${he}`;
|
|
899
|
+
const pe = Ms.compressToEncodedURIComponent(JSON.stringify(J));
|
|
900
|
+
W.searchParams.append("data", pe), window.open(W.href, "_blank", "noreferrer");
|
|
901
|
+
}
|
|
902
|
+
const He = {
|
|
903
|
+
submitRequest: {
|
|
904
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
905
|
+
color: "text-fm-color-typo-primary",
|
|
906
|
+
value: U.enum.submitRequest
|
|
907
|
+
},
|
|
908
|
+
confirmDraft: {
|
|
909
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
910
|
+
color: "text-fm-color-typo-primary",
|
|
911
|
+
value: U.enum.confirmDraft
|
|
912
|
+
},
|
|
913
|
+
cancelDraft: {
|
|
914
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
915
|
+
color: "text-fm-color-typo-error",
|
|
916
|
+
value: U.enum.cancelDraft
|
|
917
|
+
},
|
|
918
|
+
approveRequest: {
|
|
919
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
920
|
+
color: "text-fm-color-typo-primary",
|
|
921
|
+
value: U.enum.approveRequest
|
|
922
|
+
},
|
|
923
|
+
rejectRequest: {
|
|
924
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
925
|
+
color: "text-fm-color-typo-error",
|
|
926
|
+
value: U.enum.rejectRequest
|
|
927
|
+
},
|
|
928
|
+
processRequest: {
|
|
929
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
930
|
+
color: "text-fm-color-typo-primary",
|
|
931
|
+
value: U.enum.processRequest
|
|
932
|
+
},
|
|
933
|
+
receiveStock: {
|
|
934
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
935
|
+
color: "text-fm-color-typo-primary",
|
|
936
|
+
value: U.enum.receiveStock
|
|
937
|
+
},
|
|
938
|
+
completeReceive: {
|
|
939
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
940
|
+
color: "text-fm-color-typo-primary",
|
|
941
|
+
value: U.enum.completeReceive
|
|
942
|
+
},
|
|
943
|
+
closeRequest: {
|
|
944
|
+
translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
|
|
945
|
+
color: "system-error-300",
|
|
946
|
+
value: U.enum.closeRequest
|
|
947
|
+
},
|
|
948
|
+
approveDraft: {
|
|
949
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
|
|
950
|
+
color: "text-fm-color-typo-primary",
|
|
951
|
+
value: U.enum.approveDraft
|
|
952
|
+
},
|
|
953
|
+
rejectDraft: {
|
|
954
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
|
|
955
|
+
color: "text-fm-color-typo-error",
|
|
956
|
+
value: U.enum.rejectDraft
|
|
957
|
+
},
|
|
958
|
+
returnStock: {
|
|
959
|
+
translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
|
|
960
|
+
color: "text-fm-color-typo-primary",
|
|
961
|
+
value: U.enum.returnStock
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
function bs() {
|
|
965
|
+
const m = Ze();
|
|
966
|
+
return {
|
|
967
|
+
ableToMarkReceived(t) {
|
|
968
|
+
if (!t || t.status !== _e.enum.RECEIVING || m.useOperatePurchaseOrderV2) return !1;
|
|
969
|
+
const n = Ke().currentLocationDBName;
|
|
970
|
+
return `${t.supplier.internal}_${t.supplier._id}` !== n;
|
|
971
|
+
},
|
|
972
|
+
ableToMarkApproved(t) {
|
|
973
|
+
return !(!t || (t == null ? void 0 : t.status) !== _e.enum.REQUESTING);
|
|
974
|
+
},
|
|
975
|
+
ableToCreateFulfillment(t, r) {
|
|
976
|
+
var u, d;
|
|
977
|
+
if (!m.acceptRequireFulfillment || !t || !r || t.status !== _e.enum.PROCESSING || !r.processedAt)
|
|
978
|
+
return !1;
|
|
979
|
+
const n = (u = r == null ? void 0 : r.from) == null ? void 0 : u.dbName, p = (d = r == null ? void 0 : r.to) == null ? void 0 : d.dbName;
|
|
980
|
+
return !(n.startsWith("restaurant_") && p.startsWith("restaurant_"));
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
function gs() {
|
|
985
|
+
const m = H(() => [
|
|
986
|
+
{
|
|
987
|
+
action: Wt.Action.manage,
|
|
988
|
+
subject: Wt.Subject.Business.inventory_orderDraftApproval
|
|
989
|
+
}
|
|
990
|
+
]), { hasPermission: t } = ar(m);
|
|
991
|
+
return {
|
|
992
|
+
hasOrderDraftPermission: Cs(t)
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function gi(m, t, r, n) {
|
|
996
|
+
const p = Ke(), u = _t(), d = bt(), s = bs(), { t: a } = ht(), S = Je(), { hasOrderDraftPermission: f } = gs(), C = Ze(), A = H(
|
|
997
|
+
() => C.enablePrintTemplate ? [Ee[De.PrintCustom]] : []
|
|
998
|
+
), N = H(
|
|
999
|
+
() => C.enablePurchaseOrderEmail ? [Ee[De.Email]] : []
|
|
1000
|
+
);
|
|
1001
|
+
function h(B) {
|
|
1002
|
+
const ge = M(B), R = n == null ? void 0 : n.excludeRowActions;
|
|
1003
|
+
return R != null && R.length ? ge.filter(
|
|
1004
|
+
(w) => !R.includes(w.value)
|
|
1005
|
+
) : ge;
|
|
1006
|
+
}
|
|
1007
|
+
function M(B) {
|
|
1008
|
+
switch (B.status) {
|
|
1009
|
+
case "DRAFT":
|
|
1010
|
+
return [
|
|
1011
|
+
Ee[De.Update],
|
|
1012
|
+
Ee[De.Details],
|
|
1013
|
+
B.supplier.internal === "restaurant" || B.supplier.internal === "warehouse" ? He[U.enum.submitRequest] : He[U.enum.confirmDraft],
|
|
1014
|
+
He[U.enum.cancelDraft]
|
|
1015
|
+
];
|
|
1016
|
+
case "RECEIVING":
|
|
1017
|
+
return [
|
|
1018
|
+
...s.ableToMarkReceived(B) ? [He[U.enum.completeReceive]] : [],
|
|
1019
|
+
Ee[De.Details],
|
|
1020
|
+
Ee[De.Print],
|
|
1021
|
+
...A.value,
|
|
1022
|
+
...N.value
|
|
1023
|
+
];
|
|
1024
|
+
case "PENDING_APPROVAL": {
|
|
1025
|
+
const R = [Ee[De.Details]];
|
|
1026
|
+
return f.value && R.push(
|
|
1027
|
+
Ee[De.Update],
|
|
1028
|
+
He[U.enum.approveDraft],
|
|
1029
|
+
He[U.enum.rejectDraft]
|
|
1030
|
+
), R;
|
|
1031
|
+
}
|
|
1032
|
+
case "REQUESTING":
|
|
1033
|
+
return m === "receive/request" ? [
|
|
1034
|
+
Ee[De.Details],
|
|
1035
|
+
Ee[De.Print],
|
|
1036
|
+
...A.value
|
|
1037
|
+
] : [
|
|
1038
|
+
He[U.enum.approveRequest],
|
|
1039
|
+
He[U.enum.rejectRequest],
|
|
1040
|
+
Ee[De.Details]
|
|
1041
|
+
// DefaultRowActions[RowActionEnum.Print]
|
|
1042
|
+
];
|
|
1043
|
+
case "PROCESSING":
|
|
1044
|
+
return [
|
|
1045
|
+
Ee[De.Details],
|
|
1046
|
+
Ee[De.Print],
|
|
1047
|
+
...A.value
|
|
1048
|
+
];
|
|
1049
|
+
case "COMPLETE":
|
|
1050
|
+
case "CANCEL":
|
|
1051
|
+
default:
|
|
1052
|
+
return [
|
|
1053
|
+
Ee[De.Details],
|
|
1054
|
+
Ee[De.Print],
|
|
1055
|
+
...A.value
|
|
1056
|
+
];
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
function E(B) {
|
|
1060
|
+
return Object.values(U.enum).includes(B);
|
|
1061
|
+
}
|
|
1062
|
+
async function re(B, ge, R) {
|
|
1063
|
+
var L, X, fe, xe, D, P, le, ce, $;
|
|
1064
|
+
let w;
|
|
1065
|
+
try {
|
|
1066
|
+
w = t.resolvePO ? await t.resolvePO(ge) : ge;
|
|
1067
|
+
} catch (_) {
|
|
1068
|
+
console.error("Failed to load full purchase order for action", _), S.open({
|
|
1069
|
+
title: a("inventory.common.somethingWentWrong"),
|
|
1070
|
+
message: (_ == null ? void 0 : _.message) || a("inventory.common.tryAgain"),
|
|
1071
|
+
type: "error"
|
|
1072
|
+
});
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
const j = wt(w);
|
|
1076
|
+
if (!(n != null && n.onCustomAction && await n.onCustomAction(B, j))) {
|
|
1077
|
+
if (B === De.Print || B === De.PrintCustom) {
|
|
1078
|
+
let _ = j;
|
|
1079
|
+
if (_.items == null && (n != null && n.fetchFullPo)) {
|
|
1080
|
+
const o = await n.fetchFullPo(j);
|
|
1081
|
+
if (o == null) return;
|
|
1082
|
+
_ = wt(o);
|
|
1083
|
+
}
|
|
1084
|
+
const q = (L = n == null ? void 0 : n.resolveLocation) == null ? void 0 : L.call(n, j), de = { ...(R == null ? void 0 : R.toInventoryLocation) ?? q ?? p.currentLocation };
|
|
1085
|
+
if (de.type === "restaurant") {
|
|
1086
|
+
const o = p.locationRestaurantFromCore(de.doc._id);
|
|
1087
|
+
o !== null && (de.doc = o);
|
|
1088
|
+
}
|
|
1089
|
+
((X = R == null ? void 0 : R.netSuite) != null && X.refNo || (fe = _.netSuite) != null && fe.refNo) && (_.ref = [((xe = R == null ? void 0 : R.netSuite) == null ? void 0 : xe.refNo) || ((D = _.netSuite) == null ? void 0 : D.refNo)].filter((o) => o).join(" "));
|
|
1090
|
+
const ke = R ?? ((P = n == null ? void 0 : n.resolvePurchaseRequest) == null ? void 0 : P.call(n, j)), Re = {
|
|
1091
|
+
po: _,
|
|
1092
|
+
currentLocation: de,
|
|
1093
|
+
business: d.currentBusiness.value,
|
|
1094
|
+
fulfilling: m === "approval",
|
|
1095
|
+
por: ke
|
|
1096
|
+
};
|
|
1097
|
+
if (B === De.PrintCustom) {
|
|
1098
|
+
const o = ds(Re);
|
|
1099
|
+
o && (oe.value = o.html, Se.value = o.templateName, Ae.value = o.isDefault, pe.value = !0);
|
|
1100
|
+
} else
|
|
1101
|
+
pr(Re);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
if (B === De.Details) {
|
|
1105
|
+
t.promptShowTransferDetails(j, R);
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
if (B === De.Update) {
|
|
1109
|
+
(le = t.promptUpdateTransferDialog) == null || le.call(t, j);
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
if (B === De.Email) {
|
|
1113
|
+
(ce = t.promptEmailDialog) == null || ce.call(t, j);
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
if (E(B)) {
|
|
1117
|
+
t.submitAction(w, B, ($ = R == null ? void 0 : R.to) == null ? void 0 : $.dbName);
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
function J() {
|
|
1123
|
+
var ge;
|
|
1124
|
+
const B = [
|
|
1125
|
+
{
|
|
1126
|
+
accessorKey: "seqNumber",
|
|
1127
|
+
header: () => a("inventory.transfer.table.seqNo"),
|
|
1128
|
+
enableSorting: !0,
|
|
1129
|
+
size: 80,
|
|
1130
|
+
sortUndefined: "last"
|
|
1131
|
+
},
|
|
1132
|
+
{
|
|
1133
|
+
accessorKey: "_id",
|
|
1134
|
+
header: () => a("inventory.transfer.table.createdAt"),
|
|
1135
|
+
cell(R) {
|
|
1136
|
+
return it(`${R.getValue()}`);
|
|
1137
|
+
},
|
|
1138
|
+
enableSorting: !0
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
accessorKey: "supplier.name",
|
|
1142
|
+
header: () => a("inventory.transfer.table.transferFrom"),
|
|
1143
|
+
enableSorting: !0,
|
|
1144
|
+
size: 200
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
// Bulk-view summary rows carry itemCount instead of the items array
|
|
1148
|
+
id: "noOfItems",
|
|
1149
|
+
accessorFn: (R) => {
|
|
1150
|
+
var w;
|
|
1151
|
+
return R.itemCount ?? ((w = R.items) == null ? void 0 : w.length) ?? 0;
|
|
1152
|
+
},
|
|
1153
|
+
header: () => a("inventory.transfer.table.noOfItems"),
|
|
1154
|
+
cell: (R) => {
|
|
1155
|
+
const w = R.row.original.version || "1", j = R.getValue();
|
|
1156
|
+
return ee("div", { class: "flex items-center gap-2" }, [
|
|
1157
|
+
j,
|
|
1158
|
+
w !== "1" ? ee(
|
|
1159
|
+
"div",
|
|
1160
|
+
{ class: "py-3" },
|
|
1161
|
+
ee(
|
|
1162
|
+
st,
|
|
1163
|
+
{},
|
|
1164
|
+
() => ee(
|
|
1165
|
+
"div",
|
|
1166
|
+
{
|
|
1167
|
+
class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
|
|
1168
|
+
},
|
|
1169
|
+
`v${w}`
|
|
1170
|
+
)
|
|
1171
|
+
)
|
|
1172
|
+
) : null
|
|
1173
|
+
]);
|
|
1174
|
+
},
|
|
1175
|
+
enableSorting: !1,
|
|
1176
|
+
meta: {
|
|
1177
|
+
width: "10rem"
|
|
1178
|
+
}
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
accessorKey: "ref",
|
|
1182
|
+
header: () => a("inventory.transfer.table.reference"),
|
|
1183
|
+
enableSorting: !1,
|
|
1184
|
+
size: "auto"
|
|
1185
|
+
},
|
|
1186
|
+
...(ge = d.sessionUser.value) != null && ge.role.isAdmin ? [
|
|
1187
|
+
{
|
|
1188
|
+
id: "statusForAdmin",
|
|
1189
|
+
header: () => ee(st, {}, () => `${a("inventory.transfer.table.status")}`),
|
|
1190
|
+
cell(R) {
|
|
1191
|
+
return R.row.original.status;
|
|
1192
|
+
},
|
|
1193
|
+
enableSorting: !0,
|
|
1194
|
+
size: 200
|
|
1195
|
+
}
|
|
1196
|
+
] : [],
|
|
1197
|
+
{
|
|
1198
|
+
accessorKey: "status",
|
|
1199
|
+
header: () => a("inventory.transfer.table.status"),
|
|
1200
|
+
cell(R) {
|
|
1201
|
+
const w = R.getValue(), j = R.row.original, { partial: L, over: X } = j.items == null ? { partial: !!j.partialReceived, over: !!j.overReceived } : $t(vt(j)), fe = Ct(w ?? "", L, X);
|
|
1202
|
+
let xe = a(`inventory.transfer.status.${fe}`), D = `${w ?? ""}`.toLocaleLowerCase("en-us");
|
|
1203
|
+
fe === _e.enum.CLOSE && (xe = `${a(`inventory.transfer.status.${_e.enum.COMPLETE}`)}`), fe === "PARTIAL_RECEIVED" && D === _e.enum.PROCESSING.toLocaleLowerCase("en-us") && (D = _e.enum.RECEIVING.toLocaleLowerCase("en-us"));
|
|
1204
|
+
let P = null;
|
|
1205
|
+
const le = r.value.find((ce) => ce.ref === R.row.original._id);
|
|
1206
|
+
if (le != null && le.milestones && le.milestones.length > 0) {
|
|
1207
|
+
const ce = le.milestones[le.milestones.length - 1];
|
|
1208
|
+
if (ce.estimatedTime) {
|
|
1209
|
+
const $ = new Date(ce.estimatedTime), _ = $.getDate().toString().padStart(2, "0");
|
|
1210
|
+
P = `${$.toLocaleString("en-US", { month: "short" })} ${_}`;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
return ee(
|
|
1214
|
+
"div",
|
|
1215
|
+
{
|
|
1216
|
+
class: "flex"
|
|
1217
|
+
},
|
|
1218
|
+
[
|
|
1219
|
+
ee(
|
|
1220
|
+
"div",
|
|
1221
|
+
{ class: "flex items-center" },
|
|
1222
|
+
ee(
|
|
1223
|
+
"div",
|
|
1224
|
+
{
|
|
1225
|
+
class: [
|
|
1226
|
+
"fm-status-badge",
|
|
1227
|
+
`fm-status-badge-${D}`,
|
|
1228
|
+
X && "fm-status-badge-error"
|
|
1229
|
+
].filter(Boolean).join(" ")
|
|
1230
|
+
},
|
|
1231
|
+
`${xe}`
|
|
1232
|
+
)
|
|
1233
|
+
),
|
|
1234
|
+
...P ? [
|
|
1235
|
+
ee(
|
|
1236
|
+
"div",
|
|
1237
|
+
{
|
|
1238
|
+
class: "flex items-center gap-1 ml-2"
|
|
1239
|
+
},
|
|
1240
|
+
[
|
|
1241
|
+
ee(pt.FmIcon, {
|
|
1242
|
+
name: "local_shipping",
|
|
1243
|
+
size: "md",
|
|
1244
|
+
color: "neutral-gray-400"
|
|
1245
|
+
}),
|
|
1246
|
+
ee(
|
|
1247
|
+
"span",
|
|
1248
|
+
{ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" },
|
|
1249
|
+
P
|
|
1250
|
+
)
|
|
1251
|
+
]
|
|
1252
|
+
)
|
|
1253
|
+
] : []
|
|
1254
|
+
]
|
|
1255
|
+
);
|
|
1256
|
+
},
|
|
1257
|
+
enableSorting: !0,
|
|
1258
|
+
size: 150
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
id: "action",
|
|
1262
|
+
cell(R) {
|
|
1263
|
+
var L;
|
|
1264
|
+
const w = R.row.original, j = [
|
|
1265
|
+
...h(w),
|
|
1266
|
+
...((L = n == null ? void 0 : n.appendRowActions) == null ? void 0 : L.call(n, w)) ?? []
|
|
1267
|
+
];
|
|
1268
|
+
return Ht(j, (X) => re(X, w));
|
|
1269
|
+
},
|
|
1270
|
+
enableSorting: !1,
|
|
1271
|
+
size: 40,
|
|
1272
|
+
meta: {
|
|
1273
|
+
cellClass: "",
|
|
1274
|
+
headerClass: ""
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
];
|
|
1278
|
+
if (u.isEnabled) {
|
|
1279
|
+
const R = [
|
|
1280
|
+
{
|
|
1281
|
+
id: "netsuiteTransferOrder",
|
|
1282
|
+
accessorFn: (w) => {
|
|
1283
|
+
var j;
|
|
1284
|
+
return (j = w.netSuite) != null && j.id ? `${w.netSuite.refNo} (${w.netSuite.id})` : "N/A";
|
|
1285
|
+
},
|
|
1286
|
+
header: () => "NetSuite Order (ID)",
|
|
1287
|
+
cell(w) {
|
|
1288
|
+
var L;
|
|
1289
|
+
const j = w.row.original;
|
|
1290
|
+
return (L = j.netSuite) != null && L.id ? `${j.netSuite.refNo} (${j.netSuite.id})` : "N/A";
|
|
1291
|
+
},
|
|
1292
|
+
enableSorting: !1,
|
|
1293
|
+
size: 200,
|
|
1294
|
+
meta: {
|
|
1295
|
+
cellClass: "",
|
|
1296
|
+
headerClass: ""
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
id: "netsuiteTransactionNumber",
|
|
1301
|
+
accessorFn: (w) => {
|
|
1302
|
+
var j, L;
|
|
1303
|
+
return ((L = (j = w.netSuite) == null ? void 0 : j.additionalInfo) == null ? void 0 : L.transactionnumber) ?? "N/A";
|
|
1304
|
+
},
|
|
1305
|
+
header: () => "NetSuite Transaction No.",
|
|
1306
|
+
cell(w) {
|
|
1307
|
+
var L, X;
|
|
1308
|
+
return ((X = (L = w.row.original.netSuite) == null ? void 0 : L.additionalInfo) == null ? void 0 : X.transactionnumber) ?? "N/A";
|
|
1309
|
+
},
|
|
1310
|
+
enableSorting: !1,
|
|
1311
|
+
size: 200,
|
|
1312
|
+
meta: {
|
|
1313
|
+
cellClass: "",
|
|
1314
|
+
headerClass: ""
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
];
|
|
1318
|
+
B.splice(B.length - 1, 0, ...R);
|
|
1319
|
+
}
|
|
1320
|
+
return B;
|
|
1321
|
+
}
|
|
1322
|
+
function W() {
|
|
1323
|
+
var ge;
|
|
1324
|
+
const B = [
|
|
1325
|
+
{
|
|
1326
|
+
accessorKey: "purchaseOrder.seqNumber",
|
|
1327
|
+
header: () => a("inventory.transfer.table.seqNo"),
|
|
1328
|
+
enableSorting: !0,
|
|
1329
|
+
size: 80,
|
|
1330
|
+
sortUndefined: "last"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
accessorKey: "purchaseOrder._id",
|
|
1334
|
+
header: () => a("inventory.transfer.table.createdAt"),
|
|
1335
|
+
cell(R) {
|
|
1336
|
+
return it(`${R.getValue()}`);
|
|
1337
|
+
},
|
|
1338
|
+
enableSorting: !0
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
accessorKey: "to.name",
|
|
1342
|
+
header: () => a("inventory.transfer.table.transferTo"),
|
|
1343
|
+
enableSorting: !1,
|
|
1344
|
+
size: 200
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
accessorKey: "purchaseOrder.items.length",
|
|
1348
|
+
header: () => a("inventory.transfer.table.noOfItems"),
|
|
1349
|
+
enableSorting: !1
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
accessorKey: "purchaseOrder.ref",
|
|
1353
|
+
header: () => a("inventory.transfer.table.reference"),
|
|
1354
|
+
enableSorting: !1,
|
|
1355
|
+
size: "auto"
|
|
1356
|
+
},
|
|
1357
|
+
...(ge = d.sessionUser.value) != null && ge.role.isAdmin ? [
|
|
1358
|
+
{
|
|
1359
|
+
id: "statusForAdmin",
|
|
1360
|
+
header: () => ee(st, {}, () => `${a("inventory.transfer.table.status")}`),
|
|
1361
|
+
cell(R) {
|
|
1362
|
+
return R.row.original.status;
|
|
1363
|
+
},
|
|
1364
|
+
enableSorting: !0,
|
|
1365
|
+
size: 200
|
|
1366
|
+
}
|
|
1367
|
+
] : [],
|
|
1368
|
+
{
|
|
1369
|
+
accessorKey: "purchaseOrder.status",
|
|
1370
|
+
header: () => a("inventory.transfer.table.status"),
|
|
1371
|
+
cell(R) {
|
|
1372
|
+
const w = R.row.original, j = R.getValue();
|
|
1373
|
+
if (!w.purchaseOrder)
|
|
1374
|
+
return ee(pt.FmChip, {
|
|
1375
|
+
label: "N/A",
|
|
1376
|
+
compact: !0
|
|
1377
|
+
});
|
|
1378
|
+
const L = vt(w.purchaseOrder), { partial: X, over: fe } = $t(L), xe = Ct(j ?? "", X, fe);
|
|
1379
|
+
let D = a(`inventory.transfer.status.${xe}`), P = `${j ?? ""}`.toLocaleLowerCase("en-us");
|
|
1380
|
+
return xe === _e.enum.CLOSE && (D = `${a(`inventory.transfer.status.${_e.enum.COMPLETE}`)}`), xe === "PARTIAL_RECEIVED" && P === _e.enum.PROCESSING.toLocaleLowerCase("en-us") && (P = _e.enum.RECEIVING.toLocaleLowerCase("en-us")), w.rejectedAt && (D = a("inventory.transfer.status.REJECT"), P = _e.enum.REJECT.toLocaleLowerCase("en-us")), ee(
|
|
1381
|
+
"div",
|
|
1382
|
+
{
|
|
1383
|
+
class: "flex"
|
|
1384
|
+
},
|
|
1385
|
+
ee(
|
|
1386
|
+
"div",
|
|
1387
|
+
{
|
|
1388
|
+
class: [
|
|
1389
|
+
"fm-status-badge",
|
|
1390
|
+
`fm-status-badge-${P}`,
|
|
1391
|
+
fe && "fm-status-badge-error"
|
|
1392
|
+
].filter(Boolean).join(" ")
|
|
1393
|
+
},
|
|
1394
|
+
`${D}`
|
|
1395
|
+
)
|
|
1396
|
+
);
|
|
1397
|
+
},
|
|
1398
|
+
enableSorting: !0
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
id: "action",
|
|
1402
|
+
cell(R) {
|
|
1403
|
+
const w = R.row.original, L = (w.purchaseOrder ? h(w.purchaseOrder) : []).map((X) => X.value === De.Print ? {
|
|
1404
|
+
...X,
|
|
1405
|
+
translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
|
|
1406
|
+
} : X);
|
|
1407
|
+
return Ht(
|
|
1408
|
+
L,
|
|
1409
|
+
(X) => w.purchaseOrder ? re(X, w.purchaseOrder, w) : void 0
|
|
1410
|
+
);
|
|
1411
|
+
},
|
|
1412
|
+
enableSorting: !1,
|
|
1413
|
+
size: 40,
|
|
1414
|
+
meta: {
|
|
1415
|
+
cellClass: "",
|
|
1416
|
+
headerClass: ""
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
];
|
|
1420
|
+
if (u.isEnabled) {
|
|
1421
|
+
const R = [
|
|
1422
|
+
{
|
|
1423
|
+
id: "netsuiteTransferOrder",
|
|
1424
|
+
accessorFn: (w) => {
|
|
1425
|
+
var j;
|
|
1426
|
+
return (j = w.netSuite) != null && j.id ? `${w.netSuite.refNo} (${w.netSuite.id})` : "N/A";
|
|
1427
|
+
},
|
|
1428
|
+
header: () => "NetSuite Order (ID)",
|
|
1429
|
+
cell(w) {
|
|
1430
|
+
var L;
|
|
1431
|
+
const j = w.row.original;
|
|
1432
|
+
return (L = j.netSuite) != null && L.id ? `${j.netSuite.refNo} (${j.netSuite.id})` : "N/A";
|
|
1433
|
+
},
|
|
1434
|
+
enableSorting: !1,
|
|
1435
|
+
size: 200,
|
|
1436
|
+
meta: {
|
|
1437
|
+
cellClass: "",
|
|
1438
|
+
headerClass: ""
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
id: "netsuiteTransactionNumber",
|
|
1443
|
+
accessorFn: (w) => {
|
|
1444
|
+
var j, L;
|
|
1445
|
+
return ((L = (j = w.netSuite) == null ? void 0 : j.additionalInfo) == null ? void 0 : L.transactionnumber) ?? "N/A";
|
|
1446
|
+
},
|
|
1447
|
+
header: () => "NetSuite Transaction No.",
|
|
1448
|
+
cell(w) {
|
|
1449
|
+
var L, X;
|
|
1450
|
+
return ((X = (L = w.row.original.netSuite) == null ? void 0 : L.additionalInfo) == null ? void 0 : X.transactionnumber) ?? "N/A";
|
|
1451
|
+
},
|
|
1452
|
+
enableSorting: !1,
|
|
1453
|
+
size: 200,
|
|
1454
|
+
meta: {
|
|
1455
|
+
cellClass: "",
|
|
1456
|
+
headerClass: ""
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
];
|
|
1460
|
+
B.splice(B.length - 2, 0, ...R);
|
|
1461
|
+
}
|
|
1462
|
+
return B;
|
|
1463
|
+
}
|
|
1464
|
+
const he = H(() => m === "receive/request" ? J() : W()), pe = se(!1), oe = se(""), Se = se(""), Ae = se(!1);
|
|
1465
|
+
return {
|
|
1466
|
+
columnDefs: he,
|
|
1467
|
+
showCustomPrintDialog: pe,
|
|
1468
|
+
customPrintHtml: oe,
|
|
1469
|
+
customPrintTemplateName: Se,
|
|
1470
|
+
customPrintIsDefault: Ae
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
const fr = { class: "flex flex-col gap-4 border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, vr = { class: "flex items-center justify-between" }, yr = {
|
|
1474
|
+
key: 0,
|
|
1475
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary"
|
|
1476
|
+
}, hr = { class: "flex justify-between items-start py-1 gap-4" }, br = { class: "flex-1 min-w-0 flex flex-col gap-2" }, gr = { class: "flex flex-col gap-2 items-end w-52 shrink-0" }, _r = {
|
|
1477
|
+
key: 0,
|
|
1478
|
+
class: "border-b border-fm-color-stroke-secondary"
|
|
1479
|
+
}, Ft = /* @__PURE__ */ qe({
|
|
1480
|
+
__name: "PriceAdjustmentEditor",
|
|
1481
|
+
props: {
|
|
1482
|
+
controller: {},
|
|
1483
|
+
state: {}
|
|
1484
|
+
},
|
|
1485
|
+
setup(m) {
|
|
1486
|
+
const t = m, r = H(() => t.state.adjustments ?? []);
|
|
1487
|
+
function n(a) {
|
|
1488
|
+
return +we(a.dinero);
|
|
1489
|
+
}
|
|
1490
|
+
function p() {
|
|
1491
|
+
t.controller.addAdjustment();
|
|
1492
|
+
}
|
|
1493
|
+
function u(a, S) {
|
|
1494
|
+
t.controller.updateAdjustment(a, S);
|
|
1495
|
+
}
|
|
1496
|
+
function d(a, S) {
|
|
1497
|
+
t.controller.updateAdjustment(a, null, S);
|
|
1498
|
+
}
|
|
1499
|
+
function s(a) {
|
|
1500
|
+
t.controller.removeAdjustment(a);
|
|
1501
|
+
}
|
|
1502
|
+
return (a, S) => {
|
|
1503
|
+
const f = te("FmButton"), C = te("FmTextField"), A = te("FmStepperField");
|
|
1504
|
+
return i(), y("div", fr, [
|
|
1505
|
+
e("div", vr, [
|
|
1506
|
+
S[0] || (S[0] = e("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-secondary" }, "Price adjustments", -1)),
|
|
1507
|
+
T(f, {
|
|
1508
|
+
variant: "tertiary",
|
|
1509
|
+
label: "Add adjustment",
|
|
1510
|
+
"prepend-icon": "add",
|
|
1511
|
+
size: "md",
|
|
1512
|
+
onClick: p
|
|
1513
|
+
})
|
|
1514
|
+
]),
|
|
1515
|
+
r.value.length === 0 ? (i(), y("div", yr, " No price adjustments ")) : V("", !0),
|
|
1516
|
+
(i(!0), y($e, null, Ie(r.value, (N, h) => (i(), y("div", {
|
|
1517
|
+
key: N.id
|
|
1518
|
+
}, [
|
|
1519
|
+
e("div", hr, [
|
|
1520
|
+
e("div", br, [
|
|
1521
|
+
T(C, {
|
|
1522
|
+
"model-value": N.name,
|
|
1523
|
+
"onUpdate:modelValue": (M) => u(N.id, M),
|
|
1524
|
+
label: "Name",
|
|
1525
|
+
placeholder: "e.g. Freight, Discount",
|
|
1526
|
+
size: "md"
|
|
1527
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
1528
|
+
]),
|
|
1529
|
+
e("div", gr, [
|
|
1530
|
+
T(A, {
|
|
1531
|
+
"model-value": n(N),
|
|
1532
|
+
"onUpdate:modelValue": (M) => d(N.id, M),
|
|
1533
|
+
label: "Amount (+/-)",
|
|
1534
|
+
step: 0.01,
|
|
1535
|
+
placeholder: "0.00",
|
|
1536
|
+
size: "md",
|
|
1537
|
+
"append-text": v(Ce)()
|
|
1538
|
+
}, null, 8, ["model-value", "onUpdate:modelValue", "append-text"])
|
|
1539
|
+
]),
|
|
1540
|
+
T(f, {
|
|
1541
|
+
variant: "tertiary",
|
|
1542
|
+
"prepend-icon": "delete",
|
|
1543
|
+
size: "md",
|
|
1544
|
+
class: "mt-6",
|
|
1545
|
+
onClick: (M) => s(N.id)
|
|
1546
|
+
}, null, 8, ["onClick"])
|
|
1547
|
+
]),
|
|
1548
|
+
h < r.value.length - 1 ? (i(), y("div", _r)) : V("", !0)
|
|
1549
|
+
]))), 128))
|
|
1550
|
+
]);
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
function It(m) {
|
|
1555
|
+
const t = dt(
|
|
1556
|
+
Qt({
|
|
1557
|
+
currency: m.currency,
|
|
1558
|
+
adjustments: m.adjustments ?? []
|
|
1559
|
+
})
|
|
1560
|
+
), r = dt(t.value.state());
|
|
1561
|
+
function n(d) {
|
|
1562
|
+
const s = () => {
|
|
1563
|
+
r.value = d.state();
|
|
1564
|
+
};
|
|
1565
|
+
return d.addListener(s), () => d.removeListener(s);
|
|
1566
|
+
}
|
|
1567
|
+
let p = n(t.value);
|
|
1568
|
+
function u(d) {
|
|
1569
|
+
p(), t.value = Qt({
|
|
1570
|
+
currency: m.currency,
|
|
1571
|
+
adjustments: d ?? []
|
|
1572
|
+
}), p = n(t.value), r.value = t.value.state();
|
|
1573
|
+
}
|
|
1574
|
+
return rs(() => p()), { controller: t, state: r, reset: u };
|
|
1575
|
+
}
|
|
1576
|
+
const Sr = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, kr = { class: "flex flex-col gap-8" }, Or = { class: "flex w-full justify-end gap-16" }, xr = /* @__PURE__ */ qe({
|
|
1577
|
+
__name: "FulfillmentForm",
|
|
1578
|
+
props: {
|
|
1579
|
+
purchaseOrder: {},
|
|
1580
|
+
confirm: { type: Function }
|
|
1581
|
+
},
|
|
1582
|
+
emits: ["update:show"],
|
|
1583
|
+
setup(m, { emit: t }) {
|
|
1584
|
+
const r = m, n = As({
|
|
1585
|
+
id: "",
|
|
1586
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1587
|
+
items: []
|
|
1588
|
+
}), p = se(), u = t, d = (a) => a != null && a !== "";
|
|
1589
|
+
os(() => {
|
|
1590
|
+
r.purchaseOrder && (n.items = r.purchaseOrder.items.map((a) => ({
|
|
1591
|
+
id: a.id,
|
|
1592
|
+
sku: a.sku,
|
|
1593
|
+
measurement: a.measurement,
|
|
1594
|
+
amount: a.quantity ?? { amount: 1, precision: 0 }
|
|
1595
|
+
})));
|
|
1596
|
+
});
|
|
1597
|
+
const s = H(() => n.items.length <= 10);
|
|
1598
|
+
return (a, S) => {
|
|
1599
|
+
const f = te("FmTable"), C = te("FmButton"), A = te("FmForm");
|
|
1600
|
+
return i(), ye(A, {
|
|
1601
|
+
ref_key: "formRef",
|
|
1602
|
+
ref: p,
|
|
1603
|
+
class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
|
|
1604
|
+
onValidationFailed: console.log,
|
|
1605
|
+
onValidationSuccess: S[1] || (S[1] = () => r.confirm(n))
|
|
1606
|
+
}, {
|
|
1607
|
+
default: ie(() => [
|
|
1608
|
+
S[2] || (S[2] = e("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
|
|
1609
|
+
e("div", Sr, [
|
|
1610
|
+
e("div", kr, [
|
|
1611
|
+
T(f, {
|
|
1612
|
+
"column-defs": [
|
|
1613
|
+
{
|
|
1614
|
+
header: "Code",
|
|
1615
|
+
cell: (N) => {
|
|
1616
|
+
const h = r.purchaseOrder.items.find((M) => d(N.row.original.id) ? M.id === N.row.original.id : M.sku._id === N.row.original.sku._id);
|
|
1617
|
+
return ee(
|
|
1618
|
+
v(pt).FmTooltip,
|
|
1619
|
+
{
|
|
1620
|
+
content: h.code,
|
|
1621
|
+
placement: "top",
|
|
1622
|
+
variant: "plain",
|
|
1623
|
+
zIndex: 50
|
|
1624
|
+
},
|
|
1625
|
+
ee(
|
|
1626
|
+
"span",
|
|
1627
|
+
{
|
|
1628
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
1629
|
+
},
|
|
1630
|
+
h.code
|
|
1631
|
+
)
|
|
1632
|
+
);
|
|
1633
|
+
}
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
header: "Name",
|
|
1637
|
+
cell: (N) => {
|
|
1638
|
+
const h = r.purchaseOrder.items.find((M) => d(N.row.original.id) ? M.id === N.row.original.id : M.sku._id === N.row.original.sku._id);
|
|
1639
|
+
return ee(
|
|
1640
|
+
v(pt).FmTooltip,
|
|
1641
|
+
{
|
|
1642
|
+
content: h.name,
|
|
1643
|
+
placement: "top",
|
|
1644
|
+
variant: "plain",
|
|
1645
|
+
zIndex: 50
|
|
1646
|
+
},
|
|
1647
|
+
ee(
|
|
1648
|
+
"span",
|
|
1649
|
+
{
|
|
1650
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
1651
|
+
},
|
|
1652
|
+
h.name
|
|
1653
|
+
)
|
|
1654
|
+
);
|
|
1655
|
+
}
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
header: "Amount",
|
|
1659
|
+
cell: (N) => {
|
|
1660
|
+
const h = N.row.original, M = r.purchaseOrder.items.find((re) => d(h.id) ? re.id === h.id : re.sku._id === h.sku._id), E = h.amount ?? {
|
|
1661
|
+
amount: 1,
|
|
1662
|
+
precision: 0
|
|
1663
|
+
};
|
|
1664
|
+
return ee(Gs, {
|
|
1665
|
+
style: {
|
|
1666
|
+
flex: "1 1 0%"
|
|
1667
|
+
},
|
|
1668
|
+
modelValue: {
|
|
1669
|
+
amount: E,
|
|
1670
|
+
measurement: h.measurement ?? null
|
|
1671
|
+
},
|
|
1672
|
+
key: d(h.id) ? h.id : h.sku._id,
|
|
1673
|
+
unit: h.sku.unit,
|
|
1674
|
+
"onUpdate:modelValue": (re) => {
|
|
1675
|
+
if (!re) return;
|
|
1676
|
+
const J = n.items.find((W) => d(h.id) ? W.id === h.id : W.sku._id === h.sku._id);
|
|
1677
|
+
J && (J.amount = re.amount);
|
|
1678
|
+
},
|
|
1679
|
+
disableUnit: !0,
|
|
1680
|
+
rules: [
|
|
1681
|
+
v(Ws)(
|
|
1682
|
+
+v(we)({ amount: 0, precision: 0 })
|
|
1683
|
+
),
|
|
1684
|
+
v(Qs)(+v(we)(M.quantity))
|
|
1685
|
+
],
|
|
1686
|
+
applyDefaultRules: !0
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
],
|
|
1691
|
+
"row-data": n.items,
|
|
1692
|
+
"hide-footer": s.value
|
|
1693
|
+
}, null, 8, ["column-defs", "row-data", "hide-footer"])
|
|
1694
|
+
])
|
|
1695
|
+
]),
|
|
1696
|
+
e("div", Or, [
|
|
1697
|
+
T(C, {
|
|
1698
|
+
class: "px-16",
|
|
1699
|
+
label: "Confirm",
|
|
1700
|
+
size: "md",
|
|
1701
|
+
variant: "primary",
|
|
1702
|
+
type: "submit"
|
|
1703
|
+
}),
|
|
1704
|
+
T(C, {
|
|
1705
|
+
class: "px-16",
|
|
1706
|
+
label: "Cancel",
|
|
1707
|
+
size: "md",
|
|
1708
|
+
variant: "secondary",
|
|
1709
|
+
onClick: S[0] || (S[0] = () => u("update:show", !1))
|
|
1710
|
+
})
|
|
1711
|
+
])
|
|
1712
|
+
]),
|
|
1713
|
+
_: 1
|
|
1714
|
+
}, 8, ["onValidationFailed"]);
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
}), at = {
|
|
1718
|
+
submitRequest: {
|
|
1719
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
1720
|
+
color: "primary",
|
|
1721
|
+
buttonVariant: Ue.Primary
|
|
1722
|
+
},
|
|
1723
|
+
confirmDraft: {
|
|
1724
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
1725
|
+
color: "primary",
|
|
1726
|
+
buttonVariant: Ue.Primary
|
|
1727
|
+
},
|
|
1728
|
+
cancelDraft: {
|
|
1729
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
1730
|
+
color: "system-error-300",
|
|
1731
|
+
buttonVariant: Ue.Destructive
|
|
1732
|
+
},
|
|
1733
|
+
approveDraft: {
|
|
1734
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
|
|
1735
|
+
color: "primary",
|
|
1736
|
+
buttonVariant: Ue.Primary
|
|
1737
|
+
},
|
|
1738
|
+
rejectDraft: {
|
|
1739
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
|
|
1740
|
+
color: "system-error-300",
|
|
1741
|
+
buttonVariant: Ue.Destructive
|
|
1742
|
+
},
|
|
1743
|
+
approveRequest: {
|
|
1744
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
1745
|
+
color: "primary",
|
|
1746
|
+
buttonVariant: Ue.Primary
|
|
1747
|
+
},
|
|
1748
|
+
processRequest: {
|
|
1749
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
1750
|
+
color: "primary",
|
|
1751
|
+
buttonVariant: Ue.Primary
|
|
1752
|
+
},
|
|
1753
|
+
receiveStock: {
|
|
1754
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
1755
|
+
color: "primary",
|
|
1756
|
+
buttonVariant: Ue.Primary,
|
|
1757
|
+
available: !1
|
|
1758
|
+
},
|
|
1759
|
+
completeReceive: {
|
|
1760
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
1761
|
+
color: "primary",
|
|
1762
|
+
buttonVariant: Ue.Plain
|
|
1763
|
+
},
|
|
1764
|
+
rejectRequest: {
|
|
1765
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
1766
|
+
color: "system-error-300",
|
|
1767
|
+
buttonVariant: Ue.Destructive
|
|
1768
|
+
},
|
|
1769
|
+
closeRequest: {
|
|
1770
|
+
translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
|
|
1771
|
+
color: "system-error-300",
|
|
1772
|
+
buttonVariant: Ue.Destructive,
|
|
1773
|
+
available: !1
|
|
1774
|
+
},
|
|
1775
|
+
returnStock: {
|
|
1776
|
+
translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
|
|
1777
|
+
color: "primary",
|
|
1778
|
+
buttonVariant: Ue.Primary,
|
|
1779
|
+
available: !1
|
|
1780
|
+
}
|
|
1781
|
+
}, wr = { class: "flex flex-row-reverse" }, $r = /* @__PURE__ */ qe({
|
|
1782
|
+
__name: "NetSuiteSync",
|
|
1783
|
+
props: {
|
|
1784
|
+
poRequest: {},
|
|
1785
|
+
purchaseOrder: {},
|
|
1786
|
+
isTransferBetweenOutlets: { type: Boolean },
|
|
1787
|
+
scope: {}
|
|
1788
|
+
},
|
|
1789
|
+
setup(m) {
|
|
1790
|
+
const t = m, r = _t(), n = Je(), p = gt(), u = se(!1);
|
|
1791
|
+
H(() => {
|
|
1792
|
+
var f, C, A, N;
|
|
1793
|
+
let s = !0;
|
|
1794
|
+
r.isEnabled || (s = !1);
|
|
1795
|
+
const a = t.purchaseOrder, S = t.poRequest;
|
|
1796
|
+
return a && ((f = a == null ? void 0 : a.supplier) != null && f.internal ? (!S && a.status == _e.enum.DRAFT && (s = !1), S && !((C = S == null ? void 0 : S.netSuite) != null && C.id) && (s = !1), t.isTransferBetweenOutlets && (s = !1)) : ((a == null ? void 0 : a.status) !== _e.enum.REQUESTING && a.supplier.internal && (s = !1), !S && !((A = a == null ? void 0 : a.netSuite) != null && A.id) && (s = !1), !S && ((N = a == null ? void 0 : a.netSuite) != null && N.id) && (a == null ? void 0 : a.status) == _e.enum.REQUESTING && (s = !1))), s;
|
|
1797
|
+
});
|
|
1798
|
+
async function d() {
|
|
1799
|
+
u.value || p.open({
|
|
1800
|
+
title: "Sync with NetSuite",
|
|
1801
|
+
contentComponent: ee("div", [
|
|
1802
|
+
ee("p", "Are you sure you want to sync now?"),
|
|
1803
|
+
ee("br"),
|
|
1804
|
+
ee(
|
|
1805
|
+
"p",
|
|
1806
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
1807
|
+
"Please wait a moment before syncing manually to avoid unnecessary actions."
|
|
1808
|
+
)
|
|
1809
|
+
]),
|
|
1810
|
+
primaryActions: {
|
|
1811
|
+
text: "Sync",
|
|
1812
|
+
close: !0,
|
|
1813
|
+
variant: "destructive"
|
|
1814
|
+
},
|
|
1815
|
+
secondaryActions: { text: "Not now", close: !0 }
|
|
1816
|
+
}).onPrimary(async () => {
|
|
1817
|
+
var s, a, S, f, C, A, N;
|
|
1818
|
+
try {
|
|
1819
|
+
u.value = !0;
|
|
1820
|
+
const h = ((s = t.purchaseOrder) == null ? void 0 : s._id) || ((a = t.poRequest) == null ? void 0 : a.purchaseOrderId) || "", M = (S = t.poRequest) == null ? void 0 : S.to.dbName;
|
|
1821
|
+
await r.syncPurchaseOrder({
|
|
1822
|
+
purchaseOrderId: h,
|
|
1823
|
+
locationId: t.scope === "approval" ? M : void 0,
|
|
1824
|
+
netsuiteId: ((C = (f = t.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : C.id) || ((N = (A = t.poRequest) == null ? void 0 : A.netSuite) == null ? void 0 : N.id)
|
|
1825
|
+
}), n.open({
|
|
1826
|
+
title: "Sync with NetSuite",
|
|
1827
|
+
message: "Requested to sync with NetSuite. Please wait a moment.",
|
|
1828
|
+
type: "success"
|
|
1829
|
+
}), await new Promise((E) => setTimeout(E, 5e3)), u.value = !1;
|
|
1830
|
+
} catch (h) {
|
|
1831
|
+
console.log("Failed to sync with NetSuite", h), n.open({
|
|
1832
|
+
title: "Error",
|
|
1833
|
+
message: "Failed to sync with NetSuite",
|
|
1834
|
+
type: "error"
|
|
1835
|
+
}), u.value = !1;
|
|
1836
|
+
}
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
return (s, a) => {
|
|
1840
|
+
const S = te("FmButton");
|
|
1841
|
+
return i(), y("div", wr, [
|
|
1842
|
+
T(S, {
|
|
1843
|
+
"prepend-icon": "sync",
|
|
1844
|
+
variant: "secondary",
|
|
1845
|
+
label: "Sync",
|
|
1846
|
+
loading: u.value,
|
|
1847
|
+
onClick: d,
|
|
1848
|
+
"text-color": "primary",
|
|
1849
|
+
"bg-color": "transparent",
|
|
1850
|
+
"border-color": "primary"
|
|
1851
|
+
}, null, 8, ["loading"])
|
|
1852
|
+
]);
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
}), Cr = {
|
|
1856
|
+
key: 0,
|
|
1857
|
+
class: "flex flex-col gap-8"
|
|
1858
|
+
}, Ar = { class: "flex flex-col gap-4" }, Dr = { class: "fm-typo-en-body-lg-600" }, Rr = {
|
|
1859
|
+
key: 0,
|
|
1860
|
+
class: "flex flex-col gap-4"
|
|
1861
|
+
}, Nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pr = { class: "fm-typo-en-body-lg-600" }, Fr = { key: 0 }, Ir = { key: 1 }, Tr = {
|
|
1862
|
+
key: 1,
|
|
1863
|
+
class: "flex flex-col gap-4"
|
|
1864
|
+
}, Er = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qr = { class: "fm-typo-en-body-lg-600" }, Vr = { key: 0 }, Lr = { key: 1 }, jr = {
|
|
1865
|
+
key: 2,
|
|
1866
|
+
class: "flex flex-col gap-4"
|
|
1867
|
+
}, Ur = { class: "fm-typo-en-body-lg-600" }, Mr = {
|
|
1868
|
+
key: 3,
|
|
1869
|
+
class: "flex flex-col gap-4"
|
|
1870
|
+
}, Br = { class: "fm-typo-en-body-lg-600" }, zr = /* @__PURE__ */ qe({
|
|
1871
|
+
__name: "NetSuiteInfo",
|
|
1872
|
+
props: {
|
|
1873
|
+
transferType: {},
|
|
1874
|
+
transferToDbName: {},
|
|
1875
|
+
poRequest: {},
|
|
1876
|
+
purchaseOrder: {},
|
|
1877
|
+
isTransferBetweenOutlets: { type: Boolean },
|
|
1878
|
+
scope: {}
|
|
1879
|
+
},
|
|
1880
|
+
setup(m) {
|
|
1881
|
+
const t = m, r = _t(), n = et(), p = se(t.poRequest);
|
|
1882
|
+
os(async () => {
|
|
1883
|
+
var a;
|
|
1884
|
+
if (!t.poRequest && ((a = t.purchaseOrder) != null && a._id)) {
|
|
1885
|
+
const S = await n.getLatestPurchaseOrderRequest(t.purchaseOrder._id);
|
|
1886
|
+
p.value = S;
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
const u = H(
|
|
1890
|
+
() => {
|
|
1891
|
+
var a, S, f, C, A, N;
|
|
1892
|
+
return r.getSubsidiaryFullName(
|
|
1893
|
+
((f = (S = (a = t.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : S.subsidiary) == null ? void 0 : f.id) || ((N = (A = (C = t.poRequest) == null ? void 0 : C.netSuite) == null ? void 0 : A.subsidiary) == null ? void 0 : N.id)
|
|
1894
|
+
).fullName;
|
|
1895
|
+
}
|
|
1896
|
+
), d = H(() => {
|
|
1897
|
+
var a, S, f, C, A, N, h, M, E, re, J, W;
|
|
1898
|
+
return (f = (S = (a = t.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : S.additionalInfo) != null && f.transactionnumber ? (N = (A = (C = t.purchaseOrder) == null ? void 0 : C.netSuite) == null ? void 0 : A.additionalInfo) == null ? void 0 : N.transactionnumber : (E = (M = (h = p.value) == null ? void 0 : h.netSuite) == null ? void 0 : M.additionalInfo) != null && E.transactionnumber ? (W = (J = (re = p.value) == null ? void 0 : re.netSuite) == null ? void 0 : J.additionalInfo) == null ? void 0 : W.transactionnumber : null;
|
|
1899
|
+
}), s = H(() => {
|
|
1900
|
+
var a, S, f, C, A, N;
|
|
1901
|
+
return (S = (a = t.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) != null && S.length && ((C = (f = t.purchaseOrder) == null ? void 0 : f.deliveryFullfillment) == null ? void 0 : C.length) > 0 ? (N = (A = t.purchaseOrder) == null ? void 0 : A.deliveryFullfillment) == null ? void 0 : N.map((h) => {
|
|
1902
|
+
var M;
|
|
1903
|
+
return (M = h.netSuite) == null ? void 0 : M.refNo;
|
|
1904
|
+
}).join(", ") : "N/A";
|
|
1905
|
+
});
|
|
1906
|
+
return (a, S) => {
|
|
1907
|
+
var f, C, A, N, h, M, E, re, J, W, he, pe, oe, Se, Ae, B;
|
|
1908
|
+
return v(r).isEnabled ? (i(), y("div", Cr, [
|
|
1909
|
+
e("div", Ar, [
|
|
1910
|
+
S[0] || (S[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
|
|
1911
|
+
e("div", Dr, b(u.value || "N/A"), 1)
|
|
1912
|
+
]),
|
|
1913
|
+
!a.isTransferBetweenOutlets && a.scope === v(At).RECEIVE_REQUEST ? (i(), y("div", Rr, [
|
|
1914
|
+
e("div", Nr, " NetSuite " + b((C = (f = a.purchaseOrder) == null ? void 0 : f.netSuite) != null && C.recordType ? v(as)((N = (A = a.purchaseOrder) == null ? void 0 : A.netSuite) == null ? void 0 : N.recordType) : a.transferType === v(lt).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
1915
|
+
e("div", Pr, [
|
|
1916
|
+
(M = (h = a.purchaseOrder) == null ? void 0 : h.netSuite) != null && M.id ? (i(), y("span", Fr, b((re = (E = a.purchaseOrder) == null ? void 0 : E.netSuite) == null ? void 0 : re.refNo) + " (" + b((W = (J = a.purchaseOrder) == null ? void 0 : J.netSuite) == null ? void 0 : W.id) + ") ", 1)) : (i(), y("span", Ir, "N/A"))
|
|
1917
|
+
])
|
|
1918
|
+
])) : V("", !0),
|
|
1919
|
+
!a.isTransferBetweenOutlets && p.value || a.scope === v(At).APPROVAL ? (i(), y("div", Tr, [
|
|
1920
|
+
e("div", Er, " (Request) NetSuite " + b(a.transferType === v(lt).enum.purchase ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
1921
|
+
e("div", qr, [
|
|
1922
|
+
(pe = (he = p.value) == null ? void 0 : he.netSuite) != null && pe.id ? (i(), y("span", Vr, b((Se = (oe = p.value) == null ? void 0 : oe.netSuite) == null ? void 0 : Se.refNo) + " (" + b((B = (Ae = p.value) == null ? void 0 : Ae.netSuite) == null ? void 0 : B.id) + ") ", 1)) : (i(), y("span", Lr, "N/A"))
|
|
1923
|
+
])
|
|
1924
|
+
])) : V("", !0),
|
|
1925
|
+
d.value ? (i(), y("div", jr, [
|
|
1926
|
+
S[1] || (S[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
|
|
1927
|
+
e("div", Ur, b(d.value), 1)
|
|
1928
|
+
])) : V("", !0),
|
|
1929
|
+
v(r).isEnabled && a.transferType === v(lt).enum.transfer && !a.isTransferBetweenOutlets ? (i(), y("div", Mr, [
|
|
1930
|
+
S[2] || (S[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
|
|
1931
|
+
e("div", Br, b(s.value), 1)
|
|
1932
|
+
])) : V("", !0)
|
|
1933
|
+
])) : V("", !0);
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
}), Kr = { class: "flex flex-row-reverse" }, Hr = /* @__PURE__ */ qe({
|
|
1937
|
+
__name: "NetSuiteLog",
|
|
1938
|
+
props: {
|
|
1939
|
+
netsuiteId: {},
|
|
1940
|
+
purchaseOrderId: {}
|
|
1941
|
+
},
|
|
1942
|
+
setup(m) {
|
|
1943
|
+
const t = Je(), r = Pt();
|
|
1944
|
+
async function n(p, u) {
|
|
1945
|
+
const d = [];
|
|
1946
|
+
if (p && d.push(`body.message:*${p}*`), u) {
|
|
1947
|
+
const f = u.replace(/:/g, "\\:");
|
|
1948
|
+
d.push(`${f}`);
|
|
1949
|
+
}
|
|
1950
|
+
if (d.length === 0) {
|
|
1951
|
+
t.open({
|
|
1952
|
+
message: "Cannot open logs without valid filters.",
|
|
1953
|
+
type: "error"
|
|
1954
|
+
});
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
const a = `attributes.pod:netsuite* AND (${d.join(" OR ")})`, { url: S } = await r.getSyncLogs(a);
|
|
1958
|
+
t.open(
|
|
1959
|
+
{
|
|
1960
|
+
message: "Opening NetSuite logs...",
|
|
1961
|
+
type: "info"
|
|
1962
|
+
},
|
|
1963
|
+
800
|
|
1964
|
+
), await new Promise((f) => setTimeout(f, 800)), window.open(S, "_blank");
|
|
1965
|
+
}
|
|
1966
|
+
return (p, u) => {
|
|
1967
|
+
const d = te("FmButton");
|
|
1968
|
+
return i(), y("div", Kr, [
|
|
1969
|
+
T(d, {
|
|
1970
|
+
"prepend-icon": "history",
|
|
1971
|
+
variant: "secondary",
|
|
1972
|
+
label: "Logs",
|
|
1973
|
+
onClick: u[0] || (u[0] = (s) => n(p.netsuiteId, p.purchaseOrderId)),
|
|
1974
|
+
"text-color": "primary",
|
|
1975
|
+
"bg-color": "transparent",
|
|
1976
|
+
"border-color": "primary"
|
|
1977
|
+
})
|
|
1978
|
+
]);
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
}), Gr = { class: "flex flex-row-reverse" }, Wr = { key: 0 }, Qr = { key: 1 }, Yr = { class: "mb-6" }, Jr = { class: "fm-typo-en-body-md-400" }, Zr = { key: 0 }, Xr = { key: 1 }, eo = {
|
|
1982
|
+
key: 0,
|
|
1983
|
+
class: "flex"
|
|
1984
|
+
}, to = {
|
|
1985
|
+
key: 1,
|
|
1986
|
+
class: "border-t pt-6"
|
|
1987
|
+
}, so = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, ro = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, oo = { class: "w-full" }, no = {
|
|
1988
|
+
class: "p-3 fm-typo-en-body-sm-600",
|
|
1989
|
+
style: { "min-width": "130px" }
|
|
1990
|
+
}, ao = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, lo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, io = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, uo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, co = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, mo = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, po = { class: "p-3 fm-typo-en-body-sm-600" }, fo = { key: 2 }, vo = { key: 1 }, yo = /* @__PURE__ */ qe({
|
|
1991
|
+
__name: "NetSuiteLatestInfo",
|
|
1992
|
+
props: {
|
|
1993
|
+
netsuiteId: {},
|
|
1994
|
+
purchaseOrderId: {}
|
|
1995
|
+
},
|
|
1996
|
+
setup(m) {
|
|
1997
|
+
const t = m, r = Pt(), n = se(!1), p = Ke(), u = se(!0), d = se(!1), s = se(!1), a = se(!1), S = se(null), f = se([]);
|
|
1998
|
+
async function C() {
|
|
1999
|
+
if (!S.value) {
|
|
2000
|
+
n.value = !0;
|
|
2001
|
+
try {
|
|
2002
|
+
u.value = !0;
|
|
2003
|
+
const M = await r.getMoreInfo(
|
|
2004
|
+
p.currentLocation.dbName,
|
|
2005
|
+
t.purchaseOrderId
|
|
2006
|
+
);
|
|
2007
|
+
S.value = M, d.value = !1;
|
|
2008
|
+
} catch {
|
|
2009
|
+
d.value = !0;
|
|
2010
|
+
} finally {
|
|
2011
|
+
u.value = !1;
|
|
2012
|
+
}
|
|
2013
|
+
await A();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
async function A() {
|
|
2017
|
+
if (!(f.value.length > 0))
|
|
2018
|
+
try {
|
|
2019
|
+
s.value = !0;
|
|
2020
|
+
const M = await r.getChangeLogs(t.netsuiteId);
|
|
2021
|
+
f.value = M, a.value = !1;
|
|
2022
|
+
} catch {
|
|
2023
|
+
a.value = !0;
|
|
2024
|
+
} finally {
|
|
2025
|
+
s.value = !1;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
function N(M) {
|
|
2029
|
+
switch (M) {
|
|
2030
|
+
case Be.Create:
|
|
2031
|
+
return "text-green-600 bg-green-100";
|
|
2032
|
+
case Be.Set:
|
|
2033
|
+
return "text-blue-600 bg-blue-100";
|
|
2034
|
+
case Be.Change:
|
|
2035
|
+
return "text-yellow-600 bg-yellow-100";
|
|
2036
|
+
case Be.Unset:
|
|
2037
|
+
return "text-red-600 bg-red-100";
|
|
2038
|
+
default:
|
|
2039
|
+
return "text-gray-600 bg-gray-100";
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
function h(M) {
|
|
2043
|
+
return new Date(M).toLocaleDateString("en-US", {
|
|
2044
|
+
year: "numeric",
|
|
2045
|
+
month: "short",
|
|
2046
|
+
day: "numeric",
|
|
2047
|
+
hour: "2-digit",
|
|
2048
|
+
minute: "2-digit"
|
|
2049
|
+
});
|
|
2050
|
+
}
|
|
2051
|
+
return (M, E) => {
|
|
2052
|
+
const re = te("FmButton"), J = te("FmLabel"), W = te("FmCircularProgress"), he = te("FmIcon"), pe = te("FmDialog");
|
|
2053
|
+
return i(), y("div", Gr, [
|
|
2054
|
+
T(pe, {
|
|
2055
|
+
modelValue: n.value,
|
|
2056
|
+
"onUpdate:modelValue": E[2] || (E[2] = (oe) => n.value = oe),
|
|
2057
|
+
overlay: !0,
|
|
2058
|
+
"max-width": 800
|
|
2059
|
+
}, {
|
|
2060
|
+
"dialog-button": ie(() => [
|
|
2061
|
+
T(re, {
|
|
2062
|
+
"prepend-icon": "info",
|
|
2063
|
+
variant: "secondary",
|
|
2064
|
+
label: "Latest Info",
|
|
2065
|
+
onClick: E[0] || (E[0] = (oe) => C()),
|
|
2066
|
+
"text-color": "primary",
|
|
2067
|
+
"bg-color": "transparent",
|
|
2068
|
+
"border-color": "primary"
|
|
2069
|
+
})
|
|
2070
|
+
]),
|
|
2071
|
+
"dialog-header": ie(() => E[3] || (E[3] = [
|
|
2072
|
+
e("div", null, "NetSuite latest info", -1)
|
|
2073
|
+
])),
|
|
2074
|
+
default: ie(() => [
|
|
2075
|
+
u.value ? (i(), y("div", Wr, "Loading...")) : (i(), y("div", Qr, [
|
|
2076
|
+
d.value ? (i(), y("p", vo, "Something went wrong.")) : (i(), y($e, { key: 0 }, [
|
|
2077
|
+
e("div", Yr, [
|
|
2078
|
+
E[4] || (E[4] = e("h3", { class: "fm-typo-en-body-lg-600 mb-4" }, "NetSuite Order Details", -1)),
|
|
2079
|
+
(i(!0), y($e, null, Ie(S.value, (oe, Se) => (i(), y("div", {
|
|
2080
|
+
key: Se,
|
|
2081
|
+
class: "mb-2"
|
|
2082
|
+
}, [
|
|
2083
|
+
e("div", null, [
|
|
2084
|
+
T(J, {
|
|
2085
|
+
label: v(Rt)(Se)
|
|
2086
|
+
}, null, 8, ["label"]),
|
|
2087
|
+
e("div", Jr, [
|
|
2088
|
+
Array.isArray(oe) ? (i(), y("span", Zr, b(oe.length > 0 ? oe.join(", ") : "N/A"), 1)) : (i(), y("span", Xr, b(oe), 1))
|
|
2089
|
+
])
|
|
2090
|
+
])
|
|
2091
|
+
]))), 128))
|
|
2092
|
+
]),
|
|
2093
|
+
s.value ? (i(), y("div", eo, [
|
|
2094
|
+
E[5] || (E[5] = e("span", null, "Change Log Loading...", -1)),
|
|
2095
|
+
T(W, { size: "md" })
|
|
2096
|
+
])) : V("", !0),
|
|
2097
|
+
!s.value && f.value.length > 0 ? (i(), y("div", to, [
|
|
2098
|
+
e("h3", so, [
|
|
2099
|
+
T(he, {
|
|
2100
|
+
name: "error",
|
|
2101
|
+
color: "#ff9500",
|
|
2102
|
+
size: "sm"
|
|
2103
|
+
}),
|
|
2104
|
+
E[6] || (E[6] = We(" Change Logs "))
|
|
2105
|
+
]),
|
|
2106
|
+
e("div", ro, [
|
|
2107
|
+
e("table", oo, [
|
|
2108
|
+
E[7] || (E[7] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
|
|
2109
|
+
e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
|
|
2110
|
+
e("th", {
|
|
2111
|
+
class: "text-left p-3 fm-typo-en-body-md-600",
|
|
2112
|
+
style: { "min-width": "130px" }
|
|
2113
|
+
}, " Date "),
|
|
2114
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
|
|
2115
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
|
|
2116
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
|
|
2117
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
|
|
2118
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
|
|
2119
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
|
|
2120
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
|
|
2121
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
|
|
2122
|
+
])
|
|
2123
|
+
], -1)),
|
|
2124
|
+
e("tbody", null, [
|
|
2125
|
+
(i(!0), y($e, null, Ie(f.value, (oe, Se) => (i(), y("tr", {
|
|
2126
|
+
key: Se,
|
|
2127
|
+
class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
|
|
2128
|
+
}, [
|
|
2129
|
+
e("td", no, b(h(oe._dateiso8601)), 1),
|
|
2130
|
+
e("td", ao, b(oe._rolename), 1),
|
|
2131
|
+
e("td", lo, b(oe._employeename), 1),
|
|
2132
|
+
e("td", io, b(oe._contextname), 1),
|
|
2133
|
+
e("td", {
|
|
2134
|
+
class: Qe(`p-3 fm-typo-en-body-sm-600 ${N(Number(oe.type) - 1)}`)
|
|
2135
|
+
}, b(v(Be)[Number(oe.type) - 1]), 3),
|
|
2136
|
+
e("td", uo, b(oe.lineid || ""), 1),
|
|
2137
|
+
e("td", co, b(oe._fieldname), 1),
|
|
2138
|
+
e("td", mo, b(oe.oldvalue || ""), 1),
|
|
2139
|
+
e("td", po, b(oe.newvalue || ""), 1)
|
|
2140
|
+
]))), 128))
|
|
2141
|
+
])
|
|
2142
|
+
])
|
|
2143
|
+
])
|
|
2144
|
+
])) : (i(), y("div", fo, E[8] || (E[8] = [
|
|
2145
|
+
e("p", null, "No change logs available.", -1)
|
|
2146
|
+
])))
|
|
2147
|
+
], 64))
|
|
2148
|
+
]))
|
|
2149
|
+
]),
|
|
2150
|
+
"dialog-footer": ie(() => [
|
|
2151
|
+
T(re, {
|
|
2152
|
+
class: "ml-auto sm:w-full xs:w-full",
|
|
2153
|
+
label: "Close",
|
|
2154
|
+
size: "md",
|
|
2155
|
+
variant: "primary",
|
|
2156
|
+
onClick: E[1] || (E[1] = (oe) => n.value = !1)
|
|
2157
|
+
})
|
|
2158
|
+
]),
|
|
2159
|
+
_: 1
|
|
2160
|
+
}, 8, ["modelValue"])
|
|
2161
|
+
]);
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2164
|
+
}), ho = {
|
|
2165
|
+
key: 0,
|
|
2166
|
+
class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
|
|
2167
|
+
}, bo = { class: "flex gap-8 items-center" }, go = { class: "ml-auto" }, _o = { class: "flex gap-3" }, So = /* @__PURE__ */ qe({
|
|
2168
|
+
__name: "NetSuitePanel",
|
|
2169
|
+
props: {
|
|
2170
|
+
poRequest: {},
|
|
2171
|
+
purchaseOrder: {},
|
|
2172
|
+
transferType: {},
|
|
2173
|
+
transferToDbName: {},
|
|
2174
|
+
scope: {}
|
|
2175
|
+
},
|
|
2176
|
+
setup(m) {
|
|
2177
|
+
const t = m, r = Js(), n = H(() => r.isNetSuiteEnabled);
|
|
2178
|
+
return (p, u) => {
|
|
2179
|
+
var s, a;
|
|
2180
|
+
const d = te("FmMenuDivider");
|
|
2181
|
+
return n.value ? (i(), y("div", ho, [
|
|
2182
|
+
e("div", bo, [
|
|
2183
|
+
u[0] || (u[0] = e("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
|
|
2184
|
+
e("div", go, [
|
|
2185
|
+
e("div", _o, [
|
|
2186
|
+
(a = (s = t.purchaseOrder) == null ? void 0 : s.netSuite) != null && a.id ? (i(), ye(st, { key: 0 }, {
|
|
2187
|
+
default: ie(() => {
|
|
2188
|
+
var S, f, C;
|
|
2189
|
+
return [
|
|
2190
|
+
T(yo, {
|
|
2191
|
+
"netsuite-id": (f = (S = p.purchaseOrder) == null ? void 0 : S.netSuite) == null ? void 0 : f.id,
|
|
2192
|
+
"purchase-order-id": (C = p.purchaseOrder) == null ? void 0 : C._id
|
|
2193
|
+
}, null, 8, ["netsuite-id", "purchase-order-id"])
|
|
2194
|
+
];
|
|
2195
|
+
}),
|
|
2196
|
+
_: 1
|
|
2197
|
+
})) : V("", !0),
|
|
2198
|
+
T(st, null, {
|
|
2199
|
+
default: ie(() => {
|
|
2200
|
+
var S, f, C;
|
|
2201
|
+
return [
|
|
2202
|
+
T(Hr, {
|
|
2203
|
+
"netsuite-id": (f = (S = p.purchaseOrder) == null ? void 0 : S.netSuite) == null ? void 0 : f.id,
|
|
2204
|
+
"purchase-order-id": (C = p.purchaseOrder) == null ? void 0 : C._id
|
|
2205
|
+
}, null, 8, ["netsuite-id", "purchase-order-id"])
|
|
2206
|
+
];
|
|
2207
|
+
}),
|
|
2208
|
+
_: 1
|
|
2209
|
+
}),
|
|
2210
|
+
T($r, {
|
|
2211
|
+
"po-request": p.poRequest,
|
|
2212
|
+
"purchase-order": p.purchaseOrder,
|
|
2213
|
+
"is-transfer-between-outlets": !n.value,
|
|
2214
|
+
scope: p.scope
|
|
2215
|
+
}, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
|
|
2216
|
+
])
|
|
2217
|
+
])
|
|
2218
|
+
]),
|
|
2219
|
+
T(d),
|
|
2220
|
+
T(zr, {
|
|
2221
|
+
"po-request": p.poRequest,
|
|
2222
|
+
"purchase-order": p.purchaseOrder,
|
|
2223
|
+
"transfer-type": p.transferType,
|
|
2224
|
+
"transfer-to-db-name": p.transferToDbName,
|
|
2225
|
+
"is-transfer-between-outlets": !n.value,
|
|
2226
|
+
scope: p.scope
|
|
2227
|
+
}, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
|
|
2228
|
+
])) : V("", !0);
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
}), ko = ["open"], Oo = { class: "fm-typo-en-body-sm-600 cursor-pointer select-none" }, ts = /* @__PURE__ */ qe({
|
|
2232
|
+
__name: "FmAdminCollapsiblePanel",
|
|
2233
|
+
props: {
|
|
2234
|
+
title: { default: "Admin" },
|
|
2235
|
+
open: { type: Boolean, default: !1 },
|
|
2236
|
+
selectable: { type: Boolean, default: !0 },
|
|
2237
|
+
class: { default: void 0 },
|
|
2238
|
+
contentClass: { default: void 0 }
|
|
2239
|
+
},
|
|
2240
|
+
setup(m) {
|
|
2241
|
+
const t = m;
|
|
2242
|
+
return (r, n) => (i(), ye(st, {
|
|
2243
|
+
selectable: t.selectable,
|
|
2244
|
+
class: Qe(t.class)
|
|
2245
|
+
}, {
|
|
2246
|
+
default: ie(() => [
|
|
2247
|
+
e("details", {
|
|
2248
|
+
open: t.open,
|
|
2249
|
+
class: "w-full"
|
|
2250
|
+
}, [
|
|
2251
|
+
e("summary", Oo, b(t.title), 1),
|
|
2252
|
+
e("div", {
|
|
2253
|
+
class: Qe(["mt-4 flex flex-col gap-2", t.contentClass])
|
|
2254
|
+
}, [
|
|
2255
|
+
Ds(r.$slots, "default")
|
|
2256
|
+
], 2)
|
|
2257
|
+
], 8, ko)
|
|
2258
|
+
]),
|
|
2259
|
+
_: 3
|
|
2260
|
+
}, 8, ["selectable", "class"]));
|
|
2261
|
+
}
|
|
2262
|
+
});
|
|
2263
|
+
function _s(m) {
|
|
2264
|
+
if (!(m != null && m.itemsAtSubmission)) return [];
|
|
2265
|
+
const t = new Set(m.itemsAtSubmission.map((p) => p.sku._id)), r = /* @__PURE__ */ new Set(), n = [];
|
|
2266
|
+
for (const p of m.items) {
|
|
2267
|
+
const u = p.sku._id;
|
|
2268
|
+
t.has(u) || r.has(u) || (r.add(u), n.push(p));
|
|
2269
|
+
}
|
|
2270
|
+
return n;
|
|
2271
|
+
}
|
|
2272
|
+
function Ss(m, t) {
|
|
2273
|
+
var p;
|
|
2274
|
+
if (!m || t.length === 0) return {};
|
|
2275
|
+
const r = new Set(t.map((u) => u.sku._id)), n = {};
|
|
2276
|
+
for (const u of m.deliveryOrder ?? [])
|
|
2277
|
+
for (const d of u.received ?? []) {
|
|
2278
|
+
const s = d.sku._id;
|
|
2279
|
+
s && r.has(s) && (n[s] = (n[s] ?? 0) + (((p = d.amount) == null ? void 0 : p.amount) ?? 0));
|
|
2280
|
+
}
|
|
2281
|
+
return t.reduce(
|
|
2282
|
+
(u, d) => {
|
|
2283
|
+
var C, A;
|
|
2284
|
+
const s = d.sku._id ?? "", a = ((C = d.quantity) == null ? void 0 : C.amount) ?? 0, S = n[s] ?? 0, f = ((A = d.quantity) == null ? void 0 : A.precision) ?? 0;
|
|
2285
|
+
return u[s] = {
|
|
2286
|
+
key: s,
|
|
2287
|
+
total: { amount: a, precision: f },
|
|
2288
|
+
received: { amount: S, precision: f },
|
|
2289
|
+
remaining: { amount: a - S, precision: f }
|
|
2290
|
+
}, u;
|
|
2291
|
+
},
|
|
2292
|
+
{}
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
const xo = { class: "flex flex-col gap-3" }, wo = { class: "flex flex-col gap-4" }, $o = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Co = { class: "flex flex-col gap-4" }, Ao = { class: "flex justify-between items-start py-1 gap-4" }, Do = { class: "flex flex-col flex-1 min-w-0" }, Ro = { class: "fm-typo-en-body-lg-600 truncate" }, No = { class: "fm-typo-en-body-md-400 truncate" }, Po = { class: "flex flex-col gap-2 items-end w-52 shrink-0" }, Fo = {
|
|
2296
|
+
key: 0,
|
|
2297
|
+
class: "flex items-center gap-2"
|
|
2298
|
+
}, Io = {
|
|
2299
|
+
key: 0,
|
|
2300
|
+
class: "border-b border-fm-color-stroke-secondary"
|
|
2301
|
+
}, To = { class: "flex flex-col gap-4" }, Eo = { class: "flex items-center justify-between" }, qo = {
|
|
2302
|
+
key: 0,
|
|
2303
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary"
|
|
2304
|
+
}, Vo = { class: "flex justify-between items-start py-1 gap-4" }, Lo = { class: "flex-1 min-w-0 flex flex-col gap-2" }, jo = { class: "flex flex-col gap-2 items-end w-52 shrink-0" }, Uo = {
|
|
2305
|
+
key: 0,
|
|
2306
|
+
class: "flex items-center gap-2"
|
|
2307
|
+
}, Mo = {
|
|
2308
|
+
key: 0,
|
|
2309
|
+
class: "border-b border-fm-color-stroke-secondary"
|
|
2310
|
+
}, Bo = { class: "flex flex-col gap-4" }, zo = { class: "flex flex-col gap-4" }, Ko = { class: "flex flex-col gap-4" }, Ho = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Go = {
|
|
2311
|
+
key: 1,
|
|
2312
|
+
class: "flex flex-col gap-4"
|
|
2313
|
+
}, Wo = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, ct = "Will be ignored on save (zero or negative quantity)", Qo = /* @__PURE__ */ qe({
|
|
2314
|
+
__name: "EditForm",
|
|
2315
|
+
props: {
|
|
2316
|
+
purchaseOrder: {},
|
|
2317
|
+
deliveryOrder: {},
|
|
2318
|
+
receivedInfoMap: {}
|
|
2319
|
+
},
|
|
2320
|
+
emits: ["submitted"],
|
|
2321
|
+
setup(m, { emit: t }) {
|
|
2322
|
+
var ce;
|
|
2323
|
+
const { t: r } = nr(), n = Ze(), p = Je(), u = se(!1), d = Dt(), s = m, a = (((ce = s.purchaseOrder) == null ? void 0 : ce.version) ?? Me.enum[1]) === Me.enum[2], S = t, f = is("deliveryOrder"), C = et(), {
|
|
2324
|
+
controller: A,
|
|
2325
|
+
state: N,
|
|
2326
|
+
reset: h
|
|
2327
|
+
} = It({
|
|
2328
|
+
currency: Ce(),
|
|
2329
|
+
adjustments: s.deliveryOrder.priceAdjustments
|
|
2330
|
+
}), M = H(
|
|
2331
|
+
() => {
|
|
2332
|
+
var $;
|
|
2333
|
+
return (($ = s.purchaseOrder.deliveryFullfillment) == null ? void 0 : $.findIndex(
|
|
2334
|
+
(_) => s.deliveryOrder.fullfillmentId && _.id === s.deliveryOrder.fullfillmentId
|
|
2335
|
+
)) ?? -1;
|
|
2336
|
+
}
|
|
2337
|
+
), E = n.enablePurchaseOrderReceiveWithCustomCost, re = n.enablePortalDeliveryOrderWrite, J = se({}), W = H(
|
|
2338
|
+
() => (s.purchaseOrder.itemsAtSubmission ?? s.purchaseOrder.items).length
|
|
2339
|
+
), he = H(() => _s(s.purchaseOrder)), pe = H(
|
|
2340
|
+
() => Ss(s.purchaseOrder, he.value)
|
|
2341
|
+
), oe = H(
|
|
2342
|
+
() => s.purchaseOrder.items.map(
|
|
2343
|
+
($, _) => H({
|
|
2344
|
+
get: () => {
|
|
2345
|
+
var Z;
|
|
2346
|
+
const q = (Z = f.received[_]) == null ? void 0 : Z.amount;
|
|
2347
|
+
return q ? +we(q) : 0;
|
|
2348
|
+
},
|
|
2349
|
+
set: (q) => {
|
|
2350
|
+
f.received[_].amount = Ye(q, $.sku.unit.precision);
|
|
2351
|
+
}
|
|
2352
|
+
})
|
|
2353
|
+
)
|
|
2354
|
+
), Se = H(
|
|
2355
|
+
() => s.purchaseOrder.items.map(
|
|
2356
|
+
($, _) => H({
|
|
2357
|
+
get: () => {
|
|
2358
|
+
var Z;
|
|
2359
|
+
const q = (Z = f.received[_]) == null ? void 0 : Z.cost;
|
|
2360
|
+
return q ? +we(q) : 0;
|
|
2361
|
+
},
|
|
2362
|
+
set: (q) => {
|
|
2363
|
+
f.received[_].cost = {
|
|
2364
|
+
currency: Ce(),
|
|
2365
|
+
...Ye(q, 4)
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
})
|
|
2369
|
+
)
|
|
2370
|
+
);
|
|
2371
|
+
function Ae($) {
|
|
2372
|
+
var q;
|
|
2373
|
+
const _ = !J.value[$];
|
|
2374
|
+
if (J.value[$] = _, _) {
|
|
2375
|
+
const Z = (q = f.received[$]) == null ? void 0 : q.cost;
|
|
2376
|
+
f.received[$].cost = Z ? { ...Z, precision: 4 } : { currency: Ce(), amount: 0, precision: 4 };
|
|
2377
|
+
} else
|
|
2378
|
+
delete f.received[$].cost;
|
|
2379
|
+
}
|
|
2380
|
+
const B = se([]), ge = H(
|
|
2381
|
+
() => d.skus.filter(($) => !$.isInactive).map(($) => ({ label: `${$.name} (${$.code})`, value: $._id }))
|
|
2382
|
+
);
|
|
2383
|
+
function R() {
|
|
2384
|
+
B.value.push({ skuId: null, costEnabled: !1 }), f.received.push({
|
|
2385
|
+
sku: null,
|
|
2386
|
+
amount: Ne.fromNumber(0),
|
|
2387
|
+
measurement: null
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
function w($) {
|
|
2391
|
+
B.value.splice($, 1), f.received.splice(W.value + $, 1);
|
|
2392
|
+
}
|
|
2393
|
+
function j($, _) {
|
|
2394
|
+
B.value[$].skuId = _;
|
|
2395
|
+
const q = _ ? d.skuById[_] : null;
|
|
2396
|
+
f.received[W.value + $].sku = q;
|
|
2397
|
+
}
|
|
2398
|
+
function L($, _) {
|
|
2399
|
+
var ke, Re;
|
|
2400
|
+
const q = (ke = s.receivedInfoMap) == null ? void 0 : ke[_.sku._id], Z = q ? `${r("inventory.transfer.receiveRequest.details.received")} ${Ne.toFormatString({ value: q.received })} / ${ft(_.quantity, _.sku.unit, _.measurement)}` : void 0;
|
|
2401
|
+
return (((Re = oe.value[$]) == null ? void 0 : Re.value) ?? 0) > 0 ? Z : Z ? `${Z} · ${ct}` : ct;
|
|
2402
|
+
}
|
|
2403
|
+
function X($, _) {
|
|
2404
|
+
var ke;
|
|
2405
|
+
const Z = (((ke = fe.value[_]) == null ? void 0 : ke.value) ?? 0) <= 0;
|
|
2406
|
+
let de;
|
|
2407
|
+
if ($.skuId && pe.value[$.skuId]) {
|
|
2408
|
+
const Re = pe.value[$.skuId], o = Ne.toFormatString({ value: Re.received });
|
|
2409
|
+
de = `${r("inventory.transfer.receiveRequest.details.received")} ${o}`;
|
|
2410
|
+
}
|
|
2411
|
+
return Z ? de ? `${de} · ${ct}` : ct : de;
|
|
2412
|
+
}
|
|
2413
|
+
const fe = H(
|
|
2414
|
+
() => B.value.map(($, _) => {
|
|
2415
|
+
const q = W.value + _;
|
|
2416
|
+
return H({
|
|
2417
|
+
get: () => {
|
|
2418
|
+
var de;
|
|
2419
|
+
const Z = (de = f.received[q]) == null ? void 0 : de.amount;
|
|
2420
|
+
return Z ? +we(Z) : 0;
|
|
2421
|
+
},
|
|
2422
|
+
set: (Z) => {
|
|
2423
|
+
var ke, Re, o;
|
|
2424
|
+
const de = ((ke = $.historyItem) == null ? void 0 : ke.sku.unit.precision) ?? ($.skuId ? (o = (Re = d.skuById[$.skuId]) == null ? void 0 : Re.unit) == null ? void 0 : o.precision : void 0) ?? 2;
|
|
2425
|
+
f.received[q].amount = Ye(Z, de);
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
})
|
|
2429
|
+
), xe = H(
|
|
2430
|
+
() => B.value.map(($, _) => {
|
|
2431
|
+
const q = W.value + _;
|
|
2432
|
+
return H({
|
|
2433
|
+
get: () => {
|
|
2434
|
+
var de;
|
|
2435
|
+
const Z = (de = f.received[q]) == null ? void 0 : de.cost;
|
|
2436
|
+
return Z ? +we(Z) : 0;
|
|
2437
|
+
},
|
|
2438
|
+
set: (Z) => {
|
|
2439
|
+
f.received[q].cost = {
|
|
2440
|
+
currency: Ce(),
|
|
2441
|
+
...Ye(Z, 4)
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2444
|
+
});
|
|
2445
|
+
})
|
|
2446
|
+
);
|
|
2447
|
+
function D($) {
|
|
2448
|
+
const _ = B.value[$], q = W.value + $;
|
|
2449
|
+
_.costEnabled = !_.costEnabled, _.costEnabled ? f.received[q].cost = { currency: Ce(), amount: 0, precision: 4 } : delete f.received[q].cost;
|
|
2450
|
+
}
|
|
2451
|
+
Xe(
|
|
2452
|
+
() => u.value,
|
|
2453
|
+
($) => {
|
|
2454
|
+
var o, l, k;
|
|
2455
|
+
if (!$) {
|
|
2456
|
+
B.value = [], J.value = {};
|
|
2457
|
+
return;
|
|
2458
|
+
}
|
|
2459
|
+
h(s.deliveryOrder.priceAdjustments);
|
|
2460
|
+
const _ = s.purchaseOrder.itemsAtSubmission ?? s.purchaseOrder.items, q = new Set(_.map((x) => x.sku._id)), Z = {}, de = [];
|
|
2461
|
+
for (const x of s.deliveryOrder.received ?? []) {
|
|
2462
|
+
const F = (o = x.sku) == null ? void 0 : o._id;
|
|
2463
|
+
F && (q.has(F) ? Z[F] = x : de.push(x));
|
|
2464
|
+
}
|
|
2465
|
+
f.received = _.map((x) => {
|
|
2466
|
+
const F = Z[x.sku._id];
|
|
2467
|
+
return F ? { ...F } : {
|
|
2468
|
+
// Propagate the stable id so V2 submissions match this existing PO line
|
|
2469
|
+
// instead of the backend treating it as a new extra item (see CreateForm.vue).
|
|
2470
|
+
...a && x.id ? { id: x.id } : {},
|
|
2471
|
+
sku: x.sku,
|
|
2472
|
+
amount: Ne.fromNumber(0),
|
|
2473
|
+
measurement: x.measurement ?? null
|
|
2474
|
+
};
|
|
2475
|
+
});
|
|
2476
|
+
const ke = {};
|
|
2477
|
+
for (let x = 0; x < _.length; x++)
|
|
2478
|
+
(l = Z[_[x].sku._id]) != null && l.cost && (ke[x] = !0);
|
|
2479
|
+
J.value = ke, B.value = [];
|
|
2480
|
+
const Re = he.value;
|
|
2481
|
+
for (const x of de) {
|
|
2482
|
+
const F = Re.find((Q) => {
|
|
2483
|
+
var ve;
|
|
2484
|
+
return Q.sku._id === ((ve = x.sku) == null ? void 0 : ve._id);
|
|
2485
|
+
});
|
|
2486
|
+
B.value.push({
|
|
2487
|
+
skuId: ((k = x.sku) == null ? void 0 : k._id) ?? null,
|
|
2488
|
+
costEnabled: !!x.cost,
|
|
2489
|
+
locked: !0,
|
|
2490
|
+
quantityLocked: !0,
|
|
2491
|
+
historyItem: F
|
|
2492
|
+
}), f.received.push({ ...x });
|
|
2493
|
+
}
|
|
2494
|
+
if (Re.length) {
|
|
2495
|
+
const x = new Set(de.map((F) => {
|
|
2496
|
+
var Q;
|
|
2497
|
+
return (Q = F.sku) == null ? void 0 : Q._id;
|
|
2498
|
+
}));
|
|
2499
|
+
for (const F of Re)
|
|
2500
|
+
x.has(F.sku._id) || (B.value.push({
|
|
2501
|
+
skuId: F.sku._id,
|
|
2502
|
+
costEnabled: !1,
|
|
2503
|
+
locked: !0,
|
|
2504
|
+
historyItem: F
|
|
2505
|
+
}), f.received.push({
|
|
2506
|
+
...a && F.id ? { id: F.id } : {},
|
|
2507
|
+
sku: F.sku,
|
|
2508
|
+
amount: Ne.fromNumber(0),
|
|
2509
|
+
measurement: F.measurement ?? null
|
|
2510
|
+
}));
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
);
|
|
2514
|
+
const P = se(!1);
|
|
2515
|
+
function le() {
|
|
2516
|
+
P.value = !0, C.updateDeliveryOrder({
|
|
2517
|
+
deliveryOrder: {
|
|
2518
|
+
...s.deliveryOrder,
|
|
2519
|
+
...f,
|
|
2520
|
+
priceAdjustments: A.value.state().adjustments
|
|
2521
|
+
},
|
|
2522
|
+
purchaseOrderId: s.purchaseOrder._id,
|
|
2523
|
+
purchaseOrderRev: s.purchaseOrder._rev
|
|
2524
|
+
}).then(() => {
|
|
2525
|
+
p.open(
|
|
2526
|
+
{
|
|
2527
|
+
title: "Success",
|
|
2528
|
+
message: `PO# ${s.purchaseOrder.seqNumber} Changes have been saved`,
|
|
2529
|
+
type: "success"
|
|
2530
|
+
},
|
|
2531
|
+
1e4
|
|
2532
|
+
), u.value = !1, S("submitted");
|
|
2533
|
+
}).finally(() => {
|
|
2534
|
+
P.value = !1;
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
return ($, _) => {
|
|
2538
|
+
const q = te("FmButton"), Z = te("FmStepperField"), de = te("FmSwitch"), ke = te("FmSelect"), Re = te("FmTextField"), o = te("FmDialog");
|
|
2539
|
+
return i(), ye(o, {
|
|
2540
|
+
modelValue: u.value,
|
|
2541
|
+
"onUpdate:modelValue": _[1] || (_[1] = (l) => u.value = l),
|
|
2542
|
+
overlay: !0,
|
|
2543
|
+
"min-width": 800
|
|
2544
|
+
}, {
|
|
2545
|
+
"dialog-button": ie(() => [
|
|
2546
|
+
v(re) ? (i(), ye(q, {
|
|
2547
|
+
key: 0,
|
|
2548
|
+
variant: "plain",
|
|
2549
|
+
label: "Edit",
|
|
2550
|
+
size: "md",
|
|
2551
|
+
"prepend-icon": "edit"
|
|
2552
|
+
})) : V("", !0)
|
|
2553
|
+
]),
|
|
2554
|
+
"dialog-header": ie(() => [
|
|
2555
|
+
e("div", null, "Received on " + b(v(tt)(s.deliveryOrder.createdAt)), 1)
|
|
2556
|
+
]),
|
|
2557
|
+
"dialog-footer": ie(() => [
|
|
2558
|
+
T(q, {
|
|
2559
|
+
class: "ml-auto",
|
|
2560
|
+
label: "Apply changes",
|
|
2561
|
+
size: "md",
|
|
2562
|
+
variant: "destructive",
|
|
2563
|
+
disabled: P.value,
|
|
2564
|
+
loading: P.value,
|
|
2565
|
+
onClick: le
|
|
2566
|
+
}, null, 8, ["disabled", "loading"])
|
|
2567
|
+
]),
|
|
2568
|
+
default: ie(() => [
|
|
2569
|
+
e("div", xo, [
|
|
2570
|
+
e("div", wo, [
|
|
2571
|
+
_[2] || (_[2] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Adjustment date", -1)),
|
|
2572
|
+
e("div", $o, b(s.deliveryOrder.adjustment ? v(tt)(new Date(v(mt)(s.deliveryOrder.adjustment))) : "-"), 1)
|
|
2573
|
+
]),
|
|
2574
|
+
e("div", Co, [
|
|
2575
|
+
_[4] || (_[4] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
|
|
2576
|
+
(i(!0), y($e, null, Ie(s.purchaseOrder.items, (l, k) => {
|
|
2577
|
+
var x;
|
|
2578
|
+
return i(), y("div", { key: k }, [
|
|
2579
|
+
e("div", Ao, [
|
|
2580
|
+
e("div", Do, [
|
|
2581
|
+
e("span", Ro, b(l.sku.name), 1),
|
|
2582
|
+
e("span", No, b(l.sku.code), 1)
|
|
2583
|
+
]),
|
|
2584
|
+
e("div", Po, [
|
|
2585
|
+
T(Z, {
|
|
2586
|
+
label: "Receive Quantity",
|
|
2587
|
+
modelValue: oe.value[k].value,
|
|
2588
|
+
"onUpdate:modelValue": (F) => oe.value[k].value = F,
|
|
2589
|
+
"append-text": ((x = l.measurement) == null ? void 0 : x.abbrev) ?? l.sku.unit.abbrev,
|
|
2590
|
+
"helper-text": L(k, l)
|
|
2591
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text", "helper-text"]),
|
|
2592
|
+
v(E) ? (i(), y("div", Fo, [
|
|
2593
|
+
T(de, {
|
|
2594
|
+
"model-value": J.value[k],
|
|
2595
|
+
"onUpdate:modelValue": (F) => Ae(k),
|
|
2596
|
+
size: "sm"
|
|
2597
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
2598
|
+
_[3] || (_[3] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
|
|
2599
|
+
])) : V("", !0),
|
|
2600
|
+
v(E) && J.value[k] ? (i(), ye(Z, {
|
|
2601
|
+
key: 1,
|
|
2602
|
+
modelValue: Se.value[k].value,
|
|
2603
|
+
"onUpdate:modelValue": (F) => Se.value[k].value = F,
|
|
2604
|
+
label: "Total Cost",
|
|
2605
|
+
step: 1e-4,
|
|
2606
|
+
min: 0,
|
|
2607
|
+
placeholder: "0.0000",
|
|
2608
|
+
size: "sm",
|
|
2609
|
+
"append-text": v(Ce)()
|
|
2610
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : V("", !0)
|
|
2611
|
+
])
|
|
2612
|
+
]),
|
|
2613
|
+
k < s.purchaseOrder.items.length - 1 ? (i(), y("div", Io)) : V("", !0)
|
|
2614
|
+
]);
|
|
2615
|
+
}), 128))
|
|
2616
|
+
]),
|
|
2617
|
+
e("div", To, [
|
|
2618
|
+
e("div", Eo, [
|
|
2619
|
+
_[5] || (_[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Extra items", -1)),
|
|
2620
|
+
T(q, {
|
|
2621
|
+
variant: "tertiary",
|
|
2622
|
+
label: "Add item",
|
|
2623
|
+
"prepend-icon": "add",
|
|
2624
|
+
size: "md",
|
|
2625
|
+
onClick: R
|
|
2626
|
+
})
|
|
2627
|
+
]),
|
|
2628
|
+
B.value.length === 0 ? (i(), y("div", qo, " No extra items added ")) : V("", !0),
|
|
2629
|
+
(i(!0), y($e, null, Ie(B.value, (l, k) => {
|
|
2630
|
+
var x, F;
|
|
2631
|
+
return i(), y("div", { key: k }, [
|
|
2632
|
+
e("div", Vo, [
|
|
2633
|
+
e("div", Lo, [
|
|
2634
|
+
T(ke, {
|
|
2635
|
+
"model-value": l.skuId,
|
|
2636
|
+
"onUpdate:modelValue": (Q) => j(k, Q),
|
|
2637
|
+
label: "Ingredient",
|
|
2638
|
+
items: ge.value,
|
|
2639
|
+
searchable: "",
|
|
2640
|
+
searchTarget: "label",
|
|
2641
|
+
placeholder: "Select ingredient",
|
|
2642
|
+
disabled: l.locked
|
|
2643
|
+
}, null, 8, ["model-value", "onUpdate:modelValue", "items", "disabled"])
|
|
2644
|
+
]),
|
|
2645
|
+
e("div", jo, [
|
|
2646
|
+
T(Z, {
|
|
2647
|
+
label: "Receive Quantity",
|
|
2648
|
+
modelValue: fe.value[k].value,
|
|
2649
|
+
"onUpdate:modelValue": (Q) => fe.value[k].value = Q,
|
|
2650
|
+
"append-text": l.skuId ? ((F = (x = v(d).skuById[l.skuId]) == null ? void 0 : x.unit) == null ? void 0 : F.abbrev) ?? "" : "",
|
|
2651
|
+
"helper-text": X(l, k),
|
|
2652
|
+
disabled: l.quantityLocked || !l.skuId
|
|
2653
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text", "helper-text", "disabled"]),
|
|
2654
|
+
v(E) ? (i(), y("div", Uo, [
|
|
2655
|
+
T(de, {
|
|
2656
|
+
"model-value": l.costEnabled,
|
|
2657
|
+
"onUpdate:modelValue": (Q) => D(k),
|
|
2658
|
+
size: "sm"
|
|
2659
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
2660
|
+
_[6] || (_[6] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
|
|
2661
|
+
])) : V("", !0),
|
|
2662
|
+
v(E) && l.costEnabled ? (i(), ye(Z, {
|
|
2663
|
+
key: 1,
|
|
2664
|
+
modelValue: xe.value[k].value,
|
|
2665
|
+
"onUpdate:modelValue": (Q) => xe.value[k].value = Q,
|
|
2666
|
+
label: "Total Cost",
|
|
2667
|
+
step: 1e-4,
|
|
2668
|
+
min: 0,
|
|
2669
|
+
placeholder: "0.0000",
|
|
2670
|
+
size: "sm",
|
|
2671
|
+
"append-text": v(Ce)()
|
|
2672
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : V("", !0)
|
|
2673
|
+
]),
|
|
2674
|
+
l.locked ? V("", !0) : (i(), ye(q, {
|
|
2675
|
+
key: 0,
|
|
2676
|
+
variant: "tertiary",
|
|
2677
|
+
"prepend-icon": "delete",
|
|
2678
|
+
size: "md",
|
|
2679
|
+
class: "mt-6",
|
|
2680
|
+
onClick: (Q) => w(k)
|
|
2681
|
+
}, null, 8, ["onClick"]))
|
|
2682
|
+
]),
|
|
2683
|
+
k < B.value.length - 1 ? (i(), y("div", Mo)) : V("", !0)
|
|
2684
|
+
]);
|
|
2685
|
+
}), 128))
|
|
2686
|
+
]),
|
|
2687
|
+
e("div", Bo, [
|
|
2688
|
+
_[7] || (_[7] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
|
|
2689
|
+
e("div", zo, [
|
|
2690
|
+
T(Re, {
|
|
2691
|
+
modelValue: v(f).deliveryOrderNumber,
|
|
2692
|
+
"onUpdate:modelValue": _[0] || (_[0] = (l) => v(f).deliveryOrderNumber = l),
|
|
2693
|
+
size: "md",
|
|
2694
|
+
placeholder: s.deliveryOrder.deliveryOrderNumber
|
|
2695
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
2696
|
+
])
|
|
2697
|
+
]),
|
|
2698
|
+
e("div", Ko, [
|
|
2699
|
+
_[8] || (_[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
|
|
2700
|
+
e("div", Ho, b(s.deliveryOrder.remark || "N/A"), 1)
|
|
2701
|
+
]),
|
|
2702
|
+
v(n).enablePurchaseOrderPriceAdjustment ? (i(), ye(Ft, {
|
|
2703
|
+
key: 0,
|
|
2704
|
+
controller: v(A),
|
|
2705
|
+
state: v(N)
|
|
2706
|
+
}, null, 8, ["controller", "state"])) : V("", !0),
|
|
2707
|
+
M.value >= 0 ? (i(), y("div", Go, [
|
|
2708
|
+
_[9] || (_[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Fulfilment's sequence", -1)),
|
|
2709
|
+
e("div", Wo, b(M.value + 1), 1)
|
|
2710
|
+
])) : V("", !0)
|
|
2711
|
+
])
|
|
2712
|
+
]),
|
|
2713
|
+
_: 1
|
|
2714
|
+
}, 8, ["modelValue"]);
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
}), Yo = { class: "flex flex-col gap-3" }, Jo = { class: "flex flex-col gap-4" }, Zo = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, Xo = {
|
|
2718
|
+
key: 0,
|
|
2719
|
+
class: "flex flex-col gap-4"
|
|
2720
|
+
}, en = { class: "flex items-center justify-between" }, tn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, sn = {
|
|
2721
|
+
key: 0,
|
|
2722
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
2723
|
+
}, rn = { class: "flex gap-4" }, on = { class: "flex-1" }, nn = { class: "flex-1" }, an = {
|
|
2724
|
+
key: 0,
|
|
2725
|
+
class: "flex items-center text-fm-color-system-error-300"
|
|
2726
|
+
}, ln = { class: "fm-typo-en-body-md-400" }, un = { class: "flex flex-col gap-4" }, cn = { class: "flex justify-between items-start py-1 gap-4" }, dn = { class: "flex flex-col flex-1 min-w-0" }, mn = { class: "fm-typo-en-body-lg-600 truncate" }, pn = { class: "fm-typo-en-body-md-400 truncate" }, fn = { class: "flex flex-col gap-2 items-end w-52 shrink-0" }, vn = {
|
|
2727
|
+
key: 0,
|
|
2728
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300 self-end text-right"
|
|
2729
|
+
}, yn = {
|
|
2730
|
+
key: 1,
|
|
2731
|
+
class: "flex items-center gap-2"
|
|
2732
|
+
}, hn = {
|
|
2733
|
+
key: 0,
|
|
2734
|
+
class: "border-b border-fm-color-stroke-secondary"
|
|
2735
|
+
}, bn = { class: "flex flex-col gap-4" }, gn = { class: "flex items-center justify-between" }, _n = {
|
|
2736
|
+
key: 0,
|
|
2737
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-tertiary"
|
|
2738
|
+
}, Sn = { class: "flex justify-between items-start py-1 gap-4" }, kn = { class: "flex-1 min-w-0 flex flex-col gap-2" }, On = { class: "flex flex-col gap-2 items-end w-52 shrink-0" }, xn = {
|
|
2739
|
+
key: 0,
|
|
2740
|
+
class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300 self-end text-right"
|
|
2741
|
+
}, wn = {
|
|
2742
|
+
key: 1,
|
|
2743
|
+
class: "flex items-center gap-2"
|
|
2744
|
+
}, $n = {
|
|
2745
|
+
key: 0,
|
|
2746
|
+
class: "border-b border-fm-color-stroke-secondary"
|
|
2747
|
+
}, Cn = { class: "flex flex-col gap-4" }, An = { class: "flex flex-col gap-4" }, Dn = { class: "flex flex-col gap-4" }, Rn = { class: "flex flex-col gap-4 fm-typo-en-body-lg-600" }, ss = "Will be ignored on save (zero or negative quantity)", Nn = /* @__PURE__ */ qe({
|
|
2748
|
+
__name: "CreateForm",
|
|
2749
|
+
props: {
|
|
2750
|
+
purchaseOrder: {},
|
|
2751
|
+
receivedInfoMap: {},
|
|
2752
|
+
receivedMap: {}
|
|
2753
|
+
},
|
|
2754
|
+
emits: ["submitted"],
|
|
2755
|
+
setup(m, { emit: t }) {
|
|
2756
|
+
var ve, I, me, ne;
|
|
2757
|
+
const { t: r } = ht(), n = se(!1), p = bt(), u = m, d = t, s = is("", {
|
|
2758
|
+
default: {
|
|
2759
|
+
deliveryOrderNumber: "",
|
|
2760
|
+
remark: "",
|
|
2761
|
+
received: (u.purchaseOrder.itemsAtSubmission ?? u.purchaseOrder.items).map((g) => {
|
|
2762
|
+
var c;
|
|
2763
|
+
return {
|
|
2764
|
+
// Propagate the stable id so V2 submissions match this existing PO line instead
|
|
2765
|
+
// of the backend's classify-received.ts treating it as a new extra item (which
|
|
2766
|
+
// appends a duplicate item record with quantity = this delivery's amount, on
|
|
2767
|
+
// every single delivery — inflating the PO's total ordered quantity forever).
|
|
2768
|
+
...(((c = u.purchaseOrder) == null ? void 0 : c.version) ?? Me.enum[1]) === Me.enum[2] && g.id ? { id: g.id } : {},
|
|
2769
|
+
sku: g.sku,
|
|
2770
|
+
amount: Ne.fromNumber(0),
|
|
2771
|
+
measurement: g.measurement
|
|
2772
|
+
};
|
|
2773
|
+
}),
|
|
2774
|
+
createdBy: {
|
|
2775
|
+
id: ((ve = p.sessionUser.value) == null ? void 0 : ve.id) || "",
|
|
2776
|
+
name: ((I = p.sessionUser.value) == null ? void 0 : I.displayName) || ""
|
|
2777
|
+
},
|
|
2778
|
+
createdAt: ""
|
|
2779
|
+
}
|
|
2780
|
+
}), a = et(), S = gt(), f = Ze(), C = Dt(), {
|
|
2781
|
+
controller: A,
|
|
2782
|
+
state: N,
|
|
2783
|
+
reset: h
|
|
2784
|
+
} = It({ currency: Ce() }), M = ((me = u.purchaseOrder) == null ? void 0 : me.supplier.internal) != null, E = M && f.enablePOSTransferRequireFulfillment, re = f.enablePortalDeliveryOrderWrite && (u.purchaseOrder.status === _e.Enum.RECEIVING || u.purchaseOrder.status === _e.Enum.COMPLETE) && (M ? !E : !0), J = f.enablePurchaseOrderReceiveWithCustomCost, W = f.enableBackdateReceive, he = se({}), pe = H(
|
|
2785
|
+
() => u.purchaseOrder.itemsAtSubmission ?? u.purchaseOrder.items
|
|
2786
|
+
), oe = H(() => _s(u.purchaseOrder)), Se = H(
|
|
2787
|
+
() => Ss(u.purchaseOrder, oe.value)
|
|
2788
|
+
);
|
|
2789
|
+
function Ae(g) {
|
|
2790
|
+
return g.sku._id ?? null;
|
|
2791
|
+
}
|
|
2792
|
+
const B = (((ne = u.purchaseOrder) == null ? void 0 : ne.version) ?? Me.enum[1]) === Me.enum[2], ge = Je(), R = H({
|
|
2793
|
+
get() {
|
|
2794
|
+
if (!s.createdAt) return "";
|
|
2795
|
+
const g = new Date(s.createdAt), c = g.getFullYear(), O = String(g.getMonth() + 1).padStart(2, "0"), G = String(g.getDate()).padStart(2, "0");
|
|
2796
|
+
return `${c}-${O}-${G}`;
|
|
2797
|
+
},
|
|
2798
|
+
set(g) {
|
|
2799
|
+
if (g) {
|
|
2800
|
+
const c = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [O, G, K] = g.split("-");
|
|
2801
|
+
c.setFullYear(parseInt(O)), c.setMonth(parseInt(G) - 1), c.setDate(parseInt(K)), s.createdAt = c.toISOString();
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
}), w = H({
|
|
2805
|
+
get() {
|
|
2806
|
+
if (!s.createdAt) return "";
|
|
2807
|
+
const g = new Date(s.createdAt), c = String(g.getHours()).padStart(2, "0"), O = String(g.getMinutes()).padStart(2, "0");
|
|
2808
|
+
return `${c}:${O}`;
|
|
2809
|
+
},
|
|
2810
|
+
set(g) {
|
|
2811
|
+
if (g) {
|
|
2812
|
+
const c = s.createdAt ? new Date(s.createdAt) : /* @__PURE__ */ new Date(), [O, G] = g.split(":");
|
|
2813
|
+
c.setHours(parseInt(O)), c.setMinutes(parseInt(G)), s.createdAt = c.toISOString();
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
}), j = H(() => {
|
|
2817
|
+
const g = mt(u.purchaseOrder._id);
|
|
2818
|
+
if (!g) return "";
|
|
2819
|
+
const c = new Date(g), O = c.getFullYear(), G = String(c.getMonth() + 1).padStart(2, "0"), K = String(c.getDate()).padStart(2, "0");
|
|
2820
|
+
return `${O}-${G}-${K}`;
|
|
2821
|
+
}), L = H(() => {
|
|
2822
|
+
const g = mt(u.purchaseOrder._id);
|
|
2823
|
+
return g ? new Date(g) : null;
|
|
2824
|
+
}), X = H(() => {
|
|
2825
|
+
if (!R.value || !w.value || !L.value) return null;
|
|
2826
|
+
if (/* @__PURE__ */ new Date(`${R.value}T${w.value}:00`) < L.value) {
|
|
2827
|
+
const c = j.value, O = L.value.getHours(), G = L.value.getMinutes(), K = O >= 12 ? "PM" : "AM", Oe = O % 12 || 12, z = `${String(Oe).padStart(2, "0")}:${String(G).padStart(2, "0")} ${K}`;
|
|
2828
|
+
return `Delivery date & time cannot be earlier than order creation (${c} ${z})`;
|
|
2829
|
+
}
|
|
2830
|
+
return null;
|
|
2831
|
+
}), fe = H(() => X.value || $.value.some((c) => !c.skuId) ? !1 : s.received.some((c) => {
|
|
2832
|
+
const O = c.amount;
|
|
2833
|
+
return O ? +we(O) > 0 : !1;
|
|
2834
|
+
}));
|
|
2835
|
+
function xe(g) {
|
|
2836
|
+
var G;
|
|
2837
|
+
const c = (G = u.receivedInfoMap[g.sku._id]) == null ? void 0 : G.received, O = c != null ? Ne.toFormatString({ value: c }) : "0";
|
|
2838
|
+
return `${r("inventory.transfer.receiveRequest.details.received")} ${O} / ${ft(g.quantity, g.sku.unit, g.measurement)}`;
|
|
2839
|
+
}
|
|
2840
|
+
function D() {
|
|
2841
|
+
s.createdAt = "";
|
|
2842
|
+
}
|
|
2843
|
+
const P = H(() => pe.value.map((g, c) => H({
|
|
2844
|
+
get: () => {
|
|
2845
|
+
var G;
|
|
2846
|
+
const O = (G = s.received[c]) == null ? void 0 : G.amount;
|
|
2847
|
+
return O ? +we(O) : 0;
|
|
2848
|
+
},
|
|
2849
|
+
set: (O) => {
|
|
2850
|
+
var K;
|
|
2851
|
+
const G = ((K = pe.value[c]) == null ? void 0 : K.sku.unit.precision) ?? 2;
|
|
2852
|
+
s.received[c].amount = Ye(O, G);
|
|
2853
|
+
}
|
|
2854
|
+
})));
|
|
2855
|
+
function le(g) {
|
|
2856
|
+
const c = !he.value[g];
|
|
2857
|
+
if (he.value[g] = c, c) {
|
|
2858
|
+
const O = pe.value[g];
|
|
2859
|
+
O.totalCost ? s.received[g].cost = {
|
|
2860
|
+
currency: O.totalCost.currency,
|
|
2861
|
+
amount: O.totalCost.amount,
|
|
2862
|
+
precision: 4
|
|
2863
|
+
// Standardize to 4 decimals
|
|
2864
|
+
} : s.received[g].cost = {
|
|
2865
|
+
currency: Ce(),
|
|
2866
|
+
amount: 0,
|
|
2867
|
+
precision: 4
|
|
2868
|
+
};
|
|
2869
|
+
} else
|
|
2870
|
+
delete s.received[g].cost;
|
|
2871
|
+
}
|
|
2872
|
+
const ce = H(() => pe.value.map((g, c) => H({
|
|
2873
|
+
get: () => {
|
|
2874
|
+
var G;
|
|
2875
|
+
const O = (G = s.received[c]) == null ? void 0 : G.cost;
|
|
2876
|
+
return O ? +we(O) : 0;
|
|
2877
|
+
},
|
|
2878
|
+
set: (O) => {
|
|
2879
|
+
s.received[c].cost = {
|
|
2880
|
+
currency: Ce(),
|
|
2881
|
+
...Ye(O, 4)
|
|
2882
|
+
};
|
|
2883
|
+
}
|
|
2884
|
+
}))), $ = se([]), _ = H(
|
|
2885
|
+
() => C.skus.filter((g) => !g.isInactive).map((g) => ({ label: `${g.name} (${g.code})`, value: g._id }))
|
|
2886
|
+
), q = H(() => pe.value.length);
|
|
2887
|
+
function Z() {
|
|
2888
|
+
$.value.push({ skuId: null, stableKey: null, costEnabled: !1 }), s.received.push({
|
|
2889
|
+
sku: null,
|
|
2890
|
+
amount: Ne.fromNumber(0),
|
|
2891
|
+
measurement: null
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
function de(g) {
|
|
2895
|
+
$.value.splice(g, 1), s.received.splice(q.value + g, 1);
|
|
2896
|
+
}
|
|
2897
|
+
function ke(g, c) {
|
|
2898
|
+
$.value[g].skuId = c;
|
|
2899
|
+
const O = c ? C.skuById[c] : null;
|
|
2900
|
+
s.received[q.value + g].sku = O;
|
|
2901
|
+
}
|
|
2902
|
+
function Re(g) {
|
|
2903
|
+
const c = g.stableKey;
|
|
2904
|
+
if (c && Se.value[c]) {
|
|
2905
|
+
const O = Se.value[c], G = Ne.toFormatString({ value: O.received });
|
|
2906
|
+
return `${r("inventory.transfer.receiveRequest.details.received")} ${G}`;
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
const o = H(
|
|
2910
|
+
() => $.value.map((g, c) => {
|
|
2911
|
+
const O = q.value + c;
|
|
2912
|
+
return H({
|
|
2913
|
+
get: () => {
|
|
2914
|
+
var K;
|
|
2915
|
+
const G = (K = s.received[O]) == null ? void 0 : K.amount;
|
|
2916
|
+
return G ? +we(G) : 0;
|
|
2917
|
+
},
|
|
2918
|
+
set: (G) => {
|
|
2919
|
+
var z, Y, be;
|
|
2920
|
+
const K = $.value[c], Oe = ((z = K == null ? void 0 : K.historyItem) == null ? void 0 : z.sku.unit.precision) ?? (K != null && K.skuId ? (be = (Y = C.skuById[K.skuId]) == null ? void 0 : Y.unit) == null ? void 0 : be.precision : void 0) ?? 2;
|
|
2921
|
+
s.received[O].amount = Ye(G, Oe);
|
|
2922
|
+
}
|
|
2923
|
+
});
|
|
2924
|
+
})
|
|
2925
|
+
), l = H(
|
|
2926
|
+
() => $.value.map((g, c) => {
|
|
2927
|
+
const O = q.value + c;
|
|
2928
|
+
return H({
|
|
2929
|
+
get: () => {
|
|
2930
|
+
var K;
|
|
2931
|
+
const G = (K = s.received[O]) == null ? void 0 : K.cost;
|
|
2932
|
+
return G ? +we(G) : 0;
|
|
2933
|
+
},
|
|
2934
|
+
set: (G) => {
|
|
2935
|
+
s.received[O].cost = {
|
|
2936
|
+
currency: Ce(),
|
|
2937
|
+
...Ye(G, 4)
|
|
2938
|
+
};
|
|
2939
|
+
}
|
|
2940
|
+
});
|
|
2941
|
+
})
|
|
2942
|
+
);
|
|
2943
|
+
function k(g) {
|
|
2944
|
+
const c = $.value[g], O = q.value + g;
|
|
2945
|
+
c.costEnabled = !c.costEnabled, c.costEnabled ? s.received[O].cost = { currency: Ce(), amount: 0, precision: 4 } : delete s.received[O].cost;
|
|
2946
|
+
}
|
|
2947
|
+
function x() {
|
|
2948
|
+
S.open({
|
|
2949
|
+
title: "Confirm Create Delivery Order",
|
|
2950
|
+
message: `Are you sure you want to create delivery order for PO# ${u.purchaseOrder.seqNumber}?`,
|
|
2951
|
+
primaryActions: {
|
|
2952
|
+
text: "Create",
|
|
2953
|
+
close: !0,
|
|
2954
|
+
variant: "primary"
|
|
2955
|
+
},
|
|
2956
|
+
secondaryActions: {
|
|
2957
|
+
text: "Cancel",
|
|
2958
|
+
close: !0
|
|
2959
|
+
}
|
|
2960
|
+
}).onPrimary(() => Q());
|
|
2961
|
+
}
|
|
2962
|
+
const F = se(!1);
|
|
2963
|
+
function Q() {
|
|
2964
|
+
F.value = !0, a.createDeliveryOrder({
|
|
2965
|
+
deliveryOrder: {
|
|
2966
|
+
...s,
|
|
2967
|
+
priceAdjustments: A.value.state().adjustments
|
|
2968
|
+
},
|
|
2969
|
+
purchaseOrderId: u.purchaseOrder._id,
|
|
2970
|
+
purchaseOrderRev: u.purchaseOrder._rev,
|
|
2971
|
+
currency: Ce()
|
|
2972
|
+
}).then(() => {
|
|
2973
|
+
ge.open(
|
|
2974
|
+
{
|
|
2975
|
+
title: "Success",
|
|
2976
|
+
message: `New delivery order created for PO# ${u.purchaseOrder.seqNumber}`,
|
|
2977
|
+
type: "success"
|
|
2978
|
+
},
|
|
2979
|
+
1e4
|
|
2980
|
+
), n.value = !1, d("submitted");
|
|
2981
|
+
}).finally(() => {
|
|
2982
|
+
F.value = !1;
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2985
|
+
return Xe(
|
|
2986
|
+
() => n.value,
|
|
2987
|
+
(g) => {
|
|
2988
|
+
var G;
|
|
2989
|
+
if (!g) {
|
|
2990
|
+
$.value = [], h([]), s.received = pe.value.map((K) => ({
|
|
2991
|
+
...B && K.id ? { id: K.id } : {},
|
|
2992
|
+
sku: K.sku,
|
|
2993
|
+
amount: Ne.fromNumber(0),
|
|
2994
|
+
measurement: K.measurement
|
|
2995
|
+
}));
|
|
2996
|
+
return;
|
|
2997
|
+
}
|
|
2998
|
+
const c = pe.value;
|
|
2999
|
+
for (let K = 0; K < c.length; K++) {
|
|
3000
|
+
const Oe = c[K], Y = (((G = u.purchaseOrder) == null ? void 0 : G.version) ?? Me.enum[1]) === Me.enum[2] ? Oe.id : Oe.sku._id, be = u.receivedMap[Y], Pe = +we(Oe.quantity), Te = be ? +we(be.received) : 0;
|
|
3001
|
+
P.value[K].value = Math.max(0, Pe - Te);
|
|
3002
|
+
}
|
|
3003
|
+
const O = oe.value;
|
|
3004
|
+
if (O.length) {
|
|
3005
|
+
for (const K of O) {
|
|
3006
|
+
const Oe = Ae(K);
|
|
3007
|
+
$.value.push({
|
|
3008
|
+
skuId: K.sku._id,
|
|
3009
|
+
stableKey: Oe,
|
|
3010
|
+
costEnabled: !1,
|
|
3011
|
+
historyItem: K
|
|
3012
|
+
}), s.received.push({
|
|
3013
|
+
// Propagate the stable id so V2 submissions align with the existing PO line.
|
|
3014
|
+
...B && K.id ? { id: K.id } : {},
|
|
3015
|
+
sku: K.sku,
|
|
3016
|
+
amount: Ne.fromNumber(0),
|
|
3017
|
+
measurement: K.measurement ?? null
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
for (let K = 0; K < O.length; K++) {
|
|
3021
|
+
const Oe = Ae(O[K]), z = Oe ? Se.value[Oe] : void 0;
|
|
3022
|
+
if (z) {
|
|
3023
|
+
const Y = Math.pow(10, z.remaining.precision ?? 2);
|
|
3024
|
+
o.value[K].value = Math.max(0, z.remaining.amount / Y);
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
), (g, c) => {
|
|
3030
|
+
const O = te("FmButton"), G = te("FmDatePicker"), K = te("FmTimePicker"), Oe = te("FmIcon"), z = te("FmStepperField"), Y = te("FmSwitch"), be = te("FmSelect"), Pe = te("FmTextField"), Te = te("FmDialog");
|
|
3031
|
+
return i(), ye(Te, {
|
|
3032
|
+
modelValue: n.value,
|
|
3033
|
+
"onUpdate:modelValue": c[4] || (c[4] = (Fe) => n.value = Fe),
|
|
3034
|
+
overlay: !0,
|
|
3035
|
+
"min-width": 800
|
|
3036
|
+
}, {
|
|
3037
|
+
"dialog-button": ie(() => [
|
|
3038
|
+
v(re) ? (i(), ye(O, {
|
|
3039
|
+
key: 0,
|
|
3040
|
+
variant: "primary",
|
|
3041
|
+
label: "Create",
|
|
3042
|
+
size: "md",
|
|
3043
|
+
"prepend-icon": "add",
|
|
3044
|
+
class: "w-full"
|
|
3045
|
+
})) : V("", !0)
|
|
3046
|
+
]),
|
|
3047
|
+
"dialog-header": ie(() => [
|
|
3048
|
+
e("div", null, "Order #" + b(u.purchaseOrder.seqNumber) + " (New Delivery Order)", 1)
|
|
3049
|
+
]),
|
|
3050
|
+
"dialog-footer": ie(() => [
|
|
3051
|
+
T(O, {
|
|
3052
|
+
class: "ml-auto",
|
|
3053
|
+
label: "Create",
|
|
3054
|
+
size: "md",
|
|
3055
|
+
variant: "destructive",
|
|
3056
|
+
disabled: !fe.value || F.value,
|
|
3057
|
+
loading: F.value,
|
|
3058
|
+
onClick: x
|
|
3059
|
+
}, null, 8, ["disabled", "loading"])
|
|
3060
|
+
]),
|
|
3061
|
+
default: ie(() => {
|
|
3062
|
+
var Fe;
|
|
3063
|
+
return [
|
|
3064
|
+
e("div", Yo, [
|
|
3065
|
+
e("div", Jo, [
|
|
3066
|
+
c[5] || (c[5] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Received by", -1)),
|
|
3067
|
+
e("div", Zo, b((Fe = v(p).sessionUser.value) == null ? void 0 : Fe.displayName), 1)
|
|
3068
|
+
]),
|
|
3069
|
+
v(W) ? (i(), y("div", Xo, [
|
|
3070
|
+
e("div", en, [
|
|
3071
|
+
e("div", tn, [
|
|
3072
|
+
c[6] || (c[6] = We(" Delivery Date & Time ")),
|
|
3073
|
+
!R.value && !w.value ? (i(), y("div", sn, " Leave blank to use current date & time ")) : V("", !0)
|
|
3074
|
+
]),
|
|
3075
|
+
R.value || w.value ? (i(), ye(O, {
|
|
3076
|
+
key: 0,
|
|
3077
|
+
variant: "tertiary",
|
|
3078
|
+
label: "Clear",
|
|
3079
|
+
"prepend-icon": "close",
|
|
3080
|
+
onClick: D
|
|
3081
|
+
})) : V("", !0)
|
|
3082
|
+
]),
|
|
3083
|
+
e("div", rn, [
|
|
3084
|
+
e("div", on, [
|
|
3085
|
+
T(G, {
|
|
3086
|
+
modelValue: R.value,
|
|
3087
|
+
"onUpdate:modelValue": c[0] || (c[0] = (ae) => R.value = ae)
|
|
3088
|
+
}, null, 8, ["modelValue"])
|
|
3089
|
+
]),
|
|
3090
|
+
e("div", nn, [
|
|
3091
|
+
T(K, {
|
|
3092
|
+
modelValue: w.value,
|
|
3093
|
+
"onUpdate:modelValue": c[1] || (c[1] = (ae) => w.value = ae)
|
|
3094
|
+
}, null, 8, ["modelValue"])
|
|
3095
|
+
])
|
|
3096
|
+
]),
|
|
3097
|
+
X.value ? (i(), y("div", an, [
|
|
3098
|
+
T(Oe, {
|
|
3099
|
+
name: "error",
|
|
3100
|
+
class: "inline-block mr-1",
|
|
3101
|
+
size: "sm"
|
|
3102
|
+
}),
|
|
3103
|
+
e("div", ln, b(X.value), 1)
|
|
3104
|
+
])) : V("", !0)
|
|
3105
|
+
])) : V("", !0),
|
|
3106
|
+
e("div", un, [
|
|
3107
|
+
c[8] || (c[8] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Items going to receive ", -1)),
|
|
3108
|
+
(i(!0), y($e, null, Ie(pe.value, (ae, ue) => {
|
|
3109
|
+
var Le;
|
|
3110
|
+
return i(), y("div", { key: ue }, [
|
|
3111
|
+
e("div", cn, [
|
|
3112
|
+
e("div", dn, [
|
|
3113
|
+
e("span", mn, b(ae.sku.name), 1),
|
|
3114
|
+
e("span", pn, b(ae.sku.code), 1)
|
|
3115
|
+
]),
|
|
3116
|
+
e("div", fn, [
|
|
3117
|
+
T(z, {
|
|
3118
|
+
label: "Receive Quantity",
|
|
3119
|
+
modelValue: P.value[ue].value,
|
|
3120
|
+
"onUpdate:modelValue": (Ve) => P.value[ue].value = Ve,
|
|
3121
|
+
"helper-text": xe(ae),
|
|
3122
|
+
"append-text": ((Le = ae.measurement) == null ? void 0 : Le.abbrev) ?? ae.sku.unit.abbrev
|
|
3123
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "helper-text", "append-text"]),
|
|
3124
|
+
P.value[ue].value <= 0 ? (i(), y("div", vn, b(ss))) : V("", !0),
|
|
3125
|
+
v(J) ? (i(), y("div", yn, [
|
|
3126
|
+
T(Y, {
|
|
3127
|
+
"model-value": he.value[ue],
|
|
3128
|
+
"onUpdate:modelValue": (Ve) => le(ue),
|
|
3129
|
+
size: "sm"
|
|
3130
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
3131
|
+
c[7] || (c[7] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
|
|
3132
|
+
])) : V("", !0),
|
|
3133
|
+
v(J) && he.value[ue] ? (i(), ye(z, {
|
|
3134
|
+
key: 2,
|
|
3135
|
+
modelValue: ce.value[ue].value,
|
|
3136
|
+
"onUpdate:modelValue": (Ve) => ce.value[ue].value = Ve,
|
|
3137
|
+
label: "Total Cost",
|
|
3138
|
+
step: 1e-4,
|
|
3139
|
+
min: 0,
|
|
3140
|
+
placeholder: "0.0000",
|
|
3141
|
+
size: "sm",
|
|
3142
|
+
"append-text": v(Ce)()
|
|
3143
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : V("", !0)
|
|
3144
|
+
])
|
|
3145
|
+
]),
|
|
3146
|
+
ue < pe.value.length - 1 ? (i(), y("div", hn)) : V("", !0)
|
|
3147
|
+
]);
|
|
3148
|
+
}), 128))
|
|
3149
|
+
]),
|
|
3150
|
+
e("div", bn, [
|
|
3151
|
+
e("div", gn, [
|
|
3152
|
+
c[9] || (c[9] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Extra items", -1)),
|
|
3153
|
+
T(O, {
|
|
3154
|
+
variant: "tertiary",
|
|
3155
|
+
label: "Add item",
|
|
3156
|
+
"prepend-icon": "add",
|
|
3157
|
+
size: "md",
|
|
3158
|
+
onClick: Z
|
|
3159
|
+
})
|
|
3160
|
+
]),
|
|
3161
|
+
$.value.length === 0 ? (i(), y("div", _n, " No extra items added ")) : V("", !0),
|
|
3162
|
+
(i(!0), y($e, null, Ie($.value, (ae, ue) => {
|
|
3163
|
+
var Le, Ve;
|
|
3164
|
+
return i(), y("div", { key: ue }, [
|
|
3165
|
+
e("div", Sn, [
|
|
3166
|
+
e("div", kn, [
|
|
3167
|
+
T(be, {
|
|
3168
|
+
"model-value": ae.skuId,
|
|
3169
|
+
"onUpdate:modelValue": (je) => ke(ue, je),
|
|
3170
|
+
label: "Ingredient",
|
|
3171
|
+
items: _.value,
|
|
3172
|
+
searchable: "",
|
|
3173
|
+
searchTarget: "label",
|
|
3174
|
+
placeholder: "Select ingredient",
|
|
3175
|
+
disabled: !!ae.historyItem
|
|
3176
|
+
}, null, 8, ["model-value", "onUpdate:modelValue", "items", "disabled"])
|
|
3177
|
+
]),
|
|
3178
|
+
e("div", On, [
|
|
3179
|
+
T(z, {
|
|
3180
|
+
label: "Receive Quantity",
|
|
3181
|
+
modelValue: o.value[ue].value,
|
|
3182
|
+
"onUpdate:modelValue": (je) => o.value[ue].value = je,
|
|
3183
|
+
"append-text": ae.skuId ? ((Ve = (Le = v(C).skuById[ae.skuId]) == null ? void 0 : Le.unit) == null ? void 0 : Ve.abbrev) ?? "" : "",
|
|
3184
|
+
"helper-text": Re(ae)
|
|
3185
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text", "helper-text"]),
|
|
3186
|
+
o.value[ue].value <= 0 ? (i(), y("div", xn, b(ss))) : V("", !0),
|
|
3187
|
+
v(J) ? (i(), y("div", wn, [
|
|
3188
|
+
T(Y, {
|
|
3189
|
+
"model-value": ae.costEnabled,
|
|
3190
|
+
"onUpdate:modelValue": (je) => k(ue),
|
|
3191
|
+
size: "sm"
|
|
3192
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
3193
|
+
c[10] || (c[10] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Override cost ", -1))
|
|
3194
|
+
])) : V("", !0),
|
|
3195
|
+
v(J) && ae.costEnabled ? (i(), ye(z, {
|
|
3196
|
+
key: 2,
|
|
3197
|
+
modelValue: l.value[ue].value,
|
|
3198
|
+
"onUpdate:modelValue": (je) => l.value[ue].value = je,
|
|
3199
|
+
label: "Total Cost",
|
|
3200
|
+
step: 1e-4,
|
|
3201
|
+
min: 0,
|
|
3202
|
+
placeholder: "0.0000",
|
|
3203
|
+
size: "sm",
|
|
3204
|
+
"append-text": v(Ce)()
|
|
3205
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "append-text"])) : V("", !0)
|
|
3206
|
+
]),
|
|
3207
|
+
ae.historyItem ? V("", !0) : (i(), ye(O, {
|
|
3208
|
+
key: 0,
|
|
3209
|
+
variant: "tertiary",
|
|
3210
|
+
"prepend-icon": "delete",
|
|
3211
|
+
size: "md",
|
|
3212
|
+
class: "mt-6",
|
|
3213
|
+
onClick: (je) => de(ue)
|
|
3214
|
+
}, null, 8, ["onClick"]))
|
|
3215
|
+
]),
|
|
3216
|
+
ue < $.value.length - 1 ? (i(), y("div", $n)) : V("", !0)
|
|
3217
|
+
]);
|
|
3218
|
+
}), 128))
|
|
3219
|
+
]),
|
|
3220
|
+
e("div", Cn, [
|
|
3221
|
+
c[11] || (c[11] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Delivery order no.", -1)),
|
|
3222
|
+
e("div", An, [
|
|
3223
|
+
T(Pe, {
|
|
3224
|
+
modelValue: v(s).deliveryOrderNumber,
|
|
3225
|
+
"onUpdate:modelValue": c[2] || (c[2] = (ae) => v(s).deliveryOrderNumber = ae),
|
|
3226
|
+
size: "md"
|
|
3227
|
+
}, null, 8, ["modelValue"])
|
|
3228
|
+
])
|
|
3229
|
+
]),
|
|
3230
|
+
e("div", Dn, [
|
|
3231
|
+
c[12] || (c[12] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Remark", -1)),
|
|
3232
|
+
e("div", Rn, [
|
|
3233
|
+
T(Pe, {
|
|
3234
|
+
modelValue: v(s).remark,
|
|
3235
|
+
"onUpdate:modelValue": c[3] || (c[3] = (ae) => v(s).remark = ae),
|
|
3236
|
+
size: "md"
|
|
3237
|
+
}, null, 8, ["modelValue"])
|
|
3238
|
+
])
|
|
3239
|
+
]),
|
|
3240
|
+
v(f).enablePurchaseOrderPriceAdjustment ? (i(), ye(Ft, {
|
|
3241
|
+
key: 1,
|
|
3242
|
+
controller: v(A),
|
|
3243
|
+
state: v(N)
|
|
3244
|
+
}, null, 8, ["controller", "state"])) : V("", !0)
|
|
3245
|
+
])
|
|
3246
|
+
];
|
|
3247
|
+
}),
|
|
3248
|
+
_: 1
|
|
3249
|
+
}, 8, ["modelValue"]);
|
|
3250
|
+
};
|
|
3251
|
+
}
|
|
3252
|
+
}), Pn = {
|
|
3253
|
+
key: 0,
|
|
3254
|
+
class: "flex flex-col gap-1"
|
|
3255
|
+
}, Fn = { class: "truncate" }, In = { class: "shrink-0" }, Tn = /* @__PURE__ */ qe({
|
|
3256
|
+
__name: "PriceAdjustmentList",
|
|
3257
|
+
props: {
|
|
3258
|
+
adjustments: {}
|
|
3259
|
+
},
|
|
3260
|
+
setup(m) {
|
|
3261
|
+
const t = m, r = H(() => t.adjustments ?? []);
|
|
3262
|
+
function n(p) {
|
|
3263
|
+
const u = p.amount < 0 ? "-" : "+", d = we({ ...p, amount: Math.abs(p.amount) });
|
|
3264
|
+
return `${u}${p.currency} ${d}`;
|
|
3265
|
+
}
|
|
3266
|
+
return (p, u) => r.value.length ? (i(), y("div", Pn, [
|
|
3267
|
+
(i(!0), y($e, null, Ie(r.value, (d) => (i(), y("div", {
|
|
3268
|
+
key: d.id,
|
|
3269
|
+
class: "flex justify-between gap-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
|
|
3270
|
+
}, [
|
|
3271
|
+
e("span", Fn, b(d.name), 1),
|
|
3272
|
+
e("span", In, b(n(d.dinero)), 1)
|
|
3273
|
+
]))), 128))
|
|
3274
|
+
])) : V("", !0);
|
|
3275
|
+
}
|
|
3276
|
+
}), En = { class: "flex flex-col gap-3" }, qn = /* @__PURE__ */ qe({
|
|
3277
|
+
__name: "PriceAdjustmentEditForm",
|
|
3278
|
+
props: {
|
|
3279
|
+
purchaseOrder: {}
|
|
3280
|
+
},
|
|
3281
|
+
emits: ["submitted"],
|
|
3282
|
+
setup(m, { emit: t }) {
|
|
3283
|
+
const r = m, n = t, p = et(), u = Je(), d = se(!1), s = se(!1), { controller: a, state: S, reset: f } = It({
|
|
3284
|
+
currency: Ce(),
|
|
3285
|
+
adjustments: r.purchaseOrder.priceAdjustments
|
|
3286
|
+
});
|
|
3287
|
+
Xe(
|
|
3288
|
+
() => d.value,
|
|
3289
|
+
(A) => {
|
|
3290
|
+
A && f(r.purchaseOrder.priceAdjustments);
|
|
3291
|
+
}
|
|
3292
|
+
);
|
|
3293
|
+
function C() {
|
|
3294
|
+
s.value = !0, p.updatePurchaseOrder({
|
|
3295
|
+
...r.purchaseOrder,
|
|
3296
|
+
priceAdjustments: a.value.state().adjustments
|
|
3297
|
+
}).then(() => {
|
|
3298
|
+
u.open(
|
|
3299
|
+
{
|
|
3300
|
+
title: "Success",
|
|
3301
|
+
message: `PO# ${r.purchaseOrder.seqNumber} price adjustments saved`,
|
|
3302
|
+
type: "success"
|
|
3303
|
+
},
|
|
3304
|
+
1e4
|
|
3305
|
+
), d.value = !1, n("submitted");
|
|
3306
|
+
}).finally(() => {
|
|
3307
|
+
s.value = !1;
|
|
3308
|
+
});
|
|
3309
|
+
}
|
|
3310
|
+
return (A, N) => {
|
|
3311
|
+
const h = te("FmButton"), M = te("FmDialog");
|
|
3312
|
+
return i(), ye(M, {
|
|
3313
|
+
modelValue: d.value,
|
|
3314
|
+
"onUpdate:modelValue": N[0] || (N[0] = (E) => d.value = E),
|
|
3315
|
+
overlay: !0,
|
|
3316
|
+
"min-width": 600
|
|
3317
|
+
}, {
|
|
3318
|
+
"dialog-button": ie(() => [
|
|
3319
|
+
T(h, {
|
|
3320
|
+
variant: "plain",
|
|
3321
|
+
label: "Edit price adjustments",
|
|
3322
|
+
size: "md",
|
|
3323
|
+
"prepend-icon": "edit"
|
|
3324
|
+
})
|
|
3325
|
+
]),
|
|
3326
|
+
"dialog-header": ie(() => [
|
|
3327
|
+
e("div", null, "Price adjustments — PO# " + b(r.purchaseOrder.seqNumber), 1)
|
|
3328
|
+
]),
|
|
3329
|
+
"dialog-footer": ie(() => [
|
|
3330
|
+
T(h, {
|
|
3331
|
+
class: "ml-auto",
|
|
3332
|
+
label: "Apply changes",
|
|
3333
|
+
size: "md",
|
|
3334
|
+
variant: "destructive",
|
|
3335
|
+
disabled: s.value,
|
|
3336
|
+
loading: s.value,
|
|
3337
|
+
onClick: C
|
|
3338
|
+
}, null, 8, ["disabled", "loading"])
|
|
3339
|
+
]),
|
|
3340
|
+
default: ie(() => [
|
|
3341
|
+
e("div", En, [
|
|
3342
|
+
T(Ft, {
|
|
3343
|
+
controller: v(a),
|
|
3344
|
+
state: v(S)
|
|
3345
|
+
}, null, 8, ["controller", "state"])
|
|
3346
|
+
])
|
|
3347
|
+
]),
|
|
3348
|
+
_: 1
|
|
3349
|
+
}, 8, ["modelValue"]);
|
|
3350
|
+
};
|
|
3351
|
+
}
|
|
3352
|
+
}), Vn = { class: "flex flex-row-reverse" }, Ln = {
|
|
3353
|
+
key: 0,
|
|
3354
|
+
class: "flex"
|
|
3355
|
+
}, jn = {
|
|
3356
|
+
key: 1,
|
|
3357
|
+
class: "border-t pt-6"
|
|
3358
|
+
}, Un = { class: "fm-typo-en-body-lg-600 mb-4 flex items-center gap-2" }, Mn = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg overflow-y-auto" }, Bn = { class: "w-full" }, zn = {
|
|
3359
|
+
class: "p-3 fm-typo-en-body-sm-600",
|
|
3360
|
+
style: { "min-width": "130px" }
|
|
3361
|
+
}, Kn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Hn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Gn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Wn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Qn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Yn = { class: "p-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Jn = { class: "p-3 fm-typo-en-body-sm-600" }, Zn = { key: 2 }, Xn = /* @__PURE__ */ qe({
|
|
3362
|
+
__name: "NetSuiteTransactionChangeLog",
|
|
3363
|
+
props: {
|
|
3364
|
+
netsuiteId: {}
|
|
3365
|
+
},
|
|
3366
|
+
setup(m) {
|
|
3367
|
+
const t = m, r = Pt(), n = se(!1), p = se(!1), u = se(!1), d = se([]);
|
|
3368
|
+
async function s() {
|
|
3369
|
+
if (!(d.value.length > 0))
|
|
3370
|
+
try {
|
|
3371
|
+
p.value = !0;
|
|
3372
|
+
const f = await r.getChangeLogs(t.netsuiteId);
|
|
3373
|
+
d.value = f, u.value = !1;
|
|
3374
|
+
} catch {
|
|
3375
|
+
u.value = !0;
|
|
3376
|
+
} finally {
|
|
3377
|
+
p.value = !1;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
function a(f) {
|
|
3381
|
+
switch (f) {
|
|
3382
|
+
case Be.Create:
|
|
3383
|
+
return "text-green-600 bg-green-100";
|
|
3384
|
+
case Be.Set:
|
|
3385
|
+
return "text-blue-600 bg-blue-100";
|
|
3386
|
+
case Be.Change:
|
|
3387
|
+
return "text-yellow-600 bg-yellow-100";
|
|
3388
|
+
case Be.Unset:
|
|
3389
|
+
return "text-red-600 bg-red-100";
|
|
3390
|
+
default:
|
|
3391
|
+
return "text-gray-600 bg-gray-100";
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
function S(f) {
|
|
3395
|
+
return new Date(f).toLocaleDateString("en-US", {
|
|
3396
|
+
year: "numeric",
|
|
3397
|
+
month: "short",
|
|
3398
|
+
day: "numeric",
|
|
3399
|
+
hour: "2-digit",
|
|
3400
|
+
minute: "2-digit"
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
return (f, C) => {
|
|
3404
|
+
const A = te("FmButton"), N = te("FmCircularProgress"), h = te("FmIcon"), M = te("FmDialog");
|
|
3405
|
+
return i(), y("div", Vn, [
|
|
3406
|
+
T(M, {
|
|
3407
|
+
modelValue: n.value,
|
|
3408
|
+
"onUpdate:modelValue": C[2] || (C[2] = (E) => n.value = E),
|
|
3409
|
+
overlay: !0,
|
|
3410
|
+
"max-width": 800
|
|
3411
|
+
}, {
|
|
3412
|
+
"dialog-button": ie(() => [
|
|
3413
|
+
T(A, {
|
|
3414
|
+
"prepend-icon": "info",
|
|
3415
|
+
variant: "secondary",
|
|
3416
|
+
label: "NetSuite",
|
|
3417
|
+
onClick: C[0] || (C[0] = (E) => s()),
|
|
3418
|
+
"text-color": "primary",
|
|
3419
|
+
"bg-color": "transparent",
|
|
3420
|
+
"border-color": "primary"
|
|
3421
|
+
})
|
|
3422
|
+
]),
|
|
3423
|
+
"dialog-header": ie(() => C[3] || (C[3] = [
|
|
3424
|
+
e("div", null, "NetSuite info", -1)
|
|
3425
|
+
])),
|
|
3426
|
+
default: ie(() => [
|
|
3427
|
+
p.value ? (i(), y("div", Ln, [
|
|
3428
|
+
C[4] || (C[4] = e("span", null, "Change Log Loading...", -1)),
|
|
3429
|
+
T(N, { size: "md" })
|
|
3430
|
+
])) : V("", !0),
|
|
3431
|
+
!p.value && d.value.length > 0 ? (i(), y("div", jn, [
|
|
3432
|
+
e("h3", Un, [
|
|
3433
|
+
T(h, {
|
|
3434
|
+
name: "error",
|
|
3435
|
+
color: "#ff9500",
|
|
3436
|
+
size: "sm"
|
|
3437
|
+
}),
|
|
3438
|
+
C[5] || (C[5] = We(" Change Logs "))
|
|
3439
|
+
]),
|
|
3440
|
+
e("div", Mn, [
|
|
3441
|
+
e("table", Bn, [
|
|
3442
|
+
C[6] || (C[6] = e("thead", { class: "bg-fm-color-neutral-gray-50" }, [
|
|
3443
|
+
e("tr", { class: "border-b border-fm-color-neutral-gray-200" }, [
|
|
3444
|
+
e("th", {
|
|
3445
|
+
class: "text-left p-3 fm-typo-en-body-md-600",
|
|
3446
|
+
style: { "min-width": "130px" }
|
|
3447
|
+
}, " Date "),
|
|
3448
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Role"),
|
|
3449
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Name"),
|
|
3450
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Context"),
|
|
3451
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Type"),
|
|
3452
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Line ID"),
|
|
3453
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Field"),
|
|
3454
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "Old Value"),
|
|
3455
|
+
e("th", { class: "text-left p-3 fm-typo-en-body-md-600" }, "New Value")
|
|
3456
|
+
])
|
|
3457
|
+
], -1)),
|
|
3458
|
+
e("tbody", null, [
|
|
3459
|
+
(i(!0), y($e, null, Ie(d.value, (E, re) => (i(), y("tr", {
|
|
3460
|
+
key: re,
|
|
3461
|
+
class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
|
|
3462
|
+
}, [
|
|
3463
|
+
e("td", zn, b(S(E._dateiso8601)), 1),
|
|
3464
|
+
e("td", Kn, b(E._rolename), 1),
|
|
3465
|
+
e("td", Hn, b(E._employeename), 1),
|
|
3466
|
+
e("td", Gn, b(E._contextname), 1),
|
|
3467
|
+
e("td", {
|
|
3468
|
+
class: Qe(`p-3 fm-typo-en-body-sm-600 ${a(Number(E.type) - 1)}`)
|
|
3469
|
+
}, b(v(Be)[Number(E.type) - 1]), 3),
|
|
3470
|
+
e("td", Wn, b(E.lineid || ""), 1),
|
|
3471
|
+
e("td", Qn, b(E._fieldname), 1),
|
|
3472
|
+
e("td", Yn, b(E.oldvalue || ""), 1),
|
|
3473
|
+
e("td", Jn, b(E.newvalue || ""), 1)
|
|
3474
|
+
]))), 128))
|
|
3475
|
+
])
|
|
3476
|
+
])
|
|
3477
|
+
])
|
|
3478
|
+
])) : (i(), y("div", Zn, C[7] || (C[7] = [
|
|
3479
|
+
e("p", null, "No change logs available.", -1)
|
|
3480
|
+
])))
|
|
3481
|
+
]),
|
|
3482
|
+
"dialog-footer": ie(() => [
|
|
3483
|
+
T(A, {
|
|
3484
|
+
class: "ml-auto sm:w-full xs:w-full",
|
|
3485
|
+
label: "Close",
|
|
3486
|
+
size: "md",
|
|
3487
|
+
variant: "primary",
|
|
3488
|
+
onClick: C[1] || (C[1] = (E) => n.value = !1)
|
|
3489
|
+
})
|
|
3490
|
+
]),
|
|
3491
|
+
_: 1
|
|
3492
|
+
}, 8, ["modelValue"])
|
|
3493
|
+
]);
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
}), ea = { class: "flex flex-col w-full gap-3" }, ta = { class: "flex" }, sa = { class: "fm-typo-en-title-md-600 text-fm-color-typo-primary" }, ra = { class: "flex flex-col gap-16 w-full h-full" }, oa = { class: "flex justify-between" }, na = { class: "fm-typo-en-body-lg-600" }, aa = { class: "flex gap-2" }, la = {
|
|
3497
|
+
key: 0,
|
|
3498
|
+
class: "flex items-center gap-1"
|
|
3499
|
+
}, ia = { class: "fm-typo-en-body-md-400" }, ua = { class: "flex flex-col gap-8" }, ca = {
|
|
3500
|
+
key: 0,
|
|
3501
|
+
class: "flex items-start justify-between gap-6"
|
|
3502
|
+
}, da = { class: "text-xs font-mono text-right break-all" }, ma = {
|
|
3503
|
+
key: 1,
|
|
3504
|
+
class: "flex items-start justify-between gap-6"
|
|
3505
|
+
}, pa = { class: "fm-typo-en-body-sm-600" }, fa = {
|
|
3506
|
+
key: 2,
|
|
3507
|
+
class: "flex items-start justify-between gap-6"
|
|
3508
|
+
}, va = { class: "text-xs font-mono text-right break-all" }, ya = {
|
|
3509
|
+
key: 3,
|
|
3510
|
+
class: "flex items-start justify-between gap-6"
|
|
3511
|
+
}, ha = { class: "text-xs font-mono text-right break-all" }, ba = { class: "flex flex-col gap-4" }, ga = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _a = { class: "flex gap-1" }, Sa = { class: "fm-typo-en-body-lg-600" }, ka = {
|
|
3512
|
+
key: 0,
|
|
3513
|
+
class: "flex flex-col gap-4"
|
|
3514
|
+
}, Oa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xa = { class: "fm-typo-en-body-lg-600" }, wa = { class: "flex flex-col gap-4" }, $a = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ca = { class: "fm-typo-en-body-lg-600" }, Aa = {
|
|
3515
|
+
key: 1,
|
|
3516
|
+
class: "flex flex-col gap-4"
|
|
3517
|
+
}, Da = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ra = { class: "fm-typo-en-body-lg-600" }, Na = {
|
|
3518
|
+
key: 2,
|
|
3519
|
+
class: "flex flex-col gap-4"
|
|
3520
|
+
}, Pa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fa = { class: "fm-typo-en-body-lg-600" }, Ia = {
|
|
3521
|
+
key: 3,
|
|
3522
|
+
class: "flex flex-col gap-4"
|
|
3523
|
+
}, Ta = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ea = { class: "fm-typo-en-body-lg-600" }, qa = {
|
|
3524
|
+
key: 4,
|
|
3525
|
+
class: "flex flex-col gap-4"
|
|
3526
|
+
}, Va = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, La = { class: "fm-typo-en-body-lg-600" }, ja = {
|
|
3527
|
+
key: 5,
|
|
3528
|
+
class: "flex flex-col gap-4"
|
|
3529
|
+
}, Ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ma = { class: "fm-typo-en-body-lg-600" }, Ba = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, za = { class: "flex flex-col gap-8" }, Ka = { class: "flex gap-8 items-center" }, Ha = { class: "flex-1 fm-typo-en-body-lg-600" }, Ga = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Wa = { class: "flex w-full gap-4" }, Qa = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, Ya = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-2" }, Ja = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Za = ["innerHTML"], Xa = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, el = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, tl = {
|
|
3530
|
+
key: 0,
|
|
3531
|
+
class: "flex items-center gap-4"
|
|
3532
|
+
}, sl = { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, rl = {
|
|
3533
|
+
key: 0,
|
|
3534
|
+
class: "inline-flex items-center gap-1 text-xs font-medium text-gray-500 bg-gray-100 px-2 py-0.5 rounded-full"
|
|
3535
|
+
}, ol = { class: "py-8" }, nl = { class: "flex justify-end gap-4 items-center" }, al = { class: "fm-typo-en-body-lg-600" }, ll = {
|
|
3536
|
+
key: 0,
|
|
3537
|
+
class: "flex justify-end"
|
|
3538
|
+
}, il = {
|
|
3539
|
+
key: 1,
|
|
3540
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
3541
|
+
}, ul = {
|
|
3542
|
+
key: 0,
|
|
3543
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
3544
|
+
}, cl = ["src"], dl = { class: "fm-typo-en-body-lg-600" }, ml = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, pl = {
|
|
3545
|
+
key: 1,
|
|
3546
|
+
class: "px-4 flex flex-col"
|
|
3547
|
+
}, fl = { class: "flex gap-12 content-stretch" }, vl = {
|
|
3548
|
+
class: "flex flex-col w-40",
|
|
3549
|
+
name: "circles"
|
|
3550
|
+
}, yl = { class: "flex-1 flex flex-col items-center" }, hl = { class: "h-40 w-40 bg-fm-color-primary rounded-full flex items-center justify-center" }, bl = { class: "flex-1 flex flex-col items-center" }, gl = { class: "flex w-full items-center gap-4" }, _l = {
|
|
3551
|
+
class: "py-12 flex flex-col gap-4",
|
|
3552
|
+
name: "received-at header"
|
|
3553
|
+
}, Sl = { class: "fm-typo-en-body-lg-400" }, kl = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ol = { class: "ml-auto flex gap-1" }, xl = { class: "flex gap-12 content-stretch" }, wl = {
|
|
3554
|
+
class: "flex flex-col w-40",
|
|
3555
|
+
name: "circles"
|
|
3556
|
+
}, $l = { class: "flex-1 flex flex-col items-center" }, Cl = {
|
|
3557
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
3558
|
+
name: "delivery details"
|
|
3559
|
+
}, Al = { class: "flex flex-col gap-8" }, Dl = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Rl = { class: "flex flex-col gap-4" }, Nl = {
|
|
3560
|
+
key: 2,
|
|
3561
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
3562
|
+
}, Pl = {
|
|
3563
|
+
key: 0,
|
|
3564
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
3565
|
+
}, Fl = ["src"], Il = { class: "fm-typo-en-body-lg-600" }, Tl = {
|
|
3566
|
+
key: 1,
|
|
3567
|
+
class: "px-4 flex flex-col gap-12"
|
|
3568
|
+
}, El = { class: "flex flex-col gap-4" }, ql = { class: "flex justify-between gap-8" }, Vl = { class: "fm-typo-en-body-lg-600" }, Ll = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary whitespace-nowrap" }, jl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ul = {
|
|
3569
|
+
key: 0,
|
|
3570
|
+
class: "fm-typo-en-body-md-400"
|
|
3571
|
+
}, Ml = { class: "flex gap-8 xs:flex-col" }, _i = /* @__PURE__ */ qe({
|
|
3572
|
+
__name: "TransferDetails",
|
|
3573
|
+
props: {
|
|
3574
|
+
poRequest: {},
|
|
3575
|
+
purchaseOrder: {},
|
|
3576
|
+
transferTo: {},
|
|
3577
|
+
transferToDbName: {},
|
|
3578
|
+
show: { type: Boolean },
|
|
3579
|
+
canResubmit: { type: Boolean },
|
|
3580
|
+
canApprove: { type: Boolean },
|
|
3581
|
+
scope: {},
|
|
3582
|
+
receivedMap: {},
|
|
3583
|
+
shipments: {}
|
|
3584
|
+
},
|
|
3585
|
+
emits: ["update:show", "submitted"],
|
|
3586
|
+
setup(m, { emit: t }) {
|
|
3587
|
+
const r = m, n = t, p = gt(), u = Je(), d = Ze(), s = Ke(), a = bt(), { hasOrderDraftPermission: S } = gs(), f = hs();
|
|
3588
|
+
function C(o) {
|
|
3589
|
+
const l = o.isCustomCost, k = o.totalCost;
|
|
3590
|
+
return l != null ? l === !0 : k != null;
|
|
3591
|
+
}
|
|
3592
|
+
Xe(
|
|
3593
|
+
() => r.purchaseOrder,
|
|
3594
|
+
(o) => {
|
|
3595
|
+
f.init(o);
|
|
3596
|
+
},
|
|
3597
|
+
{ immediate: !0 }
|
|
3598
|
+
);
|
|
3599
|
+
const A = H(
|
|
3600
|
+
() => {
|
|
3601
|
+
var o, l;
|
|
3602
|
+
return {
|
|
3603
|
+
id: ((o = a.sessionUser.value) == null ? void 0 : o.id) ?? "",
|
|
3604
|
+
name: ((l = a.sessionUser.value) == null ? void 0 : l.displayName) ?? ""
|
|
3605
|
+
};
|
|
3606
|
+
}
|
|
3607
|
+
), N = bs(), { t: h } = ht(), M = H(
|
|
3608
|
+
() => {
|
|
3609
|
+
var o, l, k, x;
|
|
3610
|
+
return ((l = (o = r.purchaseOrder) == null ? void 0 : o.supplier) == null ? void 0 : l.internal) === "restaurant" || ((x = (k = r.purchaseOrder) == null ? void 0 : k.supplier) == null ? void 0 : x.internal) === "warehouse" ? lt.enum.transfer : lt.enum.purchase;
|
|
3611
|
+
}
|
|
3612
|
+
), E = H(() => {
|
|
3613
|
+
var k;
|
|
3614
|
+
const o = (k = r.shipments) == null ? void 0 : k.find((x) => {
|
|
3615
|
+
var F;
|
|
3616
|
+
return x.ref === ((F = r.purchaseOrder) == null ? void 0 : F._id);
|
|
3617
|
+
});
|
|
3618
|
+
let l = null;
|
|
3619
|
+
if (o != null && o.milestones && o.milestones.length > 0) {
|
|
3620
|
+
const x = o.milestones[o.milestones.length - 1];
|
|
3621
|
+
if (x.estimatedTime) {
|
|
3622
|
+
const F = new Date(x.estimatedTime), Q = F.getDate().toString().padStart(2, "0");
|
|
3623
|
+
l = `${F.toLocaleString("en-US", { month: "short" })} ${Q}`;
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
return l;
|
|
3627
|
+
}), re = se(!1), J = se(""), W = se(!0), he = et(), pe = Ys(he.getWorkflowConfig), oe = fs(), Se = [
|
|
3628
|
+
U.enum.receiveStock,
|
|
3629
|
+
U.enum.processRequest,
|
|
3630
|
+
U.enum.closeRequest
|
|
3631
|
+
], Ae = H(() => {
|
|
3632
|
+
var me, ne, g, c, O, G, K, Oe, z;
|
|
3633
|
+
if (!r.purchaseOrder)
|
|
3634
|
+
return [];
|
|
3635
|
+
const o = pe.result.value;
|
|
3636
|
+
if (o.state === Jt.loading)
|
|
3637
|
+
return [];
|
|
3638
|
+
let l;
|
|
3639
|
+
const k = ns.safeParse(r.purchaseOrder);
|
|
3640
|
+
if (k.success)
|
|
3641
|
+
l = k.data;
|
|
3642
|
+
else {
|
|
3643
|
+
const Y = /* @__PURE__ */ new Set(["1", "2"]), be = { line1: "", state: "", city: "", postcode: "", country: "" };
|
|
3644
|
+
l = {
|
|
3645
|
+
_id: ((me = r.purchaseOrder) == null ? void 0 : me._id) ?? "",
|
|
3646
|
+
status: ((ne = r.purchaseOrder) == null ? void 0 : ne.status) ?? _e.enum.DRAFT,
|
|
3647
|
+
version: Y.has((g = r.purchaseOrder) == null ? void 0 : g.version) ? (c = r.purchaseOrder) == null ? void 0 : c.version : null,
|
|
3648
|
+
seqNumber: typeof ((O = r.purchaseOrder) == null ? void 0 : O.seqNumber) == "number" ? r.purchaseOrder.seqNumber : 0,
|
|
3649
|
+
supplier: {
|
|
3650
|
+
_id: ((K = (G = r.purchaseOrder) == null ? void 0 : G.supplier) == null ? void 0 : K._id) ?? "",
|
|
3651
|
+
name: ((z = (Oe = r.purchaseOrder) == null ? void 0 : Oe.supplier) == null ? void 0 : z.name) ?? "",
|
|
3652
|
+
address: be
|
|
3653
|
+
},
|
|
3654
|
+
items: [],
|
|
3655
|
+
deliveryOrder: []
|
|
3656
|
+
};
|
|
3657
|
+
}
|
|
3658
|
+
const x = {
|
|
3659
|
+
user: A.value,
|
|
3660
|
+
executedAt: s.locations.computeFirst(
|
|
3661
|
+
(Y) => {
|
|
3662
|
+
var be;
|
|
3663
|
+
return Y.dbName === ((be = s._currentLocation) == null ? void 0 : be.dbName) ? Y : null;
|
|
3664
|
+
}
|
|
3665
|
+
),
|
|
3666
|
+
// Strip purchaseOrder and netSuite from the POR before passing to the Dart
|
|
3667
|
+
// bridge — both can carry legacy PO snapshots with "" fields that fail the
|
|
3668
|
+
// bridge's unguarded `as Map<String,dynamic>` casts. Also validate the POR
|
|
3669
|
+
// itself through Zod first: legacy PORs can have null required string fields
|
|
3670
|
+
// (e.g. purchaseOrderId, from.dbName) that cause Dart's _asString to throw.
|
|
3671
|
+
// The workflow engine only needs from/to/processedAt/rejectedAt — passing
|
|
3672
|
+
// null for an unvalidatable POR yields the same available actions.
|
|
3673
|
+
purchaseOrderRequest: (() => {
|
|
3674
|
+
if (r.poRequest == null) return r.poRequest;
|
|
3675
|
+
const Y = Es.safeParse(r.poRequest);
|
|
3676
|
+
return Y.success ? { ...Y.data, purchaseOrder: null, netSuite: null } : null;
|
|
3677
|
+
})(),
|
|
3678
|
+
purchaseOrder: l
|
|
3679
|
+
}, F = d.useOperatePurchaseOrderV2, Q = d.poWorkflowAllowToMarkCompleted, ve = [...Se];
|
|
3680
|
+
F && !Q && ve.push(U.enum.completeReceive);
|
|
3681
|
+
let I = [];
|
|
3682
|
+
try {
|
|
3683
|
+
o.state === Jt.error ? (console.error("Error fetching workflow config:", o.error), I = St.getAvailableActions({
|
|
3684
|
+
...x,
|
|
3685
|
+
orderConfig: St.getDefaultConfig()
|
|
3686
|
+
}).actions.filter((Y) => !ve.includes(Y))) : I = St.getAvailableActions({
|
|
3687
|
+
...x,
|
|
3688
|
+
orderConfig: o.data
|
|
3689
|
+
}).actions.filter((Y) => !ve.includes(Y));
|
|
3690
|
+
} catch (Y) {
|
|
3691
|
+
console.error("Error getting available actions:", Y);
|
|
3692
|
+
}
|
|
3693
|
+
return r.scope === "approval" && (I = I.filter((Y) => Y !== U.enum.completeReceive)), S.value || (I = I.filter(
|
|
3694
|
+
(Y) => Y !== U.enum.approveDraft && Y !== U.enum.rejectDraft
|
|
3695
|
+
)), I;
|
|
3696
|
+
}), B = Bs(r, "show"), ge = H(() => [
|
|
3697
|
+
{
|
|
3698
|
+
label: h("inventory.transfer.receiveRequest.details.overview"),
|
|
3699
|
+
value: "overview"
|
|
3700
|
+
},
|
|
3701
|
+
{
|
|
3702
|
+
label: h("inventory.transfer.receiveRequest.details.deliveryHistory"),
|
|
3703
|
+
value: "deliveryHistory"
|
|
3704
|
+
},
|
|
3705
|
+
{
|
|
3706
|
+
label: h("inventory.transfer.receiveRequest.details.actionLogs"),
|
|
3707
|
+
value: "actionLogs"
|
|
3708
|
+
}
|
|
3709
|
+
]), R = se(ge.value[0]);
|
|
3710
|
+
Xe(
|
|
3711
|
+
() => r.show,
|
|
3712
|
+
(o) => {
|
|
3713
|
+
o && (R.value = ge.value[0]);
|
|
3714
|
+
}
|
|
3715
|
+
);
|
|
3716
|
+
function w(o) {
|
|
3717
|
+
return o.map((l) => ({
|
|
3718
|
+
...l,
|
|
3719
|
+
amount: {
|
|
3720
|
+
...l.amount,
|
|
3721
|
+
amount: -Math.abs(l.amount.amount)
|
|
3722
|
+
}
|
|
3723
|
+
}));
|
|
3724
|
+
}
|
|
3725
|
+
async function j(o, l, k, x, F) {
|
|
3726
|
+
return new Promise((Q, ve) => {
|
|
3727
|
+
const I = {
|
|
3728
|
+
closeButton: !1,
|
|
3729
|
+
title: x.title,
|
|
3730
|
+
message: x.message,
|
|
3731
|
+
primaryActions: x.primaryActions,
|
|
3732
|
+
secondaryActions: { text: "No", close: !1 }
|
|
3733
|
+
};
|
|
3734
|
+
let me = l.rejectReason ?? "";
|
|
3735
|
+
k === U.enum.rejectDraft && (I.contentComponent = ps, I.contentComponentProps = {
|
|
3736
|
+
message: x.message,
|
|
3737
|
+
onChange: (ne) => {
|
|
3738
|
+
me = ne ?? "";
|
|
3739
|
+
}
|
|
3740
|
+
}), p.open(I).onPrimary(async () => {
|
|
3741
|
+
var g, c, O, G;
|
|
3742
|
+
const ne = [];
|
|
3743
|
+
k === U.enum.confirmDraft || k === U.enum.submitRequest ? ne.push({
|
|
3744
|
+
action: "confirmDraft",
|
|
3745
|
+
payload: f.controller.value.toConfirmDraftData(Ce())
|
|
3746
|
+
}) : k === U.enum.approveRequest ? (ne.push({
|
|
3747
|
+
action: "approveRequest",
|
|
3748
|
+
payload: null
|
|
3749
|
+
}), l.fulfillment && ne.push({
|
|
3750
|
+
action: "processRequest",
|
|
3751
|
+
payload: {
|
|
3752
|
+
fulfillmentId: "",
|
|
3753
|
+
deliveryOrderNumber: "",
|
|
3754
|
+
deliveryRemark: null,
|
|
3755
|
+
items: w(l.fulfillment.items),
|
|
3756
|
+
createdBy: A.value
|
|
3757
|
+
}
|
|
3758
|
+
})) : k === U.enum.processRequest ? l.fulfillment && ne.push({
|
|
3759
|
+
action: "processRequest",
|
|
3760
|
+
payload: {
|
|
3761
|
+
fulfillmentId: "",
|
|
3762
|
+
deliveryOrderNumber: "",
|
|
3763
|
+
deliveryRemark: null,
|
|
3764
|
+
items: w(l.fulfillment.items),
|
|
3765
|
+
createdBy: A.value
|
|
3766
|
+
}
|
|
3767
|
+
}) : k === U.enum.rejectRequest ? ne.push({
|
|
3768
|
+
action: "rejectRequest",
|
|
3769
|
+
payload: null
|
|
3770
|
+
}) : k === U.enum.closeRequest ? ne.push({
|
|
3771
|
+
action: "closeRequest",
|
|
3772
|
+
payload: null
|
|
3773
|
+
}) : k === U.enum.rejectDraft && ne.push({
|
|
3774
|
+
action: "rejectDraft",
|
|
3775
|
+
payload: {
|
|
3776
|
+
rejectReason: me ?? ""
|
|
3777
|
+
}
|
|
3778
|
+
});
|
|
3779
|
+
try {
|
|
3780
|
+
await oe({
|
|
3781
|
+
operate: {
|
|
3782
|
+
operation: k,
|
|
3783
|
+
doc: o,
|
|
3784
|
+
options: l
|
|
3785
|
+
},
|
|
3786
|
+
operateV2: {
|
|
3787
|
+
_id: ((g = r.purchaseOrder) == null ? void 0 : g._id) ?? "",
|
|
3788
|
+
_rev: ((c = r.purchaseOrder) == null ? void 0 : c._rev) ?? "",
|
|
3789
|
+
action: k === U.enum.submitRequest ? U.enum.confirmDraft : k,
|
|
3790
|
+
payloads: ne
|
|
3791
|
+
// add payload if action is receiveStock or processRequest
|
|
3792
|
+
},
|
|
3793
|
+
transferTo: (G = (O = r.poRequest) == null ? void 0 : O.to) == null ? void 0 : G.dbName
|
|
3794
|
+
}).delayed(1e3), Q("submitted");
|
|
3795
|
+
} catch (K) {
|
|
3796
|
+
ve(K);
|
|
3797
|
+
}
|
|
3798
|
+
}).onSecondary(() => {
|
|
3799
|
+
Q("cancelled");
|
|
3800
|
+
for (let ne = 0; ne < F + 2; ne++)
|
|
3801
|
+
p.close();
|
|
3802
|
+
}).onClose(() => {
|
|
3803
|
+
});
|
|
3804
|
+
});
|
|
3805
|
+
}
|
|
3806
|
+
async function L(o) {
|
|
3807
|
+
var F, Q, ve, I;
|
|
3808
|
+
if (o === U.enum.receiveStock)
|
|
3809
|
+
return;
|
|
3810
|
+
const l = ms[o];
|
|
3811
|
+
if (!l) {
|
|
3812
|
+
u.open({
|
|
3813
|
+
title: "Something went wrong",
|
|
3814
|
+
message: `Cannot process order: ${Rt(o)}`,
|
|
3815
|
+
type: "error"
|
|
3816
|
+
});
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
const { successMessage: k, ...x } = l;
|
|
3820
|
+
if (r.purchaseOrder) {
|
|
3821
|
+
J.value = `${o}`, re.value = !0, W.value = !1;
|
|
3822
|
+
const me = {};
|
|
3823
|
+
let ne = 0;
|
|
3824
|
+
if ((o === U.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
3825
|
+
o === U.enum.completeReceive) && d.autoReceiveWarehouse)
|
|
3826
|
+
me.autoReceive = !0;
|
|
3827
|
+
else if ((o === U.enum.approveRequest || o === U.enum.processRequest) && d.acceptRequireFulfillment) {
|
|
3828
|
+
const g = (Q = (F = r.poRequest) == null ? void 0 : F.from) == null ? void 0 : Q.dbName, c = (I = (ve = r.poRequest) == null ? void 0 : ve.to) == null ? void 0 : I.dbName;
|
|
3829
|
+
if (g && c && (g.startsWith("warehouse_") || c.startsWith("warehouse_"))) {
|
|
3830
|
+
const O = await new Promise((G, K) => {
|
|
3831
|
+
p.open({
|
|
3832
|
+
closeButton: !1,
|
|
3833
|
+
title: "Confirm transfer amount",
|
|
3834
|
+
dialogComponent: xr,
|
|
3835
|
+
dialogComponentProps: {
|
|
3836
|
+
purchaseOrder: r.purchaseOrder,
|
|
3837
|
+
confirm: G,
|
|
3838
|
+
"onUpdate:show": (Oe) => {
|
|
3839
|
+
Oe || (J.value = "", re.value = !1, W.value = !0, ne++, p.close()), K("cancelled");
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
});
|
|
3844
|
+
me.fulfillment = O;
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
try {
|
|
3848
|
+
await j(
|
|
3849
|
+
r.purchaseOrder,
|
|
3850
|
+
me,
|
|
3851
|
+
o,
|
|
3852
|
+
l,
|
|
3853
|
+
ne
|
|
3854
|
+
) === "submitted" && (u.open({
|
|
3855
|
+
title: "Success",
|
|
3856
|
+
message: k,
|
|
3857
|
+
type: "success"
|
|
3858
|
+
}), n("update:show", !1), n("submitted"));
|
|
3859
|
+
} catch (g) {
|
|
3860
|
+
u.open({
|
|
3861
|
+
title: "Something went wrong",
|
|
3862
|
+
message: g instanceof Error ? g.message : "Please try again.",
|
|
3863
|
+
type: "error"
|
|
3864
|
+
}), console.error("Error when submitting PO operation", o, r.purchaseOrder, g);
|
|
3865
|
+
} finally {
|
|
3866
|
+
J.value = "", re.value = !1, W.value = !0;
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
const X = H(() => {
|
|
3871
|
+
var o, l;
|
|
3872
|
+
return ((o = r.purchaseOrder) == null ? void 0 : o.status) === _e.enum.RECEIVING || ((l = r.purchaseOrder) == null ? void 0 : l.status) === _e.enum.COMPLETE;
|
|
3873
|
+
}), fe = H(() => r.purchaseOrder ? vt(r.purchaseOrder) : {}), xe = H(() => {
|
|
3874
|
+
const o = r.purchaseOrder;
|
|
3875
|
+
if (!o) return { status: "", statusClass: "" };
|
|
3876
|
+
const { partial: l, over: k } = $t(fe.value), x = Ct(o.status, l, k);
|
|
3877
|
+
let F = h(`inventory.transfer.status.${x}`), Q = `${o.status}`.toLocaleLowerCase("en-us");
|
|
3878
|
+
return x === _e.enum.CLOSE && (F = `${h(`inventory.transfer.status.${_e.enum.COMPLETE}`)}`), x === "PARTIAL_RECEIVED" && Q === _e.enum.PROCESSING.toLocaleLowerCase("en-us") && (Q = _e.enum.RECEIVING.toLocaleLowerCase("en-us")), {
|
|
3879
|
+
status: F,
|
|
3880
|
+
statusClass: `fm-status-badge fm-status-badge-${Q}`
|
|
3881
|
+
};
|
|
3882
|
+
}), D = H(() => {
|
|
3883
|
+
var Q, ve;
|
|
3884
|
+
const o = ((Q = r.purchaseOrder) == null ? void 0 : Q.deliveryOrder) ?? [], l = ((ve = r.purchaseOrder) == null ? void 0 : ve.deliveryFullfillment) ?? [], k = [
|
|
3885
|
+
...o.map((I) => ({
|
|
3886
|
+
createdAt: I.createdAt,
|
|
3887
|
+
type: "grn",
|
|
3888
|
+
doc: I
|
|
3889
|
+
})),
|
|
3890
|
+
...l.map((I) => ({
|
|
3891
|
+
createdAt: I.createdAt,
|
|
3892
|
+
type: "fulfillment",
|
|
3893
|
+
doc: I
|
|
3894
|
+
}))
|
|
3895
|
+
];
|
|
3896
|
+
k.reverse().sort((I, me) => I.createdAt.localeCompare(me.createdAt));
|
|
3897
|
+
function x(I) {
|
|
3898
|
+
var g, c, O, G, K, Oe, z, Y, be, Pe, Te, Fe;
|
|
3899
|
+
const me = l.findIndex((ae) => ae.id === I.fullfillmentId), ne = [
|
|
3900
|
+
(c = (g = l[me]) == null ? void 0 : g.netSuite) != null && c.id ? {
|
|
3901
|
+
label: "Fulfillment's ref no. (Netsuite)",
|
|
3902
|
+
values: [
|
|
3903
|
+
`${((G = (O = l[me]) == null ? void 0 : O.netSuite) == null ? void 0 : G.refNo) ?? "N/A"} (${((Oe = (K = l[me]) == null ? void 0 : K.netSuite) == null ? void 0 : Oe.id) ?? "-"})`
|
|
3904
|
+
]
|
|
3905
|
+
} : null,
|
|
3906
|
+
(z = I == null ? void 0 : I.netSuite) != null && z.id ? {
|
|
3907
|
+
label: "Netsuite ref no.",
|
|
3908
|
+
values: [`${((Y = I == null ? void 0 : I.netSuite) == null ? void 0 : Y.refNo) ?? "N/A"} (${((be = I == null ? void 0 : I.netSuite) == null ? void 0 : be.id) ?? "-"})`]
|
|
3909
|
+
} : null,
|
|
3910
|
+
(Pe = I == null ? void 0 : I.netSuite) != null && Pe.recordType ? {
|
|
3911
|
+
label: "Netsuite Type",
|
|
3912
|
+
values: [as((Te = I == null ? void 0 : I.netSuite) == null ? void 0 : Te.recordType)]
|
|
3913
|
+
} : null
|
|
3914
|
+
];
|
|
3915
|
+
return {
|
|
3916
|
+
header: "Received",
|
|
3917
|
+
deliveryOrder: I,
|
|
3918
|
+
date: tt(new Date(I.createdAt)),
|
|
3919
|
+
info: [
|
|
3920
|
+
{
|
|
3921
|
+
label: "Adjustment date",
|
|
3922
|
+
values: [
|
|
3923
|
+
I.adjustment ? tt(new Date(mt(I.adjustment))) : "-"
|
|
3924
|
+
]
|
|
3925
|
+
},
|
|
3926
|
+
{
|
|
3927
|
+
label: "Received by",
|
|
3928
|
+
values: [(Fe = I.createdBy) == null ? void 0 : Fe.name]
|
|
3929
|
+
},
|
|
3930
|
+
{
|
|
3931
|
+
label: "Received items",
|
|
3932
|
+
values: I.received.map((ae) => {
|
|
3933
|
+
var ue;
|
|
3934
|
+
return ee("div", [
|
|
3935
|
+
ee(
|
|
3936
|
+
"div",
|
|
3937
|
+
{
|
|
3938
|
+
class: "flex gap-4"
|
|
3939
|
+
},
|
|
3940
|
+
[
|
|
3941
|
+
ee(
|
|
3942
|
+
"div",
|
|
3943
|
+
{
|
|
3944
|
+
class: "flex flex-col"
|
|
3945
|
+
},
|
|
3946
|
+
[
|
|
3947
|
+
ee(
|
|
3948
|
+
"span",
|
|
3949
|
+
{
|
|
3950
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
3951
|
+
},
|
|
3952
|
+
`${ae.sku.name}`
|
|
3953
|
+
),
|
|
3954
|
+
ee(
|
|
3955
|
+
"span",
|
|
3956
|
+
{
|
|
3957
|
+
class: "fm-typo-en-body-md-400"
|
|
3958
|
+
},
|
|
3959
|
+
`${ae.sku.code} `
|
|
3960
|
+
)
|
|
3961
|
+
]
|
|
3962
|
+
),
|
|
3963
|
+
ee(
|
|
3964
|
+
"div",
|
|
3965
|
+
{
|
|
3966
|
+
class: "ml-auto flex flex-col"
|
|
3967
|
+
},
|
|
3968
|
+
[
|
|
3969
|
+
ee(
|
|
3970
|
+
"div",
|
|
3971
|
+
{
|
|
3972
|
+
class: "ml-auto flex gap-1"
|
|
3973
|
+
},
|
|
3974
|
+
[
|
|
3975
|
+
ee(
|
|
3976
|
+
"span",
|
|
3977
|
+
{
|
|
3978
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
3979
|
+
},
|
|
3980
|
+
we(ae.amount, !1)
|
|
3981
|
+
),
|
|
3982
|
+
ee(
|
|
3983
|
+
"span",
|
|
3984
|
+
{
|
|
3985
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
3986
|
+
},
|
|
3987
|
+
((ue = ae.measurement) == null ? void 0 : ue.abbrev) ?? ae.sku.unit.abbrev
|
|
3988
|
+
)
|
|
3989
|
+
]
|
|
3990
|
+
),
|
|
3991
|
+
ee(
|
|
3992
|
+
"div",
|
|
3993
|
+
{
|
|
3994
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
3995
|
+
},
|
|
3996
|
+
`${ae.cost ? `(${ut(ae.cost)})` : ""}`
|
|
3997
|
+
)
|
|
3998
|
+
]
|
|
3999
|
+
)
|
|
4000
|
+
]
|
|
4001
|
+
)
|
|
4002
|
+
]);
|
|
4003
|
+
})
|
|
4004
|
+
},
|
|
4005
|
+
{
|
|
4006
|
+
label: "Delivery order no.",
|
|
4007
|
+
values: [I.deliveryOrderNumber || "N/A"]
|
|
4008
|
+
},
|
|
4009
|
+
{
|
|
4010
|
+
label: "Remark",
|
|
4011
|
+
values: [I.remark || "N/A"]
|
|
4012
|
+
},
|
|
4013
|
+
me > -1 ? {
|
|
4014
|
+
label: "Fulfilment's sequence",
|
|
4015
|
+
values: [`${me + 1}`]
|
|
4016
|
+
} : null,
|
|
4017
|
+
...ne
|
|
4018
|
+
].filter((ae) => !!ae)
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
function F(I) {
|
|
4022
|
+
var ne, g, c;
|
|
4023
|
+
const me = l.findIndex((O) => O.id === I.id);
|
|
4024
|
+
return {
|
|
4025
|
+
header: "Fulfillment",
|
|
4026
|
+
date: tt(new Date(I.createdAt)),
|
|
4027
|
+
info: [
|
|
4028
|
+
{
|
|
4029
|
+
label: "Sequence",
|
|
4030
|
+
values: [String(me + 1)]
|
|
4031
|
+
},
|
|
4032
|
+
{
|
|
4033
|
+
label: "Receiveable items",
|
|
4034
|
+
values: I.items.map((O) => {
|
|
4035
|
+
var G;
|
|
4036
|
+
return ee("div", [
|
|
4037
|
+
ee(
|
|
4038
|
+
"div",
|
|
4039
|
+
{
|
|
4040
|
+
class: "flex gap-4"
|
|
4041
|
+
},
|
|
4042
|
+
[
|
|
4043
|
+
ee(
|
|
4044
|
+
"div",
|
|
4045
|
+
{
|
|
4046
|
+
class: "flex flex-col"
|
|
4047
|
+
},
|
|
4048
|
+
[
|
|
4049
|
+
ee(
|
|
4050
|
+
"span",
|
|
4051
|
+
{
|
|
4052
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
4053
|
+
},
|
|
4054
|
+
`${O.sku.name}`
|
|
4055
|
+
),
|
|
4056
|
+
ee(
|
|
4057
|
+
"span",
|
|
4058
|
+
{
|
|
4059
|
+
class: "fm-typo-en-body-md-400"
|
|
4060
|
+
},
|
|
4061
|
+
`${O.sku.code} `
|
|
4062
|
+
)
|
|
4063
|
+
]
|
|
4064
|
+
),
|
|
4065
|
+
ee(
|
|
4066
|
+
"div",
|
|
4067
|
+
{
|
|
4068
|
+
class: "ml-auto flex flex-col"
|
|
4069
|
+
},
|
|
4070
|
+
[
|
|
4071
|
+
ee(
|
|
4072
|
+
"div",
|
|
4073
|
+
{
|
|
4074
|
+
class: "ml-auto flex gap-1"
|
|
4075
|
+
},
|
|
4076
|
+
[
|
|
4077
|
+
ee(
|
|
4078
|
+
"span",
|
|
4079
|
+
{
|
|
4080
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
4081
|
+
},
|
|
4082
|
+
we(O.amount, !1)
|
|
4083
|
+
),
|
|
4084
|
+
ee(
|
|
4085
|
+
"span",
|
|
4086
|
+
{
|
|
4087
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
4088
|
+
},
|
|
4089
|
+
((G = O.measurement) == null ? void 0 : G.abbrev) ?? O.sku.unit.abbrev
|
|
4090
|
+
)
|
|
4091
|
+
]
|
|
4092
|
+
),
|
|
4093
|
+
ee(
|
|
4094
|
+
"div",
|
|
4095
|
+
{
|
|
4096
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
4097
|
+
},
|
|
4098
|
+
`${O.cost ? `(${ut(O.cost)})` : ""}`
|
|
4099
|
+
)
|
|
4100
|
+
]
|
|
4101
|
+
)
|
|
4102
|
+
]
|
|
4103
|
+
)
|
|
4104
|
+
]);
|
|
4105
|
+
})
|
|
4106
|
+
},
|
|
4107
|
+
(ne = I.netSuite) != null && ne.refNo ? {
|
|
4108
|
+
label: "Netsuite Ref no. (ID)",
|
|
4109
|
+
values: [`${(g = I.netSuite) == null ? void 0 : g.refNo} (${((c = I.netSuite) == null ? void 0 : c.id) ?? "-"})`]
|
|
4110
|
+
} : null
|
|
4111
|
+
].filter((O) => !!O)
|
|
4112
|
+
};
|
|
4113
|
+
}
|
|
4114
|
+
return k.map(
|
|
4115
|
+
(I) => I.type === "grn" ? x(I.doc) : F(I.doc)
|
|
4116
|
+
);
|
|
4117
|
+
}), P = H(() => {
|
|
4118
|
+
const o = r.purchaseOrder;
|
|
4119
|
+
if (!o) return [];
|
|
4120
|
+
if (!o.itemsAtSubmission) return o.items ?? [];
|
|
4121
|
+
const l = new Set(o.itemsAtSubmission.map((x) => x.sku._id)), k = [];
|
|
4122
|
+
for (const x of o.items ?? [])
|
|
4123
|
+
l.has(x.sku._id) || (l.add(x.sku._id), k.push(x));
|
|
4124
|
+
return [...o.itemsAtSubmission, ...k];
|
|
4125
|
+
}), le = H(() => {
|
|
4126
|
+
const o = r.purchaseOrder;
|
|
4127
|
+
if (!o || o.version !== Me.enum[2]) return r.receivedMap;
|
|
4128
|
+
const l = {}, k = {};
|
|
4129
|
+
for (const F of o.items ?? [])
|
|
4130
|
+
l[F.sku._id] || (l[F.sku._id] = []), k[F.sku._id] = F.sku.unit.precision, F.id && l[F.sku._id].push(F.id);
|
|
4131
|
+
const x = {};
|
|
4132
|
+
for (const [F, Q] of Object.entries(l)) {
|
|
4133
|
+
const ve = Q.map((g) => r.receivedMap[g]).filter(Boolean);
|
|
4134
|
+
if (ve.length === 0) continue;
|
|
4135
|
+
const I = { amount: 0, precision: k[F] ?? 0 }, me = ve.reduce((g, c) => Ne.add([g, c.total]), I), ne = ve.reduce((g, c) => Ne.add([g, c.received]), I);
|
|
4136
|
+
x[F] = {
|
|
4137
|
+
key: F,
|
|
4138
|
+
total: me,
|
|
4139
|
+
received: ne,
|
|
4140
|
+
remaining: Ne.subtract([me, ne])
|
|
4141
|
+
};
|
|
4142
|
+
}
|
|
4143
|
+
return x;
|
|
4144
|
+
});
|
|
4145
|
+
function ce(o) {
|
|
4146
|
+
const l = le.value[o.sku._id], k = _(o);
|
|
4147
|
+
return l ? `<span class="${k} fm-typo-en-body-lg-600">${Ne.toFormatString({ value: l.received })}</span>/${ft(o.quantity, o.sku.unit, o.measurement)}` : `<span class="fm-typo-en-body-lg-600">-</span>/${ft(o.quantity, o.sku.unit, o.measurement)}`;
|
|
4148
|
+
}
|
|
4149
|
+
function $(o) {
|
|
4150
|
+
const l = r.purchaseOrder;
|
|
4151
|
+
return l != null && l.itemsAtSubmission ? !l.itemsAtSubmission.some((k) => k.sku._id === o.sku._id) : !1;
|
|
4152
|
+
}
|
|
4153
|
+
function _(o) {
|
|
4154
|
+
const l = le.value[o.sku._id];
|
|
4155
|
+
if (!l)
|
|
4156
|
+
return "text-fm-color-typo-tertiary";
|
|
4157
|
+
const { isPartialReceive: k, isNoReceive: x, isOverReceive: F, isFullReceive: Q } = mr(l);
|
|
4158
|
+
return x ? "text-fm-color-typo-tertiary" : k ? "text-fm-color-system-warning-300" : F ? "text-fm-color-system-error-300" : Q ? "text-fm-color-system-success-300" : "";
|
|
4159
|
+
}
|
|
4160
|
+
const q = H(() => {
|
|
4161
|
+
var o, l, k;
|
|
4162
|
+
return (o = r.purchaseOrder) != null && o.itemsAtSubmission ? ((l = r.purchaseOrder) == null ? void 0 : l.version) === Me.enum[2] ? r.purchaseOrder.items.reduce((x, F) => {
|
|
4163
|
+
var ve, I;
|
|
4164
|
+
const Q = (I = (ve = r.purchaseOrder) == null ? void 0 : ve.itemsAtSubmission) == null ? void 0 : I.find(
|
|
4165
|
+
(me) => me.id === F.id
|
|
4166
|
+
);
|
|
4167
|
+
return Q && Q.quantity !== F.quantity && x.set(F.sku.code, {
|
|
4168
|
+
originalAmount: Number(Ne.toFormatString({ value: Q.quantity })),
|
|
4169
|
+
newAmount: Number(Ne.toFormatString({ value: F.quantity }))
|
|
4170
|
+
}), x;
|
|
4171
|
+
}, /* @__PURE__ */ new Map()) : (k = r.purchaseOrder) == null ? void 0 : k.items.reduce((x, F) => {
|
|
4172
|
+
var me, ne;
|
|
4173
|
+
const Q = (ne = (me = r.purchaseOrder) == null ? void 0 : me.itemsAtSubmission) == null ? void 0 : ne.find(
|
|
4174
|
+
(g) => g.sku._id === F.sku._id
|
|
4175
|
+
), ve = Q ? Number(Ne.toFormatString({ value: Q.quantity })) : 0, I = Number(Ne.toFormatString({ value: F.quantity }));
|
|
4176
|
+
return Q && ve !== I && x.set(F.sku.code, {
|
|
4177
|
+
originalAmount: ve,
|
|
4178
|
+
newAmount: I
|
|
4179
|
+
}), x;
|
|
4180
|
+
}, /* @__PURE__ */ new Map()) : /* @__PURE__ */ new Map();
|
|
4181
|
+
}), Z = (o) => {
|
|
4182
|
+
var k, x;
|
|
4183
|
+
const l = q.value;
|
|
4184
|
+
return ((k = r.purchaseOrder) == null ? void 0 : k.version) === Me.enum[2] ? l.has(o.id) : l.has((x = o.sku) == null ? void 0 : x.code);
|
|
4185
|
+
}, de = (o) => {
|
|
4186
|
+
var k, x;
|
|
4187
|
+
const l = q.value;
|
|
4188
|
+
return ((k = r.purchaseOrder) == null ? void 0 : k.version) === Me.enum[2] ? l.get(o.id) : l.get((x = o.sku) == null ? void 0 : x.code);
|
|
4189
|
+
}, ke = H(() => {
|
|
4190
|
+
const o = r.purchaseOrder;
|
|
4191
|
+
if (!o) return "";
|
|
4192
|
+
const l = o.actionChangelogs ?? [], k = l.length ? l[l.length - 1] : null;
|
|
4193
|
+
if (k && k.action === "rejectDraft") {
|
|
4194
|
+
const x = k.remarks ?? "";
|
|
4195
|
+
return x && x.toString().trim() !== "" ? x.toString() : "-";
|
|
4196
|
+
}
|
|
4197
|
+
return "";
|
|
4198
|
+
}), Re = H(() => {
|
|
4199
|
+
const o = r.purchaseOrder;
|
|
4200
|
+
return o ? [...o.actionChangelogs ?? []].reverse() : [];
|
|
4201
|
+
});
|
|
4202
|
+
return (o, l) => {
|
|
4203
|
+
const k = te("FmButton"), x = te("FmButtonGroup"), F = te("FmChip"), Q = te("FmIcon"), ve = te("FmMenuDivider"), I = te("FmCard"), me = te("FmTooltip"), ne = te("FmSpacer"), g = te("FmSideSheet");
|
|
4204
|
+
return i(), ye(g, {
|
|
4205
|
+
modelValue: v(B),
|
|
4206
|
+
"onUpdate:modelValue": l[9] || (l[9] = (c) => Rs(B) ? B.value = c : null),
|
|
4207
|
+
"dismiss-away": W.value,
|
|
4208
|
+
"max-width": 600,
|
|
4209
|
+
"close-button": !1
|
|
4210
|
+
}, {
|
|
4211
|
+
"side-sheet-header": ie(() => {
|
|
4212
|
+
var c, O;
|
|
4213
|
+
return [
|
|
4214
|
+
e("div", ea, [
|
|
4215
|
+
e("div", ta, [
|
|
4216
|
+
e("div", sa, b(v(h)("inventory.transfer.receiveRequest.details.title") + ((c = o.purchaseOrder) != null && c.seqNumber ? ` #${(O = o.purchaseOrder) == null ? void 0 : O.seqNumber}` : "")), 1),
|
|
4217
|
+
T(k, {
|
|
4218
|
+
class: "ml-auto -m-2",
|
|
4219
|
+
variant: "tertiary",
|
|
4220
|
+
"prepend-icon": "close",
|
|
4221
|
+
onClick: l[0] || (l[0] = (G) => n("update:show", !1))
|
|
4222
|
+
})
|
|
4223
|
+
]),
|
|
4224
|
+
T(x, {
|
|
4225
|
+
items: ge.value,
|
|
4226
|
+
modelValue: R.value,
|
|
4227
|
+
"onUpdate:modelValue": l[1] || (l[1] = (G) => R.value = G)
|
|
4228
|
+
}, null, 8, ["items", "modelValue"]),
|
|
4229
|
+
o.purchaseOrder && R.value.value === "deliveryHistory" ? (i(), ye(Nn, {
|
|
4230
|
+
key: 0,
|
|
4231
|
+
"purchase-order": o.purchaseOrder,
|
|
4232
|
+
"received-info-map": fe.value,
|
|
4233
|
+
"received-map": o.receivedMap,
|
|
4234
|
+
onSubmitted: l[2] || (l[2] = () => {
|
|
4235
|
+
n("update:show", !1), n("submitted");
|
|
4236
|
+
})
|
|
4237
|
+
}, null, 8, ["purchase-order", "received-info-map", "received-map"])) : V("", !0)
|
|
4238
|
+
])
|
|
4239
|
+
];
|
|
4240
|
+
}),
|
|
4241
|
+
default: ie(() => {
|
|
4242
|
+
var c, O, G, K, Oe;
|
|
4243
|
+
return [
|
|
4244
|
+
e("div", ra, [
|
|
4245
|
+
R.value.value === "overview" ? (i(), y($e, { key: 0 }, [
|
|
4246
|
+
e("div", null, [
|
|
4247
|
+
T(I, {
|
|
4248
|
+
variant: "outlined",
|
|
4249
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
4250
|
+
}, {
|
|
4251
|
+
default: ie(() => {
|
|
4252
|
+
var z, Y, be, Pe, Te, Fe, ae, ue, Le, Ve;
|
|
4253
|
+
return [
|
|
4254
|
+
e("div", oa, [
|
|
4255
|
+
e("div", na, b(v(h)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
|
|
4256
|
+
e("div", aa, [
|
|
4257
|
+
T(F, {
|
|
4258
|
+
label: xe.value.status,
|
|
4259
|
+
class: Qe(xe.value.statusClass),
|
|
4260
|
+
compact: ""
|
|
4261
|
+
}, null, 8, ["label", "class"]),
|
|
4262
|
+
E.value ? (i(), y("div", la, [
|
|
4263
|
+
T(Q, {
|
|
4264
|
+
name: "local_shipping",
|
|
4265
|
+
color: "#666666"
|
|
4266
|
+
}),
|
|
4267
|
+
e("span", ia, b(E.value), 1)
|
|
4268
|
+
])) : V("", !0)
|
|
4269
|
+
])
|
|
4270
|
+
]),
|
|
4271
|
+
T(ve),
|
|
4272
|
+
e("div", ua, [
|
|
4273
|
+
T(ts, { title: "Debug Info" }, {
|
|
4274
|
+
default: ie(() => {
|
|
4275
|
+
var je, Tt, Et, qt, Vt, Lt, jt, Ut, Mt, Bt, zt, Kt;
|
|
4276
|
+
return [
|
|
4277
|
+
(je = o.purchaseOrder) != null && je._id ? (i(), y("div", ca, [
|
|
4278
|
+
l[10] || (l[10] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Purchase Order ID ", -1)),
|
|
4279
|
+
e("span", da, b((Tt = o.purchaseOrder) == null ? void 0 : Tt._id), 1)
|
|
4280
|
+
])) : V("", !0),
|
|
4281
|
+
(Et = o.purchaseOrder) != null && Et.status ? (i(), y("div", ma, [
|
|
4282
|
+
l[11] || (l[11] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Purchase Order Status ", -1)),
|
|
4283
|
+
e("span", pa, b((qt = o.purchaseOrder) == null ? void 0 : qt.status), 1)
|
|
4284
|
+
])) : V("", !0),
|
|
4285
|
+
(Lt = (Vt = o.purchaseOrder) == null ? void 0 : Vt.supplier) != null && Lt._id ? (i(), y("div", fa, [
|
|
4286
|
+
l[12] || (l[12] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Source Location ID ", -1)),
|
|
4287
|
+
e("span", va, b(((Ut = (jt = o.purchaseOrder) == null ? void 0 : jt.supplier) == null ? void 0 : Ut.internal) != null ? `${(Bt = (Mt = o.purchaseOrder) == null ? void 0 : Mt.supplier) == null ? void 0 : Bt.internal}_` : "") + b((Kt = (zt = o.purchaseOrder) == null ? void 0 : zt.supplier) == null ? void 0 : Kt._id), 1)
|
|
4288
|
+
])) : V("", !0),
|
|
4289
|
+
o.transferToDbName ? (i(), y("div", ya, [
|
|
4290
|
+
l[13] || (l[13] = e("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Destination Location ID ", -1)),
|
|
4291
|
+
e("span", ha, b(o.transferToDbName), 1)
|
|
4292
|
+
])) : V("", !0)
|
|
4293
|
+
];
|
|
4294
|
+
}),
|
|
4295
|
+
_: 1
|
|
4296
|
+
}),
|
|
4297
|
+
e("div", ba, [
|
|
4298
|
+
e("div", ga, [
|
|
4299
|
+
e("div", _a, b(v(h)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
4300
|
+
]),
|
|
4301
|
+
e("div", Sa, b(v(it)(((z = o.purchaseOrder) == null ? void 0 : z._id) ?? "")), 1)
|
|
4302
|
+
]),
|
|
4303
|
+
(Y = o.purchaseOrder) != null && Y.effectiveAt ? (i(), y("div", ka, [
|
|
4304
|
+
e("div", Oa, b(v(h)("inventory.transfer.receiveRequest.details.date")), 1),
|
|
4305
|
+
e("div", xa, b(v(Nt)(new Date((be = o.purchaseOrder) == null ? void 0 : be.effectiveAt))), 1)
|
|
4306
|
+
])) : V("", !0),
|
|
4307
|
+
e("div", wa, [
|
|
4308
|
+
e("div", $a, b(v(h)("inventory.transfer.receiveRequest.details.type.title")), 1),
|
|
4309
|
+
e("div", Ca, b(v(h)(
|
|
4310
|
+
`inventory.transfer.receiveRequest.details.type.${M.value.toLocaleLowerCase("en-US")}`
|
|
4311
|
+
)), 1)
|
|
4312
|
+
]),
|
|
4313
|
+
(Te = (Pe = o.purchaseOrder) == null ? void 0 : Pe.supplier) != null && Te.name ? (i(), y("div", Aa, [
|
|
4314
|
+
e("div", Da, b(v(h)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
4315
|
+
e("div", Ra, b((ae = (Fe = o.purchaseOrder) == null ? void 0 : Fe.supplier) == null ? void 0 : ae.name), 1)
|
|
4316
|
+
])) : V("", !0),
|
|
4317
|
+
o.transferTo ? (i(), y("div", Na, [
|
|
4318
|
+
e("div", Pa, b(v(h)("inventory.transfer.receiveRequest.details.to")), 1),
|
|
4319
|
+
e("div", Fa, b(o.transferTo), 1)
|
|
4320
|
+
])) : V("", !0),
|
|
4321
|
+
(ue = o.purchaseOrder) != null && ue.ref ? (i(), y("div", Ia, [
|
|
4322
|
+
e("div", Ta, b(v(h)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
4323
|
+
e("div", Ea, b(o.purchaseOrder.ref), 1)
|
|
4324
|
+
])) : V("", !0),
|
|
4325
|
+
(Le = o.purchaseOrder) != null && Le.remark ? (i(), y("div", qa, [
|
|
4326
|
+
e("div", Va, b(v(h)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
4327
|
+
e("div", La, b(o.purchaseOrder.remark), 1)
|
|
4328
|
+
])) : V("", !0),
|
|
4329
|
+
((Ve = o.purchaseOrder) == null ? void 0 : Ve.status) === v(_e).enum.DRAFT && ke.value ? (i(), y("div", ja, [
|
|
4330
|
+
e("div", Ua, b(v(h)("inventory.transfer.receiveRequest.details.rejectionReason")), 1),
|
|
4331
|
+
e("div", Ma, b(ke.value !== "" ? ke.value : "-"), 1)
|
|
4332
|
+
])) : V("", !0)
|
|
4333
|
+
])
|
|
4334
|
+
];
|
|
4335
|
+
}),
|
|
4336
|
+
_: 1
|
|
4337
|
+
})
|
|
4338
|
+
]),
|
|
4339
|
+
T(So, {
|
|
4340
|
+
"po-request": o.poRequest,
|
|
4341
|
+
purchaseOrder: o.purchaseOrder,
|
|
4342
|
+
transferType: M.value,
|
|
4343
|
+
transferToDbName: o.transferToDbName,
|
|
4344
|
+
scope: o.scope
|
|
4345
|
+
}, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
|
|
4346
|
+
e("div", Ba, [
|
|
4347
|
+
e("div", za, [
|
|
4348
|
+
e("div", Ka, [
|
|
4349
|
+
e("span", Ha, [
|
|
4350
|
+
We(b(X.value ? v(h)("inventory.transfer.receiveRequest.details.receivedItems") : v(h)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
|
|
4351
|
+
(O = (c = o.purchaseOrder) == null ? void 0 : c.netSuite) != null && O.missingItems && ((K = (G = o.purchaseOrder) == null ? void 0 : G.netSuite) == null ? void 0 : K.missingItems.length) > 0 ? (i(), ye(me, {
|
|
4352
|
+
key: 0,
|
|
4353
|
+
variant: "rich",
|
|
4354
|
+
placement: "top",
|
|
4355
|
+
"z-index": 51
|
|
4356
|
+
}, {
|
|
4357
|
+
content: ie(() => {
|
|
4358
|
+
var z, Y;
|
|
4359
|
+
return [
|
|
4360
|
+
e("div", Ga, [
|
|
4361
|
+
(i(!0), y($e, null, Ie((Y = (z = o.purchaseOrder) == null ? void 0 : z.netSuite) == null ? void 0 : Y.missingItems, (be, Pe) => (i(), y("div", {
|
|
4362
|
+
class: "flex justify-center align-middle",
|
|
4363
|
+
key: Pe
|
|
4364
|
+
}, [
|
|
4365
|
+
T(Q, {
|
|
4366
|
+
name: "arrow_right",
|
|
4367
|
+
size: "sm"
|
|
4368
|
+
}),
|
|
4369
|
+
We(" " + b(`(${be.netSuiteId}) ${be.name}: ${be.reason}`), 1)
|
|
4370
|
+
]))), 128))
|
|
4371
|
+
])
|
|
4372
|
+
];
|
|
4373
|
+
}),
|
|
4374
|
+
default: ie(() => [
|
|
4375
|
+
T(Q, {
|
|
4376
|
+
name: "error",
|
|
4377
|
+
color: "#ff2c2c",
|
|
4378
|
+
size: "sm"
|
|
4379
|
+
})
|
|
4380
|
+
]),
|
|
4381
|
+
_: 1
|
|
4382
|
+
})) : V("", !0)
|
|
4383
|
+
])
|
|
4384
|
+
]),
|
|
4385
|
+
T(ve),
|
|
4386
|
+
(i(!0), y($e, null, Ie(P.value, (z, Y) => {
|
|
4387
|
+
var be, Pe;
|
|
4388
|
+
return i(), y("div", {
|
|
4389
|
+
key: Y,
|
|
4390
|
+
class: "flex flex-col"
|
|
4391
|
+
}, [
|
|
4392
|
+
e("div", Wa, [
|
|
4393
|
+
e("div", Qa, [
|
|
4394
|
+
We(b(z.name) + " ", 1),
|
|
4395
|
+
$(z) ? (i(), ye(me, {
|
|
4396
|
+
key: 0,
|
|
4397
|
+
variant: "rich",
|
|
4398
|
+
placement: "top",
|
|
4399
|
+
"z-index": 51
|
|
4400
|
+
}, {
|
|
4401
|
+
content: ie(() => l[14] || (l[14] = [
|
|
4402
|
+
e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Extra item (added during delivery) ", -1)
|
|
4403
|
+
])),
|
|
4404
|
+
default: ie(() => [
|
|
4405
|
+
T(Q, {
|
|
4406
|
+
name: "add_circle",
|
|
4407
|
+
color: "#6b7280",
|
|
4408
|
+
size: "sm"
|
|
4409
|
+
})
|
|
4410
|
+
]),
|
|
4411
|
+
_: 1
|
|
4412
|
+
})) : V("", !0),
|
|
4413
|
+
Z(z) ? (i(), ye(me, {
|
|
4414
|
+
key: 1,
|
|
4415
|
+
variant: "rich",
|
|
4416
|
+
placement: "top",
|
|
4417
|
+
"z-index": 51
|
|
4418
|
+
}, {
|
|
4419
|
+
content: ie(() => {
|
|
4420
|
+
var Te, Fe;
|
|
4421
|
+
return [
|
|
4422
|
+
e("div", Ya, [
|
|
4423
|
+
l[15] || (l[15] = e("div", { class: "font-semibold" }, "Submission changes", -1)),
|
|
4424
|
+
e("div", null, "Original Amount: " + b((Te = de(z)) == null ? void 0 : Te.originalAmount), 1),
|
|
4425
|
+
e("div", null, " New Amount: " + b((Fe = de(z)) == null ? void 0 : Fe.newAmount), 1)
|
|
4426
|
+
])
|
|
4427
|
+
];
|
|
4428
|
+
}),
|
|
4429
|
+
default: ie(() => [
|
|
4430
|
+
T(Q, {
|
|
4431
|
+
name: "error",
|
|
4432
|
+
color: "#ff9500",
|
|
4433
|
+
size: "sm"
|
|
4434
|
+
})
|
|
4435
|
+
]),
|
|
4436
|
+
_: 2
|
|
4437
|
+
}, 1024)) : V("", !0)
|
|
4438
|
+
]),
|
|
4439
|
+
e("div", Ja, [
|
|
4440
|
+
e("span", {
|
|
4441
|
+
innerHTML: ce(z)
|
|
4442
|
+
}, null, 8, Za)
|
|
4443
|
+
])
|
|
4444
|
+
]),
|
|
4445
|
+
e("div", Xa, [
|
|
4446
|
+
e("div", el, b(z.code), 1),
|
|
4447
|
+
v(d).enableTotalCost && ((be = z.totalCost) != null && be.amount || typeof z.sku == "object" && z.sku != null) ? (i(), y("div", tl, [
|
|
4448
|
+
e("span", sl, b(v(ut)(
|
|
4449
|
+
(Pe = z.totalCost) != null && Pe.amount ? z.totalCost : v(f).controller.value.getItemCost(z, v(Ce)()).cost
|
|
4450
|
+
)), 1),
|
|
4451
|
+
C(z) ? V("", !0) : (i(), y("span", rl, [
|
|
4452
|
+
l[16] || (l[16] = e("span", { class: "w-1.5 h-1.5 rounded-full bg-gray-400" }, null, -1)),
|
|
4453
|
+
We(" " + b(v(h)("inventory.transfer.form.items.autoCalculated")), 1)
|
|
4454
|
+
]))
|
|
4455
|
+
])) : V("", !0)
|
|
4456
|
+
])
|
|
4457
|
+
]);
|
|
4458
|
+
}), 128)),
|
|
4459
|
+
+v(we)(v(f).controller.value.getTotalCosts()) ? (i(), y($e, { key: 0 }, [
|
|
4460
|
+
e("div", ol, [
|
|
4461
|
+
T(ve)
|
|
4462
|
+
]),
|
|
4463
|
+
e("div", nl, [
|
|
4464
|
+
l[17] || (l[17] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
|
|
4465
|
+
e("div", al, b(v(Ce)()) + " " + b(v(ut)({
|
|
4466
|
+
...v(f).controller.value.getTotalCosts(),
|
|
4467
|
+
currency: v(Ce)()
|
|
4468
|
+
}).replace(/[^0-9.,]/g, "")), 1)
|
|
4469
|
+
])
|
|
4470
|
+
], 64)) : V("", !0),
|
|
4471
|
+
v(d).enablePurchaseOrderPriceAdjustment ? (i(), y($e, { key: 1 }, [
|
|
4472
|
+
T(Tn, {
|
|
4473
|
+
adjustments: (Oe = o.purchaseOrder) == null ? void 0 : Oe.priceAdjustments
|
|
4474
|
+
}, null, 8, ["adjustments"]),
|
|
4475
|
+
o.purchaseOrder ? (i(), y("div", ll, [
|
|
4476
|
+
T(qn, {
|
|
4477
|
+
"purchase-order": o.purchaseOrder,
|
|
4478
|
+
onSubmitted: l[3] || (l[3] = () => {
|
|
4479
|
+
n("update:show", !1), n("submitted");
|
|
4480
|
+
})
|
|
4481
|
+
}, null, 8, ["purchase-order"])
|
|
4482
|
+
])) : V("", !0)
|
|
4483
|
+
], 64)) : V("", !0)
|
|
4484
|
+
])
|
|
4485
|
+
])
|
|
4486
|
+
], 64)) : R.value.value === "deliveryHistory" ? (i(), y("div", il, [
|
|
4487
|
+
D.value.length ? (i(), y("div", pl, [
|
|
4488
|
+
(i(!0), y($e, null, Ie(D.value, (z, Y) => {
|
|
4489
|
+
var be, Pe, Te, Fe, ae;
|
|
4490
|
+
return i(), y($e, { key: Y }, [
|
|
4491
|
+
e("div", fl, [
|
|
4492
|
+
e("div", vl, [
|
|
4493
|
+
e("div", yl, [
|
|
4494
|
+
e("div", {
|
|
4495
|
+
class: Qe([
|
|
4496
|
+
{
|
|
4497
|
+
"bg-fm-color-primary": Y !== 0,
|
|
4498
|
+
"bg-white": Y === 0
|
|
4499
|
+
},
|
|
4500
|
+
"w-[2px] h-full"
|
|
4501
|
+
])
|
|
4502
|
+
}, null, 2)
|
|
4503
|
+
]),
|
|
4504
|
+
e("div", hl, [
|
|
4505
|
+
z.header === "Received" ? (i(), ye(Q, {
|
|
4506
|
+
key: 0,
|
|
4507
|
+
name: "local_shipping",
|
|
4508
|
+
outline: "",
|
|
4509
|
+
color: "#ffffff"
|
|
4510
|
+
})) : V("", !0)
|
|
4511
|
+
]),
|
|
4512
|
+
e("div", bl, [
|
|
4513
|
+
e("div", {
|
|
4514
|
+
class: Qe([
|
|
4515
|
+
{
|
|
4516
|
+
"bg-fm-color-primary": Y < D.value.length - 1,
|
|
4517
|
+
"bg-white": Y >= D.value.length - 1
|
|
4518
|
+
},
|
|
4519
|
+
"w-[2px] h-full"
|
|
4520
|
+
])
|
|
4521
|
+
}, null, 2)
|
|
4522
|
+
])
|
|
4523
|
+
]),
|
|
4524
|
+
e("div", gl, [
|
|
4525
|
+
e("div", _l, [
|
|
4526
|
+
e("div", Sl, b(z.header), 1),
|
|
4527
|
+
e("div", kl, b(z.date), 1)
|
|
4528
|
+
]),
|
|
4529
|
+
e("div", Ol, [
|
|
4530
|
+
z.header === "Received" && z.deliveryOrder && o.purchaseOrder ? (i(), ye(Qo, {
|
|
4531
|
+
key: 0,
|
|
4532
|
+
deliveryOrder: z.deliveryOrder,
|
|
4533
|
+
purchaseOrder: o.purchaseOrder,
|
|
4534
|
+
"received-info-map": fe.value,
|
|
4535
|
+
onSubmitted: l[4] || (l[4] = () => {
|
|
4536
|
+
n("update:show", !1), n("submitted");
|
|
4537
|
+
})
|
|
4538
|
+
}, null, 8, ["deliveryOrder", "purchaseOrder", "received-info-map"])) : V("", !0),
|
|
4539
|
+
(Pe = (be = z.deliveryOrder) == null ? void 0 : be.netSuite) != null && Pe.id ? (i(), ye(ts, {
|
|
4540
|
+
key: 1,
|
|
4541
|
+
title: "Admin",
|
|
4542
|
+
class: "min-w-[140px]"
|
|
4543
|
+
}, {
|
|
4544
|
+
default: ie(() => {
|
|
4545
|
+
var ue, Le;
|
|
4546
|
+
return [
|
|
4547
|
+
T(Xn, {
|
|
4548
|
+
"netsuite-id": (Le = (ue = z.deliveryOrder) == null ? void 0 : ue.netSuite) == null ? void 0 : Le.id
|
|
4549
|
+
}, null, 8, ["netsuite-id"])
|
|
4550
|
+
];
|
|
4551
|
+
}),
|
|
4552
|
+
_: 2
|
|
4553
|
+
}, 1024)) : V("", !0),
|
|
4554
|
+
o.purchaseOrder && ((Te = z.deliveryOrder) != null && Te.id) ? (i(), ye(Hs, {
|
|
4555
|
+
key: 2,
|
|
4556
|
+
"purchase-order-id": (Fe = o.purchaseOrder) == null ? void 0 : Fe._id,
|
|
4557
|
+
"delivery-order-id": (ae = z.deliveryOrder) == null ? void 0 : ae.id
|
|
4558
|
+
}, null, 8, ["purchase-order-id", "delivery-order-id"])) : V("", !0)
|
|
4559
|
+
])
|
|
4560
|
+
])
|
|
4561
|
+
]),
|
|
4562
|
+
e("div", xl, [
|
|
4563
|
+
e("div", wl, [
|
|
4564
|
+
e("div", $l, [
|
|
4565
|
+
e("div", {
|
|
4566
|
+
class: Qe([
|
|
4567
|
+
{
|
|
4568
|
+
"bg-fm-color-primary": Y < D.value.length - 1,
|
|
4569
|
+
"bg-white": Y >= D.value.length - 1
|
|
4570
|
+
},
|
|
4571
|
+
"w-[2px] h-full"
|
|
4572
|
+
])
|
|
4573
|
+
}, null, 2)
|
|
4574
|
+
])
|
|
4575
|
+
]),
|
|
4576
|
+
e("div", Cl, [
|
|
4577
|
+
T(I, {
|
|
4578
|
+
variant: "outlined",
|
|
4579
|
+
class: "py-12 px-16"
|
|
4580
|
+
}, {
|
|
4581
|
+
default: ie(() => [
|
|
4582
|
+
e("div", Al, [
|
|
4583
|
+
(i(!0), y($e, null, Ie(z.info, (ue, Le) => (i(), y("div", {
|
|
4584
|
+
key: Le,
|
|
4585
|
+
class: "flex flex-col gap-4"
|
|
4586
|
+
}, [
|
|
4587
|
+
e("div", Dl, b(ue == null ? void 0 : ue.label), 1),
|
|
4588
|
+
e("div", Rl, [
|
|
4589
|
+
(i(!0), y($e, null, Ie(ue == null ? void 0 : ue.values, (Ve, je) => (i(), y("div", {
|
|
4590
|
+
key: je,
|
|
4591
|
+
class: "fm-typo-en-body-lg-600"
|
|
4592
|
+
}, [
|
|
4593
|
+
typeof Ve == "string" ? (i(), y($e, { key: 0 }, [
|
|
4594
|
+
We(b(Ve), 1)
|
|
4595
|
+
], 64)) : (i(), ye(Ns(Ve), { key: 1 }))
|
|
4596
|
+
]))), 128))
|
|
4597
|
+
])
|
|
4598
|
+
]))), 128))
|
|
4599
|
+
])
|
|
4600
|
+
]),
|
|
4601
|
+
_: 2
|
|
4602
|
+
}, 1024)
|
|
4603
|
+
])
|
|
4604
|
+
])
|
|
4605
|
+
], 64);
|
|
4606
|
+
}), 128))
|
|
4607
|
+
])) : (i(), y("div", ul, [
|
|
4608
|
+
T(ne),
|
|
4609
|
+
e("div", null, [
|
|
4610
|
+
e("img", {
|
|
4611
|
+
src: v(Yt),
|
|
4612
|
+
alt: "List is empty"
|
|
4613
|
+
}, null, 8, cl)
|
|
4614
|
+
]),
|
|
4615
|
+
e("div", dl, b(v(h)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
|
|
4616
|
+
e("div", ml, b(v(h)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
|
|
4617
|
+
T(ne),
|
|
4618
|
+
T(ne)
|
|
4619
|
+
]))
|
|
4620
|
+
])) : R.value.value === "actionLogs" ? (i(), y("div", Nl, [
|
|
4621
|
+
Re.value.length ? (i(), y("div", Tl, [
|
|
4622
|
+
(i(!0), y($e, null, Ie(Re.value, (z, Y) => (i(), ye(I, {
|
|
4623
|
+
key: Y,
|
|
4624
|
+
variant: "outlined",
|
|
4625
|
+
class: "py-12 px-16"
|
|
4626
|
+
}, {
|
|
4627
|
+
default: ie(() => {
|
|
4628
|
+
var be;
|
|
4629
|
+
return [
|
|
4630
|
+
e("div", El, [
|
|
4631
|
+
e("div", ql, [
|
|
4632
|
+
e("div", Vl, b(v(at)[z.action] ? v(h)(v(at)[z.action].translationKey) : z.action), 1),
|
|
4633
|
+
e("div", Ll, b(v(tt)(z.changedAt)), 1)
|
|
4634
|
+
]),
|
|
4635
|
+
e("div", jl, b((be = z.changedBy) == null ? void 0 : be.name), 1),
|
|
4636
|
+
z.remarks ? (i(), y("div", Ul, b(z.remarks), 1)) : V("", !0)
|
|
4637
|
+
])
|
|
4638
|
+
];
|
|
4639
|
+
}),
|
|
4640
|
+
_: 2
|
|
4641
|
+
}, 1024))), 128))
|
|
4642
|
+
])) : (i(), y("div", Pl, [
|
|
4643
|
+
T(ne),
|
|
4644
|
+
e("div", null, [
|
|
4645
|
+
e("img", {
|
|
4646
|
+
src: v(Yt),
|
|
4647
|
+
alt: "List is empty"
|
|
4648
|
+
}, null, 8, Fl)
|
|
4649
|
+
]),
|
|
4650
|
+
e("div", Il, b(v(h)("inventory.transfer.receiveRequest.details.noActionLogs")), 1),
|
|
4651
|
+
T(ne),
|
|
4652
|
+
T(ne)
|
|
4653
|
+
]))
|
|
4654
|
+
])) : V("", !0)
|
|
4655
|
+
])
|
|
4656
|
+
];
|
|
4657
|
+
}),
|
|
4658
|
+
"side-sheet-footer": ie(() => [
|
|
4659
|
+
e("div", Ml, [
|
|
4660
|
+
(i(!0), y($e, null, Ie(Ae.value, (c) => (i(), y($e, null, [
|
|
4661
|
+
v(at)[c].available != !1 ? (i(), ye(k, {
|
|
4662
|
+
key: c,
|
|
4663
|
+
label: v(h)(v(at)[c].translationKey),
|
|
4664
|
+
onClick: (O) => L(c),
|
|
4665
|
+
loading: J.value === c,
|
|
4666
|
+
disabled: J.value !== c && re.value,
|
|
4667
|
+
variant: v(at)[c].buttonVariant
|
|
4668
|
+
}, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : V("", !0)
|
|
4669
|
+
], 64))), 256)),
|
|
4670
|
+
v(N).ableToMarkReceived(o.purchaseOrder) && !Ae.value.includes("completeReceive") ? (i(), ye(k, {
|
|
4671
|
+
key: 0,
|
|
4672
|
+
label: v(h)("inventory.transfer.receiveRequest.actions.completeReceive"),
|
|
4673
|
+
onClick: l[5] || (l[5] = (c) => L("completeReceive")),
|
|
4674
|
+
loading: J.value === "completeReceive",
|
|
4675
|
+
disabled: J.value !== "completeReceive" && re.value
|
|
4676
|
+
}, null, 8, ["label", "loading", "disabled"])) : V("", !0),
|
|
4677
|
+
v(N).ableToMarkApproved(o.purchaseOrder) && o.canApprove && !Ae.value.includes("approveRequest") ? (i(), ye(k, {
|
|
4678
|
+
key: 1,
|
|
4679
|
+
label: v(h)("inventory.transfer.approval.actions.approveRequest"),
|
|
4680
|
+
onClick: l[6] || (l[6] = (c) => L("approveRequest")),
|
|
4681
|
+
loading: J.value === "approveRequest",
|
|
4682
|
+
disabled: J.value !== "approveRequest" && re.value
|
|
4683
|
+
}, null, 8, ["label", "loading", "disabled"])) : V("", !0),
|
|
4684
|
+
v(N).ableToCreateFulfillment(o.purchaseOrder, o.poRequest) && r.scope === "approval" ? (i(), ye(k, {
|
|
4685
|
+
key: 2,
|
|
4686
|
+
label: v(h)("inventory.transfer.receiveRequest.actions.processRequest"),
|
|
4687
|
+
onClick: l[7] || (l[7] = (c) => L("processRequest")),
|
|
4688
|
+
loading: J.value === "processRequest",
|
|
4689
|
+
disabled: J.value !== "processRequest" && re.value
|
|
4690
|
+
}, null, 8, ["label", "loading", "disabled"])) : V("", !0),
|
|
4691
|
+
T(k, {
|
|
4692
|
+
label: v(h)("common.close"),
|
|
4693
|
+
variant: "tertiary",
|
|
4694
|
+
onClick: l[8] || (l[8] = (c) => n("update:show", !1))
|
|
4695
|
+
}, null, 8, ["label"])
|
|
4696
|
+
])
|
|
4697
|
+
]),
|
|
4698
|
+
_: 1
|
|
4699
|
+
}, 8, ["modelValue", "dismiss-away"]);
|
|
4700
|
+
};
|
|
4701
|
+
}
|
|
4702
|
+
});
|
|
4703
|
+
export {
|
|
4704
|
+
At as P,
|
|
4705
|
+
_i as _,
|
|
4706
|
+
gi as a,
|
|
4707
|
+
ir as b,
|
|
4708
|
+
ps as c,
|
|
4709
|
+
ms as d,
|
|
4710
|
+
hs as e,
|
|
4711
|
+
vt as f,
|
|
4712
|
+
us as g,
|
|
4713
|
+
fs as h,
|
|
4714
|
+
It as i,
|
|
4715
|
+
Ft as j,
|
|
4716
|
+
bi as u
|
|
4717
|
+
};
|