@@ -0,0 +1,7 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Context; | |||
interface ReminderInterface | |||
{ | |||
} |
@@ -11,6 +11,7 @@ use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface; | |||
use Lc\ShopBundle\Context\MerchantInterface; | |||
use Lc\ShopBundle\Context\MerchantUtilsInterface; | |||
use Lc\ShopBundle\Context\OrderUtilsInterface; | |||
use Lc\ShopBundle\Context\ReminderInterface; | |||
use Lc\ShopBundle\Context\SeoInterface; | |||
use Lc\ShopBundle\Context\StatusInterface; | |||
use Lc\ShopBundle\Context\TreeInterface; | |||
@@ -140,9 +141,18 @@ class AdminController extends EasyAdminController | |||
public function renderTemplate($actionName, $templatePath, array $parameters = []) | |||
{ | |||
$reminderRepo = $this->em->getRepository(ReminderInterface::class); | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$entityName = $easyadmin['entity']['name']; | |||
$id=null; | |||
if($easyadmin['item'])$id = $easyadmin['item']->getId(); | |||
$reminders = array('reminders' => $reminderRepo->findByEasyAdminConfig($actionName, $entityName, $id )); | |||
$parameters = array_merge( | |||
$parameters, | |||
$this->getTwigExtraParameters() | |||
$this->getTwigExtraParameters(), | |||
$reminders | |||
); | |||
return parent::renderTemplate($actionName, $templatePath, $parameters); |
@@ -190,6 +190,7 @@ class OrderController extends AdminController | |||
if($orderProduct->isRedelivery() === false) { | |||
//TODO s'assurer que la commande n'est pas négativce | |||
if ($this->orderUtils->isProductAvailable($orderProduct->getProduct(), $orderProduct->getQuantityOrder())) { | |||
if ($orderProduct->getQuantityOrder() <= 0) { | |||
$this->em->remove($orderProduct); |
@@ -0,0 +1,56 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Controller\Backend; | |||
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents; | |||
use Lc\ShopBundle\Form\Backend\Common\ReminderType; | |||
use Symfony\Component\HttpFoundation\Response; | |||
class ReminderController extends AdminController | |||
{ | |||
public function renderTemplate($actionName, $templatePath, array $parameters = []) | |||
{ | |||
if($this->request->isXmlHttpRequest() && ($actionName == 'new' || $actionName == 'edit')) { | |||
$response['flashMessages'] = $this->utils->getFlashMessages(); | |||
$response['data'] = $this->render('@LcShop/backend/default/modal/edit_reminder.twig', $parameters)->getContent(); | |||
return new Response(json_encode($response)); | |||
}else{ | |||
return parent::renderTemplate($actionName, $templatePath, $parameters); | |||
} | |||
} | |||
protected function redirectToReferrer(){ | |||
$action = $this->request->query->get('action'); | |||
if($action == 'new'){ | |||
$this->utils->addFlash('success', 'success.reminder.add'); | |||
}elseif($action == 'edit'){ | |||
$this->utils->addFlash('success', 'success.reminder.edit'); | |||
}elseif($action == ' setReminderDone'){ | |||
$this->utils->addFlash('success', 'success.reminder.done'); | |||
} | |||
if($this->request->isXmlHttpRequest()) { | |||
$response['flashMessages'] = $this->utils->getFlashMessages(); | |||
return new Response(json_encode($response)); | |||
} | |||
} | |||
public function setReminderDoneAction(){ | |||
$id = $this->request->query->get('id'); | |||
$done = $this->request->query->get('done'); | |||
dump($done); | |||
$easyadmin = $this->request->attributes->get('easyadmin'); | |||
$reminder = $easyadmin['item']; | |||
$reminder->setDone(true); | |||
$this->em->persist($reminder); | |||
$this->em->flush(); | |||
return $this->redirectToReferrer(); | |||
} | |||
} |
@@ -0,0 +1,71 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Form\Backend\Common; | |||
use Lc\ShopBundle\Context\ReminderInterface; | |||
use Lc\ShopBundle\Context\UserInterface; | |||
use Symfony\Bridge\Doctrine\Form\Type\EntityType; | |||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | |||
use Symfony\Component\Form\Extension\Core\Type\CollectionType; | |||
use Symfony\Component\Form\Extension\Core\Type\DateType; | |||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | |||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextareaType; | |||
use Symfony\Component\Form\Extension\Core\Type\TextType; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use Symfony\Component\Form\AbstractType; | |||
use Symfony\Component\Form\FormBuilderInterface; | |||
use Symfony\Component\OptionsResolver\OptionsResolver; | |||
use Lc\ShopBundle\Context\AddressInterface; | |||
use Symfony\Component\Security\Core\Security; | |||
use Symfony\Component\Validator\Constraints\NotBlank; | |||
class ReminderType extends AbstractType | |||
{ | |||
protected $em; | |||
public function __construct(EntityManagerInterface $entityManager) | |||
{ | |||
$this->em = $entityManager; | |||
} | |||
public function buildForm(FormBuilderInterface $builder, array $options) | |||
{ | |||
$userClass= $this->em->getClassMetadata(UserInterface::class); | |||
$userRepo= $this->em->getRepository(UserInterface::class); | |||
$builder | |||
->add('title', TextType::class, ['label' => 'Titre']) | |||
->add('description', TextareaType::class, array( | |||
'required' => false | |||
)) | |||
->add('entityName', HiddenType::class, array( | |||
'required' => false | |||
)) | |||
->add('entityId', HiddenType::class, array( | |||
'required' => false | |||
)) | |||
->add('entityAction', HiddenType::class, array( | |||
'required' => false | |||
)) | |||
->add('users', EntityType::class, array( | |||
'class'=> $userClass->name, | |||
'choices'=> $userRepo->findByRole('ROLE_ADMIN'), | |||
'required' => false, | |||
'multiple'=>true | |||
)) | |||
->add('dateReminder', DateType::class, array( | |||
'required'=>false, | |||
'widget'=>'single_text', | |||
)); | |||
} | |||
public function configureOptions(OptionsResolver $resolver) | |||
{ | |||
$resolver->setDefaults([ | |||
'label' => false, | |||
'data_class' => $this->em->getClassMetadata(ReminderInterface::class)->getName() | |||
]); | |||
} | |||
} |
@@ -0,0 +1,193 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Model; | |||
use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\Common\Collections\Collection; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\ShopBundle\Context\FilterMerchantInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class Reminder extends AbstractEntity implements FilterMerchantInterface | |||
{ | |||
public $relatedPage; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $merchant; | |||
/** | |||
* @ORM\Column(type="string", length=255) | |||
*/ | |||
protected $title; | |||
/** | |||
* @ORM\Column(type="text", nullable=true) | |||
*/ | |||
protected $description; | |||
/** | |||
* @ORM\Column(type="string", length=255, nullable=true) | |||
*/ | |||
protected $entityName; | |||
/** | |||
* @ORM\Column(type="integer", nullable=true) | |||
*/ | |||
protected $entityId; | |||
/** | |||
* @ORM\Column(type="string", length=255, nullable=true) | |||
*/ | |||
protected $entityAction; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface") | |||
*/ | |||
protected $users; | |||
/** | |||
* @ORM\Column(type="date", nullable=true) | |||
*/ | |||
protected $dateReminder; | |||
/** | |||
* @ORM\Column(type="boolean", nullable=false) | |||
*/ | |||
protected $done; | |||
public function __construct() | |||
{ | |||
$this->users = new ArrayCollection(); | |||
$this->done = false; | |||
} | |||
public function getMerchant(): ?Merchant | |||
{ | |||
return $this->merchant; | |||
} | |||
public function setMerchant(?Merchant $merchant): self | |||
{ | |||
$this->merchant = $merchant; | |||
return $this; | |||
} | |||
public function getTitle(): ?string | |||
{ | |||
return $this->title; | |||
} | |||
public function setTitle(string $title): self | |||
{ | |||
$this->title = $title; | |||
return $this; | |||
} | |||
public function getDescription(): ?string | |||
{ | |||
return $this->description; | |||
} | |||
public function setDescription(?string $description): self | |||
{ | |||
$this->description = $description; | |||
return $this; | |||
} | |||
public function getEntityName(): ?string | |||
{ | |||
return $this->entityName; | |||
} | |||
public function setEntityName(?string $entityName): self | |||
{ | |||
$this->entityName = $entityName; | |||
return $this; | |||
} | |||
public function getEntityAction(): ?string | |||
{ | |||
return $this->entityAction; | |||
} | |||
public function setEntityAction(?string $entityAction): self | |||
{ | |||
$this->entityAction = $entityAction; | |||
return $this; | |||
} | |||
public function getEntityId(): ?int | |||
{ | |||
return $this->entityId; | |||
} | |||
public function setEntityId(?int $entityId): self | |||
{ | |||
$this->entityId = $entityId; | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|User[] | |||
*/ | |||
public function getUsers(): Collection | |||
{ | |||
return $this->users; | |||
} | |||
public function addUser(User $user): self | |||
{ | |||
if (!$this->users->contains($user)) { | |||
$this->users[] = $user; | |||
} | |||
return $this; | |||
} | |||
public function removeUser(User $user): self | |||
{ | |||
if ($this->users->contains($user)) { | |||
$this->users->removeElement($user); | |||
} | |||
return $this; | |||
} | |||
public function getDateReminder(): ?\DateTimeInterface | |||
{ | |||
return $this->dateReminder; | |||
} | |||
public function setDateReminder(?\DateTimeInterface $dateReminder): self | |||
{ | |||
$this->dateReminder = $dateReminder; | |||
return $this; | |||
} | |||
public function getDone(): ?bool | |||
{ | |||
return $this->done; | |||
} | |||
public function setDone(?bool $done): self | |||
{ | |||
$this->done = $done; | |||
return $this; | |||
} | |||
} |
@@ -0,0 +1,51 @@ | |||
<?php | |||
namespace Lc\ShopBundle\Repository; | |||
use Lc\ShopBundle\Context\DefaultRepositoryInterface; | |||
use Lc\ShopBundle\Context\ProductInterface; | |||
use Lc\ShopBundle\Context\ReminderInterface; | |||
/** | |||
* @method ReminderInterface|null find($id, $lockMode = null, $lockVersion = null) | |||
* @method ReminderInterface|null findOneBy(array $criteria, array $orderBy = null) | |||
* @method ReminderInterface[] findAll() | |||
* @method ReminderInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||
*/ | |||
class ReminderRepository extends BaseRepository implements DefaultRepositoryInterface | |||
{ | |||
public function getInterfaceClass() | |||
{ | |||
return ReminderInterface::class; | |||
} | |||
public function findByUser($user){ | |||
$qb = $this->findByMerchantQuery() | |||
->leftJoin('e.users','u') | |||
->having('COUNT(u.id) = 0') | |||
->orHaving(':user MEMBER OF e.users') | |||
->andWhere('e.done = 0') | |||
->setParameter('user', $user) | |||
->orderBy('e.dateReminder', 'ASC') | |||
->groupBy('e.id'); | |||
return $qb->getQuery()->getResult(); | |||
} | |||
public function findByEasyAdminConfig($action, $entity, $id = null){ | |||
$qb = $this->findByMerchantQuery(); | |||
$qb->andWhere('e.done = 0'); | |||
$qb->andWhere('e.entityAction LIKE :action'); | |||
$qb->andWhere('e.entityName LIKE :entity'); | |||
$qb->setParameter('entity', $entity); | |||
$qb->setParameter('action', $action); | |||
if($id) { | |||
$qb->andWhere('e.entityId LIKE :id'); | |||
$qb->setParameter('id', $id); | |||
} | |||
$qb->orderBy('e.dateReminder', 'ASC'); | |||
return $qb->getQuery()->getResult(); | |||
} | |||
} |
@@ -24,7 +24,16 @@ class UserRepository extends BaseRepository implements DefaultRepositoryInterfac | |||
->where(':newsletter MEMBER OF e.newsletters') | |||
->setParameter('newsletter', $newsletter->getId()) | |||
->getQuery() | |||
->getResult() ; | |||
->getResult(); | |||
} | |||
public function findByRole($role) | |||
{ | |||
$qb = $this->createQueryBuilder('u') | |||
->where('u.roles LIKE :roles') | |||
->setParameter('roles', '%"' . $role . '"%'); | |||
return $qb->getQuery()->getResult(); | |||
} | |||
} |
@@ -2,6 +2,10 @@ | |||
body{font-size: 0.9rem;} | |||
[class*="sidebar-dark-"] .nav-sidebar > .nav-item.menu-open , [class*="sidebar-dark-"] .nav-sidebar > .nav-item:hover {background:rgba(255,255,255,.1); } | |||
.align-center{text-align: center;} | |||
.align-left{text-align: left;} | |||
.align-right{text-align: right;} | |||
.hidden{display: none;} | |||
.select2-container--default .select2-results__option[aria-disabled=true] { | |||
@@ -234,3 +238,10 @@ table th .select2-container--default .select2-selection--single{padding:0.3rem 0 | |||
top: 41px ; | |||
margin-left: 18px ; | |||
} | |||
.head-reminders{margin-top: 15px;} | |||
/* TABLEAU DE BORD */ | |||
.todo-list > li{position: relative;} | |||
.todo-list > li .text{margin-left: 30px;} | |||
.todo-list > li .tools {position: absolute; top: 4px; right: 15px; } |
@@ -3,7 +3,7 @@ jQuery(document).ready(function () { | |||
initAdminLtePlugin(); | |||
initButtonConfirm() | |||
initNotice(); | |||
initBtnEditReminder(); | |||
$('form').on('focus', 'input[type=number]', function (e) { | |||
$(this).on('wheel.disableScroll', function (e) { | |||
e.preventDefault() | |||
@@ -15,15 +15,15 @@ jQuery(document).ready(function () { | |||
}); | |||
function initNotice() { | |||
$('#lc-flash-messages .notice').each(function(i, notice){ | |||
generateNotice($(notice).find('.type').html(), $(notice).find('.message').html()); | |||
$('#lc-flash-messages .notice').each(function (i, notice) { | |||
generateNotice($(notice).find('.type').html(), $(notice).find('.message').html()); | |||
}); | |||
} | |||
function initButtonConfirm() { | |||
$('.btn-confirm-js').click(function() { | |||
return confirm('Êtes-vous sûr de vouloir réaliser cette action ?') ; | |||
}) ; | |||
$('.btn-confirm-js').click(function () { | |||
return confirm('Êtes-vous sûr de vouloir réaliser cette action ?'); | |||
}); | |||
} | |||
function initLcNoty() { | |||
@@ -70,14 +70,14 @@ function initAdminLtePlugin() { | |||
if ($('.select2, select.form-control').length) { | |||
$('form .form-widget>select.form-control, .select2').each(function (i, elm) { | |||
if(!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)) ; | |||
if (!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)); | |||
} | |||
}); | |||
$('form .form-inline>select.form-control').each(function (i, elm) { | |||
if(!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)) ; | |||
if (!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)); | |||
} | |||
}); | |||
} | |||
@@ -116,14 +116,14 @@ function initAdminLtePlugin() { | |||
} | |||
}; | |||
if($(picker).nextAll('.date-time-range-fields').find('.date-start').val()){ | |||
if ($(picker).nextAll('.date-time-range-fields').find('.date-start').val()) { | |||
options.startDate = new Date($(picker).nextAll('.date-time-range-fields').find('.date-start').val()); | |||
} | |||
if($(picker).nextAll('.date-time-range-fields').find('.date-end').val()){ | |||
if ($(picker).nextAll('.date-time-range-fields').find('.date-end').val()) { | |||
options.endDate = new Date($(picker).nextAll('.date-time-range-fields').find('.date-end').val()); | |||
} | |||
$(picker).daterangepicker(options); | |||
$(picker).on('apply.daterangepicker', function(ev, pickerElm) { | |||
$(picker).on('apply.daterangepicker', function (ev, pickerElm) { | |||
$(picker).nextAll('.date-time-range-fields').find('.date-start').val(pickerElm.startDate.format('YYYY-MM-DD HH:mm')); | |||
$(picker).nextAll('.date-time-range-fields').find('.date-end').val(pickerElm.endDate.format('YYYY-MM-DD HH:mm')); | |||
}); | |||
@@ -137,21 +137,21 @@ function moment() { | |||
} | |||
function checkForm(){ | |||
function checkForm() { | |||
$('form').addClass('form-sent'); | |||
//Panel vues js | |||
if($('form').find('.panel').length){ | |||
$('form').find('.panel').each(function(i, panel){ | |||
if($(panel).find(':invalid').length){ | |||
$('#nav-params').find('.nav-item:eq('+i+')').addClass('has-invalid'); | |||
}else{ | |||
$('#nav-params').find('.nav-item:eq('+i+')').removeClass('has-invalid'); | |||
if ($('form').find('.panel').length) { | |||
$('form').find('.panel').each(function (i, panel) { | |||
if ($(panel).find(':invalid').length) { | |||
$('#nav-params').find('.nav-item:eq(' + i + ')').addClass('has-invalid'); | |||
} else { | |||
$('#nav-params').find('.nav-item:eq(' + i + ')').removeClass('has-invalid'); | |||
} | |||
}) | |||
} | |||
} | |||
function setSelect2($select ) { | |||
function setSelect2($select) { | |||
if (typeof $select.data('select2-id') === 'undefined') { | |||
$select.data('init', 'set') | |||
@@ -189,16 +189,79 @@ function setSelect2($select ) { | |||
} | |||
} | |||
function checkForm(){ | |||
function checkForm() { | |||
$('form').addClass('form-sent'); | |||
//Panel vues js | |||
if($('form').find('.panel').length){ | |||
$('form').find('.panel').each(function(i, panel){ | |||
if($(panel).find(':invalid').length){ | |||
$('#nav-params').find('.nav-item:eq('+i+')').addClass('has-invalid'); | |||
}else{ | |||
$('#nav-params').find('.nav-item:eq('+i+')').removeClass('has-invalid'); | |||
if ($('form').find('.panel').length) { | |||
$('form').find('.panel').each(function (i, panel) { | |||
if ($(panel).find(':invalid').length) { | |||
$('#nav-params').find('.nav-item:eq(' + i + ')').addClass('has-invalid'); | |||
} else { | |||
$('#nav-params').find('.nav-item:eq(' + i + ')').removeClass('has-invalid'); | |||
} | |||
}) | |||
} | |||
} | |||
function initBtnEditReminder(){ | |||
$('.btn-edit-reminder, .btn-add-reminder ').on('click', function () { | |||
$btn = $(this); | |||
var url = $(this).data('url'); | |||
$('#modal-reminder').remove(); | |||
$.ajax({ | |||
url: url, | |||
method: "POST", | |||
dataType: "json", | |||
success: function (response) { | |||
$('body').append(response.data); | |||
if($btn.hasClass('btn-add-reminder')) { | |||
$('#reminder_entityName').val(getUrlParameter('entity')); | |||
$('#reminder_entityId').val(getUrlParameter('id')); | |||
$('#reminder_entityAction').val(getUrlParameter('action')); | |||
} | |||
$('#modal-reminder').modal('show'); | |||
initReminderModal(url); | |||
} | |||
}); | |||
}); | |||
$('.checkbox-valid-reminder').on('change', function () { | |||
var url = $(this).data('url'); | |||
if($(this).is(':checked')){ | |||
url = url+'&done=true' | |||
}else{ | |||
url = url+'&done=false' | |||
} | |||
$.ajax({ | |||
url: url, | |||
method: "POST", | |||
dataType: "json", | |||
success: function (response) { | |||
setFlashMessages(response.flashMessages); | |||
} | |||
}); | |||
}); | |||
} | |||
function initReminderModal(url) { | |||
setSelect2($('#reminderForm').find('select.form-control')); | |||
$('#modal-reminder .btn-save').on('click', function () { | |||
$('#modal-reminder').modal('hide'); | |||
$.ajax({ | |||
url: url, | |||
data: $('#reminderForm').serialize(), | |||
method: "POST", | |||
dataType: "json", | |||
success: function (response) { | |||
setFlashMessages(response.flashMessages); | |||
$('#modal-reminder').remove(); | |||
} | |||
}); | |||
}); | |||
} |
@@ -55,6 +55,21 @@ function formatNumberWithoutFixed(number){ | |||
} | |||
var getUrlParameter = function getUrlParameter(sParam) { | |||
var sPageURL = window.location.search.substring(1), | |||
sURLVariables = sPageURL.split('&'), | |||
sParameterName, | |||
i; | |||
for (i = 0; i < sURLVariables.length; i++) { | |||
sParameterName = sURLVariables[i].split('='); | |||
if (sParameterName[0] === sParam) { | |||
return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); | |||
} | |||
} | |||
}; | |||
/** | |||
* Formate un prix en l'arrondissant et en ajoutant le sigle de la monnaie | |||
* |
@@ -16,6 +16,8 @@ group: | |||
default: Édition | |||
Général: Général | |||
Adresse: Adresse | |||
Reminder: | |||
title: Pense bête | |||
ProductFamily: | |||
addresses: Livraisons & facturation | |||
main: Général | |||
@@ -36,7 +38,7 @@ group: | |||
export: Note à l'export | |||
ReductionCatalog: | |||
info: Informations principal | |||
conditions: Condictions d'application | |||
conditions: Conditions d'application | |||
ReductionCart: | |||
info: Informations | |||
conditions: Conditions d'applications | |||
@@ -52,6 +54,9 @@ label.form.empty_value: Choisissez une option | |||
form.label.delete: Supprimer l'image | |||
success: | |||
reminder: | |||
add: Le pense-bête a bien été ajouté | |||
edit: le pense-bête a bien été édité | |||
order: | |||
addPayment: Le paiement a bien été ajouté | |||
changeStatus: Le statut de la commande a été modifié | |||
@@ -327,7 +332,10 @@ field: | |||
typeOptions: | |||
credit: Crédit | |||
debit: Débit | |||
Reminder: | |||
dateReminder: Date limite | |||
users: Utilisateurs concernés | |||
usersHelp: Laissez vide si vous souhaitez ajouter ce pense-bête à tout les utilisateurs | |||
action: | |||
new: Créer %entity_label% | |||
@@ -358,6 +366,8 @@ action: | |||
credit: | |||
add: Ajouter du crédit | |||
reminder: | |||
add: Ajouter un pense-bête | |||
resetting: | |||
check_email: | | |||
Un e-mail vous a été envoyé. Il contient un lien sur lequel il vous faudra cliquer pour réinitialiser votre mot de passe. Si vous ne recevez pas d'email, vérifiez votre dossier spam ou essayez à nouveau. |
@@ -0,0 +1,21 @@ | |||
<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> |
@@ -0,0 +1,26 @@ | |||
<div class="modal fade show" id="{% block id %}{% endblock %}"> | |||
{% block form_start %}{% endblock %} | |||
<div class="modal-dialog"> | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<h4>{% block title %}{% endblock %}</h4> | |||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |||
<span aria-hidden="true">×</span> | |||
</button> | |||
</div> | |||
<div class="modal-body"> | |||
{% block content %} | |||
{% endblock %} | |||
</div> | |||
<div class="modal-footer justify-content-between"> | |||
{% block footer %} | |||
<button type="button" class="btn btn-default" | |||
data-dismiss="modal">{{ 'action.cancel'|trans }}</button> | |||
{% endblock %} | |||
</div> | |||
</div> | |||
<!-- /.modal-content --> | |||
</div> | |||
{% block form_end %}{% endblock %} | |||
</div> |
@@ -0,0 +1,35 @@ | |||
<ul class="todo-list ui-sortable" data-widget="todo-list"> | |||
{% for reminder in reminders %} | |||
<li class=""> | |||
<label class="big form-check-label"> | |||
<input type="checkbox" name="" value="1" | |||
class="form-check-input checkbox-valid-reminder" | |||
data-url="{{ path('easyadmin', { action: 'setReminderDone', entity: 'Reminder', id: reminder.id }) }}"> | |||
<span class="checkmark"></span> | |||
</label> | |||
<span class="text">{{ reminder.title }}</span> | |||
{% if reminder.dateReminder %} | |||
<small class="badge badge-info"> | |||
<i class="far fa-clock"></i> | |||
{{ reminder.dateReminder|date('d-m-Y') }} | |||
</small> | |||
{% endif %} | |||
<div class="tools"> | |||
<button type="button" class="btn-sm btn-success" data-toggle="modal" | |||
data-target="#modal-reminder-{{ reminder.id }}"> | |||
<i class="fas fa-eye"></i> | |||
</button> | |||
<button type="button" class="btn-sm btn-info btn-edit-reminder" | |||
data-url="{{ path('easyadmin', { action: 'edit', entity: 'Reminder', id: reminder.id }) }}"> | |||
<i class="fas fa-edit"></i> | |||
</button> | |||
</div> | |||
{% include '@LcShop/backend/default/modal/show_reminder.twig' %} | |||
</li> | |||
{% endfor %} | |||
</ul> | |||
@@ -1,9 +0,0 @@ | |||
<div class="actions-dropdown"> | |||
<button type="button" class="btn btn-secondary btn-sm dropdown-toggle"> | |||
<i class="fa fa-fw fa-ellipsis-h"></i> | |||
</button> | |||
<div class="dropdown-menu dropdown-menu-right"> | |||
{{ include('@EasyAdmin/default/includes/_actions.html.twig', { is_dropdown: true }) }} | |||
</div> | |||
</div> |
@@ -19,7 +19,8 @@ | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/datatables/responsive.bootstrap4.min.css') }}"> | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/select2/select2.min.css') }}"> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/bootstrap/bootstrap-switch.min.css') }}"> | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/bootstrap/bootstrap-switch.min.css') }}"> | |||
<!-- Theme style --> | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/toastr/toastr.min.css') }}"> | |||
@@ -105,7 +106,8 @@ | |||
<label for="switch-merchant"><i | |||
class="fa fa-store"></i> {{ 'action.switchMerchant'|trans() }} : | |||
</label> | |||
<select id="switch-merchant" data-allow-clear="false" data-width="auto" class="select2" name="id_merchant"> | |||
<select id="switch-merchant" data-allow-clear="false" data-width="auto" | |||
class="select2" name="id_merchant"> | |||
{% for merchant in merchants %} | |||
<option value="{{ merchant.id }}" | |||
{% if current_merchant and current_merchant.id == merchant.id %}selected="selected"{% endif %}> | |||
@@ -121,7 +123,9 @@ | |||
{% endif %} | |||
</li> | |||
<li> | |||
<a target="_blank" class="btn btn-outline-success" href="{{ merchantUtils.getMerchantUser.getMerchantConfig('url') }}">Afficher le site</a> | |||
<a target="_blank" class="btn btn-outline-success" | |||
href="{{ merchantUtils.getMerchantUser.getMerchantConfig('url') }}">Afficher le | |||
site</a> | |||
</li> | |||
</ul> | |||
{% endblock navbar %} | |||
@@ -161,25 +165,41 @@ | |||
{% set _has_content_help = _entity_config is defined and _entity_config[app.request.query.get('action')]['help']|default(false) %} | |||
<section class="content-header {{ _has_content_help ? 'has-content-help' }}"> | |||
<div class="container-fluid"> | |||
{% block content_header %} | |||
<div class="d-flex flex-row justify-content-between align-content-center w-100"> | |||
<div class="content-header-title"> | |||
<h1 class="title">{% block content_title %}{% endblock %}</h1> | |||
{% block content_header %} | |||
<div class="d-flex flex-row justify-content-between align-content-center w-100"> | |||
<div class="content-header-title"> | |||
<h1 class="title">{% block content_title %}{% endblock %}</h1> | |||
</div> | |||
{% block global_actions_wrapper %} | |||
<div class="global-actions"> | |||
{% block global_actions %}{% endblock %} | |||
{#{{ dump(_request_parameters) }}#} | |||
<button type="button" class="btn-sm btn-primary btn-add-reminder " | |||
data-url="{{ path('easyadmin', { action: 'new', entity: 'Reminder' }) }}"> | |||
+ Ajouter pense bête | |||
</button> | |||
</div> | |||
{% endblock %} | |||
</div> | |||
{% block global_actions_wrapper %} | |||
<div class="global-actions">{% block global_actions %}{% endblock %}</div> | |||
{% block content_reminders %} | |||
{% if reminders|length >0 %} | |||
<div class="head-reminders card card-outline card-danger"> | |||
{% include '@LcShop/backend/default/block/list_reminders.html.twig' %} | |||
</div> | |||
{% endif %} | |||
{% endblock %} | |||
</div> | |||
{% block content_help %} | |||
{% if _entity_config is defined and _entity_config[app.request.query.get('action')]['help']|default(false) %} | |||
<div class="content-header-help"> | |||
{{ _entity_config[app.request.query.get('action')]['help']|trans(domain = _entity_config.translation_domain)|raw }} | |||
</div> | |||
{% endif %} | |||
{% endblock content_help %} | |||
{% endblock content_header %} | |||
{% block content_help %} | |||
{% if _entity_config is defined and _entity_config[app.request.query.get('action')]['help']|default(false) %} | |||
<div class="content-header-help"> | |||
{{ _entity_config[app.request.query.get('action')]['help']|trans(domain = _entity_config.translation_domain)|raw }} | |||
</div> | |||
{% endif %} | |||
{% endblock content_help %} | |||
{% endblock content_header %} | |||
</div> | |||
</section> | |||
{% endblock content_header_wrapper %} |
@@ -0,0 +1,34 @@ | |||
{% embed "@LcShop/backend/default/block/embed_modal.twig" %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block id %}modal-reminder{% endblock %} | |||
{% block title %}{{ "action.reminder.add"|trans }}{% endblock %} | |||
{% block form_start %} | |||
{{ form_start(form, {'attr': { 'id' : 'reminderForm'}}) }} | |||
{% form_theme form '@LcShop/backend/form/custom_modal_bootstrap_4.html.twig' %} | |||
{% endblock %} | |||
{% block content %} | |||
<div class="col"> | |||
{{ form_row(form.title) }} | |||
{{ form_row(form.description) }} | |||
{{ form_row(form.dateReminder) }} | |||
{{ form_row(form.users) }} | |||
{{ form_row(form.entityName) }} | |||
{{ form_row(form.entityId) }} | |||
</div> | |||
{% endblock %} | |||
{% block footer %} | |||
{{ parent() }} | |||
<button type="button" class="btn btn-primary btn-save" >{{ 'action.add'|trans }}</button> | |||
{{ form_rest(form) }} | |||
{% endblock %} | |||
{% block form_end %} | |||
{{ form_end(form) }} | |||
{% endblock %} | |||
{% endembed %} |
@@ -0,0 +1,49 @@ | |||
{% embed "@LcShop/backend/default/block/embed_modal.twig" %} | |||
{% trans_default_domain 'lcshop' %} | |||
{% block id %}modal-reminder-{{ reminder.id }}{% endblock %} | |||
{% block title %}{{ "group.Reminder.title"|trans }} (#{{ reminder.id }}){% endblock %} | |||
{% block content %} | |||
<div class="row"> | |||
<div class="col-1 align-center"> | |||
<i class="fa fa-thumbtack"></i> | |||
</div> | |||
<div class="col-11"> | |||
<h5><strong>{{ reminder.title }}</strong></h5> | |||
</div> | |||
{% if reminder.dateReminder %} | |||
<div class="col-1 align-center"> | |||
<i class="fa fa-calendar"></i> | |||
</div> | |||
<div class="col-11"> | |||
<p>{{ reminder.dateReminder|date('d/m/Y') }}</p> | |||
</div> | |||
{% endif %} | |||
{% if reminder.description %} | |||
<div class="col-1 align-center"> | |||
<i class="fa fa-align-left"></i> | |||
</div> | |||
<div class="col-11"> | |||
<p>{{ reminder.description|nl2br }}</p> | |||
</div> | |||
{% endif %} | |||
{% if reminder.relatedPage %} | |||
<div class="col-1 align-center"> | |||
<i class="fa fa-link"></i> | |||
</div> | |||
<div class="col-11"> | |||
<a href="{{ path('easyadmin', {"action" : reminder.entityAction, 'entity' : reminder.entityName, 'id': reminder.entityId }) }}">{{ reminder.relatedPage }}</a> | |||
</div> | |||
{% endif %} | |||
</div> | |||
{% endblock %} | |||
{% block footer %} | |||
{% endblock %} | |||
{% endembed %} |
@@ -0,0 +1,6 @@ | |||
{% use '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
{% block easyadmin_rest %} | |||
{{- form_rest(form) -}} | |||
{% endblock easyadmin_rest %} |
@@ -1,29 +1,27 @@ | |||
{% trans_default_domain 'lcshop' %} | |||
{% embed "@LcShop/backend/default/block/embed_modal.twig" %} | |||
<div class="modal fade show" id="modal-add-reduction-credit"> | |||
{{ form_start(form_add_order_reduction_credit, {'attr': {'class': 'row', 'id' : 'addOrderReductionCreditForm'}}) }} | |||
{% form_theme form_add_order_reduction_credit '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<div class="modal-dialog"> | |||
{% block id %}modal-reduction-credit{% endblock %} | |||
{% block title %}{{ "action.order.addReductionCredit"|trans }}{% endblock %} | |||
<div class="modal-content"> | |||
<div class="modal-header"> | |||
<h4>{{ "action.order.addReductionCredit"|trans }}</h4> | |||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |||
<span aria-hidden="true">×</span> | |||
</button> | |||
</div> | |||
<div class="modal-body"> | |||
<div class="col"> | |||
{{ form_row(form_add_order_reduction_credit.reductionCredit) }} | |||
</div> | |||
{% block form_start %} | |||
{{ form_start(form_add_order_reduction_credit, {'attr': {'class': 'row', 'id' : 'addOrderReductionCreditForm'}}) }} | |||
{% form_theme form_add_order_reduction_credit '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
{% endblock %} | |||
</div> | |||
<div class="modal-footer justify-content-between"> | |||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |||
{{ form_row(form_add_order_reduction_credit.add, {"attr": {'class' : 'btn btn-primary', '@click': 'addOrderReductionCredit'}}) }} | |||
</div> | |||
{% block content %} | |||
<div class="col"> | |||
{{ form_row(form_add_order_reduction_credit.reductionCredit) }} | |||
</div> | |||
<!-- /.modal-content --> | |||
</div> | |||
{{ form_end(form_add_order_reduction_credit) }} | |||
</div> | |||
{% endblock %} | |||
{% block footer %} | |||
{{ parent() }} | |||
{{ form_row(form_add_order_reduction_credit.add, {"attr": {'class' : 'btn btn-primary', '@click': 'addOrderReductionCredit'}}) }} | |||
{% endblock %} | |||
{% block form_end %} | |||
{{ form_end(form_add_order_reduction_credit) }} | |||
{% endblock %} | |||
{% endembed %} |
@@ -4,9 +4,11 @@ namespace Lc\ShopBundle\Services; | |||
use Cocur\Slugify\Slugify; | |||
use Doctrine\ORM\EntityManagerInterface; | |||
use EasyCorp\Bundle\EasyAdminBundle\Configuration\ConfigManager; | |||
use Lc\ShopBundle\Context\MerchantUtilsInterface; | |||
use Lc\ShopBundle\Context\PageInterface; | |||
use Lc\ShopBundle\Context\PointSaleInterface; | |||
use Lc\ShopBundle\Context\ReminderInterface; | |||
use Lc\ShopBundle\Context\TaxRateInterface; | |||
use Lc\ShopBundle\Context\UnitInterface; | |||
use Lc\ShopBundle\Context\UserInterface; | |||
@@ -23,6 +25,7 @@ class Utils | |||
protected $merchantUtils ; | |||
protected $session; | |||
protected $translator; | |||
protected $configManager; | |||
const MEAN_PAYMENT_CREDIT_CARD = 'cb' ; | |||
const MEAN_PAYMENT_CHEQUE = 'cheque' ; | |||
@@ -30,12 +33,13 @@ class Utils | |||
const MEAN_PAYMENT_TRANSFER = 'transfer' ; | |||
const MEAN_PAYMENT_CASH = 'cash' ; | |||
public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, SessionInterface $session, TranslatorInterface $translator) | |||
public function __construct(EntityManagerInterface $em, ParameterBagInterface $parameterBag, SessionInterface $session, TranslatorInterface $translator, ConfigManager $configManager) | |||
{ | |||
$this->em = $em ; | |||
$this->parameterBag = $parameterBag ; | |||
$this->session = $session; | |||
$this->translator = $translator; | |||
$this->configManager = $configManager; | |||
} | |||
@@ -329,4 +333,35 @@ class Utils | |||
public function getFlashMessages(){ | |||
return $this->session->getFlashBag()->all(); | |||
} | |||
public function getRemindersByUser($user) | |||
{ | |||
$reminderRepo = $this->em->getRepository(ReminderInterface::class); | |||
$reminders = $reminderRepo->findByUser($user); | |||
$entitiesRepo = array(); | |||
$entitiesConfig = array(); | |||
if(count($reminders)>0 ) { | |||
foreach ($reminders as $reminder) { | |||
if($reminder->getEntityName()) { | |||
if (!isset($entitiesConfig[$reminder->getEntityName()])) { | |||
$entitiesConfig[$reminder->getEntityName()] = $this->configManager->getEntityConfig($reminder->getEntityName()); | |||
} | |||
if ($reminder->getEntityAction() == 'edit' || $reminder->getEntityAction() == 'show') { | |||
if (!isset($entitiesRepo[$reminder->getEntityName()])) { | |||
$entitiesRepo[$reminder->getEntityName()] = $this->em->getRepository($entitiesConfig[$reminder->getEntityName()]['class']); | |||
} | |||
$reminder->relatedPage = $entitiesRepo[$reminder->getEntityName()]->find($reminder->getEntityId())->__toString(); | |||
} else { | |||
$reminder->relatedPage = 'Liste de ' . $entitiesConfig[$reminder->getEntityName()]['label']; | |||
} | |||
} | |||
} | |||
} | |||
return $reminders; | |||
} | |||
} |
@@ -75,5 +75,4 @@ class BackendTwigExtension extends AbstractExtension | |||
} | |||
} |