@ozdao/prometheus-framework 0.2.81 → 0.2.82
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth.server.js +1 -1
- package/dist/auth.server.mjs +1 -1
- package/dist/community.server.js +3 -3
- package/dist/community.server.mjs +3 -3
- package/dist/credentials.schema-CDZCKfEI.mjs +106 -0
- package/dist/credentials.schema-CfhPcsuI.js +105 -0
- package/dist/events.server.js +4 -15
- package/dist/events.server.mjs +3 -14
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +1 -1
- package/dist/gallery.server.mjs +1 -1
- package/dist/index-B6a1mPgp.mjs +217 -0
- package/dist/index-BCCiEK_u.js +216 -0
- package/dist/main-8N2Jmsuk.js +91 -0
- package/dist/main-CkeuHuCY.mjs +13619 -0
- package/dist/main.css +1 -1
- package/dist/metadata.schema-Cu_mPkjE.js +77 -0
- package/dist/metadata.schema-cbFgazeK.mjs +78 -0
- package/dist/middlewares.server.js +1 -1
- package/dist/middlewares.server.mjs +1 -1
- package/dist/node_modules/@googlemaps/js-api-loader/dist/index.cjs +1 -0
- package/dist/node_modules/@googlemaps/js-api-loader/dist/index.js +238 -0
- package/dist/organizations.server.js +297 -134
- package/dist/organizations.server.mjs +295 -132
- package/dist/products.server.js +2 -2
- package/dist/products.server.mjs +2 -2
- package/dist/prometheus-framework/src/components/Address/Address.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Address/Address.vue2.js +33 -24
- package/dist/prometheus-framework/src/components/Block/Block.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Block/Block.vue.js +23 -20
- package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue.js +1 -225
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +102 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +71 -60
- package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue.js +1 -84
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +84 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone.vue.js +325 -340
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.js +2 -2
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue2.js +53 -44
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +41 -40
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js +37 -31
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Slider/Slider.vue.js +18 -19
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +1 -36
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +36 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue.js +45 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.cjs +1 -1
- package/dist/prometheus-framework/src/components/Tooltip/Tooltip.vue2.js +1 -45
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +30 -30
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/auth/store/auth.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/store/auth.js +26 -26
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +78 -103
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +15 -15
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/blocks/CardEvent.vue.js +4 -4
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +29 -27
- 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 +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/components/sections/SectionPageTitle.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/components/sections/SectionPageTitle.vue.js +33 -26
- package/dist/prometheus-framework/src/modules/globals/localization/vue-i18n.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/localization/vue-i18n.js +6 -3
- package/dist/prometheus-framework/src/modules/globals/services/globals.store.cjs +1 -0
- package/dist/prometheus-framework/src/modules/globals/services/globals.store.js +70 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconGallery.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconGallery.vue.js +28 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconLeftovers.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconLeftovers.vue.js +30 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconOrders.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconOrders.vue.js +35 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconProducts.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/icons/entities/IconProducts.vue.js +28 -0
- package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/landing/components/sections/MobileApp.vue.js +63 -86
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
- 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 +174 -114
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +40 -40
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +141 -0
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormClientDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormClientDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +77 -0
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +46 -35
- package/dist/prometheus-framework/src/modules/orders/store/customers.store.cjs +1 -0
- package/dist/prometheus-framework/src/modules/orders/store/customers.store.js +5 -0
- package/dist/prometheus-framework/src/modules/orders/store/models/customer.cjs +1 -0
- package/dist/prometheus-framework/src/modules/orders/store/models/customer.js +30 -0
- package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/store/orders.js +24 -25
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardDepartment.vue.js +16 -16
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +38 -49
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Department.vue.js +6 -6
- 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 +161 -138
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +198 -78
- 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.js +82 -125
- 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 +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
- 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 +59 -70
- 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 +3 -3
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +34 -36
- package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/departments.js +38 -18
- package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/store/invites.js +34 -35
- 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 +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardProduct.vue.js +41 -21
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
- 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/Leftovers.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +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 +24 -26
- package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.cjs +1 -0
- package/dist/prometheus-framework/src/modules/users/components/blocks/CardUser.vue.js +78 -0
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/users/store/users.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/store/users.js +13 -14
- 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 +2 -2
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +1 -1
- package/dist/queryProcessor-BJdKh0Ow.mjs +162 -0
- package/dist/queryProcessor-DRMo_GWK.js +161 -0
- package/dist/reports.server.js +1 -1
- package/dist/reports.server.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/users.server.js +69 -38
- package/dist/users.server.mjs +67 -36
- package/dist/wallet.server.js +2 -2
- package/dist/wallet.server.mjs +2 -2
- package/dist/web-CtVocufd.js +1 -0
- package/dist/web-DNq1tHCE.mjs +54 -0
- package/package.json +1 -1
- package/src/components/Address/Address.vue +13 -2
- package/src/components/Block/Block.vue +3 -2
- package/src/components/Button/Button.vue +9 -12
- package/src/components/Feed/Feed.vue +28 -6
- package/src/components/FieldPhone/FieldPhone.vue +592 -558
- package/src/components/LocationMarker/LocationMarker.vue +26 -22
- package/src/components/Popup/Popup.vue +22 -23
- package/src/components/Select/Select.vue +43 -32
- package/src/components/Slider/Slider.vue +3 -4
- package/src/modules/auth/components/pages/Invite.vue +7 -7
- package/src/modules/auth/store/auth.js +1 -1
- package/src/modules/backoffice/components/pages/Dashboard.vue +44 -29
- package/src/modules/community/components/sections/HotPosts.vue +1 -1
- package/src/modules/events/components/blocks/CardEvent.vue +4 -3
- package/src/modules/events/components/pages/Events.vue +23 -6
- package/src/modules/globals/components/sections/SectionPageTitle.vue +19 -7
- package/src/modules/globals/controllers/utils/queryProcessor.js +21 -7
- package/src/modules/globals/localization/vue-i18n.js +3 -0
- package/src/modules/globals/models/credentials.schema.js +7 -0
- package/src/modules/globals/models/metadata.schema.js +17 -0
- package/src/modules/globals/models/profile.schema.js +23 -0
- package/src/modules/globals/models/socials.schema.js +22 -0
- package/src/modules/globals/router/routerGuards.js +1 -0
- package/src/modules/globals/services/globals.cashe.js +26 -0
- package/src/modules/globals/services/globals.crud.js +115 -0
- package/src/modules/globals/services/globals.logger.js +41 -0
- package/src/modules/globals/services/globals.store.js +114 -0
- package/src/modules/icons/entities/IconGallery.vue +14 -0
- package/src/modules/icons/entities/IconLeftovers.vue +14 -0
- package/src/modules/icons/entities/IconOrders.vue +15 -0
- package/src/modules/icons/entities/IconProducts.vue +14 -0
- package/src/modules/landing/components/sections/HeroSection.vue +1 -1
- package/src/modules/landing/components/sections/MobileApp.vue +4 -4
- package/src/modules/landing/router/landing.js +1 -1
- package/src/modules/marketplace/components/sections/Filters.vue +3 -3
- package/src/modules/middlewares/server/accessors/AccessController.js +33 -0
- package/src/modules/middlewares/server/accessors/ReadDepartments.js +101 -0
- package/src/modules/middlewares/server/verifyAccesses.js +33 -0
- package/src/modules/middlewares/server/verifyInvites.js +4 -4
- package/src/modules/orders/components/pages/OrderCreate.vue +2 -2
- package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +105 -68
- package/src/modules/orders/components/pages/Orders.vue +2 -2
- package/src/modules/orders/components/sections/FormAddCustomer.vue +152 -0
- package/src/modules/orders/components/sections/FormCustomerDetails.vue +67 -0
- package/src/modules/orders/components/sections/FormDelivery.vue +17 -3
- package/src/modules/orders/controllers/applications.controller.js +2 -0
- package/src/modules/orders/controllers/orders.controller.js +77 -52
- package/src/modules/orders/models/customer.model.js +54 -18
- package/src/modules/orders/models/order.model.js +1 -1
- package/src/modules/orders/orders.client.js +51 -51
- package/src/modules/orders/orders.server.js +32 -12
- package/src/modules/orders/router/orders.router.js +36 -41
- package/src/modules/orders/routes/orders.routes.js +3 -21
- package/src/modules/orders/store/customers.store.js +5 -0
- package/src/modules/orders/store/models/customer.js +29 -0
- package/src/modules/orders/store/orders.js +14 -20
- package/src/modules/organizations/components/blocks/CardDepartment.vue +3 -3
- package/src/modules/organizations/components/blocks/CardOrganization.vue +1 -1
- package/src/modules/organizations/components/blocks/DepartmentMemberModify.vue +1 -12
- package/src/modules/organizations/components/pages/Department.vue +1 -1
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +72 -48
- package/src/modules/organizations/components/pages/Members.vue +178 -64
- package/src/modules/organizations/components/pages/Organization.vue +1 -41
- package/src/modules/organizations/components/sections/MembersAdd.vue +44 -52
- package/src/modules/organizations/controllers/departments.controller.js +2 -4
- package/src/modules/organizations/controllers/invites.controller.js +24 -23
- package/src/modules/organizations/controllers/organizations.controller.js +1 -1
- package/src/modules/organizations/models/department.model.js +52 -2
- package/src/modules/organizations/models/invite.model.js +29 -32
- package/src/modules/organizations/models/membership.model.js +2 -0
- package/src/modules/organizations/models/organization.model.js +2 -1
- package/src/modules/organizations/organizations.client.js +0 -2
- package/src/modules/organizations/routes/departments.routes.js +18 -7
- package/src/modules/organizations/routes/invites.routes.js +2 -2
- package/src/modules/organizations/store/departments.js +22 -1
- package/src/modules/organizations/store/invites.js +74 -90
- package/src/modules/products/components/blocks/CardProduct.vue +24 -0
- package/src/modules/products/components/pages/Products.vue +1 -1
- package/src/modules/reports/components/sections/FormReport.vue +40 -40
- package/src/modules/spots/components/pages/Spot.vue +1 -1
- package/src/modules/spots/components/pages/SpotEdit.vue +1 -1
- package/src/modules/users/components/blocks/CardUser.vue +85 -0
- package/src/modules/users/controllers/users.controller.js +36 -13
- package/src/modules/users/middlewares/visitor.logger.js +66 -0
- package/src/modules/users/models/request.model.js +18 -0
- package/src/modules/users/models/user.model.js +26 -55
- package/src/modules/users/models/visitor.model.js +14 -0
- package/src/modules/users/store/users.js +2 -11
- package/src/modules/wallet/controllers/routes/payments.routes.js +2 -0
- package/src/components/FieldPhone/FieldPhone(script-setup).vue +0 -1646
- package/src/components/FieldPhone/FieldPhone2.vue +0 -671
- package/src/modules/orders/components/sections/FormClientDetails.vue +0 -61
- package/src/modules/organizations/components/blocks/User.vue +0 -69
- /package/src/modules/backoffice/components/admin/{User.vue → UserEdit.vue} +0 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
const AccessController = require('./AccessController');
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @extends AccessController
|
5
|
+
*/
|
6
|
+
class ReadDepartments extends AccessController {
|
7
|
+
rule = 'read';
|
8
|
+
entity = 'departments';
|
9
|
+
|
10
|
+
async access(req, res, next) {
|
11
|
+
const Department = this.db.department
|
12
|
+
|
13
|
+
try {
|
14
|
+
const userId = req.cookies.user._id
|
15
|
+
const organization = req.query.organization
|
16
|
+
|
17
|
+
// Ищем департаменты организации в которых участвует пользователь
|
18
|
+
const departments = await Department.find({
|
19
|
+
organization: { $eq: organization },
|
20
|
+
members: { $elemMatch: { user: userId } }
|
21
|
+
})
|
22
|
+
|
23
|
+
// Если не найдены департаменты организации в которой состоит пользователь
|
24
|
+
if (!departments.length) {
|
25
|
+
return res
|
26
|
+
.status(403)
|
27
|
+
.send({
|
28
|
+
message: 'Access Denied. Read Departments. Департаменты не найдены',
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
// Если департаменты найдены
|
33
|
+
let hasAccess = false
|
34
|
+
departments.forEach((departament) => {
|
35
|
+
const accesses = departament.accesses
|
36
|
+
|
37
|
+
if (getNestedProperty(accesses, rulePath)) {
|
38
|
+
hasAccess = true
|
39
|
+
}
|
40
|
+
})
|
41
|
+
|
42
|
+
if (hasAccess) {
|
43
|
+
next()
|
44
|
+
} else {
|
45
|
+
return res
|
46
|
+
.status(403)
|
47
|
+
.send({ message: 'Access Denied. Read Departments. No access' });
|
48
|
+
}
|
49
|
+
} catch (error) {
|
50
|
+
console.error('[canReadDepartments]', error);
|
51
|
+
return res.status(500).send({ message: error.message });
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* // note: пока не использовался метод
|
57
|
+
* @param {Object} req объект
|
58
|
+
* @returns
|
59
|
+
*/
|
60
|
+
async departmentsWhereUserIsMember(req) {
|
61
|
+
const Department = this.db.department
|
62
|
+
|
63
|
+
try {
|
64
|
+
const userId = req.cookies.user._id
|
65
|
+
const organization = req.query.organization
|
66
|
+
|
67
|
+
// Ищем департаменты организации в которых участвует пользователь
|
68
|
+
const departments = await Department.find({
|
69
|
+
organization: { $eq: organization },
|
70
|
+
members: { $elemMatch: { user: userId } }
|
71
|
+
})
|
72
|
+
|
73
|
+
return departments;
|
74
|
+
} catch (error) {
|
75
|
+
console.error('[canReadDepartments]', error)
|
76
|
+
return res.status(500).send({ message: error.message })
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
module.exports = ReadDepartments;
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Получить параметр объекта по моршруту propertyPath
|
85
|
+
* @param {Object} obj
|
86
|
+
* @param {String} propertyPath path to obj property
|
87
|
+
* @returns undefined or object property of exists
|
88
|
+
*/
|
89
|
+
function getNestedProperty(obj, propertyPath) {
|
90
|
+
const properties = propertyPath.split('.');
|
91
|
+
let value = obj;
|
92
|
+
|
93
|
+
for (const property of properties) {
|
94
|
+
if (!value.hasOwnProperty(property)) {
|
95
|
+
return undefined;
|
96
|
+
}
|
97
|
+
value = value[property];
|
98
|
+
}
|
99
|
+
|
100
|
+
return value;
|
101
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
const ReadDepartments = require('./accessors/ReadDepartments');
|
2
|
+
|
3
|
+
module.exports = (db) => {
|
4
|
+
// Объекты посредников
|
5
|
+
const instances = [];
|
6
|
+
|
7
|
+
// Регистрация посредников отвечающий за проверку прав доступа
|
8
|
+
const middlewares = [
|
9
|
+
ReadDepartments,
|
10
|
+
];
|
11
|
+
|
12
|
+
let nextMiddleware = null;
|
13
|
+
|
14
|
+
// Собираем цепочку посредников
|
15
|
+
for (let i = middlewares.length - 1; i >= 0; i--) {
|
16
|
+
const Middleware = middlewares[i];
|
17
|
+
const middleware = new Middleware();
|
18
|
+
|
19
|
+
// Передаем в посредники параметры
|
20
|
+
middleware.db = db;
|
21
|
+
|
22
|
+
// Добавляем звено следующего посредника
|
23
|
+
middleware.next = nextMiddleware;
|
24
|
+
|
25
|
+
// Добавляем middleware в начало массива.
|
26
|
+
instances.unshift(middleware);
|
27
|
+
|
28
|
+
nextMiddleware = middleware;
|
29
|
+
}
|
30
|
+
|
31
|
+
// Запускам цепочку зарегестрированных посредников
|
32
|
+
return (rule, entity) => instances[0].check(rule, entity);
|
33
|
+
};
|
@@ -7,7 +7,7 @@ const middlewareFactory = (db) => {
|
|
7
7
|
const Membership = db.membership;
|
8
8
|
|
9
9
|
const checkInviteExist = async (req, res, next) => {
|
10
|
-
for (let invite of req.body) {
|
10
|
+
for (let invite of req.body.invites) {
|
11
11
|
let query;
|
12
12
|
|
13
13
|
if (invite.contact.includes('@')) {
|
@@ -16,7 +16,7 @@ const middlewareFactory = (db) => {
|
|
16
16
|
query = { invitedPhone: invite.contact };
|
17
17
|
}
|
18
18
|
|
19
|
-
query.
|
19
|
+
query['owner.target'] = req.body.owner.target;
|
20
20
|
|
21
21
|
const userInvite = await Invite.findOne(query).exec();
|
22
22
|
|
@@ -30,7 +30,7 @@ const middlewareFactory = (db) => {
|
|
30
30
|
};
|
31
31
|
|
32
32
|
const checkUsersExist = async (req, res, next) => {
|
33
|
-
for (let invite of req.body) {
|
33
|
+
for (let invite of req.body.invites) {
|
34
34
|
let query;
|
35
35
|
|
36
36
|
if (invite.contact.includes('@')) {
|
@@ -43,7 +43,7 @@ const middlewareFactory = (db) => {
|
|
43
43
|
console.log(req.params);
|
44
44
|
|
45
45
|
if (user) {
|
46
|
-
const membership = await Membership.findOne({ user: new ObjectId(user._id),
|
46
|
+
const membership = await Membership.findOne({ user: new ObjectId(user._id), 'owner.target': req.body.owner.target }).exec();
|
47
47
|
|
48
48
|
if (membership) {
|
49
49
|
console.log(membership);
|
@@ -21,7 +21,7 @@
|
|
21
21
|
v-if="orders.state.current.status !== true && shopcart.state.positions.length > 0"
|
22
22
|
class="order-form col"
|
23
23
|
>
|
24
|
-
<
|
24
|
+
<FormCustomerDetails
|
25
25
|
:order="orders.state.current"
|
26
26
|
/>
|
27
27
|
<FormDelivery
|
@@ -120,7 +120,7 @@ import AskToLogin from '@pf/src/modules/orders/components/sections/AskToLogin.vu
|
|
120
120
|
import Succes from '@pf/src/modules/orders/components/sections/Succes.vue'
|
121
121
|
import EmptyState from '@pf/src/modules/orders/components/sections/EmptyState.vue'
|
122
122
|
|
123
|
-
import
|
123
|
+
import FormCustomerDetails from '@pf/src/modules/orders/components/sections/FormCustomerDetails.vue'
|
124
124
|
import FormDelivery from '@pf/src/modules/orders/components/sections/FormDelivery.vue'
|
125
125
|
import FormPayment from '@pf/src/modules/orders/components/sections/FormPayment.vue'
|
126
126
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<template>
|
2
|
-
<div>
|
2
|
+
<div class="h-100 flex flex-column pd-thin">
|
3
3
|
<Block class="mn-b-thin">
|
4
4
|
<header class="flex-v-center flex-nowrap flex">
|
5
5
|
<h2 class="mn-r-auto">Create Order</h2>
|
@@ -13,8 +13,18 @@
|
|
13
13
|
</header>
|
14
14
|
</Block>
|
15
15
|
|
16
|
+
<Tab
|
17
|
+
v-model:selected="tabOrderCreate"
|
18
|
+
:tabs="[
|
19
|
+
{name: 'Positions', value: 'positions'},
|
20
|
+
{name: 'Customer', value: 'customer'},
|
21
|
+
{name: 'Delivery', value: 'delivery'},
|
22
|
+
{name: 'Payment', value: 'payment'}
|
23
|
+
]"
|
24
|
+
class="t-medium radius-medium bg-grey mn-b-small"
|
25
|
+
/>
|
26
|
+
|
16
27
|
<Popup
|
17
|
-
title="Добавить участника"
|
18
28
|
@close-popup="closeProductsPopup"
|
19
29
|
:isPopupOpen="isOpenProductsPopup"
|
20
30
|
class="bg-white w-min-30r w-max-30r radius-big pd-medium"
|
@@ -22,9 +32,12 @@
|
|
22
32
|
|
23
33
|
<h3 class="mn-b-small">Add to order</h3>
|
24
34
|
|
25
|
-
<div class="bg-grey mn-b-thin
|
35
|
+
<div class="h-100 bg-grey mn-b-thin o-scroll pd-medium radius-big">
|
26
36
|
<Feed
|
27
|
-
:search="
|
37
|
+
:search="{
|
38
|
+
placeholder: 'Search products...',
|
39
|
+
class: 'bg-white mn-b-thin'
|
40
|
+
}"
|
28
41
|
:states="{
|
29
42
|
empty: {
|
30
43
|
title: 'No Products Found',
|
@@ -60,12 +73,13 @@
|
|
60
73
|
</Popup>
|
61
74
|
|
62
75
|
<Block
|
76
|
+
v-if="tabOrderCreate === 'positions'"
|
63
77
|
title="Positions"
|
64
78
|
:actions="[{
|
65
79
|
label: '+',
|
66
80
|
function: () => openProductsPopup()
|
67
81
|
}]"
|
68
|
-
class="mn-b-
|
82
|
+
class="mn-b-small"
|
69
83
|
>
|
70
84
|
<span
|
71
85
|
v-if="orders.state.current.positions.length === 0"
|
@@ -87,71 +101,81 @@
|
|
87
101
|
</Block>
|
88
102
|
|
89
103
|
<Block
|
104
|
+
v-if="tabOrderCreate === 'customer'"
|
90
105
|
title="Customer"
|
91
106
|
class="mn-b-semi"
|
107
|
+
:actions="[{
|
108
|
+
label: '+',
|
109
|
+
function: () => openCustomerPopup()
|
110
|
+
}]"
|
92
111
|
>
|
93
|
-
<
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
112
|
+
<CardUser
|
113
|
+
v-if="orders.state.current.customer._id"
|
114
|
+
:user="orders.state.current.customer"
|
115
|
+
:photo="orders.state.current.customer.profile.photo"
|
116
|
+
:name="orders.state.current.customer.profile.name || orders.state.current.customer.phone || orders.state.current.customer.email"
|
117
|
+
@click="() => {
|
118
|
+
orders.mutations.resetCustomer(orders.state.current.customer)
|
119
|
+
}"
|
120
|
+
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
121
|
+
/>
|
122
|
+
<Feed
|
123
|
+
v-else
|
124
|
+
:search="{
|
125
|
+
placeholder: 'Search customer...',
|
126
|
+
class: 'bg-white mn-b-thin'
|
127
|
+
}"
|
128
|
+
:states="{
|
129
|
+
empty: {
|
130
|
+
title: 'No Products Found',
|
131
|
+
description: 'Currently, there are no such products available.'
|
132
|
+
}
|
133
|
+
}"
|
134
|
+
:store="{
|
135
|
+
read: (options) => customers.read(options),
|
136
|
+
state: null
|
137
|
+
}"
|
138
|
+
:options="{
|
139
|
+
owner: route.params._id
|
140
|
+
}"
|
141
|
+
v-slot="{
|
142
|
+
items
|
143
|
+
}"
|
144
|
+
class="bg-grey h-max-20r o-scroll"
|
145
|
+
>
|
146
|
+
<CardUser
|
147
|
+
v-for="(user, index) in items"
|
148
|
+
:key="user._id"
|
149
|
+
:user="user"
|
150
|
+
:photo="user.profile.photo"
|
151
|
+
:name="user.profile.name || user.phone || user.email"
|
152
|
+
@click="() => {
|
153
|
+
orders.state.current.customer = user
|
154
|
+
}"
|
155
|
+
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
156
|
+
/>
|
157
|
+
</Feed>
|
158
|
+
|
98
159
|
</Block>
|
99
160
|
|
100
|
-
<FormDelivery
|
101
|
-
v-if="
|
161
|
+
<FormDelivery
|
162
|
+
v-if="tabOrderCreate === 'delivery'"
|
102
163
|
:order="orders.state.current"
|
103
164
|
/>
|
104
165
|
|
105
166
|
<FormPayment
|
106
|
-
v-if="
|
167
|
+
v-if="tabOrderCreate === 'payment'"
|
107
168
|
:order="orders.state.current"
|
108
169
|
/>
|
109
170
|
|
110
|
-
<!-- <Feed
|
111
|
-
:search="true"
|
112
|
-
:states="{
|
113
|
-
empty: {
|
114
|
-
title: 'No Products Found',
|
115
|
-
description: 'Currently, there are no such products available.'
|
116
|
-
}
|
117
|
-
}"
|
118
|
-
:store="{
|
119
|
-
read: (options) => products.actions.read(options),
|
120
|
-
state: null
|
121
|
-
}"
|
122
|
-
:options="{
|
123
|
-
organization: route.params._id
|
124
|
-
}"
|
125
|
-
v-slot="{
|
126
|
-
items
|
127
|
-
}"
|
128
|
-
class="bg-grey h-min-20r h-max-20r o-scroll"
|
129
|
-
>
|
130
|
-
<CardOrderItem
|
131
|
-
v-for="(product, index) in items" :key="product._id"
|
132
|
-
:editable="false"
|
133
|
-
:product="product"
|
134
|
-
@click="() => {
|
135
|
-
let p = { ...product };
|
136
|
-
p.quantity = 1;
|
137
|
-
globals.actions.add(orders.state.current.positions, p)
|
138
|
-
closeProductsPopup();
|
139
|
-
}"
|
140
|
-
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
141
|
-
/>
|
142
|
-
</Feed> -->
|
143
|
-
|
144
171
|
<Popup
|
145
|
-
title="
|
146
|
-
@close-popup="
|
147
|
-
:isPopupOpen="
|
148
|
-
class="bg-white w-min-30r w-max-30r radius-big pd-medium"
|
172
|
+
title="Add customer"
|
173
|
+
@close-popup="closeCustomerPopup"
|
174
|
+
:isPopupOpen="isOpenCustomerPopup"
|
175
|
+
:class="'bg-white w-min-30r w-max-30r radius-big pd-medium'"
|
149
176
|
>
|
150
|
-
<
|
151
|
-
|
152
|
-
<FormClientDetails
|
153
|
-
:order="orders.state.current"
|
154
|
-
class="bg-grey"
|
177
|
+
<FormAddCustomer
|
178
|
+
@callbackCustomer="closeCustomerPopup"
|
155
179
|
/>
|
156
180
|
</Popup>
|
157
181
|
|
@@ -169,29 +193,34 @@
|
|
169
193
|
</template>
|
170
194
|
|
171
195
|
<script setup="props">
|
172
|
-
// Import Vue functionality
|
173
196
|
import { computed, ref, defineProps, onMounted, reactive, toRefs, watch } from 'vue'
|
174
|
-
import { useRoute,useRouter } from 'vue-router'
|
175
|
-
|
176
|
-
import Feed from '@pf/src/components/Feed/Feed.vue'
|
197
|
+
import { useRoute, useRouter } from 'vue-router'
|
177
198
|
|
178
199
|
import Field from '@pf/src/components/Field/Field.vue'
|
179
200
|
import Button from "@pf/src/components/Button/Button.vue";
|
201
|
+
import Tab from '@pf/src/components/Tab/Tab.vue'
|
180
202
|
import Popup from '@pf/src/components/Popup/Popup.vue';
|
181
203
|
import Block from '@pf/src/components/Block/Block.vue';
|
204
|
+
import Feed from '@pf/src/components/Feed/Feed.vue'
|
182
205
|
|
183
206
|
import CardOrderItem from '@pf/src/modules/orders/components/blocks/CardOrderItem.vue'
|
184
207
|
import CardPosition from '@pf/src/modules/products/components/blocks/CardPosition.vue';
|
208
|
+
import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue'
|
185
209
|
|
186
|
-
import
|
210
|
+
import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.vue'
|
211
|
+
|
212
|
+
import FormAddCustomer from '@pf/src/modules/orders/components/sections/FormAddCustomer.vue'
|
187
213
|
import FormDelivery from '@pf/src/modules/orders/components/sections/FormDelivery.vue'
|
188
214
|
import FormPayment from '@pf/src/modules/orders/components/sections/FormPayment.vue'
|
189
215
|
|
190
216
|
// Import your store
|
191
|
-
import * as auth from '@pf/src/modules/auth/store/auth';
|
192
217
|
import * as globals from '@pf/src/modules/globals/store/globals';
|
218
|
+
import * as auth from '@pf/src/modules/auth/store/auth';
|
193
219
|
import * as orders from '@pf/src/modules/orders/store/orders';
|
194
|
-
|
220
|
+
import * as products from '@pf/src/modules/products/store/products';
|
221
|
+
|
222
|
+
import customers from '@pf/src/modules/orders/store/customers.store';
|
223
|
+
|
195
224
|
|
196
225
|
// Accessing router
|
197
226
|
const route = useRoute()
|
@@ -203,6 +232,9 @@
|
|
203
232
|
}, 0));
|
204
233
|
})
|
205
234
|
|
235
|
+
// Tab
|
236
|
+
const tabOrderCreate = ref('positions')
|
237
|
+
|
206
238
|
// Popup
|
207
239
|
const isOpenProductsPopup = ref(false);
|
208
240
|
|
@@ -214,14 +246,14 @@
|
|
214
246
|
isOpenProductsPopup.value = false;
|
215
247
|
}
|
216
248
|
|
217
|
-
const
|
249
|
+
const isOpenCustomerPopup = ref(false);
|
218
250
|
|
219
|
-
function
|
220
|
-
|
251
|
+
function openCustomerPopup() {
|
252
|
+
isOpenCustomerPopup.value = true;
|
221
253
|
}
|
222
254
|
|
223
|
-
function
|
224
|
-
|
255
|
+
function closeCustomerPopup() {
|
256
|
+
isOpenCustomerPopup.value = false;
|
225
257
|
}
|
226
258
|
|
227
259
|
// Data
|
@@ -239,6 +271,11 @@
|
|
239
271
|
target: route.params._id,
|
240
272
|
}
|
241
273
|
|
274
|
+
orders.state.current.customer = {
|
275
|
+
type: 'Customer',
|
276
|
+
target: orders.state.current.customer._id || null,
|
277
|
+
}
|
278
|
+
|
242
279
|
orders.actions.create(orders.state.current)
|
243
280
|
}
|
244
281
|
|
@@ -64,8 +64,8 @@
|
|
64
64
|
|
65
65
|
<div class="mn-b-small pd-small bg-white radius-small flex-nowrap flex">
|
66
66
|
<div class="w-100">
|
67
|
-
<h3 class="mn-b-thin">{{order.customer.target.
|
68
|
-
<p class="t-truncate">{{order.delivery.address}}</p>
|
67
|
+
<h3 class="mn-b-thin">{{order.customer.target.profile.name || order.customer.target.phone || order.customer.target.email || 'No name'}}</h3>
|
68
|
+
<p class="t-truncate">{{order.delivery.address || 'Not specified'}}</p>
|
69
69
|
</div>
|
70
70
|
|
71
71
|
<div class=" w-100 t-right">
|
@@ -0,0 +1,152 @@
|
|
1
|
+
<template>
|
2
|
+
<Block class="pos-relative mn-b-thin">
|
3
|
+
<BlockSearch
|
4
|
+
v-click-outside="() => {searchUserShow = false}"
|
5
|
+
v-if="!dataCustomer.user"
|
6
|
+
@search="(event) => { searchUser = event; searchUserShow = true }"
|
7
|
+
placeholder="Enter name, phone or email"
|
8
|
+
class="bg-white"
|
9
|
+
/>
|
10
|
+
<CardUser
|
11
|
+
v-else
|
12
|
+
:user="dataCustomer.user"
|
13
|
+
:photo="dataCustomer.user.profile.photo"
|
14
|
+
:name="dataCustomer.user.profile.name || dataCustomer.user.phone || dataCustomer.user.email"
|
15
|
+
@click="() => {
|
16
|
+
dataCustomer.user = null
|
17
|
+
}"
|
18
|
+
class="bg-white pd-thin radius-medium w-100"
|
19
|
+
/>
|
20
|
+
|
21
|
+
<div
|
22
|
+
v-if="searchUser && searchUserShow && !dataCustomer.user "
|
23
|
+
class="mn-t-thin pos-absolute w-100 pos-t-100 pos-l-0 z-index-3 bg-grey pd-small radius-small
|
24
|
+
">
|
25
|
+
<Feed
|
26
|
+
:states="{
|
27
|
+
empty: {
|
28
|
+
title: 'No User Found',
|
29
|
+
description: 'Currently, there are no such user.'
|
30
|
+
}
|
31
|
+
}"
|
32
|
+
:store="{
|
33
|
+
read: (options) => users.actions.read(options),
|
34
|
+
state: null
|
35
|
+
}"
|
36
|
+
:options="{
|
37
|
+
search: searchUser
|
38
|
+
}"
|
39
|
+
:showLoadMore="false"
|
40
|
+
v-slot="{
|
41
|
+
items
|
42
|
+
}"
|
43
|
+
class="h-max-20r o-scroll"
|
44
|
+
>
|
45
|
+
<CardUser
|
46
|
+
v-for="(user, index) in items" :key="user._id"
|
47
|
+
:user="user"
|
48
|
+
:photo="user.profile.photo"
|
49
|
+
:name="user.profile.name || user.phone || user.email"
|
50
|
+
@click="() => {
|
51
|
+
dataCustomer.user = user
|
52
|
+
dataCustomer.profile = user.profile
|
53
|
+
dataCustomer.phone = user.phone
|
54
|
+
dataCustomer.email = user.email
|
55
|
+
dataCustomer.socials = user.socials
|
56
|
+
}"
|
57
|
+
class="bg-white pd-thin radius-medium w-100 mn-b-thin"
|
58
|
+
/>
|
59
|
+
</Feed>
|
60
|
+
</div>
|
61
|
+
</Block>
|
62
|
+
|
63
|
+
<FormCustomerDetails
|
64
|
+
:customer="dataCustomer"
|
65
|
+
class="mn-b-thin bg-grey"
|
66
|
+
/>
|
67
|
+
|
68
|
+
<Button
|
69
|
+
:submit="addCustomer"
|
70
|
+
:callback="callbackCustomer"
|
71
|
+
@error="setError"
|
72
|
+
class="w-100 pd-small radius-big bg-main t-black uppercase t-medium"
|
73
|
+
>
|
74
|
+
Add Customer
|
75
|
+
</Button>
|
76
|
+
</template>
|
77
|
+
|
78
|
+
<script setup>
|
79
|
+
import { ref } from "vue"
|
80
|
+
import { useRoute, useRouter } from 'vue-router'
|
81
|
+
|
82
|
+
import Block from '@pf/src/components/Block/Block.vue'
|
83
|
+
import Field from '@pf/src/components/Field/Field.vue'
|
84
|
+
import Select from '@pf/src/components/Select/Select.vue'
|
85
|
+
import Feed from '@pf/src/components/Feed/Feed.vue'
|
86
|
+
import Button from '@pf/src/components/Button/Button.vue'
|
87
|
+
|
88
|
+
import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.vue'
|
89
|
+
|
90
|
+
import CardUser from '@pf/src/modules/users/components/blocks/CardUser.vue'
|
91
|
+
|
92
|
+
import FormCustomerDetails from '@pf/src/modules/orders/components/sections/FormCustomerDetails.vue'
|
93
|
+
|
94
|
+
import * as users from '@pf/src/modules/users/store/users';
|
95
|
+
import * as auth from '@pf/src/modules/auth/store/auth';
|
96
|
+
|
97
|
+
import { setError } from '@pf/src/modules/globals/store/globals'
|
98
|
+
|
99
|
+
import customers from '@pf/src/modules/orders/store/customers.store';
|
100
|
+
import customerInitState from "@pf/src/modules/orders/store/models/customer"
|
101
|
+
|
102
|
+
import clickOutside from '@pf/src/components/FieldPhone/click-outside';
|
103
|
+
|
104
|
+
// Directives
|
105
|
+
let vClickOutside = clickOutside
|
106
|
+
// Props
|
107
|
+
const props = defineProps({
|
108
|
+
order: Object,
|
109
|
+
});
|
110
|
+
// Emits
|
111
|
+
const emits = defineEmits(['callbackCustomer']);
|
112
|
+
// Router
|
113
|
+
const route = useRoute()
|
114
|
+
|
115
|
+
let dataCustomer = ref(customerInitState)
|
116
|
+
|
117
|
+
let searchUser = ref(null)
|
118
|
+
let searchUserShow = ref(false)
|
119
|
+
|
120
|
+
async function addCustomer() {
|
121
|
+
let customerData = {
|
122
|
+
identity: {
|
123
|
+
type: dataCustomer.value.user ? 'User' : 'Visitor',
|
124
|
+
target: dataCustomer.value.user ? dataCustomer.value.user._id : null
|
125
|
+
},
|
126
|
+
owner: {
|
127
|
+
type: 'Organization',
|
128
|
+
target: route.params._id
|
129
|
+
},
|
130
|
+
creator: {
|
131
|
+
type: 'User',
|
132
|
+
target: auth.state.user._id
|
133
|
+
},
|
134
|
+
phone: dataCustomer.value.phone,
|
135
|
+
email: dataCustomer.value.email,
|
136
|
+
profile: dataCustomer.value.profile,
|
137
|
+
socials: dataCustomer.value.socials
|
138
|
+
}
|
139
|
+
|
140
|
+
try {
|
141
|
+
let customer = await customers.create(customerData)
|
142
|
+
|
143
|
+
dataCustomer.value = customer
|
144
|
+
} catch(err) {
|
145
|
+
console.log(err)
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
function callbackCustomer() {
|
150
|
+
emits('callbackCustomer', dataCustomer.value)
|
151
|
+
}
|
152
|
+
</script>
|