Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarzin committed Jan 10, 2025
1 parent 68b6d22 commit d1b4796
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions public/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
$(document).ready(function () {
window._token = $('meta[name="csrf-token"]').attr('content')

moment.updateLocale('en', {
week: {dow: 1} // Monday is the first day of the week
})

$('.date').datetimepicker({
format: 'DD/MM/YYYY',
locale: 'en',
icons: {
up: 'fas fa-chevron-up',
down: 'fas fa-chevron-down',
previous: 'fas fa-chevron-left',
next: 'fas fa-chevron-right'
}
})

$('.datetime').datetimepicker({
format: 'DD/MM/YYYY HH:mm:ss',
locale: 'en',
sideBySide: true,
icons: {
up: 'fas fa-chevron-up',
down: 'fas fa-chevron-down',
previous: 'fas fa-chevron-left',
next: 'fas fa-chevron-right'
}
})

$('.timepicker').datetimepicker({
format: 'HH:mm:ss',
icons: {
up: 'fas fa-chevron-up',
down: 'fas fa-chevron-down',
previous: 'fas fa-chevron-left',
next: 'fas fa-chevron-right'
}
})

$('.select-all').click(function () {
let $select2 = $(this).parent().siblings('.select2')
$select2.find('option').prop('selected', 'selected')
$select2.trigger('change')
})
$('.deselect-all').click(function () {
let $select2 = $(this).parent().siblings('.select2')
$select2.find('option').prop('selected', '')
$select2.trigger('change')
})

$('.select2').select2()

$('.treeview').each(function () {
var shouldExpand = false
$(this).find('li').each(function () {
if ($(this).hasClass('active')) {
shouldExpand = true
}
})
if (shouldExpand) {
$(this).addClass('active')
}
})

$('button.sidebar-toggler').click(function () {
setTimeout(function() {
$($.fn.dataTable.tables(true)).DataTable().columns.adjust();
}, 275);
})

/**
* Accordion JS toggle
*/
$('.accordion').click(function () {
$(this).toggleClass('active');
$(this).next('.panel').toggleClass('active');
})

$('.check-all-wrapper input').click(function (e) {
console.log("check-all-wrapper");
e.preventDefault();
$('input[data-check='+$(this).prop('id')+']:not(:checked)').each(function (){
$(this).prop('checked', true);
});
});
})

0 comments on commit d1b4796

Please sign in to comment.