nineskeletor/templates/Config/edit.html.twig

90 lines
3.5 KiB
Twig
Raw Permalink Normal View History

2022-07-21 16:15:47 +02:00
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification CONFIGURATION
{% elseif mode=="submit" %}
Création CONFIGURATION
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('app_admin_config') }}>Annuler</a>
{% if mode=="update" and not config.required %}
<a href="{{ path('app_admin_config_delete',{'id':config.id}) }}"
class="btn btn-danger float-right"
data-method="delete"
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
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="card">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.id) }}
{{ form_row(form.value) }}
{% if config.type=="logo" %}
<div style="width:90px; margin:10px auto;">
{% set color = "" %}
{% if config.id=='logodark' %}
{% set color = app.session.get('colorbgbodydark') %}
{% elseif config.id=='logolight' %}
{% set color = app.session.get('colorbgbodylight') %}
{% endif %}
2022-08-31 11:20:22 +02:00
<img id="config_value_img" src="{{ path("app_minio_image",{file:"logo/"~config.value}) }}" style="background-color: {{color}}; width:90px;height:90px; margin:auto;display:block;">
2022-07-21 16:15:47 +02:00
<a class="btn btn-info btn-modal" style="width:90px" data-modalid="mymodallarge" data-modaltitle="Logo" data-modalurl="{{ path('app_admin_config_logo') }}" title='Ajouter un Logo'>Modifier</a>
</div>
{% elseif config.type=="header" %}
<div style="margin:10px auto;">
2022-08-31 11:20:22 +02:00
<img id="config_value_img" src="{{ path("app_minio_image",{file:"header/"~config.value}) }}" style="width:100%;margin:auto;display:block;">
<a class="btn btn-info btn-modal" style="width:100%" data-modalid="mymodallarge" data-modaltitle="Bannière" data-modalurl="{{ path('app_all_crop01', {"type": "header", "reportinput": "#config_value" }) }}" title='Ajouter une Bannière'>Modifier</a>
2022-07-21 16:15:47 +02:00
</div>
{% endif %}
{{ form_row(form.help) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$("#config_value_img").on('error', function(){
var imgSrc = $(this).attr('src');
2022-08-31 11:20:22 +02:00
if(imgSrc!="/{{appAlias}}/{{config.type}}/")
2022-07-21 16:15:47 +02:00
$(this).attr('src',imgSrc);
});
$('#mymodallarge').on('hidden.bs.modal', function () {
var imgSrc = $("#config_value_img").attr('src');
$("#config_value_img").attr('src',imgSrc);
});
{% endblock %}