restore more templates in dashboard

This commit is contained in:
Tykayn 2025-02-16 23:13:44 +01:00 committed by tykayn
parent e9d896d4a7
commit cd4b678002
5 changed files with 61 additions and 10 deletions

View File

@ -0,0 +1,35 @@
<?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 Version20250216220539 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 user ADD active_festival_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649DE145A1C FOREIGN KEY (active_festival_id) REFERENCES festival (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649DE145A1C ON user (active_festival_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649DE145A1C');
$this->addSql('DROP INDEX UNIQ_8D93D649DE145A1C ON user');
$this->addSql('ALTER TABLE user DROP active_festival_id');
}
}

View File

@ -111,7 +111,7 @@ final class DefaultController extends AbstractController
$user = $this->getUser();
// $products = $this->getUser()->getProducts();
return $this->json([
'categories' => $user->getGroupOfProducts(),
'categories' => $user->getGroupOfProducts(),
'products' => $user->getProducts(),
// mock land
'lastFestival' => ['id'=>1,

View File

@ -24,6 +24,7 @@ class GroupOfProducts
/**
* @var Collection<int, Product>
*/
// TODO apiresource return properties
#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'groupOfProducts')]
private Collection $products;

View File

@ -83,6 +83,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
#[ORM\OneToMany(targetEntity: SerieFestival::class, mappedBy: 'user')]
private Collection $seriesFestival;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?Festival $activeFestival = null;
public function __construct()
{
@ -372,4 +375,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
return $this;
}
public function getActiveFestival(): ?Festival
{
return $this->activeFestival;
}
public function setActiveFestival(?Festival $activeFestival): static
{
$this->activeFestival = $activeFestival;
return $this;
}
}

View File

@ -3,8 +3,8 @@
<!--caisse IHM-->
<div id="load_ok">
<div id="listing-products" class="listing-products col-xs-12 col-md-8">
{# {% include 'logged/angular/messages.html.twig' %}#}
{# {% include 'logged/angular/listing-products.html.twig' %}#}
{% include 'logged/angular/messages.html.twig' %}
{% include 'logged/angular/listing-products.html.twig' %}
</div>
<div id="sellings" class="sellings col-xs-12 col-md-4">
@ -12,22 +12,22 @@
<div class="list-sell" ng-class="{'bg-success text-success': sellingOk }">
<button class="button">valider</button>
{# {% include 'logged/angular/validate-button.html.twig' %}#}
{# {% if app.user.products |length %}#}
{# {% include 'logged/angular/current.html.twig' %}#}
{# {% endif %}#}
{% include 'logged/angular/validate-button.html.twig' %}
{% if app.user.products |length %}
{% include 'logged/angular/current.html.twig' %}
{% endif %}
{#{% include 'logged/angular/paused.html.twig' %}#}
{% include 'logged/angular/paused.html.twig' %}
</div>
</div>
</div>
<div id="other_time">
ventes récentes
{# {% include 'logged/angular/recent.html.twig' %}#}
{% include 'logged/angular/recent.html.twig' %}
</div>
<div class="col-xs-12 col-md-4 col-md-offset-8">
catégories
{# {% include 'logged/angular/categ-options.html.twig' %}#}
{% include 'logged/angular/categ-options.html.twig' %}
</div>
</div>