Browse Source

[Global] Bons cadeaux

feature/module_traiteur_v1
Fab 4 years ago
parent
commit
cd6525c40b
6 changed files with 35 additions and 14 deletions
  1. +2
    -2
      ShopBundle/Form/Backend/ProductFamily/ProductType.php
  2. +8
    -1
      ShopBundle/Form/Frontend/SendGiftVoucherType.php
  3. +17
    -0
      ShopBundle/Repository/ReductionCreditRepository.php
  4. +1
    -4
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  5. +2
    -2
      ShopBundle/Resources/views/backend/productfamily/macros.html.twig
  6. +5
    -5
      ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig

+ 2
- 2
ShopBundle/Form/Backend/ProductFamily/ProductType.php View File

$reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName(); $reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName();
$reductionCartRepo = $this->em->getRepository(ReductionCartInterface::class); $reductionCartRepo = $this->em->getRepository(ReductionCartInterface::class);


$builder->add('giftVoucherReductionCart', EntityType::class, array(
/* $builder->add('giftVoucherReductionCart', EntityType::class, array(
'required' =>false, 'required' =>false,
'class'=> $reductionCartClass, 'class'=> $reductionCartClass,
'choices' => $reductionCartRepo->getOnlineReductionCart(), 'choices' => $reductionCartRepo->getOnlineReductionCart(),
));
));*/


} }



+ 8
- 1
ShopBundle/Form/Frontend/SendGiftVoucherType.php View File

use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {


$builder->add('title', TextType::class, [
$builder->add('activationDate', DateType::class, [
'label' => 'Date d\'activation de votre bon cadeau',
'widget'=> 'single_text',
'mapped'=> false,
])
->add('title', TextType::class, [
'label' => 'Nom de votre bon cadeau' 'label' => 'Nom de votre bon cadeau'
]) ])
->add('email', EmailType::class, [ ->add('email', EmailType::class, [

+ 17
- 0
ShopBundle/Repository/ReductionCreditRepository.php View File



public function findReductionGiftOwnedByUser($user){ public function findReductionGiftOwnedByUser($user){
$query = $this->findByMerchantQuery() ; $query = $this->findByMerchantQuery() ;
$query->leftJoin('e.users', 'u');
$query->having('COUNT(u.id) =0');
$query->andWhere('e.status = 1'); $query->andWhere('e.status = 1');
$query->andWhere('e.type = :type'); $query->andWhere('e.type = :type');
$query->andWhere('e.owner = :user'); $query->andWhere('e.owner = :user');
$query->setParameter('user', $user); $query->setParameter('user', $user);
$query->setParameter('type', ReductionCredit::TYPE_GIFT); $query->setParameter('type', ReductionCredit::TYPE_GIFT);
$query->groupBy('e.id');
return $query->getQuery()->getResult() ;
}

public function findReductionGiftOwnedActiveByUser($user){
$query = $this->findByMerchantQuery() ;
$query->leftJoin('e.users', 'u');
$query->having('COUNT(u.id) >0');
$query->andWhere('e.status = 1');
$query->andWhere('e.type = :type');
$query->andWhere('e.owner = :user');
$query->setParameter('user', $user);
$query->setParameter('type', ReductionCredit::TYPE_GIFT);
$query->groupBy('e.id');

return $query->getQuery()->getResult() ; return $query->getQuery()->getResult() ;
} }
} }

+ 1
- 4
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js View File

expirationDateInherited: false, expirationDateInherited: false,
availableQuantityInherited: false, availableQuantityInherited: false,
availableQuantityDefaultInherited: false, availableQuantityDefaultInherited: false,
propertyExpirationDateInherited: false,
giftVoucherReductionCart: null,
giftVoucherReductionCartInherited: null
propertyExpirationDateInherited: false
}, window.productForm[this.keyForm]) }, window.productForm[this.keyForm])
}, },
mounted: function () { mounted: function () {
availableQuantityDefaultUpdated: function () { availableQuantityDefaultUpdated: function () {
}, },
propertyExpirationDateUpdated: function () {}, propertyExpirationDateUpdated: function () {},
giftVoucherReductionCartUpdated: function () {},
setFocusOnField: function (field, y) { setFocusOnField: function (field, y) {
this[field] = true; this[field] = true;
this.$nextTick(function () { this.$nextTick(function () {

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/macros.html.twig View File



</td> </td>


<td colspan="4" v-show="productFamily.giftVoucherActive== true">
{# <td colspan="4" v-show="productFamily.giftVoucherActive== true">


{{ form_row(product.giftVoucherReductionCart, {"label": false, "attr" : {'v-model' : 'giftVoucherReductionCart', ':required': 'status ==1 && productFamily.giftVoucherActive'}}) }} {{ form_row(product.giftVoucherReductionCart, {"label": false, "attr" : {'v-model' : 'giftVoucherReductionCart', ':required': 'status ==1 && productFamily.giftVoucherActive'}}) }}


</td>
</td>#}
<td colspan="3"> <td colspan="3">
<button type="button" class="btn-sm btn-info" @click="modalProductForm()"> <button type="button" class="btn-sm btn-info" @click="modalProductForm()">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>

+ 5
- 5
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig View File

v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'"> v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
Semaine / Commandés Semaine / Commandés
</th> </th>
<th colspan="4"
{#<th colspan="4"
v-show="giftVoucherActive== true"> v-show="giftVoucherActive== true">
Réduction "Bon cadeaux" Réduction "Bon cadeaux"
</th>
</th>#}
<th colspan="3" class=""> <th colspan="3" class="">
Action Action
</th> </th>
<th colspan="2" <th colspan="2"
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'"> v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' || behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE') }}'">
</th> </th>
<th colspan="4"
{#<th colspan="4"
v-show="giftVoucherActive== true"> v-show="giftVoucherActive== true">
</th>
</th>#}
<th colspan="3" class=""> <th colspan="3" class="">


</th> </th>
{% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %} {% if product.vars.value.availableQuantity %}availableQuantity: parseInt({{ product.vars.value.availableQuantity }}),{% endif %}
{% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %} {% if product.vars.value.availableQuantityDefault %}availableQuantityDefault: parseInt({{ product.vars.value.availableQuantityDefault }}),{% endif %}
{% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %} {% if product.vars.value.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% endif %}
{% if product.vars.value.giftVoucherReductionCart %}giftVoucherReductionCart: {{ product.vars.value.giftVoucherReductionCart.id }},{% endif %}
{#{% if product.vars.value.giftVoucherReductionCart %}giftVoucherReductionCart: {{ product.vars.value.giftVoucherReductionCart.id }},{% endif %}#}
{# {% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %} #} {# {% if product.vars.value.expirationDate %}expirationDate: "{{ product.vars.value.expirationDate|date('d/m/Y') }}"{% endif %} #}
}; };
window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}'; window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';

Loading…
Cancel
Save