Browse Source

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/LcShopBundle into develop

develop
Fab 3 years ago
parent
commit
0ca1bc51d3
7 changed files with 59 additions and 28 deletions
  1. +5
    -5
      ShopBundle/Form/Frontend/TicketType.php
  2. +1
    -1
      ShopBundle/Model/OrderShop.php
  3. +1
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  4. +27
    -0
      ShopBundle/Resources/views/backend/default/block/list_ordersgiftvoucher.html.twig
  5. +22
    -19
      ShopBundle/Resources/views/backend/default/block/macros.html.twig
  6. +1
    -1
      ShopBundle/Resources/views/backend/user/show.html.twig
  7. +2
    -2
      ShopBundle/Services/Order/OrderUtilsReductionTrait.php

+ 5
- 5
ShopBundle/Form/Frontend/TicketType.php View File

protected $security ; protected $security ;
protected $em ; protected $em ;
protected $priceUtils ; protected $priceUtils ;
protected $utils ;


public function __construct(Security $security, EntityManagerInterface $em, UtilsManager $utilsManager) public function __construct(Security $security, EntityManagerInterface $em, UtilsManager $utilsManager)
{ {
$this->em = $em ; $this->em = $em ;
$this->orderShopRepository = $this->em->getRepository(OrderShop::class) ; $this->orderShopRepository = $this->em->getRepository(OrderShop::class) ;
$this->priceUtils = $utilsManager->getPriceUtils() ; $this->priceUtils = $utilsManager->getPriceUtils() ;
$this->utils = $utilsManager->getUtils() ;
} }


public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
]) ; ]) ;
} }
else { else {
// captcha (honey pot)
$builder->add('body', TextType::class, [
'label' => 'Body',
'required' => false,
]) ;
// captcha
$this->utils->addCaptchaType($builder);
} }



$builder->add('subject', TextType::class, [ $builder->add('subject', TextType::class, [
'label' => 'Sujet' 'label' => 'Sujet'
]) ])

+ 1
- 1
ShopBundle/Model/OrderShop.php View File

protected $merchant; protected $merchant;


/** /**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders", fetch="EAGER")
*/ */
protected $user; protected $user;



+ 1
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml View File

orderStatusHistories: Historique de changement de statut orderStatusHistories: Historique de changement de statut
waitingBankReturn: Commandes en attente de retour banque waitingBankReturn: Commandes en attente de retour banque
list: Liste des commandes list: Liste des commandes
giftVoucher: Commandes de bons cadeaux
Ticket: Ticket:
listMessages: Liste des messages listMessages: Liste des messages
list: Tickets ouverts list: Tickets ouverts

+ 27
- 0
ShopBundle/Resources/views/backend/default/block/list_ordersgiftvoucher.html.twig View File

<table class="table table-condensed" id="address-list">
<thead>
<tr>
<th>Id</th>
<th>Utilisateurs</th>
<th>Date</th>
<th></th>
</tr>
</thead>
<tbody>
{% for order in orderShopsWeekGiftVoucher %}
<tr>
<td>{{ order.id }}</td>
<td>{{ order.user }}</td>
<td>{{ order.updatedAt|date('d-m H:i') }}</td>
<td><a class="btn-sm btn-success"
href="{{ path('easyadmin', {id: order.id, entity: 'OrderShop', action: 'show'}) }}">
<i class="fas fa-eye"></i>
</a></td>
</tr>
{% else %}
<tr>
<td colspan="4"><i>Aucune commande de bons cadeaux</i></td>
{% endfor %}
</tbody>
</table>


+ 22
- 19
ShopBundle/Resources/views/backend/default/block/macros.html.twig View File







{% macro list_reduction_credits(reductionCredits) %}
{% macro list_reduction_credits(reductionCredits, user) %}
{% set merchant_current = merchantUtils.getMerchantCurrent() %}
<table class="table table-condensed"> <table class="table table-condensed">
<thead> <thead>
<tr> <tr>
</thead> </thead>
<tbody> <tbody>
{% for reductionCredit in reductionCredits %} {% for reductionCredit in reductionCredits %}
{% set isUsed = orderUtils.isReductionCreditUsed(reductionCredit) %}
<tr>
<td>{{ reductionCredit.title }}</td>
<td>
{{ reductionCredit.value|format_price(false) }}
</td>
<td>
{% include '@EasyAdmin/default/field_boolean.html.twig' with {value: reductionCredit.status} %}
</td>
<td>
{% include '@EasyAdmin/default/field_boolean.html.twig' with {value: isUsed} %}
</td>
<td>
{% if isUsed == false %}
{{ _self.button('ReductionCredit', 'edit', reductionCredit.id, 'primary') }}
{% endif %}
</td>
</tr>
{% if reductionCredit.getMerchant() == merchant_current %}
{% set isUsed = orderUtils.isReductionCreditUsed(reductionCredit, user) %}
<tr>
<td>{{ reductionCredit.title }}</td>
<td>
{{ reductionCredit.value|format_price(false) }}
</td>
<td>
{% include '@EasyAdmin/default/field_boolean.html.twig' with {value: reductionCredit.status} %}
</td>
<td>
{% include '@EasyAdmin/default/field_boolean.html.twig' with {value: isUsed} %}
</td>
<td>
{% if isUsed == false %}
{{ _self.button('ReductionCredit', 'edit', reductionCredit.id, 'primary') }}
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>

+ 1
- 1
ShopBundle/Resources/views/backend/user/show.html.twig View File



{% if entity.reductionCredits|length %} {% if entity.reductionCredits|length %}
{{ macros.card_start('ReductionCredit.list', 'warning card-outline', false) }} {{ macros.card_start('ReductionCredit.list', 'warning card-outline', false) }}
{{ macros.list_reduction_credits(entity.reductionCredits) }}
{{ macros.list_reduction_credits(entity.reductionCredits, entity) }}
{{ macros.card_end() }} {{ macros.card_end() }}
{% endif %} {% endif %}



+ 2
- 2
ShopBundle/Services/Order/OrderUtilsReductionTrait.php View File

} }
} }


public function isReductionCreditUsed($reductionCredit){
if($this->orderShopRepo->countValidOrderWithReductionCredit($reductionCredit)) {
public function isReductionCreditUsed($reductionCredit, $user = false){
if($this->orderShopRepo->countValidOrderWithReductionCredit($reductionCredit, $user)) {
return true; return true;
}else{ }else{
return false; return false;

Loading…
Cancel
Save