@feedmepos/mf-inventory-portal 1.8.0-dev.8 → 1.8.0
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-C8i7vBxz.js → App-BPdZMhM8.js} +515 -536
- package/dist/{ApprovalView-GHgTeCBV.js → ApprovalView-UzjSuZ2L.js} +26 -25
- package/dist/{BindingsDialog-C4-S2CWk.js → BindingsDialog-Cb6WRlKq.js} +2 -2
- package/dist/{BindingsPicker-C7YUArBj.js → BindingsPicker-CtD4U4lv.js} +2 -2
- package/dist/{BindingsTable-1Zoqi4ZS.js → BindingsTable-CX-3403K.js} +10 -10
- package/dist/BulkReceiveRequestPage-CUq1Lmww.js +2839 -0
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DFSg0-gv.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-C5cA-lGH.js} +1 -1
- package/dist/{ClosingDraftView-CnWFyWSE.js → ClosingDraftView-Ca_SvdWQ.js} +748 -746
- package/dist/{ClosingHistoryView-Bkm0voU6.js → ClosingHistoryView-DzkeJYoe.js} +7 -7
- package/dist/{ClosingTemplateView-Bz81JTsg.js → ClosingTemplateView-DSrelbso.js} +22 -21
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-6s-24euf.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BuOuXPy1.js} +1 -1
- package/dist/{DefaultView-1RRzbPB3.js → DefaultView-Dw-7Y8vD.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-KcLqjOj1.js → DeliveryOrderPrintPreview-C5qJsv_O.js} +15 -15
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-r0Q0qhoK.js → EmailDialog.vue_vue_type_script_setup_true_lang-D8od7aKT.js} +9847 -9723
- package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-Cwmk3NLS.js → FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-ChekXW32.js} +11 -10
- package/dist/FeatureCapabilityGate-C-IM5_7n.js +82 -0
- package/dist/FeaturePageGate.vue_vue_type_script_setup_true_lang-DEDU1XUC.js +189 -0
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-pzIzIWpX.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B861gqIJ.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6cFB4vX.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ckli_nZx.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_o6pX9i.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BEjFoMJJ.js} +2 -2
- package/dist/{FmMultiselectDialog-CC_Na_p1.js → FmMultiselectDialog-CShFKSIW.js} +2 -2
- package/dist/{FmMultiselectDialog-D0GhmOQ9.js → FmMultiselectDialog-Ci-6NMsV.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DQlSMRoB.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Dkx5vVap.js} +105 -99
- package/dist/ImportView-7ij7RUHI.js +1540 -0
- package/dist/{IngredientsView-B2I2OPSb.js → IngredientsView-fIPtTyFD.js} +367 -365
- package/dist/{IntegrationExplorerView-WK1EmwLA.js → IntegrationExplorerView-DLYT4T-I.js} +1537 -1620
- package/dist/IntegrationPlatformView-CwywuK_y.js +13385 -0
- package/dist/{IntegrationView-CeaL92Yj.js → IntegrationView-DnyVHXge.js} +2380 -2340
- package/dist/{InventoryBindingForm-DgtaDM0I.js → InventoryBindingForm-BBs8v7CL.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CqDN355J.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang--pI5wz_M.js} +134 -134
- package/dist/{InventoryBindingSummary-C_W456aj.js → InventoryBindingSummary-CwIrQ8lG.js} +1 -1
- package/dist/JsonViewer.vue_vue_type_script_setup_true_lang-C_hg75l0.js +25 -0
- package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DJSbskyn.js +79 -0
- package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-CM3gtYZo.js +19 -0
- package/dist/{PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-D6-lo7iI.js → PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-0F-yOcPC.js} +1 -1
- package/dist/PremiumUpgradePage.vue_vue_type_script_setup_true_lang-DGAxPOEh.js +58 -0
- package/dist/ProductionRunDetailPage-C_WC4qfP.js +2317 -0
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-DwBY6gIb.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BIkoMOM2.js} +3051 -3161
- package/dist/ProductionRunPage-DuzVrjbZ.js +954 -0
- package/dist/{PublishView-Dv-W6ntx.js → PublishView-BVg44yke.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-D1TAnJd_.js → PurchaseOrderPrintPreview-CNx6unyj.js} +17 -17
- package/dist/{ReceiveRequestView-Rc_uw_Ad.js → ReceiveRequestView-DeNrYOUt.js} +17 -16
- package/dist/RecipeView-De3pLsPR.js +3272 -0
- package/dist/{SettingsView-K5wAt8oo.js → SettingsView-B5ud0KtI.js} +398 -425
- package/dist/StockView-4N3NRjY8.js +3003 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CsRLy0xI.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DvlRRKdt.js} +1 -1
- package/dist/{SupplierView-CLVupRN0.js → SupplierView-fC9oe5nu.js} +21 -20
- package/dist/{SurchargeView-CToB_z5v.js → SurchargeView-H6rv7u8A.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CvqIw9q6.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DFdrmR2Z.js} +2 -2
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js +71 -0
- package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BivHE94R.js +332 -0
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Df01LqHp.js +4953 -0
- package/dist/TransferTemplateView-CVUnofkI.js +2347 -0
- package/dist/{UnitCostHistoryView-BMB2MeTh.js → UnitCostHistoryView-DjD2WAFI.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-Dn8Y8zfp.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CE0zHU6c.js} +4 -4
- package/dist/{UnitView-Bl8jws6R.js → UnitView-DCfsbE8e.js} +111 -106
- package/dist/{WarehouseView-BurSM1jg.js → WarehouseView-BCebmbcj.js} +12 -11
- package/dist/{WastageTemplateView-DRfJ9LGR.js → WastageTemplateView-BXYNMBun.js} +19 -18
- package/dist/api/bill.d.ts +4 -2
- package/dist/api/bill.spec.d.ts +1 -0
- package/dist/api/closing.d.ts +1 -0
- package/dist/api/feature-flags.d.ts +2 -0
- package/dist/api/integration-sync-log.d.ts +0 -13
- package/dist/api/inventory.d.ts +9 -9
- package/dist/api/license.d.ts +0 -1
- package/dist/api/netsuite-explorer.d.ts +1 -0
- package/dist/api/stock.d.ts +1 -1
- package/dist/{app-Duum3eHx.js → app-VtVYHCDF.js} +9785 -9546
- package/dist/app.d.ts +151 -14
- package/dist/app.js +1 -1
- package/dist/bulk-edit-simulation.helper-Nd6CtWGf.js +178 -0
- package/dist/{closing-template-BE41yfue.js → closing-template-LCe0U9w9.js} +4 -4
- package/dist/components/FeatureCapabilityGate.vue.d.ts +3 -0
- package/dist/components/FeatureGateLayout.vue.d.ts +11 -0
- package/dist/components/FeaturePageGate.spec.d.ts +1 -0
- package/dist/components/FeaturePageGate.vue.d.ts +34 -0
- package/dist/components/FmAdminCollapsiblePanel.vue.d.ts +1 -1
- package/dist/components/FmDroppableField.vue.d.ts +1 -1
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -2
- package/dist/components/FmUnitInputProps.d.ts +1 -0
- package/dist/components/FmUnitInputRules.d.ts +1 -1
- package/dist/components/HrmPermissionGuard.vue.d.ts +1 -1
- package/dist/components/MultiLocationSelector.vue.d.ts +6 -6
- package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
- package/dist/components/PremiumUpgradePage.vue.d.ts +2 -0
- package/dist/components/TemplatePublishDialog.d.ts +2 -0
- package/dist/components/TemplatePublishDialog.spec.d.ts +1 -0
- package/dist/composable/defineApi.d.ts +1 -1
- package/dist/{date2-DrhO3BxU.js → date2-Cfb6DXM4.js} +1 -1
- package/dist/{dayjs.min-CQp6EpOp.js → dayjs.min-BOndKK7B.js} +1 -1
- package/dist/{decimal-Cq0qUT4r.js → decimal-nbuisP61.js} +2 -2
- package/dist/{defineDeepModel-DRC39nJs.js → defineDeepModel-DKySrdwp.js} +5 -5
- package/dist/{duplicate-template-j2ymeDNH.js → duplicate-template-BxcKb3Jp.js} +1 -1
- package/dist/{feature-C0hQza5A.js → feature-VDUlSvM1.js} +435 -359
- package/dist/feature-flags/core.d.ts +1 -0
- package/dist/feature-flags/vue.d.ts +22 -1
- package/dist/{format-time-from-id-BmJoI3jT.js → format-time-from-id-CfVH4LZ_.js} +1 -1
- package/dist/{format-unit-display-CRgIMXsD.js → format-unit-display-BjTeAtgS.js} +209 -208
- package/dist/helper/country.spec.d.ts +1 -0
- package/dist/helper/menu-usage-module.d.ts +2 -1
- package/dist/helper/number.d.ts +5 -1
- package/dist/helper/rules.d.ts +1 -1
- package/dist/{id-to-date-CuFZDvIr.js → id-to-date-Jr9SlHLO.js} +1 -1
- package/dist/{import-export.helper-B43zbsbj.js → import-export.helper-FT9Wbigh.js} +17 -17
- package/dist/{index-BYDjs08n.js → index-BV9b3Ulp.js} +2234 -2163
- package/dist/{index-DXNYZeq3.js → index-By5-VjVg.js} +1 -1
- package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
- package/dist/{index-Cwvg7EHd.js → index-DXHVgUHU.js} +3 -3
- package/dist/index-eGvSlWMU.js +1892 -0
- package/dist/layout/SingleColumnLayout.vue.d.ts +1 -1
- package/dist/{lz-string-6DgW1cPF.js → lz-string-BAzqO9xf.js} +1 -1
- package/dist/menu-usage-module-Bq_KLsO4.js +74 -0
- package/dist/{netsuite-BSpmyaE1.js → netsuite-BhGuduqd.js} +254 -263
- package/dist/netsuite-explorer-9Qj7qAum.js +79 -0
- package/dist/{predefined-templates-C0jtb4T7.js → predefined-templates-BlRafgnc.js} +1 -1
- package/dist/production-run-list-DR1WsaBR.js +61 -0
- package/dist/{purchase-order-template-B5Pjddfi.js → purchase-order-template-By_Zxu1b.js} +1 -1
- package/dist/{recalculationUtils-DtJWwWSj.js → recalculationUtils-VsBar7jB.js} +1 -1
- package/dist/router/name.d.ts +2 -1
- package/dist/{row-action.enum-BDDJNSi0.js → row-action.enum-76yLYmPA.js} +1 -1
- package/dist/rules-fOcvgt4t.js +243 -0
- package/dist/{stock-BKMDvf5S.js → stock-C-dQaxY2.js} +1 -1
- package/dist/stock-Dh0KXA1P.js +78 -0
- package/dist/stores/feature.d.ts +26 -2
- package/dist/stores/feature.load-state.spec.d.ts +1 -0
- package/dist/stores/integration/netsuite.d.ts +2 -2
- package/dist/stores/inventory.no-location.spec.d.ts +1 -0
- package/dist/stores/location.d.ts +42 -42
- package/dist/stores/supplier.d.ts +48 -48
- package/dist/stores/warehouse.d.ts +2 -2
- package/dist/style.css +1 -1
- package/dist/{supplier-Cv8HRNou.js → supplier-XHHHN8vZ.js} +2 -2
- package/dist/{surcharge-ktE1pRyy.js → surcharge-0-oBiYoF.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-DCnXmEkb.js → uom-rules-DrRuSFgM.js} +1 -1
- package/dist/{use-ingredient-select-dialog-CYUUVrCI.js → use-ingredient-select-dialog-mQ7aQChK.js} +2 -2
- package/dist/{use-inventory-binding-dialog-Dugj9i-6.js → use-inventory-binding-dialog-5Wu0ItnH.js} +2 -2
- package/dist/{use-template-enabled-locations-BlZ7WAqX.js → use-template-enabled-locations-CgpPMl8g.js} +2 -2
- package/dist/{use-transfer-locations-CUDFnsVH.js → use-transfer-locations-DZ6B7eMT.js} +14 -14
- package/dist/{useHrmPermission-BOwmXi9H.js → useHrmPermission-BaGxz4EV.js} +1 -1
- package/dist/{useNavigationMenu-CbNKFBwx.js → useNavigationMenu-CyP39v3U.js} +39 -39
- package/dist/{useSseClient-CdyQh47h.js → useSseClient-CaD4MVg0.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +36 -36
- package/dist/views/adjustment-template/wastage-template/table.d.ts +36 -36
- package/dist/views/changelog/composables/use-snapshot-diff.d.ts +2 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -6
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +12 -12
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +6 -6
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +3 -3
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +19 -19
- package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +45 -45
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -36
- package/dist/views/import/helper/submit-rows.d.ts +1 -1
- package/dist/views/ingredients/components/inventory-binding/recipe-amount-validation.spec.d.ts +1 -0
- package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +3 -1
- package/dist/views/integration/IntegrationPlatformView.vue.d.ts +24 -0
- package/dist/views/integration/components/IntegrationCard.vue.d.ts +3 -3
- package/dist/views/integration/components/Synergy/importFn.spec.d.ts +1 -0
- package/dist/views/integration/components/Xilnex/importFn.spec.d.ts +1 -0
- package/dist/views/integration/components/netsuite/business/AddLocationDialog.vue.d.ts +36 -36
- package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +24 -24
- package/dist/views/integration/helper/opening-balance.d.ts +22 -0
- package/dist/views/integration/helper/opening-balance.spec.d.ts +1 -0
- package/dist/views/production-run/ProductionRunDetailPage.spec.d.ts +1 -0
- package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → production-run/ProductionRunDetailPage.vue.d.ts} +2 -2
- package/dist/views/production-run/ProductionRunPage.vue.d.ts +2 -0
- package/dist/views/production-run/features/detail/ProductionRunItemsTable.vue.d.ts +2 -2
- package/dist/views/production-run/features/detail/ProductionRunOverviewTab.vue.d.ts +4 -4
- package/dist/views/production-run/features/detail/use-production-run-detail.d.ts +19 -9
- package/dist/views/production-run/features/lifecycle/CancelRunDialog.vue.d.ts +4 -4
- package/dist/views/production-run/features/lifecycle/CloseRunDialog.vue.d.ts +4 -4
- package/dist/views/production-run/features/lifecycle/ProductionRunLifecycleDialogs.vue.d.ts +14 -14
- package/dist/views/production-run/features/lifecycle/TargetReachedDialog.vue.d.ts +4 -4
- package/dist/views/production-run/features/planning/ProductionRunFormDialog.vue.d.ts +4 -4
- package/dist/views/production-run/features/planning/ProductionRunPlanner.vue.d.ts +1 -1
- package/dist/views/production-run/features/planning/use-production-run-duplicate-sources.d.ts +6 -6
- package/dist/views/production-run/shared/helpers/production-run-navigation.d.ts +0 -1
- package/dist/views/production-run/shared/model/production-run-list.d.ts +1 -1
- package/dist/views/production-run/shared/ui/ProductionRunInfoBadge.vue.d.ts +1 -1
- package/dist/views/production-run/shared/ui/ProductionRunInfoText.vue.d.ts +1 -1
- package/dist/views/production-run/shared/ui/ProductionRunScrollHint.vue.d.ts +2 -2
- package/dist/views/production-run/shared/ui/ProductionRunTextarea.vue.d.ts +3 -3
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -5
- package/dist/views/receive-request/composables/netsuite-order-label.d.ts +11 -0
- package/dist/views/receive-request/composables/netsuite-order-label.spec.d.ts +1 -0
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -6
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +48 -48
- package/dist/views/receive-request/composables/use-receive-request-form.spec.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -42
- package/dist/views/receive-request/import/export.spec.d.ts +1 -0
- package/dist/views/receive-request-bulk/BulkReceiveRequestPage.vue.d.ts +2 -0
- package/dist/views/receive-request-bulk/components/CreateTransferWizard.spec.d.ts +1 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +54 -54
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.readiness.spec.d.ts +1 -0
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +8 -8
- package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.spec.d.ts +1 -0
- package/dist/views/recipe/helper/import-recipe.d.ts +30 -0
- package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
- package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +1 -14
- package/dist/views/stock/components/StockRecordCard.spec.d.ts +1 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +19 -865
- package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
- package/dist/views/stock/components/dialog/BillInventoryInfoDialog.spec.d.ts +1 -0
- package/dist/views/stock/components/dialog/BillInventoryInfoDialog.vue.d.ts +36 -0
- package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
- package/dist/views/stock/composables/use-last-closing-summary.d.ts +4 -0
- package/dist/views/stock/composables/use-last-closing-summary.spec.d.ts +1 -0
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +4 -4
- package/dist/views/supplier/composables/use-supplier-table.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -8
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
- package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +24 -24
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -48
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -48
- package/dist/views/transfer-template/helpers/template-item.error.helper.spec.d.ts +1 -0
- package/dist/views/unit/composables/use-unit-form.spec.d.ts +1 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +4 -4
- package/dist/{PlanTierBadge.vue_vue_type_script_setup_true_lang-BSR_nyHY.js → vue-KHCpiw_e.js} +101 -80
- package/dist/{vue-i18n-dSKy66Jh.js → vue-i18n-D6btLtve.js} +513 -513
- package/dist/{xlsx.util-pjzuMquw.js → xlsx.util-Dr5i_LBa.js} +2 -2
- package/package.json +71 -66
- package/dist/BulkReceiveRequestView-Lakk8011.js +0 -2656
- package/dist/FeatureCapabilityGate-C6t1VwKD.js +0 -74
- package/dist/ImportView-DCcdEvy4.js +0 -1291
- package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMDjCk9T.js +0 -72
- package/dist/ProductionRunDetailView-C9rxLBbL.js +0 -2312
- package/dist/ProductionRunView-DvMdVGz1.js +0 -930
- package/dist/RecipeView-ByUaGc4w.js +0 -3428
- package/dist/StockView-B3EjdjVx.js +0 -2615
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
- package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BGPuaJlU.js +0 -299
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-8ydaQEw-.js +0 -4836
- package/dist/TransferTemplateView-BnfALwmw.js +0 -2326
- package/dist/menu-usage-module-BdjYEk3s.js +0 -57
- package/dist/number-5ZeFx-wN.js +0 -138
- package/dist/rules-CinZKpvV.js +0 -98
- package/dist/stock-1n-4iyqz.js +0 -75
- package/dist/views/integration/composables/use-integration-sync-log.d.ts +0 -45
|
@@ -1,3428 +0,0 @@
|
|
|
1
|
-
import { defineComponent as oe, ref as O, onMounted as ct, resolveComponent as P, createElementBlock as V, openBlock as b, Fragment as H, createElementVNode as _, toDisplayString as M, createVNode as x, createCommentVNode as R, h as le, computed as C, watch as de, unref as o, withCtx as Y, createBlock as W, renderList as me, isRef as Pe, mergeProps as Ee, createTextVNode as pt, withModifiers as mt, normalizeClass as Ue, normalizeStyle as ft, Teleport as vt, normalizeProps as yt, guardReactiveProps as bt } from "vue";
|
|
2
|
-
import { a as ee, c as je, S as gt, F as $e, u as Ze, t as _t, v as kt, j as qe } from "./app-Duum3eHx.js";
|
|
3
|
-
import { useDialog as Le, useSnackbar as Oe, components as ye, useProxiedModel as De, useBreakpoints as ht } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as xt, _ as wt, m as Et } from "./menu-usage-module-BdjYEk3s.js";
|
|
5
|
-
import { F as se } from "./form-mode.enum-BKiNVH6A.js";
|
|
6
|
-
import { _ as et, u as $t } from "./FmMultiselectDialog-CC_Na_p1.js";
|
|
7
|
-
import { defineStore as tt, storeToRefs as It } from "pinia";
|
|
8
|
-
import { D as We, R as Ve } from "./row-action.enum-BDDJNSi0.js";
|
|
9
|
-
import { c as Vt } from "./component-BmLAdDiY.js";
|
|
10
|
-
import { a as ae, c as nt } from "./number-5ZeFx-wN.js";
|
|
11
|
-
import { useI18n as ne, useCoreStore as St } from "@feedmepos/mf-common";
|
|
12
|
-
import { u as Ct, _ as Ft } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
13
|
-
import { b as Bt, c as ot, I as Rt, A as Ne, U as it, R as At } from "./rules-CinZKpvV.js";
|
|
14
|
-
import { a as Tt, _ as Mt } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-CqDN355J.js";
|
|
15
|
-
import { a as Ye } from "./FmMultiselectDialog-D0GhmOQ9.js";
|
|
16
|
-
import { d as lt } from "./defineDeepModel-DRC39nJs.js";
|
|
17
|
-
import { L as Pt, P as Ut, D as Dt } from "./app-C39bYJmq.js";
|
|
18
|
-
import { _ as Ce, c as Nt, d as zt, e as be } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-DQlSMRoB.js";
|
|
19
|
-
import { u as jt } from "./vue-i18n-dSKy66Jh.js";
|
|
20
|
-
import { F as Lt, u as Ke } from "./feature-C0hQza5A.js";
|
|
21
|
-
import { _ as Ot } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-CG1m-B2p.js";
|
|
22
|
-
import { F as ke } from "./decimal-Cq0qUT4r.js";
|
|
23
|
-
import { _ as Fe } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6cFB4vX.js";
|
|
24
|
-
import { b as at, d as rt } from "./xlsx.util-pjzuMquw.js";
|
|
25
|
-
import { f as st } from "./date2-DrhO3BxU.js";
|
|
26
|
-
import { _ as Kt, F as Je } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
|
|
27
|
-
import { _ as Gt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_o6pX9i.js";
|
|
28
|
-
const qt = {
|
|
29
|
-
key: 0,
|
|
30
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
31
|
-
}, Wt = { key: 1 }, Yt = { key: 0 }, Jt = /* @__PURE__ */ oe({
|
|
32
|
-
__name: "DeleteDialog",
|
|
33
|
-
props: {
|
|
34
|
-
type: {},
|
|
35
|
-
data: {},
|
|
36
|
-
message: {},
|
|
37
|
-
bindedItems: {}
|
|
38
|
-
},
|
|
39
|
-
setup(m) {
|
|
40
|
-
const d = m, i = O(d.bindedItems || []), e = O(!1);
|
|
41
|
-
ct(() => {
|
|
42
|
-
t();
|
|
43
|
-
});
|
|
44
|
-
async function t() {
|
|
45
|
-
var r, y;
|
|
46
|
-
!e.value && ((r = d.data) != null && r._id) && (e.value = !0, i.value = await ee().getAffectedMenu((y = d.data) == null ? void 0 : y._id), e.value = !1);
|
|
47
|
-
}
|
|
48
|
-
return (r, y) => {
|
|
49
|
-
const v = P("FmSpacer"), s = P("FmCircularProgress");
|
|
50
|
-
return b(), V(H, null, [
|
|
51
|
-
_("p", null, M(r.message), 1),
|
|
52
|
-
e.value ? (b(), V("div", qt, [
|
|
53
|
-
x(v),
|
|
54
|
-
_("div", null, [
|
|
55
|
-
x(s, { size: "xl" })
|
|
56
|
-
]),
|
|
57
|
-
y[0] || (y[0] = _("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
58
|
-
x(v)
|
|
59
|
-
])) : (b(), V("div", Wt, [
|
|
60
|
-
y[2] || (y[2] = _("br", null, null, -1)),
|
|
61
|
-
i.value.length > 0 ? (b(), V("div", Yt, [
|
|
62
|
-
y[1] || (y[1] = _("p", { class: "fm-typo-en-body-lg-600" }, "Affected menu items:", -1)),
|
|
63
|
-
x(et, {
|
|
64
|
-
name: "Menu",
|
|
65
|
-
bindings: i.value
|
|
66
|
-
}, null, 8, ["bindings"])
|
|
67
|
-
])) : R("", !0)
|
|
68
|
-
]))
|
|
69
|
-
], 64);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}), ze = tt("recipeForm", function() {
|
|
73
|
-
const d = Le(), i = Oe(), e = ee(), t = O(!1), r = O();
|
|
74
|
-
function y() {
|
|
75
|
-
const n = {
|
|
76
|
-
recipe: {},
|
|
77
|
-
mode: se.CREATE,
|
|
78
|
-
show: !0,
|
|
79
|
-
"onUpdate:show"(g) {
|
|
80
|
-
r.value.show = g;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
r.value = n;
|
|
84
|
-
}
|
|
85
|
-
async function v(n) {
|
|
86
|
-
const g = {
|
|
87
|
-
recipe: je(n),
|
|
88
|
-
mode: se.UPDATE,
|
|
89
|
-
show: !0,
|
|
90
|
-
"onUpdate:show"(w) {
|
|
91
|
-
r.value.show = w;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
r.value = g;
|
|
95
|
-
}
|
|
96
|
-
async function s(n) {
|
|
97
|
-
t.value = !0;
|
|
98
|
-
try {
|
|
99
|
-
await e.deleteRecipe(n), i.open({
|
|
100
|
-
title: "Success",
|
|
101
|
-
message: `Deleted ${n.name}`,
|
|
102
|
-
type: "success"
|
|
103
|
-
});
|
|
104
|
-
} catch (g) {
|
|
105
|
-
if (g instanceof gt && xt(g)) {
|
|
106
|
-
d.open({
|
|
107
|
-
title: "Cannot delete recipe",
|
|
108
|
-
contentComponent: wt,
|
|
109
|
-
contentComponentProps: {
|
|
110
|
-
subject: (n == null ? void 0 : n.name) ?? "",
|
|
111
|
-
items: g.errorResponse.errors.map((w) => {
|
|
112
|
-
var k;
|
|
113
|
-
return {
|
|
114
|
-
chain: [
|
|
115
|
-
{
|
|
116
|
-
itemName: w.name,
|
|
117
|
-
moduleKey: (k = w.message) != null && k.startsWith("modules.") ? Et(w.message) : w.module
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
};
|
|
121
|
-
})
|
|
122
|
-
},
|
|
123
|
-
secondaryActions: {
|
|
124
|
-
text: "Close",
|
|
125
|
-
close: !0
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
i.open({
|
|
131
|
-
title: `Cannot delete ${n == null ? void 0 : n.name}`,
|
|
132
|
-
message: "Please try again.",
|
|
133
|
-
type: "error"
|
|
134
|
-
}), console.error("failed to delete recipe", g);
|
|
135
|
-
} finally {
|
|
136
|
-
t.value = !1;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function u(n) {
|
|
140
|
-
d.open({
|
|
141
|
-
title: `Delete ${(n == null ? void 0 : n.name) ?? "recipe"}?`,
|
|
142
|
-
closeButton: !1,
|
|
143
|
-
primaryActions: {
|
|
144
|
-
text: "Delete",
|
|
145
|
-
close: !0,
|
|
146
|
-
variant: "destructive"
|
|
147
|
-
},
|
|
148
|
-
secondaryActions: {
|
|
149
|
-
text: "Cancel",
|
|
150
|
-
close: !0
|
|
151
|
-
},
|
|
152
|
-
contentComponent: Jt,
|
|
153
|
-
contentComponentProps: {
|
|
154
|
-
type: "menu",
|
|
155
|
-
data: n,
|
|
156
|
-
message: "You may not be able to delete this recipe if it is linked in any of the inventory modules."
|
|
157
|
-
}
|
|
158
|
-
}).onPrimary(() => s(n));
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
createRecipe: y,
|
|
162
|
-
updateRecipe: v,
|
|
163
|
-
deleteRecipe: u,
|
|
164
|
-
recipeDialogProps: r,
|
|
165
|
-
recipeViewLoading: t
|
|
166
|
-
};
|
|
167
|
-
});
|
|
168
|
-
function Ht() {
|
|
169
|
-
const { updateRecipe: m, deleteRecipe: d } = ze(), i = ee(), { t: e } = ne();
|
|
170
|
-
async function t(n, g) {
|
|
171
|
-
const w = je(g);
|
|
172
|
-
if (n === Ve.Edit) {
|
|
173
|
-
await m(w);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
if (n === Ve.Delete) {
|
|
177
|
-
await d(w);
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
function r(n, g) {
|
|
182
|
-
const w = n.filter((I) => I.type === $e.enum.SKU), k = n.filter((I) => I.type === $e.enum.RECIPE);
|
|
183
|
-
return [
|
|
184
|
-
...w.map((I) => ({ ...I, recipeIds: [...g] })),
|
|
185
|
-
...k.filter((I) => i.recipeById[I.id] && !g.has(I.id)).flatMap(
|
|
186
|
-
(I) => r(i.recipeById[I.id].contains, /* @__PURE__ */ new Set([...g, I.id]))
|
|
187
|
-
)
|
|
188
|
-
];
|
|
189
|
-
}
|
|
190
|
-
const y = [
|
|
191
|
-
{
|
|
192
|
-
accessorKey: "recipe",
|
|
193
|
-
header: () => e("inventory.recipe.name"),
|
|
194
|
-
size: 400
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
accessorKey: "ingredients",
|
|
198
|
-
header: () => e("inventory.recipe.ingredients"),
|
|
199
|
-
size: "auto",
|
|
200
|
-
// accessor keeps the plain text so filtering still matches; the cell only restyles it
|
|
201
|
-
cell: (n) => le(
|
|
202
|
-
"div",
|
|
203
|
-
{ class: "flex flex-col items-start gap-4" },
|
|
204
|
-
n.row.original.bindings.map(
|
|
205
|
-
(g) => le(
|
|
206
|
-
"div",
|
|
207
|
-
{
|
|
208
|
-
class: "flex flex-wrap items-center gap-8 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-md px-8 py-4"
|
|
209
|
-
},
|
|
210
|
-
[
|
|
211
|
-
g.parentRecipe ? le(ye.FmChip, { compact: !0 }, g.parentRecipe) : null,
|
|
212
|
-
g.labels.join(", ")
|
|
213
|
-
]
|
|
214
|
-
)
|
|
215
|
-
)
|
|
216
|
-
)
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
id: "action",
|
|
220
|
-
header: "",
|
|
221
|
-
cell(n) {
|
|
222
|
-
return Vt(
|
|
223
|
-
[We[Ve.Edit], We[Ve.Delete]],
|
|
224
|
-
(g) => {
|
|
225
|
-
t(g, n.row.original.original);
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
},
|
|
229
|
-
enableSorting: !1,
|
|
230
|
-
size: 40,
|
|
231
|
-
meta: {
|
|
232
|
-
cellClass: "",
|
|
233
|
-
headerClass: ""
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
];
|
|
237
|
-
function v(n) {
|
|
238
|
-
const g = ee();
|
|
239
|
-
return r(n.contains, /* @__PURE__ */ new Set([n._id])).map((w) => {
|
|
240
|
-
var c, E, S;
|
|
241
|
-
const k = w.recipeIds.slice(1).length ? ((c = g.recipeById[w.recipeIds.at(-1) ?? ""]) == null ? void 0 : c.name) ?? null : null, I = g.skuById[w.id];
|
|
242
|
-
return I ? {
|
|
243
|
-
parentRecipe: k,
|
|
244
|
-
label: `${I.name} (${ae(w.amount)}${((E = w.measurement) == null ? void 0 : E.abbrev) ?? ((S = I == null ? void 0 : I.unit) == null ? void 0 : S.abbrev)})`
|
|
245
|
-
} : null;
|
|
246
|
-
}).filter((w) => !!w);
|
|
247
|
-
}
|
|
248
|
-
function s(n) {
|
|
249
|
-
const g = [];
|
|
250
|
-
for (const w of n) {
|
|
251
|
-
const k = w.parentRecipe ? g.find((I) => I.parentRecipe === w.parentRecipe) : void 0;
|
|
252
|
-
k ? k.labels.push(w.label) : g.push({ parentRecipe: w.parentRecipe, labels: [w.label] });
|
|
253
|
-
}
|
|
254
|
-
return g;
|
|
255
|
-
}
|
|
256
|
-
function u(n) {
|
|
257
|
-
return n.map((g) => {
|
|
258
|
-
const w = v(g);
|
|
259
|
-
return {
|
|
260
|
-
recipe: g.name,
|
|
261
|
-
ingredients: w.map((k) => k.parentRecipe ? `(${k.parentRecipe}) ${k.label}` : k.label).join(", "),
|
|
262
|
-
bindings: s(w),
|
|
263
|
-
original: g
|
|
264
|
-
};
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
return { columnDefs: y, formatRowData: u };
|
|
268
|
-
}
|
|
269
|
-
function Qt() {
|
|
270
|
-
const m = ee(), d = Le();
|
|
271
|
-
async function i(t, r, y, v = []) {
|
|
272
|
-
var k, I;
|
|
273
|
-
const s = t.filter((c) => c.type === "SKU"), u = t.filter((c) => c.type !== "SKU"), n = /* @__PURE__ */ new Set();
|
|
274
|
-
if (y)
|
|
275
|
-
for (const c of m.skus)
|
|
276
|
-
!v.some((S) => S === c._id) && c._id !== y && !((I = (k = c.convert) == null ? void 0 : k.inventoryBindings) != null && I.some((S) => S.id === y)) || n.add(c._id);
|
|
277
|
-
const g = m.skus.map((c) => ({
|
|
278
|
-
label: c.name,
|
|
279
|
-
sublabel: `${c.code}${n.has(c._id) ? " (Cannot bind, will cause recursive binding)" : ""}`,
|
|
280
|
-
value: c,
|
|
281
|
-
disabled: n.has(c._id)
|
|
282
|
-
})), w = g.filter(
|
|
283
|
-
(c) => s.find((E) => E.id === c.value._id) && !n.has(c.value._id)
|
|
284
|
-
).map((c) => c.value);
|
|
285
|
-
d.open({
|
|
286
|
-
title: "Select ingredients",
|
|
287
|
-
contentComponent: Ye,
|
|
288
|
-
contentComponentProps: {
|
|
289
|
-
items: g,
|
|
290
|
-
modelValue: w,
|
|
291
|
-
virtualScroll: !0
|
|
292
|
-
},
|
|
293
|
-
primaryActions: {
|
|
294
|
-
text: "Confirm",
|
|
295
|
-
close: !0
|
|
296
|
-
},
|
|
297
|
-
secondaryActions: {
|
|
298
|
-
text: "Close",
|
|
299
|
-
close: !0,
|
|
300
|
-
variant: "tertiary"
|
|
301
|
-
}
|
|
302
|
-
}).onPrimary((c) => {
|
|
303
|
-
const E = [
|
|
304
|
-
...u,
|
|
305
|
-
...t.filter((S) => c.find((h) => h._id === S.id)),
|
|
306
|
-
...c.filter((S) => !t.find((h) => h.id === S._id)).map((S) => ({
|
|
307
|
-
type: "SKU",
|
|
308
|
-
id: S._id,
|
|
309
|
-
amount: {
|
|
310
|
-
amount: 1,
|
|
311
|
-
precision: 0
|
|
312
|
-
}
|
|
313
|
-
}))
|
|
314
|
-
];
|
|
315
|
-
r(E);
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
async function e(t, r, y = []) {
|
|
319
|
-
var w;
|
|
320
|
-
const v = t.filter((k) => k.type === "RECIPE"), s = t.filter((k) => k.type !== "RECIPE"), u = /* @__PURE__ */ new Set();
|
|
321
|
-
if (y.length)
|
|
322
|
-
for (const k of m.recipes) {
|
|
323
|
-
const I = ((w = m.recipeBindingFlattenCache[k._id]) == null ? void 0 : w.inventoryBindings) ?? [], c = I.some(
|
|
324
|
-
(h) => h.bindingPaths.some((l) => y.some((f) => f === l.id))
|
|
325
|
-
), E = I.some(
|
|
326
|
-
(h) => "success" in h && y.includes(h.ingredient._id)
|
|
327
|
-
);
|
|
328
|
-
(y.some((h) => h === k._id) || c || E) && u.add(k._id);
|
|
329
|
-
}
|
|
330
|
-
const n = m.recipes.filter((k) => !y.includes(k._id)).map((k) => ({
|
|
331
|
-
label: k.name,
|
|
332
|
-
sublabel: u.has(k._id) ? "(Cannot bind, will cause recursive binding)" : `${k.contains.length} inventory bindings`,
|
|
333
|
-
value: k,
|
|
334
|
-
disabled: u.has(k._id)
|
|
335
|
-
})), g = n.filter(
|
|
336
|
-
(k) => v.find((I) => I.id === k.value._id) && !u.has(k.value._id)
|
|
337
|
-
).map((k) => k.value);
|
|
338
|
-
d.open({
|
|
339
|
-
title: "Select recipes",
|
|
340
|
-
contentComponent: Ye,
|
|
341
|
-
contentComponentProps: {
|
|
342
|
-
items: n,
|
|
343
|
-
modelValue: g,
|
|
344
|
-
virtualScroll: !0
|
|
345
|
-
},
|
|
346
|
-
primaryActions: {
|
|
347
|
-
text: "Confirm",
|
|
348
|
-
close: !0
|
|
349
|
-
},
|
|
350
|
-
secondaryActions: {
|
|
351
|
-
text: "Close",
|
|
352
|
-
close: !0,
|
|
353
|
-
variant: "tertiary"
|
|
354
|
-
}
|
|
355
|
-
}).onPrimary((k) => {
|
|
356
|
-
const I = [
|
|
357
|
-
...t.filter((c) => k.find((E) => E._id === c.id)),
|
|
358
|
-
...k.filter((c) => !t.find((E) => E.id === c._id)).map((c) => ({
|
|
359
|
-
type: "RECIPE",
|
|
360
|
-
id: c._id,
|
|
361
|
-
amount: {
|
|
362
|
-
amount: 1,
|
|
363
|
-
precision: 0
|
|
364
|
-
}
|
|
365
|
-
})),
|
|
366
|
-
...s
|
|
367
|
-
];
|
|
368
|
-
r(I);
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
return {
|
|
372
|
-
promptIngredientsBinding: i,
|
|
373
|
-
promptRecipesBinding: e
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
const Xt = { class: "flex flex-col" }, Zt = { class: "flex flex-col gap-4" }, Be = /* @__PURE__ */ oe({
|
|
377
|
-
__name: "InventoryBindingRule",
|
|
378
|
-
props: {
|
|
379
|
-
disabled: { type: Boolean },
|
|
380
|
-
modelValue: {},
|
|
381
|
-
minCount: {},
|
|
382
|
-
maxCount: {}
|
|
383
|
-
},
|
|
384
|
-
emits: ["update:modelValue"],
|
|
385
|
-
setup(m, { emit: d }) {
|
|
386
|
-
const i = m, e = d, { t } = ne(), r = St(), y = Ze(), v = C(() => {
|
|
387
|
-
var I;
|
|
388
|
-
const w = /* @__PURE__ */ new Map(), k = r.restaurants.value.map((c) => c.customAttributes ?? {});
|
|
389
|
-
for (const c of k)
|
|
390
|
-
for (const [E, S] of Object.entries(c))
|
|
391
|
-
w.has(E) || w.set(E, /* @__PURE__ */ new Set()), S && ((I = w.get(E)) == null || I.add(S));
|
|
392
|
-
return w;
|
|
393
|
-
}), s = C(
|
|
394
|
-
() => r.restaurants.value.filter((w) => {
|
|
395
|
-
var k;
|
|
396
|
-
return (k = w.profile) == null ? void 0 : k.code;
|
|
397
|
-
}).map((w) => ({ value: w.profile.code, label: `${w.profile.name} (${w.profile.code})` }))
|
|
398
|
-
), u = C(() => [
|
|
399
|
-
...[...v.value.entries()].map(([k, I]) => ({
|
|
400
|
-
type: "string",
|
|
401
|
-
key: k,
|
|
402
|
-
entity: "restaurant",
|
|
403
|
-
values: [...I]
|
|
404
|
-
})),
|
|
405
|
-
{
|
|
406
|
-
type: "string",
|
|
407
|
-
key: "state",
|
|
408
|
-
entity: "restaurant",
|
|
409
|
-
values: [
|
|
410
|
-
...new Set(y.locations.map((k) => k.doc.profile.address.state).filter(Boolean))
|
|
411
|
-
]
|
|
412
|
-
},
|
|
413
|
-
...s.value.length > 0 ? [
|
|
414
|
-
{
|
|
415
|
-
type: "string",
|
|
416
|
-
key: "outlet",
|
|
417
|
-
entity: "restaurant",
|
|
418
|
-
options: s.value
|
|
419
|
-
}
|
|
420
|
-
] : []
|
|
421
|
-
]), n = O(null);
|
|
422
|
-
let g = null;
|
|
423
|
-
return de(
|
|
424
|
-
() => i.modelValue,
|
|
425
|
-
(w) => {
|
|
426
|
-
JSON.stringify(w) !== JSON.stringify(g) && (n.value = w ? Pt.build(w) : null);
|
|
427
|
-
},
|
|
428
|
-
{ immediate: !0 }
|
|
429
|
-
), de(
|
|
430
|
-
n,
|
|
431
|
-
(w) => {
|
|
432
|
-
g = w ? Ut.build(w) : null, e("update:modelValue", g);
|
|
433
|
-
},
|
|
434
|
-
{ deep: !0 }
|
|
435
|
-
), (w, k) => {
|
|
436
|
-
const I = P("FmLabel"), c = P("FmFormGroup");
|
|
437
|
-
return b(), V("div", Xt, [
|
|
438
|
-
_("div", Zt, [
|
|
439
|
-
x(I, {
|
|
440
|
-
label: o(t)("inventory.ingredientGroup.form.rules.title"),
|
|
441
|
-
required: w.minCount != null && w.minCount > 0
|
|
442
|
-
}, null, 8, ["label", "required"]),
|
|
443
|
-
x(o(Dt), {
|
|
444
|
-
modelValue: n.value,
|
|
445
|
-
"onUpdate:modelValue": k[0] || (k[0] = (E) => n.value = E),
|
|
446
|
-
attributes: u.value
|
|
447
|
-
}, null, 8, ["modelValue", "attributes"])
|
|
448
|
-
]),
|
|
449
|
-
x(c, {
|
|
450
|
-
"model-value": n.value,
|
|
451
|
-
rules: [
|
|
452
|
-
(E) => {
|
|
453
|
-
const S = E ? 1 : 0;
|
|
454
|
-
return i.minCount !== void 0 && S < i.minCount ? o(t)("inventory.ingredientGroup.form.rules.validation.minCount", {
|
|
455
|
-
count: i.minCount
|
|
456
|
-
}) : i.maxCount !== void 0 && S > i.maxCount ? o(t)("inventory.ingredientGroup.form.rules.validation.maxCount", {
|
|
457
|
-
count: i.maxCount
|
|
458
|
-
}) : !0;
|
|
459
|
-
}
|
|
460
|
-
]
|
|
461
|
-
}, null, 8, ["model-value", "rules"])
|
|
462
|
-
]);
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
}), en = { class: "border-1 mx-3 my-1 rounded-md" }, tn = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, nn = {
|
|
466
|
-
class: "flex items-center",
|
|
467
|
-
style: { "min-height": "48px" }
|
|
468
|
-
}, on = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, ln = { class: "line-clamp-1" }, an = { class: "w-[200px]" }, rn = {
|
|
469
|
-
key: 0,
|
|
470
|
-
class: "w-[52px]"
|
|
471
|
-
}, sn = {
|
|
472
|
-
key: 0,
|
|
473
|
-
class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-8"
|
|
474
|
-
}, dn = { class: "px-12 pb-4" }, un = /* @__PURE__ */ oe({
|
|
475
|
-
__name: "InventoryRecipeBindingV2Field",
|
|
476
|
-
props: {
|
|
477
|
-
disabled: { type: Boolean },
|
|
478
|
-
readonly: { type: Boolean },
|
|
479
|
-
modelValue: {},
|
|
480
|
-
displayName: {},
|
|
481
|
-
showError: { type: Boolean },
|
|
482
|
-
allowRecipeDecimal: { type: Boolean }
|
|
483
|
-
},
|
|
484
|
-
emits: ["update:modelValue", "delete", "settings"],
|
|
485
|
-
setup(m, { emit: d }) {
|
|
486
|
-
const i = d, { t: e } = ne(), t = lt("modelValue"), r = O(ae(t.amount)), y = C(() => +r.value);
|
|
487
|
-
de(
|
|
488
|
-
() => t.amount,
|
|
489
|
-
(u) => {
|
|
490
|
-
const n = ae(u);
|
|
491
|
-
+r.value != +n && (r.value = n);
|
|
492
|
-
}
|
|
493
|
-
);
|
|
494
|
-
let v = null;
|
|
495
|
-
function s(u) {
|
|
496
|
-
r.value = u, v && clearTimeout(v), v = setTimeout(() => {
|
|
497
|
-
const n = +u;
|
|
498
|
-
u.length > 0 && isFinite(n) ? t.amount = nt(n) : t.amount = { amount: 0, precision: 0 };
|
|
499
|
-
}, 300);
|
|
500
|
-
}
|
|
501
|
-
return (u, n) => {
|
|
502
|
-
const g = P("FmTooltip"), w = P("FmTextField"), k = P("FmFormGroup"), I = P("FmButton"), c = P("FmIcon");
|
|
503
|
-
return b(), V("div", en, [
|
|
504
|
-
_("div", tn, [
|
|
505
|
-
_("div", nn, [
|
|
506
|
-
_("div", on, [
|
|
507
|
-
x(g, {
|
|
508
|
-
zIndex: 51,
|
|
509
|
-
variant: "plain",
|
|
510
|
-
placement: "top",
|
|
511
|
-
content: u.displayName
|
|
512
|
-
}, {
|
|
513
|
-
default: Y(() => [
|
|
514
|
-
_("span", ln, M(u.displayName), 1)
|
|
515
|
-
]),
|
|
516
|
-
_: 1
|
|
517
|
-
}, 8, ["content"])
|
|
518
|
-
]),
|
|
519
|
-
_("div", an, [
|
|
520
|
-
x(k, {
|
|
521
|
-
disabled: u.disabled,
|
|
522
|
-
modelValue: y.value,
|
|
523
|
-
rules: [o(Bt)(u.allowRecipeDecimal ? 5 : 0), o(ot)(-1)]
|
|
524
|
-
}, {
|
|
525
|
-
default: Y(({ invalid: E }) => [
|
|
526
|
-
x(w, {
|
|
527
|
-
class: "w-full",
|
|
528
|
-
disabled: u.disabled,
|
|
529
|
-
modelValue: r.value,
|
|
530
|
-
"onUpdate:modelValue": n[0] || (n[0] = (S) => s(S)),
|
|
531
|
-
invalid: E
|
|
532
|
-
}, null, 8, ["disabled", "modelValue", "invalid"])
|
|
533
|
-
]),
|
|
534
|
-
_: 1
|
|
535
|
-
}, 8, ["disabled", "modelValue", "rules"])
|
|
536
|
-
]),
|
|
537
|
-
u.readonly ? R("", !0) : (b(), V("div", rn, [
|
|
538
|
-
x(I, {
|
|
539
|
-
disabled: u.disabled,
|
|
540
|
-
type: "button",
|
|
541
|
-
variant: "plain",
|
|
542
|
-
icon: "delete",
|
|
543
|
-
"icon-color": "#000000",
|
|
544
|
-
onClick: n[1] || (n[1] = () => i("delete", o(t).id))
|
|
545
|
-
}, null, 8, ["disabled"])
|
|
546
|
-
]))
|
|
547
|
-
]),
|
|
548
|
-
x(Tt, {
|
|
549
|
-
"recipe-id": o(t).id,
|
|
550
|
-
multiplier: r.value
|
|
551
|
-
}, null, 8, ["recipe-id", "multiplier"]),
|
|
552
|
-
u.showError ? (b(), V("div", sn, [
|
|
553
|
-
x(c, {
|
|
554
|
-
name: "error",
|
|
555
|
-
color: "system-error-300",
|
|
556
|
-
size: "sm"
|
|
557
|
-
}),
|
|
558
|
-
_("div", null, M(o(e)("inventory.inventoryBindings.circularError")), 1)
|
|
559
|
-
])) : R("", !0)
|
|
560
|
-
]),
|
|
561
|
-
_("div", dn, [
|
|
562
|
-
x(Be, {
|
|
563
|
-
modelValue: o(t).rules,
|
|
564
|
-
"onUpdate:modelValue": n[2] || (n[2] = (E) => o(t).rules = E),
|
|
565
|
-
disabled: u.disabled
|
|
566
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
567
|
-
])
|
|
568
|
-
]);
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
function cn(m) {
|
|
573
|
-
const d = $t(), { t: i } = jt(), e = ee(), t = C(() => [
|
|
574
|
-
{
|
|
575
|
-
id: "delete",
|
|
576
|
-
header: "",
|
|
577
|
-
cell(v) {
|
|
578
|
-
const s = v.row.original;
|
|
579
|
-
return le(
|
|
580
|
-
"div",
|
|
581
|
-
{ class: "w-full flex justify-end" },
|
|
582
|
-
le(ye.FmButton, {
|
|
583
|
-
class: "delete-button",
|
|
584
|
-
key: s._id,
|
|
585
|
-
type: "button",
|
|
586
|
-
icon: "delete",
|
|
587
|
-
variant: "tertiary",
|
|
588
|
-
size: "md",
|
|
589
|
-
disabled: m.disabled ?? !1,
|
|
590
|
-
onClick: () => {
|
|
591
|
-
m.bindingAlternatives = m.bindingAlternatives.filter(
|
|
592
|
-
(u) => u._id !== s._id
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
})
|
|
596
|
-
);
|
|
597
|
-
},
|
|
598
|
-
enableSorting: !1,
|
|
599
|
-
size: 40,
|
|
600
|
-
meta: {
|
|
601
|
-
cellClass: "",
|
|
602
|
-
headerClass: ""
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
{
|
|
606
|
-
id: "alternative",
|
|
607
|
-
header: () => i("inventory.inventoryBindings.alternativeTable.ingredient"),
|
|
608
|
-
accessorFn: (v) => {
|
|
609
|
-
var s, u;
|
|
610
|
-
return `${((s = e.skuById[v._id]) == null ? void 0 : s.name) ?? ""} (${((u = e.skuById[v._id]) == null ? void 0 : u.code) ?? ""})`;
|
|
611
|
-
},
|
|
612
|
-
cell: ({ row: v }) => {
|
|
613
|
-
const s = e.skuById[v.original._id];
|
|
614
|
-
return le(
|
|
615
|
-
"div",
|
|
616
|
-
{
|
|
617
|
-
class: "w-full flex flex-col"
|
|
618
|
-
},
|
|
619
|
-
[
|
|
620
|
-
le("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, s.name),
|
|
621
|
-
le(
|
|
622
|
-
"div",
|
|
623
|
-
{ class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
|
|
624
|
-
s.code
|
|
625
|
-
)
|
|
626
|
-
]
|
|
627
|
-
);
|
|
628
|
-
},
|
|
629
|
-
size: "auto",
|
|
630
|
-
enableSorting: !1
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
id: "unit",
|
|
634
|
-
header: () => i("inventory.inventoryBindings.alternativeTable.unit"),
|
|
635
|
-
accessorFn: (v) => {
|
|
636
|
-
const s = e.skuById[v._id];
|
|
637
|
-
return s.unit.measurements.computeFirst(
|
|
638
|
-
(u) => u.id === v.trackingMeasurement ? u.name : null
|
|
639
|
-
) ?? s.unit.name;
|
|
640
|
-
},
|
|
641
|
-
enableSorting: !1
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
id: "unitOption",
|
|
645
|
-
header: () => i("inventory.inventoryBindings.alternativeTable.unit"),
|
|
646
|
-
accessorKey: "trackingMeasurement",
|
|
647
|
-
cell(v) {
|
|
648
|
-
const s = e.skuById[v.row.original._id];
|
|
649
|
-
if (!s) return null;
|
|
650
|
-
const u = [
|
|
651
|
-
{
|
|
652
|
-
label: s.unit.name,
|
|
653
|
-
sublabel: s.unit.abbrev,
|
|
654
|
-
value: null
|
|
655
|
-
},
|
|
656
|
-
...s.unit.measurements.map((n) => ({
|
|
657
|
-
label: `${n.name} (${n.abbrev})`,
|
|
658
|
-
sublabel: i("inventory.inventoryBindings.alternativeTable.measurementOption"),
|
|
659
|
-
value: n.id
|
|
660
|
-
}))
|
|
661
|
-
].filter((n) => !n.label.toLowerCase().includes("inactive"));
|
|
662
|
-
return le(ye.FmSelect, {
|
|
663
|
-
modelValue: v.row.original.trackingMeasurement ?? null,
|
|
664
|
-
items: u,
|
|
665
|
-
disabled: m.disabled ?? !1,
|
|
666
|
-
"onUpdate:modelValue": (n) => {
|
|
667
|
-
m.bindingAlternatives = m.bindingAlternatives.map((g) => g._id === v.row.original._id ? { ...g, trackingMeasurement: n } : g);
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
},
|
|
671
|
-
enableSorting: !1
|
|
672
|
-
},
|
|
673
|
-
{
|
|
674
|
-
id: "priority",
|
|
675
|
-
header: () => i("inventory.inventoryBindings.alternativeTable.priority"),
|
|
676
|
-
accessorKey: "priority",
|
|
677
|
-
enableSorting: !0,
|
|
678
|
-
cell(v) {
|
|
679
|
-
const s = v.row.original;
|
|
680
|
-
return le(ye.FmTextField, {
|
|
681
|
-
modelValue: s.priority ?? v.row.index + 1,
|
|
682
|
-
rules: [
|
|
683
|
-
Rt(),
|
|
684
|
-
Ne(1),
|
|
685
|
-
it(
|
|
686
|
-
m.bindingAlternatives.filter((u) => u._id !== s._id).map((u) => {
|
|
687
|
-
const n = e.skuById[u._id];
|
|
688
|
-
return {
|
|
689
|
-
label: n == null ? void 0 : n.name,
|
|
690
|
-
value: u.priority
|
|
691
|
-
};
|
|
692
|
-
})
|
|
693
|
-
)
|
|
694
|
-
],
|
|
695
|
-
"onUpdate:modelValue": (u) => {
|
|
696
|
-
const n = Number(u);
|
|
697
|
-
isNaN(n) || (m.bindingAlternatives = m.bindingAlternatives.map((g) => g._id === v.row.original._id ? { ...g, priority: n } : g));
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
{
|
|
703
|
-
id: "default",
|
|
704
|
-
header: () => "",
|
|
705
|
-
accessorKey: "default",
|
|
706
|
-
cell(v) {
|
|
707
|
-
const s = e.skuById[v.row.original._id];
|
|
708
|
-
return s ? le(ye.FmCheckbox, {
|
|
709
|
-
modelValue: v.row.original.default ?? !1,
|
|
710
|
-
value: s._id,
|
|
711
|
-
disabled: m.disabled ?? !1,
|
|
712
|
-
"onUpdate:modelValue": () => {
|
|
713
|
-
m.bindingAlternatives = m.bindingAlternatives.map((u) => u._id === v.row.original._id ? { ...u, default: !0 } : { ...u, default: !1 });
|
|
714
|
-
}
|
|
715
|
-
}) : null;
|
|
716
|
-
},
|
|
717
|
-
enableSorting: !1,
|
|
718
|
-
size: 40,
|
|
719
|
-
meta: {
|
|
720
|
-
cellClass: "",
|
|
721
|
-
headerClass: ""
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
{
|
|
725
|
-
id: "move",
|
|
726
|
-
header: "",
|
|
727
|
-
cell(v) {
|
|
728
|
-
const s = v.row.original;
|
|
729
|
-
return le("div", { class: "w-full flex justify-end" }, [
|
|
730
|
-
le(ye.FmButton, {
|
|
731
|
-
key: s._id,
|
|
732
|
-
type: "button",
|
|
733
|
-
icon: "keyboard_arrow_up",
|
|
734
|
-
variant: "tertiary",
|
|
735
|
-
size: "md",
|
|
736
|
-
disabled: m.disabled ?? !1,
|
|
737
|
-
onClick: () => {
|
|
738
|
-
const u = [...m.bindingAlternatives], n = u.findIndex((g) => g._id === s._id);
|
|
739
|
-
if (n > 0) {
|
|
740
|
-
const g = u[n - 1];
|
|
741
|
-
u[n - 1] = s, u[n] = g;
|
|
742
|
-
}
|
|
743
|
-
m.bindingAlternatives = [...u];
|
|
744
|
-
}
|
|
745
|
-
}),
|
|
746
|
-
le(ye.FmButton, {
|
|
747
|
-
key: s._id,
|
|
748
|
-
type: "button",
|
|
749
|
-
icon: "keyboard_arrow_down",
|
|
750
|
-
variant: "tertiary",
|
|
751
|
-
size: "md",
|
|
752
|
-
disabled: m.disabled ?? !1,
|
|
753
|
-
onClick: () => {
|
|
754
|
-
const u = [...m.bindingAlternatives], n = u.findIndex((g) => g._id === s._id);
|
|
755
|
-
if (n < u.length - 1) {
|
|
756
|
-
const g = u[n + 1];
|
|
757
|
-
u[n + 1] = s, u[n] = g;
|
|
758
|
-
}
|
|
759
|
-
m.bindingAlternatives = [...u];
|
|
760
|
-
}
|
|
761
|
-
})
|
|
762
|
-
]);
|
|
763
|
-
},
|
|
764
|
-
enableSorting: !1,
|
|
765
|
-
size: 40,
|
|
766
|
-
meta: {
|
|
767
|
-
cellClass: "",
|
|
768
|
-
headerClass: ""
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
]);
|
|
772
|
-
return {
|
|
773
|
-
get columnDefs() {
|
|
774
|
-
return t.value;
|
|
775
|
-
},
|
|
776
|
-
promptAddIngredient: async (y) => {
|
|
777
|
-
const v = [];
|
|
778
|
-
for (const n of e.skus)
|
|
779
|
-
y.includes(n._id) || v.push({
|
|
780
|
-
label: n.name,
|
|
781
|
-
sublabel: n.code,
|
|
782
|
-
value: n._id,
|
|
783
|
-
disabled: y.includes(n._id)
|
|
784
|
-
});
|
|
785
|
-
const s = (m.bindingAlternatives ?? []).map((n) => n._id), u = await d.multiSelect(v, s, (n) => {
|
|
786
|
-
var w, k, I, c, E, S;
|
|
787
|
-
const g = (w = m.bindingAlternatives) == null ? void 0 : w.findIndex((h) => h._id === n);
|
|
788
|
-
return {
|
|
789
|
-
_id: n,
|
|
790
|
-
trackingMeasurement: typeof g != "number" || g == -1 ? (k = e.skuById[n]) == null ? void 0 : k.trackingMeasurement : (c = (I = m.bindingAlternatives) == null ? void 0 : I[g]) == null ? void 0 : c.trackingMeasurement,
|
|
791
|
-
priority: ((S = (E = m.bindingAlternatives) == null ? void 0 : E[g]) == null ? void 0 : S.priority) ?? m.bindingAlternatives.length,
|
|
792
|
-
default: !1
|
|
793
|
-
};
|
|
794
|
-
});
|
|
795
|
-
m.bindingAlternatives = u ?? m.bindingAlternatives;
|
|
796
|
-
},
|
|
797
|
-
columnVisibility: {
|
|
798
|
-
delete: !0,
|
|
799
|
-
unit: !1,
|
|
800
|
-
unitOption: !0,
|
|
801
|
-
default: !1,
|
|
802
|
-
// previous demo: sort priority by moving sku element in the array,
|
|
803
|
-
// new demo: sort priority using priority field.
|
|
804
|
-
// can reenable if this use case is requested to be restored
|
|
805
|
-
move: !1
|
|
806
|
-
}
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
const pn = { class: "flex flex-col gap-16" }, mn = { class: "flex flex-col" }, fn = { class: "flex justify-between items-center px-2" }, Se = /* @__PURE__ */ oe({
|
|
810
|
-
__name: "InventoryBindingAlternative",
|
|
811
|
-
props: {
|
|
812
|
-
disabled: { type: Boolean },
|
|
813
|
-
modelValue: {},
|
|
814
|
-
filterIngredientIds: {}
|
|
815
|
-
},
|
|
816
|
-
emits: ["update:modelValue"],
|
|
817
|
-
setup(m, { emit: d }) {
|
|
818
|
-
const i = m, e = d, { t } = ne(), r = cn({
|
|
819
|
-
get disabled() {
|
|
820
|
-
return i.disabled ?? !1;
|
|
821
|
-
},
|
|
822
|
-
get bindingAlternatives() {
|
|
823
|
-
return i.modelValue ?? [];
|
|
824
|
-
},
|
|
825
|
-
set bindingAlternatives(s) {
|
|
826
|
-
e("update:modelValue", s);
|
|
827
|
-
}
|
|
828
|
-
}), y = (s) => s && s.some((u) => i.filterIngredientIds.includes(u._id)) ? "Contains invalid ingredient" : !0, v = (s) => s && s.length > 5 ? t("inventory.binding.alternative.maximumExceeded", { max: 5 }) : !0;
|
|
829
|
-
return (s, u) => {
|
|
830
|
-
var I;
|
|
831
|
-
const n = P("FmLabel"), g = P("FmButton"), w = P("FmFormGroup"), k = P("FmTable");
|
|
832
|
-
return b(), V("div", pn, [
|
|
833
|
-
_("div", mn, [
|
|
834
|
-
_("div", fn, [
|
|
835
|
-
x(n, {
|
|
836
|
-
label: o(t)("inventory.alternatives")
|
|
837
|
-
}, null, 8, ["label"]),
|
|
838
|
-
x(g, {
|
|
839
|
-
disabled: s.disabled,
|
|
840
|
-
"prepend-icon": "link",
|
|
841
|
-
variant: "primary",
|
|
842
|
-
class: "border-1 rounded-lg border-fm-color-primary",
|
|
843
|
-
onClick: u[0] || (u[0] = (c) => o(r).promptAddIngredient(s.filterIngredientIds)),
|
|
844
|
-
size: "md"
|
|
845
|
-
}, null, 8, ["disabled"])
|
|
846
|
-
]),
|
|
847
|
-
x(w, {
|
|
848
|
-
"model-value": s.modelValue,
|
|
849
|
-
rules: [y, v]
|
|
850
|
-
}, null, 8, ["model-value", "rules"])
|
|
851
|
-
]),
|
|
852
|
-
x(k, {
|
|
853
|
-
"row-data": s.modelValue ?? [],
|
|
854
|
-
"column-defs": o(r).columnDefs,
|
|
855
|
-
"page-size": ((I = s.modelValue) == null ? void 0 : I.length) || 0,
|
|
856
|
-
"shrink-at": 9999,
|
|
857
|
-
"column-visibility": o(r).columnVisibility,
|
|
858
|
-
"hide-footer": ""
|
|
859
|
-
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
860
|
-
]);
|
|
861
|
-
};
|
|
862
|
-
}
|
|
863
|
-
}), vn = { class: "border-1 mx-3 my-1 rounded-md" }, yn = { class: "flex flex-col border-b border-fm-color-neutral-gray-100" }, bn = {
|
|
864
|
-
class: "flex items-center w-full",
|
|
865
|
-
style: { "min-height": "48px" }
|
|
866
|
-
}, gn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, _n = { class: "line-clamp-1 w-full" }, kn = { class: "w-[150px]" }, hn = {
|
|
867
|
-
key: 0,
|
|
868
|
-
class: "w-[52px]"
|
|
869
|
-
}, xn = { class: "flex flex-col px-12 pb-4" }, wn = /* @__PURE__ */ oe({
|
|
870
|
-
__name: "InventorySkuBindingV2Field",
|
|
871
|
-
props: {
|
|
872
|
-
disabled: { type: Boolean },
|
|
873
|
-
readonly: { type: Boolean },
|
|
874
|
-
modelValue: {},
|
|
875
|
-
displayName: {},
|
|
876
|
-
unit: {},
|
|
877
|
-
showError: { type: Boolean },
|
|
878
|
-
ableToConfigureAlternative: { type: Boolean },
|
|
879
|
-
ableToApplyRules: { type: Boolean }
|
|
880
|
-
},
|
|
881
|
-
emits: ["update:modelValue", "delete", "settings"],
|
|
882
|
-
setup(m, { emit: d }) {
|
|
883
|
-
const i = d, { t: e } = ne(), t = lt("modelValue");
|
|
884
|
-
function r(v) {
|
|
885
|
-
v && (t.amount = v.amount, t.measurement = v.measurement);
|
|
886
|
-
}
|
|
887
|
-
function y() {
|
|
888
|
-
return {
|
|
889
|
-
modelValue: {
|
|
890
|
-
amount: t.amount,
|
|
891
|
-
measurement: t.measurement
|
|
892
|
-
},
|
|
893
|
-
amountAsString: Lt.toFormatString({
|
|
894
|
-
value: t.amount
|
|
895
|
-
})
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
|
-
return (v, s) => {
|
|
899
|
-
const u = P("FmTooltip"), n = P("FmButton"), g = P("FmFormGroup");
|
|
900
|
-
return b(), V("div", vn, [
|
|
901
|
-
_("div", yn, [
|
|
902
|
-
_("div", bn, [
|
|
903
|
-
_("div", gn, [
|
|
904
|
-
x(u, {
|
|
905
|
-
zIndex: 51,
|
|
906
|
-
variant: "plain",
|
|
907
|
-
placement: "top",
|
|
908
|
-
content: v.displayName
|
|
909
|
-
}, {
|
|
910
|
-
default: Y(() => [
|
|
911
|
-
_("span", _n, M(v.displayName), 1)
|
|
912
|
-
]),
|
|
913
|
-
_: 1
|
|
914
|
-
}, 8, ["content"])
|
|
915
|
-
]),
|
|
916
|
-
_("div", kn, [
|
|
917
|
-
x(Ce, {
|
|
918
|
-
"model-value": { amount: o(t).amount, measurement: o(t).measurement },
|
|
919
|
-
"onUpdate:modelValue": r,
|
|
920
|
-
unit: v.unit,
|
|
921
|
-
placement: "bottom",
|
|
922
|
-
"convert-amount-on-change-unit": "",
|
|
923
|
-
disabled: v.readonly
|
|
924
|
-
}, null, 8, ["model-value", "unit", "disabled"])
|
|
925
|
-
]),
|
|
926
|
-
v.readonly ? R("", !0) : (b(), V("div", hn, [
|
|
927
|
-
x(n, {
|
|
928
|
-
disabled: v.disabled,
|
|
929
|
-
type: "button",
|
|
930
|
-
variant: "tertiary",
|
|
931
|
-
icon: "delete",
|
|
932
|
-
onClick: s[0] || (s[0] = () => i("delete", o(t).id))
|
|
933
|
-
}, null, 8, ["disabled"])
|
|
934
|
-
]))
|
|
935
|
-
]),
|
|
936
|
-
_("div", xn, [
|
|
937
|
-
x(g, {
|
|
938
|
-
modelValue: o(t).amount,
|
|
939
|
-
rules: [o(ot)(0)]
|
|
940
|
-
}, null, 8, ["modelValue", "rules"]),
|
|
941
|
-
x(g, {
|
|
942
|
-
modelValue: y(),
|
|
943
|
-
rules: [
|
|
944
|
-
o(Nt)(),
|
|
945
|
-
o(zt)(v.unit),
|
|
946
|
-
() => v.showError ? o(e)("inventory.inventoryBindings.invalidWarning") : !0
|
|
947
|
-
]
|
|
948
|
-
}, null, 8, ["modelValue", "rules"])
|
|
949
|
-
]),
|
|
950
|
-
v.ableToApplyRules ? (b(), W(Be, {
|
|
951
|
-
key: 0,
|
|
952
|
-
modelValue: o(t).rules,
|
|
953
|
-
"onUpdate:modelValue": s[1] || (s[1] = (w) => o(t).rules = w),
|
|
954
|
-
disabled: v.disabled
|
|
955
|
-
}, null, 8, ["modelValue", "disabled"])) : R("", !0),
|
|
956
|
-
v.ableToConfigureAlternative ? (b(), W(Se, {
|
|
957
|
-
key: 1,
|
|
958
|
-
modelValue: o(t).alternatives,
|
|
959
|
-
"onUpdate:modelValue": s[2] || (s[2] = (w) => o(t).alternatives = w),
|
|
960
|
-
disabled: v.disabled,
|
|
961
|
-
filterIngredientIds: [o(t).id]
|
|
962
|
-
}, null, 8, ["modelValue", "disabled", "filterIngredientIds"])) : R("", !0)
|
|
963
|
-
])
|
|
964
|
-
]);
|
|
965
|
-
};
|
|
966
|
-
}
|
|
967
|
-
});
|
|
968
|
-
exports.FfCalculator;
|
|
969
|
-
const En = { class: "flex flex-col gap-24" }, $n = {
|
|
970
|
-
key: 0,
|
|
971
|
-
class: "flex flex-col gap-16"
|
|
972
|
-
}, In = { class: "flex items-center" }, Vn = { class: "flex-1 fm-typo-en-title-sm-600" }, Sn = { class: "flex flex-col" }, Cn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, Fn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Bn = {
|
|
973
|
-
key: 0,
|
|
974
|
-
class: "w-[52px]"
|
|
975
|
-
}, Rn = {
|
|
976
|
-
key: 1,
|
|
977
|
-
class: "w-[52px]"
|
|
978
|
-
}, An = { class: "flex flex-col gap-16" }, Tn = { class: "flex items-center" }, Mn = { class: "flex-1 fm-typo-en-title-sm-600" }, Pn = { class: "flex flex-col" }, Un = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, Dn = { class: "flex-1 fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Nn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary w-[150px] px-16" }, zn = {
|
|
979
|
-
key: 0,
|
|
980
|
-
class: "w-[52px]"
|
|
981
|
-
}, jn = {
|
|
982
|
-
key: 0,
|
|
983
|
-
class: "flex flex-col border-b border-fm-color-neutral-gray-100"
|
|
984
|
-
}, Ln = {
|
|
985
|
-
class: "flex items-center w-full",
|
|
986
|
-
style: { "min-height": "48px" }
|
|
987
|
-
}, On = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12 text-fm-color-typo-secondary line-clamp-1" }, Kn = {
|
|
988
|
-
key: 0,
|
|
989
|
-
class: "w-[52px]"
|
|
990
|
-
}, Gn = { class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-12 pb-4" }, qn = /* @__PURE__ */ oe({
|
|
991
|
-
__name: "InventoryBindingFormV2",
|
|
992
|
-
props: {
|
|
993
|
-
id: {},
|
|
994
|
-
modelValue: { default: () => [] },
|
|
995
|
-
excludeBindingId: {},
|
|
996
|
-
rules: { default: () => [] },
|
|
997
|
-
iframeMode: { type: Boolean },
|
|
998
|
-
disabled: { type: Boolean },
|
|
999
|
-
readonly: { type: Boolean },
|
|
1000
|
-
recipeBindingConfig: { default: () => ({ enabled: !0, ableToApplyRules: !1 }) },
|
|
1001
|
-
skuBindingConfig: { default: () => ({
|
|
1002
|
-
enabled: !0,
|
|
1003
|
-
ableToApplyRules: !1,
|
|
1004
|
-
ableToConfigureAlternative: !1
|
|
1005
|
-
}) },
|
|
1006
|
-
allowRecipeDecimal: { type: Boolean }
|
|
1007
|
-
},
|
|
1008
|
-
emits: ["update:modelValue", "click:pick-inventory-bindings"],
|
|
1009
|
-
setup(m, { emit: d }) {
|
|
1010
|
-
const { t: i } = ne(), e = ee(), t = C(() => e.recipeById), r = C(() => e.skuById), y = m, v = d, s = C(() => _t({
|
|
1011
|
-
parentId: y.id,
|
|
1012
|
-
bindings: y.modelValue,
|
|
1013
|
-
recipes: e.recipes.map((p) => p._id === y.id ? {
|
|
1014
|
-
...p,
|
|
1015
|
-
contains: y.modelValue
|
|
1016
|
-
} : p),
|
|
1017
|
-
skus: e.skus.map((p) => p._id === y.id ? {
|
|
1018
|
-
...p,
|
|
1019
|
-
convert: {
|
|
1020
|
-
inventoryBindings: y.modelValue
|
|
1021
|
-
}
|
|
1022
|
-
} : p),
|
|
1023
|
-
skuGroups: []
|
|
1024
|
-
}).inventoryBindings.filter((p) => "error" in p && p.error).map((p) => p).filter((p) => p.reason === kt.enum.circularDependency)), u = C(
|
|
1025
|
-
() => new Set(s.value.map((f) => {
|
|
1026
|
-
var a;
|
|
1027
|
-
return (a = f.bindingPaths[0]) == null ? void 0 : a.id;
|
|
1028
|
-
}))
|
|
1029
|
-
), n = C(() => y.modelValue.filter((f) => f.type === "RECIPE")), { promptIngredientsBinding: g, promptRecipesBinding: w } = Qt();
|
|
1030
|
-
async function k() {
|
|
1031
|
-
if (y.iframeMode) {
|
|
1032
|
-
v("click:pick-inventory-bindings", "RECIPE");
|
|
1033
|
-
return;
|
|
1034
|
-
}
|
|
1035
|
-
w(
|
|
1036
|
-
y.modelValue,
|
|
1037
|
-
(f) => v("update:modelValue", f),
|
|
1038
|
-
y.id ? [y.id] : []
|
|
1039
|
-
);
|
|
1040
|
-
}
|
|
1041
|
-
const I = C(() => y.modelValue.filter((f) => f.type === "SKU") ?? []);
|
|
1042
|
-
async function c() {
|
|
1043
|
-
if (y.iframeMode) {
|
|
1044
|
-
v("click:pick-inventory-bindings", "SKU");
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
g(
|
|
1048
|
-
y.modelValue,
|
|
1049
|
-
(f) => v("update:modelValue", f),
|
|
1050
|
-
y.excludeBindingId,
|
|
1051
|
-
y.id ? [y.id] : []
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
function E(f) {
|
|
1055
|
-
const a = y.modelValue.map((p) => p.id === f.id ? f : p);
|
|
1056
|
-
v("update:modelValue", a);
|
|
1057
|
-
}
|
|
1058
|
-
function S(f) {
|
|
1059
|
-
const a = y.modelValue.filter((p) => p.id !== f);
|
|
1060
|
-
v("update:modelValue", a);
|
|
1061
|
-
}
|
|
1062
|
-
function h(f) {
|
|
1063
|
-
var p, T;
|
|
1064
|
-
if (f.type !== $e.enum.SKU)
|
|
1065
|
-
throw new Error("Non-SKU binding does not have unit");
|
|
1066
|
-
if (!((p = r.value[f.id]) == null ? void 0 : p.unit))
|
|
1067
|
-
throw new Error(`Cannot find ingredient: ${f.id}`);
|
|
1068
|
-
return (T = r.value[f.id]) == null ? void 0 : T.unit;
|
|
1069
|
-
}
|
|
1070
|
-
function l(f) {
|
|
1071
|
-
return !r.value[f.id];
|
|
1072
|
-
}
|
|
1073
|
-
return (f, a) => {
|
|
1074
|
-
var B, z, j;
|
|
1075
|
-
const p = P("FmFormGroup"), T = P("FmButton"), D = P("FmIcon");
|
|
1076
|
-
return b(), V("div", En, [
|
|
1077
|
-
x(p, {
|
|
1078
|
-
disabled: f.disabled,
|
|
1079
|
-
"model-value": f.modelValue,
|
|
1080
|
-
rules: [
|
|
1081
|
-
...f.rules,
|
|
1082
|
-
() => s.value.length ? "There is a binding error in your configuration" : !0
|
|
1083
|
-
]
|
|
1084
|
-
}, {
|
|
1085
|
-
label: Y(() => a[4] || (a[4] = [
|
|
1086
|
-
_("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Define the inventory bindings for this recipe or ingredient. ", -1)
|
|
1087
|
-
])),
|
|
1088
|
-
_: 1
|
|
1089
|
-
}, 8, ["disabled", "model-value", "rules"]),
|
|
1090
|
-
((B = f.recipeBindingConfig) == null ? void 0 : B.enabled) !== !1 ? (b(), V("div", $n, [
|
|
1091
|
-
_("div", In, [
|
|
1092
|
-
_("div", Vn, M(o(i)("inventory.inventoryBindings.recipe")), 1),
|
|
1093
|
-
f.readonly ? R("", !0) : (b(), W(T, {
|
|
1094
|
-
key: 0,
|
|
1095
|
-
variant: "secondary",
|
|
1096
|
-
"text-color": "primary",
|
|
1097
|
-
"border-color": "primary",
|
|
1098
|
-
label: o(i)("inventory.inventoryBindings.linkRecipe"),
|
|
1099
|
-
"prepend-icon": "link",
|
|
1100
|
-
onClick: k
|
|
1101
|
-
}, null, 8, ["label"]))
|
|
1102
|
-
]),
|
|
1103
|
-
_("div", Sn, [
|
|
1104
|
-
_("div", Cn, [
|
|
1105
|
-
_("div", Fn, M(o(i)("inventory.inventoryBindings.recipe")), 1),
|
|
1106
|
-
a[5] || (a[5] = _("div", { class: "w-[200px]" }, null, -1)),
|
|
1107
|
-
f.recipeBindingConfig.ableToApplyRules ? (b(), V("div", Bn)) : R("", !0),
|
|
1108
|
-
f.readonly ? R("", !0) : (b(), V("div", Rn))
|
|
1109
|
-
]),
|
|
1110
|
-
(b(!0), V(H, null, me(n.value, (F) => {
|
|
1111
|
-
var U;
|
|
1112
|
-
return b(), W(un, {
|
|
1113
|
-
key: F.id,
|
|
1114
|
-
"model-value": F,
|
|
1115
|
-
"display-name": (U = t.value[F.id]) == null ? void 0 : U.name,
|
|
1116
|
-
"show-error": u.value.has(F.id),
|
|
1117
|
-
readonly: f.readonly,
|
|
1118
|
-
disabled: f.disabled,
|
|
1119
|
-
"allow-recipe-decimal": f.allowRecipeDecimal,
|
|
1120
|
-
"onUpdate:modelValue": a[0] || (a[0] = (J) => E(J)),
|
|
1121
|
-
onDelete: a[1] || (a[1] = (J) => S(J))
|
|
1122
|
-
}, null, 8, ["model-value", "display-name", "show-error", "readonly", "disabled", "allow-recipe-decimal"]);
|
|
1123
|
-
}), 128))
|
|
1124
|
-
])
|
|
1125
|
-
])) : R("", !0),
|
|
1126
|
-
_("div", An, [
|
|
1127
|
-
_("div", Tn, [
|
|
1128
|
-
_("div", Mn, M(o(i)("inventory.inventoryBindings.ingredient")), 1),
|
|
1129
|
-
f.readonly ? R("", !0) : (b(), W(T, {
|
|
1130
|
-
key: 0,
|
|
1131
|
-
variant: "secondary",
|
|
1132
|
-
"text-color": "primary",
|
|
1133
|
-
"border-color": "primary",
|
|
1134
|
-
label: o(i)("inventory.inventoryBindings.linkIngredient"),
|
|
1135
|
-
"prepend-icon": "link",
|
|
1136
|
-
onClick: c
|
|
1137
|
-
}, null, 8, ["label"]))
|
|
1138
|
-
]),
|
|
1139
|
-
_("div", Pn, [
|
|
1140
|
-
_("div", Un, [
|
|
1141
|
-
_("div", Dn, M(o(i)("inventory.inventoryBindings.ingredient")), 1),
|
|
1142
|
-
_("div", Nn, M(o(i)("inventory.inventoryBindings.amount")), 1),
|
|
1143
|
-
a[6] || (a[6] = _("div", { class: "w-[52px]" }, null, -1)),
|
|
1144
|
-
(z = f.skuBindingConfig) != null && z.ableToApplyRules || (j = f.skuBindingConfig) != null && j.ableToConfigureAlternative ? (b(), V("div", zn)) : R("", !0)
|
|
1145
|
-
]),
|
|
1146
|
-
(b(!0), V(H, null, me(I.value, (F) => {
|
|
1147
|
-
var U, J, Q;
|
|
1148
|
-
return b(), V(H, {
|
|
1149
|
-
key: F.id
|
|
1150
|
-
}, [
|
|
1151
|
-
l(F) ? (b(), V("div", jn, [
|
|
1152
|
-
_("div", Ln, [
|
|
1153
|
-
_("div", On, M(F.id), 1),
|
|
1154
|
-
f.readonly ? R("", !0) : (b(), V("div", Kn, [
|
|
1155
|
-
x(T, {
|
|
1156
|
-
disabled: f.disabled,
|
|
1157
|
-
type: "button",
|
|
1158
|
-
variant: "tertiary",
|
|
1159
|
-
icon: "delete",
|
|
1160
|
-
onClick: () => S(F.id)
|
|
1161
|
-
}, null, 8, ["disabled", "onClick"])
|
|
1162
|
-
]))
|
|
1163
|
-
]),
|
|
1164
|
-
_("div", Gn, [
|
|
1165
|
-
x(D, {
|
|
1166
|
-
name: "error",
|
|
1167
|
-
color: "system-error-300",
|
|
1168
|
-
size: "sm"
|
|
1169
|
-
}),
|
|
1170
|
-
_("div", null, M(o(i)("inventory.inventoryBindings.missingIngredient")), 1)
|
|
1171
|
-
])
|
|
1172
|
-
])) : (b(), W(wn, {
|
|
1173
|
-
key: 1,
|
|
1174
|
-
"model-value": F,
|
|
1175
|
-
"display-name": (U = r.value[F.id]) == null ? void 0 : U.name,
|
|
1176
|
-
unit: h(F),
|
|
1177
|
-
"show-error": u.value.has(F.id),
|
|
1178
|
-
"able-to-apply-rules": ((J = f.skuBindingConfig) == null ? void 0 : J.ableToApplyRules) === !0,
|
|
1179
|
-
"able-to-configure-alternative": ((Q = f.skuBindingConfig) == null ? void 0 : Q.ableToConfigureAlternative) === !0,
|
|
1180
|
-
readonly: f.readonly,
|
|
1181
|
-
disabled: f.disabled,
|
|
1182
|
-
"onUpdate:modelValue": a[2] || (a[2] = (te) => E(te)),
|
|
1183
|
-
onDelete: a[3] || (a[3] = (te) => S(te))
|
|
1184
|
-
}, null, 8, ["model-value", "display-name", "unit", "show-error", "able-to-apply-rules", "able-to-configure-alternative", "readonly", "disabled"]))
|
|
1185
|
-
], 64);
|
|
1186
|
-
}), 128))
|
|
1187
|
-
])
|
|
1188
|
-
])
|
|
1189
|
-
]);
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
}), Wn = { class: "flex flex-col gap-40" }, Yn = {
|
|
1193
|
-
key: 0,
|
|
1194
|
-
class: "flex flex-col gap-16"
|
|
1195
|
-
}, Jn = {
|
|
1196
|
-
key: 0,
|
|
1197
|
-
class: "col-span-2 mt-16 border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
1198
|
-
}, Hn = {
|
|
1199
|
-
key: 0,
|
|
1200
|
-
class: "flex flex-col items-center w-full h-full gap-24"
|
|
1201
|
-
}, Qn = { key: 1 }, Xn = { class: "mt-32" }, Zn = /* @__PURE__ */ oe({
|
|
1202
|
-
__name: "RecipeForm",
|
|
1203
|
-
props: {
|
|
1204
|
-
mode: {},
|
|
1205
|
-
modelValue: {},
|
|
1206
|
-
disabled: { type: Boolean }
|
|
1207
|
-
},
|
|
1208
|
-
emits: ["update:modelValue", "click:submit"],
|
|
1209
|
-
setup(m, { expose: d, emit: i }) {
|
|
1210
|
-
const e = m, t = i, r = Ke(), { t: y } = ne(), v = C({
|
|
1211
|
-
get() {
|
|
1212
|
-
var a;
|
|
1213
|
-
return ((a = e.modelValue) == null ? void 0 : a.name) ?? "";
|
|
1214
|
-
},
|
|
1215
|
-
set(a) {
|
|
1216
|
-
const p = e.modelValue ?? {};
|
|
1217
|
-
p.name = a, t("update:modelValue", p);
|
|
1218
|
-
}
|
|
1219
|
-
}), s = C({
|
|
1220
|
-
get() {
|
|
1221
|
-
var a;
|
|
1222
|
-
return ((a = e.modelValue) == null ? void 0 : a.contains) ?? [];
|
|
1223
|
-
},
|
|
1224
|
-
set(a) {
|
|
1225
|
-
const p = e.modelValue ?? {};
|
|
1226
|
-
p.contains = a, t("update:modelValue", p);
|
|
1227
|
-
}
|
|
1228
|
-
}), u = C({
|
|
1229
|
-
get() {
|
|
1230
|
-
var a;
|
|
1231
|
-
return ((a = e.modelValue) == null ? void 0 : a.customAttributes) ?? {};
|
|
1232
|
-
},
|
|
1233
|
-
set(a) {
|
|
1234
|
-
const p = e.modelValue ? {
|
|
1235
|
-
...e.modelValue
|
|
1236
|
-
} : {};
|
|
1237
|
-
p.customAttributes = a, t("update:modelValue", p);
|
|
1238
|
-
}
|
|
1239
|
-
}), n = C({
|
|
1240
|
-
get() {
|
|
1241
|
-
var a;
|
|
1242
|
-
return ((a = e.modelValue) == null ? void 0 : a.version) ?? null;
|
|
1243
|
-
},
|
|
1244
|
-
set(a) {
|
|
1245
|
-
const p = e.modelValue ? { ...e.modelValue } : {};
|
|
1246
|
-
p.version = a, t("update:modelValue", p);
|
|
1247
|
-
}
|
|
1248
|
-
}), g = C({
|
|
1249
|
-
get() {
|
|
1250
|
-
return n.value === "v2";
|
|
1251
|
-
},
|
|
1252
|
-
set(a) {
|
|
1253
|
-
n.value = a ? "v2" : null;
|
|
1254
|
-
}
|
|
1255
|
-
});
|
|
1256
|
-
function w() {
|
|
1257
|
-
t("click:submit");
|
|
1258
|
-
}
|
|
1259
|
-
const k = O();
|
|
1260
|
-
d({
|
|
1261
|
-
validateInputs: () => {
|
|
1262
|
-
var a, p;
|
|
1263
|
-
(p = (a = k.value) == null ? void 0 : a.validateInputs) == null || p.call(a);
|
|
1264
|
-
},
|
|
1265
|
-
resetInputsValidation: () => {
|
|
1266
|
-
var a, p;
|
|
1267
|
-
(p = (a = k.value) == null ? void 0 : a.resetInputsValidation) == null || p.call(a);
|
|
1268
|
-
},
|
|
1269
|
-
resetInputs: () => {
|
|
1270
|
-
var a, p;
|
|
1271
|
-
(p = (a = k.value) == null ? void 0 : a.resetInputs) == null || p.call(a);
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
1274
|
-
const I = ee(), c = O([]), E = O(!1), S = O(!1);
|
|
1275
|
-
de(E, async (a) => {
|
|
1276
|
-
h(a);
|
|
1277
|
-
});
|
|
1278
|
-
async function h(a) {
|
|
1279
|
-
var p, T;
|
|
1280
|
-
a && !S.value && ((p = e.modelValue) != null && p._id) && (S.value = !0, c.value = await I.getAffectedMenu((T = e.modelValue) == null ? void 0 : T._id).delayed(500), S.value = !1);
|
|
1281
|
-
}
|
|
1282
|
-
const l = C(
|
|
1283
|
-
() => I.recipes.map((a) => ({ label: a.name, value: a.name }))
|
|
1284
|
-
), f = C(() => {
|
|
1285
|
-
var a;
|
|
1286
|
-
return ((a = e.modelValue) == null ? void 0 : a.name) ?? "";
|
|
1287
|
-
});
|
|
1288
|
-
return (a, p) => {
|
|
1289
|
-
const T = P("FmTextField"), D = P("FmSwitch"), B = P("FmCard"), z = P("FmSpacer"), j = P("FmCircularProgress"), F = P("FmForm");
|
|
1290
|
-
return b(), W(F, {
|
|
1291
|
-
ref_key: "formRef",
|
|
1292
|
-
ref: k,
|
|
1293
|
-
onValidationSuccess: w
|
|
1294
|
-
}, {
|
|
1295
|
-
default: Y(() => [
|
|
1296
|
-
_("div", Wn, [
|
|
1297
|
-
x(T, {
|
|
1298
|
-
disabled: a.disabled,
|
|
1299
|
-
label: o(y)("inventory.recipe.name"),
|
|
1300
|
-
"model-value": v.value,
|
|
1301
|
-
"onUpdate:modelValue": p[0] || (p[0] = (U) => v.value = U),
|
|
1302
|
-
rules: [
|
|
1303
|
-
o(At)(),
|
|
1304
|
-
o(it)(l.value, f.value, (U) => `[${U.value}] already exists`)
|
|
1305
|
-
],
|
|
1306
|
-
"label-mark": "required"
|
|
1307
|
-
}, null, 8, ["disabled", "label", "model-value", "rules"]),
|
|
1308
|
-
o(r).enableRecipeV2 ? (b(), V("div", Yn, [
|
|
1309
|
-
x(D, {
|
|
1310
|
-
modelValue: g.value,
|
|
1311
|
-
"onUpdate:modelValue": p[1] || (p[1] = (U) => g.value = U),
|
|
1312
|
-
value: !0,
|
|
1313
|
-
label: o(y)("inventory.recipe.enableRecipeV2"),
|
|
1314
|
-
"label-placement": "right",
|
|
1315
|
-
disabled: a.disabled,
|
|
1316
|
-
sublabel: o(y)("inventory.recipe.recipeV2Warning")
|
|
1317
|
-
}, null, 8, ["modelValue", "label", "disabled", "sublabel"])
|
|
1318
|
-
])) : R("", !0),
|
|
1319
|
-
x(B, {
|
|
1320
|
-
variant: "outlined",
|
|
1321
|
-
class: "p-16"
|
|
1322
|
-
}, {
|
|
1323
|
-
default: Y(() => {
|
|
1324
|
-
var U, J;
|
|
1325
|
-
return [
|
|
1326
|
-
o(r).enableRecipeV2 ? (b(), W(qn, {
|
|
1327
|
-
key: 0,
|
|
1328
|
-
id: (U = a.modelValue) == null ? void 0 : U._id,
|
|
1329
|
-
disabled: a.disabled,
|
|
1330
|
-
"model-value": s.value,
|
|
1331
|
-
"onUpdate:modelValue": p[2] || (p[2] = (Q) => s.value = Q),
|
|
1332
|
-
rules: [o(Ne)(1)],
|
|
1333
|
-
"allow-recipe-decimal": "",
|
|
1334
|
-
"recipe-binding-config": { enabled: !g.value, ableToApplyRules: g.value },
|
|
1335
|
-
"sku-binding-config": {
|
|
1336
|
-
ableToConfigureAlternative: g.value
|
|
1337
|
-
}
|
|
1338
|
-
}, null, 8, ["id", "disabled", "model-value", "rules", "recipe-binding-config", "sku-binding-config"])) : (b(), W(Mt, {
|
|
1339
|
-
key: 1,
|
|
1340
|
-
id: (J = a.modelValue) == null ? void 0 : J._id,
|
|
1341
|
-
disabled: a.disabled,
|
|
1342
|
-
"model-value": s.value,
|
|
1343
|
-
"onUpdate:modelValue": p[3] || (p[3] = (Q) => s.value = Q),
|
|
1344
|
-
rules: [o(Ne)(1)],
|
|
1345
|
-
"allow-recipe-decimal": ""
|
|
1346
|
-
}, null, 8, ["id", "disabled", "model-value", "rules"]))
|
|
1347
|
-
];
|
|
1348
|
-
}),
|
|
1349
|
-
_: 1
|
|
1350
|
-
})
|
|
1351
|
-
]),
|
|
1352
|
-
a.mode !== o(se).CREATE ? (b(), V("div", Jn, [
|
|
1353
|
-
x(D, {
|
|
1354
|
-
label: "Show binded items",
|
|
1355
|
-
modelValue: E.value,
|
|
1356
|
-
"onUpdate:modelValue": p[4] || (p[4] = (U) => E.value = U),
|
|
1357
|
-
"label-placement": "right",
|
|
1358
|
-
disabled: S.value
|
|
1359
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
1360
|
-
S.value ? (b(), V("div", Hn, [
|
|
1361
|
-
x(z),
|
|
1362
|
-
_("div", null, [
|
|
1363
|
-
x(j, { size: "xl" })
|
|
1364
|
-
]),
|
|
1365
|
-
p[6] || (p[6] = _("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading...", -1)),
|
|
1366
|
-
x(z)
|
|
1367
|
-
])) : E.value && c.value.length ? (b(), V("div", Qn, [
|
|
1368
|
-
x(et, {
|
|
1369
|
-
name: "Menu",
|
|
1370
|
-
bindings: c.value
|
|
1371
|
-
}, null, 8, ["bindings"])
|
|
1372
|
-
])) : R("", !0)
|
|
1373
|
-
])) : R("", !0),
|
|
1374
|
-
_("div", Xn, [
|
|
1375
|
-
x(Ot, {
|
|
1376
|
-
entity: "inventoryRecipe",
|
|
1377
|
-
modelValue: u.value,
|
|
1378
|
-
"onUpdate:modelValue": p[5] || (p[5] = (U) => u.value = U)
|
|
1379
|
-
}, null, 8, ["modelValue"])
|
|
1380
|
-
])
|
|
1381
|
-
]),
|
|
1382
|
-
_: 1
|
|
1383
|
-
}, 512);
|
|
1384
|
-
};
|
|
1385
|
-
}
|
|
1386
|
-
}), eo = { class: "flex gap-4" }, to = /* @__PURE__ */ oe({
|
|
1387
|
-
__name: "RecipeDialog",
|
|
1388
|
-
props: {
|
|
1389
|
-
show: { type: Boolean },
|
|
1390
|
-
recipe: {},
|
|
1391
|
-
mode: { default: se.READ }
|
|
1392
|
-
},
|
|
1393
|
-
emits: ["update:show"],
|
|
1394
|
-
setup(m) {
|
|
1395
|
-
const d = m, i = ee(), e = Oe(), { t } = ne(), r = De(d, "show"), y = De(d, "recipe"), v = C(() => {
|
|
1396
|
-
switch (d.mode) {
|
|
1397
|
-
case se.READ:
|
|
1398
|
-
return "";
|
|
1399
|
-
case se.UPDATE:
|
|
1400
|
-
return t("inventory.recipe.update.title");
|
|
1401
|
-
case se.CREATE:
|
|
1402
|
-
return t("inventory.recipe.create.title");
|
|
1403
|
-
}
|
|
1404
|
-
return "";
|
|
1405
|
-
}), s = C(() => {
|
|
1406
|
-
switch (d.mode) {
|
|
1407
|
-
case se.READ:
|
|
1408
|
-
return "";
|
|
1409
|
-
case se.UPDATE:
|
|
1410
|
-
return t("common.save");
|
|
1411
|
-
case se.CREATE:
|
|
1412
|
-
return t("common.add");
|
|
1413
|
-
}
|
|
1414
|
-
return "";
|
|
1415
|
-
}), u = O(), n = O(!1);
|
|
1416
|
-
async function g() {
|
|
1417
|
-
n.value = !0;
|
|
1418
|
-
try {
|
|
1419
|
-
const c = je(y.value);
|
|
1420
|
-
c.precision ?? (c.precision = 0), c.measurements ?? (c.measurements = []), await i.createRecipe(c), r.value = !1, e.open({
|
|
1421
|
-
title: t("inventory.common.success"),
|
|
1422
|
-
message: t("inventory.recipe.create.success", { name: y.value.name }),
|
|
1423
|
-
type: "success"
|
|
1424
|
-
});
|
|
1425
|
-
} catch (c) {
|
|
1426
|
-
c instanceof qe || e.open({
|
|
1427
|
-
title: t("inventory.recipe.create.error.title"),
|
|
1428
|
-
message: t("inventory.recipe.create.error.message"),
|
|
1429
|
-
type: "error"
|
|
1430
|
-
});
|
|
1431
|
-
} finally {
|
|
1432
|
-
n.value = !1;
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
async function w() {
|
|
1436
|
-
n.value = !0;
|
|
1437
|
-
try {
|
|
1438
|
-
await i.updateRecipe(y.value), r.value = !1, e.open({
|
|
1439
|
-
title: t("inventory.common.success"),
|
|
1440
|
-
message: t("inventory.recipe.update.success", { name: y.value.name }),
|
|
1441
|
-
type: "success"
|
|
1442
|
-
});
|
|
1443
|
-
} catch (c) {
|
|
1444
|
-
c instanceof qe || e.open({
|
|
1445
|
-
title: t("inventory.recipe.update.error.title"),
|
|
1446
|
-
message: t("inventory.recipe.update.error.message"),
|
|
1447
|
-
type: "error"
|
|
1448
|
-
});
|
|
1449
|
-
} finally {
|
|
1450
|
-
n.value = !1;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
function k() {
|
|
1454
|
-
var c, E;
|
|
1455
|
-
(E = (c = u.value) == null ? void 0 : c.validateInputs) == null || E.call(c);
|
|
1456
|
-
}
|
|
1457
|
-
function I() {
|
|
1458
|
-
switch (d.mode) {
|
|
1459
|
-
case se.READ:
|
|
1460
|
-
return;
|
|
1461
|
-
case se.UPDATE:
|
|
1462
|
-
return w();
|
|
1463
|
-
case se.CREATE:
|
|
1464
|
-
return g();
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
return (c, E) => {
|
|
1468
|
-
const S = P("FmButton"), h = P("FmSideSheet");
|
|
1469
|
-
return b(), W(h, {
|
|
1470
|
-
"model-value": o(r),
|
|
1471
|
-
"onUpdate:modelValue": E[3] || (E[3] = (l) => Pe(r) ? r.value = l : null),
|
|
1472
|
-
header: v.value,
|
|
1473
|
-
"close-button": "",
|
|
1474
|
-
"dismiss-away": "",
|
|
1475
|
-
"max-width": 800
|
|
1476
|
-
}, {
|
|
1477
|
-
"side-sheet-footer": Y(() => [
|
|
1478
|
-
_("div", eo, [
|
|
1479
|
-
x(S, {
|
|
1480
|
-
loading: n.value,
|
|
1481
|
-
label: s.value,
|
|
1482
|
-
onClick: k
|
|
1483
|
-
}, null, 8, ["loading", "label"]),
|
|
1484
|
-
x(S, {
|
|
1485
|
-
disabled: n.value,
|
|
1486
|
-
label: o(t)("common.close"),
|
|
1487
|
-
variant: "tertiary",
|
|
1488
|
-
onClick: E[2] || (E[2] = (l) => r.value = !1)
|
|
1489
|
-
}, null, 8, ["disabled", "label"])
|
|
1490
|
-
])
|
|
1491
|
-
]),
|
|
1492
|
-
default: Y(() => [
|
|
1493
|
-
x(Zn, {
|
|
1494
|
-
class: "w-full",
|
|
1495
|
-
ref_key: "hasValidationExpose",
|
|
1496
|
-
ref: u,
|
|
1497
|
-
modelValue: o(y),
|
|
1498
|
-
"onUpdate:modelValue": E[0] || (E[0] = (l) => Pe(y) ? y.value = l : null),
|
|
1499
|
-
mode: c.mode,
|
|
1500
|
-
disabled: n.value,
|
|
1501
|
-
"onClick:submit": E[1] || (E[1] = (l) => I())
|
|
1502
|
-
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
1503
|
-
]),
|
|
1504
|
-
_: 1
|
|
1505
|
-
}, 8, ["model-value", "header"]);
|
|
1506
|
-
};
|
|
1507
|
-
}
|
|
1508
|
-
});
|
|
1509
|
-
function _e(m, d, i) {
|
|
1510
|
-
const e = [];
|
|
1511
|
-
for (const t of m)
|
|
1512
|
-
if (t.type === $e.enum.SKU)
|
|
1513
|
-
e.push({ ...t, recipeIds: [...d] });
|
|
1514
|
-
else if (t.type === $e.enum.RECIPE) {
|
|
1515
|
-
const r = i[t.id];
|
|
1516
|
-
r && !d.has(t.id) && e.push(
|
|
1517
|
-
..._e(r.contains, /* @__PURE__ */ new Set([...d, t.id]), i)
|
|
1518
|
-
);
|
|
1519
|
-
}
|
|
1520
|
-
return e;
|
|
1521
|
-
}
|
|
1522
|
-
function no(m, d) {
|
|
1523
|
-
return ke.equal(m, d);
|
|
1524
|
-
}
|
|
1525
|
-
function Re(m) {
|
|
1526
|
-
if (m == null) return null;
|
|
1527
|
-
const d = m.$and, i = m.$or;
|
|
1528
|
-
return Array.isArray(d) && d.length === 0 || Array.isArray(i) && i.length === 0 || Object.keys(m).length === 0 ? null : JSON.stringify(m);
|
|
1529
|
-
}
|
|
1530
|
-
function Ae(m) {
|
|
1531
|
-
const d = (m ?? []).map((i) => ({
|
|
1532
|
-
_id: i._id,
|
|
1533
|
-
trackingMeasurement: i.trackingMeasurement ?? null,
|
|
1534
|
-
priority: i.priority ?? null,
|
|
1535
|
-
default: i.default ?? null
|
|
1536
|
-
})).sort((i, e) => i._id.localeCompare(e._id));
|
|
1537
|
-
return JSON.stringify(d);
|
|
1538
|
-
}
|
|
1539
|
-
function He(m) {
|
|
1540
|
-
return m.measurement ? ke.multiplyDecimal(m.amount, m.measurement.conversion) : m.amount;
|
|
1541
|
-
}
|
|
1542
|
-
function Me(m, d) {
|
|
1543
|
-
var t, r;
|
|
1544
|
-
if (m.type !== d.type || m.id !== d.id || !no(He(m), He(d))) return !1;
|
|
1545
|
-
const i = ((t = m.measurement) == null ? void 0 : t.id) ?? null, e = ((r = d.measurement) == null ? void 0 : r.id) ?? null;
|
|
1546
|
-
return !(i !== e || Re(m.rules) !== Re(d.rules) || Ae(m.alternatives) !== Ae(d.alternatives));
|
|
1547
|
-
}
|
|
1548
|
-
function Qe(m, d) {
|
|
1549
|
-
return m.type === d.type && m.id === d.id;
|
|
1550
|
-
}
|
|
1551
|
-
function oo(m, d) {
|
|
1552
|
-
const i = [];
|
|
1553
|
-
let e = [...m.contains];
|
|
1554
|
-
for (const r of d)
|
|
1555
|
-
switch (r.type) {
|
|
1556
|
-
case "remove-binding": {
|
|
1557
|
-
const y = e.findIndex(
|
|
1558
|
-
(v) => v.type === r.target.type && v.id === r.target.id
|
|
1559
|
-
);
|
|
1560
|
-
y === -1 ? i.push({ change: r, outcome: "ignored", reason: "Source binding not found in target" }) : (e = [...e.slice(0, y), ...e.slice(y + 1)], i.push({ change: r, outcome: "applied" }));
|
|
1561
|
-
break;
|
|
1562
|
-
}
|
|
1563
|
-
case "add-binding": {
|
|
1564
|
-
if (e.find((s) => Me(s, r.binding))) {
|
|
1565
|
-
i.push({ change: r, outcome: "already-satisfied", reason: "Exact binding already present" });
|
|
1566
|
-
break;
|
|
1567
|
-
}
|
|
1568
|
-
if (e.find((s) => Qe(s, r.binding))) {
|
|
1569
|
-
i.push({ change: r, outcome: "blocked", reason: "A similar but non-exact binding already exists" });
|
|
1570
|
-
break;
|
|
1571
|
-
}
|
|
1572
|
-
if (m.version === "v2" && r.binding.type === "RECIPE") {
|
|
1573
|
-
i.push({ change: r, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1574
|
-
break;
|
|
1575
|
-
}
|
|
1576
|
-
if (m.version !== "v2" && (r.binding.alternatives ?? []).length > 0) {
|
|
1577
|
-
i.push({ change: r, outcome: "blocked", reason: "Cannot add a binding with alternatives to a non-V2 recipe" });
|
|
1578
|
-
break;
|
|
1579
|
-
}
|
|
1580
|
-
e = [...e, r.binding], i.push({ change: r, outcome: "applied" });
|
|
1581
|
-
break;
|
|
1582
|
-
}
|
|
1583
|
-
case "replace-binding": {
|
|
1584
|
-
const y = e.findIndex(
|
|
1585
|
-
(u) => u.type === r.from.type && u.id === r.from.id
|
|
1586
|
-
), v = e.find((u) => Me(u, r.to)), s = e.find((u, n) => n !== y && Qe(u, r.to) && !Me(u, r.to));
|
|
1587
|
-
if (y === -1) {
|
|
1588
|
-
v ? i.push({ change: r, outcome: "already-satisfied", reason: "Target already has exact replacement" }) : i.push({ change: r, outcome: "ignored", reason: "Source binding not found in target" });
|
|
1589
|
-
break;
|
|
1590
|
-
}
|
|
1591
|
-
if (m.version === "v2" && r.to.type === "RECIPE") {
|
|
1592
|
-
i.push({ change: r, outcome: "blocked", reason: "Cannot add RECIPE binding to a V2 recipe" });
|
|
1593
|
-
break;
|
|
1594
|
-
}
|
|
1595
|
-
if (m.version !== "v2" && (r.to.alternatives ?? []).length > 0) {
|
|
1596
|
-
i.push({ change: r, outcome: "blocked", reason: "Cannot apply a binding with alternatives to a non-V2 recipe" });
|
|
1597
|
-
break;
|
|
1598
|
-
}
|
|
1599
|
-
if (s) {
|
|
1600
|
-
i.push({ change: r, outcome: "blocked", reason: "A similar but non-exact replacement binding already exists" });
|
|
1601
|
-
break;
|
|
1602
|
-
}
|
|
1603
|
-
v ? (e = [...e.slice(0, y), ...e.slice(y + 1)], i.push({ change: r, outcome: "applied", reason: "Source removed; replacement already present" })) : (e = [
|
|
1604
|
-
...e.slice(0, y),
|
|
1605
|
-
r.to,
|
|
1606
|
-
...e.slice(y + 1)
|
|
1607
|
-
], i.push({ change: r, outcome: "applied" }));
|
|
1608
|
-
break;
|
|
1609
|
-
}
|
|
1610
|
-
case "update-binding-rule": {
|
|
1611
|
-
const y = e.findIndex(
|
|
1612
|
-
(n) => n.type === r.target.type && n.id === r.target.id
|
|
1613
|
-
);
|
|
1614
|
-
if (y === -1) {
|
|
1615
|
-
i.push({ change: r, outcome: "ignored", reason: "Binding not found in target" });
|
|
1616
|
-
break;
|
|
1617
|
-
}
|
|
1618
|
-
const v = e[y], s = v.rules ?? null, u = r.rule ?? null;
|
|
1619
|
-
if (Re(s) === Re(u)) {
|
|
1620
|
-
i.push({ change: r, outcome: "already-satisfied", reason: "Rule already matches" });
|
|
1621
|
-
break;
|
|
1622
|
-
}
|
|
1623
|
-
e = [
|
|
1624
|
-
...e.slice(0, y),
|
|
1625
|
-
{ ...v, rules: u },
|
|
1626
|
-
...e.slice(y + 1)
|
|
1627
|
-
], i.push({ change: r, outcome: "applied" });
|
|
1628
|
-
break;
|
|
1629
|
-
}
|
|
1630
|
-
case "update-alternatives": {
|
|
1631
|
-
if (m.version !== "v2") {
|
|
1632
|
-
i.push({ change: r, outcome: "blocked", reason: "Cannot update alternatives on a non-V2 recipe" });
|
|
1633
|
-
break;
|
|
1634
|
-
}
|
|
1635
|
-
const y = e.findIndex(
|
|
1636
|
-
(n) => n.type === r.target.type && n.id === r.target.id
|
|
1637
|
-
);
|
|
1638
|
-
if (y === -1) {
|
|
1639
|
-
i.push({ change: r, outcome: "ignored", reason: "Binding not found in target" });
|
|
1640
|
-
break;
|
|
1641
|
-
}
|
|
1642
|
-
const v = e[y], s = Ae(v.alternatives), u = Ae(r.alternatives);
|
|
1643
|
-
if (s === u) {
|
|
1644
|
-
i.push({ change: r, outcome: "already-satisfied", reason: "Alternatives already match" });
|
|
1645
|
-
break;
|
|
1646
|
-
}
|
|
1647
|
-
e = [
|
|
1648
|
-
...e.slice(0, y),
|
|
1649
|
-
{ ...v, alternatives: r.alternatives },
|
|
1650
|
-
...e.slice(y + 1)
|
|
1651
|
-
], i.push({ change: r, outcome: "applied" });
|
|
1652
|
-
break;
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
return { projected: { ...m, contains: e }, results: i };
|
|
1656
|
-
}
|
|
1657
|
-
function Xe(m) {
|
|
1658
|
-
switch (m.type) {
|
|
1659
|
-
case "add-binding":
|
|
1660
|
-
return m.binding.id !== "";
|
|
1661
|
-
case "remove-binding":
|
|
1662
|
-
return m.target.id !== "";
|
|
1663
|
-
case "replace-binding":
|
|
1664
|
-
return m.from.id !== "" && m.to.id !== "";
|
|
1665
|
-
case "update-binding-rule":
|
|
1666
|
-
return m.target.id !== "";
|
|
1667
|
-
case "update-alternatives":
|
|
1668
|
-
return m.target.id !== "";
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
function io(m) {
|
|
1672
|
-
if (m.length === 0) return "no-applicable-changes";
|
|
1673
|
-
let d = 0, i = 0, e = 0, t = 0;
|
|
1674
|
-
for (const r of m)
|
|
1675
|
-
r.outcome === "applied" ? d++ : r.outcome === "blocked" ? i++ : r.outcome === "ignored" ? e++ : r.outcome === "already-satisfied" && t++;
|
|
1676
|
-
return i > 0 && d === 0 ? "blocked" : t === m.length ? "already-satisfied" : d > 0 && (e > 0 || i > 0) ? "partially-ignored" : d > 0 ? "will-update" : "no-applicable-changes";
|
|
1677
|
-
}
|
|
1678
|
-
let lo = 0;
|
|
1679
|
-
function ao(m = null) {
|
|
1680
|
-
return {
|
|
1681
|
-
id: String(++lo),
|
|
1682
|
-
type: m,
|
|
1683
|
-
itemId: null,
|
|
1684
|
-
amountModel: be()
|
|
1685
|
-
};
|
|
1686
|
-
}
|
|
1687
|
-
function dt(m, d, i, e) {
|
|
1688
|
-
for (const t of m)
|
|
1689
|
-
if (t.type === "RECIPE") {
|
|
1690
|
-
if (t.id === d) return !0;
|
|
1691
|
-
if (!i.has(t.id)) {
|
|
1692
|
-
const r = e[t.id];
|
|
1693
|
-
if (r && dt(r.contains, d, /* @__PURE__ */ new Set([...i, t.id]), e))
|
|
1694
|
-
return !0;
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
return !1;
|
|
1698
|
-
}
|
|
1699
|
-
const ge = tt("recipeBulkEditor", function() {
|
|
1700
|
-
const d = ee(), i = Oe(), { t: e } = ne(), t = O(!1), r = O(1), y = O(null), v = O(/* @__PURE__ */ new Set()), s = O([]), u = O({}), n = O(!1), g = O(/* @__PURE__ */ new Map()), w = O(""), k = O([]), I = C(() => {
|
|
1701
|
-
let N = d.recipes;
|
|
1702
|
-
const K = y.value;
|
|
1703
|
-
if (K != null && K.nameSearch) {
|
|
1704
|
-
const G = K.nameSearch.trim().toLowerCase();
|
|
1705
|
-
G && (N = N.filter((q) => q.name.toLowerCase().includes(G)));
|
|
1706
|
-
}
|
|
1707
|
-
if (K != null && K.filters && K.filters.length > 0) {
|
|
1708
|
-
const G = /* @__PURE__ */ new Map();
|
|
1709
|
-
for (const q of N)
|
|
1710
|
-
G.set(
|
|
1711
|
-
q._id,
|
|
1712
|
-
_e(q.contains, /* @__PURE__ */ new Set([q._id]), d.recipeById)
|
|
1713
|
-
);
|
|
1714
|
-
for (const q of K.filters)
|
|
1715
|
-
if (q.type === "ingredient") {
|
|
1716
|
-
const { itemId: ue, amount: X, measurementId: re } = q;
|
|
1717
|
-
N = N.filter((fe) => (G.get(fe._id) ?? []).some((ie) => {
|
|
1718
|
-
var ce;
|
|
1719
|
-
if (ie.type !== "SKU" || ie.id !== ue) return !1;
|
|
1720
|
-
if (ie.recipeIds.length === 1) {
|
|
1721
|
-
if (X != null) {
|
|
1722
|
-
const Te = ie.measurement ? ke.multiplyDecimal(ie.amount, ie.measurement.conversion) : ie.amount;
|
|
1723
|
-
if (!ke.equal(Te, X)) return !1;
|
|
1724
|
-
}
|
|
1725
|
-
if (re != null && (((ce = ie.measurement) == null ? void 0 : ce.id) ?? null) !== re)
|
|
1726
|
-
return !1;
|
|
1727
|
-
}
|
|
1728
|
-
return !0;
|
|
1729
|
-
}));
|
|
1730
|
-
} else if (q.type === "recipe") {
|
|
1731
|
-
const ue = q.itemId;
|
|
1732
|
-
N = N.filter(
|
|
1733
|
-
(X) => dt(X.contains, ue, /* @__PURE__ */ new Set([X._id]), d.recipeById)
|
|
1734
|
-
);
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
return N;
|
|
1738
|
-
}), c = C(
|
|
1739
|
-
() => I.value.filter((N) => !v.value.has(N._id))
|
|
1740
|
-
), E = C(() => c.value.length > 0), S = C(() => {
|
|
1741
|
-
const N = s.value.filter(Xe);
|
|
1742
|
-
if (N.length === 0) {
|
|
1743
|
-
const G = {};
|
|
1744
|
-
for (const q of c.value)
|
|
1745
|
-
G[q._id] = {
|
|
1746
|
-
recipeId: q._id,
|
|
1747
|
-
recipeName: q.name,
|
|
1748
|
-
original: q,
|
|
1749
|
-
projected: null,
|
|
1750
|
-
status: "no-applicable-changes",
|
|
1751
|
-
changes: [],
|
|
1752
|
-
counts: { applied: 0, ignored: 0, blocked: 0, satisfied: 0 }
|
|
1753
|
-
};
|
|
1754
|
-
return G;
|
|
1755
|
-
}
|
|
1756
|
-
const K = {};
|
|
1757
|
-
for (const G of c.value) {
|
|
1758
|
-
const q = JSON.parse(JSON.stringify(G)), { projected: ue, results: X } = oo(q, N), re = io(X);
|
|
1759
|
-
let fe = 0, he = 0, ie = 0, ve = 0;
|
|
1760
|
-
for (const ce of X)
|
|
1761
|
-
ce.outcome === "applied" ? fe++ : ce.outcome === "ignored" ? he++ : ce.outcome === "blocked" ? ie++ : ce.outcome === "already-satisfied" && ve++;
|
|
1762
|
-
K[G._id] = {
|
|
1763
|
-
recipeId: G._id,
|
|
1764
|
-
recipeName: G.name,
|
|
1765
|
-
original: q,
|
|
1766
|
-
projected: re === "will-update" || re === "partially-ignored" ? ue : null,
|
|
1767
|
-
status: re,
|
|
1768
|
-
changes: X,
|
|
1769
|
-
counts: { applied: fe, ignored: he, blocked: ie, satisfied: ve }
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
|
-
return K;
|
|
1773
|
-
}), h = C(() => s.value.some(Xe) ? Object.values(S.value).some(
|
|
1774
|
-
(N) => N.status === "will-update" || N.status === "partially-ignored"
|
|
1775
|
-
) : !1);
|
|
1776
|
-
function l() {
|
|
1777
|
-
a(), t.value = !0;
|
|
1778
|
-
}
|
|
1779
|
-
function f() {
|
|
1780
|
-
t.value = !1;
|
|
1781
|
-
}
|
|
1782
|
-
function a() {
|
|
1783
|
-
r.value = 1, y.value = null, v.value = /* @__PURE__ */ new Set(), s.value = [], u.value = {}, n.value = !1, g.value = /* @__PURE__ */ new Map(), w.value = "", k.value = [];
|
|
1784
|
-
}
|
|
1785
|
-
function p(N) {
|
|
1786
|
-
y.value = N;
|
|
1787
|
-
}
|
|
1788
|
-
function T(N) {
|
|
1789
|
-
const K = new Set(v.value);
|
|
1790
|
-
K.add(N), v.value = K;
|
|
1791
|
-
}
|
|
1792
|
-
function D() {
|
|
1793
|
-
v.value = /* @__PURE__ */ new Set();
|
|
1794
|
-
}
|
|
1795
|
-
function B(N) {
|
|
1796
|
-
s.value = [...s.value, N];
|
|
1797
|
-
}
|
|
1798
|
-
function z(N, K) {
|
|
1799
|
-
const G = [...s.value];
|
|
1800
|
-
G[N] = K, s.value = G;
|
|
1801
|
-
}
|
|
1802
|
-
function j(N) {
|
|
1803
|
-
s.value = s.value.filter((K, G) => G !== N);
|
|
1804
|
-
}
|
|
1805
|
-
function F(N, K) {
|
|
1806
|
-
const G = [...s.value], [q] = G.splice(N, 1);
|
|
1807
|
-
G.splice(K, 0, q), s.value = G;
|
|
1808
|
-
}
|
|
1809
|
-
function U() {
|
|
1810
|
-
u.value = { ...S.value }, r.value = 3;
|
|
1811
|
-
}
|
|
1812
|
-
function J() {
|
|
1813
|
-
u.value = {}, r.value = 2;
|
|
1814
|
-
}
|
|
1815
|
-
function Q() {
|
|
1816
|
-
return Object.values(u.value).filter(
|
|
1817
|
-
(N) => (N.status === "will-update" || N.status === "partially-ignored") && N.projected != null
|
|
1818
|
-
).map((N) => N.projected);
|
|
1819
|
-
}
|
|
1820
|
-
async function te() {
|
|
1821
|
-
if (!n.value) {
|
|
1822
|
-
n.value = !0, g.value = /* @__PURE__ */ new Map();
|
|
1823
|
-
try {
|
|
1824
|
-
const N = Q(), K = await d.importRecipes({
|
|
1825
|
-
create: [],
|
|
1826
|
-
update: N
|
|
1827
|
-
}), G = (K == null ? void 0 : K.errors) ?? [];
|
|
1828
|
-
if (G.length > 0) {
|
|
1829
|
-
const q = /* @__PURE__ */ new Map();
|
|
1830
|
-
for (const { data: ue, error: X } of G) {
|
|
1831
|
-
const re = typeof X == "string" ? X : (X == null ? void 0 : X.message) ?? e("inventory.recipe.bulkEditor.step3.unknownError");
|
|
1832
|
-
q.set(ue._id, re);
|
|
1833
|
-
}
|
|
1834
|
-
g.value = q, i.open({
|
|
1835
|
-
title: e("inventory.recipe.bulkEditor.step3.partialErrorTitle"),
|
|
1836
|
-
message: e("inventory.recipe.bulkEditor.step3.partialErrorMessage", {
|
|
1837
|
-
count: G.length
|
|
1838
|
-
}),
|
|
1839
|
-
type: "warning"
|
|
1840
|
-
});
|
|
1841
|
-
} else
|
|
1842
|
-
i.open({
|
|
1843
|
-
title: e("inventory.recipe.bulkEditor.step3.successTitle"),
|
|
1844
|
-
message: e("inventory.recipe.bulkEditor.step3.successMessage", {
|
|
1845
|
-
count: N.length
|
|
1846
|
-
}),
|
|
1847
|
-
type: "success"
|
|
1848
|
-
}), t.value = !1, a();
|
|
1849
|
-
} catch (N) {
|
|
1850
|
-
i.open({
|
|
1851
|
-
title: e("inventory.recipe.bulkEditor.step3.errorTitle"),
|
|
1852
|
-
message: e("inventory.recipe.bulkEditor.step3.errorMessage"),
|
|
1853
|
-
type: "error"
|
|
1854
|
-
}), console.error("confirmAndApply failed", N);
|
|
1855
|
-
} finally {
|
|
1856
|
-
n.value = !1;
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
return {
|
|
1861
|
-
// state
|
|
1862
|
-
show: t,
|
|
1863
|
-
currentStep: r,
|
|
1864
|
-
query: y,
|
|
1865
|
-
excludedRecipeIds: v,
|
|
1866
|
-
modifications: s,
|
|
1867
|
-
entries: u,
|
|
1868
|
-
isSaving: n,
|
|
1869
|
-
applyErrors: g,
|
|
1870
|
-
nameSearch: w,
|
|
1871
|
-
filterRows: k,
|
|
1872
|
-
// computed
|
|
1873
|
-
matchedRecipes: I,
|
|
1874
|
-
selectedRecipes: c,
|
|
1875
|
-
livePreviewEntries: S,
|
|
1876
|
-
canGoToStep2: E,
|
|
1877
|
-
canGoToStep3: h,
|
|
1878
|
-
// actions
|
|
1879
|
-
openDialog: l,
|
|
1880
|
-
closeDialog: f,
|
|
1881
|
-
reset: a,
|
|
1882
|
-
updateQuery: p,
|
|
1883
|
-
removeRecipe: T,
|
|
1884
|
-
restoreAllRecipes: D,
|
|
1885
|
-
addModification: B,
|
|
1886
|
-
updateModification: z,
|
|
1887
|
-
removeModification: j,
|
|
1888
|
-
reorderModification: F,
|
|
1889
|
-
goToStep3: U,
|
|
1890
|
-
backToStep2: J,
|
|
1891
|
-
buildPayload: Q,
|
|
1892
|
-
confirmAndApply: te
|
|
1893
|
-
};
|
|
1894
|
-
}), ro = { class: "flex flex-col h-full" }, so = { class: "px-16 pt-16 pb-8 shrink-0 flex items-center justify-between" }, uo = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, co = { class: "px-16 pt-12 pb-16 border-b border-fm-color-border-default bg-fm-color-surface-default flex flex-col gap-12 shrink-0" }, po = {
|
|
1895
|
-
key: 0,
|
|
1896
|
-
class: "flex flex-wrap items-center gap-8"
|
|
1897
|
-
}, mo = {
|
|
1898
|
-
type: "button",
|
|
1899
|
-
class: "inline-flex items-center gap-4 h-[30px] pl-8 pr-6 rounded-l-md border border-r-0 border-fm-color-border-default bg-fm-color-surface-secondary hover:bg-fm-color-surface-hover cursor-pointer select-none transition-colors"
|
|
1900
|
-
}, fo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-primary" }, vo = { class: "flex flex-col gap-8 p-12 min-w-[260px]" }, yo = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, bo = {
|
|
1901
|
-
key: 0,
|
|
1902
|
-
class: "flex flex-col gap-4"
|
|
1903
|
-
}, go = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _o = { class: "text-fm-color-typo-placeholder ml-4" }, ko = ["title", "onClick"], ho = { class: "flex-1 overflow-y-auto" }, xo = {
|
|
1904
|
-
key: 0,
|
|
1905
|
-
class: "flex flex-col items-center justify-center h-full gap-8 px-24 text-center"
|
|
1906
|
-
}, wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Eo = {
|
|
1907
|
-
key: 1,
|
|
1908
|
-
class: "divide-y divide-fm-color-border-default"
|
|
1909
|
-
}, $o = { class: "flex-1 min-w-0" }, Io = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary truncate" }, Vo = {
|
|
1910
|
-
key: 0,
|
|
1911
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-1 whitespace-normal break-words"
|
|
1912
|
-
}, So = { class: "flex items-center gap-4 mt-2" }, Co = /* @__PURE__ */ oe({
|
|
1913
|
-
__name: "RecipeBulkEditorStep1",
|
|
1914
|
-
setup(m) {
|
|
1915
|
-
const { t: d } = ne(), i = ee(), e = ge(), t = C({
|
|
1916
|
-
get: () => e.nameSearch,
|
|
1917
|
-
set: (h) => {
|
|
1918
|
-
e.nameSearch = h;
|
|
1919
|
-
}
|
|
1920
|
-
}), r = C(() => e.filterRows), y = O({});
|
|
1921
|
-
function v(h) {
|
|
1922
|
-
return y.value[h] ?? !1;
|
|
1923
|
-
}
|
|
1924
|
-
function s(h, l) {
|
|
1925
|
-
y.value = { ...y.value, [h]: l };
|
|
1926
|
-
}
|
|
1927
|
-
const u = C(
|
|
1928
|
-
() => i.skus.map((h) => ({
|
|
1929
|
-
label: h.name,
|
|
1930
|
-
sublabel: h.code,
|
|
1931
|
-
value: h._id
|
|
1932
|
-
}))
|
|
1933
|
-
), n = C(
|
|
1934
|
-
() => i.recipes.map((h) => ({
|
|
1935
|
-
label: h.name,
|
|
1936
|
-
value: h._id
|
|
1937
|
-
}))
|
|
1938
|
-
);
|
|
1939
|
-
function g(h) {
|
|
1940
|
-
return h.type !== "ingredient" || !h.itemId ? null : i.skuById[h.itemId] ?? null;
|
|
1941
|
-
}
|
|
1942
|
-
function w(h) {
|
|
1943
|
-
var l;
|
|
1944
|
-
if (!h.type) return d("inventory.recipe.bulkEditor.step1.filter");
|
|
1945
|
-
if (h.type === "ingredient") {
|
|
1946
|
-
if (!h.itemId) return d("inventory.recipe.bulkEditor.step1.filterTypeIngredient");
|
|
1947
|
-
const f = i.skuById[h.itemId];
|
|
1948
|
-
if (!f) return d("inventory.recipe.bulkEditor.step1.filterTypeIngredient");
|
|
1949
|
-
const { amount: a, measurement: p } = h.amountModel;
|
|
1950
|
-
if (!(a != null && a.amount > 0)) return f.name;
|
|
1951
|
-
const D = (p == null ? void 0 : p.abbrev) ?? ((l = f.unit) == null ? void 0 : l.abbrev) ?? "", B = ae(a);
|
|
1952
|
-
return `${f.name} (${B}${D})`;
|
|
1953
|
-
}
|
|
1954
|
-
if (h.type === "recipe") {
|
|
1955
|
-
if (!h.itemId) return d("inventory.recipe.bulkEditor.step1.filterTypeRecipe");
|
|
1956
|
-
const f = i.recipeById[h.itemId];
|
|
1957
|
-
return f ? f.name : d("inventory.recipe.bulkEditor.step1.filterTypeRecipe");
|
|
1958
|
-
}
|
|
1959
|
-
return "";
|
|
1960
|
-
}
|
|
1961
|
-
function k(h) {
|
|
1962
|
-
const l = ao(h);
|
|
1963
|
-
e.filterRows.push(l), s(l.id, !0);
|
|
1964
|
-
}
|
|
1965
|
-
function I(h) {
|
|
1966
|
-
e.filterRows = e.filterRows.filter((f) => f.id !== h);
|
|
1967
|
-
const l = { ...y.value };
|
|
1968
|
-
delete l[h], y.value = l;
|
|
1969
|
-
}
|
|
1970
|
-
function c(h) {
|
|
1971
|
-
h.amountModel = be(), s(h.id, !0);
|
|
1972
|
-
}
|
|
1973
|
-
de(
|
|
1974
|
-
[t, r],
|
|
1975
|
-
() => {
|
|
1976
|
-
const h = [];
|
|
1977
|
-
for (const a of r.value)
|
|
1978
|
-
if (!(!a.type || !a.itemId))
|
|
1979
|
-
if (a.type === "ingredient") {
|
|
1980
|
-
const p = g(a), { amount: T, measurement: D } = a.amountModel, B = T != null && T.amount > 0;
|
|
1981
|
-
let z, j;
|
|
1982
|
-
p && B && (z = D ? ke.multiplyDecimal(T, D.conversion) : T, j = (D == null ? void 0 : D.id) ?? null), h.push({
|
|
1983
|
-
id: a.id,
|
|
1984
|
-
type: "ingredient",
|
|
1985
|
-
itemId: a.itemId,
|
|
1986
|
-
amount: z ?? null,
|
|
1987
|
-
measurementId: j
|
|
1988
|
-
});
|
|
1989
|
-
} else a.type === "recipe" && h.push({
|
|
1990
|
-
id: a.id,
|
|
1991
|
-
type: "recipe",
|
|
1992
|
-
itemId: a.itemId
|
|
1993
|
-
});
|
|
1994
|
-
e.updateQuery({
|
|
1995
|
-
nameSearch: t.value,
|
|
1996
|
-
filters: h
|
|
1997
|
-
});
|
|
1998
|
-
const l = t.value.trim().length > 0, f = h.length > 0;
|
|
1999
|
-
!l && !f && e.restoreAllRecipes();
|
|
2000
|
-
},
|
|
2001
|
-
{ deep: !0, immediate: !0 }
|
|
2002
|
-
);
|
|
2003
|
-
function E(h) {
|
|
2004
|
-
var p, T, D;
|
|
2005
|
-
const l = i.skuById[h.id];
|
|
2006
|
-
if (!l) return null;
|
|
2007
|
-
const f = ((p = h.measurement) == null ? void 0 : p.abbrev) ?? ((T = l.unit) == null ? void 0 : T.abbrev) ?? "", a = `${ae(h.amount)}${f}`;
|
|
2008
|
-
return h.recipeIds.slice(1).length ? `(${((D = i.recipeById[h.recipeIds.at(-1) ?? ""]) == null ? void 0 : D.name) ?? ""}) ${l.name} (${a})` : `${l.name} (${a})`;
|
|
2009
|
-
}
|
|
2010
|
-
function S(h) {
|
|
2011
|
-
return _e(h.contains, /* @__PURE__ */ new Set([h._id]), i.recipeById).map(E).filter((l) => l !== null).join(", ");
|
|
2012
|
-
}
|
|
2013
|
-
return (h, l) => {
|
|
2014
|
-
const f = P("FmButton"), a = P("FmSearch"), p = P("FmSelect"), T = P("FmPopover"), D = P("FmIcon"), B = P("FmMenuItem"), z = P("FmMenu"), j = P("FmChip");
|
|
2015
|
-
return b(), V("div", ro, [
|
|
2016
|
-
_("div", so, [
|
|
2017
|
-
_("span", uo, M(o(d)("inventory.recipe.bulkEditor.step1.selectedCount", {
|
|
2018
|
-
count: o(e).selectedRecipes.length
|
|
2019
|
-
})), 1),
|
|
2020
|
-
o(e).excludedRecipeIds.size > 0 ? (b(), W(f, {
|
|
2021
|
-
key: 0,
|
|
2022
|
-
label: o(d)("inventory.recipe.bulkEditor.step1.restoreAll"),
|
|
2023
|
-
variant: "tertiary",
|
|
2024
|
-
size: "md",
|
|
2025
|
-
onClick: l[0] || (l[0] = (F) => o(e).restoreAllRecipes())
|
|
2026
|
-
}, null, 8, ["label"])) : R("", !0)
|
|
2027
|
-
]),
|
|
2028
|
-
_("div", co, [
|
|
2029
|
-
x(a, {
|
|
2030
|
-
modelValue: t.value,
|
|
2031
|
-
"onUpdate:modelValue": l[1] || (l[1] = (F) => t.value = F),
|
|
2032
|
-
placeholder: o(d)("inventory.recipe.bulkEditor.query.nameSearchPlaceholder")
|
|
2033
|
-
}, null, 8, ["modelValue", "placeholder"]),
|
|
2034
|
-
r.value.length > 0 ? (b(), V("div", po, [
|
|
2035
|
-
(b(!0), V(H, null, me(r.value, (F) => (b(), V("div", {
|
|
2036
|
-
key: F.id,
|
|
2037
|
-
class: "flex items-center"
|
|
2038
|
-
}, [
|
|
2039
|
-
x(T, {
|
|
2040
|
-
"show-popover": v(F.id),
|
|
2041
|
-
"exclude-el-from-click-outside": ["fm-menu"],
|
|
2042
|
-
placement: "bottom-start",
|
|
2043
|
-
onPopoverChanged: (U) => s(F.id, U)
|
|
2044
|
-
}, {
|
|
2045
|
-
"popover-button": Y(() => [
|
|
2046
|
-
_("button", mo, [
|
|
2047
|
-
_("span", fo, M(w(F)), 1)
|
|
2048
|
-
])
|
|
2049
|
-
]),
|
|
2050
|
-
default: Y(() => [
|
|
2051
|
-
_("div", vo, [
|
|
2052
|
-
_("p", yo, M(F.type === "ingredient" ? o(d)("inventory.recipe.bulkEditor.step1.filterTypeIngredient") : o(d)("inventory.recipe.bulkEditor.step1.filterTypeRecipe")), 1),
|
|
2053
|
-
F.type === "ingredient" ? (b(), V(H, { key: 0 }, [
|
|
2054
|
-
x(p, {
|
|
2055
|
-
modelValue: F.itemId,
|
|
2056
|
-
"onUpdate:modelValue": [(U) => F.itemId = U, (U) => c(F)],
|
|
2057
|
-
items: u.value,
|
|
2058
|
-
placeholder: o(d)("inventory.recipe.bulkEditor.step1.selectIngredient"),
|
|
2059
|
-
clearable: ""
|
|
2060
|
-
}, {
|
|
2061
|
-
"menu-wrapper": Y((U) => [
|
|
2062
|
-
x(Fe, Ee({ ref_for: !0 }, U, {
|
|
2063
|
-
items: u.value,
|
|
2064
|
-
"model-value": F.itemId
|
|
2065
|
-
}), null, 16, ["items", "model-value"])
|
|
2066
|
-
]),
|
|
2067
|
-
_: 2
|
|
2068
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"]),
|
|
2069
|
-
g(F) ? (b(), V("div", bo, [
|
|
2070
|
-
_("span", go, [
|
|
2071
|
-
pt(M(o(d)("inventory.recipe.bulkEditor.step1.amountLabel")) + " ", 1),
|
|
2072
|
-
_("span", _o, M(o(d)("inventory.recipe.bulkEditor.step1.amountOptional")), 1)
|
|
2073
|
-
]),
|
|
2074
|
-
x(Ce, {
|
|
2075
|
-
modelValue: F.amountModel,
|
|
2076
|
-
"onUpdate:modelValue": (U) => F.amountModel = U,
|
|
2077
|
-
unit: g(F).unit,
|
|
2078
|
-
placeholder: o(d)("inventory.recipe.bulkEditor.step1.amountPlaceholder"),
|
|
2079
|
-
"convert-amount-on-change-unit": ""
|
|
2080
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "unit", "placeholder"])
|
|
2081
|
-
])) : R("", !0)
|
|
2082
|
-
], 64)) : F.type === "recipe" ? (b(), W(p, {
|
|
2083
|
-
key: 1,
|
|
2084
|
-
modelValue: F.itemId,
|
|
2085
|
-
"onUpdate:modelValue": [(U) => F.itemId = U, (U) => c(F)],
|
|
2086
|
-
items: n.value,
|
|
2087
|
-
placeholder: o(d)("inventory.recipe.bulkEditor.step1.selectRecipe"),
|
|
2088
|
-
clearable: ""
|
|
2089
|
-
}, {
|
|
2090
|
-
"menu-wrapper": Y((U) => [
|
|
2091
|
-
x(Fe, Ee({ ref_for: !0 }, U, {
|
|
2092
|
-
items: n.value,
|
|
2093
|
-
"model-value": F.itemId
|
|
2094
|
-
}), null, 16, ["items", "model-value"])
|
|
2095
|
-
]),
|
|
2096
|
-
_: 2
|
|
2097
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "items", "placeholder"])) : R("", !0)
|
|
2098
|
-
])
|
|
2099
|
-
]),
|
|
2100
|
-
_: 2
|
|
2101
|
-
}, 1032, ["show-popover", "onPopoverChanged"]),
|
|
2102
|
-
_("button", {
|
|
2103
|
-
type: "button",
|
|
2104
|
-
class: "inline-flex items-center justify-center h-[30px] w-[26px] rounded-r-md border border-l-0 border-fm-color-border-default bg-fm-color-surface-secondary hover:bg-fm-color-surface-hover text-fm-color-typo-secondary hover:text-fm-color-typo-primary cursor-pointer transition-colors",
|
|
2105
|
-
title: o(d)("inventory.recipe.bulkEditor.step1.removeFilter"),
|
|
2106
|
-
onClick: (U) => I(F.id)
|
|
2107
|
-
}, [
|
|
2108
|
-
x(D, {
|
|
2109
|
-
name: "close",
|
|
2110
|
-
size: "sm"
|
|
2111
|
-
})
|
|
2112
|
-
], 8, ko)
|
|
2113
|
-
]))), 128))
|
|
2114
|
-
])) : R("", !0),
|
|
2115
|
-
x(z, {
|
|
2116
|
-
"close-on-click": !0,
|
|
2117
|
-
placement: "bottom-start"
|
|
2118
|
-
}, {
|
|
2119
|
-
"menu-button": Y(() => [
|
|
2120
|
-
x(f, {
|
|
2121
|
-
label: o(d)("inventory.recipe.bulkEditor.step1.filter"),
|
|
2122
|
-
variant: "secondary",
|
|
2123
|
-
size: "md",
|
|
2124
|
-
"prepend-icon": "add",
|
|
2125
|
-
class: "self-start"
|
|
2126
|
-
}, null, 8, ["label"])
|
|
2127
|
-
]),
|
|
2128
|
-
default: Y(() => [
|
|
2129
|
-
x(B, {
|
|
2130
|
-
label: o(d)("inventory.recipe.bulkEditor.step1.filterTypeIngredient"),
|
|
2131
|
-
icon: "inventory_2",
|
|
2132
|
-
onClick: l[2] || (l[2] = (F) => k("ingredient"))
|
|
2133
|
-
}, null, 8, ["label"]),
|
|
2134
|
-
x(B, {
|
|
2135
|
-
label: o(d)("inventory.recipe.bulkEditor.step1.filterTypeRecipe"),
|
|
2136
|
-
icon: "restaurant_menu",
|
|
2137
|
-
onClick: l[3] || (l[3] = (F) => k("recipe"))
|
|
2138
|
-
}, null, 8, ["label"])
|
|
2139
|
-
]),
|
|
2140
|
-
_: 1
|
|
2141
|
-
})
|
|
2142
|
-
]),
|
|
2143
|
-
_("div", ho, [
|
|
2144
|
-
o(e).selectedRecipes.length === 0 ? (b(), V("div", xo, [
|
|
2145
|
-
x(D, {
|
|
2146
|
-
name: "search_off",
|
|
2147
|
-
size: "lg",
|
|
2148
|
-
class: "text-fm-color-typo-placeholder"
|
|
2149
|
-
}),
|
|
2150
|
-
_("p", wo, M(o(d)("inventory.recipe.bulkEditor.query.noResults")), 1)
|
|
2151
|
-
])) : (b(), V("div", Eo, [
|
|
2152
|
-
(b(!0), V(H, null, me(o(e).selectedRecipes, (F) => (b(), V("div", {
|
|
2153
|
-
key: F._id,
|
|
2154
|
-
class: "flex items-center gap-12 px-16 py-12 hover:bg-fm-color-surface-hover transition-colors"
|
|
2155
|
-
}, [
|
|
2156
|
-
_("div", $o, [
|
|
2157
|
-
_("div", Io, M(F.name), 1),
|
|
2158
|
-
F.contains.length > 0 ? (b(), V("div", Vo, M(S(F)), 1)) : R("", !0),
|
|
2159
|
-
_("div", So, [
|
|
2160
|
-
F.version === "v2" ? (b(), W(j, {
|
|
2161
|
-
key: 0,
|
|
2162
|
-
size: "sm",
|
|
2163
|
-
label: "V2",
|
|
2164
|
-
variant: "info"
|
|
2165
|
-
})) : R("", !0)
|
|
2166
|
-
])
|
|
2167
|
-
]),
|
|
2168
|
-
x(f, {
|
|
2169
|
-
variant: "tertiary",
|
|
2170
|
-
icon: "do_not_disturb_on",
|
|
2171
|
-
title: o(d)("inventory.recipe.bulkEditor.step1.removeRecipeTooltip"),
|
|
2172
|
-
onClick: (U) => o(e).removeRecipe(F._id)
|
|
2173
|
-
}, null, 8, ["title", "onClick"])
|
|
2174
|
-
]))), 128))
|
|
2175
|
-
]))
|
|
2176
|
-
])
|
|
2177
|
-
]);
|
|
2178
|
-
};
|
|
2179
|
-
}
|
|
2180
|
-
}), Fo = { class: "flex flex-col gap-0 rounded-lg border border-fm-color-border-default bg-fm-color-surface-default overflow-hidden" }, Bo = { class: "flex items-start gap-12 px-16 py-12" }, Ro = { class: "flex-1" }, Ao = { class: "flex-1" }, To = {
|
|
2181
|
-
key: 0,
|
|
2182
|
-
class: "border-t border-fm-color-border-default px-16 py-10 flex items-center gap-10"
|
|
2183
|
-
}, Mo = {
|
|
2184
|
-
key: 1,
|
|
2185
|
-
class: "border-t border-fm-color-border-default px-16 py-10 flex items-start gap-8 bg-fm-color-surface-warning"
|
|
2186
|
-
}, Po = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-warning" }, Uo = {
|
|
2187
|
-
key: 2,
|
|
2188
|
-
class: "border-t border-fm-color-border-default px-16 py-12 flex flex-col gap-12"
|
|
2189
|
-
}, Do = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary -mb-4" }, No = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, zo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, jo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-warning" }, Lo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary -mt-8" }, Oo = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary -mb-4" }, Ko = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Go = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, qo = /* @__PURE__ */ oe({
|
|
2190
|
-
__name: "ModificationCard",
|
|
2191
|
-
props: {
|
|
2192
|
-
modelValue: {},
|
|
2193
|
-
livePreviewEntries: {}
|
|
2194
|
-
},
|
|
2195
|
-
emits: ["update:modelValue"],
|
|
2196
|
-
setup(m, { emit: d }) {
|
|
2197
|
-
const i = m, e = d, { t } = ne(), r = ee(), y = Ke();
|
|
2198
|
-
function v($) {
|
|
2199
|
-
const A = $.type === "replace-binding" ? $.from.type : $.type === "remove-binding" || $.type === "update-binding-rule" || $.type === "update-alternatives" ? $.target.type : $.type === "add-binding" ? $.binding.type : null;
|
|
2200
|
-
return A ? A === "RECIPE" ? "recipe" : "ingredient" : null;
|
|
2201
|
-
}
|
|
2202
|
-
function s($) {
|
|
2203
|
-
return $.type === "update-alternatives" ? !0 : $.type === "add-binding" ? ($.binding.alternatives ?? []).length > 0 : $.type === "replace-binding" ? ($.to.alternatives ?? []).length > 0 : !1;
|
|
2204
|
-
}
|
|
2205
|
-
function u($) {
|
|
2206
|
-
switch ($.type) {
|
|
2207
|
-
case "add-binding":
|
|
2208
|
-
return "link";
|
|
2209
|
-
case "replace-binding":
|
|
2210
|
-
return $.from.id === $.to.id ? "update" : null;
|
|
2211
|
-
case "remove-binding":
|
|
2212
|
-
return "remove";
|
|
2213
|
-
case "update-binding-rule":
|
|
2214
|
-
return null;
|
|
2215
|
-
case "update-alternatives":
|
|
2216
|
-
return "alts";
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
function n($) {
|
|
2220
|
-
return $.type === "replace-binding" ? $.from.id || null : ($.type === "remove-binding" || $.type === "update-binding-rule" || $.type === "update-alternatives") && $.target.id || null;
|
|
2221
|
-
}
|
|
2222
|
-
function g($) {
|
|
2223
|
-
return $.type === "add-binding" && $.binding.id || null;
|
|
2224
|
-
}
|
|
2225
|
-
function w($) {
|
|
2226
|
-
const A = $.type === "replace-binding" ? $.to : $.type === "add-binding" ? $.binding : null;
|
|
2227
|
-
return A ? { amount: A.amount, measurement: A.measurement ?? null } : be();
|
|
2228
|
-
}
|
|
2229
|
-
function k($) {
|
|
2230
|
-
return $.type === "replace-binding" ? $.to.rules ?? null : $.type === "add-binding" ? $.binding.rules ?? null : null;
|
|
2231
|
-
}
|
|
2232
|
-
function I($) {
|
|
2233
|
-
return $.type === "update-alternatives" ? $.alternatives ?? [] : $.type === "add-binding" ? $.binding.alternatives ?? [] : [];
|
|
2234
|
-
}
|
|
2235
|
-
const c = O(v(i.modelValue)), E = O(u(i.modelValue)), S = O(s(i.modelValue)), h = O(n(i.modelValue)), l = O(g(i.modelValue)), f = O(w(i.modelValue)), a = O(k(i.modelValue)), p = O(I(i.modelValue)), T = O(
|
|
2236
|
-
(() => {
|
|
2237
|
-
const $ = w(i.modelValue);
|
|
2238
|
-
return $.amount ? ae($.amount) : "";
|
|
2239
|
-
})()
|
|
2240
|
-
);
|
|
2241
|
-
let D = null;
|
|
2242
|
-
function B($) {
|
|
2243
|
-
T.value = $, D && clearTimeout(D), D = setTimeout(() => {
|
|
2244
|
-
const A = +$;
|
|
2245
|
-
f.value = {
|
|
2246
|
-
amount: $.length > 0 && isFinite(A) ? nt(A) : { amount: 0, precision: 0 },
|
|
2247
|
-
measurement: null
|
|
2248
|
-
};
|
|
2249
|
-
}, 300);
|
|
2250
|
-
}
|
|
2251
|
-
de(c, () => {
|
|
2252
|
-
E.value = null, S.value = !1, h.value = null, l.value = null, f.value = be(), a.value = null, p.value = [], T.value = "";
|
|
2253
|
-
}), de(E, () => {
|
|
2254
|
-
h.value = null, l.value = null, f.value = be(), a.value = null, p.value = [], T.value = "";
|
|
2255
|
-
}), de(S, ($) => {
|
|
2256
|
-
$ || (p.value = [], E.value === "alts" && (E.value = null));
|
|
2257
|
-
});
|
|
2258
|
-
const z = C(() => [
|
|
2259
|
-
{ label: t("inventory.recipe.bulkEditor.step2.fieldIngredient"), value: "ingredient" },
|
|
2260
|
-
{ label: t("inventory.recipe.bulkEditor.step2.fieldRecipe"), value: "recipe" }
|
|
2261
|
-
]), j = C(() => {
|
|
2262
|
-
const $ = [
|
|
2263
|
-
{ label: t("inventory.recipe.bulkEditor.step2.actionLink"), value: "link" },
|
|
2264
|
-
{ label: t("inventory.recipe.bulkEditor.step2.actionUpdate"), value: "update" },
|
|
2265
|
-
{ label: t("inventory.recipe.bulkEditor.step2.actionRemove"), value: "remove" }
|
|
2266
|
-
];
|
|
2267
|
-
return c.value === "ingredient" && S.value && y.enableRecipeV2 && $.push({ label: t("inventory.recipe.bulkEditor.step2.actionAlts"), value: "alts" }), $;
|
|
2268
|
-
}), F = C(() => c.value !== null && E.value !== null), U = C(
|
|
2269
|
-
() => E.value === "update" || E.value === "remove" || E.value === "alts"
|
|
2270
|
-
), J = C(
|
|
2271
|
-
() => E.value === "link"
|
|
2272
|
-
), Q = C(
|
|
2273
|
-
() => E.value === "update" && h.value !== null
|
|
2274
|
-
), te = C(
|
|
2275
|
-
() => c.value === "ingredient" && S.value && y.enableRecipeV2
|
|
2276
|
-
), N = C(
|
|
2277
|
-
() => r.skus.map(($) => ({ label: $.name, sublabel: $.code, value: $._id }))
|
|
2278
|
-
), K = C(
|
|
2279
|
-
() => r.recipes.map(($) => ({ label: $.name, value: $._id }))
|
|
2280
|
-
), G = C(() => c.value === "recipe" ? K.value : N.value), q = C(() => c.value === "recipe" ? K.value : N.value), ue = C(() => c.value !== "ingredient" || !l.value ? null : r.skuById[l.value] ?? null), X = C(() => c.value !== "ingredient" || !h.value ? null : r.skuById[h.value] ?? null), re = C(() => {
|
|
2281
|
-
const $ = h.value ?? l.value;
|
|
2282
|
-
return $ ? [$] : [];
|
|
2283
|
-
}), fe = C(() => te.value ? Object.values(i.livePreviewEntries).filter(
|
|
2284
|
-
($) => $.original.version !== "v2"
|
|
2285
|
-
).length : 0), he = C(() => Object.values(i.livePreviewEntries).length);
|
|
2286
|
-
de(
|
|
2287
|
-
() => [E.value, h.value],
|
|
2288
|
-
([$, A], [Z, pe]) => {
|
|
2289
|
-
if ($ !== "alts" || A === pe) return;
|
|
2290
|
-
if (!A) {
|
|
2291
|
-
p.value = [];
|
|
2292
|
-
return;
|
|
2293
|
-
}
|
|
2294
|
-
const xe = Object.values(i.livePreviewEntries).find(
|
|
2295
|
-
(L) => L.original.version === "v2" && L.original.contains.some((we) => we.type === "SKU" && we.id === A)
|
|
2296
|
-
);
|
|
2297
|
-
if (xe) {
|
|
2298
|
-
const L = xe.original.contains.find((we) => we.type === "SKU" && we.id === A);
|
|
2299
|
-
p.value = L != null && L.alternatives ? [...L.alternatives] : [];
|
|
2300
|
-
} else
|
|
2301
|
-
p.value = [];
|
|
2302
|
-
}
|
|
2303
|
-
);
|
|
2304
|
-
const ie = C(() => E.value !== "alts" || !h.value ? 0 : Object.values(i.livePreviewEntries).filter(
|
|
2305
|
-
($) => $.original.version === "v2" && $.original.contains.some((A) => A.type === "SKU" && A.id === h.value)
|
|
2306
|
-
).length);
|
|
2307
|
-
function ve() {
|
|
2308
|
-
return c.value === "recipe" ? "RECIPE" : "SKU";
|
|
2309
|
-
}
|
|
2310
|
-
function ce() {
|
|
2311
|
-
const $ = ve(), A = be().amount, Z = {
|
|
2312
|
-
type: $,
|
|
2313
|
-
id: "",
|
|
2314
|
-
amount: A,
|
|
2315
|
-
measurement: null,
|
|
2316
|
-
rules: null,
|
|
2317
|
-
alternatives: []
|
|
2318
|
-
};
|
|
2319
|
-
switch (E.value) {
|
|
2320
|
-
case "update":
|
|
2321
|
-
return { type: "replace-binding", from: { type: $, id: "" }, to: Z };
|
|
2322
|
-
case "remove":
|
|
2323
|
-
return { type: "remove-binding", target: { type: $, id: "" } };
|
|
2324
|
-
case "alts":
|
|
2325
|
-
return { type: "update-alternatives", target: { type: $, id: "" }, alternatives: [] };
|
|
2326
|
-
case "link":
|
|
2327
|
-
default:
|
|
2328
|
-
return { type: "add-binding", binding: Z };
|
|
2329
|
-
}
|
|
2330
|
-
}
|
|
2331
|
-
function Te() {
|
|
2332
|
-
return h.value ? { type: ve(), id: h.value } : null;
|
|
2333
|
-
}
|
|
2334
|
-
function Ge($ = !1) {
|
|
2335
|
-
const A = $ ? h.value : l.value;
|
|
2336
|
-
if (!A) return null;
|
|
2337
|
-
const { amount: Z, measurement: pe } = f.value, Ie = pe ? ke.multiplyDecimal(Z, pe.conversion) : Z;
|
|
2338
|
-
return {
|
|
2339
|
-
type: ve(),
|
|
2340
|
-
id: A,
|
|
2341
|
-
amount: Ie,
|
|
2342
|
-
measurement: pe ?? null,
|
|
2343
|
-
rules: c.value === "recipe" ? a.value ?? null : null,
|
|
2344
|
-
alternatives: te.value ? p.value : []
|
|
2345
|
-
};
|
|
2346
|
-
}
|
|
2347
|
-
function ut() {
|
|
2348
|
-
if (!c.value) return;
|
|
2349
|
-
if (!E.value) {
|
|
2350
|
-
e("update:modelValue", ce());
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
const $ = Te(), A = Ge(!1);
|
|
2354
|
-
let Z = null;
|
|
2355
|
-
switch (E.value) {
|
|
2356
|
-
case "link":
|
|
2357
|
-
A && (Z = { type: "add-binding", binding: A });
|
|
2358
|
-
break;
|
|
2359
|
-
case "update": {
|
|
2360
|
-
const pe = Ge(!0);
|
|
2361
|
-
$ && pe && (Z = { type: "replace-binding", from: $, to: pe });
|
|
2362
|
-
break;
|
|
2363
|
-
}
|
|
2364
|
-
case "remove":
|
|
2365
|
-
$ && (Z = { type: "remove-binding", target: $ });
|
|
2366
|
-
break;
|
|
2367
|
-
case "alts":
|
|
2368
|
-
$ && (Z = { type: "update-alternatives", target: $, alternatives: p.value });
|
|
2369
|
-
break;
|
|
2370
|
-
}
|
|
2371
|
-
e("update:modelValue", Z ?? ce());
|
|
2372
|
-
}
|
|
2373
|
-
return de(
|
|
2374
|
-
[c, E, S, h, l, f, a, p],
|
|
2375
|
-
() => ut(),
|
|
2376
|
-
{ deep: !0 }
|
|
2377
|
-
), ($, A) => {
|
|
2378
|
-
const Z = P("FmSelect"), pe = P("FmSwitch"), Ie = P("FmIcon"), xe = P("FmTextField");
|
|
2379
|
-
return b(), V("div", Fo, [
|
|
2380
|
-
_("div", Bo, [
|
|
2381
|
-
_("div", Ro, [
|
|
2382
|
-
x(Z, {
|
|
2383
|
-
modelValue: c.value,
|
|
2384
|
-
"onUpdate:modelValue": A[0] || (A[0] = (L) => c.value = L),
|
|
2385
|
-
items: z.value,
|
|
2386
|
-
label: o(t)("inventory.recipe.bulkEditor.step2.sectionField"),
|
|
2387
|
-
placeholder: o(t)("inventory.recipe.bulkEditor.step2.sectionField")
|
|
2388
|
-
}, null, 8, ["modelValue", "items", "label", "placeholder"])
|
|
2389
|
-
]),
|
|
2390
|
-
_("div", Ao, [
|
|
2391
|
-
x(Z, {
|
|
2392
|
-
modelValue: E.value,
|
|
2393
|
-
"onUpdate:modelValue": A[1] || (A[1] = (L) => E.value = L),
|
|
2394
|
-
items: j.value,
|
|
2395
|
-
label: o(t)("inventory.recipe.bulkEditor.step2.sectionAction"),
|
|
2396
|
-
placeholder: o(t)("inventory.recipe.bulkEditor.step2.sectionAction")
|
|
2397
|
-
}, null, 8, ["modelValue", "items", "label", "placeholder"])
|
|
2398
|
-
])
|
|
2399
|
-
]),
|
|
2400
|
-
c.value === "ingredient" && o(y).enableRecipeV2 ? (b(), V("div", To, [
|
|
2401
|
-
x(pe, {
|
|
2402
|
-
modelValue: S.value,
|
|
2403
|
-
"onUpdate:modelValue": A[2] || (A[2] = (L) => S.value = L),
|
|
2404
|
-
label: o(t)("inventory.recipe.bulkEditor.step2.includeAlternativesToggle")
|
|
2405
|
-
}, null, 8, ["modelValue", "label"])
|
|
2406
|
-
])) : R("", !0),
|
|
2407
|
-
te.value && fe.value > 0 ? (b(), V("div", Mo, [
|
|
2408
|
-
x(Ie, {
|
|
2409
|
-
name: "warning",
|
|
2410
|
-
size: "sm",
|
|
2411
|
-
class: "text-fm-color-typo-warning mt-1 shrink-0"
|
|
2412
|
-
}),
|
|
2413
|
-
_("p", Po, M(o(t)("inventory.recipe.bulkEditor.step2.v1AlternativesWarning", {
|
|
2414
|
-
v1Count: fe.value,
|
|
2415
|
-
total: he.value
|
|
2416
|
-
})), 1)
|
|
2417
|
-
])) : R("", !0),
|
|
2418
|
-
F.value ? (b(), V("div", Uo, [
|
|
2419
|
-
U.value ? (b(), V(H, { key: 0 }, [
|
|
2420
|
-
_("p", Do, M(o(t)("inventory.recipe.bulkEditor.addModification.targetLabel")), 1),
|
|
2421
|
-
x(Z, {
|
|
2422
|
-
modelValue: h.value,
|
|
2423
|
-
"onUpdate:modelValue": A[3] || (A[3] = (L) => h.value = L),
|
|
2424
|
-
items: G.value,
|
|
2425
|
-
placeholder: c.value === "recipe" ? o(t)("inventory.recipe.bulkEditor.addModification.recipePlaceholder") : o(t)("inventory.recipe.bulkEditor.addModification.skuPlaceholder"),
|
|
2426
|
-
clearable: ""
|
|
2427
|
-
}, {
|
|
2428
|
-
"menu-wrapper": Y((L) => [
|
|
2429
|
-
x(Fe, Ee(L, {
|
|
2430
|
-
items: G.value,
|
|
2431
|
-
"model-value": h.value
|
|
2432
|
-
}), null, 16, ["items", "model-value"])
|
|
2433
|
-
]),
|
|
2434
|
-
_: 1
|
|
2435
|
-
}, 8, ["modelValue", "items", "placeholder"]),
|
|
2436
|
-
Q.value ? (b(), V(H, { key: 0 }, [
|
|
2437
|
-
c.value === "ingredient" && X.value ? (b(), W(Ce, {
|
|
2438
|
-
key: 0,
|
|
2439
|
-
modelValue: f.value,
|
|
2440
|
-
"onUpdate:modelValue": A[4] || (A[4] = (L) => f.value = L),
|
|
2441
|
-
unit: X.value.unit,
|
|
2442
|
-
placeholder: o(t)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2443
|
-
"convert-amount-on-change-unit": ""
|
|
2444
|
-
}, null, 8, ["modelValue", "unit", "placeholder"])) : c.value === "recipe" ? (b(), W(xe, {
|
|
2445
|
-
key: 1,
|
|
2446
|
-
"model-value": T.value,
|
|
2447
|
-
label: o(t)("inventory.recipe.bulkEditor.addModification.amountLabel"),
|
|
2448
|
-
type: "number",
|
|
2449
|
-
"onUpdate:modelValue": A[5] || (A[5] = (L) => B(L))
|
|
2450
|
-
}, null, 8, ["model-value", "label"])) : R("", !0),
|
|
2451
|
-
c.value === "recipe" ? (b(), V(H, { key: 2 }, [
|
|
2452
|
-
_("p", No, M(o(t)("inventory.recipe.bulkEditor.addModification.optionalRuleLabel")), 1),
|
|
2453
|
-
x(Be, {
|
|
2454
|
-
modelValue: a.value,
|
|
2455
|
-
"onUpdate:modelValue": A[6] || (A[6] = (L) => a.value = L)
|
|
2456
|
-
}, null, 8, ["modelValue"])
|
|
2457
|
-
], 64)) : R("", !0),
|
|
2458
|
-
te.value ? (b(), V(H, { key: 3 }, [
|
|
2459
|
-
_("p", zo, M(o(t)("inventory.recipe.bulkEditor.addModification.optionalAlternativesLabel")), 1),
|
|
2460
|
-
x(Se, {
|
|
2461
|
-
modelValue: p.value,
|
|
2462
|
-
"onUpdate:modelValue": A[7] || (A[7] = (L) => p.value = L),
|
|
2463
|
-
"filter-ingredient-ids": re.value
|
|
2464
|
-
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2465
|
-
], 64)) : R("", !0)
|
|
2466
|
-
], 64)) : R("", !0),
|
|
2467
|
-
E.value === "alts" && h.value ? (b(), V(H, { key: 1 }, [
|
|
2468
|
-
_("p", jo, M(ie.value > 0 ? o(t)("inventory.recipe.bulkEditor.addModification.altsOverwriteWarning", { count: ie.value }) : o(t)("inventory.recipe.bulkEditor.addModification.altsNotFoundWarning")), 1),
|
|
2469
|
-
_("p", Lo, M(o(t)("inventory.recipe.bulkEditor.addModification.altsClearNote")), 1),
|
|
2470
|
-
x(Se, {
|
|
2471
|
-
modelValue: p.value,
|
|
2472
|
-
"onUpdate:modelValue": A[8] || (A[8] = (L) => p.value = L),
|
|
2473
|
-
"filter-ingredient-ids": re.value
|
|
2474
|
-
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2475
|
-
], 64)) : R("", !0)
|
|
2476
|
-
], 64)) : R("", !0),
|
|
2477
|
-
J.value ? (b(), V(H, { key: 1 }, [
|
|
2478
|
-
_("p", Oo, M(o(t)("inventory.recipe.bulkEditor.addModification.bindingLabel")), 1),
|
|
2479
|
-
x(Z, {
|
|
2480
|
-
modelValue: l.value,
|
|
2481
|
-
"onUpdate:modelValue": A[9] || (A[9] = (L) => l.value = L),
|
|
2482
|
-
items: q.value,
|
|
2483
|
-
placeholder: c.value === "recipe" ? o(t)("inventory.recipe.bulkEditor.addModification.recipePlaceholder") : o(t)("inventory.recipe.bulkEditor.addModification.skuPlaceholder"),
|
|
2484
|
-
clearable: ""
|
|
2485
|
-
}, {
|
|
2486
|
-
"menu-wrapper": Y((L) => [
|
|
2487
|
-
x(Fe, Ee(L, {
|
|
2488
|
-
items: q.value,
|
|
2489
|
-
"model-value": l.value
|
|
2490
|
-
}), null, 16, ["items", "model-value"])
|
|
2491
|
-
]),
|
|
2492
|
-
_: 1
|
|
2493
|
-
}, 8, ["modelValue", "items", "placeholder"]),
|
|
2494
|
-
l.value ? (b(), V(H, { key: 0 }, [
|
|
2495
|
-
c.value === "ingredient" && ue.value ? (b(), W(Ce, {
|
|
2496
|
-
key: 0,
|
|
2497
|
-
modelValue: f.value,
|
|
2498
|
-
"onUpdate:modelValue": A[10] || (A[10] = (L) => f.value = L),
|
|
2499
|
-
unit: ue.value.unit,
|
|
2500
|
-
placeholder: o(t)("inventory.recipe.bulkEditor.query.amountPlaceholder"),
|
|
2501
|
-
"convert-amount-on-change-unit": ""
|
|
2502
|
-
}, null, 8, ["modelValue", "unit", "placeholder"])) : c.value === "recipe" ? (b(), W(xe, {
|
|
2503
|
-
key: 1,
|
|
2504
|
-
"model-value": T.value,
|
|
2505
|
-
label: o(t)("inventory.recipe.bulkEditor.addModification.amountLabel"),
|
|
2506
|
-
type: "number",
|
|
2507
|
-
"onUpdate:modelValue": A[11] || (A[11] = (L) => B(L))
|
|
2508
|
-
}, null, 8, ["model-value", "label"])) : R("", !0),
|
|
2509
|
-
c.value === "recipe" ? (b(), V(H, { key: 2 }, [
|
|
2510
|
-
_("p", Ko, M(o(t)("inventory.recipe.bulkEditor.addModification.optionalRuleLabel")), 1),
|
|
2511
|
-
x(Be, {
|
|
2512
|
-
modelValue: a.value,
|
|
2513
|
-
"onUpdate:modelValue": A[12] || (A[12] = (L) => a.value = L)
|
|
2514
|
-
}, null, 8, ["modelValue"])
|
|
2515
|
-
], 64)) : R("", !0),
|
|
2516
|
-
te.value ? (b(), V(H, { key: 3 }, [
|
|
2517
|
-
_("p", Go, M(o(t)("inventory.recipe.bulkEditor.addModification.optionalAlternativesLabel")), 1),
|
|
2518
|
-
x(Se, {
|
|
2519
|
-
modelValue: p.value,
|
|
2520
|
-
"onUpdate:modelValue": A[13] || (A[13] = (L) => p.value = L),
|
|
2521
|
-
"filter-ingredient-ids": re.value
|
|
2522
|
-
}, null, 8, ["modelValue", "filter-ingredient-ids"])
|
|
2523
|
-
], 64)) : R("", !0)
|
|
2524
|
-
], 64)) : R("", !0)
|
|
2525
|
-
], 64)) : R("", !0)
|
|
2526
|
-
])) : R("", !0)
|
|
2527
|
-
]);
|
|
2528
|
-
};
|
|
2529
|
-
}
|
|
2530
|
-
}), Wo = { class: "flex flex-col gap-8" }, Yo = { class: "flex flex-wrap items-center gap-12 px-4" }, Jo = {
|
|
2531
|
-
key: 0,
|
|
2532
|
-
class: "flex items-center gap-6"
|
|
2533
|
-
}, Ho = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Qo = {
|
|
2534
|
-
key: 1,
|
|
2535
|
-
class: "flex items-center gap-6"
|
|
2536
|
-
}, Xo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Zo = {
|
|
2537
|
-
key: 2,
|
|
2538
|
-
class: "flex items-center gap-6"
|
|
2539
|
-
}, ei = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ti = { class: "rounded-lg border border-fm-color-border-default overflow-hidden" }, ni = {
|
|
2540
|
-
key: 0,
|
|
2541
|
-
class: "px-16 py-12 text-center fm-typo-en-body-sm-400 text-fm-color-typo-placeholder"
|
|
2542
|
-
}, oi = {
|
|
2543
|
-
key: 1,
|
|
2544
|
-
class: "divide-y divide-fm-color-border-default"
|
|
2545
|
-
}, ii = { class: "flex items-center gap-12" }, li = { class: "flex-1 fm-typo-en-body-sm-600 text-fm-color-typo-primary truncate" }, ai = {
|
|
2546
|
-
key: 0,
|
|
2547
|
-
class: "flex flex-col gap-4 pl-8"
|
|
2548
|
-
}, ri = { class: "flex-1 fm-typo-en-body-xs-400 text-fm-color-typo-secondary font-mono truncate" }, si = /* @__PURE__ */ oe({
|
|
2549
|
-
__name: "LivePreviewTable",
|
|
2550
|
-
setup(m) {
|
|
2551
|
-
const { t: d } = ne(), i = ge(), e = ee(), t = {
|
|
2552
|
-
"will-update": 0,
|
|
2553
|
-
"partially-ignored": 1,
|
|
2554
|
-
"already-satisfied": 2,
|
|
2555
|
-
blocked: 3,
|
|
2556
|
-
"no-applicable-changes": 4
|
|
2557
|
-
}, r = C(
|
|
2558
|
-
() => Object.values(i.livePreviewEntries).sort(
|
|
2559
|
-
(l, f) => t[l.status] - t[f.status]
|
|
2560
|
-
)
|
|
2561
|
-
), y = C(
|
|
2562
|
-
() => r.value.filter((l) => l.status === "will-update").length
|
|
2563
|
-
), v = C(
|
|
2564
|
-
() => r.value.filter((l) => l.status === "partially-ignored").length
|
|
2565
|
-
), s = C(
|
|
2566
|
-
() => r.value.filter((l) => l.status === "already-satisfied").length
|
|
2567
|
-
), u = C(
|
|
2568
|
-
() => r.value.filter((l) => l.status === "blocked").length
|
|
2569
|
-
);
|
|
2570
|
-
function n(l) {
|
|
2571
|
-
switch (l) {
|
|
2572
|
-
case "will-update":
|
|
2573
|
-
return d("inventory.recipe.bulkEditor.status.willUpdate");
|
|
2574
|
-
case "already-satisfied":
|
|
2575
|
-
return d("inventory.recipe.bulkEditor.status.alreadySatisfied");
|
|
2576
|
-
case "partially-ignored":
|
|
2577
|
-
return d("inventory.recipe.bulkEditor.status.partiallyIgnored");
|
|
2578
|
-
case "blocked":
|
|
2579
|
-
return d("inventory.recipe.bulkEditor.status.blocked");
|
|
2580
|
-
case "no-applicable-changes":
|
|
2581
|
-
return d("inventory.recipe.bulkEditor.status.noApplicableChanges");
|
|
2582
|
-
default:
|
|
2583
|
-
return "";
|
|
2584
|
-
}
|
|
2585
|
-
}
|
|
2586
|
-
function g(l) {
|
|
2587
|
-
switch (l) {
|
|
2588
|
-
case "will-update":
|
|
2589
|
-
return "success";
|
|
2590
|
-
case "already-satisfied":
|
|
2591
|
-
return "info";
|
|
2592
|
-
case "partially-ignored":
|
|
2593
|
-
return "warning";
|
|
2594
|
-
case "blocked":
|
|
2595
|
-
return "critical";
|
|
2596
|
-
case "no-applicable-changes":
|
|
2597
|
-
return "neutral";
|
|
2598
|
-
default:
|
|
2599
|
-
return "neutral";
|
|
2600
|
-
}
|
|
2601
|
-
}
|
|
2602
|
-
function w(l, f) {
|
|
2603
|
-
var a, p;
|
|
2604
|
-
return l === "SKU" ? ((a = e.skuById[f]) == null ? void 0 : a.name) ?? f : l === "RECIPE" ? ((p = e.recipeById[f]) == null ? void 0 : p.name) ?? f : f;
|
|
2605
|
-
}
|
|
2606
|
-
function k(l) {
|
|
2607
|
-
var a, p;
|
|
2608
|
-
const f = w(l.type, l.id);
|
|
2609
|
-
if (l.type === "SKU") {
|
|
2610
|
-
const T = e.skuById[l.id], D = ((a = l.measurement) == null ? void 0 : a.abbrev) ?? ((p = T == null ? void 0 : T.unit) == null ? void 0 : p.abbrev) ?? "";
|
|
2611
|
-
return `${f} (${ae(l.amount)} ${D})`.trim();
|
|
2612
|
-
}
|
|
2613
|
-
return l.type === "RECIPE" ? `${f} ×${ae(l.amount)}` : f;
|
|
2614
|
-
}
|
|
2615
|
-
function I(l) {
|
|
2616
|
-
return w(l.type, l.id);
|
|
2617
|
-
}
|
|
2618
|
-
function c(l, f) {
|
|
2619
|
-
const a = f.contains.find((p) => p.type === l.type && p.id === l.id);
|
|
2620
|
-
return a ? k(a) : I(l);
|
|
2621
|
-
}
|
|
2622
|
-
function E(l, f) {
|
|
2623
|
-
switch (l.type) {
|
|
2624
|
-
case "add-binding":
|
|
2625
|
-
return `+ ${k(l.binding)}`;
|
|
2626
|
-
case "remove-binding":
|
|
2627
|
-
return `− ${I(l.target)}`;
|
|
2628
|
-
case "replace-binding":
|
|
2629
|
-
return `${c(l.from, f)} → ${k(l.to)}`;
|
|
2630
|
-
case "update-binding-rule":
|
|
2631
|
-
return `Rule: ${I(l.target)}`;
|
|
2632
|
-
case "update-alternatives":
|
|
2633
|
-
return `Alternatives: ${I(l.target)}`;
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
function S(l) {
|
|
2637
|
-
switch (l) {
|
|
2638
|
-
case "applied":
|
|
2639
|
-
return "success";
|
|
2640
|
-
case "already-satisfied":
|
|
2641
|
-
return "info";
|
|
2642
|
-
case "ignored":
|
|
2643
|
-
return "neutral";
|
|
2644
|
-
case "blocked":
|
|
2645
|
-
return "critical";
|
|
2646
|
-
default:
|
|
2647
|
-
return "neutral";
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
function h(l) {
|
|
2651
|
-
switch (l) {
|
|
2652
|
-
case "applied":
|
|
2653
|
-
return d("inventory.recipe.bulkEditor.livePreview.outcomeApplied");
|
|
2654
|
-
case "already-satisfied":
|
|
2655
|
-
return d("inventory.recipe.bulkEditor.livePreview.outcomeAlreadySatisfied");
|
|
2656
|
-
case "ignored":
|
|
2657
|
-
return d("inventory.recipe.bulkEditor.livePreview.outcomeIgnored");
|
|
2658
|
-
case "blocked":
|
|
2659
|
-
return d("inventory.recipe.bulkEditor.livePreview.outcomeBlocked");
|
|
2660
|
-
default:
|
|
2661
|
-
return l;
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
return (l, f) => {
|
|
2665
|
-
const a = P("FmChip");
|
|
2666
|
-
return b(), V("div", Wo, [
|
|
2667
|
-
_("div", Yo, [
|
|
2668
|
-
y.value + v.value > 0 ? (b(), V("div", Jo, [
|
|
2669
|
-
x(a, {
|
|
2670
|
-
size: "sm",
|
|
2671
|
-
label: String(y.value + v.value),
|
|
2672
|
-
variant: "success"
|
|
2673
|
-
}, null, 8, ["label"]),
|
|
2674
|
-
_("span", Ho, M(o(d)("inventory.recipe.bulkEditor.livePreview.willUpdate")), 1)
|
|
2675
|
-
])) : R("", !0),
|
|
2676
|
-
s.value > 0 ? (b(), V("div", Qo, [
|
|
2677
|
-
x(a, {
|
|
2678
|
-
size: "sm",
|
|
2679
|
-
label: String(s.value),
|
|
2680
|
-
variant: "info"
|
|
2681
|
-
}, null, 8, ["label"]),
|
|
2682
|
-
_("span", Xo, M(o(d)("inventory.recipe.bulkEditor.livePreview.alreadySatisfied")), 1)
|
|
2683
|
-
])) : R("", !0),
|
|
2684
|
-
u.value > 0 ? (b(), V("div", Zo, [
|
|
2685
|
-
x(a, {
|
|
2686
|
-
size: "sm",
|
|
2687
|
-
label: String(u.value),
|
|
2688
|
-
variant: "critical"
|
|
2689
|
-
}, null, 8, ["label"]),
|
|
2690
|
-
_("span", ei, M(o(d)("inventory.recipe.bulkEditor.livePreview.blocked")), 1)
|
|
2691
|
-
])) : R("", !0)
|
|
2692
|
-
]),
|
|
2693
|
-
_("div", ti, [
|
|
2694
|
-
r.value.length === 0 ? (b(), V("div", ni, M(o(d)("inventory.recipe.bulkEditor.livePreview.noRecipes")), 1)) : (b(), V("div", oi, [
|
|
2695
|
-
(b(!0), V(H, null, me(r.value, (p) => (b(), V("div", {
|
|
2696
|
-
key: p.recipeId,
|
|
2697
|
-
class: "flex flex-col gap-6 px-16 py-10"
|
|
2698
|
-
}, [
|
|
2699
|
-
_("div", ii, [
|
|
2700
|
-
_("span", li, M(p.recipeName), 1),
|
|
2701
|
-
x(a, {
|
|
2702
|
-
size: "sm",
|
|
2703
|
-
label: n(p.status),
|
|
2704
|
-
variant: g(p.status)
|
|
2705
|
-
}, null, 8, ["label", "variant"])
|
|
2706
|
-
]),
|
|
2707
|
-
p.changes.length > 0 ? (b(), V("div", ai, [
|
|
2708
|
-
(b(!0), V(H, null, me(p.changes, (T, D) => (b(), V("div", {
|
|
2709
|
-
key: D,
|
|
2710
|
-
class: "flex items-center gap-8"
|
|
2711
|
-
}, [
|
|
2712
|
-
_("span", ri, M(E(T.change, p.original)), 1),
|
|
2713
|
-
x(a, {
|
|
2714
|
-
size: "sm",
|
|
2715
|
-
label: h(T.outcome),
|
|
2716
|
-
variant: S(T.outcome)
|
|
2717
|
-
}, null, 8, ["label", "variant"])
|
|
2718
|
-
]))), 128))
|
|
2719
|
-
])) : R("", !0)
|
|
2720
|
-
]))), 128))
|
|
2721
|
-
]))
|
|
2722
|
-
])
|
|
2723
|
-
]);
|
|
2724
|
-
};
|
|
2725
|
-
}
|
|
2726
|
-
}), di = { class: "flex flex-col h-full overflow-hidden" }, ui = { class: "flex flex-col min-h-0 shrink-0" }, ci = { class: "flex items-center gap-8 px-16 pt-12 border-b border-fm-color-border-default" }, pi = { class: "flex-1 overflow-x-auto min-w-0" }, mi = {
|
|
2727
|
-
class: "px-16 py-14 overflow-y-auto",
|
|
2728
|
-
style: { "max-height": "45vh" }
|
|
2729
|
-
}, fi = {
|
|
2730
|
-
key: 0,
|
|
2731
|
-
class: "flex flex-col items-center justify-center py-40 gap-8 text-center rounded-lg border border-dashed border-fm-color-border-default"
|
|
2732
|
-
}, vi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yi = { class: "flex-1 overflow-y-auto px-16 py-14 flex flex-col gap-12 min-h-0" }, bi = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary shrink-0" }, gi = /* @__PURE__ */ oe({
|
|
2733
|
-
__name: "RecipeBulkEditorStep2",
|
|
2734
|
-
setup(m) {
|
|
2735
|
-
const { t: d } = ne(), i = ge(), e = O(null);
|
|
2736
|
-
de(
|
|
2737
|
-
() => i.modifications.length,
|
|
2738
|
-
(s) => {
|
|
2739
|
-
s === 0 ? e.value = null : (e.value === null || e.value >= s) && (e.value = s - 1);
|
|
2740
|
-
},
|
|
2741
|
-
{ immediate: !0 }
|
|
2742
|
-
);
|
|
2743
|
-
function t(s, u) {
|
|
2744
|
-
const n = s.type === "replace-binding" ? s.from.type : s.type === "remove-binding" || s.type === "update-binding-rule" || s.type === "update-alternatives" ? s.target.type : s.type === "add-binding" ? s.binding.type : null;
|
|
2745
|
-
return n === "RECIPE" ? d("inventory.recipe.bulkEditor.step2.fieldRecipe") : n === "SKU" ? d("inventory.recipe.bulkEditor.step2.fieldIngredient") : d("inventory.recipe.bulkEditor.step2.tabLabel", { n: u + 1 });
|
|
2746
|
-
}
|
|
2747
|
-
const r = C(
|
|
2748
|
-
() => i.modifications.map((s, u) => ({
|
|
2749
|
-
label: t(s, u),
|
|
2750
|
-
value: u
|
|
2751
|
-
}))
|
|
2752
|
-
);
|
|
2753
|
-
function y() {
|
|
2754
|
-
const u = {
|
|
2755
|
-
type: "add-binding",
|
|
2756
|
-
binding: {
|
|
2757
|
-
type: "SKU",
|
|
2758
|
-
id: "",
|
|
2759
|
-
amount: be().amount,
|
|
2760
|
-
measurement: null,
|
|
2761
|
-
rules: null,
|
|
2762
|
-
alternatives: []
|
|
2763
|
-
}
|
|
2764
|
-
};
|
|
2765
|
-
i.addModification(u), e.value = i.modifications.length - 1;
|
|
2766
|
-
}
|
|
2767
|
-
function v(s) {
|
|
2768
|
-
i.removeModification(s);
|
|
2769
|
-
}
|
|
2770
|
-
return (s, u) => {
|
|
2771
|
-
const n = P("FmButton"), g = P("FmTab"), w = P("FmTabs"), k = P("FmIcon");
|
|
2772
|
-
return b(), V("div", di, [
|
|
2773
|
-
_("div", ui, [
|
|
2774
|
-
_("div", ci, [
|
|
2775
|
-
_("div", pi, [
|
|
2776
|
-
r.value.length > 0 ? (b(), W(w, {
|
|
2777
|
-
key: 0,
|
|
2778
|
-
"model-value": e.value,
|
|
2779
|
-
items: r.value,
|
|
2780
|
-
"onUpdate:modelValue": u[1] || (u[1] = (I) => e.value = I)
|
|
2781
|
-
}, {
|
|
2782
|
-
default: Y((I) => [
|
|
2783
|
-
x(g, Ee(I, {
|
|
2784
|
-
"model-value": e.value,
|
|
2785
|
-
"onUpdate:modelValue": u[0] || (u[0] = (c) => e.value = c)
|
|
2786
|
-
}), {
|
|
2787
|
-
append: Y(() => [
|
|
2788
|
-
x(n, {
|
|
2789
|
-
variant: "tertiary",
|
|
2790
|
-
icon: "close",
|
|
2791
|
-
size: "md",
|
|
2792
|
-
onClick: mt((c) => v(I.value), ["stop"])
|
|
2793
|
-
}, null, 8, ["onClick"])
|
|
2794
|
-
]),
|
|
2795
|
-
_: 2
|
|
2796
|
-
}, 1040, ["model-value"])
|
|
2797
|
-
]),
|
|
2798
|
-
_: 1
|
|
2799
|
-
}, 8, ["model-value", "items"])) : R("", !0)
|
|
2800
|
-
]),
|
|
2801
|
-
x(n, {
|
|
2802
|
-
label: o(d)("inventory.recipe.bulkEditor.step2.addModification"),
|
|
2803
|
-
variant: "secondary",
|
|
2804
|
-
size: "md",
|
|
2805
|
-
"prepend-icon": "add",
|
|
2806
|
-
class: "shrink-0",
|
|
2807
|
-
onClick: y
|
|
2808
|
-
}, null, 8, ["label"])
|
|
2809
|
-
]),
|
|
2810
|
-
_("div", mi, [
|
|
2811
|
-
o(i).modifications.length === 0 ? (b(), V("div", fi, [
|
|
2812
|
-
x(k, {
|
|
2813
|
-
name: "edit_note",
|
|
2814
|
-
size: "lg",
|
|
2815
|
-
class: "text-fm-color-typo-placeholder"
|
|
2816
|
-
}),
|
|
2817
|
-
_("p", vi, M(o(d)("inventory.recipe.bulkEditor.step2.emptyState")), 1)
|
|
2818
|
-
])) : e.value !== null && o(i).modifications[e.value] ? (b(), W(qo, {
|
|
2819
|
-
key: e.value,
|
|
2820
|
-
"model-value": o(i).modifications[e.value],
|
|
2821
|
-
"live-preview-entries": o(i).livePreviewEntries,
|
|
2822
|
-
"onUpdate:modelValue": u[2] || (u[2] = (I) => o(i).updateModification(e.value, I))
|
|
2823
|
-
}, null, 8, ["model-value", "live-preview-entries"])) : R("", !0)
|
|
2824
|
-
])
|
|
2825
|
-
]),
|
|
2826
|
-
u[3] || (u[3] = _("div", { class: "border-t border-fm-color-border-default shrink-0" }, null, -1)),
|
|
2827
|
-
_("div", yi, [
|
|
2828
|
-
_("span", bi, M(o(d)("inventory.recipe.bulkEditor.step2.livePreviewTitle")), 1),
|
|
2829
|
-
x(si)
|
|
2830
|
-
])
|
|
2831
|
-
]);
|
|
2832
|
-
};
|
|
2833
|
-
}
|
|
2834
|
-
});
|
|
2835
|
-
function _i(m) {
|
|
2836
|
-
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([d, i]) => `${d}: ${i}`).join(", ");
|
|
2837
|
-
}
|
|
2838
|
-
function ki() {
|
|
2839
|
-
const m = ee(), d = ge(), i = m.skuById, e = m.recipeById, r = Object.values(d.entries).filter(
|
|
2840
|
-
(s) => s.status === "will-update" || s.status === "partially-ignored"
|
|
2841
|
-
).flatMap((s, u) => {
|
|
2842
|
-
var w;
|
|
2843
|
-
const n = s.projected ?? s.original, g = _i(n.customAttributes);
|
|
2844
|
-
if ((w = n.contains) != null && w.length) {
|
|
2845
|
-
const k = n.contains.filter((c) => c.type === "RECIPE"), I = n.contains.filter((c) => c.type === "SKU");
|
|
2846
|
-
return [
|
|
2847
|
-
...u === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2848
|
-
...k.map(
|
|
2849
|
-
(c, E) => {
|
|
2850
|
-
var S;
|
|
2851
|
-
return [
|
|
2852
|
-
E === 0 ? n.name : "",
|
|
2853
|
-
"RECIPE",
|
|
2854
|
-
"",
|
|
2855
|
-
((S = e[c.id]) == null ? void 0 : S.name) ?? c.id,
|
|
2856
|
-
ae(c.amount),
|
|
2857
|
-
"UNIT",
|
|
2858
|
-
E === 0 ? g : ""
|
|
2859
|
-
];
|
|
2860
|
-
}
|
|
2861
|
-
),
|
|
2862
|
-
...I.map(
|
|
2863
|
-
(c, E) => {
|
|
2864
|
-
var S, h, l, f;
|
|
2865
|
-
return [
|
|
2866
|
-
!k.length && E === 0 ? n.name : "",
|
|
2867
|
-
"INGREDIENT",
|
|
2868
|
-
((S = i[c.id]) == null ? void 0 : S.code) ?? "",
|
|
2869
|
-
((h = i[c.id]) == null ? void 0 : h.name) ?? c.id,
|
|
2870
|
-
ae(c.amount),
|
|
2871
|
-
c.measurement ? c.measurement.abbrev : ((f = (l = i[c.id]) == null ? void 0 : l.unit) == null ? void 0 : f.abbrev) ?? "",
|
|
2872
|
-
!k.length && E === 0 ? g : ""
|
|
2873
|
-
];
|
|
2874
|
-
}
|
|
2875
|
-
)
|
|
2876
|
-
];
|
|
2877
|
-
}
|
|
2878
|
-
return [
|
|
2879
|
-
...u === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
2880
|
-
[n.name, "No bindings", "", "", "", "", g]
|
|
2881
|
-
];
|
|
2882
|
-
}), v = at(r, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
2883
|
-
rt(v, `RECIPE_BULK_EDIT_${st(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
2884
|
-
}
|
|
2885
|
-
const hi = { class: "flex flex-col gap-16" }, xi = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary p-16" }, wi = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary mb-8" }, Ei = { class: "flex flex-wrap gap-12" }, $i = { class: "flex items-center gap-6" }, Ii = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vi = {
|
|
2886
|
-
key: 0,
|
|
2887
|
-
class: "flex items-center gap-6"
|
|
2888
|
-
}, Si = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ci = {
|
|
2889
|
-
key: 1,
|
|
2890
|
-
class: "flex items-center gap-6"
|
|
2891
|
-
}, Fi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bi = {
|
|
2892
|
-
key: 2,
|
|
2893
|
-
class: "flex items-center gap-6"
|
|
2894
|
-
}, Ri = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ai = {
|
|
2895
|
-
key: 3,
|
|
2896
|
-
class: "flex items-center gap-6"
|
|
2897
|
-
}, Ti = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mi = { class: "mt-12" }, Pi = ["onClick"], Ui = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary flex-1 truncate" }, Di = {
|
|
2898
|
-
key: 0,
|
|
2899
|
-
class: "px-12 py-8 border-b border-fm-color-border-default"
|
|
2900
|
-
}, Ni = { class: "px-12 py-10 leading-relaxed" }, zi = {
|
|
2901
|
-
key: 2,
|
|
2902
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder italic"
|
|
2903
|
-
}, ji = { class: "flex items-center gap-12 px-12 py-8 border-t border-fm-color-border-default bg-fm-color-surface-secondary text-fm-color-typo-secondary fm-typo-en-body-xs-400" }, Li = { key: 0 }, Oi = { key: 1 }, Ki = {
|
|
2904
|
-
key: 2,
|
|
2905
|
-
class: "text-fm-color-warning"
|
|
2906
|
-
}, Gi = {
|
|
2907
|
-
key: 3,
|
|
2908
|
-
class: "text-fm-color-error"
|
|
2909
|
-
}, qi = {
|
|
2910
|
-
key: 4,
|
|
2911
|
-
class: "text-fm-color-typo-placeholder"
|
|
2912
|
-
}, Wi = /* @__PURE__ */ oe({
|
|
2913
|
-
__name: "RecipeBulkEditorSummaryStep",
|
|
2914
|
-
setup(m) {
|
|
2915
|
-
const { t: d } = ne(), i = ee(), e = ge(), t = C(() => Object.values(e.entries)), r = C(
|
|
2916
|
-
() => t.value.filter((l) => l.status === "will-update").length
|
|
2917
|
-
), y = C(
|
|
2918
|
-
() => t.value.filter((l) => l.status === "partially-ignored").length
|
|
2919
|
-
), v = C(
|
|
2920
|
-
() => t.value.filter((l) => l.status === "already-satisfied").length
|
|
2921
|
-
), s = C(
|
|
2922
|
-
() => t.value.filter((l) => l.status === "blocked").length
|
|
2923
|
-
), u = C(
|
|
2924
|
-
() => t.value.filter((l) => l.status === "no-applicable-changes").length
|
|
2925
|
-
), n = O(/* @__PURE__ */ new Set());
|
|
2926
|
-
function g(l) {
|
|
2927
|
-
return n.value.has(l);
|
|
2928
|
-
}
|
|
2929
|
-
function w(l) {
|
|
2930
|
-
const f = new Set(n.value);
|
|
2931
|
-
f.has(l) ? f.delete(l) : f.add(l), n.value = f;
|
|
2932
|
-
}
|
|
2933
|
-
function k(l) {
|
|
2934
|
-
var p, T, D;
|
|
2935
|
-
const f = [], a = _e(l.contains, /* @__PURE__ */ new Set([l._id]), i.recipeById);
|
|
2936
|
-
for (let B = 0; B < a.length; B++) {
|
|
2937
|
-
const z = a[B], j = z.recipeIds.slice(1).length > 0, F = j ? ((p = i.recipeById[z.recipeIds.at(-1) ?? ""]) == null ? void 0 : p.name) ?? "" : "", U = i.skuById[z.id];
|
|
2938
|
-
if (!U) continue;
|
|
2939
|
-
const J = ((T = z.measurement) == null ? void 0 : T.abbrev) ?? ((D = U.unit) == null ? void 0 : D.abbrev) ?? "", Q = `${ae(z.amount)}${J}`, te = j ? `(${F}) ${U.name} (${Q})` : `${U.name} (${Q})`;
|
|
2940
|
-
B > 0 && f.push({ text: ", " }), f.push({ text: te });
|
|
2941
|
-
}
|
|
2942
|
-
return f;
|
|
2943
|
-
}
|
|
2944
|
-
function I(l) {
|
|
2945
|
-
var B, z, j;
|
|
2946
|
-
const f = i.skuById[l.id];
|
|
2947
|
-
if (!f) return "";
|
|
2948
|
-
const a = l.recipeIds.slice(1).length > 0, p = a ? ((B = i.recipeById[l.recipeIds.at(-1) ?? ""]) == null ? void 0 : B.name) ?? "" : "", T = ((z = l.measurement) == null ? void 0 : z.abbrev) ?? ((j = f.unit) == null ? void 0 : j.abbrev) ?? "", D = `${ae(l.amount)}${T}`;
|
|
2949
|
-
return a ? `(${p}) ${f.name} (${D})` : `${f.name} (${D})`;
|
|
2950
|
-
}
|
|
2951
|
-
function c(l) {
|
|
2952
|
-
if (!l.projected) return [];
|
|
2953
|
-
const f = _e(l.original.contains, /* @__PURE__ */ new Set([l.recipeId]), i.recipeById), a = _e(l.projected.contains, /* @__PURE__ */ new Set([l.recipeId]), i.recipeById), p = /* @__PURE__ */ new Map();
|
|
2954
|
-
for (const j of f) p.set(`${j.type}:${j.id}`, j);
|
|
2955
|
-
const T = /* @__PURE__ */ new Map();
|
|
2956
|
-
for (const j of a) T.set(`${j.type}:${j.id}`, j);
|
|
2957
|
-
const D = [];
|
|
2958
|
-
let B = !0;
|
|
2959
|
-
function z(j, F) {
|
|
2960
|
-
F && (B || D.push({ kind: "unchanged", text: ", " }), D.push({ kind: j, text: F }), B = !1);
|
|
2961
|
-
}
|
|
2962
|
-
for (const [j, F] of p) {
|
|
2963
|
-
const U = T.get(j);
|
|
2964
|
-
if (!U)
|
|
2965
|
-
z("removed", I(F));
|
|
2966
|
-
else {
|
|
2967
|
-
const J = I(F), Q = I(U);
|
|
2968
|
-
J === Q ? z("unchanged", J) : (z("removed", J), z("added", Q));
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
for (const [j, F] of T)
|
|
2972
|
-
p.has(j) || z("added", I(F));
|
|
2973
|
-
return D;
|
|
2974
|
-
}
|
|
2975
|
-
const E = C(() => {
|
|
2976
|
-
const l = /* @__PURE__ */ new Map();
|
|
2977
|
-
for (const f of t.value)
|
|
2978
|
-
l.set(f.recipeId, c(f));
|
|
2979
|
-
return l;
|
|
2980
|
-
});
|
|
2981
|
-
function S(l) {
|
|
2982
|
-
switch (l) {
|
|
2983
|
-
case "will-update":
|
|
2984
|
-
return d("inventory.recipe.bulkEditor.status.willUpdate");
|
|
2985
|
-
case "already-satisfied":
|
|
2986
|
-
return d("inventory.recipe.bulkEditor.status.alreadySatisfied");
|
|
2987
|
-
case "partially-ignored":
|
|
2988
|
-
return d("inventory.recipe.bulkEditor.status.partiallyIgnored");
|
|
2989
|
-
case "blocked":
|
|
2990
|
-
return d("inventory.recipe.bulkEditor.status.blocked");
|
|
2991
|
-
case "no-applicable-changes":
|
|
2992
|
-
return d("inventory.recipe.bulkEditor.status.noApplicableChanges");
|
|
2993
|
-
default:
|
|
2994
|
-
return "";
|
|
2995
|
-
}
|
|
2996
|
-
}
|
|
2997
|
-
function h(l) {
|
|
2998
|
-
switch (l) {
|
|
2999
|
-
case "will-update":
|
|
3000
|
-
return "success";
|
|
3001
|
-
case "already-satisfied":
|
|
3002
|
-
return "info";
|
|
3003
|
-
case "partially-ignored":
|
|
3004
|
-
return "warning";
|
|
3005
|
-
case "blocked":
|
|
3006
|
-
return "critical";
|
|
3007
|
-
case "no-applicable-changes":
|
|
3008
|
-
return "neutral";
|
|
3009
|
-
default:
|
|
3010
|
-
return "neutral";
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
return (l, f) => {
|
|
3014
|
-
const a = P("FmChip"), p = P("FmButton"), T = P("FmBanner"), D = P("FmIcon");
|
|
3015
|
-
return b(), V("div", hi, [
|
|
3016
|
-
_("div", xi, [
|
|
3017
|
-
_("p", wi, M(o(d)("inventory.recipe.bulkEditor.summary.title")), 1),
|
|
3018
|
-
_("div", Ei, [
|
|
3019
|
-
_("div", $i, [
|
|
3020
|
-
x(a, {
|
|
3021
|
-
size: "sm",
|
|
3022
|
-
label: String(r.value),
|
|
3023
|
-
variant: "success"
|
|
3024
|
-
}, null, 8, ["label"]),
|
|
3025
|
-
_("span", Ii, M(o(d)("inventory.recipe.bulkEditor.summary.countWillUpdate")), 1)
|
|
3026
|
-
]),
|
|
3027
|
-
y.value > 0 ? (b(), V("div", Vi, [
|
|
3028
|
-
x(a, {
|
|
3029
|
-
size: "sm",
|
|
3030
|
-
label: String(y.value),
|
|
3031
|
-
variant: "warning"
|
|
3032
|
-
}, null, 8, ["label"]),
|
|
3033
|
-
_("span", Si, M(o(d)("inventory.recipe.bulkEditor.summary.countPartiallyIgnored")), 1)
|
|
3034
|
-
])) : R("", !0),
|
|
3035
|
-
v.value > 0 ? (b(), V("div", Ci, [
|
|
3036
|
-
x(a, {
|
|
3037
|
-
size: "sm",
|
|
3038
|
-
label: String(v.value),
|
|
3039
|
-
variant: "info"
|
|
3040
|
-
}, null, 8, ["label"]),
|
|
3041
|
-
_("span", Fi, M(o(d)("inventory.recipe.bulkEditor.summary.countAlreadySatisfied")), 1)
|
|
3042
|
-
])) : R("", !0),
|
|
3043
|
-
s.value > 0 ? (b(), V("div", Bi, [
|
|
3044
|
-
x(a, {
|
|
3045
|
-
size: "sm",
|
|
3046
|
-
label: String(s.value),
|
|
3047
|
-
variant: "critical"
|
|
3048
|
-
}, null, 8, ["label"]),
|
|
3049
|
-
_("span", Ri, M(o(d)("inventory.recipe.bulkEditor.summary.countBlocked")), 1)
|
|
3050
|
-
])) : R("", !0),
|
|
3051
|
-
u.value > 0 ? (b(), V("div", Ai, [
|
|
3052
|
-
x(a, {
|
|
3053
|
-
size: "sm",
|
|
3054
|
-
label: String(u.value),
|
|
3055
|
-
variant: "neutral"
|
|
3056
|
-
}, null, 8, ["label"]),
|
|
3057
|
-
_("span", Ti, M(o(d)("inventory.recipe.bulkEditor.summary.countNoChanges")), 1)
|
|
3058
|
-
])) : R("", !0)
|
|
3059
|
-
]),
|
|
3060
|
-
_("div", Mi, [
|
|
3061
|
-
x(p, {
|
|
3062
|
-
label: o(d)("common.export"),
|
|
3063
|
-
variant: "secondary",
|
|
3064
|
-
size: "md",
|
|
3065
|
-
onClick: o(ki)
|
|
3066
|
-
}, null, 8, ["label", "onClick"])
|
|
3067
|
-
]),
|
|
3068
|
-
r.value === 0 && y.value === 0 ? (b(), W(T, {
|
|
3069
|
-
key: 0,
|
|
3070
|
-
class: "mt-12",
|
|
3071
|
-
type: "warning",
|
|
3072
|
-
message: o(d)("inventory.recipe.bulkEditor.summary.nothingToSubmit")
|
|
3073
|
-
}, null, 8, ["message"])) : R("", !0)
|
|
3074
|
-
]),
|
|
3075
|
-
(b(!0), V(H, null, me(t.value, (B) => (b(), V("div", {
|
|
3076
|
-
key: B.recipeId,
|
|
3077
|
-
class: "rounded-lg border border-fm-color-border-default overflow-hidden"
|
|
3078
|
-
}, [
|
|
3079
|
-
_("button", {
|
|
3080
|
-
type: "button",
|
|
3081
|
-
class: Ue(["w-full flex items-center gap-8 px-12 py-10 bg-fm-color-surface-secondary border-b border-fm-color-border-default text-left cursor-pointer", { "border-b-0": !g(B.recipeId) }]),
|
|
3082
|
-
onClick: (z) => w(B.recipeId)
|
|
3083
|
-
}, [
|
|
3084
|
-
x(D, {
|
|
3085
|
-
name: g(B.recipeId) ? "expand_less" : "expand_more",
|
|
3086
|
-
size: "sm",
|
|
3087
|
-
class: "text-fm-color-typo-secondary flex-shrink-0"
|
|
3088
|
-
}, null, 8, ["name"]),
|
|
3089
|
-
_("span", Ui, M(B.recipeName), 1),
|
|
3090
|
-
B.original.version === "v2" ? (b(), W(a, {
|
|
3091
|
-
key: 0,
|
|
3092
|
-
size: "sm",
|
|
3093
|
-
label: "V2",
|
|
3094
|
-
variant: "info"
|
|
3095
|
-
})) : R("", !0),
|
|
3096
|
-
x(a, {
|
|
3097
|
-
size: "sm",
|
|
3098
|
-
label: S(B.status),
|
|
3099
|
-
variant: h(B.status)
|
|
3100
|
-
}, null, 8, ["label", "variant"])
|
|
3101
|
-
], 10, Pi),
|
|
3102
|
-
g(B.recipeId) ? (b(), V(H, { key: 0 }, [
|
|
3103
|
-
o(e).applyErrors.has(B.recipeId) ? (b(), V("div", Di, [
|
|
3104
|
-
x(T, {
|
|
3105
|
-
type: "error",
|
|
3106
|
-
message: o(e).applyErrors.get(B.recipeId)
|
|
3107
|
-
}, null, 8, ["message"])
|
|
3108
|
-
])) : R("", !0),
|
|
3109
|
-
_("div", Ni, [
|
|
3110
|
-
B.projected ? (E.value.get(B.recipeId) ?? []).length > 0 ? (b(!0), V(H, { key: 1 }, me(E.value.get(B.recipeId), (z, j) => (b(), V("span", {
|
|
3111
|
-
key: j,
|
|
3112
|
-
class: Ue(["fm-typo-en-body-sm-400", {
|
|
3113
|
-
"text-fm-color-typo-secondary": z.kind === "unchanged",
|
|
3114
|
-
"line-through text-fm-color-error font-medium": z.kind === "removed",
|
|
3115
|
-
"text-fm-color-success font-medium": z.kind === "added"
|
|
3116
|
-
}])
|
|
3117
|
-
}, M(z.text), 3))), 128)) : (b(), V("span", zi, M(o(d)("inventory.recipe.bulkEditor.summary.emptyBindings")), 1)) : (b(!0), V(H, { key: 0 }, me(k(B.original), (z, j) => (b(), V("span", {
|
|
3118
|
-
key: j,
|
|
3119
|
-
class: "fm-typo-en-body-sm-400 text-fm-color-typo-placeholder"
|
|
3120
|
-
}, M(z.text), 1))), 128))
|
|
3121
|
-
]),
|
|
3122
|
-
_("div", ji, [
|
|
3123
|
-
B.counts.applied > 0 ? (b(), V("span", Li, M(o(d)("inventory.recipe.bulkEditor.summary.footerApplied", { count: B.counts.applied })), 1)) : R("", !0),
|
|
3124
|
-
B.counts.satisfied > 0 ? (b(), V("span", Oi, M(o(d)("inventory.recipe.bulkEditor.summary.footerSatisfied", { count: B.counts.satisfied })), 1)) : R("", !0),
|
|
3125
|
-
B.counts.ignored > 0 ? (b(), V("span", Ki, M(o(d)("inventory.recipe.bulkEditor.summary.footerIgnored", { count: B.counts.ignored })), 1)) : R("", !0),
|
|
3126
|
-
B.counts.blocked > 0 ? (b(), V("span", Gi, M(o(d)("inventory.recipe.bulkEditor.summary.footerBlocked", { count: B.counts.blocked })), 1)) : R("", !0),
|
|
3127
|
-
B.counts.applied === 0 && B.counts.satisfied === 0 && B.counts.ignored === 0 && B.counts.blocked === 0 ? (b(), V("span", qi, M(o(d)("inventory.recipe.bulkEditor.summary.noChangesDetail")), 1)) : R("", !0)
|
|
3128
|
-
])
|
|
3129
|
-
], 64)) : R("", !0)
|
|
3130
|
-
]))), 128))
|
|
3131
|
-
]);
|
|
3132
|
-
};
|
|
3133
|
-
}
|
|
3134
|
-
}), Yi = { class: "flex items-center gap-12" }, Ji = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Hi = {
|
|
3135
|
-
key: 0,
|
|
3136
|
-
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
3137
|
-
}, Qi = {
|
|
3138
|
-
key: 1,
|
|
3139
|
-
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
3140
|
-
}, Xi = {
|
|
3141
|
-
key: 2,
|
|
3142
|
-
class: "h-[calc(98vh-120px)] overflow-y-auto px-24 py-20"
|
|
3143
|
-
}, Zi = {
|
|
3144
|
-
key: 0,
|
|
3145
|
-
class: "flex items-center gap-8 px-4"
|
|
3146
|
-
}, el = {
|
|
3147
|
-
key: 1,
|
|
3148
|
-
class: "flex items-center gap-8 px-4"
|
|
3149
|
-
}, tl = {
|
|
3150
|
-
key: 2,
|
|
3151
|
-
class: "flex items-center gap-8 px-4"
|
|
3152
|
-
}, nl = /* @__PURE__ */ oe({
|
|
3153
|
-
__name: "RecipeBulkEditorDialog",
|
|
3154
|
-
props: {
|
|
3155
|
-
show: { type: Boolean }
|
|
3156
|
-
},
|
|
3157
|
-
emits: ["update:show"],
|
|
3158
|
-
setup(m, { emit: d }) {
|
|
3159
|
-
const i = m, { t: e } = ne(), t = ge(), r = De(i, "show"), y = Le(), v = C(() => t.currentStep === 1), s = C(() => t.currentStep === 2), u = C(() => t.currentStep === 3);
|
|
3160
|
-
function n() {
|
|
3161
|
-
t.currentStep = 2;
|
|
3162
|
-
}
|
|
3163
|
-
function g() {
|
|
3164
|
-
t.currentStep = 1;
|
|
3165
|
-
}
|
|
3166
|
-
function w() {
|
|
3167
|
-
t.goToStep3();
|
|
3168
|
-
}
|
|
3169
|
-
function k() {
|
|
3170
|
-
t.backToStep2();
|
|
3171
|
-
}
|
|
3172
|
-
function I() {
|
|
3173
|
-
y.open({
|
|
3174
|
-
title: e("inventory.recipe.bulkEditor.step3.confirmTitle"),
|
|
3175
|
-
message: e("inventory.recipe.bulkEditor.step3.confirmMessage"),
|
|
3176
|
-
primaryActions: {
|
|
3177
|
-
text: e("inventory.recipe.bulkEditor.step3.confirmButton"),
|
|
3178
|
-
variant: "primary",
|
|
3179
|
-
close: !0
|
|
3180
|
-
},
|
|
3181
|
-
secondaryActions: {
|
|
3182
|
-
text: e("common.cancel"),
|
|
3183
|
-
close: !0
|
|
3184
|
-
}
|
|
3185
|
-
}).onPrimary(async () => {
|
|
3186
|
-
await t.confirmAndApply();
|
|
3187
|
-
});
|
|
3188
|
-
}
|
|
3189
|
-
function c() {
|
|
3190
|
-
r.value = !1, t.reset();
|
|
3191
|
-
}
|
|
3192
|
-
return (E, S) => {
|
|
3193
|
-
const h = P("FmChip"), l = P("FmButton"), f = P("FmDialog");
|
|
3194
|
-
return b(), W(f, {
|
|
3195
|
-
modelValue: o(r),
|
|
3196
|
-
"onUpdate:modelValue": [
|
|
3197
|
-
S[0] || (S[0] = (a) => Pe(r) ? r.value = a : null),
|
|
3198
|
-
S[1] || (S[1] = (a) => {
|
|
3199
|
-
a || o(t).reset();
|
|
3200
|
-
})
|
|
3201
|
-
],
|
|
3202
|
-
overlay: !0,
|
|
3203
|
-
"close-button": "",
|
|
3204
|
-
"max-width": "98vw",
|
|
3205
|
-
"max-height": "98vh"
|
|
3206
|
-
}, {
|
|
3207
|
-
"dialog-header": Y(() => [
|
|
3208
|
-
_("div", Yi, [
|
|
3209
|
-
_("span", Ji, M(o(e)("inventory.recipe.bulkEditor.title")), 1),
|
|
3210
|
-
x(h, {
|
|
3211
|
-
size: "sm",
|
|
3212
|
-
label: o(e)("inventory.recipe.bulkEditor.stepIndicator", { step: o(t).currentStep, total: 3 }),
|
|
3213
|
-
variant: "neutral"
|
|
3214
|
-
}, null, 8, ["label"])
|
|
3215
|
-
])
|
|
3216
|
-
]),
|
|
3217
|
-
"dialog-footer": Y(() => [
|
|
3218
|
-
v.value ? (b(), V("div", Zi, [
|
|
3219
|
-
x(l, {
|
|
3220
|
-
label: o(e)("common.next"),
|
|
3221
|
-
disabled: !o(t).canGoToStep2,
|
|
3222
|
-
onClick: n
|
|
3223
|
-
}, null, 8, ["label", "disabled"]),
|
|
3224
|
-
x(l, {
|
|
3225
|
-
label: o(e)("common.close"),
|
|
3226
|
-
variant: "tertiary",
|
|
3227
|
-
onClick: c
|
|
3228
|
-
}, null, 8, ["label"])
|
|
3229
|
-
])) : s.value ? (b(), V("div", el, [
|
|
3230
|
-
x(l, {
|
|
3231
|
-
label: o(e)("inventory.recipe.bulkEditor.step2.reviewButton"),
|
|
3232
|
-
disabled: !o(t).canGoToStep3,
|
|
3233
|
-
onClick: w
|
|
3234
|
-
}, null, 8, ["label", "disabled"]),
|
|
3235
|
-
x(l, {
|
|
3236
|
-
label: o(e)("common.back"),
|
|
3237
|
-
variant: "secondary",
|
|
3238
|
-
onClick: g
|
|
3239
|
-
}, null, 8, ["label"]),
|
|
3240
|
-
x(l, {
|
|
3241
|
-
label: o(e)("common.close"),
|
|
3242
|
-
variant: "tertiary",
|
|
3243
|
-
onClick: c
|
|
3244
|
-
}, null, 8, ["label"])
|
|
3245
|
-
])) : u.value ? (b(), V("div", tl, [
|
|
3246
|
-
x(l, {
|
|
3247
|
-
label: o(e)("inventory.recipe.bulkEditor.step3.confirmButton"),
|
|
3248
|
-
disabled: o(t).isSaving,
|
|
3249
|
-
loading: o(t).isSaving,
|
|
3250
|
-
onClick: I
|
|
3251
|
-
}, null, 8, ["label", "disabled", "loading"]),
|
|
3252
|
-
x(l, {
|
|
3253
|
-
label: o(e)("common.back"),
|
|
3254
|
-
variant: "secondary",
|
|
3255
|
-
disabled: o(t).isSaving,
|
|
3256
|
-
onClick: k
|
|
3257
|
-
}, null, 8, ["label", "disabled"]),
|
|
3258
|
-
x(l, {
|
|
3259
|
-
label: o(e)("common.close"),
|
|
3260
|
-
variant: "tertiary",
|
|
3261
|
-
disabled: o(t).isSaving,
|
|
3262
|
-
onClick: c
|
|
3263
|
-
}, null, 8, ["label", "disabled"])
|
|
3264
|
-
])) : R("", !0)
|
|
3265
|
-
]),
|
|
3266
|
-
default: Y(() => [
|
|
3267
|
-
v.value ? (b(), V("div", Hi, [
|
|
3268
|
-
x(Co)
|
|
3269
|
-
])) : s.value ? (b(), V("div", Qi, [
|
|
3270
|
-
x(gi)
|
|
3271
|
-
])) : u.value ? (b(), V("div", Xi, [
|
|
3272
|
-
x(Wi)
|
|
3273
|
-
])) : R("", !0)
|
|
3274
|
-
]),
|
|
3275
|
-
_: 1
|
|
3276
|
-
}, 8, ["modelValue"]);
|
|
3277
|
-
};
|
|
3278
|
-
}
|
|
3279
|
-
});
|
|
3280
|
-
function ol(m) {
|
|
3281
|
-
return !m || Object.keys(m).length === 0 ? "" : Object.entries(m).map(([d, i]) => `${d}: ${i}`).join(", ");
|
|
3282
|
-
}
|
|
3283
|
-
function il() {
|
|
3284
|
-
const m = ee(), d = m.recipes, i = m.recipeById, e = m.skuById, t = d.flatMap((v, s) => {
|
|
3285
|
-
var n;
|
|
3286
|
-
const u = ol(v.customAttributes);
|
|
3287
|
-
if ((n = v.contains) != null && n.length) {
|
|
3288
|
-
const g = v.contains.filter((k) => k.type === "RECIPE"), w = v.contains.filter((k) => k.type === "SKU");
|
|
3289
|
-
return [
|
|
3290
|
-
...s === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
3291
|
-
...g.map(
|
|
3292
|
-
(k, I) => {
|
|
3293
|
-
var c;
|
|
3294
|
-
return [
|
|
3295
|
-
I === 0 ? v.name : "",
|
|
3296
|
-
"RECIPE",
|
|
3297
|
-
"",
|
|
3298
|
-
(c = i[k.id]) == null ? void 0 : c.name,
|
|
3299
|
-
ae(k.amount),
|
|
3300
|
-
"UNIT",
|
|
3301
|
-
I === 0 ? u : ""
|
|
3302
|
-
];
|
|
3303
|
-
}
|
|
3304
|
-
),
|
|
3305
|
-
...w.map(
|
|
3306
|
-
(k, I) => {
|
|
3307
|
-
var c, E, S, h;
|
|
3308
|
-
return [
|
|
3309
|
-
!g.length && I === 0 ? v.name : "",
|
|
3310
|
-
"INGREDIENT",
|
|
3311
|
-
(c = e[k.id]) == null ? void 0 : c.code,
|
|
3312
|
-
(E = e[k.id]) == null ? void 0 : E.name,
|
|
3313
|
-
ae(k.amount),
|
|
3314
|
-
k.measurement ? k.measurement.abbrev : (h = (S = e[k.id]) == null ? void 0 : S.unit) == null ? void 0 : h.abbrev,
|
|
3315
|
-
!g.length && I === 0 ? u : ""
|
|
3316
|
-
];
|
|
3317
|
-
}
|
|
3318
|
-
)
|
|
3319
|
-
];
|
|
3320
|
-
}
|
|
3321
|
-
return [
|
|
3322
|
-
...s === 0 ? [] : [["", "", "", "", "", "", ""]],
|
|
3323
|
-
[v.name, "No bindings", "", "", "", "", u]
|
|
3324
|
-
];
|
|
3325
|
-
}), y = at(t, ["Name", "Type", "Code", "Item", "Amount", "Unit", "Custom Attributes"]);
|
|
3326
|
-
rt(y, `RECIPE_${st(/* @__PURE__ */ new Date(), "-", "-")}.xlsx`);
|
|
3327
|
-
}
|
|
3328
|
-
const ll = { class: "flex flex-col py-8" }, al = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, rl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ml = /* @__PURE__ */ oe({
|
|
3329
|
-
__name: "RecipeView",
|
|
3330
|
-
setup(m) {
|
|
3331
|
-
const d = ee(), i = C(() => d.recipes), e = Ze(), { createRecipe: t, updateRecipe: r } = ze(), { recipeDialogProps: y, recipeViewLoading: v } = It(ze()), { columnDefs: s, formatRowData: u } = Ht(), n = C(() => u(i.value)), g = ge(), w = Ke();
|
|
3332
|
-
O(!1);
|
|
3333
|
-
function k(a) {
|
|
3334
|
-
if (a === "add")
|
|
3335
|
-
return t();
|
|
3336
|
-
if (a === "export")
|
|
3337
|
-
return il();
|
|
3338
|
-
a === "bulk-edit" && g.openDialog();
|
|
3339
|
-
}
|
|
3340
|
-
const I = O(""), c = C(() => v.value), { breakpoints: E } = ht(), S = C(() => E.value.xs || E.value.sm), h = C(() => S.value ? 10 : 20), l = Ct(), { t: f } = ne();
|
|
3341
|
-
return (a, p) => {
|
|
3342
|
-
const T = P("FmTable");
|
|
3343
|
-
return b(), W(Ft, {
|
|
3344
|
-
title: o(f)("inventory.recipe.title"),
|
|
3345
|
-
actions: [
|
|
3346
|
-
{
|
|
3347
|
-
label: o(f)("inventory.recipe.create.title"),
|
|
3348
|
-
value: "add",
|
|
3349
|
-
isPrimary: !0,
|
|
3350
|
-
prependIcon: "add"
|
|
3351
|
-
},
|
|
3352
|
-
...o(w).enableBulkEditRecipes ? [{ label: o(f)("inventory.recipe.bulkEditor.title"), value: "bulk-edit", isPrimary: !1 }] : [],
|
|
3353
|
-
{ label: o(f)("common.export"), value: "export", isPrimary: !1 }
|
|
3354
|
-
],
|
|
3355
|
-
"onClick:action": k
|
|
3356
|
-
}, {
|
|
3357
|
-
default: Y(() => [
|
|
3358
|
-
_("div", {
|
|
3359
|
-
class: Ue([
|
|
3360
|
-
"relative flex flex-col gap-8 max-h-full",
|
|
3361
|
-
{
|
|
3362
|
-
"p-0": S.value,
|
|
3363
|
-
"px-24 ": !S.value
|
|
3364
|
-
}
|
|
3365
|
-
])
|
|
3366
|
-
}, [
|
|
3367
|
-
x(Gt, {
|
|
3368
|
-
searchable: "",
|
|
3369
|
-
search: I.value,
|
|
3370
|
-
"onUpdate:search": p[0] || (p[0] = (D) => I.value = D)
|
|
3371
|
-
}, null, 8, ["search"]),
|
|
3372
|
-
(b(), W(T, {
|
|
3373
|
-
style: ft(o(l).tableHeight),
|
|
3374
|
-
"column-defs": o(s),
|
|
3375
|
-
"row-data": n.value,
|
|
3376
|
-
"search-value": I.value,
|
|
3377
|
-
loading: !o(e)._currentLocation || c.value,
|
|
3378
|
-
onRowClick: p[1] || (p[1] = (D) => o(r)(D.original.original)),
|
|
3379
|
-
key: i.value.length,
|
|
3380
|
-
"page-size": h.value
|
|
3381
|
-
}, {
|
|
3382
|
-
"list-row": Y((D) => [
|
|
3383
|
-
x(Kt, {
|
|
3384
|
-
row: D,
|
|
3385
|
-
onRowClick: (B) => o(r)(B.original)
|
|
3386
|
-
}, {
|
|
3387
|
-
default: Y((B) => {
|
|
3388
|
-
var z, j, F, U, J, Q, te, N, K, G;
|
|
3389
|
-
return [
|
|
3390
|
-
_("div", ll, [
|
|
3391
|
-
_("div", al, [
|
|
3392
|
-
x(o(Je), {
|
|
3393
|
-
render: (F = (j = (z = B.recipe) == null ? void 0 : z.column) == null ? void 0 : j.columnDef) == null ? void 0 : F.cell,
|
|
3394
|
-
props: (J = (U = B.recipe) == null ? void 0 : U.getContext) == null ? void 0 : J.call(U)
|
|
3395
|
-
}, null, 8, ["render", "props"])
|
|
3396
|
-
]),
|
|
3397
|
-
_("div", rl, [
|
|
3398
|
-
x(o(Je), {
|
|
3399
|
-
render: (N = (te = (Q = B.ingredients) == null ? void 0 : Q.column) == null ? void 0 : te.columnDef) == null ? void 0 : N.cell,
|
|
3400
|
-
props: (G = (K = B.ingredients) == null ? void 0 : K.getContext) == null ? void 0 : G.call(K)
|
|
3401
|
-
}, null, 8, ["render", "props"])
|
|
3402
|
-
])
|
|
3403
|
-
])
|
|
3404
|
-
];
|
|
3405
|
-
}),
|
|
3406
|
-
_: 2
|
|
3407
|
-
}, 1032, ["row", "onRowClick"])
|
|
3408
|
-
]),
|
|
3409
|
-
_: 1
|
|
3410
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
3411
|
-
], 2),
|
|
3412
|
-
(b(), W(vt, { to: "body" }, [
|
|
3413
|
-
x(to, yt(bt(o(y))), null, 16),
|
|
3414
|
-
o(w).enableBulkEditRecipes ? (b(), W(nl, {
|
|
3415
|
-
key: 0,
|
|
3416
|
-
show: o(g).show,
|
|
3417
|
-
"onUpdate:show": p[2] || (p[2] = (D) => o(g).show = D)
|
|
3418
|
-
}, null, 8, ["show"])) : R("", !0)
|
|
3419
|
-
]))
|
|
3420
|
-
]),
|
|
3421
|
-
_: 1
|
|
3422
|
-
}, 8, ["title", "actions"]);
|
|
3423
|
-
};
|
|
3424
|
-
}
|
|
3425
|
-
});
|
|
3426
|
-
export {
|
|
3427
|
-
Ml as default
|
|
3428
|
-
};
|