Преглед изворни кода

Merge branch 'develop'

master
Fab пре 4 година
родитељ
комит
2f2f56d9fa
8 измењених фајлова са 138 додато и 1 уклоњено
  1. +58
    -0
      ShopBundle/Form/Backend/Common/ProductType.php
  2. +52
    -0
      ShopBundle/Form/Backend/Common/UserType.php
  3. +1
    -0
      ShopBundle/Form/Backend/Order/AddPoductToOrderType.php
  4. +4
    -0
      ShopBundle/Resources/public/js/backend/script/merchant/vuejs-merchant.js
  5. +1
    -0
      ShopBundle/Resources/translations/lcshop.fr.yaml
  6. +3
    -0
      ShopBundle/Resources/views/backend/merchant/form.html.twig
  7. +18
    -0
      ShopBundle/Resources/views/backend/merchant/panel_maintenance.html.twig
  8. +1
    -1
      ShopBundle/Resources/views/backend/order/macros.html.twig

+ 58
- 0
ShopBundle/Form/Backend/Common/ProductType.php Прегледај датотеку

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

namespace Lc\ShopBundle\Form\Backend\Common;

use Doctrine\ORM\EntityManagerInterface;

use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\ProductInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ProductType extends AbstractType
{
protected $em;
protected $merchantUtils;

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

public function buildForm(FormBuilderInterface $builder, array $options)
{
$productClass = $this->em->getClassMetadata(ProductInterface::class);
$currentMerchant = $this->merchantUtils->getMerchantUser();

$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($productClass, $options, $currentMerchant) {
$builder = $event->getForm()->getParent();

$builder->add('product', EntityType::class, array_merge($options,[
'class' => $productClass->name,
'query_builder' => function (EntityRepository $er) use ($currentMerchant) {
return $er->createQueryBuilder('p')
->join('p.productFamily', 'pFamily')
->where('pFamily.merchant = :currentMerchant')
->andWhere('pFamily.status = 1')
->setParameter('currentMerchant', $currentMerchant);
},
'choice_label' => function ($product) {
return $product->getProductFamily()->getTitle() . ' - ' . $product->getTitle();
}
]));
});
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'translation_domain' => 'lcshop',
]);
}
}

+ 52
- 0
ShopBundle/Form/Backend/Common/UserType.php Прегледај датотеку

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

namespace Lc\ShopBundle\Form\Backend\Common;

use Doctrine\ORM\EntityManagerInterface;

use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Repository\GroupUserRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;

class UserType extends AbstractType
{
protected $em;

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

public function buildForm(FormBuilderInterface $builder, array $options)
{
$userClass = $this->em->getClassMetadata(UserInterface::class);
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($userClass, $options) {
$builder = $event->getForm()->getParent();

$builder->add('user', EntityType::class, array_merge($options,[
'class' => $userClass->name,
'query_builder'=> function (EntityRepository $er) {
$query = $er->findByMerchantQuery();
return $query;
},
'expanded' => false,
'translation_domain'=>'lcshop',
]));
});
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'translation_domain' => 'lcshop',
]);
}
}

+ 1
- 0
ShopBundle/Form/Backend/Order/AddPoductToOrderType.php Прегледај датотеку

@@ -40,6 +40,7 @@ class AddPoductToOrderType extends AbstractType
return $er->createQueryBuilder('p')
->join('p.productFamily', 'pFamily')
->where('pFamily.merchant = :currentMerchant')
->andWhere('pFamily.status = 1')
->setParameter('currentMerchant', $currentMerchant);
},
'choice_label' => function ($product) {

+ 4
- 0
ShopBundle/Resources/public/js/backend/script/merchant/vuejs-merchant.js Прегледај датотеку

@@ -33,6 +33,10 @@ appOrder = new Vue({
{
name: 'address',
nameDisplay: 'Adresse'
},
{
name: 'maintenance',
nameDisplay: 'Maintenance'
}
]
}, window.addressValues);

+ 1
- 0
ShopBundle/Resources/translations/lcshop.fr.yaml Прегледај датотеку

@@ -75,6 +75,7 @@ group:
order: Commande
email: Email
delivery: Livraison
maintenance: Maintenance


None: Aucune valeur

+ 3
- 0
ShopBundle/Resources/views/backend/merchant/form.html.twig Прегледај датотеку

@@ -43,6 +43,9 @@
<div v-show="currentSection == 'seo'" class="panel panel-default">
{% include '@LcShop/backend/merchant/panel_seo.html.twig' %}
</div>
<div v-show="currentSection == 'maintenance'" class="panel panel-default">
{% include '@LcShop/backend/merchant/panel_maintenance.html.twig' %}
</div>

</div>


+ 18
- 0
ShopBundle/Resources/views/backend/merchant/panel_maintenance.html.twig Прегледај датотеку

@@ -0,0 +1,18 @@
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}

<div class="row">
<div class="col-8">
{{ macros.card_start('Merchant.maintenance','light') }}
<div class="col-12">
{% if form.merchantConfigs['maintenance'] is defined %}
{{ form_row(form.merchantConfigs['maintenance']) }}
{% endif %}
</div>
<div class="col-12">
{% if form.merchantConfigs['maintenanceIpAuthorized'] is defined %}
{{ form_row(form.merchantConfigs['maintenanceIpAuthorized']) }}
{% endif %}
</div>
{{ macros.card_end() }}
</div>
</div>

+ 1
- 1
ShopBundle/Resources/views/backend/order/macros.html.twig Прегледај датотеку

@@ -60,7 +60,7 @@
</span>

<span v-show="orderProduct.isRedelivery">
- <i class="fa fa-undo" data-toggle="tooltip" title="Ce produit fait l'objet d'une relivraison" ></i>
- <i class="fa fa-undo" data-toggle="tooltip" title="Ce produit est une relivraison" ></i>
</span>

</td>

Loading…
Откажи
Сачувај