-
-
Notifications
You must be signed in to change notification settings - Fork 428
/
pub_createTicket.hbs
771 lines (686 loc) · 33.8 KB
/
pub_createTicket.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<!DOCTYPE html>
<html>
<head>
<title>Trudesk · {{{title}}}</title>
<link rel="stylesheet" href="/css/plugins.min.css">
<link rel="stylesheet" href="/css/app.min.css">
<style type="text/css">
html {
overflow-x: hidden;
height: 100%;
font: 400 14px/20px "Roboto", Arial, sans-serif;
}
body {
background: #eee;
text-align: center;
font-family: "Roboto", Arial, sans-serif;
height: 100%;
-webkit-font-smoothing: subpixel-antialiased;
}
.wrapper,
#privacyPolicySlide {
width: 400px;
height: auto;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50.111%);
-webkit-transform: translate(-50%, -50.111%);
padding: 15px 0;
}
#privacyPolicySlide {
width: 75%;
text-align: left;
height: auto;
}
.white-box {
height: 500px;
background: #f6f6f6;
border: 1px solid #ccc;
color: #222;
padding: 15px;
overflow: auto;
}
h2 {
color: #444;
}
p {
font-family: "Roboto", Arial, sans-serif;
font-weight: 300;
font-size: 16px;
line-height: 24px;
color: #272727;
text-rendering: auto;
}
img {
margin-bottom: 55px;
}
label {
text-align: left
}
button:not('.action') {
font-family: "Roboto", Arial, sans-serif;
width: 340px;
height: 20px;
text-align: left;
padding: 15px 20px;
background: #384b5f;
border: 1px solid #1c2937;
font-size: 20px;
color: #fff;
margin-bottom: 15px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
font-weight: 300;
}
button.button {
width: 380px;
height: auto;
text-align: center;
background: #e74b3b;
border: none;
text-transform: uppercase;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
button.button:hover {
background: #f15849;
cursor: pointer;
}
*:focus {
outline: 0;
}
a {
display: inline-block;
padding-right: 10px;
color: #727272;
font-size: 14px;
float: right;
text-decoration: none;
font-weight: 300;
}
a:hover {
color: #A5A5A5;
}
::-webkit-input-placeholder { /* WebKit browsers */
color: #222;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #222;
opacity: 1;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #222;
opacity: 1;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #222;
}
.alert-message p {
margin-top: 8px;
margin-bottom: 0;
color: white;
font-weight: 300;
text-align: center;
}
button.button.noCap {
text-transform: none;
}
.hide {
display: none;
}
.green {
background: #29b955;
}
.md-input-bar:before,
.md-input-bar:after {
background: #2196f3 !important;
}
.btn {
width: 100%;
height: 50px;
margin-bottom: 24px !important;
/*color: #E74C3C;*/
}
.btn:hover, .btn:active, .btn:focus {
/*color: #222;*/
}
#logosvg {
position: absolute;
top: 35px;
left: 35px;
}
.l1 {
stroke-dasharray: 290;
stroke-dashoffset: 290;
animation: line 0.8s infinite ease-in-out;
-webkit-animation: line 0.8s infinite ease-in-out;
}
@keyframes line {
0% {
stroke-dashoffset: 290;
}
50% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: -290;
}
}
.loader {
height: 75px;
width: 100%;
}
.loader:before {
content: '';
padding-top: 50px !important;
}
.loader svg {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.loader svg line {
stroke: #000;
stroke-width: 5;
stroke-linecap: round;
}
</style>
<script src="/socket.io/socket.io.js"></script>
<script src="/js/vendor.js"></script>
<script src="/js/truRequire.js"></script>
</head>
<body>
<svg version="1.1" id="logosvg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 288.9 70.1" xml:space="preserve" style="width: 150px; margin-bottom: 40px;">
<style type="text/css">
.st0 {
fill: rgba(0,0,0,0.6);
}
.st1 {
fill: rgba(231,76,60, 0.9);
}
</style>
<path class="st0" d="M28.5,28.4c-0.1,1.6-0.7,3.4-1.6,5.4c-2.4-0.3-4.6-0.4-6.8-0.4h-1.7c-2.9,13.9-4.3,22.6-4.3,26.1
c0,1.8,0.4,2.7,1.2,2.7c0.8,0,2.9-0.8,6.2-2.3l1.7,3.1C17.7,67.7,12.5,70,7.8,70c-2.2,0-4-0.7-5.4-2.1c-1.4-1.4-2.1-3.2-2.1-5.5
c0-2.3,0.3-4.9,0.8-7.7c0.5-2.9,1.3-6.4,2.2-10.6c0.9-4.2,1.6-7.5,2.1-10.1c-2.3,0.2-4,0.4-5.2,0.6c-0.1-0.8-0.2-1.8-0.2-3
c0-1.3,0.1-2.3,0.3-3.1h5.9c0.5-3.4,0.8-6.6,0.8-9.6L6.8,16v-0.3c4.9-1.7,9.5-2.5,13.8-2.5c0.2,1.3,0.4,2.8,0.4,4.7
c0,1.9-0.5,5.4-1.6,10.6H28.5z"></path>
<path class="st0" d="M29.6,69.1H29c-0.1-0.5-0.2-1.6-0.2-3.4c0-1.8,0.8-6.6,2.5-14.4c1.7-7.8,2.5-12.3,2.5-13.4
c0-1.9-0.9-4.1-2.6-6.4l-0.8-1.1l0.1-1.2c3.4-0.9,8.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8.3,1.8-14.7,5.3-19.5c3.5-4.7,7.5-7.1,11.9-7.1c4.4,0,8.1,1,11.1,3
c1.9-10.1,2.9-18.1,2.9-23.9l-0.5-3.9c4.7-1.6,9.3-2.4,13.8-2.4c0.5,1.1,0.8,2.3,0.8,3.7c0,4.6-1.4,13.8-4.1,27.8
c-2.8,14-4.1,23.5-4.1,28.5c0,1.5,0.3,2.3,1,2.3c0.4,0,1.6-0.6,3.6-1.8l0.9-0.6L153.2,63.1z M130.6,32.8c-2.2,0-4.1,2.2-5.7,6.5
c-1.6,4.3-2.4,8.6-2.4,12.8c0,4.2,0.3,6.9,0.9,8.1c0.6,1.2,1.5,1.8,2.7,1.8c2.1,0,4.1-0.8,6.1-2.5c0.2-2.5,1.6-10.8,4.2-25
C134.3,33.4,132.3,32.8,130.6,32.8z"></path>
<path class="st0" d="M155.5,52.6c0-7.8,2.4-14,7.1-18.5c4.7-4.5,10.1-6.8,16.1-6.8c3.7,0,6.7,0.9,9.1,2.7c2.4,1.8,3.6,4.2,3.6,7.3
c0,3-0.8,5.6-2.3,7.6c-1.5,2.1-3.4,3.7-5.6,4.8c-4.4,2.2-8.5,3.6-12.2,4.1l-2.3,0.3c0.4,5.9,2.8,8.8,7.2,8.8c1.5,0,3.1-0.4,4.8-1.1
c1.7-0.8,3-1.5,3.9-2.3l1.4-1.1l2.3,3c-0.5,0.7-1.5,1.6-3,2.7c-1.5,1.1-2.9,2.1-4.2,2.8c-3.6,2-7.6,3-11.9,3
c-4.3,0-7.7-1.5-10.2-4.6C156.7,62.3,155.5,58.1,155.5,52.6z M176.5,45.5c1.9-2.1,2.8-4.9,2.8-8.3c0-3.4-1-5.1-3-5.1
c-2.4,0-4.2,2-5.5,6.1c-1.3,4-1.9,7.8-1.9,11.3C172.1,49,174.6,47.6,176.5,45.5z"></path>
<path class="st0" d="M223.2,56.6c0,3.9-1.7,7.2-5.2,9.7c-3.5,2.5-7.4,3.8-11.9,3.8c-4.4,0-8-0.9-10.6-2.8c-2.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,12.5,238.1,6.9z"></path>
<circle class="st1" cx="284.9" cy="64.7" r="4"></circle>
</svg>
<div class="wrapper">
<div class="slides">
<div class="slide">
<h2 style="margin-bottom: 18px;">New Issue</h2>
<p style="text-align: left;">
This wizard will walk you through the process of submitting a new issue.
</p>
<button class="btn md-btn md-btn-wave md-btn-success" data-next>Lets Get Started</button>
</div>
<div id="userInfoSlide" class="slide hide">
<h2 style="margin-bottom: 25px;">User Information</h2>
<p style="text-align: left;">
We need to know how to store your request. Please give us a little information about you.
</p>
<form id="userInfo" class="uk-form-stacked uk-clearfix">
<div class="uk-margin-medium-bottom">
<label for="user-fullname">Full Name</label>
<input id="user-fullname" name="user-fullname" class="md-input" type="text" required />
</div>
<div class="uk-margin-medium-bottom">
<label for="user-email">Email</label>
<input id="user-email" name="user-email" class="md-input" type="email" required />
</div>
<div class="uk-margin-medium-bottom">
<div id="captchaImage" style="margin-bottom: 10px;"></div>
<label for="captcha">Please enter the letters you see above.</label>
<input id="captcha" name="captcha" class="md-input" type="text" required />
</div>
<div style="width: 25%; float: left;">
<button class="btn md-btn md-btn-wave md-btn-primary1" type="button" data-prev>Back</button>
</div>
<div style="width: 70%; float: right;">
<button id="checkEmail" class="btn md-btn md-btn-wave md-btn-success" type="button">Next</button>
</div>
</form>
<a href="#" class="no-ajaxy" id="privacyPolicyBtn">Privacy Policy</a>
</div>
<div class="slide hide">
<h2 style="margin-bottom: 25px;">Issue</h2>
<p style="text-align: left; margin-bottom: 25px;">
Please tell us about the issue you're having.
Remember to be as detailed as possible to ensure its resolved promptly.
</p>
<form id="adminAccount" class="uk-form-stacked uk-clearfix">
<div class="uk-margin-medium-bottom">
<label for="ticket-subject">Subject</label>
<input type="text" id="ticket-subject" name="ticket-subject" class="md-input" required />
</div>
<div class="uk-margin-medium-bottom">
<label for="ticket-issue">Issue</label>
<textarea name="ticket-issue" id="ticket-issue" cols="30" rows="10" class="md-input" required></textarea>
</div>
<div style="width: 25%; float: left;">
<button class="btn md-btn md-btn-wave md-btn-primary1" type="button" data-prev>Back</button>
</div>
<div style="width: 70%; float: right;">
<button class="btn md-btn md-btn-wave md-btn-success" type="button" id="submit-issue">Submit Issue</button>
</div>
</form>
</div>
<div class="slide hide">
<h2 style="margin-bottom: 25px;">Creating Issue...</h2>
<p style="text-align: left;">Thank you for submitting your issue. An email has been sent to you with login details to view and create future tickets.</p>
<div class="loader">
<svg style="width: 140px; " viewBox="0 0 288.9 70.1">
<line class="l1" x1="0" y1="0" x2="288" y2="0"></line>
</svg>
</div>
</div>
<div id="restartSlide" class="slide hide">
<h2 style="margin-bottom: 25px;">Time to Restart</h2>
<p style="text-align: left;"><i>So here we are, together sharpening a knife.</i> Trudesk needs to restart to come out of install mode. Just restart it and you should get a login screen. (hopefully)!</p>
<button class="btn md-btn md-btn-wave" type="button" id="restartTrudesk">restart me!</button>
</div>
<div id="errorSlide" class="slide hide">
<h2 style="margin-bottom: 25px;">Crap! Something funky happened.</h2>
<p style="text-align: justify;">
Alright. This entire install script is in <i>beta</i>. Didn't I mention that? Anyway, there are a couple of options below to try and resolve the issue. There are some common pit falls and workarounds
in the docs that may help. Submitting the issue will help identify any bugs in the script and will help others as well.
</p>
<pre style="text-align: left; font-size: 11px; font-weight: normal; margin-bottom: 15px;"></pre>
<div style="width: 100%;">
<a href="https://www.github.com/polonel/trudesk/issues/new" target="_blank" style="width: 100%; padding: 0; margin: 0;">
<button class="btn md-btn md-btn-wave md-btn-danger" type="button" style="width: 100%; margin-bottom: 10px !important;">I think I should submit this issue.</button>
</a>
<button class="btn md-btn md-btn-wave md-btn-success" type="button" style="width: 100%; margin-bottom: 10px !important;" onclick="location.reload();">I think i will start over.</button>
<a href="https://github.com/polonel/trudesk/blob/master/README.md" target="_blank" style="width: 100%; padding: 0; margin: 0;">
<button class="btn md-btn md-btn-wave" type="button" style="width: 100%; margin-bottom: 10px !important;">or maybe i should read the docs!</button>
</a>
</div>
</div>
<div id="emailExistsSlide" class="slide hide">
<h2 style="margin-bottom: 25px;">Email Already Exists</h2>
<p style="text-align: justify;">
The email <span id="emailSpan" style="font-weight: bold;">[email protected]</span> already exists. If you already have an account using this email please login and submit your ticket.
</p>
<div style="width: 100%; margin-top: 50px;">
<a href="/login" class="no-ajaxy" style="width: 100%; padding: 0; margin: 0;">
<button class="btn md-btn md-btn-wave md-btn-primary" type="button" style="width: 100%; margin-bottom: 10px !important;">Login</button>
</a>
<button class="btn md-btn md-btn-wave" type="button" style="width: 100%; margin-bottom: 10px !important;" onclick="location.reload();">Start Over</button>
</div>
</div>
<div id="ticketCreatedSlide" class="slide hide">
<h2 style="margin-bottom: 25px; text-align: left;">Thank you <span id="spanfullname" style="color: #2196f3;">[fullname]</span>,</h2>
<p style="text-align: justify;">
Your issue, <strong id="strongSubject">[Subject]</strong> has been submitted. Please store the following information to access and update your ticket.
</p>
<p style="text-align: left;">
Username: <strong id="strongUsername">[Username]</strong> <br>
Password: <strong id="strongPassword">[Password]</strong>
</p>
<p style="text-align: justify;">
Please follow the link below in order to login and update or view the current status of this issue.
</p>
<div style="width: 100%; margin-top: 50px;">
<a href="/login" class="no-ajaxy" style="width: 100%; padding: 0; margin: 0;">
<button class="btn md-btn md-btn-wave md-btn-primary" type="button" style="width: 100%; margin-bottom: 10px !important;">Login</button>
</a>
</div>
</div>
</div>
</div>
<div id="privacyPolicySlide" class="hide">
<div class="white-box" style="margin-bottom: 15px;">
{{{data.privacyPolicy}}}
</div>
<button id="privacyPolicyBackBtn" class="btn md-btn md-btn-wave md-btn-primary" type="button" style="width: 100%; margin-bottom: 10px !important;">Back</button>
</div>
<script type="text/javascript">
window.truRequire(['jquery', 'snackbar', 'helpers'], function(loadedModules) {
var $ = loadedModules[0];
window.Snackbar = loadedModules[1];
var helpers = loadedModules[2];
$(document).ready(function() {
helpers.init();
getCaptcha();
var $slides = $('.slides > .slide');
var totalSlides = 0;
var activeSlide = 0;
$slides.each(function(idx) {
$(this).addClass('slide-' + idx);
if (idx === 0)
$(this).addClass('activeSlide');
else
$(this).addClass('hide');
totalSlides++;
});
function getCaptcha() {
$.ajax({
method: 'GET',
url: '/captcha',
success: function(response) {
var svg = $(response).find('svg');
$('#captchaImage').append(svg);
},
error: function(err) {
console.error(err);
}
});
}
function isDoubleClicked(element) {
//if already clicked return TRUE to indicate this click is not allowed
if (element.data("isclicked")) return true;
//mark as clicked for 1 second
element.data("isclicked", true);
setTimeout(function () {
element.removeData("isclicked");
}, 1000);
//return FALSE to indicate this click was allowed
return false;
}
$('button[data-next]').click(function() {
if (isDoubleClicked($(this))) return;
advanceSlide();
});
$('button[data-prev]').click(function() {
if (isDoubleClicked($(this))) return;
var prevSlideIdx = activeSlide - 1;
var prevSlide = $('.slide-' + prevSlideIdx);
if (prevSlide.length > 0) {
$(this).parents('.slide').fadeOut(300, function() {
prevSlide.css({display: 'none'}).removeClass('hide');
$(this).addClass('hide').removeClass('activeSlide');
prevSlide.fadeIn(300, function() {
prevSlide.addClass('activeSlide');
});
});
activeSlide--;
}
});
var userInfo = undefined;
var ticket = undefined;
$('button#checkEmail').click(function() {
if (isDoubleClicked($(this))) return;
var userInfoFormData = $('form#userInfo').serializeObject();
var $emailField, $fullnameField;
var $emailValid = false, $fullnameValid = false;
if (!userInfoFormData['user-email'] || !validateEmail(userInfoFormData['user-email'])) {
$emailField = $('form#userInfo').find('input#user-email');
$emailField.parent('.md-input-wrapper').addClass('has-error');
$emailField.parent('.md-input-wrapper').find('.md-input-bar').addClass('bottom-fix error-color');
$emailField.addClass('uk-form-danger');
} else {
$emailField = $('form#userInfo').find('input#user-email');
$emailField.parent('.md-input-wrapper').removeClass('has-error');
$emailField.parent('.md-input-wrapper').find('.md-input-bar').removeClass('bottom-fix error-color');
$emailField.removeClass('uk-form-danger');
$emailValid = true;
}
if (!userInfoFormData['user-fullname'] || (userInfoFormData['user-fullname'].length < 5)) {
$fullnameField = $('form#userInfo').find('input#user-fullname');
$fullnameField.parent('.md-input-wrapper').addClass('has-error');
$fullnameField.parent('.md-input-wrapper').find('.md-input-bar').addClass('bottom-fix error-color');
$fullnameField.addClass('uk-form-danger');
} else {
$fullnameField = $('form#userInfo').find('input#user-fullname');
$fullnameField.parent('.md-input-wrapper').removeClass('has-error');
$fullnameField.parent('.md-input-wrapper').find('.md-input-bar').removeClass('bottom-fix error-color');
$fullnameField.removeClass('uk-form-danger');
$fullnameValid = true;
}
if (!$fullnameValid || !$emailValid)
return false;
var $checkEmailBtn = $(this);
$checkEmailBtn.prop('disabled', true).text('Validating...');
$.ajax({
method: 'POST',
url: '/api/v1/public/users/checkemail',
data: {
email: userInfoFormData['user-email'],
captcha: $('#captcha').val()
},
error: function(e) {
$checkEmailBtn.prop('disabled', false).text('Next');
window.Snackbar.show({
text: 'An Error occurred. Check Captcha.',
actionTextColor: 'red'
});
console.error(e);
},
success: function(data) {
$checkEmailBtn.prop('disabled', false).text('Next');
if (!data.success) {
$checkEmailBtn.prop('disabled', false).text('Next');
window.Snackbar.show({
text: 'An Error occurred.',
actionTextColor: 'red'
});
} else {
if (data.exist) {
//Email already Exist
//Show email exists slide
var $active = $('.activeSlide');
var errorSlide = $('#emailExistsSlide');
if (errorSlide.length > 0) {
$('span#emailSpan').text(userInfoFormData['user-email']);
$active.fadeOut(300, function() {
errorSlide.css({display: 'none'}).removeClass('hide');
$(this).addClass('hide').removeClass('activeSlide');
errorSlide.fadeIn(300, function() {
errorSlide.addClass('activeSlide');
});
});
activeSlide++;
}
} else {
userInfo = {
'fullname': userInfoFormData['user-fullname'],
'email': userInfoFormData['user-email']
};
//Reset Error Classes
$emailField = $('form#userInfo').find('input#user-email');
$emailField.parent('.md-input-wrapper').removeClass('has-error');
$emailField.parent('.md-input-wrapper').find('.md-input-bar').removeClass('bottom-fix error-color');
$emailField.removeClass('uk-form-danger');
$fullnameField = $('form#userInfo').find('input#user-fullname');
$fullnameField.parent('.md-input-wrapper').removeClass('has-error');
$fullnameField.parent('.md-input-wrapper').find('.md-input-bar').removeClass('bottom-fix error-color');
$fullnameField.removeClass('uk-form-danger');
advanceSlide();
}
}
}
});
});
function advanceSlide() {
var $active = $('.activeSlide');
var nextSlideIdx = activeSlide + 1;
var nextSlide = $('.slide-' + nextSlideIdx);
if (nextSlide.length > 0) {
$active.fadeOut(300, function() {
$(this).addClass('hide').removeClass('activeSlide');
nextSlide.css({display: 'none'}).removeClass('hide');
nextSlide.fadeIn(300, function() {
nextSlide.addClass('activeSlide');
});
});
activeSlide++;
}
}
$('button#submit-issue').click(function() {
if (isDoubleClicked($(this))) return;
var adminInfoFormData = $('form#adminAccount').serializeObject();
var $subjectField, $issueField;
var $subjectValid = false, $issueValid = false;
if (!adminInfoFormData['ticket-subject'] || (adminInfoFormData['ticket-subject'].length < 5)) {
$subjectField = $('form#adminAccount').find('input#ticket-subject');
$subjectField.parent('.md-input-wrapper').addClass('has-error');
$subjectField.parent('.md-input-wrapper').find('.md-input-bar').addClass('bottom-fix error-color');
$subjectField.addClass('uk-form-danger');
} else {
$subjectField = $('form#adminAccount').find('input#ticket-subject');
$subjectField.parent('.md-input-wrapper').removeClass('has-error');
$subjectField.parent('.md-input-wrapper').find('.md-input-bar').removeClass('bottom-fix error-color');
$subjectField.removeClass('uk-form-danger');
$subjectValid = true;
}
if (!adminInfoFormData['ticket-issue'] || (adminInfoFormData['ticket-issue'].length < 10)) {
$issueField = $('form#adminAccount').find('textarea#ticket-issue');
$issueField.parent('.md-input-wrapper').addClass('has-error');
$issueField.parent('.md-input-wrapper').find('.md-input-bar').addClass('bottom-fix error-color');
$issueField.addClass('uk-form-danger');
} else {
$issueField = $('form#adminAccount').find('textarea#ticket-issue');
$issueField.parent('.md-input-wrapper').removeClass('has-error');
$issueField.parent('.md-input-wrapper').find('.md-input-bar').removeClass('bottom-fix error-color');
$issueField.removeClass('uk-form-danger');
$issueValid = true;
}
if (!$subjectValid || !$issueValid)
return false;
ticket = {
subject: adminInfoFormData['ticket-subject'],
issue: adminInfoFormData['ticket-issue']
};
advanceSlide();
//Send the install POST wait for Response...
setTimeout(function() {
sendIssue();
}, 1500);
});
$('a#privacyPolicyBtn').click(function() {
if (isDoubleClicked($(this))) return;
showPrivacyPolicy();
});
$('button#privacyPolicyBackBtn').click(function() {
if (isDoubleClicked($(this))) return;
var privacyPolicySlide = $('#privacyPolicySlide');
if (privacyPolicySlide.length > 0) {
privacyPolicySlide.fadeOut(300, function() {
privacyPolicySlide.addClass('hide');
var userInfoSlide = $('#userInfoSlide');
userInfoSlide.removeClass('hide');
userInfoSlide.fadeIn(300, function() {
userInfoSlide.addClass('activeSlide');
});
});
activeSlide = 1;
}
});
function showPrivacyPolicy() {
//Show Ticket Created Slide
var $active = $('.activeSlide');
var privacyPolicySlide = $('#privacyPolicySlide');
if (privacyPolicySlide.length > 0) {
//$('span#emailSpan').text(userInfoFormData['user-email']);
$active.fadeOut(300, function() {
privacyPolicySlide.css({display: 'none'}).removeClass('hide');
$(this).addClass('hide');
privacyPolicySlide.fadeIn(300, function() {
});
});
}
}
function showTicketCreated() {
//Show Ticket Created Slide
var $active = $('.activeSlide');
var ticketCreatedSlide = $('#ticketCreatedSlide');
if (ticketCreatedSlide.length > 0) {
//$('span#emailSpan').text(userInfoFormData['user-email']);
$active.fadeOut(300, function() {
ticketCreatedSlide.css({display: 'none'}).removeClass('hide');
$(this).addClass('hide').removeClass('activeSlide');
ticketCreatedSlide.fadeIn(300, function() {
ticketCreatedSlide.addClass('activeSlide');
});
});
activeSlide++;
}
}
function sendIssue() {
var d = {
user: userInfo,
ticket: ticket,
captcha: $('#captcha').val()
};
$.ajax({
method: 'POST',
url: '/api/v1/public/tickets/create',
data: JSON.stringify(d),
contentType: 'application/json',
success: function(response) {
if (!response.success) {
//TODO: Show Error Slide
} else {
//console.log(response);
$('span#spanfullname').text(userInfo.fullname);
$('strong#strongSubject').text(ticket.subject);
$('strong#strongUsername').text(userInfo.email);
$('strong#strongPassword').text(response.userData.chancepass);
showTicketCreated();
}
},
error: function(err) {
console.error(err);
}
})
}
function validateEmail(email) {
var mailFormat = /^\w+([.-]\w+)*@\w+([.-]\w+)*(\.\w+)+$/;
return email.match(mailFormat);
}
$.fn.serializeObject = function(){
var obj = {};
$.each( this.serializeArray(), function(i,o){
var n = o.name,
v = o.value;
obj[n] = obj[n] === undefined ? v
: $.isArray( obj[n] ) ? obj[n].concat( v )
: [ obj[n], v ];
});
return obj;
};
});
});
</script>
</body>
</html>