Initial Commit
The initial public commit of MVGL website code.
This commit is contained in:
commit
b39ecf1638
2043 changed files with 215154 additions and 0 deletions
178
resources/assets/extended/js/custom/account/settings/profile-details.js
vendored
Normal file
178
resources/assets/extended/js/custom/account/settings/profile-details.js
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTAccountSettingsProfileDetails = function () {
|
||||
// Private variables
|
||||
var form;
|
||||
var submitButton;
|
||||
var validation;
|
||||
|
||||
// Private functions
|
||||
var initValidation = function () {
|
||||
// Init form validation rules. For more info check the FormValidation plugin's official documentation: https://formvalidation.io/
|
||||
validation = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
first_name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'First name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
last_name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Last name is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
phone: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Contact phone number is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
country: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Please select a country'
|
||||
}
|
||||
}
|
||||
},
|
||||
timezone: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Please select a timezone'
|
||||
}
|
||||
}
|
||||
},
|
||||
language: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Please select a language'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row',
|
||||
eleInvalidClass: '',
|
||||
eleValidClass: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Select2 validation integration
|
||||
$(form.querySelector('[name="country"]')).on('change', function () {
|
||||
// Revalidate the color field when an option is chosen
|
||||
validation.revalidateField('country');
|
||||
});
|
||||
|
||||
$(form.querySelector('[name="language"]')).on('change', function () {
|
||||
// Revalidate the color field when an option is chosen
|
||||
validation.revalidateField('language');
|
||||
});
|
||||
|
||||
$(form.querySelector('[name="timezone"]')).on('change', function () {
|
||||
// Revalidate the color field when an option is chosen
|
||||
validation.revalidateField('timezone');
|
||||
});
|
||||
}
|
||||
|
||||
var handleForm = function () {
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Validate form
|
||||
validation.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;
|
||||
|
||||
// Send 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: "Thank you! You've updated your basic info",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
}
|
||||
});
|
||||
})
|
||||
.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 methods
|
||||
return {
|
||||
init: function () {
|
||||
form = document.getElementById('kt_account_profile_details_form');
|
||||
submitButton = form.querySelector('#kt_account_profile_details_submit');
|
||||
|
||||
initValidation();
|
||||
handleForm();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function () {
|
||||
KTAccountSettingsProfileDetails.init();
|
||||
});
|
296
resources/assets/extended/js/custom/account/settings/signin-methods.js
vendored
Normal file
296
resources/assets/extended/js/custom/account/settings/signin-methods.js
vendored
Normal file
|
@ -0,0 +1,296 @@
|
|||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTAccountSettingsSigninMethods = function () {
|
||||
// Private functions
|
||||
var initSettings = function () {
|
||||
|
||||
// UI elements
|
||||
var signInMainEl = document.getElementById('kt_signin_email');
|
||||
var signInEditEl = document.getElementById('kt_signin_email_edit');
|
||||
var passwordMainEl = document.getElementById('kt_signin_password');
|
||||
var passwordEditEl = document.getElementById('kt_signin_password_edit');
|
||||
|
||||
// button elements
|
||||
var signInChangeEmail = document.getElementById('kt_signin_email_button');
|
||||
var signInCancelEmail = document.getElementById('kt_signin_cancel');
|
||||
var passwordChange = document.getElementById('kt_signin_password_button');
|
||||
var passwordCancel = document.getElementById('kt_password_cancel');
|
||||
|
||||
// toggle UI
|
||||
signInChangeEmail.querySelector('button').addEventListener('click', function () {
|
||||
toggleChangeEmail();
|
||||
});
|
||||
|
||||
signInCancelEmail.addEventListener('click', function () {
|
||||
toggleChangeEmail();
|
||||
});
|
||||
|
||||
passwordChange.querySelector('button').addEventListener('click', function () {
|
||||
toggleChangePassword();
|
||||
});
|
||||
|
||||
passwordCancel.addEventListener('click', function () {
|
||||
toggleChangePassword();
|
||||
});
|
||||
|
||||
var toggleChangeEmail = function () {
|
||||
signInMainEl.classList.toggle('d-none');
|
||||
signInChangeEmail.classList.toggle('d-none');
|
||||
signInEditEl.classList.toggle('d-none');
|
||||
}
|
||||
|
||||
var toggleChangePassword = function () {
|
||||
passwordMainEl.classList.toggle('d-none');
|
||||
passwordChange.classList.toggle('d-none');
|
||||
passwordEditEl.classList.toggle('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
var handleChangeEmail = function (e) {
|
||||
var validation;
|
||||
|
||||
// form elements
|
||||
var form = document.getElementById('kt_signin_change_email');
|
||||
var submitButton = form.querySelector('#kt_signin_submit');
|
||||
|
||||
validation = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
email: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Email is required'
|
||||
},
|
||||
emailAddress: {
|
||||
message: 'The value is not a valid email address'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
password: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Password is required'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
plugins: { //Learn more: https://formvalidation.io/guide/plugins
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row'
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
validation.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;
|
||||
|
||||
// Send ajax request
|
||||
axios.post(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: "Your email has been successfully changed.",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn font-weight-bold btn-light-primary"
|
||||
}
|
||||
});
|
||||
})
|
||||
.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 {
|
||||
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 font-weight-bold btn-light-primary"
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var handleChangePassword = function (e) {
|
||||
var validation;
|
||||
|
||||
// form elements
|
||||
var form = document.getElementById('kt_signin_change_password');
|
||||
var submitButton = form.querySelector('#kt_password_submit');
|
||||
|
||||
validation = FormValidation.formValidation(
|
||||
form,
|
||||
{
|
||||
fields: {
|
||||
current_password: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Current Password is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
password: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'New Password is required'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
password_confirmation: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: 'Confirm Password is required'
|
||||
},
|
||||
identical: {
|
||||
compare: function () {
|
||||
return form.querySelector('[name="password"]').value;
|
||||
},
|
||||
message: 'The password and its confirm are not the same'
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
plugins: { //Learn more: https://formvalidation.io/guide/plugins
|
||||
trigger: new FormValidation.plugins.Trigger(),
|
||||
bootstrap: new FormValidation.plugins.Bootstrap5({
|
||||
rowSelector: '.fv-row'
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
submitButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
validation.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;
|
||||
|
||||
// Send ajax request
|
||||
axios.post(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: "Your password has been successfully reset.",
|
||||
icon: "success",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Ok, got it!",
|
||||
customClass: {
|
||||
confirmButton: "btn font-weight-bold btn-light-primary"
|
||||
}
|
||||
});
|
||||
})
|
||||
.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 {
|
||||
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 font-weight-bold btn-light-primary"
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
initSettings();
|
||||
handleChangeEmail();
|
||||
handleChangePassword();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function () {
|
||||
KTAccountSettingsSigninMethods.init();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue