@ozdao/prometheus-framework 0.2.67 → 0.2.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. package/dist/products.server.js +1 -0
  2. package/dist/products.server.mjs +1 -0
  3. package/dist/prometheus-framework/src/components/Button/Button.vue.cjs +1 -1
  4. package/dist/prometheus-framework/src/components/Button/Button.vue.js +225 -1
  5. package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +1 -1
  6. package/dist/prometheus-framework/src/components/Button/Button.vue2.js +1 -225
  7. package/dist/prometheus-framework/src/components/Field/Field.vue.cjs +1 -1
  8. package/dist/prometheus-framework/src/components/Field/Field.vue.js +84 -1
  9. package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +1 -1
  10. package/dist/prometheus-framework/src/components/Field/Field.vue2.js +1 -84
  11. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
  12. package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
  13. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  14. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +72 -1
  15. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  16. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +1 -72
  17. package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
  18. package/dist/prometheus-framework/src/components/Select/Select.vue.js +97 -1
  19. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  20. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +1 -97
  21. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  22. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +46 -1
  23. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  24. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +1 -46
  25. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  26. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +3 -3
  27. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.cjs +1 -1
  28. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterCode.vue.js +1 -1
  29. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  30. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +3 -3
  31. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  32. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +3 -3
  33. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  34. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +3 -3
  35. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  36. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +3 -3
  37. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  38. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +3 -3
  39. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  40. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  41. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  42. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +3 -3
  43. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  44. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +4 -4
  45. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
  46. package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
  47. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
  48. package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
  49. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +5 -1
  50. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +66 -0
  51. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +1 -5
  52. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +0 -66
  53. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
  54. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
  55. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
  56. package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
  57. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
  58. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
  59. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  60. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +4 -4
  61. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
  62. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +3 -3
  63. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  64. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +3 -3
  65. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  66. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +3 -3
  67. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  68. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +3 -3
  69. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.cjs +1 -1
  70. package/dist/prometheus-framework/src/modules/globals/components/blocks/BlockSearch.vue.js +1 -1
  71. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  72. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +1 -1
  73. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  74. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +2 -2
  75. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  76. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +4 -4
  77. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  78. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +1 -1
  79. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  80. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +2 -2
  81. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
  82. package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
  83. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  84. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +5 -5
  85. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  86. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +2 -2
  87. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  88. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
  89. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  90. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +5 -5
  91. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  92. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  93. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  94. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +3 -3
  95. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  96. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +3 -3
  97. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  98. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +5 -5
  99. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  100. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +2 -2
  101. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  102. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  103. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
  104. package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
  105. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
  106. package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
  107. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
  108. package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
  109. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  110. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +3 -3
  111. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  112. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +3 -3
  113. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  114. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +1 -1
  115. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  116. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +4 -4
  117. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  118. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +1 -1
  119. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
  120. package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
  121. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  122. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +3 -3
  123. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
  124. package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
  125. package/dist/prometheus-framework/src/modules/products/store/leftovers.cjs +1 -1
  126. package/dist/prometheus-framework/src/modules/products/store/leftovers.js +9 -8
  127. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  128. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +3 -3
  129. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  130. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +2 -2
  131. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  132. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  133. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  134. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +3 -3
  135. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  136. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  137. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  138. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +3 -3
  139. package/dist/style.css +1 -1
  140. package/package.json +1 -1
  141. package/src/components/ButtonSegmented/ButtonSegmented.vue +78 -0
  142. package/src/components/Completion/Completion.vue +76 -0
  143. package/src/components/Feed/Feed.vue +46 -18
  144. package/src/components/Tab/Tab.vue +11 -30
  145. package/src/modules/auth/components/pages/Invite.vue +1 -1
  146. package/src/modules/auth/controllers/auth.controller.js +10 -21
  147. package/src/modules/backoffice/router/backoffice.js +3 -3
  148. package/src/modules/events/components/elements/ButtonCheck.vue +15 -15
  149. package/src/modules/events/components/pages/EditEventTickets.vue +39 -13
  150. package/src/modules/events/components/pages/Event.vue +1 -2
  151. package/src/modules/events/controllers/tickets.controller.js +151 -98
  152. package/src/modules/events/controllers/utils/templateEmail.js +14 -0
  153. package/src/modules/events/controllers/utils/templateTicket.js +194 -0
  154. package/src/modules/events/router/events.js +3 -0
  155. package/src/modules/events/store/tickets.js +2 -2
  156. package/src/modules/globals/controllers/utils/queryProcessor.js +31 -6
  157. package/src/modules/globals/utils/mailing.js +19 -12
  158. package/src/modules/icons/entities/IconEvents.vue +7 -2
  159. package/src/modules/landing/components/pages/Home.vue +1 -1
  160. package/src/modules/orders/components/blocks/CardOrder.vue +1 -1
  161. package/src/modules/orders/components/blocks/CardOrderVar1.vue +97 -0
  162. package/src/modules/orders/components/pages/{FormOrder.vue → OrderCreate.vue} +20 -11
  163. package/src/modules/orders/components/pages/{EditOrder.vue → OrderCreateBackoffice.vue} +74 -17
  164. package/src/modules/orders/components/pages/Orders.vue +181 -70
  165. package/src/modules/orders/components/pages/Orders_refact.vue +2 -2
  166. package/src/modules/orders/components/sections/FormClientDetails.vue +24 -26
  167. package/src/modules/{applications → orders}/components/sections/SubscribeNewsletter.vue +1 -1
  168. package/src/modules/orders/controllers/orders.controller.js +46 -7
  169. package/src/modules/orders/models/customer.model.js +31 -0
  170. package/src/modules/orders/models/order.model.js +8 -13
  171. package/src/modules/orders/orders.client.js +67 -0
  172. package/src/modules/orders/orders.server.js +15 -0
  173. package/src/modules/orders/router/orders.router.js +1 -1
  174. package/src/modules/orders/store/orders.js +17 -2
  175. package/src/modules/products/controllers/leftovers.controller.js +1 -0
  176. package/src/modules/products/store/leftovers.js +3 -2
  177. package/src/modules/users/components/pages/Profile.vue +6 -4
  178. package/src/modules/users/components/sections/ProfileCompletion.vue +30 -15
  179. package/src/modules/users/controllers/users.controller.js +0 -2
  180. package/src/modules/users/models/user.model.js +6 -5
  181. package/src/modules/users/users.server.js +1 -0
  182. package/src/styles/base/borders.scss +5 -2
  183. package/src/styles/config.scss +3 -4
  184. package/src/modules/applications/applications.client.js +0 -1
  185. package/src/modules/orders/components/blocks/Positions.vue +0 -177
  186. package/src/modules/users/models/client.model.js +0 -60
  187. /package/src/modules/{applications → orders}/controllers/applications.controller.js +0 -0
  188. /package/src/modules/{testimonials → orders}/controllers/testimonials.controller.js +0 -0
  189. /package/src/modules/{applications → orders}/models/application.model.js +0 -0
  190. /package/src/modules/{testimonials → orders}/models/testimonial.model.js +0 -0
  191. /package/src/modules/{applications → orders}/routes/applications.routes.js +0 -0
  192. /package/src/modules/{testimonials → orders}/routes/testimonials.routes.js +0 -0
  193. /package/src/modules/{applications → orders}/store/applications.js +0 -0
  194. /package/src/modules/{testimonials → orders}/store/testimonials.js +0 -0
  195. /package/src/modules/{payments → wallet}/components/pages/Payments.vue +0 -0
  196. /package/src/modules/{payments → wallet}/controllers/payments.controller.js +0 -0
  197. /package/src/modules/{payments → wallet}/controllers/payments.tinkoff.controller.js +0 -0
  198. /package/src/modules/{payments → wallet}/models/payment.model.js +0 -0
  199. /package/src/modules/{payments → wallet}/models/payment.tinkoff.model.js +0 -0
  200. /package/src/modules/{payments → wallet}/routes/payments.routes.js +0 -0
  201. /package/src/modules/{payments → wallet}/routes/payments.tinkoff.routes.js +0 -0
  202. /package/src/modules/{payments → wallet}/store/payments.js +0 -0
@@ -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';
@@ -1,109 +1,131 @@
1
- const QRCode = require("qrcode");
2
- const Jimp = require('jimp');
1
+ const fs = require("fs");
3
2
  const path = require('path');
3
+ const puppeteer = require("puppeteer");
4
+
5
+ const QRCode = require("qrcode");
6
+ const Mustache = require("mustache");
4
7
 
5
8
  const { sendEmail } = require('@pf/src/modules/globals/utils/mailing');
6
9
 
10
+ const { renderTemplate: renderTicketTemplate } = require('./utils/templateTicket');
11
+ const { renderTemplate: renderEmailTemplate } = require('./utils/templateEmail');
12
+
13
+ function formatDate(dateString) {
14
+ const date = new Date(dateString);
15
+ const options = { day: 'numeric', month: 'long' };
16
+ return date.toLocaleDateString('en-US', options);
17
+ }
18
+
19
+ // Функция для форматирования времени в формат "16:30"
20
+ function formatTime(dateString) {
21
+ const date = new Date(dateString);
22
+ const options = { hour: '2-digit', minute: '2-digit', hour12: false };
23
+ return date.toLocaleTimeString('en-US', options);
24
+ }
25
+
7
26
  const controllerFactory = (db, publicPath) => {
8
27
  const Ticket = db.ticket;
28
+ const Event = db.event;
9
29
 
10
30
  // Функция для создания билета, генерации QR-кода и сохранения билета
11
31
  async function saveAndSendTicket(ticketData) {
12
- console.log(ticketData);
13
- const ticket = new Ticket(ticketData);
14
-
15
- const data = await ticket.save();
16
-
17
- // Работа с QR-кодом
18
- const qrData = data._id.toString();
19
- const qrCode = await QRCode.toDataURL(qrData, { errorCorrectionLevel: 'H', type: 'image/png' });
32
+ console.log(ticketData);
33
+ const quantity = ticketData.quantity || 1; // Установим значение по умолчанию, если quantity не указано
34
+ const ticketIds = [];
35
+ const pdfFiles = [];
20
36
 
21
- data.status = "unused";
22
- data.qrcode = qrCode;
23
-
24
- data.client_refactor.name = ticketData.name
25
- data.client_refactor.email = ticketData.email
26
-
27
- // Путь к шаблону билета и куда сохранить измененный
28
- const templatePath = path.join(publicPath, 'tickets', 'template.png');
29
- const outputPath = path.join(publicPath, 'tickets', `ticket-${data._id}.png`);
30
- data.image = `/tickets/ticket-${data._id}.png`;
31
-
32
- // Загрузка шаблона билета
33
- const ticketTemplate = await Jimp.read(templatePath);
34
-
35
- // Генерация QR-кода в виде изображения
36
- const qrImage = await Jimp.read(Buffer.from(qrCode.split(",")[1], 'base64'));
37
-
38
- const resizedQrWidth = qrImage.bitmap.width * 1.5;
39
- const resizedQrHeight = qrImage.bitmap.height * 1.5;
40
- qrImage.resize(resizedQrWidth, resizedQrHeight);
41
-
42
- // Вычисление позиции для QR-кода после изменения размера
43
- const { width: templateWidth, height: templateHeight } = ticketTemplate.bitmap;
37
+ const event = await Event.findById(ticketData.target).exec();
44
38
 
45
- const xPosition = (templateWidth - resizedQrWidth) / 2;
46
- const yPosition = (templateHeight / 2 - resizedQrHeight / 2) + 275; // Немного ниже центра
47
-
48
- // Добавление QR-кода на шаблон билета
49
- await ticketTemplate.composite(qrImage, xPosition, yPosition);
50
-
51
- // Сохранение измененного билета
52
- await ticketTemplate.writeAsync(outputPath);
53
-
54
- if (ticketData.email) {
55
- const emailBody = `
56
- <h1>Your Ticket from ${process.env.APP_NAME}</h1>
57
- <p>Dear ${ticketData.name || 'Anonymous'},<br>
58
- Your ticket is now ready.<br>
59
- Please find your ticket attached below:</p>
60
- <img src="${process.env.API_URL + data.image}" alt="Ticket Image" style="width:100%;max-width:600px;height:auto;">
61
- Keep this ticket safe, and show the QR code at the entrance.<br>
62
- Looking forward to seeing you!<br>
63
- Best regards,<br>
64
- <p>The ${process.env.APP_NAME} Team</p>
65
- `;
66
-
67
- try {
68
- const emailSent = await sendEmail(ticketData.email, `Your Ticket from ${process.env.APP_NAME}`, emailBody);
69
- } catch(err){
70
- console.log(err)
71
- }
39
+ if (!event) {
40
+ console.error("Event not found!");
41
+ return;
72
42
  }
73
43
 
74
- // Обновление билета с сгенерированным QR-кодом
75
- await data.save();
76
-
77
- return data; // Возвращаем данные для дальнейшего использования
78
- }
79
-
80
- const create = async (req, res) => {
81
- // Проверяем, является ли тело запроса массивом
82
- if (Array.isArray(req.body)) {
83
- // Если тело запроса - массив, обрабатываем каждый элемент массива
84
- const ticketsData = req.body;
85
-
86
- try {
87
- const ticketsPromises = ticketsData.map(ticketData =>
88
- saveAndSendTicket(ticketData)
89
- );
90
- const tickets = await Promise.all(ticketsPromises);
91
- res.json(tickets); // Отправляем массив сохраненных билетов
92
- } catch (err) {
93
- console.log(err)
94
- res.status(500).send({ errorCode: "SERVER_ERROR" });
95
- }
96
- } else {
97
- // Если тело запроса не массив, обрабатываем как один объект
98
- try {
99
- const data = await saveAndSendTicket(req.body);
100
- res.json(data); // Отправляем данные одного билета
101
- } catch (err) {
102
- console.log(err)
103
- res.status(500).send({ errorCode: "SERVER_ERROR" });
104
- }
105
- }
106
- };
44
+ for (let i = 0; i < quantity; i++) {
45
+ const ticket = new Ticket(ticketData);
46
+ const data = await ticket.save();
47
+ ticketIds.push(data._id.toString()); // Сохраняем ID каждого билета для QR кода
48
+
49
+ const qrData = data._id.toString();
50
+ const qrCode = await QRCode.toDataURL(qrData, {
51
+ errorCorrectionLevel: 'H',
52
+ type: 'image/png'
53
+ });
54
+ data.status = "unused";
55
+ data.qrcode = qrCode;
56
+ data.client_refactor.name = ticketData.name
57
+ data.client_refactor.email = ticketData.email
58
+ const renderedHtml = renderTicketTemplate({
59
+ clientName: ticketData.name || 'No name',
60
+ qrCode: qrCode,
61
+ eventLocation: event.location || process.env.APP_NAME,
62
+ eventName: event.name,
63
+ eventDate: formatDate(event.date.start),
64
+ eventTime: formatTime(event.date.start)
65
+ });
66
+ const dirPath = path.join(publicPath, 'tickets');
67
+ const fileName = `ticket-${data._id.toString()}.pdf`;
68
+ const filePath = path.join(dirPath, fileName);
69
+ pdfFiles.push(filePath); // Сохраняем пути ко всем файлам PDF
70
+ const browser = await puppeteer.launch();
71
+ const page = await browser.newPage();
72
+ await page.setContent(renderedHtml);
73
+ const pdfBuffer = await page.pdf({
74
+ path: filePath,
75
+ format: "A4"
76
+ });
77
+ await browser.close();
78
+ data.image = `/tickets/${fileName}`;
79
+ await data.save(); // Обновление билета в базе данных
80
+ }
81
+ // Отправка одного емейла с прикрепленными PDF файлами всех билетов
82
+ if (ticketData.email) {
83
+ const renderedHtmlEmail = renderEmailTemplate({
84
+ clientName: ticketData.name || 'No name',
85
+ eventLocation: event.location || process.env.APP_NAME,
86
+ eventName: event.name,
87
+ eventDate: formatDate(event.date.start),
88
+ eventTime: formatTime(event.date.start),
89
+ randomness: Date.now()
90
+ });
91
+ try {
92
+ const emailSent = await sendEmail(ticketData.email, `Your Tickets for ${event.name}`, renderedHtmlEmail, pdfFiles);
93
+ } catch (err) {
94
+ console.error("Email sending failed:", err);
95
+ }
96
+ }
97
+ return {
98
+ tickets: ticketIds
99
+ }; // Возвращаем ID всех созданных билетов
100
+ };
101
+
102
+ const create = async (req, res) => {
103
+ if (Array.isArray(req.body)) {
104
+ const ticketsData = req.body;
105
+ try {
106
+ const ticketsPromises = ticketsData.map(ticketData =>
107
+ saveAndSendTicket(ticketData)
108
+ );
109
+ const tickets = await Promise.all(ticketsPromises);
110
+ res.json(tickets);
111
+ } catch (err) {
112
+ console.log(err)
113
+ res.status(500).send({
114
+ errorCode: "SERVER_ERROR"
115
+ });
116
+ }
117
+ } else {
118
+ try {
119
+ const data = await saveAndSendTicket(req.body);
120
+ res.json(data);
121
+ } catch (err) {
122
+ console.log(err)
123
+ res.status(500).send({
124
+ errorCode: "SERVER_ERROR"
125
+ });
126
+ }
127
+ }
128
+ };
107
129
 
108
130
  const read = async (req, res) => {
109
131
  let query = {};
@@ -125,6 +147,34 @@ const controllerFactory = (db, publicPath) => {
125
147
  query.role = req.query.role;
126
148
  }
127
149
 
150
+ options.limit = req.query.limit || 10;
151
+ options.skip = req.query.skip || 0;
152
+
153
+ const sortParam = req.query.sortParam || 'createdAt';
154
+ const sortOrder = req.query.sortOrder === 'asc' ? 1 : -1;
155
+
156
+ options.sort = {
157
+ [sortParam]: sortOrder,
158
+ "_id": 1
159
+ };
160
+
161
+ const search = req.query.search;
162
+
163
+ if (search) {
164
+ const parts = search.split('.');
165
+ let regexPattern = '';
166
+
167
+ if (parts.length === 2) {
168
+ // Создаем паттерн, который допускает замену одного символа в каждой части
169
+ regexPattern = parts.map(part => part.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*')).join('\\.');
170
+ } else {
171
+ // Если нет точки, применяем аналогичный подход к всей строке
172
+ regexPattern = search.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
173
+ }
174
+
175
+ query['client_refactor.name'] = { $regex: new RegExp(regexPattern, 'i') };
176
+ }
177
+
128
178
  try {
129
179
  const tickets = await Ticket.find(query, null, options).populate('user');
130
180
  if (!tickets) {
@@ -139,7 +189,7 @@ const controllerFactory = (db, publicPath) => {
139
189
  const update = async (req, res) => {
140
190
  try {
141
191
  const { _id } = req.body;
142
-
192
+
143
193
  // Поиск билета по ID
144
194
  const ticket = await Ticket.findById(_id);
145
195
 
@@ -147,15 +197,18 @@ const controllerFactory = (db, publicPath) => {
147
197
  if (!ticket) {
148
198
  return res.status(404).send({ errorCode: "TICKET_NOT_FOUND" });
149
199
  }
150
-
200
+
151
201
  // Проверка статуса билета
152
- if (ticket.status === "used") {
202
+ if (ticket.status === "used" && req.body.check) {
153
203
  return res.status(500).send({ errorCode: "TICKET_ALREADY_USED" });
154
204
  }
205
+
206
+ if (ticket.status === "deactivated" && req.body.check) {
207
+ return res.status(500).send({ errorCode: "TICKET_DEACTIVATED" });
208
+ }
155
209
 
156
210
  // Обновление билета
157
- const updatedTicket = await Ticket.findByIdAndUpdate(_id, req.body, { new: true });
158
-
211
+ const updatedTicket = await Ticket.findOneAndUpdate({_id: _id}, req.body, { new: true });
159
212
  // Отправка обновленного билета
160
213
  res.send(updatedTicket);
161
214
  } catch (err) {
@@ -0,0 +1,14 @@
1
+ const Mustache = require("mustache");
2
+
3
+ // Шаблон HTML и CSS в одной строке
4
+ const template = `
5
+ <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Ticket Confirmation</title></head><body style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;margin:0;padding:0;color:#333;background-color:#f9f9f9"><span style="opacity:0">{{ randomness }}</span><div class="container" style="border-radius:48px;width:100%;max-width:650px;background:#fff;margin:20px auto;overflow:hidden"><div class="header" style="background:#e31c25;color:#fff;text-align:left"><img alt="NO MORE SNOW" style="max-width:150px;height:auto;padding:20px" src="https://thecommunephuket.com/logo/nms_logotype-white.jpg"><h1 style="box-sizing:border-box;border-top:2px solid rgba(0,0,0,.1);padding:40px;text-align:center;margin:0;text-transform:uppercase;width:100%">Confirmation of Your Ticket Purchase</h1></div><div class="content" style="padding:20px;text-align:center"><h2 style="color:#000">Thank You, {{clientName}}!</h2><p style="color:#000;opacity:.5">Your purchase has been confirmed. Please find your ticket attached to this email.</p><div class="details" style="background-color:#f5f5f5;padding:10px;margin-top:20px;margin-bottom:20px;border-radius:24px"><h3 style="color:#000;margin:0">Event Details</h3><p style="display:flex;color:#000"><strong style="display:block;width:100%;opacity:.5;text-align:right;margin-right:.5rem">Event:</strong><span style="text-align:left;width:100%">{{eventName}}</span></p><p style="display:flex;color:#000"><strong style="display:block;width:100%;opacity:.5;text-align:right;margin-right:.5rem">Date:</strong><span style="text-align:left;width:100%">{{eventDate}}</span></p><p style="display:flex;color:#000"><strong style="display:block;width:100%;opacity:.5;text-align:right;margin-right:.5rem">Time:</strong><span style="text-align:left;width:100%">{{eventTime}}</span></p></div><div class="social-links" style="text-align:center"><h3 style="color:#000">Stay Connected</h3><p style="color:#000;opacity:.5">Follow us on Instagram for the latest updates and exclusive content!</p><table border="0" cellpadding="0" cellspacing="0" style="margin: 0 auto; border-collapse:separate;mso-table-lspace:0;mso-table-rspace:0;width:auto"><tr><td style="font-family:sans-serif;font-size:14px;vertical-align:top;background-color:#e31c25;border-radius:48px;text-align:center" valign="top" bgcolor="#e31c25" align="center"><a href="https://www.instagram.com/no.more.snow/?hl=en" target="_blank" style="display:inline-block;color:#fff;background-color:#e31c25;border:solid 1px #e31c25;border-radius:48px;box-sizing:border-box;cursor:pointer;text-decoration:none;font-size:14px;font-weight:700;margin:0;padding:12px 25px;text-transform:capitalize;border-color:#e31c25">Instagram</a></td></tr></table></div><div class="footer" style="text-align:center;padding:10px 20px;border-radius:24px"><p style="color:#000">Need help? Contact us:<a href="https://t.me/thecommunebar" style="color:#e31c25">@thecommunebar</a></p></div><p class="details copyright" style="color:#000;background-color:#f5f5f5;padding:20px;margin-top:20px;margin-bottom:20px;border-radius:24px;margin:0;box-sizing:border-box;text-align:center">&copy; 2024 NO MORE SNOW Ltd. All Rights Reserved.</p></div></div><span style="opacity:0">{{ randomness }}</span></body></html>
6
+ `;
7
+
8
+ // Функция для рендеринга шаблона с данными
9
+ function renderTemplate(data) {
10
+ return Mustache.render(template, data);
11
+ }
12
+
13
+ module.exports = { renderTemplate };
14
+