@ozdao/martyrs 0.2.518 → 0.2.520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index.cjs +4 -4
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +4 -4
- package/dist/_virtual/index2.js +4 -4
- package/dist/{abac-Cf_9lCSh.js → abac-CnJsrv8S.js} +3 -3
- package/dist/{abac-6LjoG9u-.cjs → abac-DOyUjhee.cjs} +3 -3
- package/dist/builder.cjs +27 -25
- package/dist/builder.js +27 -25
- package/dist/chats.server.cjs +198 -1
- package/dist/chats.server.js +198 -1
- package/dist/{crud-sE7GLPbj.js → crud-BIFl1W1i.js} +6 -6
- package/dist/{crud-JN_LFj01.cjs → crud-CC6k6yY5.cjs} +6 -6
- package/dist/{globals.logger-CZMgIMlM.cjs → globals.logger-BuW7JHMY.cjs} +63 -53
- package/dist/{globals.logger-Bf6rRU7j.js → globals.logger-VRHh-WUW.js} +63 -53
- package/dist/{globals.observer-CV2wCzzh.cjs → globals.observer-C_FYclgV.cjs} +36 -1
- package/dist/{globals.observer-CDqUjVU5.js → globals.observer-MZsqaE6F.js} +36 -1
- package/dist/globals.server.cjs +1 -1
- package/dist/globals.server.js +1 -1
- package/dist/inventory.server.cjs +276 -376
- package/dist/inventory.server.js +276 -376
- package/dist/main-BM3GslOO.cjs +11 -0
- package/dist/{main-wmEhGVvD.js → main-Qcn7YlTx.js} +1834 -1830
- package/dist/martyrs/src/components/Address/{Address.vue2.cjs → Address.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Address/{Address.vue2.js.map → Address.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Address/{Address.vue2.js → Address.vue.js} +2 -2
- package/dist/martyrs/src/components/Address/Address.vue.js.map +1 -0
- package/dist/martyrs/src/components/Button/Button.vue.cjs +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.js +1 -1
- package/dist/martyrs/src/components/Button/Button.vue.js.map +1 -1
- package/dist/martyrs/src/components/Chips/{Chips.vue.cjs → Chips.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Chips/{Chips.vue.js → Chips.vue2.js} +2 -2
- package/dist/martyrs/src/components/Chips/Chips.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs → Dropdown.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.js → Dropdown.vue2.js} +2 -2
- package/dist/martyrs/src/components/Dropdown/{Dropdown.vue.cjs.map → Dropdown.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs +0 -93
- package/dist/martyrs/src/components/EditImages/EditImages.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js +1 -94
- package/dist/martyrs/src/components/EditImages/EditImages.vue.js.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs +93 -0
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js +94 -1
- package/dist/martyrs/src/components/EditImages/EditImages.vue2.js.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -3
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -3
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.cjs.map +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js +1 -1
- package/dist/martyrs/src/components/Loader/Loader.vue2.js.map +1 -1
- package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.cjs → LocationMarker.vue.cjs} +2 -2
- package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.js.map → LocationMarker.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/LocationMarker/{LocationMarker.vue2.js → LocationMarker.vue.js} +2 -2
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue.js.map +1 -0
- package/dist/martyrs/src/components/Select/{Select.vue2.cjs → Select.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Select/{Select.vue2.js.map → Select.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Select/{Select.vue2.js → Select.vue.js} +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -0
- package/dist/martyrs/src/modules/auth/views/components/blocks/CardUser.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/blocks/CardUser.vue.js +2 -2
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +2 -2
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +4 -4
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +41 -51
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +59 -69
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.cjs +11 -13
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.js +11 -13
- package/dist/martyrs/src/modules/auth/views/components/sections/SliderFeatures.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs +10 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js +10 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js.map +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs +6 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +6 -0
- package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.cjs +27 -11
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.js +28 -12
- package/dist/martyrs/src/modules/chats/components/blocks/ChatMessage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs +62 -0
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js +63 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs +60 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js +60 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/blocks/CardBlogpost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs +3 -3
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js +3 -3
- package/dist/martyrs/src/modules/community/components/layouts/Community.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.cjs +2 -2
- package/dist/martyrs/src/modules/community/components/pages/BlogPost.vue.js +2 -2
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.cjs +50 -368
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.js +53 -371
- package/dist/martyrs/src/modules/community/components/pages/Posts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/blocks/CardEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EditEventTickets.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs +2 -3
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +2 -3
- package/dist/martyrs/src/modules/events/components/pages/Event.vue.js.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs +2 -2
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/pages/Events.vue.js.map +1 -1
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +3 -3
- package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.cjs +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/LocationSelection.vue.js +2 -2
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs +16 -3
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js +17 -4
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs +7 -0
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.js +7 -0
- package/dist/martyrs/src/modules/globals/views/mixins/mixins.js.map +1 -1
- package/dist/martyrs/src/modules/icons/pages/IconsPage.vue.cjs +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs +67 -43
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js +68 -44
- package/dist/martyrs/src/modules/inventory/components/forms/AdjustmentForm.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs +22 -7
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js +23 -8
- package/dist/martyrs/src/modules/inventory/components/forms/ColumnSettingsMenu.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs +47 -32
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js +48 -33
- package/dist/martyrs/src/modules/inventory/components/forms/HistoryView.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs +47 -26
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js +48 -27
- package/dist/martyrs/src/modules/inventory/components/forms/StockAlertsForm.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs +42 -52
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js +43 -53
- package/dist/martyrs/src/modules/inventory/components/pages/Inventory.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs +18 -18
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js +3 -3
- package/dist/martyrs/src/modules/inventory/components/pages/InventoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/inventory/store/{ inventory.store.cjs → inventory.store.cjs} +46 -2
- package/dist/martyrs/src/modules/inventory/store/inventory.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/inventory/store/{ inventory.store.js → inventory.store.js} +46 -2
- package/dist/martyrs/src/modules/inventory/store/inventory.store.js.map +1 -0
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs +180 -19
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js +181 -20
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js.map +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Album.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Playlist.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.cjs +1 -1
- package/dist/martyrs/src/modules/music/components/pages/Track.vue.js +1 -1
- package/dist/martyrs/src/modules/music/router/music.cjs +1 -2
- package/dist/martyrs/src/modules/music/router/music.cjs.map +1 -1
- package/dist/martyrs/src/modules/music/router/music.js +1 -2
- package/dist/martyrs/src/modules/music/router/music.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormApplicationDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/forms/FormCustomerDetails.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +3 -4
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +3 -4
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/orders.client.cjs +2 -2
- package/dist/martyrs/src/modules/orders/orders.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/orders.client.js +2 -2
- package/dist/martyrs/src/modules/orders/orders.client.js.map +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.cjs +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.js +1 -1
- package/dist/martyrs/src/modules/orders/router/customers.router.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +2 -24
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js +5 -27
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardOrganization.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.cjs +4 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js +4 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/Socials.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +3 -3
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +3 -3
- package/dist/martyrs/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.cjs +195 -0
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js +195 -0
- package/dist/martyrs/src/modules/organizations/components/forms/AddExistingMembersForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs +402 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js +402 -0
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs +86 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js +86 -0
- package/dist/martyrs/src/modules/organizations/components/forms/InviteForm.vue.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs +10 -10
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js +11 -11
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +279 -191
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +285 -197
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +7 -7
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +7 -7
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +3 -3
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs +4 -4
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js +4 -4
- package/dist/martyrs/src/modules/organizations/components/sections/Publics.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs +42 -41
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js +53 -52
- package/dist/martyrs/src/modules/organizations/configs/navigation.organization.config.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/organizations.client.cjs +23 -16
- package/dist/martyrs/src/modules/organizations/organizations.client.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/organizations.client.js +35 -28
- package/dist/martyrs/src/modules/organizations/organizations.client.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/router/departments.router.cjs +0 -18
- package/dist/martyrs/src/modules/organizations/router/departments.router.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/router/departments.router.js +0 -18
- package/dist/martyrs/src/modules/organizations/router/departments.router.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/store/departments.store.cjs +6 -0
- package/dist/martyrs/src/modules/organizations/store/departments.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/departments.store.js +6 -0
- package/dist/martyrs/src/modules/organizations/store/departments.store.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.cjs +6 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.js +6 -0
- package/dist/martyrs/src/modules/organizations/store/invites.store.js.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.cjs +20 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.cjs.map +1 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.js +20 -0
- package/dist/martyrs/src/modules/organizations/store/memberships.store.js.map +1 -0
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/ProductDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +3 -4
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +3 -4
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditDiscounts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/sections/EditVariants.vue.js +2 -2
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.js +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/martyrs/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +3 -3
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js +3 -3
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +3 -3
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +3 -3
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.cjs +60 -272
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.js +62 -274
- package/dist/martyrs/src/modules/spots/components/pages/Spots.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.cjs +4 -4
- package/dist/martyrs/src/modules/wallet/views/components/pages/Wallet.vue.js +4 -4
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/music.server.cjs +9 -9
- package/dist/music.server.js +9 -9
- package/dist/notifications.server.cjs +0 -24
- package/dist/notifications.server.js +0 -24
- package/dist/orders.server.cjs +3 -6
- package/dist/orders.server.js +3 -6
- package/dist/organizations.server.cjs +119 -43
- package/dist/organizations.server.js +119 -43
- package/dist/products.server.cjs +5 -5
- package/dist/products.server.js +5 -5
- package/dist/rents.server.cjs +3 -3
- package/dist/rents.server.js +3 -3
- package/dist/style.css +16 -17
- package/dist/wallet.server.cjs +2 -2
- package/dist/wallet.server.js +2 -2
- package/dist/{web-B5wZTKbK.cjs → web-B0cfxzgu.cjs} +1 -1
- package/dist/{web-520xCgXy.js → web-DVR8m2fm.js} +1 -1
- package/package.json +1 -1
- package/src/builder/modes/ssr.rspack.dev.js +20 -12
- package/src/builder/rspack/rspack.config.base.js +16 -15
- package/src/components/Button/Button.vue +1 -1
- package/src/components/Feed/Feed.old.vue +0 -1
- package/src/components/Feed/Feed.vue +1 -31
- package/src/components/Loader/Loader.vue +1 -1
- package/src/modules/auth/FIXES.md +61 -0
- package/src/modules/auth/PROMT.md +33 -0
- package/src/modules/auth/auth.server.js +1 -0
- package/src/modules/auth/views/components/blocks/CardUser.vue +2 -2
- package/src/modules/auth/views/components/layouts/Auth.vue +1 -1
- package/src/modules/auth/views/components/pages/Invite.vue +2 -2
- package/src/modules/auth/views/components/pages/Profile.vue +33 -48
- package/src/modules/auth/views/components/sections/SliderFeatures.vue +5 -7
- package/src/modules/auth/views/store/auth.js +16 -1
- package/src/modules/auth//320/220/320/240/320/245/320/230/320/242/320/225/320/232/320/242/320/243/320/240/320/220.md +445 -0
- package/src/modules/backoffice/components/partials/Sidebar.vue +6 -0
- package/src/modules/chats/CLAUDE.md +137 -0
- package/src/modules/chats/components/blocks/ChatMessage.vue +12 -0
- package/src/modules/chats/components/sections/ChatWindow.vue +84 -2
- package/src/modules/chats/controllers/chats.controller.js +187 -0
- package/src/modules/chats/models/chat.model.js +21 -0
- package/src/modules/chats/routes/chats.routes.js +46 -0
- package/src/modules/chats/store/chat.store.js +67 -0
- package/src/modules/community/components/layouts/Community.vue +2 -2
- package/src/modules/community/components/pages/Posts.vue +3 -328
- package/src/modules/events/components/pages/EditEventTickets.vue +1 -1
- package/src/modules/events/components/pages/Events.vue +2 -2
- package/src/modules/globals/controllers/classes/globals.cache.js +64 -55
- package/src/modules/globals/controllers/classes/globals.logger.js +40 -4
- package/src/modules/globals/controllers/classes/globals.observer.js +54 -4
- package/src/modules/globals/views/components/partials/Header.vue +1 -1
- package/src/modules/globals/views/components/partials/Sidebar.vue +17 -13
- package/src/modules/globals/views/mixins/mixins.js +7 -0
- package/src/modules/inventory/CLAUDE.md +330 -0
- package/src/modules/inventory/PROMT.md +25 -0
- package/src/modules/inventory/components/forms/AdjustmentForm.vue +53 -36
- package/src/modules/inventory/components/forms/ColumnSettingsMenu.vue +11 -6
- package/src/modules/inventory/components/forms/HistoryView.vue +21 -9
- package/src/modules/inventory/components/forms/StockAlertsForm.vue +33 -22
- package/src/modules/inventory/components/pages/Inventory.vue +40 -40
- package/src/modules/inventory/components/pages/InventoryEdit.vue +1 -1
- package/src/modules/inventory/docs/01-intro.md +126 -0
- package/src/modules/inventory/docs/02-architecture.md +266 -0
- package/src/modules/inventory/docs/03-components-and-relationships.md +338 -0
- package/src/modules/inventory/docs/04-business-logic-and-algorithms.md +376 -0
- package/src/modules/inventory/docs/05-api-specification.md +356 -0
- package/src/modules/inventory/docs/06-access-control.md +320 -0
- package/src/modules/inventory/inventory.server.js +6 -2
- package/src/modules/inventory/{services → middlewares}/inventory.verifier.js +5 -16
- package/src/modules/inventory/models/stock.availability.model.js +20 -7
- package/src/modules/inventory/routes/inventory.routes.js +14 -17
- package/src/modules/inventory/services/adjustment.service.js +137 -0
- package/src/modules/inventory/services/audit.service.js +160 -0
- package/src/modules/inventory/services/availability.service.js +323 -0
- package/src/modules/inventory/services/inventory.helpers.old.js +217 -0
- package/src/modules/inventory/store/{ inventory.store.js → inventory.store.js} +0 -14
- package/src/modules/inventory/workers/inventory.availability.worker.js +29 -30
- package/src/modules/marketplace/views/components/layouts/Marketplace.vue +160 -8
- package/src/modules/notifications/controllers/notifications.controller.js +0 -6
- package/src/modules/notifications/services/notification.service.js +1 -17
- package/src/modules/notifications/services/web-push.service.js +0 -2
- package/src/modules/orders/components/blocks/CardOrderBackoffice.vue +2 -2
- package/src/modules/orders/components/blocks/CardOrderVar1.vue +1 -1
- package/src/modules/orders/controllers/orders.controller.js +2 -4
- package/src/modules/orders/orders.client.js +2 -2
- package/src/modules/orders/router/customers.router.js +1 -1
- package/src/modules/organizations/CLAUDE.md +259 -0
- package/src/modules/organizations/components/blocks/CardDepartment.vue +1 -22
- package/src/modules/organizations/components/blocks/Socials.vue +1 -1
- package/src/modules/organizations/components/elements/ButtonToggleMembership.vue +3 -3
- package/src/modules/organizations/components/forms/AddExistingMembersForm.vue +191 -0
- package/src/modules/organizations/components/forms/DepartmentForm.vue +390 -0
- package/src/modules/organizations/components/forms/InviteForm.vue +81 -0
- package/src/modules/organizations/components/pages/Department.vue +10 -10
- package/src/modules/organizations/components/pages/DepartmentEdit.vue +8 -8
- package/src/modules/organizations/components/pages/Members.vue +265 -171
- package/src/modules/organizations/components/pages/Organization.new.vue +172 -183
- package/src/modules/organizations/components/pages/Organization.vue +6 -6
- package/src/modules/organizations/components/pages/OrganizationEdit.vue +1 -1
- package/src/modules/organizations/components/pages/Organizations.vue +1 -1
- package/src/modules/organizations/components/sections/Organizations.vue +2 -2
- package/src/modules/organizations/components/sections/Publics.vue +4 -4
- package/src/modules/organizations/configs/navigation.organization.config.js +40 -39
- package/src/modules/organizations/controllers/departments.controller.js +53 -34
- package/src/modules/organizations/controllers/invites.controller.js +44 -5
- package/src/modules/organizations/controllers/memberships.controller.js +43 -4
- package/src/modules/organizations/organizations.client.js +24 -15
- package/src/modules/organizations/router/departments.router.js +0 -18
- package/src/modules/organizations/routes/departments.routes.js +6 -8
- package/src/modules/organizations/routes/invites.routes.js +6 -4
- package/src/modules/organizations/routes/memberships.routes.js +6 -5
- package/src/modules/organizations/routes/organizations.routes.js +1 -1
- package/src/modules/organizations/store/departments.store.js +5 -0
- package/src/modules/organizations/store/invites.store.js +5 -0
- package/src/modules/organizations/store/memberships.store.js +23 -0
- package/src/modules/products/components/pages/Products.vue +0 -1
- package/src/modules/spots/components/blocks/CardSpot.vue +1 -1
- package/src/modules/spots/components/pages/Spots.vue +3 -203
- package/src/styles/base/all.scss +0 -15
- package/src/styles/responsive.scss +1 -31
- package/src/styles/typography.scss +20 -5
- package/dist/main-CSzPfQYR.cjs +0 -11
- package/dist/martyrs/src/components/Address/Address.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/Chips/Chips.vue.js.map +0 -1
- package/dist/martyrs/src/components/Dropdown/Dropdown.vue.js.map +0 -1
- package/dist/martyrs/src/components/LocationMarker/LocationMarker.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/Select/Select.vue2.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs +0 -76
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.js +0 -76
- package/dist/martyrs/src/modules/globals/views/components/blocks/BlockFilter.vue.js.map +0 -1
- package/dist/martyrs/src/modules/inventory/store/ inventory.store.cjs.map +0 -1
- package/dist/martyrs/src/modules/inventory/store/ inventory.store.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +0 -280
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +0 -280
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/departments.cjs +0 -121
- package/dist/martyrs/src/modules/organizations/store/departments.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/departments.js +0 -121
- package/dist/martyrs/src/modules/organizations/store/departments.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/invites.cjs +0 -64
- package/dist/martyrs/src/modules/organizations/store/invites.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/invites.js +0 -64
- package/dist/martyrs/src/modules/organizations/store/invites.js.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/memberships.cjs +0 -87
- package/dist/martyrs/src/modules/organizations/store/memberships.cjs.map +0 -1
- package/dist/martyrs/src/modules/organizations/store/memberships.js +0 -87
- package/dist/martyrs/src/modules/organizations/store/memberships.js.map +0 -1
- package/src/modules/globals/controllers/classes/globals.websocket.ws.js +0 -102
- package/src/modules/globals/views/components/blocks/BlockFilter.vue +0 -60
- package/src/modules/inventory/docs/README.md +0 -291
- package/src/modules/inventory/models/stock.balance.model.js +0 -43
- package/src/modules/inventory/services/inventory.crud.js +0 -710
- package/src/modules/inventory/tests/inventory.test.js +0 -281
- package/src/modules/organizations/store/departments.js +0 -137
- package/src/modules/organizations/store/invites.js +0 -76
- package/src/modules/organizations/store/memberships.js +0 -110
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import Cache from '@martyrs/src/modules/globals/controllers/classes/globals.cache.js';
|
|
2
|
+
import Logger from '@martyrs/src/modules/globals/controllers/classes/globals.logger.js';
|
|
3
|
+
import queryProcessor from '@martyrs/src/modules/globals/controllers/utils/queryProcessor.js';
|
|
4
|
+
|
|
5
|
+
const availabilityServiceFactory = db => {
|
|
6
|
+
const cache = new Cache({ ttlSeconds: 300 });
|
|
7
|
+
const logger = new Logger(db);
|
|
8
|
+
|
|
9
|
+
// Helper function to collect affected variants for recalculation
|
|
10
|
+
const collectAffectedVariants = async (products, variants, session) => {
|
|
11
|
+
const affectedVariants = new Set();
|
|
12
|
+
|
|
13
|
+
// Add direct variants
|
|
14
|
+
variants?.forEach(v => {
|
|
15
|
+
if (v) affectedVariants.add(v.toString());
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Find dependent variants
|
|
19
|
+
if (products?.length) {
|
|
20
|
+
const dependentVariants = await db.variant.find({
|
|
21
|
+
'ingredients._id': { $in: products },
|
|
22
|
+
'ingredients.optional': { $ne: true }
|
|
23
|
+
}).distinct('_id').session(session);
|
|
24
|
+
|
|
25
|
+
dependentVariants.forEach(v => affectedVariants.add(v.toString()));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return Array.from(affectedVariants);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Main recalculation function
|
|
32
|
+
const recalculateAvailability = async (variantIds, storage, session) => {
|
|
33
|
+
const variants = await db.variant.find({
|
|
34
|
+
_id: { $in: variantIds }
|
|
35
|
+
}).session(session).lean();
|
|
36
|
+
|
|
37
|
+
if (!variants.length) return;
|
|
38
|
+
|
|
39
|
+
const allIngredientIds = new Set();
|
|
40
|
+
variants.forEach(v => {
|
|
41
|
+
v.ingredients?.forEach(ing => {
|
|
42
|
+
allIngredientIds.add(ing._id.toString());
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const availabilities = await db.stockAvailability.find({
|
|
47
|
+
storage,
|
|
48
|
+
$or: [
|
|
49
|
+
{ variant: { $in: variantIds } },
|
|
50
|
+
{ product: { $in: Array.from(allIngredientIds) } }
|
|
51
|
+
]
|
|
52
|
+
}).session(session).lean();
|
|
53
|
+
|
|
54
|
+
const quantityByVariant = new Map();
|
|
55
|
+
const quantityByProduct = new Map();
|
|
56
|
+
|
|
57
|
+
availabilities.forEach(a => {
|
|
58
|
+
if (a.variant) {
|
|
59
|
+
quantityByVariant.set(a.variant.toString(), a.quantity);
|
|
60
|
+
} else if (a.product) {
|
|
61
|
+
quantityByProduct.set(a.product.toString(), a.quantity);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const bulkOps = [];
|
|
66
|
+
|
|
67
|
+
variants.forEach(variant => {
|
|
68
|
+
const variantId = variant._id.toString();
|
|
69
|
+
const directStock = quantityByVariant.get(variantId) || 0;
|
|
70
|
+
|
|
71
|
+
let available = directStock > 0 ? directStock : Infinity;
|
|
72
|
+
const constraints = [];
|
|
73
|
+
|
|
74
|
+
if (variant.ingredients?.length) {
|
|
75
|
+
for (const ing of variant.ingredients) {
|
|
76
|
+
if (ing.optional) continue;
|
|
77
|
+
|
|
78
|
+
const stock = quantityByProduct.get(ing._id.toString()) || 0;
|
|
79
|
+
const canMake = Math.floor(stock / (ing.quantity || 1));
|
|
80
|
+
|
|
81
|
+
if (directStock === 0 || canMake < available) {
|
|
82
|
+
available = canMake;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
constraints.push({
|
|
86
|
+
ingredient: ing._id,
|
|
87
|
+
stock,
|
|
88
|
+
required: ing.quantity,
|
|
89
|
+
available: canMake
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (available === Infinity) {
|
|
95
|
+
available = directStock;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
bulkOps.push({
|
|
99
|
+
updateOne: {
|
|
100
|
+
filter: { variant: variant._id, storage },
|
|
101
|
+
update: {
|
|
102
|
+
$set: {
|
|
103
|
+
product: variant.product,
|
|
104
|
+
available,
|
|
105
|
+
constraints,
|
|
106
|
+
calculatedAt: new Date()
|
|
107
|
+
},
|
|
108
|
+
$setOnInsert: {
|
|
109
|
+
quantity: directStock,
|
|
110
|
+
owner: variant.owner,
|
|
111
|
+
creator: variant.creator
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
upsert: true
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (bulkOps.length) {
|
|
120
|
+
await db.stockAvailability.bulkWrite(bulkOps, { session });
|
|
121
|
+
|
|
122
|
+
// Check alerts
|
|
123
|
+
for (const variant of variants) {
|
|
124
|
+
const variantId = variant._id.toString();
|
|
125
|
+
const available = quantityByVariant.get(variantId) || 0;
|
|
126
|
+
|
|
127
|
+
const alerts = await db.stockAlert.find({
|
|
128
|
+
product: variant.product,
|
|
129
|
+
enabled: true,
|
|
130
|
+
$or: [
|
|
131
|
+
{ variant: null, storage: null },
|
|
132
|
+
{ variant: null, storage: storage },
|
|
133
|
+
{ variant: variant._id, storage: null },
|
|
134
|
+
{ variant: variant._id, storage: storage }
|
|
135
|
+
]
|
|
136
|
+
}).session(session);
|
|
137
|
+
|
|
138
|
+
for (const alert of alerts) {
|
|
139
|
+
if (available < alert.threshold) {
|
|
140
|
+
try {
|
|
141
|
+
await fetch(`${process.env.API_URL || ''}/api/notifications`, {
|
|
142
|
+
method: 'POST',
|
|
143
|
+
headers: {
|
|
144
|
+
'Content-Type': 'application/json',
|
|
145
|
+
'X-Service-Key': process.env.SERVICE_KEY,
|
|
146
|
+
},
|
|
147
|
+
body: JSON.stringify({
|
|
148
|
+
title: 'Low Stock Alert',
|
|
149
|
+
body: `Stock for ${variant.name || 'Product'} is low: ${available} units remaining (threshold: ${alert.threshold})`,
|
|
150
|
+
type: 'stock_alert',
|
|
151
|
+
metadata: {
|
|
152
|
+
alertId: alert._id,
|
|
153
|
+
productId: variant.product,
|
|
154
|
+
variantId: variant._id,
|
|
155
|
+
storageId: storage,
|
|
156
|
+
currentStock: available,
|
|
157
|
+
threshold: alert.threshold
|
|
158
|
+
},
|
|
159
|
+
userId: alert.creator.target
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
} catch (notificationError) {
|
|
163
|
+
logger.error('Error sending stock alert notification:', notificationError);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// Cache invalidation helper
|
|
172
|
+
const invalidateCache = (tags) => {
|
|
173
|
+
setImmediate(() => {
|
|
174
|
+
cache.delByTags(tags).catch(err =>
|
|
175
|
+
logger.error('Cache invalidation error', err)
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// Initialize change streams for variant updates
|
|
181
|
+
const initChangeStreams = () => {
|
|
182
|
+
const variantStream = db.variant.watch([], { fullDocument: 'updateLookup' });
|
|
183
|
+
|
|
184
|
+
variantStream.on('change', async (change) => {
|
|
185
|
+
if (change.operationType === 'update' &&
|
|
186
|
+
change.updateDescription?.updatedFields?.ingredients) {
|
|
187
|
+
|
|
188
|
+
const variantId = change.documentKey._id;
|
|
189
|
+
|
|
190
|
+
const storages = await db.stockAvailability.distinct('storage', {
|
|
191
|
+
variant: variantId
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
for (const storage of storages) {
|
|
195
|
+
await recalculateAvailability([variantId], storage);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
invalidateCache(['availability']);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
variantStream.on('error', err => {
|
|
203
|
+
logger.error('Variant change stream error', err);
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// Don't initialize here - will be called from inventory.server.js
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
// Public API for reading availability
|
|
211
|
+
async read(req, res) {
|
|
212
|
+
try {
|
|
213
|
+
console.log('=== AVAILABILITY DEBUG ===');
|
|
214
|
+
console.log('req.query:', req.query);
|
|
215
|
+
console.log('req.verifiedQuery:', req.verifiedQuery);
|
|
216
|
+
console.log('req.verifiedQuery?.details:', req.verifiedQuery?.details);
|
|
217
|
+
|
|
218
|
+
if (!req.verifiedQuery) {
|
|
219
|
+
console.log('WARNING: req.verifiedQuery is undefined, converting from req.query');
|
|
220
|
+
req.verifiedQuery = {
|
|
221
|
+
...req.query,
|
|
222
|
+
skip: parseInt(req.query.skip) || 0,
|
|
223
|
+
limit: parseInt(req.query.limit) || 20
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const cacheKey = JSON.stringify({ type: 'availability', ...req.verifiedQuery });
|
|
228
|
+
let data = await cache.get(cacheKey);
|
|
229
|
+
|
|
230
|
+
if (!data) {
|
|
231
|
+
const needsDetails = req.verifiedQuery?.details === 'true';
|
|
232
|
+
|
|
233
|
+
const matchConditions = {};
|
|
234
|
+
if (req.verifiedQuery?.owner) {
|
|
235
|
+
matchConditions['owner.target'] = new db.mongoose.Types.ObjectId(req.verifiedQuery.owner);
|
|
236
|
+
}
|
|
237
|
+
if (req.verifiedQuery?.product) {
|
|
238
|
+
matchConditions._id = new db.mongoose.Types.ObjectId(req.verifiedQuery.product);
|
|
239
|
+
}
|
|
240
|
+
if (req.verifiedQuery?.search) {
|
|
241
|
+
matchConditions.name = { $regex: req.verifiedQuery.search, $options: 'i' };
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const pipeline = [
|
|
245
|
+
{ $match: matchConditions },
|
|
246
|
+
{
|
|
247
|
+
$lookup: {
|
|
248
|
+
from: 'stockavailabilities',
|
|
249
|
+
let: { pid: '$_id' },
|
|
250
|
+
pipeline: [
|
|
251
|
+
{
|
|
252
|
+
$match: {
|
|
253
|
+
$expr: { $eq: ['$product', '$$pid'] },
|
|
254
|
+
...(req.verifiedQuery?.storage && {
|
|
255
|
+
storage: new db.mongoose.Types.ObjectId(req.verifiedQuery.storage)
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
as: 'availability'
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{ $skip: req.verifiedQuery?.skip || 0 },
|
|
264
|
+
{ $limit: req.verifiedQuery?.limit || 20 },
|
|
265
|
+
{
|
|
266
|
+
$addFields: {
|
|
267
|
+
available: { $sum: '$availability.available' },
|
|
268
|
+
totalStock: { $sum: '$availability.quantity' },
|
|
269
|
+
storageCount: { $size: '$availability' }
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
];
|
|
273
|
+
|
|
274
|
+
if (needsDetails) {
|
|
275
|
+
pipeline.push(
|
|
276
|
+
{
|
|
277
|
+
$lookup: {
|
|
278
|
+
from: 'products',
|
|
279
|
+
let: { pid: '$product' },
|
|
280
|
+
pipeline: [
|
|
281
|
+
{ $match: { $expr: { $eq: ['$_id', '$$pid'] } } },
|
|
282
|
+
{
|
|
283
|
+
$project: {
|
|
284
|
+
name: 1,
|
|
285
|
+
sku: 1,
|
|
286
|
+
unit: 1
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
as: 'productInfo'
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
$unwind: {
|
|
295
|
+
path: '$productInfo',
|
|
296
|
+
preserveNullAndEmptyArrays: true
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
data = await db.product.aggregate(pipeline).exec();
|
|
303
|
+
await cache.setWithTags(cacheKey, data, ['availability']);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
res.json(data);
|
|
307
|
+
} catch (error) {
|
|
308
|
+
logger.error('Error reading availability', error);
|
|
309
|
+
res.status(500).json({ message: error.message });
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
|
|
313
|
+
// Internal methods for other services
|
|
314
|
+
recalculateAvailability,
|
|
315
|
+
collectAffectedVariants,
|
|
316
|
+
invalidateCache,
|
|
317
|
+
initChangeStreams,
|
|
318
|
+
cache,
|
|
319
|
+
logger
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export default availabilityServiceFactory;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import Cache from '@martyrs/src/modules/globals/controllers/classes/globals.cache.js';
|
|
2
|
+
import Logger from '@martyrs/src/modules/globals/controllers/classes/globals.logger.js';
|
|
3
|
+
import Observer from '@martyrs/src/modules/globals/controllers/classes/globals.observer.js';
|
|
4
|
+
|
|
5
|
+
// Update quantity in stockAvailability
|
|
6
|
+
export async function updateStockQuantity(db, product, variant, storage, quantity, owner, creator, session) {
|
|
7
|
+
return await db.stockAvailability.findOneAndUpdate(
|
|
8
|
+
{ product, variant, storage },
|
|
9
|
+
{
|
|
10
|
+
$inc: { quantity },
|
|
11
|
+
$setOnInsert: {
|
|
12
|
+
owner,
|
|
13
|
+
creator,
|
|
14
|
+
available: 0,
|
|
15
|
+
constraints: []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{ upsert: true, new: true, session }
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Collect affected variants for recalculation
|
|
23
|
+
export async function collectAffectedVariants(db, products, variants, session) {
|
|
24
|
+
const affectedVariants = new Set();
|
|
25
|
+
|
|
26
|
+
// Add direct variants
|
|
27
|
+
variants?.forEach(v => {
|
|
28
|
+
if (v) affectedVariants.add(v.toString());
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Find dependent variants
|
|
32
|
+
if (products?.length) {
|
|
33
|
+
const dependentVariants = await db.variant.find({
|
|
34
|
+
'ingredients._id': { $in: products },
|
|
35
|
+
'ingredients.optional': { $ne: true }
|
|
36
|
+
}).distinct('_id').session(session);
|
|
37
|
+
|
|
38
|
+
dependentVariants.forEach(v => affectedVariants.add(v.toString()));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return Array.from(affectedVariants);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Batch recalculate availability
|
|
45
|
+
export async function recalculateAvailability(db, logger, variantIds, storage, session) {
|
|
46
|
+
const variants = await db.variant.find({
|
|
47
|
+
_id: { $in: variantIds }
|
|
48
|
+
}).session(session).lean();
|
|
49
|
+
|
|
50
|
+
if (!variants.length) return;
|
|
51
|
+
|
|
52
|
+
const allIngredientIds = new Set();
|
|
53
|
+
variants.forEach(v => {
|
|
54
|
+
v.ingredients?.forEach(ing => {
|
|
55
|
+
allIngredientIds.add(ing._id.toString());
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const availabilities = await db.stockAvailability.find({
|
|
60
|
+
storage,
|
|
61
|
+
$or: [
|
|
62
|
+
{ variant: { $in: variantIds } },
|
|
63
|
+
{ product: { $in: Array.from(allIngredientIds) } }
|
|
64
|
+
]
|
|
65
|
+
}).session(session).lean();
|
|
66
|
+
|
|
67
|
+
const quantityByVariant = new Map();
|
|
68
|
+
const quantityByProduct = new Map();
|
|
69
|
+
|
|
70
|
+
availabilities.forEach(a => {
|
|
71
|
+
if (a.variant) {
|
|
72
|
+
quantityByVariant.set(a.variant.toString(), a.quantity);
|
|
73
|
+
} else if (a.product) {
|
|
74
|
+
quantityByProduct.set(a.product.toString(), a.quantity);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const bulkOps = [];
|
|
79
|
+
|
|
80
|
+
variants.forEach(variant => {
|
|
81
|
+
const variantId = variant._id.toString();
|
|
82
|
+
const directStock = quantityByVariant.get(variantId) || 0;
|
|
83
|
+
|
|
84
|
+
let available = directStock > 0 ? directStock : Infinity;
|
|
85
|
+
const constraints = [];
|
|
86
|
+
|
|
87
|
+
if (variant.ingredients?.length) {
|
|
88
|
+
for (const ing of variant.ingredients) {
|
|
89
|
+
if (ing.optional) continue;
|
|
90
|
+
|
|
91
|
+
const stock = quantityByProduct.get(ing._id.toString()) || 0;
|
|
92
|
+
const canMake = Math.floor(stock / (ing.quantity || 1));
|
|
93
|
+
|
|
94
|
+
if (directStock === 0 || canMake < available) {
|
|
95
|
+
available = canMake;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
constraints.push({
|
|
99
|
+
ingredient: ing._id,
|
|
100
|
+
stock,
|
|
101
|
+
required: ing.quantity,
|
|
102
|
+
available: canMake
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (available === Infinity) {
|
|
108
|
+
available = directStock;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
bulkOps.push({
|
|
112
|
+
updateOne: {
|
|
113
|
+
filter: { variant: variant._id, storage },
|
|
114
|
+
update: {
|
|
115
|
+
$set: {
|
|
116
|
+
product: variant.product,
|
|
117
|
+
available,
|
|
118
|
+
constraints,
|
|
119
|
+
calculatedAt: new Date()
|
|
120
|
+
},
|
|
121
|
+
$setOnInsert: {
|
|
122
|
+
quantity: directStock,
|
|
123
|
+
owner: variant.owner,
|
|
124
|
+
creator: variant.creator
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
upsert: true
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (bulkOps.length) {
|
|
133
|
+
await db.stockAvailability.bulkWrite(bulkOps, { session });
|
|
134
|
+
|
|
135
|
+
// Check alerts
|
|
136
|
+
for (const variant of variants) {
|
|
137
|
+
const variantId = variant._id.toString();
|
|
138
|
+
const available = quantityByVariant.get(variantId) || 0;
|
|
139
|
+
|
|
140
|
+
const alerts = await db.stockAlert.find({
|
|
141
|
+
product: variant.product,
|
|
142
|
+
enabled: true,
|
|
143
|
+
$or: [
|
|
144
|
+
{ variant: null, storage: null },
|
|
145
|
+
{ variant: null, storage: storage },
|
|
146
|
+
{ variant: variant._id, storage: null },
|
|
147
|
+
{ variant: variant._id, storage: storage }
|
|
148
|
+
]
|
|
149
|
+
}).session(session);
|
|
150
|
+
|
|
151
|
+
for (const alert of alerts) {
|
|
152
|
+
if (available < alert.threshold) {
|
|
153
|
+
try {
|
|
154
|
+
await fetch(`${process.env.API_URL || ''}/api/notifications`, {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
headers: {
|
|
157
|
+
'Content-Type': 'application/json',
|
|
158
|
+
'X-Service-Key': process.env.SERVICE_KEY,
|
|
159
|
+
},
|
|
160
|
+
body: JSON.stringify({
|
|
161
|
+
title: 'Low Stock Alert',
|
|
162
|
+
body: `Stock for ${variant.name || 'Product'} is low: ${available} units remaining (threshold: ${alert.threshold})`,
|
|
163
|
+
type: 'stock_alert',
|
|
164
|
+
metadata: {
|
|
165
|
+
alertId: alert._id,
|
|
166
|
+
productId: variant.product,
|
|
167
|
+
variantId: variant._id,
|
|
168
|
+
storageId: storage,
|
|
169
|
+
currentStock: available,
|
|
170
|
+
threshold: alert.threshold
|
|
171
|
+
},
|
|
172
|
+
userId: alert.creator.target
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
} catch (notificationError) {
|
|
176
|
+
logger.error('Error sending stock alert notification:', notificationError);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function invalidateCache(cache, logger, tags) {
|
|
185
|
+
setImmediate(() => {
|
|
186
|
+
cache.delByTags(tags).catch(err =>
|
|
187
|
+
logger.error('Cache invalidation error', err)
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Initialize change streams for variant updates
|
|
193
|
+
export function initChangeStreams(db, logger, recalculateAvailability, invalidateCache) {
|
|
194
|
+
const variantStream = db.variant.watch([], { fullDocument: 'updateLookup' });
|
|
195
|
+
|
|
196
|
+
variantStream.on('change', async (change) => {
|
|
197
|
+
if (change.operationType === 'update' &&
|
|
198
|
+
change.updateDescription?.updatedFields?.ingredients) {
|
|
199
|
+
|
|
200
|
+
const variantId = change.documentKey._id;
|
|
201
|
+
|
|
202
|
+
const storages = await db.stockAvailability.distinct('storage', {
|
|
203
|
+
variant: variantId
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
for (const storage of storages) {
|
|
207
|
+
await recalculateAvailability(db, logger, [variantId], storage);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
invalidateCache(['availability']);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
variantStream.on('error', err => {
|
|
215
|
+
logger.error('Variant change stream error', err);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
@@ -4,7 +4,6 @@ import $axios from '@martyrs/src/modules/globals/views/utils/axios-instance.js';
|
|
|
4
4
|
|
|
5
5
|
const state = reactive({
|
|
6
6
|
adjustments: [],
|
|
7
|
-
balance: [],
|
|
8
7
|
availability: [],
|
|
9
8
|
inventories: [],
|
|
10
9
|
current: {
|
|
@@ -46,19 +45,6 @@ const actions = {
|
|
|
46
45
|
}
|
|
47
46
|
},
|
|
48
47
|
|
|
49
|
-
// Balance
|
|
50
|
-
async fetchBalance(options = {}) {
|
|
51
|
-
try {
|
|
52
|
-
const params = { ...state.filters, ...options };
|
|
53
|
-
const response = await $axios.get('/api/inventory/balance', { params });
|
|
54
|
-
state.balance = response.data;
|
|
55
|
-
return response.data;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
setError(error);
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
48
|
// Availability
|
|
63
49
|
async fetchAvailability(options = {}) {
|
|
64
50
|
try {
|