✨ feat(EsyWeb): Ajoute formulaire et route pour la création de sites web.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Controller\Artemis\EsyWeb;
|
||||
|
||||
use App\Entity\EsyWeb\Website;
|
||||
use App\Form\Artemis\EsyWeb\WebsiteType;
|
||||
use App\Repository\EsyWeb\WebsiteRepository;
|
||||
use App\Repository\EsyWebTutoRepository;
|
||||
use App\Service\Logger\LoggerService;
|
||||
@@ -10,6 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Vich\UploaderBundle\Templating\Helper\UploaderHelper;
|
||||
|
||||
class EsyWebController extends AbstractController
|
||||
@@ -23,5 +26,26 @@ class EsyWebController extends AbstractController
|
||||
'websites' => $websiteRepository->findAll(),
|
||||
]);
|
||||
|
||||
}
|
||||
#[Route(path: '/artemis/esyweb/add', name: 'artemis_esyweb_add', methods: ['GET', 'POST'])]
|
||||
public function websiteAdd(LoggerService $loggerService,Request $request)
|
||||
{
|
||||
$loggerService->log("VIEW","Affiche la page de création de site internet",$this->getUser());
|
||||
|
||||
$webiste = new Website();
|
||||
$webiste->setState("created");
|
||||
$webiste->setUuid(Uuid::v4());
|
||||
|
||||
$form = $this->createForm(WebsiteType::class,$webiste);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
}
|
||||
return $this->render('artemis/esyweb/add.twig', [
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
38
src/Form/Artemis/EsyWeb/WebsiteType.php
Normal file
38
src/Form/Artemis/EsyWeb/WebsiteType.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Artemis\EsyWeb;
|
||||
|
||||
use App\Entity\EsyWeb\Website;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class WebsiteType extends AbstractType
|
||||
{
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
$builder
|
||||
->add('type',ChoiceType::class,[
|
||||
'label' => 'Type de site internet',
|
||||
'required' => true,
|
||||
'choices' => [
|
||||
'Vitrine' => 'vitrine',
|
||||
'E-commerce' => 'e-trade',
|
||||
]
|
||||
])
|
||||
->add('title',TextType::class,[
|
||||
'label' => 'Titre',
|
||||
'required' => true
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefault('data_class', Website::class);
|
||||
}
|
||||
}
|
||||
7
templates/artemis/esyweb/add.twig
Normal file
7
templates/artemis/esyweb/add.twig
Normal file
@@ -0,0 +1,7 @@
|
||||
{% extends 'artemis/base.twig' %}
|
||||
{% block title %}Création d'un site internet{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ form_start(form) }}
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
@@ -8,18 +8,60 @@
|
||||
<div class="p-6 bg-gray-900 min-h-screen text-white">
|
||||
<h1 class="text-3xl font-bold text-white mb-6">Liste des Sites Internet</h1>
|
||||
|
||||
{# DÉBUT DES DONNÉES FACTICES POUR LA PRÉVISUALISATION #}
|
||||
{% set websites = [
|
||||
{name: 'Site Alpha', client: 'SARL Alpha Conseil', ndd: 'alpha-conseil.fr', status: 'Actif'},
|
||||
{name: 'Boulangerie Bruno', client: 'EURL Pains et Délices', ndd: 'bruno-boulanger.com', status: 'En Développement'},
|
||||
{name: 'SARL Gamma', client: 'Gamma Immobilier', ndd: 'gamma-immo.net', status: 'Suspendu'},
|
||||
{name: 'Assurances Zenith', client: 'Cabinet Zenith', ndd: 'zenith-assure.fr', status: 'Actif'},
|
||||
{name: 'Projet Beta', client: 'Association Beta', ndd: 'beta-projet.org', status: 'Archivé'},
|
||||
] %}
|
||||
{# FIN DES DONNÉES FACTICES #}
|
||||
{# BARRE DE RECHERCHE, SÉLECTEUR DE TRI ET BOUTONS #}
|
||||
<div class="mb-6 flex justify-between items-center">
|
||||
<div class="flex items-center space-x-4 flex-grow">
|
||||
{# Champ de Recherche #}
|
||||
<div class="relative flex-grow max-w-sm">
|
||||
<input type="text" placeholder="Rechercher un site, client ou NDD..."
|
||||
class="w-full pl-10 pr-4 py-2 text-sm text-gray-100 bg-gray-800 border border-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition duration-150"
|
||||
aria-label="Rechercher" id="searchInput">
|
||||
{# Icône de recherche (Loupe) #}
|
||||
<svg class="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center">
|
||||
{# NOUVEAU BOUTON D'EXTRACTION XLS #}
|
||||
<button id="exportXlsBtn" class="inline-flex items-center px-4 py-2 mr-3 border border-transparent text-sm font-medium rounded-md shadow-sm text-gray-900 bg-gray-300 hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-400 focus:ring-offset-gray-900">
|
||||
Extraire en XLS
|
||||
</button>
|
||||
|
||||
{# Bouton Ajouter un nouveau site #}
|
||||
<a href="{{ path('artemis_esyweb_add') }}" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 focus:ring-offset-gray-900">
|
||||
+ Ajouter un nouveau site
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# BLOC DE FILTRAGE PAR CARACTÈRE (0-9, A-Z) #}
|
||||
<div class="mb-6 flex flex-wrap gap-2 select-none justify-center" id="filterPills">
|
||||
{# Boutons chiffres 0-9 #}
|
||||
{% for digit in 0..9 %}
|
||||
<a href="{{ path('artemis_esyweb',{letter:digit}) }}"
|
||||
class="filter-pill px-3 py-1 rounded bg-gray-700 hover:bg-gray-600 text-white transition duration-150"
|
||||
>
|
||||
{{ digit }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
{# Boutons lettres A-Z #}
|
||||
{% for letter in 'A'..'Z' %}
|
||||
<a href="{{ path('artemis_esyweb',{letter:letter}) }}"
|
||||
class="filter-pill px-3 py-1 rounded bg-gray-700 hover:bg-gray-600 text-white transition duration-150"
|
||||
>
|
||||
{{ letter }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
<a href="{{ path('artemis_esyweb') }}"
|
||||
class="filter-pill px-3 py-1 rounded bg-blue-600 text-white transition duration-150"
|
||||
>
|
||||
Tout
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-800 shadow-xl rounded-lg overflow-hidden">
|
||||
<table class="min-w-full divide-y divide-gray-700">
|
||||
<table id="websitesTable" class="min-w-full divide-y divide-gray-700">
|
||||
<thead class="bg-gray-700">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">
|
||||
@@ -36,7 +78,7 @@
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-gray-800 divide-y divide-gray-700">
|
||||
<tbody id="websitesTableBody" class="bg-gray-800 divide-y divide-gray-700">
|
||||
{#
|
||||
NOTE : La variable 'websites' est définie ici avec des données factices.
|
||||
En production, elle devra être passée par votre contrôleur.
|
||||
@@ -80,13 +122,5 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{# Bloc pour ajouter un site, si nécessaire #}
|
||||
<div class="mt-6 text-right">
|
||||
<a href="{{ path('artemis_esyweb') }}" class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 focus:ring-offset-gray-900">
|
||||
+ Ajouter un nouveau site
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user