@feedmepos/mf-inventory-portal 0.0.19-dev.13 → 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-9MdmwrUz.js → ApprovalView-BY13XuOu.js} +5 -5
- package/dist/{BindingsDialog-C-q6Y04n.js → BindingsDialog-B3PP-XkE.js} +22 -22
- package/dist/{BindingsPicker-syyx9h8v.js → BindingsPicker-DL17pRty.js} +17 -17
- package/dist/{BindingsTable-CQ0WyX2i.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-Ofs2UG-9.js → IngredientsView-C-rsKAsF.js} +294 -294
- package/dist/{IntegrationView-BCruLSTA.js → IntegrationView-BkhfPSjM.js} +278 -278
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bvw_BkWY.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Buc21sEN.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BLVAIHDv.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BRijSilS.js} +1 -1
- package/dist/PurchaseOrderPrintPreview-CGMMozPA.js +152 -0
- package/dist/{ReceiveRequestView-Dw-AC1Mw.js → ReceiveRequestView-Bk0pUeEm.js} +7 -7
- package/dist/{RecipeView-B5WkUzLO.js → RecipeView-kzA9kIg8.js} +181 -181
- package/dist/Standalone.vue.d.ts +1 -1
- package/dist/{StockView-CMTxj8Ly.js → StockView-DF-ucES_.js} +23 -23
- package/dist/SupplierView-XlzsU00G.js +813 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-B8IGZmDZ.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-CExCsCFg.js → UnitView-9VMIlEZ_.js} +242 -242
- package/dist/{WarehouseView-DuPizg7w.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 +14 -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-GwZ2MmM_.js → decimal-E3w4eGHF.js} +1 -1
- package/dist/helper/number.d.ts +2 -0
- package/dist/{id-to-date-CMUZ2glF.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-C3IEOm7C.js → layout-BTYR4n3X.js} +1 -1
- package/dist/{purchase-order-transaction-type-DpZQe_jA.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-CjErNF-B.js → xlsx-q6Ctgevr.js} +2759 -2759
- package/dist/{xlsx.util-CMXCCmUA.js → xlsx.util-Cvqg56mI.js} +2 -2
- package/package.json +2 -1
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DlIq3AyC.js +0 -272
- package/dist/PurchaseOrderPrintPreview-Do2KxBzF.js +0 -152
- package/dist/SupplierView-OmZ0X1E1.js +0 -801
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BJMBsA9j.js +0 -1672
- package/dist/TransferTemplateView-Da6ehaJF.js +0 -1101
- package/dist/app-Chj8x632.js +0 -67206
- package/dist/is-linked-ingredient-error-C6AghEwR.js +0 -37
- package/dist/supplier-dG_APcwB.js +0 -54
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
import { defineComponent as O, mergeModels as _e, computed as S, useModel as he, resolveComponent as E, openBlock as U, createElementBlock as T, createElementVNode as u, createVNode as y, withCtx as F, toDisplayString as P, unref as t, Fragment as Se, renderList as xe, ref as N, createBlock as B, createCommentVNode as fe, isRef as pe, watch as we, normalizeStyle as ke, Teleport as Ce } from "vue";
|
|
2
|
+
import { u as ye } from "./supplier-Ed-Bva_-.js";
|
|
3
|
+
import { D as me, R as j, F as M } from "./row-action.enum-PMKMRrZR.js";
|
|
4
|
+
import { c as Ie, _ as Me, F as G, u as $e } from "./layout-BTYR4n3X.js";
|
|
5
|
+
import { c as Q, u as be, a2 as Ue, d as ce, g as Ae, y as De, C as J, h as Re, R as A, b as Fe, j as Pe } from "./app-kYGuBDV8.js";
|
|
6
|
+
import { useI18n as L, useCoreStore as Ne } from "@feedmepos/mf-common";
|
|
7
|
+
import { useDialog as ge, useSnackbar as Ve, useProxiedModel as ve, useBreakpoints as Ee } from "@feedmepos/ui-library";
|
|
8
|
+
import { _ as Te, a as Be } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DoF7wwNT.js";
|
|
9
|
+
import { _ as Le } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
10
|
+
function qe(D, w) {
|
|
11
|
+
const { t: V } = L();
|
|
12
|
+
function o(b, r) {
|
|
13
|
+
if (b === j.Edit) {
|
|
14
|
+
D(Q(r));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (b === j.Delete) {
|
|
18
|
+
w(Q(r));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return { columnDefs: [
|
|
23
|
+
{
|
|
24
|
+
accessorKey: "name",
|
|
25
|
+
header: () => V("inventory.supplier.table.supplier"),
|
|
26
|
+
enableSorting: !0,
|
|
27
|
+
size: 200
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
accessorKey: "contactName",
|
|
31
|
+
header: () => V("inventory.supplier.table.pic"),
|
|
32
|
+
enableSorting: !1,
|
|
33
|
+
size: 250
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
accessorKey: "phoneNumber",
|
|
37
|
+
header: () => V("inventory.supplier.table.contact"),
|
|
38
|
+
enableSorting: !1,
|
|
39
|
+
size: 200
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
accessorKey: "email",
|
|
43
|
+
header: () => V("inventory.supplier.table.email"),
|
|
44
|
+
enableSorting: !1,
|
|
45
|
+
size: "auto"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "action",
|
|
49
|
+
header: "",
|
|
50
|
+
cell(b) {
|
|
51
|
+
return Ie(
|
|
52
|
+
[me[j.Edit], me[j.Delete]],
|
|
53
|
+
(r) => {
|
|
54
|
+
o(r, b.row.original);
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
size: 40,
|
|
59
|
+
meta: {
|
|
60
|
+
cellClass: "",
|
|
61
|
+
headerClass: ""
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
] };
|
|
65
|
+
}
|
|
66
|
+
const ze = { class: "flex flex-col gap-12" }, Ye = { class: "flex flex-col" }, He = { class: "flex items-center gap-8 py-8" }, Ke = { class: "flex-1" }, je = { class: "fm-typo-en-title-sm-800" }, Ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oe = { class: "flex flex-col gap-4" }, Je = { class: "flex-1" }, Qe = { class: "flex flex-col" }, We = { class: "fm-typo-en-body-lg-400" }, Xe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ze = { class: "flex-1" }, el = { class: "flex" }, ll = { class: "text-fm-color-typo-secondary" }, tl = /* @__PURE__ */ O({
|
|
67
|
+
__name: "SupplierSupplyItemField",
|
|
68
|
+
props: /* @__PURE__ */ _e({
|
|
69
|
+
modelValue: {}
|
|
70
|
+
}, {
|
|
71
|
+
modelValue: {},
|
|
72
|
+
modelModifiers: {}
|
|
73
|
+
}),
|
|
74
|
+
emits: ["update:modelValue"],
|
|
75
|
+
setup(D) {
|
|
76
|
+
const w = Ne(), V = be(), o = S(() => V.skus), v = ge(), { t: b } = L(), r = he(D, "modelValue");
|
|
77
|
+
function i() {
|
|
78
|
+
var g;
|
|
79
|
+
const d = V.skus.map((a) => ({
|
|
80
|
+
label: a.name,
|
|
81
|
+
sublabel: a.code,
|
|
82
|
+
value: a._id
|
|
83
|
+
})), _ = ((g = r.value) == null ? void 0 : g.map((a) => a.skuId)) ?? [], k = S(
|
|
84
|
+
() => {
|
|
85
|
+
var a;
|
|
86
|
+
return ((a = Ae(w.currentCountry.value)) == null ? void 0 : a.currency) ?? "MYR";
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
v.open({
|
|
90
|
+
title: b("inventory.supplier.supplyItems.selectItem"),
|
|
91
|
+
closeButton: !0,
|
|
92
|
+
contentComponent: De,
|
|
93
|
+
contentComponentProps: {
|
|
94
|
+
modelValue: _,
|
|
95
|
+
items: d
|
|
96
|
+
},
|
|
97
|
+
primaryActions: {
|
|
98
|
+
text: "Confirm",
|
|
99
|
+
close: !0
|
|
100
|
+
},
|
|
101
|
+
secondaryActions: {
|
|
102
|
+
text: "Close",
|
|
103
|
+
close: !0,
|
|
104
|
+
variant: "tertiary"
|
|
105
|
+
}
|
|
106
|
+
}).onPrimary((a) => {
|
|
107
|
+
const s = a.map((h) => V.skuById[h]).filter((h) => h);
|
|
108
|
+
s.sort((h, n) => h.code.localeCompare(n.code));
|
|
109
|
+
const m = s.map((h) => {
|
|
110
|
+
var e;
|
|
111
|
+
const n = (e = r.value) == null ? void 0 : e.find((c) => c.skuId === h._id);
|
|
112
|
+
return n || {
|
|
113
|
+
skuId: h._id,
|
|
114
|
+
defaultCost: h.defaultCost ?? {
|
|
115
|
+
costPerUnit: {
|
|
116
|
+
currency: k.value,
|
|
117
|
+
amount: 0,
|
|
118
|
+
precision: 2
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
r.value = m;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function f(d) {
|
|
127
|
+
switch (d) {
|
|
128
|
+
case J.MY:
|
|
129
|
+
return "MYR";
|
|
130
|
+
case J.SG:
|
|
131
|
+
return "SGD";
|
|
132
|
+
case J.ID:
|
|
133
|
+
return "IDR";
|
|
134
|
+
default:
|
|
135
|
+
return "MYR";
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function R(d) {
|
|
139
|
+
const _ = [...(r == null ? void 0 : r.value) ?? []];
|
|
140
|
+
_.splice(d, 1), r.value = _;
|
|
141
|
+
}
|
|
142
|
+
function x(d) {
|
|
143
|
+
var g;
|
|
144
|
+
const _ = d.skuId, k = (g = o.value.find((a) => a._id === _)) == null ? void 0 : g.unit;
|
|
145
|
+
if (!k)
|
|
146
|
+
throw new Error(`Cannot find ingredient: ${_}`);
|
|
147
|
+
return k;
|
|
148
|
+
}
|
|
149
|
+
function C(d) {
|
|
150
|
+
return {
|
|
151
|
+
amount: d.defaultCost.costPerUnit,
|
|
152
|
+
measurement: d.defaultCost.measurement
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function I(d, _) {
|
|
156
|
+
const g = (r.value ?? []).map((a) => a.skuId !== d.skuId ? a : {
|
|
157
|
+
...a,
|
|
158
|
+
defaultCost: {
|
|
159
|
+
...a.defaultCost,
|
|
160
|
+
measurement: _.measurement,
|
|
161
|
+
costPerUnit: {
|
|
162
|
+
...a.defaultCost.costPerUnit,
|
|
163
|
+
..._.amount
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
r.value = g;
|
|
168
|
+
}
|
|
169
|
+
return (d, _) => {
|
|
170
|
+
const k = E("FmButton");
|
|
171
|
+
return U(), T("div", ze, [
|
|
172
|
+
u("div", Ye, [
|
|
173
|
+
u("div", He, [
|
|
174
|
+
u("div", Ke, [
|
|
175
|
+
y(Le, { "z-index": 50 }, {
|
|
176
|
+
default: F(() => [
|
|
177
|
+
u("div", je, P(t(b)("inventory.supplier.supplyItems.title")), 1)
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
})
|
|
181
|
+
]),
|
|
182
|
+
u("div", null, [
|
|
183
|
+
y(k, {
|
|
184
|
+
"prepend-icon": "link",
|
|
185
|
+
label: t(b)("inventory.supplier.supplyItems.addItems"),
|
|
186
|
+
variant: "plain",
|
|
187
|
+
onClick: i
|
|
188
|
+
}, null, 8, ["label"])
|
|
189
|
+
])
|
|
190
|
+
]),
|
|
191
|
+
u("div", Ge, P(t(b)("inventory.supplier.supplyItems.overridePriceHint")), 1)
|
|
192
|
+
]),
|
|
193
|
+
u("div", Oe, [
|
|
194
|
+
(U(!0), T(Se, null, xe(r.value, (g, a) => {
|
|
195
|
+
var s, m, h;
|
|
196
|
+
return U(), T("div", {
|
|
197
|
+
key: g.skuId,
|
|
198
|
+
class: "flex"
|
|
199
|
+
}, [
|
|
200
|
+
u("div", Je, [
|
|
201
|
+
u("div", Qe, [
|
|
202
|
+
u("div", We, P((s = t(V).skuById[g.skuId]) == null ? void 0 : s.name), 1),
|
|
203
|
+
u("div", Xe, P((m = t(V).skuById[g.skuId]) == null ? void 0 : m.code), 1)
|
|
204
|
+
])
|
|
205
|
+
]),
|
|
206
|
+
u("div", Ze, [
|
|
207
|
+
u("div", el, [
|
|
208
|
+
y(Ue, {
|
|
209
|
+
"model-value": C(g),
|
|
210
|
+
unit: x(g),
|
|
211
|
+
"onUpdate:modelValue": (n) => I(g, n),
|
|
212
|
+
placement: r.value && a === ((h = r.value) == null ? void 0 : h.length) - 1 ? "top" : "bottom",
|
|
213
|
+
separator: "/",
|
|
214
|
+
"apply-default-rules": "",
|
|
215
|
+
precision: 4,
|
|
216
|
+
"format-minimum-precision": 2
|
|
217
|
+
}, {
|
|
218
|
+
prepend: F(() => {
|
|
219
|
+
var n, l;
|
|
220
|
+
return [
|
|
221
|
+
u("div", ll, P(f(((n = t(w).currentCountry) == null ? void 0 : n.value) ?? t(ce)) === "MYR" ? "RM" : f(((l = t(w).currentCountry) == null ? void 0 : l.value) ?? t(ce))), 1)
|
|
222
|
+
];
|
|
223
|
+
}),
|
|
224
|
+
_: 2
|
|
225
|
+
}, 1032, ["model-value", "unit", "onUpdate:modelValue", "placement"]),
|
|
226
|
+
u("div", null, [
|
|
227
|
+
y(k, {
|
|
228
|
+
"prepend-icon": "close",
|
|
229
|
+
variant: "tertiary",
|
|
230
|
+
onClick: (n) => R(a)
|
|
231
|
+
}, null, 8, ["onClick"])
|
|
232
|
+
])
|
|
233
|
+
])
|
|
234
|
+
])
|
|
235
|
+
]);
|
|
236
|
+
}), 128))
|
|
237
|
+
])
|
|
238
|
+
]);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}), sl = { class: "flex flex-col gap-40" }, ol = { class: "flex flex-col gap-16" }, nl = { class: "flex flex-col gap-8" }, al = { class: "fm-typo-en-title-sm-800" }, rl = { class: "grid grid-cols-2 gap-24" }, ul = { class: "flex flex-col gap-8" }, il = { class: "fm-typo-en-title-sm-800" }, dl = { class: "flex flex-col gap-16" }, pl = {
|
|
242
|
+
key: 0,
|
|
243
|
+
class: "flex flex-col gap-8"
|
|
244
|
+
}, ml = /* @__PURE__ */ O({
|
|
245
|
+
__name: "SupplierForm",
|
|
246
|
+
props: {
|
|
247
|
+
modelValue: {},
|
|
248
|
+
disabled: { type: Boolean }
|
|
249
|
+
},
|
|
250
|
+
emits: ["update:modelValue", "validation-success"],
|
|
251
|
+
setup(D, { expose: w, emit: V }) {
|
|
252
|
+
const o = D, v = V, b = Fe(), r = be(), i = S(() => Re(r.skus, "_id")), { t: f } = L(), R = S({
|
|
253
|
+
get() {
|
|
254
|
+
var l;
|
|
255
|
+
return ((l = o.modelValue) == null ? void 0 : l.name) ?? "";
|
|
256
|
+
},
|
|
257
|
+
set(l) {
|
|
258
|
+
const e = o.modelValue ?? {};
|
|
259
|
+
e.name = l, v("update:modelValue", e);
|
|
260
|
+
}
|
|
261
|
+
}), x = S({
|
|
262
|
+
get() {
|
|
263
|
+
var l;
|
|
264
|
+
return ((l = o.modelValue) == null ? void 0 : l.registrationNumber) ?? "";
|
|
265
|
+
},
|
|
266
|
+
set(l) {
|
|
267
|
+
const e = o.modelValue ?? {};
|
|
268
|
+
e.registrationNumber = l, v("update:modelValue", e);
|
|
269
|
+
}
|
|
270
|
+
}), C = S({
|
|
271
|
+
get() {
|
|
272
|
+
var l, e;
|
|
273
|
+
return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.line1) ?? "";
|
|
274
|
+
},
|
|
275
|
+
set(l) {
|
|
276
|
+
const e = o.modelValue ?? {};
|
|
277
|
+
e.address ?? (e.address = {}), e.address.line1 = l, v("update:modelValue", e);
|
|
278
|
+
}
|
|
279
|
+
}), I = S({
|
|
280
|
+
get() {
|
|
281
|
+
var l, e;
|
|
282
|
+
return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.line2) ?? "";
|
|
283
|
+
},
|
|
284
|
+
set(l) {
|
|
285
|
+
const e = o.modelValue ?? {};
|
|
286
|
+
e.address ?? (e.address = {}), e.address.line2 = l, v("update:modelValue", e);
|
|
287
|
+
}
|
|
288
|
+
}), d = S({
|
|
289
|
+
get() {
|
|
290
|
+
var l, e;
|
|
291
|
+
return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.city) ?? "";
|
|
292
|
+
},
|
|
293
|
+
set(l) {
|
|
294
|
+
const e = o.modelValue ?? {};
|
|
295
|
+
e.address ?? (e.address = {}), e.address.city = l, v("update:modelValue", e);
|
|
296
|
+
}
|
|
297
|
+
}), _ = S({
|
|
298
|
+
get() {
|
|
299
|
+
var l, e;
|
|
300
|
+
return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.postcode) ?? "";
|
|
301
|
+
},
|
|
302
|
+
set(l) {
|
|
303
|
+
const e = o.modelValue ?? {};
|
|
304
|
+
e.address ?? (e.address = {}), e.address.postcode = l, v("update:modelValue", e);
|
|
305
|
+
}
|
|
306
|
+
}), k = S({
|
|
307
|
+
get() {
|
|
308
|
+
var l, e;
|
|
309
|
+
return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.state) ?? "";
|
|
310
|
+
},
|
|
311
|
+
set(l) {
|
|
312
|
+
const e = o.modelValue ?? {};
|
|
313
|
+
e.address ?? (e.address = {}), e.address.state = l, v("update:modelValue", e);
|
|
314
|
+
}
|
|
315
|
+
}), g = S({
|
|
316
|
+
get() {
|
|
317
|
+
var l, e;
|
|
318
|
+
return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.country) ?? "";
|
|
319
|
+
},
|
|
320
|
+
set(l) {
|
|
321
|
+
const e = o.modelValue ?? {};
|
|
322
|
+
e.address ?? (e.address = {}), e.address.country = l, v("update:modelValue", e);
|
|
323
|
+
}
|
|
324
|
+
}), a = S({
|
|
325
|
+
get() {
|
|
326
|
+
var l;
|
|
327
|
+
return ((l = o.modelValue) == null ? void 0 : l.contactName) ?? "";
|
|
328
|
+
},
|
|
329
|
+
set(l) {
|
|
330
|
+
const e = o.modelValue ?? {};
|
|
331
|
+
e.contactName = l, v("update:modelValue", e);
|
|
332
|
+
}
|
|
333
|
+
}), s = S({
|
|
334
|
+
get() {
|
|
335
|
+
var l;
|
|
336
|
+
return ((l = o.modelValue) == null ? void 0 : l.phoneNumber) ?? "";
|
|
337
|
+
},
|
|
338
|
+
set(l) {
|
|
339
|
+
const e = o.modelValue ?? {};
|
|
340
|
+
e.phoneNumber = l, v("update:modelValue", e);
|
|
341
|
+
}
|
|
342
|
+
}), m = S({
|
|
343
|
+
get() {
|
|
344
|
+
var l;
|
|
345
|
+
return ((l = o.modelValue) == null ? void 0 : l.email) ?? "";
|
|
346
|
+
},
|
|
347
|
+
set(l) {
|
|
348
|
+
const e = o.modelValue ?? {};
|
|
349
|
+
e.email = l, v("update:modelValue", e);
|
|
350
|
+
}
|
|
351
|
+
}), h = S({
|
|
352
|
+
get() {
|
|
353
|
+
var e;
|
|
354
|
+
return (((e = o.modelValue) == null ? void 0 : e.supplyItems) ?? []).filter((c) => i.value[c.skuId]);
|
|
355
|
+
},
|
|
356
|
+
set(l) {
|
|
357
|
+
const e = o.modelValue ?? {};
|
|
358
|
+
e.supplyItems = l, v("update:modelValue", e);
|
|
359
|
+
}
|
|
360
|
+
}), n = N();
|
|
361
|
+
return w({
|
|
362
|
+
validateInputs: () => {
|
|
363
|
+
var l, e;
|
|
364
|
+
(e = (l = n.value) == null ? void 0 : l.validateInputs) == null || e.call(l);
|
|
365
|
+
},
|
|
366
|
+
resetInputsValidation: () => {
|
|
367
|
+
var l, e;
|
|
368
|
+
(e = (l = n.value) == null ? void 0 : l.resetInputsValidation) == null || e.call(l);
|
|
369
|
+
},
|
|
370
|
+
resetInputs: () => {
|
|
371
|
+
var l, e;
|
|
372
|
+
(e = (l = n.value) == null ? void 0 : l.resetInputs) == null || e.call(l);
|
|
373
|
+
}
|
|
374
|
+
}), (l, e) => {
|
|
375
|
+
const c = E("FmTextField"), $ = E("FmPhoneNumber"), q = E("FmForm");
|
|
376
|
+
return U(), B(q, {
|
|
377
|
+
ref_key: "formRef",
|
|
378
|
+
ref: n,
|
|
379
|
+
onValidationSuccess: e[12] || (e[12] = (p) => v("validation-success"))
|
|
380
|
+
}, {
|
|
381
|
+
default: F(() => [
|
|
382
|
+
u("div", sl, [
|
|
383
|
+
u("div", ol, [
|
|
384
|
+
y(c, {
|
|
385
|
+
disabled: l.disabled,
|
|
386
|
+
rules: [t(A)()],
|
|
387
|
+
"label-mark": "required",
|
|
388
|
+
label: t(f)("inventory.supplier.companyName"),
|
|
389
|
+
modelValue: R.value,
|
|
390
|
+
"onUpdate:modelValue": e[0] || (e[0] = (p) => R.value = p)
|
|
391
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
392
|
+
y(c, {
|
|
393
|
+
disabled: l.disabled,
|
|
394
|
+
rules: [t(A)()],
|
|
395
|
+
"label-mark": "required",
|
|
396
|
+
label: t(f)("inventory.supplier.registrationNo"),
|
|
397
|
+
modelValue: x.value,
|
|
398
|
+
"onUpdate:modelValue": e[1] || (e[1] = (p) => x.value = p)
|
|
399
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"])
|
|
400
|
+
]),
|
|
401
|
+
u("div", nl, [
|
|
402
|
+
u("div", al, P(t(f)("inventory.supplier.address.title")), 1),
|
|
403
|
+
u("div", rl, [
|
|
404
|
+
y(c, {
|
|
405
|
+
disabled: l.disabled,
|
|
406
|
+
rules: [t(A)()],
|
|
407
|
+
"label-mark": "required",
|
|
408
|
+
label: t(f)("inventory.supplier.address.line1"),
|
|
409
|
+
modelValue: C.value,
|
|
410
|
+
"onUpdate:modelValue": e[2] || (e[2] = (p) => C.value = p)
|
|
411
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
412
|
+
y(c, {
|
|
413
|
+
disabled: l.disabled,
|
|
414
|
+
"label-mark": "optional",
|
|
415
|
+
label: t(f)("inventory.supplier.address.line2"),
|
|
416
|
+
modelValue: I.value,
|
|
417
|
+
"onUpdate:modelValue": e[3] || (e[3] = (p) => I.value = p)
|
|
418
|
+
}, null, 8, ["disabled", "label", "modelValue"]),
|
|
419
|
+
y(c, {
|
|
420
|
+
disabled: l.disabled,
|
|
421
|
+
rules: [t(A)()],
|
|
422
|
+
"label-mark": "required",
|
|
423
|
+
label: t(f)("inventory.supplier.address.city"),
|
|
424
|
+
modelValue: d.value,
|
|
425
|
+
"onUpdate:modelValue": e[4] || (e[4] = (p) => d.value = p)
|
|
426
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
427
|
+
y(c, {
|
|
428
|
+
disabled: l.disabled,
|
|
429
|
+
rules: [t(A)()],
|
|
430
|
+
"label-mark": "required",
|
|
431
|
+
label: t(f)("inventory.supplier.address.postcode"),
|
|
432
|
+
modelValue: _.value,
|
|
433
|
+
"onUpdate:modelValue": e[5] || (e[5] = (p) => _.value = p)
|
|
434
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
435
|
+
y(c, {
|
|
436
|
+
disabled: l.disabled,
|
|
437
|
+
rules: [t(A)()],
|
|
438
|
+
"label-mark": "required",
|
|
439
|
+
label: t(f)("inventory.supplier.address.state"),
|
|
440
|
+
modelValue: k.value,
|
|
441
|
+
"onUpdate:modelValue": e[6] || (e[6] = (p) => k.value = p)
|
|
442
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
443
|
+
y(c, {
|
|
444
|
+
disabled: l.disabled,
|
|
445
|
+
rules: [t(A)()],
|
|
446
|
+
"label-mark": "required",
|
|
447
|
+
label: t(f)("inventory.supplier.address.country"),
|
|
448
|
+
modelValue: g.value,
|
|
449
|
+
"onUpdate:modelValue": e[7] || (e[7] = (p) => g.value = p)
|
|
450
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"])
|
|
451
|
+
])
|
|
452
|
+
]),
|
|
453
|
+
u("div", ul, [
|
|
454
|
+
u("div", il, P(t(f)("inventory.supplier.contact.title")), 1),
|
|
455
|
+
u("div", dl, [
|
|
456
|
+
y(c, {
|
|
457
|
+
disabled: l.disabled,
|
|
458
|
+
rules: [t(A)()],
|
|
459
|
+
"label-mark": "required",
|
|
460
|
+
label: t(f)("inventory.supplier.contact.pic"),
|
|
461
|
+
modelValue: a.value,
|
|
462
|
+
"onUpdate:modelValue": e[8] || (e[8] = (p) => a.value = p)
|
|
463
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
464
|
+
y($, {
|
|
465
|
+
disabled: l.disabled,
|
|
466
|
+
rules: [t(A)()],
|
|
467
|
+
"label-mark": "required",
|
|
468
|
+
label: t(f)("inventory.supplier.contact.phoneNumber"),
|
|
469
|
+
modelValue: s.value,
|
|
470
|
+
"onUpdate:modelValue": e[9] || (e[9] = (p) => s.value = p)
|
|
471
|
+
}, null, 8, ["disabled", "rules", "label", "modelValue"]),
|
|
472
|
+
y(c, {
|
|
473
|
+
disabled: l.disabled,
|
|
474
|
+
"label-mark": "optional",
|
|
475
|
+
label: t(f)("inventory.supplier.contact.email"),
|
|
476
|
+
modelValue: m.value,
|
|
477
|
+
"onUpdate:modelValue": e[10] || (e[10] = (p) => m.value = p)
|
|
478
|
+
}, null, 8, ["disabled", "label", "modelValue"])
|
|
479
|
+
])
|
|
480
|
+
]),
|
|
481
|
+
t(b).enableTotalCost ? (U(), T("div", pl, [
|
|
482
|
+
y(tl, {
|
|
483
|
+
modelValue: h.value,
|
|
484
|
+
"onUpdate:modelValue": e[11] || (e[11] = (p) => h.value = p)
|
|
485
|
+
}, null, 8, ["modelValue"])
|
|
486
|
+
])) : fe("", !0)
|
|
487
|
+
])
|
|
488
|
+
]),
|
|
489
|
+
_: 1
|
|
490
|
+
}, 512);
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
}), cl = { class: "flex gap-4" }, vl = /* @__PURE__ */ O({
|
|
494
|
+
__name: "SupplierDialog",
|
|
495
|
+
props: {
|
|
496
|
+
mode: {},
|
|
497
|
+
supplier: {},
|
|
498
|
+
show: { type: Boolean },
|
|
499
|
+
businessLevel: { type: Boolean }
|
|
500
|
+
},
|
|
501
|
+
emits: ["update:show", "submitted"],
|
|
502
|
+
setup(D, { expose: w, emit: V }) {
|
|
503
|
+
const o = D, v = V, b = N(!1), r = Ve(), { t: i } = L(), f = ye(), R = S(() => {
|
|
504
|
+
switch (o.mode) {
|
|
505
|
+
case M.READ:
|
|
506
|
+
return "";
|
|
507
|
+
case M.UPDATE:
|
|
508
|
+
return i("inventory.supplier.update.title");
|
|
509
|
+
case M.CREATE:
|
|
510
|
+
return i("inventory.supplier.create.title");
|
|
511
|
+
}
|
|
512
|
+
return "";
|
|
513
|
+
}), x = S(() => {
|
|
514
|
+
switch (o.mode) {
|
|
515
|
+
case M.READ:
|
|
516
|
+
return "";
|
|
517
|
+
case M.UPDATE:
|
|
518
|
+
return i("common.save");
|
|
519
|
+
case M.CREATE:
|
|
520
|
+
return i("common.add");
|
|
521
|
+
}
|
|
522
|
+
return "";
|
|
523
|
+
}), C = N();
|
|
524
|
+
w({
|
|
525
|
+
validateInputs: () => {
|
|
526
|
+
var s, m;
|
|
527
|
+
(m = (s = C.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
|
|
528
|
+
},
|
|
529
|
+
resetInputsValidation: () => {
|
|
530
|
+
var s, m;
|
|
531
|
+
(m = (s = C.value) == null ? void 0 : s.resetInputsValidation) == null || m.call(s);
|
|
532
|
+
},
|
|
533
|
+
resetInputs: () => {
|
|
534
|
+
var s, m;
|
|
535
|
+
(m = (s = C.value) == null ? void 0 : s.resetInputs) == null || m.call(s);
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
const I = ve(o, "show"), d = ve(o, "supplier");
|
|
539
|
+
function _() {
|
|
540
|
+
var s, m;
|
|
541
|
+
(m = (s = C.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
|
|
542
|
+
}
|
|
543
|
+
function k() {
|
|
544
|
+
switch (o.mode) {
|
|
545
|
+
case M.READ:
|
|
546
|
+
return;
|
|
547
|
+
case M.UPDATE:
|
|
548
|
+
return a();
|
|
549
|
+
case M.CREATE:
|
|
550
|
+
return g();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
async function g() {
|
|
554
|
+
b.value = !0;
|
|
555
|
+
try {
|
|
556
|
+
await Promise.all([
|
|
557
|
+
f.createSupplier(d.value, o.businessLevel),
|
|
558
|
+
new Promise((s) => setTimeout(s, 1e3))
|
|
559
|
+
]), r.open({
|
|
560
|
+
title: i("common.success"),
|
|
561
|
+
message: i("inventory.supplier.create.success", { name: d.value.name }),
|
|
562
|
+
type: "success"
|
|
563
|
+
}), v("update:show", !1), v("submitted");
|
|
564
|
+
} catch (s) {
|
|
565
|
+
r.open({
|
|
566
|
+
title: "Something went wrong",
|
|
567
|
+
message: `Cannot create ${d.value.name} supplier. Please try again`,
|
|
568
|
+
type: "error"
|
|
569
|
+
}), console.error("cannot create supplier", s);
|
|
570
|
+
} finally {
|
|
571
|
+
b.value = !1;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
async function a() {
|
|
575
|
+
if (d.value === null) {
|
|
576
|
+
r.open({
|
|
577
|
+
title: i("inventory.supplier.update.error.title"),
|
|
578
|
+
message: i("inventory.supplier.update.error.emptySupplier"),
|
|
579
|
+
type: "error"
|
|
580
|
+
});
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
b.value = !0;
|
|
584
|
+
try {
|
|
585
|
+
await Promise.all([
|
|
586
|
+
f.updateSupplier(d.value, o.businessLevel),
|
|
587
|
+
new Promise((s) => setTimeout(s, 1e3))
|
|
588
|
+
]), r.open({
|
|
589
|
+
title: i("common.success"),
|
|
590
|
+
message: i("inventory.supplier.update.success", { name: d.value.name }),
|
|
591
|
+
type: "success"
|
|
592
|
+
}), v("update:show", !1), v("submitted");
|
|
593
|
+
} catch (s) {
|
|
594
|
+
r.open({
|
|
595
|
+
title: i("inventory.supplier.update.error.title"),
|
|
596
|
+
message: i("inventory.supplier.update.error.message"),
|
|
597
|
+
type: "error"
|
|
598
|
+
}), console.error("cannot update supplier", s);
|
|
599
|
+
} finally {
|
|
600
|
+
b.value = !1;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return (s, m) => {
|
|
604
|
+
const h = E("FmButton"), n = E("FmSideSheet");
|
|
605
|
+
return U(), B(n, {
|
|
606
|
+
header: R.value,
|
|
607
|
+
modelValue: t(I),
|
|
608
|
+
"onUpdate:modelValue": m[1] || (m[1] = (l) => pe(I) ? I.value = l : null),
|
|
609
|
+
"dismiss-away": !b.value,
|
|
610
|
+
"close-button": "",
|
|
611
|
+
"max-width": 500
|
|
612
|
+
}, {
|
|
613
|
+
default: F(() => {
|
|
614
|
+
var l;
|
|
615
|
+
return [
|
|
616
|
+
(U(), B(ml, {
|
|
617
|
+
class: "w-full",
|
|
618
|
+
ref_key: "formRef",
|
|
619
|
+
ref: C,
|
|
620
|
+
modelValue: t(d),
|
|
621
|
+
"onUpdate:modelValue": m[0] || (m[0] = (e) => pe(d) ? d.value = e : null),
|
|
622
|
+
onValidationSuccess: k,
|
|
623
|
+
key: ((l = s.supplier) == null ? void 0 : l._id) ?? "",
|
|
624
|
+
disabled: b.value
|
|
625
|
+
}, null, 8, ["modelValue", "disabled"]))
|
|
626
|
+
];
|
|
627
|
+
}),
|
|
628
|
+
"side-sheet-footer": F(() => [
|
|
629
|
+
u("div", cl, [
|
|
630
|
+
y(h, {
|
|
631
|
+
loading: b.value,
|
|
632
|
+
label: x.value,
|
|
633
|
+
onClick: _
|
|
634
|
+
}, null, 8, ["loading", "label"])
|
|
635
|
+
])
|
|
636
|
+
]),
|
|
637
|
+
_: 1
|
|
638
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
}), fl = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, yl = { class: "flex flex-col py-8" }, bl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, gl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _l = {
|
|
642
|
+
key: 0,
|
|
643
|
+
class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
644
|
+
}, hl = "You are managing business-level supplier list. These suppliers will be made visible to all locations.", Al = /* @__PURE__ */ O({
|
|
645
|
+
__name: "SupplierView",
|
|
646
|
+
setup(D) {
|
|
647
|
+
const w = N(!1), V = ye(), o = Pe(), v = N(!1), b = ge(), r = Ve(), { t: i } = L();
|
|
648
|
+
o.watchLocation(f), we(w, f);
|
|
649
|
+
async function f() {
|
|
650
|
+
if (o._currentLocation) {
|
|
651
|
+
v.value = !0;
|
|
652
|
+
try {
|
|
653
|
+
await Promise.all([
|
|
654
|
+
V.readSuppliers(),
|
|
655
|
+
new Promise((l) => setTimeout(l, 1e3))
|
|
656
|
+
]);
|
|
657
|
+
} catch {
|
|
658
|
+
r.open({
|
|
659
|
+
title: "Cannot fetch supplier list",
|
|
660
|
+
type: "error"
|
|
661
|
+
});
|
|
662
|
+
} finally {
|
|
663
|
+
v.value = !1;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const R = S(
|
|
668
|
+
() => w.value ? V.businessSuppliers : V.locationSuppliers
|
|
669
|
+
), x = N({});
|
|
670
|
+
function C() {
|
|
671
|
+
x.value.mode = M.CREATE, x.value.supplier = {}, x.value.show = !0;
|
|
672
|
+
}
|
|
673
|
+
function I(n) {
|
|
674
|
+
x.value.mode = M.UPDATE, x.value.supplier = Q(n), x.value.show = !0;
|
|
675
|
+
}
|
|
676
|
+
async function d(n) {
|
|
677
|
+
b.open({
|
|
678
|
+
title: i("inventory.supplier.delete.confirm"),
|
|
679
|
+
message: i("inventory.supplier.delete.confirmMessage", { name: n.name }),
|
|
680
|
+
primaryActions: {
|
|
681
|
+
text: i("common.delete"),
|
|
682
|
+
close: !0,
|
|
683
|
+
variant: "destructive"
|
|
684
|
+
},
|
|
685
|
+
secondaryActions: {
|
|
686
|
+
text: i("common.cancel"),
|
|
687
|
+
close: !0
|
|
688
|
+
}
|
|
689
|
+
}).onPrimary(() => _(n));
|
|
690
|
+
}
|
|
691
|
+
async function _(n) {
|
|
692
|
+
b.open({
|
|
693
|
+
title: i("inventory.supplier.deletingSupplier"),
|
|
694
|
+
closeButton: !1
|
|
695
|
+
});
|
|
696
|
+
try {
|
|
697
|
+
await V.deleteSupplier(n, w.value), r.open({
|
|
698
|
+
title: i("inventory.supplier.delete.success"),
|
|
699
|
+
message: i("inventory.supplier.delete.successMessage", { name: n == null ? void 0 : n.name }),
|
|
700
|
+
type: "success"
|
|
701
|
+
}), f();
|
|
702
|
+
} catch (l) {
|
|
703
|
+
r.open({
|
|
704
|
+
title: i("inventory.supplier.delete.error"),
|
|
705
|
+
message: i("inventory.supplier.delete.errorMessage", { name: n == null ? void 0 : n.name }),
|
|
706
|
+
type: "error"
|
|
707
|
+
}), console.error("failed to delete supplier", l);
|
|
708
|
+
} finally {
|
|
709
|
+
b.close();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
const { columnDefs: k } = qe(I, d);
|
|
713
|
+
function g(n) {
|
|
714
|
+
n === "create" && C();
|
|
715
|
+
}
|
|
716
|
+
const a = N(""), { breakpoints: s } = Ee(), m = S(() => s.value.xs || s.value.sm ? 10 : 20), h = $e();
|
|
717
|
+
return (n, l) => {
|
|
718
|
+
const e = E("FmTable");
|
|
719
|
+
return U(), B(Te, {
|
|
720
|
+
title: t(i)("inventory.supplier.title"),
|
|
721
|
+
actions: [
|
|
722
|
+
{
|
|
723
|
+
label: t(i)("inventory.supplier.create.title"),
|
|
724
|
+
value: "create",
|
|
725
|
+
isPrimary: !0,
|
|
726
|
+
prependIcon: "add"
|
|
727
|
+
}
|
|
728
|
+
],
|
|
729
|
+
"onClick:action": g
|
|
730
|
+
}, {
|
|
731
|
+
default: F(() => [
|
|
732
|
+
u("div", fl, [
|
|
733
|
+
y(Be, {
|
|
734
|
+
searchable: "",
|
|
735
|
+
"change-location": "",
|
|
736
|
+
search: a.value,
|
|
737
|
+
"onUpdate:search": l[0] || (l[0] = (c) => a.value = c),
|
|
738
|
+
"show-business": "",
|
|
739
|
+
"using-business": w.value,
|
|
740
|
+
"onUpdate:usingBusiness": l[1] || (l[1] = (c) => w.value = c),
|
|
741
|
+
"using-business-helper-text": hl,
|
|
742
|
+
actions: [{ icon: "refresh", onClick: () => f() }]
|
|
743
|
+
}, null, 8, ["search", "using-business", "actions"]),
|
|
744
|
+
y(e, {
|
|
745
|
+
style: ke(t(h).tableHeight),
|
|
746
|
+
"column-defs": t(k),
|
|
747
|
+
"row-data": R.value,
|
|
748
|
+
"search-value": a.value,
|
|
749
|
+
loading: !t(o)._currentLocation || v.value,
|
|
750
|
+
onRowClick: l[2] || (l[2] = (c) => I(c.original)),
|
|
751
|
+
"page-size": m.value
|
|
752
|
+
}, {
|
|
753
|
+
"list-row": F((c) => [
|
|
754
|
+
y(Me, {
|
|
755
|
+
row: c,
|
|
756
|
+
onRowClick: I
|
|
757
|
+
}, {
|
|
758
|
+
default: F(($) => {
|
|
759
|
+
var q, p, W, z, X, Z, ee, le, Y, te, se, oe, ne, H, ae, re, ue, ie, K, de;
|
|
760
|
+
return [
|
|
761
|
+
u("div", yl, [
|
|
762
|
+
u("div", bl, [
|
|
763
|
+
y(t(G), {
|
|
764
|
+
render: (W = (p = (q = $.name) == null ? void 0 : q.column) == null ? void 0 : p.columnDef) == null ? void 0 : W.cell,
|
|
765
|
+
props: (X = (z = $.name) == null ? void 0 : z.getContext) == null ? void 0 : X.call(z)
|
|
766
|
+
}, null, 8, ["render", "props"])
|
|
767
|
+
]),
|
|
768
|
+
u("div", gl, [
|
|
769
|
+
y(t(G), {
|
|
770
|
+
render: (le = (ee = (Z = $.contactName) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : le.cell,
|
|
771
|
+
props: (te = (Y = $.contactName) == null ? void 0 : Y.getContext) == null ? void 0 : te.call(Y)
|
|
772
|
+
}, null, 8, ["render", "props"])
|
|
773
|
+
]),
|
|
774
|
+
u("div", Vl, [
|
|
775
|
+
y(t(G), {
|
|
776
|
+
render: (ne = (oe = (se = $.phoneNumber) == null ? void 0 : se.column) == null ? void 0 : oe.columnDef) == null ? void 0 : ne.cell,
|
|
777
|
+
props: (ae = (H = $.phoneNumber) == null ? void 0 : H.getContext) == null ? void 0 : ae.call(H)
|
|
778
|
+
}, null, 8, ["render", "props"])
|
|
779
|
+
]),
|
|
780
|
+
c.original.email ? (U(), T("div", _l, [
|
|
781
|
+
y(t(G), {
|
|
782
|
+
render: (ie = (ue = (re = $.email) == null ? void 0 : re.column) == null ? void 0 : ue.columnDef) == null ? void 0 : ie.cell,
|
|
783
|
+
props: (de = (K = $.email) == null ? void 0 : K.getContext) == null ? void 0 : de.call(K)
|
|
784
|
+
}, null, 8, ["render", "props"])
|
|
785
|
+
])) : fe("", !0)
|
|
786
|
+
])
|
|
787
|
+
];
|
|
788
|
+
}),
|
|
789
|
+
_: 2
|
|
790
|
+
}, 1032, ["row"])
|
|
791
|
+
]),
|
|
792
|
+
_: 1
|
|
793
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
794
|
+
]),
|
|
795
|
+
(U(), B(Ce, { to: "body" }, [
|
|
796
|
+
y(vl, {
|
|
797
|
+
show: x.value.show,
|
|
798
|
+
"onUpdate:show": l[3] || (l[3] = (c) => x.value.show = c),
|
|
799
|
+
supplier: x.value.supplier,
|
|
800
|
+
mode: x.value.mode,
|
|
801
|
+
businessLevel: w.value,
|
|
802
|
+
onSubmitted: l[4] || (l[4] = (c) => f())
|
|
803
|
+
}, null, 8, ["show", "supplier", "mode", "businessLevel"])
|
|
804
|
+
]))
|
|
805
|
+
]),
|
|
806
|
+
_: 1
|
|
807
|
+
}, 8, ["title", "actions"]);
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
export {
|
|
812
|
+
Al as default
|
|
813
|
+
};
|