-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Philipp Kraft
committed
Jan 24, 2025
1 parent
646a186
commit 5ad1bb2
Showing
8 changed files
with
352 additions
and
260 deletions.
There are no files selected for viewing
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
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,90 @@ | ||
<!DOCTYPE html> | ||
|
||
<py:extends href="layout.html" xmlns:py=""> | ||
<py:block name="scripts"> | ||
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/index.global.min.js'></script> | ||
<script> | ||
let calendar; | ||
document.addEventListener('DOMContentLoaded', function() { | ||
let filter = JSON.parse(sessionStorage.getItem('job-filter')) | ||
if (filter) { | ||
$('#filter-persons').val(filter.persons) | ||
$('#filter-types').val(filter.types) | ||
$('#filter-active').prop('checked', filter.onlyactive) | ||
} else { | ||
$('#filter-persons').val(`${user()}`) | ||
$('#filter-active').prop('checked', true) | ||
} | ||
var calendarEl = document.getElementById('calendar'); | ||
calendar = new FullCalendar.Calendar(calendarEl, { | ||
initialView: 'listYear', | ||
headerToolbar: { center: 'dayGridMonth,multiMonthYear,listYear' }, | ||
events: { | ||
url: "${conf.url('job','json')}", | ||
extraParams: function() { | ||
return { | ||
persons: $('#filter-persons').val(), | ||
types: $('#filter-types').val(), | ||
onlyactive: $('#filter-active').is(':checked') | ||
} | ||
} | ||
} | ||
}); | ||
calendar.render(); | ||
$('.filter').on('change', event => { | ||
sessionStorage.setItem('job-filter', JSON.stringify( | ||
{ | ||
persons: $('#filter-persons').val(), | ||
types: $('#filter-types').val(), | ||
onlyactive: $('#filter-active').is(':checked') | ||
} | ||
)) | ||
calendar.refetchEvents() | ||
}) | ||
}); | ||
</script> | ||
</py:block> | ||
<py:block name="style"> | ||
<!-- insert additional styles --> | ||
</py:block> | ||
<py:block name="sidebar"> | ||
<!-- insert sidebar content --> | ||
<div class="container-fluid" > | ||
<a class="btn btn-primary w-100 mb-4" href="new"> | ||
<i class="fas fa-plus-circle mr-3" /> | ||
new job | ||
</a> | ||
</div> | ||
<div class="card m-2"> | ||
<div class="card-header"> | ||
<i class="fas fa-filter"></i> filter | ||
</div> | ||
<div class="card-body"> | ||
<div class="custom-control custom-switch"> | ||
<input type="checkbox" class="custom-control-input filter" id="filter-active"/> | ||
<label class="custom-control-label" for="filter-active">show only active elements</label> | ||
</div> | ||
<div class="form-group"> | ||
<label for="filter-types">types</label> | ||
<select class="select2 form-control filter" id="filter-types" multiple="multiple" name="type[]"> | ||
<option py:for="t, in jobtypes" value="${t}">${t}</option> | ||
</select> | ||
</div> | ||
<div class="form-group"> | ||
<label for="filter-persons">persons</label> | ||
<select class="select2 form-control filter" id="filter-persons" multiple="multiple" name="person[]"> | ||
<option py:for="p in persons" value="${p.username}">${p}</option> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</py:block> | ||
<py:block name="content"> | ||
<!-- insert main content --> | ||
<div class="container"> | ||
<div id="calendar" class="w100 h100"></div> | ||
</div> | ||
|
||
</py:block> | ||
</py:extends> |
Oops, something went wrong.