use Lc\ShopBundle\Context\TreeInterface; | use Lc\ShopBundle\Context\TreeInterface; | ||||
use Lc\ShopBundle\Form\Backend\Common\AbstractEditPositionType; | use Lc\ShopBundle\Form\Backend\Common\AbstractEditPositionType; | ||||
use Lc\ShopBundle\Services\Utils; | use Lc\ShopBundle\Services\Utils; | ||||
use Lc\ShopBundle\Services\UtilsManager; | |||||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | ||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | use Symfony\Bridge\Doctrine\Form\Type\EntityType; | ||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||||
protected $orderUtils; | protected $orderUtils; | ||||
protected $translator; | protected $translator; | ||||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, Utils $utils, | |||||
MerchantUtilsInterface $merchantUtils, MailjetTransport $mailjetTransport, OrderUtilsInterface $orderUtils, TranslatorInterface $translator) | |||||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, | |||||
MailjetTransport $mailjetTransport,UtilsManager $utilsManager, TranslatorInterface $translator) | |||||
{ | { | ||||
$this->security = $security; | $this->security = $security; | ||||
$this->userManager = $userManager; | $this->userManager = $userManager; | ||||
$this->em = $em; | $this->em = $em; | ||||
$this->utils = $utils; | |||||
$this->merchantUtils = $merchantUtils; | |||||
$this->mailjetTransport = $mailjetTransport; | $this->mailjetTransport = $mailjetTransport; | ||||
$this->orderUtils = $orderUtils; | |||||
$this->utils = $utilsManager->getUtils(); | |||||
$this->merchantUtils = $utilsManager->getMerchantUtils(); | |||||
$this->orderUtils = $utilsManager->getOrderUtils() ;; | |||||
$this->translator = $translator; | $this->translator = $translator; | ||||
} | } | ||||
/** | /** | ||||
* Réécriture de show action pr rediriger vers l'édition | * Réécriture de show action pr rediriger vers l'édition | ||||
*/ | */ | ||||
public function showAction() | |||||
/* public function showAction() | |||||
{ | { | ||||
$id = $this->request->query->get('id'); | $id = $this->request->query->get('id'); | ||||
$entity = $this->request->query->get('entity'); | $entity = $this->request->query->get('entity'); | ||||
'entity' => $entity, | 'entity' => $entity, | ||||
'id' => $id | 'id' => $id | ||||
]); | ]); | ||||
} | |||||
}*/ | |||||
/** | /** |
public function setReminderDoneAction(){ | public function setReminderDoneAction(){ | ||||
$id = $this->request->query->get('id'); | $id = $this->request->query->get('id'); | ||||
$done = $this->request->query->get('done'); | $done = $this->request->query->get('done'); | ||||
dump($done); | |||||
$easyadmin = $this->request->attributes->get('easyadmin'); | $easyadmin = $this->request->attributes->get('easyadmin'); | ||||
$reminder = $easyadmin['item']; | $reminder = $easyadmin['item']; | ||||
$reminder->setDone(true); | |||||
$reminder->setDone($done); | |||||
$this->em->persist($reminder); | $this->em->persist($reminder); | ||||
$this->em->flush(); | $this->em->flush(); | ||||
return $this->redirectToReferrer(); | return $this->redirectToReferrer(); |
<?php | |||||
namespace Lc\ShopBundle\Controller\Backend; | |||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use FOS\UserBundle\Model\UserManagerInterface; | |||||
use Lc\ShopBundle\Form\Backend\Ticket\TicketMessageType; | |||||
use Lc\ShopBundle\Form\Backend\Ticket\TicketStatusType; | |||||
use Lc\ShopBundle\Services\UtilsManager; | |||||
use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport; | |||||
use Symfony\Component\HttpFoundation\Response; | |||||
use Symfony\Component\Security\Core\Security; | |||||
use Symfony\Contracts\Translation\TranslatorInterface; | |||||
class TicketController extends AdminController | |||||
{ | |||||
protected $ticketUtils; | |||||
public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, MailjetTransport $mailjetTransport, UtilsManager $utilsManager, TranslatorInterface $translator) | |||||
{ | |||||
$this->ticketUtils = $utilsManager->getTicketUtils(); | |||||
parent::__construct($security, $userManager, $em, $mailjetTransport, $utilsManager, $translator); | |||||
} | |||||
/** | |||||
* 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() | |||||
]); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\ShopBundle\Form\Backend\Ticket; | |||||
use App\Entity\Product; | |||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use Lc\ShopBundle\Context\CreditHistoryInterface; | |||||
use Lc\ShopBundle\Context\OrderProductInterface; | |||||
use Lc\ShopBundle\Context\OrderReductionCartInterface; | |||||
use Lc\ShopBundle\Context\OrderShopInterface; | |||||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||||
use Lc\ShopBundle\Context\ProductInterface; | |||||
use Lc\ShopBundle\Context\ReductionCartInterface; | |||||
use Lc\ShopBundle\Context\ReductionCreditInterface; | |||||
use Lc\ShopBundle\Context\TicketMessageInterface; | |||||
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer; | |||||
use Lc\ShopBundle\Model\CreditHistory; | |||||
use Lc\ShopBundle\Services\Utils; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||||
use Symfony\Component\Form\Extension\Core\Type\DateType; | |||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType; | |||||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||||
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' | |||||
]); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\ShopBundle\Form\Backend\Ticket; | |||||
use App\Entity\Product; | |||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use Lc\ShopBundle\Context\CreditHistoryInterface; | |||||
use Lc\ShopBundle\Context\OrderProductInterface; | |||||
use Lc\ShopBundle\Context\OrderReductionCartInterface; | |||||
use Lc\ShopBundle\Context\OrderShopInterface; | |||||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||||
use Lc\ShopBundle\Context\ProductInterface; | |||||
use Lc\ShopBundle\Context\ReductionCartInterface; | |||||
use Lc\ShopBundle\Context\ReductionCreditInterface; | |||||
use Lc\ShopBundle\Context\TicketInterface; | |||||
use Lc\ShopBundle\Context\TicketMessageInterface; | |||||
use Lc\ShopBundle\Form\DataTransformer\ProductToIdTransformer; | |||||
use Lc\ShopBundle\Model\CreditHistory; | |||||
use Lc\ShopBundle\Model\Ticket; | |||||
use Lc\ShopBundle\Services\Utils; | |||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||||
use Symfony\Component\Form\AbstractType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ButtonType; | |||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||||
use Symfony\Component\Form\Extension\Core\Type\DateType; | |||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType; | |||||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||||
use Symfony\Component\Form\FormBuilderInterface; | |||||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||||
class TicketStatusType extends AbstractType | |||||
{ | |||||
protected $em; | |||||
public function __construct(EntityManagerInterface $em) | |||||
{ | |||||
$this->em = $em; | |||||
} | |||||
public function buildForm(FormBuilderInterface $builder, array $options) | |||||
{ | |||||
$builder->add('ticketStatus', ChoiceType::class, array( | |||||
'choices'=>array( | |||||
'field.Ticket.ticketStatusOptions.'.Ticket::TICKET_STATUS_OPEN => Ticket::TICKET_STATUS_OPEN, | |||||
'field.Ticket.ticketStatusOptions.'.Ticket::TICKET_STATUS_BEING_PROCESSED => Ticket::TICKET_STATUS_BEING_PROCESSED, | |||||
'field.Ticket.ticketStatusOptions.'.Ticket::TICKET_STATUS_CLOSED => Ticket::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' | |||||
]); | |||||
} | |||||
} |
*/ | */ | ||||
protected $updatedBy; | protected $updatedBy; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop") | |||||
*/ | |||||
protected $tickets; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->orderStatusHistories = new ArrayCollection(); | $this->orderStatusHistories = new ArrayCollection(); | ||||
} | } | ||||
/** | |||||
* @return Collection|Ticket[] | |||||
*/ | |||||
public function getTickets(): Collection | |||||
{ | |||||
return $this->tickets; | |||||
} | |||||
public function addTicket(Ticket $ticket): self | |||||
{ | |||||
if (!$this->tickets->contains($ticket)) { | |||||
$this->tickets[] = $ticket; | |||||
$ticket->setOrderShop($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeTicket(Ticket $ticket): self | |||||
{ | |||||
if ($this->tickets->contains($ticket)) { | |||||
$this->tickets->removeElement($ticket); | |||||
// set the owning side to null (unless already changed) | |||||
if ($ticket->getOrderShop() === $this) { | |||||
$ticket->setOrderShop(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
public function isValid() { | public function isValid() { | ||||
if($this->getOrderStatus() && in_array($this->getOrderStatus()->getAlias(), OrderStatus::$statusAliasAsValid) > 0) { | if($this->getOrderStatus() && in_array($this->getOrderStatus()->getAlias(), OrderStatus::$statusAliasAsValid) > 0) { | ||||
return true ; | return true ; |
*/ | */ | ||||
protected $type; | protected $type; | ||||
/** | |||||
* @ORM\Column(type="text", nullable=true) | |||||
*/ | |||||
protected $typeHelp; | |||||
/** | /** | ||||
* @ORM\Column(type="string", length=32) | * @ORM\Column(type="string", length=32) | ||||
*/ | */ | ||||
$this->ticketMessages = new ArrayCollection(); | $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 getMerchant(): ?MerchantInterface | public function getMerchant(): ?MerchantInterface | ||||
{ | { | ||||
return $this->merchant; | return $this->merchant; | ||||
return 'field.Ticket.typeOptions.'.$this->getType() ; | return 'field.Ticket.typeOptions.'.$this->getType() ; | ||||
} | } | ||||
public function getTypeHelp(): ?string | |||||
{ | |||||
return $this->typeHelp; | |||||
} | |||||
public function setTypeHelp(?string $typeHelp): self | |||||
{ | |||||
$this->typeHelp = $typeHelp; | |||||
return $this; | |||||
} | |||||
public function getTicketStatus(): ?string | public function getTicketStatus(): ?string | ||||
{ | { | ||||
return $this->ticketStatus; | return $this->ticketStatus; |
*/ | */ | ||||
protected $ticket; | protected $ticket; | ||||
/** | |||||
* @ORM\Column(type="boolean", nullable=true) | |||||
*/ | |||||
protected $answerByAdmin; | |||||
public function __toString() | |||||
{ | |||||
return $this->message; | |||||
} | |||||
public function getMessage(): ?string | public function getMessage(): ?string | ||||
{ | { | ||||
return $this->message; | return $this->message; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getAnswerByAdmin(): ?bool | |||||
{ | |||||
return $this->answerByAdmin; | |||||
} | |||||
public function setAnswerByAdmin(?bool $answerByAdmin): self | |||||
{ | |||||
$this->answerByAdmin = $answerByAdmin; | |||||
return $this; | |||||
} | |||||
} | } |
public function getSummary() | public function getSummary() | ||||
{ | { | ||||
return strtoupper($this->getLastname()).' '.$this->getFirstname(). ' ('.$this->getEmail().')'; | |||||
return '#'.$this->getId().' '.strtoupper($this->getLastname()).' '.$this->getFirstname(). ' ('.$this->getEmail().')'; | |||||
} | |||||
public function getName() | |||||
{ | |||||
return strtoupper($this->getLastname()).' '.$this->getFirstname(); | |||||
} | } | ||||
public function setEmail($email) | public function setEmail($email) |
.todo-list > li{position: relative;} | .todo-list > li{position: relative;} | ||||
.todo-list > li .text{margin-left: 30px;} | .todo-list > li .text{margin-left: 30px;} | ||||
.todo-list > li .tools {position: absolute; top: 4px; right: 15px; } | .todo-list > li .tools {position: absolute; top: 4px; right: 15px; } | ||||
#addTicketMessageForm{margin-top: 30px; border-top:2px dotted #eee; padding-top: 30px} |
jQuery(document).ready(function () { | |||||
$('.ticket-status').on("change", function(){ | |||||
$.ajax({ | |||||
url: $('#ticketStatusForm').prop('action'), | |||||
method: "POST", | |||||
data: $('#ticketStatusForm').serialize(), | |||||
dataType: "json", | |||||
success: function (response) { | |||||
setFlashMessages(response.flashMessages); | |||||
} | |||||
}); | |||||
}); | |||||
}); |
orderPayment: Ajouter un règlement | orderPayment: Ajouter un règlement | ||||
orderStatus: Changer de status | orderStatus: Changer de status | ||||
addRedeliveryOrderProduct: Ajouter une relivraison | addRedeliveryOrderProduct: Ajouter une relivraison | ||||
Ticket: | |||||
listMessages: Liste des messages | |||||
None: Aucune valeur | None: Aucune valeur | ||||
label.form.empty_value: Choisissez une option | label.form.empty_value: Choisissez une option | ||||
form.label.delete: Supprimer l'image | form.label.delete: Supprimer l'image | ||||
credit: | credit: | ||||
debited: Le compte prépayé a bien été débité | debited: Le compte prépayé a bien été débité | ||||
added: Le compte a bien été crédité | added: Le compte a bien été crédité | ||||
ticket: | |||||
statusChange: Le status a bien été modifié | |||||
addMessage: Le message a bien été envoyé | |||||
error: | error: | ||||
form: | form: | ||||
submitted: Une erreur est survenue à la soumission du formulaire | submitted: Une erreur est survenue à la soumission du formulaire | ||||
deliveryPointSale: Lieu de livraison | deliveryPointSale: Lieu de livraison | ||||
deliveryAvailabilty: Créneau de livraison | deliveryAvailabilty: Créneau de livraison | ||||
id: Id | id: Id | ||||
status: En ligne | |||||
status: Statut | |||||
statusOptions: | statusOptions: | ||||
offline: <span class="badge badge-danger">Hors ligne</span> | offline: <span class="badge badge-danger">Hors ligne</span> | ||||
online: <span class="badge badge-success">En ligne</span> | online: <span class="badge badge-success">En ligne</span> | ||||
priceWithTax: Prix de vente TTC | priceWithTax: Prix de vente TTC | ||||
username: Nom d'utilisateur | username: Nom d'utilisateur | ||||
user: Utilisateur | user: Utilisateur | ||||
visitor: Visiteur | |||||
email: E-mail | email: E-mail | ||||
plainPassword: Mot de passe | plainPassword: Mot de passe | ||||
roles: Rôle attribué | roles: Rôle attribué | ||||
isPublic: Publique | isPublic: Publique | ||||
isDepository: Dépôt | isDepository: Dépôt | ||||
productCategories: Catégories | productCategories: Catégories | ||||
category: Catégorie | |||||
parent: Parent | parent: Parent | ||||
date: Date | date: Date | ||||
content: Contenu | content: Contenu | ||||
usersHelp: Laissez vide si vous souhaitez ajouter ce pense-bête à tout les utilisateurs | usersHelp: Laissez vide si vous souhaitez ajouter ce pense-bête à tout les utilisateurs | ||||
Ticket: | Ticket: | ||||
type: Catégorie | type: Catégorie | ||||
message: Votre réponse | |||||
typeOptions: | typeOptions: | ||||
general-question: Questions générales | general-question: Questions générales | ||||
product-unavailable: Produit manquant | product-unavailable: Produit manquant | ||||
switchMerchant: Votre hub | switchMerchant: Votre hub | ||||
show: Voir | show: Voir | ||||
choiceFile: Parcourir | choiceFile: Parcourir | ||||
send: Envoyer | |||||
edit: Éditer | edit: Éditer | ||||
search: Rechercher | search: Rechercher | ||||
delete: Supprimer | delete: Supprimer |
<div class="info-box"> | |||||
<span class="info-box-icon {% block class %}bg-info{% endblock %}"> | |||||
<i class="fa fa-{% block icon %}bg-info{% endblock %}"></i></span> | |||||
<div class="info-box-content"> | |||||
<span class="info-box-text">{% block label %}{% endblock %}</span> | |||||
<strong>{% block value %}{% endblock %}</strong> | |||||
</div> | |||||
</div> |
<div class="card {% block style %}{% endblock %}"> | |||||
<div class="card-header"> | |||||
{% block header %} | |||||
<h3 class="card-title"> | |||||
{% block title %}{% endblock title %} | |||||
</h3> | |||||
{% block tools %}{% endblock tools %} | |||||
{% endblock header %} | |||||
</div> | |||||
<div class="card-body"> | |||||
{% block content %} | |||||
{% endblock %} | |||||
</div> | |||||
<div class="card-footer"> | |||||
{% block footer %} | |||||
{% endblock %} | |||||
</div> | |||||
</div> |
{% macro card_start(zone = "default", card ='primary', fullWidth = false ) %} | |||||
<div class="card card-{{ card }}"> | |||||
<div class="card-header"> | |||||
<h3 class="card-title"> | |||||
{% set label = "group."~zone %} | |||||
{{ label|trans({}, 'lcshop')|raw }} | |||||
</h3> | |||||
</div> | |||||
<div class="card-body {{ fullWidth == true ? 'p-0' : 'row' }}"> | |||||
{% endmacro card_start %} | |||||
{% macro card_overlay(attr) %} | |||||
</div> | |||||
<div v-if="{{ attr }}==true" class="overlay"> | |||||
<i class="fas fa-2x fa-sync-alt"></i> | |||||
</div> | |||||
{% endmacro card_overlay %} | |||||
{% macro card_end(noCol = false) %} | |||||
</div> | |||||
</div> | |||||
{% endmacro card_end %} | |||||
{% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %} | {% macro startCard(col, zone = "default", card ='primary', fullWidth = false ) %} | ||||
{% if col > 0 %} | {% if col > 0 %} | ||||
<div class="col-{{ col }}">{% endif %} | <div class="col-{{ col }}">{% endif %} | ||||
} | } | ||||
</script> | </script> | ||||
{% endmacro reductionCatalogFormValues %} | {% endmacro reductionCatalogFormValues %} | ||||
{% macro box_info(class="bg-info", icon, label, value) %} | |||||
{% embed '@LcShop/backend/default/block/embed_box.twig' %} | |||||
{% trans_default_domain 'lcshop' %} | |||||
{% block class %}{{ class }}{% endblock %} | |||||
{% block icon %}{{ icon }}{% endblock %} | |||||
{% block label %}{{ label }}{% endblock %} | |||||
{% block value %} | |||||
{{ value }} | |||||
{% endblock %} | |||||
{% endembed %} | |||||
{% endmacro box_info %} |
{% block aside_logo %} | {% block aside_logo %} | ||||
<a class="brand-link {{ easyadmin_config('site_name')|length > 14 ? 'logo-long' }}" | <a class="brand-link {{ easyadmin_config('site_name')|length > 14 ? 'logo-long' }}" | ||||
title="{{ easyadmin_config('site_name')|striptags }}" href="{{ path('easyadmin') }}"> | title="{{ easyadmin_config('site_name')|striptags }}" href="{{ path('easyadmin') }}"> | ||||
{{ easyadmin_config('site_name')|raw }} <span>Besançon</span> | |||||
{{ easyadmin_config('site_name')|raw }} | |||||
</a> | </a> | ||||
{% endblock aside_logo %} | {% endblock aside_logo %} | ||||
<!-- Sidebar --> | <!-- Sidebar --> |
item.type == 'link' ? item.url : | item.type == 'link' ? item.url : | ||||
item.type == 'route' ? path(item.route, item.params) : | item.type == 'route' ? path(item.route, item.params) : | ||||
item.type == 'entity' ? path('easyadmin', { entity: item.entity, action: 'list' }|merge(menu_params)|merge(item.params)) : | item.type == 'entity' ? path('easyadmin', { entity: item.entity, action: 'list' }|merge(menu_params)|merge(item.params)) : | ||||
item.type == 'empty' ? '#' : '' | |||||
%} | |||||
item.type == 'empty' ? '#' : '' %} | |||||
{# if the URL generated for the route belongs to the backend, regenerate | {# if the URL generated for the route belongs to the backend, regenerate | ||||
the URL to include the menu_params to display the selected menu item | the URL to include the menu_params to display the selected menu item | ||||
<a href="{{ path }}" | <a href="{{ path }}" | ||||
class="nav-link {{ item.css_class|default('') }} {{ active ? 'active' }}" | class="nav-link {{ item.css_class|default('') }} {{ active ? 'active' }}" | ||||
{% if item.target|default(false) %}target="{{ item.target }}"{% endif %} | {% if item.target|default(false) %}target="{{ item.target }}"{% endif %} | ||||
{% if item.rel|default(false) %}rel="{{ item.rel }}"{% endif %}> | |||||
{% if item.rel|default(false) %}rel="{{ item.rel }}"{% endif %}> | |||||
{% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %} | {% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %} | ||||
<p>{{ item.label|trans(domain = translation_domain) }} | <p>{{ item.label|trans(domain = translation_domain) }} | ||||
{% if item.children|default([]) is not empty %}<i class="right fas fa-angle-left"></i>{% endif %} | {% if item.children|default([]) is not empty %}<i class="right fas fa-angle-left"></i>{% endif %} | ||||
{% if item.params.count_menu_item is defined %}<span class="badge badge-info right">{{ count_menu_items(item.params.count_menu_item) }}</span>{% endif %} | |||||
</p> | </p> | ||||
</a> | </a> | ||||
{% endif %} | {% endif %} | ||||
{% set is_selected_submenu = is_selected_menu and app.request.query.get('submenuIndex')|default(-1) != -1 %} | {% set is_selected_submenu = is_selected_menu and app.request.query.get('submenuIndex')|default(-1) != -1 %} | ||||
{% if easyadmin_is_granted(item.permission) %} | {% if easyadmin_is_granted(item.permission) %} | ||||
<li class="{{ item.type == 'divider' ? 'nav-header' : 'nav-item'}} {{ item.children is not empty ? 'treeview' }} {{ is_selected_menu ? 'menu-open' }}"> | |||||
{{ helper.render_menu_item(item, _translation_domain, is_selected_menu) }} | |||||
<li class="{{ item.type == 'divider' ? 'nav-header' : 'nav-item' }} {{ item.children is not empty ? 'treeview' }} {{ is_selected_menu ? 'menu-open' }}"> | |||||
{{ helper.render_menu_item(item, _translation_domain, is_selected_menu) }} | |||||
{% if item.children|default([]) is not empty %} | |||||
<ul class="nav nav-treeview"> | |||||
{% for subitem in item.children %} | |||||
{% block menu_subitem %} | |||||
{% if easyadmin_is_granted(subitem.permission) %} | |||||
<li class="nav-item "> | |||||
{{ helper.render_menu_item(subitem, _translation_domain, is_selected_menu and app.request.query.get('submenuIndex')|default(-1) == subitem.submenu_index ? true) }} | |||||
</li> | |||||
{% endif %} | |||||
{% endblock menu_subitem %} | |||||
{% endfor %} | |||||
</ul> | |||||
{% endif %} | |||||
</li> | |||||
{% if item.children|default([]) is not empty %} | |||||
<ul class="nav nav-treeview"> | |||||
{% for subitem in item.children %} | |||||
{% block menu_subitem %} | |||||
{% if easyadmin_is_granted(subitem.permission) %} | |||||
<li class="nav-item "> | |||||
{{ helper.render_menu_item(subitem, _translation_domain, is_selected_menu and app.request.query.get('submenuIndex')|default(-1) == subitem.submenu_index ? true) }} | |||||
</li> | |||||
{% endif %} | |||||
{% endblock menu_subitem %} | |||||
{% endfor %} | |||||
</ul> | |||||
{% endif %} | |||||
</li> | |||||
{% endif %} | {% endif %} | ||||
{% endblock menu_item %} | {% endblock menu_item %} | ||||
{% endfor %} | {% endfor %} |
{% extends '@LcShop/backend/default/show.html.twig' %} | |||||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||||
{% trans_default_domain 'lcshop' %} | |||||
{% block main %} | |||||
<div class="row"> | |||||
<div class="col-4"> | |||||
{% embed '@LcShop/backend/default/block/embed_box.twig' %} | |||||
{% trans_default_domain 'lcshop' %} | |||||
{% block class %}bg-info{% endblock %} | |||||
{% block icon %}toggle-on{% endblock %} | |||||
{% block label %} {{ "field.default.status"|trans }}{% endblock %} | |||||
{% block value %} | |||||
{{ form_start(form_ticket_status,{'attr' : {'id' : 'ticketStatusForm'}}) }} | |||||
{% form_theme form_ticket_status '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||||
{% for field in form_ticket_status.ticketStatus %} | |||||
{{ form_widget(field, {'attr': {"class" : 'ticket-status'}}) }} | |||||
{% endfor %} | |||||
{{ form_end(form_ticket_status) }} | |||||
{% endblock %} | |||||
{% endembed %} | |||||
{% if entity.user %} | |||||
{{ macros.box_info('bg-info', 'user', "field.default.user"|trans, entity.user.summary) }} | |||||
{% else %} | |||||
{{ macros.box_info('bg-info', 'user-secret', "field.default.visitor"|trans, entity.user ? entity.user.summary : entity.visitorInfos) }} | |||||
{% endif %} | |||||
{{ macros.box_info('bg-warning', 'calendar', "field.default.date"|trans, entity.createdAt|date('d/m/Y')) }} | |||||
{% set trad = "field.Ticket.typeOptions."~entity.type %} | |||||
{{ macros.box_info('bg-success', 'archive', "field.default.category"|trans, trad|trans) }} | |||||
{% set trad = "field.Ticket.ticketStatusOptions."~entity.ticketStatus %} | |||||
{% if entity.orderShop is not null %} | |||||
{{ macros.box_info('bg-danger', 'credit-card', "field.default.order"|trans, entity.orderShop.reference) }} | |||||
{% endif %} | |||||
</div> | |||||
<div class="col-8"> | |||||
{{ macros.card_start('Ticket.listMessages') }} | |||||
<div class="col-12 direct-chat-primary"> | |||||
{% for message in entity.ticketMessages %} | |||||
<div class="direct-chat-msg {{ message.answerByAdmin ? 'right' }}"> | |||||
<div class="direct-chat-infos clearfix"> | |||||
<span class="direct-chat-name {{ message.answerByAdmin ? 'float-right' : 'float-left' }}"> | |||||
{{ entity.username }} | |||||
</span> | |||||
<span class="direct-chat-timestamp {{ message.answerByAdmin ? 'float-left' : 'float-right' }}"> | |||||
{{ message.createdAt|date('d/m/Y H:i') }} | |||||
</span> | |||||
</div> | |||||
{% if message.answerByAdmin %} | |||||
<img src="{{ asset('assets/img/backend/logo-pdl.png') }}" alt="" class="direct-chat-img"/> | |||||
{% 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"> | |||||
{{ message.message|nl2br }} | |||||
</div> | |||||
</div> | |||||
{% endfor %} | |||||
</div> | |||||
<hr /> | |||||
{{ form_start(form_add_ticket_message, {"attr" : {"class" : 'col-12', 'id' : 'addTicketMessageForm'}}) }} | |||||
{% form_theme form_add_ticket_message '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||||
<div class="row"> | |||||
<div class="col-12"> | |||||
{{ form_row(form_add_ticket_message.message) }} | |||||
</div> | |||||
</div> | |||||
{{ form_end(form_add_ticket_message) }} | |||||
{{ macros.card_end('ticketMessages') }} | |||||
<div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
{% endblock %} | |||||
{% block script_javascript %} | |||||
{{ parent() }} | |||||
<script src="{{ asset('bundles/lcshop/js/backend/script/ticket/init-edit.js') }}"></script> | |||||
{% endblock %} |
$ticketMessage->setStatus(1) ; | $ticketMessage->setStatus(1) ; | ||||
$ticketMessage->setTicket($ticket) ; | $ticketMessage->setTicket($ticket) ; | ||||
$ticketMessage->setMessage($params['message']) ; | $ticketMessage->setMessage($params['message']) ; | ||||
if(isset($params['answerByAdmin']) && $params['answerByAdmin']) { | |||||
$ticketMessage->setAnswerByAdmin($params['answerByAdmin']) ; | |||||
} | |||||
$this->em->persist($ticketMessage); | $this->em->persist($ticketMessage); | ||||
if(isset($params['closeTicket']) && $params['closeTicket']) { | if(isset($params['closeTicket']) && $params['closeTicket']) { | ||||
$ticket->setTicketStatus(Ticket::TICKET_STATUS_CLOSED) ; | $ticket->setTicketStatus(Ticket::TICKET_STATUS_CLOSED) ; | ||||
} | } | ||||
$ticket->setUpdatedAt(new \DateTime()) ; | $ticket->setUpdatedAt(new \DateTime()) ; | ||||
$this->em->persist($ticket); | $this->em->persist($ticket); | ||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Lc\ShopBundle\Context\ReductionCartInterface; | use Lc\ShopBundle\Context\ReductionCartInterface; | ||||
use Lc\ShopBundle\Context\TicketInterface; | |||||
use Symfony\Contracts\Translation\TranslatorInterface; | use Symfony\Contracts\Translation\TranslatorInterface; | ||||
use Twig\Extension\AbstractExtension; | use Twig\Extension\AbstractExtension; | ||||
use Twig\TwigFilter; | use Twig\TwigFilter; | ||||
{ | { | ||||
return array( | return array( | ||||
new TwigFunction('list_reduction_codes', [$this, 'getListReductionCodes']), | new TwigFunction('list_reduction_codes', [$this, 'getListReductionCodes']), | ||||
new TwigFunction('count_menu_items', [$this, 'countMenuItems']), | |||||
); | ); | ||||
} | } | ||||
} | } | ||||
; | ; | ||||
return $codesToReturn; | return $codesToReturn; | ||||
} | |||||
public function countMenuItems($entityName){ | |||||
switch($entityName){ | |||||
case 'ticket' : | |||||
$ticketRepo = $this->em->getRepository(TicketInterface::class); | |||||
return $ticketRepo->countByTicketStatus('open'); | |||||
} | |||||
} | } | ||||
} | } |