This commit is contained in:
Tykayn 2025-02-14 14:25:23 +01:00 committed by tykayn
parent b373892ddc
commit c44ac9c522
25 changed files with 485 additions and 26 deletions

View file

@ -26,8 +26,8 @@ security:
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/logged, roles: ROLE_USER }
when@test:
security:

View file

@ -3,7 +3,7 @@
namespace App\Controller;
use App\Entity\Expense;
use App\Form\ExpenseType;
use App\Form\Expense1Type;
use App\Repository\ExpenseRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -26,7 +26,7 @@ final class ExpenseController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$expense = new Expense();
$form = $this->createForm(ExpenseType::class, $expense);
$form = $this->createForm(Expense1Type::class, $expense);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@ -53,7 +53,7 @@ final class ExpenseController extends AbstractController
#[Route('/{id}/edit', name: 'app_expense_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Expense $expense, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ExpenseType::class, $expense);
$form = $this->createForm(Expense1Type::class, $expense);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {

View file

@ -3,7 +3,7 @@
namespace App\Controller;
use App\Entity\Festival;
use App\Form\FestivalType;
use App\Form\Festival1Type;
use App\Repository\FestivalRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -26,7 +26,7 @@ final class FestivalController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$festival = new Festival();
$form = $this->createForm(FestivalType::class, $festival);
$form = $this->createForm(Festival1Type::class, $festival);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@ -53,7 +53,7 @@ final class FestivalController extends AbstractController
#[Route('/{id}/edit', name: 'app_festival_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Festival $festival, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(FestivalType::class, $festival);
$form = $this->createForm(Festival1Type::class, $festival);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {

View file

@ -3,7 +3,7 @@
namespace App\Controller;
use App\Entity\GroupOfProducts;
use App\Form\GroupOfProductsType;
use App\Form\GroupOfProducts1Type;
use App\Repository\GroupOfProductsRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -26,7 +26,7 @@ final class GroupOfProductsController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$groupOfProduct = new GroupOfProducts();
$form = $this->createForm(GroupOfProductsType::class, $groupOfProduct);
$form = $this->createForm(GroupOfProducts1Type::class, $groupOfProduct);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@ -53,7 +53,7 @@ final class GroupOfProductsController extends AbstractController
#[Route('/{id}/edit', name: 'app_group_of_products_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, GroupOfProducts $groupOfProduct, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(GroupOfProductsType::class, $groupOfProduct);
$form = $this->createForm(GroupOfProducts1Type::class, $groupOfProduct);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {

View file

@ -3,7 +3,7 @@
namespace App\Controller;
use App\Entity\Product;
use App\Form\ProductType;
use App\Form\Product1Type;
use App\Repository\ProductRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -26,7 +26,7 @@ final class ProductController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$product = new Product();
$form = $this->createForm(ProductType::class, $product);
$form = $this->createForm(Product1Type::class, $product);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@ -53,7 +53,7 @@ final class ProductController extends AbstractController
#[Route('/{id}/edit', name: 'app_product_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Product $product, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ProductType::class, $product);
$form = $this->createForm(Product1Type::class, $product);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {

View file

@ -3,7 +3,7 @@
namespace App\Controller;
use App\Entity\Selling;
use App\Form\SellingType;
use App\Form\Selling1Type;
use App\Repository\SellingRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -26,7 +26,7 @@ final class SellingController extends AbstractController
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$selling = new Selling();
$form = $this->createForm(SellingType::class, $selling);
$form = $this->createForm(Selling1Type::class, $selling);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@ -53,7 +53,7 @@ final class SellingController extends AbstractController
#[Route('/{id}/edit', name: 'app_selling_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Selling $selling, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(SellingType::class, $selling);
$form = $this->createForm(Selling1Type::class, $selling);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {

View file

@ -0,0 +1,81 @@
<?php
namespace App\Controller;
use App\Entity\SerieFestival;
use App\Form\SerieFestivalType;
use App\Repository\SerieFestivalRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/serie/festival')]
final class SerieFestivalController extends AbstractController
{
#[Route(name: 'app_serie_festival_index', methods: ['GET'])]
public function index(SerieFestivalRepository $serieFestivalRepository): Response
{
return $this->render('serie_festival/index.html.twig', [
'serie_festivals' => $serieFestivalRepository->findAll(),
]);
}
#[Route('/new', name: 'app_serie_festival_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$serieFestival = new SerieFestival();
$form = $this->createForm(SerieFestivalType::class, $serieFestival);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($serieFestival);
$entityManager->flush();
return $this->redirectToRoute('app_serie_festival_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('serie_festival/new.html.twig', [
'serie_festival' => $serieFestival,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_serie_festival_show', methods: ['GET'])]
public function show(SerieFestival $serieFestival): Response
{
return $this->render('serie_festival/show.html.twig', [
'serie_festival' => $serieFestival,
]);
}
#[Route('/{id}/edit', name: 'app_serie_festival_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, SerieFestival $serieFestival, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(SerieFestivalType::class, $serieFestival);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();
return $this->redirectToRoute('app_serie_festival_index', [], Response::HTTP_SEE_OTHER);
}
return $this->render('serie_festival/edit.html.twig', [
'serie_festival' => $serieFestival,
'form' => $form,
]);
}
#[Route('/{id}', name: 'app_serie_festival_delete', methods: ['POST'])]
public function delete(Request $request, SerieFestival $serieFestival, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$serieFestival->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($serieFestival);
$entityManager->flush();
}
return $this->redirectToRoute('app_serie_festival_index', [], Response::HTTP_SEE_OTHER);
}
}

32
src/Form/Expense1Type.php Normal file
View file

@ -0,0 +1,32 @@
<?php
namespace App\Form;
use App\Entity\Expense;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class Expense1Type extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('price')
->add('user', EntityType::class, [
'class' => User::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Expense::class,
]);
}
}

View file

@ -0,0 +1,48 @@
<?php
namespace App\Form;
use App\Entity\Festival;
use App\Entity\SerieFestival;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class Festival1Type extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('date_start', null, [
'widget' => 'single_text',
])
->add('date_end', null, [
'widget' => 'single_text',
])
->add('fraisInscription')
->add('fondDeCaisseAvant')
->add('fondDeCaisseApres')
->add('dateCreation', null, [
'widget' => 'single_text',
])
->add('user', EntityType::class, [
'class' => User::class,
'choice_label' => 'id',
])
->add('serieFestival', EntityType::class, [
'class' => SerieFestival::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Festival::class,
]);
}
}

View file

@ -0,0 +1,43 @@
<?php
namespace App\Form;
use App\Entity\GroupOfProducts;
use App\Entity\Product;
use App\Entity\Selling;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class GroupOfProducts1Type extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('products', EntityType::class, [
'class' => Product::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('sellings', EntityType::class, [
'class' => Selling::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('user', EntityType::class, [
'class' => User::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => GroupOfProducts::class,
]);
}
}

47
src/Form/Product1Type.php Normal file
View file

@ -0,0 +1,47 @@
<?php
namespace App\Form;
use App\Entity\GroupOfProducts;
use App\Entity\Product;
use App\Entity\Selling;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class Product1Type extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('price')
->add('stock')
->add('image')
->add('comment')
->add('groupOfProducts', EntityType::class, [
'class' => GroupOfProducts::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('sellings', EntityType::class, [
'class' => Selling::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('user', EntityType::class, [
'class' => User::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Product::class,
]);
}
}

45
src/Form/Selling1Type.php Normal file
View file

@ -0,0 +1,45 @@
<?php
namespace App\Form;
use App\Entity\Festival;
use App\Entity\GroupOfProducts;
use App\Entity\Product;
use App\Entity\Selling;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class Selling1Type extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('note')
->add('sum')
->add('reduction')
->add('groupOfProducts', EntityType::class, [
'class' => GroupOfProducts::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('products', EntityType::class, [
'class' => Product::class,
'choice_label' => 'id',
'multiple' => true,
])
->add('festival', EntityType::class, [
'class' => Festival::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Selling::class,
]);
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace App\Form;
use App\Entity\SerieFestival;
use App\Entity\User;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class SerieFestivalType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('dateCreation', null, [
'widget' => 'single_text',
])
->add('user', EntityType::class, [
'class' => User::class,
'choice_label' => 'id',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => SerieFestival::class,
]);
}
}

View file

@ -12,6 +12,10 @@
<th>Name</th>
<th>Date_start</th>
<th>Date_end</th>
<th>FraisInscription</th>
<th>FondDeCaisseAvant</th>
<th>FondDeCaisseApres</th>
<th>DateCreation</th>
<th>actions</th>
</tr>
</thead>
@ -22,6 +26,10 @@
<td>{{ festival.name }}</td>
<td>{{ festival.dateStart ? festival.dateStart|date('Y-m-d') : '' }}</td>
<td>{{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }}</td>
<td>{{ festival.fraisInscription }}</td>
<td>{{ festival.fondDeCaisseAvant }}</td>
<td>{{ festival.fondDeCaisseApres }}</td>
<td>{{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }}</td>
<td>
<a href="{{ path('app_festival_show', {'id': festival.id}) }}">show</a>
<a href="{{ path('app_festival_edit', {'id': festival.id}) }}">edit</a>
@ -29,7 +37,7 @@
</tr>
{% else %}
<tr>
<td colspan="5">no records found</td>
<td colspan="9">no records found</td>
</tr>
{% endfor %}
</tbody>

View file

@ -23,6 +23,22 @@
<th>Date_end</th>
<td>{{ festival.dateEnd ? festival.dateEnd|date('Y-m-d') : '' }}</td>
</tr>
<tr>
<th>FraisInscription</th>
<td>{{ festival.fraisInscription }}</td>
</tr>
<tr>
<th>FondDeCaisseAvant</th>
<td>{{ festival.fondDeCaisseAvant }}</td>
</tr>
<tr>
<th>FondDeCaisseApres</th>
<td>{{ festival.fondDeCaisseApres }}</td>
</tr>
<tr>
<th>DateCreation</th>
<td>{{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }}</td>
</tr>
</tbody>
</table>

View file

@ -12,6 +12,8 @@
<th>Name</th>
<th>Price</th>
<th>Stock</th>
<th>Image</th>
<th>Comment</th>
<th>actions</th>
</tr>
</thead>
@ -22,6 +24,8 @@
<td>{{ product.name }}</td>
<td>{{ product.price }}</td>
<td>{{ product.stock }}</td>
<td>{{ product.image }}</td>
<td>{{ product.comment }}</td>
<td>
<a href="{{ path('app_product_show', {'id': product.id}) }}">show</a>
<a href="{{ path('app_product_edit', {'id': product.id}) }}">edit</a>
@ -29,7 +33,7 @@
</tr>
{% else %}
<tr>
<td colspan="5">no records found</td>
<td colspan="7">no records found</td>
</tr>
{% endfor %}
</tbody>

View file

@ -23,6 +23,14 @@
<th>Stock</th>
<td>{{ product.stock }}</td>
</tr>
<tr>
<th>Image</th>
<td>{{ product.image }}</td>
</tr>
<tr>
<th>Comment</th>
<td>{{ product.comment }}</td>
</tr>
</tbody>
</table>

View file

@ -10,7 +10,6 @@
<tr>
<th>Id</th>
<th>Note</th>
<th>Products</th>
<th>Sum</th>
<th>Reduction</th>
<th>actions</th>
@ -21,7 +20,6 @@
<tr>
<td>{{ selling.id }}</td>
<td>{{ selling.note }}</td>
<td>{{ selling.products }}</td>
<td>{{ selling.sum }}</td>
<td>{{ selling.reduction }}</td>
<td>
@ -31,7 +29,7 @@
</tr>
{% else %}
<tr>
<td colspan="6">no records found</td>
<td colspan="5">no records found</td>
</tr>
{% endfor %}
</tbody>

View file

@ -15,10 +15,6 @@
<th>Note</th>
<td>{{ selling.note }}</td>
</tr>
<tr>
<th>Products</th>
<td>{{ selling.products }}</td>
</tr>
<tr>
<th>Sum</th>
<td>{{ selling.sum }}</td>

View file

@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_serie_festival_delete', {'id': serie_festival.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ serie_festival.id) }}">
<button class="btn">Delete</button>
</form>

View file

@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View file

@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit SerieFestival{% endblock %}
{% block body %}
<h1>Edit SerieFestival</h1>
{{ include('serie_festival/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_serie_festival_index') }}">back to list</a>
{{ include('serie_festival/_delete_form.html.twig') }}
{% endblock %}

View file

@ -0,0 +1,37 @@
{% extends 'base.html.twig' %}
{% block title %}SerieFestival index{% endblock %}
{% block body %}
<h1>SerieFestival index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>DateCreation</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for serie_festival in serie_festivals %}
<tr>
<td>{{ serie_festival.id }}</td>
<td>{{ serie_festival.name }}</td>
<td>{{ serie_festival.dateCreation ? serie_festival.dateCreation|date('Y-m-d') : '' }}</td>
<td>
<a href="{{ path('app_serie_festival_show', {'id': serie_festival.id}) }}">show</a>
<a href="{{ path('app_serie_festival_edit', {'id': serie_festival.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="4">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_serie_festival_new') }}">Create new</a>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New SerieFestival{% endblock %}
{% block body %}
<h1>Create new SerieFestival</h1>
{{ include('serie_festival/_form.html.twig') }}
<a href="{{ path('app_serie_festival_index') }}">back to list</a>
{% endblock %}

View file

@ -0,0 +1,30 @@
{% extends 'base.html.twig' %}
{% block title %}SerieFestival{% endblock %}
{% block body %}
<h1>SerieFestival</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ serie_festival.id }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ serie_festival.name }}</td>
</tr>
<tr>
<th>DateCreation</th>
<td>{{ serie_festival.dateCreation ? serie_festival.dateCreation|date('Y-m-d') : '' }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_serie_festival_index') }}">back to list</a>
<a href="{{ path('app_serie_festival_edit', {'id': serie_festival.id}) }}">edit</a>
{{ include('serie_festival/_delete_form.html.twig') }}
{% endblock %}