@feedmepos/mf-inventory-portal 0.0.5
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/README.md +31 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/ApprovalView-CTQdDgGH.js +119 -0
- package/dist/BindingsDialog-DvX_DRsO.js +82 -0
- package/dist/BindingsPicker-CQIGhTCR.js +124 -0
- package/dist/BindingsTable-Da4BLkvc.js +122 -0
- package/dist/ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DcixBOcX.js +97 -0
- package/dist/Entry.vue.d.ts +2 -0
- package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-BXU7x6di.js +144 -0
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-CD89qCIa.js +49 -0
- package/dist/IngredientsView-2ZKdzsgI.js +739 -0
- package/dist/IntegrationView-BRWYO3VE.js +1172 -0
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CnsDmPTe.js +240 -0
- package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DBK7mpQS.js +66 -0
- package/dist/PurchaseOrderPrintPreview-CH9gVYDg.js +152 -0
- package/dist/ReceiveRequestView-DQBqc3GF.js +1298 -0
- package/dist/RecipeView-DFG9Wkx-.js +594 -0
- package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js +53 -0
- package/dist/Standalone.vue.d.ts +2 -0
- package/dist/StockView-DLWMp_I5.js +1733 -0
- package/dist/SupplierView-CZhM2ie3.js +607 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Ffe9bhq8.js +1027 -0
- package/dist/UnitView-C3XVSbJY.js +626 -0
- package/dist/WarehouseView-BntzAdz3.js +1139 -0
- package/dist/api/bill.d.ts +1364 -0
- package/dist/api/closing.d.ts +3 -0
- package/dist/api/error.d.ts +31 -0
- package/dist/api/food-market-hub.d.ts +38 -0
- package/dist/api/inventory.d.ts +176 -0
- package/dist/api/purchase-order.d.ts +13 -0
- package/dist/api/stock.d.ts +9 -0
- package/dist/api/supplier.d.ts +7 -0
- package/dist/api/type.d.ts +12 -0
- package/dist/api/warehouse.d.ts +7 -0
- package/dist/app-BzDhmCVx.js +36639 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.js +5 -0
- package/dist/components/ChangeLocationComponent.vue.d.ts +2 -0
- package/dist/components/DeferableLoading.vue.d.ts +19 -0
- package/dist/components/DeferableLoadingProps.d.ts +4 -0
- package/dist/components/DeleteDialog.vue.d.ts +18 -0
- package/dist/components/FmCoordinateInput.vue.d.ts +24 -0
- package/dist/components/FmCoordinateInputProps.d.ts +23 -0
- package/dist/components/FmFilterableSelect.vue.d.ts +25 -0
- package/dist/components/FmFilterableSelectProps.d.ts +28 -0
- package/dist/components/FmMultiselectDialog.vue.d.ts +30 -0
- package/dist/components/FmMultiselectDialogProps.d.ts +16 -0
- package/dist/components/FmTableToolbar.vue.d.ts +49 -0
- package/dist/components/MultiSelectDialog.vue.d.ts +12 -0
- package/dist/components/MultiSelectDialogProps.d.ts +7 -0
- package/dist/components/NavigationTab.vue.d.ts +2 -0
- package/dist/components/NumberPrecisionInput.vue.d.ts +16 -0
- package/dist/components/NumberPrecisionInputProps.d.ts +12 -0
- package/dist/components/TableActionableRow.vue.d.ts +40 -0
- package/dist/components/UnitDisplayControl.vue.d.ts +12 -0
- package/dist/components/UnitDisplayControlProp.d.ts +7 -0
- package/dist/components/fm-components.type.d.ts +8 -0
- package/dist/components/form/form-mode.enum.d.ts +5 -0
- package/dist/components/icons/IconCommunity.vue.d.ts +2 -0
- package/dist/components/icons/IconDocumentation.vue.d.ts +2 -0
- package/dist/components/icons/IconEcosystem.vue.d.ts +2 -0
- package/dist/components/icons/IconSupport.vue.d.ts +2 -0
- package/dist/components/icons/IconTooling.vue.d.ts +2 -0
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +145 -0
- package/dist/components/inventory-binding/InventoryBindingProps.d.ts +11 -0
- package/dist/components/map/CoordinateDialog.vue.d.ts +24 -0
- package/dist/components/map/GoogleMap.vue.d.ts +79 -0
- package/dist/components/map/coordinates.d.ts +6 -0
- package/dist/components/map/helper/coords-to-latlong.d.ts +8 -0
- package/dist/components/map/type.d.ts +27 -0
- package/dist/components/nested-multiselect/FmNestedMultiselectDialog.vue.d.ts +7 -0
- package/dist/components/nested-multiselect/FmNestedMultiselectDialogProps.d.ts +22 -0
- package/dist/components/nested-multiselect/helper/multiselect-utils.d.ts +2 -0
- package/dist/components/row-action.enum.d.ts +13 -0
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +84 -0
- package/dist/components/shell/inventory/binding-ui.test.d.ts +1 -0
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +110 -0
- package/dist/components/shell/inventory/utils.d.ts +5 -0
- package/dist/components/ui-library/FmDateRangePickerChip.vue.d.ts +36 -0
- package/dist/components/ui-library/FmSpecialChip.vue.d.ts +79 -0
- package/dist/composable/defineApi.d.ts +18 -0
- package/dist/composable/useBreakpoints.d.ts +7 -0
- package/dist/composable/useIframe.d.ts +37 -0
- package/dist/composable/useSearch.d.ts +5 -0
- package/dist/composable/useTabStorage.d.ts +2 -0
- package/dist/composable/useToast.d.ts +36 -0
- package/dist/core.d.ts +12 -0
- package/dist/cypress/component/FmFilterableSelect.cy.d.ts +1 -0
- package/dist/cypress/component/FmNestedMultiselectDialog.cy.d.ts +1 -0
- package/dist/cypress/component/UnitDisplayControl.cy.d.ts +1 -0
- package/dist/cypress/component/receive-request/KDI-15-total-price-currency.cy.d.ts +2 -0
- package/dist/cypress/e2e/views/MenuV3.spec.cy.d.ts +0 -0
- package/dist/cypress/e2e/views/MenuV4.spec.cy.d.ts +0 -0
- package/dist/cypress/e2e/views/Root.spec.cy.d.ts +0 -0
- package/dist/cypress/e2e/views/StockView.spec.cy.d.ts +0 -0
- package/dist/cypress/support/commands.d.ts +0 -0
- package/dist/cypress/support/component.d.ts +10 -0
- package/dist/cypress/support/e2e.d.ts +1 -0
- package/dist/date2-C7HiAWQG.js +209 -0
- package/dist/dayjs.min-Db57WhI9.js +282 -0
- package/dist/decimal-D3a0BwVj.js +98 -0
- package/dist/empty-placeholder-wf6-BWE8.js +4 -0
- package/dist/extensions/array.d.ts +15 -0
- package/dist/favicon.ico +0 -0
- package/dist/fuzzy-BW8ZYsDG.js +41 -0
- package/dist/helper/address.d.ts +2 -0
- package/dist/helper/component.d.ts +4 -0
- package/dist/helper/core/country/codes.d.ts +255 -0
- package/dist/helper/core/country/utils.d.ts +8 -0
- package/dist/helper/core/id-to-date.d.ts +1 -0
- package/dist/helper/core/store/type.d.ts +2 -0
- package/dist/helper/country.d.ts +260 -0
- package/dist/helper/date.spec.d.ts +1 -0
- package/dist/helper/date2.d.ts +20 -0
- package/dist/helper/decimal.d.ts +15 -0
- package/dist/helper/decimal.spec.d.ts +1 -0
- package/dist/helper/export.d.ts +12 -0
- package/dist/helper/form.d.ts +5 -0
- package/dist/helper/inventory.d.ts +1 -0
- package/dist/helper/iteration.d.ts +15 -0
- package/dist/helper/number.d.ts +27 -0
- package/dist/helper/number.spec.d.ts +1 -0
- package/dist/helper/object.d.ts +36 -0
- package/dist/helper/object.spec.d.ts +1 -0
- package/dist/helper/rules.d.ts +22 -0
- package/dist/helper/search.d.ts +21 -0
- package/dist/helper/semver.d.ts +20 -0
- package/dist/helper/semver.spec.d.ts +1 -0
- package/dist/helper/type.d.ts +8 -0
- package/dist/helper/url.d.ts +7 -0
- package/dist/helper/validate.d.ts +70 -0
- package/dist/helper/xlsx.util.d.ts +8 -0
- package/dist/helper/zod.d.ts +21 -0
- package/dist/id-to-date-ReZIpUDw.js +30 -0
- package/dist/index-D46it8Rk.js +12956 -0
- package/dist/init-date-range-M3Q03-Fd.js +21 -0
- package/dist/is-linked-ingredient-error-C6AghEwR.js +37 -0
- package/dist/layout/InventoryLayout.vue.d.ts +2 -0
- package/dist/layout/SingleColumnLayout.vue.d.ts +55 -0
- package/dist/layout/components/NavigationButton.vue.d.ts +22 -0
- package/dist/layout/layout-routes.d.ts +7 -0
- package/dist/layout/type.d.ts +17 -0
- package/dist/layout-BvUjg6JS.js +151 -0
- package/dist/locales/en/common.json +7 -0
- package/dist/main.d.ts +2 -0
- package/dist/router/index.d.ts +5 -0
- package/dist/router/name.d.ts +17 -0
- package/dist/router/shared.d.ts +11 -0
- package/dist/row-action.enum-BwQbURNh.js +28 -0
- package/dist/rules-DHfAMDW3.js +86 -0
- package/dist/stores/api.d.ts +10 -0
- package/dist/stores/env.d.ts +5 -0
- package/dist/stores/feature.d.ts +9 -0
- package/dist/stores/googlemap.d.ts +37 -0
- package/dist/stores/helper/generate-backend-urls.d.ts +8 -0
- package/dist/stores/inventory.d.ts +1983 -0
- package/dist/stores/layout.d.ts +5 -0
- package/dist/stores/location.d.ts +1898 -0
- package/dist/stores/route.d.ts +12 -0
- package/dist/stores/stock.d.ts +58 -0
- package/dist/stores/supplier.d.ts +30 -0
- package/dist/stores/warehouse.d.ts +88 -0
- package/dist/style.css +1 -0
- package/dist/supplier-DTiiOLtg.js +65 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -0
- package/dist/use-inventory-binding-dialog-B6JO7050.js +109 -0
- package/dist/views/InventoryView.vue.d.ts +2 -0
- package/dist/views/SelectBussinessDialog.vue.d.ts +2 -0
- package/dist/views/approval/ApprovalView.vue.d.ts +2 -0
- package/dist/views/dev/ComponentPreview.vue.d.ts +2 -0
- package/dist/views/dev/components/CoordinateTest.vue.d.ts +2 -0
- package/dist/views/dev/components/DateRange.vue.d.ts +2 -0
- package/dist/views/dev/components/FmSelectTest.vue.d.ts +2 -0
- package/dist/views/dev/components/InventoryIframe.vue.d.ts +2 -0
- package/dist/views/dev/components/LayoutDev.vue.d.ts +2 -0
- package/dist/views/dev/components/MfCommontTest.vue.d.ts +2 -0
- package/dist/views/dev/components/NestedSelection.vue.d.ts +2 -0
- package/dist/views/dev/components/NumberStepper.vue.d.ts +2 -0
- package/dist/views/dev/components/TabStorageTest.vue.d.ts +2 -0
- package/dist/views/dev/helpers/debug.d.ts +22 -0
- package/dist/views/dev/helpers/nested-options.d.ts +60 -0
- package/dist/views/dev/helpers/pinia-test.d.ts +9 -0
- package/dist/views/home/HomeView.vue.d.ts +2 -0
- package/dist/views/iframe/inventory-bindings/bindings-dialog/BindingsDialog.vue.d.ts +2 -0
- package/dist/views/iframe/inventory-bindings/bindings-picker/BindingsPicker.vue.d.ts +2 -0
- package/dist/views/iframe/inventory-bindings/bindings-table/BindingsTable.vue.d.ts +2 -0
- package/dist/views/ingredients/IngredientsView.vue.d.ts +2 -0
- package/dist/views/ingredients/components/cannot-delete/CannotDelete.vue.d.ts +30 -0
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +54 -0
- package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +8 -0
- package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItem.vue.d.ts +12 -0
- package/dist/views/ingredients/components/ingredient-binded-item/IngredientBindedItemProps.d.ts +5 -0
- package/dist/views/ingredients/components/ingredient-dialog/IngredientDialog.vue.d.ts +31 -0
- package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +9 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +104 -0
- package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +10 -0
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +88 -0
- package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +4 -0
- package/dist/views/ingredients/components/inventory-binding/util.d.ts +7 -0
- package/dist/views/ingredients/composables/use-ingredient-form.d.ts +8 -0
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +46 -0
- package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +7 -0
- package/dist/views/integration/IntegrationView.vue.d.ts +2 -0
- package/dist/views/integration/components/ApplyAddon.vue.d.ts +379 -0
- package/dist/views/integration/components/ApplyProduct.vue.d.ts +303 -0
- package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +277 -0
- package/dist/views/integration/components/ApplyProductDialogProps.d.ts +17 -0
- package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +277 -0
- package/dist/views/integration/helper/menu.d.ts +36 -0
- package/dist/views/receive-request/ReceiveRequestView.vue.d.ts +2 -0
- package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistory.vue.d.ts +12 -0
- package/dist/views/receive-request/components/supplier-price-history/SupplierPriceHistoryProps.d.ts +11 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +18 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +12 -0
- package/dist/views/receive-request/components/transfer-dialog/TransferDialog.vue.d.ts +22 -0
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +11 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +450 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +10 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +369 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1202 -0
- package/dist/views/receive-request/constants/dialog-templates.d.ts +8 -0
- package/dist/views/receive-request/constants/purchase-order-transaction-type.d.ts +4 -0
- package/dist/views/receive-request/constants/purchase-row-actions.d.ts +2 -0
- package/dist/views/receive-request/helper/format-time-from-id.d.ts +2 -0
- package/dist/views/receive-request/helper/format-unit-display.d.ts +6 -0
- package/dist/views/receive-request/helper/get-received-amount.d.ts +2 -0
- package/dist/views/receive-request/helper/init-date-range.d.ts +8 -0
- package/dist/views/receive-request/helper/print-po.d.ts +2 -0
- package/dist/views/receive-request/helper/status-to-background.d.ts +2 -0
- package/dist/views/receive-request/print-preview/PurchaseOrderPrintPreview.vue.d.ts +47 -0
- package/dist/views/recipe/RecipeView.vue.d.ts +2 -0
- package/dist/views/recipe/components/recipe-dialog/RecipeDialog.vue.d.ts +31 -0
- package/dist/views/recipe/components/recipe-dialog/RecipeDialogProps.d.ts +9 -0
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +62 -0
- package/dist/views/recipe/components/recipe-form/RecipeFormProps.d.ts +10 -0
- package/dist/views/recipe/composables/use-recipe-form.d.ts +9 -0
- package/dist/views/recipe/composables/use-recipe-table.d.ts +11 -0
- package/dist/views/recipe/helper/export-recipe.d.ts +1 -0
- package/dist/views/stock/StockView.vue.d.ts +2 -0
- package/dist/views/stock/components/StockHistory.vue.d.ts +17 -0
- package/dist/views/stock/components/StockHistoryProps.d.ts +7 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +712 -0
- package/dist/views/stock/components/dialog/AdjustSkuDialog.vue.d.ts +22 -0
- package/dist/views/stock/components/dialog/AdjustSkuDialogProps.d.ts +8 -0
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +164 -0
- package/dist/views/stock/components/dialog/AdjustedItemFormProps.d.ts +8 -0
- package/dist/views/stock/components/dialog/ConvertSkuDialog.vue.d.ts +22 -0
- package/dist/views/stock/components/dialog/ConvertSkuDialogProps.d.ts +9 -0
- package/dist/views/stock/components/dialog/constant/adjustment-type-options.d.ts +7 -0
- package/dist/views/stock/components/dialog/helper/adjust.d.ts +3 -0
- package/dist/views/stock/components/dialog/helper/form-adjust.d.ts +10 -0
- package/dist/views/stock/composables/use-stock-table.d.ts +12 -0
- package/dist/views/stock/helper/compute-summary-total-test.d.ts +1 -0
- package/dist/views/stock/helper/compute-summary-total.d.ts +1 -0
- package/dist/views/stock/helper/compute-summary-total.spec.d.ts +1 -0
- package/dist/views/stock/helper/format-date-from-id.d.ts +2 -0
- package/dist/views/stock/helper/on-click-export-excel.d.ts +9 -0
- package/dist/views/stock/helper/stock-row-action.d.ts +13 -0
- package/dist/views/stock/type.d.ts +9 -0
- package/dist/views/supplier/SupplierView.vue.d.ts +2 -0
- package/dist/views/supplier/components/SupplierDialog.vue.d.ts +22 -0
- package/dist/views/supplier/components/SupplierDialogProps.d.ts +10 -0
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +58 -0
- package/dist/views/supplier/components/SupplierFormProps.d.ts +8 -0
- package/dist/views/supplier/composables/use-supplier-table.d.ts +22 -0
- package/dist/views/unit/UnitView.vue.d.ts +2 -0
- package/dist/views/unit/components/unit-dialog/UnitDialog.vue.d.ts +31 -0
- package/dist/views/unit/components/unit-dialog/UnitDialogProps.d.ts +9 -0
- package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +50 -0
- package/dist/views/unit/components/unit-form/UnitFormProps.d.ts +10 -0
- package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +43 -0
- package/dist/views/unit/components/unit-used-by/UnitUsedBy.vue.d.ts +12 -0
- package/dist/views/unit/components/unit-used-by/UnitUsedByProps.d.ts +3 -0
- package/dist/views/unit/composables/use-unit-form.d.ts +8 -0
- package/dist/views/unit/composables/use-unit-table.d.ts +19 -0
- package/dist/views/unit/type.d.ts +2 -0
- package/dist/views/warehouse/WarehouseView.vue.d.ts +2 -0
- package/dist/views/warehouse/components/WarehouseDialog.vue.d.ts +22 -0
- package/dist/views/warehouse/components/WarehouseDialogProps.d.ts +10 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +174 -0
- package/dist/views/warehouse/components/WarehouseFormProps.d.ts +8 -0
- package/dist/views/warehouse/composables/use-warehouse-table.d.ts +12 -0
- package/dist/xlsx-BljO4Lx2.js +15510 -0
- package/package.json +93 -0
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
import { defineComponent as q, computed as x, openBlock as m, createElementBlock as w, Fragment as z, renderList as j, createElementVNode as s, toDisplayString as _, createCommentVNode as G, ref as R, resolveComponent as A, createBlock as T, withCtx as I, createVNode as c, unref as d, isRef as W, normalizeStyle as se, Teleport as ae, normalizeProps as ne, guardReactiveProps as re } from "vue";
|
|
2
|
+
import { u as H, S as ie, c as te, a as X, b as de } from "./app-BzDhmCVx.js";
|
|
3
|
+
import { useDialog as ue, useSnackbar as oe, useProxiedModel as Z, useBreakpoints as me } from "@feedmepos/ui-library";
|
|
4
|
+
import { i as ce, _ as pe } from "./is-linked-ingredient-error-C6AghEwR.js";
|
|
5
|
+
import { F as U, D as ee, R as N } from "./row-action.enum-BwQbURNh.js";
|
|
6
|
+
import { c as fe, _ as ve, F as be, u as ye } from "./layout-BvUjg6JS.js";
|
|
7
|
+
import { _ as ge } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CFjO4TPG.js";
|
|
8
|
+
import { R as L, A as _e, M as xe } from "./rules-DHfAMDW3.js";
|
|
9
|
+
import { a as O, t as he } from "./date2-C7HiAWQG.js";
|
|
10
|
+
import { F as Ve } from "./decimal-D3a0BwVj.js";
|
|
11
|
+
import { _ as Ue } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DBK7mpQS.js";
|
|
12
|
+
const we = { class: "flex flex-col gap-8" }, Ce = /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1), Se = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "flex flex-col"
|
|
15
|
+
}, Fe = /* @__PURE__ */ s("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
|
|
16
|
+
/* @__PURE__ */ s("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
|
|
17
|
+
/* @__PURE__ */ s("div", {
|
|
18
|
+
class: "flex-0 py-8 px-16",
|
|
19
|
+
style: { "flex-basis": "240px" }
|
|
20
|
+
}, "Used in")
|
|
21
|
+
], -1), ke = { class: "flex-1 py-8 px-16" }, $e = {
|
|
22
|
+
class: "flex-0 py-8 px-16",
|
|
23
|
+
style: { "flex-basis": "240px" }
|
|
24
|
+
}, Ae = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "flex flex-col"
|
|
27
|
+
}, Ee = /* @__PURE__ */ s("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
|
|
28
|
+
/* @__PURE__ */ s("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
|
|
29
|
+
/* @__PURE__ */ s("div", {
|
|
30
|
+
class: "flex-0 py-8 px-16",
|
|
31
|
+
style: { "flex-basis": "240px" }
|
|
32
|
+
}, "Used in")
|
|
33
|
+
], -1), Ie = { class: "flex-1 py-8 px-16" }, De = {
|
|
34
|
+
class: "flex-0 py-8 px-16",
|
|
35
|
+
style: { "flex-basis": "240px" }
|
|
36
|
+
}, Re = {
|
|
37
|
+
key: 2,
|
|
38
|
+
class: "flex flex-col"
|
|
39
|
+
}, Pe = /* @__PURE__ */ s("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
|
|
40
|
+
/* @__PURE__ */ s("div", { class: "flex-1 py-8 px-16" }, "Menu"),
|
|
41
|
+
/* @__PURE__ */ s("div", {
|
|
42
|
+
class: "flex-0 py-8 px-16",
|
|
43
|
+
style: { "flex-basis": "240px" }
|
|
44
|
+
}, "Used in")
|
|
45
|
+
], -1), Te = { class: "flex-1 py-8 px-16" }, Me = {
|
|
46
|
+
class: "flex-0 py-8 px-16",
|
|
47
|
+
style: { "flex-basis": "240px" }
|
|
48
|
+
}, Be = /* @__PURE__ */ q({
|
|
49
|
+
__name: "UnitUsedBy",
|
|
50
|
+
props: {
|
|
51
|
+
unit: {}
|
|
52
|
+
},
|
|
53
|
+
setup(h) {
|
|
54
|
+
const u = h, y = H(), a = x(() => y.validateUnitUsage(u.unit)), l = x(() => a.value.filter((f) => f.from === "INGREDIENT")), r = x(() => a.value.filter((f) => f.from === "RECIPE")), p = x(() => a.value.filter((f) => f.from === "MENU"));
|
|
55
|
+
return (f, V) => (m(), w("div", we, [
|
|
56
|
+
Ce,
|
|
57
|
+
l.value.length ? (m(), w("div", Se, [
|
|
58
|
+
Fe,
|
|
59
|
+
(m(!0), w(z, null, j(l.value, (t) => {
|
|
60
|
+
var n;
|
|
61
|
+
return m(), w("div", {
|
|
62
|
+
key: t.code,
|
|
63
|
+
class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
|
|
64
|
+
}, [
|
|
65
|
+
s("div", ke, _(t.code) + " " + _(t.name), 1),
|
|
66
|
+
s("div", $e, _((n = t.bindedIngredient) != null && n.length ? "Convert binding" : "Item unit"), 1)
|
|
67
|
+
]);
|
|
68
|
+
}), 128))
|
|
69
|
+
])) : G("", !0),
|
|
70
|
+
r.value.length ? (m(), w("div", Ae, [
|
|
71
|
+
Ee,
|
|
72
|
+
(m(!0), w(z, null, j(r.value, (t) => {
|
|
73
|
+
var n, v, b;
|
|
74
|
+
return m(), w("div", {
|
|
75
|
+
key: t.code,
|
|
76
|
+
class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
|
|
77
|
+
}, [
|
|
78
|
+
s("div", Ie, _(t.code) + " " + _(t.name), 1),
|
|
79
|
+
s("div", De, _((n = t.bindedIngredient) == null ? void 0 : n.slice(0, 3).map((e) => e.code).join(", ")) + " " + _(t.bindedIngredient && ((v = t.bindedIngredient) == null ? void 0 : v.length) > 3 ? `and ${((b = t.bindedIngredient) == null ? void 0 : b.length) - 3} more` : ""), 1)
|
|
80
|
+
]);
|
|
81
|
+
}), 128))
|
|
82
|
+
])) : G("", !0),
|
|
83
|
+
p.value.length ? (m(), w("div", Re, [
|
|
84
|
+
Pe,
|
|
85
|
+
(m(!0), w(z, null, j(p.value, (t) => {
|
|
86
|
+
var n, v, b;
|
|
87
|
+
return m(), w("div", {
|
|
88
|
+
key: t.code,
|
|
89
|
+
class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
|
|
90
|
+
}, [
|
|
91
|
+
s("div", Te, _(t.code) + " " + _(t.name), 1),
|
|
92
|
+
s("div", Me, _((n = t.bindedIngredient) == null ? void 0 : n.slice(0, 3).map((e) => e.code).join(", ")) + " " + _(t.bindedIngredient && ((v = t.bindedIngredient) == null ? void 0 : v.length) > 3 ? `and ${((b = t.bindedIngredient) == null ? void 0 : b.length) - 3} more` : ""), 1)
|
|
93
|
+
]);
|
|
94
|
+
}), 128))
|
|
95
|
+
])) : G("", !0)
|
|
96
|
+
]));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
function Ne() {
|
|
100
|
+
const h = ue(), u = oe(), y = H(), a = R(!1), l = R();
|
|
101
|
+
function r() {
|
|
102
|
+
const t = {
|
|
103
|
+
unit: {},
|
|
104
|
+
mode: U.CREATE,
|
|
105
|
+
show: !0,
|
|
106
|
+
"onUpdate:show"(n) {
|
|
107
|
+
l.value.show = n;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
l.value = t;
|
|
111
|
+
}
|
|
112
|
+
async function p(t) {
|
|
113
|
+
const n = {
|
|
114
|
+
unit: t,
|
|
115
|
+
mode: U.UPDATE,
|
|
116
|
+
show: !0,
|
|
117
|
+
"onUpdate:show"(v) {
|
|
118
|
+
l.value.show = v;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
l.value = n;
|
|
122
|
+
}
|
|
123
|
+
async function f(t) {
|
|
124
|
+
a.value = !0;
|
|
125
|
+
try {
|
|
126
|
+
await y.deleteUnit(t), u.open({
|
|
127
|
+
title: "Success",
|
|
128
|
+
message: `Deleted ${t.name}`,
|
|
129
|
+
type: "success"
|
|
130
|
+
});
|
|
131
|
+
} catch (n) {
|
|
132
|
+
n instanceof ie && ce(n) ? h.open({
|
|
133
|
+
title: "Cannot delete unit",
|
|
134
|
+
contentComponent: pe,
|
|
135
|
+
contentComponentProps: {
|
|
136
|
+
subject: (t == null ? void 0 : t.name) ?? "",
|
|
137
|
+
items: n.errorResponse.message
|
|
138
|
+
},
|
|
139
|
+
secondaryActions: {
|
|
140
|
+
text: "Close",
|
|
141
|
+
close: !0
|
|
142
|
+
}
|
|
143
|
+
}) : console.log("unable to delete unit", n), u.open({
|
|
144
|
+
title: `Cannot delete ${t.name}`,
|
|
145
|
+
message: "Please try again.",
|
|
146
|
+
type: "error"
|
|
147
|
+
}), console.error("failed to delete unit", n);
|
|
148
|
+
} finally {
|
|
149
|
+
a.value = !1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function V(t) {
|
|
153
|
+
if (y.validateUnitUsage(t).length) {
|
|
154
|
+
h.open({
|
|
155
|
+
title: `Cannot delete ${(t == null ? void 0 : t.name) ?? "unit"}`,
|
|
156
|
+
overlay: !0,
|
|
157
|
+
dismissAway: !0,
|
|
158
|
+
closeButton: !0,
|
|
159
|
+
contentComponent: Be,
|
|
160
|
+
contentComponentProps: {
|
|
161
|
+
unit: t
|
|
162
|
+
},
|
|
163
|
+
primaryActions: {
|
|
164
|
+
text: "Confirm",
|
|
165
|
+
close: !0
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
h.open({
|
|
171
|
+
title: `Delete ${(t == null ? void 0 : t.name) ?? "unit"}?`,
|
|
172
|
+
closeButton: !1,
|
|
173
|
+
message: "You may not be able to delete this unit if it is linked in any of the inventory modules.",
|
|
174
|
+
primaryActions: {
|
|
175
|
+
text: "Delete",
|
|
176
|
+
close: !0,
|
|
177
|
+
variant: "destructive"
|
|
178
|
+
},
|
|
179
|
+
secondaryActions: {
|
|
180
|
+
text: "Cancel",
|
|
181
|
+
close: !0
|
|
182
|
+
}
|
|
183
|
+
}).onPrimary(() => f(t));
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
createUnit: r,
|
|
187
|
+
updateUnit: p,
|
|
188
|
+
deleteUnit: V,
|
|
189
|
+
unitDialogProps: l,
|
|
190
|
+
unitViewLoading: a
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function Le({
|
|
194
|
+
updateUnit: h,
|
|
195
|
+
deleteUnit: u
|
|
196
|
+
}) {
|
|
197
|
+
async function y(l, r) {
|
|
198
|
+
const p = te(r);
|
|
199
|
+
if (l === N.Edit) {
|
|
200
|
+
await h(p);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (l === N.Delete) {
|
|
204
|
+
await u(p);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return { columnDefs: [
|
|
209
|
+
{
|
|
210
|
+
accessorKey: "name",
|
|
211
|
+
header: "Name",
|
|
212
|
+
enableSorting: !0,
|
|
213
|
+
size: 300
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
accessorKey: "abbrev",
|
|
217
|
+
header: "Symbol",
|
|
218
|
+
enableSorting: !1,
|
|
219
|
+
size: "auto"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "action",
|
|
223
|
+
header: "",
|
|
224
|
+
cell(l) {
|
|
225
|
+
return fe(
|
|
226
|
+
[ee[N.Edit], ee[N.Delete]],
|
|
227
|
+
(r) => {
|
|
228
|
+
y(r, l.row.original);
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
},
|
|
232
|
+
enableSorting: !1,
|
|
233
|
+
size: 40,
|
|
234
|
+
meta: {
|
|
235
|
+
cellClass: "",
|
|
236
|
+
headerClass: ""
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
] };
|
|
240
|
+
}
|
|
241
|
+
const ze = { class: "grid grid-cols-3 gap-24" }, je = { class: "flex" }, qe = { class: "flex items-center" }, He = { class: "fm-typo-en-body-lg-600 flex-grow" }, Ke = { class: "grid grid-cols-3 gap-24" }, Ge = /* @__PURE__ */ q({
|
|
242
|
+
__name: "UnitForm",
|
|
243
|
+
props: {
|
|
244
|
+
mode: {},
|
|
245
|
+
modelValue: {},
|
|
246
|
+
disabled: { type: Boolean }
|
|
247
|
+
},
|
|
248
|
+
emits: ["update:modelValue", "click:submit"],
|
|
249
|
+
setup(h, { expose: u, emit: y }) {
|
|
250
|
+
const a = h, l = y;
|
|
251
|
+
function r() {
|
|
252
|
+
l("click:submit");
|
|
253
|
+
}
|
|
254
|
+
const p = x({
|
|
255
|
+
get() {
|
|
256
|
+
var e;
|
|
257
|
+
return ((e = a.modelValue) == null ? void 0 : e.name) ?? "";
|
|
258
|
+
},
|
|
259
|
+
set(e) {
|
|
260
|
+
const o = a.modelValue ?? {};
|
|
261
|
+
o.name = e, l("update:modelValue", o);
|
|
262
|
+
}
|
|
263
|
+
}), f = x({
|
|
264
|
+
get() {
|
|
265
|
+
var e;
|
|
266
|
+
return ((e = a.modelValue) == null ? void 0 : e.abbrev) ?? "";
|
|
267
|
+
},
|
|
268
|
+
set(e) {
|
|
269
|
+
const o = a.modelValue ?? {};
|
|
270
|
+
o.abbrev = e, l("update:modelValue", o);
|
|
271
|
+
}
|
|
272
|
+
}), V = x({
|
|
273
|
+
get() {
|
|
274
|
+
var e;
|
|
275
|
+
return ((e = a.modelValue) == null ? void 0 : e.precision) ?? 0;
|
|
276
|
+
},
|
|
277
|
+
set(e) {
|
|
278
|
+
const o = a.modelValue ?? {};
|
|
279
|
+
o.precision = e, l("update:modelValue", o);
|
|
280
|
+
}
|
|
281
|
+
}), t = x({
|
|
282
|
+
get() {
|
|
283
|
+
var e;
|
|
284
|
+
return ((e = a.modelValue) == null ? void 0 : e.measurements) ?? [];
|
|
285
|
+
},
|
|
286
|
+
set(e) {
|
|
287
|
+
const o = a.modelValue ?? {};
|
|
288
|
+
o.measurements = e, l("update:modelValue", o);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
function n() {
|
|
292
|
+
const e = a.modelValue ?? {}, o = e.measurements ?? [];
|
|
293
|
+
e.measurements = [
|
|
294
|
+
...o,
|
|
295
|
+
{
|
|
296
|
+
id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
|
|
297
|
+
name: "",
|
|
298
|
+
abbrev: "",
|
|
299
|
+
conversion: {
|
|
300
|
+
amount: 1,
|
|
301
|
+
precision: 0
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
], l("update:modelValue", e);
|
|
305
|
+
}
|
|
306
|
+
function v(e) {
|
|
307
|
+
const o = a.modelValue ?? {}, i = o.measurements ?? [];
|
|
308
|
+
i.splice(e, 1), o.measurements = i, l("update:modelValue", o);
|
|
309
|
+
}
|
|
310
|
+
const b = R();
|
|
311
|
+
return u({
|
|
312
|
+
validateInputs: () => {
|
|
313
|
+
var e, o;
|
|
314
|
+
(o = (e = b.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
|
|
315
|
+
},
|
|
316
|
+
resetInputsValidation: () => {
|
|
317
|
+
var e, o;
|
|
318
|
+
(o = (e = b.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
|
|
319
|
+
},
|
|
320
|
+
resetInputs: () => {
|
|
321
|
+
var e, o;
|
|
322
|
+
(o = (e = b.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
|
|
323
|
+
}
|
|
324
|
+
}), (e, o) => {
|
|
325
|
+
const i = A("FmTextField"), E = A("FmStepperField"), S = A("FmButton"), F = A("FmCard"), K = A("FmForm");
|
|
326
|
+
return m(), T(K, {
|
|
327
|
+
ref_key: "formRef",
|
|
328
|
+
ref: b,
|
|
329
|
+
class: "flex flex-col gap-40",
|
|
330
|
+
onValidationSuccess: r
|
|
331
|
+
}, {
|
|
332
|
+
default: I(() => {
|
|
333
|
+
var k;
|
|
334
|
+
return [
|
|
335
|
+
s("div", ze, [
|
|
336
|
+
c(i, {
|
|
337
|
+
disabled: e.disabled,
|
|
338
|
+
class: "col-span-2",
|
|
339
|
+
label: "Name",
|
|
340
|
+
modelValue: p.value,
|
|
341
|
+
"onUpdate:modelValue": o[0] || (o[0] = (C) => p.value = C),
|
|
342
|
+
rules: [d(L)()],
|
|
343
|
+
"label-mark": "required"
|
|
344
|
+
}, null, 8, ["disabled", "modelValue", "rules"]),
|
|
345
|
+
c(i, {
|
|
346
|
+
disabled: e.disabled,
|
|
347
|
+
label: "Symbol",
|
|
348
|
+
modelValue: f.value,
|
|
349
|
+
"onUpdate:modelValue": o[1] || (o[1] = (C) => f.value = C),
|
|
350
|
+
rules: [d(L)()],
|
|
351
|
+
"label-mark": "required"
|
|
352
|
+
}, null, 8, ["disabled", "modelValue", "rules"]),
|
|
353
|
+
c(E, {
|
|
354
|
+
disabled: e.disabled,
|
|
355
|
+
class: "col-span-3",
|
|
356
|
+
label: "Precision",
|
|
357
|
+
modelValue: V.value,
|
|
358
|
+
"onUpdate:modelValue": o[2] || (o[2] = (C) => V.value = C),
|
|
359
|
+
rules: [d(_e)(0)]
|
|
360
|
+
}, null, 8, ["disabled", "modelValue", "rules"])
|
|
361
|
+
]),
|
|
362
|
+
s("div", je, [
|
|
363
|
+
c(S, {
|
|
364
|
+
disabled: e.disabled,
|
|
365
|
+
type: "button",
|
|
366
|
+
"prepend-icon": "add",
|
|
367
|
+
label: "Add measurement",
|
|
368
|
+
variant: "plain",
|
|
369
|
+
onClick: n
|
|
370
|
+
}, null, 8, ["disabled"])
|
|
371
|
+
]),
|
|
372
|
+
(m(!0), w(z, null, j((k = e.modelValue) == null ? void 0 : k.measurements, (C, g) => (m(), T(F, {
|
|
373
|
+
class: "flex flex-col gap-16 p-16",
|
|
374
|
+
variant: "outlined",
|
|
375
|
+
key: C.id
|
|
376
|
+
}, {
|
|
377
|
+
default: I(() => [
|
|
378
|
+
s("div", qe, [
|
|
379
|
+
s("div", He, "Measurement " + _(g + 1), 1),
|
|
380
|
+
c(S, {
|
|
381
|
+
disabled: e.disabled,
|
|
382
|
+
variant: "tertiary",
|
|
383
|
+
"prepend-icon": "delete",
|
|
384
|
+
onClick: ($) => v(g)
|
|
385
|
+
}, null, 8, ["disabled", "onClick"])
|
|
386
|
+
]),
|
|
387
|
+
s("div", Ke, [
|
|
388
|
+
c(i, {
|
|
389
|
+
disabled: e.disabled,
|
|
390
|
+
class: "col-span-2",
|
|
391
|
+
label: "Name",
|
|
392
|
+
modelValue: e.modelValue.measurements[g].name,
|
|
393
|
+
"onUpdate:modelValue": ($) => e.modelValue.measurements[g].name = $,
|
|
394
|
+
rules: [d(L)()],
|
|
395
|
+
"label-mark": "required"
|
|
396
|
+
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "rules"]),
|
|
397
|
+
c(i, {
|
|
398
|
+
disabled: e.disabled,
|
|
399
|
+
label: "Symbol",
|
|
400
|
+
modelValue: e.modelValue.measurements[g].abbrev,
|
|
401
|
+
"onUpdate:modelValue": ($) => e.modelValue.measurements[g].abbrev = $,
|
|
402
|
+
rules: [d(L)()],
|
|
403
|
+
"label-mark": "required"
|
|
404
|
+
}, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "rules"]),
|
|
405
|
+
c(Ue, {
|
|
406
|
+
disabled: e.disabled,
|
|
407
|
+
class: "col-span-3",
|
|
408
|
+
label: "Conversion",
|
|
409
|
+
"model-value": +d(O)(e.modelValue.measurements[g].conversion),
|
|
410
|
+
"onUpdate:modelValue": ($) => t.value = t.value.map(
|
|
411
|
+
(P, D) => D === g ? {
|
|
412
|
+
...P,
|
|
413
|
+
conversion: d(Ve).toPrecision(
|
|
414
|
+
d(he)($),
|
|
415
|
+
V.value
|
|
416
|
+
)
|
|
417
|
+
} : P
|
|
418
|
+
),
|
|
419
|
+
rules: [d(xe)(0)],
|
|
420
|
+
step: +d(O)({ amount: 1, precision: V.value }),
|
|
421
|
+
"helper-text": `1 ${e.modelValue.measurements[g].name || "measurement unit"} equal to ${+d(O)(e.modelValue.measurements[g].conversion)} ${p.value || "base unit"}`
|
|
422
|
+
}, null, 8, ["disabled", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
|
|
423
|
+
])
|
|
424
|
+
]),
|
|
425
|
+
_: 2
|
|
426
|
+
}, 1024))), 128))
|
|
427
|
+
];
|
|
428
|
+
}),
|
|
429
|
+
_: 1
|
|
430
|
+
}, 512);
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
}), Oe = { class: "flex gap-4" }, Ye = /* @__PURE__ */ q({
|
|
434
|
+
__name: "UnitDialog",
|
|
435
|
+
props: {
|
|
436
|
+
show: { type: Boolean },
|
|
437
|
+
unit: {},
|
|
438
|
+
mode: { default: U.READ }
|
|
439
|
+
},
|
|
440
|
+
emits: ["update:show"],
|
|
441
|
+
setup(h) {
|
|
442
|
+
const u = h, y = H(), a = oe(), l = Z(u, "show"), r = Z(u, "unit"), p = x(() => {
|
|
443
|
+
switch (u.mode) {
|
|
444
|
+
case U.READ:
|
|
445
|
+
return "View Unit";
|
|
446
|
+
case U.UPDATE:
|
|
447
|
+
return "Edit Unit";
|
|
448
|
+
case U.CREATE:
|
|
449
|
+
return "Add Unit";
|
|
450
|
+
}
|
|
451
|
+
return "";
|
|
452
|
+
}), f = x(() => {
|
|
453
|
+
switch (u.mode) {
|
|
454
|
+
case U.READ:
|
|
455
|
+
return "";
|
|
456
|
+
case U.UPDATE:
|
|
457
|
+
return "Save";
|
|
458
|
+
case U.CREATE:
|
|
459
|
+
return "Add";
|
|
460
|
+
}
|
|
461
|
+
return "";
|
|
462
|
+
}), V = R(), t = R(!1);
|
|
463
|
+
async function n() {
|
|
464
|
+
t.value = !0;
|
|
465
|
+
try {
|
|
466
|
+
const o = te(r.value);
|
|
467
|
+
o.precision ?? (o.precision = 0), o.measurements ?? (o.measurements = []), await y.createUnit(o), l.value = !1, a.open({
|
|
468
|
+
title: "Success",
|
|
469
|
+
message: "Created " + r.value.name,
|
|
470
|
+
type: "success"
|
|
471
|
+
});
|
|
472
|
+
} catch (o) {
|
|
473
|
+
o instanceof X || a.open({
|
|
474
|
+
title: "Failed to create unit",
|
|
475
|
+
message: "Please try again",
|
|
476
|
+
type: "error"
|
|
477
|
+
});
|
|
478
|
+
} finally {
|
|
479
|
+
t.value = !1;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
async function v() {
|
|
483
|
+
t.value = !0;
|
|
484
|
+
try {
|
|
485
|
+
await y.updateUnit(r.value), l.value = !1, a.open({
|
|
486
|
+
title: "Success",
|
|
487
|
+
message: "Updated " + r.value.name,
|
|
488
|
+
type: "success"
|
|
489
|
+
});
|
|
490
|
+
} catch (o) {
|
|
491
|
+
o instanceof X || a.open({
|
|
492
|
+
title: "Failed to update unit",
|
|
493
|
+
message: "Please try again",
|
|
494
|
+
type: "error"
|
|
495
|
+
});
|
|
496
|
+
} finally {
|
|
497
|
+
t.value = !1;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
function b() {
|
|
501
|
+
var o, i;
|
|
502
|
+
(i = (o = V.value) == null ? void 0 : o.validateInputs) == null || i.call(o);
|
|
503
|
+
}
|
|
504
|
+
function e() {
|
|
505
|
+
switch (u.mode) {
|
|
506
|
+
case U.READ:
|
|
507
|
+
return;
|
|
508
|
+
case U.UPDATE:
|
|
509
|
+
return v();
|
|
510
|
+
case U.CREATE:
|
|
511
|
+
return n();
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
return (o, i) => {
|
|
515
|
+
const E = A("FmButton"), S = A("FmSideSheet");
|
|
516
|
+
return m(), T(S, {
|
|
517
|
+
"model-value": d(l),
|
|
518
|
+
"onUpdate:modelValue": i[3] || (i[3] = (F) => W(l) ? l.value = F : null),
|
|
519
|
+
header: p.value,
|
|
520
|
+
"close-button": "",
|
|
521
|
+
"dismiss-away": "",
|
|
522
|
+
"max-width": 500
|
|
523
|
+
}, {
|
|
524
|
+
"side-sheet-footer": I(() => [
|
|
525
|
+
s("div", Oe, [
|
|
526
|
+
c(E, {
|
|
527
|
+
loading: t.value,
|
|
528
|
+
label: f.value,
|
|
529
|
+
onClick: b
|
|
530
|
+
}, null, 8, ["loading", "label"]),
|
|
531
|
+
c(E, {
|
|
532
|
+
disabled: t.value,
|
|
533
|
+
label: "Close",
|
|
534
|
+
variant: "tertiary",
|
|
535
|
+
onClick: i[2] || (i[2] = (F) => l.value = !1)
|
|
536
|
+
}, null, 8, ["disabled"])
|
|
537
|
+
])
|
|
538
|
+
]),
|
|
539
|
+
default: I(() => [
|
|
540
|
+
c(Ge, {
|
|
541
|
+
class: "w-full",
|
|
542
|
+
ref_key: "hasValidationExpose",
|
|
543
|
+
ref: V,
|
|
544
|
+
modelValue: d(r),
|
|
545
|
+
"onUpdate:modelValue": i[0] || (i[0] = (F) => W(r) ? r.value = F : null),
|
|
546
|
+
mode: o.mode,
|
|
547
|
+
disabled: t.value,
|
|
548
|
+
"onClick:submit": i[1] || (i[1] = (F) => e())
|
|
549
|
+
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
550
|
+
]),
|
|
551
|
+
_: 1
|
|
552
|
+
}, 8, ["model-value", "header"]);
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
}), Je = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, Qe = { class: "px-8 flex items-center xs:gap-0 xs:flex-col-reverse sm:gap-0 sm:flex-col-reverse" }, We = { class: "flex-1 w-full" }, Xe = { class: "flex flex-col py-8" }, Ze = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, et = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = /* @__PURE__ */ q({
|
|
556
|
+
__name: "UnitView",
|
|
557
|
+
setup(h) {
|
|
558
|
+
const u = H(), y = de(), a = x(() => u.units), { createUnit: l, updateUnit: r, deleteUnit: p, unitDialogProps: f, unitViewLoading: V } = Ne(), { columnDefs: t } = Le({ updateUnit: r, deleteUnit: p });
|
|
559
|
+
function n(E) {
|
|
560
|
+
E === "add" && l();
|
|
561
|
+
}
|
|
562
|
+
const v = R(""), b = x(() => V.value), { breakpoints: e } = me(), o = x(() => e.value.xs || e.value.sm ? 10 : 20), i = ye();
|
|
563
|
+
return (E, S) => {
|
|
564
|
+
const F = A("FmTableToolbar"), K = A("FmTable");
|
|
565
|
+
return m(), T(ge, {
|
|
566
|
+
title: "Unit",
|
|
567
|
+
actions: [{ label: "Add unit", value: "add", isPrimary: !0, prependIcon: "add" }],
|
|
568
|
+
"onClick:action": n
|
|
569
|
+
}, {
|
|
570
|
+
default: I(() => [
|
|
571
|
+
s("div", Je, [
|
|
572
|
+
s("div", Qe, [
|
|
573
|
+
s("div", We, [
|
|
574
|
+
c(F, {
|
|
575
|
+
searchable: "",
|
|
576
|
+
"search-model": v.value,
|
|
577
|
+
"onUpdate:searchModel": S[0] || (S[0] = (k) => v.value = k)
|
|
578
|
+
}, null, 8, ["search-model"])
|
|
579
|
+
])
|
|
580
|
+
]),
|
|
581
|
+
c(K, {
|
|
582
|
+
style: se(d(i).tableHeight),
|
|
583
|
+
"column-defs": d(t),
|
|
584
|
+
"row-data": a.value,
|
|
585
|
+
"search-value": v.value,
|
|
586
|
+
loading: !d(y)._currentLocation || b.value,
|
|
587
|
+
onRowClick: S[1] || (S[1] = (k) => d(r)(k.original)),
|
|
588
|
+
"page-size": o.value
|
|
589
|
+
}, {
|
|
590
|
+
"list-row": I((k) => [
|
|
591
|
+
c(ve, {
|
|
592
|
+
row: k,
|
|
593
|
+
onRowClick: d(r)
|
|
594
|
+
}, {
|
|
595
|
+
default: I((C) => {
|
|
596
|
+
var g, $, P, D, Y, M, J, B, Q;
|
|
597
|
+
return [
|
|
598
|
+
s("div", Xe, [
|
|
599
|
+
s("div", Ze, [
|
|
600
|
+
c(d(be), {
|
|
601
|
+
render: (P = ($ = (g = C.name) == null ? void 0 : g.column) == null ? void 0 : $.columnDef) == null ? void 0 : P.cell,
|
|
602
|
+
props: (Y = (D = C.name) == null ? void 0 : D.getContext) == null ? void 0 : Y.call(D)
|
|
603
|
+
}, null, 8, ["render", "props"])
|
|
604
|
+
]),
|
|
605
|
+
s("div", et, _((Q = (B = (J = (M = k.original.measurements) == null ? void 0 : M.map) == null ? void 0 : J.call(M, (le) => le.name)) == null ? void 0 : B.join) == null ? void 0 : Q.call(B, ", ")), 1)
|
|
606
|
+
])
|
|
607
|
+
];
|
|
608
|
+
}),
|
|
609
|
+
_: 2
|
|
610
|
+
}, 1032, ["row", "onRowClick"])
|
|
611
|
+
]),
|
|
612
|
+
_: 1
|
|
613
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
614
|
+
]),
|
|
615
|
+
(m(), T(ae, { to: "body" }, [
|
|
616
|
+
c(Ye, ne(re(d(f))), null, 16)
|
|
617
|
+
]))
|
|
618
|
+
]),
|
|
619
|
+
_: 1
|
|
620
|
+
});
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
export {
|
|
625
|
+
ct as default
|
|
626
|
+
};
|