@ozdao/prometheus-framework 0.2.309 → 0.2.311
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/products.server.js +192 -195
- package/dist/products.server.mjs +192 -195
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js.map +1 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs +2 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js +3 -2
- package/dist/prometheus-framework/src/components/Chips/Chips.vue2.js.map +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.js +1 -1
- package/dist/prometheus-framework/src/components/EditImages/EditImages.vue2.js.map +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +13 -12
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +13 -12
- package/dist/prometheus-framework/src/components/Field/Field.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs +1 -0
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js +1 -0
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs +6 -2
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.js +6 -2
- package/dist/prometheus-framework/src/modules/auth/views/store/auth.js.map +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +2 -4
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +3 -5
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/BottomNavigationBar.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +18 -15
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js +21 -18
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs +4 -0
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.js +4 -0
- package/dist/prometheus-framework/src/modules/globals/views/store/globals.js.map +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +2 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +554 -554
- package/dist/prometheus-framework/src/modules/pages/pages.client.js +554 -554
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardCategory.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs +11 -10
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +11 -10
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +78 -43
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +83 -48
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +80 -30
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +91 -41
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +119 -80
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +132 -93
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +39 -21
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +51 -33
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs +96 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.js +96 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.js.map +1 -0
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +21 -7
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +21 -7
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/Filters.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/products.client.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/products.client.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/categories.router.cjs +17 -5
- package/dist/prometheus-framework/src/modules/products/router/categories.router.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/categories.router.js +17 -5
- package/dist/prometheus-framework/src/modules/products/router/categories.router.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/products.router.cjs +1 -12
- package/dist/prometheus-framework/src/modules/products/router/products.router.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/router/products.router.js +1 -12
- package/dist/prometheus-framework/src/modules/products/router/products.router.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/categories.cjs +52 -71
- package/dist/prometheus-framework/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/categories.js +52 -71
- package/dist/prometheus-framework/src/modules/products/store/categories.js.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.cjs +6 -8
- package/dist/prometheus-framework/src/modules/products/store/products.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/products/store/products.js +6 -8
- package/dist/prometheus-framework/src/modules/products/store/products.js.map +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
- package/package.json +1 -1
- package/src/components/Block/Block.vue +1 -1
- package/src/components/EditImages/EditImages.vue +1 -1
- package/src/modules/auth/views/middlewares/auth.validation.js +1 -0
- package/src/modules/auth/views/store/auth.js +6 -2
- package/src/modules/backoffice/components/pages/Dashboard.vue +1 -3
- package/src/modules/globals/views/components/partials/BottomNavigationBar.vue +3 -3
- package/src/modules/globals/views/components/partials/NavigationBar.vue +4 -4
- package/src/modules/globals/views/store/globals.js +5 -0
- package/src/modules/organizations/components/pages/Organization.vue +1 -1
- package/src/modules/organizations/components/pages/OrganizationBackoffice.vue +1 -2
- package/src/modules/products/components/blocks/CardCategory.vue +14 -3
- package/src/modules/products/components/blocks/CardProduct.vue +12 -11
- package/src/modules/products/components/pages/Categories.vue +120 -28
- package/src/modules/products/components/pages/CategoryEdit.vue +206 -151
- package/src/modules/products/components/pages/ProductEdit.vue +107 -69
- package/src/modules/products/components/pages/Products.vue +35 -20
- package/src/modules/products/components/sections/CategoriesTree.vue +102 -0
- package/src/modules/products/components/sections/EditProductInfo.vue +53 -40
- package/src/modules/products/controllers/categories.controller.js +175 -97
- package/src/modules/products/controllers/products.controller.js +4 -2
- package/src/modules/products/models/category.model.js +15 -66
- package/src/modules/products/models/product.model.js +15 -12
- package/src/modules/products/products.client.js +0 -1
- package/src/modules/products/router/categories.router.js +17 -5
- package/src/modules/products/router/products.router.js +0 -12
- package/src/modules/products/routes/categories.routes.js +5 -34
- package/src/modules/products/store/categories.js +69 -83
- package/src/modules/products/store/products.js +6 -8
package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ProductEdit.vue.js","sources":["../../../../../../../src/modules/products/components/pages/ProductEdit.vue"],"sourcesContent":["<template>\n\t<div class=\"for-transition w-100 cols-1 pd-thin gap-thin\">\n \n <Block class=\"flex-nowrap flex-v-center flex\">\n \n <h1 class=\"mn-r-auto\">\n\t\t\t {{ route.params.product ? products.state.current.name : 'Create Product' }}\n\t\t\t</h1>\n\n\t\t\t<Button \n\t\t\t\tv-if=\"route.params.product\"\n \t:submit=\"onDelete\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-red mn-r-thin\"\n >\n \t\tDelete \n \t</Button>\n\n <Button \n \t:submit=\"onSubmit\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-main\"\n >\n \t\tSave\n \t</Button>\n </Block>\n\n <Block\n\t\t\tplaceholder=\"The product doesn't have any images yet.\"\n\t\t\tclass=\"h-min\"\n\t\t>\n\t\t\t<EditImages \n\t\t\t\t:images=\"products.state.current.images\"\n\t\t\t\t:uploadPath=\"'photos'\" \n\t\t\t\t@update:images=\"(imagesNew) => { products.state.current.images = imagesNew }\" \n\t\t\t/>\n\t\t</Block>\n\n <div class=\"cols-2 gap-thin\">\n\n \t<Block\n \t\t\ttitle=\"Profile\"\n \t\t>\n\t\t\t\t<EditProductInfo \t\t\n\t\t\t\t\t:product=\"products.state.current\"\n\t\t\t\t/>\n\t\t\t</Block>\n\n\t\t\t<Block\n\t\t title=\"Ingredients\"\n\t\t\t\tplaceholder=\"No ingridients added yet\"\n\t\t\t\t:actions=\"[{\n\t label: '+',\n\t function: () => openIngredientPopup()\n\t }]\"\n\t\t >\n\t\t \t<div v-if=\"products.state.current.ingredients.length > 0\" class=\"cols-1 gap-thin\">\n\t\t\t <CardPosition \n\t\t\t v-for=\"(product, index) in products.state.current.ingredients\" \n\t\t\t :key=\"product._id\" \n\t\t\t :product=\"product\"\n\t\t\t :array=\"products.state.current.ingredients\"\n\t\t\t :products=\"Products\"\n\t\t :showPrice=\"false\"\n\t\t\t @add=\"(item) => {\n\t\t\t\t\t globals.actions.add(products.state.current.ingredients, item);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @update=\"(item) => {\n\t\t\t\t\t globals.actions.update(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @delete=\"(item) => {\n\t\t\t\t\t globals.actions.delete(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t />\n\t\t\t </div>\n\t\t </Block>\n\n\t\t <Popup \n\t title=\"Add ingredient\" \n\t @close-popup=\"closeIngredientPopup\" \n\t :isPopupOpen=\"isOpenIngredientPopup\"\n\t class=\"bg-white w-min-30r w-max-30r radius-big pd-medium\"\n\t >\n\t <div class=\"bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big\">\n\t <Feed\n\t :search=\"{\n\t \tclass: 'bg-white mn-b-thin'\n\t }\"\n\t :states=\"{\n\t empty: {\n\t title: 'No Products Found',\n\t description: 'Currently, there are no such products available.'\n\t }\n\t }\"\n\t :store=\"{\n\t read: (options) => products.actions.read(options),\n\t state: null\n\t }\"\n\t :options=\"{\n\t organization: route.params._id\n\t }\"\n\t v-slot=\"{ \n\t items \n\t }\"\n\t class=\"\"\n\t >\n\t <CardOrderItem\n\t v-for=\"(product, index) in items\" :key=\"product._id\"\n\t :editable=\"false\" \n\t :product=\"product\" \n\t @click=\"() => { \n\t let p = { ...product };\n\t p.quantity = 1;\n\t p.type = 'pcs'\n\t globals.actions.add(products.state.current.ingredients,p)\n\t closeIngredientPopup();\n\t }\"\n\t class=\"bg-white pd-thin radius-medium w-100 mn-b-thin\"\n\t />\n\t </Feed>\n\t </div>\n\t </Popup>\n\n\n\t\t</div> \n\n\t\t\t<Block\n \t\t\ttitle=\"Categories\"\n \t\t\t:actions=\"[{\n\t label: '+',\n\t function: () => router.push({\n\t\t\t\t\t\tname: 'Categories Organization', \n\t\t\t\t\t\tparams: { \n\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t} \n\t\t\t\t\t})\n\t }]\"\n \t\t>\n\t\t\t\t<Checkbox \n\t\t\t\t\tv-for=\"(category, index) in categories.state.all\"\n :label=\"category.name\"\n name=\"categories\"\n :value=\"category.url\"\n class=\"w-100 mn-t-small bg-white radius-small pd-small\"\n :radio=\"products.state.current.category\"\n @update:radio=\"event => products.state.current.category = event\"\n />\n\t\t\t</Block>\n\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Parameters\"\n\t\t\t\tplaceholder=\"No parameters added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.information.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t\tclass=\"cols-1 gap-thin\"\n\t\t\t>\n <div \n \tclass=\"gap-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.information\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small h-100 i-big flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.information.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n\t </div>\n </div>\n\t\t\t</Block>\n\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Localization\"\n\t\t\t\tplaceholder=\"No localizations added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.localization.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t>\n <div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.localization\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.localization.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n </div>\n </div>\n\t\t\t</Block>\n\n\t\n\t\t\n\t\t<!-- <Block\n\t title=\"Quantity Discount\"\n\t class=\"mn-b-semi\"\n\t :actions=\"[{\n\t\t\t\tlabel: '+',\n\t\t\t\tfunction: () => products.state.current.quantityDiscount.push({name: '', value: ''})\n\t\t\t}]\"\n\t >\n\t \t<div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.quantityDiscount\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Quantity\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Discount\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n <IconDelete \n \t@click=\"() => products.state.current.quantityDiscount.splice(index, 1)\" \n \tclass=\"i-medium\"\n />\n </div>\n </div>\n\t\t</Block> -->\n\n\t\t<!-- <EditModifications\n\t\t\t:product=\"products.state.current\"\n\t\t/> -->\n\n\n\n\t\t\n\n</div>\n\t\n</template>\n\n<script setup>\n\t// Import libs\n\timport { reactive, computed, onMounted, ref } from 'vue'\n\timport { useRoute, useRouter } from 'vue-router'\n\t// Import components\n\timport Breadcrumbs from '@pf/src/components/Breadcrumbs/Breadcrumbs.vue'\n\n\timport Block from '@pf/src/components/Block/Block.vue';\n\timport Tab from \"@pf/src/components/Tab/Tab.vue\";\n\timport Field from \"@pf/src/components/Field/Field.vue\";\n\timport Checkbox from \"@pf/src/components/Checkbox/Checkbox.vue\";\n\timport Button from \"@pf/src/components/Button/Button.vue\";\n\timport Popup from \"@pf/src/components/Popup/Popup.vue\";\n\timport Feed from \"@pf/src/components/Feed/Feed.vue\";\n\n\timport EditImages from '@pf/src/components/EditImages/EditImages.vue';\n\n\timport IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n \timport CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';\n import CardOrderItem from '@pf/src/modules/orders/components/blocks/CardOrderItem.vue'\n\n\n\timport EditProductInfo from '@pf/src/modules/products/components/sections/EditProductInfo.vue';\n import EditModifications from '@pf/src/modules/products/components/sections/EditModifications.vue';\n \n\t// Accessing router and store\n\timport * as globals from '@pf/src/modules/globals/views/store/globals';\n \timport * as products from '@pf/src/modules/products/store/products';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n\tconst route = useRoute()\n\tconst router = useRouter()\n\n const Products = ref(products.state.all);\n const isOpenIngredientPopup = ref(false);\n\n\n function openIngredientPopup(member) {\n\t isOpenIngredientPopup.value = true;\n\t // if (typeof member === \"number\") selectedMember.value = member;\n\t}\n\n\tfunction closeIngredientPopup() {\n\t isOpenIngredientPopup.value = false;\n\t // selectedMember.value = null;\n\t}\n\n onMounted(async() => { \n\t products.mutations.resetProduct();\n\n \tif (route.params.product) {\n\t\t await products.actions.read({ _id: route.params.product });\n\t } \n\n\t if (!products.state.current.ingredients) {\n\t \tproducts.state.current.ingredients = []\n\t }\n\n \t// Data prefetching\n\t \tawait categories.actions.fetchCategories()\n\n try {\n const productsResponse = await products.actions.read({\n organization: route.params._id,\n limit: 100\n });\n Products.value = productsResponse;\n } catch (error) {\n console.error('error');\n }\n })\n\n\tfunction onImagesUpdate(newImages) {\n\t products.state.current.images = newImages;\n\t}\n\t\n\tfunction onSubmit() {\n\t\tif (route.params.product) {\n\t\t\tproducts.actions.update(route.params.product, products.state.current)\n\t\t} else {\n\t\t\tproducts.actions.create(route.params._id, products.state.current)\n\t\t}\n\t}\n\n\tfunction onDelete() {\n\t\tproducts.actions.deleteProduct(products.state.current._id)\n\t}\n\n\tfunction redirectTo () {\n\t\trouter.push({\n\t\t\tname: 'Organization', \n\t\t\tparams: { \n\t\t\t\t_id: route.params._id\n\t\t\t} \n\t\t})\n\t}\n</script>\n\n<style lang=\"scss\">\n\t.main-photo {\n\t\tmax-width: 50%;\n\t\timg { width: 100%; }\n\t}\n</style>\n"],"names":["products.state","products.mutations","products.actions","categories.actions"],"mappings":";;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
1
|
+
{"version":3,"file":"ProductEdit.vue.js","sources":["../../../../../../../src/modules/products/components/pages/ProductEdit.vue"],"sourcesContent":["<template>\n\t<div class=\"for-transition w-100 cols-1 bg-white pd-thin gap-thin\">\n \n <Block v-if=\"!MOBILE_APP\" class=\"flex-nowrap gap-small flex-v-center flex\">\n \n <h2 class=\"t-nowrap mn-r-auto\">\n\t\t\t {{ route.params.product ? products.state.current.name : 'Create Product' }}\n\t\t\t</h2>\n\n\t\t\t<Button \n\t\t\t\tv-if=\"route.params.product\"\n \t:submit=\"onDelete\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-red mn-r-thin\"\n >\n \t\tDelete \n \t</Button>\n\n <Button \n \t:submit=\"onSubmit\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-main\"\n >\n \t\tSave\n \t</Button>\n </Block>\n\n <Block\n\t\t\tplaceholder=\"The product doesn't have any images yet.\"\n\t\t\tclass=\"h-min\"\n\t\t>\n\t\t\t<EditImages \n\t\t\t\t:images=\"products.state.current.images\"\n\t\t\t\t:uploadPath=\"'photos'\" \n\t\t\t\t@update:images=\"(imagesNew) => { products.state.current.images = imagesNew }\" \n\t\t\t/>\n\t\t</Block>\n\n <div class=\"cols-2 gap-thin\">\n\n \t<Block\n \t\t\ttitle=\"Profile\"\n \t\t>\n\t\t\t\t<EditProductInfo \t\t\n\t\t\t\t\t:product=\"products.state.current\"\n\t\t\t\t/>\n\t\t\t</Block>\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Categories\"\n\t\t\t\t:actions=\"[{\n\t\t label: '+',\n\t\t function: () => router.push({\n\t\t\t\t\t\tname: 'Categories', \n\t\t\t\t\t\tparams: { \n\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t} \n\t\t\t\t\t})\n\t\t }]\"\n\t\t\t>\n\t\t\t\t<Checkbox \n\t\t\t\t\tv-for=\"(category, index) in categories.state.all\"\n\t\t :label=\"category.name\"\n\t\t name=\"categories\"\n\t\t :value=\"category.url\"\n\t\t class=\"w-100 mn-t-small bg-white radius-small pd-small\"\n\t\t :radio=\"products.state.current.category\"\n\t\t @update:radio=\"event => products.state.current.category = event\"\n\t\t />\n\t\t\t</Block>\n\n\t\t\t<Block\n\t\t\t\ttitle=\"Parameters\"\n\t\t\t\tplaceholder=\"No parameters added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.information.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t\tclass=\"cols-1 gap-thin\"\n\t\t\t>\n <div \n \tclass=\"gap-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.information\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small h-100 i-big flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.information.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n\t </div>\n </div>\n\t\t\t</Block>\n\n\n\t\t\t<Block\n\t\t title=\"Ingredients\"\n\t\t\t\tplaceholder=\"No ingridients added yet\"\n\t\t\t\t:actions=\"[{\n\t label: '+',\n\t function: () => openIngredientPopup()\n\t }]\"\n\t\t >\n\t\t \t<div v-if=\"products.state.current.ingredients.length > 0\" class=\"cols-1 gap-thin\">\n\t\t\t <CardPosition \n\t\t\t v-for=\"(product, index) in products.state.current.ingredients\" \n\t\t\t :key=\"product._id\" \n\t\t\t :product=\"product\"\n\t\t\t :array=\"products.state.current.ingredients\"\n\t\t\t :products=\"Products\"\n\t\t :showPrice=\"false\"\n\t\t\t @add=\"(item) => {\n\t\t\t\t\t globals.actions.add(products.state.current.ingredients, item);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @update=\"(item) => {\n\t\t\t\t\t globals.actions.update(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t\t\t @delete=\"(item) => {\n\t\t\t\t\t globals.actions.delete(products.state.current.ingredients, item, index);\n\t\t\t\t\t closeIngredientPopup();\n\t\t\t\t\t }\"\n\t\t\t />\n\t\t\t </div>\n\t\t </Block>\n\n\t\t <Popup \n\t title=\"Add ingredient\" \n\t @close-popup=\"closeIngredientPopup\" \n\t :isPopupOpen=\"isOpenIngredientPopup\"\n\t class=\"bg-white w-min-30r w-max-30r radius-big pd-medium\"\n\t >\n\t <div class=\"bg-light mn-b-thin h-min-20r h-max-20r o-scroll pd-medium radius-big\">\n\t <Feed\n\t :search=\"{\n\t \tclass: 'bg-white mn-b-thin'\n\t }\"\n\t :states=\"{\n\t empty: {\n\t title: 'No Products Found',\n\t description: 'Currently, there are no such products available.'\n\t }\n\t }\"\n\t :store=\"{\n\t read: (options) => products.actions.read(options),\n\t state: null\n\t }\"\n\t :options=\"{\n\t organization: route.params._id\n\t }\"\n\t v-slot=\"{ \n\t items \n\t }\"\n\t class=\"\"\n\t >\n\t <CardOrderItem\n\t v-for=\"(product, index) in items\" :key=\"product._id\"\n\t :editable=\"false\" \n\t :product=\"product\" \n\t @click=\"() => { \n\t let p = { ...product };\n\t p.quantity = 1;\n\t p.type = 'pcs'\n\t globals.actions.add(products.state.current.ingredients,p)\n\t closeIngredientPopup();\n\t }\"\n\t class=\"bg-white pd-thin radius-medium w-100 mn-b-thin\"\n\t />\n\t </Feed>\n\t </div>\n\t </Popup>\n\n\n\t\t</div> \n\n\t\t\t<Block\n\t\t\t\ttitle=\"Localization\"\n\t\t\t\tplaceholder=\"No localizations added yet\"\n\t\t\t\t:actions=\"[{\n\t\t\t\t\tlabel: '+',\n\t\t\t\t\tfunction: () => products.state.current.localization.push({name: '', value: ''})\n\t\t\t\t}]\"\n\t\t\t>\n <div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.localization\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Название параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Значение параметра\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n\t <IconDelete \n\t \t@click=\"() => products.state.current.localization.splice(index, 1)\" \n\t \tclass=\"i-medium\"\n\t />\n </div>\n </div>\n\t\t\t</Block>\n\n\t\t\t<Button \n\t\t\t\tv-if=\"route.params.product\"\n \t:submit=\"onDelete\" \n \t:callback=\"redirectTo\"\n \tclass=\"bg-red w-100 mn-b-thin\"\n >\n \t\tDelete \n \t</Button>\n\n <Button \n \t:submit=\"onSubmit\" \n \t:callback=\"redirectTo\"\n \tclass=\"w-100 bg-main\"\n >\n \t\tSave\n \t</Button>\n\n\t\n\t\t\n\t\t<!-- <Block\n\t title=\"Quantity Discount\"\n\t class=\"mn-b-semi\"\n\t :actions=\"[{\n\t\t\t\tlabel: '+',\n\t\t\t\tfunction: () => products.state.current.quantityDiscount.push({name: '', value: ''})\n\t\t\t}]\"\n\t >\n\t \t<div \n \tclass=\"gap-thin mn-b-thin flex-nowrap flex\" \n \tv-for=\"(item, index) in products.state.current.quantityDiscount\" \n \t:key=\"index\"\n > \n <Field\n v-model:field=\"item.name\"\n placeholder=\"Quantity\"\n class=\"w-100 bg-white radius-small pd-medium\"\n /> \n <Field\n v-model:field=\"item.value\"\n placeholder=\"Discount\"\n class=\"w-100 bg-white radius-small pd-medium\"\n />\n <div class=\"radius-small pd-small flex-center flex aspect-1x1 bg-red\">\n <IconDelete \n \t@click=\"() => products.state.current.quantityDiscount.splice(index, 1)\" \n \tclass=\"i-medium\"\n />\n </div>\n </div>\n\t\t</Block> -->\n\n\t\t<!-- <EditModifications\n\t\t\t:product=\"products.state.current\"\n\t\t/> -->\n\n\n\n\t\t\n\n</div>\n\t\n</template>\n\n<script setup>\n\t// Import libs\n\timport { reactive, computed, onMounted, ref } from 'vue'\n\timport { useRoute, useRouter } from 'vue-router'\n\t// Import components\n\timport Breadcrumbs from '@pf/src/components/Breadcrumbs/Breadcrumbs.vue'\n\n\timport Block from '@pf/src/components/Block/Block.vue';\n\timport Tab from \"@pf/src/components/Tab/Tab.vue\";\n\timport Field from \"@pf/src/components/Field/Field.vue\";\n\timport Checkbox from \"@pf/src/components/Checkbox/Checkbox.vue\";\n\timport Button from \"@pf/src/components/Button/Button.vue\";\n\timport Popup from \"@pf/src/components/Popup/Popup.vue\";\n\timport Feed from \"@pf/src/components/Feed/Feed.vue\";\n\n\timport EditImages from '@pf/src/components/EditImages/EditImages.vue';\n\n\timport IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';\n\n \timport CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';\n import CardOrderItem from '@pf/src/modules/orders/components/blocks/CardOrderItem.vue'\n\n\n\timport EditProductInfo from '@pf/src/modules/products/components/sections/EditProductInfo.vue';\n import EditModifications from '@pf/src/modules/products/components/sections/EditModifications.vue';\n \n\t// Accessing router and store\n\timport * as globals from '@pf/src/modules/globals/views/store/globals';\n\timport * as auth from '@pf/src/modules/auth/views/store/auth';\n \timport * as products from '@pf/src/modules/products/store/products';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n\timport { setError } from '@pf/src/modules/globals/views/store/globals'\n\t\n\tconst route = useRoute()\n\tconst router = useRouter()\n\n const Products = ref(products.state.all);\n const isOpenIngredientPopup = ref(false);\n\n\n function openIngredientPopup(member) {\n\t isOpenIngredientPopup.value = true;\n\t // if (typeof member === \"number\") selectedMember.value = member;\n\t}\n\n\tfunction closeIngredientPopup() {\n\t isOpenIngredientPopup.value = false;\n\t // selectedMember.value = null;\n\t}\n\n onMounted(async() => { \n\t products.mutations.resetProduct();\n\n \tif (route.params.product) {\n\t\t await products.actions.read({ _id: route.params.product });\n\t } \n\n\t if (!products.state.current.ingredients) {\n\t \tproducts.state.current.ingredients = []\n\t }\n\n \t// Data prefetching\n\t \tawait categories.actions.fetchCategories()\n\n try {\n const productsResponse = await products.actions.read({\n organization: route.params._id,\n limit: 100\n });\n Products.value = productsResponse;\n } catch (error) {\n console.error('error');\n }\n })\n\n\tfunction onImagesUpdate(newImages) {\n\t products.state.current.images = newImages;\n\t}\n\t\n\tasync function onSubmit() {\n\t try {\n\t if (route.params.product) {\n\t await products.actions.update(route.params.product, products.state.current)\n\t } else {\n\t products.state.current.owner = {\n\t target: route.params._id || auth.state.user._id,\n\t type: route.params._id ? 'organization' : 'user'\n\t }\n\t \n\t products.state.current.creator = {\n\t target: auth.state.user._id,\n\t type: 'user',\n\t hidden: false\n\t }\n\t await products.actions.create(products.state.current)\n\t }\n\t } catch (error) {\n\t \tsetError({ response: { data: { errorCode: \"PRODUCT_NOT_CREATED\" }} })\n\t console.error('Product creation error:', error)\n\t // Здесь можно добавить обработку ошибки, например:\n\t // - показать уведомление пользователю\n\t // - отправить ошибку в систему мониторинга\n\t // - выполнить откат изменений при необходимости\n\t }\n\t}\n\n\tfunction onDelete() {\n\t\tproducts.actions.deleteProduct(products.state.current._id)\n\t}\n\n\tfunction redirectTo () {\n\t\trouter.push({\n\t\t\tname: 'Organization', \n\t\t\tparams: { \n\t\t\t\t_id: route.params._id\n\t\t\t} \n\t\t})\n\t}\n</script>\n\n<style lang=\"scss\">\n\t.main-photo {\n\t\tmax-width: 50%;\n\t\timg { width: 100%; }\n\t}\n</style>\n"],"names":["products.state","products.mutations","products.actions","categories.actions","auth.state"],"mappings":";;;;;;;;;;;;;;;;;;;;;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AW,sBAAuB,EAAA,GAAG;AACnE,gBAAQ,MAAM,2BAA2B,KAAK;AAAA,MAK/C;AAAA,IACF;AAED,aAAS,WAAW;AACnBE,cAAiB,cAAcF,MAAe,QAAQ,GAAG;AAAA,IACzD;AAED,aAAS,aAAc;AACtB,aAAO,KAAK;AAAA,QACX,MAAM;AAAA,QACN,QAAQ;AAAA,UACP,KAAK,MAAM,OAAO;AAAA,QAClB;AAAA,MACJ,CAAG;AAAA,IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -12,7 +12,9 @@ const marketplace = require("../../store/marketplace.cjs");
|
|
12
12
|
const BlockSearch = require("../../../globals/views/components/blocks/BlockSearch.vue.cjs");
|
13
13
|
const BlockFilter = require("../../../globals/views/components/blocks/BlockFilter.vue.cjs");
|
14
14
|
const CardProduct = require("../blocks/CardProduct.vue.cjs");
|
15
|
+
const IconPlus = require("../../../icons/navigation/IconPlus.vue.cjs");
|
15
16
|
const auth = require("../../../auth/views/store/auth.cjs");
|
17
|
+
const globals = require("../../../globals/views/store/globals.cjs");
|
16
18
|
const products = require("../../store/products.cjs");
|
17
19
|
const _hoisted_1 = { class: "h-100" };
|
18
20
|
const _hoisted_2 = {
|
@@ -38,7 +40,14 @@ const _sfc_main = {
|
|
38
40
|
vue.watch(tabProducts, (newValue) => {
|
39
41
|
if (route.name !== "Organization") router.replace({ query: { ...route.query, tabProducts: newValue } });
|
40
42
|
});
|
41
|
-
|
43
|
+
globals.state.navigation_bar.actions = [{
|
44
|
+
component: IconPlus.default,
|
45
|
+
props: {
|
46
|
+
fill: "rgb(var(--main))"
|
47
|
+
},
|
48
|
+
condition: () => auth.state.user && auth.state.user._id,
|
49
|
+
action: () => route.params._id ? router.push({ name: "Organization_ProductAdd", params: { _id: route.params._id } }) : router.push({ name: "ProductAdd" })
|
50
|
+
}], vue.onMounted(async () => {
|
42
51
|
let categoriesFilter = await categories.actions.fetchCategories();
|
43
52
|
categoriesFilter = categoriesFilter.map((category) => ({
|
44
53
|
value: category.url,
|
@@ -56,6 +65,9 @@ const _sfc_main = {
|
|
56
65
|
marketplace.state.filter.options.unshift(categoryOption);
|
57
66
|
}
|
58
67
|
});
|
68
|
+
vue.onUnmounted(() => {
|
69
|
+
globals.state.navigation_bar.actions = [];
|
70
|
+
});
|
59
71
|
vue.watch(() => marketplace.state.sort, (newSortValue, oldSortValue) => {
|
60
72
|
let query = { ...route.query };
|
61
73
|
query.sortParam = newSortValue.param;
|
@@ -82,13 +94,17 @@ const _sfc_main = {
|
|
82
94
|
router.replace({ query });
|
83
95
|
}
|
84
96
|
return (_ctx, _cache) => {
|
97
|
+
const _component_router_link = vue.resolveComponent("router-link");
|
85
98
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
86
99
|
vue.unref(route).name !== "Organization" && !_ctx.MOBILE_APP ? (vue.openBlock(), vue.createElementBlock("header", _hoisted_2, [
|
87
100
|
_cache[4] || (_cache[4] = vue.createElementVNode("h2", { class: "mn-r-medium" }, "Products", -1)),
|
88
101
|
vue.createElementVNode("button", {
|
89
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
90
|
-
|
91
|
-
|
102
|
+
onClick: _cache[0] || (_cache[0] = ($event) => {
|
103
|
+
var _a;
|
104
|
+
return _ctx.$router.push({
|
105
|
+
name: ((_a = vue.unref(route).params) == null ? void 0 : _a._id) ? "Organization_ProductAdd" : "ProductAdd"
|
106
|
+
});
|
107
|
+
}),
|
92
108
|
class: "radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second"
|
93
109
|
}, " + ")
|
94
110
|
])) : vue.createCommentVNode("", true),
|
@@ -104,7 +120,7 @@ const _sfc_main = {
|
|
104
120
|
],
|
105
121
|
style: { "flex": "0 0 auto" },
|
106
122
|
class: "o-hidden h5 bg-light gap-micro pd-small pd-t-thin pd-b-thin pos-sticky pos-t-0 z-index-1",
|
107
|
-
tabClass: "bg-white pd-small radius-small w-100"
|
123
|
+
tabClass: "bg-white uppercase pd-small radius-small w-100"
|
108
124
|
}, null, 8, ["selected"])) : vue.createCommentVNode("", true),
|
109
125
|
vue.createElementVNode("div", _hoisted_3, [
|
110
126
|
vue.createVNode(BlockFilter.default, {
|
@@ -136,7 +152,7 @@ const _sfc_main = {
|
|
136
152
|
},
|
137
153
|
options: {
|
138
154
|
limit: 15,
|
139
|
-
|
155
|
+
owner: vue.unref(route).params._id,
|
140
156
|
categories: vue.unref(route).query.categories,
|
141
157
|
prices: vue.unref(route).query.prices,
|
142
158
|
delivery: vue.unref(route).query.delivery,
|
@@ -144,26 +160,28 @@ const _sfc_main = {
|
|
144
160
|
...tabProducts.value !== "all" && { status: tabProducts.value }
|
145
161
|
// user: user
|
146
162
|
},
|
147
|
-
class: "cols-4 pd-thin gap-thin"
|
163
|
+
class: "cols-4 rows-1 pd-t-zero pd-thin gap-thin"
|
148
164
|
}, {
|
149
165
|
default: vue.withCtx(({
|
150
166
|
items
|
151
167
|
}) => [
|
152
168
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items, (product) => {
|
153
|
-
return vue.openBlock(), vue.createBlock(
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
169
|
+
return vue.openBlock(), vue.createBlock(_component_router_link, {
|
170
|
+
to: vue.unref(route).params._id ? { name: "Organization_Product", params: { _id: vue.unref(route).params._id, product: product._id } } : { name: "Product", params: { product: product._id } }
|
171
|
+
}, {
|
172
|
+
default: vue.withCtx(() => [
|
173
|
+
(vue.openBlock(), vue.createBlock(CardProduct.default, {
|
174
|
+
key: product._id,
|
175
|
+
product,
|
176
|
+
user: auth.state.access,
|
177
|
+
organization: vue.unref(route).params._id,
|
178
|
+
access: _ctx.hasAccess(vue.unref(route).params._id, "products", "edit", auth.state.accesses),
|
179
|
+
class: "h-max bg-light"
|
180
|
+
}, null, 8, ["product", "user", "organization", "access"]))
|
181
|
+
]),
|
182
|
+
_: 2
|
183
|
+
}, 1032, ["to"]);
|
184
|
+
}), 256))
|
167
185
|
]),
|
168
186
|
_: 1
|
169
187
|
}, 8, ["filter", "store", "options"])
|
package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Products.vue.cjs","sources":["../../../../../../../src/modules/products/components/pages/Products.vue"],"sourcesContent":["<template>\n <div class=\"h-100\">\n <header \n v-if=\"route.name !== 'Organization' && !MOBILE_APP\"\n class=\"mn-b-medium flex-v-center flex-nowrap flex\"\n >\n <h2 class=\"mn-r-medium\">Products</h2>\n <button \n @click=\"$router.push({\n name: route.params._id ? 'Organization_ProductAdd' : 'ProductAdd'\n })\" \n class=\"radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second\">\n +\n </button>\n </header>\n\n <Tab \n v-if=\"route.name !== 'Organization'\"\n v-model:selected=\"tabProducts\"\n :tabs=\"[\n { name: 'All', value: 'all' },\n { name: 'Published', value: 'published' },\n { name: 'Unpublished', value: 'unpublished' }, \n { name: 'Archivied', value: 'archivied' } \n ]\"\n style=\"flex: 0 0 auto\"\n class=\"\n o-hidden \n h5 \n bg-light\n gap-micro pd-small pd-t-thin pd-b-thin\n pos-sticky pos-t-0\n z-index-1\n \"\n tabClass=\"bg-white pd-small radius-small w-100\"\n />\n\n <div class=\"cols-2-1_3 h-100 z-index-3 pos-relative radius-big gap-thin\">\n\n <BlockFilter\n v-model:filter=\"marketplace.state.filter\"\n :options=\"marketplace.state.filter.options\"\n class=\"h-100 w-100 z-index-2 desktop-only\"\n />\n\n\n <div class=\"rows-1 h-100 z-index-3 bg-white radius-tl-big radius-tr-big\">\n <div class=\"pd-thin z-index-3 radius-tl-big radius-tr-big pos-t-0 pos-sticky\">\n <BlockSearch \n @search=\"updateSearch\"\n placeholder=\"Enter product name\"\n class=\"bg-light h-4r\"\n />\n </div>\n <Feed\n v-model:filter=\"marketplace.state.filter\"\n \n :states=\"{\n empty: {\n title: 'No Products Found',\n description: 'Currently, there are no products available.'\n }\n }\"\n :store=\"{\n read: (options) => products.actions.read(options),\n state: products.state\n }\"\n :options=\"{\n limit: 15,\n organization: route.params._id,\n categories: route.query.categories,\n prices: route.query.prices,\n delivery: route.query.delivery,\n // search: route.query.search,\n ...(tabProducts !== 'all' && { status: tabProducts })\n // user: user\n }\"\n v-slot=\"{ \n items \n }\"\n class=\"cols-4 pd-thin gap-thin\"\n >\n <CardProduct\n v-for=\"product in items\"\n :key=\"product._id\"\n :product=\"product\"\n :user=\"auth.state.access\"\n class=\"h-max bg-white\"\n @click.capture=\"$router.push({\n name: 'Organization_Product', \n params: { \n _id: route.params._id, \n product: product._id \n } \n })\" \n />\n </Feed>\n </div>\n </div>\n</div>\n</template>\n\n\n<script setup=\"props\">\n // Import libs\n import { computed, watch, onMounted, ref } from 'vue'\n import { useRoute, useRouter } from 'vue-router'\n\n // Import components\n import Tab from '@pf/src/components/Tab/Tab.vue'\n import Feed from '@pf/src/components/Feed/Feed.vue'\n\n import FilterProducts from '@pf/src/modules/products/components/sections/FilterProducts.vue'\n import BlockSearch from '@pf/src/modules/globals/views/components/blocks/BlockSearch.vue'\n import BlockFilter from '@pf/src/modules/globals/views/components/blocks/BlockFilter.vue'\n\n import CardProduct from '@pf/src/modules/products/components/blocks/CardProduct.vue'\n\n // Accessing router and store\n import * as auth from '@pf/src/modules/auth/views/store/auth';\n import * as products from '@pf/src/modules/products/store/products';\n import * as marketplace from '@pf/src/modules/products/store/marketplace';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Tab logic\n const tabProducts = ref(route.query.tabProducts ? route.query.tabProducts : 'all')\n\n if (route.name !== 'Organization') route.query.tabProducts = tabProducts.value\n \n if (route.query) {\n const query = route.query;\n\n marketplace.state.filter.selected.categories = query.categories ? query.categories.split(',') : [];\n marketplace.state.filter.selected.prices = query.prices ? query.prices.split(',') : [];\n marketplace.state.filter.selected.delivery = query.delivery ? query.delivery.split(',') : [];\n }\n\n\n watch(tabProducts, (newValue) => {\n if (route.name !== 'Organization') router.replace({ query: { ...route.query, tabProducts: newValue } });\n });\n\n onMounted(async () => {\n let categoriesFilter = await categories.actions.fetchCategories();\n\n categoriesFilter = categoriesFilter.map(category => ({\n value: category.url,\n label: category.name\n }));\n\n const index = marketplace.state.filter.options.findIndex(option => option.value === 'categories');\n\n const categoryOption = {\n title: 'Categories',\n value: 'categories',\n options: categoriesFilter\n };\n\n if (index !== -1) {\n marketplace.state.filter.options[index] = categoryOption;\n } else {\n marketplace.state.filter.options.unshift(categoryOption);\n }\n })\n\n watch(() => marketplace.state.sort, (newSortValue, oldSortValue) => {\n let query = { ...route.query}\n \n query.sortParam = newSortValue.param\n query.sortOrder = newSortValue.order\n \n // replace the current route\n router.replace({ query });\n }, { deep: true });\n\n\n watch(() => marketplace.state.filter.selected, (newFilterValue, oldFilterValue) => {\n // Переводим фильтр в формат query\n const query = { ...route.query };\n\n // Удаляем старые значения фильтра из query\n Object.keys(oldFilterValue).forEach(key => {\n if (query[key]) {\n delete query[key];\n }\n });\n\n // Добавляем новые значения фильтра в query\n const newQueryValues = Object.fromEntries(\n Object.entries(newFilterValue)\n .filter(([key, value]) => Array.isArray(value) && value.length > 0)\n .map(([key, value]) => [key, value.join(',')])\n );\n\n delete query.options;\n Object.assign(query, newQueryValues);\n\n // Обновляем маршрут с новым query\n router.replace({ query });\n }, { deep: true })\n\n\n\n \n function updateSearch(search) {\n let query = { ...route.query}\n \n query.search = search\n \n router.replace({ query });\n }\n</script>\n\n<style lang=\"scss\">\n\n\n</style>\n"],"names":["useRoute","useRouter","ref","marketplace.state","watch","onMounted","categories.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HE,UAAM,QAAQA,UAAAA,SAAU;AACxB,UAAM,SAASC,UAAAA,UAAW;AAG1B,UAAM,cAAcC,QAAI,MAAM,MAAM,cAAc,MAAM,MAAM,cAAc,KAAK;AAEjF,QAAI,MAAM,SAAS,eAAgB,OAAM,MAAM,cAAc,YAAY;AAEzE,QAAI,MAAM,OAAO;AACf,YAAM,QAAQ,MAAM;AAEpBC,kBAAAA,MAAkB,OAAO,SAAS,aAAa,MAAM,aAAa,MAAM,WAAW,MAAM,GAAG,IAAI,CAAA;AAChGA,kBAAAA,MAAkB,OAAO,SAAS,SAAS,MAAM,SAAS,MAAM,OAAO,MAAM,GAAG,IAAI,CAAA;AACpFA,kBAAAA,MAAkB,OAAO,SAAS,WAAW,MAAM,WAAW,MAAM,SAAS,MAAM,GAAG,IAAI,CAAA;AAAA,IAC3F;AAGDC,cAAM,aAAa,CAAC,aAAa;AAC/B,UAAI,MAAM,SAAS,eAAgB,QAAO,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,aAAa,SAAQ,EAAI,CAAA;AAAA,IAC1G,CAAG;AAEDC,QAAAA,UAAU,YAAY;AACpB,UAAI,mBAAmB,MAAMC,mBAAmB;AAEhD,yBAAmB,iBAAiB,IAAI,eAAa;AAAA,QACnD,OAAO,SAAS;AAAA,QAChB,OAAO,SAAS;AAAA,MACjB,EAAC;AAEF,YAAM,QAAQH,kBAAkB,OAAO,QAAQ,UAAU,YAAU,OAAO,UAAU,YAAY;AAEhG,YAAM,iBAAiB;AAAA,QACrB,OAAO;AAAA,QACP,OAAO;AAAA,QACP,SAAS;AAAA,MACf;AAEI,UAAI,UAAU,IAAI;AACdA,oBAAAA,MAAkB,OAAO,QAAQ,KAAK,IAAI;AAAA,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js","sources":["../../../../../../../src/modules/products/components/pages/Products.vue"],"sourcesContent":["<template>\n <div class=\"h-100\">\n <header \n v-if=\"route.name !== 'Organization' && !MOBILE_APP\"\n class=\"mn-b-medium flex-v-center flex-nowrap flex\"\n >\n <h2 class=\"mn-r-medium\">Products</h2>\n <button \n @click=\"$router.push({\n name: route.params?._id ? 'Organization_ProductAdd' : 'ProductAdd'\n })\" \n class=\"radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second\">\n +\n </button>\n </header>\n\n <Tab \n v-if=\"route.name !== 'Organization'\"\n v-model:selected=\"tabProducts\"\n :tabs=\"[\n { name: 'All', value: 'all' },\n { name: 'Published', value: 'published' },\n { name: 'Unpublished', value: 'unpublished' }, \n { name: 'Archivied', value: 'archivied' } \n ]\"\n style=\"flex: 0 0 auto\"\n class=\"\n o-hidden \n h5 \n bg-light\n gap-micro pd-small pd-t-thin pd-b-thin\n pos-sticky pos-t-0\n z-index-1\n\n \"\n tabClass=\"bg-white uppercase pd-small radius-small w-100\"\n />\n\n <div class=\"cols-2-1_3 h-100 z-index-3 pos-relative radius-big gap-thin\">\n\n <BlockFilter\n v-model:filter=\"marketplace.state.filter\"\n :options=\"marketplace.state.filter.options\"\n class=\"h-100 w-100 z-index-2 desktop-only\"\n />\n\n\n <div class=\"rows-1 h-100 z-index-3 bg-white radius-tl-big radius-tr-big\">\n <div class=\"pd-thin z-index-3 radius-tl-big radius-tr-big pos-t-0 pos-sticky\">\n <BlockSearch \n @search=\"updateSearch\"\n placeholder=\"Enter product name\"\n class=\"bg-light h-4r\"\n />\n </div>\n <Feed\n v-model:filter=\"marketplace.state.filter\"\n \n :states=\"{\n empty: {\n title: 'No Products Found',\n description: 'Currently, there are no products available.'\n }\n }\"\n :store=\"{\n read: (options) => products.actions.read(options),\n state: products.state\n }\"\n :options=\"{\n limit: 15,\n owner: route.params._id,\n categories: route.query.categories,\n prices: route.query.prices,\n delivery: route.query.delivery,\n // search: route.query.search,\n ...(tabProducts !== 'all' && { status: tabProducts })\n // user: user\n }\"\n v-slot=\"{ \n items \n }\"\n class=\"cols-4 rows-1 pd-t-zero pd-thin gap-thin\"\n >\n <router-link \n v-for=\"product in items\" \n :to=\"route.params._id ? { name: 'Organization_Product', params: { _id: route.params._id, product: product._id } } : { name: 'Product', params: { product: product._id } }\">\n <CardProduct\n :key=\"product._id\"\n :product=\"product\"\n :user=\"auth.state.access\"\n :organization=\"route.params._id\"\n :access=\"hasAccess(route.params._id, 'products', 'edit', auth.state.accesses)\"\n class=\"h-max bg-light\"\n />\n </router-link>\n </Feed>\n\n </div>\n </div>\n</div>\n</template>\n\n\n<script setup=\"props\">\n // Import libs\n import { ref, computed, watch, onMounted, onUnmounted } from 'vue'\n import { useRoute, useRouter } from 'vue-router'\n\n // Import components\n import Tab from '@pf/src/components/Tab/Tab.vue'\n import Feed from '@pf/src/components/Feed/Feed.vue'\n\n import FilterProducts from '@pf/src/modules/products/components/sections/FilterProducts.vue'\n import BlockSearch from '@pf/src/modules/globals/views/components/blocks/BlockSearch.vue'\n import BlockFilter from '@pf/src/modules/globals/views/components/blocks/BlockFilter.vue'\n\n import CardProduct from '@pf/src/modules/products/components/blocks/CardProduct.vue'\n\n import IconPlus from '@pf/src/modules/icons/navigation/IconPlus.vue'\n\n // Accessing router and store\n import * as auth from '@pf/src/modules/auth/views/store/auth';\n import * as globals from '@pf/src/modules/globals/views/store/globals';\n import * as products from '@pf/src/modules/products/store/products';\n import * as marketplace from '@pf/src/modules/products/store/marketplace';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Tab logic\n const tabProducts = ref(route.query.tabProducts ? route.query.tabProducts : 'all')\n\n if (route.name !== 'Organization') route.query.tabProducts = tabProducts.value\n \n if (route.query) {\n const query = route.query;\n\n marketplace.state.filter.selected.categories = query.categories ? query.categories.split(',') : [];\n marketplace.state.filter.selected.prices = query.prices ? query.prices.split(',') : [];\n marketplace.state.filter.selected.delivery = query.delivery ? query.delivery.split(',') : [];\n }\n\n watch(tabProducts, (newValue) => {\n if (route.name !== 'Organization') router.replace({ query: { ...route.query, tabProducts: newValue } });\n });\n\n globals.state.navigation_bar.actions = [{\n component: IconPlus,\n props: {\n fill: \"rgb(var(--main))\" \n },\n condition: () => auth.state.user && auth.state.user._id,\n action: () => route.params._id ? router.push({ name: 'Organization_ProductAdd', params: { _id: route.params._id} }) : router.push({ name: 'ProductAdd' })\n }],\n\n onMounted(async () => {\n let categoriesFilter = await categories.actions.fetchCategories();\n\n categoriesFilter = categoriesFilter.map(category => ({\n value: category.url,\n label: category.name\n }));\n\n const index = marketplace.state.filter.options.findIndex(option => option.value === 'categories');\n\n const categoryOption = {\n title: 'Categories',\n value: 'categories',\n options: categoriesFilter\n };\n\n if (index !== -1) {\n marketplace.state.filter.options[index] = categoryOption;\n } else {\n marketplace.state.filter.options.unshift(categoryOption);\n }\n })\n\n onUnmounted(() => {\n globals.state.navigation_bar.actions = [];\n });\n\n watch(() => marketplace.state.sort, (newSortValue, oldSortValue) => {\n let query = { ...route.query}\n \n query.sortParam = newSortValue.param\n query.sortOrder = newSortValue.order\n \n // replace the current route\n router.replace({ query });\n }, { deep: true });\n\n\n watch(() => marketplace.state.filter.selected, (newFilterValue, oldFilterValue) => {\n // Переводим фильтр в формат query\n const query = { ...route.query };\n\n // Удаляем старые значения фильтра из query\n Object.keys(oldFilterValue).forEach(key => {\n if (query[key]) {\n delete query[key];\n }\n });\n\n // Добавляем новые значения фильтра в query\n const newQueryValues = Object.fromEntries(\n Object.entries(newFilterValue)\n .filter(([key, value]) => Array.isArray(value) && value.length > 0)\n .map(([key, value]) => [key, value.join(',')])\n );\n\n delete query.options;\n Object.assign(query, newQueryValues);\n\n // Обновляем маршрут с новым query\n router.replace({ query });\n }, { deep: true })\n\n\n\n \n function updateSearch(search) {\n let query = { ...route.query}\n \n query.search = search\n \n router.replace({ query });\n }\n</script>\n\n<style lang=\"scss\">\n\n\n</style>\n"],"names":["useRoute","useRouter","ref","marketplace.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AQ,EAAE,MAAK,CAAE;AAAA,IAC5B,GAAK,EAAE,MAAM,MAAM;AAKjB,aAAS,aAAa,QAAQ;AAC5B,UAAI,QAAQ,EAAE,GAAG,MAAM,MAAK;AAE5B,YAAM,SAAS;AAEf,aAAO,QAAQ,EAAE,MAAK,CAAE;AAAA,IACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,17 +1,19 @@
|
|
1
|
-
import { ref, watch, onMounted, openBlock, createElementBlock, unref, createElementVNode, createCommentVNode, createBlock, createVNode, withCtx, Fragment, renderList } from "vue";
|
1
|
+
import { ref, watch, onMounted, onUnmounted, resolveComponent, openBlock, createElementBlock, unref, createElementVNode, createCommentVNode, createBlock, createVNode, withCtx, Fragment, renderList } from "vue";
|
2
2
|
import { useRoute, useRouter } from "vue-router";
|
3
|
-
import _sfc_main$
|
4
|
-
import _sfc_main$
|
3
|
+
import _sfc_main$2 from "../../../../components/Tab/Tab.vue2.js";
|
4
|
+
import _sfc_main$5 from "../../../../components/Feed/Feed.vue.js";
|
5
5
|
/* empty css */
|
6
6
|
import "vue-i18n";
|
7
7
|
import { actions } from "../../store/categories.js";
|
8
8
|
import { state } from "../../store/marketplace.js";
|
9
9
|
/* empty css */
|
10
|
-
import _sfc_main$
|
11
|
-
import _sfc_main$
|
12
|
-
import _sfc_main$
|
10
|
+
import _sfc_main$4 from "../../../globals/views/components/blocks/BlockSearch.vue.js";
|
11
|
+
import _sfc_main$3 from "../../../globals/views/components/blocks/BlockFilter.vue.js";
|
12
|
+
import _sfc_main$6 from "../blocks/CardProduct.vue.js";
|
13
|
+
import _sfc_main$1 from "../../../icons/navigation/IconPlus.vue.js";
|
13
14
|
import { state as state$2 } from "../../../auth/views/store/auth.js";
|
14
|
-
import {
|
15
|
+
import { state as state$1 } from "../../../globals/views/store/globals.js";
|
16
|
+
import { actions as actions$1, state as state$3 } from "../../store/products.js";
|
15
17
|
const _hoisted_1 = { class: "h-100" };
|
16
18
|
const _hoisted_2 = {
|
17
19
|
key: 0,
|
@@ -36,7 +38,14 @@ const _sfc_main = {
|
|
36
38
|
watch(tabProducts, (newValue) => {
|
37
39
|
if (route.name !== "Organization") router.replace({ query: { ...route.query, tabProducts: newValue } });
|
38
40
|
});
|
39
|
-
|
41
|
+
state$1.navigation_bar.actions = [{
|
42
|
+
component: _sfc_main$1,
|
43
|
+
props: {
|
44
|
+
fill: "rgb(var(--main))"
|
45
|
+
},
|
46
|
+
condition: () => state$2.user && state$2.user._id,
|
47
|
+
action: () => route.params._id ? router.push({ name: "Organization_ProductAdd", params: { _id: route.params._id } }) : router.push({ name: "ProductAdd" })
|
48
|
+
}], onMounted(async () => {
|
40
49
|
let categoriesFilter = await actions.fetchCategories();
|
41
50
|
categoriesFilter = categoriesFilter.map((category) => ({
|
42
51
|
value: category.url,
|
@@ -54,6 +63,9 @@ const _sfc_main = {
|
|
54
63
|
state.filter.options.unshift(categoryOption);
|
55
64
|
}
|
56
65
|
});
|
66
|
+
onUnmounted(() => {
|
67
|
+
state$1.navigation_bar.actions = [];
|
68
|
+
});
|
57
69
|
watch(() => state.sort, (newSortValue, oldSortValue) => {
|
58
70
|
let query = { ...route.query };
|
59
71
|
query.sortParam = newSortValue.param;
|
@@ -80,17 +92,21 @@ const _sfc_main = {
|
|
80
92
|
router.replace({ query });
|
81
93
|
}
|
82
94
|
return (_ctx, _cache) => {
|
95
|
+
const _component_router_link = resolveComponent("router-link");
|
83
96
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
84
97
|
unref(route).name !== "Organization" && !_ctx.MOBILE_APP ? (openBlock(), createElementBlock("header", _hoisted_2, [
|
85
98
|
_cache[4] || (_cache[4] = createElementVNode("h2", { class: "mn-r-medium" }, "Products", -1)),
|
86
99
|
createElementVNode("button", {
|
87
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
88
|
-
|
89
|
-
|
100
|
+
onClick: _cache[0] || (_cache[0] = ($event) => {
|
101
|
+
var _a;
|
102
|
+
return _ctx.$router.push({
|
103
|
+
name: ((_a = unref(route).params) == null ? void 0 : _a._id) ? "Organization_ProductAdd" : "ProductAdd"
|
104
|
+
});
|
105
|
+
}),
|
90
106
|
class: "radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second"
|
91
107
|
}, " + ")
|
92
108
|
])) : createCommentVNode("", true),
|
93
|
-
unref(route).name !== "Organization" ? (openBlock(), createBlock(_sfc_main$
|
109
|
+
unref(route).name !== "Organization" ? (openBlock(), createBlock(_sfc_main$2, {
|
94
110
|
key: 1,
|
95
111
|
selected: tabProducts.value,
|
96
112
|
"onUpdate:selected": _cache[1] || (_cache[1] = ($event) => tabProducts.value = $event),
|
@@ -102,10 +118,10 @@ const _sfc_main = {
|
|
102
118
|
],
|
103
119
|
style: { "flex": "0 0 auto" },
|
104
120
|
class: "o-hidden h5 bg-light gap-micro pd-small pd-t-thin pd-b-thin pos-sticky pos-t-0 z-index-1",
|
105
|
-
tabClass: "bg-white pd-small radius-small w-100"
|
121
|
+
tabClass: "bg-white uppercase pd-small radius-small w-100"
|
106
122
|
}, null, 8, ["selected"])) : createCommentVNode("", true),
|
107
123
|
createElementVNode("div", _hoisted_3, [
|
108
|
-
createVNode(_sfc_main$
|
124
|
+
createVNode(_sfc_main$3, {
|
109
125
|
filter: state.filter,
|
110
126
|
"onUpdate:filter": _cache[2] || (_cache[2] = ($event) => state.filter = $event),
|
111
127
|
options: state.filter.options,
|
@@ -113,13 +129,13 @@ const _sfc_main = {
|
|
113
129
|
}, null, 8, ["filter", "options"]),
|
114
130
|
createElementVNode("div", _hoisted_4, [
|
115
131
|
createElementVNode("div", _hoisted_5, [
|
116
|
-
createVNode(_sfc_main$
|
132
|
+
createVNode(_sfc_main$4, {
|
117
133
|
onSearch: updateSearch,
|
118
134
|
placeholder: "Enter product name",
|
119
135
|
class: "bg-light h-4r"
|
120
136
|
})
|
121
137
|
]),
|
122
|
-
createVNode(_sfc_main$
|
138
|
+
createVNode(_sfc_main$5, {
|
123
139
|
filter: state.filter,
|
124
140
|
"onUpdate:filter": _cache[3] || (_cache[3] = ($event) => state.filter = $event),
|
125
141
|
states: {
|
@@ -130,11 +146,11 @@ const _sfc_main = {
|
|
130
146
|
},
|
131
147
|
store: {
|
132
148
|
read: (options) => actions$1.read(options),
|
133
|
-
state: state$
|
149
|
+
state: state$3
|
134
150
|
},
|
135
151
|
options: {
|
136
152
|
limit: 15,
|
137
|
-
|
153
|
+
owner: unref(route).params._id,
|
138
154
|
categories: unref(route).query.categories,
|
139
155
|
prices: unref(route).query.prices,
|
140
156
|
delivery: unref(route).query.delivery,
|
@@ -142,26 +158,28 @@ const _sfc_main = {
|
|
142
158
|
...tabProducts.value !== "all" && { status: tabProducts.value }
|
143
159
|
// user: user
|
144
160
|
},
|
145
|
-
class: "cols-4 pd-thin gap-thin"
|
161
|
+
class: "cols-4 rows-1 pd-t-zero pd-thin gap-thin"
|
146
162
|
}, {
|
147
163
|
default: withCtx(({
|
148
164
|
items
|
149
165
|
}) => [
|
150
166
|
(openBlock(true), createElementBlock(Fragment, null, renderList(items, (product) => {
|
151
|
-
return openBlock(), createBlock(
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
167
|
+
return openBlock(), createBlock(_component_router_link, {
|
168
|
+
to: unref(route).params._id ? { name: "Organization_Product", params: { _id: unref(route).params._id, product: product._id } } : { name: "Product", params: { product: product._id } }
|
169
|
+
}, {
|
170
|
+
default: withCtx(() => [
|
171
|
+
(openBlock(), createBlock(_sfc_main$6, {
|
172
|
+
key: product._id,
|
173
|
+
product,
|
174
|
+
user: state$2.access,
|
175
|
+
organization: unref(route).params._id,
|
176
|
+
access: _ctx.hasAccess(unref(route).params._id, "products", "edit", state$2.accesses),
|
177
|
+
class: "h-max bg-light"
|
178
|
+
}, null, 8, ["product", "user", "organization", "access"]))
|
179
|
+
]),
|
180
|
+
_: 2
|
181
|
+
}, 1032, ["to"]);
|
182
|
+
}), 256))
|
165
183
|
]),
|
166
184
|
_: 1
|
167
185
|
}, 8, ["filter", "store", "options"])
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Products.vue.js","sources":["../../../../../../../src/modules/products/components/pages/Products.vue"],"sourcesContent":["<template>\n <div class=\"h-100\">\n <header \n v-if=\"route.name !== 'Organization' && !MOBILE_APP\"\n class=\"mn-b-medium flex-v-center flex-nowrap flex\"\n >\n <h2 class=\"mn-r-medium\">Products</h2>\n <button \n @click=\"$router.push({\n name: route.params
|
1
|
+
{"version":3,"file":"Products.vue.js","sources":["../../../../../../../src/modules/products/components/pages/Products.vue"],"sourcesContent":["<template>\n <div class=\"h-100\">\n <header \n v-if=\"route.name !== 'Organization' && !MOBILE_APP\"\n class=\"mn-b-medium flex-v-center flex-nowrap flex\"\n >\n <h2 class=\"mn-r-medium\">Products</h2>\n <button \n @click=\"$router.push({\n name: route.params?._id ? 'Organization_ProductAdd' : 'ProductAdd'\n })\" \n class=\"radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second\">\n +\n </button>\n </header>\n\n <Tab \n v-if=\"route.name !== 'Organization'\"\n v-model:selected=\"tabProducts\"\n :tabs=\"[\n { name: 'All', value: 'all' },\n { name: 'Published', value: 'published' },\n { name: 'Unpublished', value: 'unpublished' }, \n { name: 'Archivied', value: 'archivied' } \n ]\"\n style=\"flex: 0 0 auto\"\n class=\"\n o-hidden \n h5 \n bg-light\n gap-micro pd-small pd-t-thin pd-b-thin\n pos-sticky pos-t-0\n z-index-1\n\n \"\n tabClass=\"bg-white uppercase pd-small radius-small w-100\"\n />\n\n <div class=\"cols-2-1_3 h-100 z-index-3 pos-relative radius-big gap-thin\">\n\n <BlockFilter\n v-model:filter=\"marketplace.state.filter\"\n :options=\"marketplace.state.filter.options\"\n class=\"h-100 w-100 z-index-2 desktop-only\"\n />\n\n\n <div class=\"rows-1 h-100 z-index-3 bg-white radius-tl-big radius-tr-big\">\n <div class=\"pd-thin z-index-3 radius-tl-big radius-tr-big pos-t-0 pos-sticky\">\n <BlockSearch \n @search=\"updateSearch\"\n placeholder=\"Enter product name\"\n class=\"bg-light h-4r\"\n />\n </div>\n <Feed\n v-model:filter=\"marketplace.state.filter\"\n \n :states=\"{\n empty: {\n title: 'No Products Found',\n description: 'Currently, there are no products available.'\n }\n }\"\n :store=\"{\n read: (options) => products.actions.read(options),\n state: products.state\n }\"\n :options=\"{\n limit: 15,\n owner: route.params._id,\n categories: route.query.categories,\n prices: route.query.prices,\n delivery: route.query.delivery,\n // search: route.query.search,\n ...(tabProducts !== 'all' && { status: tabProducts })\n // user: user\n }\"\n v-slot=\"{ \n items \n }\"\n class=\"cols-4 rows-1 pd-t-zero pd-thin gap-thin\"\n >\n <router-link \n v-for=\"product in items\" \n :to=\"route.params._id ? { name: 'Organization_Product', params: { _id: route.params._id, product: product._id } } : { name: 'Product', params: { product: product._id } }\">\n <CardProduct\n :key=\"product._id\"\n :product=\"product\"\n :user=\"auth.state.access\"\n :organization=\"route.params._id\"\n :access=\"hasAccess(route.params._id, 'products', 'edit', auth.state.accesses)\"\n class=\"h-max bg-light\"\n />\n </router-link>\n </Feed>\n\n </div>\n </div>\n</div>\n</template>\n\n\n<script setup=\"props\">\n // Import libs\n import { ref, computed, watch, onMounted, onUnmounted } from 'vue'\n import { useRoute, useRouter } from 'vue-router'\n\n // Import components\n import Tab from '@pf/src/components/Tab/Tab.vue'\n import Feed from '@pf/src/components/Feed/Feed.vue'\n\n import FilterProducts from '@pf/src/modules/products/components/sections/FilterProducts.vue'\n import BlockSearch from '@pf/src/modules/globals/views/components/blocks/BlockSearch.vue'\n import BlockFilter from '@pf/src/modules/globals/views/components/blocks/BlockFilter.vue'\n\n import CardProduct from '@pf/src/modules/products/components/blocks/CardProduct.vue'\n\n import IconPlus from '@pf/src/modules/icons/navigation/IconPlus.vue'\n\n // Accessing router and store\n import * as auth from '@pf/src/modules/auth/views/store/auth';\n import * as globals from '@pf/src/modules/globals/views/store/globals';\n import * as products from '@pf/src/modules/products/store/products';\n import * as marketplace from '@pf/src/modules/products/store/marketplace';\n import * as categories from '@pf/src/modules/products/store/categories';\n\n const route = useRoute()\n const router = useRouter()\n\n // Tab logic\n const tabProducts = ref(route.query.tabProducts ? route.query.tabProducts : 'all')\n\n if (route.name !== 'Organization') route.query.tabProducts = tabProducts.value\n \n if (route.query) {\n const query = route.query;\n\n marketplace.state.filter.selected.categories = query.categories ? query.categories.split(',') : [];\n marketplace.state.filter.selected.prices = query.prices ? query.prices.split(',') : [];\n marketplace.state.filter.selected.delivery = query.delivery ? query.delivery.split(',') : [];\n }\n\n watch(tabProducts, (newValue) => {\n if (route.name !== 'Organization') router.replace({ query: { ...route.query, tabProducts: newValue } });\n });\n\n globals.state.navigation_bar.actions = [{\n component: IconPlus,\n props: {\n fill: \"rgb(var(--main))\" \n },\n condition: () => auth.state.user && auth.state.user._id,\n action: () => route.params._id ? router.push({ name: 'Organization_ProductAdd', params: { _id: route.params._id} }) : router.push({ name: 'ProductAdd' })\n }],\n\n onMounted(async () => {\n let categoriesFilter = await categories.actions.fetchCategories();\n\n categoriesFilter = categoriesFilter.map(category => ({\n value: category.url,\n label: category.name\n }));\n\n const index = marketplace.state.filter.options.findIndex(option => option.value === 'categories');\n\n const categoryOption = {\n title: 'Categories',\n value: 'categories',\n options: categoriesFilter\n };\n\n if (index !== -1) {\n marketplace.state.filter.options[index] = categoryOption;\n } else {\n marketplace.state.filter.options.unshift(categoryOption);\n }\n })\n\n onUnmounted(() => {\n globals.state.navigation_bar.actions = [];\n });\n\n watch(() => marketplace.state.sort, (newSortValue, oldSortValue) => {\n let query = { ...route.query}\n \n query.sortParam = newSortValue.param\n query.sortOrder = newSortValue.order\n \n // replace the current route\n router.replace({ query });\n }, { deep: true });\n\n\n watch(() => marketplace.state.filter.selected, (newFilterValue, oldFilterValue) => {\n // Переводим фильтр в формат query\n const query = { ...route.query };\n\n // Удаляем старые значения фильтра из query\n Object.keys(oldFilterValue).forEach(key => {\n if (query[key]) {\n delete query[key];\n }\n });\n\n // Добавляем новые значения фильтра в query\n const newQueryValues = Object.fromEntries(\n Object.entries(newFilterValue)\n .filter(([key, value]) => Array.isArray(value) && value.length > 0)\n .map(([key, value]) => [key, value.join(',')])\n );\n\n delete query.options;\n Object.assign(query, newQueryValues);\n\n // Обновляем маршрут с новым query\n router.replace({ query });\n }, { deep: true })\n\n\n\n \n function updateSearch(search) {\n let query = { ...route.query}\n \n query.search = search\n \n router.replace({ query });\n }\n</script>\n\n<style lang=\"scss\">\n\n\n</style>\n"],"names":["marketplace.state","globals.state","IconPlus","auth.state","categories.actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+HE,UAAM,QAAQ,SAAU;AACxB,UAAM,SAAS,UAAW;AAG1B,UAAM,cAAc,IAAI,MAAM,MAAM,cAAc,MAAM,MAAM,cAAc,KAAK;AAEjF,QAAI,MAAM,SAAS,eAAgB,OAAM,MAAM,cAAc,YAAY;AAEzE,QAAI,MAAM,OAAO;AACf,YAAM,QAAQ,MAAM;AAEpBA,YAAkB,OAAO,SAAS,aAAa,MAAM,aAAa,MAAM,WAAW,MAAM,GAAG,IAAI,CAAA;AAChGA,YAAkB,OAAO,SAAS,SAAS,MAAM,SAAS,MAAM,OAAO,MAAM,GAAG,IAAI,CAAA;AACpFA,YAAkB,OAAO,SAAS,WAAW,MAAM,WAAW,MAAM,SAAS,MAAM,GAAG,IAAI,CAAA;AAAA,IAC3F;AAED,UAAM,aAAa,CAAC,aAAa;AAC/B,UAAI,MAAM,SAAS,eAAgB,QAAO,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,aAAa,SAAQ,EAAI,CAAA;AAAA,IAC1G,CAAG;AAEDC,YAAc,eAAe,UAAU,CAAC;AAAA,MACtC,WAAWC;AAAAA,MACX,OAAO;AAAA,QACL,MA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M,iBAAiB,OAAO;AAAA,QAC5B,OAAO,QAAQ,cAAc,EAC1B,OAAO,CAAC,CAAC,KAAK,KAAK,MAAM,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,CAAC,EACjE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,MAAM,KAAK,GAAG,CAAC,CAAC;AAAA,MACrD;AAEI,aAAO,MAAM;AACb,aAAO,OAAO,OAAO,cAAc;AAGnC,aAAO,QAAQ,EAAE,MAAK,CAAE;AAAA,IAC5B,GAAK,EAAE,MAAM,MAAM;AAKjB,aAAS,aAAa,QAAQ;AAC5B,UAAI,QAAQ,EAAE,GAAG,MAAM,MAAK;AAE5B,YAAM,SAAS;AAEf,aAAO,QAAQ,EAAE,MAAK,CAAE;AAAA,IACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/prometheus-framework/src/modules/products/components/sections/CategoriesTree.vue.cjs
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
3
|
+
const vue = require("vue");
|
4
|
+
const vueDraggableNext_esmBundler = require("../../../../../../node_modules/vue-draggable-next/dist/vue-draggable-next.esm-bundler.cjs");
|
5
|
+
const CardCategory = require("../blocks/CardCategory.vue.cjs");
|
6
|
+
const categories = require("../../store/categories.cjs");
|
7
|
+
const _sfc_main = {
|
8
|
+
__name: "CategoriesTree",
|
9
|
+
props: {
|
10
|
+
items: Array,
|
11
|
+
state: Array
|
12
|
+
},
|
13
|
+
emits: ["update"],
|
14
|
+
setup(__props, { emit: __emit }) {
|
15
|
+
const props = __props;
|
16
|
+
const emits = __emit;
|
17
|
+
const dragOptions = {
|
18
|
+
animation: 200,
|
19
|
+
group: "category",
|
20
|
+
ghostClass: "ghost"
|
21
|
+
};
|
22
|
+
async function deleteCategory(category) {
|
23
|
+
if (confirm(`Are you sure you want to delete the category "${category.name}"?`)) {
|
24
|
+
await categories.actions.deleteCategory(category.url);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
function findCategoryAndUpdateParent(items, targetId, parentId = null) {
|
28
|
+
for (const item of items) {
|
29
|
+
if (item._id === targetId) {
|
30
|
+
item.parent = parentId;
|
31
|
+
return item;
|
32
|
+
}
|
33
|
+
if (item.children) {
|
34
|
+
const found = findCategoryAndUpdateParent(item.children, targetId, item._id);
|
35
|
+
if (found) {
|
36
|
+
return found;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
return null;
|
41
|
+
}
|
42
|
+
function updateOrders(items, startOrder = 0) {
|
43
|
+
let currentOrder = startOrder;
|
44
|
+
items.forEach((item) => {
|
45
|
+
var _a;
|
46
|
+
item.order = currentOrder++;
|
47
|
+
if ((_a = item.children) == null ? void 0 : _a.length) {
|
48
|
+
currentOrder = updateOrders(item.children, currentOrder);
|
49
|
+
}
|
50
|
+
});
|
51
|
+
return currentOrder;
|
52
|
+
}
|
53
|
+
function handleChange(event) {
|
54
|
+
if (!event.added && !event.moved) return;
|
55
|
+
const targetId = event.added ? event.added.element._id : props.items[event.moved.newIndex]._id;
|
56
|
+
const updatedCategory = findCategoryAndUpdateParent(props.state, targetId);
|
57
|
+
if (!updatedCategory) return;
|
58
|
+
updateOrders(props.state);
|
59
|
+
emits("update", updatedCategory);
|
60
|
+
}
|
61
|
+
function emitChange(event) {
|
62
|
+
emits("update", event);
|
63
|
+
}
|
64
|
+
return (_ctx, _cache) => {
|
65
|
+
return vue.openBlock(), vue.createBlock(vue.unref(vueDraggableNext_esmBundler.VueDraggableNext), vue.mergeProps(dragOptions, {
|
66
|
+
class: "dragArea list-group w-full",
|
67
|
+
list: __props.items,
|
68
|
+
onChange: handleChange
|
69
|
+
}), {
|
70
|
+
default: vue.withCtx(() => [
|
71
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.items, (category) => {
|
72
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
73
|
+
key: category._id,
|
74
|
+
class: "pd-medium bg-light radius-medium mn-b-thin"
|
75
|
+
}, [
|
76
|
+
vue.createVNode(CardCategory.default, {
|
77
|
+
category,
|
78
|
+
onDelete: deleteCategory
|
79
|
+
}, null, 8, ["category"]),
|
80
|
+
vue.createElementVNode("div", null, [
|
81
|
+
vue.createVNode(_sfc_main, {
|
82
|
+
items: category.children,
|
83
|
+
state: __props.items,
|
84
|
+
onUpdate: emitChange
|
85
|
+
}, null, 8, ["items", "state"])
|
86
|
+
])
|
87
|
+
]);
|
88
|
+
}), 128))
|
89
|
+
]),
|
90
|
+
_: 1
|
91
|
+
}, 16, ["list"]);
|
92
|
+
};
|
93
|
+
}
|
94
|
+
};
|
95
|
+
exports.default = _sfc_main;
|
96
|
+
//# sourceMappingURL=CategoriesTree.vue.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CategoriesTree.vue.cjs","sources":["../../../../../../../src/modules/products/components/sections/CategoriesTree.vue"],"sourcesContent":["<template>\n <VueDraggableNext\n v-bind=\"dragOptions\" \n class=\"dragArea list-group w-full\"\n :list=\"items\"\n @change=\"handleChange\"\n >\n <div v-for=\"category in items\" :key=\"category._id\" class=\"pd-medium bg-light radius-medium mn-b-thin\">\n <CardCategory \n :category=\"category\" \n @delete=\"deleteCategory\" \n />\n <div\n >\n <!-- Subcategories: -->\n <CategoryList \n :items=\"category.children\"\n :state=\"items\"\n @update=\"emitChange\"\n />\n </div>\n </div>\n </VueDraggableNext>\n</template>\n\n<script setup>\nimport { VueDraggableNext } from 'vue-draggable-next';\nimport CardCategory from '@pf/src/modules/products/components/blocks/CardCategory.vue';\nimport CategoryList from '@pf/src/modules/products/components/sections/CategoriesTree.vue';\nimport * as categories from '@pf/src/modules/products/store/categories';\n\nconst props = defineProps({\n items: Array,\n state: Array\n});\n\nconst emits = defineEmits(['update']);\n\nconst dragOptions = {\n animation: 200,\n group: 'category',\n ghostClass: 'ghost'\n};\n\nasync function deleteCategory(category) {\n if (confirm(`Are you sure you want to delete the category \"${category.name}\"?`)) {\n await categories.actions.deleteCategory(category.url);\n }\n}\n\nfunction findCategoryAndUpdateParent(items, targetId, parentId = null) {\n for (const item of items) {\n if (item._id === targetId) {\n item.parent = parentId;\n return item;\n }\n \n if (item.children) {\n const found = findCategoryAndUpdateParent(item.children, targetId, item._id);\n if (found) {\n return found;\n }\n }\n }\n return null;\n}\n\nfunction updateOrders(items, startOrder = 0) {\n let currentOrder = startOrder;\n \n items.forEach(item => {\n item.order = currentOrder++;\n \n if (item.children?.length) {\n currentOrder = updateOrders(item.children, currentOrder);\n }\n });\n \n return currentOrder;\n}\n\nfunction handleChange(event) {\n if (!event.added && !event.moved) return;\n \n const targetId = event.added ? \n event.added.element._id : \n props.items[event.moved.newIndex]._id;\n \n const updatedCategory = findCategoryAndUpdateParent(props.state, targetId);\n if (!updatedCategory) return;\n \n // Обновляем order для всего дерева категорий\n updateOrders(props.state);\n \n // Отправляем обновленную категорию\n emits('update', updatedCategory);\n}\n\nfunction emitChange(event) {\n emits('update', event);\n}\n</script> "],"names":["categories.actions"],"mappings":";;;;;;;;;;;;;;AA+BA,UAAM,QAAQ;AAKd,UAAM,QAAQ;AAEd,UAAM,cAAc;AAAA,MAClB,WAAW;AAAA,MACX,OAAO;AAAA,MACP,YAAY;AAAA,IACd;AAEA,mBAAe,eAAe,UAAU;AACtC,UAAI,QAAQ,iDAAiD,SAAS,IAAI,IAAI,GAAG;AAC/E,cAAMA,mBAAmB,eAAe,SAAS,GAAG;AAAA,MACrD;AAAA,IACH;AAEA,aAAS,4BAA4B,OAAO,UAAU,WAAW,MAAM;AACrE,iBAAW,QAAQ,OAAO;AACxB,YAAI,KAAK,QAAQ,UAAU;AACzB,eAAK,SAAS;AACd,iBAAO;AAAA,QACR;AAED,YAAI,KAAK,UAAU;AACjB,gBAAM,QAAQ,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