Browse Source

Crud Merchant, Section, Page

feature/ticket
Guillaume 3 years ago
parent
commit
db6a8007c8
10 changed files with 758 additions and 523 deletions
  1. +586
    -493
      composer.lock
  2. +0
    -1
      config/services.yaml
  3. +31
    -0
      migrations/Version20210603092517.php
  4. +23
    -24
      src/Controller/Admin/DashboardController.php
  5. +46
    -0
      src/Controller/Admin/MerchantCrudController.php
  6. +1
    -4
      src/Controller/Admin/PageCrudController.php
  7. +57
    -0
      src/Controller/Admin/SectionCrudController.php
  8. +1
    -1
      src/Entity/Site/Page.php
  9. +3
    -0
      symfony.lock
  10. +10
    -0
      templates/admin/dashboard.html.twig

+ 586
- 493
composer.lock
File diff suppressed because it is too large
View File


+ 0
- 1
config/services.yaml View File

resource: '../src/Controller/' resource: '../src/Controller/'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']



Lc\CaracoleBundle\: Lc\CaracoleBundle\:
resource: '../Lc/CaracoleBundle/' resource: '../Lc/CaracoleBundle/'
exclude: exclude:

+ 31
- 0
migrations/Version20210603092517.php View File

<?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 Version20210603092517 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->addSql('ALTER TABLE section ADD color VARCHAR(32) NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE section DROP color');
}
}

+ 23
- 24
src/Controller/Admin/DashboardController.php View File



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



use App\Entity\Common\TaxRate; use App\Entity\Common\TaxRate;
use App\Entity\Merchant\Merchant;
use App\Entity\Section\Section;
use App\Entity\Site\Page; use App\Entity\Site\Page;
use App\Entity\User\GroupUser;
use App\Entity\User\User; use App\Entity\User\User;
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use Lc\SovBundle\Controller\Admin\DashboardController as LcDashboardController;
use Lc\CaracoleBundle\Controller\Admin\DashboardController as CaracDashboardController;
use Symfony\Component\HttpFoundation\Response;


class DashboardController extends LcDashboardController
class DashboardController extends CaracDashboardController
{ {


public function configureMenuItems(): iterable public function configureMenuItems(): iterable
{ {
yield MenuItem::linkToDashboard('Tableau de bord', 'circle');
yield MenuItem::linkToDashboard('dashboard', 'circle');


yield MenuItem::subMenu('Utilisateurs', 'user')->setSubItems(
yield MenuItem::linkToCrud('page', 'copy', Page::class);
yield MenuItem::subMenu('user', 'user')->setSubItems(
[ [
MenuItem::linkToCrud('Utilisateurs', '', User::class),
MenuItem::linkToCrud('Groupes d\'utilisateurs', '', GroupUser::class),
MenuItem::linkToCrud('user_index', '', User::class),
] ]
); );

yield MenuItem::linkToCrud('Pages', 'copy', Page::class);
yield MenuItem::linkToCrud('TVA', 'circle', TaxRate::class);

yield MenuItem::subMenu('Mon compte', 'user')->setSubItems(
yield MenuItem::subMenu('account', 'user')->setSubItems(
[ [
MenuItem::linkToRoute('Informations personnelles', '', 'sov_admin_account_profile'),
MenuItem::linkToRoute('Mot de passe', '', 'sov_admin_account_password'),
MenuItem::linkToRoute('account_profile', '', 'sov_admin_account_profile'),
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'),
] ]
); );


/*
MenuItem::section('Blog'),
MenuItem::linkToCrud('Categories', 'fa fa-tags', Category::class),
MenuItem::linkToCrud('Blog Posts', 'fa fa-file-text', BlogPost::class),
yield MenuItem::subMenu('admin', 'circle')->setSubItems(
[
MenuItem::linkToCrud('admin_merchant', 'circle', Merchant::class),
MenuItem::linkToCrud('admin_section', 'circle', Section::class),
MenuItem::linkToCrud('admin_tva', 'circle', TaxRate::class),
]
);
}


MenuItem::section('Users'),
MenuItem::linkToCrud('Comments', 'fa fa-comment', Comment::class),
MenuItem::linkToCrud('Users', 'fa fa-user', User::class),*/
public function index(): Response
{
return $this->render('admin/dashboard.html.twig');
} }


/*public function configureMenuItems(): iterable /*public function configureMenuItems(): iterable

+ 46
- 0
src/Controller/Admin/MerchantCrudController.php View File

<?php

namespace App\Controller\Admin;

use App\Entity\Merchant\Merchant;
use App\Entity\Section\Section;
use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;

class MerchantCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Merchant::class;
}

public function configureFields(string $pageName): iterable
{
$panel = parent::configureFields($pageName);

return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('position')
->hideOnForm()
->hideOnIndex(),
CKEditorField::new('description')
->hideOnIndex(),
AssociationField::new('taxRate')
->setRequired(true)
->hideOnIndex(),
StatusField::new('status'),
],
$panel
);
}

}

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



return array_merge( return array_merge(
[ [
FormField::addPanel('Général'),
//->setCustomOption('template', '@LcSov/adminlte/crud/_test.html.twig')
FormField::addPanel('general'),
TextField::new('title'), TextField::new('title'),
NumberField::new('position')->hideOnForm(), NumberField::new('position')->hideOnForm(),
//BooleanField::new('titlefefe')->setFormTypeOption('mapped', false)->setFormTypeOption('required', true),
StatusField::new('status'), StatusField::new('status'),
CKEditorField::new('description'), CKEditorField::new('description'),

], ],
$panel $panel
); );

+ 57
- 0
src/Controller/Admin/SectionCrudController.php View File

<?php

namespace App\Controller\Admin;

use App\Entity\Section\Section;
use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\Admin\AbstractCrudController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;

class SectionCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Section::class;
}

public function configureFields(string $pageName): iterable
{
$panel = parent::configureFields($pageName);

return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
AssociationField::new('merchant'),
ChoiceField::new('cycle')
->setRequired(true)
->setChoices(
[
'Jour' => Section::CYCLE_DAY,
'Semaine' => Section::CYCLE_WEEK,
'Mois' => Section::CYCLE_MONTH,
'Année' => Section::CYCLE_YEAR,
]
),
TextField::new('color')
->setRequired(true)
->hideOnIndex(),
NumberField::new('position')
->hideOnForm()
->hideOnIndex(),
CKEditorField::new('description')
->hideOnIndex(),
StatusField::new('status'),
],
$panel
);
}

}

+ 1
- 1
src/Entity/Site/Page.php View File



namespace App\Entity\Site; namespace App\Entity\Site;


use Lc\CaracoleBundle\Repository\Site\PageRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use App\Entity\File\File ; use App\Entity\File\File ;
use Lc\CaracoleBundle\Repository\Site\PageRepository;


/** /**
* @ORM\Entity(repositoryClass=PageRepository::class) * @ORM\Entity(repositoryClass=PageRepository::class)

+ 3
- 0
symfony.lock View File

"symfony/polyfill-php80": { "symfony/polyfill-php80": {
"version": "v1.22.1" "version": "v1.22.1"
}, },
"symfony/polyfill-php81": {
"version": "v1.23.0"
},
"symfony/polyfill-uuid": { "symfony/polyfill-uuid": {
"version": "v1.22.1" "version": "v1.22.1"
}, },

+ 10
- 0
templates/admin/dashboard.html.twig View File

{% extends '@LcCaracole/adminlte/layout.html.twig' %}

{% block content_title %}
{{ 'dashboard'|lc_trans_admin_title }}
{% endblock %}

{% block main %}
Tableau de bord par défaut Caracole.
{% endblock %}


Loading…
Cancel
Save