admin cruds
This commit is contained in:
parent
2fa0183b42
commit
32dfa20583
@ -24,12 +24,9 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="7b6ae3ea-b7de-4daa-94af-b6fb4f3c8b8e" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/config/bundles.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/bundles.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/config/packages/security.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/config/packages/security.yaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Controller/Admin/DashboardController.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Controller/Admin/DashboardController.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Controller/Admin/UserCrudController.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/Controller/Admin/UserCrudController.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/DataFixtures/AppFixtures.php" beforeDir="false" afterPath="$PROJECT_DIR$/src/DataFixtures/AppFixtures.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/symfony.lock" beforeDir="false" afterPath="$PROJECT_DIR$/symfony.lock" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -314,7 +311,7 @@
|
||||
<workItem from="1687943901322" duration="8313000" />
|
||||
<workItem from="1721124162582" duration="4590000" />
|
||||
<workItem from="1721135270174" duration="484000" />
|
||||
<workItem from="1721135995908" duration="3026000" />
|
||||
<workItem from="1721135995908" duration="4298000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -332,47 +329,4 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state x="703" y="141" key="#com.intellij.ide.util.MemberChooser" timestamp="1687278814575">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="703" y="141" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1080/1920.0.3440.1440@0.0.1920.1080" timestamp="1687278814575" />
|
||||
<state x="691" y="212" key="FileChooserDialogImpl" timestamp="1686849741743">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="691" y="212" key="FileChooserDialogImpl/0.0.1920.1080/1920.0.3440.1440@0.0.1920.1080" timestamp="1686849741743" />
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.bottom" timestamp="1687513180430">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.bottom/0.0.1920.1036@0.0.1920.1036" timestamp="1687513180430" />
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.center" timestamp="1687513180430">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.center/0.0.1920.1036@0.0.1920.1036" timestamp="1687513180430" />
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.left" timestamp="1687513180429">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.left/0.0.1920.1036@0.0.1920.1036" timestamp="1687513180429" />
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.right" timestamp="1687513180430">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state width="1866" height="459" key="GridCell.Tab.0.right/0.0.1920.1036@0.0.1920.1036" timestamp="1687513180430" />
|
||||
<state x="318" y="86" key="SettingsEditor" timestamp="1687165377814">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="318" y="86" key="SettingsEditor/0.0.1920.1080/1920.0.3440.1440@0.0.1920.1080" timestamp="1687165377814" />
|
||||
<state x="583" y="133" width="1201" height="770" key="find.popup" timestamp="1687960544044">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state x="583" y="133" width="1201" height="770" key="find.popup/0.0.1920.1036@0.0.1920.1036" timestamp="1687960544044" />
|
||||
<state x="583" y="139" width="1201" height="802" key="find.popup/0.0.1920.1080/1920.0.3440.1440@0.0.1920.1080" timestamp="1687280123841" />
|
||||
<state x="670" y="328" width="533" height="422" key="scopes" timestamp="1687956395639">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state x="670" y="328" width="533" height="422" key="scopes/0.0.1920.1036@0.0.1920.1036" timestamp="1687956395639" />
|
||||
<state x="624" y="164" width="672" height="676" key="search.everywhere.popup" timestamp="1687961242028">
|
||||
<screen x="0" y="0" width="1920" height="1036" />
|
||||
</state>
|
||||
<state x="624" y="164" width="672" height="676" key="search.everywhere.popup/0.0.1920.1036@0.0.1920.1036" timestamp="1687961242028" />
|
||||
</component>
|
||||
</project>
|
@ -7,33 +7,24 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
use ExepenseConfigCrudController;
|
||||
use UserCrudController;
|
||||
use ProductCrudController;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Entity\ExepenseConfig;
|
||||
use App\Entity\SerieFestival;
|
||||
use App\Entity\Festival;
|
||||
use App\Entity\Product;
|
||||
use App\Entity\ProductSold;
|
||||
use App\Entity\ProductCategory;
|
||||
|
||||
class DashboardController extends AbstractDashboardController
|
||||
{
|
||||
#[Route('/admin', name: 'admin')]
|
||||
public function index(): Response
|
||||
{
|
||||
// return parent::index();
|
||||
|
||||
// Option 1. You can make your dashboard redirect to some common page of your backend
|
||||
//
|
||||
// $adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);
|
||||
|
||||
// Option 1. Make your dashboard redirect to the same page for all users
|
||||
// return $this->redirect($adminUrlGenerator->setController(UserCrudController::class)->generateUrl());
|
||||
|
||||
|
||||
// Option 2. You can make your dashboard redirect to different pages depending on the user
|
||||
//
|
||||
// if ('jane' === $this->getUser()->getUsername()) {
|
||||
// return $this->redirect('...');
|
||||
// }
|
||||
|
||||
// Option 3. You can render some custom template to display a proper dashboard with widgets, etc.
|
||||
// (tip: it's easier if your template extends from @EasyAdmin/page/content.html.twig)
|
||||
//
|
||||
return $this->render('admin/dashboard.html.twig');
|
||||
}
|
||||
|
||||
@ -46,8 +37,16 @@ class DashboardController extends AbstractDashboardController
|
||||
{
|
||||
return [
|
||||
MenuItem::linkToDashboard('Dashboard', 'fa fa-home'),
|
||||
MenuItem::section('Users'),
|
||||
MenuItem::linkToCrud('Users', 'fa fa-user', User::class),
|
||||
MenuItem::section('Utilisatrices'),
|
||||
MenuItem::linkToCrud('Gens', 'fa fa-user', User::class),
|
||||
MenuItem::linkToCrud('Dépenses', 'fa fa-user', ExepenseConfig::class),
|
||||
MenuItem::section('Biens'),
|
||||
MenuItem::linkToCrud('Produits', 'fa fa-user', Product::class),
|
||||
MenuItem::linkToCrud('Ventes', 'fa fa-user', ProductSold::class),
|
||||
MenuItem::linkToCrud('Catégories', 'fa fa-user', ProductCategory::class),
|
||||
MenuItem::section('Festivals'),
|
||||
MenuItem::linkToCrud('Catégories', 'fa fa-user', SerieFestival::class),
|
||||
MenuItem::linkToCrud('Festivals', 'fa fa-user', Festival::class),
|
||||
];
|
||||
}
|
||||
|
||||
|
28
src/Controller/Admin/ExepenseConfigCrudController.php
Normal file
28
src/Controller/Admin/ExepenseConfigCrudController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\ExepenseConfig;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class ExepenseConfigCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return ExepenseConfig::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
28
src/Controller/Admin/FestivalCrudController.php
Normal file
28
src/Controller/Admin/FestivalCrudController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\Festival;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class FestivalCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return Festival::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
28
src/Controller/Admin/ProductCategoryCrudController.php
Normal file
28
src/Controller/Admin/ProductCategoryCrudController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\ProductCategory;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class ProductCategoryCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return ProductCategory::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
47
src/Controller/Admin/ProductCrudController.php
Normal file
47
src/Controller/Admin/ProductCrudController.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\Product;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
|
||||
class ProductCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return Product::class;
|
||||
}
|
||||
public function configureCrud(Crud $crud): Crud
|
||||
{
|
||||
return $crud
|
||||
// set this option if you prefer the page content to span the entire
|
||||
// browser width, instead of the default design which sets a max width
|
||||
->renderContentMaximized()
|
||||
|
||||
// set this option if you prefer the sidebar (which contains the main menu)
|
||||
// to be displayed as a narrow column instead of the default expanded design
|
||||
// ->renderSidebarMinimized()
|
||||
;
|
||||
}
|
||||
public function configureMenuItems(): iterable
|
||||
{
|
||||
return[
|
||||
MenuItem::linkToCrud('Products', 'fa fa-tags', Category::class),
|
||||
MenuItem::section('Products'),
|
||||
];
|
||||
}
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
// TextField::new('title'),
|
||||
TextEditorField::new('name'),
|
||||
];
|
||||
}
|
||||
}
|
28
src/Controller/Admin/ProductSoldCrudController.php
Normal file
28
src/Controller/Admin/ProductSoldCrudController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\ProductSold;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class ProductSoldCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return ProductSold::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
28
src/Controller/Admin/SellRecordCrudController.php
Normal file
28
src/Controller/Admin/SellRecordCrudController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\SellRecord;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class SellRecordCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return SellRecord::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
28
src/Controller/Admin/SerieFestivalCrudController.php
Normal file
28
src/Controller/Admin/SerieFestivalCrudController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Entity\SerieFestival;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
|
||||
class SerieFestivalCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return SerieFestival::class;
|
||||
}
|
||||
|
||||
/*
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IdField::new('id'),
|
||||
TextField::new('title'),
|
||||
TextEditorField::new('description'),
|
||||
];
|
||||
}
|
||||
*/
|
||||
}
|
@ -20,13 +20,7 @@ class UserCrudController extends AbstractCrudController
|
||||
public function configureCrud(Crud $crud): Crud
|
||||
{
|
||||
return $crud
|
||||
// set this option if you prefer the page content to span the entire
|
||||
// browser width, instead of the default design which sets a max width
|
||||
->renderContentMaximized()
|
||||
|
||||
// set this option if you prefer the sidebar (which contains the main menu)
|
||||
// to be displayed as a narrow column instead of the default expanded design
|
||||
// ->renderSidebarMinimized()
|
||||
;
|
||||
}
|
||||
public function configureMenuItems(): iterable
|
||||
|
@ -9,16 +9,36 @@ class AppFixtures extends Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$product = new Product();
|
||||
|
||||
$expense = new Exepense();
|
||||
$expense->setName('courses au marché')
|
||||
->setAmount(40);
|
||||
|
||||
$product = new Product();
|
||||
$product->setName('Un Livre d\'exemple');
|
||||
|
||||
$categ = new Category();
|
||||
$categ->setName('Livres');
|
||||
|
||||
$demo_user = new User();
|
||||
|
||||
$demo_user->setEmail('contact+admin@cipherbliss.com')->setRoles('ROLE_ADMIN')->addProduct($product);
|
||||
$demo_user
|
||||
->setEmail('demo@demo.com')
|
||||
->setRoles('ROLE_ADMIN')
|
||||
->addExpenseConfig($expense)
|
||||
->addProduct($product);
|
||||
|
||||
$product
|
||||
->setCategory($categ)
|
||||
->setOwner($demo_user);
|
||||
|
||||
$expense->setOwner($demo_user);
|
||||
|
||||
$categ->addProduct($product);
|
||||
|
||||
$manager->persist($expense);
|
||||
$manager->persist($product);
|
||||
$manager->persist($categ);
|
||||
$manager->persist($demo_user);
|
||||
|
||||
$manager->flush();
|
||||
|
Loading…
Reference in New Issue
Block a user