initial upload
This commit is contained in:
471
aem_gestion/templates/planning/planningb.pt
Normal file
471
aem_gestion/templates/planning/planningb.pt
Normal file
@@ -0,0 +1,471 @@
|
||||
<metal:block use-macro="main_template">
|
||||
<div metal:fill-slot="content">
|
||||
|
||||
<div class="container">
|
||||
<div class="alert alert-warning" tal:condition="message" tal:content="message"></div>
|
||||
<div id="flash" tal:condition="request.session.get('_f_error')" >
|
||||
<tal:block tal:repeat="m request.session.get('_f_error')">
|
||||
<div class="alert alert-warning">${m}</div>
|
||||
</tal:block>
|
||||
<span class="hide">${request.session.popitem()}</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div id="exams_agence-form" >
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-1">Agence</label>
|
||||
<div class="col-xs-11">
|
||||
<a class="btn btn-default" href="${url}?agence=1" >VALMY</a>
|
||||
<a class="btn btn-default" href="${url}?agence=2" >SAXE</a>
|
||||
<a class="btn btn-default" href="${url}?agence=3" >CROIX ROUSSE</a>
|
||||
<a class="btn btn-default" href="${url}?agence=4" >MONPLAISIR</a>
|
||||
<a class="btn btn-default" href="${url}?agence=5" >CHARPENNES</a>
|
||||
<a class="btn btn-default" href="${url}?agence=6" >VAUGNERAY</a>
|
||||
<a class="btn btn-default" href="${url}?agence=7" >GENTIL</a>
|
||||
<a class="btn btn-default" href="${url}?agence=8" >VITTON</a>
|
||||
<a class="btn btn-default" href="${url}?agence=9" >WEB</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<form method="POST" id="change-permis" action="${current_url}" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-1">Type de permis</label>
|
||||
<div class="col-xs-5">
|
||||
<select class="form-control" name="current_planning" onChange="$('#change-permis').submit()">
|
||||
<option value="ALL" tal:attributes="selected current_planning=='ALL' and 'selected' or None">----</option>
|
||||
<tal:block tal:repeat="item type_plannings">
|
||||
<option value="${item}" tal:attributes="selected current_planning==item and 'selected' or None">${item}</option>
|
||||
</tal:block>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="row ml-2">
|
||||
<div class="col-xs-5">
|
||||
<button class="btn btn-primary" type="button" tal:condition="code >= 4 " data-toggle="modal" data-target="#validatePlanning"><span class="glyphicon glyphicon-check"></span> Validation Planning B</button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<style>
|
||||
.fc-bgevent {
|
||||
opacity: 0.8 !important;
|
||||
border: 1px dotted #acacac;
|
||||
}
|
||||
</style>
|
||||
<div id="calendar"></div>
|
||||
<br />
|
||||
<p>
|
||||
|
||||
<span class="label" style="background-color:#b57f3e; color:black;">Type de Permis B</span>
|
||||
<span class="label" style="background-color:#c2ac91; color:black;">Type de Permis B78</span>
|
||||
<span class="label" style="background-color:#79b0a0; color:black;">Type de Permis 2R</span>
|
||||
<span class="label" style="background-color:#a08da6; color:black;">Type de Permis GL</span>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<span class="label" style="background-color:LightGreen; color:black;">Validée</span>
|
||||
<span class="label" style="background-color:LightBlue; color:black;">Activitée</span>
|
||||
<span class="label" style="background-color:LightPink; color:black;">Réservation</span>
|
||||
<span class="label" style="background-color:LightYellow; color:black;">Heure Conduite B</span>
|
||||
<span class="label" style="background-color:Gold; color:black;">Examen blanc</span>
|
||||
<span class="label" style="background-color:GoldenRod; color:black;">Avant permis</span>
|
||||
<span class="label" style="background-color:Plum; color:black;">RDV préalable</span>
|
||||
<span class="label" style="background-color:YellowGreen; color:black;">RDV pédag 1</span>
|
||||
<span class="label" style="background-color:LimeGreen; color:black;">RDV pédag 2</span>
|
||||
<span class="label" style="background-color:DeepSkyBlue; color:black;">1ères heures</span>
|
||||
<span class="label" style="background-color:DeepPink; color:black;">Absent Retard</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Modal : Confirmation CREATION -->
|
||||
<div class="modal fade" id="confirmCreate" role="dialog" aria-labelledby="confirmCreateLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Créer un rendez-vous</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- The form is placed inside the body of modal -->
|
||||
<form id="create_rdv-form" class="form-horizontal" action="${url}" method="post"
|
||||
data-fv-framework="bootstrap"
|
||||
data-fv-icon-valid="glyphicon glyphicon-ok"
|
||||
data-fv-icon-invalid="glyphicon glyphicon-remove"
|
||||
data-fv-icon-validating="glyphicon glyphicon-refresh">
|
||||
<p>
|
||||
Voulez-vous créer un rendez-vous pour : <br />
|
||||
</p>
|
||||
<div class="col-xs-offset-3 col-xs-9">
|
||||
<p><b>le <span id=dateheureRDV>date</span> h</b></p>
|
||||
<p>pour un élève ou une activité</p>
|
||||
</div>
|
||||
<div class="form-group" id="form-code">
|
||||
<label class="col-xs-3 control-label">Nom ou Code</label>
|
||||
<div class="col-xs-8">
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="3 caractères minimum" />
|
||||
<span id="text-error-message" style="font-size:11px;color:#D9534F;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="dateRDV" id=dateRDV value="date">
|
||||
<input type="hidden" name="heureRDV" id=heureRDV value="heure">
|
||||
<input type="hidden" name="agence" id="agence" value="${agence}">
|
||||
<input type="hidden" name="cd_mon" id="cd_mon" value="">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-3">Nb d'heures</label>
|
||||
<div class="col-xs-6">
|
||||
<select class="form-control static" name="QTE">
|
||||
<tal:block tal:repeat="i [x for x in range(1,12)]">
|
||||
<option tal:attributes="selected str(i)==QTE and 'selected' or None">${i}</option>
|
||||
</tal:block>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-5 col-xs-offset-3">
|
||||
<button type="submit" id="submitRdv" class="btn btn-danger" name="form.submitted">Créer</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal : Confirmation CREATION -->
|
||||
<div class="modal fade" id="confirmCreateB78" role="dialog" aria-labelledby="confirmCreateLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Créer un rendez-vous</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- The form is placed inside the body of modal -->
|
||||
<form id="create_rdv-form78" class="form-horizontal" action="${url}" method="post"
|
||||
data-fv-framework="bootstrap"
|
||||
data-fv-icon-valid="glyphicon glyphicon-ok"
|
||||
data-fv-icon-invalid="glyphicon glyphicon-remove"
|
||||
data-fv-icon-validating="glyphicon glyphicon-refresh">
|
||||
<p>
|
||||
Voulez-vous créer un rendez-vous pour : <br />
|
||||
</p>
|
||||
<div class="col-xs-offset-3 col-xs-9">
|
||||
<p><b>le <span id='dateheureRDVB78'>date</span> h</b></p>
|
||||
<p>pour un élève ou une activité</p>
|
||||
</div>
|
||||
<div class="form-group" id="form-codeB78">
|
||||
<label class="col-xs-3 control-label">Nom ou Code</label>
|
||||
<div class="col-xs-8">
|
||||
<input type="text" class="form-control" id="nameB78" name="name" placeholder="3 caractères minimum" />
|
||||
<span id="text-error-message" style="font-size:11px;color:#D9534F;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="dateRDV" id="dateRDVB78" value="date">
|
||||
<input type="hidden" name="heureRDV" id="heureRDVB78" value="heure">
|
||||
<input type="hidden" name="agence" id="agenceB78" value="${agence}">
|
||||
<input type="hidden" name="cd_mon_B78" id="cd_mon_B78" value="">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-3">Nb d'heures</label>
|
||||
<div class="col-xs-6">
|
||||
<select class="form-control static" name="QTE">
|
||||
<tal:block tal:repeat="i [x for x in range(1,12)]">
|
||||
<option tal:attributes="selected str(i)==QTE and 'selected' or None">${i}</option>
|
||||
</tal:block>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-5 col-xs-offset-3">
|
||||
<button type="submit" id="submitRdvB78" class="btn btn-danger" name="form.submitted">Créer</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal : validation PLANNING -->
|
||||
<div class="modal fade" id="validatePlanning" role="dialog" aria-labelledby="confirmCreateLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Validation planning B</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- The form is placed inside the body of modal -->
|
||||
<form id="validate-planning" class="form-horizontal" action="${url}" method="post"
|
||||
data-fv-framework="bootstrap"
|
||||
data-fv-icon-valid="glyphicon glyphicon-ok"
|
||||
data-fv-icon-invalid="glyphicon glyphicon-remove"
|
||||
data-fv-icon-validating="glyphicon glyphicon-refresh">
|
||||
<p>
|
||||
Après la validation, aucune modification ne sera possible. Etes-vous sûr de vouloir valider cette journée ?
|
||||
</p>
|
||||
<div class="form-group" id="form-codeB78">
|
||||
<label class="col-xs-3 control-label">Date</label>
|
||||
<div class="col-xs-8">
|
||||
<input type="text" class="form-control" id="validate_date" name="date" value="${current_date.strftime('%d/%m/%Y')}" placeholder="DD/MM/YYYY" />
|
||||
<span id="text-error-message" style="font-size:11px;color:#D9534F;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-3">Agence</label>
|
||||
<div class="col-xs-6">
|
||||
<select class="form-control static" name="agence" tal:attributes="value code != 9 and myagence or agence" tabindex="-1" tal:attributes="disabled code != 9 and 'disabled' or None" tabindex="-1">
|
||||
<tal:block tal:repeat="i [x for x in range(1,10)]" >
|
||||
<option tal:attributes="selected ((code == 9 and i==agence) or (code != 9 and i==myagence )) and 'selected' or None" value="${i}" >${i}</option>
|
||||
</tal:block>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-xs-5 col-xs-offset-3">
|
||||
<button type="submit" class="btn btn-danger" name="form.validated">Valider</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
</div><!-- content -->
|
||||
<div metal:fill-slot="additional_scripts">
|
||||
<!-- Bootstrap Fullcalendar plugin -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar-scheduler/1.9.4/scheduler.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/locale/fr.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#calendar').fullCalendar({
|
||||
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
|
||||
locale: 'fr',
|
||||
defaultView: 'timelineDay',
|
||||
defaultDate:'${current_date.strftime('%Y-%m-%d')}',
|
||||
selectable: false,
|
||||
contentHeight: "auto",
|
||||
minTime: "07:00:00",
|
||||
maxTime: "21:00:00",
|
||||
header: {
|
||||
left: '',
|
||||
center: 'prev title next',
|
||||
right: 'timelineDay'
|
||||
},
|
||||
resourceAreaWidth: '20%',
|
||||
resourceLabelText: 'Moniteurs',
|
||||
resources: ${calendar_ressources},
|
||||
selectOverlap: function(event) {
|
||||
return event.rendering === 'background';
|
||||
},
|
||||
resourceRender: function(resourceObj, labelTds, bodyTds) {
|
||||
//console.log( bodyTds);
|
||||
if(resourceObj.planning == "2R"){
|
||||
labelTds.css('background', '#79b0a0');
|
||||
}
|
||||
else if(resourceObj.planning == "GL"){
|
||||
labelTds.css('background', '#a08da6');
|
||||
}
|
||||
else if(resourceObj.planning == "B"){
|
||||
labelTds.css('background', '#b57f3e');
|
||||
}
|
||||
else if(resourceObj.planning == "B78"){
|
||||
labelTds.css('background', '#c2ac91');
|
||||
}
|
||||
else{
|
||||
labelTds.css('color', 'black');
|
||||
}
|
||||
|
||||
},
|
||||
events: function(start,end,timezone,callback){
|
||||
var data = ${calendar_events};
|
||||
var fomatedData = [];
|
||||
data.forEach(function(e){
|
||||
if(e.url){
|
||||
var url = e.url.replaceAll('amp;','');
|
||||
e.url = url;
|
||||
fomatedData.push(e)
|
||||
}
|
||||
});
|
||||
callback(data)
|
||||
},
|
||||
dayClick: function(date, jsEvent, view,resource) {
|
||||
if (jsEvent.target.classList.contains('fc-bgevent')) {
|
||||
console.log(date)
|
||||
if(resource.planning === "B78"){
|
||||
$('#dateheureRDVB78').html(moment(date).format('dddd DD MMMM à HH'));
|
||||
$('#dateRDVB78').attr('value', moment(date).format('YYYY-MM-DD'));
|
||||
$('#heureRDVB78').attr('value', moment(date).format('HH'));
|
||||
$('#cd_mon_B78').val(resource.id);
|
||||
$("#confirmCreateB78").modal("show");
|
||||
}
|
||||
else{
|
||||
$('#dateheureRDV').html(moment(date).format('dddd DD MMMM à HH'));
|
||||
$('#dateRDV').attr('value', moment(date).format('YYYY-MM-DD'));
|
||||
$('#heureRDV').attr('value', moment(date).format('HH'));
|
||||
$('#cd_mon').val(resource.id);
|
||||
$("#confirmCreate").modal("show");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
eventClick: function(infso) {
|
||||
console.log(infso)
|
||||
},
|
||||
dayRender: function(date,cell, data) {
|
||||
cell.css("background-color", "#edeff0");
|
||||
cell.css("disabled", 'disabled')
|
||||
cell.Enabled = false;
|
||||
},
|
||||
viewRender: function(view, element) {
|
||||
var start = view.activeStart;
|
||||
var end = view.activeEnd;
|
||||
const paramsString = window.location.search;
|
||||
const searchParams = new URLSearchParams(paramsString);
|
||||
var current_day = moment('${current_date.strftime('%Y-%m-%d')}');
|
||||
var diff = view.start.diff(current_day,'days', false);
|
||||
$('#validate_date').val(view.start.format('DD/MM/YYYY'));
|
||||
if(diff <= -6){
|
||||
disableNavButton();
|
||||
searchParams.set('next', view.start.format('YYYY-MM-DD'));
|
||||
// searchParams.set('next', view.start.subtract(30, "days").format('YYYY-MM-DD'));
|
||||
window.location.replace(window.location.href.replace(location.search, '')+'?'+searchParams.toString())
|
||||
}
|
||||
else if(diff >= 30) {
|
||||
disableNavButton();
|
||||
searchParams.set('next', view.start.format('YYYY-MM-DD'));
|
||||
window.location.replace(window.location.href.replace(location.search, '')+'?'+searchParams.toString())
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
$('#create_rdv-form').formValidation({
|
||||
framework: 'bootstrap',
|
||||
excluded: ':disabled',
|
||||
icon: {
|
||||
valid: 'glyphicon glyphicon-ok',
|
||||
invalid: 'glyphicon glyphicon-remove',
|
||||
validating: 'glyphicon glyphicon-refresh'
|
||||
},
|
||||
});
|
||||
$('#name').autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
url:'/ajax_lookup',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
recherche: 'E' + request.term,
|
||||
},
|
||||
success: function (data) {
|
||||
response( data );
|
||||
},
|
||||
});
|
||||
},
|
||||
minLength: 3,
|
||||
appendTo: "#confirmCreate"
|
||||
});
|
||||
$('#create_rdv-form').submit(function(ev){
|
||||
var actionurl = ev.currentTarget.action;
|
||||
var array_code = $('#name').val().split(' | ');
|
||||
var reg = new RegExp('^[A-Z0-9]+-[A-Z0-9]+|[0-9]{6}$');
|
||||
var condition1 = array_code.length == 2 && array_code[0].length >= 3 && array_code[1].length == 6 ;
|
||||
var condition2 = reg.test( $('#name').val().trim())
|
||||
if(condition1 && condition2){
|
||||
$('#text-error-message').text('');
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$('#form-code').addClass('has-feedback has-error');
|
||||
$('#submitRdv').addClass('disabled').attr("disabled", true);
|
||||
$('#text-error-message').text('Code non validé');
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('#name').on('change input',function(){
|
||||
console.log('here');
|
||||
$('#text-error-message').text('');
|
||||
$('#form-code').removeClass('has-feedback has-error');
|
||||
$('#submitRdv').removeClass('disabled').attr("disabled", false);
|
||||
|
||||
});
|
||||
|
||||
$('#create_rdv-formB78').formValidation({
|
||||
framework: 'bootstrap',
|
||||
excluded: ':disabled',
|
||||
icon: {
|
||||
valid: 'glyphicon glyphicon-ok',
|
||||
invalid: 'glyphicon glyphicon-remove',
|
||||
validating: 'glyphicon glyphicon-refresh'
|
||||
},
|
||||
});
|
||||
|
||||
$('#nameB78').autocomplete({
|
||||
source: function (request, response) {
|
||||
$.ajax({
|
||||
url:'/ajax_lookupb78',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
recherche: 'E' + request.term,
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data)
|
||||
response( data );
|
||||
},
|
||||
});
|
||||
},
|
||||
minLength: 3,
|
||||
appendTo: "#confirmCreateB78"
|
||||
});
|
||||
|
||||
$('#create_rdv-formB78').submit(function(ev){
|
||||
var actionurl = ev.currentTarget.action;
|
||||
var array_code = $('#name78').val().split(' | ');
|
||||
var reg = new RegExp('^[A-Z0-9]+-[A-Z0-9]+|[0-9]{6}$');
|
||||
var condition1 = array_code.length == 2 && array_code[0].length >= 3 && array_code[1].length == 6 ;
|
||||
var condition2 = reg.test( $('#name78').val().trim())
|
||||
if(condition1 && condition2){
|
||||
$('#text-error-message').text('');
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$('#form-codeB78').addClass('has-feedback has-error');
|
||||
$('#submitRdvB78').addClass('disabled').attr("disabled", true);
|
||||
$('#text-error-message').text('Code non validé');
|
||||
ev.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#nameB78').on('change input',function(){
|
||||
$('#text-error-message').text('');
|
||||
$('#form-codeB78').removeClass('has-feedback has-error');
|
||||
$('#submitRdvB78').removeClass('disabled').prop("disabled", false);;
|
||||
});
|
||||
|
||||
function disableNavButton(){
|
||||
$(".fc-prev-button").prop('disabled', true);
|
||||
$(".fc-prev-button").addClass('fc-state-disabled');
|
||||
$(".fc-next-button").prop('disabled', true);
|
||||
$(".fc-next-button").addClass('fc-state-disabled');
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</metal:block>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user