mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
various improvements aside acdtivity
This commit is contained in:
parent
4525f01d5f
commit
e4cfb4804b
@ -12,17 +12,29 @@ use Doctrine\Common\Collections\Criteria;
|
||||
|
||||
final class AsideActivityController extends CRUDController
|
||||
{
|
||||
/**
|
||||
* @param QueryBuilder $query
|
||||
*/
|
||||
protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $query) {
|
||||
protected function buildQueryEntities(string $action, Request $request)
|
||||
{
|
||||
$qb = parent::buildQueryEntities($action, $request);
|
||||
|
||||
$usr = $this->getUser();
|
||||
$id = $usr->getId();
|
||||
$criteria = Criteria::create()->andWhere(Criteria::expr()->eq('agent', $id));
|
||||
if ('index' === $action) {
|
||||
$qb->andWhere($qb->expr()->eq('e.agent', ':user'));
|
||||
$qb->setParameter('user', $this->getUser());
|
||||
}
|
||||
|
||||
$query
|
||||
->addCriteria($criteria);
|
||||
return $qb;
|
||||
}
|
||||
|
||||
protected function orderQuery(
|
||||
string $action,
|
||||
$query,
|
||||
Request $request,
|
||||
PaginatorInterface $paginator
|
||||
) {
|
||||
if ('index' === $action) {
|
||||
return $query->orderBy('e.date', 'DESC');
|
||||
}
|
||||
|
||||
return parent::orderQuery($action, $query, $request, $paginator);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@ use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
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;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
@ -27,15 +28,18 @@ final class AsideActivityFormType extends AbstractType
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
private TokenStorageInterface $storage;
|
||||
|
||||
public function __construct (TranslatableStringHelper $translatableStringHelper, array $timeChoices, TokenStorageInterface $storage){
|
||||
$this->timeChoices = $timeChoices;
|
||||
public function __construct (
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ParameterBagInterface $parameterBag,
|
||||
TokenStorageInterface $storage
|
||||
){
|
||||
$this->timeChoices = $parameterBag->get('chill_activity.form.time_duration');
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->storage = $storage;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
dump($options);
|
||||
$timeChoices = [];
|
||||
|
||||
foreach ($this->timeChoices as $e) {
|
||||
|
@ -27,7 +27,6 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||
*/
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
|
||||
$menu->addChild($this->translator->trans('Create an aside activity'), [
|
||||
'route' => 'chill_crud_aside_activity_new'
|
||||
])
|
||||
|
@ -15,7 +15,9 @@
|
||||
</a>
|
||||
</li>
|
||||
{% endblock %}
|
||||
{% block content_form_actions_before %}{% endblock %}
|
||||
{% block content_form_actions_before %}
|
||||
|
||||
{% endblock %}
|
||||
{% block content_form_actions_confirm_delete %}
|
||||
<li>
|
||||
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
||||
|
@ -3,6 +3,6 @@
|
||||
{# {% block title %}{{ ('crud.' ~ crud_name ~ '.delete.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} #}
|
||||
|
||||
{% block content %}
|
||||
{% embed '@ChillAsideActivity/AsideActivity/_delete.html.twig' %}
|
||||
{% embed '@ChillAsideActivity/asideActivity/_delete.html.twig' %}
|
||||
{% endembed %}
|
||||
{% endblock content %}
|
@ -9,5 +9,6 @@
|
||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||
{# we do not have "view" page. We empty the corresponding block #}
|
||||
{% block content_form_actions_view %}{% endblock %}
|
||||
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
|
@ -18,7 +18,7 @@
|
||||
<div
|
||||
class="flex-table my-4 list-records">
|
||||
{# Sort activities according to date in descending order #}
|
||||
{% for entity in entities|sort ((a, b) => b.date <=> a.date) %}
|
||||
{% for entity in entities %}
|
||||
{% set t = entity.type %}
|
||||
|
||||
<div class="item-bloc">
|
||||
@ -68,24 +68,12 @@
|
||||
<div class="item-col">
|
||||
<ul class="list-content">
|
||||
<ul class="record_actions">
|
||||
{# <li>
|
||||
<a href="{{ path('chill_crud_aside_activity_view', { 'id': entity.id} ) }}" class="btn btn-show "></a>
|
||||
</li> #}
|
||||
{# TOOD
|
||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||
#}
|
||||
<li><a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "> </a>
|
||||
</li>
|
||||
{# TOOD
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
||||
#}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update btn-mini "></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete btn-mini"></a>
|
||||
</li>
|
||||
{#
|
||||
{% endif %}
|
||||
#}
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
@ -93,10 +81,13 @@
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{{ chill_pagination(paginator) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
||||
{{ 'Add a new aside activity' | trans }}
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
||||
{{ 'Create' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -1,10 +1,6 @@
|
||||
---
|
||||
services:
|
||||
chill.asideactivity.form.type.asideactivity:
|
||||
class: Chill\AsideActivityBundle\Form\AsideActivityFormType
|
||||
arguments:
|
||||
- "@chill.main.helper.translatable_string"
|
||||
- "%chill_activity.form.time_duration%"
|
||||
- "@security.token_storage"
|
||||
tags:
|
||||
- { name: form.type, alias: chill_asideactivitybundle_asideactivity }
|
||||
Chill\AsideActivityBundle\Form\:
|
||||
resource: './../../Form'
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
@ -1,6 +1,5 @@
|
||||
services:
|
||||
Chill\AsideActivityBundle\Menu\SectionMenuBuilder:
|
||||
arguments:
|
||||
$translator: '@Symfony\Component\Translation\TranslatorInterface'
|
||||
tags:
|
||||
- { name: "chill.menu_builder" }
|
||||
Chill\AsideActivityBundle\Menu\:
|
||||
resource: './../../Menu'
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
@ -34,10 +34,10 @@ crud:
|
||||
aside_activity:
|
||||
title_view: Détail de l'activité annexe
|
||||
title_new: Nouvelle activité annexe
|
||||
title_edit: Edition d'une activité annexe
|
||||
title_delete: Supprimation d'une activité annexe
|
||||
title_edit: Édition d'une activité annexe
|
||||
title_delete: Supprimer une activité annexe
|
||||
button_delete: Supprimer
|
||||
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cet activité annexe?
|
||||
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cette activité annexe?
|
||||
aside_activity_category:
|
||||
title_new: Nouvelle catégorie d'activité annexe
|
||||
title_edit: Edition d'une catégorie de type d'activité
|
||||
@ -58,18 +58,6 @@ Agent: Utilisateur
|
||||
date: Date
|
||||
Duration: Durée
|
||||
Note: Note
|
||||
5 minutes: 5 minutes
|
||||
10 minutes: 10 minutes
|
||||
15 minutes: 15 minutes
|
||||
20 minutes: 20 minutes
|
||||
25 minutes: 25 minutes
|
||||
30 minutes: 30 minutes
|
||||
45 minutes: 45 minutes
|
||||
1 hour: 1 heure
|
||||
1 hour 15: 1 heure 15
|
||||
1 hour 30: 1 heure 30
|
||||
1 hour 45: 1 heure 45
|
||||
2 hours: 2 heures
|
||||
|
||||
#list
|
||||
My aside activities: Mes activités annexes
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Chill\MainBundle;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Chill\MainBundle\DependencyInjection\CompilerPass\SearchableServicesCompilerPass;
|
||||
@ -23,6 +24,10 @@ class ChillMainBundle extends Bundle
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
|
||||
$container->registerForAutoconfiguration(LocalMenuBuilderInterface::class)
|
||||
->addTag('chill.menu_builder');
|
||||
|
||||
$container->addCompilerPass(new SearchableServicesCompilerPass());
|
||||
$container->addCompilerPass(new ConfigConsistencyCompilerPass());
|
||||
$container->addCompilerPass(new TimelineCompilerClass());
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8839b431f296733b792c788f2ef58e5ecd6419d3
|
||||
Subproject commit bd95d3c96a437757b7e8f35cdfd30da9aeac1a01
|
Loading…
x
Reference in New Issue
Block a user