@ozdao/prometheus-framework 0.2.40 → 0.2.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/dist/main.css +1 -1
  2. package/dist/prometheus-framework.cjs.js +19 -19
  3. package/dist/prometheus-framework.es.js +501 -515
  4. package/package.json +1 -1
  5. package/src/components/Countdown/Countdown.vue +4 -3
  6. package/src/components/Header/Header.vue +2 -0
  7. package/src/modules/community/components/layouts/Community.vue +2 -2
  8. package/src/modules/community/components/pages/CreateBlogPost.vue +1 -0
  9. package/src/modules/constructor/components/sections/Constructor.vue +1 -1
  10. package/src/modules/events/components/pages/EditEvent.vue +48 -3
  11. package/src/modules/events/components/pages/Event.vue +16 -8
  12. package/src/modules/events/components/sections/HeroEvent.vue +32 -28
  13. package/src/modules/events/components/sections/SectionMainGuest.vue +3 -2
  14. package/src/modules/events/components/sections/SectionPreviousEvents.vue +22 -15
  15. package/src/modules/events/models/event.model.js +9 -0
  16. package/src/modules/files/middlewares/server/middlewareBusboy.js +13 -2
  17. package/src/modules/marketplace/components/layouts/Marketplace.vue +1 -1
  18. package/src/modules/orders/store/shopcart.js +21 -5
  19. package/src/modules/payments/controller/payments.controller.js +54 -200
  20. package/src/modules/payments/controller/payments.tinkoff.controller.js +242 -0
  21. package/src/modules/payments/models/payment.model.js +22 -0
  22. package/src/modules/payments/routes/payments.routes.js +4 -25
  23. package/src/modules/payments/routes/payments.tinkoff.routes.js +58 -0
  24. package/src/modules/products/components/pages/Product.vue +3 -1
  25. package/src/modules/products/components/sections/SectionProduct.vue +3 -0
  26. package/src/modules/products/controllers/products.controller.js +188 -109
  27. package/src/modules/products/models/product.model.js +1 -0
  28. package/src/modules/wallet/components/pages/Wallet.vue +73 -88
  29. package/src/modules/wallet/controllers/crypto.controller.js +79 -0
  30. package/src/modules/wallet/models/wallet.model.js +27 -0
  31. /package/src/modules/{orders/models/payment.model.js → payments/models/payment.tinkoff.model.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/prometheus-framework",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
4
4
  "description": "Web3 Framework focused on user experience and ease of development.",
5
5
  "author": "OZ DAO <hello@ozdao.dev>",
6
6
  "license": "GPL-3.0-or-later",
@@ -27,11 +27,10 @@
27
27
  import { ref, onMounted, onBeforeUnmount } from 'vue';
28
28
 
29
29
  const props = defineProps([
30
- 'content',
31
- 'options'
30
+ 'date',
32
31
  ])
33
32
 
34
- const targetDate = new Date(props.options?.date || 'January 13, 2024 16:00:00').getTime();
33
+ const targetDate = new Date(props.date).getTime();
35
34
  const currentDate = ref(new Date().getTime());
36
35
 
37
36
  let interval;
@@ -62,6 +61,8 @@ const calculateTime = () => {
62
61
  }
63
62
  };
64
63
 
64
+ calculateTime();
65
+
65
66
  onMounted(() => {
66
67
  interval = setInterval(() => {
67
68
  currentDate.value = new Date().getTime();
@@ -61,6 +61,8 @@
61
61
  <Button
62
62
  :submit="a => store.shopcart.actions.toggleShopcart()"
63
63
  :counter="store.shopcart.getters.cartTotalAmount"
64
+ :showSucces="false"
65
+ :showLoader="false"
64
66
  class="pd-zero mn-l-auto"
65
67
  >
66
68
  <IconShopcart class="i-semi"/>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div style="grid-template-columns: 1fr 3fr 1fr;" class="cols-3 gap-thin pd-thin">
2
+ <div style="grid-template-columns: 2fr 4fr 2fr;" class="cols-3 gap-thin pd-thin">
3
3
 
4
4
  <ul class="align-self-start pos-sticky pos-t-0 w-100 bg-grey radius-big pd-medium p-medium gap-thin flex-column flex-nowrap flex">
5
5
  <li
@@ -81,7 +81,7 @@
81
81
 
82
82
  </section>
83
83
 
84
- <div class="bg-grey radius-big pd-medium">
84
+ <div class="align-self-start bg-grey radius-big pd-medium">
85
85
  <div class="gap-thin flex-nowrap flex">
86
86
  <p class="t-medium mn-b-small">Popular Communities</p>
87
87
 
@@ -13,6 +13,7 @@
13
13
  <Textarea
14
14
  v-if="post"
15
15
  :prop="post"
16
+ :setFocus="true"
16
17
  content="name"
17
18
  placeholder="Enter post title"
18
19
  class="h2"
@@ -143,7 +143,7 @@ function handleAddBlock(type = 'Textarea', content = '', index, data) {
143
143
  class: '',
144
144
  content: content,
145
145
  blocks: [],
146
- setFocus: true,
146
+ setFocus: false,
147
147
  };
148
148
 
149
149
  if (data && data.blocks && Array.isArray(data.blocks)) {
@@ -113,6 +113,18 @@
113
113
  class="mn-b-thin w-100 bg-grey pd-medium radius-small"
114
114
  />
115
115
 
116
+ <Field
117
+ v-model:field="event.specialData.ticketText"
118
+ placeholder="Promotion text for ticket in hero "
119
+ class="w-100 bg-grey radius-small pd-medium"
120
+ />
121
+
122
+ <Field
123
+ v-model:field="event.specialData.ticketTextButton"
124
+ placeholder="Text on 'Buy Ticket' button "
125
+ class="w-100 bg-grey radius-small pd-medium"
126
+ />
127
+
116
128
 
117
129
  </div>
118
130
  </div>
@@ -175,6 +187,12 @@
175
187
  placeholder="Link to Main guest spotify track"
176
188
  class="mn-b-thin w-100 bg-grey pd-medium radius-small"
177
189
  />
190
+
191
+ <Field
192
+ v-model:field="event.specialData.guestYoutube"
193
+ placeholder="Link to Main guest youtube video"
194
+ class="mn-b-thin w-100 bg-grey pd-medium radius-small"
195
+ />
178
196
  </div>
179
197
 
180
198
  <h5
@@ -295,12 +313,41 @@
295
313
  "
296
314
  />
297
315
 
298
- <h5
316
+ <hr class="bg-black-transp-10 mn-b-semi mn-t-semi d-block">
317
+
318
+ <h4
319
+ class="mn-b-thin"
320
+ >
321
+ Previous Party Section
322
+ </h4>
323
+
324
+ <h5
299
325
  class="mn-b-thin"
300
326
  >
301
327
  Video in Previous Partys Section
302
328
  </h5>
303
329
 
330
+ <Field
331
+ v-model:field="event.specialData.previousTitle"
332
+ placeholder="Name"
333
+ class="w-100 bg-grey radius-small pd-medium"
334
+ />
335
+ <Field
336
+ v-model:field="event.specialData.previousDescription"
337
+ placeholder="Name"
338
+ class="w-100 bg-grey radius-small pd-medium"
339
+ />
340
+ <Field
341
+ v-model:field="event.specialData.previousLink"
342
+ placeholder="Name"
343
+ class="w-100 bg-grey radius-small pd-medium"
344
+ />
345
+ <Field
346
+ v-model:field="event.specialData.previousLinkText"
347
+ placeholder="Name"
348
+ class="w-100 bg-grey radius-small pd-medium"
349
+ />
350
+
304
351
  <Upload
305
352
  v-model:field="event.specialData.previousVideo"
306
353
  :placeholder="'Upload image'"
@@ -311,8 +358,6 @@
311
358
  mn-b-thin w-100 bg-grey pd-medium radius-small t-black
312
359
  "
313
360
  />
314
-
315
-
316
361
  </div>
317
362
 
318
363
  <h3 class="mn-b-small">Date</h3>
@@ -26,11 +26,12 @@
26
26
  title: event.name,
27
27
  description: event.description,
28
28
  ticketLinkStripe: event.specialData.ticketLinkStripe,
29
+ ticketText: event.specialData.ticketText,
30
+ cover: event.cover,
29
31
  subtitle: event.specialData.subtitle,
30
32
  logos: event.specialData.logos,
31
33
  video: event.specialData.video,
32
- buyticket: 'Buy ticket',
33
- booktable: 'Book table'
34
+ ticketTextButton: event.specialData.ticketTextButton,
34
35
  }"
35
36
  :options="{
36
37
  date: event.date.start,
@@ -52,15 +53,15 @@
52
53
  video: event.specialData.guestVideo,
53
54
  spotify: event.specialData.guestSpotify,
54
55
  soundcloud: event.specialData.guestSoundcloud,
56
+ youtube: event.specialData.guestYoutube
55
57
  }"
56
58
  class="mn-b-thin"
57
59
  />
58
-
59
60
  <section
60
61
  v-if="!isLoading && event && event.special"
61
62
  :style="`
62
- background-image: url(${event.specialData.lineupBackground});
63
63
  background-size: 100%; background-repeat: no-repeat;
64
+ background-image: url(${event.specialData.lineupBackground});
64
65
  `"
65
66
  class="mn-b-thin t-white gap-big w-100 h-max o-hidden radius-big pd-big pos-relative bg-black"
66
67
  >
@@ -68,13 +69,13 @@
68
69
  <div
69
70
  class="gap-big mn-b-thin"
70
71
  :class="{
71
- 'cols-2': event.specialData.guests.lenght > 0,
72
- 'cols-1': event.specialData.guests.lenght > 1
72
+ 'cols-2': event.specialData.guests.length > 0,
73
+ 'cols-1': event.specialData.guests.length > 1
73
74
  }"
74
75
  >
75
76
 
76
77
  <SectionSpecialGuests
77
- v-if="event.specialData.guests.lenght > 0"
78
+ v-if="event.specialData.guests.length > 0"
78
79
  :content="{
79
80
  title: 'Special Guests',
80
81
  guests: event.specialData.guests
@@ -92,7 +93,14 @@
92
93
 
93
94
  <SectionPreviousEvents
94
95
  :content="{
95
- ticket: event.specialData.ticketImage
96
+ ticket: event.specialData.ticketImage,
97
+ ticketTextButton: event.specialData.ticketTextButton,
98
+ paymentText: event.specialData.paymentText,
99
+ paymentContact: event.specialData.paymentContact,
100
+ previousTitle: event.specialData.previousTitle,
101
+ previousDescription: event.specialData.previousDescription,
102
+ previousLink: event.specialData.previousLink,
103
+ previousLinkText: event.specialData.previousLinkText,
96
104
  }"
97
105
  :options="{
98
106
  link: event.specialData.ticketLinkStripe,
@@ -4,7 +4,6 @@
4
4
  t-white
5
5
  t-center
6
6
  w-100
7
- h-100
8
7
  pos-relative
9
8
  gap-thin
10
9
  cols-2
@@ -15,6 +14,9 @@
15
14
  style="min-height: 20rem;"
16
15
  class="desktop-only radius-big o-hidden bg-black pos-relative"
17
16
  >
17
+
18
+ <img v-if="content.cover && !content.video" :src="content.cover" class="desktop-only object-fit-cover pos-absolute z-index-0 pos-t-0 pos-l-0 w-100 h-100">
19
+
18
20
  <video
19
21
  v-if="content.video"
20
22
  style="object-fit: cover;"
@@ -36,7 +38,7 @@
36
38
  pd-big mn-r-auto mn-l-auto t-white flex-h-center flex-column o-hidden flex-v-start t-left flex w-100 h-100 gap-zero">
37
39
  <!-- <img src="/logo/jungle-stereo-cosmonaut.png" class="h-8r mn-b-small z-index-1"/> -->
38
40
  <div class="mn-b-big z-index-1 flex-nowrap flex gap-small">
39
- <img v-for="logo in content.logos" class="i-big" :src="logo">
41
+ <img v-for="logo in content.logos" class="radius-thin i-big" :src="logo">
40
42
  </div>
41
43
 
42
44
  <h3 class="pd-thin z-index-1 w-max br-solid br-2px br-white radius-extra mn-b-thin">
@@ -51,25 +53,32 @@
51
53
  {{content?.description}}
52
54
  </p>
53
55
 
54
- <p class="z-index-1 t-transp p-small mn-b-thin">
55
-
56
- Hurry up and purchase your ticket at a special price of only <span class="bg-white t-black pd-t-nano pd-b-nano pd-r-micro pd-l-micro radius-extra">{{options?.price}} {{returnCurrency()}}</span>
56
+ <p class="z-index-1 t-transp p-small mn-b-thin">
57
+ <span>
58
+ {{content?.ticketText }}
59
+ </span>
60
+
61
+ <span v-if="options?.price" class="bg-white t-black pd-t-nano pd-b-nano pd-r-micro pd-l-micro radius-extra">
62
+ {{options?.price}} {{returnCurrency()}}
63
+ </span>
57
64
  </p>
58
65
 
59
66
 
67
+
60
68
  <Countdown
61
- class="z-index-1 mn-b-small w-40"
62
- :options="props.options"
69
+ v-if="options.date"
70
+ class="z-index-1 mn-t-medium w-100 w-max-30r"
71
+ :date="options.date"
63
72
  />
73
+
64
74
  <div v-if="content?.ticketLinkStripe" class="z-index-1 mn-t-medium mn-b-small flex-nowrap flex gap-thin">
65
- <!-- <a href="#" class="pd-l-medium pd-r-medium pd-t-small pd-b-small radius-extra uppercase t-medium t-black bg-white ">
66
- Sold Out
67
- </a> -->
68
75
  <a href="#" @click="clickBuyTicket()" class="pd-l-medium pd-r-medium pd-t-small pd-b-small radius-extra uppercase t-medium t-black bg-white ">
69
- {{content?.buyticket}}
76
+ {{content?.ticketTextButton || 'Buy Ticket' }}
70
77
  </a>
71
78
  </div>
72
79
 
80
+ <img style="object-fit: cover; opacity: 0.2;" v-if="content.cover && !content.video" :src="content.cover" class="mobile-only pos-absolute z-index-0 pos-t-0 pos-l-0 w-100 h-100">
81
+
73
82
  <video
74
83
  v-if="content.video"
75
84
  style="object-fit: cover; opacity: 0.2;"
@@ -89,30 +98,36 @@
89
98
 
90
99
 
91
100
  <script setup>
101
+ import { ref, onMounted } from 'vue'
92
102
  import { useI18n } from 'vue-i18n'
93
103
 
94
104
  import Countdown from "@pf/src/components/Countdown/Countdown.vue"
95
105
 
96
- import { ref, onMounted } from 'vue'
106
+
107
+ const props = defineProps({
108
+ content: {
109
+ type: Object
110
+ },
111
+ options: {
112
+ type: Object
113
+ }
114
+ })
115
+
116
+
97
117
  const videoElement = ref(null)
98
118
 
99
119
  var isPlaying = false;
100
120
 
101
121
  function checkAndPlayVideo() {
102
- // Initializing values
103
-
104
- // On video playing toggle values
105
122
  videoElement.value.onplaying = function() {
106
123
  isPlaying = true;
107
124
  };
108
125
 
109
- // On video pause toggle values
110
126
  videoElement.value.onpause = function() {
111
127
  isPlaying = false;
112
128
  };
113
129
  }
114
130
 
115
- // Play video function
116
131
  async function playVid() {
117
132
  if (videoElement.value.paused && !isPlaying) {
118
133
  return videoElement.value.play();
@@ -124,17 +139,6 @@
124
139
  playVid()
125
140
  })
126
141
 
127
-
128
- const props = defineProps({
129
- content: {
130
- type: Object
131
- },
132
- options: {
133
- type: Object
134
- }
135
- })
136
-
137
-
138
142
  function clickBuyTicket () {
139
143
  gtag('event', 'buy_ticket', {
140
144
  'event_category': 'conversion',
@@ -11,11 +11,11 @@
11
11
  class="mn-b-semi"
12
12
  />
13
13
 
14
- <h2 class="mn-b-big">
14
+ <h2 class="mn-b-semi">
15
15
  {{content?.title}}
16
16
  </h2>
17
17
 
18
- <p class="p-medium" v-html="content?.description"/>
18
+ <p class="p-medium t-transp" v-html="content?.description"/>
19
19
  <slot></slot>
20
20
  <iframe class="radius-big o-hidden mn-t-medium" v-if="content?.soundcloud" width="100%" height="200" scrolling="no" frameborder="no" allow="autoplay"
21
21
  :src="`https://w.soundcloud.com/player/?url=https%3A//soundcloud.com/${content.soundcloud}
@@ -33,6 +33,7 @@
33
33
  loading="lazy"
34
34
  class="mn-t-thin radius-big o-hidden"
35
35
  ></iframe>
36
+ <iframe v-if="content?.youtube" width="100%" class="radius-big mn-t-semi" height="315" :src="`https://www.youtube.com/embed/${content?.youtube}`" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
36
37
  </div>
37
38
 
38
39
  <div style="min-height: 20rem;" class="o-hidden pos-relative">
@@ -3,40 +3,48 @@
3
3
  <div class="cols-2 gap-big pos-relative ">
4
4
  <div class="cols-1 gap-small ">
5
5
  <a v-if="options?.link" @click="clickBuyTicket()" href="#" class="bg-main flex-child-grow-1 flex-child-shrink-0 flex-child-basis-auto o-hidden radius-big pd-big flex-center flex-column flex w-100 gap-zero">
6
- <img class="w-100" :src="content?.ticket">
6
+ <img v-if="content?.ticket" class="w-100" :src="content?.ticket">
7
7
 
8
- <a class="t-white bg-black pd-l-medium pd-b-thin pd-t-thin pd-r-small h4 radius-extra uppercase t-nye204">
8
+ <a class="t-white bg-black pd-l-small pd-b-thin pd-t-thin pd-r-small h4 radius-extra uppercase t-nye204">
9
9
  <!-- SOLD OUT -->
10
- {{t('nye2024.buyticket')}}
10
+ {{ content?.ticketTextButton || 'Buy Ticket'}}
11
11
  </a>
12
12
 
13
13
  </a>
14
14
 
15
- <p class="pd-small radius-big bg-second flex flex-center gap-small p-medium t-medium t-white">
16
- <span>For extra payment options contact</span>
17
- <a class="t-black bg-white radius-extra pd-thin" href="https://t.me/thecommunebar" target="_blank">@thecommunebar</a>
15
+ <p v-if="content?.paymentContact" class="pd-small radius-big bg-second flex flex-center gap-small p-medium t-medium t-white">
16
+ <span>{{content?.paymentText}}</span>
17
+ <a class="t-black bg-white radius-extra pd-thin" :href="content?.paymentContactURL" target="_blank">{{content?.paymentContact}}</a>
18
18
  </p>
19
19
  </div>
20
20
 
21
21
  <div class="br-solid br-1px br-white-transp-10 o-hidden radius-big bg-black ">
22
- <video v-if="options?.video" style="max-height: 20rem; object-fit: cover;" ref="videoElement" class="pos-t-0 pos-l-0 w-100 h-auto" preload autoplay muted loop playsinlineclass playsinline :src="options?.video" itemprop="video" type="video/mp4" ></video>
22
+
23
+ <video
24
+ v-if="options?.video" style="max-height: 20rem; object-fit: cover;"
25
+ ref="videoElement" class="pos-t-0 pos-l-0 w-100 h-auto"
26
+ preload autoplay muted loop playsinlineclass playsinline
27
+ :src="options?.video" itemprop="video" type="video/mp4"
28
+ >
29
+ </video>
23
30
 
24
31
 
25
32
  <div class="pd-big flex-column flex w-100 h-100 gap-zero">
26
- <h3 class="t-unna t-nye204 mn-b-small">
27
- {{t('nye2024.title')}}
33
+ <h3 v-if="content?.previousTitle" class="t-unna t-nye204 mn-b-small">
34
+ {{content?.previousTitle}}
28
35
  </h3>
29
36
 
30
- <p class="p-medium t-transp mn-b-big">
31
- {{t('nye2024.description')}}
37
+ <p v-if="content?.previousDescription" class="p-medium t-transp mn-b-big">
38
+ {{content?.previousDescription}}
32
39
  </p>
33
40
 
34
- <div class="flex-nowrap flex gap-thin">
35
- <a href="https://www.instagram.com/thecommune.phuket/" target="_blank" class="pd-l-medium pd-r-medium pd-t-small pd-b-small t-black radius-extra uppercase t-medium bg-white">
36
- {{t('nye2024.checkinblog')}}
41
+ <div v-if="content?.previousLink" class="flex-nowrap flex gap-thin">
42
+ <a :href="content?.previousLink" target="_blank" class="pd-l-medium pd-r-medium pd-t-small pd-b-small t-black radius-extra uppercase t-medium bg-white">
43
+ {{content?.previousLinkText || 'Check'}}
37
44
  </a>
38
45
  </div>
39
46
  </div>
47
+
40
48
  </div>
41
49
 
42
50
 
@@ -68,7 +76,6 @@
68
76
  "titleTicket":"Are you ready?",
69
77
  "description":"Experience the ultimate party vibe at The Commune! Elevate your evening with distinctive and exhilarating activities, ensuring an unforgettable time. Dive into the excitement and make every moment special.",
70
78
  "checkinblog":"CHECK IN INSTAGRAM",
71
- "buyticket": "Buy Ticket Now →"
72
79
  }
73
80
  }
74
81
  }
@@ -34,6 +34,8 @@ module.exports = (db) => {
34
34
  default: () => ({
35
35
  subtitle: 'NMS Presents',
36
36
  ticketPrice: '499',
37
+ ticketText: 'Hurry up and purchase your ticket at a special price of only',
38
+ ticketTextButton: 'Buy Ticket Now →',
37
39
  ticketImage: null,
38
40
  ticketLinkStripe: null,
39
41
  video: null,
@@ -47,6 +49,13 @@ module.exports = (db) => {
47
49
  guestTwitter: null,
48
50
  guestSoundcloud: null,
49
51
  guestSpotify: null,
52
+ guestYoutube: null,
53
+ paymentContact: null,
54
+ paymentText: 'For extra payment options contact',
55
+ previousTitle: null,
56
+ previousDescription: null,
57
+ previousLink: null,
58
+ previousLinkText: null,
50
59
  logos: [],
51
60
  lineup: [],
52
61
  lineupBackground: null,
@@ -59,7 +59,18 @@ const handleFileUpload = (req, res, next, publicPath, { folderNameDefault = 'uns
59
59
  return;
60
60
  }
61
61
 
62
- const fileName = `${Math.floor(Math.random() * 10000)}-${info.filename}`;
62
+ const normalizeFileName = (filename) => {
63
+ return filename
64
+ // Заменяем пробелы на подчеркивания
65
+ .replace(/\s/g, '_')
66
+ // Удаляем или заменяем небезопасные символы
67
+ .replace(/[^a-zA-Z0-9-_\.]/g, '')
68
+ // Опционально: сокращаем имя файла, если оно слишком длинное
69
+ .slice(0, 80);
70
+ };
71
+
72
+ // Применяем нормализацию к имени файла
73
+ const fileName = `${Math.floor(Math.random() * 10000)}-${normalizeFileName(info.filename)}`;
63
74
  const fileFullPath = path.join(filePath, fileName);
64
75
 
65
76
  const fileProcess = fsp.mkdir(path.dirname(fileFullPath), { recursive: true })
@@ -67,7 +78,7 @@ const handleFileUpload = (req, res, next, publicPath, { folderNameDefault = 'uns
67
78
  const stream = file.pipe(fs.createWriteStream(fileFullPath));
68
79
  stream.on('finish', () => {
69
80
  files.push(path.relative(publicPath, fileFullPath));
70
- resolve(); // This line replaces the thumbnail creation process
81
+ resolve();
71
82
  });
72
83
  stream.on('error', reject);
73
84
  }));
@@ -10,7 +10,7 @@
10
10
  <span v-if="localPosition.country">{{localPosition.country}}</span>
11
11
  </span>
12
12
 
13
- <span v-else @click="a => { store.globals.state.isOpenLocationPopup = true }" class="t-semi t-main">
13
+ <span v-else @click="a => { store.globals.state.isOpenLocationPopup = true }" class="t-semi t-black cursor-pointer hover-t-underline">
14
14
  The World
15
15
  </span>
16
16
  </h2>
@@ -28,11 +28,12 @@ const actions = {
28
28
  setShopcart() {
29
29
  try {
30
30
  const storedShopcart = localStorage.getItem('shopcart');
31
+
31
32
  if (storedShopcart) {
32
33
  const shopcartData = JSON.parse(storedShopcart);
33
34
  state.positions = shopcartData.positions; // Восстанавливаем продукты
34
35
  state.organization = shopcartData.organization; // Восстанавливаем _id организации
35
- }
36
+ }
36
37
  } catch (error) {
37
38
  console.error(error);
38
39
  throw error;
@@ -74,11 +75,16 @@ const actions = {
74
75
 
75
76
  if (cartItemIndex > -1) {
76
77
  state.positions.splice(cartItemIndex, 1);
77
-
78
- localStorage.setItem('shopcart', JSON.stringify(state.positions));
78
+
79
+ // Сохраняем весь объект корзины, а не только позиции
80
+ localStorage.setItem('shopcart', JSON.stringify({
81
+ positions: state.positions,
82
+ organization: state.organization
83
+ }));
79
84
  }
80
85
  },
81
86
 
87
+
82
88
  decrementItemQuantity(_id) {
83
89
  const cartItem = state.positions.find(
84
90
  (item) => item._id === _id
@@ -92,10 +98,15 @@ const actions = {
92
98
  state.positions.splice(cartItemIndex, 1);
93
99
  }
94
100
 
95
- localStorage.setItem('shopcart', JSON.stringify(state.positions));
101
+ // Сохраняем весь объект корзины, а не только позиции
102
+ localStorage.setItem('shopcart', JSON.stringify({
103
+ positions: state.positions,
104
+ organization: state.organization
105
+ }));
96
106
  }
97
107
  },
98
108
 
109
+
99
110
  incrementItemQuantity(_id) {
100
111
  const cartItem = state.positions.find(
101
112
  (item) => item._id === _id
@@ -104,10 +115,15 @@ const actions = {
104
115
  if (cartItem) {
105
116
  cartItem.quantity++;
106
117
 
107
- localStorage.setItem('shopcart', JSON.stringify(state.positions));
118
+ // Сохраняем весь объект корзины, а не только позиции
119
+ localStorage.setItem('shopcart', JSON.stringify({
120
+ positions: state.positions,
121
+ organization: state.organization
122
+ }));
108
123
  }
109
124
  },
110
125
 
126
+
111
127
  resetShopcart({ state }) {
112
128
  state.positions = [];
113
129