This commit is contained in:
62
templates/Documentcategory/edit.html.twig
Executable file
62
templates/Documentcategory/edit.html.twig
Executable file
@ -0,0 +1,62 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
<h1 class="page-header">
|
||||
{% if mode=="update" %}
|
||||
Modification Catégorie de Document = {{documentcategory.label}}
|
||||
{% elseif mode=="submit" %}
|
||||
Création Catégorie de Document
|
||||
{% endif %}
|
||||
</h1>
|
||||
|
||||
{{ form_widget(form.submit) }}
|
||||
<a class="btn btn-secondary" href={{ path('app_admin_documentcategory') }}>Annuler</a>
|
||||
{% if mode=="update" %}
|
||||
<a class="btn btn-danger float-end" href={{ path('app_admin_documentcategory_delete',{id:documentcategory.id}) }} data-method="delete" data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?">Supprimer</a>
|
||||
{% endif %}
|
||||
|
||||
{% 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 mt-4">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-pencil-alt fa-fw"></i> Informations
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
{{ form_row(form.label) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
|
||||
<div class="float-end" style="width:700px;max-width:100%">
|
||||
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Documentcategory",entityid:documentcategory.id})) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$('document').ready(function(){
|
||||
$("#documentcategory_label").focus();
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
81
templates/Documentcategory/list.html.twig
Executable file
81
templates/Documentcategory/list.html.twig
Executable file
@ -0,0 +1,81 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block localstyle %}
|
||||
<style>
|
||||
.list-sort {
|
||||
padding:10px;
|
||||
background-color: var(--bs-card-cap-bg);
|
||||
border: var(--bs-card-border-width) solid var(--bs-card-border-color);
|
||||
border-radius: var(--bs-card-inner-border-radius);
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1 class="page-header">Gestion des Catégories de Document </h1>
|
||||
|
||||
|
||||
<a class="btn btn-success" href="{{ path('app_'~access~'_documentcategory_submit') }}">Ajouter</a>
|
||||
{% if auditUse and (access=="admin" or access=="audit") %}
|
||||
<a class="btn btn-secondary float-end" href="{{ path('app_'~access~'_audit_render',{entityname:'Documentcategory'}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Catégories de Document
|
||||
</div>
|
||||
|
||||
{% set childs=[] %}
|
||||
<div class="card-body">
|
||||
<ul class="list-sort">
|
||||
{% for documentcategory in documentcategorys %}
|
||||
{{ render(path("app_"~access~"_documentcategory_render",{id:documentcategory.id})) }}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
|
||||
function updateItems() {
|
||||
roworder=0;
|
||||
$('.itemcat').each(function(i) {
|
||||
// Order
|
||||
roworder++;
|
||||
|
||||
// On récupère id et order
|
||||
var id = $(this).data('id');
|
||||
|
||||
// On récupère le parent
|
||||
var parent=$(this).parents('.itemcat').data('id');
|
||||
//if(id==parent) parent=null;
|
||||
|
||||
console.log({id: id, parent:parent, roworder: roworder});
|
||||
|
||||
// Mise à jour en base de l'order
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{{ path('app_'~access~'_documentcategory_order') }}",
|
||||
data: {
|
||||
id:id,
|
||||
parent:parent,
|
||||
roworder:roworder
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$( ".list-sort" ).sortable({
|
||||
connectWith: ".list-sort",
|
||||
items: ".itemcat",
|
||||
placeholder: "item placeholder",
|
||||
stop: updateItems
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
10
templates/Documentcategory/render.html.twig
Normal file
10
templates/Documentcategory/render.html.twig
Normal file
@ -0,0 +1,10 @@
|
||||
<div class="itemcat list-group-item mb-3" data-id="{{ documentcategory.id }}" >
|
||||
<a href="{{ path('app_'~access~'_documentcategory_update',{id:documentcategory.id})}}">{{ documentcategory.label }}</a>
|
||||
<ul class="p-3 list-sort">
|
||||
{% if not documentcategory.childs is empty %}
|
||||
{% for documentcategory in documentcategory.childs %}
|
||||
{{ render(path("app_"~access~"_documentcategory_render",{id:documentcategory.id,access:access})) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
Reference in New Issue
Block a user