Selaa lähdekoodia

Reminder

ideas
Guillaume 3 vuotta sitten
vanhempi
commit
d261a963ea
6 muutettua tiedostoa jossa 114 lisäystä ja 6 poistoa
  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 Näytä tiedosto

@@ -4,7 +4,10 @@ namespace Lc\CaracoleBundle\Controller\Dashboard;

use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
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
{
@@ -15,17 +18,28 @@ class DashboardAdminAdminController extends SovDashboardController
$crud
->overrideTemplate('layout', '@LcCaracole/adminlte/layout.html.twig');

return $crud ;
return $crud;
}

public function configureAssets(): Assets
{
$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 Näytä tiedosto

@@ -0,0 +1,43 @@
<?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 Näytä tiedosto

@@ -0,0 +1,12 @@
<?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 Näytä tiedosto

@@ -4,13 +4,15 @@ namespace Lc\CaracoleBundle\Model\Reminder;

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

/**
* @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")
@@ -18,6 +20,10 @@ abstract class ReminderModel extends SovReminderModel implements FilterMerchantI
*/
protected $merchant;

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

public function getMerchant(): MerchantInterface
{
@@ -30,4 +36,16 @@ abstract class ReminderModel extends SovReminderModel implements FilterMerchantI

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 Näytä tiedosto

@@ -0,0 +1,20 @@
<?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 Näytä tiedosto

@@ -5,6 +5,7 @@ nav.navbar.carac {
padding-top: 0px;
padding-bottom: 0px;
border-width: 2px;
z-index: 1;

ul.left {
position: relative;

Loading…
Peruuta
Tallenna