@ozdao/martyrs 0.2.429 → 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/components/Block/Block.vue.cjs +1 -1
- package/dist/martyrs/src/components/Block/Block.vue.js +1 -1
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue.cjs → Tooltip.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Tooltip/Tooltip.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue.js → Tooltip.vue2.js} +2 -2
- package/dist/martyrs/src/components/Tooltip/{Tooltip.vue.cjs.map → Tooltip.vue2.js.map} +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/blocks/CardHeader.vue.js +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/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/CardOrderUser.vue.cjs +19 -13
- 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 +19 -13
- 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 +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +1 -1
- 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 +1 -1
- 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/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +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/pages/views/components/pages/PageEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/pages/views/components/pages/PageEdit.vue.js +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/store/spots.cjs +4 -11
- package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.js +4 -11
- package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/orders.server.js +5 -4
- package/dist/orders.server.mjs +4 -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 +4 -16
- package/dist/spots.server.mjs +4 -16
- package/dist/style.css +40 -48
- package/dist/wallet.server.js +1 -1
- package/dist/wallet.server.mjs +1 -1
- package/package.json +1 -1
- package/src/modules/globals/controllers/utils/queryProcessor.js +2 -1
- 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/orders/components/blocks/CardOrderBackoffice.vue +106 -0
- package/src/modules/orders/components/blocks/CardOrderUser.vue +16 -9
- package/src/modules/orders/components/pages/OrderCreate.vue +2 -2
- 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/controllers/orders.controller.js +2 -1
- 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/controllers/spots.controller.js +3 -17
- package/src/modules/spots/routes/spots.routes.js +1 -4
- package/src/modules/spots/store/spots.js +4 -12
- package/src/styles/base/shadow_transitions_hover_refactor.scss +1 -0
- package/dist/martyrs/src/components/Tooltip/Tooltip.vue.js.map +0 -1
- package/src/modules/landing/components/sections/HowToBuyWDR.vue +0 -130
- package/src/modules/landing/components/sections/WhatIsWDRSection.vue +0 -116
|
@@ -148,17 +148,24 @@ const statusText = computed(() => {
|
|
|
148
148
|
case 'canceled':
|
|
149
149
|
return `Canceled, ${updatedDate}`;
|
|
150
150
|
default:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
// Расчет задержки
|
|
152
|
+
if (props.positions?.length) {
|
|
153
|
+
const lastPosition = props.positions[props.positions.length - 1];
|
|
154
|
+
const lastEndDateRaw = lastPosition?.date?.end;
|
|
155
|
+
|
|
156
|
+
if (lastEndDateRaw) {
|
|
157
|
+
const lastEndDate = new Date(lastEndDateRaw);
|
|
154
158
|
const now = new Date();
|
|
155
|
-
const diffTime = Math.abs(now - lastEndDate);
|
|
159
|
+
const diffTime = Math.abs(now.getTime() - lastEndDate.getTime());
|
|
156
160
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
161
|
+
|
|
157
162
|
if (diffDays > 0 && props.status !== 'finished' && props.status !== 'canceled') {
|
|
158
163
|
return `Delay ${diffDays} day${diffDays > 1 ? 's' : ''}`;
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
|
-
|
|
166
|
+
}
|
|
167
|
+
return `Created, ${createdDate}`;
|
|
168
|
+
|
|
162
169
|
}
|
|
163
170
|
});
|
|
164
171
|
|
|
@@ -192,16 +199,16 @@ threeDaysFromNow.setDate(today.getDate() + 3);
|
|
|
192
199
|
// Показывать ли уведомление о возврате
|
|
193
200
|
const showReturnNotice = computed(() => {
|
|
194
201
|
return props.positions.some(position => {
|
|
195
|
-
const endDate = getDateWithoutTime(position.date.end);
|
|
196
|
-
return endDate <= threeDaysFromNow;
|
|
202
|
+
const endDate = position?.date?.end ? getDateWithoutTime(position.date.end) : null;
|
|
203
|
+
return endDate !== null && endDate <= threeDaysFromNow;
|
|
197
204
|
});
|
|
198
205
|
});
|
|
199
206
|
|
|
200
207
|
// Есть ли просроченные позиции
|
|
201
208
|
const hasOverdue = computed(() => {
|
|
202
209
|
return props.positions.some(position => {
|
|
203
|
-
const endDate = getDateWithoutTime(position.date.end);
|
|
204
|
-
return endDate < today;
|
|
210
|
+
const endDate = position?.date?.end ? getDateWithoutTime(position.date.end) : null;
|
|
211
|
+
return endDate !== null && endDate < today;
|
|
205
212
|
});
|
|
206
213
|
});
|
|
207
214
|
|
|
@@ -260,14 +260,14 @@ async function handleCreate() {
|
|
|
260
260
|
let order = await orders.actions.create(orders.state.current);
|
|
261
261
|
|
|
262
262
|
if (order) {
|
|
263
|
-
shopcart.actions.resetShopcart()
|
|
264
|
-
|
|
265
263
|
router.push({
|
|
266
264
|
name: 'Order',
|
|
267
265
|
params: {
|
|
268
266
|
order: order._id
|
|
269
267
|
}
|
|
270
268
|
})
|
|
269
|
+
|
|
270
|
+
shopcart.actions.resetShopcart()
|
|
271
271
|
} else {
|
|
272
272
|
alert('something wrong')
|
|
273
273
|
}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
state: null
|
|
54
54
|
}"
|
|
55
55
|
:options="{
|
|
56
|
-
|
|
56
|
+
owner: route.params._id
|
|
57
57
|
}"
|
|
58
58
|
v-slot="{
|
|
59
59
|
items
|
|
@@ -165,12 +165,14 @@
|
|
|
165
165
|
|
|
166
166
|
<FormDelivery
|
|
167
167
|
v-if="tabOrderCreate === 'delivery'"
|
|
168
|
-
:order="orders.state.current"
|
|
168
|
+
:order="orders.state.current"
|
|
169
|
+
:organization="orderOrganization[0]"
|
|
169
170
|
/>
|
|
170
171
|
|
|
171
172
|
<FormPayment
|
|
172
173
|
v-if="tabOrderCreate === 'payment'"
|
|
173
174
|
:order="orders.state.current"
|
|
175
|
+
:organization="orderOrganization[0]"
|
|
174
176
|
/>
|
|
175
177
|
|
|
176
178
|
<Popup
|
|
@@ -223,6 +225,7 @@
|
|
|
223
225
|
import * as globals from '@martyrs/src/modules/globals/views/store/globals';
|
|
224
226
|
import * as auth from '@martyrs/src/modules/auth/views/store/auth';
|
|
225
227
|
import * as orders from '@martyrs/src/modules/orders/store/orders';
|
|
228
|
+
import * as organizations from '@martyrs/src/modules/organizations/store/organizations';
|
|
226
229
|
import * as products from '@martyrs/src/modules/products/store/products';
|
|
227
230
|
|
|
228
231
|
import customers from '@martyrs/src/modules/orders/store/customers.store';
|
|
@@ -296,7 +299,16 @@
|
|
|
296
299
|
})
|
|
297
300
|
}
|
|
298
301
|
|
|
299
|
-
|
|
302
|
+
const orderOrganization = ref({})
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
onMounted(async() => {
|
|
307
|
+
|
|
308
|
+
orderOrganization.value = await organizations.actions.read({
|
|
309
|
+
_id: route.params._id,
|
|
310
|
+
lookup: ['spots']
|
|
311
|
+
})
|
|
300
312
|
|
|
301
313
|
// await orders.actions.fetchOrder(route.params.id) // Implement this action in your store
|
|
302
314
|
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
v-if="!MOBILE_APP"
|
|
5
5
|
title="Orders"
|
|
6
6
|
:actions="[
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
route.meta.context === 'backoffice' && { to: { name: 'BackofficeAdminCreateOrder' }, label: 'Create Order' },
|
|
8
|
+
route.meta.context === 'organization' && { to: { name: 'OrganizationAdminCreateOrder', params: { _id: route.params._id}}, label: 'Create Order' }
|
|
9
|
+
].filter(Boolean)"
|
|
9
10
|
class="mn-b-small"
|
|
10
11
|
/>
|
|
11
12
|
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
}"
|
|
45
46
|
:options="{
|
|
46
47
|
limit: 15,
|
|
47
|
-
...(route.meta.context === 'organization' && {
|
|
48
|
+
...(route.meta.context === 'organization' && { owner: route.params._id }),
|
|
48
49
|
...(route.meta.context === 'user' && { customer: route.params._id }),
|
|
49
50
|
...(tab !== 'all' && { status: tab })
|
|
50
51
|
}"
|
|
@@ -62,98 +63,14 @@
|
|
|
62
63
|
? { order: order._id }
|
|
63
64
|
: { order: order._id, organization: order.owner.target || order.owner._id }
|
|
64
65
|
}"
|
|
65
|
-
class="bg-light pos-relative pd-medium radius-big"
|
|
66
66
|
>
|
|
67
|
-
<
|
|
68
|
-
:
|
|
69
|
-
:entityType="'order'"
|
|
67
|
+
<CardOrderBackoffice
|
|
68
|
+
:order="order"
|
|
70
69
|
:user="auth.state.user"
|
|
71
|
-
:
|
|
72
|
-
:
|
|
73
|
-
:
|
|
74
|
-
class="mn-b-small"
|
|
70
|
+
:formatDate="formatDate"
|
|
71
|
+
:getTotal="orders.getters.getTotal"
|
|
72
|
+
:currency="returnCurrency()"
|
|
75
73
|
/>
|
|
76
|
-
|
|
77
|
-
<div class="mn-b-small pd-small bg-white radius-small flex-nowrap flex">
|
|
78
|
-
<div class="w-100">
|
|
79
|
-
<!-- <h3 class="mn-b-thin">{{order.customer.target.profile?.name || order.customer.target.phone || order.customer.target.email || 'No name'}}</h3> -->
|
|
80
|
-
<p class="t-truncate">{{order.delivery.address || 'Not specified'}}</p>
|
|
81
|
-
</div>
|
|
82
|
-
|
|
83
|
-
<div class=" w-100 t-right">
|
|
84
|
-
<h3 class="mn-b-thin">{{returnCurrency()}}{{orders.getters.getTotal(order.positions)}}</h3>
|
|
85
|
-
<p>#{{order._id.slice(0, 4) + '...' + order._id.slice(-4)}}</p>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div class="cols-1 mn-b-small gap-thin pd-small bg-white radius-small">
|
|
90
|
-
<!-- Always display the first two positions -->
|
|
91
|
-
<div
|
|
92
|
-
v-for="(position, index) in order.positions.slice(0, 2)"
|
|
93
|
-
:key="index"
|
|
94
|
-
class="w-100 flex"
|
|
95
|
-
>
|
|
96
|
-
<p class="mn-r-auto">{{ position.name }}</p>
|
|
97
|
-
<p class="t-right">
|
|
98
|
-
{{ position.quantity }} {{ position.type }}
|
|
99
|
-
x
|
|
100
|
-
{{ position.price }}
|
|
101
|
-
<span class="t-transp">{{ returnCurrency() }}</span>
|
|
102
|
-
</p>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<transition name="fade">
|
|
106
|
-
<!-- Display the rest of the positions if there are more than two and spoiler is true -->
|
|
107
|
-
<div v-if="spoiler && order.positions.length > 2">
|
|
108
|
-
<div
|
|
109
|
-
v-for="(position, index) in order.positions.slice(2)"
|
|
110
|
-
:key="index + 2"
|
|
111
|
-
class="w-100 flex"
|
|
112
|
-
>
|
|
113
|
-
<p class="mn-r-auto">{{ position.name }}</p>
|
|
114
|
-
<p class="t-right">
|
|
115
|
-
{{ position.quantity }} {{ position.type }}
|
|
116
|
-
x
|
|
117
|
-
{{ position.price }}
|
|
118
|
-
<span class="t-transp">{{ returnCurrency() }}</span>
|
|
119
|
-
</p>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
</transition>
|
|
123
|
-
|
|
124
|
-
<!-- Toggle button for additional positions, visible only if there are more than two positions -->
|
|
125
|
-
<button
|
|
126
|
-
v-if="order.positions.length > 2"
|
|
127
|
-
@click.prevent="spoiler = !spoiler"
|
|
128
|
-
class="radius-big bg-light-transp-50 pd-nano w-100 flex-center flex"
|
|
129
|
-
>
|
|
130
|
-
{{ !spoiler ? `+${order.positions.length - 2} more` : `Hide` }}
|
|
131
|
-
</button>
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<div class="pd-small bg-white radius-small gap-micro flex-v-center flex-nowrap flex">
|
|
136
|
-
<IconTime class="i-semi t-transp" fill="rgb(var(--black)" />
|
|
137
|
-
<p class="t-medium mn-r-auto">{{formatDate(order.deadline)}}</p>
|
|
138
|
-
|
|
139
|
-
<span
|
|
140
|
-
class="flex-child flex-child-shrink-0 capitalize w-max t-medium radius-big pd-b-nano pd-t-nano pd-r-thin pd-l-thin bg-main"
|
|
141
|
-
>
|
|
142
|
-
{{order.status}}
|
|
143
|
-
</span>
|
|
144
|
-
|
|
145
|
-
<span
|
|
146
|
-
class="flex-child flex-child-shrink-0 capitalize w-max t-medium radius-big pd-b-nano pd-t-nano pd-r-thin pd-l-thin t-white bg-red"
|
|
147
|
-
>
|
|
148
|
-
Unpaid
|
|
149
|
-
</span>
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<div v-if="order.comment" class="pos-relative radius-small bg-fifth-transp-10 mn-t-thin pd-small">
|
|
154
|
-
<p class="mn-b-thin t-transp uppercase p-small t-medium">Comment</p>
|
|
155
|
-
<p>{{order.comment}}</p>
|
|
156
|
-
</div>
|
|
157
74
|
</router-link>
|
|
158
75
|
|
|
159
76
|
<router-link
|
|
@@ -192,7 +109,7 @@
|
|
|
192
109
|
import CardOrder from '@martyrs/src/modules/orders/components/blocks/CardOrder.vue'
|
|
193
110
|
|
|
194
111
|
import CardOrderUser from '@martyrs/src/modules/orders/components/blocks/CardOrderUser.vue'
|
|
195
|
-
import
|
|
112
|
+
import CardOrderBackoffice from '@martyrs/src/modules/orders/components/blocks/CardOrderBackoffice.vue'
|
|
196
113
|
|
|
197
114
|
import SectionPageTitle from '@martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue'
|
|
198
115
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!-- ---------------------------------------------------------------- -->
|
|
4
4
|
<!-- 01. Popup Header -->
|
|
5
5
|
<!-- ---------------------------------------------------------------- -->
|
|
6
|
-
<div class="
|
|
6
|
+
<div class="flex-nowrap flex">
|
|
7
7
|
<div class="mn-b-medium w-100">
|
|
8
8
|
<h4 class="mn-b-thin p-big">{{t('title')}}</h4>
|
|
9
9
|
<p class="t-transp p-small">{{t('subtitle')}} {{ t('positions', { count: StoreCartAmount }) }}</p>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<!-- ---------------------------------------------------------------- -->
|
|
14
14
|
<!-- 02. Popup Content -->
|
|
15
15
|
<!-- ---------------------------------------------------------------- -->
|
|
16
|
-
<div class="
|
|
16
|
+
<div class="h-100 flex flex-column w-100 pos-relative o-x-hidden o-y-scroll gap-small shopcart-content">
|
|
17
17
|
<!-- Empty State -->
|
|
18
18
|
<p v-if="!(shopcart.state.positions.length > 0)" class="mn-t-medium"><i>{{t('emptystate')}}</i></p>
|
|
19
19
|
<!-- Shopcart positions -->
|
|
@@ -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);
|
|
@@ -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
|
|
@@ -33,13 +33,13 @@ const controllerFactory = (db) => {
|
|
|
33
33
|
];
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
|
-
const spots = await
|
|
36
|
+
const spots = await Spot.aggregate(stages);
|
|
37
37
|
|
|
38
|
-
if (!
|
|
38
|
+
if (!spots) {
|
|
39
39
|
return res.status(404).send({ errorCode: "SPOTS_NOT_FOUND", message: "Spots not found." });
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
res.status(200).send(
|
|
42
|
+
res.status(200).send(spots);
|
|
43
43
|
|
|
44
44
|
} catch (err) {
|
|
45
45
|
console.log(err);
|
|
@@ -60,19 +60,6 @@ const controllerFactory = (db) => {
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
const readOld = (req, res) => {
|
|
64
|
-
Spot.find({ organization: req.params._id })
|
|
65
|
-
.then(spots => {
|
|
66
|
-
if (!spots) {
|
|
67
|
-
return res.status(404).send({ message: "Spots not found" });
|
|
68
|
-
}
|
|
69
|
-
res.send(spots);
|
|
70
|
-
})
|
|
71
|
-
.catch(err => {
|
|
72
|
-
res.status(500).send({ message: err.message });
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
63
|
const create = async (req, res) => {
|
|
77
64
|
try {
|
|
78
65
|
const newSpot = new Spot({
|
|
@@ -117,7 +104,6 @@ const controllerFactory = (db) => {
|
|
|
117
104
|
return {
|
|
118
105
|
read,
|
|
119
106
|
readOne,
|
|
120
|
-
readOld,
|
|
121
107
|
create,
|
|
122
108
|
update,
|
|
123
109
|
delete: deleteSpot
|