@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.
Files changed (134) hide show
  1. package/dist/{Media-DW8RLbfM.js → Media-_vz04tII.js} +1 -1
  2. package/dist/{Media-y_TX6us_.mjs → Media-sGk7Bp9b.mjs} +1 -1
  3. package/dist/auth.server.js +6 -2
  4. package/dist/auth.server.mjs +6 -2
  5. package/dist/authJwt-CELQKF2s.js +82 -0
  6. package/dist/authJwt-DnXu3BFq.mjs +83 -0
  7. package/dist/builder.js +7 -4
  8. package/dist/builder.mjs +7 -4
  9. package/dist/chats.server.js +1 -1
  10. package/dist/chats.server.mjs +1 -1
  11. package/dist/community.server.js +4 -4
  12. package/dist/community.server.mjs +4 -4
  13. package/dist/events.server.js +4 -4
  14. package/dist/events.server.mjs +4 -4
  15. package/dist/files.server.js +1 -1
  16. package/dist/files.server.mjs +1 -1
  17. package/dist/gallery.server.js +3 -3
  18. package/dist/gallery.server.mjs +3 -3
  19. package/dist/{globals.abac-DT0VjfaZ.js → globals.abac-Bn-4tbX8.js} +110 -16
  20. package/dist/{globals.abac-CvmZM8XG.mjs → globals.abac-DZpTRxKR.mjs} +110 -16
  21. package/dist/globals.server.js +70 -10
  22. package/dist/globals.server.mjs +70 -10
  23. package/dist/{globals.verifier-C_VZYebB.mjs → globals.verifier-BdJxc8-8.mjs} +34 -0
  24. package/dist/{globals.verifier-ChDpCdy_.js → globals.verifier-CKYpYfQl.js} +34 -0
  25. package/dist/{index-CVXl1rB5.js → index-BOmxJQ5W.js} +7 -86
  26. package/dist/{index-Df8vtZx7.mjs → index-C_Fw0Umg.mjs} +7 -86
  27. package/dist/{main-CgmHzhq5.mjs → main-CqMtW7Hq.mjs} +274 -276
  28. package/dist/{main-CCfQH-Dd.js → main-CsGkbSyK.js} +2 -2
  29. package/dist/martyrs/src/components/Select/Select.vue.cjs +4 -4
  30. package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
  31. package/dist/martyrs/src/components/Select/Select.vue.js +4 -4
  32. package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
  33. package/dist/martyrs/src/modules/community/community.client.js +27 -27
  34. package/dist/martyrs/src/modules/community/community.client.js.map +1 -1
  35. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +2 -3
  36. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs.map +1 -1
  37. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +2 -3
  38. package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js.map +1 -1
  39. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +88 -27
  40. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
  41. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +89 -28
  42. package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
  43. package/dist/martyrs/src/modules/orders/store/shopcart.cjs +1 -0
  44. package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
  45. package/dist/martyrs/src/modules/orders/store/shopcart.js +1 -0
  46. package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
  47. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +19 -0
  48. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
  49. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +19 -0
  50. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
  51. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -0
  52. package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
  53. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -0
  54. package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
  55. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
  56. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
  57. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
  58. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
  59. package/dist/martyrs/src/modules/products/store/categories.cjs +2 -0
  60. package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
  61. package/dist/martyrs/src/modules/products/store/categories.js +2 -0
  62. package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
  63. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +30 -24
  64. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs.map +1 -1
  65. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +30 -24
  66. package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js.map +1 -1
  67. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +807 -0
  68. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs.map +1 -0
  69. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +807 -0
  70. package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js.map +1 -0
  71. package/dist/martyrs/src/modules/spots/store/spots.cjs +4 -1
  72. package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
  73. package/dist/martyrs/src/modules/spots/store/spots.js +4 -1
  74. package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
  75. package/dist/martyrs.cjs.js +1 -1
  76. package/dist/martyrs.css +1 -1
  77. package/dist/martyrs.es.js +1 -1
  78. package/dist/notifications.server.js +1 -1
  79. package/dist/notifications.server.mjs +1 -1
  80. package/dist/orders.server.js +5 -4
  81. package/dist/orders.server.mjs +5 -4
  82. package/dist/organizations.server.js +120 -47
  83. package/dist/organizations.server.mjs +120 -47
  84. package/dist/{ownership.schema-C0w02Vw1.mjs → ownership.schema-CNCotD3D.mjs} +10 -4
  85. package/dist/{ownership.schema-Ck2H9clB.js → ownership.schema-MxfJlPtq.js} +10 -4
  86. package/dist/products.server.js +415 -149
  87. package/dist/products.server.mjs +415 -149
  88. package/dist/{profile.schema-h61hhB2w.js → profile.schema-BLSuV_VC.js} +0 -4
  89. package/dist/{profile.schema-kP_zKXNt.mjs → profile.schema-BRuvQ7QV.mjs} +0 -4
  90. package/dist/{queryProcessor-CWnMIe2U.mjs → queryProcessor-CVKI651_.mjs} +62 -8
  91. package/dist/{queryProcessor-D6GuKfTV.js → queryProcessor-DSUqSk3I.js} +62 -8
  92. package/dist/rents.server.js +4 -4
  93. package/dist/rents.server.mjs +4 -4
  94. package/dist/spots.server.js +162 -8
  95. package/dist/spots.server.mjs +162 -8
  96. package/dist/style.css +27 -4
  97. package/dist/wallet.server.js +2 -2
  98. package/dist/wallet.server.mjs +2 -2
  99. package/package.json +1 -1
  100. package/src/builder/rspack/rspack.config.base.js +1 -1
  101. package/src/builder/rspack/rspack.config.client.js +13 -5
  102. package/src/components/Select/Select.vue +4 -2
  103. package/src/modules/auth/models/user.model.js +4 -1
  104. package/src/modules/community/components/sections/HotPosts.vue +1 -1
  105. package/src/modules/globals/controllers/classes/globals.abac.js +148 -23
  106. package/src/modules/globals/controllers/classes/globals.validator.js +37 -0
  107. package/src/modules/globals/controllers/classes/globals.verifier.js +2 -0
  108. package/src/modules/globals/controllers/policies/globals.policies.js +91 -74
  109. package/src/modules/globals/controllers/utils/queryProcessor.js +59 -11
  110. package/src/modules/globals/models/schemas/ownership.schema.js +11 -6
  111. package/src/modules/globals/models/schemas/profile.schema.js +0 -4
  112. package/src/modules/music/components/layouts/MusicLayout.vue +10 -58
  113. package/src/modules/music/components/pages/MusicHome.vue +5 -5
  114. package/src/modules/orders/components/pages/OrderCreate.vue +85 -12
  115. package/src/modules/orders/controllers/orders.controller.js +3 -0
  116. package/src/modules/orders/store/shopcart.js +1 -0
  117. package/src/modules/organizations/models/schemas/accesses.schema.js +18 -0
  118. package/src/modules/organizations/policies/organizations.policies.js +117 -61
  119. package/src/modules/products/components/pages/CategoryEdit.vue +27 -2
  120. package/src/modules/products/components/pages/Product.vue +1 -0
  121. package/src/modules/products/components/pages/ProductEdit.vue +2 -2
  122. package/src/modules/products/controllers/categories.controller.js +297 -133
  123. package/src/modules/products/middlewares/categories.verifier.js +177 -0
  124. package/src/modules/products/models/category.model.js +12 -14
  125. package/src/modules/products/routes/categories.routes.js +50 -11
  126. package/src/modules/products/store/categories.js +2 -0
  127. package/src/modules/spots/components/pages/SpotEdit.vue +21 -17
  128. package/src/modules/spots/components/sections/WorktimeEdit.vue +840 -0
  129. package/src/modules/spots/controllers/queries/getIsOpenNowStage.js +109 -0
  130. package/src/modules/spots/controllers/spots.controller.js +2 -1
  131. package/src/modules/spots/models/spot.model.js +59 -13
  132. package/src/modules/spots/store/spots.js +4 -1
  133. package/src/modules/products/middlewares/index.js +0 -11
  134. package/src/modules/products/middlewares/verifyCategory.js +0 -25
@@ -155,7 +155,11 @@ function getCreatorUserLookupStage() {
155
155
  }
156
156
  },
157
157
  {
158
- $project: { password: 0 }
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
- localField: "creator.target",
172
- foreignField: "_id",
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
- localField: "creator.target",
183
- foreignField: "_id",
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: { password: 0 }
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
- localField: "owner.target",
216
- foreignField: "_id",
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: true,
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: true,
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
@@ -13,10 +13,6 @@ module.exports = function applyProfileSchema(schema,db) {
13
13
  type: String,
14
14
  default: null
15
15
  },
16
- birthday: {
17
- type: Date,
18
- default: null
19
- }
20
16
  },
21
17
  })
22
18
  }
@@ -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
- <Button
27
- v-if="isAuthenticated"
28
- @click="showUserMenu = !showUserMenu"
29
- class="bg-black radius-extra flex-v-center flex pd-thin hover-bg-dark"
30
- :showLoader="false"
31
- :showSucces="false"
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="flex-child-1 o-y-scroll o-x-hidden bg-black-transp-95">
76
- <div class="mn-small">
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="t-white">Featured Playlists</h2>
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="t-white">New Releases</h2>
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="t-white">Popular Tracks</h2>
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="t-white">Top Artists</h2>
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,