Przeglądaj źródła

[Global] Bons cadeaux

feature/module_traiteur_v1
Fab 3 lat temu
rodzic
commit
cd6525c40b
6 zmienionych plików z 35 dodań i 14 usunięć
  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 Wyświetl plik

@@ -134,11 +134,11 @@ class ProductType extends AbstractType
$reductionCartClass = $this->em->getClassMetadata(ReductionCartInterface::class)->getName();
$reductionCartRepo = $this->em->getRepository(ReductionCartInterface::class);

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

}


+ 8
- 1
ShopBundle/Form/Frontend/SendGiftVoucherType.php Wyświetl plik

@@ -10,6 +10,8 @@ use Lc\ShopBundle\Services\UtilsManager;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
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\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -28,7 +30,12 @@ class SendGiftVoucherType extends AbstractType
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'
])
->add('email', EmailType::class, [

+ 17
- 0
ShopBundle/Repository/ReductionCreditRepository.php Wyświetl plik

@@ -47,11 +47,28 @@ class ReductionCreditRepository extends BaseRepository implements DefaultReposit

public function findReductionGiftOwnedByUser($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() ;
}

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() ;
}
}

+ 1
- 4
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js Wyświetl plik

@@ -191,9 +191,7 @@ $(window).on('load', function () {
expirationDateInherited: false,
availableQuantityInherited: false,
availableQuantityDefaultInherited: false,
propertyExpirationDateInherited: false,
giftVoucherReductionCart: null,
giftVoucherReductionCartInherited: null
propertyExpirationDateInherited: false
}, window.productForm[this.keyForm])
},
mounted: function () {
@@ -241,7 +239,6 @@ $(window).on('load', function () {
availableQuantityDefaultUpdated: function () {
},
propertyExpirationDateUpdated: function () {},
giftVoucherReductionCartUpdated: function () {},
setFocusOnField: function (field, y) {
this[field] = true;
this.$nextTick(function () {

+ 2
- 2
ShopBundle/Resources/views/backend/productfamily/macros.html.twig Wyświetl plik

@@ -119,11 +119,11 @@

</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'}}) }}

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

+ 5
- 5
ShopBundle/Resources/views/backend/productfamily/panel_products.html.twig Wyświetl plik

@@ -109,10 +109,10 @@
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
</th>
<th colspan="4"
{#<th colspan="4"
v-show="giftVoucherActive== true">
Réduction "Bon cadeaux"
</th>
</th>#}
<th colspan="3" class="">
Action
</th>
@@ -196,9 +196,9 @@
<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') }}'">
</th>
<th colspan="4"
{#<th colspan="4"
v-show="giftVoucherActive== true">
</th>
</th>#}
<th colspan="3" class="">

</th>
@@ -251,7 +251,7 @@
{% 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.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 %} #}
};
window.formProductTemplate[{{ keyForm }}] = '{{ product_family_macros.product_row(product, totalProductOrdered[product.vars.value.id])|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';

Ładowanie…
Anuluj
Zapisz