@ozdao/prometheus-framework 0.2.68 → 0.2.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/package.json +1 -1
  2. package/src/components/ButtonSegmented/ButtonSegmented.vue +78 -0
  3. package/src/components/Completion/Completion.vue +76 -0
  4. package/src/components/Feed/Feed.vue +46 -18
  5. package/src/components/Tab/Tab.vue +11 -30
  6. package/src/modules/auth/components/pages/Invite.vue +1 -1
  7. package/src/modules/auth/controllers/auth.controller.js +10 -21
  8. package/src/modules/backoffice/router/backoffice.js +3 -3
  9. package/src/modules/events/components/elements/ButtonCheck.vue +15 -15
  10. package/src/modules/events/components/pages/EditEventTickets.vue +39 -13
  11. package/src/modules/events/components/pages/Event.vue +1 -2
  12. package/src/modules/events/controllers/tickets.controller.js +151 -98
  13. package/src/modules/events/controllers/utils/templateEmail.js +14 -0
  14. package/src/modules/events/controllers/utils/templateTicket.js +194 -0
  15. package/src/modules/events/router/events.js +3 -0
  16. package/src/modules/events/store/tickets.js +2 -2
  17. package/src/modules/globals/controllers/utils/queryProcessor.js +31 -6
  18. package/src/modules/globals/utils/mailing.js +19 -12
  19. package/src/modules/icons/entities/IconEvents.vue +7 -2
  20. package/src/modules/landing/components/pages/Home.vue +1 -1
  21. package/src/modules/orders/components/blocks/CardOrder.vue +1 -1
  22. package/src/modules/orders/components/blocks/CardOrderVar1.vue +97 -0
  23. package/src/modules/orders/components/pages/{FormOrder.vue → OrderCreate.vue} +20 -11
  24. package/src/modules/orders/components/pages/{EditOrder.vue → OrderCreateBackoffice.vue} +74 -17
  25. package/src/modules/orders/components/pages/Orders.vue +181 -70
  26. package/src/modules/orders/components/pages/Orders_refact.vue +2 -2
  27. package/src/modules/orders/components/sections/FormClientDetails.vue +24 -26
  28. package/src/modules/{applications → orders}/components/sections/SubscribeNewsletter.vue +1 -1
  29. package/src/modules/orders/controllers/orders.controller.js +46 -7
  30. package/src/modules/orders/models/customer.model.js +31 -0
  31. package/src/modules/orders/models/order.model.js +8 -13
  32. package/src/modules/orders/orders.client.js +67 -0
  33. package/src/modules/orders/orders.server.js +15 -0
  34. package/src/modules/orders/router/orders.router.js +1 -1
  35. package/src/modules/orders/store/orders.js +17 -2
  36. package/src/modules/users/components/pages/Profile.vue +6 -4
  37. package/src/modules/users/components/sections/ProfileCompletion.vue +30 -15
  38. package/src/modules/users/controllers/users.controller.js +0 -2
  39. package/src/modules/users/models/user.model.js +6 -5
  40. package/src/modules/users/users.server.js +1 -0
  41. package/src/styles/base/borders.scss +5 -2
  42. package/src/styles/config.scss +3 -4
  43. package/src/modules/applications/applications.client.js +0 -1
  44. package/src/modules/orders/components/blocks/Positions.vue +0 -177
  45. package/src/modules/users/models/client.model.js +0 -60
  46. /package/src/modules/{applications → orders}/controllers/applications.controller.js +0 -0
  47. /package/src/modules/{testimonials → orders}/controllers/testimonials.controller.js +0 -0
  48. /package/src/modules/{applications → orders}/models/application.model.js +0 -0
  49. /package/src/modules/{testimonials → orders}/models/testimonial.model.js +0 -0
  50. /package/src/modules/{applications → orders}/routes/applications.routes.js +0 -0
  51. /package/src/modules/{testimonials → orders}/routes/testimonials.routes.js +0 -0
  52. /package/src/modules/{applications → orders}/store/applications.js +0 -0
  53. /package/src/modules/{testimonials → orders}/store/testimonials.js +0 -0
  54. /package/src/modules/{payments → wallet}/components/pages/Payments.vue +0 -0
  55. /package/src/modules/{payments → wallet}/controllers/payments.controller.js +0 -0
  56. /package/src/modules/{payments → wallet}/controllers/payments.tinkoff.controller.js +0 -0
  57. /package/src/modules/{payments → wallet}/models/payment.model.js +0 -0
  58. /package/src/modules/{payments → wallet}/models/payment.tinkoff.model.js +0 -0
  59. /package/src/modules/{payments → wallet}/routes/payments.routes.js +0 -0
  60. /package/src/modules/{payments → wallet}/routes/payments.tinkoff.routes.js +0 -0
  61. /package/src/modules/{payments → wallet}/store/payments.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/prometheus-framework",
3
- "version": "0.2.68",
3
+ "version": "0.2.69",
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",
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div class="">
3
+ <div class="flex-nowrap flex-v-center flex pos-relative">
4
+
5
+ <div
6
+ v-for="(tab,index) in tabs"
7
+ :key="index"
8
+ @click="selectTab(index,tab)"
9
+ :class="{ 't-transp': index !== selectedTab }"
10
+ class="z-index-1 t-center pd-small w-100">
11
+ <label>{{tab.name}}</label>
12
+ </div>
13
+
14
+ <div
15
+ :style="tabSelectorStyle"
16
+ class="radius-extra bg-main t-white tab-selector">
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+
23
+ <script setup="props">
24
+ import { ref, computed } from 'vue'
25
+
26
+ const emit = defineEmits(['update:selected']);
27
+
28
+ const props = defineProps({
29
+ tabs: Array,
30
+ selected: String,
31
+ callback: Function
32
+ })
33
+
34
+ const selectedTab = ref(0)
35
+
36
+ if (props.selected) {
37
+ const selectedIndex = props.tabs.findIndex(tab => tab.value === props.selected)
38
+ if (selectedIndex !== -1) {
39
+ selectedTab.value = selectedIndex
40
+ }
41
+ }
42
+
43
+ function selectTab(index,tab) {
44
+ selectedTab.value = index;
45
+ emit('update:selected', tab.value);
46
+ if (props.callback) props.callback()
47
+ }
48
+
49
+ function getTabSelectorLeftOffset(tabIndex) {
50
+ const tabWidthPercentage = 100 / props.tabs.length;
51
+ return `${tabWidthPercentage * tabIndex}%`;
52
+ }
53
+
54
+ function calculateTabWidth() {
55
+ return `${100 / props.tabs.length}%`;
56
+ }
57
+
58
+ const tabSelectorStyle = computed(() => {
59
+ const leftOffset = getTabSelectorLeftOffset(selectedTab.value);
60
+ return { left: leftOffset, width: calculateTabWidth() };
61
+ });
62
+ </script>
63
+
64
+ <style lang="scss">
65
+ .tab-selector {
66
+ position: absolute;
67
+ width: 50%;
68
+ height: 100%;
69
+
70
+
71
+ left: 0;
72
+ top: 0;
73
+
74
+ z-index: 0;
75
+
76
+ transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
77
+ }
78
+ </style>
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <section class="w-100 radius-big pd-medium bg-main t-black">
3
+ <div class="mn-b-thin flex-v-center flex-nowrap flex">
4
+ <h3>
5
+ {{text}}
6
+ </h3>
7
+
8
+ <h4 class="mn-l-thin uppercase radius-big t-semi t-medium t-white bg-black w-max pd-thin">
9
+ {{ percentage || completionPercentage }}%
10
+ </h4>
11
+
12
+ <router-link
13
+ v-if="cta"
14
+ :to="{
15
+ name: 'User Edit Profile',
16
+ params: { _id: user }
17
+ }"
18
+ class="mn-l-auto uppercase radius-big t-semi t-medium t-white bg-black w-max pd-thin"
19
+ >
20
+ {{text_cta}}
21
+ </router-link>
22
+ </div>
23
+
24
+ <div class=" w-100 h-2r pos-relative pd-nano bg-black radius-big">
25
+ <div :style="`width: ${completionPercentage}%`"class="h-100 bg-main mn-b-thin radius-big">
26
+ </div>
27
+ </div>
28
+
29
+ </section>
30
+ </template>
31
+
32
+ <script setup>
33
+ import { ref, onMounted } from 'vue'
34
+
35
+ const { user, cta, target} = defineProps({
36
+ user: Object,
37
+ target: Object,
38
+ cta: Boolean,
39
+ percentage: Number,
40
+ text: String,
41
+ text_cta: String,
42
+ })
43
+
44
+ const completionPercentage = ref(0)
45
+
46
+ const calculateCompletion = (profileObject) => {
47
+ let totalProperties = 0;
48
+ let filledProperties = 0;
49
+
50
+ function recurse(obj) {
51
+ for (let key in obj) {
52
+ if (obj.hasOwnProperty(key)) {
53
+ if (obj[key] && typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
54
+ recurse(obj[key]); // Recurse into nested objects
55
+ } else {
56
+ totalProperties++;
57
+ if (obj[key] != null && obj[key] !== '') {
58
+ filledProperties++;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ recurse(profileObject);
66
+
67
+ return (totalProperties === 0 ? 0 : Math.round((filledProperties / totalProperties) * 100));
68
+
69
+ };
70
+
71
+
72
+ if (target) completionPercentage.value = calculateCompletion(target)
73
+ </script>
74
+
75
+ <style scoped>
76
+ </style>
@@ -1,22 +1,27 @@
1
1
  <template>
2
2
 
3
- <TransitionGroup tag="ul" name="scaleTransition" >
4
- <BlockSearch
5
- v-if="search"
6
- @search="updateSearch"
7
- placeholder="Enter product name"
8
- class="bg-white mn-b-thin"
9
- />
10
- </TransitionGroup>
11
-
12
- <TransitionGroup v-if="isLoading" tag="ul" name="scaleTransition" class="o-hidden bg-grey radius-big">
3
+ <BlockSearch
4
+ v-if="search"
5
+ :placeholder="search.placeholder || 'Search...'"
6
+ :class="search.class || 'bg-grey mn-b-thin'"
7
+ @search="updateSearch"
8
+ />
9
+
10
+ <TransitionGroup
11
+ v-if="isLoading"
12
+ tag="ul"
13
+ name="scaleTransition"
14
+ class="o-hidden bg-grey radius-big"
15
+ >
13
16
  <SkeletonEvent
14
17
  v-if="isLoading"
15
18
  v-for="i in currentLimit" :key="i"
16
19
  />
17
20
  </TransitionGroup>
18
21
 
19
- <transition name="scaleTransition">
22
+ <transition
23
+ name="scaleTransition"
24
+ >
20
25
  <EmptyState
21
26
  v-if="!isLoading && itemsList.length < 1"
22
27
  :title="states.empty.title"
@@ -25,19 +30,25 @@
25
30
  />
26
31
  </transition>
27
32
 
28
- <TransitionGroup tag="ul" name="scaleTransition" :class="$attrs.class">
33
+ <TransitionGroup
34
+ tag="ul"
35
+ name="scaleTransition"
36
+ :class="$attrs.class"
37
+ >
29
38
  <slot
30
39
  v-if="!isLoading && itemsList.length > 0"
31
40
  :items="itemsList"
32
41
  :user="user"
33
- ></slot>
42
+ >
43
+
44
+ </slot>
34
45
 
35
46
  <button
36
47
  v-if="showLoadMore && hasMoreItems && itemsList.length > 0"
37
48
  @click="loadMoreItems"
38
49
  class="col-w-100 w-100 bg-main button"
39
50
  >
40
- Load more
51
+ Load More
41
52
  </button>
42
53
  </TransitionGroup>
43
54
 
@@ -57,14 +68,14 @@ import BlockSearch from '@pf/src/modules/globals/components/blocks/BlockSearch.v
57
68
 
58
69
  // Пропсы
59
70
  const props = defineProps({
60
- search: {
61
- type: Boolean,
62
- default: false
63
- },
64
71
  showLoadMore: {
65
72
  type: Boolean,
66
73
  default: true
67
74
  },
75
+ search: {
76
+ type: Boolean,
77
+ default: false
78
+ },
68
79
  states: {
69
80
  type: Object,
70
81
  default: () => ({
@@ -81,6 +92,10 @@ const props = defineProps({
81
92
  state: Object,
82
93
  }),
83
94
  },
95
+ external: {
96
+ type: Boolean,
97
+ default: false
98
+ },
84
99
  options: {
85
100
  type: Object,
86
101
  default: () => ({
@@ -114,6 +129,7 @@ function updateSearch(search) {
114
129
  }
115
130
 
116
131
  const loadMoreItems = async () => {
132
+
117
133
  if (hasMoreItems.value) {
118
134
  currentSkip.value += currentLimit.value;
119
135
 
@@ -156,6 +172,18 @@ const fetchItems = async () => {
156
172
  isLoading.value = false;
157
173
  };
158
174
 
175
+ watch(() => props.external, (newVal) => {
176
+
177
+ });
178
+
179
+ watch(() => props.external, (newVal, oldVal) => {
180
+ if (newVal !== oldVal) {
181
+ fetchItems();
182
+ }
183
+ }, { deep: true });
184
+
185
+
186
+
159
187
  watch(() => props.options, (newVal, oldVal) => {
160
188
  if (
161
189
  newVal.organization !== oldVal.organization ||
@@ -1,20 +1,15 @@
1
1
  <template>
2
- <div class="">
3
- <div class="flex-nowrap flex-v-center flex pos-relative">
4
-
5
- <div
6
- v-for="(tab,index) in tabs"
7
- :key="index"
8
- @click="selectTab(index,tab)"
9
- :class="{ 't-transp': index !== selectedTab }"
10
- class="z-index-1 t-center pd-small w-100">
11
- <label>{{tab.name}}</label>
12
- </div>
13
-
14
- <div
15
- :style="tabSelectorStyle"
16
- class="radius-extra bg-main t-white tab-selector">
17
- </div>
2
+ <div class="flex-nowrap flex-v-center flex pos-relative">
3
+ <div
4
+ v-for="(tab,index) in tabs"
5
+ :key="index"
6
+ @click="selectTab(index,tab)"
7
+ :class="{
8
+ 't-transp': index !== selectedTab,
9
+ 'br-solid br-b-3px br-main': index === selectedTab,
10
+ }"
11
+ class="z-index-1 t-center pd-small w-max ">
12
+ <label>{{tab.name}}</label>
18
13
  </div>
19
14
  </div>
20
15
  </template>
@@ -45,20 +40,6 @@
45
40
  emit('update:selected', tab.value);
46
41
  if (props.callback) props.callback()
47
42
  }
48
-
49
- function getTabSelectorLeftOffset(tabIndex) {
50
- const tabWidthPercentage = 100 / props.tabs.length;
51
- return `${tabWidthPercentage * tabIndex}%`;
52
- }
53
-
54
- function calculateTabWidth() {
55
- return `${100 / props.tabs.length}%`;
56
- }
57
-
58
- const tabSelectorStyle = computed(() => {
59
- const leftOffset = getTabSelectorLeftOffset(selectedTab.value);
60
- return { left: leftOffset, width: calculateTabWidth() };
61
- });
62
43
  </script>
63
44
 
64
45
  <style lang="scss">
@@ -27,7 +27,7 @@
27
27
  <Button
28
28
  :submit="onSubmit"
29
29
  :callback="redirectTo"
30
- class="w-100 bg-main mn-b-big">\
30
+ class="w-100 bg-main mn-b-big">
31
31
  <span>Join</span>
32
32
  </Button>
33
33
  </section>
@@ -94,8 +94,6 @@ const controllerFactory = (db) => {
94
94
 
95
95
  const signup = async (req, res) => {
96
96
  const { type, email, phone, inviteCode } = req.body;
97
-
98
- console.log(req.body)
99
97
 
100
98
  let userData = {
101
99
  password: bcrypt.hashSync(req.body.password, 8)
@@ -106,6 +104,7 @@ const controllerFactory = (db) => {
106
104
  } else if (type === 'phone') {
107
105
  userData.phone = phone;
108
106
  }
107
+
109
108
  const user = new User(userData);
110
109
 
111
110
  try {
@@ -114,24 +113,14 @@ const controllerFactory = (db) => {
114
113
  console.log(err)
115
114
  return res.status(500).send({ message: err });
116
115
  }
117
- if (req.body.roles) {
118
- try {
119
- const roles = await Role.find({ name: { $in: req.body.roles } });
120
- user.roles = roles.map(role => role._id);
121
- await user.save();
122
- } catch (err) {
123
- console.log(err)
124
- return res.status(500).send({ message: err });
125
- }
126
- } else {
127
- try {
128
- const role = await Role.findOne({ name: "user" });
129
- user.roles = [role._id];
130
- await user.save();
131
- } catch (err) {
132
- console.log(err)
133
- return res.status(500).send({ message: err });
134
- }
116
+
117
+ try {
118
+ const role = await Role.findOne({ name: "user" });
119
+ user.roles = [role._id];
120
+ await user.save();
121
+ } catch (err) {
122
+ console.log(err)
123
+ return res.status(500).send({ message: err });
135
124
  }
136
125
 
137
126
  let invite = null;
@@ -146,7 +135,6 @@ const controllerFactory = (db) => {
146
135
  return res.status(500).send({ message: err });
147
136
  }
148
137
  }
149
- console.log(inviteCode);
150
138
 
151
139
  if (invite) {
152
140
  invite.status = 'used';
@@ -159,6 +147,7 @@ const controllerFactory = (db) => {
159
147
  target: new ObjectId(invite.organization),
160
148
  role: invite.role.name,
161
149
  });
150
+
162
151
  try {
163
152
  await newMembership.save();
164
153
  } catch (err) {
@@ -101,11 +101,11 @@ const backofficeRoutes = [{
101
101
  },{
102
102
  path: 'add',
103
103
  name: 'AdminOrderAdd',
104
- component: () => import(/* webpackChunkName: 'BackofficeOrders' */ '@pf/src/modules/orders/components/pages/EditOrder.vue')
104
+ component: () => import(/* webpackChunkName: 'BackofficeOrders' */ '@pf/src/modules/orders/components/pages/OrderCreateBackoffice.vue')
105
105
  },{
106
106
  path: ':order',
107
107
  name: 'AdminOrderEdit',
108
- component: () => import(/* webpackChunkName: 'BackofficeOrders' */ '@pf/src/modules/orders/components/pages/EditOrder.vue')
108
+ component: () => import(/* webpackChunkName: 'BackofficeOrders' */ '@pf/src/modules/orders/components/pages/OrderCreateBackoffice.vue')
109
109
  }]
110
110
  },{
111
111
  path: 'payments',
@@ -117,7 +117,7 @@ const backofficeRoutes = [{
117
117
  },
118
118
  authorize: []
119
119
  },
120
- component: () => import(/* webpackChunkName: 'BackofficePayments' */ '@pf/src/modules/payments/components/pages/Payments.vue'),
120
+ component: () => import(/* webpackChunkName: 'BackofficePayments' */ '@pf/src/modules/wallet/components/pages/Payments.vue'),
121
121
  }
122
122
  ]
123
123
  }];
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <div>
3
3
  <Button :submit="openPublicationPopup" class="bg-main button-small radius-extra button">
4
- Check ticket
4
+ Check Tickets
5
5
  </Button>
6
6
 
7
7
  <Popup title="Добавить участника" @close-popup="closePublicationPopup" :isPopupOpen="isPublicationPopup"
8
8
  class="w-max-30r h-max-30r t-left pd-big bg-white radius-big">
9
- <h3 class="mn-b-small">Final Touches</h3>
9
+ <h3 class="mn-b-small">Scan QR Code</h3>
10
10
 
11
- <div style="border: 2px solid black" class="h-100">
11
+ <div class="h-max">
12
12
  <QrcodeStream :track="paintBoundingBox" @detect="onDetect" @error="onError"></QrcodeStream>
13
13
  </div>
14
14
  </Popup>
@@ -27,7 +27,10 @@ import Button from '@pf/src/components/Button/Button.vue'
27
27
  // Methods
28
28
  import * as tickets from '@pf/src/modules/events/store/tickets'
29
29
 
30
+ const emits = defineEmits('qrcodecheck')
31
+
30
32
  const isPublicationPopup = ref(false)
33
+ const error = ref('')
31
34
 
32
35
  function openPublicationPopup() {
33
36
  isPublicationPopup.value = true
@@ -38,32 +41,29 @@ function closePublicationPopup() {
38
41
  }
39
42
 
40
43
  const result = ref(null)
44
+
41
45
  async function onDetect(detectedCodes) {
42
46
  result.value = detectedCodes.map((code) => code.rawValue)
43
-
47
+
44
48
  try {
45
49
  const qrcode = result.value[0] || ''
46
- console.log('Получено значение qrcode:', qrcode);
47
50
 
48
51
  if (!qrcode) {
49
- throw new Error('неудалось прочитать qrcode');
52
+ throw new Error('Troubles with qrcode reading');
50
53
  }
51
54
 
52
55
  const response = await tickets.actions.update({
53
56
  _id: qrcode,
54
57
  status: 'used',
58
+ check: true
55
59
  })
56
60
 
57
- console.log('Обновлено значение ticket.status:', response)
58
-
59
- alert('Билет проверен');
60
-
61
- closePublicationPopup()
61
+ alert("Ticket checked. And it's all right!");
62
62
  } catch (e) {
63
- alert('Билет не найден или уже использован');
64
-
65
- console.error('Ошибка при обновлении ticket.status:', e.message)
63
+ alert(`Ticket is not found, already used or deactivated!`);
66
64
  }
65
+
66
+ emits('qrcodecheck')
67
67
  }
68
68
 
69
69
  function onError(err) {
@@ -103,4 +103,4 @@ function paintBoundingBox(detectedCodes, ctx) {
103
103
 
104
104
  <style scoped>
105
105
  /* Existing styles can stay unchanged */
106
- </style>
106
+ </style>
@@ -6,9 +6,10 @@
6
6
  <h2 class="mn-r-medium">Tickets</h2>
7
7
  <button
8
8
  @click="openTicketsPopup()"
9
- class="radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second">
10
- +
9
+ class="radius-extra uppercase button-small flex-child flex-child-shrink-0 hover-scale-1 cursor-pointer t-white bg-second">
10
+ Add Tickets
11
11
  </button>
12
+ <ButtonCheck @qrcodecheck="fetchTickets = !fetchTickets " class="w-100 pd-medium mn-auto" />
12
13
  </header>
13
14
 
14
15
  <Popup
@@ -34,13 +35,19 @@
34
35
  <Field
35
36
  v-model:field="item.name"
36
37
  placeholder="Name"
37
- class="w-30 bg-white radius-small pd-medium"
38
+ class="w-50 bg-white radius-small pd-medium"
38
39
  />
39
40
  <Field
40
41
  v-model:field="item.email"
41
42
  placeholder="Email"
42
43
  class="w-100 bg-white radius-small pd-medium"
43
44
  />
45
+ <Field
46
+ v-model:field="item.quantity"
47
+ placeholder="Quantity"
48
+ type="number"
49
+ class="w-10 bg-white radius-small pd-medium"
50
+ />
44
51
  <div v-if="index > 0" @click="() => newTickets.splice(index, 1)" class="radius-small h-100 i-big flex-center flex aspect-1x1 bg-red">
45
52
  <IconDelete
46
53
  class="i-medium"
@@ -59,6 +66,7 @@
59
66
  </Popup>
60
67
 
61
68
  <Feed
69
+ :search="true"
62
70
  :states="{
63
71
  empty: {
64
72
  title: 'No Tickets Found',
@@ -72,18 +80,18 @@
72
80
  :options="{
73
81
  target: event._id
74
82
  }"
83
+ :external="fetchTickets"
75
84
  v-slot="{
76
85
  items
77
86
  }"
78
87
  >
79
88
  <div
80
89
  v-for="(ticket, index) in items"
81
- class="radius-big bg-grey gap-small pd-small flex-nowrap flex pos-relative mn-b-thin"
90
+ class="radius-big bg-grey gap-small pd-medium flex-v-center flex-nowrap flex pos-relative mn-b-thin"
82
91
  >
92
+ <a :href="ticket.image" target="_blank"><img :src="ticket.qrcode" class="radius-small h-5r w-5r"></a>
83
93
 
84
- <img :src="ticket.image" class="radius-small h-5r w-5r">
85
-
86
- <div class="">
94
+ <div class="mn-r-auto ">
87
95
  <p class="h4">
88
96
  {{ticket.client_refactor?.name || 'No name'}}, {{ticket.role}}
89
97
  </p>
@@ -97,12 +105,22 @@
97
105
  </div>
98
106
 
99
107
  <Button
100
- :submit="onSubmit"
108
+ v-if="ticket.status !== 'deactivated'"
109
+ :submit="() => changeStatus(ticket, 'deactivated')"
101
110
  :callback="redirectTo"
102
- class="w-min h-min mn-l-auto bg-black t-white"
111
+ class="w-min h-min pd-small bg-black t-white"
103
112
  >
104
113
  Deactivate
105
114
  </Button>
115
+
116
+ <Button
117
+ v-if="ticket.status === 'deactivated' || ticket.status === 'used' "
118
+ :submit="() => changeStatus(ticket, 'unused')"
119
+ :callback="redirectTo"
120
+ class="w-min h-min pd-small bg-green t-white"
121
+ >
122
+ Activate
123
+ </Button>
106
124
 
107
125
  </div>
108
126
  </Feed>
@@ -117,6 +135,8 @@ import Popup from "@pf/src/components/Popup/Popup.vue";
117
135
  import Field from '@pf/src/components/Field/Field.vue'
118
136
  import Button from '@pf/src/components/Button/Button.vue';
119
137
 
138
+ import ButtonCheck from '@pf/src/modules/events/components/elements/ButtonCheck.vue'
139
+
120
140
  import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';
121
141
 
122
142
  import { ref, onMounted } from 'vue';
@@ -137,7 +157,8 @@ const newTickets = ref([{
137
157
  name: '',
138
158
  email: '',
139
159
  target: event.value?._id,
140
- type: 'event'
160
+ type: 'event',
161
+ quantity: 1,
141
162
  }])
142
163
 
143
164
  const isOpenTicketsPopup = ref(false);
@@ -149,7 +170,8 @@ function openTicketsPopup(department) {
149
170
  name: '',
150
171
  email: '',
151
172
  target: event.value?._id,
152
- type: 'event'
173
+ type: 'event',
174
+ quantity: 1,
153
175
  }]
154
176
  }
155
177
 
@@ -157,6 +179,8 @@ function closeTicketsPopup() {
157
179
  isOpenTicketsPopup.value = false;
158
180
  }
159
181
 
182
+ const fetchTickets = ref(false)
183
+
160
184
 
161
185
  onMounted(async () =>{
162
186
  const data = await events.read({ user: auth.state.user._id, url: route.params.url });
@@ -167,15 +191,17 @@ onMounted(async () =>{
167
191
  async function onSubmit() {
168
192
  try {
169
193
  const response = await tickets.actions.create(newTickets.value);
194
+ fetchTickets.value = !fetchTickets.value
170
195
  } catch (error) {
171
196
  console.log(error);
172
197
  }
173
198
  }
174
199
 
175
- async function onDeactivate() {
200
+ async function changeStatus(ticket, status) {
176
201
  if (confirm('Are you sure you want to deactivate this event?')) {
177
202
  try {
178
- const response = await events.update(event.value._id);
203
+ const response = await tickets.actions.update({ ...ticket, status: status});
204
+ fetchTickets.value = !fetchTickets.value
179
205
  } catch (error) {
180
206
  console.error(error);
181
207
  }
@@ -130,7 +130,7 @@
130
130
 
131
131
  <!-- <img v-if="qrcode" :src="qrcode" class="w-8r h-8r" /> -->
132
132
 
133
- <!-- <ButtonCheck class="w-100 pd-medium mn-auto" /> -->
133
+
134
134
 
135
135
  <section>
136
136
  <component
@@ -180,7 +180,6 @@
180
180
  import CardEvent from '@pf/src/modules/events/components/blocks/CardEvent.vue';
181
181
  import SkeletonEvent from '@pf/src/modules/icons/skeletons/SkeletonEvent.vue'
182
182
  import ButtonJoin from '@pf/src/modules/events/components/elements/ButtonJoin.vue';
183
- // import ButtonCheck from '@pf/src/modules/events/components/elements/ButtonCheck.vue'
184
183
  import Comments from '@pf/src/modules/community/components/sections/Comments.vue';
185
184
 
186
185
  import Image from '@pf/src/modules/constructor/components/elements/Image.vue';