@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,707 @@
|
|
|
1
|
+
import { n as G, j as $, ag as P, a7 as se, c as E, S as ce, y as le, a8 as ue, J as ie, K as de, ah as me, ad as pe, w as fe, b as ve, a as he } from "./app-P7rGzGsF.js";
|
|
2
|
+
import { ref as b, computed as L, h as ge, defineComponent as ye, onMounted as be, resolveComponent as q, openBlock as k, createElementBlock as K, createElementVNode as N, createVNode as x, createCommentVNode as we, createBlock as z } from "vue";
|
|
3
|
+
import { i as Te } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-6yg6_JPe.js";
|
|
4
|
+
import { F as R, D as H, R as B } from "./row-action.enum-PMKMRrZR.js";
|
|
5
|
+
import { useDialog as J, useSnackbar as Q, FmButtonVariant as Y, components as Se } from "@feedmepos/ui-library";
|
|
6
|
+
import { c as Pe } from "./layout-D-zXtsSp.js";
|
|
7
|
+
import { useCoreStore as M, useI18n as Ae } from "@feedmepos/mf-common";
|
|
8
|
+
import { defineStore as De } from "pinia";
|
|
9
|
+
import { useRouter as $e } from "vue-router";
|
|
10
|
+
const Ce = G((e, n) => {
|
|
11
|
+
const o = $();
|
|
12
|
+
return {
|
|
13
|
+
async readRequests(t) {
|
|
14
|
+
const r = t ?? o.currentLocationDBName, a = `${e.inventoryBackendUrl}/${r}/purchase-request`;
|
|
15
|
+
return await n.get(a);
|
|
16
|
+
},
|
|
17
|
+
async getPurchaseOrders({
|
|
18
|
+
start: t,
|
|
19
|
+
end: r
|
|
20
|
+
}) {
|
|
21
|
+
const a = o.currentLocationDBName, l = `${e.inventoryBackendUrl}/${a}/purchase-order`;
|
|
22
|
+
return await n.get(`${l}?start=${t}&end=${r}`);
|
|
23
|
+
},
|
|
24
|
+
async getPurchaseOrderById(t) {
|
|
25
|
+
const r = o.currentLocationDBName, a = `${e.inventoryBackendUrl}/${r}/purchase-order`;
|
|
26
|
+
return await n.get(`${a}/${t}`);
|
|
27
|
+
},
|
|
28
|
+
async processPurchaseOrder(t, r) {
|
|
29
|
+
const a = o.currentLocationDBName, l = r || a, i = `${e.inventoryBackendUrl}/${l}/purchase-order/run-operation`;
|
|
30
|
+
return await n.put(i, t);
|
|
31
|
+
},
|
|
32
|
+
async createPurchaseOrder(t) {
|
|
33
|
+
const r = o.currentLocationDBName, a = `${e.inventoryBackendUrl}/${r}/purchase-order`;
|
|
34
|
+
return await n.post(a, t);
|
|
35
|
+
},
|
|
36
|
+
async updatePurchaseOrder(t) {
|
|
37
|
+
const r = o.currentLocationDBName, a = `${e.inventoryBackendUrl}/${r}/purchase-order`;
|
|
38
|
+
return await n.put(a, t);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}), _e = {
|
|
42
|
+
[P.enum.confirmDraft]: {
|
|
43
|
+
primaryActions: {
|
|
44
|
+
text: "Confirm draft",
|
|
45
|
+
close: !0
|
|
46
|
+
},
|
|
47
|
+
title: "Confirm draft?",
|
|
48
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
49
|
+
successMessage: "Purchase order draft has been confirmed"
|
|
50
|
+
},
|
|
51
|
+
[P.enum.cancelDraft]: {
|
|
52
|
+
primaryActions: {
|
|
53
|
+
text: "Cancel draft",
|
|
54
|
+
close: !0,
|
|
55
|
+
variant: "destructive"
|
|
56
|
+
},
|
|
57
|
+
title: "Cancel draft?",
|
|
58
|
+
message: "Purchase order cannot be changed after cancelled draft.",
|
|
59
|
+
successMessage: "Purchase order draft has been cancelled"
|
|
60
|
+
},
|
|
61
|
+
[P.enum.submitRequest]: {
|
|
62
|
+
primaryActions: {
|
|
63
|
+
text: "Submit request",
|
|
64
|
+
close: !0
|
|
65
|
+
},
|
|
66
|
+
title: "Confirm draft?",
|
|
67
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
68
|
+
successMessage: "Purchase order draft has been submitted"
|
|
69
|
+
},
|
|
70
|
+
[P.enum.completeReceive]: {
|
|
71
|
+
primaryActions: {
|
|
72
|
+
text: "Mark received",
|
|
73
|
+
close: !0
|
|
74
|
+
},
|
|
75
|
+
title: "Mark as received",
|
|
76
|
+
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
77
|
+
successMessage: "Purchase order has been marked as received"
|
|
78
|
+
},
|
|
79
|
+
[P.enum.approveRequest]: {
|
|
80
|
+
primaryActions: {
|
|
81
|
+
text: "Approve request",
|
|
82
|
+
close: !0
|
|
83
|
+
},
|
|
84
|
+
title: "Approve request?",
|
|
85
|
+
message: "Purchase order will be approved.",
|
|
86
|
+
successMessage: "Purchase order has been approved"
|
|
87
|
+
},
|
|
88
|
+
[P.enum.rejectRequest]: {
|
|
89
|
+
primaryActions: {
|
|
90
|
+
text: "Reject request",
|
|
91
|
+
close: !0,
|
|
92
|
+
variant: "destructive"
|
|
93
|
+
},
|
|
94
|
+
title: "Reject request?",
|
|
95
|
+
message: "Purchase order will be rejected.",
|
|
96
|
+
successMessage: "Purchase order has been rejected"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function Ne(e) {
|
|
100
|
+
const n = Z(e);
|
|
101
|
+
return n === null ? "" : se(n);
|
|
102
|
+
}
|
|
103
|
+
function Z(e) {
|
|
104
|
+
const n = e.match(/\w+_(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z).*/);
|
|
105
|
+
if (!n) return null;
|
|
106
|
+
const o = /* @__PURE__ */ new Date(`${n[1]}`);
|
|
107
|
+
return isNaN(o.getTime()) ? null : o;
|
|
108
|
+
}
|
|
109
|
+
const X = G((e, n) => {
|
|
110
|
+
function o() {
|
|
111
|
+
var p;
|
|
112
|
+
const t = M(), r = $(), a = r.businessLevel, l = `business_${((p = t.currentBusiness.value) == null ? void 0 : p._id) ?? ""}`, i = r.currentLocation.dbName;
|
|
113
|
+
return a ? l : i;
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
async getTemplate(t) {
|
|
117
|
+
const r = o(), a = `${e.inventoryBackendUrl}/${r}/purchase-order-template/${t}`;
|
|
118
|
+
return n.get(a);
|
|
119
|
+
},
|
|
120
|
+
async getLocationTemplate(t) {
|
|
121
|
+
const a = $().currentLocation.dbName, l = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${t}`;
|
|
122
|
+
return n.get(l);
|
|
123
|
+
},
|
|
124
|
+
async getBusinessTemplate(t) {
|
|
125
|
+
var i;
|
|
126
|
+
const a = `business_${((i = M().currentBusiness.value) == null ? void 0 : i._id) ?? ""}`, l = `${e.inventoryBackendUrl}/${a}/purchase-order-template/${t}`;
|
|
127
|
+
return n.get(l);
|
|
128
|
+
},
|
|
129
|
+
async readTemplates() {
|
|
130
|
+
const t = o(), r = `${e.inventoryBackendUrl}/${t}/purchase-order-template`;
|
|
131
|
+
return n.get(r);
|
|
132
|
+
},
|
|
133
|
+
async readLocationTemplates() {
|
|
134
|
+
const r = $().currentLocation.dbName, a = `${e.inventoryBackendUrl}/${r}/purchase-order-template`;
|
|
135
|
+
return n.get(a);
|
|
136
|
+
},
|
|
137
|
+
async readBusinessTemplates() {
|
|
138
|
+
var l;
|
|
139
|
+
const r = `business_${((l = M().currentBusiness.value) == null ? void 0 : l._id) ?? ""}`, a = `${e.inventoryBackendUrl}/${r}/purchase-order-template`;
|
|
140
|
+
return n.get(a);
|
|
141
|
+
},
|
|
142
|
+
async createTemplate(t) {
|
|
143
|
+
const r = o(), a = `${e.inventoryBackendUrl}/${r}/purchase-order-template`;
|
|
144
|
+
return n.post(a, t);
|
|
145
|
+
},
|
|
146
|
+
async updateTemplate(t) {
|
|
147
|
+
const r = o(), a = `${e.inventoryBackendUrl}/${r}/purchase-order-template`;
|
|
148
|
+
return n.put(a, t);
|
|
149
|
+
},
|
|
150
|
+
async deleteTemplate(t) {
|
|
151
|
+
const r = o(), a = `${e.inventoryBackendUrl}/${r}/purchase-order-template`;
|
|
152
|
+
return n.delete(a, { _id: t._id, _rev: t._rev });
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}), Be = De("transferTemplateActions", () => {
|
|
156
|
+
const e = Fe("receive/request"), n = J(), o = Q(), t = X(), r = b({});
|
|
157
|
+
function a() {
|
|
158
|
+
r.value = {
|
|
159
|
+
mode: R.CREATE,
|
|
160
|
+
show: !0,
|
|
161
|
+
"onUpdate:show"(d) {
|
|
162
|
+
r.value.show = d;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function l(d) {
|
|
167
|
+
r.value = {
|
|
168
|
+
mode: R.UPDATE,
|
|
169
|
+
modelValue: d,
|
|
170
|
+
show: !0,
|
|
171
|
+
"onUpdate:show"(f) {
|
|
172
|
+
r.value.show = f;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function i(d, f, y) {
|
|
177
|
+
n.open({
|
|
178
|
+
title: `Confirm deleting template ${d.name}?`,
|
|
179
|
+
message: "Deleted template can no longer be retrieved",
|
|
180
|
+
primaryActions: {
|
|
181
|
+
text: "Delete",
|
|
182
|
+
variant: Y.Destructive,
|
|
183
|
+
close: !0
|
|
184
|
+
},
|
|
185
|
+
secondaryActions: {
|
|
186
|
+
text: "Cancel",
|
|
187
|
+
variant: Y.Plain,
|
|
188
|
+
close: !0
|
|
189
|
+
}
|
|
190
|
+
}).onPrimary(async () => {
|
|
191
|
+
o.open({
|
|
192
|
+
title: `Deleting ${d.name}`,
|
|
193
|
+
type: "info"
|
|
194
|
+
});
|
|
195
|
+
try {
|
|
196
|
+
f.value = !0;
|
|
197
|
+
const [T] = await Promise.allSettled([
|
|
198
|
+
t.deleteTemplate(d),
|
|
199
|
+
new Promise((u) => setTimeout(u, 1e3))
|
|
200
|
+
]);
|
|
201
|
+
if (T.status === "rejected") throw T.reason;
|
|
202
|
+
o.open({
|
|
203
|
+
title: `Deleted ${d.name}`,
|
|
204
|
+
type: "success"
|
|
205
|
+
});
|
|
206
|
+
} catch (T) {
|
|
207
|
+
o.open({
|
|
208
|
+
title: `Unable to delete ${d.name}`,
|
|
209
|
+
message: `See error from server: ${T}`,
|
|
210
|
+
type: "error"
|
|
211
|
+
}), console.error("error on deleting purchase order template", T);
|
|
212
|
+
} finally {
|
|
213
|
+
f.value = !1, y();
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const p = b({});
|
|
218
|
+
function w(d) {
|
|
219
|
+
p.value = {
|
|
220
|
+
template: d,
|
|
221
|
+
show: !0,
|
|
222
|
+
"onUpdate:show"(f) {
|
|
223
|
+
p.value.show = f;
|
|
224
|
+
},
|
|
225
|
+
"onAction:edit"() {
|
|
226
|
+
p.value.show = !1, l(E(d));
|
|
227
|
+
},
|
|
228
|
+
"onAction:use"() {
|
|
229
|
+
p.value.show = !1, S(E(d));
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function S(d) {
|
|
234
|
+
e.promptCreateTransferDialog({
|
|
235
|
+
...d.purchaseOrder,
|
|
236
|
+
template: d._id
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
createTemplate: a,
|
|
241
|
+
viewTemplate: w,
|
|
242
|
+
updateTemplate: l,
|
|
243
|
+
deleteTemplate: i,
|
|
244
|
+
useTemplate: S,
|
|
245
|
+
templateDialogProps: r,
|
|
246
|
+
templateDetailsProps: p,
|
|
247
|
+
transferFormDialogProps: e.transferDialogProps
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
var V = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(V || {});
|
|
251
|
+
function I(e) {
|
|
252
|
+
var o;
|
|
253
|
+
return ((o = e == null ? void 0 : e.supplier) == null ? void 0 : o.internal) ? V.TRANSFER : V.PURCHASE;
|
|
254
|
+
}
|
|
255
|
+
const W = "use";
|
|
256
|
+
function Ue() {
|
|
257
|
+
const { t: e } = Ae(), { viewTemplate: n, updateTemplate: o, deleteTemplate: t, useTemplate: r } = Be(), a = b(new Array()), l = b(new Array()), i = b(!1), p = $(), w = X();
|
|
258
|
+
async function S() {
|
|
259
|
+
if (a.value = [], l.value = [], !!p._currentLocation) {
|
|
260
|
+
i.value = !0;
|
|
261
|
+
try {
|
|
262
|
+
const [u, m] = await Promise.all([
|
|
263
|
+
w.readLocationTemplates(),
|
|
264
|
+
w.readBusinessTemplates(),
|
|
265
|
+
new Promise((v) => setTimeout(v, 1e3))
|
|
266
|
+
]);
|
|
267
|
+
a.value = u, l.value = m;
|
|
268
|
+
} catch (u) {
|
|
269
|
+
console.log("Something went wrong when fetching templates:", u);
|
|
270
|
+
} finally {
|
|
271
|
+
i.value = !1;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
async function d(u) {
|
|
276
|
+
if (!a.value.find((m) => m._id) && p._currentLocation) {
|
|
277
|
+
i.value = !0;
|
|
278
|
+
try {
|
|
279
|
+
const [m] = await Promise.all([
|
|
280
|
+
w.getTemplate(u).catch((v) => {
|
|
281
|
+
if (v instanceof ce && v.errorResponse.statusCode === 404)
|
|
282
|
+
return w.getBusinessTemplate(u);
|
|
283
|
+
throw v;
|
|
284
|
+
}),
|
|
285
|
+
new Promise((v) => setTimeout(v, 1e3))
|
|
286
|
+
]);
|
|
287
|
+
a.value = [m];
|
|
288
|
+
} catch (m) {
|
|
289
|
+
console.log("Something went wrong when fetching templates:", m);
|
|
290
|
+
} finally {
|
|
291
|
+
i.value = !1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function f(u, m) {
|
|
296
|
+
switch (m = E(m), u) {
|
|
297
|
+
case W:
|
|
298
|
+
return r(m);
|
|
299
|
+
case B.Details:
|
|
300
|
+
return n(m);
|
|
301
|
+
case B.Edit:
|
|
302
|
+
return o(m);
|
|
303
|
+
case B.Delete:
|
|
304
|
+
return t(m, i, S);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const y = [
|
|
308
|
+
{
|
|
309
|
+
id: "_id",
|
|
310
|
+
accessorKey: "_id",
|
|
311
|
+
header: () => e("inventory.transfer.table.createdAt"),
|
|
312
|
+
cell(u) {
|
|
313
|
+
return Ne(`${u.getValue()}`);
|
|
314
|
+
},
|
|
315
|
+
enableSorting: !0
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: "name",
|
|
319
|
+
accessorKey: "name",
|
|
320
|
+
header: () => e("inventory.transfer.table.name"),
|
|
321
|
+
enableSorting: !0,
|
|
322
|
+
size: 200
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
id: "supplier",
|
|
326
|
+
accessorKey: "purchaseOrder.supplier.name",
|
|
327
|
+
header: () => e("inventory.transfer.table.transferFrom"),
|
|
328
|
+
enableSorting: !0,
|
|
329
|
+
size: 200
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "type",
|
|
333
|
+
header: () => e("inventory.transfer.receiveRequest.details.type.title"),
|
|
334
|
+
enableSorting: !0,
|
|
335
|
+
sortingFn(u, m) {
|
|
336
|
+
const v = I(u.original.purchaseOrder), _ = I(m.original.purchaseOrder);
|
|
337
|
+
return v.localeCompare(_);
|
|
338
|
+
},
|
|
339
|
+
size: 200,
|
|
340
|
+
cell(u) {
|
|
341
|
+
const m = I(u.row.original.purchaseOrder), v = e(
|
|
342
|
+
`inventory.transfer.receiveRequest.details.type.${m.toLocaleLowerCase()}`
|
|
343
|
+
);
|
|
344
|
+
return ge(Se.FmChip, {
|
|
345
|
+
label: v,
|
|
346
|
+
class: "fm-chip-transfer-info",
|
|
347
|
+
compact: !0
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
id: "noOfItems",
|
|
353
|
+
accessorKey: "purchaseOrder.items.length",
|
|
354
|
+
header: () => e("inventory.transfer.table.noOfItems"),
|
|
355
|
+
enableSorting: !1,
|
|
356
|
+
meta: {
|
|
357
|
+
width: "10rem",
|
|
358
|
+
textAlign: "right"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
id: "ref",
|
|
363
|
+
accessorKey: "purchaseOrder.ref",
|
|
364
|
+
header: () => e("inventory.transfer.table.reference"),
|
|
365
|
+
enableSorting: !1,
|
|
366
|
+
size: "auto"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
id: "action",
|
|
370
|
+
cell(u) {
|
|
371
|
+
const m = u.row.original, v = [
|
|
372
|
+
{
|
|
373
|
+
translationKey: "inventory.transfer.template.use",
|
|
374
|
+
value: W,
|
|
375
|
+
color: "text-fm-color-typo-primary"
|
|
376
|
+
},
|
|
377
|
+
H[B.Edit],
|
|
378
|
+
H[B.Delete]
|
|
379
|
+
];
|
|
380
|
+
return Pe(v, (_) => f(_, m));
|
|
381
|
+
},
|
|
382
|
+
enableSorting: !1,
|
|
383
|
+
size: 40,
|
|
384
|
+
meta: {
|
|
385
|
+
cellClass: "",
|
|
386
|
+
headerClass: ""
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
], T = L(() => [...a.value, ...l.value]);
|
|
390
|
+
return {
|
|
391
|
+
columnDefs: y,
|
|
392
|
+
locationTemplates: a,
|
|
393
|
+
businessTemplates: l,
|
|
394
|
+
templates: T,
|
|
395
|
+
loading: i,
|
|
396
|
+
fetchTemplates: S,
|
|
397
|
+
loadTemplate: d
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
const Oe = { class: "flex flex-col bg-white p-16 fm-corner-radius-lg gap-16" }, ke = {
|
|
401
|
+
key: 0,
|
|
402
|
+
class: "flex gap-8 fm-typo-en-body-md-400 text-fm-color-typo-warning"
|
|
403
|
+
}, Ee = { class: "flex gap-12" }, Le = /* @__PURE__ */ ye({
|
|
404
|
+
__name: "SelectTemplateDialog",
|
|
405
|
+
emits: ["close", "update:modelValue"],
|
|
406
|
+
setup(e, { emit: n }) {
|
|
407
|
+
const o = n, t = b(), r = Ue(), a = $e();
|
|
408
|
+
be(() => {
|
|
409
|
+
r.fetchTemplates();
|
|
410
|
+
});
|
|
411
|
+
const l = L(() => r.loading.value), i = L(
|
|
412
|
+
() => r.templates.value.map((f) => ({
|
|
413
|
+
label: f.name,
|
|
414
|
+
value: f._id
|
|
415
|
+
}))
|
|
416
|
+
);
|
|
417
|
+
function p() {
|
|
418
|
+
o("close"), a.push({ name: ue.TRANSFER_TEMPLATE });
|
|
419
|
+
}
|
|
420
|
+
function w() {
|
|
421
|
+
o("close");
|
|
422
|
+
}
|
|
423
|
+
function S([f]) {
|
|
424
|
+
t.value = f;
|
|
425
|
+
}
|
|
426
|
+
function d() {
|
|
427
|
+
o("update:modelValue", t.value), w();
|
|
428
|
+
}
|
|
429
|
+
return (f, y) => {
|
|
430
|
+
const T = q("FmIcon"), u = q("FmButton");
|
|
431
|
+
return k(), K("div", Oe, [
|
|
432
|
+
y[2] || (y[2] = N("div", { class: "h-32 text-fm-color-typo-primary fm-typo-en-title-md-600" }, "Select one template", -1)),
|
|
433
|
+
x(le, {
|
|
434
|
+
"model-value": [t.value],
|
|
435
|
+
"onUpdate:modelValue": S,
|
|
436
|
+
items: i.value,
|
|
437
|
+
loading: l.value,
|
|
438
|
+
"no-shadow": "",
|
|
439
|
+
"single-select": ""
|
|
440
|
+
}, null, 8, ["model-value", "items", "loading"]),
|
|
441
|
+
!l.value && !i.value.length ? (k(), K("div", ke, [
|
|
442
|
+
N("div", null, [
|
|
443
|
+
x(T, {
|
|
444
|
+
name: "warning",
|
|
445
|
+
size: "sm"
|
|
446
|
+
})
|
|
447
|
+
]),
|
|
448
|
+
y[0] || (y[0] = N("div", null, "You have not configured any templates", -1))
|
|
449
|
+
])) : we("", !0),
|
|
450
|
+
N("div", Ee, [
|
|
451
|
+
y[1] || (y[1] = N("div", { class: "flex-1" }, null, -1)),
|
|
452
|
+
!l.value && !i.value.length ? (k(), z(u, {
|
|
453
|
+
key: 0,
|
|
454
|
+
label: "Create template",
|
|
455
|
+
"prepend-icon": "add",
|
|
456
|
+
onClick: p
|
|
457
|
+
})) : (k(), z(u, {
|
|
458
|
+
key: 1,
|
|
459
|
+
loading: l.value,
|
|
460
|
+
disabled: !t.value,
|
|
461
|
+
label: "Use template",
|
|
462
|
+
onClick: d
|
|
463
|
+
}, null, 8, ["loading", "disabled"])),
|
|
464
|
+
x(u, {
|
|
465
|
+
label: "Close",
|
|
466
|
+
variant: "tertiary",
|
|
467
|
+
onClick: w
|
|
468
|
+
})
|
|
469
|
+
])
|
|
470
|
+
]);
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
function Re() {
|
|
475
|
+
let e = () => {
|
|
476
|
+
}, n = (t) => Promise.reject(t);
|
|
477
|
+
const o = new Promise((t, r) => {
|
|
478
|
+
e = t, n = r;
|
|
479
|
+
});
|
|
480
|
+
return Object.defineProperty(o, "resolve", {
|
|
481
|
+
get() {
|
|
482
|
+
return e;
|
|
483
|
+
}
|
|
484
|
+
}), Object.defineProperty(o, "reject", {
|
|
485
|
+
get() {
|
|
486
|
+
return n;
|
|
487
|
+
}
|
|
488
|
+
}), o;
|
|
489
|
+
}
|
|
490
|
+
function Fe(e, n) {
|
|
491
|
+
const o = J(), t = $(), r = ve(), a = b(!1), l = Q(), i = Ce(), p = b(new Array()), w = b(
|
|
492
|
+
n != null && n.startDate && (n != null && n.endDate) ? n : Te()
|
|
493
|
+
), S = L(() => {
|
|
494
|
+
const c = new Date(w.value.startDate), s = new Date(w.value.endDate);
|
|
495
|
+
return {
|
|
496
|
+
start: ie(c).toISOString(),
|
|
497
|
+
end: de(s).toISOString()
|
|
498
|
+
};
|
|
499
|
+
}), d = b(new Array()), f = me(), y = b(null);
|
|
500
|
+
function T() {
|
|
501
|
+
const c = Re();
|
|
502
|
+
let s;
|
|
503
|
+
return o.open({
|
|
504
|
+
title: "Select one template",
|
|
505
|
+
dialogComponent: Le,
|
|
506
|
+
dialogComponentProps: {
|
|
507
|
+
onClose() {
|
|
508
|
+
o.close(), c.resolve(s);
|
|
509
|
+
},
|
|
510
|
+
"onUpdate:modelValue"(h) {
|
|
511
|
+
s = h;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}), c;
|
|
515
|
+
}
|
|
516
|
+
const u = b();
|
|
517
|
+
async function m(c) {
|
|
518
|
+
let s;
|
|
519
|
+
if (r.mustUsePoTemplate && !(c != null && c.template) && (s = await T(), !s))
|
|
520
|
+
return;
|
|
521
|
+
const h = {
|
|
522
|
+
mode: R.CREATE,
|
|
523
|
+
modelValue: c || void 0,
|
|
524
|
+
show: !0,
|
|
525
|
+
"onUpdate:show"(g) {
|
|
526
|
+
u.value.show = g;
|
|
527
|
+
},
|
|
528
|
+
templateId: s,
|
|
529
|
+
lastClosingDate: y.value
|
|
530
|
+
};
|
|
531
|
+
u.value = h;
|
|
532
|
+
}
|
|
533
|
+
function v(c) {
|
|
534
|
+
const s = {
|
|
535
|
+
mode: R.UPDATE,
|
|
536
|
+
modelValue: E(c),
|
|
537
|
+
show: !0,
|
|
538
|
+
"onUpdate:show"(h) {
|
|
539
|
+
u.value.show = h;
|
|
540
|
+
},
|
|
541
|
+
lastClosingDate: y.value
|
|
542
|
+
};
|
|
543
|
+
u.value = s;
|
|
544
|
+
}
|
|
545
|
+
async function _() {
|
|
546
|
+
p.value = [], a.value = !0;
|
|
547
|
+
try {
|
|
548
|
+
p.value = await i.getPurchaseOrders(S.value).then((h) => h.sort((g, A) => A._id.localeCompare(g._id)));
|
|
549
|
+
const c = await f.readLastClosing(!0), s = c == null ? void 0 : c._id;
|
|
550
|
+
s && (y.value = Z(s));
|
|
551
|
+
} catch {
|
|
552
|
+
l.open({
|
|
553
|
+
title: "Something went wrong",
|
|
554
|
+
message: "Error at fetching purchase orders",
|
|
555
|
+
type: "error"
|
|
556
|
+
});
|
|
557
|
+
} finally {
|
|
558
|
+
a.value = !1;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async function ee() {
|
|
562
|
+
d.value = [], a.value = !0;
|
|
563
|
+
try {
|
|
564
|
+
d.value = await i.readRequests();
|
|
565
|
+
} catch {
|
|
566
|
+
l.open({
|
|
567
|
+
title: "Something went wrong",
|
|
568
|
+
message: "Error at fetching purchase requests",
|
|
569
|
+
type: "error"
|
|
570
|
+
});
|
|
571
|
+
} finally {
|
|
572
|
+
a.value = !1;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
function U() {
|
|
576
|
+
switch (e) {
|
|
577
|
+
case "receive/request":
|
|
578
|
+
return _();
|
|
579
|
+
case "approval":
|
|
580
|
+
return ee();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function te(c, s) {
|
|
584
|
+
w.value = {
|
|
585
|
+
startDate: c,
|
|
586
|
+
endDate: s
|
|
587
|
+
}, U();
|
|
588
|
+
}
|
|
589
|
+
t.watchLocation(async (c) => {
|
|
590
|
+
if (!c) {
|
|
591
|
+
p.value = [];
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
await U();
|
|
595
|
+
});
|
|
596
|
+
const C = b(), j = b(Math.random().toString());
|
|
597
|
+
async function re(c, s) {
|
|
598
|
+
var D, O;
|
|
599
|
+
const h = Math.random().toString();
|
|
600
|
+
j.value = h;
|
|
601
|
+
const g = e === "receive/request" ? t.currentLocation : s == null ? void 0 : s.to, A = {
|
|
602
|
+
purchaseOrder: c,
|
|
603
|
+
transferTo: g == null ? void 0 : g.name,
|
|
604
|
+
transferToDbName: g == null ? void 0 : g.dbName,
|
|
605
|
+
show: !0,
|
|
606
|
+
canResubmit: !1,
|
|
607
|
+
canApprove: e === "approval",
|
|
608
|
+
"onUpdate:show"(F) {
|
|
609
|
+
C.value.show = F;
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
if (C.value = A, !(s || c.status !== pe.enum.REQUESTING)) {
|
|
613
|
+
try {
|
|
614
|
+
s = (await i.readRequests(
|
|
615
|
+
`${c.supplier.internal}_${c.supplier._id}`
|
|
616
|
+
)).find((oe) => oe.purchaseOrderId === c._id);
|
|
617
|
+
} catch {
|
|
618
|
+
console.error("Error at fetching po request to check");
|
|
619
|
+
}
|
|
620
|
+
h === j.value && (C.value.canResubmit = !s, C.value.transferTo = (D = s == null ? void 0 : s.to) == null ? void 0 : D.name, C.value.transferToDbName = (O = s == null ? void 0 : s.to) == null ? void 0 : O.dbName);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
async function ae(c, s, h, g) {
|
|
624
|
+
a.value = !0;
|
|
625
|
+
try {
|
|
626
|
+
await i.processPurchaseOrder(
|
|
627
|
+
{
|
|
628
|
+
operation: s,
|
|
629
|
+
doc: c,
|
|
630
|
+
options: (
|
|
631
|
+
// auto receive for supplier to warehouse
|
|
632
|
+
(s === P.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
633
|
+
s === P.enum.completeReceive) && r.autoReceiveWarehouse ? {
|
|
634
|
+
autoReceive: !0
|
|
635
|
+
} : void 0
|
|
636
|
+
)
|
|
637
|
+
},
|
|
638
|
+
g
|
|
639
|
+
), await new Promise((O) => setTimeout(O, 1e3));
|
|
640
|
+
const D = $().currentLocationDBName.startsWith("restaurant_");
|
|
641
|
+
s === P.enum.confirmDraft && c.effectiveAt && D ? l.open({
|
|
642
|
+
title: "Success",
|
|
643
|
+
message: `${h}. The backdate will be reflected once your POS has received this change.`,
|
|
644
|
+
type: "success"
|
|
645
|
+
}) : l.open({
|
|
646
|
+
title: "Success",
|
|
647
|
+
message: h,
|
|
648
|
+
type: "success"
|
|
649
|
+
});
|
|
650
|
+
} catch (A) {
|
|
651
|
+
l.open({
|
|
652
|
+
title: "Something went wrong",
|
|
653
|
+
message: "Please try again.",
|
|
654
|
+
type: "error"
|
|
655
|
+
}), console.error("Error when submitting PO operation", s, c, A);
|
|
656
|
+
} finally {
|
|
657
|
+
a.value = !1, U();
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
async function ne(c, s, h) {
|
|
661
|
+
const g = _e[s];
|
|
662
|
+
if (!g) {
|
|
663
|
+
l.open({
|
|
664
|
+
title: "Something went wrong",
|
|
665
|
+
message: `Cannot process order: ${fe(s)}`,
|
|
666
|
+
type: "error"
|
|
667
|
+
});
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
const { successMessage: A, ...D } = g;
|
|
671
|
+
o.open({
|
|
672
|
+
title: D.title,
|
|
673
|
+
message: D.message,
|
|
674
|
+
primaryActions: D.primaryActions
|
|
675
|
+
}).onPrimary(() => {
|
|
676
|
+
ae(c, s, A, h);
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
return {
|
|
680
|
+
purchaseOrders: p,
|
|
681
|
+
purchaseRequests: d,
|
|
682
|
+
updateDateRange: te,
|
|
683
|
+
fetchData: U,
|
|
684
|
+
loading: a,
|
|
685
|
+
transferDialogProps: u,
|
|
686
|
+
promptCreateTransferDialog: m,
|
|
687
|
+
promptUpdateTransferDialog: v,
|
|
688
|
+
transferDetailsProps: C,
|
|
689
|
+
promptShowTransferDetails: re,
|
|
690
|
+
submitAction: ne
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
function Ye(e, n, o) {
|
|
694
|
+
const t = (o == null ? void 0 : o.abbrev) ?? n.abbrev;
|
|
695
|
+
return `${he(e, !1)} ${t}`;
|
|
696
|
+
}
|
|
697
|
+
export {
|
|
698
|
+
V as P,
|
|
699
|
+
X as a,
|
|
700
|
+
Ye as b,
|
|
701
|
+
Be as c,
|
|
702
|
+
Ue as d,
|
|
703
|
+
Ce as e,
|
|
704
|
+
Ne as f,
|
|
705
|
+
_e as g,
|
|
706
|
+
Fe as u
|
|
707
|
+
};
|
package/dist/helper/number.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export declare function trimPrecision(decimal: FdoDecimal): {
|
|
|
20
20
|
precision: number;
|
|
21
21
|
};
|
|
22
22
|
export declare function adjustmentAmountFormat(a: AdjustmentAmount, toPrecision?: boolean): string;
|
|
23
|
+
/** Trims the number to the least precision possible */
|
|
24
|
+
export declare function numberFormatTrimPrecision(amount: number, precision?: number): string;
|
|
23
25
|
export declare function adjustmentCurrencyFormat(a: FdoDinero, asSuffix?: boolean, precision?: number): string;
|
|
24
26
|
export declare function adjustmentAmountAbs(a: AdjustmentAmount): AdjustmentAmount;
|
|
25
27
|
export declare function getPrecision(a: number): number;
|