initial commit
This commit is contained in:
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
// Class Definition
|
||||
var KTSignupComingSoon = function() {
|
||||
// Elements
|
||||
var form;
|
||||
var submitButton;
|
||||
var validator;
|
||||
|
||||
var counterDays;
|
||||
var counterHours;
|
||||
var counterMinutes;
|
||||
var counterSeconds;
|
||||
|
||||
var handleForm = function(e) {
|
||||
var validation;
|
||||
|
||||
if( !form ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Init form validation rules. For more info check the FormValidation plugin's official documentation:https://formvalidation.io/
|
||||
validator = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
'email': {
|
||||
validators: {
|
||||
regexp: {
|
||||
regexp: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
||||
message: 'The value is not a valid email address',
|
||||
},
|
||||
notEmpty: {
|
||||
message: 'Email address is required'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row',
|
||||
eleInvalidClass: '',
|
||||
eleValidClass: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Validate form
|
||||
validator.validate().then(function (status) {
|
||||
if (status == 'Valid') {
|
||||
// Show loading indication
|
||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
submitButton.disabled = true;
|
||||
|
||||
// Simulate ajax request
|
||||
setTimeout(function() {
|
||||
// Hide loading indication
|
||||
submitButton.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
submitButton.disabled = false;
|
||||
|
||||
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "We have received your request. You will be notified once we go live.",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
form.querySelector('[name="email"]').value= "";
|
||||
//form.submit();
|
||||
|
||||
//form.submit(); // submit form
|
||||
var redirectUrl = form.getAttribute('data-kt-redirect-url');
|
||||
if (redirectUrl) {
|
||||
location.href = redirectUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
// Show error popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "Sorry, looks like there are some errors detected, please try again.",
|
||||
icon: "error",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var initCounter = function() {
|
||||
// Set the date we're counting down to
|
||||
var currentTime = new Date();
|
||||
var countDownDate = new Date(currentTime.getTime() + 1000 * 60 * 60 * 24 * 15 + 1000 * 60 * 60 * 10 + 1000 * 60 * 15).getTime();
|
||||
|
||||
var count = function() {
|
||||
// Get todays date and time
|
||||
var now = new Date().getTime();
|
||||
|
||||
// Find the distance between now an the count down date
|
||||
var distance = countDownDate - now;
|
||||
|
||||
// Time calculations for days, hours, minutes and seconds
|
||||
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
|
||||
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
||||
|
||||
// Display the result
|
||||
if(counterDays) counterDays.innerHTML = days;
|
||||
if(counterHours) counterHours.innerHTML = hours;
|
||||
if(counterMinutes) counterMinutes.innerHTML = minutes;
|
||||
if(counterSeconds) counterSeconds.innerHTML = seconds;
|
||||
};
|
||||
|
||||
// Update the count down every 1 second
|
||||
var x = setInterval(count, 1000);
|
||||
|
||||
// Initial count
|
||||
count();
|
||||
}
|
||||
|
||||
// Public Functions
|
||||
return {
|
||||
// public functions
|
||||
init: function() {
|
||||
form = document.querySelector('#kt_coming_soon_form');
|
||||
submitButton = document.querySelector('#kt_coming_soon_submit');
|
||||
|
||||
handleForm();
|
||||
|
||||
counterDays = document.querySelector('#kt_coming_soon_counter_days');
|
||||
if (counterDays) {
|
||||
counterHours = document.querySelector('#kt_coming_soon_counter_hours');
|
||||
counterMinutes = document.querySelector('#kt_coming_soon_counter_minutes');
|
||||
counterSeconds = document.querySelector('#kt_coming_soon_counter_seconds');
|
||||
|
||||
initCounter();
|
||||
}
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTSignupComingSoon.init();
|
||||
});
|
||||
@@ -0,0 +1,169 @@
|
||||
"use strict";
|
||||
|
||||
// Class Definition
|
||||
var KTSignupFreeTrial = function() {
|
||||
// Elements
|
||||
var form;
|
||||
var submitButton;
|
||||
var validator;
|
||||
var passwordMeter;
|
||||
|
||||
// Handle form
|
||||
var handleForm = function(e) {
|
||||
// Init form validation rules. For more info check the FormValidation plugin's official documentation:https://formvalidation.io/
|
||||
validator = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
'email': {
|
||||
validators: {
|
||||
regexp: {
|
||||
regexp: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
||||
message: 'The value is not a valid email address',
|
||||
},
|
||||
notEmpty: {
|
||||
message: 'Email address is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'password': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'The password is required'
|
||||
},
|
||||
callback: {
|
||||
message: 'Please enter valid password',
|
||||
callback: function(input) {
|
||||
if (input.value.length > 0) {
|
||||
return validatePassword();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'confirm-password': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'The password confirmation is required'
|
||||
},
|
||||
identical: {
|
||||
compare: function() {
|
||||
return form.querySelector('[name="password"]').value;
|
||||
},
|
||||
message: 'The password and its confirm are not the same'
|
||||
}
|
||||
}
|
||||
},
|
||||
'toc': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'You must accept the terms and conditions'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger({
|
||||
event: {
|
||||
password: false
|
||||
}
|
||||
}),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row',
|
||||
eleInvalidClass: '',
|
||||
eleValidClass: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
validator.revalidateField('password');
|
||||
|
||||
validator.validate().then(function(status) {
|
||||
if (status == 'Valid') {
|
||||
// Show loading indication
|
||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
submitButton.disabled = true;
|
||||
|
||||
// Simulate ajax request
|
||||
setTimeout(function() {
|
||||
// Hide loading indication
|
||||
submitButton.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
submitButton.disabled = false;
|
||||
|
||||
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "You have successfully registered!",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
form.reset(); // reset form
|
||||
passwordMeter.reset(); // reset password meter
|
||||
|
||||
//form.submit(); // submit form
|
||||
var redirectUrl = form.getAttribute('data-kt-redirect-url');
|
||||
if (redirectUrl) {
|
||||
location.href = redirectUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1500);
|
||||
} else {
|
||||
// Show error popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "Sorry, looks like there are some errors detected, please try again.",
|
||||
icon: "error",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.querySelector('input[name="password"]').addEventListener('input', function() {
|
||||
if (this.value.length > 0) {
|
||||
validator.updateFieldStatus('password', 'NotValidated');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Password input validation
|
||||
var validatePassword = function() {
|
||||
return (passwordMeter.getScore() === 100);
|
||||
}
|
||||
|
||||
// Public functions
|
||||
return {
|
||||
// Initialization
|
||||
init: function() {
|
||||
form = document.querySelector('#kt_free_trial_form');
|
||||
submitButton = document.querySelector('#kt_free_trial_submit');
|
||||
passwordMeter = KTPasswordMeter.getInstance(form.querySelector('[data-kt-password-meter="true"]'));
|
||||
|
||||
handleForm();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTSignupFreeTrial.init();
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTSignupGeneral = function() {
|
||||
// Elements
|
||||
var form;
|
||||
var submitButton;
|
||||
var validator;
|
||||
var passwordMeter;
|
||||
|
||||
// Handle form
|
||||
var handleForm = function(e) {
|
||||
// Init form validation rules. For more info check the FormValidation plugin's official documentation:https://formvalidation.io/
|
||||
validator = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
'first-name': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'First Name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'last-name': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Last Name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'email': {
|
||||
validators: {
|
||||
regexp: {
|
||||
regexp: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
||||
message: 'The value is not a valid email address',
|
||||
},
|
||||
notEmpty: {
|
||||
message: 'Email address is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
'password': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'The password is required'
|
||||
},
|
||||
callback: {
|
||||
message: 'Please enter valid password',
|
||||
callback: function(input) {
|
||||
if (input.value.length > 0) {
|
||||
return validatePassword();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'confirm-password': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'The password confirmation is required'
|
||||
},
|
||||
identical: {
|
||||
compare: function() {
|
||||
return form.querySelector('[name="password"]').value;
|
||||
},
|
||||
message: 'The password and its confirm are not the same'
|
||||
}
|
||||
}
|
||||
},
|
||||
'toc': {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'You must accept the terms and conditions'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger({
|
||||
event: {
|
||||
password: false
|
||||
}
|
||||
}),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row',
|
||||
eleInvalidClass: '', // comment to enable invalid state icons
|
||||
eleValidClass: '' // comment to enable valid state icons
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Handle form submit
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
validator.revalidateField('password');
|
||||
|
||||
validator.validate().then(function(status) {
|
||||
if (status == 'Valid') {
|
||||
// Show loading indication
|
||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||
|
||||
// Disable button to avoid multiple click
|
||||
submitButton.disabled = true;
|
||||
|
||||
// Simulate ajax request
|
||||
setTimeout(function() {
|
||||
// Hide loading indication
|
||||
submitButton.removeAttribute('data-kt-indicator');
|
||||
|
||||
// Enable button
|
||||
submitButton.disabled = false;
|
||||
|
||||
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "You have successfully reset your password!",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
form.reset(); // reset form
|
||||
passwordMeter.reset(); // reset password meter
|
||||
//form.submit();
|
||||
|
||||
//form.submit(); // submit form
|
||||
var redirectUrl = form.getAttribute('data-kt-redirect-url');
|
||||
if (redirectUrl) {
|
||||
location.href = redirectUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1500);
|
||||
} else {
|
||||
// Show error popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: "Sorry, looks like there are some errors detected, please try again.",
|
||||
icon: "error",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle password input
|
||||
form.querySelector('input[name="password"]').addEventListener('input', function() {
|
||||
if (this.value.length > 0) {
|
||||
validator.updateFieldStatus('password', 'NotValidated');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Password input validation
|
||||
var validatePassword = function() {
|
||||
return (passwordMeter.getScore() === 100);
|
||||
}
|
||||
|
||||
// Public functions
|
||||
return {
|
||||
// Initialization
|
||||
init: function() {
|
||||
// Elements
|
||||
form = document.querySelector('#kt_sign_up_form');
|
||||
submitButton = document.querySelector('#kt_sign_up_submit');
|
||||
passwordMeter = KTPasswordMeter.getInstance(form.querySelector('[data-kt-password-meter="true"]'));
|
||||
|
||||
handleForm ();
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTSignupGeneral.init();
|
||||
});
|
||||
Reference in New Issue
Block a user