Browse Source

Ecriture des repo

master
Fab 3 years ago
parent
commit
afe8f0d898
7 changed files with 139 additions and 66 deletions
  1. +1
    -1
      config/packages/security.yaml
  2. +106
    -13
      src/Controller/Admin/DashboardController.php
  3. +1
    -1
      src/Controller/Admin/PageCrudController.php
  4. +15
    -0
      src/Controller/Common/TaxRateCrudController.php
  5. +15
    -0
      src/Controller/User/GroupUserCrudController.php
  6. +1
    -1
      src/Controller/User/UserCrudController.php
  7. +0
    -50
      src/Repository/DocumentRepository.php

+ 1
- 1
config/packages/security.yaml View File

@@ -8,7 +8,7 @@ security:
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
class: App\Entity\User\User
property: email
firewalls:
dev:

+ 106
- 13
src/Controller/Admin/DashboardController.php View File

@@ -3,7 +3,9 @@
namespace App\Controller\Admin;


use App\Entity\Common\TaxRate;
use App\Entity\Site\Page;
use App\Entity\User\GroupUser;
use App\Entity\User\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use Lc\SovBundle\Controller\Admin\DashboardController as LcDashboardController;
@@ -11,25 +13,116 @@ use Lc\SovBundle\Controller\Admin\DashboardController as LcDashboardController;
class DashboardController extends LcDashboardController
{

public function configureMenuItems(): iterable
/*public function configureMenuItems(): iterable
{
return [
MenuItem::linkToDashboard('Tableau de bord', 'fa fa-home'),
MenuItem::linkToCrud('Pages', 'fa fa-tags', Page::class),
MenuItem::linkToCrud('Utilisateurs', 'fa fa-user', User::class),
$submenu1 = [
MenuItem::linkToCrud('Zones', 'fas fa-map-marked-alt', DeliveryAvailabilityZone::class),
MenuItem::linkToCrud('Ambassades', 'fas fa-store-alt', DeliveryAvailabilityZone::class),
];

$submenu2 = [
MenuItem::linkToCrud('Produits', 'fas fa-carrot', ProductFamily::class),
MenuItem::linkToCrud('Produits (édition avancée)', 'fas fa-carrot', ProductFamily::class),
MenuItem::linkToCrud('Renouvelement des stocks', 'fas fa-layer-group', ProductFamily::class),
MenuItem::linkToCrud('Catégories', 'fas fa-store', ProductCategory::class)->setPermission('ROLE_ADMIN'),
MenuItem::linkToCrud('Producteurs', 'fas fa-tractor', Supplier::class)->setPermission('ROLE_ADMIN'),
MenuItem::linkToCrud('Zones de dépôt', 'fas fa-cubes', DepositoryZone::class)->setPermission('ROLE_ADMIN'),
];

$submenu3 = [
MenuItem::linkToCrud('Paniers', 'fas fa-shopping-basket', OrderShop::class),
MenuItem::linkToCrud('Commandes ', 'fas fa-shopping-cart', OrderShop::class),
MenuItem::linkToCrud('Relivraisons', 'fas fa-undo', OrderProduct::class),
];

/*
MenuItem::section('Blog'),
MenuItem::linkToCrud('Categories', 'fa fa-tags', Category::class),
MenuItem::linkToCrud('Blog Posts', 'fa fa-file-text', BlogPost::class),
$submenu4 = [
MenuItem::linkToCrud('Commandes du jour', 'fas fa-calendar-day', OrderShop::class),
MenuItem::linkToCrud('Toutes les commandes', 'fas fa-utensils', OrderShop::class),
];

MenuItem::section('Users'),
MenuItem::linkToCrud('Comments', 'fa fa-comment', Comment::class),
MenuItem::linkToCrud('Users', 'fa fa-user', User::class),*/
$submenu5 = [
MenuItem::linkToCrud('Utilisateurs', 'fas fa-user', User::class),
MenuItem::linkToCrud('Groupes d\'utilisateurs', 'fas fa-users', GroupUser::class),
MenuItem::linkToCrud('Comptes prépayés', 'fas fa-cash-register', UserMerchant::class),
MenuItem::linkToCrud('Parrainages', 'fas fa-user-plus', Sponsor::class),
];

$submenu6 = [
MenuItem::linkToCrud('Réductions sur catalogues', 'fas fa-book', ReductionCatalog::class),
MenuItem::linkToCrud('Réductions paniers', 'fas fa-shopping-basket', ReductionCart::class),
MenuItem::linkToCrud('Avoirs', 'fas fa-backspace', ReductionCredit::class),
MenuItem::linkToCrud('Bons cadeaux', 'fas fa-gift', ReductionCredit::class),
];

$submenu7 = [
MenuItem::linkToCrud('Zones', 'fas fa-map-marked-alt', DeliveryZone::class),
MenuItem::linkToCrud('Ambassades', 'fas fa-map-marker-alt', PointSale::class),
MenuItem::linkToCrud('Créneaux horaires', 'fas fa-clock', DeliverySlot::class),
MenuItem::linkToCrud('Tarifs', 'fas fa-euro-sign', DeliveryPrice::class),
MenuItem::linkToCrud('Dispo zones (par défaut)', 'fas fa-calendar-check', DeliveryAvailabilityZone::class),
MenuItem::linkToCrud('Dispo ambassades (par défaut)', 'fas fa-calendar-check', DeliveryAvailabilityZone::class),
MenuItem::linktoRoute('Livraison à vélo', 'fas fa-bicycle', 'admin_bike_delivery'),
];

//MenuItem::linkToLogout('Déconnexion', 'fa fa-exit'),
$submenu8 = [
MenuItem::linkToCrud('Bons de commandes', 'fas fa-tractor', Supplier::class),
MenuItem::linktoRoute('Exports', 'fas fa-download', 'admin_exports'),
MenuItem::linktoRoute('Pesées', 'fas fa-truck-loading', 'admin_export_weighing'),
MenuItem::linkToCrud('Comptabilité', 'fas fa-euro-sign', OrderShop::class),
];

$submenu9 = [
MenuItem::linkToCrud('Notifications activées', 'fas fa-check', NotificationUser::class),
MenuItem::linkToCrud('Notifications envoyées', 'fas fa-archive', NotificationLog::class),
];

yield MenuItem::linktoRoute('Tableau de bord', 'fas fa-tachometer-alt', 'admin_dashboard', ['count_menu_item' => 'productAvailabilitiesNegative', 'alert' => 1]);
yield MenuItem::linkToCrud('Tickets', 'fas fa-envelope', Ticket::class)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Disponibilités', 'fas fa-calendar-check')->setSubItems($submenu1)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Catalogues', 'fas fa-book')->setSubItems($submenu2);
yield MenuItem::subMenu('Commandes marché', 'fas fa-shopping-cart')->setSubItems($submenu3)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Commandes du midi', 'fas fa-utensils')->setSubItems($submenu4);
yield MenuItem::subMenu('Utilisateurs', 'fas fa-users')->setSubItems($submenu5)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Reductions', 'fas fa-tags')->setSubItems($submenu6)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Livraisons', 'fas fa-truck')->setSubItems($submenu7)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Exports', 'fas fa-file-export')->setSubItems($submenu8)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Pense bêtes', 'fas fa-thumbtack', Reminder::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Actualités', 'fas fa-bullhorn', News::class)->setPermission('ROLE_ADMIN');
yield MenuItem::subMenu('Notifications', 'fas fa-bell')->setSubItems($submenu9)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Pages', 'fas fa-file', Page::class)->setPermission('ROLE_ADMIN');
yield MenuItem::linkToCrud('Paramètres', 'fas fa-cogs', Hub::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linktoRoute('Statistiques', 'fas fa-chart-line', 'admin_statistic')->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linktoRoute('Espace développement', 'fas fa-drafting-compass', 'admin_develop')->setPermission('ROLE_SUPER_ADMIN');

yield MenuItem::section('Administration', 'fas fa-folder-open')->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Hubs', 'fas fa-store', Hub::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Espaces', 'fas fa-th-large', Section::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Newsletters', 'fas fa-paper-plane', Newsletter::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Notifications', 'fas fa-bell', Notification::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Règles de taxes', 'fas fa-euro-sign', TaxRate::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Unités', 'fas fa-balance-scale', Unit::class)->setPermission('ROLE_SUPER_ADMIN');
yield MenuItem::linkToCrud('Statuts de commande', 'fas fa-shopping-basket', OrderStatus::class)->setPermission('ROLE_SUPER_ADMIN');
*/

public function configureMenuItems(): iterable
{
$submenuUser = [
MenuItem::linkToCrud('Utilisateurs', 'fas fa-user', User::class),
MenuItem::linkToCrud('Groupes d\'utilisateurs', 'fas fa-users', GroupUser::class),
];

yield MenuItem::linkToDashboard('Tableau de bord', 'fa fa-home');
yield MenuItem::subMenu('Utilisateurs', 'fas fa-users')->setSubItems($submenuUser);
yield MenuItem::linkToCrud('Pages', 'fa fa-tags', Page::class);
yield MenuItem::linkToCrud('TVA', 'fa fa-user', TaxRate::class);
/*
MenuItem::section('Blog'),
MenuItem::linkToCrud('Categories', 'fa fa-tags', Category::class),
MenuItem::linkToCrud('Blog Posts', 'fa fa-file-text', BlogPost::class),

MenuItem::section('Users'),
MenuItem::linkToCrud('Comments', 'fa fa-comment', Comment::class),
MenuItem::linkToCrud('Users', 'fa fa-user', User::class),*/
}

}

+ 1
- 1
src/Controller/Admin/PageCrudController.php View File

@@ -2,7 +2,7 @@

namespace App\Controller\Admin;

use App\Entity\Page;
use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;

+ 15
- 0
src/Controller/Common/TaxRateCrudController.php View File

@@ -0,0 +1,15 @@
<?php

namespace App\Controller\Common;

use App\Entity\Common\TaxRate;
use Lc\CaracoleBundle\Controller\Common\TaxRateCrudController as AbstractUserCrudController;

class TaxRateCrudController extends AbstractUserCrudController
{
public static function getEntityFqcn(): string
{
return TaxRate::class;
}

}

+ 15
- 0
src/Controller/User/GroupUserCrudController.php View File

@@ -0,0 +1,15 @@
<?php

namespace App\Controller\User;

use App\Entity\User\GroupUser;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use Lc\CaracoleBundle\Controller\User\GroupUserCrudController as AbstractUserCrudController;

class GroupUserCrudController extends AbstractUserCrudController
{
public static function getEntityFqcn(): string
{
return GroupUser::class;
}
}

src/Controller/Admin/UserCrudController.php → src/Controller/User/UserCrudController.php View File

@@ -1,6 +1,6 @@
<?php

namespace App\Controller\Admin;
namespace App\Controller\User;

use App\Entity\User\User;
use Lc\SovBundle\Controller\Admin\UserCrudController as AbstractUserCrudController;

+ 0
- 50
src/Repository/DocumentRepository.php View File

@@ -1,50 +0,0 @@
<?php

namespace App\Repository;

use App\Entity\Document;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
* @method Document|null find($id, $lockMode = null, $lockVersion = null)
* @method Document|null findOneBy(array $criteria, array $orderBy = null)
* @method Document[] findAll()
* @method Document[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class DocumentRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Document::class);
}

// /**
// * @return Document[] Returns an array of Document objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('d')
->andWhere('d.exampleField = :val')
->setParameter('val', $value)
->orderBy('d.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/

/*
public function findOneBySomeField($value): ?Document
{
return $this->createQueryBuilder('d')
->andWhere('d.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

Loading…
Cancel
Save