Merge branch 'changehourevent' into timetracking

This commit is contained in:
2020-07-30 13:57:18 +02:00
3 changed files with 179 additions and 16 deletions

View File

@@ -109,6 +109,12 @@
<label class="custom-control-label" for="astreinte">Astreinte</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="externaltrip">
<label class="custom-control-label" for="externaltrip">Déplacement externe</label>
</div>
</div>
<div class="form-group">
<label for="description" class="control-label">
@@ -157,7 +163,6 @@
{% endif %}
</select>
</div>
<div class="form-group">
<label class="control-label required" for="taskupdate">
Project<span class="mandatory">*</span>
@@ -169,7 +174,25 @@
{% endfor %}
</select>
</div>
<div class="form-group">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="amupdate">
<label class="custom-control-label" for="amupdate">Evènement sur la matinée</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="apupdate">
<label class="custom-control-label" for="apupdate">Evènement sur l'après-midi</label>
</div>
</div>
<div class="form-group">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="externaltripupdate">
<label class="custom-control-label" for="externaltripupdate">Déplacement externe</label>
</div>
</div>
<div class="form-group">
<label for="description" class="control-label">
Description
@@ -230,14 +253,19 @@ function eventRender(info) {
var eventInfo=$(content).children('.eventUser');
// Ajout container
content.append("<span class='eventInfo float-right'></span>");
content.append("<span style='margin-top:-12px' class='eventInfo float-right'></span>");
var eventInfo=$(content).children('.eventInfo');
// Ajouter le verrou si event non editable
if(info.event.extendedProps.locked) {
eventInfo.append("<i class='fa fa-lock float-right'></i>");
}
if(info.event.extendedProps.externaltrip) {
eventInfo.append("<i class='fas fa-bed float-right'></i>");
}
if(info.event.extendedProps.holiday) {
eventInfo.append("<i class='fas fa-umbrella-beach float-right'></i>");
}
// Ajout estimation
eventInfo.append("<span class='eventEstimate float-right small'>"+info.event.extendedProps.estimate+"</span>");
@@ -245,7 +273,7 @@ function eventRender(info) {
content.attr("title",info.event.extendedProps.fulldescription);
}
// Formulaire Création d'un évelement
// Formulaire Création d'un événement
var allDay;
function eventSelect(selectionInfo) {
var start=moment(selectionInfo.start);
@@ -291,32 +319,73 @@ function eventSelect(selectionInfo) {
$('#modalsubmit #end').val(end.format("YYYY-MM-DD"));
$('#modalsubmit #description').val("");
$('#modalsubmit #externaltrip').prop("checked",false);
$("#modalsubmit .alert").remove();
// Formulaire de création d'un évènement
$('#modalsubmit').modal();
}
// Formulaire Modification d'un évelement
// Formulaire Modification d'un événement
function eventClick(info) {
if(info.event.extendedProps.editable) {
console.log(info.event.id);
console.log(info.event);
var id=info.event.id;
var description=info.event.extendedProps.description;
var userid=info.event.extendedProps.userid;
var taskid=info.event.extendedProps.taskid;
var fgastreinte=info.event.extendedProps.astreinte;
var eventallday = info.event.allDay;
var eventstart = info.event.start;
var eventend = info.event.end;
var externaltrip = info.event.extendedProps.externaltrip;
var holiday = info.event.extendedProps.holiday;
$('#userupdate').val(userid).trigger("change");
$('#taskupdate').val(taskid).trigger("change");
$('#modalupdate #idevent').val(id);
$('#modalupdate #fgastreinte').val(fgastreinte);
$('#modalupdate #description').val(description);
if (holiday) {
$('#modalupdate #externaltripupdate').prop("checked",false);
$('#modalupdate #externaltripupdate').prop("disabled",true);
}else{
$('#modalupdate #externaltripupdate').prop("disabled",false);
$('#modalupdate #externaltripupdate').prop("checked",externaltrip);
}
$("#modalupdate .alert").remove();
eDayStart=eventstart.toString().split(" ")[2]
eDayEnd=eventend.toString().split(" ")[2]
if ((eDayEnd - eDayStart) >1) {
$('#modalupdate #amupdate').prop("checked",true);
$('#modalupdate #apupdate').prop("checked",true);
$('#modalupdate #amupdate').prop("disabled",true);
$('#modalupdate #apupdate').prop("disabled",true);
}else{
$('#modalupdate #amupdate').prop("disabled",false);
$('#modalupdate #apupdate').prop("disabled",false);
if (!eventallday){
eStart = eventstart.toString().split(" ")[4].split(":")[0]
//eEnd = eventend.toString().split(" ")[4].split(":")[0]
//AM
if (eStart == 09){
$('#modalupdate #amupdate').prop("checked",true);
$('#modalupdate #apupdate').prop("checked",false);
}
//AP
if (eStart == 13){
$('#modalupdate #amupdate').prop("checked",false);
$('#modalupdate #apupdate').prop("checked",true);
}
}else{
$('#modalupdate #amupdate').prop("checked",true);
$('#modalupdate #apupdate').prop("checked",true);
}
}
// Formulaire de création d'un évènement
$('#modalupdate').modal();
}
@@ -350,6 +419,7 @@ function eventSubmit() {
am: $("#modalsubmit #amsubmit").prop("checked"),
ap: $("#modalsubmit #apsubmit").prop("checked"),
astreinte: $("#modalsubmit #astreinte").prop("checked"),
externaltrip: $("#modalsubmit #externaltrip").prop("checked"),
description: $("#modalsubmit #description").val()
},
url: "{{ path('app_event_submit') }}",
@@ -378,7 +448,10 @@ function eventUpdate() {
idevent: $("#modalupdate #idevent").val(),
iduser: $("#userupdate").val(),
idtask: $("#taskupdate").val(),
am: $("#modalupdate #amupdate").prop("checked"),
ap: $("#modalupdate #apupdate").prop("checked"),
fgastreinte: $("#modalupdate #fgastreinte").val(),
externaltrip: $("#modalupdate #externaltripupdate").prop("checked"),
description: $("#modalupdate #description").val()
},
url: "{{ path('app_event_update') }}",
@@ -426,7 +499,6 @@ function eventDelete() {
// On change astreinte
$("#astreinte").change(function() {
console.log(allDay)
if(this.checked) {
$("#amsubmit").prop("disabled",true);
$("#apsubmit").prop("disabled",true);