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