@ozdao/prometheus-framework 0.2.59 → 0.2.61

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. package/dist/auth.server.js +12 -223
  2. package/dist/auth.server.mjs +12 -223
  3. package/dist/community.server.js +3 -2
  4. package/dist/community.server.mjs +2 -1
  5. package/dist/events.server.js +117 -25
  6. package/dist/events.server.mjs +116 -24
  7. package/dist/files.server.js +7 -7
  8. package/dist/files.server.mjs +7 -7
  9. package/dist/gallery.server.js +2 -2
  10. package/dist/gallery.server.mjs +2 -2
  11. package/dist/main-DsseFd2d.mjs +13753 -0
  12. package/dist/main-U466Gwzt.js +91 -0
  13. package/dist/main.css +1 -1
  14. package/dist/metadata.schema-CS6_9GLU.js +174 -0
  15. package/dist/metadata.schema-CjpDDEnW.mjs +210 -0
  16. package/dist/metadata.schema-D88c1Ebp.mjs +175 -0
  17. package/dist/metadata.schema-doiYQfuO.js +209 -0
  18. package/dist/organizations.server.js +212 -16
  19. package/dist/organizations.server.mjs +212 -16
  20. package/dist/ownership.schema-DN0SlQL6.js +36 -0
  21. package/dist/ownership.schema-oyx6eNkZ.mjs +37 -0
  22. package/dist/products.server.js +8 -5
  23. package/dist/products.server.mjs +8 -5
  24. package/dist/prometheus-framework/src/components/Chips/Chips.vue.cjs +1 -1
  25. package/dist/prometheus-framework/src/components/Chips/Chips.vue.js +19 -14
  26. package/dist/prometheus-framework/src/components/Feed/Feed.vue.cjs +1 -1
  27. package/dist/prometheus-framework/src/components/Feed/Feed.vue.js +26 -26
  28. package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.cjs +1 -1
  29. package/dist/prometheus-framework/src/components/FieldPhone/FieldPhone2.vue.js +1 -373
  30. package/dist/prometheus-framework/src/components/Popup/Popup.vue.cjs +1 -1
  31. package/dist/prometheus-framework/src/components/Popup/Popup.vue.js +1 -72
  32. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +1 -1
  33. package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +72 -1
  34. package/dist/prometheus-framework/src/components/Select/Select.vue.cjs +1 -1
  35. package/dist/prometheus-framework/src/components/Select/Select.vue.js +1 -97
  36. package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +1 -1
  37. package/dist/prometheus-framework/src/components/Select/Select.vue2.js +97 -1
  38. package/dist/prometheus-framework/src/components/Tab/Tab.vue.cjs +1 -1
  39. package/dist/prometheus-framework/src/components/Tab/Tab.vue.js +46 -1
  40. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.cjs +1 -1
  41. package/dist/prometheus-framework/src/components/Tab/Tab.vue2.js +1 -46
  42. package/dist/prometheus-framework/src/modules/auth/auth.client.cjs +1 -1
  43. package/dist/prometheus-framework/src/modules/auth/auth.client.js +12 -14
  44. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.cjs +1 -1
  45. package/dist/prometheus-framework/src/modules/auth/components/layouts/Auth.vue.js +1 -1
  46. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.cjs +1 -1
  47. package/dist/prometheus-framework/src/modules/auth/components/pages/EnterPassword.vue.js +1 -1
  48. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.cjs +1 -1
  49. package/dist/prometheus-framework/src/modules/auth/components/pages/Invite.vue.js +2 -2
  50. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.cjs +1 -1
  51. package/dist/prometheus-framework/src/modules/auth/components/pages/ResetPassword.vue.js +1 -1
  52. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.cjs +1 -1
  53. package/dist/prometheus-framework/src/modules/auth/components/pages/SignIn.vue.js +1 -1
  54. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.cjs +1 -1
  55. package/dist/prometheus-framework/src/modules/auth/components/pages/SignUp.vue.js +1 -1
  56. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
  57. package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
  58. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
  59. package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
  60. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
  61. package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
  62. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
  63. package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
  64. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.cjs +1 -5
  65. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue.js +0 -66
  66. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.cjs +5 -1
  67. package/dist/prometheus-framework/src/modules/constructor/components/elements/Textarea.vue2.js +66 -0
  68. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
  69. package/dist/prometheus-framework/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
  70. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.cjs +1 -1
  71. package/dist/prometheus-framework/src/modules/events/components/layouts/layoutEvents.vue.js +1 -1
  72. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
  73. package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +199 -185
  74. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -0
  75. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +168 -0
  76. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.cjs +1 -0
  77. package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue2.js +1 -0
  78. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.cjs +2 -2
  79. package/dist/prometheus-framework/src/modules/events/components/pages/Event.vue.js +43 -43
  80. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.cjs +1 -1
  81. package/dist/prometheus-framework/src/modules/events/components/pages/Events.vue.js +2 -2
  82. package/dist/prometheus-framework/src/modules/events/router/events.cjs +1 -1
  83. package/dist/prometheus-framework/src/modules/events/router/events.js +11 -2
  84. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +1 -1
  85. package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  86. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.cjs +1 -1
  87. package/dist/prometheus-framework/src/modules/gallery/components/sections/GalleryWithCategories.vue.js +1 -1
  88. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.cjs +1 -1
  89. package/dist/prometheus-framework/src/modules/globals/components/blocks/CardHeader.vue.js +59 -56
  90. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
  91. package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
  92. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.cjs +1 -1
  93. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue.js +1 -13
  94. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.cjs +1 -1
  95. package/dist/prometheus-framework/src/modules/mobile/components/Menu/Menu.vue2.js +13 -1
  96. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.cjs +1 -1
  97. package/dist/prometheus-framework/src/modules/orders/components/pages/EditOrder.vue.js +167 -124
  98. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
  99. package/dist/prometheus-framework/src/modules/orders/components/pages/Orders.vue.js +56 -45
  100. package/dist/prometheus-framework/src/modules/orders/store/orders.cjs +1 -1
  101. package/dist/prometheus-framework/src/modules/orders/store/orders.js +19 -24
  102. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.cjs +1 -1
  103. package/dist/prometheus-framework/src/modules/organizations/components/blocks/DepartmentMemberModify.vue.js +1 -1
  104. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
  105. package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +3 -3
  106. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
  107. package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +3 -3
  108. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
  109. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +25 -25
  110. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
  111. package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +3 -3
  112. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
  113. package/dist/prometheus-framework/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
  114. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
  115. package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
  116. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
  117. package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
  118. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
  119. package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +3 -3
  120. package/dist/prometheus-framework/src/modules/organizations/organizations.client.cjs +1 -1
  121. package/dist/prometheus-framework/src/modules/organizations/organizations.client.js +40 -38
  122. package/dist/prometheus-framework/src/modules/organizations/store/departments.cjs +1 -1
  123. package/dist/prometheus-framework/src/modules/organizations/store/departments.js +19 -19
  124. package/dist/prometheus-framework/src/modules/organizations/store/invites.cjs +1 -1
  125. package/dist/prometheus-framework/src/modules/organizations/store/invites.js +5 -5
  126. package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.cjs +1 -1
  127. package/dist/prometheus-framework/src/modules/products/components/blocks/CardLeftover.vue.js +36 -27
  128. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
  129. package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +16 -16
  130. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
  131. package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
  132. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
  133. package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  134. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
  135. package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +11 -11
  136. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
  137. package/dist/prometheus-framework/src/modules/products/components/pages/Leftovers.vue.js +21 -21
  138. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
  139. package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
  140. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.cjs +1 -1
  141. package/dist/prometheus-framework/src/modules/products/components/pages/Products.vue.js +36 -50
  142. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
  143. package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
  144. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
  145. package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
  146. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
  147. package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +1 -1
  148. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.cjs +1 -1
  149. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileBlogposts.vue.js +1 -1
  150. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +1 -1
  151. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +1 -1
  152. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.cjs +1 -1
  153. package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEvents.vue.js +1 -1
  154. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.cjs +1 -1
  155. package/dist/prometheus-framework/src/modules/wallet/components/pages/Wallet.vue.js +2 -2
  156. package/dist/prometheus-framework.cjs.js +1 -1
  157. package/dist/prometheus-framework.es.js +1 -1
  158. package/dist/style.css +1 -1
  159. package/dist/web-D7bW32Ul.mjs +54 -0
  160. package/dist/web-DpE9HxA3.js +1 -0
  161. package/package.json +1 -1
  162. package/src/components/Chips/Chips.vue +2 -2
  163. package/src/components/Feed/Feed.vue +2 -1
  164. package/src/modules/auth/auth.client.js +0 -2
  165. package/src/modules/auth/auth.server.js +1 -7
  166. package/src/modules/auth/components/pages/Invite.vue +1 -1
  167. package/src/modules/events/components/pages/EditEvent.vue +19 -0
  168. package/src/modules/events/components/pages/EditEventTickets.vue +194 -0
  169. package/src/modules/events/controllers/tickets.controller.js +103 -28
  170. package/src/modules/events/models/ticket.model.js +22 -4
  171. package/src/modules/events/router/events.js +5 -0
  172. package/src/modules/events/routes/tickets.routes.js +2 -2
  173. package/src/modules/events/store/tickets.js +1 -0
  174. package/src/modules/globals/components/blocks/CardHeader.vue +6 -6
  175. package/src/modules/organizations/components/pages/Members.vue +1 -1
  176. package/src/modules/organizations/components/pages/Organization.vue +4 -4
  177. package/src/modules/organizations/components/sections/MembersAdd.vue +1 -1
  178. package/src/modules/organizations/controllers/departments.controller.js +14 -1
  179. package/src/modules/organizations/models/department.model.js +5 -1
  180. package/src/modules/organizations/organizations.client.js +2 -0
  181. package/src/modules/organizations/organizations.server.js +6 -2
  182. package/src/modules/organizations/routes/departments.routes.js +1 -1
  183. package/src/modules/organizations/store/departments.js +3 -2
  184. package/src/modules/products/components/blocks/CardLeftover.vue +19 -7
  185. package/src/modules/products/components/pages/EditLeftover.vue +1 -1
  186. package/src/modules/products/components/pages/Leftovers.vue +14 -3
  187. package/src/modules/products/components/pages/Products.vue +8 -8
  188. package/src/modules/products/models/leftover.model.js +9 -5
  189. package/src/modules/users/models/client.model.js +60 -0
  190. /package/src/modules/{auth → organizations}/controllers/invites.controller.js +0 -0
  191. /package/src/modules/{auth → organizations}/models/invite.model.js +0 -0
  192. /package/src/modules/{auth → organizations}/routes/invites.routes.js +0 -0
  193. /package/src/modules/{auth → organizations}/store/invites.js +0 -0
@@ -0,0 +1,194 @@
1
+ <template>
2
+ <article v-if="event" class="h-100 pd-thin">
3
+ <header
4
+ class="mn-b-medium flex-v-center flex-nowrap flex"
5
+ >
6
+ <h2 class="mn-r-medium">Tickets</h2>
7
+ <button
8
+ @click="openTicketsPopup()"
9
+ class="radius-100 i-big hover-scale-1 cursor-pointer t-white bg-second">
10
+ +
11
+ </button>
12
+ </header>
13
+
14
+ <Popup
15
+ title="Добавить участника"
16
+ @close-popup="closeTicketsPopup"
17
+ :isPopupOpen="isOpenTicketsPopup"
18
+ class="w-max-40r"
19
+ >
20
+ <Block
21
+ title="Add tickets"
22
+ placeholder="No parameters added yet"
23
+ :actions="[{
24
+ label: '+',
25
+ function: () => newTickets.push({name: '', value: '', target: event._id, type: 'event'})
26
+ }]"
27
+ class="cols-1 mn-b-thin gap-thin"
28
+ >
29
+ <div
30
+ class="gap-thin flex-nowrap flex"
31
+ v-for="(item, index) in newTickets"
32
+ :key="index"
33
+ >
34
+ <Field
35
+ v-model:field="item.name"
36
+ placeholder="Name"
37
+ class="w-30 bg-white radius-small pd-medium"
38
+ />
39
+ <Field
40
+ v-model:field="item.email"
41
+ placeholder="Email"
42
+ class="w-100 bg-white radius-small pd-medium"
43
+ />
44
+ <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
+ <IconDelete
46
+ class="i-medium"
47
+ />
48
+ </div>
49
+ </div>
50
+
51
+ <Button
52
+ :submit="onSubmit"
53
+ :callback="closeTicketsPopup"
54
+ class="w-100 bg-black t-white"
55
+ >
56
+ Create Tickets
57
+ </Button>
58
+ </Block>
59
+ </Popup>
60
+
61
+ <Feed
62
+ :states="{
63
+ empty: {
64
+ title: 'No Tickets Found',
65
+ description: 'Currently, there are no tickets.'
66
+ }
67
+ }"
68
+ :store="{
69
+ read: (options) => tickets.actions.read(options),
70
+ state: null
71
+ }"
72
+ :options="{
73
+ target: event._id
74
+ }"
75
+ v-slot="{
76
+ items
77
+ }"
78
+ >
79
+ <div
80
+ v-for="(ticket, index) in items"
81
+ class="radius-big bg-grey gap-small pd-small flex-nowrap flex pos-relative mn-b-thin"
82
+ >
83
+
84
+ <img :src="ticket.image" class="radius-small h-5r w-5r">
85
+
86
+ <div class="">
87
+ <p class="h4">
88
+ {{ticket.client_refactor?.name || 'No name'}}, {{ticket.role}}
89
+ </p>
90
+ <p class="h5 t-transp mn-b-thin">
91
+ {{ticket.client_refactor?.email || 'No email'}}
92
+ </p>
93
+
94
+ <span class="pd-r-thin pd-l-thin pd-b-nano pd-t-nano bg-second radius-extra t-white t-medium d-block w-max uppercase">
95
+ {{ticket.status}}
96
+ </span>
97
+ </div>
98
+
99
+ <Button
100
+ :submit="onSubmit"
101
+ :callback="redirectTo"
102
+ class="w-min h-min mn-l-auto bg-black t-white"
103
+ >
104
+ Deactivate
105
+ </Button>
106
+
107
+ </div>
108
+ </Feed>
109
+
110
+ </article>
111
+ </template>
112
+
113
+ <script setup>
114
+ import Feed from '@pf/src/components/Feed/Feed.vue';
115
+ import Block from '@pf/src/components/Block/Block.vue';
116
+ import Popup from "@pf/src/components/Popup/Popup.vue";
117
+ import Field from '@pf/src/components/Field/Field.vue'
118
+ import Button from '@pf/src/components/Button/Button.vue';
119
+
120
+ import IconDelete from '@pf/src/modules/icons/navigation/IconDelete.vue';
121
+
122
+ import { ref, onMounted } from 'vue';
123
+ import { useRoute, useRouter } from 'vue-router';
124
+
125
+ import * as events from '@pf/src/modules/events/store/events.js';
126
+ import * as auth from '@pf/src/modules/auth/store/auth';
127
+ import * as organizations from '@pf/src/modules/organizations/store/organizations';
128
+
129
+ import * as tickets from '@pf/src/modules/events/store/tickets';
130
+
131
+ const route = useRoute();
132
+ const router = useRouter();
133
+
134
+ let event = ref(null);
135
+
136
+ const newTickets = ref([{
137
+ name: '',
138
+ email: '',
139
+ target: event.value?._id,
140
+ type: 'event'
141
+ }])
142
+
143
+ const isOpenTicketsPopup = ref(false);
144
+
145
+ function openTicketsPopup(department) {
146
+ isOpenTicketsPopup.value = true;
147
+
148
+ newTickets.value = [{
149
+ name: '',
150
+ email: '',
151
+ target: event.value?._id,
152
+ type: 'event'
153
+ }]
154
+ }
155
+
156
+ function closeTicketsPopup() {
157
+ isOpenTicketsPopup.value = false;
158
+ }
159
+
160
+
161
+ onMounted(async () =>{
162
+ const data = await events.read({ user: auth.state.user._id, url: route.params.url });
163
+
164
+ event.value = data.pop();
165
+ })
166
+
167
+ async function onSubmit() {
168
+ try {
169
+ const response = await tickets.actions.create(newTickets.value);
170
+ } catch (error) {
171
+ console.log(error);
172
+ }
173
+ }
174
+
175
+ async function onDeactivate() {
176
+ if (confirm('Are you sure you want to deactivate this event?')) {
177
+ try {
178
+ const response = await events.update(event.value._id);
179
+ } catch (error) {
180
+ console.error(error);
181
+ }
182
+ }
183
+ }
184
+
185
+ </script>
186
+
187
+ <style lang="scss">
188
+ .dp__input {
189
+ border: 0;
190
+ padding: var(--medium);
191
+ padding-left: 3rem;
192
+ background: rgb(var(--grey))
193
+ }
194
+ </style>
@@ -1,8 +1,110 @@
1
1
  const QRCode = require("qrcode");
2
+ const Jimp = require('jimp');
3
+ const path = require('path');
2
4
 
3
- const controllerFactory = (db) => {
5
+ const { sendEmail } = require('@pf/src/modules/globals/utils/mailing');
6
+
7
+ const controllerFactory = (db, publicPath) => {
4
8
  const Ticket = db.ticket;
5
9
 
10
+ // Функция для создания билета, генерации QR-кода и сохранения билета
11
+ 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' });
20
+
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;
44
+
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
+ }
72
+ }
73
+
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
+ };
107
+
6
108
  const read = async (req, res) => {
7
109
  let query = {};
8
110
  let options = {};
@@ -34,33 +136,6 @@ const controllerFactory = (db) => {
34
136
  }
35
137
  };
36
138
 
37
- const create = async (req, res) => {
38
- const newTicket = new Ticket({
39
- user: req.body.user,
40
- type: req.body.type,
41
- target: req.body.target,
42
- role: req.body.role
43
- });
44
-
45
- try {
46
- const data = await newTicket.save();
47
-
48
- // Working with qrcode
49
- const qrData = data._id.toString();
50
- const qrCode = await QRCode.toDataURL(qrData);
51
-
52
- data.status = "unused";
53
- data.qrcode = qrCode;
54
-
55
- // Updated ticked with generated qrcode
56
- await data.save();
57
-
58
- res.send(data);
59
- } catch (err) {
60
- res.status(500).send({ errorCode: "SERVER_ERROR" });
61
- }
62
- };
63
-
64
139
  const update = async (req, res) => {
65
140
  try {
66
141
  const { _id } = req.body;
@@ -1,17 +1,28 @@
1
1
  module.exports = (mongoose) => {
2
2
  const TicketSchema = new mongoose.Schema({
3
+ client: {
4
+ type: mongoose.Schema.Types.ObjectId,
5
+ ref: 'Client',
6
+ },
7
+ client_refactor: {
8
+ email: {
9
+ type: String,
10
+ },
11
+ name: {
12
+ type: String,
13
+ },
14
+ },
3
15
  user: {
4
16
  type: mongoose.Schema.Types.ObjectId,
5
17
  ref: 'User',
6
- required: true,
7
18
  },
8
19
  type: {
9
20
  type: String,
10
21
  enum: ['event','parking'],
11
- default: 'organization',
22
+ default: 'event',
12
23
  required: true,
13
24
  },
14
- target: { // заменяем 'organization' на 'target', так как это может быть или User, или Organization
25
+ target: {
15
26
  type: mongoose.Schema.Types.ObjectId,
16
27
  ref: function (value) {
17
28
  if (this.type === 'event') return 'Event';
@@ -26,11 +37,18 @@ module.exports = (mongoose) => {
26
37
  qrcode: {
27
38
  type: String,
28
39
  },
40
+ image: {
41
+ type: String,
42
+ },
29
43
  status: {
30
44
  type: String,
31
- enum: ["unused", "used"],
45
+ enum: ["unused", "used","deactivated"],
32
46
  deafult: "unused",
33
47
  },
48
+ }, {
49
+ timestamps: {
50
+ currentTime: () => Date.now()
51
+ }
34
52
  });
35
53
 
36
54
  TicketSchema.index({ user: 1, type: 1, target: 1 });
@@ -50,6 +50,11 @@ const eventsRoutes = [
50
50
  name: 'Edit Event',
51
51
  meta: { authorize: [] },
52
52
  component: () => import(/* webpackChunkName: 'EditEvent' */ '../components/pages/EditEvent.vue')
53
+ },{
54
+ path: 'events/:url/edit/tickets',
55
+ name: 'Edit Event Tickets',
56
+ meta: { authorize: [] },
57
+ component: () => import(/* webpackChunkName: 'EditEvent' */ '../components/pages/EditEventTickets.vue')
53
58
  }
54
59
  ];
55
60
 
@@ -1,8 +1,8 @@
1
1
  // Factories
2
2
  const controllerFactory = require("../controllers/tickets.controller");
3
3
  // Routes
4
- module.exports = function(app, db, origins) {
5
- const controller = controllerFactory(db);
4
+ module.exports = function(app, db, origins, publicPath) {
5
+ const controller = controllerFactory(db, publicPath);
6
6
 
7
7
  app.use(function(req, res, next) {
8
8
 
@@ -22,6 +22,7 @@ const state = reactive({
22
22
  // Methods
23
23
  const actions = {
24
24
  async read({ user, type, target, role }) {
25
+
25
26
  try {
26
27
  const response = await $axios.get(`/api/tickets`, { params: { user, type, target, role } });
27
28
  state.error = null;
@@ -11,7 +11,7 @@
11
11
  class="w-100 flex-nowrap flex-v-center flex"
12
12
  >
13
13
  <img
14
- v-if="owner.target.profile.photo?.length > 0 && type !== 'short'"
14
+ v-if="owner.target?.profile?.photo?.length > 0 && type !== 'short'"
15
15
  :src="(FILE_SERVER_URL || '') + owner.target.profile.photo"
16
16
  class="radius-medium object-fit-cover mn-r-thin i-thin"
17
17
 
@@ -24,7 +24,7 @@
24
24
  />
25
25
 
26
26
  <PlaceholderUserpic
27
- v-if="!owner.target.profile.photo && type !== 'short'"
27
+ v-if="!owner.target?.profile?.photo && type !== 'short'"
28
28
  class="radius-medium mn-r-thin i-thin"
29
29
 
30
30
  @click.stop="$router.push({
@@ -48,19 +48,19 @@
48
48
  }
49
49
  })"
50
50
  >
51
- {{owner.target.profile.name}}
51
+ {{owner.target?.profile?.name}}
52
52
  </span>
53
53
 
54
54
  <span
55
- v-if="!creator.hidden && owner.target.profile.name !== creator.target.profile?.name"
55
+ v-if="!creator.hidden && owner.target?.profile?.name !== creator.target?.profile?.name"
56
56
  @click.stop="$router.push({
57
57
  name: 'User Profile',
58
58
  params: {
59
- _id: creator.target._id
59
+ _id: creator.target?._id
60
60
  }
61
61
  })"
62
62
  >
63
- · by {{creator.target.profile?.name}}
63
+ · by {{creator.target?.profile?.name}}
64
64
  </span>
65
65
  <span v-if="date">
66
66
  · {{getTimeElapsed(date)}}
@@ -81,7 +81,7 @@ import User from '@pf/src/modules/organizations/components/blocks/User.vue';
81
81
 
82
82
 
83
83
  import * as auth from '@pf/src/modules/auth/store/auth'
84
- import * as invites from '@pf/src/modules/auth/store/invites';
84
+ import * as invites from '@pf/src/modules/organizations/store/invites';
85
85
  import * as memberships from '@pf/src/modules/organizations/store/memberships';
86
86
  import * as organization from '@pf/src/modules/organizations/store/organizations'
87
87
  import * as departments from '@pf/src/modules/organizations/store/departments';
@@ -26,13 +26,13 @@
26
26
  }
27
27
  }"
28
28
  :store="{
29
- read: (options) => departments.actions.read(route.params._id),
29
+ read: (options) => departments.actions.read(options),
30
30
  state: null
31
31
  }"
32
32
  :options="{
33
- user: auth.state.user._id,
34
- sort: 'numberOfMemberships',
35
- limit: 10
33
+ organization: route.params._id,
34
+ user: auth.state.user._id,
35
+ hidden: false,
36
36
  }"
37
37
  v-slot="{
38
38
  items
@@ -58,7 +58,7 @@
58
58
  import Button from '@pf/src/components/Button/Button.vue'
59
59
  // Import validation
60
60
  import * as inputsValidation from '@pf/src/modules/middlewares/client/inputs.validation'
61
- import * as invites from '@pf/src/modules/auth/store/invites';
61
+ import * as invites from '@pf/src/modules/organizations/store/invites';
62
62
  // Props
63
63
  const props = defineProps({
64
64
  organization: Object,
@@ -17,7 +17,20 @@ const controllerFactory = (db) => {
17
17
  };
18
18
 
19
19
  const read = (req, res) => {
20
- Department.find({ organization: req.params._id })
20
+ let query = {};
21
+ let options = {};
22
+
23
+ console.log(req.query)
24
+
25
+ if (req.query.organization) {
26
+ query.organization = new db.mongoose.Types.ObjectId(req.query.organization);
27
+ }
28
+
29
+ if (req.query.hidden) {
30
+ query.hidden = req.query.hidden;
31
+ }
32
+
33
+ Department.find(query, null, options)
21
34
  .populate('members.user')
22
35
  .populate('subdepartments')
23
36
  .then(departments => {
@@ -21,7 +21,11 @@ module.exports = (mongoose) => {
21
21
  start: String,
22
22
  end: String
23
23
  }
24
- }],
24
+ }],
25
+ hidden: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
25
29
  // Marketplace options
26
30
  delivery: [String],
27
31
  payment: [String],
@@ -30,6 +30,7 @@ import ButtonToggleMembership from './components/elements/ButtonToggleMembership
30
30
  import * as departmentsStore from './store/departments.js';
31
31
  import * as membershipsStore from './store/memberships.js';
32
32
  import * as organizationStore from './store/organizations.js';
33
+ import * as invitesStore from './store/invites.js';
33
34
 
34
35
  // Import Vue Router routes
35
36
  import organizationsRouter from './router/organizations.js';
@@ -61,6 +62,7 @@ ButtonToggleMembership,
61
62
  departmentsStore,
62
63
  membershipsStore,
63
64
  organizationStore,
65
+ invitesStore,
64
66
  organizationsRouter
65
67
  };
66
68
 
@@ -2,26 +2,30 @@
2
2
  const DepartmentsController = require('./controllers/departments.controller.js');
3
3
  const OrganizationsController = require('./controllers/organizations.controller.js');
4
4
  const MembershipsController = require('./controllers/memberships.controller.js');
5
-
5
+ const InvitesController = require('./controllers/invites.controller.js');
6
6
  // Importing routes
7
7
  const departmentsRoutes = require('./routes/departments.routes.js');
8
8
  const organizationsRoutes = require('./routes/organizations.routes.js');
9
9
  const membershipsRoutes = require('./routes/memberships.routes.js');
10
-
10
+ const invitesRoutes = require('./routes/invites.routes.js')
11
11
  // Importing models
12
12
  const DepartmentModel = require('./models/department.model.js');
13
13
  const OrganizationModel = require('./models/organization.model.js');
14
14
  const MembershipModel = require('./models/membership.model.js');
15
+ const InviteModel = require('./models/invite.model.js');
15
16
 
16
17
  // Exporting
17
18
  module.exports = {
18
19
  DepartmentsController,
19
20
  OrganizationsController,
20
21
  MembershipsController,
22
+ InvitesController,
21
23
  departmentsRoutes,
22
24
  organizationsRoutes,
23
25
  membershipsRoutes,
26
+ invitesRoutes,
24
27
  DepartmentModel,
25
28
  OrganizationModel,
26
29
  MembershipModel,
30
+ InviteModel
27
31
  };
@@ -14,7 +14,7 @@ module.exports = function(app, db) {
14
14
  });
15
15
 
16
16
  // Get organization departments by _id
17
- app.get("/api/departments/:_id", controller.read);
17
+ app.get("/api/departments/read", controller.read);
18
18
 
19
19
  // Get department by _id
20
20
  app.get("/api/departments/get/:_id", controller.readOne);
@@ -48,9 +48,10 @@ const actions = {
48
48
  }
49
49
  },
50
50
 
51
- async read(organizationId) {
51
+ async read(options) {
52
52
  try {
53
- const response = await $axios.get(`/api/departments/${organizationId}`);
53
+ const response = await $axios.get(`/api/departments/read`, { params: options });
54
+
54
55
  console.log('Response:', response);
55
56
  state.departments = response.data;
56
57
  state.error = null;
@@ -1,8 +1,17 @@
1
1
  <template>
2
- <div class="flex-column pos-relative flex-wrap block">
2
+ <div class="flex-column pos-relative flex-wrap">
3
+ <CardHeader
4
+ :entity="leftover"
5
+ :entityType="'leftover'"
6
+ :user="user"
7
+ :owner="leftover.creator"
8
+ :creator="leftover.creator"
9
+ :date="leftover.createdAt"
10
+ />
11
+
3
12
  <div class="w-100 mn-b-thin flex">
4
13
  <p class="p-big">
5
- {{leftover.type}} #{{leftover._id}} {{leftover.organization}}
14
+ {{leftover.type}}
6
15
  </p>
7
16
  <IconEdit
8
17
  @click="$router.push({
@@ -16,14 +25,16 @@
16
25
  />
17
26
  </div>
18
27
 
19
- <div class="w-100 spoiler">
20
- <div @click="spoiler = !spoiler" class="mn-b-small flex">
28
+
29
+
30
+ <div class="w-100 bg-white radius-small pd-small spoiler">
31
+ <div @click="spoiler = !spoiler" class="flex">
21
32
  <span>Всего товаров {{leftover.positions.length}}</span>
22
33
  <!-- <img :class="{ 'spoiler-active': spoiler }" class="button-icon" src="@/assets/icons/arrow-down-spoiler.svg"> -->
23
34
  </div>
24
35
  <transition name="fade">
25
36
  <div v-if="spoiler">
26
- <div v-for="position in leftover.positions" class="w-100 mn-b-thin flex">
37
+ <div v-for="position in leftover.positions" class="mn-t-small w-100 mn-b-thin flex">
27
38
  <div class=" w-50 flex">
28
39
  <span>
29
40
  <!-- <span class="t-transp">Название:</span> -->
@@ -43,7 +54,7 @@
43
54
  </transition>
44
55
  </div>
45
56
 
46
- <!-- <p class="t-transp">Created At {{leftover.createdAt}} by </p> -->
57
+
47
58
  </div>
48
59
  </template>
49
60
 
@@ -52,11 +63,12 @@
52
63
  import { ref } from 'vue'
53
64
  import { useRouter } from 'vue-router'
54
65
 
66
+ import CardHeader from '@pf/src/modules/globals/components/blocks/CardHeader.vue'
67
+
55
68
  // Icons
56
69
  import IconEdit from '@pf/src/modules/icons/navigation/IconEdit.vue'
57
70
  import PlaceholderUserpic from '@pf/src/modules/icons/placeholders/PlaceholderUserpic.vue'
58
71
 
59
-
60
72
  const router = useRouter()
61
73
 
62
74
  const props = defineProps({