ninefolio/templates/Config/edit.html.twig

88 lines
3.7 KiB
Twig
Raw Permalink Normal View History

2024-09-17 14:02:17 +02:00
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
Modification CONFIGURATION
</h1>
{{ form_widget(form.submit) }}
2024-10-30 17:58:39 +01:00
{% if by=="profil" %}
2024-10-26 12:08:33 +02:00
<a class="btn btn-secondary" href={{ path('app_user_profil') }}>Annuler</a>
2024-10-30 17:58:39 +01:00
{% elseif by=="update" %}
2024-10-26 12:08:33 +02:00
<a class="btn btn-secondary" href={{ path('app_user_update',{id:userid}) }}>Annuler</a>
{% else %}
2024-10-30 17:58:39 +01:00
<a class="btn btn-secondary" href={{ path('app_admin_config') }}>Annuler</a>
2024-09-17 14:02:17 +02:00
{% 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">
2024-10-26 12:08:33 +02:00
{{ form_row(form.keyid) }}
2024-09-17 14:02:17 +02:00
{{ form_row(form.value) }}
{% if config.type=="logo" %}
<div style="width:90px; margin:10px auto;">
2024-10-31 11:48:30 +01:00
{% set color = "" %}
{% if config.id=='logodark' %}
{% set color = app.session.get('colorbgbodydark') %}
{% elseif config.id=='logolight' %}
{% set color = app.session.get('colorbgbodylight') %}
{% endif %}
2024-09-17 14:02:17 +02:00
2024-10-31 11:48:30 +01:00
<a class="btn btn-info" style="width:90px" onClick="ModalLoad('extraLargeModal','Logo','{{ path('app_user_config_logo') }}');" title='Ajouter un Logo'>Modifier</a>
<img id="config_value_img" src="{{asset("uploads/logo/"~config.value)}}" style="background-color: {{color}}; width:90px;height:90px; margin:auto;display:block;">
2024-09-17 14:02:17 +02:00
</div>
{% elseif config.type=="hero" %}
<div style="margin:10px auto;">
2024-10-31 11:48:30 +01:00
<a class="btn btn-info" style="width:100%" onClick="ModalLoad('extraLargeModal','Carrousel','{{ path('app_crop01', {"type": "hero", "reportinput": "config_value" }) }}');" title='Ajouter une Bannière'>Modifier</a>
<img id="config_value_img" src="{{asset("uploads/hero/"~config.value)}}" style="width:100%;margin:auto;display:block;">
2024-09-17 14:02:17 +02:00
</div>
{% elseif config.type=="image" %}
<div style="margin:10px auto;">
2024-10-31 11:48:30 +01:00
<a class="btn btn-info" style="width:100%" onClick="ModalLoad('extraLargeModal','Image','{{ path('app_crop01', {"type": "image", "reportinput": "config_value" }) }}');" title='Ajouter une Image'>Modifier</a>
<img id="config_value_img" src="{{asset("uploads/image/"~config.value)}}" style="width:100%;margin:auto;display:block;">
2024-09-17 14:02:17 +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');
if(imgSrc!="/{{appAlias}}/uploads/{{config.type}}/")
$(this).attr('src',imgSrc);
});
$('#extraLargeModal').on('hidden.bs.modal', function () {
var imgSrc = $("#config_value_img").attr('src');
$("#config_value_img").attr('src',imgSrc);
});
{% endblock %}