Browse Source

ticker+reminder

feature/ticket
Charly 3 years ago
parent
commit
5eb84df8dd
20 changed files with 910 additions and 10 deletions
  1. +1
    -1
      Controller/Dashboard/DashboardAdminController.php
  2. +1
    -1
      Controller/Reminder/ReminderAdminController.php
  3. +1
    -1
      Controller/Security/SecurityAdminController.php
  4. +46
    -0
      Controller/Ticket/TicketAdminController.php
  5. +254
    -0
      Controller/Ticket/_TicketAdminController.php
  6. +52
    -0
      Form/Ticket/TicketMessageType.php
  7. +49
    -0
      Form/Ticket/TicketStatusType.php
  8. +59
    -0
      Form/Ticket/TicketTypeType.php
  9. +1
    -1
      Model/File/FileModel.php
  10. +2
    -1
      Model/Reminder/ReminderModel.php
  11. +2
    -1
      Model/Setting/SettingModel.php
  12. +8
    -0
      Model/Ticket/TicketInterface.php
  13. +8
    -0
      Model/Ticket/TicketMessageInterface.php
  14. +106
    -0
      Model/Ticket/TicketMessageModel.php
  15. +258
    -0
      Model/Ticket/TicketModel.php
  16. +2
    -1
      Model/User/GroupUserModel.php
  17. +22
    -0
      Repository/Ticket/TicketMessageRepository.php
  18. +22
    -0
      Repository/Ticket/TicketRepository.php
  19. +2
    -2
      Resources/config/routes.yaml
  20. +14
    -1
      Resources/translations/admin.fr.yaml

Controller/Dashboard/DashboardController.php → Controller/Dashboard/DashboardAdminController.php View File

use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;


class DashboardController extends AbstractDashboardController
class DashboardAdminController extends AbstractDashboardController
{ {
public function index(): Response public function index(): Response
{ {

Controller/Reminder/ReminderController.php → Controller/Reminder/ReminderAdminController.php View File

use Lc\SovBundle\Controller\AbstractAdminController; use Lc\SovBundle\Controller\AbstractAdminController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;


abstract class ReminderController extends AbstractAdminController
abstract class ReminderAdminController extends AbstractAdminController
{ {


public function renderTemplate($actionName, $templatePath, array $parameters = []) public function renderTemplate($actionName, $templatePath, array $parameters = [])

Controller/Security/SecurityController.php → Controller/Security/SecurityAdminController.php View File

use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;


class SecurityController extends AbstractController
class SecurityAdminController extends AbstractController
{ {


public function login(AuthenticationUtils $authenticationUtils): Response public function login(AuthenticationUtils $authenticationUtils): Response

+ 46
- 0
Controller/Ticket/TicketAdminController.php View File

<?php

namespace Lc\SovBundle\Controller\Ticket;

use App\Entity\Ticket\Ticket;
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Controller\AbstractAdminController;

abstract class TicketAdminController extends AbstractAdminController
{

public static function getEntityFqcn(): string
{
return TicketInterface::class;
}

public function configureFields(string $pageName): iterable
{

return [
TextField::new('id')->hideOnForm(),
DateField::new('createdAt')->setFormat('short')->hideOnForm(),
TextField::new('visitorFirstName')->hideOnForm(),
TextField::new('visitorLastName')->hideOnForm(),
TextField::new('visitorEmail')->hideOnForm(),
AssociationField::new('user')
->hideOnIndex(),
TextField::new('subject'),
ChoiceField::new('type')
->autocomplete()
->setChoices(
[
'entity.Ticket.fields.typeOptions.' . Ticket::TYPE_GENERAL_QUESTION => Ticket::TYPE_GENERAL_QUESTION,
'entity.Ticket.fields.typeOptions.' . Ticket::TYPE_TECHNICAL_PROBLEM => Ticket::TYPE_TECHNICAL_PROBLEM,
]
),
StatusField::new('status')->setRequired(false)->hideOnForm(),
];
}
}

+ 254
- 0
Controller/Ticket/_TicketAdminController.php View File

<?php

namespace Lc\SovBundle\Controller\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Form\Ticket\TicketMessageType;
use Lc\SovBundle\Form\Ticket\TicketStatusType;
use Lc\SovBundle\Services\UtilsManager;
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Lc\SovBundle\Model\Ticket\TicketModel;

abstract class _TicketAdminController extends AbstractAdminController
{
protected $ticketUtils;
protected $userUtils;

public function __construct(
Security $security,
UserManagerInterface $userManager,
EntityManagerInterface $em,
MailjetTransport $mailjetTransport,
UtilsManager $utilsManager,
TranslatorInterface $translator,
SessionInterface $session
) {
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator, $session);
$this->ticketUtils = $utilsManager->getTicketUtils();
$this->userUtils = $utilsManager->getUserUtils();
}

public function persistTicketEntity($entity, $form)
{
$entity->setStatus(TicketModel::TICKET_STATUS_OPEN);

$ticket = $this->ticketUtils->createTicket(
[
'user' => $entity->getUser(),
'type' => $entity->getType(),
'orderShop' => $entity->getOrderShop(),
'subject' => $entity->getSubject(),
'message' => $form->get('message')->getData(),
'createByAdmin' => true,
]
);
}

protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)
{
$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);

if ($this->filtersForm->get('status')->getData() === null) {
$queryBuilder->andWhere('entity.status LIKE :open OR entity.status LIKE :beingprocessed');
$queryBuilder->setParameter('open', TicketModel::TICKET_STATUS_OPEN);
$queryBuilder->setParameter('beingprocessed', TicketModel::TICKET_STATUS_BEING_PROCESSED);
}

return $queryBuilder;
}

public function showAction()
{
$this->dispatch(EasyAdminEvents::PRE_SHOW);

$id = $this->request->query->get('id');
$easyadmin = $this->request->attributes->get('easyadmin');
$entity = $easyadmin['item'];

$fields = $this->entity['show']['fields'];
$deleteForm = $this->createDeleteForm($this->entity['name'], $id);

$this->dispatch(
EasyAdminEvents::POST_SHOW,
[
'deleteForm' => $deleteForm,
'fields' => $fields,
'entity' => $entity,
]
);

$parameters = [
'entity' => $entity,
'fields' => $fields,
'delete_form' => $deleteForm->createView(),
];

return $this->executeDynamicMethod(
'render<EntityName>Template',
['show', $this->entity['templates']['show'], $parameters]
);
}

/**
* The method that is executed when the user performs a 'show' action on an entity.
*
* @return Response
*/
public function renderTicketTemplate($actionName, $templatePath, array $parameters = [])
{
if ($actionName == 'show') {
$parameters['form_add_ticket_message'] = $this->createCustomForm(
TicketMessageType::class,
'newMessageTicket',
$parameters,
false
)->createView();
$parameters['form_ticket_status'] = $this->createCustomForm(
TicketStatusType::class,
'ticketStatus',
$parameters
)->createView();
}
return parent::renderTemplate($actionName, $templatePath, $parameters);
}


public function ticketStatusAction()
{
$easyadmin = $this->request->attributes->get('easyadmin');
$ticket = $easyadmin['item'];

$formTicketStatusForm = $this->createForm(TicketStatusType::class, $ticket);
$formTicketStatusForm->handleRequest($this->request);

if ($formTicketStatusForm->isSubmitted() && $formTicketStatusForm->isValid()) {
$this->em->persist($ticket);
$this->em->flush();

$this->utils->addFlash('success', 'success.ticket.statusChange');
} else {
$this->utils->addFlash('error', $formTicketStatusForm->getErrors());
}
$response['flashMessages'] = $this->utils->getFlashMessages();

return new Response(json_encode($response));
}

public function newMessageTicketAction()
{
$easyadmin = $this->request->attributes->get('easyadmin');
$ticket = $easyadmin['item'];

$formAddTicketMessage = $this->createForm(TicketMessageType::class);
$formAddTicketMessage->handleRequest($this->request);

if ($formAddTicketMessage->isSubmitted() && $formAddTicketMessage->isValid()) {
$this->ticketUtils->createTicketMessage(
array(
'ticket' => $ticket,
'message' => $formAddTicketMessage->get('message')->getData(),
'answerByAdmin' => true
)
);

$this->utils->addFlash('success', 'success.ticket.addMessage');
} else {
$this->utils->addFlash('error', $formAddTicketMessage->getErrors());
}

return $this->redirectToRoute(
'easyadmin',
[
'action' => 'show',
'entity' => 'Ticket',
'id' => $ticket->getId()
]
);
}

public function newAction()
{
$this->dispatch(EasyAdminEvents::PRE_NEW);

$entity = $this->executeDynamicMethod('createNew<EntityName>Entity');

$easyadmin = $this->request->attributes->get('easyadmin');
$easyadmin['item'] = $entity;
$this->request->attributes->set('easyadmin', $easyadmin);

$fields = $this->entity['new']['fields'];

$newForm = $this->executeDynamicMethod('create<EntityName>NewForm', [$entity, $fields]);

if ($this->request->request->get('user')) {
$userRepo = $this->em->getRepository(UserInterface::class);
$newForm->get('user')->setData($userRepo->find($this->request->request->get('user')));
}

if ($this->request->request->get('orderId')) {
$newForm->get('orderId')->setData($this->request->request->get('orderId'));
}


$newForm->handleRequest($this->request);

if ($newForm->isSubmitted() && $newForm->isValid()) {
if ($newForm->get('orderId')->getData()) {
$orderShopRepo = $this->em->getRepository(OrderShopInterface::class);
$orderShop = $orderShopRepo->find($newForm->get('orderId')->getData());
if ($orderShop) {
$entity->setOrderShop($orderShop);
}
}


$this->processUploadedFiles($newForm);

$this->dispatch(EasyAdminEvents::PRE_PERSIST, ['entity' => $entity]);
$this->executeDynamicMethod('persist<EntityName>Entity', [$entity, $newForm]);
$this->dispatch(EasyAdminEvents::POST_PERSIST, ['entity' => $entity]);

$this->utils->addFlash('success', 'success.ticket.addMessage');

if ($this->request->isXmlHttpRequest()) {
$response['type'] = 'success';
$response['flashMessages'] = $this->utils->getFlashMessages();
return new Response(json_encode($response));
} else {
return $this->redirectToReferrer();
}
}
$this->dispatch(
EasyAdminEvents::POST_NEW,
[
'entity_fields' => $fields,
'form' => $newForm,
'entity' => $entity,
]
);

$parameters = [
'form' => $newForm->createView(),
'entity_fields' => $fields,
'entity' => $entity,
];
if ($this->request->isXmlHttpRequest()) {
$response['modal'] = $this->renderView('@LcShop/backend/ticket/modal/create.html.twig', $parameters);
return new Response(json_encode($response));
} else {
return $this->executeDynamicMethod(
'render<EntityName>Template',
['new', $this->entity['templates']['new'], $parameters]
);
}
}
}

+ 52
- 0
Form/Ticket/TicketMessageType.php View File

<?php

namespace Lc\SovBundle\Form\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Model\Ticket\TicketMessageInterface;
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\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TicketMessageType extends AbstractType
{
protected $em;

public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'message',
TextareaType::class,
array(
'required' => true
)
)
->add(
'add',
SubmitType::class,
array(
'label' => 'action.send',
'attr' => array(
'class' => 'btn btn-primary float-right'
)
)
);
}

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

+ 49
- 0
Form/Ticket/TicketStatusType.php View File

<?php

namespace Lc\SovBundle\Form\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Model\Ticket\TicketModel;

class TicketStatusType extends AbstractType
{
protected $em;


public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add(
'status',
ChoiceType::class,
array(
'choices' => array(
'field.Ticket.statusOptions.' . TicketModel::TICKET_STATUS_OPEN => TicketModel::TICKET_STATUS_OPEN,
'field.Ticket.statusOptions.' . TicketModel::TICKET_STATUS_BEING_PROCESSED => TicketModel::TICKET_STATUS_BEING_PROCESSED,
'field.Ticket.statusOptions.' . TicketModel::TICKET_STATUS_CLOSED => TicketModel::TICKET_STATUS_CLOSED,
),
'required' => true,
'expanded' => true
)
);
}

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

+ 59
- 0
Form/Ticket/TicketTypeType.php View File

<?php

namespace Lc\SovBundle\Form\Ticket;

use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Lc\SovBundle\Model\Ticket\TicketModel;
use Lc\SovBundle\Model\Ticket\TicketInterface;

class TicketTypeType extends AbstractType
{
protected $em;


public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->addEventListener(
FormEvents::PRE_SET_DATA,
function (FormEvent $event) {
$builder = $event->getForm()->getParent();

$builder->add(
'type',
ChoiceType::class,
[
'label' => 'field.Ticket.type',
'multiple' => false,
'expanded' => false,
'choices' => [
'field.Ticket.typeOptions.' . TicketModel::TYPE_GENERAL_QUESTION => TicketModel::TYPE_GENERAL_QUESTION,
'field.Ticket.typeOptions.' . TicketModel::TYPE_TECHNICAL_PROBLEM => TicketModel::TYPE_TECHNICAL_PROBLEM,
],
'translation_domain' => 'lcshop',
]
);
}
);
}

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

+ 1
- 1
Model/File/FileModel.php View File

use Lc\SovBundle\Doctrine\Extension\TranslatableTrait; use Lc\SovBundle\Doctrine\Extension\TranslatableTrait;


abstract class FileModel implements SortableInterface, BlameableInterface, TimestampableInterface, TranslatableInterface, abstract class FileModel implements SortableInterface, BlameableInterface, TimestampableInterface, TranslatableInterface,
DevAliasInterface, EntityInterface
DevAliasInterface, EntityInterface, FileInterface
{ {
use DevAliasTrait; use DevAliasTrait;
use BlameableTrait; use BlameableTrait;

+ 2
- 1
Model/Reminder/ReminderModel.php View File

use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;


/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class ReminderModel extends AbstractLightEntity
abstract class ReminderModel extends AbstractLightEntity implements ReminderInterface, EntityInterface
{ {
/** /**
* temporary fields (do not delete) * temporary fields (do not delete)

+ 2
- 1
Model/Setting/SettingModel.php View File

namespace Lc\SovBundle\Model\Setting; namespace Lc\SovBundle\Model\Setting;


use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Model\File\FileInterface; use Lc\SovBundle\Model\File\FileInterface;


/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class SettingModel
abstract class SettingModel implements SettingInterface, EntityInterface
{ {
/** /**
* @ORM\Column(type="string", length=63) * @ORM\Column(type="string", length=63)

+ 8
- 0
Model/Ticket/TicketInterface.php View File

<?php

namespace Lc\SovBundle\Model\Ticket;

interface TicketInterface
{

}

+ 8
- 0
Model/Ticket/TicketMessageInterface.php View File

<?php

namespace Lc\SovBundle\Model\Ticket;

interface TicketMessageInterface
{

}

+ 106
- 0
Model/Ticket/TicketMessageModel.php View File

<?php

namespace Lc\SovBundle\Model\Ticket;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\StatusTrait;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;

/**
* @ORM\MappedSuperclass()
*/
abstract class TicketMessageModel extends AbstractLightEntity implements TicketMessageInterface, EntityInterface, StatusInterface
{
use StatusTrait;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\Column(type="text")
*/
protected $message;

/**
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Ticket\TicketInterface", inversedBy="ticketMessages")
* @ORM\JoinColumn(nullable=false)
*/
protected $ticket;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $answerByAdmin;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $imageFilename;

public function __toString()
{
return $this->message;
}

public function getMessage(): ?string
{
return $this->message;
}

public function setMessage(string $message): self
{
$this->message = $message;

return $this;
}

public function getTicket(): TicketInterface
{
return $this->ticket;
}

public function setTicket(TicketInterface $ticket): self
{
$this->ticket = $ticket;

return $this;
}

public function getAnswerByAdmin(): ?bool
{
return $this->answerByAdmin;
}

public function setAnswerByAdmin(?bool $answerByAdmin): self
{
$this->answerByAdmin = $answerByAdmin;

return $this;
}

public function getImageFilename(): ?string
{
return $this->imageFilename;
}

public function setImageFilename(?string $imageFilename): self
{
$this->imageFilename = $imageFilename;

return $this;
}
}

+ 258
- 0
Model/Ticket/TicketModel.php View File

<?php

namespace Lc\SovBundle\Model\Ticket;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class TicketModel extends AbstractLightEntity implements TicketInterface, EntityInterface
{
const TYPE_TECHNICAL_PROBLEM = 'technical-problem';
const TYPE_GENERAL_QUESTION = 'general-question';

const TICKET_STATUS_OPEN = 'open';
const TICKET_STATUS_BEING_PROCESSED = 'being-processed';
const TICKET_STATUS_CLOSED = 'closed';

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\Column(type="string", length=32)
*/
protected $type;

/**
* @ORM\Column(type="string", length=32)
*/
protected $status;

/**
* @ORM\Column(type="string", length=255)
*/
protected $subject;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $tags = [];

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $visitorFirstname;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $visitorLastname;

/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
protected $visitorEmail;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $visitorToken;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="tickets")
*/
protected $user;

public function __construct()
{
$this->ticketMessages = new ArrayCollection();
}

public function getUsername()
{
if ($this->getUser()) {
return $this->getUser()->getName();
} else {
return strtoupper($this->getVisitorLastname()) . ' ' . $this->getVisitorFirstname();
}
}

public function getVisitorInfos()
{
return strtoupper($this->getVisitorLastname()) . ' ' . $this->getVisitorFirstname(
) . ' (' . $this->getVisitorEmail() . ')';
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

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

public function getStatus(): ?string
{
return $this->status;
}

public function setStatus(string $status): self
{
$this->status = $status;

return $this;
}

public function getStatusLabel(): string
{
return 'field.Ticket.statusOptions.' . $this->getStatus();
}

public function getSubject(): ?string
{
return $this->subject;
}

public function setSubject(string $subject): self
{
$this->subject = $subject;

return $this;
}

public function getTags(): ?array
{
return $this->tags;
}

public function setTags(?array $tags): self
{
$this->tags = $tags;

return $this;
}

public function getVisitorFirstname(): ?string
{
return $this->visitorFirstname;
}

public function setVisitorFirstname(?string $visitorFirstname): self
{
$this->visitorFirstname = $visitorFirstname;

return $this;
}

public function getVisitorLastname(): ?string
{
return $this->visitorLastname;
}

public function setVisitorLastname(?string $visitorLastname): self
{
$this->visitorLastname = $visitorLastname;

return $this;
}

public function getVisitorEmail(): ?string
{
return $this->visitorEmail;
}

public function setVisitorEmail(?string $visitorEmail): self
{
$this->visitorEmail = $visitorEmail;

return $this;
}

public function getVisitorToken(): ?string
{
return $this->visitorToken;
}

public function setVisitorToken(?string $visitorToken): self
{
$this->visitorToken = $visitorToken;

return $this;
}

/**
* @return Collection|TicketMessageInterface[]
*/
public function getTicketMessages(): Collection
{
return $this->ticketMessages;
}

public function addTicketMessage(TicketMessageInterface $ticketMessage): self
{
if (!$this->ticketMessages->contains($ticketMessage)) {
$this->ticketMessages[] = $ticketMessage;
$ticketMessage->setTicket($this);
}

return $this;
}

public function removeTicketMessage(TicketMessageInterface $ticketMessage): self
{
if ($this->ticketMessages->contains($ticketMessage)) {
$this->ticketMessages->removeElement($ticketMessage);
// set the owning side to null (unless already changed)
if ($ticketMessage->getTicket() === $this) {
$ticketMessage->setTicket(null);
}
}

return $this;
}

public function getUser(): ?UserInterface
{
return $this->user;
}

public function setUser(?UserInterface $user): self
{
$this->user = $user;

return $this;
}
}

+ 2
- 1
Model/User/GroupUserModel.php View File

use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;


/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class GroupUserModel extends AbstractLightEntity
abstract class GroupUserModel extends AbstractLightEntity implements GroupUserInterface, EntityInterface
{ {


/** /**

+ 22
- 0
Repository/Ticket/TicketMessageRepository.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

use Lc\SovBundle\Model\Ticket\TicketMessageInterface;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method TicketMessageInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketMessageInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketMessageInterface[] findAll()
* @method TicketMessageInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketMessageRepository extends AbstractRepository
{
public function getInterfaceClass()
{
return TicketMessageInterface::class;
}


}

+ 22
- 0
Repository/Ticket/TicketRepository.php View File

<?php

namespace Lc\SovBundle\Repository\Ticket;

use Lc\SovBundle\Model\Ticket\TicketInterface;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method TicketInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketInterface[] findAll()
* @method TicketInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketRepository extends AbstractRepository
{
public function getInterfaceClass()
{
return TicketInterface::class;
}


}

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



sov_login: sov_login:
path: /login path: /login
controller: Lc\SovBundle\Controller\Security\SecurityController::login
controller: Lc\SovBundle\Controller\Security\SecurityAdminController::login


sov_logout: sov_logout:
path: /logout path: /logout
controller: Lc\SovBundle\Controller\Security\SecurityController::logout
controller: Lc\SovBundle\Controller\Security\SecurityAdminController::logout


sov_admin_account_profile: sov_admin_account_profile:
path: /admin/account/profile path: /admin/account/profile

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


menu: menu:
dashboard: Tableau de bord dashboard: Tableau de bord
page: Pages page: Pages
account: Mon compte account: Mon compte
account_profile: Informations personnelles account_profile: Informations personnelles
account_password: Mot de passe account_password: Mot de passe
tickets: Tickets


title: title:
dashboard: Tableau de bord dashboard: Tableau de bord
Page: Page:
label: Page label: Page
label_plurial: Pages label_plurial: Pages
Ticket:
fields:
visitorFirstName: Nom
visitorLastName: Prénom
visitorEmail: E-mail
subject: Sujet
type: Type
typeOptions:
general-question: Questions générales
technical-problem: Problème technique

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

Loading…
Cancel
Save