Commit 185d1980 by Julien Jorry

BIG UPDATE : update role, actions, list on BO + update front + debug...

parent 2dfaf9e9
// Lumen 4.3.1
// Bootswatch
// Variables ===================================================================
$web-font-path: "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic" !default;
@import url($web-font-path);
@mixin shadow($width: 4px){
border-style: solid;
border-width: 0 1px $width 1px;
}
// Navbar ======================================================================
.navbar {
@include shadow();
}
.bg-primary {
border-color: darken($primary, 5%);
}
.bg-dark {
border-color: darken($dark, 5%);
}
.bg-light {
background-color: #fff !important;
border-color: darken(#fff, 5%);
}
// Buttons =====================================================================
.btn {
@include shadow();
text-transform: uppercase;
&:not(.disabled):hover {
margin-top: 1px;
border-bottom-width: 3px;
}
&:not(.disabled):active {
margin-top: 2px;
border-bottom-width: 2px;
@include box-shadow(none);
}
}
[class*="btn-outline"] {
border-top-width: 1px;
}
.btn {
&-primary {
border-color: darken($primary, 5%);
}
&-secondary {
border-color: darken($secondary, 5%);
}
&-success {
border-color: darken($success, 5%);
}
&-info {
border-color: darken($info, 5%);
}
&-danger {
border-color: darken($danger, 5%);
}
&-warning {
border-color: darken($warning, 5%);
}
&-light {
border-color: darken($light, 5%);
}
&-dark {
border-color: darken($dark, 5%);
}
}
.btn-group-vertical {
.btn + .btn {
&:hover {
margin-top: -1px;
border-top-width: 1px;
}
&:active {
margin-top: -1px;
border-top-width: 2px;
}
}
}
// Typography ==================================================================
.text-secondary {
color: $gray-700 !important;
}
.blockquote-footer {
color: $gray-600;
}
// Tables ======================================================================
.table {
&-primary,
&-success,
&-info,
&-warning,
&-danger {
color: #fff;
}
&-primary {
&, > th, > td {
background-color: $primary;
}
}
&-secondary {
&, > th, > td {
background-color: $secondary;
}
}
&-light {
&, > th, > td {
background-color: $light;
}
}
&-dark {
&, > th, > td {
background-color: $dark;
}
}
&-success {
&, > th, > td {
background-color: $success;
}
}
&-info {
&, > th, > td {
background-color: $info;
}
}
&-danger {
&, > th, > td {
background-color: $danger;
}
}
&-warning {
&, > th, > td {
background-color: $warning;
}
}
&-active {
&, > th, > td {
background-color: $table-active-bg;
}
}
&-hover {
.table-primary:hover {
&, > th, > td {
background-color: darken($primary, 5%);
}
}
.table-secondary:hover {
&, > th, > td {
background-color: darken($secondary, 5%);
}
}
.table-light:hover {
&, > th, > td {
background-color: darken($light, 5%);
}
}
.table-dark:hover {
&, > th, > td {
background-color: darken($dark, 5%);
}
}
.table-success:hover {
&, > th, > td {
background-color: darken($success, 5%);
}
}
.table-info:hover {
&, > th, > td {
background-color: darken($info, 5%);
}
}
.table-danger:hover {
&, > th, > td {
background-color: darken($danger, 5%);
}
}
.table-warning:hover {
&, > th, > td {
background-color: darken($warning, 5%);
}
}
.table-active:hover {
&, > th, > td {
background-color: $table-active-bg;
}
}
}
}
// Forms =======================================================================
.form-control {
box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
}
.input-group-sm {
> .input-group-prepend,
> .input-group-append {
.btn {
font-size: $btn-font-size-sm;
}
}
}
// Navs ========================================================================
.nav {
.open > a,
.open > a:hover,
.open > a:focus {
border-color: transparent;
}
}
.nav-tabs {
.nav-link {
color: $body-color;
&,
&.disabled,
&.disabled:hover,
&.disabled:focus {
margin-top: 6px;
border-color: $nav-tabs-border-color;
transition: all 0.2s ease-in-out;
}
&:not(.disabled):hover,
&:not(.disabled):focus,
&.active {
padding-bottom: calc(0.5em + 6px);
border-bottom-color: transparent;
margin-top: 0;
}
}
&.nav-justified > li {
vertical-align: bottom;
}
}
.dropdown-menu {
margin-top: 0;
@include shadow();
border-top-width: 1px;
@include box-shadow(none);
}
.breadcrumb {
border-color: darken($breadcrumb-bg, 5%);
@include shadow();
}
.pagination {
> li > a,
> li > span {
position: relative;
top: 0;
@include shadow();
color: $pagination-color;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
&:hover,
&:focus {
top: 1px;
border-bottom-width: 3px;
text-decoration: none;
}
&:active {
top: 2px;
border-bottom-width: 2px;
}
}
> .disabled > a,
> .disabled > span {
&:hover {
top: 0;
@include shadow();
}
&:active {
top: 0;
@include shadow();
}
}
}
.pager {
> li > a,
> li > span,
> .disabled > a,
> .disabled > span {
&,
&:hover,
&:active {
border-left-width: 2px;
border-right-width: 2px;
}
}
}
// Indicators ==================================================================
.close {
text-decoration: none;
opacity: 0.4;
&:hover,
&:focus {
opacity: 1;
}
}
.alert {
color: $white;
@include shadow();
&-primary {
background-color: $primary;
border-color: darken($primary, 5%);
}
&-secondary {
background-color: $secondary;
border-color: darken($secondary, 5%);
}
&-success {
background-color: $success;
border-color: darken($success, 5%);
}
&-info {
background-color: $info;
border-color: darken($info, 5%);
}
&-danger {
background-color: $danger;
border-color: darken($danger, 5%);
}
&-warning {
background-color: $warning;
border-color: darken($warning, 5%);
}
&-dark {
background-color: $dark;
border-color: darken($dark, 5%);
}
&-light {
background-color: $light;
border-color: darken($light, 5%);
}
.alert-link {
font-weight: normal;
color: #fff;
text-decoration: underline;
}
&-secondary,
&-light {
&,
& a,
& .alert-link {
color: $body-color;
}
}
}
.badge {
&-warning,
&-info {
color: $white;
}
}
// Progress bars ===============================================================
// Containers ==================================================================
a.list-group-item {
&-success {
&.active {
background-color: $success;
}
&.active:hover,
&.active:focus {
background-color: darken($success, 5%);
}
}
&-warning {
&.active {
background-color: $warning;
}
&.active:hover,
&.active:focus {
background-color: darken($warning, 5%);
}
}
&-danger {
&.active {
background-color: $danger;
}
&.active:hover,
&.active:focus {
background-color: darken($danger, 5%);
}
}
}
.jumbotron {
border: 1px solid $gray-200;
box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.05);
}
.modal {
.close {
color: $black;
&:not(:disabled):not(.disabled):hover,
&:not(:disabled):not(.disabled):focus {
color: $black;
}
}
}
// Lumen 4.3.1
// Bootswatch
//
// Color system
//
$white: #fff !default;
$gray-100: #f6f6f6 !default;
$gray-200: #f0f0f0 !default;
$gray-300: #dee2e6 !default;
$gray-400: #ced4da !default;
$gray-500: #adb5bd !default;
$gray-600: #999 !default;
$gray-700: #555 !default;
$gray-800: #333 !default;
$gray-900: #222 !default;
$black: #000 !default;
$blue: #158CBA !default;
$indigo: #6610f2 !default;
$purple: #6f42c1 !default;
$pink: #e83e8c !default;
$red: #FF4136 !default;
$orange: #fd7e14 !default;
$yellow: #FF851B !default;
$green: #28B62C !default;
$teal: #20c997 !default;
$cyan: #75CAEB !default;
$primary: $blue !default;
$secondary: $gray-200 !default;
$success: $green !default;
$info: $cyan !default;
$warning: $yellow !default;
$danger: $red !default;
$light: $gray-100 !default;
$dark: $gray-700 !default;
$yiq-contrasted-threshold: 200 !default;
// Fonts
$font-family-sans-serif: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default;
$font-size-base: 0.875rem !default;
// Buttons
$btn-font-size: 0.75rem !default;
$btn-font-size-sm: 0.625rem !default;
$btn-font-weight: bold !default;
// Dropdowns
$dropdown-link-color: rgba(0,0,0,.5) !default;
// Navs
$nav-tabs-border-color: $gray-200 !default;
$nav-tabs-link-hover-border-color: $nav-tabs-border-color !default;
$nav-tabs-link-active-color: $gray-900 !default;
$nav-tabs-link-active-border-color: $nav-tabs-border-color !default;
// Pagination
$pagination-color: $gray-700 !default;
$pagination-bg: $gray-200 !default;
$pagination-hover-color: $pagination-color !default;
$pagination-hover-bg: $pagination-bg !default;
$pagination-active-border-color: darken($primary, 5%) !default;
$pagination-disabled-color: $gray-600 !default;
$pagination-disabled-bg: $pagination-bg !default;
// Jumbotron
$jumbotron-bg: #fafafa !default;
// Modals
$modal-content-border-color: rgba($black,.1) !default;
// Close
$close-color: $white !default;
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
*/ */
// any CSS you require will output into a single css file (app.css in this case) // any CSS you require will output into a single css file (app.css in this case)
require('../css/admin.css'); // require('../css/admin.css');
// Need jQuery? Install it with "yarn add jquery", then uncomment to require it. // Need jQuery? Install it with "yarn add jquery", then uncomment to require it.
// var $ = require('jquery'); // var $ = require('jquery');
...@@ -20,6 +20,9 @@ global.$ = global.jQuery = $; ...@@ -20,6 +20,9 @@ global.$ = global.jQuery = $;
// no need to set this to a variable, just require it // no need to set this to a variable, just require it
// require('popper.js/dist/popper.js'); // require('popper.js/dist/popper.js');
require('bootstrap'); require('bootstrap');
// require('../css/lumen/_variables.scss');
// require('../css/lumen/_bootswatch.scss');
require('../css/lumen/bootstrap.min.css');
require('../js/flash-messages.js'); require('../js/flash-messages.js');
const mlc = require('../js/mlc.js'); const mlc = require('../js/mlc.js');
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"php": "^7.1.3", "php": "^7.1.3",
"ext-ctype": "*", "ext-ctype": "*",
"ext-iconv": "*", "ext-iconv": "*",
"api-platform/api-pack": "^1.2",
"friendsofsymfony/ckeditor-bundle": "^2.0", "friendsofsymfony/ckeditor-bundle": "^2.0",
"friendsofsymfony/rest-bundle": "^2.4", "friendsofsymfony/rest-bundle": "^2.4",
"friendsofsymfony/user-bundle": "^2.1", "friendsofsymfony/user-bundle": "^2.1",
......
...@@ -4,9 +4,168 @@ ...@@ -4,9 +4,168 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "99c6a787e9c5545a79d54dc3619b7cae", "content-hash": "7ac11d25e4e3f7f116995e5f3029628d",
"packages": [ "packages": [
{ {
"name": "api-platform/api-pack",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/api-platform/api-pack.git",
"reference": "9e3e7421415c747e676778f211434674324dcfa9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/api-platform/api-pack/zipball/9e3e7421415c747e676778f211434674324dcfa9",
"reference": "9e3e7421415c747e676778f211434674324dcfa9",
"shasum": ""
},
"require": {
"api-platform/core": "^2.1",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.4.5",
"nelmio/cors-bundle": "^1.5",
"php": "^7.0",
"phpdocumentor/reflection-docblock": "^3.0 || ^4.0",
"symfony/asset": "*",
"symfony/expression-language": "*",
"symfony/security-bundle": "*",
"symfony/twig-bundle": "*",
"symfony/validator": "*"
},
"type": "symfony-pack",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "A pack for API Platform",
"time": "2019-01-12T11:48:48+00:00"
},
{
"name": "api-platform/core",
"version": "v2.3.6",
"source": {
"type": "git",
"url": "https://github.com/api-platform/core.git",
"reference": "f12aa2ae9ee67e7c948cd3161ad980d35210bed7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/api-platform/core/zipball/f12aa2ae9ee67e7c948cd3161ad980d35210bed7",
"reference": "f12aa2ae9ee67e7c948cd3161ad980d35210bed7",
"shasum": ""
},
"require": {
"doctrine/inflector": "^1.0",
"php": ">=7.1",
"psr/cache": "^1.0",
"psr/container": "^1.0",
"symfony/http-foundation": "^3.4 || ^4.0",
"symfony/http-kernel": "^3.4 || ^4.0",
"symfony/property-access": "^3.4 || ^4.0",
"symfony/property-info": "^3.4 || ^4.0",
"symfony/serializer": "^4.1",
"willdurand/negotiation": "^2.0.3"
},
"conflict": {
"doctrine/common": "<2.7"
},
"require-dev": {
"behat/behat": "^3.1",
"behat/mink": "^1.7",
"behat/mink-browserkit-driver": "^1.3.1",
"behat/mink-extension": "^2.2",
"behat/symfony2-extension": "^2.1.1",
"behatch/contexts": "3.1.0",
"doctrine/annotations": "^1.2",
"doctrine/doctrine-bundle": "^1.8",
"doctrine/orm": "^2.6.3",
"friendsofsymfony/user-bundle": "^2.1",
"guzzlehttp/guzzle": "^6.0",
"justinrainbow/json-schema": "^5.0",
"nelmio/api-doc-bundle": "^2.13.3",
"php-mock/php-mock-phpunit": "^2.0",
"phpdocumentor/reflection-docblock": "^3.0 || ^4.0",
"phpdocumentor/type-resolver": "^0.3 || ^0.4",
"phpunit/phpunit": "^6.1",
"psr/log": "^1.0",
"ramsey/uuid": "^3.7",
"ramsey/uuid-doctrine": "^1.4",
"symfony/asset": "^3.4 || ^4.0",
"symfony/cache": "^3.4 || ^4.0",
"symfony/config": "^3.4 || ^4.0",
"symfony/console": "^3.4 || ^4.0",
"symfony/debug": "^3.4 || ^4.0",
"symfony/dependency-injection": "^3.4 || ^4.0",
"symfony/doctrine-bridge": "^3.4 || ^4.0",
"symfony/event-dispatcher": "^3.4 || ^4.0",
"symfony/expression-language": "^3.4 || ^4.0",
"symfony/finder": "^3.4 || ^4.0",
"symfony/form": "^3.4 || ^4.0",
"symfony/framework-bundle": "^3.4 || ^4.0",
"symfony/phpunit-bridge": "^3.4 || ^4.0",
"symfony/routing": "^3.4 || ^4.0",
"symfony/security": "^3.4 || ^4.0",
"symfony/security-bundle": "^3.4 || ^4.0",
"symfony/twig-bundle": "^3.4 || ^4.0",
"symfony/validator": "^3.4 || ^4.0",
"symfony/web-profiler-bundle": "^3.4 || ^4.0",
"symfony/yaml": "^3.4 || ^4.0",
"webonyx/graphql-php": ">=0.13 <1.0"
},
"suggest": {
"friendsofsymfony/user-bundle": "To use the FOSUserBundle bridge.",
"guzzlehttp/guzzle": "To use the HTTP cache invalidation system.",
"phpdocumentor/reflection-docblock": "To support extracting metadata from PHPDoc.",
"psr/cache-implementation": "To use metadata caching.",
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
"symfony/cache": "To have metadata caching when using Symfony integration.",
"symfony/config": "To load XML configuration files.",
"symfony/expression-language": "To use authorization features.",
"symfony/security": "To use authorization features.",
"symfony/twig-bundle": "To use the Swagger UI integration.",
"symfony/web-profiler-bundle": "To use the data collector.",
"webonyx/graphql-php": "To support GraphQL."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"psr-4": {
"ApiPlatform\\Core\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kévin Dunglas",
"email": "dunglas@gmail.com",
"homepage": "https://dunglas.fr"
}
],
"description": "Build a fully-featured hypermedia or GraphQL API in minutes",
"homepage": "https://api-platform.com",
"keywords": [
"Hydra",
"JSON-LD",
"api",
"graphql",
"hal",
"jsonapi",
"openapi",
"rest",
"swagger"
],
"time": "2019-01-15T16:10:35+00:00"
},
{
"name": "behat/transliterator", "name": "behat/transliterator",
"version": "v1.2.0", "version": "v1.2.0",
"source": { "source": {
...@@ -3381,6 +3540,64 @@ ...@@ -3381,6 +3540,64 @@
"time": "2019-01-25T17:25:46+00:00" "time": "2019-01-25T17:25:46+00:00"
}, },
{ {
"name": "nelmio/cors-bundle",
"version": "1.5.4",
"source": {
"type": "git",
"url": "https://github.com/nelmio/NelmioCorsBundle.git",
"reference": "548dc8ebd3984acd2f6d8787ab1dac2e9aa14254"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nelmio/NelmioCorsBundle/zipball/548dc8ebd3984acd2f6d8787ab1dac2e9aa14254",
"reference": "548dc8ebd3984acd2f6d8787ab1dac2e9aa14254",
"shasum": ""
},
"require": {
"symfony/framework-bundle": "^2.7 || ^3.0 || ^4.0"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^1.0 || ^2.0",
"mockery/mockery": "^0.9 || ^1.0",
"symfony/phpunit-bridge": "^2.7 || ^3.0 || ^4.0"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "1.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Nelmio\\CorsBundle\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nelmio",
"homepage": "http://nelm.io"
},
{
"name": "Symfony Community",
"homepage": "https://github.com/nelmio/NelmioCorsBundle/contributors"
}
],
"description": "Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony2 application",
"keywords": [
"api",
"cors",
"crossdomain"
],
"time": "2017-12-11T18:41:54+00:00"
},
{
"name": "ocramius/package-versions", "name": "ocramius/package-versions",
"version": "1.3.0", "version": "1.3.0",
"source": { "source": {
......
...@@ -44,4 +44,6 @@ return [ ...@@ -44,4 +44,6 @@ return [
Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true], Sonata\IntlBundle\SonataIntlBundle::class => ['all' => true],
Lexik\Bundle\TranslationBundle\LexikTranslationBundle::class => ['all' => true], Lexik\Bundle\TranslationBundle\LexikTranslationBundle::class => ['all' => true],
Prodigious\Sonata\MenuBundle\ProdigiousSonataMenuBundle::class => ['all' => true], Prodigious\Sonata\MenuBundle\ProdigiousSonataMenuBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
]; ];
api_platform:
mapping:
paths: ['%kernel.project_dir%/src/Entity']
# App\Entity\Adherent:
# get: ~
# post: ~
# put: ~
# App\Entity\Page:
# get: ~
# post: ~
# put: ~
# App\Entity\Comptoir:
# get: ~
# post: ~
# put: ~
# App\Entity\Cotisation:
# get: ~
# post: ~
# put: ~
# App\Entity\CotisationAdherent:
# get: ~
# post: ~
# put: ~
# App\Entity\CotisationPrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\CotisationInfos:
# get: ~
# post: ~
# put: ~
# App\Entity\Document:
# get: ~
# post: ~
# put: ~
# App\Entity\EmailToken:
# get: ~
# post: ~
# put: ~
# App\Entity\Faq:
# get: ~
# post: ~
# put: ~
# App\Entity\Flux:
# get: ~
# post: ~
# put: ~
# App\Entity\Geoloc:
# get: ~
# post: ~
# put: ~
# App\Entity\Groupe:
# get: ~
# post: ~
# put: ~
# App\Entity\GroupePrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\Lien:
# get: ~
# post: ~
# put: ~
# App\Entity\Message:
# get: ~
# post: ~
# put: ~
# App\Entity\News:
# get: ~
# post: ~
# put: ~
# App\Entity\Page:
# get: ~
# post: ~
# put: ~
# App\Entity\Prestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\Rubrique:
# get: ~
# post: ~
# put: ~
# App\Entity\Siege:
# get: ~
# App\Entity\Transaction:
# get: ~
# post: ~
# put: ~
# App\Entity\TransactionAdherentPrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\TransactionPrestataireAdherent:
# get: ~
# post: ~
# put: ~
# App\Entity\TransactionPrestatairePrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\Transfert:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertComptoirAdherent:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertComptoirGroupe:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertComptoirPrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertGroupeComptoir:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertPrestataireComptoir:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertPrestataireSiege:
# get: ~
# post: ~
# put: ~
# App\Entity\TransfertSiegeGroupe:
# get: ~
# post: ~
# put: ~
# App\Entity\TypePrestataire:
# get: ~
# post: ~
# put: ~
# App\Entity\User:
# get: ~
# post: ~
# put: ~
# App\Entity\Usergroup:
# get: ~
# post: ~
# put: ~
# App\Entity\Book:
# itemOperations:
# get:
# method: 'GET'
# path: '/grimoire/{id}'
# requirements:
# id: '\d+'
# defaults:
# color: 'brown'
# host: '{subdomain}.api-platform.com'
# schemes: ['https']
# options:
# my_option: 'my_option_value'
# status: 200 # customize the HTTP status code to send
# put:
# method: 'PUT'
# path: '/grimoire/{id}/update'
# hydra_context: { foo: 'bar' }
# requirements:
# id: '\d+'
\ No newline at end of file
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': ~
...@@ -50,6 +50,7 @@ security: ...@@ -50,6 +50,7 @@ security:
switch_user: switch_user:
provider: fos_userbundle provider: fos_userbundle
context: mlc_context context: mlc_context
# access_denied_handler: App\Security\AccessDeniedHandler
# -> end custom configuration # -> end custom configuration
main: main:
pattern: ^/ pattern: ^/
...@@ -77,6 +78,7 @@ security: ...@@ -77,6 +78,7 @@ security:
context: mlc_context context: mlc_context
switch_user: switch_user:
provider: fos_userbundle provider: fos_userbundle
# access_denied_handler: App\Security\AccessDeniedHandler
encoders: encoders:
FOS\UserBundle\Model\UserInterface: bcrypt FOS\UserBundle\Model\UserInterface: bcrypt
...@@ -87,11 +89,11 @@ security: ...@@ -87,11 +89,11 @@ security:
ROLE_ADMIN_SIEGE: ROLE_USER ROLE_ADMIN_SIEGE: ROLE_USER
ROLE_REDACTEUR: ROLE_USER ROLE_REDACTEUR: ROLE_USER
ROLE_TRESORIER: ROLE_USER ROLE_TRESORIER: ROLE_USER
ROLE_CONTROLEUR: ROLE_USER
ROLE_GESTION_GROUPE: ROLE_USER ROLE_GESTION_GROUPE: ROLE_USER
ROLE_COMPTOIR: ROLE_USER ROLE_COMPTOIR: ROLE_USER
ROLE_CONTACT: ROLE_USER ROLE_CONTACT: ROLE_USER
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN] ROLE_SUPER_ADMIN: [ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
# Easy way to control access for large sections of your site # Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used # Note: Only the *first* access control that matches will be used
...@@ -107,6 +109,6 @@ security: ...@@ -107,6 +109,6 @@ security:
# Secured part of the site # Secured part of the site
# This config requires being logged for the whole site and having the admin role for the admin part. # This config requires being logged for the whole site and having the admin role for the admin part.
# Change these rules to adapt them to your needs # Change these rules to adapt them to your needs
- { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] } - { path: ^/admin/, role: [ROLE_SUPER_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMIN_SIEGE, ROLE_REDACTEUR, ROLE_TRESORIER, ROLE_CONTROLEUR, ROLE_GESTION_GROUPE, ROLE_COMPTOIR, ROLE_CONTACT] }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
...@@ -16,7 +16,7 @@ sonata_user: ...@@ -16,7 +16,7 @@ sonata_user:
controller: App\Controller\CRUD\GroupCRUDController controller: App\Controller\CRUD\GroupCRUDController
translation: SonataUserBundle translation: SonataUserBundle
impersonating: impersonating:
route: sonata_admin_dashboard route: index
sonata_block: sonata_block:
default_contexts: [sonata_page_bundle] default_contexts: [sonata_page_bundle]
......
...@@ -26,7 +26,7 @@ sonata_admin: ...@@ -26,7 +26,7 @@ sonata_admin:
# batch_confirmation: '@SonataAdmin/CRUD/batch_confirmation.html.twig' # batch_confirmation: '@SonataAdmin/CRUD/batch_confirmation.html.twig'
# inner_list_row: '@SonataAdmin/CRUD/list_inner_row.html.twig' # inner_list_row: '@SonataAdmin/CRUD/list_inner_row.html.twig'
# base_list_field: '@SonataAdmin/CRUD/base_list_field.html.twig' # base_list_field: '@SonataAdmin/CRUD/base_list_field.html.twig'
# list_block: '@SonataAdmin/Block/block_admin_list.html.twig' list_block: '@SonataAdmin/Block/block_admin_list.html.twig'
# user_block: '@SonataAdmin/Core/user_block.html.twig' # user_block: '@SonataAdmin/Core/user_block.html.twig'
# add_block: '@SonataAdmin/Core/add_block.html.twig' # add_block: '@SonataAdmin/Core/add_block.html.twig'
# pager_links: '@SonataAdmin/Pager/links.html.twig' # pager_links: '@SonataAdmin/Pager/links.html.twig'
......
api_platform:
resource: .
type: api_platform
prefix: /api
...@@ -149,6 +149,7 @@ services: ...@@ -149,6 +149,7 @@ services:
calls: calls:
- [ setUserManager, ['@fos_user.user_manager']] - [ setUserManager, ['@fos_user.user_manager']]
- [ addChild, ['@sonata.user.admin.user', 'user']] - [ addChild, ['@sonata.user.admin.user', 'user']]
- [ setTokenStorage, ['@security.token_storage']]
admin.prestataire.cotisations: admin.prestataire.cotisations:
class: App\Admin\CotisationPrestataireAdmin class: App\Admin\CotisationPrestataireAdmin
...@@ -179,6 +180,8 @@ services: ...@@ -179,6 +180,8 @@ services:
manager_type: orm manager_type: orm
label: "Comptoirs" label: "Comptoirs"
public: true public: true
calls:
- [ setTokenStorage, ['@security.token_storage']]
admin.groupepresta.gerer: admin.groupepresta.gerer:
class: App\Admin\GroupeprestataireAdmin class: App\Admin\GroupeprestataireAdmin
...@@ -189,6 +192,8 @@ services: ...@@ -189,6 +192,8 @@ services:
group: "Prestataire" group: "Prestataire"
label: "AMAP / Marchés" label: "AMAP / Marchés"
public: true public: true
calls:
- [ setTokenStorage, ['@security.token_storage']]
admin.news.gerer: admin.news.gerer:
class: App\Admin\NewsAdmin class: App\Admin\NewsAdmin
...@@ -252,6 +257,7 @@ services: ...@@ -252,6 +257,7 @@ services:
public: true public: true
calls: calls:
- [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation'}]] - [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation'}]]
- [ setTokenStorage, ['@security.token_storage']]
admin.transfert.gerer: admin.transfert.gerer:
class: App\Admin\TransfertAdmin class: App\Admin\TransfertAdmin
...@@ -263,8 +269,8 @@ services: ...@@ -263,8 +269,8 @@ services:
label: "Transfert" label: "Transfert"
pager_type: "simple" pager_type: "simple"
public: true public: true
# calls: calls:
# - [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation'}]] - [ setTokenStorage, ['@security.token_storage']]
admin.transaction.gerer: admin.transaction.gerer:
class: App\Admin\TransactionAdmin class: App\Admin\TransactionAdmin
...@@ -276,8 +282,8 @@ services: ...@@ -276,8 +282,8 @@ services:
label: "Transaction" label: "Transaction"
pager_type: "simple" pager_type: "simple"
public: true public: true
# calls: calls:
# - [ setSubClasses, [{transaction: 'App\Entity\Transaction', transfert: 'App\Entity\Transfert', cotisation: 'App\Entity\Cotisation'}]] - [ setTokenStorage, ['@security.token_storage']]
# admin.flux.gerer: # admin.flux.gerer:
# class: App\Admin\FluxAdmin # class: App\Admin\FluxAdmin
......
...@@ -17,9 +17,33 @@ App\Entity\Usergroup: ...@@ -17,9 +17,33 @@ App\Entity\Usergroup:
usergroup_prestataire: usergroup_prestataire:
__construct: ['Prestataire', ['ROLE_PRESTATAIRE']] __construct: ['Prestataire', ['ROLE_PRESTATAIRE']]
usergroup_adminsiege: usergroup_adminsiege:
__construct: ['Administrateur du Siege', ['ROLE_ADMIN_SIEGE']] __construct: ['Administrateur du Siege', [
'ROLE_ADMIN_SIEGE',
'ROLE_SONATA_USER_ADMIN_USER_ALL',
'ROLE_SONATA_USER_ADMIN_GROUP_ALL',
'ROLE_ADMIN_ADHERENT_GERER_ALL',
'ROLE_ADMIN_ALL_COTISATIONS_ALL',
'ROLE_ADMIN_GROUPE_GERER_ALL',
'ROLE_ADMIN_TRANSFERT_GERER_ALL']]
usergroup_redacteur: usergroup_redacteur:
__construct: ['Rédacteur', ['ROLE_REDACTEUR']] __construct: ['Rédacteur', [
'ROLE_REDACTEUR',
'ROLE_SONATA_MEDIA_ADMIN_MEDIA_ALL',
'ROLE_SONATA_MEDIA_ADMIN_GALLERY_ALL',
'ROLE_SONATA_MEDIA_ADMIN_GALLERY_HAS_MEDIA_ALL',
'ROLE_PRODIGIOUS_SONATA_MENU_ADMIN_MENU_ALL',
'ROLE_PRODIGIOUS_SONATA_MENU_ADMIN_MENU_ITEM_ALL',
'ROLE_ADMIN_GROUPEPRESTA_GERER_ALL',
'ROLE_ADMIN_NEWS_GERER_ALL',
'ROLE_ADMIN_DOCUMENT_GERER_ALL',
'ROLE_ADMIN_RUBRIQUE_GERER_ALL',
'ROLE_ADMIN_FAQ_GERER_ALL',
'ROLE_ADMIN_TRADUCTION_GERER_ALL']]
usergroup_controleur:
__construct: ['Contrôleur', [
'ROLE_CONTROLEUR',
'ROLE_ADMIN_TRANSACTION_GERER_LIST',
'ROLE_ADMIN_TRANSACTION_GERER_VIEW']]
usergroup_tresorier: usergroup_tresorier:
__construct: ['Trésorier', [ __construct: ['Trésorier', [
'ROLE_TRESORIER', 'ROLE_TRESORIER',
...@@ -27,18 +51,49 @@ App\Entity\Usergroup: ...@@ -27,18 +51,49 @@ App\Entity\Usergroup:
'ROLE_ADMIN_ADHERENT_COTISATIONS_ALL', 'ROLE_ADMIN_ADHERENT_COTISATIONS_ALL',
'ROLE_ADMIN_PRESTATAIRE_GERER_ALL', 'ROLE_ADMIN_PRESTATAIRE_GERER_ALL',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL', 'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL',
'ROLE_ADMIN_DOCUMENT_GERER_ALL', 'ROLE_ADMIN_ALL_COTISATIONS_ALL',
'ROLE_ADMIN_RUBRIQUE_GERER_ALL', 'ROLE_ADMIN_TRANSFERT_GERER_ALL']]
'ROLE_ADMIN_FAQ_GERER_ALL',
'ROLE_ADMIN_FLUX_GERER_ALL']]
usergroup_gestiongroupe: usergroup_gestiongroupe:
__construct: ['Gestionnaire de Groupe', ['ROLE_GESTION_GROUPE']] __construct: ['Gestionnaire de Groupe', [
'ROLE_GESTION_GROUPE',
'ROLE_SONATA_USER_ADMIN_USER_ALL',
'ROLE_ADMIN_ADHERENT_GERER_ALL',
'ROLE_ADMIN_ADHERENT_COTISATIONS_ALL',
'ROLE_ADMIN_PRESTATAIRE_GERER_ALL',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL',
'ROLE_ADMIN_GROUPE_GERER_EDIT',
'ROLE_ADMIN_GROUPE_GERER_VIEW',
'ROLE_ADMIN_COMPTOIR_GERER_ALL',
'ROLE_ADMIN_GROUPEPRESTA_GERER_ALL',
'ROLE_ADMIN_DOCUMENT_GERER_ALL',
'ROLE_ADMIN_TRANSFERT_GERER_EDIT',
'ROLE_ADMIN_TRANSFERT_GERER_LIST',
'ROLE_ADMIN_TRANSFERT_GERER_CREATE',
'ROLE_ADMIN_TRANSFERT_GERER_EXPORT']]
usergroup_comptoir: usergroup_comptoir:
__construct: ['Comptoir', ['ROLE_COMPTOIR']] __construct: ['Comptoir', [
'ROLE_COMPTOIR',
'ROLE_ADMIN_ADHERENT_GERER_EDIT',
'ROLE_ADMIN_ADHERENT_GERER_LIST',
'ROLE_ADMIN_ADHERENT_GERER_CREATE',
'ROLE_ADMIN_ADHERENT_GERER_VIEW',
'ROLE_ADMIN_COMPTOIR_GERER_EDIT',
'ROLE_ADMIN_COMPTOIR_GERER_VIEW',
'ROLE_ADMIN_TRANSFERT_GERER_LIST',
'ROLE_ADMIN_TRANSFERT_GERER_CREATE',
'ROLE_ADMIN_TRANSFERT_GERER_VIEW']]
usergroup_contact: usergroup_contact:
__construct: ['Contact', ['ROLE_CONTACT']] __construct: ['Contact', [
usergroup_admin: 'ROLE_CONTACT',
__construct: ['Admin', ['ROLE_ADMIN', 'ROLE_SUPER_ADMIN']] 'ROLE_ADMIN_ADHERENT_GERER_ALL',
'ROLE_ADMIN_ADHERENT_COTISATIONS_ALL',
'ROLE_ADMIN_PRESTATAIRE_GERER_ALL',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_ALL',
'ROLE_ADMIN_COMPTOIR_GERER_ALL',
'ROLE_ADMIN_GROUPEPRESTA_GERER_ALL',
'ROLE_ADMIN_NEWS_GERER_ALL',
'ROLE_ADMIN_DOCUMENT_GERER_ALL',
'ROLE_ADMIN_RUBRIQUE_GERER_ALL']]
usergroup_superadmin: usergroup_superadmin:
__construct: ['Super Admin', ['ROLE_SUPER_ADMIN']] __construct: ['Super Admin', ['ROLE_SUPER_ADMIN']]
...@@ -73,18 +128,22 @@ App\Entity\Groupeprestataire: ...@@ -73,18 +128,22 @@ App\Entity\Groupeprestataire:
name: 'AMAP de test' name: 'AMAP de test'
type: 'amap' type: 'amap'
horaires: 'Tous les Jeudis de 12h à 14h' horaires: 'Tous les Jeudis de 12h à 14h'
groupe: '@groupe1'
grppresta2: grppresta2:
name: 'AMAP de test 2' name: 'AMAP de test 2'
type: 'amap' type: 'amap'
horaires: 'Tous les Mercredis de 12h à 14h' horaires: 'Tous les Mercredis de 12h à 14h'
groupe: '@groupe<numberBetween(1,10)>'
grppresta3: grppresta3:
name: 'Marché de test' name: 'Marché de test'
type: 'marche' type: 'marche'
horaires: 'Tous les Dimanches de 8h à 12h' horaires: 'Tous les Dimanches de 8h à 12h'
groupe: '@groupe1'
grppresta4: grppresta4:
name: 'Marché de test 2' name: 'Marché de test 2'
type: 'marche' type: 'marche'
horaires: 'Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h' horaires: 'Tous les 1er Dimanches du mois de 8h à 12h et de 18h à 20h'
groupe: '@groupe<numberBetween(1,10)>'
App\Entity\Adherent: App\Entity\Adherent:
adherent{1..11}: adherent{1..11}:
...@@ -181,13 +240,6 @@ App\Entity\User: ...@@ -181,13 +240,6 @@ App\Entity\User:
enabled: true enabled: true
groups: ['@usergroup_superadmin'] groups: ['@usergroup_superadmin']
roles: ['ROLE_SUPER_ADMIN'] roles: ['ROLE_SUPER_ADMIN']
useradmin:
username: 'user_admin'
email: 'admin@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_admin']
roles: ['ROLE_ADMIN']
usercontact: usercontact:
username: 'user_contact' username: 'user_contact'
email: 'contact@doume.test' email: 'contact@doume.test'
...@@ -195,6 +247,7 @@ App\Entity\User: ...@@ -195,6 +247,7 @@ App\Entity\User:
enabled: true enabled: true
groups: ['@usergroup_contact'] groups: ['@usergroup_contact']
roles: ['ROLE_CONTACT'] roles: ['ROLE_CONTACT']
groupesgere: '@groupe1'
usercomptoir: usercomptoir:
username: 'user_comptoir' username: 'user_comptoir'
email: 'comptoir@doume.test' email: 'comptoir@doume.test'
...@@ -202,7 +255,7 @@ App\Entity\User: ...@@ -202,7 +255,7 @@ App\Entity\User:
enabled: true enabled: true
groups: ['@usergroup_comptoir'] groups: ['@usergroup_comptoir']
roles: ['ROLE_COMPTOIR'] roles: ['ROLE_COMPTOIR']
gestionnaireComptoir: '@comptoir1' comptoirsgere: '@comptoir1'
usergestiongroupe: usergestiongroupe:
username: 'user_gestiongroupe' username: 'user_gestiongroupe'
email: 'groupe@doume.test' email: 'groupe@doume.test'
...@@ -210,7 +263,7 @@ App\Entity\User: ...@@ -210,7 +263,7 @@ App\Entity\User:
enabled: true enabled: true
groups: ['@usergroup_gestiongroupe'] groups: ['@usergroup_gestiongroupe']
roles: ['ROLE_GESTION_GROUPE'] roles: ['ROLE_GESTION_GROUPE']
gestionnaireGroupe: '@groupe1' groupesgere: '@groupe1'
usertresorier: usertresorier:
username: 'user_tresorier' username: 'user_tresorier'
email: 'tresorier@doume.test' email: 'tresorier@doume.test'
...@@ -225,6 +278,13 @@ App\Entity\User: ...@@ -225,6 +278,13 @@ App\Entity\User:
enabled: true enabled: true
groups: ['@usergroup_redacteur'] groups: ['@usergroup_redacteur']
roles: ['ROLE_REDACTEUR'] roles: ['ROLE_REDACTEUR']
usercontroleur:
username: 'user_controleur'
email: 'controleur@doume.test'
plainPassword: 'test'
enabled: true
groups: ['@usergroup_controleur']
roles: ['ROLE_CONTROLEUR']
useradminsiege: useradminsiege:
username: 'user_adminsiege' username: 'user_adminsiege'
email: 'siege@doume.test' email: 'siege@doume.test'
...@@ -280,6 +340,17 @@ App\Entity\TransactionAdherentPrestataire: ...@@ -280,6 +340,17 @@ App\Entity\TransactionAdherentPrestataire:
destinataire: '@prestataire<current()>' destinataire: '@prestataire<current()>'
createdAt: '<dateTimeBetween("-200 days", "now")>' createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction' parenttype: 'transaction'
App\Entity\TransactionAdherentAdherent:
tro_adh_adh{2..5}:
operateur: '@usera<current()>'
type: 'adherent_adherent'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2, 0,2)>'
expediteur: '@adherent<current()>'
destinataire: '@adherent<numberBetween(6, 11)>'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transaction'
App\Entity\TransactionPrestataireAdherent: App\Entity\TransactionPrestataireAdherent:
tro_pre_adh{2..11}: tro_pre_adh{2..11}:
operateur: '@userp<current()>' operateur: '@userp<current()>'
...@@ -357,6 +428,17 @@ App\Entity\TransfertPrestataireComptoir: ...@@ -357,6 +428,17 @@ App\Entity\TransfertPrestataireComptoir:
destinataire: '@comptoir<numberBetween(1,50)>' destinataire: '@comptoir<numberBetween(1,50)>'
createdAt: '<dateTimeBetween("-200 days", "now")>' createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert' parenttype: 'transfert'
App\Entity\TransfertPrestataireSiege:
tre_pre_cpt{2..11}:
operateur: '@userp<current()>'
type: 'prestataire_siege'
reference: 'test'
moyen: 'cb'
montant: '<randomFloat(2, 0,2)>'
expediteur: '@prestataire<current()>'
destinataire: '@siege_1'
createdAt: '<dateTimeBetween("-200 days", "now")>'
parenttype: 'transfert'
App\Entity\TransfertSiegeGroupe: App\Entity\TransfertSiegeGroupe:
tre_sie_grp{1..10}: tre_sie_grp{1..10}:
operateur: '@useradminsiege' operateur: '@useradminsiege'
...@@ -390,14 +472,14 @@ Prodigious\Sonata\MenuBundle\Entity\MenuItem: ...@@ -390,14 +472,14 @@ Prodigious\Sonata\MenuBundle\Entity\MenuItem:
position: 0 position: 0
target: 0 target: 0
enabled: 1 enabled: 1
menuitem3: # menuitem3:
menu: '@menu_main' # menu: '@menu_main'
name: 'Charte' # name: 'Charte'
parent: '@menuitem1' # parent: '@menuitem1'
url: '/charte' # url: '/page/charte'
position: 1 # position: 1
target: 0 # target: 0
enabled: 1 # enabled: 1
menuitem4: menuitem4:
menu: '@menu_main' menu: '@menu_main'
name: 'Professionnels' name: 'Professionnels'
......
...@@ -55,6 +55,31 @@ class AdherentAdmin extends AbstractAdmin ...@@ -55,6 +55,31 @@ class AdherentAdmin extends AbstractAdmin
parent::configure(); parent::configure();
} }
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$user = $this->tokenStorage->getToken()->getUser();
$query = parent::createQuery($context);
$query
->innerJoin($query->getRootAliases()[0] .'.user', 'u')
->addSelect('u')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$query
->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupe)
;
}
}
return $query;
}
protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
{ {
if (!$childAdmin && !in_array($action, ['edit', 'show'])) { if (!$childAdmin && !in_array($action, ['edit', 'show'])) {
...@@ -137,6 +162,7 @@ class AdherentAdmin extends AbstractAdmin ...@@ -137,6 +162,7 @@ class AdherentAdmin extends AbstractAdmin
)) ))
->end() ->end()
->with('Cotisation', ['class' => 'col-md-5']) ->with('Cotisation', ['class' => 'col-md-5'])
//@TODO : géré une ou plusieurs cotisations
->add('user.cotisations.first.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y'))) ->add('user.cotisations.first.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
->add('user.cotisations.first.montant', TextType::class, array('label' => 'Montant')) ->add('user.cotisations.first.montant', TextType::class, array('label' => 'Montant'))
->add('user.cotisations.first.moyen', ChoiceType::class, array( ->add('user.cotisations.first.moyen', ChoiceType::class, array(
...@@ -147,7 +173,7 @@ class AdherentAdmin extends AbstractAdmin ...@@ -147,7 +173,7 @@ class AdherentAdmin extends AbstractAdmin
return MoyenEnum::getTypeName($choice); return MoyenEnum::getTypeName($choice);
}, },
)); ));
if ($this->tokenStorage->getToken()->getUser()->isGranted('ROLE_TRESORIER') ) { if ($this->tokenStorage->getToken()->getUser()->isGranted('ROLE_TRESORIER')) {
$formMapper $formMapper
->add('user.cotisations.first.cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu')); ->add('user.cotisations.first.cotisationInfos.recu', CheckboxType::class, array('label' => 'Reçu'));
} }
...@@ -293,23 +319,4 @@ class AdherentAdmin extends AbstractAdmin ...@@ -293,23 +319,4 @@ class AdherentAdmin extends AbstractAdmin
return $actions; return $actions;
} }
/**
* {@inheritdoc}
*/
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$query->innerJoin($query->getRootAliases()[0] .'.user', 'u')
->addSelect('u');
// $role = 'ROLE_ADHERENT';
// // $query->andWhere($query->getRootAliases()[0] . '.adherent IS NOT NULL');
// $query->leftJoin($query->getRootAliases()[0] . '.groups', 'g')
// ->where($query->expr()->orX(
// $query->expr()->like($query->getRootAliases()[0] . '.roles', ':roles'),
// $query->expr()->like('g.roles', ':roles')
// ))
// ->setParameter('roles', '%"'.$role.'"%');
return $query;
}
} }
...@@ -11,19 +11,40 @@ use Sonata\AdminBundle\Form\FormMapper; ...@@ -11,19 +11,40 @@ use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class ComptoirAdmin extends AbstractAdmin class ComptoirAdmin extends AbstractAdmin
{ {
protected $tokenStorage;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'ASC', '_sort_order' => 'ASC',
'_sort_by' => 'name', '_sort_by' => 'name',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function configureShowFields(ShowMapper $showMapper) public function createQuery($context = 'list')
{ {
$query = parent::createQuery($context);
$user = $this->tokenStorage->getToken()->getUser();
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$query
->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupe)
;
}
}
return $query;
} }
/** /**
...@@ -89,9 +110,10 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -89,9 +110,10 @@ class ComptoirAdmin extends AbstractAdmin
$listMapper $listMapper
->addIdentifier('name') ->addIdentifier('name')
->addIdentifier('email') ->addIdentifier('email')
->addIdentifier('compte', null, array('label' => 'Solde'))
->addIdentifier('geoloc.adresse') ->addIdentifier('geoloc.adresse')
->addIdentifier('tel') ->addIdentifier('tel')
->addIdentifier('updatedAt') ->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.Comptoir', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
; ;
} }
} }
...@@ -13,15 +13,37 @@ class CotisationAdherentAdmin extends CotisationAdmin ...@@ -13,15 +13,37 @@ class CotisationAdherentAdmin extends CotisationAdmin
protected $baseRouteName = 'cotisation_adherent'; protected $baseRouteName = 'cotisation_adherent';
protected $baseRoutePattern = 'cotisation_adherent'; protected $baseRoutePattern = 'cotisation_adherent';
public function configure()
{
parent::configure();
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u') $query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u')
->andWhere('u.adherent IS NOT NULL') ->andWhere('u.adherent IS NOT NULL')
; ;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN adherent a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
return $query; return $query;
} }
......
...@@ -18,10 +18,27 @@ class CotisationPrestataireAdmin extends CotisationAdmin ...@@ -18,10 +18,27 @@ class CotisationPrestataireAdmin extends CotisationAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u') $query->leftJoin($query->getRootAliases()[0] . '.operateur', 'u')
->andWhere('u.prestataire IS NOT NULL') ->andWhere('u.prestataire IS NOT NULL')
; ;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN prestataire a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
return $query; return $query;
} }
......
...@@ -11,11 +11,13 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType; ...@@ -11,11 +11,13 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
class FluxAdmin extends AbstractAdmin class FluxAdmin extends AbstractAdmin
{ {
protected $translator; protected $translator;
protected $tokenStorage;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
'_sort_by' => 'createdAt', '_sort_by' => 'createdAt',
...@@ -26,6 +28,11 @@ class FluxAdmin extends AbstractAdmin ...@@ -26,6 +28,11 @@ class FluxAdmin extends AbstractAdmin
$this->translator = $translator; $this->translator = $translator;
} }
public function setTokenStorage(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -123,8 +130,8 @@ class FluxAdmin extends AbstractAdmin ...@@ -123,8 +130,8 @@ class FluxAdmin extends AbstractAdmin
{ {
unset($this->listModes['mosaic']); unset($this->listModes['mosaic']);
$listMapper $listMapper
->addIdentifier('type', null, array('label' => 'Type'))
->addIdentifier('createdAt', null, array('label' => 'Date')) ->addIdentifier('createdAt', null, array('label' => 'Date'))
->addIdentifier('type', null, array('label' => 'Type'))
->addIdentifier('operateur', User::class, array('label' => 'Operateur')) ->addIdentifier('operateur', User::class, array('label' => 'Operateur'))
->addIdentifier('expediteur', null, array('label' => 'Expediteur')) ->addIdentifier('expediteur', null, array('label' => 'Expediteur'))
->addIdentifier('destinataire', null, array('label' => 'Destinataire')) ->addIdentifier('destinataire', null, array('label' => 'Destinataire'))
......
...@@ -100,6 +100,7 @@ class GroupeAdmin extends AbstractAdmin ...@@ -100,6 +100,7 @@ class GroupeAdmin extends AbstractAdmin
$listMapper $listMapper
->addIdentifier('name', null, array('label' => 'Nom du groupe')) ->addIdentifier('name', null, array('label' => 'Nom du groupe'))
->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description')) ->addIdentifier('content', 'html', array('truncate' => array('length' => 80), 'label' => 'Description'))
->addIdentifier('compte', null, array('label' => 'Solde'))
->add( ->add(
'getPrestatairesCount', 'getPrestatairesCount',
null, null,
......
...@@ -11,9 +11,11 @@ use Sonata\AdminBundle\Show\ShowMapper; ...@@ -11,9 +11,11 @@ use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class GroupeprestataireAdmin extends AbstractAdmin class GroupeprestataireAdmin extends AbstractAdmin
{ {
protected $tokenStorage;
protected $datagridValues = [ protected $datagridValues = [
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
...@@ -21,12 +23,37 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -21,12 +23,37 @@ class GroupeprestataireAdmin extends AbstractAdmin
'_sort_by' => 'updatedAt', '_sort_by' => 'updatedAt',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function configureShowFields(ShowMapper $showMapper) public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser();
$query = parent::createQuery($context);
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f INNER JOIN adherent a ON (a.id = f.prestataire_id OR a.id = f.prestataire_dest_id) WHERE a.groupe_id = '.$groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
} }
}
return $query;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -29,12 +29,13 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -29,12 +29,13 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class PrestataireAdmin extends AbstractAdmin class PrestataireAdmin extends AbstractAdmin
{ {
protected $baseRouteName = 'prestataire'; protected $baseRouteName = 'prestataire';
protected $baseRoutePattern = 'prestataire'; protected $baseRoutePattern = 'prestataire';
protected $tokenStorage;
protected $datagridValues = [ protected $datagridValues = [
// reverse order (default = 'ASC') // reverse order (default = 'ASC')
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
...@@ -44,6 +45,11 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -44,6 +45,11 @@ class PrestataireAdmin extends AbstractAdmin
// '_per_page' => 32 // '_per_page' => 32
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function configure() public function configure()
{ {
parent::configure(); parent::configure();
...@@ -133,7 +139,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -133,7 +139,7 @@ class PrestataireAdmin extends AbstractAdmin
$formMapper $formMapper
->add('user.phone', TextType::class, array( ->add('user.phone', TextType::class, array(
'label' => 'Téléphone :', 'label' => 'Téléphone :',
'required' => true 'required' => false
)) ))
->add('user.email', TextType::class, array( ->add('user.email', TextType::class, array(
'label' => 'Email :', 'label' => 'Email :',
...@@ -147,6 +153,7 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -147,6 +153,7 @@ class PrestataireAdmin extends AbstractAdmin
'placeholder' => 'Choisir un groupe', 'placeholder' => 'Choisir un groupe',
)) ))
->end() ->end()
//@TODO : cotisationS
->with('Cotisation', ['class' => 'col-md-5']) ->with('Cotisation', ['class' => 'col-md-5'])
->add('user.cotisations.first.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y'))) ->add('user.cotisations.first.cotisationInfos.annee', TextType::class, array('label' => 'Année', 'data' => $now->format('Y')))
->add('user.cotisations.first.montant', TextType::class, array('label' => 'Montant')) ->add('user.cotisations.first.montant', TextType::class, array('label' => 'Montant'))
...@@ -341,10 +348,23 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -341,10 +348,23 @@ class PrestataireAdmin extends AbstractAdmin
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
// $query->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true); $query
$query->innerJoin($query->getRootAliases()[0] .'.user', 'u') ->innerJoin($query->getRootAliases()[0] .'.user', 'u')
->addSelect('u'); ->addSelect('u')
;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$query
->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $groupe)
;
}
}
return $query; return $query;
} }
} }
...@@ -12,25 +12,64 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType; ...@@ -12,25 +12,64 @@ use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Route\RouteCollection; use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SChoiceType;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
class TransfertAdmin extends FluxAdmin class TransfertAdmin extends FluxAdmin
{ {
protected $translator; protected $tokenStorage;
protected $datagridValues = [ protected $datagridValues = [
'_sort_order' => 'DESC', '_sort_order' => 'DESC',
'_sort_by' => 'createdAt', '_sort_by' => 'createdAt',
]; ];
public function setTokenStorage(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function createQuery($context = 'list') public function createQuery($context = 'list')
{ {
$user = $this->tokenStorage->getToken()->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
$query->andWhere($query->getRootAliases()[0].".parenttype = :type") $query->andWhere($query->getRootAliases()[0].".parenttype = :type")
->setParameter('type', 'transfert'); ->setParameter('type', 'transfert');
; ;
if ($user->isGranted('ROLE_GESTION_GROUPE') || $user->isGranted('ROLE_CONTACT')) {
if (empty($user->getGroupesgere())) {
$query->andWhere('false');
} else {
$groupe = $user->getGroupesgere();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f WHERE f.groupe_id = '.$groupe->getId().' OR (f.type = \'prestataire_siege\' AND f.prestataire_id IN (SELECT p.id FROM prestataire p WHERE p.groupe_id = '.$groupe->getId().'))');
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
if ($user->isGranted('ROLE_COMPTOIR')) {
if (empty($user->getComptoirsgere())) {
$query->andWhere('false');
} else {
$comptoir = $user->getComptoirsgere();
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager();
$connection = $em->getConnection();
$statement = $connection->prepare('SELECT f.id FROM flux f WHERE f.comptoir_id = '.$comptoir->getId().' OR f.user_id = '.$user->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0].'.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
return $query; return $query;
} }
......
...@@ -33,4 +33,11 @@ class GroupAdmin extends BaseGroupAdmin ...@@ -33,4 +33,11 @@ class GroupAdmin extends BaseGroupAdmin
return $actions; return $actions;
} }
public function getDashboardActions()
{
$actions = parent::getDashboardActions();
unset($actions['list']);
return $actions;
}
} }
...@@ -13,6 +13,7 @@ declare(strict_types=1); ...@@ -13,6 +13,7 @@ declare(strict_types=1);
namespace App\Application\Sonata\UserBundle\Admin; namespace App\Application\Sonata\UserBundle\Admin;
use App\Entity\User;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use Sonata\AdminBundle\Admin\AbstractAdmin; use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\DatagridMapper;
...@@ -21,6 +22,7 @@ use Sonata\AdminBundle\Form\FormMapper; ...@@ -21,6 +22,7 @@ use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\ModelType; use Sonata\AdminBundle\Form\Type\ModelType;
use Sonata\AdminBundle\Show\ShowMapper; use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\CoreBundle\Form\Type\DatePickerType; use Sonata\CoreBundle\Form\Type\DatePickerType;
use Sonata\UserBundle\Admin\Model\UserAdmin as BaseUserAdmin;
use Sonata\UserBundle\Form\Type\SecurityRolesType; use Sonata\UserBundle\Form\Type\SecurityRolesType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\LocaleType; use Symfony\Component\Form\Extension\Core\Type\LocaleType;
...@@ -28,7 +30,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; ...@@ -28,7 +30,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TimezoneType; use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormTypeInterface; use Symfony\Component\Form\FormTypeInterface;
use Sonata\UserBundle\Admin\Model\UserAdmin as BaseUserAdmin;
class UserAdmin extends BaseUserAdmin class UserAdmin extends BaseUserAdmin
{ {
...@@ -37,6 +38,7 @@ class UserAdmin extends BaseUserAdmin ...@@ -37,6 +38,7 @@ class UserAdmin extends BaseUserAdmin
parent::configure(); parent::configure();
$this->setTemplate('edit', '@SonataAdmin/base_edit.html.twig'); $this->setTemplate('edit', '@SonataAdmin/base_edit.html.twig');
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -46,7 +48,7 @@ class UserAdmin extends BaseUserAdmin ...@@ -46,7 +48,7 @@ class UserAdmin extends BaseUserAdmin
->addIdentifier('username') ->addIdentifier('username')
->add('email') ->add('email')
->add('groups') ->add('groups')
->add('enabled', null, ['editable' => true]) ->addIdentifier('enabled', null, array('label' => 'Activé', 'datatype' => 'App.User', 'template' => '@SonataAdmin/Boolean/editable_boolean.html.twig'))
->add('createdAt') ->add('createdAt')
; ;
...@@ -102,10 +104,10 @@ class UserAdmin extends BaseUserAdmin ...@@ -102,10 +104,10 @@ class UserAdmin extends BaseUserAdmin
// ->add('gplusUid') // ->add('gplusUid')
// ->add('gplusName') // ->add('gplusName')
// ->end() // ->end()
->with('Security') // ->with('Security')
->add('token') // ->add('token')
->add('twoStepVerificationCode') // ->add('twoStepVerificationCode')
->end() // ->end()
; ;
} }
...@@ -121,16 +123,17 @@ class UserAdmin extends BaseUserAdmin ...@@ -121,16 +123,17 @@ class UserAdmin extends BaseUserAdmin
->with('Profile', ['class' => 'col-md-6'])->end() ->with('Profile', ['class' => 'col-md-6'])->end()
->with('General', ['class' => 'col-md-6'])->end() ->with('General', ['class' => 'col-md-6'])->end()
// ->with('Social', ['class' => 'col-md-6'])->end() // ->with('Social', ['class' => 'col-md-6'])->end()
->end() ->end();
->tab('Security');
if (!($subject->isGranted('ROLE_SUPER_ADMIN') || $subject->isGranted('ROLE_ADMIN_SIEGE'))) { if (!($subject->isGranted('ROLE_SUPER_ADMIN') || $subject->isGranted('ROLE_ADMIN_SIEGE'))) {
$formMapper->with('Groups', ['class' => 'col-md-8'])->end(); $formMapper
} ->tab('Security')
$formMapper->with('Status', ['class' => 'col-md-4'])->end() ->with('Groups', ['class' => 'col-md-8'])->end()
->with('Status', ['class' => 'col-md-4'])->end()
// ->with('Keys', ['class' => 'col-md-4'])->end() // ->with('Keys', ['class' => 'col-md-4'])->end()
// ->with('Roles', ['class' => 'col-md-12'])->end() // ->with('Roles', ['class' => 'col-md-12'])->end()
->end() ->end()
; ;
}
$now = new \DateTime(); $now = new \DateTime();
...@@ -179,18 +182,20 @@ class UserAdmin extends BaseUserAdmin ...@@ -179,18 +182,20 @@ class UserAdmin extends BaseUserAdmin
// ->add('gplusUid', null, ['required' => false]) // ->add('gplusUid', null, ['required' => false])
// ->add('gplusName', null, ['required' => false]) // ->add('gplusName', null, ['required' => false])
// ->end() // ->end()
->end() ->end();
if (!($subject->isGranted('ROLE_SUPER_ADMIN') || $subject->isGranted('ROLE_ADMIN_SIEGE'))) {
$formMapper
->tab('Security') ->tab('Security')
->with('Status') ->with('Status')
->add('enabled', null, ['required' => false]) ->add('enabled', null, ['required' => false])
->end(); ->end()
if (!($subject->isGranted('ROLE_SUPER_ADMIN') || $subject->isGranted('ROLE_ADMIN_SIEGE'))) { ;
$hideOrShowGroupe = ['class' => 'hide']; $hideOrShowGroupe = ['class' => 'hide'];
$hideOrShowComptoir = ['class' => 'hide']; $hideOrShowComptoir = ['class' => 'hide'];
if ($subject->isGranted('ROLE_GESTION_GROUPE') && !empty($subject->getGestionnaireGroupe())) { if (($subject->isGranted('ROLE_GESTION_GROUPE') || $subject->isGranted('ROLE_CONTACT')) && !empty($subject->getGroupesgere())) {
$hideOrShowGroupe = []; $hideOrShowGroupe = [];
} }
if ($subject->isGranted('ROLE_COMPTOIR') && !empty($subject->getGestionnaireComptoir())) { if ($subject->isGranted('ROLE_COMPTOIR') && !empty($subject->getComptoirsgere())) {
$hideOrShowComptoir = []; $hideOrShowComptoir = [];
} }
$formMapper->with('Groups') $formMapper->with('Groups')
...@@ -199,19 +204,20 @@ class UserAdmin extends BaseUserAdmin ...@@ -199,19 +204,20 @@ class UserAdmin extends BaseUserAdmin
'expanded' => true, 'expanded' => true,
'multiple' => true, 'multiple' => true,
]) ])
->add('gestionnaireGroupe', null, [ ->add('groupesgere', null, [
'required' => false, 'required' => false,
'label' => 'Groupe local géré (obligatoire)', 'label' => 'Groupe local géré (obligatoire)',
'attr' => $hideOrShowGroupe, 'attr' => $hideOrShowGroupe,
'label_attr' => $hideOrShowGroupe, 'label_attr' => $hideOrShowGroupe,
]) ])
->add('gestionnaireComptoir', null, [ ->add('comptoirsgere', null, [
'required' => false, 'required' => false,
'label' => 'Comptoir géré (obligatoire)', 'label' => 'Comptoir géré (obligatoire)',
'attr' => $hideOrShowComptoir, 'attr' => $hideOrShowComptoir,
'label_attr' => $hideOrShowComptoir, 'label_attr' => $hideOrShowComptoir,
]) ])
->end(); ->end();
$formMapper->end();
} }
// ->with('Roles') // ->with('Roles')
// ->add('realRoles', SecurityRolesType::class, [ // ->add('realRoles', SecurityRolesType::class, [
...@@ -225,7 +231,6 @@ class UserAdmin extends BaseUserAdmin ...@@ -225,7 +231,6 @@ class UserAdmin extends BaseUserAdmin
// ->add('token', null, ['required' => false]) // ->add('token', null, ['required' => false])
// ->add('twoStepVerificationCode', null, ['required' => false]) // ->add('twoStepVerificationCode', null, ['required' => false])
// ->end() // ->end()
$formMapper->end();
} }
public function getBatchActions() public function getBatchActions()
...@@ -242,4 +247,18 @@ class UserAdmin extends BaseUserAdmin ...@@ -242,4 +247,18 @@ class UserAdmin extends BaseUserAdmin
unset($actions['list']); unset($actions['list']);
return $actions; return $actions;
} }
public function preUpdate($user): void
{
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
/* ON EMPECHE ICI DE DESACTIVER LES ROLES SUPER ADMIN OU ADMIN SIEGE */
if ($user->hasRole('ROLE_SUPER_ADMIN') || $user->hasRole('ROLE_ADMIN_SIEGE')) {
if (!$user->isEnabled()) {
$user->setEnabled(1);
$em->persist($user);
$em->flush();
}
}
}
} }
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\Faq; use App\Entity\Faq;
use App\Entity\Page;
use App\Entity\User; use App\Entity\User;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Form\Type\AdhererFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentPrestataireFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Geocoder\Provider\Nominatim\Nominatim; use Geocoder\Provider\Nominatim\Nominatim;
...@@ -95,18 +97,24 @@ class IndexController extends AbstractController ...@@ -95,18 +97,24 @@ class IndexController extends AbstractController
{ {
$request->getSession()->remove('_choixGroup'); $request->getSession()->remove('_choixGroup');
// On enregistre le rôle choisit en session // On enregistre le rôle choisit en session
$request->getSession()->set('_groupId', $group->getId()); $request->getSession()->set('_groupId', $group);
// @TODO : On redirige sur l'index (ou en fonction du rôle?) // @TODO : On redirige sur l'index (ou en fonction du rôle?)
return $this->redirectToRoute('index'); return $this->redirectToRoute('index');
} }
/** /**
* @Route("/charte", name="charte") * @Route("/page/{slug}", name="show_page")
*/ */
public function charteAction() public function pageAction(Page $page)
{ {
return $this->render('charte.html.twig'); $template = 'page.html.twig';
if (!empty($page->getTemplate()) && $this->get('templating')->exists($page->getTemplate())) {
$template = $page->getTemplate();
}
return $this->render($template, array(
'page' => $page
));
} }
/** /**
......
<?php <?php
namespace App\Controller\Rest; namespace App\Controller\Rest;
use App\Controller\ExceptionFOSRestController; use App\Controller\ExceptionFOSRestController;
...@@ -36,7 +35,7 @@ class FluxController extends ExceptionFOSRestController ...@@ -36,7 +35,7 @@ class FluxController extends ExceptionFOSRestController
/** /**
* Transfert du siège au groupe * Transfert du siège au groupe
* *
* @Route("/api/tr_sie_grp/", methods={"GET"}) * @Route("/transfert/siege/groupe/{}", methods={"GET"})
* @SWG\Response( * @SWG\Response(
* response=200, * response=200,
* description="Transfert du siège au groupe", * description="Transfert du siège au groupe",
......
...@@ -5,11 +5,11 @@ namespace App\Controller; ...@@ -5,11 +5,11 @@ namespace App\Controller;
use App\Entity\Adherent; use App\Entity\Adherent;
use App\Entity\Cotisation; use App\Entity\Cotisation;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\TransactionAdherentPrestataire; use App\Entity\TransactionAdherentAdherent;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Form\Type\AdherentInfosFormType; use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\AdhererFormType; use App\Form\Type\AdhererFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentAdherentFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
...@@ -80,4 +80,42 @@ class UserAdherentController extends AbstractController ...@@ -80,4 +80,42 @@ class UserAdherentController extends AbstractController
'title' => 'Transaction à un prestataire' 'title' => 'Transaction à un prestataire'
]); ]);
} }
/**
* @Route("/adherent/transaction/adherent/", name="transactionAdherentAdherent")
* @IsGranted("ROLE_ADHERENT")
*/
public function transactionAdherentAdherentAction(Request $request)
{
if (empty($this->getUser()) || empty($this->getUser()->getAdherent())) {
return $this->redirectToRoute('index');
}
$entity = new TransactionAdherentAdherent();
$entity->setOperateur($this->getUser());
$entity->setExpediteur($this->getUser()->getAdherent());
$form = $this->createForm(TransactionAdherentAdherentFormType::class, $entity);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
$this->em->persist($data);
$this->em->flush();
$this->addFlash(
'success',
'Transaction bien effectuée !'
);
$referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) {
return $this->redirect($referer);
} elseif (!$request->isXmlHttpRequest()) {
return new Response('', Response::HTTP_BAD_REQUEST);
}
}
return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(),
'compte' => $this->getUser()->getAdherent()->getCompte(),
'title' => 'Transaction à un adhérent'
]);
}
} }
...@@ -6,10 +6,12 @@ use App\Entity\Adherent; ...@@ -6,10 +6,12 @@ use App\Entity\Adherent;
use App\Entity\Cotisation; use App\Entity\Cotisation;
use App\Entity\Geoloc; use App\Entity\Geoloc;
use App\Entity\TransactionAdherentPrestataire; use App\Entity\TransactionAdherentPrestataire;
use App\Entity\TransfertGroupeComptoir;
use App\Entity\Usergroup; use App\Entity\Usergroup;
use App\Form\Type\AdherentInfosFormType; use App\Form\Type\AdherentInfosFormType;
use App\Form\Type\AdhererFormType; use App\Form\Type\AdhererFormType;
use App\Form\Type\TransactionAdherentPrestataireFormType; use App\Form\Type\TransactionAdherentPrestataireFormType;
use App\Form\Type\TransfertGroupeComptoirFormType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserManagerInterface; use FOS\UserBundle\Model\UserManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
...@@ -30,10 +32,10 @@ class UserGestionnaireGroupeController extends AbstractController ...@@ -30,10 +32,10 @@ class UserGestionnaireGroupeController extends AbstractController
} }
/** /**
* @Route("/egroupe/infos", name="groupe_infos") * @Route("/groupe/infos", name="groupe_infos")
* @IsGranted("ROLE_ADHERENT") * @IsGranted("ROLE_ADHERENT")
*/ */
public function adherentInfosAction(Request $request) public function groupeInfosAction(Request $request)
{ {
// $form = $this->createForm(AdherentInfosFormType::class, $this->getUser()->getAdherent()); // $form = $this->createForm(AdherentInfosFormType::class, $this->getUser()->getAdherent());
// $form->handleRequest($request); // $form->handleRequest($request);
...@@ -48,14 +50,14 @@ class UserGestionnaireGroupeController extends AbstractController ...@@ -48,14 +50,14 @@ class UserGestionnaireGroupeController extends AbstractController
} }
/** /**
* @Route("/adherent/transaction/prestataire/", name="transactionAdherentPrestataire") * @Route("/groupe/transfert/comptoir/", name="transfertGroupeComptoir")
* @IsGranted("ROLE_ADHERENT") * @IsGranted("ROLE_GESTION_GROUPE")
*/ */
public function transactionAdherentPrestataireAction(Request $request) public function transfertGroupeComptoirAction(Request $request)
{ {
$entity = new TransactionAdherentPrestataire(); $entity = new TransfertGroupeComptoir();
$entity->setOperateur($this->getUser()); $entity->setOperateur($this->getUser());
$form = $this->createForm(TransactionAdherentPrestataireFormType::class, $entity); $form = $this->createForm(TransfertGroupeComptoirFormType::class, $entity);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
...@@ -64,7 +66,7 @@ class UserGestionnaireGroupeController extends AbstractController ...@@ -64,7 +66,7 @@ class UserGestionnaireGroupeController extends AbstractController
$this->em->flush(); $this->em->flush();
$this->addFlash( $this->addFlash(
'success', 'success',
'Transaction bien effectuée !' 'Transfert bien effectuée !'
); );
$referer = $request->headers->get('referer'); $referer = $request->headers->get('referer');
if ($referer && !$request->isXmlHttpRequest()) { if ($referer && !$request->isXmlHttpRequest()) {
...@@ -76,8 +78,8 @@ class UserGestionnaireGroupeController extends AbstractController ...@@ -76,8 +78,8 @@ class UserGestionnaireGroupeController extends AbstractController
return $this->render('flux/transaction.html.twig', [ return $this->render('flux/transaction.html.twig', [
'form' => $form->createView(), 'form' => $form->createView(),
'compte' => $this->getUser()->getAdherent()->getCompte(), 'compte' => $this->getUser()->getGroupesgere()->getCompte(),
'title' => 'Transaction à un prestataire' 'title' => 'Transfert à un comptoir'
]); ]);
} }
} }
<?php
namespace App\Entity;
use App\Entity\EntityTrait\NameSlugContentEntityTrait;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="charte")
*/
class Charte
{
use NameSlugContentEntityTrait;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/**
* @var \Application\Sonata\MediaBundle\Entity\Media
* @Assert\NotBlank()
* @ORM\ManyToOne(targetEntity="App\Application\Sonata\MediaBundle\Entity\Media", cascade={"persist"}, fetch="LAZY")
* @ORM\JoinColumn(name="media_id", referencedColumnName="id")
*/
protected $media;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $text;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* Get media
* @return
*/
public function getMedia()
{
return $this->media;
}
/**
* Set media
* @return $this
*/
public function setMedia($media)
{
$this->media = $media;
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function __toString(): string
{
return $this->getTitle()?$this->getTitle():'Charte';
}
}
...@@ -53,7 +53,7 @@ class Comptoir ...@@ -53,7 +53,7 @@ class Comptoir
/** /**
* @var ArrayCollection|User[] * @var ArrayCollection|User[]
* @ORM\OneToMany(targetEntity="User", mappedBy="gestionnaireComptoir", fetch="EXTRA_LAZY") * @ORM\OneToMany(targetEntity="User", mappedBy="comptoirsgere", fetch="EXTRA_LAZY")
*/ */
private $gestionnaires; private $gestionnaires;
......
...@@ -10,12 +10,12 @@ use Gedmo\Timestampable\Traits\TimestampableEntity; ...@@ -10,12 +10,12 @@ use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** /**
* FLUX = TRANSFERT ou TRANSACTION * FLUX = TRANSFERT ou TRANSACTION ou COTISATIONS
* @ORM\Entity(repositoryClass="App\Repository\FluxRepository") * @ORM\Entity(repositoryClass="App\Repository\FluxRepository")
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* @ORM\InheritanceType("SINGLE_TABLE") * @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\DiscriminatorColumn(name="discr", type="string")
* @ORM\DiscriminatorMap({"cotisation" = "Cotisation", "cotisation_adherent" = "CotisationAdherent", "cotisation_prestataire" = "CotisationPrestataire", "tro_adh_pre" = "TransactionAdherentPrestataire", "tro_pre_adh" = "TransactionPrestataireAdherent", "tro_pre_pre" = "TransactionPrestatairePrestataire", "tre_cpt_adh" = "TransfertComptoirAdherent", "tre_cpt_grp" = "TransfertComptoirGroupe", "tre_cpt_pre" = "TransfertComptoirPrestataire", "tre_grp_cpt" = "TransfertGroupeComptoir", "tre_pre_cpt" = "TransfertPrestataireComptoir", "tre_sie_grp" = "TransfertSiegeGroupe"}) * @ORM\DiscriminatorMap({"cotisation" = "Cotisation", "cotisation_adherent" = "CotisationAdherent", "cotisation_prestataire" = "CotisationPrestataire", "tro_adh_pre" = "TransactionAdherentPrestataire", "tro_adh_adh" = "TransactionAdherentAdherent", "tro_pre_adh" = "TransactionPrestataireAdherent", "tro_pre_pre" = "TransactionPrestatairePrestataire", "tre_cpt_adh" = "TransfertComptoirAdherent", "tre_cpt_grp" = "TransfertComptoirGroupe", "tre_cpt_pre" = "TransfertComptoirPrestataire", "tre_grp_cpt" = "TransfertGroupeComptoir", "tre_pre_cpt" = "TransfertPrestataireComptoir", "tre_pre_sie" = "TransfertPrestataireSiege", "tre_sie_grp" = "TransfertSiegeGroupe"})
*/ */
abstract class Flux abstract class Flux
{ {
...@@ -242,9 +242,15 @@ abstract class Flux ...@@ -242,9 +242,15 @@ abstract class Flux
public function postPersist(LifecycleEventArgs $event) public function postPersist(LifecycleEventArgs $event)
{ {
$flux = $event->getEntity(); $flux = $event->getEntity();
if (empty($flux->getExpediteur())) {
throw new \Exception("[FLUX] Opération impossible ! Pas d'expéditeur !");
}
if ($flux->getMontant() <= 0) {
throw new \Exception("[FLUX] Opération impossible ! Montant inférieur ou égal à zéro !");
}
$compteExp = $flux->getExpediteur()->getCompte() - $flux->getMontant(); $compteExp = $flux->getExpediteur()->getCompte() - $flux->getMontant();
if ($compteExp < 0) { if ($compteExp < 0) {
throw new \Exception("Transaction adherent => prestataire : Opération impossible !"); throw new \Exception("[FLUX] Opération impossible ! Montant supérieur au solde de l'expéditeur !");
} else { } else {
$em = $event->getEntityManager(); $em = $event->getEntityManager();
$flux->getExpediteur()->setCompte($compteExp); $flux->getExpediteur()->setCompte($compteExp);
......
...@@ -54,6 +54,13 @@ class Groupe ...@@ -54,6 +54,13 @@ class Groupe
private $prestataires; private $prestataires;
/** /**
* @var ArrayCollection|Groupeprestataire[]
* @ORM\OneToMany(targetEntity="Groupeprestataire", mappedBy="groupe", fetch="EXTRA_LAZY")
* @ORM\OrderBy({"name": "ASC"})
*/
private $groupeprestataires;
/**
* @var ArrayCollection|Adherent[] * @var ArrayCollection|Adherent[]
* @ORM\OneToMany(targetEntity="Adherent", mappedBy="groupe", fetch="EXTRA_LAZY") * @ORM\OneToMany(targetEntity="Adherent", mappedBy="groupe", fetch="EXTRA_LAZY")
* @ORM\OrderBy({"updatedAt": "ASC"}) * @ORM\OrderBy({"updatedAt": "ASC"})
...@@ -62,7 +69,7 @@ class Groupe ...@@ -62,7 +69,7 @@ class Groupe
/** /**
* @var ArrayCollection|User[] * @var ArrayCollection|User[]
* @ORM\OneToMany(targetEntity="User", mappedBy="gestionnaireGroupe", fetch="EXTRA_LAZY") * @ORM\OneToMany(targetEntity="User", mappedBy="groupesgere", fetch="EXTRA_LAZY")
*/ */
private $gestionnaires; private $gestionnaires;
...@@ -71,6 +78,7 @@ class Groupe ...@@ -71,6 +78,7 @@ class Groupe
$this->comptoirs = new ArrayCollection(); $this->comptoirs = new ArrayCollection();
$this->prestataires = new ArrayCollection(); $this->prestataires = new ArrayCollection();
$this->adherents = new ArrayCollection(); $this->adherents = new ArrayCollection();
$this->groupeprestataires = new ArrayCollection();
} }
/** /**
...@@ -246,6 +254,40 @@ class Groupe ...@@ -246,6 +254,40 @@ class Groupe
return $this; return $this;
} }
/**
* @return Amap[]|ArrayCollection
*/
public function getGroupeprestataires()
{
return $this->groupeprestataires;
}
/**
* @param Amap $amap
* @return $this
*/
public function addGroupeprestataire(Groupeprestataire $groupeprestataire)
{
if (!$this->groupeprestataires->contains($groupeprestataire)) {
$this->groupeprestataires[] = $groupeprestataire;
$groupeprestataire->addGroupe($this);
}
return $this;
}
/**
* @param Amap $amap
* @return $this
*/
public function removeGroupeprestataire(Groupeprestataire $groupeprestataires)
{
if ($this->groupeprestataires->contains($groupeprestataire)) {
$this->groupeprestataires->removeElement($groupeprestataire);
$groupeprestataire->removeGroupe($this);
}
return $this;
}
public function getComptoirsCount() public function getComptoirsCount()
{ {
......
...@@ -62,6 +62,13 @@ class Groupeprestataire ...@@ -62,6 +62,13 @@ class Groupeprestataire
protected $prestataires; protected $prestataires;
/** /**
* @var Groupe $groupe
*
* @ORM\ManyToOne(targetEntity="Groupe", inversedBy="groupeprestataires")
*/
private $groupe;
/**
* @var null|string (champ libre) * @var null|string (champ libre)
* *
* @ORM\Column(name="horaires", type="string", length=255, nullable=true) * @ORM\Column(name="horaires", type="string", length=255, nullable=true)
...@@ -172,6 +179,24 @@ class Groupeprestataire ...@@ -172,6 +179,24 @@ class Groupeprestataire
return $this; return $this;
} }
/**
* @param null|Groupe $groupes
* @return $this
*/
public function setGroupe(?Groupe $groupe)
{
$this->groupe = $groupe;
return $this;
}
/**
* @return null|Groupe
*/
public function getGroupe(): ?Groupe
{
return $this->groupe;
}
public function getPrestatairesCount() public function getPrestatairesCount()
{ {
return $this->getPrestataires()->count(); return $this->getPrestataires()->count();
......
...@@ -52,9 +52,9 @@ class Page ...@@ -52,9 +52,9 @@ class Page
/** /**
* @var null|string * @var null|string
* *
* @ORM\Column(name="tag", type="string", length=255, nullable=true) * @ORM\Column(name="keywords", type="string", length=255, nullable=true)
*/ */
private $metaTags; private $metaKeywords;
/** /**
* @var null|string * @var null|string
...@@ -128,18 +128,18 @@ class Page ...@@ -128,18 +128,18 @@ class Page
/** /**
* @return null|string * @return null|string
*/ */
public function getMetaTags(): ?string public function getMetaKeywords(): ?string
{ {
return $this->metaTags; return $this->metaKeywords;
} }
/** /**
* @param null|string $metaTags * @param null|string $metaKeywords
* @return Page * @return Page
*/ */
public function setMetaTags(?string $metaTags) public function setMetaKeywords(?string $metaKeywords)
{ {
$this->metaTags = $metaTags; $this->metaKeywords = $metaKeywords;
return $this; return $this;
} }
......
...@@ -18,6 +18,7 @@ use Doctrine\ORM\Mapping as ORM; ...@@ -18,6 +18,7 @@ use Doctrine\ORM\Mapping as ORM;
* - PRESTATAIRES => ADHERENTS (Virement vers un adherent) * - PRESTATAIRES => ADHERENTS (Virement vers un adherent)
* - PRESTATAIRES => PRESTATAIRES (Virement entre prestataires) * - PRESTATAIRES => PRESTATAIRES (Virement entre prestataires)
* - ADHERENTS => PRESTATAIRES (Paiement numérique) * - ADHERENTS => PRESTATAIRES (Paiement numérique)
* - ADHERENTS => ADHERENTS (transfert de monnaie numérique)
* *
* @ORM\Entity * @ORM\Entity
*/ */
......
<?php
namespace App\Entity;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* TRANSACTION
* - ADHERENTS => ADHERENTS (transfert de monnaie numérique)
*
* @ORM\Entity
* @ORM\HasLifecycleCallbacks
*/
class TransactionAdherentAdherent extends Transaction
{
/**
* @ORM\OneToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_id", referencedColumnName="id", nullable=true)
* @Assert\NotBlank
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Adherent")
* @ORM\JoinColumn(name="adherent_dest_id", referencedColumnName="id", nullable=true)
* @Assert\NotBlank
*/
protected $destinataire;
/**
* @return string
*/
public function getType(): string
{
return 'adherent_adherent';
}
}
...@@ -6,7 +6,7 @@ use Doctrine\ORM\Mapping as ORM; ...@@ -6,7 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* TRANSFERT * TRANSFERT
* - PRESTATAIRES => COMPTOIRS (Reconversion) * - PRESTATAIRES => COMPTOIRS (dépôt de billet et chargement du compte numérique)
* *
* @ORM\Entity() * @ORM\Entity()
*/ */
......
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* TRANSFERT
* - PRESTATAIRES => SIEGE (Reconversion)
*
* @ORM\Entity()
*/
class TransfertPrestataireSiege extends Transfert
{
/**
* @ORM\OneToOne(targetEntity="Prestataire")
* @ORM\JoinColumn(name="prestataire_id", referencedColumnName="id", nullable=true)
*/
protected $expediteur;
/**
* @ORM\OneToOne(targetEntity="Siege")
* @ORM\JoinColumn(name="siege_id", referencedColumnName="id", nullable=true)
*/
protected $destinataire;
/**
* @return string
*/
public function getType(): string
{
return 'prestataire_siege';
}
}
...@@ -79,14 +79,16 @@ class User extends BaseUser ...@@ -79,14 +79,16 @@ class User extends BaseUser
private $emailTokens; private $emailTokens;
/** /**
* @TODO : changer en manytomany pour qu'un user puisse géré plusieurs groupes ?
* @ORM\ManyToOne(targetEntity="Groupe", inversedBy="gestionnaires", cascade={"all"}) * @ORM\ManyToOne(targetEntity="Groupe", inversedBy="gestionnaires", cascade={"all"})
*/ */
private $gestionnaireGroupe; private $groupesgere;
/** /**
* @TODO : changer en manytomany pour qu'un user puisse géré plusieurs comptoirs ?
* @ORM\ManyToOne(targetEntity="Comptoir", inversedBy="gestionnaires", cascade={"all"}) * @ORM\ManyToOne(targetEntity="Comptoir", inversedBy="gestionnaires", cascade={"all"})
*/ */
private $gestionnaireComptoir; private $comptoirsgere;
/** /**
* @ORM\Column(name="apiKey", type="string", length=255, nullable=true) * @ORM\Column(name="apiKey", type="string", length=255, nullable=true)
...@@ -315,39 +317,39 @@ class User extends BaseUser ...@@ -315,39 +317,39 @@ class User extends BaseUser
} }
/** /**
* @param null|Groupe $gestionnaireGroupe * @param null|Groupe $groupesgere
* @return $this * @return $this
*/ */
public function setGestionnaireGroupe(?Groupe $gestionnaireGroupe) public function setGroupesgere(?Groupe $groupesgere)
{ {
$this->gestionnaireGroupe = $gestionnaireGroupe; $this->groupesgere = $groupesgere;
return $this; return $this;
} }
/** /**
* @return null|Groupe * @return null|Groupe
*/ */
public function getGestionnaireGroupe(): ?Groupe public function getGroupesgere(): ?Groupe
{ {
return $this->gestionnaireGroupe; return $this->groupesgere;
} }
/** /**
* @param null|Comptoir $gestionnaireComptoir * @param null|Comptoir $comptoirsgere
* @return $this * @return $this
*/ */
public function setGestionnaireComptoir(?Comptoir $gestionnaireComptoir) public function setComptoirsgere(?Comptoir $comptoirsgere)
{ {
$this->gestionnaireComptoir = $gestionnaireComptoir; $this->comptoirsgere = $comptoirsgere;
return $this; return $this;
} }
/** /**
* @return null|Comptoir * @return null|Comptoir
*/ */
public function getGestionnaireComptoir(): ?Comptoir public function getComptoirsgere(): ?Comptoir
{ {
return $this->gestionnaireComptoir; return $this->comptoirsgere;
} }
public function createEmailToken() public function createEmailToken()
......
...@@ -8,14 +8,19 @@ abstract class MoyenEnum ...@@ -8,14 +8,19 @@ abstract class MoyenEnum
const MOYEN_ESPECE = "espece"; const MOYEN_ESPECE = "espece";
const MOYEN_CHEQUE = "cheque"; const MOYEN_CHEQUE = "cheque";
const MOYEN_VIREMENT = "virement"; const MOYEN_VIREMENT = "virement";
const MOYEN_HELLOASSO = "helloasso";
const MOYEN_MLC = "mlc";
const MOYEN_AUTRE = "autre"; const MOYEN_AUTRE = "autre";
/** @var array user friendly named type */ /** @var array user friendly named type */
protected static $typeName = [ protected static $typeName = [
self::MOYEN_CB => 'Carte bancaire', self::MOYEN_CB => 'Carte bancaire',
self::MOYEN_ESPECE => 'Espèce', self::MOYEN_ESPECE => 'Espèce',
self::MOYEN_CHEQUE => 'Chèque', self::MOYEN_CHEQUE => 'Chèque',
self::MOYEN_VIREMENT => 'Virement', self::MOYEN_VIREMENT => 'Virement',
self::MOYEN_HELLOASSO => 'HelloAsso',
self::MOYEN_MLC => 'MLC',
self::MOYEN_AUTRE => 'Autre', self::MOYEN_AUTRE => 'Autre',
]; ];
...@@ -42,6 +47,8 @@ abstract class MoyenEnum ...@@ -42,6 +47,8 @@ abstract class MoyenEnum
self::MOYEN_ESPECE, self::MOYEN_ESPECE,
self::MOYEN_CHEQUE, self::MOYEN_CHEQUE,
self::MOYEN_VIREMENT, self::MOYEN_VIREMENT,
self::MOYEN_HELLOASSO,
self::MOYEN_MLC,
self::MOYEN_AUTRE self::MOYEN_AUTRE
]; ];
} }
......
<?php
namespace App\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
use Symfony\Component\Security\Http\SecurityEvents;
class SwitchUserSubscriber implements EventSubscriberInterface
{
private $router;
/**
* SwitchUserSubscriber constructor.
*
* @param RouterInterface $router
*/
public function __construct(RouterInterface $router)
{
$this->router = $router;
}
public function onSwitchUser(SwitchUserEvent $event)
{
// $request = $event->getRequest();
// if ($request->hasSession() && $request->getSession()->has('_groupId')) {
// $group = $request->getSession()->get('_groupId');
// if ($group->getRoles()->contains('ROLE_SUPER_ADMIN')) {
// return new RedirectResponse($this->router->generate('sonata_admin_dashboard'));
// }
// }
// return new RedirectResponse($this->router->generate('index'));
// if ($request->hasSession() && ($session = $request->getSession)) {
// $session->set(
// '_locale',
// // assuming your User has some getLocale() method
// $event->getTargetUser()->getLocale()
// );
// }
}
public static function getSubscribedEvents()
{
return [
// constant for security.switch_user
SecurityEvents::SWITCH_USER => 'onSwitchUser',
];
}
}
<?php
namespace App\Form\Type;
use App\Entity\Cotisation;
use App\Enum\MoyenEnum;
use App\Form\Type\CotisationInfosFormType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
class AddCotisationFormType extends AbstractType
{
protected $em;
protected $tk;
public function __construct(EntityManagerInterface $em, TokenStorageInterface $tk)
{
$this->em = $em;
$this->tk = $tk;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
$now = new \DateTime();
$flux = $options['data'];
if (empty($this->tk->getToken()) || empty($this->tk->getToken()->getUser()) || empty($this->tk->getToken()->getUser()->getId()) || empty($flux) || empty($flux->getExpediteur())) {
throw new \Exception("[FLUX] Opération impossible ! Pas d'utilisateur connecté !");
}
$maxvalue = $flux->getExpediteur()->getCompte();
$builder
->add('type', HiddenType::class, array(
'data' => 'cotisation',
'data_class' => null
))
->add('operateur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getId(),
'data_class' => null,
'entity_class' => User::class,
'em' => $this->em
))
->add('reference', HiddenType::class, array(
'label' => 'Reference :',
'required' => true,
'data' => 'Cotisation '.$now->format('Y')
))
->add('montant', MoneyType::class, array(
'label' => 'Montant :',
'required' => true
))
->add('moyen', ChoiceType::class, array(
'required' => true,
'choices' => MoyenEnum::getAvailableTypes(),
'choice_label' => function ($choice) {
return MoyenEnum::getTypeName($choice);
},
))
;
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => Cotisation::class,
'cascade_validation' => true
));
}
public function getParent()
{
return FluxFormType::class;
}
public function getBlockPrefix()
{
return 'formCotisation';
}
}
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
namespace App\Form\Type; namespace App\Form\Type;
use App\Entity\Cotisation; use App\Entity\Cotisation;
use App\Enum\MoyenEnum;
use App\Form\Type\CotisationInfosFormType; use App\Form\Type\CotisationInfosFormType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
...@@ -15,6 +17,13 @@ class CotisationFormType extends FluxFormType ...@@ -15,6 +17,13 @@ class CotisationFormType extends FluxFormType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('moyen', ChoiceType::class, array(
'required' => true,
'choices' => MoyenEnum::getAvailableTypes(),
'choice_label' => function ($choice) {
return MoyenEnum::getTypeName($choice);
},
))
->add('type', HiddenType::class, array( ->add('type', HiddenType::class, array(
'data' => 'cotisation', 'data' => 'cotisation',
'data_class' => null 'data_class' => null
......
...@@ -18,24 +18,30 @@ use Symfony\Component\Form\FormError; ...@@ -18,24 +18,30 @@ use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\LessThanOrEqual;
class FluxFormType extends AbstractType class FluxFormType extends AbstractType
{ {
protected $em; protected $em;
protected $tk; protected $security;
public function __construct(EntityManagerInterface $em, TokenStorageInterface $tk) public function __construct(EntityManagerInterface $em, Security $security)
{ {
$this->em = $em; $this->em = $em;
$this->tk = $tk; $this->security = $security;
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$flux = $options['data'];
if (empty($this->security->getUser()) || empty($this->security->getUser()->getId()) || empty($flux) || empty($flux->getExpediteur())) {
throw new \Exception("[FLUX] Opération impossible ! Pas d'utilisateur connecté !");
}
$maxvalue = $flux->getExpediteur()->getCompte();
$builder $builder
->add('operateur', HiddenType::class, array( ->add('operateur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getId(), 'data' => $this->security->getUser()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => User::class, 'entity_class' => User::class,
'em' => $this->em 'em' => $this->em
...@@ -43,23 +49,22 @@ class FluxFormType extends AbstractType ...@@ -43,23 +49,22 @@ class FluxFormType extends AbstractType
->add('montant', MoneyType::class, array( ->add('montant', MoneyType::class, array(
'label' => 'Montant :', 'label' => 'Montant :',
'required' => true, 'required' => true,
)) 'constraints' => [
->add('moyen', ChoiceType::class, array( new LessThanOrEqual([
'required' => true, 'message' => 'Montant supérieur à votre solde.',
'choices' => MoyenEnum::getAvailableTypes(), 'value' => $maxvalue,
'choice_label' => function ($choice) { ]),
return MoyenEnum::getTypeName($choice); ],
},
)) ))
->add('reference', TextType::class, array( ->add('reference', TextType::class, array(
'label' => 'Reference :', 'label' => 'Reference :',
'required' => true 'required' => true
)) ))
->add('save', SubmitType::class, ['label' => "Valider la transaction"]) ->add('save', SubmitType::class, ['label' => "Valider"])
->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($builder) { ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($builder) {
$transaction = $event->getData(); $flux = $event->getData();
if ($event->getForm()->isValid() && (!$transaction || null === $transaction->getId())) { if ($event->getForm()->isValid() && (!$flux || null === $flux->getId())) {
if ($transaction->getExpediteur()->getCompte() < $transaction->getMontant()) { if ($flux->getExpediteur()->getCompte() < $flux->getMontant()) {
$event->getForm()->get('montant')->addError(new FormError("Montant supérieur à votre solde !")); $event->getForm()->get('montant')->addError(new FormError("Montant supérieur à votre solde !"));
} }
} }
......
<?php
namespace App\Form\Type;
use App\Entity\Adherent;
use App\Entity\TransactionAdherentAdherent;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class TransactionAdherentAdherentFormType extends TransactionFormType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('expediteur', HiddenType::class, array(
'data' => $this->security->getUser()->getAdherent()->getId(),
'data_class' => null,
'entity_class' => Adherent::class,
'em' => $this->em
))
->add('destinataire', EntityType::class, array(
'class' => Adherent::class,
'choices' => $this->em->getRepository(Adherent::class)->findBy(array('enabled' => true)),
'placeholder' => 'Adherent',
'required' => true,
'label' => 'Adherent :',
))
->add('moyen', HiddenType::class, array(
'data' => 'virement'
))
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'class' => TransactionAdherentAdherent::class,
));
}
public function getParent()
{
return TransactionFormType::class;
}
public function getBlockPrefix()
{
return 'formTransactionAdherentAdherent';
}
}
...@@ -16,7 +16,7 @@ class TransfertComptoirAdherentFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertComptoirAdherentFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getGestionnaireComptoir()->getId(), 'data' => $this->tk->getToken()->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Comptoir::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransfertComptoirGroupeFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertComptoirGroupeFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getGestionnaireComptoir()->getId(), 'data' => $this->tk->getToken()->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Comptoir::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
......
...@@ -16,7 +16,7 @@ class TransfertComptoirPrestataireFormType extends TransfertFormType ...@@ -16,7 +16,7 @@ class TransfertComptoirPrestataireFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getGestionnaireComptoir()->getId(), 'data' => $this->tk->getToken()->getUser()->getComptoirsgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Comptoir::class, 'entity_class' => Comptoir::class,
'em' => $this->em 'em' => $this->em
......
...@@ -17,7 +17,7 @@ class TransfertGroupeComptoirFormType extends TransfertFormType ...@@ -17,7 +17,7 @@ class TransfertGroupeComptoirFormType extends TransfertFormType
{ {
$builder $builder
->add('expediteur', HiddenType::class, array( ->add('expediteur', HiddenType::class, array(
'data' => $this->tk->getToken()->getUser()->getGestionnaireGroupe()->getId(), 'data' => $this->tk->getToken()->getUser()->getGroupesgere()->getId(),
'data_class' => null, 'data_class' => null,
'entity_class' => Groupe::class, 'entity_class' => Groupe::class,
'em' => $this->em 'em' => $this->em
......
...@@ -43,6 +43,13 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface ...@@ -43,6 +43,13 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface
return $role->getRole(); return $role->getRole();
}, $roles); }, $roles);
if ($request->getSession()->has('_groupId') && !$token->getUser()->getGroups()->containsKey($request->getSession()->get('_groupId'))) {
$request->getSession()->remove('_groupId');
}
if (!$request->getSession()->has('_groupId') && count($token->getUser()->getGroups()) > 1) {
$request->getSession()->set('_choixGroup', 'true');
}
if (in_array('ROLE_SUPER_ADMIN', $rolesTab, true)) { if (in_array('ROLE_SUPER_ADMIN', $rolesTab, true)) {
// c'est un administrateur // c'est un administrateur
if ($this->getTargetUrlFromSession($request->getSession(), $token) != null) { if ($this->getTargetUrlFromSession($request->getSession(), $token) != null) {
...@@ -53,9 +60,6 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface ...@@ -53,9 +60,6 @@ class AfterLoginRedirection implements AuthenticationSuccessHandlerInterface
$redirection = new RedirectResponse($this->router->generate('sonata_admin_dashboard')); $redirection = new RedirectResponse($this->router->generate('sonata_admin_dashboard'));
} }
} else { } else {
if (!$request->getSession()->has('_groupId') && count($token->getUser()->getGroups()) > 1) {
$request->getSession()->set('_choixGroup', 'true');
}
$redirection = new RedirectResponse($this->router->generate('index')); $redirection = new RedirectResponse($this->router->generate('index'));
} }
......
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190222171021 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE charte');
$this->addSql('ALTER TABLE page CHANGE tag keywords VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE charte (id INT AUTO_INCREMENT NOT NULL, media_id INT DEFAULT NULL, name VARCHAR(150) NOT NULL COLLATE utf8mb4_unicode_ci, slug VARCHAR(150) NOT NULL COLLATE utf8mb4_unicode_ci, content LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci, text LONGTEXT DEFAULT NULL COLLATE utf8mb4_unicode_ci, INDEX IDX_3484E5A6EA9FDD75 (media_id), UNIQUE INDEX UNIQ_3484E5A6989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE charte ADD CONSTRAINT FK_3484E5A6EA9FDD75 FOREIGN KEY (media_id) REFERENCES media__media (id)');
$this->addSql('ALTER TABLE page CHANGE keywords tag VARCHAR(255) DEFAULT NULL COLLATE utf8mb4_unicode_ci');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190222190247 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D64929D29E4D');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6493D550E0D');
$this->addSql('DROP INDEX IDX_8D93D6493D550E0D ON user');
$this->addSql('DROP INDEX IDX_8D93D64929D29E4D ON user');
$this->addSql('ALTER TABLE user ADD groupesgere_id INT DEFAULT NULL, ADD comptoirsgere_id INT DEFAULT NULL, DROP gestionnaire_groupe_id, DROP gestionnaire_comptoir_id');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649F5100B17 FOREIGN KEY (groupesgere_id) REFERENCES groupe (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6495E8DB979 FOREIGN KEY (comptoirsgere_id) REFERENCES comptoir (id)');
$this->addSql('CREATE INDEX IDX_8D93D649F5100B17 ON user (groupesgere_id)');
$this->addSql('CREATE INDEX IDX_8D93D6495E8DB979 ON user (comptoirsgere_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649F5100B17');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6495E8DB979');
$this->addSql('DROP INDEX IDX_8D93D649F5100B17 ON user');
$this->addSql('DROP INDEX IDX_8D93D6495E8DB979 ON user');
$this->addSql('ALTER TABLE user ADD gestionnaire_groupe_id INT DEFAULT NULL, ADD gestionnaire_comptoir_id INT DEFAULT NULL, DROP groupesgere_id, DROP comptoirsgere_id');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64929D29E4D FOREIGN KEY (gestionnaire_groupe_id) REFERENCES groupe (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6493D550E0D FOREIGN KEY (gestionnaire_comptoir_id) REFERENCES comptoir (id)');
$this->addSql('CREATE INDEX IDX_8D93D6493D550E0D ON user (gestionnaire_comptoir_id)');
$this->addSql('CREATE INDEX IDX_8D93D64929D29E4D ON user (gestionnaire_groupe_id)');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190301204441 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE flux ADD adherent_dest_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AFCF2AA19 FOREIGN KEY (adherent_dest_id) REFERENCES adherent (id)');
$this->addSql('CREATE INDEX IDX_7252313AFCF2AA19 ON flux (adherent_dest_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AFCF2AA19');
$this->addSql('DROP INDEX IDX_7252313AFCF2AA19 ON flux');
$this->addSql('ALTER TABLE flux DROP adherent_dest_id');
}
}
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190303175347 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE groupeprestaire ADD groupe_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE groupeprestaire ADD CONSTRAINT FK_FB9ABBCE7A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)');
$this->addSql('CREATE INDEX IDX_FB9ABBCE7A45358C ON groupeprestaire (groupe_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE groupeprestaire DROP FOREIGN KEY FK_FB9ABBCE7A45358C');
$this->addSql('DROP INDEX IDX_FB9ABBCE7A45358C ON groupeprestaire');
$this->addSql('ALTER TABLE groupeprestaire DROP groupe_id');
}
}
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
class AccessDeniedHandler implements AccessDeniedHandlerInterface
{
public function __construct(\Twig_Environment $twig)
{
$this->twig = $twig;
}
public function handle(Request $request, AccessDeniedException $accessDeniedException)
{
//@TODO : beautiful error
// return new Response($this->twig->render('@Twig/Exception/error.html.twig'), 403);
return new Response('', 403);
}
}
{ {
"api-platform/api-pack": {
"version": "v1.2.0"
},
"api-platform/core": {
"version": "2.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.1",
"ref": "18727d8f229306860b46955f438e1897421da689"
}
},
"behat/transliterator": { "behat/transliterator": {
"version": "v1.2.0" "version": "v1.2.0"
}, },
...@@ -248,6 +260,15 @@ ...@@ -248,6 +260,15 @@
"ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94" "ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94"
} }
}, },
"nelmio/cors-bundle": {
"version": "1.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.5",
"ref": "f0436fc35fca88eada758311f8de43bfb61f1980"
}
},
"nikic/php-parser": { "nikic/php-parser": {
"version": "v4.1.0" "version": "v4.1.0"
}, },
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<div class='infos mt-4'> <div class='infos mt-4'>
<h4>Modifier mes informations :</h4> <h4>{{"Modifier mes informations"|trans}} :</h4>
<p> <p>
{{form_start(form)}} {{form_start(form)}}
{{ form_row(form.user) }} {{ form_row(form.user) }}
......
{% set idcard = idcard|default(random(500)) %}
<div class="card mb-3">
<div class="card-header" data-toggle="collapse" data-target="#collapse{{idcard}}" aria-expanded="false" aria-controls="collapse{{idcard}}">{% block blocktitle %}TITLE with blocktitle{% endblock blocktitle %}</div>
<div class="card-body collapse" id="collapse{{idcard}}">
<h4 class="card-title">{% block blocksubtitle %}SUBTITLE with blocksubtitle{% endblock blocksubtitle %}</h4>
<div class="card-text">
{% block blockcontent %}CONTENT with blockcontent{% endblock blockcontent %}
</div>
</div>
</div>
...@@ -13,7 +13,10 @@ ...@@ -13,7 +13,10 @@
{% else %} {% else %}
{% set class = 'label-danger' %} {% set class = 'label-danger' %}
{% endif %} {% endif %}
{# ON EMPECHE ICI DE DESACTIVER LES ROLES SUPER ADMIN OU ADMIN SIEGE #}
<span class="label {{ class }} editableboolean" data-value="{{value}}{{value ? 'true' : 'false'}}" data-url="{{path('setenable', {'id': object.id, 'type': field_description.options.datatype})}}" style='cursor:pointer;'>{{ text }}</span> {% if object is instanceof("App\\Entity\\User") and (object.isGranted('ROLE_SUPER_ADMIN') or object.isGranted('ROLE_ADMIN_SIEGE')) %}
{% set class = class~' hide' %}
{% endif %}
<span class="label {{ class }} editableboolean" data-value="{{value ? 'true' : 'false'}}" data-url="{{path('setenable', {'id': object.id, 'type': field_description.options.datatype})}}" style='cursor:pointer;'>{{ text }}</span>
{% endspaceless -%} {% endspaceless -%}
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -7,27 +7,24 @@ ...@@ -7,27 +7,24 @@
$(function () { $(function () {
$("input[name='{{ admin.uniqid }}[groups][]']").each(function () { $("input[name='{{ admin.uniqid }}[groups][]']").each(function () {
$(this).on('ifChecked', function(event){ $(this).on('ifChecked', function(event){
if ($.trim($(this).closest('label').text()) == 'Gestionnaire de Groupe') { if ($.trim($(this).closest('label').text()) == 'Gestionnaire de Groupe' || $.trim($(this).closest('label').text()) == 'Contact') {
console.log('Gestionnaire de Groupe'); $('#sonata-ba-field-container-{{ admin.uniqid }}_groupesgere label.hide').removeClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireGroupe label.hide').removeClass('hide'); $('#sonata-ba-field-container-{{ admin.uniqid }}_groupesgere div.select2-container').removeClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireGroupe div.select2-container').removeClass('hide');
} else if ($.trim($(this).closest('label').text()) == 'Comptoir') { } else if ($.trim($(this).closest('label').text()) == 'Comptoir') {
console.log('Comptoir'); console.log('Comptoir');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireComptoir label.hide').removeClass('hide'); $('#sonata-ba-field-container-{{ admin.uniqid }}_comptoirsgere label.hide').removeClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireComptoir div.select2-container').removeClass('hide'); $('#sonata-ba-field-container-{{ admin.uniqid }}_comptoirsgere div.select2-container').removeClass('hide');
} }
}); });
$(this).on('ifUnchecked', function(event){ $(this).on('ifUnchecked', function(event){
if ($.trim($(this).closest('label').text()) == 'Gestionnaire de Groupe') { if ($.trim($(this).closest('label').text()) == 'Gestionnaire de Groupe' || $.trim($(this).closest('label').text()) == 'Contact') {
console.log('Uncheck Gestionnaire de Groupe'); $('#{{ admin.uniqid }}_groupesgere').select2('val',[]);
$('#{{ admin.uniqid }}_gestionnaireGroupe').select2('val',[]); $('#sonata-ba-field-container-{{ admin.uniqid }}_groupesgere label.control-label').addClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireGroupe label.control-label').addClass('hide'); $('#sonata-ba-field-container-{{ admin.uniqid }}_groupesgere div.select2-container').addClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireGroupe div.select2-container').addClass('hide');
} else if ($.trim($(this).closest('label').text()) == 'Comptoir') { } else if ($.trim($(this).closest('label').text()) == 'Comptoir') {
console.log('Uncheck Comptoir'); $('#{{ admin.uniqid }}_comptoirsgere').select2('val',[]);
$('#{{ admin.uniqid }}_gestionnaireComptoir').select2('val',[]); $('#sonata-ba-field-container-{{ admin.uniqid }}_comptoirsgere label.control-label').addClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireComptoir label.control-label').addClass('hide'); $('#sonata-ba-field-container-{{ admin.uniqid }}_comptoirsgere div.select2-container').addClass('hide');
$('#sonata-ba-field-container-{{ admin.uniqid }}_gestionnaireComptoir div.select2-container').addClass('hide');
} }
}); });
}); });
......
{% extends 'common/layout.html.twig' %}
{% block content %}
<h1>Oups ! Il y a eu une erreur !</h1>
<br/><br/><br/><br/>
<p>The server returned a "{{ status_code }} {{ status_text }}".</p>
{% endblock content %}
\ No newline at end of file
{{ { 'error': { 'code': status_code, 'message': status_text } }|json_encode|raw }}
\ No newline at end of file
{% extends 'common/layout.html.twig' %}
{% block content %}
<h1>Oups ! Il y a eu une erreur !</h1>
<br/><br/><br/><br/>
<p>The server returned a "{{ status_code }} {{ status_text }}".</p>
{% endblock content %}
\ No newline at end of file
{{ { 'error': { 'code': status_code, 'message': status_text } }|json_encode|raw }}
\ No newline at end of file
{% extends 'common/layout.html.twig' %}
{% block content %}
<h1>Oups ! Il y a eu une erreur !</h1>
<br/><br/><br/><br/>
<p>The server returned a "{{ status_code }} {{ status_text }}".</p>
{% endblock content %}
\ No newline at end of file
{{ { 'error': { 'code': status_code, 'message': status_text } }|json_encode|raw }}
\ No newline at end of file
...@@ -19,7 +19,14 @@ ...@@ -19,7 +19,14 @@
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
{{ tree.menu(menuItems, currentPath) }} {{ tree.menu(menuItems, currentPath) }}
{# MENU UTILISATEUR AYANT ACCES A L'ADMIN CONNECTE #} {# MENU UTILISATEUR AYANT ACCES A L'ADMIN CONNECTE #}
{% if app.user and (is_granted('ROLE_ADMIN') or is_granted('ROLE_SUPER_ADMIN')) %} {% if app.user and (is_granted('ROLE_ADMIN_SIEGE') or
is_granted('ROLE_SUPER_ADMIN') or
is_granted('ROLE_TRESORIER') or
is_granted('ROLE_CONTACT') or
is_granted('ROLE_GESTION_GROUPE') or
is_granted('ROLE_COMPTOIR') or
is_granted('ROLE_CONTROLEUR')
) %}
<li class="nav-item ml-auto" role="menu-item"> <li class="nav-item ml-auto" role="menu-item">
<a href="{{ path('sonata_admin_dashboard') }}" class="nav-link" data-toggle="tooltip" data-placement="bottom" title="{{ 'Administration'|trans }}"> <a href="{{ path('sonata_admin_dashboard') }}" class="nav-link" data-toggle="tooltip" data-placement="bottom" title="{{ 'Administration'|trans }}">
{# {{ 'Administration'|trans }} #} {# {{ 'Administration'|trans }} #}
...@@ -39,6 +46,7 @@ ...@@ -39,6 +46,7 @@
{% if is_granted('ROLE_ADHERENT') %} {% if is_granted('ROLE_ADHERENT') %}
<a href="{{ path('adherent_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a> <a href="{{ path('adherent_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a>
<a href="{{ path('transactionAdherentPrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a> <a href="{{ path('transactionAdherentPrestataire') }}" class="dropdown-item">{{ 'Transaction vers presta'|trans }}</a>
<a href="{{ path('transactionAdherentAdherent') }}" class="dropdown-item">{{ 'Transaction vers adherent'|trans }}</a>
{% endif %} {% endif %}
{% if is_granted('ROLE_PRESTATAIRE') %} {% if is_granted('ROLE_PRESTATAIRE') %}
<a href="{{ path('prestataire_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a> <a href="{{ path('prestataire_infos') }}" class="dropdown-item">{{ 'Mes infos'|trans }}</a>
...@@ -48,6 +56,9 @@ ...@@ -48,6 +56,9 @@
{% if app.user.groups|length > 1 %} {% if app.user.groups|length > 1 %}
<a href="#" class="viewChoiceGroup dropdown-item">{{ 'Choix du rôle'|trans }}</a> <a href="#" class="viewChoiceGroup dropdown-item">{{ 'Choix du rôle'|trans }}</a>
{% endif %} {% endif %}
{% if is_granted('ROLE_PREVIOUS_ADMIN') %}
<a href="{{path('index')}}?_switch_user=_exit" class="dropdown-item">{{ 'Exit impersonate'|trans }}</a>
{% endif %}
<a href="{{ path('fos_user_security_logout') }}" class="dropdown-item">{{ 'Déconnexion'|trans }}</a> <a href="{{ path('fos_user_security_logout') }}" class="dropdown-item">{{ 'Déconnexion'|trans }}</a>
</div> </div>
</li> </li>
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
{{ form_row(form.expediteur) }} {{ form_row(form.expediteur) }}
{{ form_row(form.destinataire) }} {{ form_row(form.destinataire) }}
{{ form_row(form.montant) }} {{ form_row(form.montant) }}
{% if form.moyen is defined %}
{{ form_row(form.moyen) }} {{ form_row(form.moyen) }}
{% endif %}
{{ form_row(form.reference) }} {{ form_row(form.reference) }}
{{ form_row(form.save) }} {{ form_row(form.save) }}
{{form_end(form)}} {{form_end(form)}}
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
{% include 'common/rubriques.html.twig' %} {% include 'common/rubriques.html.twig' %}
</div> </div>
<div class='col-6 text-center'> <div class='col-6 text-center'>
COLONNE PRINCIPALE {% if is_granted('ROLE_PRESTATAIRE') %}
{% include 'presta/block/solde.html.twig' %}
{% endif %}
</div> </div>
<div class='col-3'> <div class='col-3'>
SIDEBAR SIDEBAR
......
{% set title = page.metatitle %}
{% set description = page.metadescription %}
{% set keywords = page.metakeywords %}
{% extends 'common/layout.html.twig' %} {% extends 'common/layout.html.twig' %}
{% block content %} {% block content %}
<div class='container'> <div class='container'>
<h4>Charte</h4> <h4>{{page.title}}</h4>
<p class="paragraf"> <p class="paragraf">
Cette Charte des valeurs a été adoptée lors de l'assemblée générale du 25 janvier 2014.<br> {{page.content|raw}}
{# Cette Charte des valeurs a été adoptée lors de l'assemblée générale du 25 janvier 2014.<br>
<br> <br>
<strong>En signant cette Charte des valeurs, je m'engage en tant que consommateur ou prestataire à utiliser la monnaie locale comme </strong>&nbsp;: <br> <strong>En signant cette Charte des valeurs, je m'engage en tant que consommateur ou prestataire à utiliser la monnaie locale comme </strong>&nbsp;: <br>
porteuse de valeurs éthiques, écologiques et sociales dans une recherche de mieux être collectif, outil pour inciter chacun à mieux comprendre sa façon de produire et de consommer, moyen de contribuer à une alternative non-spéculative au modèle économique actuel<br> porteuse de valeurs éthiques, écologiques et sociales dans une recherche de mieux être collectif, outil pour inciter chacun à mieux comprendre sa façon de produire et de consommer, moyen de contribuer à une alternative non-spéculative au modèle économique actuel<br>
<strong>En signant cette Charte des valeurs, je m'engage en tant que consommateur ou prestataire à favoriser&nbsp;</strong>: <strong>En signant cette Charte des valeurs, je m'engage en tant que consommateur ou prestataire à favoriser&nbsp;</strong>: #}
</p> </p>
{# <p class="paragraf" style="min-height:60px;"> {# <p class="paragraf" style="min-height:60px;">
<img src="./pictocharte/proximite.gif" style="float:left;margin-right:10px;width:36px;"> L'activité et les emplois locaux en privilégiant les productions, les services et les commerces de proximité, dans une démarche de qualité.<br> <img src="./pictocharte/proximite.gif" style="float:left;margin-right:10px;width:36px;"> L'activité et les emplois locaux en privilégiant les productions, les services et les commerces de proximité, dans une démarche de qualité.<br>
......
{% set idcard = 'soldepresta' %}
{% extends 'block/block_collapse.html.twig' %}
{% block blocktitle %}
<i class="fa fa-euro ml-4"></i> Solde de mon compte
{% endblock blocktitle %}
{% block blocksubtitle %}
{% endblock blocksubtitle %}
{% block blockcontent %}
Solde : {{app.user.prestataire.compte}} {{'mlc_name'|trans}}
{% endblock blockcontent %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment