-
Notifications
You must be signed in to change notification settings - Fork 11
/
usecase-form-modal.php
192 lines (178 loc) · 6.12 KB
/
usecase-form-modal.php
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
<script type="text/javascript" language="javascript">
function IsEmail(email) {
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!regex.test(email)) {
return false;
} else {
return true;
}
}
$("#btnUsecase").live("click", function() {
var isAccepted = $('#isAccept').is(':checked');
if ($("#nameUsecase").val() !== "" && $("#comUsecase").val() !== "" && $("#emailUsecase").val() !== "" && isAccepted) {
if (!IsEmail($("#emailUsecase").val())) {
var e = document.getElementById("emailValidationUsecase");
e.className = "show";
setTimeout(function() {
e.className = e.className.replace("show", "");
}, 3000);
return;
}
var name = $("#nameUsecase").val();
var email = $("#emailUsecase").val();
var company = $("#comUsecase").val();
var phone = $("#phoneUsecase").val();
var x = document.getElementById("snackbarUsecase");
document.getElementById('usecaseLoading').style.visibility = 'visible';
$.ajax({
type: "POST",
url: "./useCaseMail?page=<?php echo $isFor; ?>",
data: "name=" + name + '&email=' + email + '&company=' + company + '&phone=' + phone,
success: function(data) {
x.className = "show";
document.getElementById('usecaseLoading').style.visibility = 'hidden';
setTimeout(function() {
x.className = x.className.replace("show", "");
$('#myModal').modal('hide');
}, 3000);
$('#nameUsecase').val('');
$('#emailUsecase').val('');
$('#comUsecase').val('');
$('#phoneUsecase').val('');
}
});
} else {
var y = document.getElementById("validationUsecase");
y.className = "show";
setTimeout(function() {
y.className = y.className.replace("show", "");
}, 3000);
document.getElementById('usecaseLoading').style.visibility = 'hidden';
}
});
</script>
<style>
#snackbarUsecase {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 2px;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
font-size: 17px;
}
#snackbarUsecase.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
#validationUsecase {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 2px;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
font-size: 17px;
}
#validationUsecase.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
#emailValidationUsecase {
visibility: hidden;
min-width: 250px;
margin-left: -125px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 2px;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
bottom: 30px;
font-size: 17px;
}
#emailValidationUsecase.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@keyframes fadein {
from {
bottom: 0;
opacity: 0;
}
to {
bottom: 30px;
opacity: 1;
}
}
@keyframes fadeout {
from {
bottom: 30px;
opacity: 1;
}
to {
bottom: 0;
opacity: 0;
}
}
</style>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Get Use-Case for <?php echo $isFor; ?></h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<div class="formBox w-100">
<div class="form-group">
<input type="text" class="form-control" name="name" id="nameUsecase" placeholder="Name *">
</div>
<div class="form-group">
<input type="text" class="form-control" name="email" id="emailUsecase" placeholder="Email *">
</div>
<div class="form-group">
<input type="text" class="form-control" name="phone" id="phoneUsecase" placeholder="Phone"
onkeypress='validate(event)'>
</div>
<div class="form-group">
<input type="text" class="form-control" name="company" id="comUsecase" placeholder="Company *">
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="isAccept" checked="">
<label class="custom-control-label" for="isAccept">I agree to download the usecase.</label>
</div>
</div>
<div id="emailValidationUsecase">Email is Incorrect</div>
<div id="snackbarUsecase">We Will Contact you Shortly</div>
<div id="validationUsecase">Fill All the Mandatory Fields</div>
<br>
</div>
</div>
<div class="modal-footer">
<i class="fa fa-spinner fa-spin" style="color:#ed1b4a; visibility: hidden" id="usecaseLoading" aria-hidden="true"></i>
<input type="button" value="Submit" id="btnUsecase" class="btnmodal btn-round btn-red-grd">
<input type="button" value="Close" data-dismiss="modal" class="btnmodal btn-round btn-red-grd">
</div>
</div>
</div>
</div>