Browse Source

Correctif field et filter

develop
Fab 3 years ago
parent
commit
bb74e9df01
12 changed files with 88 additions and 28 deletions
  1. +13
    -11
      Field/Filter/AssociationFilter.php
  2. +1
    -1
      Field/Filter/FilterManager.php
  3. +1
    -1
      Resources/assets/app/adminlte/index/index.scss
  4. +1
    -1
      Resources/translations/admin.fr.yaml
  5. +7
    -6
      Resources/views/admin/ticket/field/status.html.twig
  6. +33
    -0
      Resources/views/admin/ticket/macro.html.twig
  7. +4
    -0
      Resources/views/adminlte/crud/field/amount.html.twig
  8. +5
    -2
      Resources/views/adminlte/crud/field/boolean.html.twig
  9. +5
    -2
      Resources/views/adminlte/crud/field/status.html.twig
  10. +11
    -0
      Resources/views/adminlte/embed/smallbox.html.twig
  11. +2
    -1
      Resources/views/adminlte/macro/button.html.twig
  12. +5
    -3
      Twig/TwigExtension.php

+ 13
- 11
Field/Filter/AssociationFilter.php View File

); );
} }


public function applyFilter(RepositoryQueryInterface $repositoryQuery, string $fieldProperty, $filteredValue = null)
public function applyFilter(RepositoryQueryInterface $repositoryQuery, FieldDto $fieldDto, string $fieldProperty, $filteredValue = null)
{ {
if ($filteredValue !== null) { if ($filteredValue !== null) {
$repositoryQuery->andWhere('.' . $fieldProperty . ' = :' . $fieldProperty . '');

if ($fieldDto->getFormTypeOption('multiple')) {
$repositoryQuery->andWhere(':' . $fieldProperty . ' MEMBER OF .' . $fieldProperty . '');
} else {
$repositoryQuery->andWhere('.' . $fieldProperty . ' = :' . $fieldProperty . '');
}
$repositoryQuery->setParameter($fieldProperty, $filteredValue); $repositoryQuery->setParameter($fieldProperty, $filteredValue);
/* //TODO Faut généraliser avec TreeInterface, ça ne doit pas être ici
if ($field['type_options']['multiple']) {
$repositoryQuery->andWhere(':' . $field['property'] . ' MEMBER OF entity.' . $field['property'] . '');
} else {
}


if ($filter instanceof TreeInterface && $filter->getParent() == null) {
$repositoryQuery->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray()));
} else {
}*/

//
// if ($filter instanceof TreeInterface && $filter->getParent() == null) {
// $repositoryQuery->setParameter($field['property'], array_merge(array($filter), $filter->getChildrens()->toArray()));
// } else {
// }
} }
} }



+ 1
- 1
Field/Filter/FilterManager.php View File

break; break;
case EntityType::class: case EntityType::class:
$textFilter = new AssociationFilter(); $textFilter = new AssociationFilter();
$textFilter->applyFilter($repositoryQuery, $this->getFieldProperty($fieldDto), $filteredValue['value']);
$textFilter->applyFilter($repositoryQuery, $fieldDto, $this->getFieldProperty($fieldDto), $filteredValue['value']);
break; break;
case DateTimeType::class: case DateTimeType::class:
case DateType::class: case DateType::class:

+ 1
- 1
Resources/assets/app/adminlte/index/index.scss View File

.table th input { .table th input {
width: 100%; width: 100%;
} }
.card-table {
.card-table, table {
.badge { .badge {
white-space: normal; white-space: normal;
} }

+ 1
- 1
Resources/translations/admin.fr.yaml View File

news: Actualités news: Actualités
newsletters: Bulletins d'informations newsletters: Bulletins d'informations
user: Utilisateurs user: Utilisateurs
user_index: Liste
user_index: Utilisateurs
account: Mon compte account: Mon compte
account_profile: Informations personnelles account_profile: Informations personnelles
account_password: Mot de passe account_password: Mot de passe

+ 7
- 6
Resources/views/admin/ticket/field/status.html.twig View File

{% import "@LcSov/adminlte/macro/badge.html.twig" as macro %} {% import "@LcSov/adminlte/macro/badge.html.twig" as macro %}

{% set status = entity.instance.status %}
{% if status is not defined %}
{% set status = entity.instance.status %}
{% endif %}
{% if status == 'open' %} {% if status == 'open' %}
{{ macro.badge_success(('entity.Ticket.fields.statusOptions.'~entity.instance.status)|trans({},'admin')) }}
{{ macro.badge_success(status|sov_trans_admin_choice('status','Ticket')) }}
{% elseif status == 'being-processed' %} {% elseif status == 'being-processed' %}
{{ macro.badge_warning(('entity.Ticket.fields.statusOptions.'~entity.instance.status)|trans({},'admin')) }}
{{ macro.badge_warning(status|sov_trans_admin_choice('status','Ticket')) }}
{% elseif status == 'closed' %} {% elseif status == 'closed' %}
{{ macro.badge_danger(('entity.Ticket.fields.statusOptions.'~entity.instance.status)|trans({},'admin')) }}
{% endif %}
{{ macro.badge_danger(status|sov_trans_admin_choice('status','Ticket')) }}
{% endif %}

+ 33
- 0
Resources/views/admin/ticket/macro.html.twig View File

{% macro list_tickets(tickets) %}
<table class="table table-condensed">
<thead>
<tr>
<th>Sujet</th>
<th>Statut</th>
<th>Dernier message</th>
<th></th>
</tr>
</thead>
<tbody>
{% for ticket in tickets %}
<tr>
<td>{{ ticket.subject }}</td>
<td>
{% set value = ticket.status %}
{% include '@LcSov/admin/ticket/field/status.html.twig' with {status: ticket.status}%}
</td>
<td>
{% set item = ticket %}
{% include '@LcSov/admin/ticket/field/lastmessage.html.twig' %}
</td>
<td>
<a class="btn-sm btn-success" data-toggle="tooltip" title="{{ 'detail'|sov_trans_admin_action('Ticket') }}"
href="{{ ea_url_short("App\\Controller\\Ticket\\TicketAdminController", 'detail', ticket.id) }}">
<i class="fas fa-eye"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endmacro list_tickets %}

+ 4
- 0
Resources/views/adminlte/crud/field/amount.html.twig View File

{% if value is not defined %}
{% set value = field.value %}
{% endif %}
{{ value|format_price|raw }}

+ 5
- 2
Resources/views/adminlte/crud/field/boolean.html.twig View File

{% if field.value %}
{% if value is not defined %}
{% set value = field.value %}
{% endif %}
{% if value == 1 %}
<span class="badge badge-success">Oui</span> <span class="badge badge-success">Oui</span>
{% else %} {% else %}
<span class="badge badge-danger">Non</span> <span class="badge badge-danger">Non</span>
{% endif %}
{% endif %}

+ 5
- 2
Resources/views/adminlte/crud/field/status.html.twig View File

{% if field.value == 1 %}
{% if value is not defined %}
{% set value = field.value %}
{% endif %}
{% if value == 1 %}
<div class="badge badge-success">En ligne</div> <div class="badge badge-success">En ligne</div>
{% else %} {% else %}
<div class="badge badge-danger">Hors ligne</div> <div class="badge badge-danger">Hors ligne</div>
{% endif %}
{% endif %}

+ 11
- 0
Resources/views/adminlte/embed/smallbox.html.twig View File


<div class="small-box bg-{% block color %}{% endblock %}">
<div class="inner">
<h3>{% block title %}{% endblock %}</h3>
<p>{% block content %}{% endblock %}</p>

<div class="icon">
<i class="fa fa-{% block icon %}bg-info{% endblock %}"></i>
</div>
</div>
</div>

+ 2
- 1
Resources/views/adminlte/macro/button.html.twig View File

{{ params.label|sov_trans_admin_action }} {{ params.label|sov_trans_admin_action }}
</span> </span>
</button> </button>
{% endmacro %}
{% endmacro %}


+ 5
- 3
Twig/TwigExtension.php View File



namespace Lc\SovBundle\Twig; namespace Lc\SovBundle\Twig;


use App\Controller\Ticket\TicketAdminController;
use App\Repository\ReminderRepository; use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
public function generateEaUrl(string $controller =null, string $action=null, int $entityId=null, array $extraParam = array()): string public function generateEaUrl(string $controller =null, string $action=null, int $entityId=null, array $extraParam = array()): string
{ {
$adminUrlGenerator = $this->adminUrlGenerator; $adminUrlGenerator = $this->adminUrlGenerator;

if ($controller) { if ($controller) {
$adminUrlGenerator->setController($controller); $adminUrlGenerator->setController($controller);
} }
if ($action) { if ($action) {
$adminUrlGenerator->setAction($action); $adminUrlGenerator->setAction($action);
} }
if ($entityId) {
$adminUrlGenerator->setEntityId($entityId);
}
$adminUrlGenerator->setEntityId($entityId);
if($extraParam){ if($extraParam){
foreach ($extraParam as $key=>$value) { foreach ($extraParam as $key=>$value) {
$adminUrlGenerator->set($key, $value); $adminUrlGenerator->set($key, $value);

Loading…
Cancel
Save