$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(), | ||||
)); | |||||
));*/ | |||||
} | } | ||||
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, [ |
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() ; | ||||
} | } | ||||
} | } |
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 () { |
</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> |
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 }}'; |