✨ feat(CustomerController): Ajoute la page de création de client et API interne.
Ajoute la route pour la page de création de client et une API pour l'auto-complétion des informations via le Siret.
This commit is contained in:
2
.env
2
.env
@@ -52,3 +52,5 @@ REDIS_DSN="redis://redis:6379"
|
||||
REAL_MAIL=0
|
||||
VAULT_ADDR=http://vault:8200
|
||||
VAULT_TOKEN=myroot
|
||||
|
||||
INSEE_KEYAPI=f941bdf0-b8a3-4e4c-81bd-f0b8a35e4cc8
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"league/flysystem-aws-s3-v3": "^3.29",
|
||||
"league/flysystem-bundle": "^3.4",
|
||||
"liip/imagine-bundle": "^2.13",
|
||||
"lufiipe/insee-sierene": "*",
|
||||
"minishlink/web-push": "^9.0",
|
||||
"mittwald/vault-php": "^3.0",
|
||||
"nelmio/api-doc-bundle": "^5.4",
|
||||
|
||||
105
composer.lock
generated
105
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "d68cad60163f361459326f5402d1f396",
|
||||
"content-hash": "eeb180229a285394dea5fa7492f8a1ce",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@@ -3934,6 +3934,109 @@
|
||||
},
|
||||
"time": "2024-12-12T09:38:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "lufiipe/insee-sierene",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lufiipe/insee-sierene.git",
|
||||
"reference": "f57e66770c379cb66a224984bfe57e303b02683f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/lufiipe/insee-sierene/zipball/f57e66770c379cb66a224984bfe57e303b02683f",
|
||||
"reference": "f57e66770c379cb66a224984bfe57e303b02683f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "^7.0",
|
||||
"lufiipe/simplevent": "^1.0",
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^2.1",
|
||||
"phpunit/phpunit": "^9.0|^10.0|^11.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"LuFiipe\\InseeSierene\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Luis-Filipe ANTUNES",
|
||||
"email": "lf.antunes.dasilva@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A PHP package for retrieving company information from the INSEE Sirene API",
|
||||
"keywords": [
|
||||
"INSEE",
|
||||
"Siren",
|
||||
"Siret",
|
||||
"php",
|
||||
"sirene"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/lufiipe/insee-sierene/issues",
|
||||
"source": "https://github.com/lufiipe/insee-sierene/tree/1.0.0"
|
||||
},
|
||||
"time": "2025-06-26T08:05:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "lufiipe/simplevent",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lufiipe/simplevent.git",
|
||||
"reference": "b9b6899cf8ee9220cd3c64e1b1d57ca7ffbfcd95"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/lufiipe/simplevent/zipball/b9b6899cf8ee9220cd3c64e1b1d57ca7ffbfcd95",
|
||||
"reference": "b9b6899cf8ee9220cd3c64e1b1d57ca7ffbfcd95",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^2.0",
|
||||
"phpunit/phpunit": "^9.0|^10.0|^11.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"LuFiipe\\SimplEvent\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Luis-Filipe ANTUNES",
|
||||
"email": "lf.antunes.dasilva@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Simple PHP event listener library",
|
||||
"keywords": [
|
||||
"emitter",
|
||||
"event",
|
||||
"listener",
|
||||
"php"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/lufiipe/simplevent/issues",
|
||||
"source": "https://github.com/lufiipe/simplevent/tree/1.0.0"
|
||||
},
|
||||
"time": "2025-06-26T07:49:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "meyfa/php-svg",
|
||||
"version": "v0.9.1",
|
||||
|
||||
42
src/Controller/ApiInterne/Intranet/CustomerController.php
Normal file
42
src/Controller/ApiInterne/Intranet/CustomerController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\ApiInterne\Intranet;
|
||||
|
||||
|
||||
use LuFiipe\InseeSierene\Sirene;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
|
||||
class CustomerController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/api-interne/intranet/customer/auto/{siret}',name: 'api-interne-intranet-customer-auto')]
|
||||
public function customerAuto(?string $siret): Response
|
||||
{
|
||||
if(is_null($siret)){
|
||||
return $this->json([
|
||||
'error' => true
|
||||
]);
|
||||
}
|
||||
$siret = str_replace(" ","",$siret);
|
||||
|
||||
$sirene = new Sirene($_ENV['INSEE_KEYAPI']);
|
||||
$content = $sirene->siret($siret)->getBody();
|
||||
$company =[
|
||||
'etat' => $content['uniteLegale']['etatAdministratifUniteLegale'] = "A"?true:false,
|
||||
'name' => $content['uniteLegale']['denominationUniteLegale'],
|
||||
'siret' => $siret,
|
||||
'rna' => $content['uniteLegale']['identifiantAssociationUniteLegale'],
|
||||
'ape' => $content['uniteLegale']['activitePrincipaleUniteLegale'],
|
||||
'num' => $content['adresseEtablissement']['numeroVoieEtablissement']." ".
|
||||
$content['adresseEtablissement']['typeVoieEtablissement']." ".
|
||||
$content['adresseEtablissement']['libelleVoieEtablissement'],
|
||||
'zipcode' => $content['adresseEtablissement']['codePostalEtablissement'],
|
||||
'comune' => $content['adresseEtablissement']['libelleCommuneEtablissement'],
|
||||
|
||||
];
|
||||
return $this->json($company);
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,18 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
class CustomerController extends AbstractController
|
||||
{
|
||||
#[Route(path: '/artemis/intranet/customer',name: 'artemis_intranet_customer',methods: ['GET', 'POST'])]
|
||||
public function artemis(CustomerRepository $customerRepository,Request $request,PaginatorInterface $paginator): Response
|
||||
public function customers(CustomerRepository $customerRepository,Request $request,PaginatorInterface $paginator): Response
|
||||
{
|
||||
|
||||
return $this->render('artemis/intranet/customer.twig',[
|
||||
'customers' => $paginator->paginate($customerRepository->searchCustomer($request),$request->get('page',1),20),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(path: '/artemis/intranet/customer/add',name: 'artemis_intranet_customer_add',methods: ['GET', 'POST'])]
|
||||
public function customerAdd(Request $request): Response
|
||||
{
|
||||
return $this->render('artemis/intranet/customer/add.twig',[
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h2 class="text-3xl font-semibold text-gray-800 dark:text-gray-200">Listes des clients</h2>
|
||||
<div>
|
||||
<a href="" class="px-4 py-2 bg-blue-600 text-white font-medium rounded-md shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900">
|
||||
<a href="{{ path('artemis_intranet_customer_add') }}" class="px-4 py-2 bg-blue-600 text-white font-medium rounded-md shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900">
|
||||
+ Crée un compte client
|
||||
</a>
|
||||
</div>
|
||||
|
||||
14
templates/artemis/intranet/customer/add.twig
Normal file
14
templates/artemis/intranet/customer/add.twig
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends 'artemis/base.twig' %}
|
||||
{% block title %}Intrante - Crée Client{% endblock %}
|
||||
{% block content %}
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h2 class="text-3xl font-semibold text-gray-800 dark:text-gray-200">Crée un client</h2>
|
||||
<div>
|
||||
<button class="px-4 py-2 bg-blue-600 text-white font-medium rounded-md shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900">
|
||||
Récupération automatique des informations du client via Siret
|
||||
</button>
|
||||
</div>
|
||||
</div> <div class="mt-5 bg-gray-800 rounded-lg shadow-lg p-6 space-y-4">
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user