Commit d4eb8194 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Finalisation de l'ensemble des fieldset pour le formulaure intervenant dossier.

parent 38a934f4
......@@ -77,9 +77,7 @@ class IntervenantDossierController extends AbstractController
}
});
return compact('form', 'role', 'intervenant');
return compact('form', 'role', 'intervenant');
}
......
......@@ -185,7 +185,38 @@ class AdresseFieldset extends AbstractFieldset
public function getInputFilterSpecification()
{
return [];
$spec = [
'precisions' => [
'required' => false,
],
'lieuDit' => [
'required' => false,
],
'numero' => [
'required' => false,
],
'numeroComplement' => [
'required' => false,
],
'voirie' => [
'required' => false,
],
'voie' => [
'required' => false,
],
'codePostal' => [
'required' => false,
],
'ville' => [
'required' => false,
],
'pays' => [
'required' => false,
],
];
return $spec;
}
......
<?php
namespace Application\Form\Element;
use Application\Proxy\StatutIntervenantProxy;
use DoctrineORMModule\Form\Element\EntitySelect;
/**
* Select d'entités StatutIntervenant, avec proxy dédié.
*/
class StatutIntervenantSelect extends EntitySelect
{
public function __construct($name = null, $options = [])
{
parent::__construct($name, $options);
$this->proxy = new StatutIntervenantProxy();
}
}
\ No newline at end of file
<?php
namespace Application\Form\Employeur;
use Application\Form\AbstractFieldset;
use Application\Service\Traits\ContextServiceAwareTrait;
/**
* Description of EmployeurFieldset
*
*/
class EmployeurFieldset extends AbstractFieldset
{
use ContextServiceAwareTrait;
public function init()
{
$this->addElements();
}
/**
* @return self
*/
private function addElements()
{
$this->add([
'name' => 'employeur',
'options' => [
'label' => 'Employeur',
],
'type' => 'Text',
]);
return $this;
}
public function getInputFilterSpecification()
{
$spec = [
'employeur' => [
'required' => false,
],
];
return $spec;
}
}
\ No newline at end of file
<?php
namespace Application\Form\Intervenant\Dossier;
use Application\Form\AbstractFieldset;
use Application\Service\Traits\ContextServiceAwareTrait;
/**
* Description of DossierAutresFieldset
*
*/
class DossierAutresFieldset extends AbstractFieldset
{
use ContextServiceAwareTrait;
public function init()
{
$this->addElements();
}
private function addElements()
{
$this->add([
'name' => 'autre1',
'options' => [
'label' => 'Autre N°1',
],
'type' => 'Text',
]);
$this->add([
'name' => 'autre2',
'options' => [
'label' => 'Autre N°2',
],
'type' => 'Text',
]);
$this->add([
'name' => 'autre3',
'options' => [
'label' => 'Autre N°3',
],
'type' => 'Text',
]);
$this->add([
'name' => 'autre4',
'options' => [
'label' => 'Autre N°4',
],
'type' => 'Text',
]);
$this->add([
'name' => 'autre5',
'options' => [
'label' => 'Autre N°5',
],
'type' => 'Text',
]);
return $this;
}
public function getInputFilterSpecification()
{
$spec = [
'autre1' => [
'required' => false,
],
'autre2' => [
'required' => false,
],
'autre3' => [
'required' => false,
],
'autre4' => [
'required' => false,
],
'autre5' => [
'required' => false,
],
];
return $spec;
}
}
\ No newline at end of file
<?php
namespace Application\Form\Intervenant\Dossier;
use Application\Form\AbstractFieldset;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Validator\RIBValidator;
/**
* Description of DossierBancaireFieldset
*
*/
class DossierBancaireFieldset extends AbstractFieldset
{
use ContextServiceAwareTrait;
public function init()
{
$this->addElements();
}
private function addElements()
{
$this->add([
'name' => 'ribBic',
'options' => [
'label' => 'BIC',
],
'attributes' => [
'size' => 11,
'maxlength' => 11,
],
'type' => 'Text',
]);
$this->add([
'name' => 'ribIban',
'options' => [
'label' => 'IBAN',
],
'attributes' => [
'size' => 34,
'maxlength' => 34,
],
'type' => 'Text',
]);
$this->add([
'name' => 'ribHorsSepa',
'options' => [
'label' => 'RIB hors zone SEPA',
],
'type' => 'Checkbox',
]);
return $this;
}
public function getInputFilterSpecification()
{
$spec = [
'ribBic' => [
'required' => false,
'filters' => [
['name' => 'StringTrim'],
['name' => 'StringToUpper'],
],
'validators' => [
new \Zend\Validator\Regex([
'pattern' => "/[0-9a-zA-Z]{8,11}/",
'messages' => [\Zend\Validator\Regex::NOT_MATCH => "Le BIC doit contenir 8 à 11 caractères"],
]),
],
],
'ribIban' => [
'required' => false,
'filters' => [
['name' => 'StringTrim'],
['name' => 'StringToUpper'],
],
'validators' => [
new RIBValidator(),
],
],
];
return $spec;
}
}
\ No newline at end of file
......@@ -2,10 +2,14 @@
namespace Application\Form\Intervenant\Dossier;
use Application\Constants;
use Application\Form\AbstractFieldset;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Validator\DepartementNaissanceValidator;
use Application\Validator\PaysNaissanceValidator;
use Zend\Form\Element\Email;
use Zend\Form\Element\Tel;
use Zend\Validator\Date as DateValidator;
/**
* Description of DossierContactFieldset
......@@ -88,6 +92,22 @@ class DossierContactFieldset extends AbstractFieldset
*/
public function getInputFilterSpecification()
{
return [];
$spec = [
'emailEtablissement' => [
'required' => false,
],
'emailPersonnel' => [
'required' => false,
],
'telephoneProfessionnel' => [
'required' => false,
],
'telephonePersonnel' => [
'required' => false,
],
];
return $spec;
}
}
\ No newline at end of file
......@@ -189,44 +189,45 @@ class DossierIdentiteFieldset extends AbstractFieldset
// la sélection du département n'est obligatoire que si le pays sélectionné est la France
$departementRequired = (self::$franceId === $paysNaissanceId);
/*$spec = [
$spec = [
'nomUsuel' => [
'required' => true,
'required' => false,
'readonly' => true
],
'nomPatronymique' => [
'required' => false,
],
'prenom' => [
'required' => true,
'required' => false,
],
'civilite' => [
'required' => true,
'required' => false,
],
'dateNaissance' => [
'required' => true,
'required' => false,
'allow_empty' => true,
'validators' => [
new DateValidator(['format' => Constants::DATE_FORMAT]),
],
],
'paysNaissance' => [
'required' => true,
'required' => false,
'allow_empty' => true,
'validators' => [
new PaysNaissanceValidator(['service' => $this->getServicePays()]),
],
],
'departementNaissance' => [
'required' => $departementRequired,
'required' => false,//$departementRequired,
'validators' => [
new DepartementNaissanceValidator(),
],
],
'villeNaissance' => [
'required' => true,
'required' => false,
],
];*/
$spec = [];
];
return $spec;
}
......
<?php
namespace Application\Form\Intervenant\Dossier;
use Application\Form\AbstractFieldset;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Validator\NumeroINSEEValidator;
/**
* Description of DossierInseeFieldset
*
*/
class DossierInseeFieldset extends AbstractFieldset
{
use ContextServiceAwareTrait;
public function init()
{
$this->addElements();
}
private function addElements()
{
$this->add([
'name' => 'numeroInsee',
'options' => [
'label' => 'Numéro <abbr title="Numéro de sécurité sociale">INSEE</abbr> (clé incluse)',
'use_hidden_element' => false,
'checked_value' => 1,
'unchecked_value' => 0,
'label_options' => [
'disable_html_escape' => true,
],
],
'attributes' => [
'info_icon' => "Numéro INSEE (sécurité sociale) avec la clé de contrôle",
],
'type' => 'Text',
]);
/**
* Numéro INSEE provisoire
*/
$this->add([
'name' => 'numeroInseeEstProvisoire',
'options' => [
'label' => 'Numéro <abbr title="Numéro de sécurité sociale">INSEE</abbr> provisoire',
'label_options' => [
'disable_html_escape' => true,
],
],
'attributes' => [
],
'type' => 'Checkbox',
]);
return $this;
}
public function getInputFilterSpecification()
{
$numeroInseeProvisoire = (bool)$this->get('numeroInseeEstProvisoire')->getValue();
$spec = [
'numeroInsee' => [
'required' => false,
'validators' => [
new NumeroINSEEValidator([
'provisoire' => $numeroInseeProvisoire,
]),
],
],
];
return [];
}
}
\ No newline at end of file
......@@ -175,38 +175,6 @@ class DossierFieldset extends AbstractFieldset
/**
* Numéro INSEE
*/
$this->add([
'name' => 'numeroInsee',
'options' => [
'label' => 'Numéro <abbr title="Numéro de sécurité sociale">INSEE</abbr> (clé incluse)',
'use_hidden_element' => false,
'checked_value' => 1,
'unchecked_value' => 0,
'label_options' => [
'disable_html_escape' => true,
],
],
'attributes' => [
'info_icon' => "Numéro INSEE (sécurité sociale) avec la clé de contrôle",
],
'type' => 'Text',
]);
/**
* Numéro INSEE provisoire
*/
$this->add([
'name' => 'numeroInseeEstProvisoire',
'options' => [
'label' => 'Numéro <abbr title="Numéro de sécurité sociale">INSEE</abbr> provisoire',
'label_options' => [
'disable_html_escape' => true,
],
],
'attributes' => [
],
'type' => 'Checkbox',
]);
/**
* Adresse postale
......@@ -360,7 +328,7 @@ class DossierFieldset extends AbstractFieldset
// la sélection du département n'est obligatoire que si le pays sélectionné est la France
$departementRequired = (self::$franceId === $paysNaissanceId);
$spec = [
$spec = [
'nomUsuel' => [
'required' => true,
],
......
......@@ -4,9 +4,14 @@ namespace Application\Form\Intervenant;
use Application\Entity\Db\Intervenant;
use Application\Form\AbstractForm;
use Application\Form\Element\StatutIntervenantSelect;
use Application\Form\Employeur\EmployeurFieldset;
use Application\Form\Adresse\AdresseFieldset;
use Application\Form\Intervenant\Dossier\DossierAutresFieldset;
use Application\Form\Intervenant\Dossier\DossierBancaireFieldset;
use Application\Form\Intervenant\Dossier\DossierContactFieldset;
use Application\Form\Intervenant\Dossier\DossierIdentiteFieldset;
use Application\Form\Intervenant\Dossier\DossierInseeFieldset;
use Application\Hydrator\IntervenantDossierHydrator;
use Application\Service\Traits\ContextServiceAwareTrait;
use Application\Service\Traits\DossierServiceAwareTrait;
......@@ -31,6 +36,10 @@ class IntervenantDossier extends AbstractForm
protected $dossierIdentiteFieldset;
protected $dossierAdresseFieldset;
protected $dossierContactFiedlset;
protected $dossierInseeFiedlset;
protected $dossierBancaireFieldset;
protected $dossierEmployeurFieldset;
protected $dossierAutresFiedlset;
/**
* @var boolean
......@@ -54,12 +63,46 @@ class IntervenantDossier extends AbstractForm
$this->dossierAdresseFieldset->init();
$this->dossierContactFiedlset = new DossierContactFieldset('DossierContact');
$this->dossierContactFiedlset->init();
$this->dossierInseeFiedlset = new DossierInseeFieldset('DossierInsee');
$this->dossierInseeFiedlset->init();
$this->dossierBancaireFieldset = new DossierBancaireFieldset('DossierBancaire');
$this->dossierBancaireFieldset->init();
$this->dossierEmployeurFieldset = new EmployeurFieldset('DossierEmployeur');
$this->dossierEmployeurFieldset->init();
$this->dossierAutresFiedlset = new DossierAutresFieldset('DossierAutres');
$this->dossierAutresFiedlset->init();
$this->setAttribute('id', 'dossier');
$this->add($this->dossierIdentiteFieldset);
$this->add($this->dossierAdresseFieldset);
$this->add($this->dossierContactFiedlset);
$this->add($this->dossierInseeFiedlset);
$this->add($this->dossierBancaireFieldset);
$this->add($this->dossierEmployeurFieldset);
$this->add($this->dossierAutresFiedlset);
/**
* Select pour Statut intervenant customisé