@ozdao/martyrs 0.2.428 → 0.2.430
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/community.server.js +1 -1
- package/dist/community.server.mjs +1 -1
- package/dist/events.server.js +1 -1
- package/dist/events.server.mjs +1 -1
- package/dist/gallery.server.js +1 -1
- package/dist/gallery.server.mjs +1 -1
- package/dist/{globals.logger-Deb_8o7C.mjs → globals.cache-BT6q3vOf.mjs} +0 -33
- package/dist/{globals.logger-BuG0pN80.js → globals.cache-CwWvNGFQ.js} +0 -33
- package/dist/globals.logger-BdjooLaD.js +34 -0
- package/dist/globals.logger-DusiFsxN.mjs +35 -0
- package/dist/martyrs/src/modules/chats/components/pages/ChatPage.vue.cjs +13 -3
- package/dist/martyrs/src/modules/chats/components/pages/ChatPage.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/components/pages/ChatPage.vue.js +14 -4
- package/dist/martyrs/src/modules/chats/components/pages/ChatPage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.cjs +24 -6
- 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 +25 -7
- package/dist/martyrs/src/modules/chats/components/sections/ChatWindow.vue.js.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs +7 -8
- package/dist/martyrs/src/modules/chats/store/chat.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/chats/store/chat.store.js +7 -8
- package/dist/martyrs/src/modules/chats/store/chat.store.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.cjs +6 -8
- package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.js +6 -8
- package/dist/martyrs/src/modules/globals/views/classes/globals.websocket.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs +11 -8
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js +11 -8
- package/dist/martyrs/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.cjs +5 -5
- 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 +5 -5
- package/dist/martyrs/src/modules/globals/views/components/partials/Header.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +17 -9
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +17 -9
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.cjs +16 -4
- 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 +16 -4
- package/dist/martyrs/src/modules/globals/views/components/partials/Sidebar.vue.js.map +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.cjs +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.js +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/sections/SectionMenu.vue.js.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs +7 -1
- package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js +7 -1
- package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs +112 -0
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js +112 -0
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue.js.map +1 -0
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderItem.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderItem.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderItem.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderItem.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.cjs +18 -12
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js +18 -12
- package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +200 -92
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +213 -105
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +9 -12
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +10 -13
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +14 -6
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +23 -15
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +16 -99
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +16 -99
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs +2 -2
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js +2 -2
- package/dist/martyrs/src/modules/orders/components/partials/ShopCart.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.cjs +99 -99
- 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 +102 -102
- 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 +14 -8
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js +15 -9
- package/dist/martyrs/src/modules/orders/components/sections/FormPayment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/store/orders.cjs +51 -0
- package/dist/martyrs/src/modules/orders/store/orders.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/store/orders.js +51 -0
- package/dist/martyrs/src/modules/orders/store/orders.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +59 -56
- 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 +63 -60
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/store/organizations.cjs +0 -2
- package/dist/martyrs/src/modules/organizations/store/organizations.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/store/organizations.js +1 -3
- package/dist/martyrs/src/modules/organizations/store/organizations.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +4 -3
- 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 +5 -4
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.cjs +15 -12
- 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 +15 -12
- package/dist/martyrs/src/modules/spots/components/blocks/CardSpot.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.cjs +2 -2
- package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.js +2 -2
- package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/orders.server.js +11 -4
- package/dist/orders.server.mjs +10 -3
- package/dist/organizations.server.js +33 -30
- package/dist/organizations.server.mjs +33 -30
- package/dist/products.server.js +1 -1
- package/dist/products.server.mjs +1 -1
- package/dist/{queryProcessor-CCmHM0yi.mjs → queryProcessor-CWnMIe2U.mjs} +4 -1
- package/dist/{queryProcessor-CwQakZkT.js → queryProcessor-D6GuKfTV.js} +4 -1
- package/dist/rents.server.js +4 -3
- package/dist/rents.server.mjs +3 -2
- package/dist/spots.server.js +41 -12
- package/dist/spots.server.mjs +41 -12
- package/dist/style.css +57 -65
- package/dist/wallet.server.js +1 -1
- package/dist/wallet.server.mjs +1 -1
- package/package.json +1 -1
- package/src/modules/chats/components/pages/ChatPage.vue +18 -23
- package/src/modules/chats/components/sections/ChatWindow.vue +55 -38
- package/src/modules/chats/store/chat.store.js +20 -21
- package/src/modules/globals/controllers/utils/queryProcessor.js +2 -1
- package/src/modules/globals/views/classes/globals.websocket.js +10 -11
- package/src/modules/globals/views/components/layouts/Client.vue +21 -15
- package/src/modules/globals/views/components/partials/Header.vue +3 -4
- package/src/modules/globals/views/components/partials/Navigation.vue +17 -19
- package/src/modules/globals/views/components/partials/Sidebar.vue +20 -9
- package/src/modules/marketplace/views/components/sections/SectionMenu.vue +1 -1
- package/src/modules/notifications/components/elements/NotificationBadge.vue +7 -0
- package/src/modules/orders/components/blocks/CardOrderBackoffice.vue +106 -0
- package/src/modules/orders/components/blocks/CardOrderItem.vue +2 -2
- package/src/modules/orders/components/blocks/CardOrderUser.vue +16 -9
- package/src/modules/orders/components/pages/OrderBackoffice.vue +146 -77
- package/src/modules/orders/components/pages/OrderCreate.vue +7 -12
- package/src/modules/orders/components/pages/OrderCreateBackoffice.vue +15 -3
- package/src/modules/orders/components/pages/Orders.vue +10 -93
- package/src/modules/orders/components/partials/ShopCart.vue +2 -2
- package/src/modules/orders/components/sections/FormDelivery.vue +35 -43
- package/src/modules/orders/components/sections/FormPayment.vue +17 -7
- package/src/modules/orders/controllers/orders.controller.js +12 -1
- package/src/modules/orders/store/orders.js +65 -0
- package/src/modules/organizations/components/pages/Organization.vue +48 -47
- package/src/modules/organizations/controllers/organizations.controller.js +57 -47
- package/src/modules/organizations/store/organizations.js +6 -6
- package/src/modules/products/components/pages/Products.vue +4 -3
- package/src/modules/spots/components/blocks/CardSpot.vue +8 -7
- package/src/modules/spots/controllers/spots.controller.js +47 -14
- package/src/modules/spots/routes/spots.routes.js +2 -3
- package/src/modules/spots/store/spots.js +4 -4
- package/src/styles/base/shadow_transitions_hover_refactor.scss +1 -0
- package/src/modules/landing/components/sections/HowToBuyWDR.vue +0 -130
- package/src/modules/landing/components/sections/WhatIsWDRSection.vue +0 -116
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { createBlock, openBlock, withCtx, createElementVNode, createVNode } from "vue";
|
|
1
|
+
import { computed, createBlock, openBlock, withCtx, createElementVNode, createVNode } from "vue";
|
|
2
2
|
import _sfc_main$1 from "../../../../components/Block/Block.vue.js";
|
|
3
3
|
import Select from "../../../../components/Select/Select.vue.js";
|
|
4
4
|
const _hoisted_1 = { class: "mn-b-small flex-nowrap flex" };
|
|
5
5
|
const _sfc_main = {
|
|
6
6
|
__name: "FormPayment",
|
|
7
7
|
props: {
|
|
8
|
-
order: Object
|
|
8
|
+
order: Object,
|
|
9
|
+
organization: Object
|
|
9
10
|
},
|
|
10
11
|
setup(__props) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const availablePaymentTypes = computed(() => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const types = /* @__PURE__ */ new Set();
|
|
16
|
+
(_b = (_a = props.organization) == null ? void 0 : _a.spots) == null ? void 0 : _b.forEach((spot) => {
|
|
17
|
+
var _a2;
|
|
18
|
+
(_a2 = spot.payment) == null ? void 0 : _a2.forEach((type) => types.add(type));
|
|
19
|
+
});
|
|
20
|
+
return Array.from(types);
|
|
21
|
+
});
|
|
11
22
|
return (_ctx, _cache) => {
|
|
12
23
|
return openBlock(), createBlock(_sfc_main$1, { title: "Payment" }, {
|
|
13
24
|
default: withCtx(() => [
|
|
@@ -15,16 +26,11 @@ const _sfc_main = {
|
|
|
15
26
|
createVNode(Select, {
|
|
16
27
|
select: __props.order.payment.type,
|
|
17
28
|
"onUpdate:select": _cache[0] || (_cache[0] = ($event) => __props.order.payment.type = $event),
|
|
18
|
-
|
|
19
|
-
options: [
|
|
20
|
-
{ name: "Cash", value: "cash" },
|
|
21
|
-
{ name: "Card", value: "card" },
|
|
22
|
-
{ name: "Bank Transfer", value: "bank" }
|
|
23
|
-
],
|
|
29
|
+
options: availablePaymentTypes.value,
|
|
24
30
|
placeholder: "Select type of payment",
|
|
25
31
|
size: "small",
|
|
26
32
|
class: "bg-white pd-medium radius-small w-100"
|
|
27
|
-
}, null, 8, ["select"])
|
|
33
|
+
}, null, 8, ["select", "options"])
|
|
28
34
|
])
|
|
29
35
|
]),
|
|
30
36
|
_: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormPayment.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormPayment.vue.js","sources":["../../../../../../../src/modules/orders/components/sections/FormPayment.vue"],"sourcesContent":["<template>\n <Block title=\"Payment\">\n <div class=\"mn-b-small flex-nowrap flex\">\n <Select \n v-model:select=\"order.payment.type\"\n :options=\"availablePaymentTypes\"\n placeholder=\"Select type of payment\" \n size=\"small\"\n class=\"bg-white pd-medium radius-small w-100\"\n />\n </div>\n </Block>\n</template>\n\n<script setup>\n\nimport { computed } from 'vue';\n\nimport Block from '@martyrs/src/components/Block/Block.vue'\nimport Select from '@martyrs/src/components/Select/Select.vue'\n\nconst props = defineProps({\n order: Object,\n organization: Object,\n});\n\nconst availablePaymentTypes = computed(() => {\n const types = new Set()\n props.organization?.spots?.forEach(spot => {\n spot.payment?.forEach(type => types.add(type))\n })\n return Array.from(types)\n})\n\n\n\n</script>"],"names":["_a"],"mappings":";;;;;;;;;;;AAqBA,UAAM,QAAQ;AAKd,UAAM,wBAAwB,SAAS,MAAM;;AAC3C,YAAM,QAAQ,oBAAI,IAAG;AACrB,wBAAM,iBAAN,mBAAoB,UAApB,mBAA2B,QAAQ,UAAQ;;AACzC,SAAAA,MAAA,KAAK,YAAL,gBAAAA,IAAc,QAAQ,UAAQ,MAAM,IAAI,IAAI;AAAA,MAC7C;AACD,aAAO,MAAM,KAAK,KAAK;AAAA,IACzB,CAAC;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -74,6 +74,57 @@ const mutations = {
|
|
|
74
74
|
product.date = dates;
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
|
+
addProductToCart(state2, product, organization, date) {
|
|
78
|
+
const cartItem = state2.positions.find(
|
|
79
|
+
(item) => item._id === product._id
|
|
80
|
+
);
|
|
81
|
+
if (cartItem) {
|
|
82
|
+
cartItem.quantity++;
|
|
83
|
+
} else {
|
|
84
|
+
state2.positions.push({
|
|
85
|
+
_id: product._id,
|
|
86
|
+
images: product.images,
|
|
87
|
+
name: product.name,
|
|
88
|
+
listing: product.listing,
|
|
89
|
+
price: product.price,
|
|
90
|
+
price_currency: product.price_currency,
|
|
91
|
+
quantity: 1,
|
|
92
|
+
date,
|
|
93
|
+
org_id: organization
|
|
94
|
+
// Добавляем _id организации к каждому продукту
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
removeProduct(state2, _id) {
|
|
99
|
+
const cartItem = state2.positions.find(
|
|
100
|
+
(item) => item._id === _id
|
|
101
|
+
);
|
|
102
|
+
const cartItemIndex = state2.positions.indexOf(cartItem);
|
|
103
|
+
if (cartItemIndex > -1) {
|
|
104
|
+
state2.positions.splice(cartItemIndex, 1);
|
|
105
|
+
localStorage.setItem("shopcart", JSON.stringify({
|
|
106
|
+
positions: state2.positions,
|
|
107
|
+
organization: state2.organization
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
decrementItemQuantity(state2, _id) {
|
|
112
|
+
const cartItem = state2.positions.find(
|
|
113
|
+
(item) => item._id === _id
|
|
114
|
+
);
|
|
115
|
+
const cartItemIndex = state2.positions.indexOf(cartItem);
|
|
116
|
+
if (cartItemIndex > -1) {
|
|
117
|
+
cartItem.quantity--;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
incrementItemQuantity(state2, _id) {
|
|
121
|
+
const cartItem = state2.positions.find(
|
|
122
|
+
(item) => item._id === _id
|
|
123
|
+
);
|
|
124
|
+
if (cartItem) {
|
|
125
|
+
cartItem.quantity++;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
77
128
|
resetCustomer(stateObject) {
|
|
78
129
|
Object.assign(stateObject, customerInitState);
|
|
79
130
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.cjs","sources":["../../../../../../src/modules/orders/store/orders.js"],"sourcesContent":["// Dependencies\nimport { reactive, ref, computed, toRefs, watch } from \"vue\";\n// Setup Axios\nimport $axios from '@martyrs/src/modules/globals/views/utils/axios-instance.js';\n// Globals\nimport { setError } from '@martyrs/src/modules/globals/views/store/globals'\n// Init State\nimport orderInitState from \"@martyrs/src/modules/orders/store/models/order\"\n\n\nconst state = reactive({\n all: [], \n current: {\n ...orderInitState\n }\n});\n\nconst actions = {\n async create(order) {\n try {\n const response = await $axios.post('/api/orders/create', order);\n\n state.all.push(response.data);\n\n return response.data;\n } catch (error) {\n setError(error);\n }\n },\n\n async read( options = {}) {\n try {\n \n console.log('options is', options)\n const response = await $axios.get('/api/orders/read', { params: options });\n\n if (options._id) {\n set(response.data[0], 'current')\n } else {\n set(response.data, 'all')\n }\n\n return response.data; \n } catch (err) {\n setError(err)\n throw err;\n }\n },\n\n async update(order) {\n try {\n const response = await $axios.post(`/api/orders/update`, order);\n\n const index = state.all.findIndex(o => o._id === order._id);\n \n if (index !== -1) {\n state.all[index] = response.data;\n }\n\n return response.data; \n } catch (error) {\n setError(error);\n }\n },\n\n async delete(orderID) {\n try {\n await $axios.delete(`/api/orders/${orderID}`);\n state.all = state.all.filter(o => o._id !== orderID);\n } catch (error) {\n setError(error);\n }\n },\n\n async changePaymentStatus(orderID, status) {\n try {\n const response = await $axios.post(`/api/orders/payment/${orderID}`, { status });\n const index = state.all.findIndex(o => o._id === orderID);\n if (index !== -1) {\n state.all[index] = response.data;\n }\n } catch (error) {\n setError(error);\n }\n },\n}\n\nconst mutations = { \n updateRentDates({ positions, productId, dates }) {\n const product = positions.find(p => p._id === productId)\n\n if (product) {\n product.date = dates // Предполагается, что dates — объект { start, end }\n }\n },\n\n resetCustomer(stateObject) { \n Object.assign(stateObject, customerInitState);\n }, \n resetOrder(stateObject) {\n state.current = { ...orderInitState }\n // Object.assign(stateObject, orderInitState);\n } \n}\n\nconst getters = {\n getTotal(positions) {\n return Number(positions.reduce((total, product) => {\n // Проверяем тип листинга\n if (product.listing === 'rent') {\n const start = new Date(product.date.start)\n const end = new Date(product.date.end)\n const diffTime = Math.abs(end - start)\n return total + product.price * (Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1);\n } else {\n // Для обычных товаров умножаем на количество\n return total + product.price * (product.quantity || 1);\n }\n }, 0));\n }\n}\n\nfunction set(eventData, property) { \n state[property] = eventData\n}\n\nconst history = []\n\nhistory.push(state) \n\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\nexport {\n state,\n actions,\n mutations,\n getters\n}"],"names":["reactive","orderInitState","order","$axios","setError","watch"],"mappings":";;;;;;AAUK,MAAC,QAAQA,IAAAA,SAAS;AAAA,EACrB,KAAK,CAAE;AAAA,EACP,SAAS;AAAA,IACP,GAAGC,MAAAA;AAAAA,EACP;AACA,CAAC;AAEI,MAAC,UAAU;AAAA,EACd,MAAM,OAAOC,QAAO;AAClB,QAAI;AACF,YAAM,WAAW,MAAMC,cAAAA,QAAO,KAAK,sBAAsBD,MAAK;AAE9D,YAAM,IAAI,KAAK,SAAS,IAAI;AAE5B,aAAO,SAAS;AAAA,IACjB,SAAQ,OAAO;AACdE,cAAAA,SAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAEA,MAAM,KAAM,UAAU,IAAI;AACzB,QAAI;AAEF,cAAQ,IAAI,cAAc,OAAO;AACjC,YAAM,WAAW,MAAMD,sBAAO,IAAI,oBAAoB,EAAE,QAAQ,SAAS;AAEzE,UAAI,QAAQ,KAAK;AACf,YAAI,SAAS,KAAK,CAAC,GAAG,SAAS;AAAA,MACvC,OAAa;AACL,YAAI,SAAS,MAAM,KAAK;AAAA,MAChC;AAEM,aAAO,SAAS;AAAA,IACjB,SAAQ,KAAK;AACZC,cAAAA,SAAS,GAAG;AACZ,YAAM;AAAA,IACZ;AAAA,EACG;AAAA,EAED,MAAM,OAAOF,QAAO;AAClB,QAAI;AACF,YAAM,WAAW,MAAMC,cAAM,QAAC,KAAK,sBAAsBD,MAAK;AAE9D,YAAM,QAAQ,MAAM,IAAI,UAAU,OAAK,EAAE,QAAQA,OAAM,GAAG;AAE1D,UAAI,UAAU,IAAI;AAChB,cAAM,IAAI,KAAK,IAAI,SAAS;AAAA,MACpC;AAEM,aAAO,SAAS;AAAA,IACjB,SAAQ,OAAO;AACdE,cAAAA,SAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAED,MAAM,OAAO,SAAS;AACpB,QAAI;AACF,YAAMD,cAAM,QAAC,OAAO,eAAe,OAAO,EAAE;AAC5C,YAAM,MAAM,MAAM,IAAI,OAAO,OAAK,EAAE,QAAQ,OAAO;AAAA,IACpD,SAAQ,OAAO;AACdC,cAAAA,SAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAED,MAAM,oBAAoB,SAAS,QAAQ;AACzC,QAAI;AACF,YAAM,WAAW,MAAMD,cAAM,QAAC,KAAK,uBAAuB,OAAO,IAAI,EAAE,QAAQ;AAC/E,YAAM,QAAQ,MAAM,IAAI,UAAU,OAAK,EAAE,QAAQ,OAAO;AACxD,UAAI,UAAU,IAAI;AAChB,cAAM,IAAI,KAAK,IAAI,SAAS;AAAA,MACpC;AAAA,IACK,SAAQ,OAAO;AACdC,cAAAA,SAAS,KAAK;AAAA,IACpB;AAAA,EACG;AACH;AAEK,MAAC,YAAY;AAAA,EAChB,gBAAgB,EAAE,WAAW,WAAW,MAAK,GAAI;AAC/C,UAAM,UAAU,UAAU,KAAK,OAAK,EAAE,QAAQ,SAAS;AAEvD,QAAI,SAAS;AACX,cAAQ,OAAO;AAAA,IACrB;AAAA,EACG;AAAA,
|
|
1
|
+
{"version":3,"file":"orders.cjs","sources":["../../../../../../src/modules/orders/store/orders.js"],"sourcesContent":["// Dependencies\nimport { reactive, ref, computed, toRefs, watch } from \"vue\";\n// Setup Axios\nimport $axios from '@martyrs/src/modules/globals/views/utils/axios-instance.js';\n// Globals\nimport { setError } from '@martyrs/src/modules/globals/views/store/globals'\n// Init State\nimport orderInitState from \"@martyrs/src/modules/orders/store/models/order\"\n\n\nconst state = reactive({\n all: [], \n current: {\n ...orderInitState\n }\n});\n\nconst actions = {\n async create(order) {\n try {\n const response = await $axios.post('/api/orders/create', order);\n\n state.all.push(response.data);\n\n return response.data;\n } catch (error) {\n setError(error);\n }\n },\n\n async read( options = {}) {\n try {\n \n console.log('options is', options)\n const response = await $axios.get('/api/orders/read', { params: options });\n\n if (options._id) {\n set(response.data[0], 'current')\n } else {\n set(response.data, 'all')\n }\n\n return response.data; \n } catch (err) {\n setError(err)\n throw err;\n }\n },\n\n async update(order) {\n try {\n const response = await $axios.post(`/api/orders/update`, order);\n\n const index = state.all.findIndex(o => o._id === order._id);\n \n if (index !== -1) {\n state.all[index] = response.data;\n }\n\n return response.data; \n } catch (error) {\n setError(error);\n }\n },\n\n async delete(orderID) {\n try {\n await $axios.delete(`/api/orders/${orderID}`);\n state.all = state.all.filter(o => o._id !== orderID);\n } catch (error) {\n setError(error);\n }\n },\n\n async changePaymentStatus(orderID, status) {\n try {\n const response = await $axios.post(`/api/orders/payment/${orderID}`, { status });\n const index = state.all.findIndex(o => o._id === orderID);\n if (index !== -1) {\n state.all[index] = response.data;\n }\n } catch (error) {\n setError(error);\n }\n },\n}\n\nconst mutations = { \n updateRentDates({ positions, productId, dates }) {\n const product = positions.find(p => p._id === productId)\n\n if (product) {\n product.date = dates // Предполагается, что dates — объект { start, end }\n }\n },\n\n\n addProductToCart(state, product, organization, date) {\n const cartItem = state.positions.find(\n (item) => item._id === product._id\n );\n\n if (cartItem) {\n cartItem.quantity++;\n } else {\n state.positions.push({\n _id: product._id,\n images: product.images,\n name: product.name,\n listing: product.listing,\n price: product.price,\n price_currency: product.price_currency,\n quantity: 1,\n date: date, \n org_id: organization, // Добавляем _id организации к каждому продукту\n });\n }\n },\n\n\n removeProduct(state, _id) {\n const cartItem = state.positions.find(\n (item) => item._id === _id\n );\n const cartItemIndex = state.positions.indexOf(cartItem);\n\n if (cartItemIndex > -1) {\n state.positions.splice(cartItemIndex, 1);\n \n // Сохраняем весь объект корзины, а не только позиции\n localStorage.setItem('shopcart', JSON.stringify({\n positions: state.positions,\n organization: state.organization\n }));\n }\n },\n\n\n decrementItemQuantity(state, _id) {\n const cartItem = state.positions.find(\n (item) => item._id === _id\n );\n const cartItemIndex = state.positions.indexOf(cartItem);\n \n if (cartItemIndex > -1) {\n cartItem.quantity--;\n }\n },\n\n\n incrementItemQuantity(state, _id) {\n const cartItem = state.positions.find(\n (item) => item._id === _id\n );\n\n if (cartItem) {\n cartItem.quantity++;\n }\n },\n\n\n resetCustomer(stateObject) { \n Object.assign(stateObject, customerInitState);\n }, \n resetOrder(stateObject) {\n state.current = { ...orderInitState }\n // Object.assign(stateObject, orderInitState);\n } \n}\n\nconst getters = {\n getTotal(positions) {\n return Number(positions.reduce((total, product) => {\n // Проверяем тип листинга\n if (product.listing === 'rent') {\n const start = new Date(product.date.start)\n const end = new Date(product.date.end)\n const diffTime = Math.abs(end - start)\n return total + product.price * (Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1);\n } else {\n // Для обычных товаров умножаем на количество\n return total + product.price * (product.quantity || 1);\n }\n }, 0));\n }\n}\n\nfunction set(eventData, property) { \n state[property] = eventData\n}\n\nconst history = []\n\nhistory.push(state) \n\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\nexport {\n state,\n actions,\n mutations,\n getters\n}"],"names":["reactive","orderInitState","order","$axios","setError","state","watch"],"mappings":";;;;;;AAUK,MAAC,QAAQA,IAAAA,SAAS;AAAA,EACrB,KAAK,CAAE;AAAA,EACP,SAAS;AAAA,IACP,GAAGC,MAAAA;AAAAA,EACP;AACA,CAAC;AAEI,MAAC,UAAU;AAAA,EACd,MAAM,OAAOC,QAAO;AAClB,QAAI;AACF,YAAM,WAAW,MAAMC,cAAAA,QAAO,KAAK,sBAAsBD,MAAK;AAE9D,YAAM,IAAI,KAAK,SAAS,IAAI;AAE5B,aAA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AQ;AAAA,IACxB;AACD,UAAM,gBAAgBA,OAAM,UAAU,QAAQ,QAAQ;AAEtD,QAAI,gBAAgB,IAAI;AACtB,eAAS;AAAA,IACf;AAAA,EACG;AAAA,EAGD,sBAAsBA,QAAO,KAAK;AAChC,UAAM,WAAWA,OAAM,UAAU;AAAA,MAC/B,CAAC,SAAS,KAAK,QAAQ;AAAA,IACxB;AAED,QAAI,UAAU;AACZ,eAAS;AAAA,IACf;AAAA,EACG;AAAA,EAGD,cAAc,aAAa;AACzB,WAAO,OAAO,aAAa,iBAAiB;AAAA,EAC7C;AAAA,EACD,WAAW,aAAa;AACtB,UAAM,UAAU,EAAE,GAAGJ,MAAc,QAAA;AAAA,EAEpC;AACH;AAEK,MAAC,UAAU;AAAA,EACd,SAAS,WAAW;AAClB,WAAO,OAAO,UAAU,OAAO,CAAC,OAAO,YAAY;AAEjD,UAAI,QAAQ,YAAY,QAAQ;AAC9B,cAAM,QAAQ,IAAI,KAAK,QAAQ,KAAK,KAAK;AACzC,cAAM,MAAM,IAAI,KAAK,QAAQ,KAAK,GAAG;AACrC,cAAM,WAAW,KAAK,IAAI,MAAM,KAAK;AACrC,eAAO,QAAQ,QAAQ,SAAS,KAAK,KAAK,YAAY,MAAO,KAAK,KAAK,GAAG,IAAI;AAAA,MACtF,OAAa;AAEL,eAAO,QAAQ,QAAQ,SAAS,QAAQ,YAAY;AAAA,MAC5D;AAAA,IACK,GAAE,CAAC,CAAC;AAAA,EACT;AACA;AAEA,SAAS,IAAI,WAAW,UAAU;AAChC,QAAM,QAAQ,IAAI;AACpB;AAMAK,IAAAA,MAAM,OAAO,CAAC,UAAU,aAAa;AAErC,CAAC;;;;;"}
|
|
@@ -72,6 +72,57 @@ const mutations = {
|
|
|
72
72
|
product.date = dates;
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
+
addProductToCart(state2, product, organization, date) {
|
|
76
|
+
const cartItem = state2.positions.find(
|
|
77
|
+
(item) => item._id === product._id
|
|
78
|
+
);
|
|
79
|
+
if (cartItem) {
|
|
80
|
+
cartItem.quantity++;
|
|
81
|
+
} else {
|
|
82
|
+
state2.positions.push({
|
|
83
|
+
_id: product._id,
|
|
84
|
+
images: product.images,
|
|
85
|
+
name: product.name,
|
|
86
|
+
listing: product.listing,
|
|
87
|
+
price: product.price,
|
|
88
|
+
price_currency: product.price_currency,
|
|
89
|
+
quantity: 1,
|
|
90
|
+
date,
|
|
91
|
+
org_id: organization
|
|
92
|
+
// Добавляем _id организации к каждому продукту
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
removeProduct(state2, _id) {
|
|
97
|
+
const cartItem = state2.positions.find(
|
|
98
|
+
(item) => item._id === _id
|
|
99
|
+
);
|
|
100
|
+
const cartItemIndex = state2.positions.indexOf(cartItem);
|
|
101
|
+
if (cartItemIndex > -1) {
|
|
102
|
+
state2.positions.splice(cartItemIndex, 1);
|
|
103
|
+
localStorage.setItem("shopcart", JSON.stringify({
|
|
104
|
+
positions: state2.positions,
|
|
105
|
+
organization: state2.organization
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
decrementItemQuantity(state2, _id) {
|
|
110
|
+
const cartItem = state2.positions.find(
|
|
111
|
+
(item) => item._id === _id
|
|
112
|
+
);
|
|
113
|
+
const cartItemIndex = state2.positions.indexOf(cartItem);
|
|
114
|
+
if (cartItemIndex > -1) {
|
|
115
|
+
cartItem.quantity--;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
incrementItemQuantity(state2, _id) {
|
|
119
|
+
const cartItem = state2.positions.find(
|
|
120
|
+
(item) => item._id === _id
|
|
121
|
+
);
|
|
122
|
+
if (cartItem) {
|
|
123
|
+
cartItem.quantity++;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
75
126
|
resetCustomer(stateObject) {
|
|
76
127
|
Object.assign(stateObject, customerInitState);
|
|
77
128
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.js","sources":["../../../../../../src/modules/orders/store/orders.js"],"sourcesContent":["// Dependencies\nimport { reactive, ref, computed, toRefs, watch } from \"vue\";\n// Setup Axios\nimport $axios from '@martyrs/src/modules/globals/views/utils/axios-instance.js';\n// Globals\nimport { setError } from '@martyrs/src/modules/globals/views/store/globals'\n// Init State\nimport orderInitState from \"@martyrs/src/modules/orders/store/models/order\"\n\n\nconst state = reactive({\n all: [], \n current: {\n ...orderInitState\n }\n});\n\nconst actions = {\n async create(order) {\n try {\n const response = await $axios.post('/api/orders/create', order);\n\n state.all.push(response.data);\n\n return response.data;\n } catch (error) {\n setError(error);\n }\n },\n\n async read( options = {}) {\n try {\n \n console.log('options is', options)\n const response = await $axios.get('/api/orders/read', { params: options });\n\n if (options._id) {\n set(response.data[0], 'current')\n } else {\n set(response.data, 'all')\n }\n\n return response.data; \n } catch (err) {\n setError(err)\n throw err;\n }\n },\n\n async update(order) {\n try {\n const response = await $axios.post(`/api/orders/update`, order);\n\n const index = state.all.findIndex(o => o._id === order._id);\n \n if (index !== -1) {\n state.all[index] = response.data;\n }\n\n return response.data; \n } catch (error) {\n setError(error);\n }\n },\n\n async delete(orderID) {\n try {\n await $axios.delete(`/api/orders/${orderID}`);\n state.all = state.all.filter(o => o._id !== orderID);\n } catch (error) {\n setError(error);\n }\n },\n\n async changePaymentStatus(orderID, status) {\n try {\n const response = await $axios.post(`/api/orders/payment/${orderID}`, { status });\n const index = state.all.findIndex(o => o._id === orderID);\n if (index !== -1) {\n state.all[index] = response.data;\n }\n } catch (error) {\n setError(error);\n }\n },\n}\n\nconst mutations = { \n updateRentDates({ positions, productId, dates }) {\n const product = positions.find(p => p._id === productId)\n\n if (product) {\n product.date = dates // Предполагается, что dates — объект { start, end }\n }\n },\n\n resetCustomer(stateObject) { \n Object.assign(stateObject, customerInitState);\n }, \n resetOrder(stateObject) {\n state.current = { ...orderInitState }\n // Object.assign(stateObject, orderInitState);\n } \n}\n\nconst getters = {\n getTotal(positions) {\n return Number(positions.reduce((total, product) => {\n // Проверяем тип листинга\n if (product.listing === 'rent') {\n const start = new Date(product.date.start)\n const end = new Date(product.date.end)\n const diffTime = Math.abs(end - start)\n return total + product.price * (Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1);\n } else {\n // Для обычных товаров умножаем на количество\n return total + product.price * (product.quantity || 1);\n }\n }, 0));\n }\n}\n\nfunction set(eventData, property) { \n state[property] = eventData\n}\n\nconst history = []\n\nhistory.push(state) \n\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\nexport {\n state,\n actions,\n mutations,\n getters\n}"],"names":[],"mappings":";;;;AAUK,MAAC,QAAQ,SAAS;AAAA,EACrB,KAAK,CAAE;AAAA,EACP,SAAS;AAAA,IACP,GAAG;AAAA,EACP;AACA,CAAC;AAEI,MAAC,UAAU;AAAA,EACd,MAAM,OAAO,OAAO;AAClB,QAAI;AACF,YAAM,WAAW,MAAM,OAAO,KAAK,sBAAsB,KAAK;AAE9D,YAAM,IAAI,KAAK,SAAS,IAAI;AAE5B,aAAO,SAAS;AAAA,IACjB,SAAQ,OAAO;AACd,eAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAEA,MAAM,KAAM,UAAU,IAAI;AACzB,QAAI;AAEF,cAAQ,IAAI,cAAc,OAAO;AACjC,YAAM,WAAW,MAAM,OAAO,IAAI,oBAAoB,EAAE,QAAQ,SAAS;AAEzE,UAAI,QAAQ,KAAK;AACf,YAAI,SAAS,KAAK,CAAC,GAAG,SAAS;AAAA,MACvC,OAAa;AACL,YAAI,SAAS,MAAM,KAAK;AAAA,MAChC;AAEM,aAAO,SAAS;AAAA,IACjB,SAAQ,KAAK;AACZ,eAAS,GAAG;AACZ,YAAM;AAAA,IACZ;AAAA,EACG;AAAA,EAED,MAAM,OAAO,OAAO;AAClB,QAAI;AACF,YAAM,WAAW,MAAM,OAAO,KAAK,sBAAsB,KAAK;AAE9D,YAAM,QAAQ,MAAM,IAAI,UAAU,OAAK,EAAE,QAAQ,MAAM,GAAG;AAE1D,UAAI,UAAU,IAAI;AAChB,cAAM,IAAI,KAAK,IAAI,SAAS;AAAA,MACpC;AAEM,aAAO,SAAS;AAAA,IACjB,SAAQ,OAAO;AACd,eAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAED,MAAM,OAAO,SAAS;AACpB,QAAI;AACF,YAAM,OAAO,OAAO,eAAe,OAAO,EAAE;AAC5C,YAAM,MAAM,MAAM,IAAI,OAAO,OAAK,EAAE,QAAQ,OAAO;AAAA,IACpD,SAAQ,OAAO;AACd,eAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAED,MAAM,oBAAoB,SAAS,QAAQ;AACzC,QAAI;AACF,YAAM,WAAW,MAAM,OAAO,KAAK,uBAAuB,OAAO,IAAI,EAAE,QAAQ;AAC/E,YAAM,QAAQ,MAAM,IAAI,UAAU,OAAK,EAAE,QAAQ,OAAO;AACxD,UAAI,UAAU,IAAI;AAChB,cAAM,IAAI,KAAK,IAAI,SAAS;AAAA,MACpC;AAAA,IACK,SAAQ,OAAO;AACd,eAAS,KAAK;AAAA,IACpB;AAAA,EACG;AACH;AAEK,MAAC,YAAY;AAAA,EAChB,gBAAgB,EAAE,WAAW,WAAW,MAAK,GAAI;AAC/C,UAAM,UAAU,UAAU,KAAK,OAAK,EAAE,QAAQ,SAAS;AAEvD,QAAI,SAAS;AACX,cAAQ,OAAO;AAAA,IACrB;AAAA,EACG;AAAA,
|
|
1
|
+
{"version":3,"file":"orders.js","sources":["../../../../../../src/modules/orders/store/orders.js"],"sourcesContent":["// Dependencies\nimport { reactive, ref, computed, toRefs, watch } from \"vue\";\n// Setup Axios\nimport $axios from '@martyrs/src/modules/globals/views/utils/axios-instance.js';\n// Globals\nimport { setError } from '@martyrs/src/modules/globals/views/store/globals'\n// Init State\nimport orderInitState from \"@martyrs/src/modules/orders/store/models/order\"\n\n\nconst state = reactive({\n all: [], \n current: {\n ...orderInitState\n }\n});\n\nconst actions = {\n async create(order) {\n try {\n const response = await $axios.post('/api/orders/create', order);\n\n state.all.push(response.data);\n\n return response.data;\n } catch (error) {\n setError(error);\n }\n },\n\n async read( options = {}) {\n try {\n \n console.log('options is', options)\n const response = await $axios.get('/api/orders/read', { params: options });\n\n if (options._id) {\n set(response.data[0], 'current')\n } else {\n set(response.data, 'all')\n }\n\n return response.data; \n } catch (err) {\n setError(err)\n throw err;\n }\n },\n\n async update(order) {\n try {\n const response = await $axios.post(`/api/orders/update`, order);\n\n const index = state.all.findIndex(o => o._id === order._id);\n \n if (index !== -1) {\n state.all[index] = response.data;\n }\n\n return response.data; \n } catch (error) {\n setError(error);\n }\n },\n\n async delete(orderID) {\n try {\n await $axios.delete(`/api/orders/${orderID}`);\n state.all = state.all.filter(o => o._id !== orderID);\n } catch (error) {\n setError(error);\n }\n },\n\n async changePaymentStatus(orderID, status) {\n try {\n const response = await $axios.post(`/api/orders/payment/${orderID}`, { status });\n const index = state.all.findIndex(o => o._id === orderID);\n if (index !== -1) {\n state.all[index] = response.data;\n }\n } catch (error) {\n setError(error);\n }\n },\n}\n\nconst mutations = { \n updateRentDates({ positions, productId, dates }) {\n const product = positions.find(p => p._id === productId)\n\n if (product) {\n product.date = dates // Предполагается, что dates — объект { start, end }\n }\n },\n\n\n addProductToCart(state, product, organization, date) {\n const cartItem = state.positions.find(\n (item) => item._id === product._id\n );\n\n if (cartItem) {\n cartItem.quantity++;\n } else {\n state.positions.push({\n _id: product._id,\n images: product.images,\n name: product.name,\n listing: product.listing,\n price: product.price,\n price_currency: product.price_currency,\n quantity: 1,\n date: date, \n org_id: organization, // Добавляем _id организации к каждому продукту\n });\n }\n },\n\n\n removeProduct(state, _id) {\n const cartItem = state.positions.find(\n (item) => item._id === _id\n );\n const cartItemIndex = state.positions.indexOf(cartItem);\n\n if (cartItemIndex > -1) {\n state.positions.splice(cartItemIndex, 1);\n \n // Сохраняем весь объект корзины, а не только позиции\n localStorage.setItem('shopcart', JSON.stringify({\n positions: state.positions,\n organization: state.organization\n }));\n }\n },\n\n\n decrementItemQuantity(state, _id) {\n const cartItem = state.positions.find(\n (item) => item._id === _id\n );\n const cartItemIndex = state.positions.indexOf(cartItem);\n \n if (cartItemIndex > -1) {\n cartItem.quantity--;\n }\n },\n\n\n incrementItemQuantity(state, _id) {\n const cartItem = state.positions.find(\n (item) => item._id === _id\n );\n\n if (cartItem) {\n cartItem.quantity++;\n }\n },\n\n\n resetCustomer(stateObject) { \n Object.assign(stateObject, customerInitState);\n }, \n resetOrder(stateObject) {\n state.current = { ...orderInitState }\n // Object.assign(stateObject, orderInitState);\n } \n}\n\nconst getters = {\n getTotal(positions) {\n return Number(positions.reduce((total, product) => {\n // Проверяем тип листинга\n if (product.listing === 'rent') {\n const start = new Date(product.date.start)\n const end = new Date(product.date.end)\n const diffTime = Math.abs(end - start)\n return total + product.price * (Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1);\n } else {\n // Для обычных товаров умножаем на количество\n return total + product.price * (product.quantity || 1);\n }\n }, 0));\n }\n}\n\nfunction set(eventData, property) { \n state[property] = eventData\n}\n\nconst history = []\n\nhistory.push(state) \n\nwatch(state, (newState, oldState) => {\n history.push(newState)\n})\n\nexport {\n state,\n actions,\n mutations,\n getters\n}"],"names":["state"],"mappings":";;;;AAUK,MAAC,QAAQ,SAAS;AAAA,EACrB,KAAK,CAAE;AAAA,EACP,SAAS;AAAA,IACP,GAAG;AAAA,EACP;AACA,CAAC;AAEI,MAAC,UAAU;AAAA,EACd,MAAM,OAAO,OAAO;AAClB,QAAI;AACF,YAAM,WAAW,MAAM,OAAO,KAAK,sBAAsB,KAAK;AAE9D,YAAM,IAAI,KAAK,SAAS,IAAI;AAE5B,aAAO,SAAS;AAAA,IACjB,SAAQ,OAAO;AACd,eAAS,KAAK;AAAA,IACpB;AAAA,EACG;AAAA,EAEA,MAAM,KAAM,UAAU,IAAI;AACzB,QAAI;AAEF,cAAQ,IAAI,cAAc,OAAO;AACjC,YAAM,WAAW,MAAM,OAAO,IAAI,oBAAoB,EAAE,Q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AA,IACf;AAAA,EACG;AAAA,EAGD,cAAc,aAAa;AACzB,WAAO,OAAO,aAAa,iBAAiB;AAAA,EAC7C;AAAA,EACD,WAAW,aAAa;AACtB,UAAM,UAAU,EAAE,GAAG,eAAc;AAAA,EAEpC;AACH;AAEK,MAAC,UAAU;AAAA,EACd,SAAS,WAAW;AAClB,WAAO,OAAO,UAAU,OAAO,CAAC,OAAO,YAAY;AAEjD,UAAI,QAAQ,YAAY,QAAQ;AAC9B,cAAM,QAAQ,IAAI,KAAK,QAAQ,KAAK,KAAK;AACzC,cAAM,MAAM,IAAI,KAAK,QAAQ,KAAK,GAAG;AACrC,cAAM,WAAW,KAAK,IAAI,MAAM,KAAK;AACrC,eAAO,QAAQ,QAAQ,SAAS,KAAK,KAAK,YAAY,MAAO,KAAK,KAAK,GAAG,IAAI;AAAA,MACtF,OAAa;AAEL,eAAO,QAAQ,QAAQ,SAAS,QAAQ,YAAY;AAAA,MAC5D;AAAA,IACK,GAAE,CAAC,CAAC;AAAA,EACT;AACA;AAEA,SAAS,IAAI,WAAW,UAAU;AAChC,QAAM,QAAQ,IAAI;AACpB;AAMA,MAAM,OAAO,CAAC,UAAU,aAAa;AAErC,CAAC;"}
|
|
@@ -118,64 +118,68 @@ const _sfc_main = {
|
|
|
118
118
|
]),
|
|
119
119
|
_: 1
|
|
120
120
|
}),
|
|
121
|
-
tabOrganization.value === "products" && _ctx.hasAccess(vue.unref(route).params._id, null, null, auth.state.accesses, auth.state.access.roles) ? (vue.openBlock(), vue.createBlock(Block.default, {
|
|
122
|
-
key: 0,
|
|
123
|
-
class: "o-scroll mn-b-small"
|
|
124
|
-
}, {
|
|
125
|
-
default: vue.withCtx(() => [
|
|
126
|
-
vue.createElementVNode("div", _hoisted_3, [
|
|
127
|
-
vue.createVNode(_component_router_link, {
|
|
128
|
-
class: "bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra",
|
|
129
|
-
to: {
|
|
130
|
-
name: "Organization_ProductAdd",
|
|
131
|
-
params: {
|
|
132
|
-
_id: vue.unref(route).params._id
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
137
|
-
vue.createTextVNode(" Add Product ")
|
|
138
|
-
])),
|
|
139
|
-
_: 1
|
|
140
|
-
}, 8, ["to"]),
|
|
141
|
-
vue.createVNode(_component_router_link, {
|
|
142
|
-
class: "uppercase t-nowrap t-semi pd-thin radius-extra",
|
|
143
|
-
to: {
|
|
144
|
-
name: "Leftovers",
|
|
145
|
-
params: {
|
|
146
|
-
_id: vue.unref(route).params._id
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
151
|
-
vue.createTextVNode(" Change Invetory ")
|
|
152
|
-
])),
|
|
153
|
-
_: 1
|
|
154
|
-
}, 8, ["to"]),
|
|
155
|
-
vue.createVNode(_component_router_link, {
|
|
156
|
-
class: "d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",
|
|
157
|
-
to: {
|
|
158
|
-
name: "Backoffice",
|
|
159
|
-
params: {
|
|
160
|
-
_id: vue.unref(route).params._id
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
165
|
-
vue.createTextVNode(" Go to Backoffice ")
|
|
166
|
-
])),
|
|
167
|
-
_: 1
|
|
168
|
-
}, 8, ["to"])
|
|
169
|
-
])
|
|
170
|
-
]),
|
|
171
|
-
_: 1
|
|
172
|
-
})) : vue.createCommentVNode("", true),
|
|
173
121
|
vue.createVNode(vue.Transition, { name: "slide-fade" }, {
|
|
174
122
|
default: vue.withCtx(() => [
|
|
175
123
|
tabOrganization.value === "products" ? (vue.openBlock(), vue.createBlock(Products.default, {
|
|
176
124
|
key: 0,
|
|
177
125
|
organization: organizations.state.current
|
|
178
|
-
},
|
|
126
|
+
}, {
|
|
127
|
+
default: vue.withCtx(() => [
|
|
128
|
+
_ctx.hasAccess(vue.unref(route).params._id, null, null, auth.state.accesses, auth.state.access.roles) ? (vue.openBlock(), vue.createBlock(Block.default, {
|
|
129
|
+
key: 0,
|
|
130
|
+
class: "o-y-scroll w-100 pos-relative mn-b-small"
|
|
131
|
+
}, {
|
|
132
|
+
default: vue.withCtx(() => [
|
|
133
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
134
|
+
vue.createVNode(_component_router_link, {
|
|
135
|
+
class: "bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra",
|
|
136
|
+
to: {
|
|
137
|
+
name: "Organization_ProductAdd",
|
|
138
|
+
params: {
|
|
139
|
+
_id: vue.unref(route).params._id
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}, {
|
|
143
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
144
|
+
vue.createTextVNode(" Add Product ")
|
|
145
|
+
])),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["to"]),
|
|
148
|
+
vue.createVNode(_component_router_link, {
|
|
149
|
+
class: "uppercase t-nowrap t-semi pd-thin radius-extra",
|
|
150
|
+
to: {
|
|
151
|
+
name: "Leftovers",
|
|
152
|
+
params: {
|
|
153
|
+
_id: vue.unref(route).params._id
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
158
|
+
vue.createTextVNode(" Change Invetory ")
|
|
159
|
+
])),
|
|
160
|
+
_: 1
|
|
161
|
+
}, 8, ["to"]),
|
|
162
|
+
vue.createVNode(_component_router_link, {
|
|
163
|
+
class: "d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",
|
|
164
|
+
to: {
|
|
165
|
+
name: "Backoffice",
|
|
166
|
+
params: {
|
|
167
|
+
_id: vue.unref(route).params._id
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
172
|
+
vue.createTextVNode(" Go to Backoffice ")
|
|
173
|
+
])),
|
|
174
|
+
_: 1
|
|
175
|
+
}, 8, ["to"])
|
|
176
|
+
])
|
|
177
|
+
]),
|
|
178
|
+
_: 1
|
|
179
|
+
})) : vue.createCommentVNode("", true)
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
}, 8, ["organization"])) : vue.createCommentVNode("", true)
|
|
179
183
|
]),
|
|
180
184
|
_: 1
|
|
181
185
|
}),
|
|
@@ -190,13 +194,12 @@ const _sfc_main = {
|
|
|
190
194
|
}
|
|
191
195
|
},
|
|
192
196
|
store: {
|
|
193
|
-
read: (options) => spots.actions.read(
|
|
197
|
+
read: (options) => spots.actions.read(options),
|
|
194
198
|
state: organizations.state
|
|
195
199
|
},
|
|
196
200
|
options: {
|
|
197
201
|
user: auth.state.user._id,
|
|
198
|
-
|
|
199
|
-
contain: ["blogposts"],
|
|
202
|
+
organization: vue.unref(route).params._id,
|
|
200
203
|
limit: 10
|
|
201
204
|
}
|
|
202
205
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Organization.vue.cjs","sources":["../../../../../../../src/modules/organizations/components/pages/Organization.vue"],"sourcesContent":["<template>\n\t<div v-if=\"organizationData\" class=\"pd-thin for-transition w-100\">\n\n\t\t<!-- <Breadcrumbs class=\"mn-b-thin pd-medium bg-light radius-big\"/> -->\n\t\t<!-- <pre>{{organization.state.current}}</pre> -->\n\n\t\t<DetailsTabSection \t\n\t\t\t:organization=\"organization.state.current\" \n\t\t\t:user=\"auth.state.user\"\n\t\t\tclass=\"mn-b-thin\"\n\t\t>\n\n\t\t</DetailsTabSection>\n\n\t\t<Tab \n\t\t\tv-model:selected=\"tabOrganization\"\n\t\t\t:tabs=\"[\n\t\t\t\t{ name: 'Community', value: 'community' },\n\t\t\t\t{ name: 'Menu', value: 'products' },\t\n\t\t\t\t{ name: 'Events', value: 'events' },\n\t\t\t\t{ name: 'Spots', value: 'spots' }\t\n\t\t\t]\"\n\t\t\tclass=\"mn-b-thin flex-child-default o-hidden t-medium p-medium radius-medium pd-thin bg-light\"\n\t\t/>\n\n\t\t<div class=\"h-100 pos-relative\">\n\n\t\t\t<transition name=\"slide-fade\">\n\t\t <Feed\n\t\t \tv-if=\"tabOrganization === 'community'\"\n\t\t\t :showLoadMore=\"false\"\n\t\t\t :states=\"{\n\t\t\t empty: {\n\t\t\t title: 'No Blog Posts Found',\n\t\t\t description: 'Currently, there are no posts available in this blog. Please check back later.'\n\t\t\t }\n\t\t\t }\"\n\t\t\t :store=\"{\n\t\t\t read: (options) => blog.read(options)\n\t\t\t }\"\n\t\t\t :options=\"{\n\t\t\t status: 'published',\n\t\t\t user: auth.state.user._id,\n\t\t\t owner: route.params._id,\n\t\t\t }\"\n\t\t\t v-slot=\"{ \n\t\t\t items \n\t\t\t }\"\n\t\t\t class=\"row-1 gap-thin\"\n\t\t\t >\n\t\t\t <CardBlogpost \n\t\t\t v-for=\"item in items\" \n\t\t\t :key=\"item._id\" \n\t\t\t :blogpost=\"item\" \n\t\t\t :user=\"auth.state.user._id\" \n\t\t\t class=\"h-max-40r mn-b-medium\"\n\t\t\t />\n\t\t\t </Feed>\n\t\t\t</transition>\n\n\t\n\t\t\t<transition name=\"slide-fade\">\n\t\t\t\t<FeedEvents \n\t\t\t\t\tv-if=\"tabOrganization === 'events'\"\n\t\t\t \t:user=\"auth.state.user._id\"\n\t\t\t\t\t:owner=\"route.params._id\"\n\t\t\t\t\t:sortOrder=\"'desc'\"\n\t\t\t\t\t:sortParam=\"'date.start'\"\n\t\t\t\t/>\n\t\t\t</transition>\n\n\t\t\t<
|
|
1
|
+
{"version":3,"file":"Organization.vue.cjs","sources":["../../../../../../../src/modules/organizations/components/pages/Organization.vue"],"sourcesContent":["<template>\n\t<div v-if=\"organizationData\" class=\"pd-thin for-transition w-100\">\n\n\t\t<!-- <Breadcrumbs class=\"mn-b-thin pd-medium bg-light radius-big\"/> -->\n\t\t<!-- <pre>{{organization.state.current}}</pre> -->\n\n\t\t<DetailsTabSection \t\n\t\t\t:organization=\"organization.state.current\" \n\t\t\t:user=\"auth.state.user\"\n\t\t\tclass=\"mn-b-thin\"\n\t\t>\n\n\t\t</DetailsTabSection>\n\n\t\t<Tab \n\t\t\tv-model:selected=\"tabOrganization\"\n\t\t\t:tabs=\"[\n\t\t\t\t{ name: 'Community', value: 'community' },\n\t\t\t\t{ name: 'Menu', value: 'products' },\t\n\t\t\t\t{ name: 'Events', value: 'events' },\n\t\t\t\t{ name: 'Spots', value: 'spots' }\t\n\t\t\t]\"\n\t\t\tclass=\"mn-b-thin flex-child-default o-hidden t-medium p-medium radius-medium pd-thin bg-light\"\n\t\t/>\n\n\t\t<div class=\"h-100 pos-relative\">\n\n\t\t\t<transition name=\"slide-fade\">\n\t\t <Feed\n\t\t \tv-if=\"tabOrganization === 'community'\"\n\t\t\t :showLoadMore=\"false\"\n\t\t\t :states=\"{\n\t\t\t empty: {\n\t\t\t title: 'No Blog Posts Found',\n\t\t\t description: 'Currently, there are no posts available in this blog. Please check back later.'\n\t\t\t }\n\t\t\t }\"\n\t\t\t :store=\"{\n\t\t\t read: (options) => blog.read(options)\n\t\t\t }\"\n\t\t\t :options=\"{\n\t\t\t status: 'published',\n\t\t\t user: auth.state.user._id,\n\t\t\t owner: route.params._id,\n\t\t\t }\"\n\t\t\t v-slot=\"{ \n\t\t\t items \n\t\t\t }\"\n\t\t\t class=\"row-1 gap-thin\"\n\t\t\t >\n\t\t\t <CardBlogpost \n\t\t\t v-for=\"item in items\" \n\t\t\t :key=\"item._id\" \n\t\t\t :blogpost=\"item\" \n\t\t\t :user=\"auth.state.user._id\" \n\t\t\t class=\"h-max-40r mn-b-medium\"\n\t\t\t />\n\t\t\t </Feed>\n\t\t\t</transition>\n\n\t\n\t\t\t<transition name=\"slide-fade\">\n\t\t\t\t<FeedEvents \n\t\t\t\t\tv-if=\"tabOrganization === 'events'\"\n\t\t\t \t:user=\"auth.state.user._id\"\n\t\t\t\t\t:owner=\"route.params._id\"\n\t\t\t\t\t:sortOrder=\"'desc'\"\n\t\t\t\t\t:sortParam=\"'date.start'\"\n\t\t\t\t/>\n\t\t\t</transition>\n\n\t\t\t\n\n\t\t\t<transition name=\"slide-fade\">\n\t\t\t\t<Products \n\t\t\t\t\tv-if=\"tabOrganization === 'products'\"\n\t\t\t\t\t:organization=\"organization.state.current\"\n\t\t\t\t>\n\t\t\t\t\t<Block\n\t\t\t\t\t\tv-if=\"hasAccess(route.params._id, null, null, auth.state.accesses, auth.state.access.roles)\"\n\t\t\t\t\t\tclass=\"o-y-scroll w-100 pos-relative mn-b-small\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div class=\"w-100 gap-thin flex flex-nowrap\t o-x-scroll\">\n\t\t\t\t\t\t\t<router-link \n\t\t\t\t\t\t\t\tclass=\"bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra \"\n\t\t\t\t\t\t\t\t:to=\"{\n\t\t\t\t\t\t\t\t\tname:'Organization_ProductAdd', \n\t\t\t\t\t\t\t\t\tparams: {\n\t\t\t\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tAdd Product\n\t\t\t\t\t\t\t</router-link>\n\n\t\t\t\t\t\t\t<router-link \n\t\t\t\t\t\t\t\tclass=\" uppercase t-nowrap t-semi pd-thin radius-extra \"\n\t\t\t\t\t\t\t\t:to=\"{\n\t\t\t\t\t\t\t\t\tname:'Leftovers', \n\t\t\t\t\t\t\t\t\tparams: {\n\t\t\t\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tChange Invetory\n\t\t\t\t\t\t\t</router-link>\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<router-link \n\t\t\t\t\t\t\t\tclass=\"d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra \"\n\t\t\t\t\t\t\t\t:to=\"{\n\t\t\t\t\t\t\t\t\tname:'Backoffice', \n\t\t\t\t\t\t\t\t\tparams: {\n\t\t\t\t\t\t\t\t\t\t_id: route.params._id\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tGo to Backoffice\n\t\t\t\t\t\t\t</router-link>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Block>\n\t\t\t\t</Products>\n\n\t\t\t</transition>\n\n\t\t\t<transition name=\"slide-fade\">\n\t\t\t\t<div v-if=\"tabOrganization === 'spots'\">\n\t\t\t\t\t<Feed\n\t\t\t :states=\"{\n\t\t\t empty: {\n\t\t\t title: 'No Spots Found',\n\t\t\t description: 'Currently, there are no spots available.'\n\t\t\t }\n\t\t\t }\"\n\t\t\t :store=\"{\n\t\t\t read: (options) => spots.actions.read(options),\n\t\t\t state: organization.state\n\t\t\t }\"\n\t\t\t :options=\"{\n\t\t\t \tuser: auth.state.user._id,\n\t\t\t\t\t\t\t\torganization: route.params._id,\n\t\t\t\t\t\t\t\tlimit: 10\n\t\t\t }\"\n\t\t\t v-slot=\"{ \n\t\t\t items \n\t\t\t }\"\n\t\t\t >\n\t\t\t \t<CardSpot\n\t\t v-for=\"(spot, index) in items\"\n\t\t :key=\"index\"\n\t\t :spot=\"spot\"\n\t\t :organization=\"organization.state.current\"\n\t\t :editAccess=\"hasAccess(route.params._id, 'spots', 'edit', auth.state.accesses, auth.state.access.roles)\"\n\t\t :showDeliveryOptions=\"true\"\n\t\t :showPaymentOptions=\"true\"\n\t\t class=\"radius-big bg-light mn-b-thin\"\n\t\t />\n\t\t\t </Feed>\n\n\t\t\t <button\n\t v-if=\"hasAccess(route.params._id, 'spots', 'create', auth.state.accesses, auth.state.access.roles)\"\n\t @click=\"$router.push(`/spots/${organization.state.current._id}/spots/create`)\"\n\t class=\"mn-b-thin bg-main button w-100\"\n\t >\n\t Add spot\n\t </button>\n\n\t\t\t\t</div>\n\t\t\t</transition>\n\n\t\t</div>\n\t</div>\n</template>\n\n<script setup>\n\timport { computed, reactive, ref, onMounted, watch } from 'vue'\n\timport { useRoute, useRouter } from 'vue-router'\n\t// Import components\n\timport Breadcrumbs \tfrom '@martyrs/src/components/Breadcrumbs/Breadcrumbs.vue'\n\timport Tab \t\tfrom '@martyrs/src/components/Tab/Tab.vue'\n\timport Block \t\tfrom '@martyrs/src/components/Block/Block.vue'\n\timport Feed from '@martyrs/src/components/Feed/Feed.vue'\n\t// Community\n\t import CardBlogpost from '@martyrs/src/modules/community/components/blocks/CardBlogpost.vue';\n\t// Mobile Module\n\timport Menu from '@martyrs/src/components/Menu/Menu.vue'\n\timport MenuItem from '@martyrs/src/components/Menu/MenuItem.vue'\n\t// Organizations\n\timport DepartmentSub from '@martyrs/src/modules/organizations/components/blocks/DepartmentSub.vue';\n\timport DetailsTabSection from '@martyrs/src/modules/organizations/components/sections/DetailsTabSection.vue'\n\timport User from '@martyrs/src/modules/auth/views/components/blocks/CardUser.vue';\n\t// Feeds\n\timport FeedEvents from '@martyrs/src/modules/events/components/sections/Feed.vue'; \n\t// Spots\n\timport CardSpot from '@martyrs/src/modules/spots/components/blocks/CardSpot.vue';\t\n\t// Local\n\timport Products from '@martyrs/src/modules/products/components/pages/Products.vue';\n\t// Import state\n\timport * as auth from '@martyrs/src/modules/auth/views/store/auth';\n\timport * as organization from '@martyrs/src/modules/organizations/store/organizations';\n\timport * as memberships from '@martyrs/src/modules/organizations/store/memberships';\n\timport * as departments from '@martyrs/src/modules/organizations/store/departments';\n\t// Community\n import * as blog from '@martyrs/src/modules/community/store/blogposts.js';\n\t// Spots\n\timport * as spots from '@martyrs/src/modules/spots/store/spots';\n\t// Init router\n\tconst router \t= useRouter()\n\tconst route \t= useRoute()\n\t// Accesing state\n\tlet tab = route.query.tab ? route.query.tab : 'products';\n\n\tconst organizationData = ref(null)\n\n\tconst tabOrganization = ref(tab)\n\n\troute.query.tab = tabOrganization.value\n\n\tonMounted(async () => {\n\t\t\n\t\torganizationData.value = await organization.actions.read({\n\t\t\t_id: route.params._id, \n\t\t\tuser: auth.state.user._id,\n\t\t\tlookup: ['memberships']\n\t\t})\n\n \t\tawait memberships.actions.read({target: route.params._id})\n\t})\n\n\twatch(tabOrganization, (newValue) => {\n\t router.replace({ query: { ...route.query, tab: newValue } });\n\t});\n</script>\n\n<style lang=\"scss\">\n\t.slide-fade-enter-active {\n\t\t// min-height: 100vh;\n\t transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n\t}\n\n\t.slide-fade-leave-active {\n\t\t// min-height: 100vh;\n\t transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n\t}\n\n\t.slide-fade-enter-from,\n\t.slide-fade-leave-to {\n\t\tmin-height: 0;\n\t\tposition: absolute;\n\t transform: translateX(20px);\n\t opacity: 0;\n\t left: 0;\n\t top: 0;\n\t}\n\n</style>\n"],"names":["useRouter","useRoute","ref","onMounted","organization.actions","auth.state","memberships.actions","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+MC,UAAM,SAAUA,UAAS,UAAA;AACzB,UAAM,QAASC,UAAQ,SAAA;AAEvB,QAAI,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM,MAAM;AAE9C,UAAM,mBAAmBC,IAAAA,IAAI,IAAI;AAEjC,UAAM,kBAAkBA,IAAAA,IAAI,GAAG;AAE/B,UAAM,MAAM,MAAM,gBAAgB;AAElCC,QAAAA,UAAU,YAAY;AAErB,uBAAiB,QAAQ,MAAMC,cAAoB,QAAC,KAAK;AAAA,QACxD,KAAK,MAAM,OAAO;AAAA,QAClB,MAAMC,KAAAA,MAAW,KAAK;AAAA,QACtB,QAAQ,CAAC,aAAa;AAAA,MACtB,CAAA;AAEA,YAAMC,YAAAA,QAAoB,KAAK,EAAC,QAAQ,MAAM,OAAO,IAAG,CAAC;AAAA,IAC1D,CAAA;AAEDC,cAAM,iBAAiB,CAAC,aAAa;AACnC,aAAO,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,KAAK,SAAQ,GAAI;AAAA,IAC9D,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref, onMounted, watch, resolveComponent, createElementBlock, createCommentVNode, openBlock, createVNode, createElementVNode,
|
|
1
|
+
import { ref, onMounted, watch, resolveComponent, createElementBlock, createCommentVNode, openBlock, createVNode, createElementVNode, Transition, withCtx, createBlock, unref, Fragment, renderList, createTextVNode } from "vue";
|
|
2
2
|
import { useRouter, useRoute } from "vue-router";
|
|
3
3
|
import "vue-i18n";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import _sfc_main$2 from "../../../../components/Tab/Tab.vue.js";
|
|
6
|
-
import _sfc_main$
|
|
6
|
+
import _sfc_main$7 from "../../../../components/Block/Block.vue.js";
|
|
7
7
|
import _sfc_main$3 from "../../../../components/Feed/Feed.vue.js";
|
|
8
8
|
import _sfc_main$4 from "../../../community/components/blocks/CardBlogpost.vue.js";
|
|
9
9
|
/* empty css */
|
|
@@ -11,7 +11,7 @@ import "../../../../components/Menu/MenuItem.vue.js";
|
|
|
11
11
|
import _sfc_main$1 from "../sections/DetailsTabSection.vue.js";
|
|
12
12
|
import _sfc_main$5 from "../../../events/components/sections/Feed.vue.js";
|
|
13
13
|
import CardSpot from "../../../spots/components/blocks/CardSpot.vue.js";
|
|
14
|
-
import _sfc_main$
|
|
14
|
+
import _sfc_main$6 from "../../../products/components/pages/Products.vue.js";
|
|
15
15
|
import { state } from "../../../auth/views/store/auth.js";
|
|
16
16
|
import { actions, state as state$1 } from "../../store/organizations.js";
|
|
17
17
|
import { actions as actions$1 } from "../../store/memberships.js";
|
|
@@ -116,64 +116,68 @@ const _sfc_main = {
|
|
|
116
116
|
]),
|
|
117
117
|
_: 1
|
|
118
118
|
}),
|
|
119
|
-
tabOrganization.value === "products" && _ctx.hasAccess(unref(route).params._id, null, null, state.accesses, state.access.roles) ? (openBlock(), createBlock(_sfc_main$6, {
|
|
120
|
-
key: 0,
|
|
121
|
-
class: "o-scroll mn-b-small"
|
|
122
|
-
}, {
|
|
123
|
-
default: withCtx(() => [
|
|
124
|
-
createElementVNode("div", _hoisted_3, [
|
|
125
|
-
createVNode(_component_router_link, {
|
|
126
|
-
class: "bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra",
|
|
127
|
-
to: {
|
|
128
|
-
name: "Organization_ProductAdd",
|
|
129
|
-
params: {
|
|
130
|
-
_id: unref(route).params._id
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}, {
|
|
134
|
-
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
135
|
-
createTextVNode(" Add Product ")
|
|
136
|
-
])),
|
|
137
|
-
_: 1
|
|
138
|
-
}, 8, ["to"]),
|
|
139
|
-
createVNode(_component_router_link, {
|
|
140
|
-
class: "uppercase t-nowrap t-semi pd-thin radius-extra",
|
|
141
|
-
to: {
|
|
142
|
-
name: "Leftovers",
|
|
143
|
-
params: {
|
|
144
|
-
_id: unref(route).params._id
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
149
|
-
createTextVNode(" Change Invetory ")
|
|
150
|
-
])),
|
|
151
|
-
_: 1
|
|
152
|
-
}, 8, ["to"]),
|
|
153
|
-
createVNode(_component_router_link, {
|
|
154
|
-
class: "d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",
|
|
155
|
-
to: {
|
|
156
|
-
name: "Backoffice",
|
|
157
|
-
params: {
|
|
158
|
-
_id: unref(route).params._id
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}, {
|
|
162
|
-
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
163
|
-
createTextVNode(" Go to Backoffice ")
|
|
164
|
-
])),
|
|
165
|
-
_: 1
|
|
166
|
-
}, 8, ["to"])
|
|
167
|
-
])
|
|
168
|
-
]),
|
|
169
|
-
_: 1
|
|
170
|
-
})) : createCommentVNode("", true),
|
|
171
119
|
createVNode(Transition, { name: "slide-fade" }, {
|
|
172
120
|
default: withCtx(() => [
|
|
173
|
-
tabOrganization.value === "products" ? (openBlock(), createBlock(_sfc_main$
|
|
121
|
+
tabOrganization.value === "products" ? (openBlock(), createBlock(_sfc_main$6, {
|
|
174
122
|
key: 0,
|
|
175
123
|
organization: state$1.current
|
|
176
|
-
},
|
|
124
|
+
}, {
|
|
125
|
+
default: withCtx(() => [
|
|
126
|
+
_ctx.hasAccess(unref(route).params._id, null, null, state.accesses, state.access.roles) ? (openBlock(), createBlock(_sfc_main$7, {
|
|
127
|
+
key: 0,
|
|
128
|
+
class: "o-y-scroll w-100 pos-relative mn-b-small"
|
|
129
|
+
}, {
|
|
130
|
+
default: withCtx(() => [
|
|
131
|
+
createElementVNode("div", _hoisted_3, [
|
|
132
|
+
createVNode(_component_router_link, {
|
|
133
|
+
class: "bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra",
|
|
134
|
+
to: {
|
|
135
|
+
name: "Organization_ProductAdd",
|
|
136
|
+
params: {
|
|
137
|
+
_id: unref(route).params._id
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
142
|
+
createTextVNode(" Add Product ")
|
|
143
|
+
])),
|
|
144
|
+
_: 1
|
|
145
|
+
}, 8, ["to"]),
|
|
146
|
+
createVNode(_component_router_link, {
|
|
147
|
+
class: "uppercase t-nowrap t-semi pd-thin radius-extra",
|
|
148
|
+
to: {
|
|
149
|
+
name: "Leftovers",
|
|
150
|
+
params: {
|
|
151
|
+
_id: unref(route).params._id
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
156
|
+
createTextVNode(" Change Invetory ")
|
|
157
|
+
])),
|
|
158
|
+
_: 1
|
|
159
|
+
}, 8, ["to"]),
|
|
160
|
+
createVNode(_component_router_link, {
|
|
161
|
+
class: "d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra",
|
|
162
|
+
to: {
|
|
163
|
+
name: "Backoffice",
|
|
164
|
+
params: {
|
|
165
|
+
_id: unref(route).params._id
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
170
|
+
createTextVNode(" Go to Backoffice ")
|
|
171
|
+
])),
|
|
172
|
+
_: 1
|
|
173
|
+
}, 8, ["to"])
|
|
174
|
+
])
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
})) : createCommentVNode("", true)
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
}, 8, ["organization"])) : createCommentVNode("", true)
|
|
177
181
|
]),
|
|
178
182
|
_: 1
|
|
179
183
|
}),
|
|
@@ -188,13 +192,12 @@ const _sfc_main = {
|
|
|
188
192
|
}
|
|
189
193
|
},
|
|
190
194
|
store: {
|
|
191
|
-
read: (options) => actions$2.read(
|
|
195
|
+
read: (options) => actions$2.read(options),
|
|
192
196
|
state: state$1
|
|
193
197
|
},
|
|
194
198
|
options: {
|
|
195
199
|
user: state.user._id,
|
|
196
|
-
|
|
197
|
-
contain: ["blogposts"],
|
|
200
|
+
organization: unref(route).params._id,
|
|
198
201
|
limit: 10
|
|
199
202
|
}
|
|
200
203
|
}, {
|