Initial Commit

The initial public commit of MVGL website code.
This commit is contained in:
Jimmy B. 2024-01-14 13:51:43 -06:00
commit b39ecf1638
2043 changed files with 215154 additions and 0 deletions

View file

@ -0,0 +1,174 @@
"use strict";
// Class Definition
var KTPasswordResetNewPassword = function () {
// Elements
var form;
var submitButton;
var validator;
var passwordMeter;
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: {
'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
axios.post(submitButton.closest('form').getAttribute('action'), new FormData(form))
.then(function (response) {
// 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) {
window.location.href = '/login';
form.querySelector('[name="email"]').value = "";
form.querySelector('[name="password"]').value = "";
form.querySelector('[name="confirm-password"]').value = "";
passwordMeter.reset(); // reset password meter
}
});
})
.catch(function (error) {
let dataMessage = error.response.data.message;
let dataErrors = error.response.data.errors;
for (const errorsKey in dataErrors) {
if (!dataErrors.hasOwnProperty(errorsKey)) continue;
dataMessage += "\r\n" + dataErrors[errorsKey];
}
if (error.response) {
Swal.fire({
text: dataMessage,
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
});
}
})
.then(function () {
// always executed
// Hide loading indication
submitButton.removeAttribute('data-kt-indicator');
// Enable button
submitButton.disabled = false;
});
} 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');
}
});
}
var validatePassword = function () {
return (passwordMeter.getScore() > 50);
}
// Public Functions
return {
// public functions
init: function () {
form = document.querySelector('#kt_new_password_form');
submitButton = document.querySelector('#kt_new_password_submit');
passwordMeter = KTPasswordMeter.getInstance(form.querySelector('[data-kt-password-meter="true"]'));
handleForm();
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
KTPasswordResetNewPassword.init();
});

View file

@ -0,0 +1,131 @@
"use strict";
// Class Definition
var KTPasswordResetGeneral = function () {
// Elements
var form;
var submitButton;
var validator;
// 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: {
notEmpty: {
message: 'Email address is required'
},
emailAddress: {
message: 'The value is not a valid email address'
}
}
}
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap: new FormValidation.plugins.Bootstrap5({
rowSelector: '.fv-row',
eleInvalidClass: '',
eleValidClass: ''
})
}
}
);
// Handle form submit
submitButton.addEventListener('click', function (e) {
// Prevent button default action
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
axios.post(submitButton.closest('form').getAttribute('action'), new FormData(form))
.then(function (response) {
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
Swal.fire({
text: "Please check your email to proceed with the password reset.",
icon: "success",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
}).then(function (result) {
if (result.isConfirmed) {
form.querySelector('[name="email"]').value = "";
}
});
})
.catch(function (error) {
let dataMessage = error.response.data.message;
let dataErrors = error.response.data.errors;
for (const errorsKey in dataErrors) {
if (!dataErrors.hasOwnProperty(errorsKey)) continue;
dataMessage += "\r\n" + dataErrors[errorsKey];
}
if (error.response) {
Swal.fire({
text: dataMessage,
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
});
}
})
.then(function () {
// always executed
// Hide loading indication
submitButton.removeAttribute('data-kt-indicator');
// Enable button
submitButton.disabled = false;
});
} 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"
}
});
}
});
});
}
// Public functions
return {
// Initialization
init: function () {
form = document.querySelector('#kt_password_reset_form');
submitButton = document.querySelector('#kt_password_reset_submit');
handleForm();
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
KTPasswordResetGeneral.init();
});

View file

@ -0,0 +1,143 @@
"use strict";
// Class definition
var KTSigninGeneral = function () {
// Elements
var form;
var submitButton;
var validator;
// 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: {
notEmpty: {
message: 'Email address is required'
},
emailAddress: {
message: 'The value is not a valid email address'
}
}
},
'password': {
validators: {
notEmpty: {
message: 'The password is required'
},
callback: {
message: 'Please enter valid password',
}
}
}
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap: new FormValidation.plugins.Bootstrap5({
rowSelector: '.fv-row',
eleInvalidClass: '',
eleValidClass: ''
})
}
}
);
// Handle form submit
submitButton.addEventListener('click', function (e) {
// Prevent button default action
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
axios.post(submitButton.closest('form').getAttribute('action'), new FormData(form))
.then(function (response) {
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
Swal.fire({
text: "You have successfully logged in!",
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.querySelector('[name="password"]').value = "";
window.location.reload();
}
});
})
.catch(function (error) {
let dataMessage = error.response.data.message;
let dataErrors = error.response.data.errors;
for (const errorsKey in dataErrors) {
if (!dataErrors.hasOwnProperty(errorsKey)) continue;
dataMessage += "\r\n" + dataErrors[errorsKey];
}
if (error.response) {
Swal.fire({
text: dataMessage,
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
});
}
})
.then(function () {
// always executed
// Hide loading indication
submitButton.removeAttribute('data-kt-indicator');
// Enable button
submitButton.disabled = false;
});
} 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"
}
});
}
});
});
}
// Public functions
return {
// Initialization
init: function () {
form = document.querySelector('#kt_sign_in_form');
submitButton = document.querySelector('#kt_sign_in_submit');
handleForm();
}
};
}();
// On document ready
KTUtil.onDOMContentLoaded(function () {
KTSigninGeneral.init();
});

View file

@ -0,0 +1,205 @@
"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: {
'username': {
validators: {
notEmpty: {
message: 'A username is required.'
},
stringLength: {
max: 16,
message: 'The username must not be more than 16 characters.',
},
regexp: {
regexp: /^[a-zA-Z0-9-_]+$/,
message: 'Usernames can only contain alphanumeric characters, hyphens and underscores.'
}
}
},
'email': {
validators: {
notEmpty: {
message: 'An email address is required.'
},
emailAddress: {
message: 'The value is not a valid email address.'
}
}
},
'password': {
validators: {
stringLength: {
min: 16,
message: 'The password must be at least 16 characters long.',
},
notEmpty: {
message: 'A password is required.'
},
callback: {
message: 'Please enter valid password.',
callback: function (input) {
if (input.value.length > 0) {
return validatePassword();
}
}
}
}
},
'password_confirmation': {
validators: {
notEmpty: {
message: 'The password confirmation field is required.'
},
identical: {
compare: function () {
return form.querySelector('[name="password"]').value;
},
message: 'The passwords 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: ''
})
}
}
);
// Handle form submit
submitButton.addEventListener('click', function (e) {
// Prevent button default action
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
axios.post(submitButton.closest('form').getAttribute('action'), new FormData(form))
.then(function (response) {
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
Swal.fire({
text: "You have successfully registered! Please check your email for verification.",
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.querySelector('[name="password"]').value = "";
window.location.reload();
}
});
})
.catch(function (error) {
let dataMessage = error.response.data.message;
let dataErrors = error.response.data.errors;
for (const errorsKey in dataErrors) {
if (!dataErrors.hasOwnProperty(errorsKey)) continue;
dataMessage += "\r\n" + dataErrors[errorsKey];
}
if (error.response) {
Swal.fire({
text: dataMessage,
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
});
}
})
.then(function () {
// always executed
// Hide loading indication
submitButton.removeAttribute('data-kt-indicator');
// Enable button
submitButton.disabled = false;
});
} 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() > 50);
}
// Public functions
return {
// Initialization
init: function () {
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();
});