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