first commit
This commit is contained in:
115
templates/base.html.twig
Normal file
115
templates/base.html.twig
Normal file
@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{appName}}{% block title %}{% endblock %}</title>
|
||||
<link rel="icon" href="">
|
||||
|
||||
<link rel="stylesheet" href="{{ asset('lib/bootstrap/css/bootstrap.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/bootswatch/bootswatch.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/fontawesome/css/all.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/datatables/datatables.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/select2/select2.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/select2/select2-bootstrap-5-theme.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/dropzone/dropzone.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/dropzone/dropzone-bootstrap.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('lib/imgareaselect/css/imgareaselect-default.css') }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ asset('lib/app/app.css') }}">
|
||||
|
||||
<script src="{{ asset('lib/jquery/jquery.min.js') }}"></script>
|
||||
<script src="{{ asset('lib/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
||||
<script src="{{ asset('lib/fontawesome/fontawesome-free.index.js') }}"></script>
|
||||
<script src="{{ asset('lib/datatables/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('lib/datatables/datatables.init.js') }}"></script>
|
||||
<script src="{{ asset('lib/select2/select2.min.js') }}"></script>
|
||||
<script src="{{ asset('lib/select2/select2.init.js') }}"></script>
|
||||
<script src="{{ asset('lib/dropzone/dropzone.min.js') }}"></script>
|
||||
<script src="{{ asset('lib/imgareaselect/js/jquery.imgareaselect.dev.js') }}"></script>
|
||||
<script src="{{ asset('lib/app/app.js') }}"></script>
|
||||
|
||||
{% block javascripts %}
|
||||
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
{% block localstyle %}
|
||||
{% endblock %}
|
||||
|
||||
<body>
|
||||
{% if usemenu is defined and usemenu %}
|
||||
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ path('app_home') }}">
|
||||
{% if app.session.get('project') %}
|
||||
<img src="{{asset(app.session.get('project').logo)}}"> Projet = {{app.session.get('project').title}}
|
||||
{% else %}
|
||||
<img src="{{asset("medias/logo/logo.png")}}"> {{appName}}
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarColor02">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="navbar-nav ms-auto ps-3 d-flex flex-row position-absolute" style="right: 15px; top:15px">
|
||||
{% if app.user %}
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
<a class="nav-link px-2" href="{{path('app_admin')}}"><i class="fa-solid fa-cog fa-2x"></i></a>
|
||||
{% endif %}
|
||||
<a class="nav-link px-2" href="{{path('app_user_profil')}}"><img src="{{asset(app.user.avatar)}}" class="avatar"></a>
|
||||
<a class="nav-link px-2" href="{{path('app_logout')}}"><i class="fa-solid fa-right-from-bracket fa-2x"></i></a>
|
||||
{% else %}
|
||||
<a class="nav-link px-2" href="{{path('app_login')}}"><i class="fa-solid fa-right-to-bracket fa-2x"></i></a>
|
||||
{% endif %}
|
||||
|
||||
<a class="navbar-toggler nav-link px-2" href="#" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"><i class="fa-solid fa-bars fa-2x"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
<main>
|
||||
{% if usesidebar is defined and usesidebar %}
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
<sidebar>
|
||||
<div>
|
||||
<span>GENERALE</span>
|
||||
|
||||
<a href="{{ path('app_admin_user') }}" title="Utilisateurs">
|
||||
<i class="fas fa-user fa-fw"></i>
|
||||
<span>Utilisateurs</span>
|
||||
</a>
|
||||
</div>
|
||||
</sidebar>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<content style="margin: 0px auto; {{ (maxwidth is defined ? "max-width:"~maxwidth~"px;":"") }}">
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</content>
|
||||
</main>
|
||||
|
||||
<div id="mymodal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">INFORMATION</h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<iframe id="framemodal" frameborder=0 width="100%" height="600px"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
{% block localscript %}
|
||||
{% endblock %}
|
||||
</html>
|
1
templates/home/blank.html.twig
Normal file
1
templates/home/blank.html.twig
Normal file
@ -0,0 +1 @@
|
||||
{% extends 'base.html.twig' %}
|
116
templates/home/home.html.twig
Normal file
116
templates/home/home.html.twig
Normal file
@ -0,0 +1,116 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block localstyle%}
|
||||
<style>
|
||||
.card-body div {
|
||||
display:flex;
|
||||
}
|
||||
|
||||
.card-body div label {
|
||||
width: 30%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form.submit) }}
|
||||
|
||||
<div class="row">
|
||||
{% for section in dicos %}
|
||||
<div class="{{section.style}}">
|
||||
<div class="card mt-3 ">
|
||||
<div class="card-header">
|
||||
<h5>{{section.label}}</h5>
|
||||
</div>
|
||||
<div id="{{section.id}}" class="card-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
function moveToSection() {
|
||||
$('[data-section]').each(function() {
|
||||
inputLabel = $(this).parent();
|
||||
section = $(this).data('section');
|
||||
inputLabel.appendTo('#'+section);
|
||||
console.log('Section trouvée:', section);
|
||||
});
|
||||
|
||||
$('label.required').each(function () {
|
||||
// Évite de doubler les *
|
||||
if (!$(this).text().includes('*')) {
|
||||
$(this).append(' *');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cardHideShow() {
|
||||
$('.card-body').each(function () {
|
||||
const $cardBody = $(this);
|
||||
const $children = $cardBody.children();
|
||||
$cardBody.parent().parent().show();
|
||||
|
||||
const allHidden = $children.length > 0 && $children.filter(':visible').length === 0;
|
||||
if (allHidden) {
|
||||
$cardBody.parent().parent().hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function refreshHideShow() {
|
||||
$('.slave').each(function() {
|
||||
slave = $(this);
|
||||
slaveId = slave.attr('id');
|
||||
|
||||
// Déterminer si le champs est required
|
||||
isrequired = $('label[for="' + slaveId + '"]').hasClass('required');
|
||||
console.log(slaveId);
|
||||
console.log(isrequired);
|
||||
|
||||
// Rechercher son maitre
|
||||
masterArray = slave.data('slave').split("=");
|
||||
master = $('[data-master="'+masterArray[0]+'"]')
|
||||
|
||||
// Déterminer si le slave doit etre afficher
|
||||
toshow=false;
|
||||
if(master.is(':visible')&&master.val()===masterArray[1]) {
|
||||
toshow=true;
|
||||
}
|
||||
|
||||
if(toshow) {
|
||||
slave.parent().show();
|
||||
}
|
||||
else {
|
||||
slave.parent().hide();
|
||||
}
|
||||
|
||||
cardHideShow();
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.master').on('change', function () {
|
||||
console.log($(this).val());
|
||||
refreshHideShow();
|
||||
});
|
||||
|
||||
moveToSection();
|
||||
refreshHideShow();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
13
templates/include/error.html.twig
Normal file
13
templates/include/error.html.twig
Normal file
@ -0,0 +1,13 @@
|
||||
{% for message in app.flashes('error') %}
|
||||
<div class="alert alert-danger mt-3">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if form.vars.errors is not empty %}
|
||||
<div class="alert alert-danger mt-3">
|
||||
{% for error in form.vars.errors %}
|
||||
<li>{{ error.message }}</li>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
43
templates/security/login.html.twig
Normal file
43
templates/security/login.html.twig
Normal file
@ -0,0 +1,43 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<form method="post">
|
||||
<img src="{{asset("/medias/logo/logo.png")}}" style="margin: 15px auto 15px auto; width:100px; display:block;">
|
||||
<center style="font-size:200%;margin-bottom:30px;">{{appName}}</center>
|
||||
<div class="card card-body m-auto" style="width:300px">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
Vous êtes déjà connecté avec le login {{ app.user.userIdentifier }} = <a href="{{ path('app_logout') }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="username">Login</label>
|
||||
<input class="form-control" type="text" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="username" required autofocus>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input class="form-control" type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Valider
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#username").focus();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
48
templates/upload/crop01.html.twig
Normal file
48
templates/upload/crop01.html.twig
Normal file
@ -0,0 +1,48 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block localstyle %}
|
||||
<style>
|
||||
body {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
|
||||
<form action="{{ oneup_uploader_endpoint(endpoint) }}" class="dropzone" id="myDropzone" style="margin-top:10px">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
Dropzone.options.myDropzone = {
|
||||
maxFiles: 1,
|
||||
acceptedMimeTypes: 'image/*',
|
||||
success: function(file, response){
|
||||
// Construction de l'url de retour
|
||||
url="{{ path('app_user_upload_crop02',{reportThumb: reportThumb, path:'xxx', file:'yyy'})|escape('js') }}";
|
||||
url=url.replace("xxx",response["path"]);
|
||||
url=url.replace("yyy",response["file"]);
|
||||
|
||||
// Navigation sur l'url de retour
|
||||
$(location).attr('href',url);
|
||||
},
|
||||
|
||||
|
||||
dictDefaultMessage: "Déposez vos fichiers ici pour les téléverser",
|
||||
dictFallbackMessage: "Votre navigateur ne supporte pas le téléversement de fichiers par glisser-déposer.",
|
||||
dictFallbackText: "Veuillez utiliser le formulaire ci-dessous pour téléverser vos fichiers.",
|
||||
dictFileTooBig: "Le fichier est trop volumineux .",
|
||||
dictInvalidFileType: "Vous ne pouvez pas téléverser des fichiers de ce type.",
|
||||
dictCancelUpload: "Annuler le téléversement",
|
||||
dictCancelUploadConfirmation: "Êtes-vous sûr de vouloir annuler ce téléversement ?",
|
||||
dictRemoveFile: "Supprimer le fichier",
|
||||
dictMaxFilesExceeded: "Vous ne pouvez pas téléverser plus de fichiers."
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
window.parent.$("#mymodal").modal('hide');
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
83
templates/upload/crop02.html.twig
Normal file
83
templates/upload/crop02.html.twig
Normal file
@ -0,0 +1,83 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block localstyle %}
|
||||
<style>
|
||||
body {
|
||||
background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form.submit) }} <a class="btn btn-secondary" onClick="closeModal();">Annuler</a>
|
||||
|
||||
<div id='preview' style='overflow:hidden; width:90px; height:90px; position: absolute; top: 0px; right: 10px;'>
|
||||
<img src="{{ asset(image) }}" style='position: relative;' alt='Thumbnail Preview' />
|
||||
</div>
|
||||
|
||||
<div style="margin-top:50px;">
|
||||
<img id="largeimg" src="{{ asset(image) }}">
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
function preview(img, selection) {
|
||||
var scaleX = 90 / selection.width;
|
||||
var scaleY = 90 / selection.height;
|
||||
|
||||
$('#preview img').css({
|
||||
width: Math.round(scaleX * $('#largeimg').width()) + 'px',
|
||||
height: Math.round(scaleY * $('#largeimg').height()) + 'px',
|
||||
marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px',
|
||||
marginTop: '-' + Math.round(scaleY * selection.y1) + 'px'
|
||||
});
|
||||
$('#form_x1').val(selection.x1);
|
||||
$('#form_y1').val(selection.y1);
|
||||
$('#form_x2').val(selection.x2);
|
||||
$('#form_y2').val(selection.y2);
|
||||
$('#form_w').val(selection.width);
|
||||
$('#form_h').val(selection.height);
|
||||
}
|
||||
|
||||
function reportThumb() {
|
||||
window.parent.$("#{{reportThumb}}").val("{{thumb}}");
|
||||
url="{{ asset(thumb) }}";
|
||||
window.parent.$("#{{reportThumb}}_img").attr("src",url);
|
||||
closeModal();
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
window.parent.$("#mymodal").modal('hide');
|
||||
}
|
||||
|
||||
$(window).on("load",function () {
|
||||
{% if toReport %}
|
||||
reportThumb();
|
||||
{% endif %}
|
||||
$('#largeimg').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: preview });
|
||||
|
||||
|
||||
var selection = new Object();
|
||||
if($('#largeimg').height()<$('#largeimg').width()) {
|
||||
selection.width = $('#largeimg').height();
|
||||
selection.height = $('#largeimg').height();
|
||||
}
|
||||
else {
|
||||
selection.width = $('#largeimg').width();
|
||||
selection.height = $('#largeimg').width();
|
||||
}
|
||||
|
||||
selection.x1=0;
|
||||
selection.x2=0;
|
||||
selection.y1=0;
|
||||
selection.y2=0;
|
||||
|
||||
preview($('#largeimg'),selection);
|
||||
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
57
templates/user/edit.html.twig
Normal file
57
templates/user/edit.html.twig
Normal file
@ -0,0 +1,57 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %} = {{title}}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>{{title}}</h1>
|
||||
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form.submit) }}
|
||||
<a href="{{ path(routecancel) }}" class="btn btn-secondary ms-1">Annuler</a>
|
||||
{%if mode=="update" %}<a href="{{ path(routedelete,{id:form.vars.value.id}) }}" class="btn btn-danger float-end" onclick="return confirm('Confirmez-vous la suppression de cet enregistrement ?')">Supprimer</a>{%endif%}
|
||||
|
||||
{% include('include/error.html.twig') %}
|
||||
|
||||
<div class="text-center d-flex flex-column align-items-center">
|
||||
<img id="user_avatar_img" src="{{asset(form.vars.value.avatar)}}" class="bigavatar mb-2">
|
||||
{{ form_row(form.avatar) }}
|
||||
<a class="btn btn-info" style="max-width:100%; margin-bottom:15px;" data-bs-toggle="modal" data-bs-target="#mymodal" onClick="ModalLoad('mymodal','Avatar','{{ path('app_user_upload_crop01',{endpoint:'avatar',reportThumb:'user_avatar'}) }}');" title='Ajouter un avatar'>Modifier</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mx-auto">
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Information</div>
|
||||
<div class="card-body">
|
||||
{{ form_row(form.username) }}
|
||||
{%if form.password is defined%}
|
||||
{{ form_row(form.password) }}
|
||||
{% endif %}
|
||||
{{ form_row(form.email) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{%if form.roles is defined%}
|
||||
<div class="col-md-6">
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">Permissions</div>
|
||||
<div class="card-body">
|
||||
{{ form_row(form.roles) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%endif%}
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#user_username").focus();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
48
templates/user/list.html.twig
Normal file
48
templates/user/list.html.twig
Normal file
@ -0,0 +1,48 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %} = {{title}}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>{{title}}</h1>
|
||||
<a href="{{ path(routesubmit) }}" class="btn btn-success">Ajouter</a>
|
||||
|
||||
<div class="dataTable_wrapper">
|
||||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="70px" class="no-sort">Action</th>
|
||||
<th width="70px" class="no-sort">Avatar</th>
|
||||
<th>Login</th>
|
||||
<th>Rôles</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td><a href="{{ path(routeupdate,{id:user.id}) }}"><i class="fas fa-file fa-2x"></i></a></td>
|
||||
<td><img class="avatar" src="{{ asset(user.avatar)}}"></td>
|
||||
<td>{{user.username}}</td>
|
||||
<td>
|
||||
{% for role in user.roles %}
|
||||
{{role}}<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#dataTables').DataTable({
|
||||
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
|
||||
responsive: true,
|
||||
iDisplayLength: 100,
|
||||
order: [[ 2, "asc" ]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user