@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,60 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Block title="Delivery">
|
|
3
3
|
<h5 class="font-second mn-b-thin">Select delivery type</h5>
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
<div class="mn-b-small flex-nowrap flex" v-if="availableDeliveryTypes.length">
|
|
5
6
|
<Radio
|
|
7
|
+
v-for="type in availableDeliveryTypes"
|
|
8
|
+
:key="type"
|
|
6
9
|
v-model:radio="order.delivery.type"
|
|
7
|
-
label="
|
|
8
|
-
value="
|
|
9
|
-
class="bg-white pd-medium radius-small w-100 mn-r-small"
|
|
10
|
-
/>
|
|
11
|
-
<Radio
|
|
12
|
-
v-model:radio="order.delivery.type"
|
|
13
|
-
label="Courier"
|
|
14
|
-
value="courier"
|
|
10
|
+
:label="capitalize(type)"
|
|
11
|
+
:value="type"
|
|
15
12
|
class="bg-white pd-medium radius-small w-100 mn-r-small"
|
|
16
13
|
/>
|
|
17
14
|
</div>
|
|
15
|
+
<div v-else>No delivery options available.</div>
|
|
18
16
|
|
|
19
17
|
<!-- Раздел для Pickup -->
|
|
20
18
|
<template v-if="order.delivery.type === 'pickup'">
|
|
21
19
|
<h5 class="font-second mn-b-thin">Select pickup spot</h5>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
limit: 10
|
|
35
|
-
}"
|
|
36
|
-
v-slot="{
|
|
37
|
-
items
|
|
38
|
-
}"
|
|
39
|
-
class=""
|
|
40
|
-
>
|
|
41
|
-
<CardSpot
|
|
42
|
-
v-for="(spot, index) in items"
|
|
43
|
-
:key="index"
|
|
44
|
-
:spot="spot"
|
|
45
|
-
:organization="order.organization"
|
|
46
|
-
:editAcess="false"
|
|
47
|
-
:showDeliveryOptions="false"
|
|
48
|
-
:showPaymentOptions="false"
|
|
49
|
-
:selected="order.delivery.spot === spot._id"
|
|
50
|
-
@click="() => order.delivery.spot = order.delivery.spot === spot._id ? null : spot._id"
|
|
51
|
-
class="mn-b-thin radius-medium o-hidden bg-white"
|
|
52
|
-
/>
|
|
53
|
-
</Feed>
|
|
20
|
+
<CardSpot
|
|
21
|
+
v-for="(spot, index) in organization?.spots.filter(item => item.delivery?.includes('pickup'))"
|
|
22
|
+
:key="index"
|
|
23
|
+
:spot="spot"
|
|
24
|
+
:organization="order.organization"
|
|
25
|
+
:editAcess="false"
|
|
26
|
+
:showDeliveryOptions="false"
|
|
27
|
+
:showPaymentOptions="false"
|
|
28
|
+
:selected="order.delivery.spot === spot._id"
|
|
29
|
+
@click="() => order.delivery.spot = order.delivery.spot === spot._id ? null : spot._id"
|
|
30
|
+
class="mn-b-thin radius-medium o-hidden bg-white"
|
|
31
|
+
/>
|
|
54
32
|
</template>
|
|
55
33
|
|
|
56
34
|
<!-- Раздел для Courier -->
|
|
57
|
-
<template v-else-if="order.delivery.type === 'courier'">
|
|
35
|
+
<template v-else-if="order.delivery.type === 'courier' || order.delivery.type === 'post'">
|
|
58
36
|
<h5 class="font-second mn-b-thin">Address</h5>
|
|
59
37
|
<Address
|
|
60
38
|
label="Location"
|
|
@@ -91,7 +69,7 @@
|
|
|
91
69
|
</template>
|
|
92
70
|
|
|
93
71
|
<script setup>
|
|
94
|
-
import { watch, onMounted } from 'vue';
|
|
72
|
+
import { watch, computed, onMounted } from 'vue';
|
|
95
73
|
import { useRoute } from 'vue-router';
|
|
96
74
|
|
|
97
75
|
import Feed from '@martyrs/src/components/Feed/Feed.vue';
|
|
@@ -106,6 +84,7 @@ import Field from '@martyrs/src/components/Field/Field.vue';
|
|
|
106
84
|
|
|
107
85
|
const props = defineProps({
|
|
108
86
|
order: Object,
|
|
87
|
+
organization: Object,
|
|
109
88
|
});
|
|
110
89
|
|
|
111
90
|
const route = useRoute();
|
|
@@ -124,4 +103,17 @@ onMounted(() => {
|
|
|
124
103
|
props.order.delivery.location = globals.state.position.location;
|
|
125
104
|
}
|
|
126
105
|
});
|
|
106
|
+
|
|
107
|
+
const availableDeliveryTypes = computed(() => {
|
|
108
|
+
const types = new Set()
|
|
109
|
+
props.organization?.spots?.forEach(spot => {
|
|
110
|
+
spot.delivery?.forEach(type => types.add(type))
|
|
111
|
+
})
|
|
112
|
+
return Array.from(types)
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
function capitalize(str) {
|
|
116
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
117
|
+
}
|
|
118
|
+
|
|
127
119
|
</script>
|
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
<div class="mn-b-small flex-nowrap flex">
|
|
4
4
|
<Select
|
|
5
5
|
v-model:select="order.payment.type"
|
|
6
|
-
:
|
|
7
|
-
:options="[
|
|
8
|
-
{name: 'Cash', value: 'cash'},
|
|
9
|
-
{name: 'Card', value: 'card'},
|
|
10
|
-
{name: 'Bank Transfer', value: 'bank'},
|
|
11
|
-
]"
|
|
6
|
+
:options="availablePaymentTypes"
|
|
12
7
|
placeholder="Select type of payment"
|
|
13
8
|
size="small"
|
|
14
9
|
class="bg-white pd-medium radius-small w-100"
|
|
@@ -18,10 +13,25 @@
|
|
|
18
13
|
</template>
|
|
19
14
|
|
|
20
15
|
<script setup>
|
|
16
|
+
|
|
17
|
+
import { computed } from 'vue';
|
|
18
|
+
|
|
21
19
|
import Block from '@martyrs/src/components/Block/Block.vue'
|
|
22
20
|
import Select from '@martyrs/src/components/Select/Select.vue'
|
|
23
21
|
|
|
24
|
-
defineProps({
|
|
22
|
+
const props = defineProps({
|
|
25
23
|
order: Object,
|
|
24
|
+
organization: Object,
|
|
26
25
|
});
|
|
26
|
+
|
|
27
|
+
const availablePaymentTypes = computed(() => {
|
|
28
|
+
const types = new Set()
|
|
29
|
+
props.organization?.spots?.forEach(spot => {
|
|
30
|
+
spot.payment?.forEach(type => types.add(type))
|
|
31
|
+
})
|
|
32
|
+
return Array.from(types)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
27
37
|
</script>
|
|
@@ -113,6 +113,7 @@ const controllerFactory = (db) => {
|
|
|
113
113
|
|
|
114
114
|
// Start a database transaction
|
|
115
115
|
const session = await db.mongoose.startSession();
|
|
116
|
+
|
|
116
117
|
session.startTransaction();
|
|
117
118
|
|
|
118
119
|
try {
|
|
@@ -192,7 +193,7 @@ const controllerFactory = (db) => {
|
|
|
192
193
|
await session.commitTransaction();
|
|
193
194
|
|
|
194
195
|
// Send notification
|
|
195
|
-
|
|
196
|
+
sendOrderMessage(orderData);
|
|
196
197
|
|
|
197
198
|
// Return the created order
|
|
198
199
|
res.status(201).send(createdOrder);
|
|
@@ -324,7 +325,17 @@ const controllerFactory = (db) => {
|
|
|
324
325
|
// }
|
|
325
326
|
|
|
326
327
|
// Save the order first
|
|
328
|
+
if (req.body.payment?.type && req.body.payment.type !== order.payment?.type) {
|
|
329
|
+
order.payment.type = req.body.payment.type;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Update payment.status if changed
|
|
333
|
+
if (req.body.payment?.status && req.body.payment.status !== order.payment?.status) {
|
|
334
|
+
order.payment.status = req.body.payment.status;
|
|
335
|
+
}
|
|
336
|
+
|
|
327
337
|
await order.save();
|
|
338
|
+
|
|
328
339
|
|
|
329
340
|
// Send notification if status changed
|
|
330
341
|
if (statusChanged) {
|
|
@@ -94,6 +94,71 @@ const mutations = {
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
|
|
97
|
+
|
|
98
|
+
addProductToCart(state, product, organization, date) {
|
|
99
|
+
const cartItem = state.positions.find(
|
|
100
|
+
(item) => item._id === product._id
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (cartItem) {
|
|
104
|
+
cartItem.quantity++;
|
|
105
|
+
} else {
|
|
106
|
+
state.positions.push({
|
|
107
|
+
_id: product._id,
|
|
108
|
+
images: product.images,
|
|
109
|
+
name: product.name,
|
|
110
|
+
listing: product.listing,
|
|
111
|
+
price: product.price,
|
|
112
|
+
price_currency: product.price_currency,
|
|
113
|
+
quantity: 1,
|
|
114
|
+
date: date,
|
|
115
|
+
org_id: organization, // Добавляем _id организации к каждому продукту
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
removeProduct(state, _id) {
|
|
122
|
+
const cartItem = state.positions.find(
|
|
123
|
+
(item) => item._id === _id
|
|
124
|
+
);
|
|
125
|
+
const cartItemIndex = state.positions.indexOf(cartItem);
|
|
126
|
+
|
|
127
|
+
if (cartItemIndex > -1) {
|
|
128
|
+
state.positions.splice(cartItemIndex, 1);
|
|
129
|
+
|
|
130
|
+
// Сохраняем весь объект корзины, а не только позиции
|
|
131
|
+
localStorage.setItem('shopcart', JSON.stringify({
|
|
132
|
+
positions: state.positions,
|
|
133
|
+
organization: state.organization
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
decrementItemQuantity(state, _id) {
|
|
140
|
+
const cartItem = state.positions.find(
|
|
141
|
+
(item) => item._id === _id
|
|
142
|
+
);
|
|
143
|
+
const cartItemIndex = state.positions.indexOf(cartItem);
|
|
144
|
+
|
|
145
|
+
if (cartItemIndex > -1) {
|
|
146
|
+
cartItem.quantity--;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
incrementItemQuantity(state, _id) {
|
|
152
|
+
const cartItem = state.positions.find(
|
|
153
|
+
(item) => item._id === _id
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
if (cartItem) {
|
|
157
|
+
cartItem.quantity++;
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
|
|
97
162
|
resetCustomer(stateObject) {
|
|
98
163
|
Object.assign(stateObject, customerInitState);
|
|
99
164
|
},
|
|
@@ -69,55 +69,57 @@
|
|
|
69
69
|
/>
|
|
70
70
|
</transition>
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
v-if="tabOrganization === 'products' && hasAccess(route.params._id, null, null, auth.state.accesses, auth.state.access.roles)"
|
|
74
|
-
class="o-scroll mn-b-small "
|
|
75
|
-
>
|
|
76
|
-
<div class="w-100 gap-thin flex flex-nowrap o-x-scroll">
|
|
77
|
-
<router-link
|
|
78
|
-
class="bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra "
|
|
79
|
-
:to="{
|
|
80
|
-
name:'Organization_ProductAdd',
|
|
81
|
-
params: {
|
|
82
|
-
_id: route.params._id
|
|
83
|
-
}
|
|
84
|
-
}"
|
|
85
|
-
>
|
|
86
|
-
Add Product
|
|
87
|
-
</router-link>
|
|
88
|
-
|
|
89
|
-
<router-link
|
|
90
|
-
class=" uppercase t-nowrap t-semi pd-thin radius-extra "
|
|
91
|
-
:to="{
|
|
92
|
-
name:'Leftovers',
|
|
93
|
-
params: {
|
|
94
|
-
_id: route.params._id
|
|
95
|
-
}
|
|
96
|
-
}"
|
|
97
|
-
>
|
|
98
|
-
Change Invetory
|
|
99
|
-
</router-link>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<router-link
|
|
103
|
-
class="d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra "
|
|
104
|
-
:to="{
|
|
105
|
-
name:'Backoffice',
|
|
106
|
-
params: {
|
|
107
|
-
_id: route.params._id
|
|
108
|
-
}
|
|
109
|
-
}"
|
|
110
|
-
>
|
|
111
|
-
Go to Backoffice
|
|
112
|
-
</router-link>
|
|
113
|
-
</div>
|
|
114
|
-
</Block>
|
|
72
|
+
|
|
115
73
|
|
|
116
74
|
<transition name="slide-fade">
|
|
117
75
|
<Products
|
|
118
76
|
v-if="tabOrganization === 'products'"
|
|
119
77
|
:organization="organization.state.current"
|
|
120
|
-
|
|
78
|
+
>
|
|
79
|
+
<Block
|
|
80
|
+
v-if="hasAccess(route.params._id, null, null, auth.state.accesses, auth.state.access.roles)"
|
|
81
|
+
class="o-y-scroll w-100 pos-relative mn-b-small"
|
|
82
|
+
>
|
|
83
|
+
<div class="w-100 gap-thin flex flex-nowrap o-x-scroll">
|
|
84
|
+
<router-link
|
|
85
|
+
class="bg-black t-nowrap t-white uppercase t-semi pd-thin radius-extra "
|
|
86
|
+
:to="{
|
|
87
|
+
name:'Organization_ProductAdd',
|
|
88
|
+
params: {
|
|
89
|
+
_id: route.params._id
|
|
90
|
+
}
|
|
91
|
+
}"
|
|
92
|
+
>
|
|
93
|
+
Add Product
|
|
94
|
+
</router-link>
|
|
95
|
+
|
|
96
|
+
<router-link
|
|
97
|
+
class=" uppercase t-nowrap t-semi pd-thin radius-extra "
|
|
98
|
+
:to="{
|
|
99
|
+
name:'Leftovers',
|
|
100
|
+
params: {
|
|
101
|
+
_id: route.params._id
|
|
102
|
+
}
|
|
103
|
+
}"
|
|
104
|
+
>
|
|
105
|
+
Change Invetory
|
|
106
|
+
</router-link>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
<router-link
|
|
110
|
+
class="d-block t-nowrap mn-l-auto uppercase t-semi bg-white pd-thin radius-extra "
|
|
111
|
+
:to="{
|
|
112
|
+
name:'Backoffice',
|
|
113
|
+
params: {
|
|
114
|
+
_id: route.params._id
|
|
115
|
+
}
|
|
116
|
+
}"
|
|
117
|
+
>
|
|
118
|
+
Go to Backoffice
|
|
119
|
+
</router-link>
|
|
120
|
+
</div>
|
|
121
|
+
</Block>
|
|
122
|
+
</Products>
|
|
121
123
|
|
|
122
124
|
</transition>
|
|
123
125
|
|
|
@@ -131,13 +133,12 @@
|
|
|
131
133
|
}
|
|
132
134
|
}"
|
|
133
135
|
:store="{
|
|
134
|
-
read: (options) => spots.actions.read(
|
|
136
|
+
read: (options) => spots.actions.read(options),
|
|
135
137
|
state: organization.state
|
|
136
138
|
}"
|
|
137
139
|
:options="{
|
|
138
140
|
user: auth.state.user._id,
|
|
139
|
-
|
|
140
|
-
contain: ['blogposts'],
|
|
141
|
+
organization: route.params._id,
|
|
141
142
|
limit: 10
|
|
142
143
|
}"
|
|
143
144
|
v-slot="{
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const jwt = require("jsonwebtoken");
|
|
2
2
|
|
|
3
|
+
const Cache = require('@martyrs/src/modules/globals/controllers/classes/globals.cache');
|
|
4
|
+
|
|
3
5
|
const queryProcessorGlobals = require('@martyrs/src/modules/globals/controllers/utils/queryProcessor');
|
|
4
6
|
|
|
5
7
|
const {
|
|
@@ -23,25 +25,33 @@ const controllerFactory = (db) => {
|
|
|
23
25
|
const Department = db.department;
|
|
24
26
|
const Membership = db.membership;
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
// Создаем экземпляр вашего кэша с TTL 5 минут (по умолчанию)
|
|
29
|
+
const cache = new Cache({ ttlSeconds: 60 * 5 });
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
const read = async (req, res) => {
|
|
32
|
+
console.log('controller query', req.query);
|
|
29
33
|
|
|
30
34
|
try {
|
|
35
|
+
const cacheKey = JSON.stringify(req.query); // Ключ кэша на основе запроса
|
|
36
|
+
|
|
37
|
+
// Проверяем, есть ли данные в кэше
|
|
38
|
+
let cachedResult = await cache.get(cacheKey);
|
|
39
|
+
if (cachedResult) {
|
|
40
|
+
// Если данные в кэше есть, возвращаем их
|
|
41
|
+
return res.status(200).send(cachedResult);
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
const requestedLookups = getRequestedLookups(req.query);
|
|
32
45
|
const matchConditions = getBasicMatchConditions(req.query);
|
|
33
46
|
|
|
34
47
|
const stages = [
|
|
35
48
|
...getLookupStages(requestedLookups, lookupConfigs),
|
|
36
|
-
|
|
37
49
|
...getPostableConditions(req.query.postable),
|
|
38
50
|
...getContainConditions(req.query.contain),
|
|
39
|
-
|
|
40
51
|
...queryProcessorGlobals.getSearchOptions(
|
|
41
52
|
req.query.search,
|
|
42
53
|
{ fields: requestedLookups.includes('products') ? ['profile.name', 'products.name'] : ['profile.name'] }
|
|
43
54
|
),
|
|
44
|
-
|
|
45
55
|
...(requestedLookups.includes('products') && req.query.prices ? getPriceConditions(req.query.prices) : []),
|
|
46
56
|
...(requestedLookups.includes('spots') ? (await getLocationStages(req.query)).stages : []),
|
|
47
57
|
...(requestedLookups.includes('memberships') ? [
|
|
@@ -56,50 +66,17 @@ const controllerFactory = (db) => {
|
|
|
56
66
|
console.log(JSON.stringify(stages, null, 2));
|
|
57
67
|
|
|
58
68
|
const organizations = await Organization.aggregate(stages);
|
|
59
|
-
res.status(200).send(organizations);
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error(err);
|
|
62
|
-
res.status(500).send({ message: err.message });
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
console.log(req.query)
|
|
72
|
-
|
|
73
|
-
// Fetch by website
|
|
74
|
-
if (req.query._id) {
|
|
75
|
-
query['_id'] = req.query._id;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (req.query.owner) {
|
|
79
|
-
query['owner'] = req.query.owner;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Fetch by type
|
|
83
|
-
if (req.query.type) {
|
|
84
|
-
query.types = req.query.type;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Pagination options
|
|
88
|
-
let options = {};
|
|
89
|
-
options.skip = parseInt(req.query.skip) || 0;
|
|
90
|
-
options.limit = parseInt(req.query.limit) || 10;
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
const organizations = await Organization.find(query, null, options);
|
|
94
|
-
|
|
95
|
-
if (!organizations || organizations.length === 0) {
|
|
96
|
-
return res.status(404).send({ message: "Organizations not found." });
|
|
70
|
+
// Кэшируем результат с тегами для каждой организации
|
|
71
|
+
for (const org of organizations) {
|
|
72
|
+
const orgTag = `organization_${org._id}`; // Уникальный тег для каждой организации
|
|
73
|
+
await cache.setWithTags(cacheKey, organizations, [orgTag, 'organizations']); // Добавляем оба тега
|
|
97
74
|
}
|
|
98
75
|
|
|
99
|
-
// Send fetched organizations
|
|
100
76
|
res.status(200).send(organizations);
|
|
101
|
-
} catch(err) {
|
|
102
|
-
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error(err);
|
|
79
|
+
res.status(500).send({ message: err.message });
|
|
103
80
|
}
|
|
104
81
|
};
|
|
105
82
|
|
|
@@ -122,6 +99,14 @@ const controllerFactory = (db) => {
|
|
|
122
99
|
|
|
123
100
|
const savedMembership = await membership.save();
|
|
124
101
|
|
|
102
|
+
// Очищаем кэш для этой организации
|
|
103
|
+
const orgTag = `organization_${savedOrganization._id}`;
|
|
104
|
+
await cache.delByTag(orgTag);
|
|
105
|
+
|
|
106
|
+
// Обновляем кэш, добавляя новую организацию
|
|
107
|
+
const newCacheKey = JSON.stringify({ _id: savedOrganization._id }); // Ключ для новой записи
|
|
108
|
+
await cache.setWithTags(newCacheKey, [savedOrganization], [orgTag, 'organizations']);
|
|
109
|
+
|
|
125
110
|
res.status(201).json(savedOrganization);
|
|
126
111
|
} catch (error) {
|
|
127
112
|
console.error('Error:', error);
|
|
@@ -144,6 +129,14 @@ const controllerFactory = (db) => {
|
|
|
144
129
|
return res.status(404).json({ message: 'Organization not found' });
|
|
145
130
|
}
|
|
146
131
|
|
|
132
|
+
// Очищаем кэш для этой организации
|
|
133
|
+
const orgTag = `organization_${organizationId}`;
|
|
134
|
+
await cache.delByTag(orgTag);
|
|
135
|
+
|
|
136
|
+
// Обновляем кэш новой версией организации
|
|
137
|
+
const updateCacheKey = JSON.stringify({ _id: organizationId }); // Ключ для обновленной записи
|
|
138
|
+
await cache.setWithTags(updateCacheKey, [organization], [orgTag, 'organizations']);
|
|
139
|
+
|
|
147
140
|
res.status(200).json({ message: 'Organization updated successfully', organization });
|
|
148
141
|
} catch (error) {
|
|
149
142
|
res.status(500).json({ error: error.message });
|
|
@@ -167,6 +160,10 @@ const controllerFactory = (db) => {
|
|
|
167
160
|
expiresIn: 86400 // 24 hours
|
|
168
161
|
});
|
|
169
162
|
|
|
163
|
+
// Очищаем кэш для этой организации
|
|
164
|
+
const orgTag = `organization_${req.params._id}`;
|
|
165
|
+
cache.delByTag(orgTag);
|
|
166
|
+
|
|
170
167
|
res.send({ newToken });
|
|
171
168
|
})
|
|
172
169
|
.catch(err => {
|
|
@@ -181,6 +178,14 @@ const controllerFactory = (db) => {
|
|
|
181
178
|
const checkAccesses = async (req, res) => {
|
|
182
179
|
try {
|
|
183
180
|
const uid = new db.mongoose.Types.ObjectId(req.userId);
|
|
181
|
+
const cacheKey = `accesses_${uid.toString()}`; // Уникальный ключ для кэша на основе userId
|
|
182
|
+
|
|
183
|
+
// Проверяем, есть ли данные в кэше
|
|
184
|
+
const cachedResult = await cache.get(cacheKey);
|
|
185
|
+
if (cachedResult) {
|
|
186
|
+
return res.status(200).json(cachedResult);
|
|
187
|
+
}
|
|
188
|
+
|
|
184
189
|
const depts = await Department.find({ 'members.user': uid });
|
|
185
190
|
const ownedOrgs = await Organization.find({ owner: uid });
|
|
186
191
|
const ownedOrgIds = ownedOrgs.map(org => org._id.toString());
|
|
@@ -200,8 +205,8 @@ const controllerFactory = (db) => {
|
|
|
200
205
|
rights[key] = {};
|
|
201
206
|
}
|
|
202
207
|
const accessRights = accessData[key];
|
|
203
|
-
Object.
|
|
204
|
-
rights[key][right] = isOwner || rights[key][right] ||
|
|
208
|
+
Object.entries(accessRights).forEach(([right, value]) => {
|
|
209
|
+
rights[key][right] = isOwner || rights[key][right] || value;
|
|
205
210
|
});
|
|
206
211
|
});
|
|
207
212
|
};
|
|
@@ -239,6 +244,11 @@ const controllerFactory = (db) => {
|
|
|
239
244
|
});
|
|
240
245
|
|
|
241
246
|
const accessArray = Object.values(accesses);
|
|
247
|
+
|
|
248
|
+
// Кэшируем результат с тегами: уникальный тег для пользователя и общий тег для всех доступов
|
|
249
|
+
const userTag = `access_${uid.toString()}`; // Тег для конкретного пользователя
|
|
250
|
+
await cache.setWithTags(cacheKey, accessArray, [userTag, 'accesses']);
|
|
251
|
+
|
|
242
252
|
res.status(200).json(accessArray);
|
|
243
253
|
} catch (err) {
|
|
244
254
|
console.error('Error getting accesses:', err);
|
|
@@ -141,13 +141,13 @@ const actions = {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
const history = []
|
|
145
|
-
history.push(state)
|
|
144
|
+
// const history = []
|
|
145
|
+
// history.push(state)
|
|
146
146
|
|
|
147
|
-
// // Watch
|
|
148
|
-
watch(state, (newState, oldState) => {
|
|
149
|
-
|
|
150
|
-
})
|
|
147
|
+
// // // Watch
|
|
148
|
+
// watch(state, (newState, oldState) => {
|
|
149
|
+
// history.push(newState)
|
|
150
|
+
// })
|
|
151
151
|
|
|
152
152
|
// Module Export
|
|
153
153
|
export {
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
</div>
|
|
49
49
|
|
|
50
50
|
<div class="z-index-3 bg-white radius-tl-big radius-tr-big">
|
|
51
|
-
<
|
|
51
|
+
<slot></slot>
|
|
52
|
+
<div class=" z-index-3 radius-tl-big radius-tr-big">
|
|
52
53
|
<BlockSearch
|
|
53
54
|
@search="updateSearch"
|
|
54
55
|
placeholder="Enter product name"
|
|
55
|
-
class="bg-light h-4r"
|
|
56
|
+
class="bg-light mn-b-thin h-4r"
|
|
56
57
|
/>
|
|
57
58
|
</div>
|
|
58
59
|
<Feed
|
|
@@ -82,7 +83,7 @@
|
|
|
82
83
|
v-slot="{
|
|
83
84
|
items
|
|
84
85
|
}"
|
|
85
|
-
class="cols-4 rows-1
|
|
86
|
+
class="cols-4 rows-1 gap-thin"
|
|
86
87
|
|
|
87
88
|
>
|
|
88
89
|
<router-link
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
class="aspect-1x1 h-100 w-auto"
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
|
-
<div class="pd-
|
|
13
|
+
<div class="pd-small w-100">
|
|
14
14
|
|
|
15
15
|
<!-- v-if="user === event.creator.target._id" -->
|
|
16
16
|
<IconEdit
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
class="z-index-2 pos-absolute pos-t-regular pos-r-regular radius-extra bg-second pd-thin i-semi"
|
|
32
32
|
/>
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
<div class="bg-light radius-small pd-thin mn-b-thin radius-small">
|
|
35
|
+
<p
|
|
36
|
+
class=" p-small w-100 t-truncate"
|
|
37
|
+
>
|
|
38
|
+
{{spot.address}}
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
40
41
|
|
|
41
42
|
<h3
|
|
42
43
|
class="mn-b-thin w-100"
|