Browse Source

Reminder

ideas
Guillaume 3 years ago
parent
commit
d261a963ea
6 changed files with 114 additions and 6 deletions
  1. +19
    -5
      Controller/Dashboard/DashboardAdminAdminController.php
  2. +43
    -0
      Factory/FactoryTrait.php
  3. +12
    -0
      Factory/Reminder/ReminderFactory.php
  4. +19
    -1
      Model/Reminder/ReminderModel.php
  5. +20
    -0
      Repository/Reminder/ReminderRepository.php
  6. +1
    -0
      Resources/assets/app/adminlte/common/common.scss

+ 19
- 5
Controller/Dashboard/DashboardAdminAdminController.php View File



use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use Lc\SovBundle\Controller\Dashboard\DashboardAdminController as SovDashboardController ;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu;
use Lc\SovBundle\Controller\Dashboard\DashboardAdminController as SovDashboardController;
use Symfony\Component\Security\Core\User\UserInterface;


class DashboardAdminAdminController extends SovDashboardController class DashboardAdminAdminController extends SovDashboardController
{ {
$crud $crud
->overrideTemplate('layout', '@LcCaracole/adminlte/layout.html.twig'); ->overrideTemplate('layout', '@LcCaracole/adminlte/layout.html.twig');


return $crud ;
return $crud;
} }


public function configureAssets(): Assets public function configureAssets(): Assets
{ {
$assets = parent::configureAssets(); // TODO: Change the autogenerated stub $assets = parent::configureAssets(); // TODO: Change the autogenerated stub


$assets->addWebpackEncoreEntry('carac-common') ;
$assets->addWebpackEncoreEntry('carac-switch-merchant') ;
$assets->addWebpackEncoreEntry('carac-common');
$assets->addWebpackEncoreEntry('carac-switch-merchant');


return $assets ;
return $assets;
}

public function configureUserMenu(UserInterface $user): UserMenu
{
return parent::configureUserMenu($user)
->setMenuItems(
[
MenuItem::linkToRoute('Mon profil', 'fa fa-id-card', 'sov_admin_account_profile'),
MenuItem::linkToLogout('Déconnexion', 'sign-out-alt'),
]
);
} }


} }

+ 43
- 0
Factory/FactoryTrait.php View File

<?php

namespace Lc\CaracoleBundle\Factory;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Factory\AbstractFactory as SovAbstractFactory;

trait FactoryTrait
{
protected $merchantResolver;
protected $sectionResolver;

public function __construct(
EntityManagerInterface $em,
MerchantResolver $merchantResolver,
SectionResolver $sectionResolver
) {
parent::__construct($em);
$this->merchantResolver = $merchantResolver;
$this->sectionResolver = $sectionResolver;
}

public function create($params = array())
{
$entityClass = $this->em->getEntityName($this->getEntityClass());
$entity = new $entityClass;

if ($entity instanceof FilterMerchantInterface && !isset($params['merchant'])) {
$params['merchant'] = $this->merchantResolver->getCurrent();
}

if ($entity instanceof FilterSectionInterface && !isset($params['section'])) {
$params['section'] = $this->sectionResolver->getCurrent();
}

return parent::create($params);
}

}

+ 12
- 0
Factory/Reminder/ReminderFactory.php View File

<?php

namespace Lc\CaracoleBundle\Factory\Reminder;

use Lc\CaracoleBundle\Factory\FactoryTrait;
use Lc\SovBundle\Factory\Reminder\ReminderFactory as SovReminderFactory;

class ReminderFactory extends SovReminderFactory
{
use FactoryTrait;

}

+ 19
- 1
Model/Reminder/ReminderModel.php View File



use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Model\Reminder\ReminderModel as SovReminderModel; use Lc\SovBundle\Model\Reminder\ReminderModel as SovReminderModel;


/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class ReminderModel extends SovReminderModel implements FilterMerchantInterface
abstract class ReminderModel extends SovReminderModel implements FilterMerchantInterface, FilterSectionInterface
{ {
/** /**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface") * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
*/ */
protected $merchant; protected $merchant;


/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface")
*/
protected $section;


public function getMerchant(): MerchantInterface public function getMerchant(): MerchantInterface
{ {


return $this; return $this;
} }

public function getSection(): ?SectionInterface
{
return $this->section;
}

public function setSection(?SectionInterface $section): self
{
$this->section = $section;

return $this;
}
} }

+ 20
- 0
Repository/Reminder/ReminderRepository.php View File

<?php

namespace Lc\CaracoleBundle\Repository\Reminder;

use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Model\Reminder\ReminderInterface;
use Lc\SovBundle\Repository\Reminder\ReminderRepository as SovReminderRepository;

/**
* @method ReminderInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ReminderInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ReminderInterface[] findAll()
* @method ReminderInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ReminderRepository extends SovReminderRepository
{
use RepositoryTrait;


}

+ 1
- 0
Resources/assets/app/adminlte/common/common.scss View File

padding-top: 0px; padding-top: 0px;
padding-bottom: 0px; padding-bottom: 0px;
border-width: 2px; border-width: 2px;
z-index: 1;


ul.left { ul.left {
position: relative; position: relative;

Loading…
Cancel
Save