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