prevent event display twice on addevent fix #67
This commit is contained in:
@@ -18,7 +18,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
locale: frLocale,
|
||||
weekNumbers: true,
|
||||
selectable: true,
|
||||
events: 'event/load/'+iduser,
|
||||
eventSources: [{
|
||||
'id': 1,
|
||||
'url': 'event/load/'+iduser,
|
||||
}],
|
||||
eventLimit:8,
|
||||
eventDrop: function(info) {
|
||||
info.revert();
|
||||
|
@@ -18,10 +18,10 @@
|
||||
.fc-content {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
|
||||
.fc-title {
|
||||
font-weight: bolder;
|
||||
font-size: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.eventAvatar {
|
||||
@@ -30,7 +30,7 @@
|
||||
float: left;
|
||||
}
|
||||
|
||||
.eventInfo{
|
||||
.eventInfo{
|
||||
margin: -5px 5px 0px 0px;
|
||||
clear: both;
|
||||
}
|
||||
@@ -39,7 +39,7 @@
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.eventEstimate {
|
||||
.eventEstimate {
|
||||
margin: -3px 10px;
|
||||
}
|
||||
.select2-results__group {
|
||||
@@ -76,7 +76,7 @@
|
||||
</label>
|
||||
<select class="select2entity" id="usersubmit" name="usersubmit">
|
||||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') or is_granted('ROLE_VALIDATOR')%}
|
||||
|
||||
|
||||
{% for user in app.session.get('users') %}
|
||||
{% set selected="" %}
|
||||
{%if user.id==app.session.get('iduser') %}
|
||||
@@ -105,7 +105,7 @@
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -114,27 +114,27 @@
|
||||
<input type="checkbox" class="custom-control-input" id="amsubmit">
|
||||
<label class="custom-control-label" for="amsubmit">Evènement sur la matinée</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="apsubmit">
|
||||
<label class="custom-control-label" for="apsubmit">Evènement sur l'après-midi</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="astreinte">
|
||||
<label class="custom-control-label" for="astreinte">Astreinte</label>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description" class="control-label">
|
||||
@@ -147,7 +147,7 @@
|
||||
|
||||
<input type="hidden" id="start" name="start" class="form-control" value="">
|
||||
<input type="hidden" id="end" name="end" class="form-control" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -162,7 +162,7 @@
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal-body">
|
||||
<button onClick="eventUpdate()" class="btn btn-success">Valider</button>
|
||||
<button onClick="" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
||||
@@ -174,7 +174,7 @@
|
||||
Intervenant<span class="mandatory">*</span>
|
||||
</label>
|
||||
<select class="select2entity" id="userupdate" name="userupdate">
|
||||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') or is_granted('ROLE_VALIDATOR')%}
|
||||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') or is_granted('ROLE_VALIDATOR')%}
|
||||
{% for user in users %}
|
||||
<option value="{{user.id}}">{{user.displayname}}</option>
|
||||
{% endfor %}
|
||||
@@ -203,7 +203,7 @@
|
||||
<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>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
@@ -216,7 +216,7 @@
|
||||
<input type="checkbox" class="custom-control-input" id="externaltripupdate">
|
||||
<label class="custom-control-label" for="externaltripupdate">Déplacement externe</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="description" class="control-label">
|
||||
Description
|
||||
@@ -227,7 +227,7 @@
|
||||
|
||||
<input type="hidden" id="idevent" name="idevent" class="form-control" value="">
|
||||
<input type="hidden" id="fgastreinte" name="fgastreinte" class="form-control" value="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -243,25 +243,25 @@ $(document).ready(function() {
|
||||
$("#modalsubmit #user").select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr"
|
||||
});
|
||||
});
|
||||
|
||||
$("#modalsubmit #task").select2({
|
||||
placeholder: "Selectionnez un projet",
|
||||
allowClear: true,
|
||||
theme: 'bootstrap4',
|
||||
language: "fr"
|
||||
});
|
||||
});
|
||||
|
||||
$("#modalupdate #user").select2({
|
||||
theme: 'bootstrap4',
|
||||
language: "fr"
|
||||
});
|
||||
});
|
||||
|
||||
$("#modalupdate #task").select2({
|
||||
placeholder: "Selectionnez un projet",
|
||||
theme: 'bootstrap4',
|
||||
language: "fr"
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Rendu d'un évenement
|
||||
@@ -276,7 +276,7 @@ function eventRender(info) {
|
||||
content.append("<span class='eventUser float-left small'>"+info.event.extendedProps.username+"</span>");
|
||||
var eventInfo=$(content).children('.eventUser');
|
||||
|
||||
// Ajout container
|
||||
// Ajout container
|
||||
content.append("<span style='margin-top:-12px' class='eventInfo float-right'></span>");
|
||||
var eventInfo=$(content).children('.eventInfo');
|
||||
|
||||
@@ -317,7 +317,7 @@ function eventSelect(selectionInfo) {
|
||||
}
|
||||
|
||||
// Valeur par défaut
|
||||
{% if (is_granted('ROLE_ADMIN') or is_granted('ROLE_VALIDATOR') or is_granted('ROLE_MASTER')) and app.session.get('iduser')!="all" %}
|
||||
{% if (is_granted('ROLE_ADMIN') or is_granted('ROLE_VALIDATOR') or is_granted('ROLE_MASTER')) and app.session.get('iduser')!="all" %}
|
||||
$('#usersubmit').val({{app.session.get('iduser')}}).trigger("change");
|
||||
{% else %}
|
||||
$('#usersubmit').val({{app.user.id}}).trigger("change");
|
||||
@@ -341,7 +341,7 @@ function eventSelect(selectionInfo) {
|
||||
|
||||
$('#modalsubmit #start').val(start.format("YYYY-MM-DD"));
|
||||
$('#modalsubmit #end').val(end.format("YYYY-MM-DD"));
|
||||
|
||||
|
||||
$('#modalsubmit #description').val("");
|
||||
$('#modalsubmit #externaltrip').prop("checked",false);
|
||||
|
||||
@@ -369,7 +369,7 @@ function eventClick(info) {
|
||||
$('#userupdate').val(userid).trigger("change");
|
||||
$('#taskupdate').val(taskid).trigger("change");
|
||||
$('#modalupdate #idevent').val(id);
|
||||
|
||||
|
||||
$('#modalupdate #fgastreinte').val(fgastreinte);
|
||||
$('#modalupdate #description').val(description);
|
||||
if (holiday) {
|
||||
@@ -409,7 +409,7 @@ function eventClick(info) {
|
||||
$('#modalupdate #apupdate').prop("checked",true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Formulaire de création d'un évènement
|
||||
$('#modalupdate').modal();
|
||||
}
|
||||
@@ -433,7 +433,7 @@ function eventSubmit() {
|
||||
}
|
||||
|
||||
if(!error) {
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
iduser: $("#usersubmit").val(),
|
||||
@@ -444,7 +444,7 @@ function eventSubmit() {
|
||||
ap: $("#modalsubmit #apsubmit").prop("checked"),
|
||||
astreinte: $("#modalsubmit #astreinte").prop("checked"),
|
||||
externaltrip: $("#modalsubmit #externaltrip").prop("checked"),
|
||||
description: $("#modalsubmit #description").val()
|
||||
description: $("#modalsubmit #description").val()
|
||||
},
|
||||
url: "{{ path('app_event_submit') }}",
|
||||
success: function (response) {
|
||||
@@ -453,7 +453,7 @@ function eventSubmit() {
|
||||
$("#modalsubmit .modal-body").append("<div class='alert alert-danger' style='margin: 5px 0px'>"+response.error+"</div>");
|
||||
}
|
||||
else {
|
||||
calendar.addEvent(response);
|
||||
calendar.addEvent(response,1);
|
||||
calendar.render;
|
||||
$('#modalsubmit').modal('hide');
|
||||
}
|
||||
@@ -466,7 +466,7 @@ function eventSubmit() {
|
||||
function eventUpdate() {
|
||||
$("#modalupdate .alert").remove();
|
||||
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
idevent: $("#modalupdate #idevent").val(),
|
||||
@@ -476,7 +476,7 @@ function eventUpdate() {
|
||||
ap: $("#modalupdate #apupdate").prop("checked"),
|
||||
fgastreinte: $("#modalupdate #fgastreinte").val(),
|
||||
externaltrip: $("#modalupdate #externaltripupdate").prop("checked"),
|
||||
description: $("#modalupdate #description").val()
|
||||
description: $("#modalupdate #description").val()
|
||||
},
|
||||
url: "{{ path('app_event_update') }}",
|
||||
success: function (response) {
|
||||
@@ -486,8 +486,8 @@ function eventUpdate() {
|
||||
}
|
||||
else {
|
||||
var event = calendar.getEventById($("#modalupdate #idevent").val());
|
||||
event.remove();
|
||||
|
||||
event.remove();
|
||||
|
||||
calendar.addEvent(response);
|
||||
calendar.render;
|
||||
$('#modalupdate').modal('hide');
|
||||
@@ -500,7 +500,7 @@ function eventUpdate() {
|
||||
function eventDelete() {
|
||||
$("#modalupdate .alert").remove();
|
||||
|
||||
$.ajax({
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
idevent: $("#modalupdate #idevent").val(),
|
||||
@@ -514,7 +514,7 @@ function eventDelete() {
|
||||
}
|
||||
else {
|
||||
var event = calendar.getEventById($("#modalupdate #idevent").val());
|
||||
event.remove();
|
||||
event.remove();
|
||||
$('#modalupdate').modal('hide');
|
||||
}
|
||||
}
|
||||
@@ -539,4 +539,4 @@ $("#astreinte").change(function() {
|
||||
}
|
||||
});
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user