diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fd5ef67c..3cb5d027 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -24,12 +24,9 @@ - - - - + + - @@ -332,47 +329,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index 3e41c1b5..dd3de5bd 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -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'); } @@ -42,12 +33,20 @@ class DashboardController extends AbstractDashboardController return Dashboard::new() ->setTitle('Caisse'); } - public function configureMenuItems(): iterable + public function configureMenuItems(): iterable { 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), ]; } diff --git a/src/Controller/Admin/ExepenseConfigCrudController.php b/src/Controller/Admin/ExepenseConfigCrudController.php new file mode 100644 index 00000000..fa96808b --- /dev/null +++ b/src/Controller/Admin/ExepenseConfigCrudController.php @@ -0,0 +1,28 @@ +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'), + ]; + } +} diff --git a/src/Controller/Admin/ProductSoldCrudController.php b/src/Controller/Admin/ProductSoldCrudController.php new file mode 100644 index 00000000..ce643140 --- /dev/null +++ b/src/Controller/Admin/ProductSoldCrudController.php @@ -0,0 +1,28 @@ +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 diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index 579269de..7d3ce87b 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -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();