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