mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: add location in asideActivity pages (user currentLocation by default)
This commit is contained in:
parent
5cea4a647d
commit
c546c4a207
@ -33,6 +33,7 @@ final class AsideActivityController extends CRUDController
|
||||
$asideActivity = new AsideActivity();
|
||||
|
||||
$asideActivity->setAgent($this->getUser());
|
||||
$asideActivity->setLocation($this->getUser()->getCurrentLocation());
|
||||
|
||||
$duration = $request->query->get('duration', '300');
|
||||
$duration = DateTime::createFromFormat('U', $duration);
|
||||
|
@ -13,6 +13,7 @@ namespace Chill\AsideActivityBundle\Form;
|
||||
|
||||
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||
use Chill\AsideActivityBundle\Form\Type\PickAsideActivityCategoryType;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||
@ -20,6 +21,7 @@ use DateInterval;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeZone;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
||||
@ -77,7 +79,15 @@ final class AsideActivityFormType extends AbstractType
|
||||
->add('note', ChillTextareaType::class, [
|
||||
'label' => 'Note',
|
||||
'required' => false,
|
||||
]);
|
||||
])
|
||||
->add('location', EntityType::class, [
|
||||
'label' => 'Set a location',
|
||||
'class' => Location::class,
|
||||
'choice_label' => fn (Location $l) => $l->getName(),
|
||||
'data' => $options['data']->getLocation(),
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
|
||||
foreach (['duration'] as $fieldName) {
|
||||
$builder->get($fieldName)
|
||||
|
@ -39,6 +39,9 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%- if entity.location.name is defined -%}
|
||||
<div><i class="fa fa-fw fa-map-marker"></i>{{ entity.location.name }}</div>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
<div class="item-col" style="justify-content: flex-end;">
|
||||
<div class="box">
|
||||
|
@ -23,6 +23,13 @@
|
||||
<dt class="inline">{{ 'Created for'|trans }}</dt>
|
||||
<dd>{{ entity.agent }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Asideactivity location'|trans }}</dt>
|
||||
{%- if entity.location.name is defined -%}
|
||||
<dd>{{ entity.location.name }}</dd>
|
||||
{%- else -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No data given'|trans }}</span></dd>
|
||||
{%- endif -%}
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
|
||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||
|
@ -26,6 +26,7 @@ Users: Utilisateurs
|
||||
Emergency: Urgent
|
||||
by: "Par "
|
||||
location: Lieu
|
||||
Asideactivity location: Localisation de l'activité
|
||||
|
||||
# Crud
|
||||
crud:
|
||||
|
Loading…
x
Reference in New Issue
Block a user