ninegate/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Calendar/edit.html.twig

112 lines
3.0 KiB
Twig

{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Calendrier = {{entity.name}}
{% elseif mode=="submit" %}
Création Calendrier
{% endif %}
</h1>
{{ form_widget(form.submit) }}
{% if access=="config" and mode=="submit" %}
<a class="btn btn-default" href={{ path('cadoles_portal_config_calendar') }}>Annuler</a>
{% else %}
<a class="btn btn-default" href={{ path('cadoles_portal_'~access~'_calendar_view',{'id':entity.id}) }}>Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_config_calendar_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette annonce ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.color) }}
<div id="url" style="display:none">
{{ form_row(form.url) }}
</div>
<div id="login" style="display:none">
{{ form_row(form.caldavname) }}
{{ form_row(form.login) }}
{{ form_row(form.password) }}
</div>
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
showhide();
});
$( "#calendar_type" ).on('change', function() {
showhide();
});
function showhide() {
console.log($("#calendar_type").val());
if($("#calendar_type").val()==1) {
$("#url").show();
$("#login").hide();
}
else if($("#calendar_type").val()==2) {
$("#url").show();
$("#login").show();
}
else {
$("#url").hide();
$("#login").hide();
}
}
{% endblock %}