@ozdao/martyrs 0.2.473 → 0.2.474
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/{Media-DW8RLbfM.js → Media-_vz04tII.js} +1 -1
- package/dist/{Media-y_TX6us_.mjs → Media-sGk7Bp9b.mjs} +1 -1
- package/dist/auth.server.js +6 -2
- package/dist/auth.server.mjs +6 -2
- package/dist/authJwt-CELQKF2s.js +82 -0
- package/dist/authJwt-DnXu3BFq.mjs +83 -0
- package/dist/builder.js +7 -4
- package/dist/builder.mjs +7 -4
- package/dist/chats.server.js +1 -1
- package/dist/chats.server.mjs +1 -1
- package/dist/community.server.js +4 -4
- package/dist/community.server.mjs +4 -4
- package/dist/events.server.js +4 -4
- package/dist/events.server.mjs +4 -4
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +3 -3
- package/dist/gallery.server.mjs +3 -3
- package/dist/{globals.abac-DT0VjfaZ.js → globals.abac-Bn-4tbX8.js} +110 -16
- package/dist/{globals.abac-CvmZM8XG.mjs → globals.abac-DZpTRxKR.mjs} +110 -16
- package/dist/globals.server.js +70 -10
- package/dist/globals.server.mjs +70 -10
- package/dist/{globals.verifier-C_VZYebB.mjs → globals.verifier-BdJxc8-8.mjs} +34 -0
- package/dist/{globals.verifier-ChDpCdy_.js → globals.verifier-CKYpYfQl.js} +34 -0
- package/dist/{index-CVXl1rB5.js → index-BOmxJQ5W.js} +7 -86
- package/dist/{index-Df8vtZx7.mjs → index-C_Fw0Umg.mjs} +7 -86
- package/dist/{main-CgmHzhq5.mjs → main-CqMtW7Hq.mjs} +274 -276
- package/dist/{main-CCfQH-Dd.js → main-CsGkbSyK.js} +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.cjs +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Select/Select.vue.js +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/community.client.js +27 -27
- package/dist/martyrs/src/modules/community/community.client.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +2 -3
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +2 -3
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +88 -27
- 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 +89 -28
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.js +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +19 -0
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +19 -0
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.cjs +2 -0
- package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.js +2 -0
- package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +30 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +30 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/spots/store/spots.cjs +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.js +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +1 -1
- package/dist/notifications.server.mjs +1 -1
- package/dist/orders.server.js +5 -4
- package/dist/orders.server.mjs +5 -4
- package/dist/organizations.server.js +120 -47
- package/dist/organizations.server.mjs +120 -47
- package/dist/{ownership.schema-C0w02Vw1.mjs → ownership.schema-CNCotD3D.mjs} +10 -4
- package/dist/{ownership.schema-Ck2H9clB.js → ownership.schema-MxfJlPtq.js} +10 -4
- package/dist/products.server.js +415 -149
- package/dist/products.server.mjs +415 -149
- package/dist/{profile.schema-h61hhB2w.js → profile.schema-BLSuV_VC.js} +0 -4
- package/dist/{profile.schema-kP_zKXNt.mjs → profile.schema-BRuvQ7QV.mjs} +0 -4
- package/dist/{queryProcessor-CWnMIe2U.mjs → queryProcessor-CVKI651_.mjs} +62 -8
- package/dist/{queryProcessor-D6GuKfTV.js → queryProcessor-DSUqSk3I.js} +62 -8
- package/dist/rents.server.js +4 -4
- package/dist/rents.server.mjs +4 -4
- package/dist/spots.server.js +162 -8
- package/dist/spots.server.mjs +162 -8
- package/dist/style.css +27 -4
- package/dist/wallet.server.js +2 -2
- package/dist/wallet.server.mjs +2 -2
- package/package.json +1 -1
- package/src/builder/rspack/rspack.config.base.js +1 -1
- package/src/builder/rspack/rspack.config.client.js +13 -5
- package/src/components/Select/Select.vue +4 -2
- package/src/modules/auth/models/user.model.js +4 -1
- package/src/modules/community/components/sections/HotPosts.vue +1 -1
- package/src/modules/globals/controllers/classes/globals.abac.js +148 -23
- package/src/modules/globals/controllers/classes/globals.validator.js +37 -0
- package/src/modules/globals/controllers/classes/globals.verifier.js +2 -0
- package/src/modules/globals/controllers/policies/globals.policies.js +91 -74
- package/src/modules/globals/controllers/utils/queryProcessor.js +59 -11
- package/src/modules/globals/models/schemas/ownership.schema.js +11 -6
- package/src/modules/globals/models/schemas/profile.schema.js +0 -4
- package/src/modules/music/components/layouts/MusicLayout.vue +10 -58
- package/src/modules/music/components/pages/MusicHome.vue +5 -5
- package/src/modules/orders/components/pages/OrderCreate.vue +85 -12
- package/src/modules/orders/controllers/orders.controller.js +3 -0
- package/src/modules/orders/store/shopcart.js +1 -0
- package/src/modules/organizations/models/schemas/accesses.schema.js +18 -0
- package/src/modules/organizations/policies/organizations.policies.js +117 -61
- package/src/modules/products/components/pages/CategoryEdit.vue +27 -2
- package/src/modules/products/components/pages/Product.vue +1 -0
- package/src/modules/products/components/pages/ProductEdit.vue +2 -2
- package/src/modules/products/controllers/categories.controller.js +297 -133
- package/src/modules/products/middlewares/categories.verifier.js +177 -0
- package/src/modules/products/models/category.model.js +12 -14
- package/src/modules/products/routes/categories.routes.js +50 -11
- package/src/modules/products/store/categories.js +2 -0
- package/src/modules/spots/components/pages/SpotEdit.vue +21 -17
- package/src/modules/spots/components/sections/WorktimeEdit.vue +840 -0
- package/src/modules/spots/controllers/queries/getIsOpenNowStage.js +109 -0
- package/src/modules/spots/controllers/spots.controller.js +2 -1
- package/src/modules/spots/models/spot.model.js +59 -13
- package/src/modules/spots/store/spots.js +4 -1
- package/src/modules/products/middlewares/index.js +0 -11
- package/src/modules/products/middlewares/verifyCategory.js +0 -25
|
@@ -155,7 +155,11 @@ function getCreatorUserLookupStage() {
|
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
$project: {
|
|
158
|
+
$project: {
|
|
159
|
+
username: 1,
|
|
160
|
+
profile: 1,
|
|
161
|
+
_id: 1
|
|
162
|
+
}
|
|
159
163
|
}
|
|
160
164
|
],
|
|
161
165
|
as: "creatorUser"
|
|
@@ -163,13 +167,25 @@ function getCreatorUserLookupStage() {
|
|
|
163
167
|
};
|
|
164
168
|
}
|
|
165
169
|
|
|
166
|
-
|
|
167
170
|
function getCreatorOrganizationLookupStage() {
|
|
168
171
|
return {
|
|
169
172
|
$lookup: {
|
|
170
173
|
from: "organizations",
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
let: { creatorId: "$creator.target" },
|
|
175
|
+
pipeline: [
|
|
176
|
+
{
|
|
177
|
+
$match: {
|
|
178
|
+
$expr: { $eq: ["$_id", "$$creatorId"] }
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
$project: {
|
|
183
|
+
name: 1, // если нужно, можешь оставить только нужные поля
|
|
184
|
+
profile: 1,
|
|
185
|
+
_id: 1
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
],
|
|
173
189
|
as: "creatorOrganization"
|
|
174
190
|
}
|
|
175
191
|
};
|
|
@@ -179,14 +195,26 @@ function getCreatorCustomerLookupStage() {
|
|
|
179
195
|
return {
|
|
180
196
|
$lookup: {
|
|
181
197
|
from: "customers",
|
|
182
|
-
|
|
183
|
-
|
|
198
|
+
let: { creatorId: "$creator.target" },
|
|
199
|
+
pipeline: [
|
|
200
|
+
{
|
|
201
|
+
$match: {
|
|
202
|
+
$expr: { $eq: ["_id", "$$creatorId"] }
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
$project: {
|
|
207
|
+
username: 1, // если есть, можно заменить на нужные поля у customer
|
|
208
|
+
profile: 1,
|
|
209
|
+
_id: 1
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
],
|
|
184
213
|
as: "creatorCustomer"
|
|
185
214
|
}
|
|
186
215
|
};
|
|
187
216
|
}
|
|
188
217
|
|
|
189
|
-
|
|
190
218
|
function getOwnerUserLookupStage() {
|
|
191
219
|
return {
|
|
192
220
|
$lookup: {
|
|
@@ -199,7 +227,13 @@ function getOwnerUserLookupStage() {
|
|
|
199
227
|
}
|
|
200
228
|
},
|
|
201
229
|
{
|
|
202
|
-
$project: {
|
|
230
|
+
$project: {
|
|
231
|
+
username: 1,
|
|
232
|
+
profile: 1,
|
|
233
|
+
email: 1,
|
|
234
|
+
phone: 1,
|
|
235
|
+
_id: 1
|
|
236
|
+
}
|
|
203
237
|
}
|
|
204
238
|
],
|
|
205
239
|
as: "ownerUser"
|
|
@@ -207,19 +241,33 @@ function getOwnerUserLookupStage() {
|
|
|
207
241
|
};
|
|
208
242
|
}
|
|
209
243
|
|
|
210
|
-
|
|
211
244
|
function getOwnerOrganizationLookupStage() {
|
|
212
245
|
return {
|
|
213
246
|
$lookup: {
|
|
214
247
|
from: "organizations",
|
|
215
|
-
|
|
216
|
-
|
|
248
|
+
let: { ownerId: "$owner.target" },
|
|
249
|
+
pipeline: [
|
|
250
|
+
{
|
|
251
|
+
$match: {
|
|
252
|
+
$expr: { $eq: ["$_id", "$$ownerId"] }
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
$project: {
|
|
257
|
+
official: 1, // если нужно
|
|
258
|
+
owner: 1, // если нужно
|
|
259
|
+
profile: 1,
|
|
260
|
+
_id: 1
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
],
|
|
217
264
|
as: "ownerOrganization"
|
|
218
265
|
}
|
|
219
266
|
};
|
|
220
267
|
}
|
|
221
268
|
|
|
222
269
|
|
|
270
|
+
|
|
223
271
|
function getAddFieldsCreatorOwnerStage() {
|
|
224
272
|
return {
|
|
225
273
|
$addFields: {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
module.exports = function applyOwnershipSchema(schema,db) {
|
|
1
|
+
module.exports = function applyOwnershipSchema(schema, db) {
|
|
2
2
|
schema.add({
|
|
3
3
|
owner: {
|
|
4
4
|
type: {
|
|
5
5
|
type: String,
|
|
6
|
-
required: true
|
|
6
|
+
required: true,
|
|
7
|
+
enum: ['user', 'organization', 'platform']
|
|
7
8
|
},
|
|
8
9
|
target: {
|
|
9
10
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
10
11
|
refPath: 'owner.type',
|
|
11
|
-
required:
|
|
12
|
+
required: function() {
|
|
13
|
+
return this.owner.type !== 'platform';
|
|
14
|
+
}
|
|
12
15
|
},
|
|
13
16
|
},
|
|
14
17
|
creator: {
|
|
@@ -18,16 +21,18 @@ module.exports = function applyOwnershipSchema(schema,db) {
|
|
|
18
21
|
},
|
|
19
22
|
type: {
|
|
20
23
|
type: String,
|
|
21
|
-
required: true
|
|
24
|
+
required: true,
|
|
25
|
+
enum: ['user', 'organization', 'platform']
|
|
22
26
|
},
|
|
23
27
|
target: {
|
|
24
28
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
25
29
|
refPath: 'creator.type',
|
|
26
|
-
required:
|
|
30
|
+
required: function() {
|
|
31
|
+
return this.creator.type !== 'platform';
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
|
-
|
|
31
36
|
schema.index({
|
|
32
37
|
'owner.target': 1,
|
|
33
38
|
'creator.target': 1
|
|
@@ -22,60 +22,21 @@
|
|
|
22
22
|
<SearchForm @search="handleSearch" placeholder="Search music..." />
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
|
-
<div class="music-user-menu pos-relative">
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
>
|
|
33
|
-
<span v-if="user && user.profile" class="t-nowrap t-medium t-truncate w-max-10r mn-r-thin">{{ user.profile.name }}</span>
|
|
34
|
-
<IconProfile class="i-medium" fill="rgb(var(--white))"/>
|
|
35
|
-
</Button>
|
|
25
|
+
<div class="music-user-menu flex-nowrap flex pos-relative">
|
|
26
|
+
|
|
27
|
+
<router-link :to="{ name: 'music-library' }" class="t-white pd-thin w-100 d-block hover-bg-dark radius-small">
|
|
28
|
+
My Library
|
|
29
|
+
</router-link>
|
|
30
|
+
<router-link :to="{ name: 'music-upload' }" class="t-white pd-thin w-100 d-block hover-bg-dark radius-small">
|
|
31
|
+
Upload Music
|
|
32
|
+
</router-link>
|
|
36
33
|
|
|
37
|
-
<!-- User dropdown menu -->
|
|
38
|
-
<Dropdown
|
|
39
|
-
v-if="showUserMenu"
|
|
40
|
-
class="pos-absolute pos-t-100 pos-r-0 mn-t-thin pd-small bg-dark radius-small z-index-5"
|
|
41
|
-
:align="'right'"
|
|
42
|
-
>
|
|
43
|
-
<ul class="w-max-15r">
|
|
44
|
-
<li class="mn-b-thin w-100">
|
|
45
|
-
<router-link :to="{ name: 'music-library' }" class="t-white pd-thin w-100 d-block hover-bg-dark-medium radius-small">
|
|
46
|
-
My Library
|
|
47
|
-
</router-link>
|
|
48
|
-
</li>
|
|
49
|
-
<li class="mn-b-thin w-100">
|
|
50
|
-
<router-link :to="{ name: 'music-upload' }" class="t-white pd-thin w-100 d-block hover-bg-dark-medium radius-small">
|
|
51
|
-
Upload Music
|
|
52
|
-
</router-link>
|
|
53
|
-
</li>
|
|
54
|
-
<li class="w-100">
|
|
55
|
-
<button @click="logout" class="t-white bg-transparent border-none w-100 t-left pd-thin hover-bg-dark-medium radius-small cursor-pointer">
|
|
56
|
-
Logout
|
|
57
|
-
</button>
|
|
58
|
-
</li>
|
|
59
|
-
</ul>
|
|
60
|
-
</Dropdown>
|
|
61
|
-
|
|
62
|
-
<Button
|
|
63
|
-
v-else
|
|
64
|
-
@click="login"
|
|
65
|
-
class="bg-main radius-extra pd-small t-white hover-scale-1"
|
|
66
|
-
:showLoader="false"
|
|
67
|
-
:showSucces="false"
|
|
68
|
-
>
|
|
69
|
-
Login
|
|
70
|
-
</Button>
|
|
71
34
|
</div>
|
|
72
35
|
</header>
|
|
73
36
|
|
|
74
37
|
<!-- Main Content Area -->
|
|
75
|
-
<main class="
|
|
76
|
-
<
|
|
77
|
-
<router-view></router-view>
|
|
78
|
-
</div>
|
|
38
|
+
<main class="o-y-scroll o-x-hidden">
|
|
39
|
+
<router-view></router-view>
|
|
79
40
|
</main>
|
|
80
41
|
|
|
81
42
|
<!-- Music Player Fixed at Bottom -->
|
|
@@ -125,13 +86,4 @@ const handleSearch = (query) => {
|
|
|
125
86
|
router.push({ name: 'music-search', query: { q: query } });
|
|
126
87
|
};
|
|
127
88
|
|
|
128
|
-
const login = () => {
|
|
129
|
-
router.push({ name: 'Sign In', query: { redirect: router.currentRoute.value.fullPath } });
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const logout = async () => {
|
|
133
|
-
await authActions.logout();
|
|
134
|
-
showUserMenu.value = false;
|
|
135
|
-
router.push({ name: 'music-home' });
|
|
136
|
-
};
|
|
137
89
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- components/pages/MusicHome.vue -->
|
|
2
2
|
<template>
|
|
3
|
-
<div class="music-home-page">
|
|
3
|
+
<div class="music-home-page pd-medium mobile:pd-thin">
|
|
4
4
|
<!-- Hero Section -->
|
|
5
5
|
<section class="bg-gradient-dark pd-medium radius-medium mn-b-medium">
|
|
6
6
|
<h1 class="t-white mn-b-small">Welcome to Music</h1>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<!-- Featured Playlists Section -->
|
|
11
11
|
<section class="mn-b-medium">
|
|
12
12
|
<div class="flex-between flex mn-b-small">
|
|
13
|
-
<h2 class="
|
|
13
|
+
<h2 class="">Featured Playlists</h2>
|
|
14
14
|
<router-link :to="{ path: '/music/playlists' }" class="t-main t-small hover-opacity">See all</router-link>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<!-- New Releases Section -->
|
|
40
40
|
<section class="mn-b-medium">
|
|
41
41
|
<div class="flex-between flex mn-b-small">
|
|
42
|
-
<h2 class="
|
|
42
|
+
<h2 class="">New Releases</h2>
|
|
43
43
|
<router-link :to="{ path: '/music/albums' }" class="t-main t-small hover-opacity">See all</router-link>
|
|
44
44
|
</div>
|
|
45
45
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
<!-- Popular Tracks Section -->
|
|
69
69
|
<section class="mn-b-medium">
|
|
70
70
|
<div class="flex-between flex mn-b-small">
|
|
71
|
-
<h2 class="
|
|
71
|
+
<h2 class="">Popular Tracks</h2>
|
|
72
72
|
<router-link :to="{ path: '/music/tracks' }" class="t-main t-small hover-opacity">See all</router-link>
|
|
73
73
|
</div>
|
|
74
74
|
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
<!-- Top Artists Section -->
|
|
99
99
|
<section>
|
|
100
100
|
<div class="flex-between flex mn-b-small">
|
|
101
|
-
<h2 class="
|
|
101
|
+
<h2 class="">Top Artists</h2>
|
|
102
102
|
<router-link :to="{ path: '/music/artists' }" class="t-main t-small hover-opacity">See all</router-link>
|
|
103
103
|
</div>
|
|
104
104
|
|
|
@@ -4,17 +4,27 @@
|
|
|
4
4
|
|
|
5
5
|
<!-- Ask to login -->
|
|
6
6
|
<AskToLogin class="mn-b-thin" v-if="auth.state.access.status === false" />
|
|
7
|
+
|
|
8
|
+
<!-- Empty State -->
|
|
9
|
+
<EmptyState
|
|
10
|
+
v-if="shopcart.state.positions < 1"
|
|
11
|
+
/>
|
|
12
|
+
<Succes
|
|
13
|
+
v-if="order.status === true && shopcart.state.positions.length > 0"
|
|
14
|
+
:order="order"
|
|
15
|
+
/>
|
|
16
|
+
<!-- Уведомления о минимальной сумме заказа и времени работы -->
|
|
17
|
+
<div v-if="shopcart.state.positions.length > 0 && orders.state.current.status !== true" class="w-100 gap-thin cols-1 mn-b-thin">
|
|
18
|
+
<div v-if="!isOpen" class="bg-fifth-nano pd-small radius-medium t-center">
|
|
19
|
+
<p class="t-fourth">⚠️ This spot is currently closed. You can place an order, but it will be processed when the spot opens.</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div v-if="cartTotalPrice < minOrderAmount" class="bg-fourth-nano pd-small radius-medium t-center">
|
|
22
|
+
<p class="t-fourth">⚠️ Minimum order amount is {{ formatPrice(minOrderAmount) }}. Your current total is {{ formatPrice(cartTotalPrice) }}.</p>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
7
26
|
<!-- Order form -->
|
|
8
27
|
<div class="gap-small mn-b-thin cols-2">
|
|
9
|
-
<!-- Empty State -->
|
|
10
|
-
<EmptyState
|
|
11
|
-
v-if="shopcart.state.positions < 1"
|
|
12
|
-
/>
|
|
13
|
-
|
|
14
|
-
<Succes
|
|
15
|
-
v-if="order.status === true && shopcart.state.positions.length > 0"
|
|
16
|
-
:order="order"
|
|
17
|
-
/>
|
|
18
28
|
<!-- Order Form -->
|
|
19
29
|
<div
|
|
20
30
|
v-if="orders.state.current.status !== true && shopcart.state.positions.length > 0"
|
|
@@ -84,6 +94,7 @@
|
|
|
84
94
|
|| errorDelivery
|
|
85
95
|
|| errorPayment
|
|
86
96
|
|| isLocationLoading
|
|
97
|
+
|| cartTotalPrice < minOrderAmount
|
|
87
98
|
"
|
|
88
99
|
>
|
|
89
100
|
<span>Place an Order</span>
|
|
@@ -147,7 +158,7 @@ const isLocationLoading = ref(false)
|
|
|
147
158
|
// Accessing router and store
|
|
148
159
|
const route = useRoute()
|
|
149
160
|
const router = useRouter()
|
|
150
|
-
const { returnCurrency } = useGlobalMixins()
|
|
161
|
+
const { returnCurrency, formatPrice } = useGlobalMixins()
|
|
151
162
|
// COMPUTED
|
|
152
163
|
const order = computed(() => orders.state.current)
|
|
153
164
|
const user = computed(() => users.state.current)
|
|
@@ -164,6 +175,58 @@ const deliveryCost = computed(() => {
|
|
|
164
175
|
|
|
165
176
|
// Organization
|
|
166
177
|
const orderOrganization = ref({})
|
|
178
|
+
const spotOrganization = ref({})
|
|
179
|
+
const isOpen = ref(true)
|
|
180
|
+
|
|
181
|
+
// Новые переменные для проверки минимальной суммы заказа и времени работы
|
|
182
|
+
const minOrderAmount = ref(0)
|
|
183
|
+
|
|
184
|
+
function checkIsOpenNow(worktime) {
|
|
185
|
+
try {
|
|
186
|
+
console.log('[checkIsOpenNow] worktime:', worktime);
|
|
187
|
+
|
|
188
|
+
if (
|
|
189
|
+
!worktime ||
|
|
190
|
+
typeof worktime !== 'object' ||
|
|
191
|
+
Array.isArray(worktime) ||
|
|
192
|
+
!worktime.regular
|
|
193
|
+
) {
|
|
194
|
+
console.log('[checkIsOpenNow] invalid, returning true');
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const now = new Date();
|
|
199
|
+
const currentDay = now.getDay();
|
|
200
|
+
const currentTime = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
|
201
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
202
|
+
|
|
203
|
+
console.log('[checkIsOpenNow] currentDay:', currentDay);
|
|
204
|
+
console.log('[checkIsOpenNow] currentTime:', currentTime);
|
|
205
|
+
|
|
206
|
+
const specialDay = worktime.special?.find(s => {
|
|
207
|
+
const d = new Date(s.date);
|
|
208
|
+
return (
|
|
209
|
+
d.getFullYear() === today.getFullYear() &&
|
|
210
|
+
d.getMonth() === today.getMonth() &&
|
|
211
|
+
d.getDate() === today.getDate()
|
|
212
|
+
);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
if (specialDay) {
|
|
216
|
+
console.log('[checkIsOpenNow] specialDay:', specialDay);
|
|
217
|
+
if (!specialDay.isOpen) return false;
|
|
218
|
+
return specialDay.periods?.some(p => p.open <= currentTime && p.close > currentTime);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const regularDay = worktime.regular.find(d => d.dayOfWeek === currentDay);
|
|
222
|
+
if (!regularDay || !regularDay.isOpen) return false;
|
|
223
|
+
|
|
224
|
+
return regularDay.periods?.some(p => p.open <= currentTime && p.close > currentTime);
|
|
225
|
+
} catch (err) {
|
|
226
|
+
console.error('[checkIsOpenNow] error:', err);
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
167
230
|
|
|
168
231
|
|
|
169
232
|
if (!globals.state.options.orders.allowUnauthenticatedOrders && !auth.state.user._id) {
|
|
@@ -185,13 +248,23 @@ onMounted(async()=> {
|
|
|
185
248
|
orders.state.current.customer.phone = users.state.current.phone
|
|
186
249
|
orders.state.current.customer.phone = users.state.current.phone
|
|
187
250
|
}
|
|
188
|
-
|
|
251
|
+
|
|
189
252
|
orderOrganization.value = await organizations.actions.read({
|
|
190
253
|
_id: shopcart.state.organization,
|
|
191
254
|
location: globals.state.position?.location,
|
|
192
255
|
lookup: ['spots']
|
|
193
256
|
})
|
|
194
257
|
|
|
258
|
+
// Получаем информацию о минимальной сумме заказа и времени работы из spot
|
|
259
|
+
if (orderOrganization.value && orderOrganization.value[0]?.spots?.length > 0) {
|
|
260
|
+
spotOrganization.value = orderOrganization.value[0].spots[0];
|
|
261
|
+
isOpen.value = checkIsOpenNow(spotOrganization.value.worktime);
|
|
262
|
+
console.log(spotOrganization.value)
|
|
263
|
+
minOrderAmount.value = spotOrganization.value || 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
195
268
|
isLocationLoading.value = false
|
|
196
269
|
emits('page-loaded');
|
|
197
270
|
|
|
@@ -225,7 +298,7 @@ watch(
|
|
|
225
298
|
location: newVal.location,
|
|
226
299
|
lookup: ['spots']
|
|
227
300
|
})
|
|
228
|
-
|
|
301
|
+
|
|
229
302
|
isLocationLoading.value = false
|
|
230
303
|
}
|
|
231
304
|
},
|
|
@@ -370,6 +370,9 @@ const controllerFactory = (db) => {
|
|
|
370
370
|
console.log('notifiocatio data', JSON.stringify(notificationData))
|
|
371
371
|
|
|
372
372
|
// Send notification using the notification service
|
|
373
|
+
|
|
374
|
+
console.log('notification api is', `${process.env.API_URL || ''}/api/notifications`)
|
|
375
|
+
|
|
373
376
|
const notificationResponse = await fetch(`${process.env.API_URL || ''}/api/notifications`, {
|
|
374
377
|
method: 'POST',
|
|
375
378
|
headers: {
|
|
@@ -160,6 +160,7 @@ const actions = {
|
|
|
160
160
|
org_id: organization, // Добавляем _id организации к каждому продукту
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
+
state.organization = organization
|
|
163
164
|
|
|
164
165
|
// Обновляем объект корзины в localStorage, включая _id организации
|
|
165
166
|
localStorage.setItem('shopcart', JSON.stringify({
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
const accessesSchema = {
|
|
2
|
+
categories: {
|
|
3
|
+
create: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
default: false,
|
|
6
|
+
},
|
|
7
|
+
read: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
edit: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
delete: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
2
20
|
rents: {
|
|
3
21
|
create: {
|
|
4
22
|
type: Boolean,
|