Explorar el Código

creation d'une commande

reduction
Fab hace 4 años
padre
commit
52c23da987
Se han modificado 14 ficheros con 363 adiciones y 143 borrados
  1. +41
    -26
      ShopBundle/Controller/Admin/OrderController.php
  2. +0
    -3
      ShopBundle/Controller/ApiController.php
  3. +2
    -22
      ShopBundle/Form/OrderProductType.php
  4. +5
    -0
      ShopBundle/Model/PointSale.php
  5. +0
    -4
      ShopBundle/Repository/BaseRepository.php
  6. +7
    -25
      ShopBundle/Repository/PointSaleRepository.php
  7. +18
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  8. +106
    -37
      ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js
  9. +1
    -0
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-mixins.js
  10. +8
    -1
      ShopBundle/Resources/views/backend/default/layout.html.twig
  11. +5
    -0
      ShopBundle/Resources/views/backend/order/form.html.twig
  12. +28
    -2
      ShopBundle/Resources/views/backend/order/panel_addresses.html.twig
  13. +123
    -12
      ShopBundle/Resources/views/backend/order/panel_delivery.html.twig
  14. +19
    -11
      ShopBundle/Resources/views/backend/order/panel_orderproducts.html.twig

+ 41
- 26
ShopBundle/Controller/Admin/OrderController.php Ver fichero

@@ -8,6 +8,7 @@ use Doctrine\DBAL\Types\FloatType;
use Doctrine\ORM\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use Lc\ShopBundle\Context\AddressInterface;
use Lc\ShopBundle\Context\PointSaleInterface;
use Lc\ShopBundle\Context\ProductCategoryInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Context\ProductInterface;
@@ -16,6 +17,7 @@ use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Form\OrderProductType;
use Lc\ShopBundle\Form\ProductFamilyCategoriesType;
use Lc\ShopBundle\Form\ProductType;
use Lc\ShopBundle\Model\PointSale;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -25,21 +27,24 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class OrderController extends AdminController
{

public function updateEntity($entity)
{
foreach($entity->getOrderProducts() as $orderProduct) {
$orderProduct->setCreatedBy($this->getUser()) ;
$orderProduct->setUpdatedBy($this->getUser()) ;
$orderProduct->setTaxRate($orderProduct->getProduct()->getProductFamily()->getTaxRate()) ;
$orderProduct->setOrderShop($entity) ;

foreach ($entity->getOrderProducts() as $orderProduct) {
//dump($orderProduct);
$orderProduct->setCreatedBy($this->getUser());
$orderProduct->setUpdatedBy($this->getUser());
$orderProduct->setTaxRate($orderProduct->getProduct()->getProductFamily()->getTaxRate());
$orderProduct->setOrderShop($entity);

$this->em->persist($orderProduct);

$entity->addOrderProduct($orderProduct) ;
$entity->addOrderProduct($orderProduct);
}

$this->setUpdated($entity);
@@ -49,8 +54,27 @@ class OrderController extends AdminController

public function persistEntity($entity)
{
foreach ($entity->getOrderProducts() as $orderProduct) {

$orderProduct->setUnit($orderProduct->getProduct()->getUnitInherited());
$orderProduct->setTitle($orderProduct->getProduct()->getTitleInherited());
$orderProduct->setPrice($orderProduct->getProduct()->getPriceInherited());
if ($orderProduct->getProduct()->getProductFamily()->getTaxRate()) {
$orderProduct->setTaxRate($orderProduct->getProduct()->getProductFamily()->getTaxRate());
} else {
$orderProduct->setTaxRate($this->security->getUser()->getMerchant()->getTaxRate());
}

$orderProduct->setOrderShop($entity);
$orderProduct->setCreatedBy($this->getUser());
$orderProduct->setUpdatedBy($this->getUser());
$this->em->persist($orderProduct);
$entity->addOrderProduct($orderProduct);

parent::persistEntity($entity) ;
}


parent::persistEntity($entity);
}

public function createEntityFormBuilder($entity, $view)
@@ -74,17 +98,10 @@ class OrderController extends AdminController


$addressClass = $this->em->getClassMetadata(AddressInterface::class);
$formBuilder->add('invoiceAddress', EntityType::class, array(
'class' => $addressClass->name,
'query_builder' => function (EntityRepository $er) use ($entity) {
return $er->createQueryBuilder('a')
->where('a.user = :user')
->setParameter('user', $entity->getUser());
},
));

$formBuilder->add('deliveryAddress', EntityType::class, array(
$formBuilder->add('invoiceAddress', EntityType::class, array(
'class' => $addressClass->name,
'placeholder' => '',
'query_builder' => function (EntityRepository $er) use ($entity) {
return $er->createQueryBuilder('a')
->where('a.user = :user')
@@ -92,7 +109,6 @@ class OrderController extends AdminController
},
));


return $formBuilder;
}

@@ -123,7 +139,6 @@ class OrderController extends AdminController

protected function newAction()
{

$this->dispatch(EasyAdminEvents::PRE_NEW);

$entity = $this->executeDynamicMethod('createNew<EntityName>Entity');
@@ -141,24 +156,24 @@ class OrderController extends AdminController
//ETAPE 1 Choix de l'utilisateur
$user = $newForm->get('user')->getData();

if($user == null){
if ($user == null) {
$user = $this->getUserViaFirstStepForm($entity);
}

if (!$user instanceof UserInterface) return $user;
else{
else {
$entity->setUser($user);

/* $newForm = $this->executeDynamicMethod('create<EntityName>NewForm', [$entity, $fields]);
$newForm->handleRequest($this->request);*/
//réinitialise le formulaire pour charger les adresses en fonction de l'utilisateur sélectionné
$newForm = $this->executeDynamicMethod('create<EntityName>NewForm', [$entity, $fields]);
$newForm->handleRequest($this->request);

//dump( $entity);
//dump( $entity);

if ($newForm->isSubmitted() && $newForm->isValid()) {
dump($entity);
die();
/*dump($entity);
die();*/
//$this->dispatch(EasyAdminEvents::PRE_PERSIST, ['entity' => $entity]);
$this->executeDynamicMethod('persist<EntityName>Entity', [$entity, $newForm]);
$this->dispatch(EasyAdminEvents::POST_PERSIST, ['entity' => $entity]);

+ 0
- 3
ShopBundle/Controller/ApiController.php Ver fichero

@@ -19,13 +19,10 @@ class ApiController extends AbstractController
public function __construct(EntityManagerInterface $entityManager)
{
$this->em = $entityManager;

}

public function getEntity($entity, $id)
{


if($entity == 'product'){
$repo = $this->em->getRepository(ProductInterface::class);
$data = $repo->find($id);

+ 2
- 22
ShopBundle/Form/OrderProductType.php Ver fichero

@@ -41,39 +41,19 @@ class OrderProductType extends AbstractType

$builder->add('product', EntityType::class, array(
'class' => $productClass->name,
/* 'attr'=>array(
'data-widget'=> 'select2'
),*/
'placeholder'=> '',

'choice_label'=> function($product){
return $product->getProductFamily()->getTitle() . ' - ' . $product->getTitle();
}
));
$builder->add('quantity', NumberType::class, array(
'label' => 'Quantité',
'required' => false,
'attr' => [
'append_html' => 'g'
]
));

$builder->add('unit', HiddenType::class,array(
'data'=>'L',
));
$builder->add('title', HiddenType::class,array(
'data'=>'Mon litre de pont',
));

$builder->add('price', NumberType::class,array(
'attr'=> array(
'readonly'=> 'readonly'
)
));


//$builder->add('buyingPrice', NumberType::class);



}

public function configureOptions(OptionsResolver $resolver)

+ 5
- 0
ShopBundle/Model/PointSale.php Ver fichero

@@ -32,6 +32,11 @@ abstract class PointSale extends AbstractDocumentEntity
*/
protected $address;


public function labelAdminChoice(){
return $this->getTitle();
}

public function __construct()
{
$this->merchant = new ArrayCollection();

+ 0
- 4
ShopBundle/Repository/BaseRepository.php Ver fichero

@@ -5,9 +5,6 @@ namespace Lc\ShopBundle\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\ManagerRegistry;
use Symfony\Component\Form\Exception\LogicException;

class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface
{
@@ -31,7 +28,6 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
}

public function filterByMerchant($merchant){
dump($merchant);
return $this->createQueryBuilder('e')
->where('e.merchant = :currentMerchant')
->setParameter('currentMerchant', $merchant->getId())

+ 7
- 25
ShopBundle/Repository/PointSaleRepository.php Ver fichero

@@ -5,42 +5,24 @@ namespace Lc\ShopBundle\Repository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\QueryBuilder;
use Lc\ShopBundle\Context\PointSaleInterface;
use Lc\ShopBundle\Context\ProductCategoryInterface;

/**
* @method ProductCategoryInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ProductCategoryInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ProductCategoryInterface[] findAll()
* @method ProductCategoryInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method PointSaleInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method PointSaleInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method PointSaleInterface[] findAll()
* @method PointSaleInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ProductCategoryRepository extends BaseRepository
class PointSaleRepository extends BaseRepository
{
public function __construct(EntityManager $entityManager)
{

parent::__construct($entityManager, ProductCategoryInterface::class);
parent::__construct($entityManager, PointSaleInterface::class);
}


public static function adminQueryBuilderForTree(BaseRepository $e): QueryBuilder
{

return $e->createQueryBuilder('e')
->where('e.parent is NULL')
->andWhere('e.status >= 0')
->orderBy('e.position', 'ASC');
}

public function findAllParents()
{
return $this->createQueryBuilder('e')
->where('e.parent is NULL')
->andWhere('e.status >= 0')
->orderBy('e.position', 'ASC')
->getQuery()
->getResult();
}


// /**
// * @return ProductCategory[] Returns an array of ProductCategory objects

+ 18
- 0
ShopBundle/Resources/public/css/backend/custom.css Ver fichero

@@ -1,3 +1,19 @@
/* STRUCTURE */
.wrapper{margin: 0; grid-column-gap:0px; grid-row-gap:0;}
.main-header {box-shadow: 0 1px 1px rgba(0,0,0,0.05); background: #fff; border-bottom: solid 1px #e0e0e0;}
.main-header .navbar{width: var(--sidebar-width); text-align:center; border-right: solid 1px #e0e0e0;}

body.easyadmin-sidebar-width-compact .main-sidebar{width: 50px;}
body.easyadmin-sidebar-width-compact .main-header .navbar{width: 50px;}

#sidebar-resizer-handler{width: 50px;}
.resizer-handler{cursor: pointer; display: block; opacity: 1; }

.main-header #header-logo {display: inline-block; margin: auto; padding: 3px 0; }

.main-sidebar{border-right:solid 1px #e0e0e0; /*background: #222d32;*/ }
/*.sidebar-menu .fa{color: #fff;}
.sidebar-menu a{color: #fff;}*/
/* Général */

.input-group-text {
@@ -79,6 +95,8 @@

/* ORDER */

.table-order-summary{width: 100%;}

/*.select2-container--bootstrap .select2-selection{max-width: none;}*/
/*.order-product-item{margin: 15px 0; padding: 0;}*/


+ 106
- 37
ShopBundle/Resources/public/js/backend/script/order/vuejs-order.js Ver fichero

@@ -1,30 +1,6 @@
// Reference array sent to dynamic staticRenderFns
var staticRenderFns = [];

/*
Vue.directive('selecttwo', {
twoWay: true,
bind: function (el, binding, vnode) {
log(el)
log(binding)
log(this)

$(el).select2({
theme: 'bootstrap',
language: '{{ _select2_locale }}'
});
$(el).select2().on("select2:select", function(e) {
this.set($(el).val());
}.bind(binding));
},
update: function(el, ov) {
log(el)
;
$(el).trigger("change");
}
});
*/

Vue.component('order-product-form', {
mixins: [mixinTemplate],
props: ['template', 'keyForm'],
@@ -41,10 +17,11 @@ Vue.component('order-product-form', {
quantity: 1,
unit: null,
product: null
}/*, window.productForm[this.keyForm]*/)
}, window.orderProductForm[this.keyForm])
},
mounted: function () {
this.setSelect2();
this.updateQuantity();

},
methods: {
@@ -54,21 +31,30 @@ Vue.component('order-product-form', {
this.updateQuantity();
this.$parent.updateTotalPrice();
},
updateQuantity:function(){
this.totalWithTax = this.priceWithTax * this.quantity;
this.totalWithoutTax = this.price * this.quantity;
updateQuantity: function () {
this.totalWithTax = parseFloat(this.priceWithTax * this.quantity).toFixed(3);
this.totalWithoutTax = parseFloat(this.price * this.quantity).toFixed(3);
this.$parent.updateTotalPrice();
},
setSelect2: function(){
setSelect2: function () {
var select = $(this.$el).find('select.form-control');

var monSelect = $(this.$el).find('select.form-control').select2({
theme: 'bootstrap',
language: 'fr'
debug: true,
placeholder: "Select an option"
});

var vue = this;
monSelect.on('select2:select', function () {
monSelect.on('select2:select', function (e) {
//dispatch event pour que le select soit "submitable"
var event = new Event('change');
e.target.dispatchEvent(event);

this.product = monSelect.val();

$.ajax({
url: "http://localhost:8000/api/product/" + this.product,
url: DOMAIN + "/api/product/" + this.product,
method: "GET",
dataType: "",
success: function (response) {
@@ -76,12 +62,50 @@ Vue.component('order-product-form', {
}
});
})
},
deleteProductForm: function () {
if (confirm('Êtes-vous sur de cette action ?')) {
this.$parent.formOrderProductArray.splice(this.keyForm, 1);
}
}
},
watch: {}
});


Vue.component('delivery-availability-choice', {
mixins: [mixinTemplate],
props: ['template', 'key', 'name', 'id'],
data() {
return {
id: -1,
deliveryAvailability: null, // Have to assign to this variable**
deliveryAvailabilities: null, // Have to assign to this variable**
selected_category: "",
value: null,
label: null
};
},
mounted() {
},
methods: {
updateDeliveryAvailability() {
log(this.deliveryAvailability);
/*log('bnfbf');
var self = this;
$.ajax({
url: DOMAIN+"/admin/delivery-availaibility/14",
method: "POST",
dataType: "",
success: function (response) {
self.categories = response.categories;
}
});*/

}
}
});

appOrder = new Vue({
el: '#lc-order-edit',
delimiters: ['${', '}'],
@@ -92,10 +116,16 @@ appOrder = new Vue({
currentSection: 'cart',
formOrderProductArray: [],
indexOrderProductForm: 0,
formDeliveryAvailabilityLargeArray: [],
formDeliveryAvailabilityShortArray: [],
indexDeliveryAvailability: null,
invoiceAddress: null,
deliveryAddress: null,
totalWithTax:null,
totalWithoutTax:null,
deliveryType: null,
deliveryPointSale: null,
deliveryAvailability: 'niche',
totalWithTax: null,
totalWithoutTax: null,
sectionsArray: [
{
name: 'cart',
@@ -103,7 +133,11 @@ appOrder = new Vue({
},
{
name: 'addresses',
nameDisplay: 'Livraisons & facturations'
nameDisplay: 'Adresses'
},
{
name: 'delivery',
nameDisplay: 'Livraisons'
}
]
})/*, window.appOrderProductFamilyValues)*/;
@@ -117,13 +151,48 @@ appOrder = new Vue({
this.totalWithTax = 0;
for (var i = 0; i < this.$refs.orderProductForm.length; i++) {
var line = this.$refs.orderProductForm[i];
this.totalWithoutTax = this.totalWithoutTax + line.totalWithoutTax;
this.totalWithTax = this.totalWithTax + line.totalWithTax;
this.totalWithoutTax = parseFloat(parseFloat(this.totalWithoutTax) + parseFloat(line.totalWithoutTax)).toFixed(2);
this.totalWithTax = parseFloat(parseFloat(this.totalWithTax) + parseFloat(line.totalWithTax)).toFixed(2);
}
},
changeSection: function (section) {
this.updateChild();
this.currentSection = section.name;

this.addDeliveryAvailabilityChoice();
},
addDeliveryAvailabilityChoice: function () {
$.ajax({
url: DOMAIN + "/admin/delivery-availaibility/" + this.deliveryAddress,
method: "POST",
dataType: "",
success: function (response) {
for (i = 0; i < response.large.length; i++) {
slot = response.large[i];
var deliveryAvailabilityForm = $('#delivery-availability-short').data('prototype');
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__id__/g, "{{ form.deliveryAvailabilityZone.vars.id }}_"+slot.id );
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__name__/g, "{{ form.deliveryAvailabilityZone.vars.full_name }}" );
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__value__/g, slot.id );
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__label__/g, slot.label );

appOrder.formDeliveryAvailabilityLargeArray.push(deliveryAvailabilityForm);
appOrder.indexDeliveryAvailability++;
}

for (i = 0; i < response.short.length; i++) {
slot = response.short[i];
var deliveryAvailabilityForm = $('#delivery-availability-short').data('prototype');
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__id__/g, "{{ form.deliveryAvailabilityZone.vars.id }}_"+slot.id );
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__name__/g, "{{ form.deliveryAvailabilityZone.vars.full_name }}" );
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__value__/g, slot.id );
deliveryAvailabilityForm = deliveryAvailabilityForm.replace(/__label__/g, slot.label );

appOrder.formDeliveryAvailabilityShortArray.push(deliveryAvailabilityForm);
appOrder.indexDeliveryAvailability++;
}
}
});

},
addOrderProductForm: function () {
var $collectionHolder = $('#order-products-list');

+ 1
- 0
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-mixins.js Ver fichero

@@ -134,6 +134,7 @@ let mixinTemplate = {
template: {
immediate: true, // makes the watcher fire on first render, too.
handler() {
log(this.template);
if (this.template) {
var res = Vue.compile(this.template);


+ 8
- 1
ShopBundle/Resources/views/backend/default/layout.html.twig Ver fichero

@@ -68,6 +68,9 @@
{% endblock header_logo %}
</div>
</nav>
<div id="sidebar-resizer-handler" class="resizer-handler resizer-handler-left">
<i class="fa fa-arrows-alt-h"></i>
</div>

<div id="switch-merchant">
{% if is_granted('ROLE_ADMIN') %}
@@ -155,7 +158,6 @@
{{ include(_entity_config is defined ? _entity_config.templates.flash_messages : '@EasyAdmin/default/flash_messages.html.twig') }}
{% endblock flash_messages %}

<div id="sidebar-resizer-handler" class="resizer-handler resizer-handler-left"></div>

{% block content %}
<div class="content">
@@ -202,6 +204,11 @@
</div>
{% endblock wrapper_wrapper %}

{#Initilisation des varibles requis dans le JS #}

<script>
const DOMAIN = "{{ app.request.getSchemeAndHttpHost() }}";
</script>
{% block body_javascript %}{% endblock body_javascript %}

{% block body_custom_javascript %}

+ 5
- 0
ShopBundle/Resources/views/backend/order/form.html.twig Ver fichero

@@ -4,6 +4,7 @@

<div id="nav-params">
<button type="button" v-for="section in sectionsArray"
v-if="(section.name == 'delivery' && deliveryType == 'at-home' && deliveryAddress>0) || (section.name != 'delivery')"
:class="'btn '+((currentSection == section.name) ? 'btn-primary' : 'btn-default')"
@click="changeSection(section)">
${ section.nameDisplay }
@@ -27,6 +28,10 @@
{% include '@LcShop/backend/order/panel_addresses.html.twig' %}
</div>

<div v-show="currentSection == 'delivery'" class="panel panel-default">
{% include '@LcShop/backend/order/panel_delivery.html.twig' %}
</div>

</div>
</div>
{{ form_end(form) }}

+ 28
- 2
ShopBundle/Resources/views/backend/order/panel_addresses.html.twig Ver fichero

@@ -1,2 +1,28 @@
{{ form_row(form.deliveryAddress) }}
{{ form_row(form.invoiceAddress, {"attr": {'v-model' : 'invoiceAddress', 'v-selecttwo' : 'invoiceAddress'}}) }}
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons & facturation</legend>
<div class="row" >

<div class="col">
{{ form_label(form.deliveryType) }}
{% for field in form.deliveryType %}

{{ form_widget(field, {"attr" : {"v-model" : 'deliveryType'}}) }}
{% endfor %}

</div>
<div class="col" v-if="deliveryType == 'at-home'">
{{ form_row(form.deliveryAddress, {"attr": {'v-model' : 'deliveryAddress'}}) }}
</div>
<div class="col" v-else-if="deliveryType == 'point-sale'">
{{ form_row(form.deliveryPointSale, {"attr": {'v-model' : 'deliveryPointSale'}}) }}
</div>

<div class="col">
{{ form_row(form.invoiceAddress, {"attr": {'v-model' : 'invoiceAddress', 'v-selecttwo' : 'invoiceAddress'}}) }}
</div>
</div>
</fieldset>
</div>
</div>

+ 123
- 12
ShopBundle/Resources/views/backend/order/panel_delivery.html.twig Ver fichero

@@ -1,27 +1,138 @@
{#
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons & facturation</legend>
<legend>Livraisons</legend>
<div class="row">
<delivery-choice ref="delivery-choice"></delivery-choice>
#}
{#<div class="col">
{{ form_label(form.deliveryAvailabilityZoneShort) }}
<div class="delivery-availability-short">
{% for field in form.deliveryAvailabilityZoneShort %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
</div>
<div class="col">
{{ form_label(form.deliveryType) }}
{% for field in form.deliveryType %}
{{ form_label(form.deliveryAvailabilityZoneLarge) }}
<div class="delivery-availability-large">
{% for field in form.deliveryAvailabilityZoneLarge %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
${deliveryAvailability}
</div>#}{#

{{ form_widget(field, {"attr" : {"v-model" : 'deliveryType'}}) }}
{% endfor %}
</div>
</fieldset>
</div>
</div>
#}


{#
{% macro printDeliveryAvailabitlityRow(slot) %}
<div class="form-check">
<input type="radio" v-model="deliveryAvailability" id="{% verbatim %}{{ id }}{% endverbatim %}_20" name="{% verbatim %}{{ name }}{% endverbatim %}" class="form-check-input" value="{% verbatim %}{{ value }}{% endverbatim %}">
<label class="form-check-label" for="{% verbatim %}{{ id }}{% endverbatim %}_20"></label>
</div>
{% endmacro %}
{% import _self as formMacros %}

<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons</legend>
<div class="row">
<div class="col">
{{ form_label(form.deliveryAvailabilityZone) }}

<div id="delivery-availabilities-choice">

<template v-for="(deliveryAvailability, key) in formDeliveryAvailabilityArray">
<delivery-availability-choice ref="delivery-choice" :template="deliveryAvailability" :key="key" :name="{{ form.deliveryAvailabilityZone.vars.full_name }}" :id="{{ form.deliveryAvailabilityZone.vars.id }}" >

</delivery-availability-choice>
</template>
</div>
</div>
<div class="col" v-if="deliveryType == 'at-home'">
{{ form_row(form.deliveryAddress, {"attr": {'v-model' : 'deliveryAddress'}}) }}
</div>
<div class="col" v-else-if="deliveryType == 'point-sale'">
{{ form_row(form.deliveryPointSale, {"attr": {'v-model' : 'deliveryPointSale'}}) }}
</div>
#}{# <div class="col">
{{ form_label(form.deliveryAvailabilityZoneLarge) }}
<div class="delivery-availability-large">
{% for field in form.deliveryAvailabilityZoneLarge %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
${deliveryAvailability}
</div>#}{#
</div>
</fieldset>
</div>

<div class="clearfix"></div>

#}{#{% for keyForm, deliveryAvailabilityField in form.deliveryAvailabilityZoneShort %}

<script>
jQuery(window).on('load', function () {
var deliveryAvailabilityForm = '{{ formMacros.printDeliveryAvailabitlityRow(deliveryAvailabilityField)|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}';

appOrder.formDeliveryAvailabilityArray.push(deliveryAvailabilityForm);
appOrder.indexDeliveryAvailability++;
});
</script>

{% endfor %}#}{#

</div>#}


{% macro printDeliveryAvailabitlityChoice() %}
<div class="form-check">
<input type="radio" v-model="deliveryAvailability" id="__id__" name="__name__" class="form-check-input" value="__value__" @change="updateDeliveryAvailability">
<label class="form-check-label" for="__id__">__label__</label>

</div>
{% endmacro %}
{% import _self as formMacros %}

<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons</legend>
<div class="row">
<div class="col">
{{ form_row(form.invoiceAddress, {"attr": {'v-model' : 'invoiceAddress', 'v-selecttwo' : 'invoiceAddress'}}) }}
{{ form_label(form.deliveryAvailabilityZone) }}

<div id="delivery-availability-short" data-prototype='{{ formMacros.printDeliveryAvailabitlityChoice()|replace({"\n":' ', "\r":' ', "'" : "\\'"})|raw }}'>

<template v-for="(deliveryAvailability, key) in formDeliveryAvailabilityLargeArray">
<delivery-availability-choice ref="delivery-choice" :template="deliveryAvailability" :key="key" >

</delivery-availability-choice>
</template>
BLOP
<template v-for="(deliveryAvailability, key) in formDeliveryAvailabilityShortArray">
<delivery-availability-choice ref="delivery-choice" :template="deliveryAvailability" :key="key" >

</delivery-availability-choice>
</template>
</div>
</div>
{# <div class="col">
{{ form_label(form.deliveryAvailabilityZoneLarge) }}
<div class="delivery-availability-large">
{% for field in form.deliveryAvailabilityZoneLarge %}
{{ form_widget(field, {"attr" : {"v-model" : 'deliveryAvailability'}}) }}
{% endfor %}
</div>
${deliveryAvailability}
</div>#}
</div>
</fieldset>
</div>

<div class="clearfix"></div>
</div>
{##}

+ 19
- 11
ShopBundle/Resources/views/backend/order/panel_orderproducts.html.twig Ver fichero

@@ -8,12 +8,12 @@
</td>
<td>
<div class="form-widget">
{% verbatim %}{{ price }}{% endverbatim %}
{% verbatim %}{{ price }}{% endverbatim %}
</div>
</td>
<td>
<div class="form-widget">
{% verbatim %}{{ priceWithTax }}{% endverbatim %}
{% verbatim %}{{ priceWithTax }}{% endverbatim %}
</div>
</td>
<td>
@@ -22,7 +22,7 @@
</div>
</td>
<td>
{% verbatim %}{{ totalWithTax }}{% endverbatim %}
{% verbatim %}{{ totalWithTax }}{% endverbatim %}
</td>
<td>
<button type="button" class="btn-remove-product btn btn-default" @click="deleteProductForm()">
@@ -63,28 +63,36 @@

<order-product-form ref="orderProductForm" :template="formProduct" :key-form="key"></order-product-form>
</template>
<tr>
<td colspan="7">

<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addOrderProductForm"><span
class="fa fa-plus"></span> Ajouter un produit
</button>
</td>
</tr>
<tr>
<td colspan="4"></td>
<td colspan="2">
<table>
<td colspan="3">
<table class="sub-table table-order-summary">
<tr>
<th>Total without Tax</th>
<td>${totalWithoutTax}</td>
<td>${totalWithoutTax}€</td>
<td ></td>
</tr>
<tr>
<th>Total</th>
<td>${totalWithTax}</td>
<td>${totalWithTax}€</td>
<td ></td>
</tr>
</table>
</td>
<td ></td>
</tr>
</tbody>
</table>

<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addOrderProductForm"><span
class="fa fa-plus"></span> Ajouter un produit
</button>

<div class="clearfix"></div>
<script>
window.orderProductForm = new Array();

Cargando…
Cancelar
Guardar