initial commit

This commit is contained in:
2025-11-11 14:55:29 +07:00
commit 7c17aa7843
2490 changed files with 606138 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
"use strict";
// Class definition
var KTAccountSettingsDeactivateAccount = function () {
// Private variables
var form;
var validation;
var submitButton;
// 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: {
deactivate: {
validators: {
notEmpty: {
message: 'Please check the box to deactivate your account'
}
}
}
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
submitButton: new FormValidation.plugins.SubmitButton(),
//defaultSubmit: new FormValidation.plugins.DefaultSubmit(), // Uncomment this line to enable normal button submit after form validation
bootstrap: new FormValidation.plugins.Bootstrap5({
rowSelector: '.fv-row',
eleInvalidClass: '',
eleValidClass: ''
})
}
}
);
}
var handleForm = function () {
submitButton.addEventListener('click', function (e) {
e.preventDefault();
validation.validate().then(function (status) {
if (status == 'Valid') {
swal.fire({
text: "Are you sure you would like to deactivate your account?",
icon: "warning",
buttonsStyling: false,
showDenyButton: true,
confirmButtonText: "Yes",
denyButtonText: 'No',
customClass: {
confirmButton: "btn btn-light-primary",
denyButton: "btn btn-danger"
}
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
text: 'Your account has been deactivated.',
icon: 'success',
confirmButtonText: "Ok",
buttonsStyling: false,
customClass: {
confirmButton: "btn btn-light-primary"
}
})
} else if (result.isDenied) {
Swal.fire({
text: 'Account not deactivated.',
icon: 'info',
confirmButtonText: "Ok",
buttonsStyling: false,
customClass: {
confirmButton: "btn btn-light-primary"
}
})
}
});
} 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 btn-light-primary"
}
});
}
});
});
}
// Public methods
return {
init: function () {
form = document.querySelector('#kt_account_deactivate_form');
if (!form) {
return;
}
submitButton = document.querySelector('#kt_account_deactivate_account_submit');
initValidation();
handleForm();
}
}
}();
// On document ready
KTUtil.onDOMContentLoaded(function() {
KTAccountSettingsDeactivateAccount.init();
});

View File

@@ -0,0 +1,21 @@
"use strict";
// Class definition
var KTAccountSettingsOverview = function () {
// Private functions
var initSettings = function() {
}
// Public methods
return {
init: function () {
initSettings();
}
}
}();
// On document ready
KTUtil.onDOMContentLoaded(function() {
KTAccountSettingsOverview.init();
});

View File

@@ -0,0 +1,155 @@
"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: {
fname: {
validators: {
notEmpty: {
message: 'First name is required'
}
}
},
lname: {
validators: {
notEmpty: {
message: 'Last name is required'
}
}
},
company: {
validators: {
notEmpty: {
message: 'Company 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'
}
}
},
'communication[]': {
validators: {
notEmpty: {
message: 'Please select at least one communication method'
}
}
},
language: {
validators: {
notEmpty: {
message: 'Please select a language'
}
}
},
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
submitButton: new FormValidation.plugins.SubmitButton(),
//defaultSubmit: new FormValidation.plugins.DefaultSubmit(), // Uncomment this line to enable normal button submit after form validation
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();
validation.validate().then(function (status) {
if (status == 'Valid') {
swal.fire({
text: "Thank you! You've updated your basic info",
icon: "success",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn fw-bold btn-light-primary"
}
});
} 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 fw-bold btn-light-primary"
}
});
}
});
});
}
// Public methods
return {
init: function () {
form = document.getElementById('kt_account_profile_details_form');
if (!form) {
return;
}
submitButton = form.querySelector('#kt_account_profile_details_submit');
initValidation();
}
}
}();
// On document ready
KTUtil.onDOMContentLoaded(function() {
KTAccountSettingsProfileDetails.init();
});

View File

@@ -0,0 +1,236 @@
"use strict";
// Class definition
var KTAccountSettingsSigninMethods = function () {
var signInForm;
var signInMainEl;
var signInEditEl;
var passwordMainEl;
var passwordEditEl;
var signInChangeEmail;
var signInCancelEmail;
var passwordChange;
var passwordCancel;
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');
}
// Private functions
var initSettings = function () {
if (!signInMainEl) {
return;
}
// 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 handleChangeEmail = function (e) {
var validation;
if (!signInForm) {
return;
}
validation = FormValidation.formValidation(
signInForm,
{
fields: {
emailaddress: {
validators: {
notEmpty: {
message: 'Email is required'
},
emailAddress: {
message: 'The value is not a valid email address'
}
}
},
confirmemailpassword: {
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'
})
}
}
);
signInForm.querySelector('#kt_signin_submit').addEventListener('click', function (e) {
e.preventDefault();
console.log('click');
validation.validate().then(function (status) {
if (status == 'Valid') {
swal.fire({
text: "Sent password reset. Please check your email",
icon: "success",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn font-weight-bold btn-light-primary"
}
}).then(function(){
signInForm.reset();
validation.resetForm(); // Reset formvalidation --- more info: https://formvalidation.io/guide/api/reset-form/
toggleChangeEmail();
});
} 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 passwordForm = document.getElementById('kt_signin_change_password');
if (!passwordForm) {
return;
}
validation = FormValidation.formValidation(
passwordForm,
{
fields: {
currentpassword: {
validators: {
notEmpty: {
message: 'Current Password is required'
}
}
},
newpassword: {
validators: {
notEmpty: {
message: 'New Password is required'
}
}
},
confirmpassword: {
validators: {
notEmpty: {
message: 'Confirm Password is required'
},
identical: {
compare: function() {
return passwordForm.querySelector('[name="newpassword"]').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'
})
}
}
);
passwordForm.querySelector('#kt_password_submit').addEventListener('click', function (e) {
e.preventDefault();
console.log('click');
validation.validate().then(function (status) {
if (status == 'Valid') {
swal.fire({
text: "Sent password reset. Please check your email",
icon: "success",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn font-weight-bold btn-light-primary"
}
}).then(function(){
passwordForm.reset();
validation.resetForm(); // Reset formvalidation --- more info: https://formvalidation.io/guide/api/reset-form/
toggleChangePassword();
});
} 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 () {
signInForm = document.getElementById('kt_signin_change_email');
signInMainEl = document.getElementById('kt_signin_email');
signInEditEl = document.getElementById('kt_signin_email_edit');
passwordMainEl = document.getElementById('kt_signin_password');
passwordEditEl = document.getElementById('kt_signin_password_edit');
signInChangeEmail = document.getElementById('kt_signin_email_button');
signInCancelEmail = document.getElementById('kt_signin_cancel');
passwordChange = document.getElementById('kt_signin_password_button');
passwordCancel = document.getElementById('kt_password_cancel');
initSettings();
handleChangeEmail();
handleChangePassword();
}
}
}();
// On document ready
KTUtil.onDOMContentLoaded(function() {
KTAccountSettingsSigninMethods.init();
});