Browse Source

ticket detail, ticket list

ideas
Charly 3 years ago
parent
commit
9a9aedb542
15 changed files with 374 additions and 84 deletions
  1. +26
    -33
      Controller/AbstractAdminController.php
  2. +60
    -17
      Controller/Ticket/TicketAdminController.php
  3. +23
    -1
      Factory/Ticket/TicketFactory.php
  4. +23
    -0
      Factory/Ticket/TicketMessageFactory.php
  5. +96
    -0
      Form/Ticket/TicketFormType.php
  6. +6
    -18
      Form/Ticket/TicketMessageType.php
  7. +13
    -2
      Model/Ticket/TicketModel.php
  8. +3
    -1
      Resources/assets/app/adminlte/index/index.scss
  9. +1
    -1
      Resources/config/routes.yaml
  10. +8
    -6
      Resources/translations/admin.fr.yaml
  11. +83
    -0
      Resources/views/admin/ticket/detail.html.twig
  12. +3
    -3
      Resources/views/admin/ticket/index_status.html.twig
  13. +19
    -0
      Resources/views/admin/ticket/new.html.twig
  14. +8
    -0
      Resources/views/adminlte/embed/infobox.html.twig
  15. +2
    -2
      Resources/views/adminlte/macro/infobox.html.twig

+ 26
- 33
Controller/AbstractAdminController.php View File



abstract class AbstractAdminController extends EaAbstractCrudController abstract class AbstractAdminController extends EaAbstractCrudController
{ {
protected $session;
protected $request;
protected $em;
protected $translatorAdmin;

public function __construct(
SessionInterface $session,
RequestStack $request,
EntityManagerInterface $em,
TranslatorAdmin $translatorAdmin
) {
$this->session = $session;
$this->request = $request;
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
public static function getSubscribedServices()
{
return array_merge(parent::getSubscribedServices(), [
'session' => SessionInterface::class,
'request' => RequestStack::class,
'em' => EntityManagerInterface::class,
'translator_admin' => TranslatorAdmin::class,
]);
} }


public function configureActions(Actions $actions): Actions public function configureActions(Actions $actions): Actions
$actionsArray[Crud::PAGE_INDEX] = [ $actionsArray[Crud::PAGE_INDEX] = [
Action::NEW => [ Action::NEW => [
'icon' => 'plus', 'icon' => 'plus',
'label' => $this->translatorAdmin->transAction('create'),
'label' => $this->get('translator_admin')->transAction('create'),
'add_class' => 'btn-sm' 'add_class' => 'btn-sm'
], ],
Action::EDIT => [ Action::EDIT => [
'label' => false, 'label' => false,
'html_attributes' => array( 'html_attributes' => array(
'data-toggle' => 'tooltip', 'data-toggle' => 'tooltip',
'title' => $this->translatorAdmin->transAction('edit')
'title' => $this->get('translator_admin')->transAction('edit')
) )
], ],
Action::DETAIL => [ Action::DETAIL => [
'icon' => 'eye', 'icon' => 'eye',
'add_class' => 'btn btn-success',
'add_class' => 'btn btn-sm btn-success',
'label' => false, 'label' => false,
'html_attributes' => array( 'html_attributes' => array(
'data-toggle' => 'tooltip', 'data-toggle' => 'tooltip',
'title' => $this->translatorAdmin->transAction('detail')
'title' => $this->get('translator_admin')->transAction('detail')
) )
], ],
Action::DELETE => [ Action::DELETE => [
'icon' => 'trash', 'icon' => 'trash',
'dropdown' => true, 'dropdown' => true,
'label' => $this->translatorAdmin->transAction('delete')
'label' => $this->get('translator_admin')->transAction('delete')
], ],
Action::BATCH_DELETE => [ Action::BATCH_DELETE => [
'class' => 'btn btn-sm btn-danger', 'class' => 'btn btn-sm btn-danger',
'icon' => 'trash', 'icon' => 'trash',
'label' => $this->translatorAdmin->transAction('delete')
'label' => $this->get('translator_admin')->transAction('delete')
], ],
]; ];


$actionSaveAndReturn = [ $actionSaveAndReturn = [
'add_class' => 'float-right', 'add_class' => 'float-right',
'icon' => 'check', 'icon' => 'check',
'label' => $this->translatorAdmin->transAction('save_and_return')
'label' => $this->get('translator_admin')->transAction('save_and_return')
]; ];
$actionIndex = [ $actionIndex = [
'icon' => 'chevron-left', 'icon' => 'chevron-left',
'class' => 'btn btn-link', 'class' => 'btn btn-link',
'label' => $this->translatorAdmin->transAction('back_index')
'label' => $this->get('translator_admin')->transAction('back_index')
]; ];


$actionsArray[Crud::PAGE_EDIT] = [ $actionsArray[Crud::PAGE_EDIT] = [
Action::SAVE_AND_CONTINUE => [ Action::SAVE_AND_CONTINUE => [
'class' => 'btn btn-info float-right', 'class' => 'btn btn-info float-right',
'label' => $this->translatorAdmin->transAction('save_and_continue')
'label' => $this->get('translator_admin')->transAction('save_and_continue')
], ],
Action::DELETE => [ Action::DELETE => [
'icon' => 'trash', 'icon' => 'trash',
'class' => 'btn btn-outline-danger action-delete', 'class' => 'btn btn-outline-danger action-delete',
'label' => $this->translatorAdmin->transAction('delete')
'label' => $this->get('translator_admin')->transAction('delete')
], ],
Action::SAVE_AND_RETURN => $actionSaveAndReturn, Action::SAVE_AND_RETURN => $actionSaveAndReturn,
Action::INDEX => $actionIndex, Action::INDEX => $actionIndex,
$actionsArray[Crud::PAGE_NEW] = [ $actionsArray[Crud::PAGE_NEW] = [
Action::SAVE_AND_ADD_ANOTHER => [ Action::SAVE_AND_ADD_ANOTHER => [
'class' => 'btn btn-info float-right', 'class' => 'btn btn-info float-right',
'label' => $this->translatorAdmin->transAction('save_and_add_another')
'label' => $this->get('translator_admin')->transAction('save_and_add_another')
], ],
Action::SAVE_AND_RETURN => $actionSaveAndReturn, Action::SAVE_AND_RETURN => $actionSaveAndReturn,
Action::INDEX => $actionIndex, Action::INDEX => $actionIndex,
$actions->add(Crud::PAGE_NEW, Action::INDEX); $actions->add(Crud::PAGE_NEW, Action::INDEX);


if ($this->isInstanceOf(SortableInterface::class)) { if ($this->isInstanceOf(SortableInterface::class)) {
$sortAction = Action::new('sort', $this->translatorAdmin->transAction('sort'), 'fa fa-sort')
$sortAction = Action::new('sort', $this->get('translator_admin')->transAction('sort'), 'fa fa-sort')
->linkToCrudAction('sort') ->linkToCrudAction('sort')
->setCssClass('btn btn-sm btn-success') ->setCssClass('btn btn-sm btn-success')
->createAsGlobalAction(); ->createAsGlobalAction();
if ($this->isInstanceOf(TreeInterface::class)) { if ($this->isInstanceOf(TreeInterface::class)) {
$indexChildAction = Action::new( $indexChildAction = Action::new(
'index_children', 'index_children',
$this->translatorAdmin->transAction('index_children'),
$this->get('translator_admin')->transAction('index_children'),
'fa fa-list' 'fa fa-list'
) )
->linkToCrudAction(Action::INDEX) ->linkToCrudAction(Action::INDEX)


$backParentAction = Action::new( $backParentAction = Action::new(
'index_parent', 'index_parent',
$this->translatorAdmin->transAction('index_parent'),
$this->get('translator_admin')->transAction('index_parent'),
'fa fa-chevron-left' 'fa fa-chevron-left'
) )
->linkToCrudAction(Action::INDEX) ->linkToCrudAction(Action::INDEX)
$entityClass = $this->getEntityFqcn(); $entityClass = $this->getEntityFqcn();
$paramListMaxResults = 'listMaxResults'; $paramListMaxResults = 'listMaxResults';
$paramSessionListMaxResults = $entityClass . '-' . $paramListMaxResults; $paramSessionListMaxResults = $entityClass . '-' . $paramListMaxResults;
$requestListMaxResults = $this->request->getCurrentRequest()->get($paramListMaxResults);
$requestListMaxResults = $this->get('request')->getCurrentRequest()->get($paramListMaxResults);


if ($requestListMaxResults) { if ($requestListMaxResults) {
$this->session->set($paramSessionListMaxResults, $requestListMaxResults);
$this->get('session')->set($paramSessionListMaxResults, $requestListMaxResults);
} }
$maxResults = $this->session->get($paramSessionListMaxResults) ? $this->session->get(
$maxResults = $this->get('session')->get($paramSessionListMaxResults) ? $this->get('session')->get(
$paramSessionListMaxResults $paramSessionListMaxResults
) : 30; ) : 30;




// on vide le flash bag si édition en ajax (notification déjà affichée en Javascript) // on vide le flash bag si édition en ajax (notification déjà affichée en Javascript)
if ($context->getRequest()->isXmlHttpRequest()) { if ($context->getRequest()->isXmlHttpRequest()) {
$this->session->getFlashBag()->clear();
$this->get('session')->getFlashBag()->clear();
} }


return $response; return $response;

+ 60
- 17
Controller/Ticket/TicketAdminController.php View File

namespace Lc\SovBundle\Controller\Ticket; namespace Lc\SovBundle\Controller\Ticket;


use App\Entity\Ticket\Ticket; use App\Entity\Ticket\Ticket;
use App\Entity\Ticket\TicketMessage;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action; use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters; use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\AfterEntityPersistedEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityPersistedEvent;
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException;
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException;
use EasyCorp\Bundle\EasyAdminBundle\Factory\EntityFactory;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField; use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField; use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission;
use Lc\SovBundle\Factory\Ticket\TicketFactory;
use Lc\SovBundle\Field\StatusField; use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Form\Ticket\TicketFormType;
use Lc\SovBundle\Model\Ticket\TicketInterface; use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Controller\AbstractAdminController; use Lc\SovBundle\Controller\AbstractAdminController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;


abstract class TicketAdminController extends AbstractAdminController
class TicketAdminController extends AbstractAdminController
{ {
protected $ticketFactory;

public function __construct(TicketFactory $ticketFactory)
{
$this->ticketFactory = $ticketFactory;
}


public static function getEntityFqcn(): string public static function getEntityFqcn(): string
{ {
]; ];
} }


// public function configureCrud(Crud $crud): Crud
// {
// $crud
// ->overrideTemplate('crud/detail', '@LcSov/admin/ticket/detail.html.twig');
//
// return parent::configureCrud($crud);
// }
public function configureCrud(Crud $crud): Crud
{
$crud
->overrideTemplate('crud/detail', '@LcSov/admin/ticket/detail.html.twig');
return parent::configureCrud($crud);
}


public function configureActions(Actions $actions): Actions public function configureActions(Actions $actions): Actions
{ {
// $actions
// ->add(Crud::PAGE_INDEX, Action::DETAIL);
// $actions = parent::configureActions($actions);
// $actions
// ->remove(Crud::PAGE_INDEX, Action::EDIT);
// return $actions;

$actions $actions
->add(Crud::PAGE_INDEX, Action::DETAIL);
// ->remove(Crud::PAGE_INDEX, Action::EDIT);
->add(Crud::PAGE_INDEX, Action::DETAIL)
->remove(Crud::PAGE_INDEX, Action::EDIT);
return parent::configureActions($actions); return parent::configureActions($actions);
} }

public function new(AdminContext $context)
{
$ticket = $this->ticketFactory->create();
$form = $this->createForm(TicketFormType::class, $ticket);

$form->handleRequest($context->getRequest());
if ($form->isSubmitted() && $form->isValid()) {
$ticket = $form->getData();

foreach($ticket->getTicketMessages() as $ticketMessage){
$this->get('em')->persist($ticketMessage);
}

$this->get('em')->persist($ticket);
$this->get('em')->flush();

return $this->redirectToRoute('admin_dashboard');
}

return $this->render(
'@LcSov/admin/ticket/new.html.twig',
[
'form' => $form->createView(),
]
);
}
} }

+ 23
- 1
Factory/Ticket/TicketFactory.php View File



namespace Lc\SovBundle\Factory\Ticket; namespace Lc\SovBundle\Factory\Ticket;


use App\Entity\Ticket\Ticket;
use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Factory\AbstractFactory; use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Ticket\TicketInterface; use Lc\SovBundle\Model\Ticket\TicketInterface;


class TicketFactory extends AbstractFactory class TicketFactory extends AbstractFactory
{ {
protected $ticketMessageFactory;

public function __construct(EntityManagerInterface $em, TicketMessageFactory $ticketMessageFactory)
{
$this->ticketMessageFactory = $ticketMessageFactory;

parent::__construct($em);
}

public function getEntityClass() public function getEntityClass()
{ {
return TicketInterface::class; return TicketInterface::class;


public function create($params = array()) public function create($params = array())
{ {
return parent::create($params);
if (!isset($params['status'])) {
$params['status'] = Ticket::TICKET_STATUS_OPEN;
}

$ticket = parent::create($params);

if (!isset($params['ticketMessages'])) {
$ticket->addTicketMessage($this->ticketMessageFactory->create());
}

return $ticket;
} }

} }

+ 23
- 0
Factory/Ticket/TicketMessageFactory.php View File

<?php

namespace Lc\SovBundle\Factory\Ticket;

use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\Ticket\TicketMessageInterface;

class TicketMessageFactory extends AbstractFactory
{
public function getEntityClass()
{
return TicketMessageInterface::class;
}

public function create($params = array())
{
if (!isset($params['status'])) {
$params['status'] = 1;
}

return parent::create($params);
}
}

+ 96
- 0
Form/Ticket/TicketFormType.php View File

<?php

namespace Lc\SovBundle\Form\Ticket;

use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\Ticket\TicketModel;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
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\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TicketFormType extends AbstractType
{

protected $em;
protected $translatorAdmin;

public function __construct(EntityManager $em, TranslatorAdmin $translatorAdmin)
{
$this->em = $em;
$this->translatorAdmin = $translatorAdmin;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$entityName = $this->em->getEntityName(TicketInterface::class);

$builder->add(
'user',
EntityType::class,
[
'class' => $this->em->getEntityName(UserInterface::class),
]
);

$builder->add(
'subject',
TextType::class
);

$builder->add(
'type',
ChoiceType::class,
[
'label' => 'Type',
'choices' => [
$this->translatorAdmin->transField(
'typeOptions.' . TicketModel::TYPE_TECHNICAL_PROBLEM,
$entityName
) => TicketModel::TYPE_TECHNICAL_PROBLEM,
$this->translatorAdmin->transField(
'typeOptions.' . TicketModel::TYPE_GENERAL_QUESTION,
$entityName
) => TicketModel::TYPE_TECHNICAL_PROBLEM,
],
]
);

$builder->add(
'ticketMessages',
CollectionType::class,
[
'entry_type' => TicketMessageType::class,
'allow_add' => false,
]
);

$builder->add(
'submit',
SubmitType::class,
[
'label' => $this->translatorAdmin->transAction('save')
]
);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'data_class' => $this->em->getEntityName(TicketInterface::class),
]
);
}
}

+ 6
- 18
Form/Ticket/TicketMessageType.php View File



namespace Lc\SovBundle\Form\Ticket; namespace Lc\SovBundle\Form\Ticket;


use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\Ticket\TicketMessageInterface; use Lc\SovBundle\Model\Ticket\TicketMessageInterface;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
{ {
protected $em; protected $em;


public function __construct(EntityManagerInterface $em)
public function __construct(EntityManager $em)
{ {
$this->em = $em; $this->em = $em;
} }
$builder->add( $builder->add(
'message', 'message',
TextareaType::class, TextareaType::class,
array(
[
'required' => true 'required' => true
)
)
->add(
'add',
SubmitType::class,
array(
'label' => 'action.send',
'attr' => array(
'class' => 'btn btn-primary float-right'
)
)
);
]
);
} }


public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults( $resolver->setDefaults(
[ [
'data_class' => $this->em->getClassMetadata(TicketMessageInterface::class)->getName(),
'translation_domain' => 'lcshop'
'data_class' => $this->em->getEntityName(TicketMessageInterface::class),
] ]
); );
} }

+ 13
- 2
Model/Ticket/TicketModel.php View File

protected $visitorToken; protected $visitorToken;


/** /**
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Ticket\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true)
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Ticket\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true, cascade={"persist", "remove"})
* @ORM\OrderBy({"id" = "ASC"}) * @ORM\OrderBy({"id" = "ASC"})
*/ */
protected $ticketMessages; protected $ticketMessages;
} }
} }


public function getUserInfosTicket()
{
$user = $this->getUser();
if ($user) {
return '#' . $user->getId() . ' ' . $user->getName() . ' ' . $user->getEmail();
} else {
return strtoupper($this->getVisitorLastname()) . ' ' . $this->getVisitorFirstname(
) . ' ' . $this->getVisitorEmail();
}
}

public function getEmail() public function getEmail()
{ {
if ($this->getUser()) { if ($this->getUser()) {


public function getTypeLabel(): string public function getTypeLabel(): string
{ {
return 'field.Ticket.typeOptions.' . $this->getType();
return 'entity.Ticket.fields.typeOptions.' . $this->getType();
} }


public function getStatus(): ?string public function getStatus(): ?string

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


table.table { table.table {
.dropdown-actions { .dropdown-actions {
display: inline-block ; display: inline-block ;
} }
.actions {
white-space: nowrap;
}
} }

+ 1
- 1
Resources/config/routes.yaml View File



sov_admin_create_ticket: sov_admin_create_ticket:
path: /admin/ticket/create path: /admin/ticket/create
controller: Lc\SovBundle\Controller\Ticket\TicketAdminController::createTicket
controller: Lc\SovBundle\Controller\Ticket\TicketAdminController::create



+ 8
- 6
Resources/translations/admin.fr.yaml View File

label: Page label: Page
label_plurial: Pages label_plurial: Pages
Ticket: Ticket:
status:
open: Ouvert
being-processed: En attente
closed: Fermé
label: Ticket
label_plurial: Tickets
fields: fields:
visitorFirstName: Nom visitorFirstName: Nom
visitorLastName: Prénom visitorLastName: Prénom
visitorEmail: E-mail visitorEmail: E-mail
subject: Sujet subject: Sujet
type: Type type: Type
lastMessage: Dernier message
typeOptions: typeOptions:
general-question: Questions générales general-question: Questions générales
technical-problem: Problème technique technical-problem: Problème technique
lastMessage: Dernier message
statusOptions:
open: Ouvert
being-processed: En attente
closed: Fermé


default: default:
fields: fields:
id: Id id: Id
createdAt: Created at
createdAt: Créé à
user: Utilisateur user: Utilisateur
firstname: Prénom firstname: Prénom
lastname: Nom lastname: Nom

+ 83
- 0
Resources/views/admin/ticket/detail.html.twig View File

{% extends '@LcSov/adminlte/layout.html.twig' %}
{% import '@LcSov/adminlte/macro/infobox.html.twig' as macro %}

{% block content_title %}
{{ 'detail'|lc_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

{% block main %}
{{ dump() }}
<div class="row">
<div class="col-4">
{% embed '@LcSov/adminlte/embed/infobox.html.twig' %}
{% block color %}blue{% endblock %}
{% block icon %}fa fa-toggle-on{% endblock %}
{% block title %}Status{% endblock %}
{% block content %}
{{ entity.instance.status }}
{% endblock %}
{% endembed %}

{% embed '@LcSov/adminlte/embed/infobox.html.twig' %}
{% block color %}blue{% endblock %}
{% block icon %}fa fa-user{% endblock %}
{% block title %}Utilisateur{% endblock %}
{% block content %}
{{ entity.instance.getUserInfosTicket() }}
{% endblock %}
{% endembed %}

{{ macro.infobox('Date',entity.instance.createdAt|date('d/m/Y'), "yellow", "fa fa-calendar") }}
{{ macro.infobox('Catégorie',entity.instance.getTypeLabel()|trans({},'admin'), "green", "fa fa-archive") }}
</div>
<div class="col-8">
{% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block css %}card-primary{% endblock %}
{% block header %}
<h3 class="card-title">
Liste des messages
</h3>
{% endblock header %}

{% block body_wrapper %}
<div class="card-body row">
<div class="col-12 direct-chat-primary">
{% for message in entity.instance.ticketMessages %}
<div class="direct-chat-msg {{ message.answerByAdmin ? 'right' }}">
<div class="direct-chat-infos clearfix">
<div class="direct-chat-name {{ message.answerByAdmin ? 'float-right' : 'float-left' }}">
{{ message.createdBy }}
</div>
<div class="direct-chat-timestamp {{ message.answerByAdmin ? 'float-left' : 'float-right' }}">
{{ message.createdAt|date('d/m/Y H:i') }}
</div>
</div>
{% if message.answerByAdmin %}
<div class="direct-chat-img align-items-center">
<i class="fa fa-user-circle" style="font-size: 2rem; color: red"></i>
</div>
{% else %}
<div class="direct-chat-img align-items-center">
<i class="fa fa-user-circle" style="font-size: 2rem"></i>
</div>
{% endif %}
<div class="direct-chat-text">
<p>{{ message.message|nl2br }}</p>
{% if message.imageFilename is not null %}
<i>Photo jointe au message : </i> <br/>
<a href="{{ lc_liip(message.imageFilename, 'big') }}"
data-toggle="lightbox">
<img src="{{ lc_liip(message.imageFilename, 'thumb') }}"
alt="Illustration ticket"/>
</a>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
{% endembed %}
</div>
</div>
{% endblock %}

+ 3
- 3
Resources/views/admin/ticket/index_status.html.twig View File



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

+ 19
- 0
Resources/views/admin/ticket/new.html.twig View File

{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block content_title %}
{# {{ 'ticket.profile'|lc_trans_admin_title }}#}
Créer un ticket
{% endblock %}

{% block main %}
<div class="col-8">
{% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block header_wrapper %}{% endblock %}
{% block body %}
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form(form) }}
{% endblock %}
{% block footer_wrapper %}{% endblock %}
{% endembed %}
</div>
{% endblock main %}

+ 8
- 0
Resources/views/adminlte/embed/infobox.html.twig View File

<div class="info-box">
<!-- Apply any bg-* class to to the icon to color it -->
<span class="info-box-icon bg-{% block color %}{% endblock %}"><i class="{% block icon %}{% endblock %}"></i></span>
<div class="info-box-content">
<span class="info-box-text">{% block title %}{% endblock %}</span>
<span class="info-box-number">{% block content %}{% endblock %}</span>
</div>
</div>

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

{% macro infobox(title, number, color, icon) %}
{% macro infobox(title, content, color, icon) %}
<div class="info-box"> <div class="info-box">
<!-- Apply any bg-* class to to the icon to color it --> <!-- Apply any bg-* class to to the icon to color it -->
<span class="info-box-icon bg-{{ color }}"><i class="{{ icon }}"></i></span> <span class="info-box-icon bg-{{ color }}"><i class="{{ icon }}"></i></span>
<div class="info-box-content"> <div class="info-box-content">
<span class="info-box-text">{{ title }}</span> <span class="info-box-text">{{ title }}</span>
<span class="info-box-number">{{ number }}</span>
<span class="info-box-number">{{ content }}</span>
</div> </div>
<!-- /.info-box-content --> <!-- /.info-box-content -->
</div> </div>

Loading…
Cancel
Save