@feedmepos/mf-inventory-portal 0.0.19-dev.12 → 0.0.19-dev.14
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.vue.d.ts +1 -1
- package/dist/{ApprovalView-CuTAFiWC.js → ApprovalView-BY13XuOu.js} +5 -5
- package/dist/{BindingsDialog-C_ndNZ8f.js → BindingsDialog-B3PP-XkE.js} +22 -22
- package/dist/{BindingsPicker-CcAod_ha.js → BindingsPicker-DL17pRty.js} +17 -17
- package/dist/{BindingsTable-Bm4-kj_a.js → BindingsTable-CjKOv7Yw.js} +29 -29
- package/dist/Entry.vue.d.ts +1 -1
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoF7wwNT.js +306 -0
- package/dist/{IngredientsView-CyD65_rv.js → IngredientsView-C-rsKAsF.js} +294 -294
- package/dist/{IntegrationView-Bh1BWAq-.js → IntegrationView-BkhfPSjM.js} +278 -278
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-cw3SEkW_.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Buc21sEN.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-B_kVFkxk.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BRijSilS.js} +1 -1
- package/dist/PurchaseOrderPrintPreview-CGMMozPA.js +152 -0
- package/dist/{ReceiveRequestView-C0r1FIwM.js → ReceiveRequestView-Bk0pUeEm.js} +7 -7
- package/dist/{RecipeView-CYE6gi__.js → RecipeView-kzA9kIg8.js} +181 -181
- package/dist/Standalone.vue.d.ts +1 -1
- package/dist/{StockView-CKyhKuGi.js → StockView-DF-ucES_.js} +23 -23
- package/dist/SupplierView-XlzsU00G.js +813 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-8L6lwGpu.js → TransferDetails.vue_vue_type_script_setup_true_lang-Bp7AJiJ-.js} +106 -106
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-D1NAkXMT.js +1690 -0
- package/dist/TransferTemplateView-CsA2SzQY.js +1279 -0
- package/dist/{UnitView-DXnLq5nR.js → UnitView-9VMIlEZ_.js} +242 -242
- package/dist/{WarehouseView-BCnvqHHp.js → WarehouseView-JTYLFBsu.js} +360 -362
- package/dist/api/bill.d.ts +238 -84
- package/dist/api/supplier.d.ts +4 -4
- package/dist/app-kYGuBDV8.js +68549 -0
- package/dist/app.d.ts +24 -0
- package/dist/app.js +3 -3
- package/dist/components/ChangeLocationComponent.vue.d.ts +11 -1
- package/dist/components/DeferableLoading.vue.d.ts +1 -1
- package/dist/components/DeleteDialog.vue.d.ts +1 -1
- package/dist/components/FmCoordinateInput.vue.d.ts +3 -3
- package/dist/components/FmDroppableField.vue.d.ts +6 -6
- package/dist/components/FmFilterableSelect.vue.d.ts +3 -3
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +21 -10
- package/dist/components/FmMinMaxInput.vue.d.ts +20 -0
- package/dist/components/FmMinMaxInputProps.d.ts +16 -0
- package/dist/components/FmMinMaxInputRules.d.ts +4 -0
- package/dist/components/FmMultiselectDialog.vue.d.ts +5 -5
- package/dist/components/FmMultiselectDialogProps.d.ts +3 -0
- package/dist/components/FmUnitInputRules.d.ts +1 -0
- package/dist/components/MultiSelectDialog.vue.d.ts +1 -1
- package/dist/components/NavigationTab.vue.d.ts +1 -1
- package/dist/components/NumberPrecisionInput.vue.d.ts +3 -3
- package/dist/components/PremiumBadge.vue.d.ts +3 -3
- package/dist/components/PreviewBadge.vue.d.ts +3 -3
- package/dist/components/StockForecast.vue.d.ts +1 -1
- package/dist/components/TableActionableRow.vue.d.ts +4 -4
- package/dist/components/UnitDisplayControl.vue.d.ts +1 -1
- package/dist/components/icons/IconCommunity.vue.d.ts +1 -1
- package/dist/components/icons/IconDocumentation.vue.d.ts +1 -1
- package/dist/components/icons/IconEcosystem.vue.d.ts +1 -1
- package/dist/components/icons/IconSupport.vue.d.ts +1 -1
- package/dist/components/icons/IconTooling.vue.d.ts +1 -1
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
- package/dist/components/map/CoordinateDialog.vue.d.ts +4 -4
- package/dist/components/map/GoogleMap.vue.d.ts +6 -6
- package/dist/components/nested-multiselect/FmNestedMultiselectDialog.vue.d.ts +3 -3
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +3 -3
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +5 -5
- package/dist/components/ui-library/FmDateRangePickerChip.vue.d.ts +5 -5
- package/dist/composable/useIframe.d.ts +1 -1
- package/dist/composable/useSearch.d.ts +1 -1
- package/dist/{decimal-DN0h6619.js → decimal-E3w4eGHF.js} +1 -1
- package/dist/helper/number.d.ts +2 -0
- package/dist/{id-to-date-D1fU6Y7T.js → id-to-date-gyR82hWy.js} +1 -1
- package/dist/is-linked-ingredient-error-fJ2TJb3z.js +37 -0
- package/dist/layout/InventoryLayout.vue.d.ts +1 -1
- package/dist/layout/SingleColumnLayout.vue.d.ts +5 -5
- package/dist/layout/components/NavigationButton.vue.d.ts +4 -4
- package/dist/{layout-DcSLry7F.js → layout-BTYR4n3X.js} +1 -1
- package/dist/{purchase-order-transaction-type-D0c31GiL.js → purchase-order-transaction-type-CUtdDhYo.js} +2 -2
- package/dist/stores/feature.d.ts +2 -1
- package/dist/stores/location.d.ts +108 -148
- package/dist/stores/supplier.d.ts +672 -18
- package/dist/stores/warehouse.d.ts +9 -5
- package/dist/supplier-Ed-Bva_-.js +60 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/InventoryView.vue.d.ts +1 -1
- package/dist/views/SelectBussinessDialog.vue.d.ts +1 -1
- package/dist/views/approval/ApprovalView.vue.d.ts +1 -1
- package/dist/views/dev/ComponentPreview.vue.d.ts +1 -1
- package/dist/views/dev/components/CoordinateTest.vue.d.ts +1 -1
- package/dist/views/dev/components/DateRange.vue.d.ts +1 -1
- package/dist/views/dev/components/FmDecimalInputTest.vue.d.ts +1 -1
- package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +1 -1
- package/dist/views/dev/components/FmSelectTest.vue.d.ts +1 -1
- package/dist/views/dev/components/InventoryIframe.vue.d.ts +1 -1
- package/dist/views/dev/components/LayoutDev.vue.d.ts +1 -1
- package/dist/views/dev/components/MfCommontTest.vue.d.ts +1 -1
- package/dist/views/dev/components/NestedSelection.vue.d.ts +1 -1
- package/dist/views/dev/components/NumberStepper.vue.d.ts +1 -1
- package/dist/views/dev/components/TabStorageTest.vue.d.ts +1 -1
- package/dist/views/dev/components/UnitInput.vue.d.ts +1 -1
- package/dist/views/dev/helpers/pinia-test.d.ts +1 -1
- package/dist/views/home/HomeView.vue.d.ts +1 -1
- package/dist/views/iframe/inventory-bindings/bindings-dialog/BindingsDialog.vue.d.ts +1 -1
- package/dist/views/iframe/inventory-bindings/bindings-picker/BindingsPicker.vue.d.ts +1 -1
- package/dist/views/iframe/inventory-bindings/bindings-table/BindingsTable.vue.d.ts +1 -1
- package/dist/views/ingredients/IngredientsView.vue.d.ts +1 -1
- package/dist/views/ingredients/components/cannot-delete/CannotDelete.vue.d.ts +4 -4
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +3 -3
- package/dist/views/ingredients/components/import-ingredients/ImportIngredientItem.vue.d.ts +1 -1
- package/dist/views/ingredients/components/import-ingredients/ImportIngredients.vue.d.ts +1 -1
- package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItem.vue.d.ts +1 -1
- package/dist/views/ingredients/components/ingredient-dialog/IngredientDialog.vue.d.ts +5 -5
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -4
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +3 -3
- package/dist/views/ingredients/composables/use-ingredient-form.d.ts +8 -8
- package/dist/views/integration/IntegrationView.vue.d.ts +1 -1
- package/dist/views/integration/components/ApplyAddon.vue.d.ts +5 -5
- package/dist/views/integration/components/ApplyProduct.vue.d.ts +5 -5
- package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +5 -5
- package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +5 -5
- package/dist/views/receive-request/ReceiveRequestView.vue.d.ts +1 -1
- package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistory.vue.d.ts +1 -1
- package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +3 -3
- package/dist/views/receive-request/components/transfer-dialog/TransferDialog.vue.d.ts +4 -4
- package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +4 -4
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +27 -27
- package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +4 -4
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -4
- package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +3 -3
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +3 -3
- package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +4 -4
- package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +3 -3
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +0 -8
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1012 -66
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +24 -24
- package/dist/views/receive-request/print-preview/PurchaseOrderPrintPreview.vue.d.ts +1 -1
- package/dist/views/recipe/RecipeView.vue.d.ts +1 -1
- package/dist/views/recipe/components/recipe-dialog/RecipeDialog.vue.d.ts +5 -5
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +4 -4
- package/dist/views/recipe/composables/use-recipe-form.d.ts +8 -8
- package/dist/views/stock/StockView.vue.d.ts +1 -1
- package/dist/views/stock/components/StockHeaderPreview.vue.d.ts +1 -1
- package/dist/views/stock/components/StockHistory.vue.d.ts +3 -3
- package/dist/views/stock/components/StockRecalculateDialog.vue.d.ts +2 -2
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +123 -46
- package/dist/views/stock/components/dialog/AdjustSkuDialog.vue.d.ts +4 -4
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +3 -3
- package/dist/views/stock/components/dialog/ConvertSkuDialog.vue.d.ts +4 -4
- package/dist/views/stock/composables/use-stock-action.d.ts +11 -11
- package/dist/views/supplier/SupplierView.vue.d.ts +1 -1
- package/dist/views/supplier/components/SupplierDialog.vue.d.ts +4 -4
- package/dist/views/supplier/components/SupplierDialogProps.d.ts +1 -0
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +10 -10
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -3
- package/dist/views/supplier/composables/use-supplier-table.d.ts +3 -3
- package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +1 -1
- package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +3 -3
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +4 -4
- package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +3 -3
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +7 -7
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +13 -8
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1020 -79
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +309 -11
- package/dist/views/unit/UnitView.vue.d.ts +1 -1
- package/dist/views/unit/components/unit-dialog/UnitDialog.vue.d.ts +5 -5
- package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +4 -4
- package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +3 -3
- package/dist/views/unit/components/unit-used-by/UnitUsedBy.vue.d.ts +1 -1
- package/dist/views/unit/composables/use-unit-form.d.ts +8 -8
- package/dist/views/warehouse/WarehouseView.vue.d.ts +1 -1
- package/dist/views/warehouse/components/WarehouseDialog.vue.d.ts +4 -4
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +22 -14
- package/dist/{xlsx-yV2SoDMC.js → xlsx-q6Ctgevr.js} +2759 -2759
- package/dist/{xlsx.util-CTIDgqw2.js → xlsx.util-Cvqg56mI.js} +2 -2
- package/package.json +4 -3
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-rDMoAXyd.js +0 -272
- package/dist/PurchaseOrderPrintPreview-Uf0aO8n1.js +0 -152
- package/dist/SupplierView-BSJoZFMr.js +0 -801
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-Bdby-n4P.js +0 -1676
- package/dist/TransferTemplateView-B23JFk-I.js +0 -1101
- package/dist/app-DDxzU9iC.js +0 -67196
- package/dist/is-linked-ingredient-error-C6AghEwR.js +0 -37
- package/dist/supplier-CQXRbSC3.js +0 -54
|
@@ -1,1676 +0,0 @@
|
|
|
1
|
-
import { reactive as je, onMounted as Ke, computed as F, h as O, getCurrentInstance as Le, watch as Be, defineComponent as re, openBlock as S, createElementBlock as I, Fragment as he, renderList as Ie, createElementVNode as m, toDisplayString as A, unref as e, resolveComponent as P, createVNode as k, withCtx as V, createCommentVNode as W, ref as R, createBlock as q, normalizeClass as Ae, normalizeStyle as tt, isRef as me } from "vue";
|
|
2
|
-
import { useBreakpoints as st, components as se, FmButtonVariant as Re, useSnackbar as Se, useDialog as We, useProxiedModel as ot } from "@feedmepos/ui-library";
|
|
3
|
-
import { F as ne, D as Ne, R as be } from "./row-action.enum-PMKMRrZR.js";
|
|
4
|
-
import { P as $, u as nt, f as rt, b as Ye } from "./purchase-order-transaction-type-D0c31GiL.js";
|
|
5
|
-
import { a as Y, t as at, a2 as Ve, D as lt, b as Ze, R as qe, $ as it, a0 as ut, r as ct, G as Qe, l as dt, A as Ue, M as mt, a3 as Ge, c as Te, a6 as pt, O as Ee, P as Oe, a7 as ft, j as Z, a8 as yt, u as Me, n as vt, a9 as bt, aa as ht, ab as _t, E as gt, ac as Ct, y as kt } from "./app-DDxzU9iC.js";
|
|
6
|
-
import { _ as Je, u as wt } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-B_kVFkxk.js";
|
|
7
|
-
import { useI18n as ae } from "@feedmepos/mf-common";
|
|
8
|
-
import "vue-router";
|
|
9
|
-
import { u as xe } from "./supplier-CQXRbSC3.js";
|
|
10
|
-
import { F as pe, c as Tt, _ as St } from "./layout-DcSLry7F.js";
|
|
11
|
-
import { _ as xt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
12
|
-
import { defineStore as Pt } from "pinia";
|
|
13
|
-
function oe(t, p, r, u) {
|
|
14
|
-
var d, v, i;
|
|
15
|
-
if (u != null && u.manualTotalCost)
|
|
16
|
-
return u == null ? void 0 : u.manualTotalCost;
|
|
17
|
-
const f = (i = (v = (d = u == null ? void 0 : u.supplier) == null ? void 0 : d.supplyItems) == null ? void 0 : v.find(
|
|
18
|
-
(b) => b.skuId === t._id
|
|
19
|
-
)) == null ? void 0 : i.defaultCost, s = t.defaultCost, n = f ?? s, C = n == null ? void 0 : n.costPerUnit, c = C ? n != null && n.measurement ? +Y(C) / +Y(n == null ? void 0 : n.measurement.conversion) : +Y(C) : void 0, a = c ? r ? c * +Y(r.conversion) : c : void 0, l = a ? +Y(p) * a : void 0;
|
|
20
|
-
return l ? {
|
|
21
|
-
...at(l ?? 0, 2),
|
|
22
|
-
currency: Ve()
|
|
23
|
-
} : {
|
|
24
|
-
amount: 0,
|
|
25
|
-
precision: 0,
|
|
26
|
-
currency: Ve()
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
var E = /* @__PURE__ */ ((t) => (t.Code = "Code", t.Name = "Name", t.Amount = "Amount", t.Cost = "Cost", t.Delete = "Delete", t))(E || {});
|
|
30
|
-
const Ft = () => {
|
|
31
|
-
const { t } = ae();
|
|
32
|
-
return O(
|
|
33
|
-
Je,
|
|
34
|
-
{
|
|
35
|
-
zIndex: 50,
|
|
36
|
-
class: "whitespace-nowrap"
|
|
37
|
-
},
|
|
38
|
-
t("inventory.transfer.form.items.table.Cost", [Ge()])
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
function $t(t) {
|
|
42
|
-
const { t: p } = ae(), r = je({}), { breakpoints: u } = st(), f = Ze();
|
|
43
|
-
Ke(() => {
|
|
44
|
-
for (const c of t.items) {
|
|
45
|
-
if (!c.totalCost)
|
|
46
|
-
continue;
|
|
47
|
-
const a = oe(c.sku, c.quantity, c.measurement, {
|
|
48
|
-
supplier: t.supplier
|
|
49
|
-
}), l = c.totalCost ?? lt.reset();
|
|
50
|
-
a ? r[c.sku._id] = a.amount !== l.amount || a.precision !== l.precision : r[c.sku._id] = !0;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
function s(c) {
|
|
54
|
-
var l, o, d, v, i, b, w;
|
|
55
|
-
return !!(((o = (l = c.defaultCost) == null ? void 0 : l.costPerUnit) == null ? void 0 : o.amount) ?? ((w = (b = (i = (v = (d = t.supplier) == null ? void 0 : d.supplyItems) == null ? void 0 : v.find((x) => x.skuId === c._id)) == null ? void 0 : i.defaultCost) == null ? void 0 : b.costPerUnit) == null ? void 0 : w.amount));
|
|
56
|
-
}
|
|
57
|
-
const n = [
|
|
58
|
-
{
|
|
59
|
-
id: "Code",
|
|
60
|
-
header: () => p("inventory.transfer.form.items.table.Code"),
|
|
61
|
-
accessorKey: "code",
|
|
62
|
-
size: 96,
|
|
63
|
-
cell(c) {
|
|
64
|
-
const a = c.row.original;
|
|
65
|
-
return O(se.FmTextField, {
|
|
66
|
-
modelValue: a.code,
|
|
67
|
-
"onUpdate:modelValue": (l) => {
|
|
68
|
-
t.updateItem({
|
|
69
|
-
...a,
|
|
70
|
-
code: l
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
key: a.sku._id,
|
|
74
|
-
rules: [qe()],
|
|
75
|
-
labelMark: "required"
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
enableSorting: !1
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "Name",
|
|
82
|
-
header: () => p("inventory.transfer.form.items.table.Name"),
|
|
83
|
-
minSize: 300,
|
|
84
|
-
cell(c) {
|
|
85
|
-
const a = c.row.original;
|
|
86
|
-
return O(se.FmTextField, {
|
|
87
|
-
modelValue: a.name,
|
|
88
|
-
"onUpdate:modelValue": (l) => {
|
|
89
|
-
t.updateItem({
|
|
90
|
-
...a,
|
|
91
|
-
name: l
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
key: a.sku._id,
|
|
95
|
-
rules: [qe()],
|
|
96
|
-
labelMark: "required"
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
enableSorting: !1
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "Amount",
|
|
103
|
-
header: () => p("inventory.transfer.form.items.table.Amount"),
|
|
104
|
-
minSize: 200,
|
|
105
|
-
cell(c) {
|
|
106
|
-
var o, d, v;
|
|
107
|
-
const a = c.row.original, l = !!((v = (d = (o = t.template) == null ? void 0 : o.purchaseOrder) == null ? void 0 : d.items) != null && v.find(
|
|
108
|
-
(i) => i.sku._id === a.sku._id
|
|
109
|
-
));
|
|
110
|
-
return O(it, {
|
|
111
|
-
style: {
|
|
112
|
-
flex: "1 1 0%"
|
|
113
|
-
},
|
|
114
|
-
modelValue: {
|
|
115
|
-
amount: a.quantity ?? { amount: 1, precision: 0 },
|
|
116
|
-
measurement: a.measurement ?? null
|
|
117
|
-
},
|
|
118
|
-
key: a.sku._id,
|
|
119
|
-
unit: a.sku.unit,
|
|
120
|
-
"onUpdate:modelValue": (i) => {
|
|
121
|
-
const b = {
|
|
122
|
-
...a,
|
|
123
|
-
quantity: i.amount,
|
|
124
|
-
measurement: i.measurement
|
|
125
|
-
};
|
|
126
|
-
f.enableTotalCost && (b.totalCost = oe(a.sku, a.quantity, a.measurement, {
|
|
127
|
-
supplier: t.supplier,
|
|
128
|
-
// NOTE: set undefined here if `manualTotalCost[row.sku._id] = false`, so that the function
|
|
129
|
-
// will return the auto calculated default cost instead of the manual total cost
|
|
130
|
-
manualTotalCost: r[a.sku._id] ? b.totalCost : void 0
|
|
131
|
-
})), t.updateItem(b);
|
|
132
|
-
},
|
|
133
|
-
stepper: a.quantityStep,
|
|
134
|
-
disableUnit: l,
|
|
135
|
-
disabled: t.disabled,
|
|
136
|
-
rules: [
|
|
137
|
-
ut(
|
|
138
|
-
+Y(
|
|
139
|
-
a.minimumQuantity ?? {
|
|
140
|
-
amount: 1,
|
|
141
|
-
precision: ct(a.sku.unit, a.measurement)
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
)
|
|
145
|
-
],
|
|
146
|
-
applyDefaultRules: !0
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
enableSorting: !1
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
id: "Cost",
|
|
153
|
-
header: Ft,
|
|
154
|
-
size: 180,
|
|
155
|
-
cell(c) {
|
|
156
|
-
const a = c.row.original, l = s(a.sku), o = u.value.xs || u.value.sm;
|
|
157
|
-
return !r[a.sku._id] && l ? O(
|
|
158
|
-
"div",
|
|
159
|
-
{
|
|
160
|
-
class: [
|
|
161
|
-
"flex gap-4 fm-typo-en-body-md-400 items-center",
|
|
162
|
-
t.disabled ? "text-fm-color-typo-disabled" : ""
|
|
163
|
-
],
|
|
164
|
-
key: a.sku._id
|
|
165
|
-
},
|
|
166
|
-
[
|
|
167
|
-
O(se.FmButton, {
|
|
168
|
-
prependIcon: "edit",
|
|
169
|
-
variant: Re.Tertiary,
|
|
170
|
-
disabled: t.disabled,
|
|
171
|
-
onClick() {
|
|
172
|
-
t.updateItem({
|
|
173
|
-
...a,
|
|
174
|
-
totalCost: oe(a.sku, a.quantity, a.measurement, {
|
|
175
|
-
supplier: t.supplier
|
|
176
|
-
})
|
|
177
|
-
}), r[a.sku._id] = !0;
|
|
178
|
-
}
|
|
179
|
-
}),
|
|
180
|
-
O(
|
|
181
|
-
"div",
|
|
182
|
-
{
|
|
183
|
-
class: "flex flex-col"
|
|
184
|
-
},
|
|
185
|
-
[
|
|
186
|
-
O(
|
|
187
|
-
"span",
|
|
188
|
-
o ? Qe(
|
|
189
|
-
oe(a.sku, a.quantity, a.measurement, {
|
|
190
|
-
supplier: t.supplier
|
|
191
|
-
})
|
|
192
|
-
) : Y(
|
|
193
|
-
oe(a.sku, a.quantity, a.measurement, {
|
|
194
|
-
supplier: t.supplier
|
|
195
|
-
})
|
|
196
|
-
)
|
|
197
|
-
),
|
|
198
|
-
O(
|
|
199
|
-
"span",
|
|
200
|
-
{
|
|
201
|
-
class: [
|
|
202
|
-
"fm-typo-en-body-sm-400",
|
|
203
|
-
t.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
p("inventory.transfer.form.items.autoCalculated")
|
|
207
|
-
)
|
|
208
|
-
]
|
|
209
|
-
)
|
|
210
|
-
]
|
|
211
|
-
) : O(
|
|
212
|
-
se.FmTextField,
|
|
213
|
-
{
|
|
214
|
-
modelValue: Y(a.totalCost ?? { amount: 0, precision: 0 }),
|
|
215
|
-
key: a.sku._id,
|
|
216
|
-
"onUpdate:modelValue": (d) => {
|
|
217
|
-
t.updateItem({
|
|
218
|
-
...a,
|
|
219
|
-
totalCost: {
|
|
220
|
-
...dt(+d),
|
|
221
|
-
currency: Ve()
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
},
|
|
225
|
-
rules: [Ue(0), mt(2)]
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
prepend() {
|
|
229
|
-
return o ? O(
|
|
230
|
-
"div",
|
|
231
|
-
{
|
|
232
|
-
class: [
|
|
233
|
-
"text-fm-typo-en-body-lg-400",
|
|
234
|
-
t.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
235
|
-
]
|
|
236
|
-
},
|
|
237
|
-
Ge()
|
|
238
|
-
) : null;
|
|
239
|
-
},
|
|
240
|
-
append() {
|
|
241
|
-
return l ? O(se.FmButton, {
|
|
242
|
-
prependIcon: "close",
|
|
243
|
-
variant: "tertiary",
|
|
244
|
-
disabled: t.disabled,
|
|
245
|
-
onClick() {
|
|
246
|
-
t.updateItem({
|
|
247
|
-
...a,
|
|
248
|
-
// NOTE: different from PO template, if a default cost is reenabled,
|
|
249
|
-
// the total cost will automatically assigned
|
|
250
|
-
totalCost: oe(a.sku, a.quantity, a.measurement, {
|
|
251
|
-
supplier: t.supplier
|
|
252
|
-
})
|
|
253
|
-
}), r[a.sku._id] = !1;
|
|
254
|
-
}
|
|
255
|
-
}) : null;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
},
|
|
260
|
-
enableSorting: !1
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
id: "Delete",
|
|
264
|
-
header: "",
|
|
265
|
-
cell(c) {
|
|
266
|
-
const a = c.row.original;
|
|
267
|
-
return O(se.FmButton, {
|
|
268
|
-
key: a.sku._id,
|
|
269
|
-
class: "delete-button",
|
|
270
|
-
type: "button",
|
|
271
|
-
icon: "delete",
|
|
272
|
-
variant: "tertiary",
|
|
273
|
-
size: "md",
|
|
274
|
-
disabled: t.disabled,
|
|
275
|
-
onClick: () => {
|
|
276
|
-
t.deleteItem(a);
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
},
|
|
280
|
-
enableSorting: !1,
|
|
281
|
-
size: 40,
|
|
282
|
-
meta: {
|
|
283
|
-
cellClass: "",
|
|
284
|
-
headerClass: ""
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
];
|
|
288
|
-
return {
|
|
289
|
-
columnDefs: F(() => f.enableTotalCost && t.transferType === $.PURCHASE ? n : n.filter(
|
|
290
|
-
(c) => c.id !== "Cost"
|
|
291
|
-
/* Cost */
|
|
292
|
-
))
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
function Dt(t = "modelValue") {
|
|
296
|
-
var s, n;
|
|
297
|
-
const p = ((s = Le()) == null ? void 0 : s.props) ?? {}, r = ((n = Le()) == null ? void 0 : n.emit) ?? (() => {
|
|
298
|
-
}), u = je(Te(p[t])), f = `update:${pt(t)}`;
|
|
299
|
-
return Be(u, (C) => {
|
|
300
|
-
r(f, C);
|
|
301
|
-
}), u;
|
|
302
|
-
}
|
|
303
|
-
const It = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, At = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, Rt = { class: "w-[450px] xs:w-full flex" }, Vt = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Ot = /* @__PURE__ */ m("span", { class: "text-fm-color-typo-secondary" }, "/", -1), Bt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ut = /* @__PURE__ */ m("span", null, /* @__PURE__ */ A(" "), -1), Xe = /* @__PURE__ */ re({
|
|
304
|
-
__name: "SupplierPriceHistory",
|
|
305
|
-
props: {
|
|
306
|
-
prices: {}
|
|
307
|
-
},
|
|
308
|
-
setup(t) {
|
|
309
|
-
const p = xe();
|
|
310
|
-
function r(u) {
|
|
311
|
-
return p.suppliers.find((f) => f._id === u);
|
|
312
|
-
}
|
|
313
|
-
return (u, f) => (S(), I("div", It, [
|
|
314
|
-
(S(!0), I(he, null, Ie(Object.keys(u.prices), (s) => {
|
|
315
|
-
var n;
|
|
316
|
-
return S(), I("div", {
|
|
317
|
-
key: s,
|
|
318
|
-
class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
|
|
319
|
-
}, [
|
|
320
|
-
m("div", At, A((n = r(s)) == null ? void 0 : n.name), 1),
|
|
321
|
-
m("div", Rt, [
|
|
322
|
-
(S(!0), I(he, null, Ie(u.prices[s].slice(0, 3), (C) => {
|
|
323
|
-
var c;
|
|
324
|
-
return S(), I("div", {
|
|
325
|
-
key: C.date,
|
|
326
|
-
class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
|
|
327
|
-
}, [
|
|
328
|
-
m("div", Vt, [
|
|
329
|
-
m("span", null, A(C.totalCost ? e(Qe)(C.totalCost) : "No data"), 1),
|
|
330
|
-
Ot,
|
|
331
|
-
m("span", null, A(e(Y)(C.totalUnit, !1)), 1),
|
|
332
|
-
m("span", null, A(((c = C.measurement) == null ? void 0 : c.abbrev) ?? C.unit.abbrev), 1)
|
|
333
|
-
]),
|
|
334
|
-
m("div", Bt, [
|
|
335
|
-
m("span", null, "(#" + A(C.seqNumber) + ")", 1),
|
|
336
|
-
Ut,
|
|
337
|
-
m("span", null, A(e(Ee)(new Date(C.date))), 1)
|
|
338
|
-
])
|
|
339
|
-
]);
|
|
340
|
-
}), 128))
|
|
341
|
-
])
|
|
342
|
-
]);
|
|
343
|
-
}), 128))
|
|
344
|
-
]));
|
|
345
|
-
}
|
|
346
|
-
}), Et = { class: "flex flex-col gap-8 py-16" }, Mt = { class: "flex items-center" }, Lt = { class: "flex-1 flex gap-1 items-center" }, Nt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ht = { class: "flex gap-8 w-full" }, zt = { class: "flex-1 flex flex-col gap-4" }, jt = /* @__PURE__ */ m("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Kt = { class: "flex-1 flex flex-col gap-4" }, Wt = /* @__PURE__ */ m("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Yt = { class: "flex gap-8 w-full" }, Zt = { class: "flex-1 flex flex-col gap-4" }, Qt = /* @__PURE__ */ m("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Gt = { class: "flex-1 flex flex-col gap-4" }, Jt = /* @__PURE__ */ m("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1), Xt = /* @__PURE__ */ re({
|
|
347
|
-
__name: "TransferItem",
|
|
348
|
-
props: {
|
|
349
|
-
cellByColId: {},
|
|
350
|
-
comparePriceBySku: {},
|
|
351
|
-
showComparePrice: { type: Boolean },
|
|
352
|
-
row: {}
|
|
353
|
-
},
|
|
354
|
-
setup(t) {
|
|
355
|
-
const { t: p } = ae();
|
|
356
|
-
return (r, u) => {
|
|
357
|
-
var n, C, c, a, l, o, d, v, i, b, w, x, Q, M, X, B, H, G, L, N, J, h, g, U, le, z, Pe;
|
|
358
|
-
const f = P("FmLabel"), s = P("FmSpacer");
|
|
359
|
-
return S(), I("div", Et, [
|
|
360
|
-
m("div", Mt, [
|
|
361
|
-
m("div", Lt, [
|
|
362
|
-
m("span", Nt, " (" + A(r.row.original.sku.code) + ") ", 1),
|
|
363
|
-
m("span", qt, A(r.row.original.sku.name), 1)
|
|
364
|
-
]),
|
|
365
|
-
m("div", null, [
|
|
366
|
-
k(e(pe), {
|
|
367
|
-
render: (c = (C = (n = r.cellByColId.Delete) == null ? void 0 : n.column) == null ? void 0 : C.columnDef) == null ? void 0 : c.cell,
|
|
368
|
-
props: (l = (a = r.cellByColId.Delete) == null ? void 0 : a.getContext) == null ? void 0 : l.call(a)
|
|
369
|
-
}, null, 8, ["render", "props"])
|
|
370
|
-
])
|
|
371
|
-
]),
|
|
372
|
-
m("div", Ht, [
|
|
373
|
-
m("div", zt, [
|
|
374
|
-
k(f, {
|
|
375
|
-
label: e(p)(`inventory.transfer.form.items.table.${e(E).Code}`)
|
|
376
|
-
}, null, 8, ["label"]),
|
|
377
|
-
k(e(pe), {
|
|
378
|
-
render: (v = (d = (o = r.cellByColId[e(E).Code]) == null ? void 0 : o.column) == null ? void 0 : d.columnDef) == null ? void 0 : v.cell,
|
|
379
|
-
props: (b = (i = r.cellByColId[e(E).Code]) == null ? void 0 : i.getContext) == null ? void 0 : b.call(i)
|
|
380
|
-
}, null, 8, ["render", "props"]),
|
|
381
|
-
jt
|
|
382
|
-
]),
|
|
383
|
-
m("div", Kt, [
|
|
384
|
-
k(f, {
|
|
385
|
-
label: e(p)(`inventory.transfer.form.items.table.${e(E).Name}`)
|
|
386
|
-
}, null, 8, ["label"]),
|
|
387
|
-
k(e(pe), {
|
|
388
|
-
render: (Q = (x = (w = r.cellByColId[e(E).Name]) == null ? void 0 : w.column) == null ? void 0 : x.columnDef) == null ? void 0 : Q.cell,
|
|
389
|
-
props: (X = (M = r.cellByColId[e(E).Name]) == null ? void 0 : M.getContext) == null ? void 0 : X.call(M)
|
|
390
|
-
}, null, 8, ["render", "props"]),
|
|
391
|
-
Wt
|
|
392
|
-
])
|
|
393
|
-
]),
|
|
394
|
-
m("div", Yt, [
|
|
395
|
-
m("div", Zt, [
|
|
396
|
-
k(f, {
|
|
397
|
-
label: e(p)(`inventory.transfer.form.items.table.${e(E).Amount}`)
|
|
398
|
-
}, null, 8, ["label"]),
|
|
399
|
-
k(e(pe), {
|
|
400
|
-
render: (G = (H = (B = r.cellByColId[e(E).Amount]) == null ? void 0 : B.column) == null ? void 0 : H.columnDef) == null ? void 0 : G.cell,
|
|
401
|
-
props: (N = (L = r.cellByColId[e(E).Amount]) == null ? void 0 : L.getContext) == null ? void 0 : N.call(L)
|
|
402
|
-
}, null, 8, ["render", "props"]),
|
|
403
|
-
Qt
|
|
404
|
-
]),
|
|
405
|
-
m("div", Gt, [
|
|
406
|
-
k(Je, { "z-index": 50 }, {
|
|
407
|
-
default: V(() => [
|
|
408
|
-
k(f, {
|
|
409
|
-
label: e(p)(`inventory.transfer.form.items.table.${e(E).Cost}2`)
|
|
410
|
-
}, null, 8, ["label"])
|
|
411
|
-
]),
|
|
412
|
-
_: 1
|
|
413
|
-
}),
|
|
414
|
-
k(e(pe), {
|
|
415
|
-
render: (g = (h = (J = r.cellByColId[e(E).Cost]) == null ? void 0 : J.column) == null ? void 0 : h.columnDef) == null ? void 0 : g.cell,
|
|
416
|
-
props: (le = (U = r.cellByColId[e(E).Cost]) == null ? void 0 : U.getContext) == null ? void 0 : le.call(U)
|
|
417
|
-
}, null, 8, ["render", "props"]),
|
|
418
|
-
Jt
|
|
419
|
-
])
|
|
420
|
-
]),
|
|
421
|
-
r.showComparePrice && Object.keys(r.comparePriceBySku[(z = r.row.original.sku) == null ? void 0 : z._id] ?? {}).length > 0 ? (S(), I(he, { key: 0 }, [
|
|
422
|
-
k(s, { class: "h-8" }),
|
|
423
|
-
k(Xe, {
|
|
424
|
-
prices: r.comparePriceBySku[(Pe = r.row.original.sku) == null ? void 0 : Pe._id]
|
|
425
|
-
}, null, 8, ["prices"])
|
|
426
|
-
], 64)) : W("", !0)
|
|
427
|
-
]);
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
function ke(t) {
|
|
432
|
-
return ft.parse(t);
|
|
433
|
-
}
|
|
434
|
-
function we(t) {
|
|
435
|
-
return {
|
|
436
|
-
_id: t.doc._id,
|
|
437
|
-
internal: t.type,
|
|
438
|
-
contactName: t.doc.profile.name,
|
|
439
|
-
name: t.doc.profile.name,
|
|
440
|
-
email: t.doc.profile.email,
|
|
441
|
-
phoneNumber: t.doc.profile.phoneNo,
|
|
442
|
-
registrationNumber: t.doc.profile.regNo,
|
|
443
|
-
address: t.doc.profile.address
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
function es(t, p) {
|
|
447
|
-
const r = xe(), u = Z();
|
|
448
|
-
u.watchLocation(async () => {
|
|
449
|
-
await r.readSuppliers();
|
|
450
|
-
const l = t();
|
|
451
|
-
if (l.supplier._id) return;
|
|
452
|
-
const o = r.suppliers[0], d = u.locations[0];
|
|
453
|
-
p({
|
|
454
|
-
...l,
|
|
455
|
-
supplier: o ? ke(o) : d ? we(d) : l.supplier
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
const f = F(
|
|
459
|
-
() => {
|
|
460
|
-
var l, o;
|
|
461
|
-
return typeof ((o = (l = t()) == null ? void 0 : l.supplier) == null ? void 0 : o.internal) == "string" ? $.TRANSFER : $.PURCHASE;
|
|
462
|
-
}
|
|
463
|
-
), s = F({
|
|
464
|
-
get() {
|
|
465
|
-
var l, o;
|
|
466
|
-
return (o = (l = t()) == null ? void 0 : l.supplier) == null ? void 0 : o._id;
|
|
467
|
-
},
|
|
468
|
-
set(l) {
|
|
469
|
-
const o = t() ?? {};
|
|
470
|
-
if (f.value === $.PURCHASE) {
|
|
471
|
-
const i = r.suppliers.find((b) => b._id === l);
|
|
472
|
-
p({
|
|
473
|
-
...o,
|
|
474
|
-
supplier: i ? ke(i) : o.supplier
|
|
475
|
-
});
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
const v = u.locations.find((i) => i.doc._id === l);
|
|
479
|
-
p({
|
|
480
|
-
...o,
|
|
481
|
-
supplier: v ? we(v) : o.supplier
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
}), n = F(() => r.suppliers.map(ke)), C = F(() => {
|
|
485
|
-
var o;
|
|
486
|
-
const l = ((o = u._currentLocation) == null ? void 0 : o.type) === Oe.warehouse;
|
|
487
|
-
return u.locations.filter((d) => {
|
|
488
|
-
var i;
|
|
489
|
-
return !(d.dbName === ((i = u._currentLocation) == null ? void 0 : i.dbName)) && (!l || d.type === Oe.warehouse) && d.acceptRequest;
|
|
490
|
-
}).map(we);
|
|
491
|
-
}), c = F(() => f.value === $.PURCHASE ? n.value.map((o) => ({
|
|
492
|
-
label: o.name,
|
|
493
|
-
value: o._id
|
|
494
|
-
})) : C.value.map((o) => ({
|
|
495
|
-
label: o.name,
|
|
496
|
-
sublabel: o.internal ? `${o.internal}` : void 0,
|
|
497
|
-
value: o._id
|
|
498
|
-
}))), a = F(() => {
|
|
499
|
-
var v, i;
|
|
500
|
-
const l = (i = (v = t()) == null ? void 0 : v.supplier) == null ? void 0 : i._id;
|
|
501
|
-
if (f.value === $.PURCHASE) {
|
|
502
|
-
const b = r.suppliers.find((w) => w._id === l);
|
|
503
|
-
return b ? ke(b) : null;
|
|
504
|
-
}
|
|
505
|
-
const d = u.locations.find((b) => b.doc._id);
|
|
506
|
-
return d ? we(d) : null;
|
|
507
|
-
});
|
|
508
|
-
return {
|
|
509
|
-
transferLocationModel: s,
|
|
510
|
-
transferLocationOptions: c,
|
|
511
|
-
locationOptionsTypePurchase: n,
|
|
512
|
-
locationOptionsTypeTransfer: C,
|
|
513
|
-
selectedLocation: a
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
function ts(t) {
|
|
517
|
-
const p = F({
|
|
518
|
-
get() {
|
|
519
|
-
const s = t.getEffectiveAt();
|
|
520
|
-
return s ? new Date(s) : null;
|
|
521
|
-
},
|
|
522
|
-
set(s) {
|
|
523
|
-
t.setEffectiveAt((s == null ? void 0 : s.toISOString()) ?? null);
|
|
524
|
-
}
|
|
525
|
-
}), r = F({
|
|
526
|
-
get() {
|
|
527
|
-
return !!p.value;
|
|
528
|
-
},
|
|
529
|
-
set(s) {
|
|
530
|
-
s ? p.value = /* @__PURE__ */ new Date() : p.value = null;
|
|
531
|
-
}
|
|
532
|
-
}), u = F({
|
|
533
|
-
get() {
|
|
534
|
-
return p.value === null ? "" : Ee(p.value);
|
|
535
|
-
},
|
|
536
|
-
set(s) {
|
|
537
|
-
s ? p.value = /* @__PURE__ */ new Date(`${s} ${f.value}`) : p.value = null;
|
|
538
|
-
}
|
|
539
|
-
}), f = F({
|
|
540
|
-
get() {
|
|
541
|
-
return p.value === null ? "" : yt(p.value);
|
|
542
|
-
},
|
|
543
|
-
set(s) {
|
|
544
|
-
s ? p.value = /* @__PURE__ */ new Date(`${u.value} ${s}`) : p.value = null;
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
return {
|
|
548
|
-
backdatePo: p,
|
|
549
|
-
backdateSwitch: r,
|
|
550
|
-
backdateModel: u,
|
|
551
|
-
backdateTimeModel: f
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
const ss = {
|
|
555
|
-
width: "24",
|
|
556
|
-
height: "24",
|
|
557
|
-
viewBox: "0 0 24 24",
|
|
558
|
-
fill: "none",
|
|
559
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
560
|
-
}, os = ["fill"], ns = ["fill"], rs = ["stroke"], as = ["stroke"], ls = /* @__PURE__ */ re({
|
|
561
|
-
__name: "SparkIcon",
|
|
562
|
-
props: {
|
|
563
|
-
size: {
|
|
564
|
-
type: Number,
|
|
565
|
-
default: 24
|
|
566
|
-
},
|
|
567
|
-
color: {
|
|
568
|
-
type: String,
|
|
569
|
-
default: "#c7c7cc"
|
|
570
|
-
}
|
|
571
|
-
},
|
|
572
|
-
setup(t) {
|
|
573
|
-
return (p, r) => (S(), I("svg", ss, [
|
|
574
|
-
m("path", {
|
|
575
|
-
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",
|
|
576
|
-
fill: t.color
|
|
577
|
-
}, null, 8, os),
|
|
578
|
-
m("path", {
|
|
579
|
-
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",
|
|
580
|
-
fill: t.color
|
|
581
|
-
}, null, 8, ns),
|
|
582
|
-
m("path", {
|
|
583
|
-
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",
|
|
584
|
-
stroke: t.color,
|
|
585
|
-
"stroke-width": "1.5",
|
|
586
|
-
"stroke-linecap": "round",
|
|
587
|
-
"stroke-linejoin": "round"
|
|
588
|
-
}, null, 8, rs),
|
|
589
|
-
m("path", {
|
|
590
|
-
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",
|
|
591
|
-
stroke: t.color,
|
|
592
|
-
"stroke-width": "1.5",
|
|
593
|
-
"stroke-linecap": "round",
|
|
594
|
-
"stroke-linejoin": "round"
|
|
595
|
-
}, null, 8, as)
|
|
596
|
-
]));
|
|
597
|
-
}
|
|
598
|
-
}), is = { class: "flex gap-8 items-center" }, us = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, cs = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, ds = { class: "flex items-center w-full" }, ms = { class: "flex-1" }, ps = { class: "fm-typo-en-title-sm-800" }, fs = { class: "flex items-start gap-8" }, ys = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, vs = { class: "flex gap-1" }, bs = /* @__PURE__ */ m("div", { class: "grow" }, null, -1), He = /* @__PURE__ */ re({
|
|
599
|
-
__name: "ForecastStock",
|
|
600
|
-
props: {
|
|
601
|
-
disabled: { type: Boolean }
|
|
602
|
-
},
|
|
603
|
-
emits: ["update:poItems"],
|
|
604
|
-
setup(t, { emit: p }) {
|
|
605
|
-
const r = p, u = R(!1), f = R(7), s = wt(), n = Se(), C = Me(), { t: c } = ae();
|
|
606
|
-
async function a() {
|
|
607
|
-
if (f.value < 1)
|
|
608
|
-
return;
|
|
609
|
-
u.value = !1, await s.readPurchaseOrder(f.value);
|
|
610
|
-
const l = [];
|
|
611
|
-
if (s.purchaseOrderForecast.skus.length <= 0) {
|
|
612
|
-
n.open({
|
|
613
|
-
message: c("inventory.transfer.form.items.forecastStock.notAvailable"),
|
|
614
|
-
type: "info"
|
|
615
|
-
});
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
const o = s.purchaseOrderForecast.skus.reduce((d, v) => {
|
|
619
|
-
const i = C.skus.find((x) => x._id === v.id);
|
|
620
|
-
if (d.find((x) => x.sku._id === v.id) || !i)
|
|
621
|
-
return d;
|
|
622
|
-
const w = {
|
|
623
|
-
sku: i,
|
|
624
|
-
code: i.code,
|
|
625
|
-
name: i.name,
|
|
626
|
-
quantity: {
|
|
627
|
-
amount: v.amount,
|
|
628
|
-
precision: 0
|
|
629
|
-
}
|
|
630
|
-
};
|
|
631
|
-
return d.push(w), d;
|
|
632
|
-
}, l);
|
|
633
|
-
r("update:poItems", o);
|
|
634
|
-
}
|
|
635
|
-
return (l, o) => {
|
|
636
|
-
const d = P("FmButton"), v = P("FmIcon"), i = P("FmStepperField"), b = P("FmPopover");
|
|
637
|
-
return S(), q(b, {
|
|
638
|
-
disabled: l.disabled,
|
|
639
|
-
class: "flex",
|
|
640
|
-
"show-popover": u.value,
|
|
641
|
-
onPopoverChanged: o[3] || (o[3] = (w) => u.value = w)
|
|
642
|
-
}, {
|
|
643
|
-
"popover-button": V(() => [
|
|
644
|
-
k(d, {
|
|
645
|
-
label: "unused",
|
|
646
|
-
variant: "secondary",
|
|
647
|
-
"text-color": l.disabled ? "disabled" : "primary",
|
|
648
|
-
"bg-color": "transparent",
|
|
649
|
-
"border-color": l.disabled ? "disabled" : "primary",
|
|
650
|
-
disabled: l.disabled
|
|
651
|
-
}, {
|
|
652
|
-
default: V(() => [
|
|
653
|
-
m("div", is, [
|
|
654
|
-
k(ls, {
|
|
655
|
-
size: 24,
|
|
656
|
-
color: l.disabled ? "#c7c7cc" : "#ff7823"
|
|
657
|
-
}, null, 8, ["color"]),
|
|
658
|
-
m("div", us, A(e(c)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
659
|
-
])
|
|
660
|
-
]),
|
|
661
|
-
_: 1
|
|
662
|
-
}, 8, ["text-color", "border-color", "disabled"])
|
|
663
|
-
]),
|
|
664
|
-
default: V(() => [
|
|
665
|
-
m("div", cs, [
|
|
666
|
-
m("div", ds, [
|
|
667
|
-
m("div", ms, [
|
|
668
|
-
k(xt, { "z-index": 99 }, {
|
|
669
|
-
default: V(() => [
|
|
670
|
-
m("p", ps, A(e(c)("inventory.transfer.form.items.forecastStock.title")), 1)
|
|
671
|
-
]),
|
|
672
|
-
_: 1
|
|
673
|
-
})
|
|
674
|
-
]),
|
|
675
|
-
k(d, {
|
|
676
|
-
icon: "close",
|
|
677
|
-
size: "md",
|
|
678
|
-
variant: "tertiary",
|
|
679
|
-
onClick: o[0] || (o[0] = (w) => u.value = !1)
|
|
680
|
-
})
|
|
681
|
-
]),
|
|
682
|
-
k(i, {
|
|
683
|
-
modelValue: f.value,
|
|
684
|
-
"onUpdate:modelValue": o[1] || (o[1] = (w) => f.value = w),
|
|
685
|
-
label: e(c)("inventory.transfer.form.items.forecastStock.days"),
|
|
686
|
-
rules: [e(Ue)(1)]
|
|
687
|
-
}, {
|
|
688
|
-
"helper-text": V(() => [
|
|
689
|
-
m("div", fs, [
|
|
690
|
-
k(v, {
|
|
691
|
-
name: "warning",
|
|
692
|
-
size: "sm",
|
|
693
|
-
class: "text-fm-color-system-warning-300"
|
|
694
|
-
}),
|
|
695
|
-
m("div", ys, A(e(c)("inventory.transfer.form.items.forecastStock.replace")), 1)
|
|
696
|
-
])
|
|
697
|
-
]),
|
|
698
|
-
_: 1
|
|
699
|
-
}, 8, ["modelValue", "label", "rules"]),
|
|
700
|
-
m("div", vs, [
|
|
701
|
-
bs,
|
|
702
|
-
k(d, {
|
|
703
|
-
label: e(c)("common.cancel"),
|
|
704
|
-
variant: "tertiary",
|
|
705
|
-
onClick: o[2] || (o[2] = (w) => u.value = !1)
|
|
706
|
-
}, null, 8, ["label"]),
|
|
707
|
-
k(d, {
|
|
708
|
-
label: e(c)("inventory.transfer.form.items.forecastStock.generate"),
|
|
709
|
-
onClick: a
|
|
710
|
-
}, null, 8, ["label"])
|
|
711
|
-
])
|
|
712
|
-
])
|
|
713
|
-
]),
|
|
714
|
-
_: 1
|
|
715
|
-
}, 8, ["disabled", "show-popover"]);
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
}), et = vt((t, p) => ({
|
|
719
|
-
async getTemplate(r) {
|
|
720
|
-
const u = Z(), f = `${t.inventoryBackendUrl}/${u.currentLocationDBName}/purchase-order-template/${r}`;
|
|
721
|
-
return p.get(f);
|
|
722
|
-
},
|
|
723
|
-
async readTemplates() {
|
|
724
|
-
const r = Z(), u = `${t.inventoryBackendUrl}/${r.currentLocationDBName}/purchase-order-template`;
|
|
725
|
-
return p.get(u);
|
|
726
|
-
},
|
|
727
|
-
async createTemplate(r) {
|
|
728
|
-
const u = Z(), f = `${t.inventoryBackendUrl}/${u.currentLocationDBName}/purchase-order-template`;
|
|
729
|
-
return p.post(f, r);
|
|
730
|
-
},
|
|
731
|
-
async updateTemplate(r) {
|
|
732
|
-
const u = Z(), f = `${t.inventoryBackendUrl}/${u.currentLocationDBName}/purchase-order-template`;
|
|
733
|
-
return p.post(f, r);
|
|
734
|
-
},
|
|
735
|
-
async deleteTemplate(r) {
|
|
736
|
-
const u = Z(), f = `${t.inventoryBackendUrl}/${u.currentLocationDBName}/purchase-order-template`;
|
|
737
|
-
return p.delete(f, { _id: r._id, _rev: r._rev });
|
|
738
|
-
}
|
|
739
|
-
})), hs = Pt("transferTemplateActions", () => {
|
|
740
|
-
const t = nt("receive/request"), p = We(), r = Se(), u = et(), f = R({});
|
|
741
|
-
function s() {
|
|
742
|
-
f.value = {
|
|
743
|
-
mode: ne.CREATE,
|
|
744
|
-
show: !0,
|
|
745
|
-
"onUpdate:show"(o) {
|
|
746
|
-
f.value.show = o;
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
function n(o) {
|
|
751
|
-
f.value = {
|
|
752
|
-
mode: ne.UPDATE,
|
|
753
|
-
modelValue: o,
|
|
754
|
-
show: !0,
|
|
755
|
-
"onUpdate:show"(d) {
|
|
756
|
-
f.value.show = d;
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
function C(o, d, v) {
|
|
761
|
-
p.open({
|
|
762
|
-
title: `Confirm deleting template ${o.name}?`,
|
|
763
|
-
message: "Deleted template can no longer be retrieved",
|
|
764
|
-
primaryActions: {
|
|
765
|
-
text: "Delete",
|
|
766
|
-
variant: Re.Destructive,
|
|
767
|
-
close: !0
|
|
768
|
-
},
|
|
769
|
-
secondaryActions: {
|
|
770
|
-
text: "Cancel",
|
|
771
|
-
variant: Re.Plain,
|
|
772
|
-
close: !0
|
|
773
|
-
}
|
|
774
|
-
}).onPrimary(async () => {
|
|
775
|
-
r.open({
|
|
776
|
-
title: `Deleting ${o.name}`,
|
|
777
|
-
type: "info"
|
|
778
|
-
});
|
|
779
|
-
try {
|
|
780
|
-
d.value = !0;
|
|
781
|
-
const [i] = await Promise.allSettled([
|
|
782
|
-
u.deleteTemplate(o),
|
|
783
|
-
new Promise((b) => setTimeout(b, 1e3))
|
|
784
|
-
]);
|
|
785
|
-
if (i.status === "rejected") throw i.reason;
|
|
786
|
-
r.open({
|
|
787
|
-
title: `Deleted ${o.name}`,
|
|
788
|
-
type: "success"
|
|
789
|
-
});
|
|
790
|
-
} catch (i) {
|
|
791
|
-
r.open({
|
|
792
|
-
title: `Unable to delete ${o.name}`,
|
|
793
|
-
message: `See error from server: ${i}`,
|
|
794
|
-
type: "error"
|
|
795
|
-
}), console.error("error on deleting purchase order template", i);
|
|
796
|
-
} finally {
|
|
797
|
-
d.value = !1, v();
|
|
798
|
-
}
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
const c = R({});
|
|
802
|
-
function a(o) {
|
|
803
|
-
c.value = {
|
|
804
|
-
template: o,
|
|
805
|
-
show: !0,
|
|
806
|
-
"onUpdate:show"(d) {
|
|
807
|
-
c.value.show = d;
|
|
808
|
-
},
|
|
809
|
-
"onAction:edit"() {
|
|
810
|
-
c.value.show = !1, n(Te(o));
|
|
811
|
-
},
|
|
812
|
-
"onAction:use"() {
|
|
813
|
-
c.value.show = !1, l(Te(o));
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
function l(o) {
|
|
818
|
-
t.promptCreateTransferDialog({
|
|
819
|
-
...o.purchaseOrder,
|
|
820
|
-
template: o._id
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
return {
|
|
824
|
-
createTemplate: s,
|
|
825
|
-
viewTemplate: a,
|
|
826
|
-
updateTemplate: n,
|
|
827
|
-
deleteTemplate: C,
|
|
828
|
-
useTemplate: l,
|
|
829
|
-
templateDialogProps: f,
|
|
830
|
-
templateDetailsProps: c,
|
|
831
|
-
transferFormDialogProps: t.transferDialogProps
|
|
832
|
-
};
|
|
833
|
-
});
|
|
834
|
-
function De(t) {
|
|
835
|
-
var r;
|
|
836
|
-
return ((r = t == null ? void 0 : t.supplier) == null ? void 0 : r.internal) ? $.TRANSFER : $.PURCHASE;
|
|
837
|
-
}
|
|
838
|
-
const ze = "use";
|
|
839
|
-
function _s() {
|
|
840
|
-
const { t } = ae(), { viewTemplate: p, updateTemplate: r, deleteTemplate: u, useTemplate: f } = hs(), s = R(new Array()), n = R(!1), C = Z(), c = et();
|
|
841
|
-
async function a() {
|
|
842
|
-
if (s.value = [], !!C._currentLocation) {
|
|
843
|
-
n.value = !0;
|
|
844
|
-
try {
|
|
845
|
-
const [v] = await Promise.all([
|
|
846
|
-
c.readTemplates(),
|
|
847
|
-
new Promise((i) => setTimeout(i, 1e3))
|
|
848
|
-
]);
|
|
849
|
-
s.value = v;
|
|
850
|
-
} catch (v) {
|
|
851
|
-
console.log("Something went wrong when fetching templates:", v);
|
|
852
|
-
} finally {
|
|
853
|
-
n.value = !1;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
async function l(v) {
|
|
858
|
-
if (!s.value.find((i) => i._id) && C._currentLocation) {
|
|
859
|
-
n.value = !0;
|
|
860
|
-
try {
|
|
861
|
-
const [i] = await Promise.all([
|
|
862
|
-
c.getTemplate(v),
|
|
863
|
-
new Promise((b) => setTimeout(b, 1e3))
|
|
864
|
-
]);
|
|
865
|
-
s.value = [i];
|
|
866
|
-
} catch (i) {
|
|
867
|
-
console.log("Something went wrong when fetching templates:", i);
|
|
868
|
-
} finally {
|
|
869
|
-
n.value = !1;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
function o(v, i) {
|
|
874
|
-
switch (i = Te(i), v) {
|
|
875
|
-
case ze:
|
|
876
|
-
return f(i);
|
|
877
|
-
case be.Details:
|
|
878
|
-
return p(i);
|
|
879
|
-
case be.Edit:
|
|
880
|
-
return r(i);
|
|
881
|
-
case be.Delete:
|
|
882
|
-
return u(i, n, a);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
return { columnDefs: [
|
|
886
|
-
{
|
|
887
|
-
id: "_id",
|
|
888
|
-
accessorKey: "_id",
|
|
889
|
-
header: () => t("inventory.transfer.table.createdAt"),
|
|
890
|
-
cell(v) {
|
|
891
|
-
return rt(`${v.getValue()}`);
|
|
892
|
-
},
|
|
893
|
-
enableSorting: !0
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
id: "name",
|
|
897
|
-
accessorKey: "name",
|
|
898
|
-
header: () => t("inventory.transfer.table.name"),
|
|
899
|
-
enableSorting: !0,
|
|
900
|
-
size: 200
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
id: "supplier",
|
|
904
|
-
accessorKey: "purchaseOrder.supplier.name",
|
|
905
|
-
header: () => t("inventory.transfer.table.transferFrom"),
|
|
906
|
-
enableSorting: !0,
|
|
907
|
-
size: 200
|
|
908
|
-
},
|
|
909
|
-
{
|
|
910
|
-
id: "type",
|
|
911
|
-
header: () => t("inventory.transfer.receiveRequest.details.type.title"),
|
|
912
|
-
enableSorting: !0,
|
|
913
|
-
sortingFn(v, i) {
|
|
914
|
-
const b = De(v.original.purchaseOrder), w = De(i.original.purchaseOrder);
|
|
915
|
-
return b.localeCompare(w);
|
|
916
|
-
},
|
|
917
|
-
size: 200,
|
|
918
|
-
cell(v) {
|
|
919
|
-
const i = De(v.row.original.purchaseOrder), b = t(
|
|
920
|
-
`inventory.transfer.receiveRequest.details.type.${i.toLocaleLowerCase()}`
|
|
921
|
-
);
|
|
922
|
-
return O(se.FmChip, {
|
|
923
|
-
label: b,
|
|
924
|
-
class: "fm-chip-transfer-info",
|
|
925
|
-
compact: !0
|
|
926
|
-
});
|
|
927
|
-
}
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
id: "noOfItems",
|
|
931
|
-
accessorKey: "purchaseOrder.items.length",
|
|
932
|
-
header: () => t("inventory.transfer.table.noOfItems"),
|
|
933
|
-
enableSorting: !1,
|
|
934
|
-
meta: {
|
|
935
|
-
width: "10rem",
|
|
936
|
-
textAlign: "right"
|
|
937
|
-
}
|
|
938
|
-
},
|
|
939
|
-
{
|
|
940
|
-
id: "ref",
|
|
941
|
-
accessorKey: "purchaseOrder.ref",
|
|
942
|
-
header: () => t("inventory.transfer.table.reference"),
|
|
943
|
-
enableSorting: !1,
|
|
944
|
-
size: "auto"
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
id: "action",
|
|
948
|
-
cell(v) {
|
|
949
|
-
const i = v.row.original, b = [
|
|
950
|
-
{
|
|
951
|
-
translationKey: "inventory.transfer.template.use",
|
|
952
|
-
value: ze,
|
|
953
|
-
color: "text-fm-color-typo-primary"
|
|
954
|
-
},
|
|
955
|
-
Ne[be.Edit],
|
|
956
|
-
Ne[be.Delete]
|
|
957
|
-
];
|
|
958
|
-
return Tt(b, (w) => o(w, i));
|
|
959
|
-
},
|
|
960
|
-
enableSorting: !1,
|
|
961
|
-
size: 40,
|
|
962
|
-
meta: {
|
|
963
|
-
cellClass: "",
|
|
964
|
-
headerClass: ""
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
], templates: s, loading: n, fetchTemplates: a, loadTemplate: l };
|
|
968
|
-
}
|
|
969
|
-
function gs() {
|
|
970
|
-
const t = Se(), p = Ye(), r = R(!1);
|
|
971
|
-
Be(r, (n) => {
|
|
972
|
-
n && (f.value = !0, u().finally(() => {
|
|
973
|
-
f.value = !1;
|
|
974
|
-
}));
|
|
975
|
-
});
|
|
976
|
-
async function u() {
|
|
977
|
-
try {
|
|
978
|
-
const { startDate: n, endDate: C } = bt(6), l = (await p.getPurchaseOrders({ start: n, end: C })).filter(
|
|
979
|
-
(o) => {
|
|
980
|
-
var d, v;
|
|
981
|
-
return o.status === ht.enum.COMPLETE && ((d = o.supplier) == null ? void 0 : d.internal) !== "warehouse" && ((v = o.supplier) == null ? void 0 : v.internal) !== "restaurant";
|
|
982
|
-
}
|
|
983
|
-
).reduce((o, d) => {
|
|
984
|
-
const v = new Date(_t(d._id)), i = d.supplier._id;
|
|
985
|
-
for (const b of d.items) {
|
|
986
|
-
if (!b.totalCost) continue;
|
|
987
|
-
const w = o[b.sku._id] ?? {}, x = w[i] ?? [];
|
|
988
|
-
x.push({
|
|
989
|
-
date: v.toISOString(),
|
|
990
|
-
totalUnit: b.quantity,
|
|
991
|
-
totalCost: b.totalCost,
|
|
992
|
-
unit: b.sku.unit,
|
|
993
|
-
measurement: b.measurement,
|
|
994
|
-
seqNumber: d.seqNumber
|
|
995
|
-
}), w[i] = x, o[b.sku._id] = w;
|
|
996
|
-
}
|
|
997
|
-
return o;
|
|
998
|
-
}, {});
|
|
999
|
-
s.value = l;
|
|
1000
|
-
} catch {
|
|
1001
|
-
t.open({
|
|
1002
|
-
title: "Something went wrong",
|
|
1003
|
-
message: "Cannot retrieve supplier purchase history. Please try again."
|
|
1004
|
-
}), r.value = !1;
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
const f = R(!1), s = R({});
|
|
1008
|
-
return {
|
|
1009
|
-
comparePricesToggle: r,
|
|
1010
|
-
comparePriceFetching: f,
|
|
1011
|
-
comparePriceBySku: s
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
const Cs = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, ks = { key: 0 }, ws = ["colspan"], Ts = /* @__PURE__ */ re({
|
|
1015
|
-
__name: "TransferItemTable",
|
|
1016
|
-
props: {
|
|
1017
|
-
row: {},
|
|
1018
|
-
comparePriceBySku: {},
|
|
1019
|
-
showComparePrice: { type: Boolean }
|
|
1020
|
-
},
|
|
1021
|
-
setup(t) {
|
|
1022
|
-
function p(r) {
|
|
1023
|
-
return r.column.columnDef.meta;
|
|
1024
|
-
}
|
|
1025
|
-
return (r, u) => {
|
|
1026
|
-
var f, s;
|
|
1027
|
-
return S(), I(he, null, [
|
|
1028
|
-
m("tr", {
|
|
1029
|
-
class: Ae(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
|
|
1030
|
-
"bg-fm-color-neutral-gray-100": r.row.getIsSelected()
|
|
1031
|
-
}])
|
|
1032
|
-
}, [
|
|
1033
|
-
(S(!0), I(he, null, Ie(r.row.getVisibleCells(), (n) => {
|
|
1034
|
-
var C, c, a, l;
|
|
1035
|
-
return S(), I("td", {
|
|
1036
|
-
key: n.id,
|
|
1037
|
-
class: Ae([
|
|
1038
|
-
"h-[52px] px-16 text-fm-color-typo-primary",
|
|
1039
|
-
((C = p(n)) == null ? void 0 : C.cellClass) ?? "px-16"
|
|
1040
|
-
]),
|
|
1041
|
-
style: tt({
|
|
1042
|
-
width: (c = p(n)) == null ? void 0 : c.width,
|
|
1043
|
-
maxWidth: (a = p(n)) == null ? void 0 : a.maxWidth,
|
|
1044
|
-
textAlign: ((l = p(n)) == null ? void 0 : l.textAlign) ?? "left"
|
|
1045
|
-
})
|
|
1046
|
-
}, [
|
|
1047
|
-
m("span", Cs, [
|
|
1048
|
-
k(e(pe), {
|
|
1049
|
-
render: n.column.columnDef.cell,
|
|
1050
|
-
props: n.getContext()
|
|
1051
|
-
}, null, 8, ["render", "props"])
|
|
1052
|
-
])
|
|
1053
|
-
], 6);
|
|
1054
|
-
}), 128))
|
|
1055
|
-
], 2),
|
|
1056
|
-
r.showComparePrice && Object.keys(r.comparePriceBySku[(f = r.row.original.sku) == null ? void 0 : f._id] ?? {}).length > 0 ? (S(), I("tr", ks, [
|
|
1057
|
-
m("td", {
|
|
1058
|
-
colspan: r.row.getVisibleCells().length
|
|
1059
|
-
}, [
|
|
1060
|
-
k(Xe, {
|
|
1061
|
-
prices: r.comparePriceBySku[(s = r.row.original.sku) == null ? void 0 : s._id]
|
|
1062
|
-
}, null, 8, ["prices"])
|
|
1063
|
-
], 8, ws)
|
|
1064
|
-
])) : W("", !0)
|
|
1065
|
-
], 64);
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
}), Ss = { class: "flex flex-col gap-4" }, xs = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, Ps = { class: "flex flex-col gap-16" }, Fs = { class: "flex flex-col gap-24" }, $s = {
|
|
1069
|
-
key: 0,
|
|
1070
|
-
class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
|
|
1071
|
-
}, Ds = { class: "flex xs:flex-col sm:flex-col" }, Is = /* @__PURE__ */ m("div", { class: "xs:hidden sm:hidden h-48 lg:w-16 md:w-16" }, null, -1), As = {
|
|
1072
|
-
key: 0,
|
|
1073
|
-
class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
|
|
1074
|
-
}, Rs = { class: "flex-1" }, Vs = { class: "flex-1" }, Os = {
|
|
1075
|
-
key: 1,
|
|
1076
|
-
class: "flex items-center gap-4"
|
|
1077
|
-
}, Bs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, Us = { class: "flex flex-col gap-16" }, Es = { class: "flex sm:flex-col xs:flex-col gap-16 items-center xs:items-start sm:items-start" }, Ms = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, Ls = { class: "flex gap-8" }, Ns = {
|
|
1078
|
-
key: 0,
|
|
1079
|
-
class: "xs:w-full"
|
|
1080
|
-
}, qs = /* @__PURE__ */ re({
|
|
1081
|
-
__name: "TransferForm2",
|
|
1082
|
-
props: {
|
|
1083
|
-
modelValue: {},
|
|
1084
|
-
disabled: { type: Boolean },
|
|
1085
|
-
suppliers: {},
|
|
1086
|
-
skus: {},
|
|
1087
|
-
lastClosingDate: {}
|
|
1088
|
-
},
|
|
1089
|
-
emits: ["validation-success", "form:ready"],
|
|
1090
|
-
setup(t, { expose: p, emit: r }) {
|
|
1091
|
-
const u = t, f = r, s = Dt(), { t: n } = ae(), C = Z(), c = Me(), a = xe(), l = Ze(), o = _s(), d = F(
|
|
1092
|
-
() => o.templates.value.find((y) => y._id === s.template)
|
|
1093
|
-
), v = F(() => s.status === "DRAFT" || !s._rev);
|
|
1094
|
-
Ke(async () => {
|
|
1095
|
-
try {
|
|
1096
|
-
if (!s.template) return;
|
|
1097
|
-
await o.loadTemplate(s.template);
|
|
1098
|
-
} finally {
|
|
1099
|
-
f("form:ready");
|
|
1100
|
-
}
|
|
1101
|
-
});
|
|
1102
|
-
const i = F(
|
|
1103
|
-
() => C.currentLocation.type === Oe.restaurant
|
|
1104
|
-
);
|
|
1105
|
-
C.watchLocation(async () => {
|
|
1106
|
-
location && (s.supplier || (s.supplier = a.suppliers.find((y) => y) ?? s.supplier));
|
|
1107
|
-
});
|
|
1108
|
-
const b = We(), w = es(
|
|
1109
|
-
() => s,
|
|
1110
|
-
(y) => {
|
|
1111
|
-
Object.assign(s, y);
|
|
1112
|
-
}
|
|
1113
|
-
), x = F({
|
|
1114
|
-
get() {
|
|
1115
|
-
var y;
|
|
1116
|
-
return typeof ((y = s == null ? void 0 : s.supplier) == null ? void 0 : y.internal) == "string" ? $.TRANSFER : $.PURCHASE;
|
|
1117
|
-
},
|
|
1118
|
-
set(y) {
|
|
1119
|
-
var j;
|
|
1120
|
-
const _ = typeof ((j = s == null ? void 0 : s.supplier) == null ? void 0 : j.internal) == "string" ? $.TRANSFER : $.PURCHASE;
|
|
1121
|
-
y !== _ && (s.supplier = y === $.PURCHASE ? w.locationOptionsTypePurchase.value[0] : w.locationOptionsTypeTransfer.value[0]);
|
|
1122
|
-
}
|
|
1123
|
-
}), Q = F(() => w.transferLocationOptions.value), M = F({
|
|
1124
|
-
get() {
|
|
1125
|
-
return s.supplier._id;
|
|
1126
|
-
},
|
|
1127
|
-
set(y) {
|
|
1128
|
-
w.transferLocationModel.value = y;
|
|
1129
|
-
}
|
|
1130
|
-
}), X = F({
|
|
1131
|
-
get() {
|
|
1132
|
-
return s.remark ?? void 0;
|
|
1133
|
-
},
|
|
1134
|
-
set(y) {
|
|
1135
|
-
s.remark = y;
|
|
1136
|
-
}
|
|
1137
|
-
}), { backdatePo: B, backdateSwitch: H, backdateModel: G, backdateTimeModel: L } = ts({
|
|
1138
|
-
getEffectiveAt() {
|
|
1139
|
-
return s.effectiveAt;
|
|
1140
|
-
},
|
|
1141
|
-
setEffectiveAt(y) {
|
|
1142
|
-
s.effectiveAt = y;
|
|
1143
|
-
}
|
|
1144
|
-
}), { comparePricesToggle: N, comparePriceFetching: J, comparePriceBySku: h } = gs(), g = R();
|
|
1145
|
-
p({
|
|
1146
|
-
validateInputs: () => {
|
|
1147
|
-
var y, _;
|
|
1148
|
-
(_ = (y = g.value) == null ? void 0 : y.validateInputs) == null || _.call(y);
|
|
1149
|
-
},
|
|
1150
|
-
resetInputsValidation: () => {
|
|
1151
|
-
var y, _;
|
|
1152
|
-
(_ = (y = g.value) == null ? void 0 : y.resetInputsValidation) == null || _.call(y);
|
|
1153
|
-
},
|
|
1154
|
-
resetInputs: () => {
|
|
1155
|
-
var y, _;
|
|
1156
|
-
(_ = (y = g.value) == null ? void 0 : y.resetInputs) == null || _.call(y);
|
|
1157
|
-
}
|
|
1158
|
-
});
|
|
1159
|
-
const U = $t({
|
|
1160
|
-
updateItem: (y) => {
|
|
1161
|
-
s.items = s.items.map((_) => _.sku._id !== y.sku._id ? _ : y);
|
|
1162
|
-
},
|
|
1163
|
-
deleteItem: (y) => {
|
|
1164
|
-
s.items = s.items.filter((_) => _.sku._id !== y.sku._id);
|
|
1165
|
-
},
|
|
1166
|
-
get supplier() {
|
|
1167
|
-
return s.supplier;
|
|
1168
|
-
},
|
|
1169
|
-
get items() {
|
|
1170
|
-
return s.items;
|
|
1171
|
-
},
|
|
1172
|
-
get transferType() {
|
|
1173
|
-
return x.value;
|
|
1174
|
-
},
|
|
1175
|
-
get template() {
|
|
1176
|
-
return d.value;
|
|
1177
|
-
},
|
|
1178
|
-
get disabled() {
|
|
1179
|
-
return u.disabled;
|
|
1180
|
-
}
|
|
1181
|
-
}), le = F(() => U.columnDefs.value);
|
|
1182
|
-
function z() {
|
|
1183
|
-
var _e, ye, ge;
|
|
1184
|
-
let y;
|
|
1185
|
-
((D) => {
|
|
1186
|
-
D.IsInTemplate = "IsInTemplate", D.IsOutsideTemplate = "IsOutsideTemplate";
|
|
1187
|
-
})(y || (y = {}));
|
|
1188
|
-
const _ = [
|
|
1189
|
-
{
|
|
1190
|
-
id: "IsInTemplate",
|
|
1191
|
-
label: n("inventory.transfer.form.items.fromTemplate.title"),
|
|
1192
|
-
sublabel: n("inventory.transfer.form.items.fromTemplate.sublabel")
|
|
1193
|
-
},
|
|
1194
|
-
{
|
|
1195
|
-
id: "IsOutsideTemplate",
|
|
1196
|
-
label: n("inventory.transfer.form.items.other.title"),
|
|
1197
|
-
collapse: !0
|
|
1198
|
-
}
|
|
1199
|
-
], j = new Set((ge = (ye = (_e = d.value) == null ? void 0 : _e.purchaseOrder) == null ? void 0 : ye.items) == null ? void 0 : ge.map((D) => D.sku._id)), fe = c.skus.map(
|
|
1200
|
-
(D) => ({
|
|
1201
|
-
label: D.name,
|
|
1202
|
-
sublabel: D.code,
|
|
1203
|
-
value: D,
|
|
1204
|
-
groupId: j.has(D._id) ? "IsInTemplate" : "IsOutsideTemplate"
|
|
1205
|
-
/* IsOutsideTemplate */
|
|
1206
|
-
})
|
|
1207
|
-
), Fe = fe.filter((D) => {
|
|
1208
|
-
var ee;
|
|
1209
|
-
return (ee = s.items) == null ? void 0 : ee.find((ie) => ie.sku._id === D.value._id);
|
|
1210
|
-
}).map((D) => D.value);
|
|
1211
|
-
b.open({
|
|
1212
|
-
title: n("inventory.transfer.form.items.selectItem"),
|
|
1213
|
-
closeButton: !0,
|
|
1214
|
-
contentComponent: kt,
|
|
1215
|
-
contentComponentProps: {
|
|
1216
|
-
modelValue: Fe,
|
|
1217
|
-
items: fe,
|
|
1218
|
-
groups: j.size ? _ : void 0
|
|
1219
|
-
},
|
|
1220
|
-
primaryActions: {
|
|
1221
|
-
text: n("common.confirm"),
|
|
1222
|
-
close: !0
|
|
1223
|
-
},
|
|
1224
|
-
secondaryActions: {
|
|
1225
|
-
text: n("common.close"),
|
|
1226
|
-
close: !0,
|
|
1227
|
-
variant: "tertiary"
|
|
1228
|
-
}
|
|
1229
|
-
}).onPrimary((D) => {
|
|
1230
|
-
const ee = s.items ?? [], ie = D.map((K) => {
|
|
1231
|
-
var Ce, ve;
|
|
1232
|
-
const ue = ee.find((ce) => ce.sku._id === K._id);
|
|
1233
|
-
if (ue)
|
|
1234
|
-
return ue;
|
|
1235
|
-
const te = ((ve = (Ce = d.value) == null ? void 0 : Ce.purchaseOrder.items) == null ? void 0 : ve.find(
|
|
1236
|
-
(ce) => ce.sku._id === K._id
|
|
1237
|
-
)) ?? {
|
|
1238
|
-
sku: K,
|
|
1239
|
-
code: K.code,
|
|
1240
|
-
name: K.name,
|
|
1241
|
-
quantity: {
|
|
1242
|
-
amount: 1,
|
|
1243
|
-
precision: 0
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
return x.value == $.PURCHASE && (te.totalCost = oe(
|
|
1247
|
-
te.sku,
|
|
1248
|
-
te.quantity,
|
|
1249
|
-
te.measurement,
|
|
1250
|
-
{
|
|
1251
|
-
supplier: s.supplier
|
|
1252
|
-
}
|
|
1253
|
-
)), te;
|
|
1254
|
-
});
|
|
1255
|
-
ie.sort((K, ue) => K.sku.code.localeCompare(ue.sku.code)), s.items = ie;
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
function Pe(y) {
|
|
1259
|
-
return y;
|
|
1260
|
-
}
|
|
1261
|
-
return (y, _) => {
|
|
1262
|
-
var ve, ce;
|
|
1263
|
-
const j = P("FmChip"), fe = P("FmSelect"), Fe = P("FmTextField"), _e = P("FmTextarea"), ye = P("FmSwitch"), ge = P("FmDatePicker"), D = P("FmTimePicker"), ee = P("FmFormGroup"), ie = P("FmIcon"), K = P("FmButton"), ue = P("FmTooltip"), te = P("FmTable"), Ce = P("FmForm");
|
|
1264
|
-
return S(), I("div", Ss, [
|
|
1265
|
-
m("div", xs, [
|
|
1266
|
-
(ve = u.modelValue) != null && ve.template ? (S(), q(j, {
|
|
1267
|
-
key: 0,
|
|
1268
|
-
variant: y.disabled ? "warning" : void 0,
|
|
1269
|
-
label: `${e(n)("inventory.transfer.template.title")}: ${((ce = d.value) == null ? void 0 : ce.name) ?? e(n)("inventory.transfer.form.loading")}`,
|
|
1270
|
-
icon: "summarize",
|
|
1271
|
-
compact: ""
|
|
1272
|
-
}, null, 8, ["variant", "label"])) : W("", !0),
|
|
1273
|
-
k(j, {
|
|
1274
|
-
label: e(C).currentLocation.name,
|
|
1275
|
-
icon: "storefront",
|
|
1276
|
-
compact: ""
|
|
1277
|
-
}, null, 8, ["label"]),
|
|
1278
|
-
y.lastClosingDate ? (S(), q(j, {
|
|
1279
|
-
key: 1,
|
|
1280
|
-
label: `${e(n)("inventory.transfer.form.lastClosing")}: ${e(Ee)(y.lastClosingDate)} ${e(gt)(y.lastClosingDate)}`,
|
|
1281
|
-
icon: "calendar_month",
|
|
1282
|
-
compact: ""
|
|
1283
|
-
}, null, 8, ["label"])) : W("", !0)
|
|
1284
|
-
]),
|
|
1285
|
-
k(Ce, {
|
|
1286
|
-
ref_key: "formRef",
|
|
1287
|
-
ref: g,
|
|
1288
|
-
class: "flex flex-col gap-32",
|
|
1289
|
-
disabled: y.disabled,
|
|
1290
|
-
onValidationFailed: console.log,
|
|
1291
|
-
onValidationSuccess: _[12] || (_[12] = ($e) => f("validation-success"))
|
|
1292
|
-
}, {
|
|
1293
|
-
default: V(() => {
|
|
1294
|
-
var $e;
|
|
1295
|
-
return [
|
|
1296
|
-
m("div", Ps, [
|
|
1297
|
-
m("div", Fs, [
|
|
1298
|
-
k(fe, {
|
|
1299
|
-
label: e(n)("inventory.transfer.form.type.title"),
|
|
1300
|
-
"model-value": x.value,
|
|
1301
|
-
"onUpdate:modelValue": _[0] || (_[0] = (T) => x.value = T),
|
|
1302
|
-
items: [
|
|
1303
|
-
{
|
|
1304
|
-
label: e(n)("inventory.transfer.form.type.purchase"),
|
|
1305
|
-
value: e($).PURCHASE,
|
|
1306
|
-
disabled: !e(w).locationOptionsTypePurchase.value.length,
|
|
1307
|
-
sublabel: e(w).locationOptionsTypePurchase.value.length ? void 0 : e(n)("inventory.transfer.form.noSupplierAvailable")
|
|
1308
|
-
},
|
|
1309
|
-
{
|
|
1310
|
-
label: e(n)("inventory.transfer.form.type.transfer"),
|
|
1311
|
-
value: e($).TRANSFER,
|
|
1312
|
-
disabled: !e(w).locationOptionsTypeTransfer.value.length,
|
|
1313
|
-
sublabel: e(w).locationOptionsTypeTransfer.value.length ? void 0 : e(n)("inventory.transfer.form.noLocationAvailable")
|
|
1314
|
-
}
|
|
1315
|
-
],
|
|
1316
|
-
rules: [e(Ue)(1)(Q.value)]
|
|
1317
|
-
}, null, 8, ["label", "model-value", "items", "rules"]),
|
|
1318
|
-
k(fe, {
|
|
1319
|
-
label: x.value === e($).PURCHASE ? e(n)("inventory.transfer.form.purchaseFrom") : e(n)("inventory.transfer.form.transferFrom"),
|
|
1320
|
-
modelValue: M.value,
|
|
1321
|
-
"onUpdate:modelValue": _[1] || (_[1] = (T) => M.value = T),
|
|
1322
|
-
items: Q.value
|
|
1323
|
-
}, null, 8, ["label", "modelValue", "items"]),
|
|
1324
|
-
k(Fe, {
|
|
1325
|
-
label: e(n)("inventory.transfer.form.reference"),
|
|
1326
|
-
"label-mark": "optional",
|
|
1327
|
-
modelValue: e(s).ref,
|
|
1328
|
-
"onUpdate:modelValue": _[2] || (_[2] = (T) => e(s).ref = T)
|
|
1329
|
-
}, null, 8, ["label", "modelValue"]),
|
|
1330
|
-
k(_e, {
|
|
1331
|
-
label: e(n)("inventory.transfer.form.remark"),
|
|
1332
|
-
"label-mark": "optional",
|
|
1333
|
-
"max-length": 240,
|
|
1334
|
-
modelValue: X.value,
|
|
1335
|
-
"onUpdate:modelValue": _[3] || (_[3] = (T) => X.value = T),
|
|
1336
|
-
class: Ae([y.disabled ? "text-fm-color-typo-disabled " : ""])
|
|
1337
|
-
}, null, 8, ["label", "modelValue", "class"]),
|
|
1338
|
-
e(l).enableBackdatePo ? (S(), I("div", $s, [
|
|
1339
|
-
m("div", Ds, [
|
|
1340
|
-
k(ye, {
|
|
1341
|
-
modelValue: e(H),
|
|
1342
|
-
"onUpdate:modelValue": _[4] || (_[4] = (T) => me(H) ? H.value = T : null),
|
|
1343
|
-
label: e(n)("inventory.transfer.form.backdateTransfer"),
|
|
1344
|
-
sublabel: e(n)("inventory.transfer.form.applyTransferToOlderDate"),
|
|
1345
|
-
"label-placement": "right",
|
|
1346
|
-
disabled: i.value && !y.lastClosingDate || y.disabled
|
|
1347
|
-
}, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
|
|
1348
|
-
Is,
|
|
1349
|
-
e(H) ? (S(), I("div", As, [
|
|
1350
|
-
m("div", Rs, [
|
|
1351
|
-
k(ge, {
|
|
1352
|
-
modelValue: e(G),
|
|
1353
|
-
"onUpdate:modelValue": _[5] || (_[5] = (T) => me(G) ? G.value = T : null)
|
|
1354
|
-
}, null, 8, ["modelValue"])
|
|
1355
|
-
]),
|
|
1356
|
-
m("div", Vs, [
|
|
1357
|
-
k(D, {
|
|
1358
|
-
modelValue: e(L),
|
|
1359
|
-
"onUpdate:modelValue": _[6] || (_[6] = (T) => me(L) ? L.value = T : null)
|
|
1360
|
-
}, null, 8, ["modelValue"])
|
|
1361
|
-
])
|
|
1362
|
-
])) : W("", !0)
|
|
1363
|
-
]),
|
|
1364
|
-
e(B) ? (S(), q(ee, {
|
|
1365
|
-
key: 0,
|
|
1366
|
-
modelValue: e(B),
|
|
1367
|
-
"onUpdate:modelValue": _[7] || (_[7] = (T) => me(B) ? B.value = T : null),
|
|
1368
|
-
rules: [e(Ct)(new Date(y.lastClosingDate), /* @__PURE__ */ new Date())]
|
|
1369
|
-
}, null, 8, ["modelValue", "rules"])) : W("", !0),
|
|
1370
|
-
i.value && !y.lastClosingDate ? (S(), I("div", Os, [
|
|
1371
|
-
k(ie, {
|
|
1372
|
-
name: "error",
|
|
1373
|
-
size: "sm",
|
|
1374
|
-
class: "text-fm-color-typo-warning"
|
|
1375
|
-
}),
|
|
1376
|
-
m("span", Bs, A(e(n)("inventory.transfer.form.cannotBackdateWithoutClosing")), 1)
|
|
1377
|
-
])) : W("", !0)
|
|
1378
|
-
])) : W("", !0)
|
|
1379
|
-
])
|
|
1380
|
-
]),
|
|
1381
|
-
m("div", Us, [
|
|
1382
|
-
k(ee, {
|
|
1383
|
-
"model-value": e(s).items,
|
|
1384
|
-
rules: [
|
|
1385
|
-
function(de) {
|
|
1386
|
-
return de && de.length > 0 || e(n)("inventory.transfer.form.mustHaveAtLeastOneItem");
|
|
1387
|
-
}
|
|
1388
|
-
]
|
|
1389
|
-
}, null, 8, ["model-value", "rules"]),
|
|
1390
|
-
m("div", Es, [
|
|
1391
|
-
m("div", Ms, A(e(n)("inventory.transfer.form.items.title")), 1),
|
|
1392
|
-
m("div", Ls, [
|
|
1393
|
-
k(K, {
|
|
1394
|
-
disabled: y.disabled,
|
|
1395
|
-
label: e(n)("inventory.transfer.form.items.addItem"),
|
|
1396
|
-
"prepend-icon": "add",
|
|
1397
|
-
variant: "secondary",
|
|
1398
|
-
"text-color": "primary",
|
|
1399
|
-
"bg-color": "transparent",
|
|
1400
|
-
"border-color": "primary",
|
|
1401
|
-
onClick: _[8] || (_[8] = (T) => z()),
|
|
1402
|
-
size: "md"
|
|
1403
|
-
}, null, 8, ["disabled", "label"]),
|
|
1404
|
-
e(s).template ? (S(), q(ue, {
|
|
1405
|
-
key: 0,
|
|
1406
|
-
"z-index": 50
|
|
1407
|
-
}, {
|
|
1408
|
-
content: V(() => [
|
|
1409
|
-
m("div", null, A(e(n)("inventory.transfer.form.items.forecastStock.notAvailable")), 1)
|
|
1410
|
-
]),
|
|
1411
|
-
default: V(() => [
|
|
1412
|
-
k(He, {
|
|
1413
|
-
"onUpdate:poItems": _[9] || (_[9] = (T) => e(s).items = T),
|
|
1414
|
-
disabled: ""
|
|
1415
|
-
})
|
|
1416
|
-
]),
|
|
1417
|
-
_: 1
|
|
1418
|
-
})) : (S(), q(He, {
|
|
1419
|
-
key: 1,
|
|
1420
|
-
"onUpdate:poItems": _[10] || (_[10] = (T) => e(s).items = T),
|
|
1421
|
-
disabled: y.disabled || !!e(s).template
|
|
1422
|
-
}, null, 8, ["disabled"]))
|
|
1423
|
-
])
|
|
1424
|
-
]),
|
|
1425
|
-
x.value === e($).PURCHASE && v.value && e(l).enableTotalCost && (($e = y.modelValue) != null && $e.items.length) ? (S(), I("div", Ns, [
|
|
1426
|
-
k(ye, {
|
|
1427
|
-
label: e(J) ? e(n)("inventory.transfer.form.items.fetchingData") : e(n)("inventory.transfer.form.items.comparePriceHistory"),
|
|
1428
|
-
"prepend-icon": "compare_arrows",
|
|
1429
|
-
"label-placement": "right",
|
|
1430
|
-
"model-value": e(N),
|
|
1431
|
-
"onUpdate:modelValue": _[11] || (_[11] = (T) => me(N) ? N.value = T : null),
|
|
1432
|
-
disabled: e(J) || y.disabled
|
|
1433
|
-
}, null, 8, ["label", "model-value", "disabled"])
|
|
1434
|
-
])) : W("", !0),
|
|
1435
|
-
(S(), q(te, {
|
|
1436
|
-
"column-defs": le.value,
|
|
1437
|
-
"row-data": e(s).items,
|
|
1438
|
-
key: e(s).items.map((T) => T.sku._id).join("."),
|
|
1439
|
-
"hide-footer": ""
|
|
1440
|
-
}, {
|
|
1441
|
-
"table-row": V((T) => [
|
|
1442
|
-
k(Ts, {
|
|
1443
|
-
"compare-price-by-sku": e(h),
|
|
1444
|
-
"show-compare-price": x.value === e($).PURCHASE && e(N),
|
|
1445
|
-
row: T
|
|
1446
|
-
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row"])
|
|
1447
|
-
]),
|
|
1448
|
-
"list-row": V((T) => [
|
|
1449
|
-
(S(), q(St, {
|
|
1450
|
-
row: T,
|
|
1451
|
-
key: e(s).items.map((de) => de.sku._id).join(".")
|
|
1452
|
-
}, {
|
|
1453
|
-
default: V((de) => [
|
|
1454
|
-
k(Xt, {
|
|
1455
|
-
"compare-price-by-sku": e(h),
|
|
1456
|
-
"show-compare-price": x.value === e($).PURCHASE && e(N),
|
|
1457
|
-
row: T,
|
|
1458
|
-
"cell-by-col-id": de
|
|
1459
|
-
}, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
|
|
1460
|
-
]),
|
|
1461
|
-
_: 2
|
|
1462
|
-
}, 1032, ["row"]))
|
|
1463
|
-
]),
|
|
1464
|
-
_: 1
|
|
1465
|
-
}, 8, ["column-defs", "row-data"]))
|
|
1466
|
-
])
|
|
1467
|
-
];
|
|
1468
|
-
}),
|
|
1469
|
-
_: 1
|
|
1470
|
-
}, 8, ["disabled", "onValidationFailed"])
|
|
1471
|
-
]);
|
|
1472
|
-
};
|
|
1473
|
-
}
|
|
1474
|
-
}), Hs = { class: "flex items-center" }, zs = { class: "fm-typo-en-title-md-800" }, js = { class: "flex gap-4" }, no = /* @__PURE__ */ re({
|
|
1475
|
-
__name: "TransferDialog",
|
|
1476
|
-
props: {
|
|
1477
|
-
mode: {},
|
|
1478
|
-
modelValue: {},
|
|
1479
|
-
template: {},
|
|
1480
|
-
show: { type: Boolean },
|
|
1481
|
-
lastClosingDate: {}
|
|
1482
|
-
},
|
|
1483
|
-
emits: ["update:show", "submitted"],
|
|
1484
|
-
setup(t, { expose: p, emit: r }) {
|
|
1485
|
-
var J;
|
|
1486
|
-
const u = t, f = r, s = Ye(), n = Se(), C = xe(), c = Me(), a = Z(), { t: l } = ae(), o = R(!1), d = R(!1), v = R(!1);
|
|
1487
|
-
async function i(h) {
|
|
1488
|
-
if (h) {
|
|
1489
|
-
d.value = !1;
|
|
1490
|
-
try {
|
|
1491
|
-
await C.readSuppliers(), d.value = !0;
|
|
1492
|
-
} catch {
|
|
1493
|
-
n.open({
|
|
1494
|
-
title: l("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
|
|
1495
|
-
message: l("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
|
|
1496
|
-
type: "error"
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
a.watchLocation(i);
|
|
1502
|
-
function b() {
|
|
1503
|
-
return {
|
|
1504
|
-
remark: void 0,
|
|
1505
|
-
ref: void 0,
|
|
1506
|
-
stockSnapshotId: void 0,
|
|
1507
|
-
effectiveAt: void 0,
|
|
1508
|
-
items: [],
|
|
1509
|
-
supplier: {
|
|
1510
|
-
_rev: void 0,
|
|
1511
|
-
email: void 0,
|
|
1512
|
-
internal: void 0,
|
|
1513
|
-
contactName: void 0,
|
|
1514
|
-
phoneNumber: void 0,
|
|
1515
|
-
registrationNumber: void 0,
|
|
1516
|
-
supplyItems: void 0,
|
|
1517
|
-
_id: "",
|
|
1518
|
-
name: "",
|
|
1519
|
-
address: {
|
|
1520
|
-
line2: void 0,
|
|
1521
|
-
line1: "",
|
|
1522
|
-
state: "",
|
|
1523
|
-
city: "",
|
|
1524
|
-
postcode: "",
|
|
1525
|
-
country: ""
|
|
1526
|
-
}
|
|
1527
|
-
},
|
|
1528
|
-
status: "DRAFT",
|
|
1529
|
-
_id: "",
|
|
1530
|
-
seqNumber: 0,
|
|
1531
|
-
deliveryOrder: []
|
|
1532
|
-
};
|
|
1533
|
-
}
|
|
1534
|
-
const w = ot(u, "show"), x = R(u.modelValue ?? b()), Q = R(((J = u.modelValue) == null ? void 0 : J._id) ?? `${Math.random()}`);
|
|
1535
|
-
Be(
|
|
1536
|
-
() => u.show,
|
|
1537
|
-
(h) => {
|
|
1538
|
-
var g;
|
|
1539
|
-
h && (v.value = !1, x.value = u.modelValue ?? b(), Q.value = ((g = u.modelValue) == null ? void 0 : g._id) ?? `${Math.random()}`);
|
|
1540
|
-
}
|
|
1541
|
-
);
|
|
1542
|
-
const M = F(() => !d.value || !v.value), X = F(() => {
|
|
1543
|
-
switch (u.mode) {
|
|
1544
|
-
case ne.READ:
|
|
1545
|
-
return "View transfer";
|
|
1546
|
-
case ne.CREATE:
|
|
1547
|
-
return l("inventory.transfer.receiveRequest.create.title");
|
|
1548
|
-
case ne.UPDATE:
|
|
1549
|
-
return l("inventory.transfer.receiveRequest.update.title");
|
|
1550
|
-
}
|
|
1551
|
-
return "";
|
|
1552
|
-
}), B = R();
|
|
1553
|
-
p({
|
|
1554
|
-
validateInputs: () => {
|
|
1555
|
-
var h, g;
|
|
1556
|
-
(g = (h = B.value) == null ? void 0 : h.validateInputs) == null || g.call(h);
|
|
1557
|
-
},
|
|
1558
|
-
resetInputsValidation: () => {
|
|
1559
|
-
var h, g;
|
|
1560
|
-
(g = (h = B.value) == null ? void 0 : h.resetInputsValidation) == null || g.call(h);
|
|
1561
|
-
},
|
|
1562
|
-
resetInputs: () => {
|
|
1563
|
-
var h, g;
|
|
1564
|
-
(g = (h = B.value) == null ? void 0 : h.resetInputs) == null || g.call(h);
|
|
1565
|
-
}
|
|
1566
|
-
});
|
|
1567
|
-
async function H() {
|
|
1568
|
-
const h = x.value;
|
|
1569
|
-
o.value = !0, (h.supplier.internal === "warehouse" || h.supplier.internal === "restaurant") && (h.items = h.items.map(({ totalCost: g, ...U }) => U));
|
|
1570
|
-
try {
|
|
1571
|
-
await s.createPurchaseOrder(h), await new Promise((g) => setTimeout(g, 1e3)), n.open({
|
|
1572
|
-
title: l("inventory.transfer.receiveRequest.create.success"),
|
|
1573
|
-
message: l("inventory.transfer.receiveRequest.create.successMessage"),
|
|
1574
|
-
type: "success"
|
|
1575
|
-
}), f("update:show", !1), f("submitted");
|
|
1576
|
-
} catch (g) {
|
|
1577
|
-
n.open({
|
|
1578
|
-
title: l("inventory.transfer.receiveRequest.create.error.title"),
|
|
1579
|
-
message: l("inventory.transfer.receiveRequest.create.error.message"),
|
|
1580
|
-
type: "error"
|
|
1581
|
-
}), console.error("Error in creating purchase order", g);
|
|
1582
|
-
} finally {
|
|
1583
|
-
o.value = !1;
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
async function G() {
|
|
1587
|
-
const h = x.value;
|
|
1588
|
-
o.value = !0, (h.supplier.internal === "warehouse" || h.supplier.internal === "restaurant") && (h.items = h.items.map(({ totalCost: g, ...U }) => U));
|
|
1589
|
-
try {
|
|
1590
|
-
await s.updatePurchaseOrder(h), await new Promise((g) => setTimeout(g, 1e3)), n.open({
|
|
1591
|
-
title: l("inventory.transfer.receiveRequest.update.success"),
|
|
1592
|
-
message: l("inventory.transfer.receiveRequest.update.successMessage"),
|
|
1593
|
-
type: "success"
|
|
1594
|
-
}), f("update:show", !1), f("submitted");
|
|
1595
|
-
} catch (g) {
|
|
1596
|
-
n.open({
|
|
1597
|
-
title: l("inventory.transfer.receiveRequest.update.error.title"),
|
|
1598
|
-
message: l("inventory.transfer.receiveRequest.update.error.message"),
|
|
1599
|
-
type: "error"
|
|
1600
|
-
}), console.error("Error in updating purchase order", g);
|
|
1601
|
-
} finally {
|
|
1602
|
-
o.value = !1;
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
function L() {
|
|
1606
|
-
switch (u.mode) {
|
|
1607
|
-
case ne.CREATE:
|
|
1608
|
-
return H();
|
|
1609
|
-
case ne.UPDATE:
|
|
1610
|
-
return G();
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
function N() {
|
|
1614
|
-
var h, g;
|
|
1615
|
-
(g = (h = B.value) == null ? void 0 : h.validateInputs) == null || g.call(h);
|
|
1616
|
-
}
|
|
1617
|
-
return (h, g) => {
|
|
1618
|
-
const U = P("FmButton"), le = P("FmSideSheet");
|
|
1619
|
-
return S(), q(le, {
|
|
1620
|
-
modelValue: e(w),
|
|
1621
|
-
"onUpdate:modelValue": g[3] || (g[3] = (z) => me(w) ? w.value = z : null),
|
|
1622
|
-
"dismiss-away": "",
|
|
1623
|
-
"close-button": "",
|
|
1624
|
-
"max-width": 900
|
|
1625
|
-
}, {
|
|
1626
|
-
"side-sheet-header": V(() => [
|
|
1627
|
-
m("div", Hs, [
|
|
1628
|
-
m("div", zs, A(X.value), 1)
|
|
1629
|
-
])
|
|
1630
|
-
]),
|
|
1631
|
-
default: V(() => [
|
|
1632
|
-
(S(), q(qs, {
|
|
1633
|
-
class: "w-full",
|
|
1634
|
-
ref_key: "formRef",
|
|
1635
|
-
ref: B,
|
|
1636
|
-
"onForm:ready": g[0] || (g[0] = () => v.value = !0),
|
|
1637
|
-
onValidationSuccess: L,
|
|
1638
|
-
modelValue: x.value,
|
|
1639
|
-
"onUpdate:modelValue": g[1] || (g[1] = (z) => x.value = z),
|
|
1640
|
-
disabled: o.value || M.value,
|
|
1641
|
-
suppliers: e(C).suppliers,
|
|
1642
|
-
skus: e(c).skus,
|
|
1643
|
-
key: Q.value,
|
|
1644
|
-
"last-closing-date": h.lastClosingDate
|
|
1645
|
-
}, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
|
|
1646
|
-
]),
|
|
1647
|
-
"side-sheet-footer": V(() => [
|
|
1648
|
-
m("div", js, [
|
|
1649
|
-
k(U, {
|
|
1650
|
-
loading: o.value,
|
|
1651
|
-
disabled: M.value,
|
|
1652
|
-
label: e(l)("common.save"),
|
|
1653
|
-
onClick: N
|
|
1654
|
-
}, null, 8, ["loading", "disabled", "label"]),
|
|
1655
|
-
k(U, {
|
|
1656
|
-
disabled: M.value,
|
|
1657
|
-
variant: "tertiary",
|
|
1658
|
-
label: e(l)("common.close"),
|
|
1659
|
-
onClick: g[2] || (g[2] = (z) => f("update:show", !1))
|
|
1660
|
-
}, null, 8, ["disabled", "label"])
|
|
1661
|
-
])
|
|
1662
|
-
]),
|
|
1663
|
-
_: 1
|
|
1664
|
-
}, 8, ["modelValue"]);
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
});
|
|
1668
|
-
export {
|
|
1669
|
-
no as _,
|
|
1670
|
-
et as a,
|
|
1671
|
-
hs as b,
|
|
1672
|
-
oe as c,
|
|
1673
|
-
Dt as d,
|
|
1674
|
-
_s as e,
|
|
1675
|
-
es as u
|
|
1676
|
-
};
|