-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Crudzaso/develop
Develop
- Loading branch information
Showing
190 changed files
with
208,814 additions
and
249 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"use strict"; | ||
|
||
// Class definition | ||
var KTAccountAPIKeys = function () { | ||
// Private functions | ||
var initLicenceCopy = function() { | ||
KTUtil.each(document.querySelectorAll('#kt_api_keys_table [data-action="copy"]'), function(button) { | ||
var tr = button.closest('tr'); | ||
var license = KTUtil.find(tr, '[data-bs-target="license"]'); | ||
|
||
var clipboard = new ClipboardJS(button, { | ||
target: license, | ||
text: function() { | ||
return license.innerHTML; | ||
} | ||
}); | ||
|
||
clipboard.on('success', function(e) { | ||
// Icons | ||
var copyIcon = button.querySelector('.ki-copy'); | ||
var checkIcon = button.querySelector('.ki-check'); | ||
|
||
// exit if check icon is already shown | ||
if (checkIcon) { | ||
return; | ||
} | ||
|
||
// Create check icon | ||
checkIcon = document.createElement('i'); | ||
checkIcon.classList.add('ki-solid'); | ||
checkIcon.classList.add('ki-check'); | ||
checkIcon.classList.add('fs-2'); | ||
|
||
// Append check icon | ||
button.appendChild(checkIcon); | ||
|
||
// Highlight target | ||
license.classList.add('text-success'); | ||
|
||
// Hide copy icon | ||
copyIcon.classList.add('d-none'); | ||
|
||
// Set 3 seconds timeout to hide the check icon and show copy icon back | ||
setTimeout(function() { | ||
// Remove check icon | ||
copyIcon.classList.remove('d-none'); | ||
// Show check icon back | ||
button.removeChild(checkIcon); | ||
|
||
// Remove highlight | ||
license.classList.remove('text-success'); | ||
}, 3000); | ||
}); | ||
}); | ||
} | ||
|
||
// Public methods | ||
return { | ||
init: function () { | ||
initLicenceCopy(); | ||
} | ||
} | ||
}(); | ||
|
||
// On document ready | ||
KTUtil.onDOMContentLoaded(function() { | ||
KTAccountAPIKeys.init(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
"use strict"; | ||
|
||
// Class definition | ||
var KTAccountBillingGeneral = function () { | ||
// Private variables | ||
var cancelSubscriptionButton; | ||
|
||
// Private functions | ||
var handlePlan = function () { | ||
cancelSubscriptionButton.addEventListener('click', function (e) { | ||
e.preventDefault(); | ||
|
||
swal.fire({ | ||
text: "Are you sure you would like to cancel your subscription ?", | ||
icon: "warning", | ||
buttonsStyling: false, | ||
showDenyButton: true, | ||
confirmButtonText: "Yes", | ||
denyButtonText: 'No', | ||
customClass: { | ||
confirmButton: "btn btn-primary", | ||
denyButton: "btn btn-light-danger" | ||
} | ||
}).then((result) => { | ||
if (result.isConfirmed) { | ||
Swal.fire({ | ||
text: 'Your subscription has been canceled.', | ||
icon: 'success', | ||
confirmButtonText: "Ok", | ||
buttonsStyling: false, | ||
customClass: { | ||
confirmButton: "btn btn-light-primary" | ||
} | ||
}) | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
var handleCardDelete = function() { | ||
KTUtil.on(document.body, '[data-kt-billing-action="card-delete"]', 'click', function(e) { | ||
e.preventDefault(); | ||
|
||
var el = this; | ||
|
||
swal.fire({ | ||
text: "Are you sure you would like to delete selected card ?", | ||
icon: "warning", | ||
buttonsStyling: false, | ||
showDenyButton: true, | ||
confirmButtonText: "Yes", | ||
denyButtonText: 'No', | ||
customClass: { | ||
confirmButton: "btn btn-primary", | ||
denyButton: "btn btn-light-danger" | ||
} | ||
}).then((result) => { | ||
if (result.isConfirmed) { | ||
el.setAttribute('data-kt-indicator', 'on'); | ||
el.disabled = true; | ||
|
||
setTimeout(function() { | ||
Swal.fire({ | ||
text: 'Your selected card has been successfully deleted', | ||
icon: 'success', | ||
confirmButtonText: "Ok", | ||
buttonsStyling: false, | ||
customClass: { | ||
confirmButton: "btn btn-light-primary" | ||
} | ||
}).then((result) => { | ||
el.closest('[data-kt-billing-element="card"]').remove(); | ||
}); | ||
}, 2000); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
var handleAddressDelete = function() { | ||
KTUtil.on(document.body, '[data-kt-billing-action="address-delete"]', 'click', function(e) { | ||
e.preventDefault(); | ||
|
||
var el = this; | ||
|
||
swal.fire({ | ||
text: "Are you sure you would like to delete selected address ?", | ||
icon: "warning", | ||
buttonsStyling: false, | ||
showDenyButton: true, | ||
confirmButtonText: "Yes", | ||
denyButtonText: 'No', | ||
customClass: { | ||
confirmButton: "btn btn-primary", | ||
denyButton: "btn btn-light-danger" | ||
} | ||
}).then((result) => { | ||
if (result.isConfirmed) { | ||
el.setAttribute('data-kt-indicator', 'on'); | ||
el.disabled = true; | ||
|
||
setTimeout(function() { | ||
Swal.fire({ | ||
text: 'Your selected address has been successfully deleted', | ||
icon: 'success', | ||
confirmButtonText: "Ok", | ||
buttonsStyling: false, | ||
customClass: { | ||
confirmButton: "btn btn-light-primary" | ||
} | ||
}).then((result) => { | ||
el.closest('[data-kt-billing-element="address"]').remove(); | ||
}); | ||
}, 2000); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
// Public methods | ||
return { | ||
init: function () { | ||
cancelSubscriptionButton = document.querySelector('#kt_account_billing_cancel_subscription_btn'); | ||
|
||
if ( cancelSubscriptionButton ) { | ||
handlePlan(); | ||
} | ||
|
||
handleCardDelete(); | ||
handleAddressDelete(); | ||
} | ||
} | ||
}(); | ||
|
||
// On document ready | ||
KTUtil.onDOMContentLoaded(function() { | ||
KTAccountBillingGeneral.init(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
"use strict"; | ||
|
||
// Class definition | ||
var KTDatatablesClassic = function () { | ||
// Private functions | ||
|
||
var initClassic = function () { | ||
|
||
// Set date data order | ||
const table = document.getElementById('kt_orders_classic'); | ||
const tableRows = table.querySelectorAll('tbody tr'); | ||
|
||
tableRows.forEach(row => { | ||
const dateRow = row.querySelectorAll('td'); | ||
const realDate = moment(dateRow[1].innerHTML, "MMM D, YYYY").format('x'); | ||
dateRow[1].setAttribute('data-order', realDate); | ||
}); | ||
|
||
// Init datatable --- more info on datatables: https://datatables.net/manual/ | ||
const datatable = $(table).DataTable({ | ||
"info": false, | ||
'order': [] | ||
}); | ||
|
||
// Filter dropdown elements | ||
const filterOrders = document.getElementById('kt_filter_orders'); | ||
const filterYear = document.getElementById('kt_filter_year'); | ||
|
||
// Filter by order status --- official docs reference: https://datatables.net/reference/api/search() | ||
filterOrders.addEventListener('change', function (e) { | ||
datatable.column(3).search(e.target.value).draw(); | ||
}); | ||
|
||
// Filter by date --- official docs reference: https://momentjs.com/docs/ | ||
var minDate; | ||
var maxDate; | ||
filterYear.addEventListener('change', function (e) { | ||
const value = e.target.value; | ||
switch (value) { | ||
case 'thisyear': { | ||
minDate = moment().startOf('year').format('x'); | ||
maxDate = moment().endOf('year').format('x'); | ||
datatable.draw(); | ||
break; | ||
} | ||
case 'thismonth': { | ||
minDate = moment().startOf('month').format('x'); | ||
maxDate = moment().endOf('month').format('x'); | ||
datatable.draw(); | ||
break; | ||
} | ||
case 'lastmonth': { | ||
minDate = moment().subtract(1, 'months').startOf('month').format('x'); | ||
maxDate = moment().subtract(1, 'months').endOf('month').format('x'); | ||
datatable.draw(); | ||
break; | ||
} | ||
case 'last90days': { | ||
minDate = moment().subtract(30, 'days').format('x'); | ||
maxDate = moment().format('x'); | ||
datatable.draw(); | ||
break; | ||
} | ||
default: { | ||
minDate = moment().subtract(100, 'years').startOf('month').format('x'); | ||
maxDate = moment().add(1, 'months').endOf('month').format('x'); | ||
datatable.draw(); | ||
break; | ||
} | ||
} | ||
}); | ||
|
||
// Date range filter --- offical docs reference: https://datatables.net/examples/plug-ins/range_filtering.html | ||
$.fn.dataTable.ext.search.push( | ||
function (settings, data, dataIndex) { | ||
var min = minDate; | ||
var max = maxDate; | ||
var date = parseFloat(moment(data[1]).format('x')) || 0; // use data for the age column | ||
|
||
if ((isNaN(min) && isNaN(max)) || | ||
(isNaN(min) && date <= max) || | ||
(min <= date && isNaN(max)) || | ||
(min <= date && date <= max)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
); | ||
|
||
// Search --- official docs reference: https://datatables.net/reference/api/search() | ||
var filterSearch = document.getElementById('kt_filter_search'); | ||
filterSearch.addEventListener('keyup', function (e) { | ||
datatable.search(e.target.value).draw(); | ||
}); | ||
} | ||
|
||
// Public methods | ||
return { | ||
init: function () { | ||
initClassic(); | ||
} | ||
} | ||
}(); | ||
|
||
// On document ready | ||
KTUtil.onDOMContentLoaded(function() { | ||
KTDatatablesClassic.init(); | ||
}); |
43 changes: 43 additions & 0 deletions
43
public/assets/js/custom/account/referrals/referral-program.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use strict"; | ||
|
||
// Class definition | ||
var KTAccountReferralsReferralProgram = function () { | ||
// Private functions | ||
|
||
var initReferralProgrammClipboard = function() { | ||
var button = document.querySelector('#kt_referral_program_link_copy_btn'); | ||
var input = document.querySelector('#kt_referral_link_input'); | ||
var clipboard = new ClipboardJS(button); | ||
|
||
clipboard.on('success', function(e) { | ||
var buttonCaption = button.innerHTML; | ||
//Add bgcolor | ||
input.classList.add('bg-success'); | ||
input.classList.add('text-inverse-success'); | ||
|
||
button.innerHTML = 'Copied!'; | ||
|
||
setTimeout(function() { | ||
button.innerHTML = buttonCaption; | ||
|
||
// Remove bgcolor | ||
input.classList.remove('bg-success'); | ||
input.classList.remove('text-inverse-success'); | ||
}, 3000); // 3seconds | ||
|
||
e.clearSelection(); | ||
}); | ||
} | ||
|
||
// Public methods | ||
return { | ||
init: function () { | ||
initReferralProgrammClipboard(); | ||
} | ||
} | ||
}(); | ||
|
||
// On document ready | ||
KTUtil.onDOMContentLoaded(function() { | ||
KTAccountReferralsReferralProgram.init(); | ||
}); |
Oops, something went wrong.