mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
form created + general layout of templates
This commit is contained in:
parent
6e4bfd45c6
commit
58ac4b01ef
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Controller;
|
namespace Chill\PersonBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Form\PersonResourceType;
|
||||||
use Chill\PersonBundle\Repository\PersonRepository;
|
use Chill\PersonBundle\Repository\PersonRepository;
|
||||||
use Chill\PersonBundle\Repository\PersonResourceRepository;
|
use Chill\PersonBundle\Repository\PersonResourceRepository;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
@ -30,13 +31,15 @@ final class PersonResourceController extends AbstractController
|
|||||||
|
|
||||||
public function listAction($person_id)
|
public function listAction($person_id)
|
||||||
{
|
{
|
||||||
dump($person_id);
|
|
||||||
$person = $this->personRepository->find($person_id);
|
$person = $this->personRepository->find($person_id);
|
||||||
dump($person);
|
|
||||||
|
$form = $this->createForm(PersonResourceType::class);
|
||||||
|
|
||||||
return $this->render(
|
return $this->render(
|
||||||
'ChillPersonBundle:PersonResource:list.html.twig',
|
'ChillPersonBundle:PersonResource:list.html.twig',
|
||||||
[
|
[
|
||||||
'person' => $person
|
'person' => $person,
|
||||||
|
'form' => $form->createView()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
79
src/Bundle/ChillPersonBundle/Form/PersonResourceType.php
Normal file
79
src/Bundle/ChillPersonBundle/Form/PersonResourceType.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Form;
|
||||||
|
|
||||||
|
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
|
||||||
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonResource;
|
||||||
|
use Chill\PersonBundle\Entity\Person\PersonResourceKind;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\RadioType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
final class PersonResourceType extends AbstractType
|
||||||
|
{
|
||||||
|
private CategoryRender $categoryRender;
|
||||||
|
|
||||||
|
public function __construct(CategoryRender $categoryRender)
|
||||||
|
{
|
||||||
|
$this->categoryRender = $categoryRender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('kind', EntityType::class, [
|
||||||
|
'label' => 'Type',
|
||||||
|
'required' => true,
|
||||||
|
'class' => PersonResourceKind::class,
|
||||||
|
'query_builder' => static function (EntityRepository $er) {
|
||||||
|
$qb = $er->createQueryBuilder('pr');
|
||||||
|
$qb->where($qb->expr()->eq('pr.isActive', 'TRUE'));
|
||||||
|
return $qb;
|
||||||
|
},
|
||||||
|
'choice_label' => function (PersonResourceKind $personResourceKind) {
|
||||||
|
$options = [];
|
||||||
|
return $this->categoryRender->renderString($personResourceKind, $options);
|
||||||
|
}
|
||||||
|
])
|
||||||
|
->add('linkedEntity', ChoiceType::class, [
|
||||||
|
'choices' => [
|
||||||
|
'Usager' => 'person',
|
||||||
|
'Tiers' => 'thirdparty',
|
||||||
|
'Description libre' => 'freeText'
|
||||||
|
],
|
||||||
|
'expanded' => true,
|
||||||
|
'label' => 'Associer un'
|
||||||
|
])
|
||||||
|
->add('comment', ChillTextareaType::class, [
|
||||||
|
'label' => 'Note',
|
||||||
|
'required' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => PersonResource::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function getBlockPrefix(): string
|
||||||
|
// {
|
||||||
|
// return 'chill_personbundle_personresource';
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<div class="col-md col-xxl">
|
||||||
|
|
||||||
|
<h1>{{ 'Add a person resource'|trans }}</h1>
|
||||||
|
|
||||||
|
{{ form_start(form, {'attr' : {'id' : 'create-form'}}) }}
|
||||||
|
|
||||||
|
{{ form_row(form.kind) }}
|
||||||
|
|
||||||
|
{{ form_row(form.linkedEntity) }}
|
||||||
|
|
||||||
|
{{ form_row(form.comment) }}
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="dropdown">
|
||||||
|
<a class="btn btn-create"
|
||||||
|
href="#" role="button" id="newPersonResource">
|
||||||
|
{{ 'Add a person resource'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{{ form_end(form) }}
|
||||||
|
|
||||||
|
</div>
|
@ -6,27 +6,29 @@
|
|||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
{{ person }}
|
|
||||||
<div class="flex-table">
|
<div class="flex-table">
|
||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
<div class="item-row">
|
<div class="item-row">
|
||||||
<div class="item-col">Hello</div>
|
<div class="item-col">Name of resource</div>
|
||||||
<div class="item-col">there</div>
|
<div class="item-col">kind of resource</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-row separator">
|
{# <div class="item-row separator">
|
||||||
<div class="item-col">How</div>
|
<div class="item-col">How</div>
|
||||||
<div class="item-col">are</div>
|
<div class="item-col">are</div>
|
||||||
</div>
|
</div> #}
|
||||||
</div>
|
</div>
|
||||||
<div class="item-bloc">
|
<div class="item-bloc">
|
||||||
<div class="item-row">
|
<div class="item-row">
|
||||||
<div class="item-col">you</div>
|
<div class="item-col">comment zone</div>
|
||||||
<div class="item-col">doing</div>
|
<div class="item-col">doing</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-row">
|
<div class="item-row">
|
||||||
<div class="item-col">today</div>
|
{# <div class="item-col">today</div> #}
|
||||||
<div class="item-col">?</div>
|
<div class="item-col">Buttons</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include "@ChillPerson/PersonResource/create.html.twig" %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -223,7 +223,8 @@ The accompanying course has been successfully removed.: La période d'accompagne
|
|||||||
# person resource
|
# person resource
|
||||||
|
|
||||||
person_resources_menu: "Ressources"
|
person_resources_menu: "Ressources"
|
||||||
Person resources: 'Réssources de la personne'
|
Person resources: "Réssources de la personne"
|
||||||
|
Add a person resource: "Ajouter une réssource"
|
||||||
|
|
||||||
# pickAPersonType
|
# pickAPersonType
|
||||||
Pick a person: Choisir une personne
|
Pick a person: Choisir une personne
|
||||||
|
Loading…
x
Reference in New Issue
Block a user