nineskeletor/templates/Alertcategory/edit.html.twig

92 lines
3.1 KiB
Twig
Raw Normal View History

2023-01-10 11:13:28 +01:00
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Catégorie d'Annonce = {{alertcategory.label}}
{% elseif mode=="submit" %}
Création Catégorie d'Annonce
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('app_'~access~'_alert') }}>Annuler</a>
{% if mode=="update" %}
<a href={{ path('app_'~access~'_alertcategory_delete',{'id':alertcategory.id}) }}
class="btn btn-danger float-end"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette catégorie ?">
Supprimer
</a>
{% endif %}
</p>
{% 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="card">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.label) }}
{{ form_row(form.color) }}
<div id="diviconsel" class="col-md-12 text-center mt-1 mb-1" style="height:140px; padding:20px; background-color: {{ alertcategory.color ? alertcategory.color : 'var(--colorbgbodydark)' }};">
{% if alertcategory.icon %}
<img src="{{ path('app_minio_image',{file:alertcategory.icon.label}) }}" height="100" />
{% endif %}
</div>
<div class="col-md-12" style="text-align:center;padding:0px">
{{ form_row(form.idicon) }}
<a class="btn btn-success btn-modal" data-modalid="mymodallarge" data-modaltitle="Icône" data-modalurl="{{ path('app_all_icon_select') }}" title='Selectionner un Icône'>Selectionner un Icône</a>
<a class="btn btn-danger" onClick="delIcon()" title='Détacher'>Détacher l'Icône</a>
</div>
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
function selIcon(idicon,url) {
$("#alertcategory_idicon").val(idicon);
$("#diviconsel img").remove();
$("#diviconsel").append("<img src='"+url+"'>");
$("#diviconsel img").attr("height","100px");
$("#mymodallarge").modal("hide");
}
function delIcon() {
$("#diviconsel img").remove();
$("#alertcategory_idicon").val(null);
}
$("#alertcategory_color").bind("change paste keyup", function() {
$("#diviconsel").css("background-color",$(this).val());
});
</script>
{% endblock %}