@ozdao/prometheus-framework 0.2.225 → 0.2.227
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/builder.js +2 -2
- package/dist/builder.mjs +2 -2
- package/dist/events.server.js +1 -1
- package/dist/events.server.mjs +1 -1
- package/dist/prometheus-framework/src/components/Status/Status.vue.cjs +7 -2
- package/dist/prometheus-framework/src/components/Status/Status.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/components/Status/Status.vue.js +7 -2
- package/dist/prometheus-framework/src/components/Status/Status.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/auth.client.cjs +4 -0
- package/dist/prometheus-framework/src/modules/auth/auth.client.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/auth.client.js +4 -0
- package/dist/prometheus-framework/src/modules/auth/auth.client.js.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs +5 -0
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js +5 -0
- package/dist/prometheus-framework/src/modules/auth/views/middlewares/auth.validation.js.map +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/partials/Sidebar.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/partials/Sidebar.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/layouts/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/pages/Gallery.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.cjs +2 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.js +2 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Sidebar.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Sidebar.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormPayment.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/pages/pages.client.cjs +526 -526
- package/dist/prometheus-framework/src/modules/pages/pages.client.js +526 -526
- package/dist/prometheus-framework/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ImagesThumbnails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +2 -2
- package/dist/prometheus-framework.cjs.js +1 -1
- package/dist/prometheus-framework.es.js +8 -3
- package/dist/tickets.controller-BGJZtL9V.mjs +408 -0
- package/dist/tickets.controller-DUsBFD24.js +407 -0
- package/dist/wallet.server.js +1 -1
- package/dist/wallet.server.mjs +1 -1
- package/package.json +1 -1
- package/src/builder/templates/page.js +1 -1
- package/src/builder/webpack/webpack.config.spa.js +1 -1
- package/src/components/Status/Status.vue +4 -2
- package/src/modules/auth/auth.client.js +13 -0
- package/src/modules/events/controllers/utils/templateEmail.js +1 -1
- package/src/modules/events/controllers/utils/templateTicket.js +25 -19
- package/src/modules/globals/views/components/layouts/Client.vue +1 -0
@@ -0,0 +1,408 @@
|
|
1
|
+
import require$$0$1 from "path";
|
2
|
+
import require$$1 from "puppeteer";
|
3
|
+
import require$$2 from "qrcode";
|
4
|
+
import require$$0 from "mustache";
|
5
|
+
import { m as mailing } from "./mailing-C3VD4l0h.mjs";
|
6
|
+
const Mustache$1 = require$$0;
|
7
|
+
const template$1 = `
|
8
|
+
<!DOCTYPE html>
|
9
|
+
<html lang="en">
|
10
|
+
<head>
|
11
|
+
<meta charset="UTF-8">
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
13
|
+
<style>
|
14
|
+
@media print {
|
15
|
+
body {-webkit-print-color-adjust: exact;}
|
16
|
+
}
|
17
|
+
|
18
|
+
body {
|
19
|
+
padding: 10%;
|
20
|
+
font-family: Arial,Helvetica,sans-serif
|
21
|
+
}
|
22
|
+
.ticket {
|
23
|
+
display: grid;
|
24
|
+
grid-template-columns: 100% 143px;
|
25
|
+
background: #f5f5f5;
|
26
|
+
border-radius: 48px;
|
27
|
+
cursor: default;
|
28
|
+
}
|
29
|
+
.ticket__main {
|
30
|
+
display: grid;
|
31
|
+
grid-template-columns: repeat(6, 1fr) 120px;
|
32
|
+
grid-template-rows: repeat(4, min-content) auto;
|
33
|
+
padding: 20px;
|
34
|
+
}
|
35
|
+
.header {
|
36
|
+
grid-area: title;
|
37
|
+
grid-column: span 7;
|
38
|
+
grid-row: 1;
|
39
|
+
display: flex;
|
40
|
+
align-items: center;
|
41
|
+
justify-content: center;
|
42
|
+
padding: 15px 20px 15px 20px;
|
43
|
+
width: 100%;
|
44
|
+
box-sizing: border-box;
|
45
|
+
background: #111;
|
46
|
+
border-radius: 24px 24px 0 0;
|
47
|
+
}
|
48
|
+
.header svg {
|
49
|
+
width: auto;
|
50
|
+
height: 48px;
|
51
|
+
margin-right: 8px;
|
52
|
+
}
|
53
|
+
.header p {
|
54
|
+
color: white;
|
55
|
+
border-radius: 48px;
|
56
|
+
padding: 5px 10px 5px 10px;
|
57
|
+
margin-left: auto;
|
58
|
+
line-height: 1;
|
59
|
+
font-weight: 400;
|
60
|
+
font-family: 'Helvetica Neue';
|
61
|
+
font-size: 10px;
|
62
|
+
text-transform: uppercase;
|
63
|
+
}
|
64
|
+
.header div {
|
65
|
+
color: white;
|
66
|
+
border-radius: 48px;
|
67
|
+
padding: 5px 10px 5px 10px;
|
68
|
+
margin-left: 0px;
|
69
|
+
line-height: 1;
|
70
|
+
text-transform: uppercase;
|
71
|
+
background: #E31C25;
|
72
|
+
}
|
73
|
+
.header span {
|
74
|
+
display: block;
|
75
|
+
}
|
76
|
+
.info {
|
77
|
+
border: 1px solid;
|
78
|
+
border-width: 0 1px 1px 0;
|
79
|
+
border-color: rgba(0,0,0,0.1);
|
80
|
+
padding: 8px;
|
81
|
+
}
|
82
|
+
.info__item {
|
83
|
+
font-size: 9px;
|
84
|
+
margin-top: 4px;
|
85
|
+
text-transform: uppercase;
|
86
|
+
letter-spacing: 0.5px;
|
87
|
+
font-family: 'Helvetica Neue';
|
88
|
+
}
|
89
|
+
.info__detail {
|
90
|
+
font: 700 20px/1;
|
91
|
+
letter-spacing: 1px;
|
92
|
+
font-weight: 600;
|
93
|
+
text-transform: uppercase;
|
94
|
+
margin-top: 4px;
|
95
|
+
color: #e31c25;
|
96
|
+
}
|
97
|
+
.passenger {
|
98
|
+
grid-column: 1 / span 6;
|
99
|
+
}
|
100
|
+
.platform {
|
101
|
+
grid-column: 7 / span 1;
|
102
|
+
grid-row: 2 / span 3;
|
103
|
+
background: #e31c25;
|
104
|
+
color: #fff;
|
105
|
+
border-color: rgba(0,0,0,0.1);
|
106
|
+
text-align: center;
|
107
|
+
padding: 10px;
|
108
|
+
border-radius: 0 0 24px 0;
|
109
|
+
font-size: 18px;
|
110
|
+
line-height: 1;
|
111
|
+
}
|
112
|
+
.platform img {
|
113
|
+
width: 100%;
|
114
|
+
padding: 10%;
|
115
|
+
box-sizing: border-box;
|
116
|
+
}
|
117
|
+
.departure, .arrival {
|
118
|
+
grid-column-start: span 3;
|
119
|
+
}
|
120
|
+
.passenger, .departure, .date {
|
121
|
+
border-left: 1px solid;
|
122
|
+
border-color: rgba(0,0,0,0.1);
|
123
|
+
}
|
124
|
+
.date, .time {
|
125
|
+
grid-column-start: span 3;
|
126
|
+
}
|
127
|
+
.date {
|
128
|
+
border-radius: 0 0 0 24px;
|
129
|
+
}
|
130
|
+
</style>
|
131
|
+
</head>
|
132
|
+
<body>
|
133
|
+
<div class="main-content">
|
134
|
+
<div class="ticket">
|
135
|
+
<div class="ticket__main">
|
136
|
+
<div class="header">
|
137
|
+
<svg class="w-auto h-3r" width="838" height="259" viewBox="0 0 838 259" fill="none" xmlns="http://www.w3.org/2000/svg">
|
138
|
+
<path d="M118.019 23.4448C118.019 21.1861 119.85 19.355 122.109 19.355H135.784C138.043 19.355 139.874 21.1861 139.874 23.4448V129.185H118.019V23.4448Z" fill="#E31C25"/>
|
139
|
+
<path d="M90.5875 52.6748C89.338 51.9401 88.5708 50.5988 88.5708 49.1494L88.5708 36.7835C88.5708 33.6207 92.0073 31.6548 94.7338 33.2581L118.019 46.9512L118.019 68.8062L90.5875 52.6748Z" fill="#E31C25"/>
|
140
|
+
<path d="M167.306 52.6748C168.556 51.9401 169.323 50.5988 169.323 49.1494L169.323 36.7835C169.323 33.6207 165.886 31.6548 163.16 33.2581L139.874 46.9512L139.874 68.8062L167.306 52.6748Z" fill="#E31C25"/>
|
141
|
+
<path d="M139.917 234.911C139.917 237.169 138.085 239 135.827 239L122.151 239C119.893 239 118.062 237.169 118.062 234.911L118.062 129.17L139.917 129.17L139.917 234.911Z" fill="#E31C25"/>
|
142
|
+
<path d="M167.349 205.681C168.598 206.415 169.365 207.757 169.365 209.206L169.365 221.572C169.365 224.735 165.929 226.701 163.202 225.097L139.917 211.404L139.917 189.549L167.349 205.681Z" fill="#E31C25"/>
|
143
|
+
<path d="M90.6295 205.681C89.38 206.415 88.6128 207.757 88.6128 209.206L88.6128 221.572C88.6128 224.735 92.0493 226.701 94.7758 225.097L118.061 211.404L118.061 189.549L90.6295 205.681Z" fill="#E31C25"/>
|
144
|
+
<path d="M31.9262 85.7934C29.97 84.6641 29.2998 82.1628 30.4292 80.2066L37.2668 68.3635C38.3962 66.4074 40.8975 65.7371 42.8536 66.8665L134.428 119.737L123.5 138.664L31.9262 85.7934Z" fill="#E31C25"/>
|
145
|
+
<path d="M43.524 124.165C42.263 124.88 40.7178 124.874 39.4626 124.149L28.7535 117.966C26.0143 116.385 26.0301 112.426 28.7818 110.866L52.2832 97.5468L71.2102 108.474L43.524 124.165Z" fill="#E31C25"/>
|
146
|
+
<path d="M81.8838 57.7248C81.8722 56.2753 81.0943 54.9403 79.839 54.2155L69.1299 48.0326C66.3908 46.4512 62.97 48.4444 62.9953 51.6072L63.2111 78.6197L82.138 89.5472L81.8838 57.7248Z" fill="#E31C25"/>
|
147
|
+
<path d="M226.01 172.563C227.966 173.692 228.636 176.193 227.507 178.149L220.669 189.992C219.54 191.949 217.039 192.619 215.082 191.489L123.508 138.619L134.436 119.692L226.01 172.563Z" fill="#E31C25"/>
|
148
|
+
<path d="M214.412 134.191C215.673 133.476 217.218 133.482 218.473 134.207L229.182 140.39C231.921 141.971 231.905 145.93 229.154 147.49L205.652 160.809L186.725 149.882L214.412 134.191Z" fill="#E31C25"/>
|
149
|
+
<path d="M176.052 200.631C176.064 202.081 176.842 203.416 178.097 204.14L188.806 210.323C191.545 211.905 194.966 209.912 194.941 206.749L194.725 179.736L175.798 168.809L176.052 200.631Z" fill="#E31C25"/>
|
150
|
+
<path d="M42.8744 191.526C40.9183 192.656 38.417 191.986 37.2876 190.029L30.45 178.186C29.3206 176.23 29.9908 173.729 31.9469 172.599L123.521 119.729L134.448 138.656L42.8744 191.526Z" fill="#E31C25"/>
|
151
|
+
<path d="M81.9048 200.668C81.8932 202.117 81.1153 203.452 79.86 204.177L69.1509 210.36C66.4118 211.941 62.991 209.948 63.0163 206.785L63.232 179.773L82.159 168.845L81.9048 200.668Z" fill="#E31C25"/>
|
152
|
+
<path d="M43.5455 134.227C42.2845 133.513 40.7393 133.519 39.484 134.243L28.7749 140.426C26.0358 142.008 26.0516 145.967 28.8033 147.526L52.3047 160.846L71.2316 149.918L43.5455 134.227Z" fill="#E31C25"/>
|
153
|
+
<path d="M215.061 66.8296C217.017 65.7002 219.519 66.3704 220.648 68.3266L227.486 80.1697C228.615 82.1258 227.945 84.6271 225.989 85.7565L134.415 138.627L123.487 119.7L215.061 66.8296Z" fill="#E31C25"/>
|
154
|
+
<path d="M176.031 57.6877C176.042 56.2382 176.82 54.9032 178.076 54.1784L188.785 47.9955C191.524 46.4141 194.945 48.4073 194.919 51.5701L194.703 78.5826L175.777 89.5101L176.031 57.6877Z" fill="#E31C25"/>
|
155
|
+
<path d="M214.39 124.128C215.651 124.843 217.196 124.837 218.452 124.112L229.161 117.929C231.9 116.348 231.884 112.389 229.132 110.829L205.631 97.5097L186.704 108.437L214.39 124.128Z" fill="#E31C25"/>
|
156
|
+
<path d="M129 116.049L140.216 122.524V135.476L129 141.951L117.784 135.476V122.524L129 116.049Z" fill="#E31C25"/>
|
157
|
+
<path d="M820.446 72.9078V76.2201H822.534C823.443 76.2201 824.12 76.0902 824.566 75.8304C825.03 75.552 825.262 75.0974 825.262 74.4665C825.262 73.9284 825.057 73.5387 824.649 73.2975C824.26 73.0377 823.749 72.9078 823.118 72.9078H820.446ZM818.609 82.9836V71.2378H823.063C825.753 71.2378 827.099 72.3419 827.099 74.55C827.099 75.1067 827.015 75.5799 826.848 75.9695C826.7 76.3592 826.486 76.6839 826.208 76.9437C825.93 77.2035 825.605 77.4076 825.234 77.5561C824.881 77.686 824.501 77.7787 824.093 77.8344L827.46 82.9836H825.234L821.866 77.8901H820.446V82.9836H818.609ZM830.494 77.1107C830.494 75.9788 830.281 74.9119 829.854 73.9099C829.427 72.9078 828.852 72.0357 828.128 71.2935C827.405 70.5513 826.551 69.9667 825.568 69.54C824.584 69.0946 823.536 68.8719 822.423 68.8719C821.309 68.8719 820.261 69.0946 819.277 69.54C818.294 69.9667 817.44 70.5513 816.717 71.2935C815.993 72.0357 815.418 72.9078 814.991 73.9099C814.564 74.9119 814.351 75.9788 814.351 77.1107C814.351 78.2426 814.564 79.3096 814.991 80.3116C815.418 81.3136 815.993 82.1857 816.717 82.928C817.44 83.6702 818.294 84.264 819.277 84.7093C820.261 85.1361 821.309 85.3495 822.423 85.3495C823.536 85.3495 824.584 85.1361 825.568 84.7093C826.551 84.264 827.405 83.6702 828.128 82.928C828.852 82.1857 829.427 81.3136 829.854 80.3116C830.281 79.3096 830.494 78.2426 830.494 77.1107ZM812.347 77.1107C812.347 75.719 812.607 74.4109 813.126 73.1862C813.664 71.9615 814.388 70.8945 815.297 69.9853C816.206 69.0761 817.273 68.3617 818.498 67.8421C819.723 67.304 821.031 67.0349 822.423 67.0349C823.814 67.0349 825.122 67.304 826.347 67.8421C827.572 68.3617 828.639 69.0761 829.548 69.9853C830.457 70.8945 831.172 71.9615 831.691 73.1862C832.229 74.4109 832.498 75.719 832.498 77.1107C832.498 78.5024 832.229 79.8106 831.691 81.0353C831.172 82.26 830.457 83.3269 829.548 84.2362C828.639 85.1454 827.572 85.8691 826.347 86.4072C825.122 86.9268 823.814 87.1865 822.423 87.1865C821.031 87.1865 819.723 86.9268 818.498 86.4072C817.273 85.8691 816.206 85.1454 815.297 84.2362C814.388 83.3269 813.664 82.26 813.126 81.0353C812.607 79.8106 812.347 78.5024 812.347 77.1107Z" fill="#FFFFFF"/>
|
158
|
+
<path d="M282.366 171.672C281.589 171.672 281.201 171.197 281.201 170.248V88.3279C281.201 87.3788 281.589 86.9043 282.366 86.9043H297.249C297.939 86.9043 298.37 87.2494 298.543 87.9396L310.32 130.647C310.924 132.804 311.528 135.22 312.132 137.894C312.822 140.569 313.469 143.287 314.073 146.047C314.763 148.722 315.281 151.095 315.626 153.165H315.885C315.798 151.44 315.669 149.455 315.496 147.212C315.41 144.883 315.281 142.51 315.108 140.094C315.022 137.592 314.936 135.22 314.849 132.976C314.849 130.647 314.849 128.619 314.849 126.894V88.1985C314.849 87.3357 315.238 86.9043 316.014 86.9043H326.497C327.273 86.9043 327.662 87.3357 327.662 88.1985V170.248C327.662 171.197 327.273 171.672 326.497 171.672H311.743C311.139 171.672 310.708 171.37 310.449 170.766L298.672 128.965C297.551 124.91 296.559 120.898 295.696 116.929C294.833 112.874 294.056 109.121 293.366 105.67H293.107C293.28 108.172 293.409 111.105 293.496 114.47C293.668 117.835 293.798 121.2 293.884 124.564C293.97 127.843 294.013 130.733 294.013 133.235V170.248C294.013 171.197 293.668 171.672 292.978 171.672H282.366ZM354.879 172.448C347.201 172.448 341.334 170.205 337.279 165.719C333.31 161.232 331.326 154.546 331.326 145.659V113.046C331.326 104.074 333.31 97.3439 337.279 92.8575C341.334 88.371 347.201 86.1278 354.879 86.1278C362.472 86.1278 368.295 88.371 372.351 92.8575C376.406 97.3439 378.433 104.074 378.433 113.046V145.659C378.433 154.546 376.406 161.232 372.351 165.719C368.295 170.205 362.472 172.448 354.879 172.448ZM354.879 160.024C358.244 160.024 360.746 158.86 362.385 156.53C364.111 154.201 364.974 150.361 364.974 145.012V113.693C364.974 108.258 364.111 104.375 362.385 102.046C360.746 99.7165 358.244 98.5518 354.879 98.5518C351.515 98.5518 348.969 99.7165 347.244 102.046C345.605 104.375 344.785 108.258 344.785 113.693V145.012C344.785 150.361 345.605 154.201 347.244 156.53C348.969 158.86 351.515 160.024 354.879 160.024ZM391.969 171.672C391.193 171.672 390.804 171.197 390.804 170.248L391.84 88.3279C391.84 87.3788 392.271 86.9043 393.134 86.9043H407.24C408.103 86.9043 408.578 87.2494 408.664 87.9396L420.441 133.365L432.347 87.9396C432.433 87.2494 432.908 86.9043 433.771 86.9043H447.877C448.653 86.9043 449.042 87.3788 449.042 88.3279L450.206 170.248C450.206 171.197 449.818 171.672 449.042 171.672H438.041C437.265 171.672 436.877 171.197 436.877 170.248L436.488 128.317C436.402 124.521 436.402 120.941 436.488 117.576C436.661 114.125 436.833 110.976 437.006 108.129H436.877C436.273 110.803 435.582 113.521 434.806 116.282C434.029 118.956 433.21 121.631 432.347 124.306L421.994 159.766C421.821 160.456 421.39 160.801 420.7 160.801H420.182C419.578 160.801 419.19 160.456 419.017 159.766L408.534 124.306C407.672 121.631 406.852 118.956 406.076 116.282C405.385 113.521 404.738 110.803 404.134 108.129H403.875C404.134 110.976 404.307 114.125 404.393 117.576C404.566 120.941 404.609 124.521 404.523 128.317L404.134 170.248C404.134 171.197 403.746 171.672 402.97 171.672H391.969ZM476.51 172.448C468.832 172.448 462.965 170.205 458.91 165.719C454.941 161.232 452.957 154.546 452.957 145.659V113.046C452.957 104.074 454.941 97.3439 458.91 92.8575C462.965 88.371 468.832 86.1278 476.51 86.1278C484.103 86.1278 489.926 88.371 493.981 92.8575C498.036 97.3439 500.064 104.074 500.064 113.046V145.659C500.064 154.546 498.036 161.232 493.981 165.719C489.926 170.205 484.103 172.448 476.51 172.448ZM476.51 160.024C479.875 160.024 482.377 158.86 484.016 156.53C485.742 154.201 486.605 150.361 486.605 145.012V113.693C486.605 108.258 485.742 104.375 484.016 102.046C482.377 99.7165 479.875 98.5518 476.51 98.5518C473.145 98.5518 470.6 99.7165 468.875 102.046C467.235 104.375 466.416 108.258 466.416 113.693V145.012C466.416 150.361 467.235 154.201 468.875 156.53C470.6 158.86 473.145 160.024 476.51 160.024ZM504.8 171.672C504.023 171.672 503.635 171.197 503.635 170.248V88.3279C503.635 87.3788 504.023 86.9043 504.8 86.9043H522.4C530.597 86.9043 536.593 88.8887 540.389 92.8575C544.185 96.7399 546.084 102.909 546.084 111.364C546.084 117.662 545.178 122.709 543.366 126.506C541.64 130.216 539.138 132.847 535.86 134.4L535.73 134.529L549.19 169.989C549.448 171.111 549.103 171.672 548.154 171.672H535.989C535.385 171.672 534.954 171.37 534.695 170.766L523.048 137.118H517.224V170.248C517.224 171.197 516.836 171.672 516.059 171.672H504.8ZM517.224 125.6H522.53C526.067 125.6 528.612 124.478 530.165 122.235C531.718 119.992 532.495 116.584 532.495 112.011C532.495 107.525 531.675 104.289 530.036 102.305C528.397 100.234 525.808 99.1988 522.271 99.1988H517.224V125.6ZM551.539 171.672C550.676 171.672 550.245 171.197 550.245 170.248V88.3279C550.245 87.3788 550.633 86.9043 551.41 86.9043H585.835C586.611 86.9043 586.999 87.3788 586.999 88.3279V97.7753C586.999 98.7243 586.611 99.1988 585.835 99.1988H563.834V122.753H583.893C584.67 122.753 585.058 123.227 585.058 124.176V133.106C585.058 134.055 584.67 134.529 583.893 134.529H563.834V159.377H585.835C586.611 159.377 586.999 159.852 586.999 160.801V170.248C586.999 171.197 586.611 171.672 585.835 171.672H551.539ZM618.357 172.448C613.181 172.448 608.996 171.413 605.804 169.342C602.698 167.272 600.498 164.381 599.204 160.672C597.996 156.962 597.608 152.605 598.039 147.6C598.125 146.565 598.514 146.047 599.204 146.047H610.204C610.981 146.047 611.326 146.522 611.24 147.471C610.808 151.699 611.24 154.934 612.534 157.177C613.828 159.334 615.899 160.413 618.746 160.413C621.334 160.413 623.232 159.636 624.44 158.083C625.734 156.53 626.381 154.071 626.381 150.706C626.381 147.773 625.907 145.314 624.958 143.33C624.095 141.259 622.628 139.447 620.557 137.894L609.687 129.353C605.804 126.333 602.914 123.098 601.016 119.647C599.118 116.109 598.212 111.752 598.298 106.576C598.384 100.105 600.11 95.1007 603.475 91.5633C606.839 87.9396 611.757 86.1278 618.228 86.1278C625.648 86.1278 631.083 88.2416 634.534 92.4692C637.986 96.6968 639.366 102.607 638.676 110.199C638.589 111.407 638.201 112.011 637.511 112.011H626.381C625.518 112.011 625.173 111.407 625.346 110.199C625.691 106.576 625.303 103.685 624.181 101.528C623.06 99.2851 621.248 98.1635 618.746 98.1635C616.589 98.1635 614.906 98.8537 613.698 100.234C612.491 101.615 611.843 103.772 611.757 106.705C611.757 109.552 612.275 111.925 613.31 113.823C614.432 115.721 616.028 117.447 618.099 119L628.581 127.153C631.428 129.223 633.672 131.38 635.311 133.624C636.95 135.78 638.115 138.239 638.805 141C639.582 143.675 639.927 146.867 639.84 150.577C639.84 157.479 638.115 162.872 634.664 166.754C631.213 170.55 625.777 172.448 618.357 172.448ZM643.341 171.672C642.564 171.672 642.176 171.197 642.176 170.248V88.3279C642.176 87.3788 642.564 86.9043 643.341 86.9043H658.224C658.914 86.9043 659.345 87.2494 659.518 87.9396L671.295 130.647C671.899 132.804 672.503 135.22 673.106 137.894C673.797 140.569 674.444 143.287 675.048 146.047C675.738 148.722 676.256 151.095 676.601 153.165H676.86C676.773 151.44 676.644 149.455 676.471 147.212C676.385 144.883 676.256 142.51 676.083 140.094C675.997 137.592 675.911 135.22 675.824 132.976C675.824 130.647 675.824 128.619 675.824 126.894V88.1985C675.824 87.3357 676.212 86.9043 676.989 86.9043H687.472C688.248 86.9043 688.636 87.3357 688.636 88.1985V170.248C688.636 171.197 688.248 171.672 687.472 171.672H672.718C672.114 171.672 671.683 171.37 671.424 170.766L659.647 128.965C658.526 124.91 657.533 120.898 656.671 116.929C655.808 112.874 655.031 109.121 654.341 105.67H654.082C654.255 108.172 654.384 111.105 654.471 114.47C654.643 117.835 654.773 121.2 654.859 124.564C654.945 127.843 654.988 130.733 654.988 133.235V170.248C654.988 171.197 654.643 171.672 653.953 171.672H643.341ZM715.854 172.448C708.176 172.448 702.309 170.205 698.254 165.719C694.285 161.232 692.301 154.546 692.301 145.659V113.046C692.301 104.074 694.285 97.3439 698.254 92.8575C702.309 88.371 708.176 86.1278 715.854 86.1278C723.447 86.1278 729.27 88.371 733.325 92.8575C737.38 97.3439 739.408 104.074 739.408 113.046V145.659C739.408 154.546 737.38 161.232 733.325 165.719C729.27 170.205 723.447 172.448 715.854 172.448ZM715.854 160.024C719.219 160.024 721.721 158.86 723.36 156.53C725.086 154.201 725.949 150.361 725.949 145.012V113.693C725.949 108.258 725.086 104.375 723.36 102.046C721.721 99.7165 719.219 98.5518 715.854 98.5518C712.489 98.5518 709.944 99.7165 708.219 102.046C706.579 104.375 705.76 108.258 705.76 113.693V145.012C705.76 150.361 706.579 154.201 708.219 156.53C709.944 158.86 712.489 160.024 715.854 160.024ZM752.706 171.672C752.016 171.672 751.628 171.284 751.542 170.507L737.824 88.4573C737.651 87.422 737.953 86.9043 738.73 86.9043H749.989C750.765 86.9043 751.24 87.2926 751.412 88.0691L757.365 127.8C757.797 130.992 758.142 134.184 758.401 137.377C758.746 140.483 759.005 143.675 759.177 146.953C759.436 150.146 759.609 153.381 759.695 156.66H759.954C760.385 153.726 760.817 150.793 761.248 147.859C761.679 144.84 762.154 141.906 762.672 139.059L768.754 105.54L765.907 90.2691C765.648 89.1475 765.95 88.5867 766.813 88.5867H777.813C778.59 88.5867 779.021 88.975 779.107 89.7515L786.484 138.541C786.915 141.561 787.304 144.581 787.649 147.6C788.08 150.62 788.425 153.64 788.684 156.66H788.943C789.116 153.295 789.288 150.059 789.461 146.953C789.633 143.847 789.849 140.698 790.108 137.506C790.453 134.227 790.841 130.863 791.273 127.412L797.096 88.0691C797.183 87.2926 797.571 86.9043 798.261 86.9043H809.65C810.426 86.9043 810.728 87.422 810.556 88.4573L796.837 170.507C796.751 171.284 796.363 171.672 795.673 171.672H782.86C781.998 171.672 781.523 171.284 781.437 170.507L776.907 140.871C776.476 138.196 776.088 135.522 775.743 132.847C775.397 130.086 775.052 127.368 774.707 124.694H774.448C774.017 127.368 773.586 130.043 773.154 132.718C772.723 135.392 772.291 138.11 771.86 140.871L766.554 170.507C766.468 170.939 766.295 171.24 766.036 171.413C765.864 171.586 765.648 171.672 765.389 171.672H752.706Z" fill="#FFFFFF"/>
|
159
|
+
</svg>
|
160
|
+
<p>This ticket is valid for a single entry only</p>
|
161
|
+
<div>
|
162
|
+
<span style="text-wrap: nowrap;">DIGITAL TICKET</span>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
<div class="info passenger">
|
166
|
+
<div class="info__item">Customer</div>
|
167
|
+
<div class="info__detail">{{clientName}}</div>
|
168
|
+
</div>
|
169
|
+
<div class="info platform">
|
170
|
+
<span>SHOW </span><span>THIS </span><span>QR CODE</span>
|
171
|
+
<img src="{{qrCode}}" alt="QR Code" />
|
172
|
+
</div>
|
173
|
+
<div class="info departure">
|
174
|
+
<div class="info__item">Location</div>
|
175
|
+
<div class="info__detail">{{eventLocation}}</div>
|
176
|
+
</div>
|
177
|
+
<div class="info arrival">
|
178
|
+
<div class="info__item">Event</div>
|
179
|
+
<div class="info__detail">{{eventName}}</div>
|
180
|
+
</div>
|
181
|
+
<div class="info date">
|
182
|
+
<div class="info__item">Date</div>
|
183
|
+
<div class="info__detail">{{eventDate}}</div>
|
184
|
+
</div>
|
185
|
+
<div class="info time">
|
186
|
+
<div class="info__item">Time</div>
|
187
|
+
<div class="info__detail">{{eventTime}}</div>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
</body>
|
193
|
+
</html>
|
194
|
+
`;
|
195
|
+
function renderTemplate$1(data) {
|
196
|
+
return Mustache$1.render(template$1, data);
|
197
|
+
}
|
198
|
+
var templateTicket = { renderTemplate: renderTemplate$1 };
|
199
|
+
const Mustache = require$$0;
|
200
|
+
const template = `
|
201
|
+
<!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 loading="lazy" alt="NO MORE SNOW" style="max-width:150px;height:auto;padding:20px" src="https://nms.io/logo/logotype-white.png"><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">© 2024 NO MORE SNOW Ltd. All Rights Reserved.</p></div></div><span style="opacity:0">{{ randomness }}</span></body></html>
|
202
|
+
`;
|
203
|
+
function renderTemplate(data) {
|
204
|
+
return Mustache.render(template, data);
|
205
|
+
}
|
206
|
+
var templateEmail = { renderTemplate };
|
207
|
+
const path = require$$0$1;
|
208
|
+
const puppeteer = require$$1;
|
209
|
+
const QRCode = require$$2;
|
210
|
+
const { sendEmail } = mailing;
|
211
|
+
const { renderTemplate: renderTicketTemplate } = templateTicket;
|
212
|
+
const { renderTemplate: renderEmailTemplate } = templateEmail;
|
213
|
+
function formatDate(dateString) {
|
214
|
+
const date = new Date(dateString);
|
215
|
+
const options = { day: "numeric", month: "long" };
|
216
|
+
return date.toLocaleDateString("en-US", options);
|
217
|
+
}
|
218
|
+
function formatTime(dateString) {
|
219
|
+
const date = new Date(dateString);
|
220
|
+
const options = { hour: "2-digit", minute: "2-digit", hour12: false };
|
221
|
+
return date.toLocaleTimeString("en-US", options);
|
222
|
+
}
|
223
|
+
const controllerFactory = (db, publicPath) => {
|
224
|
+
const Ticket = db.ticket;
|
225
|
+
const Event = db.event;
|
226
|
+
async function saveAndSendTicket(ticketData) {
|
227
|
+
console.log(ticketData);
|
228
|
+
const quantity = ticketData.quantity || 1;
|
229
|
+
const ticketIds = [];
|
230
|
+
const pdfFiles = [];
|
231
|
+
const event = await Event.findById(ticketData.target).exec();
|
232
|
+
if (!event) {
|
233
|
+
console.error("Event not found!");
|
234
|
+
return;
|
235
|
+
}
|
236
|
+
for (let i = 0; i < quantity; i++) {
|
237
|
+
const ticket = new Ticket(ticketData);
|
238
|
+
const data = await ticket.save();
|
239
|
+
ticketIds.push(data._id.toString());
|
240
|
+
const qrData = data._id.toString();
|
241
|
+
const qrCode = await QRCode.toDataURL(qrData, {
|
242
|
+
errorCorrectionLevel: "H",
|
243
|
+
type: "image/png"
|
244
|
+
});
|
245
|
+
data.status = "unused";
|
246
|
+
data.qrcode = qrCode;
|
247
|
+
data.client_refactor.name = ticketData.name;
|
248
|
+
data.client_refactor.email = ticketData.email;
|
249
|
+
const renderedHtml = renderTicketTemplate({
|
250
|
+
clientName: ticketData.name || "No name",
|
251
|
+
qrCode,
|
252
|
+
eventLocation: event.location || process.env.APP_NAME,
|
253
|
+
eventName: event.name,
|
254
|
+
eventDate: formatDate(event.date.start),
|
255
|
+
eventTime: formatTime(event.date.start)
|
256
|
+
});
|
257
|
+
const dirPath = path.join(publicPath, "tickets");
|
258
|
+
const fileName = `ticket-${data._id.toString()}.pdf`;
|
259
|
+
const filePath = path.join(dirPath, fileName);
|
260
|
+
pdfFiles.push(filePath);
|
261
|
+
const browser = await puppeteer.launch({
|
262
|
+
args: ["--no-sandbox", "--disable-setuid-sandbox"]
|
263
|
+
});
|
264
|
+
const page = await browser.newPage();
|
265
|
+
await page.setContent(renderedHtml);
|
266
|
+
await page.pdf({
|
267
|
+
path: filePath,
|
268
|
+
format: "A4"
|
269
|
+
});
|
270
|
+
await browser.close();
|
271
|
+
data.image = `/tickets/${fileName}`;
|
272
|
+
await data.save();
|
273
|
+
}
|
274
|
+
if (ticketData.email) {
|
275
|
+
const renderedHtmlEmail = renderEmailTemplate({
|
276
|
+
clientName: ticketData.name || "No name",
|
277
|
+
eventLocation: event.location || process.env.APP_NAME,
|
278
|
+
eventName: event.name,
|
279
|
+
eventDate: formatDate(event.date.start),
|
280
|
+
eventTime: formatTime(event.date.start),
|
281
|
+
randomness: Date.now()
|
282
|
+
});
|
283
|
+
try {
|
284
|
+
const emailSent = await sendEmail(ticketData.email, `Your Tickets for ${event.name}`, renderedHtmlEmail, pdfFiles);
|
285
|
+
} catch (err) {
|
286
|
+
console.error("Email sending failed:", err);
|
287
|
+
}
|
288
|
+
}
|
289
|
+
return {
|
290
|
+
tickets: ticketIds
|
291
|
+
};
|
292
|
+
}
|
293
|
+
const create = async (req, res) => {
|
294
|
+
if (Array.isArray(req.body)) {
|
295
|
+
const ticketsData = req.body;
|
296
|
+
try {
|
297
|
+
const ticketsPromises = ticketsData.map(
|
298
|
+
(ticketData) => saveAndSendTicket(ticketData)
|
299
|
+
);
|
300
|
+
const tickets = await Promise.all(ticketsPromises);
|
301
|
+
res.json(tickets);
|
302
|
+
} catch (err) {
|
303
|
+
console.log(err);
|
304
|
+
res.status(500).send({
|
305
|
+
errorCode: "SERVER_ERROR"
|
306
|
+
});
|
307
|
+
}
|
308
|
+
} else {
|
309
|
+
try {
|
310
|
+
const data = await saveAndSendTicket(req.body);
|
311
|
+
res.json(data);
|
312
|
+
} catch (err) {
|
313
|
+
console.log(err);
|
314
|
+
res.status(500).send({
|
315
|
+
errorCode: "SERVER_ERROR"
|
316
|
+
});
|
317
|
+
}
|
318
|
+
}
|
319
|
+
};
|
320
|
+
const read = async (req, res) => {
|
321
|
+
let query = {};
|
322
|
+
let options = {};
|
323
|
+
if (req.query.user) {
|
324
|
+
query.user = req.query.user;
|
325
|
+
}
|
326
|
+
if (req.query.type) {
|
327
|
+
query.type = req.query.type;
|
328
|
+
}
|
329
|
+
if (req.query.target) {
|
330
|
+
query.target = req.query.target;
|
331
|
+
}
|
332
|
+
if (req.query.role) {
|
333
|
+
query.role = req.query.role;
|
334
|
+
}
|
335
|
+
options.limit = req.query.limit || 10;
|
336
|
+
options.skip = req.query.skip || 0;
|
337
|
+
const sortParam = req.query.sortParam || "createdAt";
|
338
|
+
const sortOrder = req.query.sortOrder === "asc" ? 1 : -1;
|
339
|
+
options.sort = {
|
340
|
+
[sortParam]: sortOrder,
|
341
|
+
"_id": 1
|
342
|
+
};
|
343
|
+
const search = req.query.search;
|
344
|
+
if (search) {
|
345
|
+
const parts = search.split(".");
|
346
|
+
let regexPattern = "";
|
347
|
+
if (parts.length === 2) {
|
348
|
+
regexPattern = parts.map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")).join("\\.");
|
349
|
+
} else {
|
350
|
+
regexPattern = search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
351
|
+
}
|
352
|
+
query["client_refactor.name"] = { $regex: new RegExp(regexPattern, "i") };
|
353
|
+
}
|
354
|
+
try {
|
355
|
+
const tickets = await Ticket.find(query, null, options).populate("user");
|
356
|
+
if (!tickets) {
|
357
|
+
return res.status(404).send({ errorCode: "TICKETS_NOT_FOUND" });
|
358
|
+
}
|
359
|
+
res.send(tickets);
|
360
|
+
} catch (err) {
|
361
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
362
|
+
}
|
363
|
+
};
|
364
|
+
const update = async (req, res) => {
|
365
|
+
try {
|
366
|
+
const { _id } = req.body;
|
367
|
+
const ticket = await Ticket.findById(_id);
|
368
|
+
if (!ticket) {
|
369
|
+
return res.status(404).send({ errorCode: "TICKET_NOT_FOUND" });
|
370
|
+
}
|
371
|
+
if (ticket.status === "used" && req.body.check) {
|
372
|
+
return res.status(500).send({ errorCode: "TICKET_ALREADY_USED" });
|
373
|
+
}
|
374
|
+
if (ticket.status === "deactivated" && req.body.check) {
|
375
|
+
return res.status(500).send({ errorCode: "TICKET_DEACTIVATED" });
|
376
|
+
}
|
377
|
+
const updatedTicket = await Ticket.findOneAndUpdate({ _id }, req.body, { new: true });
|
378
|
+
res.send(updatedTicket);
|
379
|
+
} catch (err) {
|
380
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
381
|
+
}
|
382
|
+
};
|
383
|
+
const deleteTicket = async (req, res) => {
|
384
|
+
const { type, target, user } = req.body;
|
385
|
+
try {
|
386
|
+
const ticket = await Ticket.findOne({ type, target, user });
|
387
|
+
if (!ticket) {
|
388
|
+
return res.status(404).send({ errorCode: "TICKET_NOT_FOUND" });
|
389
|
+
}
|
390
|
+
await Ticket.deleteOne({ _id: ticket._id });
|
391
|
+
res.status(200).send(ticket);
|
392
|
+
} catch (error) {
|
393
|
+
console.log(error);
|
394
|
+
res.status(500).send({ errorCode: "SERVER_ERROR" });
|
395
|
+
}
|
396
|
+
};
|
397
|
+
return {
|
398
|
+
read,
|
399
|
+
create,
|
400
|
+
update,
|
401
|
+
delete: deleteTicket,
|
402
|
+
saveAndSendTicket
|
403
|
+
};
|
404
|
+
};
|
405
|
+
var tickets_controller = controllerFactory;
|
406
|
+
export {
|
407
|
+
tickets_controller as t
|
408
|
+
};
|