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