Sfoglia il codice sorgente

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Charly 3 anni fa
parent
commit
093ae8bff7
14 ha cambiato i file con 614 aggiunte e 33 eliminazioni
  1. +208
    -7
      Controller/AdminControllerTrait.php
  2. +1
    -0
      Controller/Dashboard/DashboardAdminAdminController.php
  3. +56
    -0
      EventSubscriber/Address/DuplicateAddressEventSubscriber.php
  4. +64
    -0
      EventSubscriber/Product/DuplicateProductEventSubscriber.php
  5. +72
    -0
      Form/Merchant/DuplicateToOtherMerchantFormType.php
  6. +73
    -0
      Form/Section/DuplicateToOtherSectionFormType.php
  7. +6
    -0
      Resources/assets/app/admin/duplicate/app.duplicate.js
  8. +36
    -0
      Resources/assets/app/admin/duplicate/duplicate.js
  9. +37
    -0
      Resources/assets/app/admin/duplicate/duplicate.scss
  10. +6
    -0
      Resources/translations/admin.fr.yaml
  11. +14
    -0
      Resources/views/admin/merchant/modal/duplicate_entity_to_other_merchant.html.twig
  12. +14
    -0
      Resources/views/admin/merchant/modal/duplicate_entity_to_other_section.html.twig
  13. +26
    -0
      Resources/views/admin/merchant/modal/switch_merchant.html.twig
  14. +1
    -26
      Resources/views/adminlte/layout.html.twig

+ 208
- 7
Controller/AdminControllerTrait.php Vedi File

@@ -2,19 +2,33 @@

namespace Lc\CaracoleBundle\Controller;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Exception\ForbiddenActionException;
use EasyCorp\Bundle\EasyAdminBundle\Exception\InsufficientEntityPermissionException;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use EasyCorp\Bundle\EasyAdminBundle\Security\Permission;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMultipleMerchantsInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Factory\User\UserMerchantFactory;
use Lc\CaracoleBundle\Form\Merchant\DuplicateToOtherMerchantFormType;
use Lc\CaracoleBundle\Form\Section\DuplicateToOtherSectionFormType;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use Lc\SovBundle\Component\EntityComponent;
use Lc\SovBundle\Factory\User\UserFactory;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\HttpFoundation\Response;


trait AdminControllerTrait
@@ -22,12 +36,15 @@ trait AdminControllerTrait

public static function getSubscribedServices()
{
return array_merge(parent::getSubscribedServices(), [
'merchant_resolver' => MerchantResolver::class,
'section_resolver' => SectionResolver::class,
'user_factory' => UserFactory::class,
'user_merchant_factory' => UserMerchantFactory::class,
]);
return array_merge(
parent::getSubscribedServices(),
[
'merchant_resolver' => MerchantResolver::class,
'section_resolver' => SectionResolver::class,
'user_factory' => UserFactory::class,
'user_merchant_factory' => UserMerchantFactory::class,
]
);
}

public function configureResponseParameters(KeyValueStore $responseParameters): KeyValueStore
@@ -35,7 +52,7 @@ trait AdminControllerTrait
$responseParameters = parent::configureResponseParameters($responseParameters);

// affichage du filtre sur section
if($this->isInstanceOf(FilterSectionInterface::class)) {
if ($this->isInstanceOf(FilterSectionInterface::class)) {
$responseParameters->set('display_switch_section', true);
}

@@ -74,6 +91,190 @@ trait AdminControllerTrait
}


public function duplicateToOtherMerchant(
AdminContext $context,
EntityComponent $entityComponent,
TranslatorAdmin $translatorAdmin,
EntityManagerInterface $em
) {
if (!$this->isGranted(
Permission::EA_EXECUTE_ACTION,
['action' => "duplicate", 'entity' => $context->getEntity()]
)) {
throw new ForbiddenActionException($context);
}

if (!$context->getEntity()->isAccessible()) {
throw new InsufficientEntityPermissionException($context);
}

if (!$this->isInstanceOf(FilterMerchantInterface::class)) {
throw new \ErrorException('L\entité n\'est pas lié à un merchant.');
}
$duplicateOtherMerchantForm = $this->createForm(
DuplicateToOtherMerchantFormType::class,
null,
array(
'entityClass' => $context->getEntity()->getFqcn(),
'entityId' => $context->getEntity()->getInstance()->getId(),
'action' => $context->getRequest()->getUri(),
'attr' => ['id'=> 'duplicate-other-merchant-form'],

)
);

$duplicateOtherMerchantForm->handleRequest($context->getRequest());

if ($duplicateOtherMerchantForm->isSubmitted() && $duplicateOtherMerchantForm->isValid()) {
$newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance());
$em->create($newEntity);
$merchant = $duplicateOtherMerchantForm->get('merchants')->getData();
$newEntity->setMerchant($merchant);
$em->update($newEntity);
$em->flush();

$url = $this->get(AdminUrlGenerator::class)
->setAction(Action::EDIT)
->setEntityId($newEntity->getId())
->generateUrl();
$this->addFlash(
'success',
$translatorAdmin->transFlashMessage(
'duplicateToOtherMerchant',
['%merchant%' => $merchant->getTitle()]
),
array()
);

//TODO switch merchant route
return $this->redirect($url);
}


if ($context->getRequest()->isXmlHttpRequest()) {
$response['data'] = $this->renderView(
'@LcCaracole/admin/merchant/modal/duplicate_entity_to_other_merchant.html.twig',
array(
'form_duplicate_entity_to_other_merchant' => $duplicateOtherMerchantForm->createView(),
)
);

return new Response(json_encode($response));
}else{
throw new \ErrorException('La requête doit être effectué en ajax');
}
}

public function duplicateToOtherSection(
AdminContext $context,
EntityComponent $entityComponent,
TranslatorAdmin $translatorAdmin,
EntityManagerInterface $em
) {
if (!$this->isGranted(
Permission::EA_EXECUTE_ACTION,
['action' => "duplicate", 'entity' => $context->getEntity()]
)) {
throw new ForbiddenActionException($context);
}

if (!$context->getEntity()->isAccessible()) {
throw new InsufficientEntityPermissionException($context);
}

if (!$this->isInstanceOf(FilterSectionInterface::class)) {
throw new \ErrorException('L\entité n\'est pas lié à un merchant.');
}
$duplicateOtherSectionForm = $this->createForm(
DuplicateToOtherSectionFormType::class,
null,
array(
'entityClass' => $context->getEntity()->getFqcn(),
'entityId' => $context->getEntity()->getInstance()->getId(),
'action' => $context->getRequest()->getUri(),
'attr' => ['id'=> 'duplicate-other-section-form'],
)
);

$duplicateOtherSectionForm->handleRequest($context->getRequest());

if ($duplicateOtherSectionForm->isSubmitted() && $duplicateOtherSectionForm->isValid()) {
$newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance());
$em->create($newEntity);
$section = $duplicateOtherSectionForm->get('sections')->getData();
$newEntity->setSection($section);
$em->update($newEntity);
$em->flush();

$url = $this->get(AdminUrlGenerator::class)
->setAction(Action::EDIT)
->setEntityId($newEntity->getId())
->generateUrl();
$this->addFlash(
'success',
$translatorAdmin->transFlashMessage(
'duplicateToOtherSection',
['%section%' => $section->getTitle()]
),
array()
);

//TODO switch merchant route
return $this->redirect($url);
}


if ($context->getRequest()->isXmlHttpRequest()) {
$response['data'] = $this->renderView(
'@LcCaracole/admin/merchant/modal/duplicate_entity_to_other_section.html.twig',
array(
'form_duplicate_entity_to_other_section' => $duplicateOtherSectionForm->createView(),
)
);

return new Response(json_encode($response));
}else{
throw new \ErrorException('La requête doit être effectué en ajax');
}
}


public function buildIndexActions(Actions $actions): void
{
parent::buildIndexActions($actions);
if ($this->isInstanceOf(FilterMerchantInterface::class)) {
$actions->add(Crud::PAGE_INDEX, $this->getDuplicateToOhterMerchantAction());
}

if ($this->isInstanceOf(FilterSectionInterface::class)) {
$actions->add(Crud::PAGE_INDEX, $this->getDuplicateToOhterSectionAction());
}
}

public function getDuplicateToOhterMerchantAction(): Action
{
$duplicateAction = Action::new(
'duplicateToOtherMerchant',
$this->get('translator_admin')->transAction('duplicateToOtherMerchant'),
'fa fa-fw fa-copy'
)
->linkToCrudAction('duplicateToOtherMerchant')
->setCssClass('text-info in-dropdown duplicate-to-other-merchant duplicate-modal-action');

return $duplicateAction;
}

public function getDuplicateToOhterSectionAction(): Action
{
$duplicateAction = Action::new(
'duplicateToOtherSection',
$this->get('translator_admin')->transAction('duplicateToOtherSection'),
'fa fa-fw fa-copy'
)
->linkToCrudAction('duplicateToOtherSection')
->setCssClass('text-info in-dropdown duplicate-to-other-section duplicate-modal-action');

return $duplicateAction;
}
}


+ 1
- 0
Controller/Dashboard/DashboardAdminAdminController.php Vedi File

@@ -27,6 +27,7 @@ class DashboardAdminAdminController extends SovDashboardController

$assets->addWebpackEncoreEntry('carac-common');
$assets->addWebpackEncoreEntry('carac-switch-merchant');
$assets->addWebpackEncoreEntry('carac-duplicate');

return $assets;
}

+ 56
- 0
EventSubscriber/Address/DuplicateAddressEventSubscriber.php Vedi File

@@ -0,0 +1,56 @@
<?php

namespace Lc\CaracoleBundle\EventSubscriber\Address;

use Doctrine\ORM\EntityManagerInterface;

use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\SluggableInterface;
use Lc\SovBundle\Doctrine\Extension\SortableInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\TreeInterface;
use Lc\SovBundle\Event\EntityComponentEvent;
use Lc\SovBundle\Event\EntityManager\EntityManagerEvent;
use Lc\SovBundle\Repository\AbstractRepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DuplicateAddressEventSubscriber implements EventSubscriberInterface
{
protected $em;
protected $adminUrlGenerator;

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

public static function getSubscribedEvents()
{
return [
EntityComponentEvent::DUPLICATE_EVENT => ['duplicateAddressOnDuplicateEvent'],
];
}

public function duplicateAddressOnDuplicateEvent(EntityComponentEvent $event)
{
$entity = $event->getEntity();

$classMetadata = $this->em->getClassMetadata(get_class($entity));

foreach ($classMetadata->getAssociationMappings() as $associationMapping){
if(in_array(AddressInterface::class, class_implements($associationMapping['targetEntity']))){
$methodGet = 'get'.ucfirst($associationMapping['fieldName']);
$methodSet = 'set'.ucfirst($associationMapping['fieldName']);
if(method_exists($entity, $methodGet) && method_exists($entity, $methodSet)){
$newAddress = clone $entity->$methodGet();
$entity->$methodSet($newAddress);
$this->em->persist($newAddress);
}
}

}
}


}

+ 64
- 0
EventSubscriber/Product/DuplicateProductEventSubscriber.php Vedi File

@@ -0,0 +1,64 @@
<?php

namespace Lc\CaracoleBundle\EventSubscriber\Product;

use Doctrine\ORM\EntityManagerInterface;

use Lc\CaracoleBundle\Model\Address\AddressInterface;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\SluggableInterface;
use Lc\SovBundle\Doctrine\Extension\SortableInterface;
use Lc\SovBundle\Doctrine\Extension\StatusInterface;
use Lc\SovBundle\Doctrine\Extension\TreeInterface;
use Lc\SovBundle\Event\EntityComponentEvent;
use Lc\SovBundle\Event\EntityManager\EntityManagerEvent;
use Lc\SovBundle\Repository\AbstractRepositoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class DuplicateProductEventSubscriber implements EventSubscriberInterface
{
protected $em;
protected $adminUrlGenerator;

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

public static function getSubscribedEvents()
{
return [
EntityComponentEvent::DUPLICATE_EVENT => ['duplicateProductOnDuplicateEvent'],
];
}

public function duplicateProductOnDuplicateEvent(EntityComponentEvent $event)
{
$entity = $event->getEntity();

$classMetadata = $this->em->getClassMetadata(get_class($entity));

/*foreach ($classMetadata->getAssociationMappings() as $associationMapping){
if(in_array(ProductInterface::class, class_implements($associationMapping['targetEntity']))){

/*foreach ($productFamily->getProducts() as $i => $product) {
$newProduct = clone $product;
$newProduct->setProductFamily($productFamily);
$this->em->persist($newProduct);
$productFamily->addProduct($newProduct);
}

$methodGet = 'get'.ucfirst($associationMapping['fieldName']);
$methodSet = 'set'.ucfirst($associationMapping['fieldName']);
if(method_exists($entity, $methodGet) && method_exists($entity, $methodSet)){
$newAddress = clone $entity->$methodGet();
$entity->$methodSet($newAddress);
$this->em->persist($newAddress);
}
}

}*/
}

}

+ 72
- 0
Form/Merchant/DuplicateToOtherMerchantFormType.php Vedi File

@@ -0,0 +1,72 @@
<?php

namespace Lc\CaracoleBundle\Form\Merchant;

use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DuplicateToOtherMerchantFormType extends AbstractType
{
protected $em;
protected $translatorAdmin;
protected $merchantResolver;

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

public function buildForm(FormBuilderInterface $builder, array $options)
{
//TODO tester si l'utilisateur à les droits sur ce merchant
$builder->add(
'merchants',
EntityType::class,
[
'class' => $this->em->getEntityName(MerchantInterface::class),
'choice_label' => 'title'
]
);

$builder->add(
'EntityId',
HiddenType::class,
[
'data' => $options['entityId']
]
);

$builder->add(
'EntityClass',
HiddenType::class,
[
'data' => $options['entityClass']
]
);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'entityId' => null,
'entityClass' => null,
]
);
}

}

+ 73
- 0
Form/Section/DuplicateToOtherSectionFormType.php Vedi File

@@ -0,0 +1,73 @@
<?php

namespace Lc\CaracoleBundle\Form\Section;

use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DuplicateToOtherSectionFormType extends AbstractType
{
protected $em;
protected $translatorAdmin;
protected $merchantResolver;

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

public function buildForm(FormBuilderInterface $builder, array $options)
{
//TODO tester si l'utilisateur à les droits sur ce merchant
$builder->add(
'sections',
EntityType::class,
[
'class' => $this->em->getEntityName(SectionInterface::class),
'choice_label' => 'title'
]
);

$builder->add(
'EntityId',
HiddenType::class,
[
'data' => $options['entityId']
]
);

$builder->add(
'EntityClass',
HiddenType::class,
[
'data' => $options['entityClass']
]
);
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'entityId' => null,
'entityClass' => null,
]
);
}

}

+ 6
- 0
Resources/assets/app/admin/duplicate/app.duplicate.js Vedi File

@@ -0,0 +1,6 @@

import './duplicate.js' ;
import './duplicate.scss' ;




+ 36
- 0
Resources/assets/app/admin/duplicate/duplicate.js Vedi File

@@ -0,0 +1,36 @@
$(document).ready(function () {
initDuplicateOtherToOtherMerchant();
});

function initDuplicateOtherToOtherMerchant() {
$('.duplicate-modal-action').on('click', function (e) {
$btn = $(this);
e.preventDefault();
$.ajax({
url: $btn.prop('href'),
method: "POST",
dataType: "json",
success: function (response) {
$('body').append(response.data);
SovTools.log($('#carac-modal-duplicate'));
$('#carac-modal-duplicate').modal('show');
//initDuplicateModal();

}
});
});
}

function initDuplicateModal(){
$('#carac-button-visit-merchant').on('click', function (e){
SovTools.log($('form[name="duplicate_to_other_merchant_form"]'));
$.ajax({
url: $btn.prop('href'),
data: $('form[name="duplicate_to_other_merchant_form"]').serialize(),
method: "POST",
dataType: "json",
success: function (response) {
}
});
});
}

+ 37
- 0
Resources/assets/app/admin/duplicate/duplicate.scss Vedi File

@@ -0,0 +1,37 @@

// switch dans la navbar
.nav-switch-merchant {
width: 220px ;
text-align: right ;

.fa {
position: relative;
top: 3px;
right: 7px;
}

form.switch-merchant {
display: inline-block ;
width: 180px ;
position: relative ;
top: 7px ;
text-align: left ;

label, .select2-selection__clear {
display: none ;
}

button {
display: none ;
}
}
}

// modal
#carac-modal-switch-merchant {
form.switch-merchant {
.form-group:first-child {
display: none ;
}
}
}

+ 6
- 0
Resources/translations/admin.fr.yaml Vedi File

@@ -17,9 +17,13 @@ menu:

flash_message:
settings_saved: Paramètres mis à jour
duplicateToOtherMerchant: "Le document a bien été dupliqué sur le marchand : %merchant%"
duplicateToOtherSection: "Le document a bien été dupliqué sur la section : %section%"

action:
favorite: Définir comme favoris
duplicateToOtherMerchant: Dupliquer sur un autre marchand
duplicateToOtherSection: Dupliquer sur une autre section

setting_definition:
merchant:
@@ -49,6 +53,8 @@ entity:
address: Adresse
merchant: Marchand
taxRate: Règle de taxe
merchants: Marchands
sections: Sections
behaviorTaxRate: Avec ou sans TVA
behaviorTaxRateChoices:
tax-excluded: TVA exclue

+ 14
- 0
Resources/views/admin/merchant/modal/duplicate_entity_to_other_merchant.html.twig Vedi File

@@ -0,0 +1,14 @@
{% embed '@LcSov/adminlte/embed/modal.twig' %}
{% block id %}carac-modal-duplicate{% endblock %}
{% block title %}
Dupliquer l'entité sur un autre marchand
{% endblock %}
{% block body %}
{% form_theme form_duplicate_entity_to_other_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form(form_duplicate_entity_to_other_merchant) }}
{% endblock %}
{% block footer %}
<button type="submit" class="btn btn-default" data-dismiss="modal">{{ "cancel"|sov_trans_admin_action }}</button>
<button type="submit" class="btn btn-primary" form="{{ form_duplicate_entity_to_other_merchant.vars.attr.id }}">{{ "duplicate"|sov_trans_admin_action }}</button>
{% endblock %}
{% endembed %}

+ 14
- 0
Resources/views/admin/merchant/modal/duplicate_entity_to_other_section.html.twig Vedi File

@@ -0,0 +1,14 @@
{% embed '@LcSov/adminlte/embed/modal.twig' %}
{% block id %}carac-modal-duplicate{% endblock %}
{% block title %}
Dupliquer l'entité sur une autre section
{% endblock %}
{% block body %}
{% form_theme form_duplicate_entity_to_other_section '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form(form_duplicate_entity_to_other_section) }}
{% endblock %}
{% block footer %}
<button class="btn btn-default" data-dismiss="modal">{{ "cancel"|sov_trans_admin_action }}</button>
<button type="submit" class="btn btn-primary" form="{{ form_duplicate_entity_to_other_section.vars.attr.id }}">{{ "duplicate"|sov_trans_admin_action }}</button>
{% endblock %}
{% endembed %}

+ 26
- 0
Resources/views/admin/merchant/modal/switch_merchant.html.twig Vedi File

@@ -0,0 +1,26 @@
{% embed '@LcSov/adminlte/embed/modal.twig' %}
{% block id %}carac-modal-switch-merchant{% endblock %}
{% block size %}modal-lg{% endblock %}
{% block title %}
Bienvenue sur le marchand <i>{{ merchant_current.getTitle() }}</i>
{% endblock %}
{% block body %}
{% if not user.favoriteMerchant %}
<p>Vous n'avez pas de marchand favoris.</p>
{% endif %}
{% if user.favoriteMerchant and user.favoriteMerchant != merchant_current %}
<p>Vous n'êtes pas sur votre marchand par favoris.</p>
{% endif %}
<p>Vous pouvez soit définir le marchand <strong>{{ merchant_current.getTitle() }}</strong>
comme marchand favoris ou simplement indiquer que vous visitez ce marchand pour aujourd'hui.</p>
{% endblock %}
{% block footer %}
{% set form_switch_merchant = carac_form_switch_merchant('admin', 'carac_merchant_favorite') %}
{% form_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_merchant) }}
{{ form(form_switch_merchant) }}
{{ form_end(form_switch_merchant) }}
<button id="carac-button-visit-merchant" type="button" class="btn btn-default"
data-dismiss="modal">Visiter</button>
{% endblock %}
{% endembed %}

+ 1
- 26
Resources/views/adminlte/layout.html.twig Vedi File

@@ -47,31 +47,6 @@

{% if(user.favoriteMerchant != merchant_current) %}
{# modal affichée uniquement si la sessionStorage.visit_merchant n'est pas défini (js) #}
{% embed '@LcSov/adminlte/embed/modal.twig' %}
{% block id %}carac-modal-switch-merchant{% endblock %}
{% block size %}modal-lg{% endblock %}
{% block title %}
Bienvenue sur le marchand <i>{{ merchant_current.getTitle() }}</i>
{% endblock %}
{% block body %}
{% if not user.favoriteMerchant %}
<p>Vous n'avez pas de marchand favoris.</p>
{% endif %}
{% if user.favoriteMerchant and user.favoriteMerchant != merchant_current %}
<p>Vous n'êtes pas sur votre marchand par favoris.</p>
{% endif %}
<p>Vous pouvez soit définir le marchand <strong>{{ merchant_current.getTitle() }}</strong>
comme marchand favoris ou simplement indiquer que vous visitez ce marchand pour aujourd'hui.</p>
{% endblock %}
{% block footer %}
{% set form_switch_merchant = carac_form_switch_merchant('admin', 'carac_merchant_favorite') %}
{% form_theme form_switch_merchant '@LcSov/adminlte/crud/form_theme.html.twig' %}
{{ form_start(form_switch_merchant) }}
{{ form(form_switch_merchant) }}
{{ form_end(form_switch_merchant) }}
<button id="carac-button-visit-merchant" type="button" class="btn btn-default"
data-dismiss="modal">Visiter</button>
{% endblock %}
{% endembed %}
{% include '@LcCaracole/admin/merchant/modal/switch_merchant.html.twig' %}
{% endif %}
{% endblock %}

Loading…
Annulla
Salva