diff --git a/assets/styles/pages/_dashboard.scss b/assets/styles/pages/_dashboard.scss index 64cb6474..f56a144a 100755 --- a/assets/styles/pages/_dashboard.scss +++ b/assets/styles/pages/_dashboard.scss @@ -1,6 +1,7 @@ #caisse-now { min-height: 90vh; - padding-left: 10vw; + width: 70vw; + padding-left: 0; .product-box { display: inline-block; @@ -21,7 +22,8 @@ background: yellowgreen; } - .btn, button { + .btn, + button { font-size: 1.6rem; padding: 1.5rem; -webkit-border-radius: 1rem; @@ -67,14 +69,14 @@ // list of one category .one-category { background: #dedede; - width: 350px; + width: 31rem; margin: 0 4px; height: calc(74vh - 1rem); box-sizing: border-box; display: inline-block; - //vertical-align: top; white-space: nowrap; - //float: left; + overflow-y: auto; + h2 { font-weight: bold; @@ -106,6 +108,10 @@ } } +#loaded { + padding-bottom: 10rem; +} + #not_loaded { width: 100%; height: 75vh; @@ -124,6 +130,6 @@ text-align: center; } -#main_options{ +#main_options { width: 100%; } \ No newline at end of file diff --git a/assets/styles/pages/_forms.scss b/assets/styles/pages/_forms.scss index eb3d893f..c75b748d 100644 --- a/assets/styles/pages/_forms.scss +++ b/assets/styles/pages/_forms.scss @@ -1,10 +1,11 @@ form { - label{ + label { min-width: 300px; padding-right: 2rem; padding-bottom: 1rem; margin-bottom: 0.5rem; } + textarea, select { padding: 1rem 2rem; @@ -15,29 +16,36 @@ form { width: 100%; min-width: 50vw; } + input { padding: 1rem 2rem; border-radius: 0.5rem; border: solid 1px #ccc; margin-bottom: 0.5rem; width: 100%; - min-width: 30vw; + min-width: 30ch; [type="text"] { padding: 1rem 2rem; border-radius: 0.5rem; } + [type="textarea"] { padding: 1rem 2rem; border-radius: 0.5rem; } } - button.btn, a { + button.btn, + a { padding: 1rem 2rem; border-radius: 0.5rem; border: solid 1px #ccc; background: blue; margin-bottom: 0.5rem; } +} + +.btn-remove-all { + color: white; } \ No newline at end of file diff --git a/assets/styles/pages/global.scss b/assets/styles/pages/global.scss index 848fc568..5e79e24f 100755 --- a/assets/styles/pages/global.scss +++ b/assets/styles/pages/global.scss @@ -8,7 +8,8 @@ body { font-size: 1rem; line-height: 2rem; } -.main-container-box{ + +.main-container-box { padding-left: 5rem; } @@ -21,12 +22,12 @@ body { } .bg-dark { - background:rgba(0,0,0,0.55) !important; + background: rgba(0, 0, 0, 0.55) !important; } .bg-shader { @extend .bg-dark; - min-height: 100vh; + min-height: 150vh; } #portfolio { @@ -43,12 +44,13 @@ body { } .logged { + #portfolio, #mainNav, .masthead, { - padding-left: 300px !important; - } + padding-left: 300px !important; +} } .bg-img { @@ -200,10 +202,12 @@ input { overflow-x: auto; z-index: 10; - i, svg{ + i, + svg { min-width: 2rem; margin-right: 2ch; } + .nav { width: 100%; min-width: 300px; @@ -214,10 +218,11 @@ input { color: $light; } - .logo-home{ - width : 300px; + .logo-home { + width: 300px; margin-bottom: 1em; } + .btn-default { color: $light; @@ -241,8 +246,8 @@ input { } } -.nav > li > a:hover, -.nav > li > a { +.nav>li>a:hover, +.nav>li>a { &:focus { background: transparent; border: none; @@ -279,14 +284,14 @@ tr { } .table { - > div { + >div { &:hover { background: #ccc; } } } -.table > thead > tr > td, +.table>thead>tr>td, table td { padding: 0.5em; } @@ -324,7 +329,7 @@ table td { min-height: 90vh; } - > .row { + >.row { min-height: 90vh; // for crud forms @@ -335,7 +340,7 @@ table td { } } - + ul { + +ul { a { margin-top: 1em; } diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index e8a386c9..8b120a49 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -236,29 +236,29 @@ final class DefaultController extends AbstractController $dataOfNewSelling = $data; -// return $this->json($dataOfNewSelling); + $newSelling = new Selling(); // si l'utilisateur courant n'a pas de festival actuel, en créer un -// $currentFestival = $loggedUser->getCurrentFestival(); -// if (!$currentFestival) { -// -// $currentFestival = new Festival(); -// $currentFestival -// ->setName('festival auto créé') -// ->setUser($loggedUser) -// ->setDateCreation(new \DateTime()) -// ->setDateStart(new \DateTime()) -// ->setDateEnd((new \DateTime())->modify('+1 year')) -// ->setClientsCount(1); -// -// $entityManager->persist($currentFestival); -// } else { -// $currentFestival->setClientsCount($currentFestival->getClientsCount() + 1); -// } -// $currentFestival->addSelling($newSelling); + $currentFestival = $loggedUser->getActiveFestival(); + if (!$currentFestival) { + + $currentFestival = new Festival(); + $currentFestival + ->setName('festival auto créé') + ->setUser($loggedUser) + ->setDateCreation(new \DateTime()) + ->setDateStart(new \DateTime()) + ->setDateEnd((new \DateTime())->modify('+1 year')) + ->setClientsCount(1); + + $entityManager->persist($currentFestival); + } else { + $currentFestival->setClientsCount($currentFestival->getClientsCount() + 1); + } + $currentFestival->addSelling($newSelling); // prendre les identifiants des produits en base et les ajouter aux produits de ce Selling // Récupérer les produits à partir des identifiants @@ -286,7 +286,7 @@ final class DefaultController extends AbstractController $entityManager->persist($newSelling); - + $entityManager->persist($currentFestival); $newSelling->setOwner($loggedUser); $entityManager->persist($loggedUser); @@ -295,20 +295,20 @@ final class DefaultController extends AbstractController $response = [ 'message' => 'yes', -// TODO démocker 'newChiffreAffaire' => $currentFestival->getChiffreAffaire(), + 'newChiffreAffaire' => $currentFestival->getChiffreAffaire(), 'newChiffreAffaire' => 12, -// 'clientsCount' => $currentFestival->getClientsCount(), - 'clientsCount' => 12, -// 'activeFestival' => $currentFestival, - 'activeFestival' => ['id' => 1, - 'name' => 'le festival de mock', - 'dateCreation' => '2025-02-16', - 'commentaire' => 'MOCK: hop le commentaire de festival', - 'chiffreAffaire' => '1234', - 'fondDeCaisseAvant' => '100', - 'fondDeCaisseAprès' => '150', - 'sold' => 123 - ], + 'clientsCount' => $currentFestival->getClientsCount(), + // 'clientsCount' => 12, + 'activeFestival' => $currentFestival, + // 'activeFestival' => ['id' => 1, + // 'name' => 'le festival de mock', + // 'dateCreation' => '2025-02-16', + // 'commentaire' => 'MOCK: hop le commentaire de festival', + // 'chiffreAffaire' => '1234', + // 'fondDeCaisseAvant' => '100', + // 'fondDeCaisseAprès' => '150', + // 'sold' => 123 + // ], ]; // prendre en compte l'ajout de nouveaux produits si on a une valeur dans le POST diff --git a/src/Entity/Festival.php b/src/Entity/Festival.php index 191e1d20..8ee45e6a 100644 --- a/src/Entity/Festival.php +++ b/src/Entity/Festival.php @@ -7,58 +7,87 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Metadata\GetCollection; +use ApiPlatform\Metadata\Get; +use ApiPlatform\Metadata\Post; +use ApiPlatform\Metadata\Put; +use Symfony\Component\Serializer\Annotation\Groups; +#[ApiResource( + operations: [ + new GetCollection(normalizationContext: ['groups' => ['festival:read']]), + new Get(normalizationContext: ['groups' => ['festival:read', 'festival:item:read']]), + new Post(denormalizationContext: ['groups' => ['festival:write']]), + new Put(denormalizationContext: ['groups' => ['festival:write']]) + ], + paginationEnabled: false +)] #[ORM\Entity(repositoryClass: FestivalRepository::class)] class Festival { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] + #[Groups(['festival:read', 'selling:read'])] private ?int $id = null; #[ORM\Column(length: 255)] + #[Groups(['festival:read', 'festival:write', 'selling:read'])] private ?string $name = null; #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)] + #[Groups(['festival:read', 'festival:write'])] private ?\DateTimeInterface $date_start = null; #[ORM\Column(type: Types::DATE_MUTABLE)] + #[Groups(['festival:read', 'festival:write'])] private ?\DateTimeInterface $date_end = null; /** * @var Collection */ #[ORM\OneToMany(targetEntity: User::class, mappedBy: 'currentFestival')] + #[Groups(['festival:read'])] private Collection $users; #[ORM\ManyToOne(inversedBy: 'festivals')] + #[Groups(['festival:read', 'festival:write'])] private ?User $user = null; #[ORM\Column(nullable: true)] + #[Groups(['festival:read', 'festival:write'])] private ?float $fraisInscription = null; #[ORM\Column(nullable: true)] + #[Groups(['festival:read', 'festival:write'])] private ?float $fondDeCaisseAvant = null; #[ORM\Column(nullable: true)] + #[Groups(['festival:read', 'festival:write'])] private ?float $fondDeCaisseApres = null; #[ORM\Column(type: Types::DATE_MUTABLE)] + #[Groups(['festival:read', 'festival:write'])] private ?\DateTimeInterface $dateCreation = null; /** * @var Collection */ #[ORM\OneToMany(targetEntity: Selling::class, mappedBy: 'festival')] + #[Groups(['festival:item:read'])] private Collection $sellings; #[ORM\ManyToOne(inversedBy: 'festivals')] + #[Groups(['festival:read', 'festival:write'])] private ?SerieFestival $serieFestival = null; #[ORM\Column(nullable: true)] + #[Groups(['festival:read', 'festival:write'])] private ?float $chiffreAffaire = null; #[ORM\Column(nullable: true)] + #[Groups(['festival:read', 'festival:write'])] private ?int $clientsCount = null; public function __construct() diff --git a/src/Entity/Selling.php b/src/Entity/Selling.php index 66a85ea2..47554b52 100644 --- a/src/Entity/Selling.php +++ b/src/Entity/Selling.php @@ -5,52 +5,77 @@ namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; +use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Metadata\GetCollection; +use ApiPlatform\Metadata\Get; +use ApiPlatform\Metadata\Post; +use ApiPlatform\Metadata\Put; +use Symfony\Component\Serializer\Annotation\Groups; use Doctrine\ORM\Mapping as ORM; -#[ApiResource(paginationEnabled: false)] +#[ApiResource( + operations: [ + new GetCollection(normalizationContext: ['groups' => ['selling:read']]), + new Get(normalizationContext: ['groups' => ['selling:read', 'selling:item:read']]), + new Post(denormalizationContext: ['groups' => ['selling:write']]), + new Put(denormalizationContext: ['groups' => ['selling:write']]) + ], + paginationEnabled: false +)] #[ORM\Entity(repositoryClass: SellingRepository::class)] class Selling { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] + #[Groups(['selling:read'])] private ?int $id = null; #[ORM\Column(length: 255, nullable: true)] + #[Groups(['selling:read', 'selling:write'])] private ?string $note = null; #[ORM\Column] + #[Groups(['selling:read', 'selling:write'])] private ?float $sum = null; #[ORM\Column(nullable: true)] + #[Groups(['selling:read', 'selling:write'])] private ?float $reduction = null; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: GroupOfProducts::class, mappedBy: 'sellings')] + #[Groups(['selling:read', 'selling:write'])] private Collection $groupOfProducts; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'sellings')] + #[Groups(['selling:read', 'selling:write'])] private Collection $products; #[ORM\ManyToOne(inversedBy: 'sellings')] + #[Groups(['selling:read', 'selling:write'])] private ?Festival $festival = null; #[ORM\Column(length: 255)] + #[Groups(['selling:read', 'selling:write'])] private ?string $customer_info = null; #[ORM\Column] + #[Groups(['selling:read', 'selling:write'])] private ?float $paidByCustomer = null; #[ORM\ManyToOne(inversedBy: 'sellings')] + #[Groups(['selling:read', 'selling:write'])] private ?User $owner = null; #[ORM\Column(type: Types::DATE_MUTABLE)] + #[Groups(['selling:read', 'selling:write'])] private ?\DateTimeInterface $date = null; diff --git a/templates/festival/index.html.twig b/templates/festival/index.html.twig index 6fa13979..5e3a6945 100644 --- a/templates/festival/index.html.twig +++ b/templates/festival/index.html.twig @@ -17,6 +17,8 @@ FondDeCaisseApres DateCreation actions + Sellings + Set as active @@ -36,9 +38,14 @@ {{ festival.fondDeCaisseApres }} {{ festival.dateCreation ? festival.dateCreation|date('Y-m-d') : '' }} - show - edit - Set as active + voir + modifier + + + {{ festival.sellings|length }} + + + activer {% else %} diff --git a/templates/logged/angular/current.html.twig b/templates/logged/angular/current.html.twig index 345eef71..b1ba8102 100755 --- a/templates/logged/angular/current.html.twig +++ b/templates/logged/angular/current.html.twig @@ -18,33 +18,32 @@
-
- - - -
+
-
-
+
+ + + +
+
+
- - - - {{group.unitPrice}} - € - - - {{group.count}} - + + + {{group.unitPrice}} + € + + + {{group.count}} +
- {{group.totalPrice}} + {{group.totalPrice}} € -
diff --git a/templates/logged/angular/loaded-caisse.html.twig b/templates/logged/angular/loaded-caisse.html.twig index 594a37f6..e8fa06ea 100755 --- a/templates/logged/angular/loaded-caisse.html.twig +++ b/templates/logged/angular/loaded-caisse.html.twig @@ -1,7 +1,7 @@
-
+
{% include 'logged/angular/messages.html.twig' %} {% include 'logged/angular/listing-products.html.twig' %} @@ -11,7 +11,7 @@
- + {% include 'logged/angular/validate-button.html.twig' %} {% if app.user.products |length %} {% include 'logged/angular/current.html.twig' %} @@ -21,13 +21,18 @@
-
- ventes récentes - {% include 'logged/angular/recent.html.twig' %} -
-
- catégories - {% include 'logged/angular/categ-options.html.twig' %} - -
+
+
+
+ catégories + {% include 'logged/angular/categ-options.html.twig' %} +
+
+
+
+ ventes récentes + {% include 'logged/angular/recent.html.twig' %} +
+
+
diff --git a/templates/logged/customer.html.twig b/templates/logged/customer.html.twig index e6d381d9..13c98923 100644 --- a/templates/logged/customer.html.twig +++ b/templates/logged/customer.html.twig @@ -6,7 +6,7 @@ -