@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
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ref as R, defineComponent as re, computed as T, resolveComponent as D, openBlock as B, createBlock as O, withCtx as C, createElementVNode as n, normalizeClass as Ce, toDisplayString as g, createVNode as
|
|
2
|
-
import { i as ct, _ as dt, a as mt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
3
|
-
import { n as Xe, j as ue, o as pt, c as Pe, p as vt, u as Te, q as Oe, r as De, a as ie, k as ft, t as
|
|
1
|
+
import { ref as R, defineComponent as re, computed as T, resolveComponent as D, openBlock as B, createBlock as O, withCtx as C, createElementVNode as n, normalizeClass as Ce, toDisplayString as g, createVNode as b, createElementBlock as L, Fragment as te, renderList as ae, unref as v, h as ye, watch as he, isRef as Ie, createCommentVNode as ee, reactive as it, onMounted as Je, normalizeStyle as Qe, createTextVNode as ve, Teleport as ut, normalizeProps as $e, mergeProps as we } from "vue";
|
|
2
|
+
import { i as ct, _ as dt, a as mt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-6yg6_JPe.js";
|
|
3
|
+
import { n as Xe, j as ue, o as pt, c as Pe, p as vt, u as Te, q as Oe, r as De, a as ie, k as ft, t as ge, m as Me, A as yt, M as _t, l as fe, s as kt, v as Z, w as ht, x as ze, R as gt, y as bt, z as xt, B as Ze, D as q, E as St, f as et, G as je, H as $t, d as Ye, b as wt, J as Bt, K as Ft, C as Be, L as Vt, N as At, O as Ct, P as Dt } from "./app-P7rGzGsF.js";
|
|
4
4
|
import { useCoreStore as tt, useI18n as le } from "@feedmepos/mf-common";
|
|
5
5
|
import { useSnackbar as de, useDialog as nt, useProxiedModel as Re, useBreakpoints as Mt } from "@feedmepos/ui-library";
|
|
6
|
-
import { c as jt, _ as
|
|
7
|
-
import { g as
|
|
8
|
-
import { e as Pt, i as ot } from "./id-to-date-
|
|
9
|
-
import { _ as
|
|
6
|
+
import { c as jt, _ as Ut, F as Ke, u as It } from "./layout-D-zXtsSp.js";
|
|
7
|
+
import { g as be } from "./decimal-4ONRlhOO.js";
|
|
8
|
+
import { e as Pt, i as ot } from "./id-to-date-D8Ey2CVj.js";
|
|
9
|
+
import { _ as Ue, S as Fe, g as st } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
|
|
10
10
|
import { _ as Tt } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
|
-
import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-
|
|
11
|
+
import { u as at, _ as Ge } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-BTOE1vFl.js";
|
|
12
12
|
import { defineStore as Rt } from "pinia";
|
|
13
|
-
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-
|
|
13
|
+
import { _ as Ht } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-HcOKpAlW.js";
|
|
14
14
|
import { E as Et } from "./empty-placeholder-wf6-BWE8.js";
|
|
15
|
-
import "./array-
|
|
16
|
-
const Se = Xe((c,
|
|
17
|
-
const r = ue(), s = tt(),
|
|
18
|
-
return
|
|
19
|
-
l.name === "SvcForbiddenError" && (
|
|
15
|
+
import "./array-ClJzD_Lt.js";
|
|
16
|
+
const Se = Xe((c, m) => {
|
|
17
|
+
const r = ue(), s = tt(), x = de();
|
|
18
|
+
return m.onError(async (l) => {
|
|
19
|
+
l.name === "SvcForbiddenError" && (x == null || x.open({
|
|
20
20
|
title: l.title,
|
|
21
21
|
message: l.message,
|
|
22
22
|
type: "error"
|
|
@@ -24,42 +24,30 @@ const Se = Xe((c, d) => {
|
|
|
24
24
|
}), {
|
|
25
25
|
async readStockBalance() {
|
|
26
26
|
const l = r.currentLocationDBName, a = `${c.inventoryBackendUrl}/${l}/stock-balance`;
|
|
27
|
-
return await
|
|
27
|
+
return await m.get(a);
|
|
28
28
|
},
|
|
29
29
|
async readSkuBalance() {
|
|
30
|
-
var
|
|
30
|
+
var S;
|
|
31
31
|
const l = r.currentLocationDBName, a = `${c.inventoryBackendUrl}/${l}/sku/balance`;
|
|
32
|
-
return (((
|
|
32
|
+
return (((S = s.currentBusiness.value) == null ? void 0 : S.menuVersion) ?? "") === "v3" ? await m.get(a) : await m.get(`${a}?useInventoryDoc=true`);
|
|
33
33
|
},
|
|
34
34
|
async readSingleAdjustment(l) {
|
|
35
|
-
const a = r.currentLocationDBName,
|
|
36
|
-
return await
|
|
35
|
+
const a = r.currentLocationDBName, u = `${c.inventoryBackendUrl}/${a}/adjustment`;
|
|
36
|
+
return await m.get(`${u}?adjustmentId=${l}`);
|
|
37
37
|
},
|
|
38
|
-
async readStockAdjustment(l, a,
|
|
39
|
-
const
|
|
40
|
-
return await
|
|
38
|
+
async readStockAdjustment(l, a, u) {
|
|
39
|
+
const S = r.currentLocationDBName, k = `${c.inventoryBackendUrl}/${S}/sku`;
|
|
40
|
+
return await m.get(`${k}?skuId=${l}&start=${a}&end=${u}`);
|
|
41
41
|
},
|
|
42
42
|
async convertSku(l) {
|
|
43
43
|
var k;
|
|
44
|
-
const a = r.currentLocationDBName,
|
|
45
|
-
return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await
|
|
44
|
+
const a = r.currentLocationDBName, u = `${c.inventoryBackendUrl}/${a}/sku/convert`;
|
|
45
|
+
return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await m.post(u, l) : await m.post(`${u}?useInventoryDoc=true`, l);
|
|
46
46
|
},
|
|
47
47
|
async adjustSku(l) {
|
|
48
48
|
var k;
|
|
49
|
-
const a = r.currentLocationDBName,
|
|
50
|
-
return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await
|
|
51
|
-
},
|
|
52
|
-
recalculation: {
|
|
53
|
-
getRecalculateAbility() {
|
|
54
|
-
var h;
|
|
55
|
-
const a = `business_${(h = s.currentBusiness.value) == null ? void 0 : h._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate`;
|
|
56
|
-
return d.get(i);
|
|
57
|
-
},
|
|
58
|
-
startRecalculateTask() {
|
|
59
|
-
var h;
|
|
60
|
-
const a = `business_${(h = s.currentBusiness.value) == null ? void 0 : h._id}`, i = `${c.inventoryBackendUrl}/${a}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
|
|
61
|
-
return d.post(i);
|
|
62
|
-
}
|
|
49
|
+
const a = r.currentLocationDBName, u = `${c.inventoryBackendUrl}/${a}/sku/adjust`;
|
|
50
|
+
return (((k = s.currentBusiness.value) == null ? void 0 : k.menuVersion) ?? "") === "v3" ? await m.post(u, l) : await m.post(`${u}?useInventoryDoc=true`, l);
|
|
63
51
|
}
|
|
64
52
|
};
|
|
65
53
|
});
|
|
@@ -79,14 +67,14 @@ const _e = R(Lt()), He = () => {
|
|
|
79
67
|
get stockBalance() {
|
|
80
68
|
return _e.value.stockBalance;
|
|
81
69
|
},
|
|
82
|
-
set stockBalance(
|
|
83
|
-
_e.value.stockBalance =
|
|
70
|
+
set stockBalance(m) {
|
|
71
|
+
_e.value.stockBalance = m;
|
|
84
72
|
},
|
|
85
73
|
get productBalance() {
|
|
86
74
|
return _e.value.productBalance;
|
|
87
75
|
},
|
|
88
|
-
set productBalance(
|
|
89
|
-
_e.value.productBalance =
|
|
76
|
+
set productBalance(m) {
|
|
77
|
+
_e.value.productBalance = m;
|
|
90
78
|
},
|
|
91
79
|
// actions
|
|
92
80
|
async readStockBalance() {
|
|
@@ -100,21 +88,29 @@ const _e = R(Lt()), He = () => {
|
|
|
100
88
|
var ke = /* @__PURE__ */ ((c) => (c.History = "History", c.Convert = "Convert", c.Adjust = "Adjust", c))(ke || {});
|
|
101
89
|
const Nt = [
|
|
102
90
|
{
|
|
103
|
-
|
|
104
|
-
color: "text-neutral-700"
|
|
91
|
+
translationKey: "inventory.stock.action.history",
|
|
92
|
+
color: "text-neutral-700",
|
|
93
|
+
value: "History"
|
|
94
|
+
/* History */
|
|
105
95
|
}
|
|
106
96
|
], Ot = [
|
|
107
97
|
{
|
|
108
|
-
|
|
109
|
-
color: "text-neutral-700"
|
|
98
|
+
translationKey: "inventory.stock.action.history",
|
|
99
|
+
color: "text-neutral-700",
|
|
100
|
+
value: "History"
|
|
101
|
+
/* History */
|
|
110
102
|
},
|
|
111
103
|
{
|
|
112
|
-
|
|
113
|
-
color: "text-neutral-700"
|
|
104
|
+
translationKey: "inventory.stock.action.convert",
|
|
105
|
+
color: "text-neutral-700",
|
|
106
|
+
value: "Convert"
|
|
107
|
+
/* Convert */
|
|
114
108
|
},
|
|
115
109
|
{
|
|
116
|
-
|
|
117
|
-
color: "text-neutral-700"
|
|
110
|
+
translationKey: "inventory.stock.action.adjust",
|
|
111
|
+
color: "text-neutral-700",
|
|
112
|
+
value: "Adjust"
|
|
113
|
+
/* Adjust */
|
|
118
114
|
}
|
|
119
115
|
];
|
|
120
116
|
async function zt(c) {
|
|
@@ -139,16 +135,16 @@ async function zt(c) {
|
|
|
139
135
|
{
|
|
140
136
|
name: "Balance",
|
|
141
137
|
selector: (s) => {
|
|
142
|
-
const
|
|
143
|
-
return
|
|
138
|
+
const x = xe(s, s.unit);
|
|
139
|
+
return x.type === "unit" ? be(s.balance, s.unit, null, !1) : be(s.balance, s.unit, x.measurement, !1);
|
|
144
140
|
}
|
|
145
141
|
},
|
|
146
142
|
{
|
|
147
143
|
name: "Unit",
|
|
148
144
|
selector: (s) => {
|
|
149
145
|
var l;
|
|
150
|
-
const
|
|
151
|
-
return
|
|
146
|
+
const x = xe(s, s.unit);
|
|
147
|
+
return x.type === "unit" ? s.unit.abbrev : ((l = s.unit.measurements.find((a) => a.id === x.measurement)) == null ? void 0 : l.abbrev) || "";
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
150
|
]
|
|
@@ -157,16 +153,16 @@ async function zt(c) {
|
|
|
157
153
|
r
|
|
158
154
|
);
|
|
159
155
|
}
|
|
160
|
-
function xe(c,
|
|
156
|
+
function xe(c, m) {
|
|
161
157
|
const r = localStorage.getItem(`uom:${c._id}`);
|
|
162
|
-
return r ? r ===
|
|
158
|
+
return r ? r === m._id ? {
|
|
163
159
|
type: "unit"
|
|
164
|
-
} :
|
|
160
|
+
} : m.measurements.find((s) => s.id === r) ? {
|
|
165
161
|
type: "measurement",
|
|
166
162
|
measurement: r
|
|
167
163
|
} : {
|
|
168
164
|
type: "unit"
|
|
169
|
-
} : c.trackingMeasurement &&
|
|
165
|
+
} : c.trackingMeasurement && m.measurements.find((s) => s.id === c.trackingMeasurement) ? {
|
|
170
166
|
type: "measurement",
|
|
171
167
|
measurement: c.trackingMeasurement
|
|
172
168
|
} : {
|
|
@@ -182,62 +178,62 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
182
178
|
defaultTrackingMeasurement: {}
|
|
183
179
|
},
|
|
184
180
|
setup(c) {
|
|
185
|
-
function
|
|
181
|
+
function m(k) {
|
|
186
182
|
return `uom:${k._id}`;
|
|
187
183
|
}
|
|
188
184
|
function r(k) {
|
|
189
|
-
const
|
|
190
|
-
k ? localStorage.setItem(
|
|
185
|
+
const i = m(s.sku);
|
|
186
|
+
k ? localStorage.setItem(i, k) : localStorage.setItem(i, s.unit._id), x.value = xe(s.sku, s.unit);
|
|
191
187
|
}
|
|
192
|
-
const s = c,
|
|
188
|
+
const s = c, x = R(xe(s.sku, s.unit)), l = T(() => {
|
|
193
189
|
const { measurements: k } = s.unit;
|
|
194
190
|
return [
|
|
195
191
|
{
|
|
196
|
-
label: `${
|
|
192
|
+
label: `${be(s.amount, s.unit)}`,
|
|
197
193
|
value: null
|
|
198
194
|
},
|
|
199
|
-
...k.map(({ id:
|
|
200
|
-
label: `${
|
|
201
|
-
value:
|
|
195
|
+
...k.map(({ id: i }) => ({
|
|
196
|
+
label: `${be(s.amount, s.unit, i)}`,
|
|
197
|
+
value: i
|
|
202
198
|
}))
|
|
203
199
|
];
|
|
204
200
|
});
|
|
205
201
|
function a({ value: k }) {
|
|
206
|
-
return v(
|
|
202
|
+
return v(x).type === "unit" ? k === null : k === v(x).measurement;
|
|
207
203
|
}
|
|
208
|
-
const
|
|
204
|
+
const u = T(
|
|
209
205
|
() => {
|
|
210
206
|
var k;
|
|
211
|
-
return ((k = l.value.find((
|
|
207
|
+
return ((k = l.value.find((i) => a(i))) == null ? void 0 : k.label) ?? "";
|
|
212
208
|
}
|
|
213
|
-
),
|
|
214
|
-
return (k,
|
|
215
|
-
const o = D("FmIcon"), w = D("FmMenuItem"),
|
|
216
|
-
return B(), O(
|
|
209
|
+
), S = R(!1);
|
|
210
|
+
return (k, i) => {
|
|
211
|
+
const o = D("FmIcon"), w = D("FmMenuItem"), V = D("FmMenu");
|
|
212
|
+
return B(), O(V, {
|
|
217
213
|
"stop-click-propagation": "",
|
|
218
|
-
onMenuChanged:
|
|
214
|
+
onMenuChanged: i[0] || (i[0] = (h) => S.value = h)
|
|
219
215
|
}, {
|
|
220
216
|
"menu-button": C(() => [
|
|
221
217
|
n("button", {
|
|
222
218
|
type: "button",
|
|
223
219
|
class: Ce([
|
|
224
220
|
"w-full text-left flex items-center gap-8 cursor-pointer fm-corner-radius-sm px-8 py-4 border bg-white",
|
|
225
|
-
|
|
221
|
+
S.value ? "border-fm-color-primary" : "border-fm-color-neutral-gray-100"
|
|
226
222
|
])
|
|
227
223
|
}, [
|
|
228
|
-
n("div", Yt, g(
|
|
229
|
-
|
|
224
|
+
n("div", Yt, g(u.value), 1),
|
|
225
|
+
b(o, {
|
|
230
226
|
class: "text-fm-color-neutral-gray-400",
|
|
231
227
|
name: "expand_more"
|
|
232
228
|
})
|
|
233
229
|
], 2)
|
|
234
230
|
]),
|
|
235
231
|
default: C(() => [
|
|
236
|
-
(B(!0), L(te, null, ae(l.value, (
|
|
237
|
-
key:
|
|
238
|
-
label:
|
|
239
|
-
"model-value": a(
|
|
240
|
-
onClick: (p) => r(
|
|
232
|
+
(B(!0), L(te, null, ae(l.value, (h) => (B(), O(w, {
|
|
233
|
+
key: h.value ?? 0,
|
|
234
|
+
label: h.label,
|
|
235
|
+
"model-value": a(h),
|
|
236
|
+
onClick: (p) => r(h.value)
|
|
241
237
|
}, null, 8, ["label", "model-value", "onClick"]))), 128))
|
|
242
238
|
]),
|
|
243
239
|
_: 1
|
|
@@ -247,23 +243,23 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
247
243
|
}), Kt = { class: "whitespace-nowrap" }, Gt = /* @__PURE__ */ re({
|
|
248
244
|
__name: "StockHeaderPreview",
|
|
249
245
|
setup(c) {
|
|
250
|
-
const { t:
|
|
246
|
+
const { t: m } = le();
|
|
251
247
|
return (r, s) => (B(), O(Tt, null, {
|
|
252
248
|
default: C(() => [
|
|
253
|
-
n("div", Kt, g(v(
|
|
249
|
+
n("div", Kt, g(v(m)("inventory.stock.prediction.daysRemaining")), 1)
|
|
254
250
|
]),
|
|
255
251
|
_: 1
|
|
256
252
|
}));
|
|
257
253
|
}
|
|
258
254
|
}), lt = Rt("stockActions", () => {
|
|
259
|
-
const c = R(!1),
|
|
260
|
-
async function
|
|
261
|
-
if (
|
|
255
|
+
const c = R(!1), m = ue(), r = He(), s = at(), x = de(), l = nt(), { t: a } = le();
|
|
256
|
+
async function u() {
|
|
257
|
+
if (m._currentLocation) {
|
|
262
258
|
c.value = !0;
|
|
263
259
|
try {
|
|
264
260
|
await r.readStockBalance(), await r.readProductBalance(), await s.readStockEstimateBalance();
|
|
265
261
|
} catch {
|
|
266
|
-
|
|
262
|
+
x.open({
|
|
267
263
|
title: a("inventory.stock.error.title"),
|
|
268
264
|
message: a("inventory.stock.error.message"),
|
|
269
265
|
type: "error"
|
|
@@ -273,9 +269,9 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
273
269
|
}
|
|
274
270
|
}
|
|
275
271
|
}
|
|
276
|
-
const
|
|
272
|
+
const S = R();
|
|
277
273
|
async function k(p) {
|
|
278
|
-
var F, j,
|
|
274
|
+
var F, j, U;
|
|
279
275
|
if (!!!((j = (F = p.convert) == null ? void 0 : F.inventoryBindings) != null && j.length)) {
|
|
280
276
|
l.open({
|
|
281
277
|
title: a("inventory.stock.error.convert.title"),
|
|
@@ -284,34 +280,34 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
284
280
|
return;
|
|
285
281
|
}
|
|
286
282
|
const $ = {
|
|
287
|
-
maxCount: ((
|
|
283
|
+
maxCount: ((U = r.productBalance.find(({ id: E }) => E === p._id)) == null ? void 0 : U.count) || 0,
|
|
288
284
|
sku: p,
|
|
289
285
|
show: !0,
|
|
290
286
|
"onUpdate:show"(E) {
|
|
291
|
-
|
|
287
|
+
S.value.show = E;
|
|
292
288
|
},
|
|
293
289
|
onSubmitted() {
|
|
294
|
-
|
|
290
|
+
u();
|
|
295
291
|
}
|
|
296
292
|
};
|
|
297
|
-
|
|
293
|
+
S.value = $;
|
|
298
294
|
}
|
|
299
|
-
const
|
|
295
|
+
const i = R();
|
|
300
296
|
async function o(p) {
|
|
301
297
|
const M = {
|
|
302
298
|
stock: p,
|
|
303
299
|
show: !0,
|
|
304
300
|
"onUpdate:show"(H) {
|
|
305
|
-
|
|
301
|
+
i.value.show = H;
|
|
306
302
|
},
|
|
307
303
|
onSubmitted() {
|
|
308
|
-
|
|
304
|
+
u();
|
|
309
305
|
}
|
|
310
306
|
};
|
|
311
|
-
|
|
307
|
+
i.value = M;
|
|
312
308
|
}
|
|
313
309
|
const w = R();
|
|
314
|
-
async function
|
|
310
|
+
async function V(p) {
|
|
315
311
|
const M = {
|
|
316
312
|
sku: p,
|
|
317
313
|
show: !0,
|
|
@@ -321,11 +317,11 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
321
317
|
};
|
|
322
318
|
w.value = M;
|
|
323
319
|
}
|
|
324
|
-
function
|
|
320
|
+
function h(p, M) {
|
|
325
321
|
const H = Pe(M);
|
|
326
322
|
switch (p) {
|
|
327
323
|
case ke.History:
|
|
328
|
-
|
|
324
|
+
V(H);
|
|
329
325
|
return;
|
|
330
326
|
case ke.Convert:
|
|
331
327
|
k(H);
|
|
@@ -336,16 +332,16 @@ const Yt = { class: "fm-typo-en-body-md-400 flex-grow" }, rt = /* @__PURE__ */ r
|
|
|
336
332
|
}
|
|
337
333
|
}
|
|
338
334
|
return {
|
|
339
|
-
fetchStockBalance:
|
|
340
|
-
onActionMenu:
|
|
335
|
+
fetchStockBalance: u,
|
|
336
|
+
onActionMenu: h,
|
|
341
337
|
stockHistoryProps: w,
|
|
342
|
-
showSkuHistory:
|
|
343
|
-
convertSkuDialogProps:
|
|
344
|
-
adjustSkuDialogProps:
|
|
338
|
+
showSkuHistory: V,
|
|
339
|
+
convertSkuDialogProps: S,
|
|
340
|
+
adjustSkuDialogProps: i
|
|
345
341
|
};
|
|
346
342
|
});
|
|
347
343
|
function qt() {
|
|
348
|
-
const c = ue(),
|
|
344
|
+
const c = ue(), m = lt(), { t: r } = le();
|
|
349
345
|
return {
|
|
350
346
|
columnDefs: [
|
|
351
347
|
{
|
|
@@ -363,8 +359,8 @@ function qt() {
|
|
|
363
359
|
{
|
|
364
360
|
id: "UOM",
|
|
365
361
|
header: () => r("inventory.stock.balance"),
|
|
366
|
-
cell(
|
|
367
|
-
const l =
|
|
362
|
+
cell(x) {
|
|
363
|
+
const l = x.row.original, a = {
|
|
368
364
|
unit: l.unit,
|
|
369
365
|
sku: l,
|
|
370
366
|
amount: l.balance,
|
|
@@ -380,28 +376,28 @@ function qt() {
|
|
|
380
376
|
header: () => ye(Gt),
|
|
381
377
|
enableSorting: !0,
|
|
382
378
|
sortUndefined: "last",
|
|
383
|
-
cell(
|
|
384
|
-
var
|
|
385
|
-
const l =
|
|
386
|
-
if (typeof l != "number" || typeof a != "number" || typeof
|
|
387
|
-
return ye(
|
|
379
|
+
cell(x) {
|
|
380
|
+
var i, o;
|
|
381
|
+
const l = x.row.original.day, a = (i = x.row.original.thresholds) == null ? void 0 : i.low, u = (o = x.row.original.thresholds) == null ? void 0 : o.mid;
|
|
382
|
+
if (typeof l != "number" || typeof a != "number" || typeof u != "number")
|
|
383
|
+
return ye(Ue, {
|
|
388
384
|
days: l
|
|
389
385
|
});
|
|
390
|
-
const
|
|
391
|
-
return ye(
|
|
386
|
+
const S = l <= a ? Fe.low : l <= u ? Fe.mid : Fe.high;
|
|
387
|
+
return ye(Ue, {
|
|
392
388
|
days: l,
|
|
393
|
-
level:
|
|
389
|
+
level: S
|
|
394
390
|
});
|
|
395
391
|
},
|
|
396
392
|
size: 200
|
|
397
393
|
},
|
|
398
394
|
{
|
|
399
395
|
id: "action",
|
|
400
|
-
cell(
|
|
396
|
+
cell(x) {
|
|
401
397
|
var l;
|
|
402
398
|
return jt(
|
|
403
399
|
((l = c._currentLocation) == null ? void 0 : l.type) === "restaurant" ? Nt : Ot,
|
|
404
|
-
(a) =>
|
|
400
|
+
(a) => m.onActionMenu(a, x.row.original)
|
|
405
401
|
);
|
|
406
402
|
},
|
|
407
403
|
enableSorting: !1,
|
|
@@ -429,19 +425,19 @@ const Wt = {
|
|
|
429
425
|
isInteger(c = "Must be an integer") {
|
|
430
426
|
return this.error ? this : (this.toInt(), isNaN(this.context) && (this.error = c), this);
|
|
431
427
|
},
|
|
432
|
-
min(c,
|
|
428
|
+
min(c, m) {
|
|
433
429
|
if (this.error) return this;
|
|
434
430
|
try {
|
|
435
|
-
typeof this.context == "number" ? +this.context < c && (this.error =
|
|
431
|
+
typeof this.context == "number" ? +this.context < c && (this.error = m ?? `Must be at least ${c}`) : Object.prototype.hasOwnProperty.call(this.context, "length") ? +this.context.length < c && (this.error = m ?? `Must be at least ${c}`) : this.error = "Length cannot be determined";
|
|
436
432
|
} catch {
|
|
437
433
|
this.error = "Length cannot be determined";
|
|
438
434
|
}
|
|
439
435
|
return this;
|
|
440
436
|
},
|
|
441
|
-
max(c,
|
|
437
|
+
max(c, m) {
|
|
442
438
|
if (this.error) return this;
|
|
443
439
|
try {
|
|
444
|
-
typeof this.context == "number" ? +this.context > c && (this.error =
|
|
440
|
+
typeof this.context == "number" ? +this.context > c && (this.error = m ?? `Must be at most ${c}`) : "length" in this.context ? +this.context.length > c && (this.error = m ?? `Must be at most ${c}`) : this.error = "Length cannot be determined";
|
|
445
441
|
} catch {
|
|
446
442
|
this.error = "Length cannot be determined";
|
|
447
443
|
}
|
|
@@ -459,27 +455,27 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
459
455
|
show: { type: Boolean }
|
|
460
456
|
},
|
|
461
457
|
emits: ["update:show", "submitted"],
|
|
462
|
-
setup(c, { expose:
|
|
463
|
-
const s = c,
|
|
458
|
+
setup(c, { expose: m, emit: r }) {
|
|
459
|
+
const s = c, x = r, l = vt(), a = Te(), u = Se(), S = de(), { t: k } = le(), i = R(0), o = R(null), w = T(() => a.skus), V = T(
|
|
464
460
|
() => {
|
|
465
461
|
var e, t;
|
|
466
462
|
return (((t = (e = s.sku) == null ? void 0 : e.convert) == null ? void 0 : t.inventoryBindings) ?? []).filter(
|
|
467
463
|
(f) => f.type === Oe.enum.SKU
|
|
468
464
|
);
|
|
469
465
|
}
|
|
470
|
-
),
|
|
466
|
+
), h = T({
|
|
471
467
|
get() {
|
|
472
468
|
return !!o.value;
|
|
473
469
|
},
|
|
474
470
|
set(e) {
|
|
475
|
-
e ? o.value = Pe(
|
|
471
|
+
e ? o.value = Pe(V.value) : (o.value = null, i.value = Math.min(i.value, s.maxCount ?? 0));
|
|
476
472
|
}
|
|
477
473
|
}), p = R(!1);
|
|
478
474
|
he([() => s.show], ([e]) => {
|
|
479
|
-
e && (
|
|
475
|
+
e && (i.value = 0);
|
|
480
476
|
});
|
|
481
477
|
function M() {
|
|
482
|
-
W(s.sku,
|
|
478
|
+
W(s.sku, ge(i.value), o.value);
|
|
483
479
|
}
|
|
484
480
|
function H(e) {
|
|
485
481
|
if (o.value)
|
|
@@ -489,117 +485,117 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
489
485
|
}
|
|
490
486
|
function $(e) {
|
|
491
487
|
var y;
|
|
492
|
-
const t = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((
|
|
488
|
+
const t = (y = s.sku.convert) != null && y.measurement ? s.sku.unit.measurements.find((A) => {
|
|
493
489
|
var K;
|
|
494
|
-
return
|
|
495
|
-
}) ?? null : null, f = De(s.sku.unit, t),
|
|
496
|
-
return qe(
|
|
490
|
+
return A.id === ((K = s.sku.convert) == null ? void 0 : K.measurement);
|
|
491
|
+
}) ?? null : null, f = De(s.sku.unit, t), d = kt(+e);
|
|
492
|
+
return qe(d).isInteger().max(f).error ? "Precision cannot be more than " + f : !0;
|
|
497
493
|
}
|
|
498
494
|
const F = T(
|
|
499
495
|
() => {
|
|
500
496
|
var e, t;
|
|
501
497
|
return (e = s.sku.convert) != null && e.measurement ? (t = s.sku.unit.measurements.find((f) => {
|
|
502
|
-
var
|
|
503
|
-
return f.id === ((
|
|
498
|
+
var d;
|
|
499
|
+
return f.id === ((d = s.sku.convert) == null ? void 0 : d.measurement);
|
|
504
500
|
})) == null ? void 0 : t.abbrev : s.sku.unit.abbrev;
|
|
505
501
|
}
|
|
506
502
|
), j = T(() => {
|
|
507
|
-
var f,
|
|
508
|
-
const e = (
|
|
503
|
+
var f, d, _;
|
|
504
|
+
const e = (d = (f = s.sku.convert) == null ? void 0 : f.inventoryBindings) == null ? void 0 : d.filter((y) => y.type === "SKU");
|
|
509
505
|
return (_ = o.value ?? e) == null ? void 0 : _.map((y) => {
|
|
510
506
|
var X, G, se, Ee, Le;
|
|
511
|
-
const
|
|
507
|
+
const A = a.skus.find((pe) => pe._id === y.id), K = ((X = y.measurement) == null ? void 0 : X.abbrev) ?? ((G = A == null ? void 0 : A.unit) == null ? void 0 : G.abbrev), Q = (se = s.sku.convert) != null && se.measurement ? s.sku.unit.measurements.find((pe) => {
|
|
512
508
|
var Ne;
|
|
513
509
|
return pe.id === ((Ne = s.sku.convert) == null ? void 0 : Ne.measurement);
|
|
514
|
-
}) ?? null : null, me = De(s.sku.unit, Q),
|
|
510
|
+
}) ?? null : null, me = De(s.sku.unit, Q), I = $(`${i.value}`) === !0 ? ie(
|
|
515
511
|
ft(
|
|
516
512
|
y.amount,
|
|
517
|
-
|
|
513
|
+
ge(+i.value, me)
|
|
518
514
|
),
|
|
519
515
|
!1
|
|
520
|
-
) : "0", Y = (Le = (Ee = o.value) == null ? void 0 : Ee.find((pe) => pe.id === (
|
|
516
|
+
) : "0", Y = (Le = (Ee = o.value) == null ? void 0 : Ee.find((pe) => pe.id === (A == null ? void 0 : A._id))) == null ? void 0 : Le.amount, J = Y ? ie(Y, !1) : null;
|
|
521
517
|
return {
|
|
522
|
-
sku:
|
|
523
|
-
convertAmount: J ??
|
|
518
|
+
sku: A,
|
|
519
|
+
convertAmount: J ?? I,
|
|
524
520
|
abbrev: K
|
|
525
521
|
};
|
|
526
522
|
});
|
|
527
|
-
}),
|
|
528
|
-
|
|
523
|
+
}), U = R();
|
|
524
|
+
m({
|
|
529
525
|
validateInputs: () => {
|
|
530
526
|
var e, t;
|
|
531
|
-
(t = (e =
|
|
527
|
+
(t = (e = U.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
|
|
532
528
|
},
|
|
533
529
|
resetInputsValidation: () => {
|
|
534
530
|
var e, t;
|
|
535
|
-
(t = (e =
|
|
531
|
+
(t = (e = U.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
|
|
536
532
|
},
|
|
537
533
|
resetInputs: () => {
|
|
538
534
|
var e, t;
|
|
539
|
-
(t = (e =
|
|
535
|
+
(t = (e = U.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
|
|
540
536
|
}
|
|
541
537
|
});
|
|
542
538
|
const E = Re(s, "show");
|
|
543
539
|
async function W(e, t, f) {
|
|
544
540
|
p.value = !0;
|
|
545
541
|
try {
|
|
546
|
-
await
|
|
542
|
+
await u.convertSku({
|
|
547
543
|
conversions: [
|
|
548
544
|
{
|
|
549
545
|
doc: e,
|
|
550
546
|
amount: t,
|
|
551
|
-
overrides: f == null ? void 0 : f.map((
|
|
552
|
-
...
|
|
547
|
+
overrides: f == null ? void 0 : f.map((d) => ({
|
|
548
|
+
...d,
|
|
553
549
|
amount: {
|
|
554
|
-
...
|
|
555
|
-
amount: -1 * Math.abs(
|
|
550
|
+
...d.amount,
|
|
551
|
+
amount: -1 * Math.abs(d.amount.amount)
|
|
556
552
|
// ensure truly negative
|
|
557
553
|
}
|
|
558
554
|
}))
|
|
559
555
|
}
|
|
560
556
|
]
|
|
561
|
-
}),
|
|
562
|
-
} catch (
|
|
563
|
-
|
|
557
|
+
}), x("update:show", !1), x("submitted");
|
|
558
|
+
} catch (d) {
|
|
559
|
+
S.open({
|
|
564
560
|
title: "Something went wrong",
|
|
565
561
|
message: `Cannot convert ${e.name}. Please try again.`,
|
|
566
562
|
type: "error"
|
|
567
|
-
}), console.error("error at converting stock amount", e, t,
|
|
563
|
+
}), console.error("error at converting stock amount", e, t, d);
|
|
568
564
|
} finally {
|
|
569
565
|
p.value = !1;
|
|
570
566
|
}
|
|
571
567
|
}
|
|
572
568
|
function z(e, t, f) {
|
|
573
|
-
const
|
|
569
|
+
const d = +t;
|
|
574
570
|
let _ = f;
|
|
575
|
-
t.length > 0 && isFinite(
|
|
571
|
+
t.length > 0 && isFinite(d) ? _ = f.map((y) => (y.id !== e || (y.amount = fe(d)), y)) : _ = f.map((y) => (y.id !== e || (y.amount = { amount: 0, precision: 0 }), y)), o.value = _;
|
|
576
572
|
}
|
|
577
573
|
function P(e) {
|
|
578
574
|
const t = w.value.find((f) => f._id === e);
|
|
579
575
|
return t ? st(t.unit, !0) : [];
|
|
580
576
|
}
|
|
581
577
|
function N(e, t) {
|
|
582
|
-
const f = P(e),
|
|
583
|
-
return
|
|
584
|
-
...
|
|
585
|
-
label:
|
|
578
|
+
const f = P(e), d = f.find((_) => _.value === t) ?? f.find((_) => _.value === null);
|
|
579
|
+
return d ? {
|
|
580
|
+
...d,
|
|
581
|
+
label: d.abbrev
|
|
586
582
|
} : null;
|
|
587
583
|
}
|
|
588
584
|
function ne(e, t, f) {
|
|
589
|
-
let
|
|
585
|
+
let d;
|
|
590
586
|
if (t === null)
|
|
591
|
-
|
|
587
|
+
d = f.map((_) => (_.id !== e || (_.measurement = null), _)) ?? [];
|
|
592
588
|
else {
|
|
593
589
|
const _ = w.value.find((y) => y._id === e);
|
|
594
|
-
|
|
595
|
-
var
|
|
596
|
-
return y.id !== e || (y.measurement = (K = (
|
|
590
|
+
d = f.map((y) => {
|
|
591
|
+
var A, K;
|
|
592
|
+
return y.id !== e || (y.measurement = (K = (A = _ == null ? void 0 : _.unit) == null ? void 0 : A.measurements) == null ? void 0 : K.find((Q) => Q.id === t)), y;
|
|
597
593
|
}) ?? [];
|
|
598
594
|
}
|
|
599
|
-
o.value =
|
|
595
|
+
o.value = d;
|
|
600
596
|
}
|
|
601
597
|
function ce(e, t) {
|
|
602
|
-
const f = t.filter((
|
|
598
|
+
const f = t.filter((d) => d.id !== e);
|
|
603
599
|
o.value = f;
|
|
604
600
|
}
|
|
605
601
|
function oe() {
|
|
@@ -616,14 +612,14 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
616
612
|
return he(
|
|
617
613
|
() => s.show,
|
|
618
614
|
(e) => {
|
|
619
|
-
e || (o.value = null,
|
|
615
|
+
e || (o.value = null, i.value = 0);
|
|
620
616
|
}
|
|
621
617
|
), (e, t) => {
|
|
622
|
-
const f = D("FmTextField"),
|
|
618
|
+
const f = D("FmTextField"), d = D("FmForm"), _ = D("FmCard"), y = D("FmSwitch"), A = D("FmFormGroup"), K = D("FmSelect"), Q = D("FmButton"), me = D("FmSideSheet");
|
|
623
619
|
return B(), O(me, {
|
|
624
620
|
"dismiss-away": "",
|
|
625
621
|
modelValue: v(E),
|
|
626
|
-
"onUpdate:modelValue": t[3] || (t[3] = (
|
|
622
|
+
"onUpdate:modelValue": t[3] || (t[3] = (I) => Ie(E) ? E.value = I : null),
|
|
627
623
|
"max-width": 500
|
|
628
624
|
}, {
|
|
629
625
|
"side-sheet-header": C(() => [
|
|
@@ -633,16 +629,16 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
633
629
|
]),
|
|
634
630
|
default: C(() => [
|
|
635
631
|
n("div", Xt, [
|
|
636
|
-
|
|
632
|
+
b(d, {
|
|
637
633
|
ref_key: "formRef",
|
|
638
|
-
ref:
|
|
634
|
+
ref: U,
|
|
639
635
|
onValidationSuccess: M
|
|
640
636
|
}, {
|
|
641
637
|
default: C(() => [
|
|
642
|
-
|
|
638
|
+
b(f, {
|
|
643
639
|
disabled: p.value,
|
|
644
|
-
"model-value":
|
|
645
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
640
|
+
"model-value": i.value,
|
|
641
|
+
"onUpdate:modelValue": t[0] || (t[0] = (I) => i.value = I),
|
|
646
642
|
label: v(k)("inventory.stock.convert.amount"),
|
|
647
643
|
rules: [H, $, v(Me)(0)],
|
|
648
644
|
"append-text": F.value,
|
|
@@ -651,52 +647,52 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
651
647
|
]),
|
|
652
648
|
_: 1
|
|
653
649
|
}, 512),
|
|
654
|
-
|
|
650
|
+
b(_, {
|
|
655
651
|
variant: "outlined",
|
|
656
652
|
class: "p-16"
|
|
657
653
|
}, {
|
|
658
654
|
default: C(() => [
|
|
659
655
|
n("div", Zt, [
|
|
660
656
|
n("div", en, g(v(k)("inventory.stock.convert.deductionSummary")), 1),
|
|
661
|
-
(B(!0), L(te, null, ae(j.value, (
|
|
657
|
+
(B(!0), L(te, null, ae(j.value, (I) => {
|
|
662
658
|
var Y, J;
|
|
663
659
|
return B(), L("div", {
|
|
664
|
-
key: (Y =
|
|
660
|
+
key: (Y = I.sku) == null ? void 0 : Y._id,
|
|
665
661
|
class: "flex items-center"
|
|
666
662
|
}, [
|
|
667
|
-
n("div", tn, g((J =
|
|
668
|
-
n("div", nn, " -" + g(
|
|
663
|
+
n("div", tn, g((J = I.sku) == null ? void 0 : J.name), 1),
|
|
664
|
+
n("div", nn, " -" + g(I.convertAmount) + " " + g(I.abbrev), 1)
|
|
669
665
|
]);
|
|
670
666
|
}), 128))
|
|
671
667
|
])
|
|
672
668
|
]),
|
|
673
669
|
_: 1
|
|
674
670
|
}),
|
|
675
|
-
|
|
671
|
+
b(_, { variant: "outlined" }, {
|
|
676
672
|
default: C(() => [
|
|
677
673
|
n("div", on, [
|
|
678
|
-
|
|
674
|
+
b(y, {
|
|
679
675
|
value: "",
|
|
680
|
-
modelValue:
|
|
681
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
676
|
+
modelValue: h.value,
|
|
677
|
+
"onUpdate:modelValue": t[1] || (t[1] = (I) => h.value = I),
|
|
682
678
|
label: v(k)("inventory.stock.convert.overrideDeduction"),
|
|
683
679
|
"label-placement": "right"
|
|
684
680
|
}, null, 8, ["modelValue", "label"]),
|
|
685
|
-
|
|
686
|
-
|
|
681
|
+
h.value ? (B(), L(te, { key: 0 }, [
|
|
682
|
+
b(A, {
|
|
687
683
|
modelValue: o.value,
|
|
688
684
|
rules: [v(yt)(1, "Must have at least one ingredient binding")]
|
|
689
685
|
}, null, 8, ["modelValue", "rules"]),
|
|
690
686
|
n("div", sn, [
|
|
691
687
|
n("div", an, g(v(k)("inventory.stock.convert.ingredients")), 1),
|
|
692
|
-
(B(!0), L(te, null, ae(o.value, (
|
|
693
|
-
key:
|
|
688
|
+
(B(!0), L(te, null, ae(o.value, (I) => (B(), O(A, {
|
|
689
|
+
key: I.id,
|
|
694
690
|
disabled: p.value,
|
|
695
|
-
modelValue: +v(ie)(
|
|
691
|
+
modelValue: +v(ie)(I.amount ?? { amount: 1, precision: 0 }),
|
|
696
692
|
rules: [
|
|
697
693
|
v(_t)(
|
|
698
|
-
w.value.find((Y) => Y._id ===
|
|
699
|
-
|
|
694
|
+
w.value.find((Y) => Y._id === I.id).unit,
|
|
695
|
+
I.measurement
|
|
700
696
|
),
|
|
701
697
|
v(Me)(0)
|
|
702
698
|
]
|
|
@@ -705,33 +701,33 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
705
701
|
var J, X, G;
|
|
706
702
|
return [
|
|
707
703
|
n("div", rn, [
|
|
708
|
-
n("div", ln, g((J = w.value.find((se) => se._id ===
|
|
709
|
-
|
|
704
|
+
n("div", ln, g((J = w.value.find((se) => se._id === I.id)) == null ? void 0 : J.name), 1),
|
|
705
|
+
b(f, {
|
|
710
706
|
class: "xs:col-span-2",
|
|
711
707
|
disabled: p.value,
|
|
712
708
|
modelValue: +v(ie)(
|
|
713
|
-
|
|
709
|
+
I.amount ?? { amount: 1, precision: 0 }
|
|
714
710
|
),
|
|
715
|
-
"onUpdate:modelValue": (se) => z(
|
|
711
|
+
"onUpdate:modelValue": (se) => z(I.id, se, o.value ?? []),
|
|
716
712
|
invalid: Y
|
|
717
713
|
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"]),
|
|
718
|
-
|
|
714
|
+
b(K, {
|
|
719
715
|
disabled: p.value,
|
|
720
716
|
class: "translate-y-[2px]",
|
|
721
|
-
items: P(
|
|
722
|
-
"model-value": (G = N(
|
|
723
|
-
"onUpdate:modelValue": (se) => ne(
|
|
717
|
+
items: P(I.id),
|
|
718
|
+
"model-value": (G = N(I.id, (X = I.measurement) == null ? void 0 : X.id)) == null ? void 0 : G.value,
|
|
719
|
+
"onUpdate:modelValue": (se) => ne(I.id, se, o.value ?? []),
|
|
724
720
|
invalid: Y
|
|
725
721
|
}, {
|
|
726
|
-
"helper-text": C(() => []),
|
|
722
|
+
"helper-text": C(() => t[4] || (t[4] = [])),
|
|
727
723
|
_: 2
|
|
728
724
|
}, 1032, ["disabled", "items", "model-value", "onUpdate:modelValue", "invalid"]),
|
|
729
|
-
|
|
725
|
+
b(Q, {
|
|
730
726
|
disabled: p.value,
|
|
731
727
|
type: "button",
|
|
732
728
|
variant: "tertiary",
|
|
733
729
|
icon: "delete",
|
|
734
|
-
onClick: (se) => ce(
|
|
730
|
+
onClick: (se) => ce(I.id, o.value ?? [])
|
|
735
731
|
}, null, 8, ["disabled", "onClick"])
|
|
736
732
|
])
|
|
737
733
|
];
|
|
@@ -740,7 +736,7 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
740
736
|
}, 1032, ["disabled", "modelValue", "rules"]))), 128))
|
|
741
737
|
]),
|
|
742
738
|
n("div", null, [
|
|
743
|
-
|
|
739
|
+
b(Q, {
|
|
744
740
|
icon: "link",
|
|
745
741
|
label: v(k)("inventory.stock.convert.linkIngredient"),
|
|
746
742
|
variant: "plain",
|
|
@@ -756,12 +752,12 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
756
752
|
]),
|
|
757
753
|
"side-sheet-footer": C(() => [
|
|
758
754
|
n("div", un, [
|
|
759
|
-
|
|
755
|
+
b(Q, {
|
|
760
756
|
loading: p.value,
|
|
761
757
|
label: v(k)("inventory.stock.convert.convertButton"),
|
|
762
|
-
onClick: t[2] || (t[2] = (
|
|
758
|
+
onClick: t[2] || (t[2] = (I) => {
|
|
763
759
|
var Y, J;
|
|
764
|
-
return (J = (Y =
|
|
760
|
+
return (J = (Y = U.value) == null ? void 0 : Y.validateInputs) == null ? void 0 : J.call(Y);
|
|
765
761
|
})
|
|
766
762
|
}, null, 8, ["loading", "label"])
|
|
767
763
|
])
|
|
@@ -771,25 +767,25 @@ const Jt = { class: "flex items-center" }, Qt = { class: "fm-typo-en-title-md-80
|
|
|
771
767
|
};
|
|
772
768
|
}
|
|
773
769
|
});
|
|
774
|
-
function
|
|
775
|
-
const r =
|
|
770
|
+
function Ve(c, m) {
|
|
771
|
+
const r = ge(c, m);
|
|
776
772
|
return { ...r, amount: -r.amount };
|
|
777
773
|
}
|
|
778
|
-
function We(c,
|
|
779
|
-
return
|
|
774
|
+
function We(c, m) {
|
|
775
|
+
return ge(Math.abs(c), m);
|
|
780
776
|
}
|
|
781
|
-
const
|
|
777
|
+
const Ae = {
|
|
782
778
|
[Z.enum.DAMAGE]: {
|
|
783
779
|
label: "Waste",
|
|
784
|
-
toAdjustmentAmount:
|
|
780
|
+
toAdjustmentAmount: Ve
|
|
785
781
|
},
|
|
786
782
|
[Z.enum.THEFT]: {
|
|
787
783
|
label: "Theft",
|
|
788
|
-
toAdjustmentAmount:
|
|
784
|
+
toAdjustmentAmount: Ve
|
|
789
785
|
},
|
|
790
786
|
[Z.enum.LOSE]: {
|
|
791
787
|
label: "Lose",
|
|
792
|
-
toAdjustmentAmount:
|
|
788
|
+
toAdjustmentAmount: Ve
|
|
793
789
|
},
|
|
794
790
|
[Z.enum.EXTRA]: {
|
|
795
791
|
label: "Extra",
|
|
@@ -806,110 +802,110 @@ const Ve = {
|
|
|
806
802
|
disabled: { type: Boolean }
|
|
807
803
|
},
|
|
808
804
|
emits: ["update:modelValue", "click:delete"],
|
|
809
|
-
setup(c, { emit:
|
|
810
|
-
const r = c, s =
|
|
811
|
-
() => Object.keys(
|
|
812
|
-
label: ht(
|
|
813
|
-
value:
|
|
805
|
+
setup(c, { emit: m }) {
|
|
806
|
+
const r = c, s = m, x = T(
|
|
807
|
+
() => Object.keys(Ae).map((i) => ({
|
|
808
|
+
label: ht(i),
|
|
809
|
+
value: i
|
|
814
810
|
}))
|
|
815
811
|
), l = T(() => st(r.modelValue.doc.unit, !0)), a = T({
|
|
816
812
|
get() {
|
|
817
813
|
return r.modelValue.type ?? Z.enum.PURCHASE;
|
|
818
814
|
},
|
|
819
|
-
set(
|
|
815
|
+
set(i) {
|
|
820
816
|
const o = {
|
|
821
817
|
...r.modelValue
|
|
822
818
|
};
|
|
823
|
-
o.type =
|
|
819
|
+
o.type = i;
|
|
824
820
|
const w = ze(r.modelValue.amount);
|
|
825
|
-
o.amount =
|
|
821
|
+
o.amount = Ae[o.type].toAdjustmentAmount(
|
|
826
822
|
+ie(w),
|
|
827
823
|
w.precision
|
|
828
824
|
), s("update:modelValue", o);
|
|
829
825
|
}
|
|
830
|
-
}),
|
|
826
|
+
}), u = T({
|
|
831
827
|
get() {
|
|
832
|
-
const
|
|
833
|
-
return +ie(
|
|
828
|
+
const i = ze(r.modelValue.amount);
|
|
829
|
+
return +ie(i);
|
|
834
830
|
},
|
|
835
|
-
set(
|
|
831
|
+
set(i) {
|
|
836
832
|
const o = {
|
|
837
833
|
...r.modelValue
|
|
838
|
-
}, w = fe(
|
|
839
|
-
o.amount =
|
|
840
|
-
|
|
834
|
+
}, w = fe(i);
|
|
835
|
+
o.amount = Ae[a.value].toAdjustmentAmount(
|
|
836
|
+
i,
|
|
841
837
|
w.precision
|
|
842
838
|
), s("update:modelValue", o);
|
|
843
839
|
}
|
|
844
|
-
}),
|
|
840
|
+
}), S = T({
|
|
845
841
|
get() {
|
|
846
|
-
var
|
|
847
|
-
return ((
|
|
842
|
+
var i;
|
|
843
|
+
return ((i = r.modelValue.measurement) == null ? void 0 : i.id) ?? null;
|
|
848
844
|
},
|
|
849
|
-
set(
|
|
850
|
-
var w,
|
|
845
|
+
set(i) {
|
|
846
|
+
var w, V;
|
|
851
847
|
const o = {
|
|
852
848
|
...r.modelValue
|
|
853
849
|
};
|
|
854
|
-
o.measurement = ((
|
|
850
|
+
o.measurement = ((V = (w = r.modelValue.doc.unit) == null ? void 0 : w.measurements) == null ? void 0 : V.find((h) => h.id === i)) ?? null, s("update:modelValue", o);
|
|
855
851
|
}
|
|
856
852
|
}), k = T({
|
|
857
853
|
get() {
|
|
858
854
|
return r.modelValue.remark ?? "";
|
|
859
855
|
},
|
|
860
|
-
set(
|
|
856
|
+
set(i) {
|
|
861
857
|
const o = {
|
|
862
858
|
...r.modelValue
|
|
863
859
|
};
|
|
864
|
-
o.remark =
|
|
860
|
+
o.remark = i, s("update:modelValue", o);
|
|
865
861
|
}
|
|
866
862
|
});
|
|
867
|
-
return (
|
|
868
|
-
const w = D("FmButton"),
|
|
863
|
+
return (i, o) => {
|
|
864
|
+
const w = D("FmButton"), V = D("FmSelect"), h = D("FmTextarea"), p = D("FmCard");
|
|
869
865
|
return B(), O(p, {
|
|
870
866
|
variant: "outlined",
|
|
871
867
|
class: "grid grid-cols-2 gap-8 p-16"
|
|
872
868
|
}, {
|
|
873
869
|
default: C(() => [
|
|
874
870
|
n("div", dn, [
|
|
875
|
-
n("div", mn, g(
|
|
876
|
-
|
|
871
|
+
n("div", mn, g(i.modelValue.doc.name), 1),
|
|
872
|
+
b(w, {
|
|
877
873
|
variant: "tertiary",
|
|
878
874
|
"prepend-icon": "delete",
|
|
879
875
|
onClick: o[0] || (o[0] = (M) => s("click:delete"))
|
|
880
876
|
})
|
|
881
877
|
]),
|
|
882
|
-
|
|
883
|
-
disabled:
|
|
878
|
+
b(V, {
|
|
879
|
+
disabled: i.disabled,
|
|
884
880
|
class: "col-span-2",
|
|
885
881
|
label: "Type",
|
|
886
|
-
items:
|
|
882
|
+
items: x.value,
|
|
887
883
|
modelValue: a.value,
|
|
888
884
|
"onUpdate:modelValue": o[1] || (o[1] = (M) => a.value = M),
|
|
889
|
-
rules: [v(
|
|
885
|
+
rules: [v(gt)()],
|
|
890
886
|
"label-mark": "required"
|
|
891
887
|
}, null, 8, ["disabled", "items", "modelValue", "rules"]),
|
|
892
|
-
|
|
893
|
-
disabled:
|
|
888
|
+
b(Ht, {
|
|
889
|
+
disabled: i.disabled,
|
|
894
890
|
label: "Amount",
|
|
895
891
|
step: +v(ie)({
|
|
896
892
|
amount: 1,
|
|
897
|
-
precision: v(De)(
|
|
893
|
+
precision: v(De)(i.modelValue.doc.unit, i.modelValue.measurement)
|
|
898
894
|
}),
|
|
899
|
-
modelValue:
|
|
900
|
-
"onUpdate:modelValue": o[2] || (o[2] = (M) =>
|
|
895
|
+
modelValue: u.value,
|
|
896
|
+
"onUpdate:modelValue": o[2] || (o[2] = (M) => u.value = M),
|
|
901
897
|
rules: [v(Me)(0)]
|
|
902
898
|
}, null, 8, ["disabled", "step", "modelValue", "rules"]),
|
|
903
|
-
|
|
904
|
-
disabled:
|
|
899
|
+
b(V, {
|
|
900
|
+
disabled: i.disabled,
|
|
905
901
|
label: "Unit",
|
|
906
902
|
items: l.value,
|
|
907
|
-
modelValue:
|
|
908
|
-
"onUpdate:modelValue": o[3] || (o[3] = (M) =>
|
|
903
|
+
modelValue: S.value,
|
|
904
|
+
"onUpdate:modelValue": o[3] || (o[3] = (M) => S.value = M)
|
|
909
905
|
}, null, 8, ["disabled", "items", "modelValue"]),
|
|
910
|
-
|
|
906
|
+
b(h, {
|
|
911
907
|
class: "col-span-2",
|
|
912
|
-
disabled:
|
|
908
|
+
disabled: i.disabled,
|
|
913
909
|
label: "Remark",
|
|
914
910
|
modelValue: k.value,
|
|
915
911
|
"onUpdate:modelValue": o[4] || (o[4] = (M) => k.value = M),
|
|
@@ -927,13 +923,13 @@ const Ve = {
|
|
|
927
923
|
show: { type: Boolean }
|
|
928
924
|
},
|
|
929
925
|
emits: ["update:show", "submitted"],
|
|
930
|
-
setup(c, { expose:
|
|
931
|
-
const s = c,
|
|
926
|
+
setup(c, { expose: m, emit: r }) {
|
|
927
|
+
const s = c, x = r, l = Te(), a = nt(), u = Se(), S = de(), k = R(!1), { t: i } = le();
|
|
932
928
|
function o() {
|
|
933
|
-
p(Pe(
|
|
929
|
+
p(Pe(h));
|
|
934
930
|
}
|
|
935
931
|
const w = R();
|
|
936
|
-
|
|
932
|
+
m({
|
|
937
933
|
validateInputs: () => {
|
|
938
934
|
var $, F;
|
|
939
935
|
(F = ($ = w.value) == null ? void 0 : $.validateInputs) == null || F.call($);
|
|
@@ -947,7 +943,7 @@ const Ve = {
|
|
|
947
943
|
(F = ($ = w.value) == null ? void 0 : $.resetInputs) == null || F.call($);
|
|
948
944
|
}
|
|
949
945
|
});
|
|
950
|
-
const
|
|
946
|
+
const V = Re(s, "show"), h = it({
|
|
951
947
|
remark: "",
|
|
952
948
|
adjustments: [
|
|
953
949
|
{
|
|
@@ -961,7 +957,7 @@ const Ve = {
|
|
|
961
957
|
]
|
|
962
958
|
});
|
|
963
959
|
he([() => s.show], ([$]) => {
|
|
964
|
-
$ && (
|
|
960
|
+
$ && (h.remark = "", h.adjustments = [
|
|
965
961
|
{
|
|
966
962
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
967
963
|
type: Z.enum.PURCHASE,
|
|
@@ -975,21 +971,21 @@ const Ve = {
|
|
|
975
971
|
async function p($) {
|
|
976
972
|
k.value = !0;
|
|
977
973
|
try {
|
|
978
|
-
await
|
|
974
|
+
await u.adjustSku({
|
|
979
975
|
remark: $.remark,
|
|
980
|
-
adjustments: $.adjustments.map(({ doc: F, remark: j, type:
|
|
976
|
+
adjustments: $.adjustments.map(({ doc: F, remark: j, type: U, amount: E, measurement: W }) => ({
|
|
981
977
|
id: F._id,
|
|
982
978
|
amount: E,
|
|
983
979
|
measurement: W,
|
|
984
980
|
remark: j,
|
|
985
981
|
doc: F,
|
|
986
|
-
type:
|
|
982
|
+
type: U
|
|
987
983
|
}))
|
|
988
|
-
}),
|
|
984
|
+
}), x("update:show", !1), x("submitted");
|
|
989
985
|
} catch (F) {
|
|
990
|
-
|
|
991
|
-
title:
|
|
992
|
-
message:
|
|
986
|
+
S.open({
|
|
987
|
+
title: i("inventory.stock.adjust.error.title"),
|
|
988
|
+
message: i("inventory.stock.adjust.error.message"),
|
|
993
989
|
type: "error"
|
|
994
990
|
}), console.log("error on adjust ingredients", $, F);
|
|
995
991
|
} finally {
|
|
@@ -1001,10 +997,10 @@ const Ve = {
|
|
|
1001
997
|
label: j.name,
|
|
1002
998
|
sublabel: j.code,
|
|
1003
999
|
value: j._id
|
|
1004
|
-
})), F = $.filter((j) =>
|
|
1000
|
+
})), F = $.filter((j) => h.adjustments.find((U) => U.doc._id === j.value)).map((j) => j.value);
|
|
1005
1001
|
a.open({
|
|
1006
1002
|
title: "Select ingredients",
|
|
1007
|
-
contentComponent:
|
|
1003
|
+
contentComponent: bt,
|
|
1008
1004
|
contentComponentProps: {
|
|
1009
1005
|
items: $,
|
|
1010
1006
|
modelValue: F
|
|
@@ -1022,11 +1018,11 @@ const Ve = {
|
|
|
1022
1018
|
variant: "tertiary"
|
|
1023
1019
|
}
|
|
1024
1020
|
}).onPrimary((j) => {
|
|
1025
|
-
|
|
1026
|
-
(
|
|
1021
|
+
h.adjustments = j.map(
|
|
1022
|
+
(U) => h.adjustments.find((E) => E.doc._id === U) ?? {
|
|
1027
1023
|
id: `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
1028
1024
|
type: Z.enum.PURCHASE,
|
|
1029
|
-
doc: l.skus.find((E) => E._id ===
|
|
1025
|
+
doc: l.skus.find((E) => E._id === U),
|
|
1030
1026
|
measurement: null,
|
|
1031
1027
|
remark: "",
|
|
1032
1028
|
amount: fe(1)
|
|
@@ -1035,47 +1031,47 @@ const Ve = {
|
|
|
1035
1031
|
});
|
|
1036
1032
|
}
|
|
1037
1033
|
function H($) {
|
|
1038
|
-
|
|
1034
|
+
h.adjustments.splice($, 1);
|
|
1039
1035
|
}
|
|
1040
1036
|
return ($, F) => {
|
|
1041
|
-
const j = D("FmTextarea"),
|
|
1037
|
+
const j = D("FmTextarea"), U = D("FmButton"), E = D("FmForm"), W = D("FmSideSheet");
|
|
1042
1038
|
return B(), O(W, {
|
|
1043
|
-
modelValue: v(
|
|
1044
|
-
"onUpdate:modelValue": F[2] || (F[2] = (z) =>
|
|
1039
|
+
modelValue: v(V),
|
|
1040
|
+
"onUpdate:modelValue": F[2] || (F[2] = (z) => Ie(V) ? V.value = z : null),
|
|
1045
1041
|
"dismiss-away": "",
|
|
1046
1042
|
"max-width": 500
|
|
1047
1043
|
}, {
|
|
1048
1044
|
"side-sheet-header": C(() => [
|
|
1049
1045
|
n("div", vn, [
|
|
1050
|
-
n("div", fn, g(v(
|
|
1046
|
+
n("div", fn, g(v(i)("inventory.stock.adjust.title")), 1)
|
|
1051
1047
|
])
|
|
1052
1048
|
]),
|
|
1053
1049
|
default: C(() => [
|
|
1054
|
-
|
|
1050
|
+
b(E, {
|
|
1055
1051
|
class: "w-full flex flex-col gap-12",
|
|
1056
1052
|
ref_key: "formRef",
|
|
1057
1053
|
ref: w,
|
|
1058
1054
|
onValidationSuccess: o
|
|
1059
1055
|
}, {
|
|
1060
1056
|
default: C(() => [
|
|
1061
|
-
|
|
1062
|
-
label: v(
|
|
1063
|
-
modelValue:
|
|
1064
|
-
"onUpdate:modelValue": F[0] || (F[0] = (z) =>
|
|
1057
|
+
b(j, {
|
|
1058
|
+
label: v(i)("inventory.stock.adjust.remark"),
|
|
1059
|
+
modelValue: h.remark,
|
|
1060
|
+
"onUpdate:modelValue": F[0] || (F[0] = (z) => h.remark = z)
|
|
1065
1061
|
}, null, 8, ["label", "modelValue"]),
|
|
1066
1062
|
n("div", yn, [
|
|
1067
|
-
n("div", _n, g(v(
|
|
1068
|
-
|
|
1063
|
+
n("div", _n, g(v(i)("inventory.stock.adjust.adjustedItems")), 1),
|
|
1064
|
+
b(U, {
|
|
1069
1065
|
"prepend-icon": "add",
|
|
1070
1066
|
variant: "tertiary",
|
|
1071
1067
|
size: "md",
|
|
1072
1068
|
onClick: M
|
|
1073
1069
|
})
|
|
1074
1070
|
]),
|
|
1075
|
-
(B(!0), L(te, null, ae(
|
|
1071
|
+
(B(!0), L(te, null, ae(h.adjustments, (z, P) => (B(), O(pn, {
|
|
1076
1072
|
key: z.id,
|
|
1077
|
-
modelValue:
|
|
1078
|
-
"onUpdate:modelValue": (N) =>
|
|
1073
|
+
modelValue: h.adjustments[P],
|
|
1074
|
+
"onUpdate:modelValue": (N) => h.adjustments[P] = N,
|
|
1079
1075
|
"onClick:delete": (N) => H(P)
|
|
1080
1076
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onClick:delete"]))), 128))
|
|
1081
1077
|
]),
|
|
@@ -1084,8 +1080,8 @@ const Ve = {
|
|
|
1084
1080
|
]),
|
|
1085
1081
|
"side-sheet-footer": C(() => [
|
|
1086
1082
|
n("div", kn, [
|
|
1087
|
-
|
|
1088
|
-
label: v(
|
|
1083
|
+
b(U, {
|
|
1084
|
+
label: v(i)("inventory.stock.adjust.adjustButton"),
|
|
1089
1085
|
loading: k.value,
|
|
1090
1086
|
onClick: F[1] || (F[1] = (z) => {
|
|
1091
1087
|
var P, N;
|
|
@@ -1098,27 +1094,27 @@ const Ve = {
|
|
|
1098
1094
|
}, 8, ["modelValue"]);
|
|
1099
1095
|
};
|
|
1100
1096
|
}
|
|
1101
|
-
}),
|
|
1097
|
+
}), gn = Xe((c, m) => ({
|
|
1102
1098
|
// TODO: remove once latest inventory backend has been push
|
|
1103
|
-
async findBillsByBusinessId(r, s,
|
|
1099
|
+
async findBillsByBusinessId(r, s, x) {
|
|
1104
1100
|
const l = `${c.businessesBackendUrl}/${r}/reports/find-many`, a = {
|
|
1105
1101
|
// type: TYPE.bill,
|
|
1106
1102
|
type: "bill",
|
|
1107
1103
|
restaurantIds: s,
|
|
1108
|
-
ids:
|
|
1104
|
+
ids: x
|
|
1109
1105
|
};
|
|
1110
|
-
return await
|
|
1106
|
+
return await m.post(l, a);
|
|
1111
1107
|
},
|
|
1112
1108
|
async findBillsById(r) {
|
|
1113
|
-
const
|
|
1109
|
+
const x = ue().currentLocationDBName, l = `${c.inventoryBackendUrl}/${x}/bill/search`, a = {
|
|
1114
1110
|
ids: r
|
|
1115
1111
|
};
|
|
1116
|
-
return await
|
|
1112
|
+
return await m.post(l, a);
|
|
1117
1113
|
}
|
|
1118
|
-
})),
|
|
1114
|
+
})), bn = { class: "p-16" }, xn = { class: "fm-typo-en-body-md-600 flex-grow" }, Sn = { class: "flex-grow text-fm-color-typo-secondary" }, $n = {
|
|
1119
1115
|
key: 0,
|
|
1120
1116
|
class: "my-5"
|
|
1121
|
-
}, wn = { class: "text-neutral-400" }, Bn = { class: "flex-grow" }, Fn = { class: "flex gap-1" },
|
|
1117
|
+
}, wn = { class: "text-neutral-400" }, Bn = { class: "flex-grow" }, Fn = { class: "flex gap-1" }, Vn = { class: "flex flex-col gap-1" }, An = {
|
|
1122
1118
|
key: 1,
|
|
1123
1119
|
class: "t-system text-fsecondary"
|
|
1124
1120
|
}, Cn = {
|
|
@@ -1132,84 +1128,84 @@ const Ve = {
|
|
|
1132
1128
|
bills: { default: () => [] }
|
|
1133
1129
|
},
|
|
1134
1130
|
setup(c) {
|
|
1135
|
-
const
|
|
1131
|
+
const m = c, r = R(!1), s = R(), x = R(null), l = T(() => x.value === null ? "unset" : r.value ? `${x.value}px` : "0px");
|
|
1136
1132
|
Je(() => {
|
|
1137
1133
|
var k;
|
|
1138
|
-
|
|
1134
|
+
x.value = ((k = s.value) == null ? void 0 : k.scrollHeight) || 0;
|
|
1139
1135
|
});
|
|
1140
1136
|
const a = T(() => {
|
|
1141
|
-
var
|
|
1142
|
-
const k =
|
|
1137
|
+
var h;
|
|
1138
|
+
const k = m.record.adjustments, i = m.sku, o = {}, V = k.flatMap((p) => {
|
|
1143
1139
|
var M;
|
|
1144
|
-
return ((M = p.skus) == null ? void 0 : M.filter((H) => H.sku._id ===
|
|
1140
|
+
return ((M = p.skus) == null ? void 0 : M.filter((H) => H.sku._id === i._id)) ?? [];
|
|
1145
1141
|
}).flatMap((p) => p.amounts);
|
|
1146
|
-
for (const p of
|
|
1142
|
+
for (const p of V) {
|
|
1147
1143
|
const M = p.measurement ? xt(p.measurement.conversion, p.amount) : p.amount;
|
|
1148
|
-
o[
|
|
1144
|
+
o[h = p.type] ?? (o[h] = { amount: 0, precision: 0 }), o[p.type] = Ze(M, o[p.type]);
|
|
1149
1145
|
}
|
|
1150
1146
|
return Object.entries(o).reduce(
|
|
1151
1147
|
(p, [M, H]) => (p[M] = /// comment, because without it formatter makes code uglier
|
|
1152
1148
|
`${q.toFormatString({
|
|
1153
1149
|
value: H,
|
|
1154
1150
|
precision: 4
|
|
1155
|
-
})} ${
|
|
1151
|
+
})} ${i.unit.abbrev}`, p),
|
|
1156
1152
|
{}
|
|
1157
1153
|
);
|
|
1158
|
-
}), { t:
|
|
1154
|
+
}), { t: u } = le(), S = T(() => m.record.adjustmentsByTime.map(({ date: k, adjustments: i }) => ({
|
|
1159
1155
|
time: St(new Date(k)),
|
|
1160
|
-
adjustments:
|
|
1156
|
+
adjustments: i.flatMap(
|
|
1161
1157
|
(o) => {
|
|
1162
|
-
var w,
|
|
1163
|
-
return ((
|
|
1164
|
-
...
|
|
1158
|
+
var w, V;
|
|
1159
|
+
return ((V = (w = o.skus) == null ? void 0 : w.map) == null ? void 0 : V.call(w, (h) => ({
|
|
1160
|
+
...h,
|
|
1165
1161
|
ref: o.ref,
|
|
1166
1162
|
backdateFrom: o.effectiveAt != null ? ot(o._id) : null
|
|
1167
1163
|
}))) ?? [];
|
|
1168
1164
|
}
|
|
1169
1165
|
).flatMap((o) => {
|
|
1170
|
-
var
|
|
1171
|
-
const w = (
|
|
1166
|
+
var h;
|
|
1167
|
+
const w = (h = m.bills.find((p) => p._id === o.ref)) == null ? void 0 : h.seqNumber, V = w ? u("inventory.stock.record.bill", [w]) : "";
|
|
1172
1168
|
return o.amounts.map((p) => {
|
|
1173
1169
|
var M;
|
|
1174
1170
|
return {
|
|
1175
1171
|
amount: `${q.toFormatString({ value: p.amount, precision: 4 })} ${((M = p.measurement) == null ? void 0 : M.abbrev) ?? o.sku.unit.abbrev}`,
|
|
1176
1172
|
backdateFrom: o.backdateFrom,
|
|
1177
1173
|
name: p.type,
|
|
1178
|
-
remark: p.remark ||
|
|
1174
|
+
remark: p.remark || V || "",
|
|
1179
1175
|
cost: p.cost
|
|
1180
1176
|
};
|
|
1181
1177
|
});
|
|
1182
1178
|
})
|
|
1183
1179
|
})));
|
|
1184
|
-
return (k,
|
|
1185
|
-
const o = D("FmIcon"), w = D("FmTooltip"),
|
|
1186
|
-
return B(), O(
|
|
1180
|
+
return (k, i) => {
|
|
1181
|
+
const o = D("FmIcon"), w = D("FmTooltip"), V = D("FmCard");
|
|
1182
|
+
return B(), O(V, { variant: "outlined" }, {
|
|
1187
1183
|
default: C(() => [
|
|
1188
|
-
n("div",
|
|
1184
|
+
n("div", bn, [
|
|
1189
1185
|
n("div", {
|
|
1190
1186
|
class: "flex items-center cursor-pointer mb-1",
|
|
1191
|
-
onClick:
|
|
1187
|
+
onClick: i[0] || (i[0] = (h) => r.value = !r.value)
|
|
1192
1188
|
}, [
|
|
1193
1189
|
n("div", xn, g(k.record.date), 1),
|
|
1194
|
-
|
|
1190
|
+
b(o, {
|
|
1195
1191
|
name: r.value ? "expand_more" : "expand_less",
|
|
1196
1192
|
color: "#777777",
|
|
1197
1193
|
size: "md"
|
|
1198
1194
|
}, null, 8, ["name"])
|
|
1199
1195
|
]),
|
|
1200
|
-
(B(!0), L(te, null, ae(a.value, (
|
|
1196
|
+
(B(!0), L(te, null, ae(a.value, (h, p) => (B(), L("div", {
|
|
1201
1197
|
key: p,
|
|
1202
1198
|
class: "flex flex-row py-1",
|
|
1203
1199
|
style: { "font-size": "0.8rem" }
|
|
1204
1200
|
}, [
|
|
1205
|
-
n("div", Sn, g(v(
|
|
1201
|
+
n("div", Sn, g(v(u)(`inventory.inventoryAdjustment.type.${p}`)), 1),
|
|
1206
1202
|
n("div", {
|
|
1207
1203
|
class: Ce({
|
|
1208
|
-
"text-fm-color-typo-error":
|
|
1209
|
-
"text-fm-color-typo-success": !
|
|
1204
|
+
"text-fm-color-typo-error": h.startsWith("-"),
|
|
1205
|
+
"text-fm-color-typo-success": !h.startsWith("-"),
|
|
1210
1206
|
"ml-auto": !0
|
|
1211
1207
|
})
|
|
1212
|
-
}, g(
|
|
1208
|
+
}, g(h), 3)
|
|
1213
1209
|
]))), 128)),
|
|
1214
1210
|
n("div", {
|
|
1215
1211
|
ref_key: "detailRef",
|
|
@@ -1221,19 +1217,19 @@ const Ve = {
|
|
|
1221
1217
|
transition: "max-height 0.2s ease-out"
|
|
1222
1218
|
})
|
|
1223
1219
|
}, [
|
|
1224
|
-
|
|
1225
|
-
(B(!0), L(te, null, ae(
|
|
1226
|
-
key:
|
|
1220
|
+
S.value.length ? (B(), L("hr", $n)) : ee("", !0),
|
|
1221
|
+
(B(!0), L(te, null, ae(S.value, (h) => (B(), L("div", {
|
|
1222
|
+
key: h.time,
|
|
1227
1223
|
class: "flex gap-1 w-full"
|
|
1228
1224
|
}, [
|
|
1229
|
-
n("div", wn, g(
|
|
1225
|
+
n("div", wn, g(h.time), 1),
|
|
1230
1226
|
n("div", Bn, [
|
|
1231
|
-
(B(!0), L(te, null, ae(
|
|
1227
|
+
(B(!0), L(te, null, ae(h.adjustments, (p) => (B(), L("div", {
|
|
1232
1228
|
key: p.name,
|
|
1233
1229
|
class: "flex gap-1"
|
|
1234
1230
|
}, [
|
|
1235
1231
|
n("div", Fn, [
|
|
1236
|
-
ve(g(v(
|
|
1232
|
+
ve(g(v(u)(`inventory.inventoryAdjustment.type.${p.name}`)) + " ", 1),
|
|
1237
1233
|
p.backdateFrom ? (B(), O(w, {
|
|
1238
1234
|
key: 0,
|
|
1239
1235
|
variant: "plain",
|
|
@@ -1241,10 +1237,10 @@ const Ve = {
|
|
|
1241
1237
|
"z-index": 50
|
|
1242
1238
|
}, {
|
|
1243
1239
|
content: C(() => [
|
|
1244
|
-
n("div",
|
|
1240
|
+
n("div", Vn, g(v(u)("inventory.stock.record.backdate", [v(et)(new Date(p.backdateFrom))])), 1)
|
|
1245
1241
|
]),
|
|
1246
1242
|
default: C(() => [
|
|
1247
|
-
|
|
1243
|
+
b(o, {
|
|
1248
1244
|
name: "info",
|
|
1249
1245
|
size: "sm",
|
|
1250
1246
|
color: "primary"
|
|
@@ -1252,7 +1248,7 @@ const Ve = {
|
|
|
1252
1248
|
]),
|
|
1253
1249
|
_: 2
|
|
1254
1250
|
}, 1024)) : ee("", !0),
|
|
1255
|
-
p.remark ? (B(), L("span",
|
|
1251
|
+
p.remark ? (B(), L("span", An, " # " + g(p.remark), 1)) : ee("", !0)
|
|
1256
1252
|
]),
|
|
1257
1253
|
n("div", {
|
|
1258
1254
|
class: Ce({
|
|
@@ -1273,66 +1269,66 @@ const Ve = {
|
|
|
1273
1269
|
};
|
|
1274
1270
|
}
|
|
1275
1271
|
});
|
|
1276
|
-
function Mn(c,
|
|
1272
|
+
function Mn(c, m) {
|
|
1277
1273
|
var l;
|
|
1278
1274
|
const r = Object.keys(Z.enum).reduce(
|
|
1279
|
-
(a,
|
|
1275
|
+
(a, u) => (a[u] = { amount: 0, precision: 0 }, a),
|
|
1280
1276
|
{}
|
|
1281
1277
|
);
|
|
1282
|
-
if (!
|
|
1278
|
+
if (!m)
|
|
1283
1279
|
return Object.entries(r).reduce(
|
|
1284
|
-
(a, [
|
|
1280
|
+
(a, [u]) => (a[u] = q.fromNumber(0), a),
|
|
1285
1281
|
{}
|
|
1286
1282
|
);
|
|
1287
|
-
const
|
|
1288
|
-
var
|
|
1289
|
-
return ((
|
|
1283
|
+
const x = c.flatMap((a) => {
|
|
1284
|
+
var u;
|
|
1285
|
+
return ((u = a.skus) == null ? void 0 : u.filter((S) => S.sku._id === m._id)) ?? [];
|
|
1290
1286
|
}).flatMap((a) => a.amounts);
|
|
1291
|
-
for (const a of
|
|
1292
|
-
const
|
|
1293
|
-
r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] = q.add([
|
|
1287
|
+
for (const a of x) {
|
|
1288
|
+
const u = a.measurement ? q.multiply([a.measurement.conversion, a.amount]) : a.amount;
|
|
1289
|
+
r[l = a.type] ?? (r[l] = { amount: 0, precision: 0 }), r[a.type] = q.add([u, r[a.type]]);
|
|
1294
1290
|
}
|
|
1295
1291
|
return Object.entries(r).reduce(
|
|
1296
|
-
(a, [
|
|
1292
|
+
(a, [u, S]) => {
|
|
1297
1293
|
const k = {
|
|
1298
|
-
...
|
|
1299
|
-
amount: Math.abs(
|
|
1294
|
+
...S,
|
|
1295
|
+
amount: Math.abs(S.amount)
|
|
1300
1296
|
};
|
|
1301
|
-
return a[
|
|
1297
|
+
return a[u] = /// comment, because without it formatter makes code uglier
|
|
1302
1298
|
`${q.toFormatString({
|
|
1303
1299
|
value: k,
|
|
1304
1300
|
precision: 4
|
|
1305
|
-
})} ${
|
|
1301
|
+
})} ${m.unit.abbrev}`, a;
|
|
1306
1302
|
},
|
|
1307
1303
|
{}
|
|
1308
1304
|
);
|
|
1309
1305
|
}
|
|
1310
|
-
function jn(c,
|
|
1311
|
-
if (!
|
|
1306
|
+
function jn(c, m) {
|
|
1307
|
+
if (!m)
|
|
1312
1308
|
return null;
|
|
1313
1309
|
let r = null;
|
|
1314
|
-
const
|
|
1310
|
+
const x = c.flatMap((l) => {
|
|
1315
1311
|
var a;
|
|
1316
|
-
return ((a = l.skus) == null ? void 0 : a.filter((
|
|
1312
|
+
return ((a = l.skus) == null ? void 0 : a.filter((u) => u.sku._id === m._id)) ?? [];
|
|
1317
1313
|
}).flatMap((l) => {
|
|
1318
1314
|
var a;
|
|
1319
1315
|
return !l.history || ((a = l.history) == null ? void 0 : a.length) === 0 ? [] : l.history[0];
|
|
1320
1316
|
});
|
|
1321
|
-
for (const l of
|
|
1317
|
+
for (const l of x) {
|
|
1322
1318
|
const a = l.amounts;
|
|
1323
|
-
for (const
|
|
1324
|
-
if (
|
|
1319
|
+
for (const u of a) {
|
|
1320
|
+
if (u.type !== Z.Enum.SALES)
|
|
1325
1321
|
continue;
|
|
1326
|
-
const
|
|
1327
|
-
r ?? (r = q.fromNumber(0)), r = q.add([r,
|
|
1322
|
+
const S = u.measurement ? q.multiply([u.measurement.conversion, u.amount]) : u.amount;
|
|
1323
|
+
r ?? (r = q.fromNumber(0)), r = q.add([r, S]);
|
|
1328
1324
|
}
|
|
1329
1325
|
}
|
|
1330
1326
|
return r != null ? (r.amount = Math.abs(r.amount), `${q.toFormatString({
|
|
1331
1327
|
value: r,
|
|
1332
1328
|
precision: 4
|
|
1333
|
-
})} ${
|
|
1329
|
+
})} ${m.unit.abbrev}`) : null;
|
|
1334
1330
|
}
|
|
1335
|
-
const
|
|
1331
|
+
const Un = { class: "flex items-center w-full fm-typo-en-title-md-800" }, In = { class: "flex-1 line-clamp-2" }, Pn = { class: "flex flex-col gap-32 w-full h-full" }, Tn = { class: "flex items-center relative gap-4" }, Rn = { class: "flex-1" }, Hn = {
|
|
1336
1332
|
key: 0,
|
|
1337
1333
|
class: "flex-1 flex flex-col items-center gap-16"
|
|
1338
1334
|
}, En = { class: "fm-typo-en-body-lg-400 translate-x-4" }, Ln = {
|
|
@@ -1344,10 +1340,10 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1344
1340
|
}, Yn = { class: "flex flex-col gap-1" }, Kn = { class: "text-fm-color-typo-secondary" }, Gn = { class: "font-bold" }, qn = { class: "flex flex-col gap-1" }, Wn = { class: "text-fm-color-typo-secondary flex" }, Jn = { class: "font-bold" }, Qn = { class: "flex flex-col gap-1" }, Xn = { class: "text-fm-color-typo-secondary" }, Zn = { class: "font-bold" }, eo = { class: "flex flex-col gap-1" }, to = { class: "text-fm-color-typo-secondary" }, no = { class: "font-bold" }, oo = { class: "flex flex-col gap-1" }, so = { class: "text-fm-color-typo-secondary" }, ao = { class: "font-bold" }, ro = { class: "flex flex-col gap-1" }, lo = { class: "text-fm-color-typo-secondary" }, io = { class: "font-bold" }, uo = { class: "flex flex-col gap-1" }, co = { class: "text-fm-color-typo-secondary" }, mo = { class: "font-bold" }, po = { class: "flex flex-col gap-1" }, vo = { class: "text-fm-color-typo-secondary" }, fo = { class: "font-bold" }, yo = { class: "flex flex-col gap-1" }, _o = { class: "text-fm-color-typo-secondary" }, ko = { class: "font-bold" }, ho = {
|
|
1345
1341
|
key: 0,
|
|
1346
1342
|
class: "flex flex-col gap-8"
|
|
1347
|
-
},
|
|
1343
|
+
}, go = { class: "flex" }, bo = { class: "flex-1 flex flex-col gap-1" }, xo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, So = { class: "font-bold" }, $o = { class: "flex-1 flex flex-col gap-1" }, wo = { class: "flex gap-1 items-center text-fm-color-typo-secondary" }, Bo = { class: "flex flex-col gap-1" }, Fo = { class: "font-bold" }, Vo = {
|
|
1348
1344
|
key: 2,
|
|
1349
1345
|
class: "flex-1 flex flex-col items-center gap-8"
|
|
1350
|
-
},
|
|
1346
|
+
}, Ao = ["src"], Co = { class: "font-bold text-lg" }, Do = { class: "text-xs text-neutral-400 text-center" }, Mo = /* @__PURE__ */ re({
|
|
1351
1347
|
__name: "StockHistory",
|
|
1352
1348
|
props: {
|
|
1353
1349
|
sku: {},
|
|
@@ -1355,96 +1351,96 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1355
1351
|
},
|
|
1356
1352
|
emits: ["update:show"],
|
|
1357
1353
|
setup(c) {
|
|
1358
|
-
const
|
|
1354
|
+
const m = tt(), r = He(), s = Se(), x = gn(), l = ue(), a = wt(), { t: u } = le(), S = c, k = R(!1), i = de(), o = R(ct(0));
|
|
1359
1355
|
async function w() {
|
|
1360
1356
|
k.value = !0;
|
|
1361
1357
|
try {
|
|
1362
1358
|
await $(), await r.readStockBalance();
|
|
1363
1359
|
} catch (e) {
|
|
1364
|
-
|
|
1360
|
+
i.open({
|
|
1365
1361
|
title: "Something went wrong",
|
|
1366
1362
|
message: "Cannot fetch stock history. Please try again.",
|
|
1367
1363
|
type: "error"
|
|
1368
|
-
}), console.log("failed at fetching item adjustment history",
|
|
1364
|
+
}), console.log("failed at fetching item adjustment history", S.sku, o, e);
|
|
1369
1365
|
} finally {
|
|
1370
1366
|
k.value = !1;
|
|
1371
1367
|
}
|
|
1372
1368
|
}
|
|
1373
1369
|
Je(() => {
|
|
1374
1370
|
w();
|
|
1375
|
-
}), he([() => o.value, () =>
|
|
1371
|
+
}), he([() => o.value, () => S.sku], () => {
|
|
1376
1372
|
w();
|
|
1377
1373
|
});
|
|
1378
|
-
const
|
|
1374
|
+
const V = R([]), h = R([]), p = R(new Array());
|
|
1379
1375
|
function M(e, t) {
|
|
1380
1376
|
return t === "day" ? Ct(e) : et(e);
|
|
1381
1377
|
}
|
|
1382
1378
|
function H(e, t) {
|
|
1383
1379
|
const f = e.reduce(
|
|
1384
|
-
(
|
|
1380
|
+
(d, _) => {
|
|
1385
1381
|
const y = _.effectiveAt ?? ot(_._id);
|
|
1386
1382
|
if (!y)
|
|
1387
|
-
return
|
|
1388
|
-
const
|
|
1389
|
-
return
|
|
1383
|
+
return d;
|
|
1384
|
+
const A = M(new Date(y), t);
|
|
1385
|
+
return d[A] ?? (d[A] = []), d[A].push(_), d;
|
|
1390
1386
|
},
|
|
1391
1387
|
{}
|
|
1392
1388
|
);
|
|
1393
|
-
return Object.keys(f).map((
|
|
1394
|
-
date:
|
|
1395
|
-
adjustments: f[
|
|
1389
|
+
return Object.keys(f).map((d) => ({
|
|
1390
|
+
date: d,
|
|
1391
|
+
adjustments: f[d]
|
|
1396
1392
|
}));
|
|
1397
1393
|
}
|
|
1398
1394
|
async function $() {
|
|
1399
1395
|
let e = await s.readStockAdjustment(
|
|
1400
|
-
|
|
1396
|
+
S.sku._id,
|
|
1401
1397
|
Bt(new Date(o.value.startDate)).toISOString(),
|
|
1402
1398
|
Ft(new Date(o.value.endDate)).toISOString()
|
|
1403
1399
|
);
|
|
1404
|
-
|
|
1400
|
+
V.value = e;
|
|
1405
1401
|
const t = e.filter(({ ref: f }) => f == null ? void 0 : f.startsWith("bill_")).map(({ ref: f }) => f);
|
|
1406
|
-
await F(t),
|
|
1402
|
+
await F(t), h.value = H(e, "day").map(({ date: f, adjustments: d }) => ({
|
|
1407
1403
|
date: f,
|
|
1408
|
-
adjustments:
|
|
1409
|
-
adjustmentsByTime: H(
|
|
1404
|
+
adjustments: d,
|
|
1405
|
+
adjustmentsByTime: H(d, "minute")
|
|
1410
1406
|
}));
|
|
1411
1407
|
}
|
|
1412
1408
|
async function F(e) {
|
|
1413
|
-
e.length && (p.value = await
|
|
1409
|
+
e.length && (p.value = await x.findBillsById(e).catch((t) => {
|
|
1414
1410
|
var _;
|
|
1415
1411
|
console.error("Error on using latest bill API, retrying using legacy api", t);
|
|
1416
|
-
const f = ((_ =
|
|
1417
|
-
return
|
|
1412
|
+
const f = ((_ = m.currentBusiness.value) == null ? void 0 : _._id) ?? "", d = l.currentLocation.doc._id;
|
|
1413
|
+
return x.findBillsByBusinessId(f, [d], e);
|
|
1418
1414
|
}));
|
|
1419
1415
|
}
|
|
1420
1416
|
const j = T(() => {
|
|
1421
|
-
const e =
|
|
1417
|
+
const e = V.value, t = S.sku;
|
|
1422
1418
|
return Mn(e, t);
|
|
1423
|
-
}),
|
|
1424
|
-
const e =
|
|
1419
|
+
}), U = T(() => {
|
|
1420
|
+
const e = V.value, t = S.sku;
|
|
1425
1421
|
return jn(e, t);
|
|
1426
1422
|
}), E = T(() => {
|
|
1427
|
-
const e = [...
|
|
1423
|
+
const e = [...V.value].computeFirst((f) => {
|
|
1428
1424
|
var _, y;
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1425
|
+
const d = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === S.sku._id);
|
|
1426
|
+
return d == null ? void 0 : d.fromBalance;
|
|
1431
1427
|
}) ?? {
|
|
1432
1428
|
amount: 0,
|
|
1433
1429
|
precision: 0
|
|
1434
|
-
}, t =
|
|
1430
|
+
}, t = S.sku;
|
|
1435
1431
|
return t ? `${q.toFormatString({
|
|
1436
1432
|
value: e,
|
|
1437
1433
|
precision: 4
|
|
1438
1434
|
})} ${t.unit.abbrev}` : "";
|
|
1439
1435
|
}), W = T(() => {
|
|
1440
|
-
const e = [...
|
|
1436
|
+
const e = [...V.value].reverse().computeFirst((f) => {
|
|
1441
1437
|
var _, y;
|
|
1442
|
-
const
|
|
1443
|
-
return
|
|
1438
|
+
const d = (y = (_ = f.skus) == null ? void 0 : _.find) == null ? void 0 : y.call(_, (A) => A.sku._id === S.sku._id);
|
|
1439
|
+
return d == null ? void 0 : d.toBalance;
|
|
1444
1440
|
}) ?? {
|
|
1445
1441
|
amount: 0,
|
|
1446
1442
|
precision: 0
|
|
1447
|
-
}, t =
|
|
1443
|
+
}, t = S.sku;
|
|
1448
1444
|
return t ? `${q.toFormatString({ value: e, precision: 4 })} ${t.unit.abbrev}` : "";
|
|
1449
1445
|
});
|
|
1450
1446
|
function z(e) {
|
|
@@ -1461,32 +1457,32 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1461
1457
|
}
|
|
1462
1458
|
const P = T(() => {
|
|
1463
1459
|
var f;
|
|
1464
|
-
const t =
|
|
1460
|
+
const t = V.value.flatMap((d) => {
|
|
1465
1461
|
var _;
|
|
1466
|
-
return ((_ =
|
|
1467
|
-
}).filter((
|
|
1468
|
-
(
|
|
1462
|
+
return ((_ = d.skus) == null ? void 0 : _.flatMap((y) => y.amounts)) ?? [];
|
|
1463
|
+
}).filter((d) => d.amount.amount < 0).reduce(
|
|
1464
|
+
(d, _) => {
|
|
1469
1465
|
const y = _.cost;
|
|
1470
|
-
if (!y) return
|
|
1471
|
-
const
|
|
1472
|
-
...$t(
|
|
1466
|
+
if (!y) return d;
|
|
1467
|
+
const A = {
|
|
1468
|
+
...$t(d, Math.max(d.precision, y.precision)),
|
|
1473
1469
|
currency: y.currency
|
|
1474
1470
|
};
|
|
1475
1471
|
return {
|
|
1476
|
-
...Ze(
|
|
1477
|
-
currency:
|
|
1472
|
+
...Ze(A, y),
|
|
1473
|
+
currency: d.currency
|
|
1478
1474
|
};
|
|
1479
1475
|
},
|
|
1480
1476
|
{
|
|
1481
1477
|
amount: 0,
|
|
1482
1478
|
precision: 0,
|
|
1483
|
-
currency: z(((f =
|
|
1479
|
+
currency: z(((f = m.currentCountry) == null ? void 0 : f.value) ?? Ye)
|
|
1484
1480
|
}
|
|
1485
1481
|
);
|
|
1486
1482
|
return je(t, !1, t.precision);
|
|
1487
1483
|
});
|
|
1488
1484
|
function N() {
|
|
1489
|
-
const { startDate: e, endDate: t } =
|
|
1485
|
+
const { startDate: e, endDate: t } = Vt(o.value);
|
|
1490
1486
|
e !== null && t !== null && (o.value = {
|
|
1491
1487
|
startDate: e,
|
|
1492
1488
|
endDate: t
|
|
@@ -1494,40 +1490,40 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1494
1490
|
}
|
|
1495
1491
|
const ne = T(() => {
|
|
1496
1492
|
var f;
|
|
1497
|
-
const e = [...
|
|
1498
|
-
var y,
|
|
1499
|
-
const _ = (
|
|
1493
|
+
const e = [...V.value].reverse().computeFirst((d) => {
|
|
1494
|
+
var y, A;
|
|
1495
|
+
const _ = (A = (y = d.skus) == null ? void 0 : y.find) == null ? void 0 : A.call(y, (K) => K.sku._id === S.sku._id);
|
|
1500
1496
|
return _ == null ? void 0 : _.toCostBalances;
|
|
1501
1497
|
});
|
|
1502
1498
|
return e ? {
|
|
1503
|
-
...e.reduce((
|
|
1499
|
+
...e.reduce((d, _) => q.add([d, q.fromDinero(_.cost)]), {
|
|
1504
1500
|
amount: 0,
|
|
1505
1501
|
precision: 0
|
|
1506
1502
|
}),
|
|
1507
|
-
currency: z(((f =
|
|
1503
|
+
currency: z(((f = m.currentCountry) == null ? void 0 : f.value) ?? Ye)
|
|
1508
1504
|
} : "No data";
|
|
1509
1505
|
});
|
|
1510
1506
|
function ce() {
|
|
1511
|
-
const { startDate: e, endDate: t } =
|
|
1507
|
+
const { startDate: e, endDate: t } = At(o.value);
|
|
1512
1508
|
e !== null && t !== null && (o.value = {
|
|
1513
1509
|
startDate: e,
|
|
1514
1510
|
endDate: t
|
|
1515
1511
|
});
|
|
1516
1512
|
}
|
|
1517
|
-
const oe = Re(
|
|
1513
|
+
const oe = Re(S, "show");
|
|
1518
1514
|
return (e, t) => {
|
|
1519
|
-
const f = D("FmButton"),
|
|
1515
|
+
const f = D("FmButton"), d = D("FmField"), _ = D("FmDateRangePicker"), y = D("FmSpacer"), A = D("FmCircularProgress"), K = D("FmIcon"), Q = D("FmTooltip"), me = D("FmMenuDivider"), I = D("FmCardSection"), Y = D("FmCard"), J = D("FmSideSheet");
|
|
1520
1516
|
return B(), O(J, {
|
|
1521
1517
|
"dismiss-away": "",
|
|
1522
1518
|
modelValue: v(oe),
|
|
1523
|
-
"onUpdate:modelValue": t[4] || (t[4] = (X) =>
|
|
1519
|
+
"onUpdate:modelValue": t[4] || (t[4] = (X) => Ie(oe) ? oe.value = X : null),
|
|
1524
1520
|
"close-button": !1,
|
|
1525
1521
|
"max-width": 560
|
|
1526
1522
|
}, {
|
|
1527
1523
|
"side-sheet-header": C(() => [
|
|
1528
|
-
n("div",
|
|
1529
|
-
n("div",
|
|
1530
|
-
|
|
1524
|
+
n("div", Un, [
|
|
1525
|
+
n("div", In, g(v(u)("inventory.stock.history.title", [e.sku.name])), 1),
|
|
1526
|
+
b(f, {
|
|
1531
1527
|
variant: "tertiary",
|
|
1532
1528
|
"prepend-icon": "close",
|
|
1533
1529
|
onClick: t[0] || (t[0] = (X) => oe.value = !1)
|
|
@@ -1540,7 +1536,7 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1540
1536
|
n("div", Pn, [
|
|
1541
1537
|
n("div", Tn, [
|
|
1542
1538
|
n("div", Rn, [
|
|
1543
|
-
|
|
1539
|
+
b(_, {
|
|
1544
1540
|
modelValue: o.value,
|
|
1545
1541
|
"onUpdate:modelValue": t[1] || (t[1] = (G) => o.value = G),
|
|
1546
1542
|
"show-predefined-range": "",
|
|
@@ -1549,7 +1545,7 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1549
1545
|
"z-index": 50
|
|
1550
1546
|
}, {
|
|
1551
1547
|
"trigger-button": C(({ opened: G }) => [
|
|
1552
|
-
|
|
1548
|
+
b(d, {
|
|
1553
1549
|
"prepend-icon": "calendar_month",
|
|
1554
1550
|
focused: G
|
|
1555
1551
|
}, {
|
|
@@ -1562,48 +1558,48 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1562
1558
|
_: 1
|
|
1563
1559
|
}, 8, ["modelValue"])
|
|
1564
1560
|
]),
|
|
1565
|
-
|
|
1561
|
+
b(f, {
|
|
1566
1562
|
variant: "tertiary",
|
|
1567
1563
|
onClick: t[2] || (t[2] = (G) => N()),
|
|
1568
1564
|
"prepend-icon": "navigate_before"
|
|
1569
1565
|
}),
|
|
1570
|
-
|
|
1566
|
+
b(f, {
|
|
1571
1567
|
variant: "tertiary",
|
|
1572
1568
|
onClick: t[3] || (t[3] = (G) => ce()),
|
|
1573
1569
|
"prepend-icon": "navigate_next"
|
|
1574
1570
|
})
|
|
1575
1571
|
]),
|
|
1576
1572
|
k.value ? (B(), L("div", Hn, [
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
n("div", En, g(v(
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
])) :
|
|
1583
|
-
|
|
1573
|
+
b(y),
|
|
1574
|
+
b(A, { size: "xl" }),
|
|
1575
|
+
n("div", En, g(v(u)("inventory.stock.history.loading")), 1),
|
|
1576
|
+
b(y),
|
|
1577
|
+
b(y)
|
|
1578
|
+
])) : h.value && ((X = h.value) == null ? void 0 : X.length) > 0 ? (B(), L("div", Ln, [
|
|
1579
|
+
b(Y, { variant: "outlined" }, {
|
|
1584
1580
|
default: C(() => [
|
|
1585
|
-
|
|
1581
|
+
b(I, { class: "flex flex-col gap-4" }, {
|
|
1586
1582
|
default: C(() => [
|
|
1587
1583
|
n("div", Nn, [
|
|
1588
|
-
n("div", On, g(v(
|
|
1584
|
+
n("div", On, g(v(u)("inventory.stock.history.summary.title")), 1)
|
|
1589
1585
|
]),
|
|
1590
1586
|
n("div", zn, [
|
|
1591
1587
|
n("div", Yn, [
|
|
1592
|
-
n("div", Kn, g(v(
|
|
1588
|
+
n("div", Kn, g(v(u)("inventory.stock.history.summary.totalPurchase")), 1),
|
|
1593
1589
|
n("div", Gn, g(j.value.PURCHASE), 1)
|
|
1594
1590
|
]),
|
|
1595
1591
|
n("div", qn, [
|
|
1596
1592
|
n("div", Wn, [
|
|
1597
|
-
ve(g(v(
|
|
1598
|
-
|
|
1593
|
+
ve(g(v(u)("inventory.stock.history.summary.totalSales")) + " ", 1),
|
|
1594
|
+
U.value != null ? (B(), O(Q, {
|
|
1599
1595
|
key: 0,
|
|
1600
1596
|
variant: "plain",
|
|
1601
1597
|
placement: "top",
|
|
1602
|
-
content: `Before: ${
|
|
1598
|
+
content: `Before: ${U.value}`,
|
|
1603
1599
|
"z-index": 50
|
|
1604
1600
|
}, {
|
|
1605
1601
|
default: C(() => [
|
|
1606
|
-
|
|
1602
|
+
b(K, {
|
|
1607
1603
|
name: "warning",
|
|
1608
1604
|
size: "sm"
|
|
1609
1605
|
})
|
|
@@ -1614,50 +1610,50 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1614
1610
|
n("div", Jn, g(j.value.SALES), 1)
|
|
1615
1611
|
]),
|
|
1616
1612
|
n("div", Qn, [
|
|
1617
|
-
n("div", Xn, g(v(
|
|
1613
|
+
n("div", Xn, g(v(u)("inventory.stock.history.summary.totalLose")), 1),
|
|
1618
1614
|
n("div", Zn, g(j.value.LOSE), 1)
|
|
1619
1615
|
]),
|
|
1620
1616
|
n("div", eo, [
|
|
1621
|
-
n("div", to, g(v(
|
|
1617
|
+
n("div", to, g(v(u)("inventory.stock.history.summary.totalRequest")), 1),
|
|
1622
1618
|
n("div", no, g(j.value.REQUEST), 1)
|
|
1623
1619
|
]),
|
|
1624
1620
|
n("div", oo, [
|
|
1625
|
-
n("div", so, g(v(
|
|
1621
|
+
n("div", so, g(v(u)("inventory.stock.history.summary.totalReceive")), 1),
|
|
1626
1622
|
n("div", ao, g(j.value.RECEIVE), 1)
|
|
1627
1623
|
]),
|
|
1628
1624
|
n("div", ro, [
|
|
1629
|
-
n("div", lo, g(v(
|
|
1625
|
+
n("div", lo, g(v(u)("inventory.stock.history.summary.totalConvert")), 1),
|
|
1630
1626
|
n("div", io, g(j.value.CONVERT), 1)
|
|
1631
1627
|
]),
|
|
1632
1628
|
n("div", uo, [
|
|
1633
|
-
n("div", co, g(v(
|
|
1629
|
+
n("div", co, g(v(u)("inventory.stock.history.summary.totalDamage")), 1),
|
|
1634
1630
|
n("div", mo, g(j.value.DAMAGE), 1)
|
|
1635
1631
|
]),
|
|
1636
1632
|
n("div", po, [
|
|
1637
|
-
n("div", vo, g(v(
|
|
1633
|
+
n("div", vo, g(v(u)("inventory.stock.history.summary.openingBalance")), 1),
|
|
1638
1634
|
n("div", fo, g(E.value), 1)
|
|
1639
1635
|
]),
|
|
1640
1636
|
n("div", yo, [
|
|
1641
|
-
n("div", _o, g(v(
|
|
1637
|
+
n("div", _o, g(v(u)("inventory.stock.history.summary.lastStockBalance")), 1),
|
|
1642
1638
|
n("div", ko, g(W.value), 1)
|
|
1643
1639
|
])
|
|
1644
1640
|
]),
|
|
1645
1641
|
v(a).enableTotalCost ? (B(), L("div", ho, [
|
|
1646
|
-
|
|
1647
|
-
n("div",
|
|
1648
|
-
n("div",
|
|
1649
|
-
|
|
1642
|
+
b(me, { class: "w-full" }),
|
|
1643
|
+
n("div", go, [
|
|
1644
|
+
n("div", bo, [
|
|
1645
|
+
b(Ge, { "z-index": 50 }, {
|
|
1650
1646
|
default: C(() => [
|
|
1651
1647
|
n("div", xo, [
|
|
1652
|
-
ve(g(v(
|
|
1653
|
-
|
|
1648
|
+
ve(g(v(u)("inventory.stock.history.estimatedValue")) + " ", 1),
|
|
1649
|
+
b(Q, {
|
|
1654
1650
|
variant: "plain",
|
|
1655
1651
|
placement: "top",
|
|
1656
|
-
content: v(
|
|
1652
|
+
content: v(u)("inventory.stock.history.estimatedValueTooltip"),
|
|
1657
1653
|
"z-index": 50
|
|
1658
1654
|
}, {
|
|
1659
1655
|
default: C(() => [
|
|
1660
|
-
|
|
1656
|
+
b(K, {
|
|
1661
1657
|
name: "help",
|
|
1662
1658
|
size: "sm"
|
|
1663
1659
|
})
|
|
@@ -1671,20 +1667,20 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1671
1667
|
n("div", So, g(typeof ne.value != "string" ? v(je)(ne.value, !1, ne.value.precision) : ne.value), 1)
|
|
1672
1668
|
]),
|
|
1673
1669
|
n("div", $o, [
|
|
1674
|
-
|
|
1670
|
+
b(Ge, { "z-index": 50 }, {
|
|
1675
1671
|
default: C(() => [
|
|
1676
1672
|
n("div", wo, [
|
|
1677
|
-
ve(g(v(
|
|
1678
|
-
|
|
1673
|
+
ve(g(v(u)("inventory.stock.history.costSold")) + " ", 1),
|
|
1674
|
+
b(Q, {
|
|
1679
1675
|
variant: "plain",
|
|
1680
1676
|
placement: "top",
|
|
1681
1677
|
"z-index": 50
|
|
1682
1678
|
}, {
|
|
1683
1679
|
content: C(() => [
|
|
1684
|
-
n("div", Bo, g(v(
|
|
1680
|
+
n("div", Bo, g(v(u)("inventory.stock.history.costSoldTooltip")), 1)
|
|
1685
1681
|
]),
|
|
1686
1682
|
default: C(() => [
|
|
1687
|
-
|
|
1683
|
+
b(K, {
|
|
1688
1684
|
name: "help",
|
|
1689
1685
|
size: "sm"
|
|
1690
1686
|
})
|
|
@@ -1705,8 +1701,8 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1705
1701
|
]),
|
|
1706
1702
|
_: 1
|
|
1707
1703
|
}),
|
|
1708
|
-
|
|
1709
|
-
(B(!0), L(te, null, ae(
|
|
1704
|
+
t[5] || (t[5] = n("div", null, null, -1)),
|
|
1705
|
+
(B(!0), L(te, null, ae(h.value, (G) => (B(), L(te, {
|
|
1710
1706
|
key: G.date
|
|
1711
1707
|
}, [
|
|
1712
1708
|
e.sku ? (B(), O(Dn, {
|
|
@@ -1717,17 +1713,17 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1717
1713
|
}, null, 8, ["record", "sku", "bills"])) : ee("", !0)
|
|
1718
1714
|
], 64))), 128))
|
|
1719
1715
|
])) : (B(), L("div", Vo, [
|
|
1720
|
-
|
|
1716
|
+
b(y),
|
|
1721
1717
|
n("div", null, [
|
|
1722
1718
|
n("img", {
|
|
1723
1719
|
src: v(Et),
|
|
1724
1720
|
alt: "List is empty"
|
|
1725
|
-
}, null, 8,
|
|
1721
|
+
}, null, 8, Ao)
|
|
1726
1722
|
]),
|
|
1727
|
-
n("div",
|
|
1728
|
-
n("div",
|
|
1729
|
-
|
|
1730
|
-
|
|
1723
|
+
n("div", Co, g(v(u)("inventory.stock.history.noRecords")), 1),
|
|
1724
|
+
n("div", Do, g(v(u)("inventory.stock.history.changeDateRange")), 1),
|
|
1725
|
+
b(y),
|
|
1726
|
+
b(y)
|
|
1731
1727
|
]))
|
|
1732
1728
|
])
|
|
1733
1729
|
];
|
|
@@ -1736,25 +1732,25 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1736
1732
|
}, 8, ["modelValue"]);
|
|
1737
1733
|
};
|
|
1738
1734
|
}
|
|
1739
|
-
}),
|
|
1735
|
+
}), jo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 h-full" }, Uo = { class: "flex flex-col gap-8" }, Io = { class: "flex flex-col" }, Po = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, To = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Zo = /* @__PURE__ */ re({
|
|
1740
1736
|
__name: "StockView",
|
|
1741
1737
|
setup(c) {
|
|
1742
|
-
const { t:
|
|
1743
|
-
s.watchLocation(
|
|
1744
|
-
const
|
|
1745
|
-
async function
|
|
1738
|
+
const { t: m } = le(), r = Te(), s = ue(), x = He(), l = lt(), a = at(), { columnDefs: u } = qt();
|
|
1739
|
+
s.watchLocation(i);
|
|
1740
|
+
const S = R(!1), k = de();
|
|
1741
|
+
async function i() {
|
|
1746
1742
|
if (s._currentLocation) {
|
|
1747
|
-
|
|
1743
|
+
S.value = !0;
|
|
1748
1744
|
try {
|
|
1749
|
-
await
|
|
1745
|
+
await x.readStockBalance(), await x.readProductBalance(), await a.readStockEstimateBalance();
|
|
1750
1746
|
} catch {
|
|
1751
1747
|
k.open({
|
|
1752
|
-
title:
|
|
1753
|
-
message:
|
|
1748
|
+
title: m("inventory.stock.error.title"),
|
|
1749
|
+
message: m("inventory.stock.error.message"),
|
|
1754
1750
|
type: "error"
|
|
1755
1751
|
});
|
|
1756
1752
|
} finally {
|
|
1757
|
-
|
|
1753
|
+
S.value = !1;
|
|
1758
1754
|
}
|
|
1759
1755
|
}
|
|
1760
1756
|
}
|
|
@@ -1762,9 +1758,9 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1762
1758
|
() => r.skus.map(($) => {
|
|
1763
1759
|
var W, z, P;
|
|
1764
1760
|
const F = $.trackingMeasurement;
|
|
1765
|
-
let j = (z = (W =
|
|
1761
|
+
let j = (z = (W = x.stockBalance.skus) == null ? void 0 : W.find(
|
|
1766
1762
|
(N) => N.id === $._id
|
|
1767
|
-
)) == null ? void 0 : z.balance,
|
|
1763
|
+
)) == null ? void 0 : z.balance, U = a.inventoryForecast.skus.find(
|
|
1768
1764
|
(N) => N.id === $._id
|
|
1769
1765
|
);
|
|
1770
1766
|
return {
|
|
@@ -1773,11 +1769,11 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1773
1769
|
amount: 0,
|
|
1774
1770
|
precision: 0
|
|
1775
1771
|
},
|
|
1776
|
-
day: (
|
|
1772
|
+
day: (U == null ? void 0 : U.depletionDays) ?? void 0,
|
|
1777
1773
|
trackingUnitAbbrev: F ? ((P = $.unit.measurements.find((N) => N.id === F)) == null ? void 0 : P.abbrev) ?? "" : $.unit.abbrev
|
|
1778
1774
|
};
|
|
1779
1775
|
})
|
|
1780
|
-
), w = R(""), { breakpoints:
|
|
1776
|
+
), w = R(""), { breakpoints: V } = Mt(), h = T(() => V.value.xs || V.value.sm ? 10 : 20), p = It(), M = T(
|
|
1781
1777
|
() => {
|
|
1782
1778
|
var $;
|
|
1783
1779
|
return (($ = s._currentLocation) == null ? void 0 : $.type) === Dt.restaurant;
|
|
@@ -1786,18 +1782,18 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1786
1782
|
const $ = [
|
|
1787
1783
|
{ icon: "ios_share", onClick: () => zt(o.value) }
|
|
1788
1784
|
];
|
|
1789
|
-
return M.value ? [{ icon: "refresh", onClick:
|
|
1785
|
+
return M.value ? [{ icon: "refresh", onClick: i }, ...$] : $;
|
|
1790
1786
|
});
|
|
1791
1787
|
return ($, F) => {
|
|
1792
1788
|
const j = D("FmTable");
|
|
1793
1789
|
return B(), O(dt, {
|
|
1794
|
-
title: v(
|
|
1790
|
+
title: v(m)("inventory.stock.title")
|
|
1795
1791
|
}, {
|
|
1796
1792
|
default: C(() => {
|
|
1797
|
-
var
|
|
1793
|
+
var U, E, W, z;
|
|
1798
1794
|
return [
|
|
1799
|
-
n("div",
|
|
1800
|
-
|
|
1795
|
+
n("div", jo, [
|
|
1796
|
+
b(mt, {
|
|
1801
1797
|
searchable: "",
|
|
1802
1798
|
"change-location": "",
|
|
1803
1799
|
search: w.value,
|
|
@@ -1806,44 +1802,44 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1806
1802
|
}, null, 8, ["search", "actions"]),
|
|
1807
1803
|
(B(), O(j, {
|
|
1808
1804
|
style: Qe(v(p).tableHeight),
|
|
1809
|
-
"column-defs": v(
|
|
1805
|
+
"column-defs": v(u),
|
|
1810
1806
|
"row-data": o.value,
|
|
1811
1807
|
"search-value": w.value,
|
|
1812
|
-
loading:
|
|
1813
|
-
key: (
|
|
1808
|
+
loading: S.value || !v(s)._currentLocation,
|
|
1809
|
+
key: (U = v(s)._currentLocation) == null ? void 0 : U.dbName,
|
|
1814
1810
|
onRowClick: F[1] || (F[1] = (P) => v(l).showSkuHistory(P.original)),
|
|
1815
|
-
"page-size":
|
|
1811
|
+
"page-size": h.value
|
|
1816
1812
|
}, {
|
|
1817
1813
|
"list-row": C((P) => [
|
|
1818
|
-
|
|
1814
|
+
b(Ut, {
|
|
1819
1815
|
row: P,
|
|
1820
1816
|
onRowClick: v(l).showSkuHistory
|
|
1821
1817
|
}, {
|
|
1822
1818
|
default: C((N) => {
|
|
1823
|
-
var ne, ce, oe, e, t, f,
|
|
1819
|
+
var ne, ce, oe, e, t, f, d, _, y, A;
|
|
1824
1820
|
return [
|
|
1825
1821
|
n("div", Uo, [
|
|
1826
|
-
n("div",
|
|
1827
|
-
n("div",
|
|
1828
|
-
|
|
1822
|
+
n("div", Io, [
|
|
1823
|
+
n("div", Po, [
|
|
1824
|
+
b(v(Ke), {
|
|
1829
1825
|
render: (oe = (ce = (ne = N.code) == null ? void 0 : ne.column) == null ? void 0 : ce.columnDef) == null ? void 0 : oe.cell,
|
|
1830
1826
|
props: (t = (e = N.code) == null ? void 0 : e.getContext) == null ? void 0 : t.call(e)
|
|
1831
1827
|
}, null, 8, ["render", "props"])
|
|
1832
1828
|
]),
|
|
1833
|
-
n("div",
|
|
1834
|
-
|
|
1835
|
-
render: (_ = (
|
|
1836
|
-
props: (
|
|
1829
|
+
n("div", To, [
|
|
1830
|
+
b(v(Ke), {
|
|
1831
|
+
render: (_ = (d = (f = N.name) == null ? void 0 : f.column) == null ? void 0 : d.columnDef) == null ? void 0 : _.cell,
|
|
1832
|
+
props: (A = (y = N.name) == null ? void 0 : y.getContext) == null ? void 0 : A.call(y)
|
|
1837
1833
|
}, null, 8, ["render", "props"])
|
|
1838
1834
|
])
|
|
1839
1835
|
]),
|
|
1840
1836
|
n("div", null, [
|
|
1841
|
-
|
|
1837
|
+
b(Ue, {
|
|
1842
1838
|
days: P.original.day
|
|
1843
1839
|
}, null, 8, ["days"])
|
|
1844
1840
|
]),
|
|
1845
1841
|
n("div", null, [
|
|
1846
|
-
|
|
1842
|
+
b(rt, {
|
|
1847
1843
|
class: "xs:w-[160px]",
|
|
1848
1844
|
unit: P.original.unit,
|
|
1849
1845
|
sku: P.original,
|
|
@@ -1861,7 +1857,7 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1861
1857
|
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1862
1858
|
]),
|
|
1863
1859
|
(B(), O(ut, { to: "body" }, [
|
|
1864
|
-
(E = v(l).stockHistoryProps) != null && E.sku ? (B(), O(
|
|
1860
|
+
(E = v(l).stockHistoryProps) != null && E.sku ? (B(), O(Mo, $e(we({ key: 0 }, v(l).stockHistoryProps)), null, 16)) : ee("", !0),
|
|
1865
1861
|
(W = v(l).convertSkuDialogProps) != null && W.sku ? (B(), O(cn, $e(we({ key: 1 }, v(l).convertSkuDialogProps)), null, 16)) : ee("", !0),
|
|
1866
1862
|
(z = v(l).adjustSkuDialogProps) != null && z.stock ? (B(), O(hn, $e(we({ key: 2 }, v(l).adjustSkuDialogProps)), null, 16)) : ee("", !0)
|
|
1867
1863
|
]))
|
|
@@ -1873,5 +1869,5 @@ const In = { class: "flex items-center w-full fm-typo-en-title-md-800" }, Un = {
|
|
|
1873
1869
|
}
|
|
1874
1870
|
});
|
|
1875
1871
|
export {
|
|
1876
|
-
|
|
1872
|
+
Zo as default
|
|
1877
1873
|
};
|