@@ -38,21 +38,21 @@ class ProductFamilyController extends AdminController | |||
$reductionCatalogRepo = $this->em->getRepository(ReductionCatalogInterface::class); | |||
$reductionCatalogClass = $this->em->getClassMetadata(ReductionCatalogInterface::class); | |||
$reductionCatalog = $reductionCatalogRepo->findOneBy(array('status'=>false, 'productFamily'=>$entity)); | |||
$reductionCatalog = $reductionCatalogRepo->findOneBy(array('status' => false, 'productFamily' => $entity)); | |||
if($reductionCatalog == null)$reductionCatalog = new $reductionCatalogClass->name; | |||
$formBuilder->add('reductionCatalog', ReductionCatalogType::class,array( | |||
'mapped'=>false, | |||
'data'=> $reductionCatalog | |||
if ($reductionCatalog == null) $reductionCatalog = new $reductionCatalogClass->name; | |||
$formBuilder->add('reductionCatalog', ReductionCatalogType::class, array( | |||
'mapped' => false, | |||
'data' => $reductionCatalog | |||
)); | |||
$formBuilder->add('warningMessageType', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.default.warningMessageTypeOptions.'.ProductFamily::WARNING_MESSAGE_TYPE_SUCCESS => ProductFamily::WARNING_MESSAGE_TYPE_SUCCESS, | |||
'field.default.warningMessageTypeOptions.'.ProductFamily::WARNING_MESSAGE_TYPE_ERROR => ProductFamily::WARNING_MESSAGE_TYPE_ERROR, | |||
'field.default.warningMessageTypeOptions.'.ProductFamily::WARNING_MESSAGE_TYPE_WARNING => ProductFamily::WARNING_MESSAGE_TYPE_WARNING, | |||
'field.default.warningMessageTypeOptions.'.ProductFamily::WARNING_MESSAGE_TYPE_INFO => ProductFamily::WARNING_MESSAGE_TYPE_INFO | |||
'field.default.warningMessageTypeOptions.' . ProductFamily::WARNING_MESSAGE_TYPE_SUCCESS => ProductFamily::WARNING_MESSAGE_TYPE_SUCCESS, | |||
'field.default.warningMessageTypeOptions.' . ProductFamily::WARNING_MESSAGE_TYPE_ERROR => ProductFamily::WARNING_MESSAGE_TYPE_ERROR, | |||
'field.default.warningMessageTypeOptions.' . ProductFamily::WARNING_MESSAGE_TYPE_WARNING => ProductFamily::WARNING_MESSAGE_TYPE_WARNING, | |||
'field.default.warningMessageTypeOptions.' . ProductFamily::WARNING_MESSAGE_TYPE_INFO => ProductFamily::WARNING_MESSAGE_TYPE_INFO | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
@@ -76,8 +76,8 @@ class ProductFamilyController extends AdminController | |||
$formBuilder->add('behaviorAddToCart', ChoiceType::class, array( | |||
'data' => $entity->getBehaviorAddToCart() ? $entity->getBehaviorAddToCart() : 'simple', | |||
'choices' => array( | |||
'field.ProductFamily.behaviorAddToCartOptions.'.ProductFamily::BEHAVIOR_ADD_TO_CART_SIMPLE => ProductFamily::BEHAVIOR_ADD_TO_CART_SIMPLE, | |||
'field.ProductFamily.behaviorAddToCartOptions.'.ProductFamily::BEHAVIOR_ADD_TO_CART_MULTIPLE => ProductFamily::BEHAVIOR_ADD_TO_CART_MULTIPLE | |||
'field.ProductFamily.behaviorAddToCartOptions.' . ProductFamily::BEHAVIOR_ADD_TO_CART_SIMPLE => ProductFamily::BEHAVIOR_ADD_TO_CART_SIMPLE, | |||
'field.ProductFamily.behaviorAddToCartOptions.' . ProductFamily::BEHAVIOR_ADD_TO_CART_MULTIPLE => ProductFamily::BEHAVIOR_ADD_TO_CART_MULTIPLE | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
@@ -87,8 +87,8 @@ class ProductFamilyController extends AdminController | |||
$formBuilder->add('behaviorPrice', ChoiceType::class, array( | |||
'empty_data' => 'by-piece', | |||
'choices' => array( | |||
'field.ProductFamily.behaviorPriceOptions.'.ProductFamily::BEHAVIOR_PRICE_BY_PIECE => ProductFamily::BEHAVIOR_PRICE_BY_PIECE, | |||
'field.ProductFamily.behaviorPriceOptions.'.ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT => ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT | |||
'field.ProductFamily.behaviorPriceOptions.' . ProductFamily::BEHAVIOR_PRICE_BY_PIECE => ProductFamily::BEHAVIOR_PRICE_BY_PIECE, | |||
'field.ProductFamily.behaviorPriceOptions.' . ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT => ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
@@ -96,15 +96,15 @@ class ProductFamilyController extends AdminController | |||
)); | |||
$formBuilder->add('multiplyingFactor', NumberType::class, array( | |||
'mapped'=> false, | |||
'data'=> floatval($this->merchantUtils->getMerchantConfig('multiplying-factor')), | |||
'mapped' => false, | |||
'data' => floatval($this->merchantUtils->getMerchantConfig('multiplying-factor')), | |||
)); | |||
$formBuilder->add('propertyOrganicLabel', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.ProductFamily.organicLabelOptions.'.ProductFamily::PROPERTY_ORGANIC_LABEL_AB => ProductFamily::PROPERTY_ORGANIC_LABEL_AB, | |||
'field.ProductFamily.organicLabelOptions.'.ProductFamily::PROPERTY_ORGANIC_LABEL_NP => ProductFamily::PROPERTY_ORGANIC_LABEL_NP, | |||
'field.ProductFamily.organicLabelOptions.'.ProductFamily::PROPERTY_ORGANIC_LABEL_HVE => ProductFamily::PROPERTY_ORGANIC_LABEL_HVE | |||
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_AB => ProductFamily::PROPERTY_ORGANIC_LABEL_AB, | |||
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_NP => ProductFamily::PROPERTY_ORGANIC_LABEL_NP, | |||
'field.ProductFamily.organicLabelOptions.' . ProductFamily::PROPERTY_ORGANIC_LABEL_HVE => ProductFamily::PROPERTY_ORGANIC_LABEL_HVE | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
@@ -114,37 +114,37 @@ class ProductFamilyController extends AdminController | |||
$formBuilder->add('typeExpirationDate', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.default.'.ProductFamily::TYPE_EXPIRATION_DATE_DLC => ProductFamily::TYPE_EXPIRATION_DATE_DLC, | |||
'field.default.'.ProductFamily::TYPE_EXPIRATION_DATE_DDM => ProductFamily::TYPE_EXPIRATION_DATE_DDM, | |||
'field.default.'.ProductFamily::TYPE_EXPIRATION_DATE_DLUO => ProductFamily::TYPE_EXPIRATION_DATE_DLUO | |||
'field.default.' . ProductFamily::TYPE_EXPIRATION_DATE_DLC => ProductFamily::TYPE_EXPIRATION_DATE_DLC, | |||
'field.default.' . ProductFamily::TYPE_EXPIRATION_DATE_DDM => ProductFamily::TYPE_EXPIRATION_DATE_DDM, | |||
'field.default.' . ProductFamily::TYPE_EXPIRATION_DATE_DLUO => ProductFamily::TYPE_EXPIRATION_DATE_DLUO | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
'expanded' => true, | |||
'required'=>false | |||
'required' => false | |||
)); | |||
$formBuilder->add('behaviorStockWeek', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.ProductFamily.behaviorStockWeekOptions.'.ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE => ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE, | |||
'field.ProductFamily.behaviorStockWeekOptions.'.ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION => ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION, | |||
'field.ProductFamily.behaviorStockWeekOptions.'.ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE => ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE | |||
'field.ProductFamily.behaviorStockWeekOptions.' . ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE => ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE, | |||
'field.ProductFamily.behaviorStockWeekOptions.' . ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION => ProductFamily::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION, | |||
'field.ProductFamily.behaviorStockWeekOptions.' . ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE => ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
'expanded' => true, | |||
'required'=>true | |||
'required' => true | |||
)); | |||
$formBuilder->add('behaviorExpirationDate', ChoiceType::class, array( | |||
'choices' => array( | |||
'field.ProductFamily.behaviorExpirationDateOptions.'.ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY => ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | |||
'field.ProductFamily.behaviorExpirationDateOptions.'.ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT => ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT | |||
'field.ProductFamily.behaviorExpirationDateOptions.' . ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY => ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | |||
'field.ProductFamily.behaviorExpirationDateOptions.' . ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT => ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT | |||
), | |||
'translation_domain' => 'lcshop', | |||
'multiple' => false, | |||
'expanded' => true, | |||
'required'=>false | |||
'required' => false | |||
)); | |||
@@ -184,10 +184,11 @@ class ProductFamilyController extends AdminController | |||
$this->em->flush(); | |||
} | |||
protected function processReductionCatalog($entity, $editForm){ | |||
protected function processReductionCatalog($entity, $editForm) | |||
{ | |||
$reductionCatalog = $editForm->get('reductionCatalog')->getData(); | |||
if($reductionCatalog instanceof ReductionCatalogInterface ) { | |||
if($reductionCatalog->getValue() && $reductionCatalog->getBehaviorTaxRate() && $reductionCatalog->getUnit()){ | |||
if ($reductionCatalog instanceof ReductionCatalogInterface) { | |||
if ($reductionCatalog->getValue() && $reductionCatalog->getBehaviorTaxRate() && $reductionCatalog->getUnit()) { | |||
$reductionCatalog->setMerchant($entity->getMerchant()); | |||
$reductionCatalog->setStatus($editForm->get('activeReductionCatalog')->getData()); | |||
$reductionCatalog->setProductFamily($entity); | |||
@@ -196,11 +197,12 @@ class ProductFamilyController extends AdminController | |||
} | |||
} | |||
protected function processPrice($entity){ | |||
if($entity->getBehaviorPrice()=='by-piece'){ | |||
protected function processPrice($entity) | |||
{ | |||
if ($entity->getBehaviorPrice() == 'by-piece') { | |||
$entity->setPriceByRefUnit(null); | |||
$entity->setBuyingPriceByRefUnit(null); | |||
}else if($entity->getBehaviorPrice()=='by-reference-unit') { | |||
} else if ($entity->getBehaviorPrice() == 'by-reference-unit') { | |||
$entity->setPrice(null); | |||
$entity->setBuyingPrice(null); | |||
} | |||
@@ -215,7 +217,7 @@ class ProductFamilyController extends AdminController | |||
$this->em->persist($product); | |||
$entity->addProduct($product); | |||
} else { | |||
foreach ($entity->getProducts() as $i=>$product) { | |||
foreach ($entity->getProducts() as $i => $product) { | |||
$product->setProductFamily($entity); | |||
$this->em->persist($product); | |||
$entity->addProduct($product); | |||
@@ -255,24 +257,21 @@ class ProductFamilyController extends AdminController | |||
$entity = $easyadmin['item']; | |||
$orderShopRepo = $this->em->getRepository(OrderShopInterface::class); | |||
$totalProductOrdered = array(); | |||
foreach ($entity->getProducts() as $product) { | |||
$currentWeekNumber = $this->orderUtils->getWeekNumberCurrent(); | |||
//Les commandes sont ouvertes ont récupèrent les commandes en cours et celle de la semaine dernière | |||
if($this->orderUtils->isOpenSale()) { | |||
if ($this->orderUtils->isOpenSale()) { | |||
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId()); | |||
$totalProductOrdered[$product->getId()][$currentWeekNumber - 1] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber - 1, $product->getId()); | |||
}else{ | |||
} else { | |||
$totalProductOrdered[$product->getId()][$currentWeekNumber] = $orderShopRepo->countValidOrderProductsOfWeekByProduct($currentWeekNumber, $product->getId()); | |||
} | |||
} | |||
if ($this->request->isXmlHttpRequest() && $property = $this->request->query->get('property')) { | |||
$newValue = 'true' === mb_strtolower($this->request->query->get('newValue')); | |||
$fieldsMetadata = $this->entity['list']['fields']; | |||
@@ -300,11 +299,11 @@ class ProductFamilyController extends AdminController | |||
$editForm->handleRequest($this->request); | |||
if( $editForm->isSubmitted() && count($entity->getProductCategories()) == 0){ | |||
if ($editForm->isSubmitted() && count($entity->getProductCategories()) == 0) { | |||
$editForm->get('productCategories')->addError(new FormError('Vous devez choisir au moins une catégorie')); | |||
} | |||
if ($editForm->isSubmitted() && $editForm->isValid() && count($entity->getProductCategories())>0) { | |||
if ($editForm->isSubmitted() && $editForm->isValid() && count($entity->getProductCategories()) > 0) { | |||
$this->processUploadedFiles($editForm); | |||
@@ -312,7 +311,7 @@ class ProductFamilyController extends AdminController | |||
$this->executeDynamicMethod('update<EntityName>Entity', [$entity, $editForm]); | |||
$this->dispatch(EasyAdminEvents::POST_UPDATE, ['entity' => $entity]); | |||
$this->utils->addFlash('success', 'Produit sauvegardé') ; | |||
$this->utils->addFlash('success', 'Produit sauvegardé'); | |||
return $this->redirectToReferrer(); | |||
//return $this->redirectToRoute('easyadmin', ['entity' => 'ProductFamily', 'action' => 'edit', 'id' => $id]) ; | |||
@@ -349,11 +348,11 @@ class ProductFamilyController extends AdminController | |||
$newForm->handleRequest($this->request); | |||
if( $newForm->isSubmitted() && array_search(true, $newForm->get('productCategories')->getData()->toArray())===false){ | |||
if ($newForm->isSubmitted() && array_search(true, $newForm->get('productCategories')->getData()->toArray()) === false) { | |||
$newForm->get('productCategories')->addError(new FormError('Vous devez choisir au moins une catégorie')); | |||
} | |||
if ($newForm->isSubmitted() && $newForm->isValid() && array_search(true, $newForm->get('productCategories')->getData()->toArray())!==false) { | |||
if ($newForm->isSubmitted() && $newForm->isValid() && array_search(true, $newForm->get('productCategories')->getData()->toArray()) !== false) { | |||
$this->processUploadedFiles($newForm); | |||
$this->dispatch(EasyAdminEvents::PRE_PERSIST, ['entity' => $entity]); | |||
@@ -384,4 +383,7 @@ class ProductFamilyController extends AdminController | |||
return $this->executeDynamicMethod('render<EntityName>Template', ['new', $this->entity['templates']['new'], $parameters]); | |||
} | |||
} |
@@ -33,12 +33,20 @@ class ListFilterType extends AbstractType | |||
switch ($field['dataType']) { | |||
case 'integer': | |||
$builder->add($field['property'], TextType::class, array( | |||
'required' => false | |||
'required' => false, | |||
'attr'=>array( | |||
'class'=> ' input-sm', | |||
'form'=> 'filters-form' | |||
) | |||
)); | |||
break; | |||
case 'string': | |||
$builder->add($field['property'], TextType::class, array( | |||
'required' => false | |||
'required' => false, | |||
'attr'=>array( | |||
'class'=> ' input-sm', | |||
'form'=> 'filters-form' | |||
) | |||
)); | |||
break; | |||
case 'toggle': | |||
@@ -48,7 +56,11 @@ class ListFilterType extends AbstractType | |||
'Non' => 0, | |||
), | |||
'placeholder'=> '--', | |||
'required'=>false | |||
'required'=>false, | |||
'attr'=>array( | |||
'class'=> 'select2 input-sm', | |||
'form'=> 'filters-form' | |||
) | |||
)); | |||
break; | |||
case 'datetime': | |||
@@ -62,6 +74,7 @@ class ListFilterType extends AbstractType | |||
->add('dateEnd', DateType::class, array( | |||
'widget' => 'single_text', | |||
'required' => false, | |||
)) | |||
); | |||
break; | |||
@@ -79,6 +92,11 @@ class ListFilterType extends AbstractType | |||
}, | |||
'required' => false, | |||
'attr'=>array( | |||
'class'=> 'select2 input-sm', | |||
'form'=> 'filters-form' | |||
) | |||
)); | |||
break; |
@@ -21,3 +21,12 @@ function initDeleteAction() { | |||
}); | |||
}); | |||
} | |||
function initResetFilters() { | |||
$('.lc-reset-filters').on('click',function () { | |||
$(this).parents('form').find('.form-control').val('').trigger('change'); | |||
}) | |||
} |
@@ -188,3 +188,6 @@ function checkFormValidity(formId){ | |||
return true; | |||
} | |||
} | |||
function arrayRemove(arr, value) { return arr.filter(function(ele){ return ele != value; });} |
@@ -193,6 +193,8 @@ Vue.component('product-form', { | |||
}, window.productForm[this.keyForm]) | |||
}, | |||
mounted: function () { | |||
log(this.keyForm); | |||
//INIT VAR | |||
updateSortableProducts(); | |||
//this.setUnitSelect2(); | |||
@@ -248,7 +250,6 @@ Vue.component('product-form', { | |||
setFocusOnField: function (field, y) { | |||
this[field] = true; | |||
this.$nextTick(function () { | |||
log(field); | |||
if (field == 'unitInherited') { | |||
$('select[data-ref="' + field + '"]').eq(y).focus(); | |||
} else { | |||
@@ -280,11 +281,18 @@ Vue.component('product-form', { | |||
}, | |||
deleteProductForm: function () { | |||
if (confirm('Êtes-vous sur de cette action ?')) { | |||
this.$parent.formProductArray.splice(this.keyForm, 1); | |||
log(this.keyForm); | |||
log(this.$parent.formProductArray); | |||
//this.$parent.formProductArray.splice(this.keyForm, 1); | |||
//this.$delete(this.$parent.formProductArray, this.keyForm) | |||
var niche = arrayRemove(this.$parent.formProductArray, this.$parent.formProductArray[this.keyForm]); | |||
this.$parent.formProductArray = niche; | |||
} | |||
}, | |||
modalProductForm: function () { | |||
log($('#modal-extends-product-'+this.keyForm)); | |||
$('#modal-extends-product-'+this.keyForm).modal('show') | |||
}, | |||
}, | |||
@@ -482,8 +490,11 @@ $(window).bind('beforeunload', function(e){ | |||
}); | |||
$(window).on('load', function () { | |||
for (i = 0; i < window.formProductTemplate.length; i++) { | |||
appProductFamily.formProductArray.push(formProductTemplate[i]); | |||
for (var key in formProductTemplate) { | |||
log(key); | |||
//log(formProductTemplate[key]); | |||
appProductFamily.formProductArray[key] = formProductTemplate[key]; | |||
appProductFamily.indexFormProduct++; | |||
} | |||
}); |
@@ -61,6 +61,7 @@ | |||
{% macro priceField(field, fieldTax, fieldName, behaviorPriceValue) %} | |||
<div class="form-group field-price col-12" v-show="behaviorPrice == '{{ behaviorPriceValue }}'"> | |||
<div class="row"> | |||
<div class="col-12"> |
@@ -92,11 +92,13 @@ | |||
{#{{ "list.title"|trans({'%label%' : _entity_config['label']|lower }) }}#} | |||
{% if paginator.nbResultsTotal != paginator.nbResults %} | |||
<span data-toggle="tooltip" title="{{ "list.nbResultsFiltered"|trans }}" | |||
class="badge badge-info">{{ paginator.nbResults }} <i class="fa fa-search"></i> </span> | |||
class="badge badge-info">{{ paginator.nbResults }} <i | |||
class="fa fa-search"></i> </span> | |||
| | |||
{% endif %} | |||
<span data-toggle="tooltip" title="{{ "list.nbResults"|trans }}" | |||
class="badge badge-primary">{{ paginator.nbResultsTotal }} <i class="fa fa-bars"></i> </span> | |||
class="badge badge-primary">{{ paginator.nbResultsTotal }} <i | |||
class="fa fa-bars"></i> </span> | |||
{% if paginator.nbResultsOnline is defined %}<span data-toggle="tooltip" | |||
title="{{ "list.nbResultsOnline"|trans }}" | |||
class="badge badge-success">{{ paginator.nbResultsOnline }} | |||
@@ -141,82 +143,83 @@ | |||
{% endblock new_action %} | |||
{% endif %} | |||
</div> | |||
{{ form_start(filters_form) }} | |||
{% form_theme filters_form '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<input type="hidden" name="entity" value="{{ _entity_config.name }}"> | |||
<input type="hidden" name="menuIndex" value="{{ app.request.get('menuIndex') }}"> | |||
<input type="hidden" name="submenuIndex" value="{{ app.request.get('submenuIndex') }}"> | |||
<input type="hidden" name="sortField" value="{{ app.request.get('sortField', '') }}"> | |||
<input type="hidden" name="sortDirection" value="{{ app.request.get('sortDirection', 'DESC') }}"> | |||
<div class="card-body p-0"> | |||
{% block table %} | |||
<table class="table lc-table-list datagrid table-bordered table-hover table-striped "> | |||
<thead> | |||
{% block table_head %} | |||
<tr> | |||
{% if _has_batch_actions %} | |||
<th width="1px"><span><input type="checkbox" | |||
class="form-batch-checkbox-all"></span> | |||
</th> | |||
{% endif %} | |||
<table class="table lc-table-list datagrid table-bordered table-hover table-striped "> | |||
<thead> | |||
{% block table_head %} | |||
<tr> | |||
{% if _has_batch_actions %} | |||
<th width="1px"><span><input type="checkbox" class="form-batch-checkbox-all"></span> | |||
</th> | |||
{% endif %} | |||
{% for field, metadata in _fields_visible_by_user %} | |||
{% set isSortingField = (metadata.property == app.request.get('sortField')) or ('association' == metadata.type and app.request.get('sortField') starts with metadata.property ~ '.') %} | |||
{% set nextSortDirection = isSortingField ? (app.request.get('sortDirection') == 'DESC' ? 'ASC' : 'DESC') : 'DESC' %} | |||
{% set _column_label = metadata.label|trans(_trans_parameters) %} | |||
{% set _column_icon = isSortingField ? (nextSortDirection == 'DESC' ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %} | |||
<th class="{{ isSortingField ? 'sorted' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{% if metadata.sortable %} | |||
<a href="{{ path('easyadmin', _request_parameters|merge({ page: 1, sortField: metadata.property, sortDirection: nextSortDirection })) }}"> | |||
{{ _column_label|raw }} <i class="fa fa-fw {{ _column_icon }}"></i> | |||
</a> | |||
{% else %} | |||
<span>{{ _column_label|raw }}</span> | |||
{% endif %} | |||
</th> | |||
{% endfor %} | |||
{% if _list_item_actions|length > 0 %} | |||
<th {% if _entity_config.list.collapse_actions %}width="10px"{% endif %} {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
<span class="sr-only">{{ 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') }}</span> | |||
</th> | |||
{% endif %} | |||
</tr> | |||
{% endblock table_head %} | |||
{% for field, metadata in _fields_visible_by_user %} | |||
{% set isSortingField = (metadata.property == app.request.get('sortField')) or ('association' == metadata.type and app.request.get('sortField') starts with metadata.property ~ '.') %} | |||
{% set nextSortDirection = isSortingField ? (app.request.get('sortDirection') == 'DESC' ? 'ASC' : 'DESC') : 'DESC' %} | |||
{% set _column_label = metadata.label|trans(_trans_parameters) %} | |||
{% set _column_icon = isSortingField ? (nextSortDirection == 'DESC' ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %} | |||
<th class="{{ isSortingField ? 'sorted' }} {{ metadata.virtual ? 'virtual' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{% if metadata.sortable %} | |||
<a href="{{ path('easyadmin', _request_parameters|merge({ page: 1, sortField: metadata.property, sortDirection: nextSortDirection })) }}"> | |||
{{ _column_label|raw }} <i class="fa fa-fw {{ _column_icon }}"></i> | |||
</a> | |||
{% else %} | |||
<span>{{ _column_label|raw }}</span> | |||
{% endif %} | |||
</th> | |||
{% endfor %} | |||
{% if _list_item_actions|length > 0 %} | |||
<th {% if _entity_config.list.collapse_actions %}width="10px"{% endif %} {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
<span class="sr-only">{{ 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') }}</span> | |||
</th> | |||
{% endif %} | |||
</tr> | |||
{% endblock table_head %} | |||
<tr class="table-filters-line"> | |||
{% if _has_batch_actions %}<th></th>{% endif %} | |||
{% if _has_batch_actions %} | |||
<th></th>{% endif %} | |||
{% for field, metadata in _fields_visible_by_user %} | |||
<th> | |||
{% if filters_form[field] is defined %} | |||
{% if metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date' %} | |||
<div class="input-group input-group-sm"> | |||
<input type="text" class="form-control input-sm float-right date-range"> | |||
<div class="hidden date-time-range-fields" style="display: none;"> | |||
{{ form_widget(filters_form[field]['dateStart'], {"attr" : {'class' : 'date-start'}}) }} | |||
{{ form_widget(filters_form[field]['dateEnd'], {"attr" : {'class' : 'date-end'}}) }} | |||
<th> | |||
{% if filters_form[field] is defined %} | |||
{% if metadata['dataType'] == 'datetime' or metadata['dataType'] == 'date' %} | |||
<div class="input-group input-group-sm"> | |||
<input type="text" | |||
class="form-control input-sm float-right date-range"> | |||
<div class="hidden date-time-range-fields" style="display: none;"> | |||
{{ form_widget(filters_form[field]['dateStart'], {"attr" : {'class' : 'date-start', 'form': 'filters-form'}}) }} | |||
{{ form_widget(filters_form[field]['dateEnd'], {"attr" : {'class' : 'date-end', 'form': 'filters-form'}}) }} | |||
</div> | |||
</div> | |||
</div> | |||
{% else %} | |||
<div class="form-widget input-group-sm"> | |||
{{ form_widget(filters_form[field], {'attr': {'class' : 'input-sm'}}) }} | |||
</div> | |||
{% endif %} | |||
{% else %} | |||
<div class="form-widget input-group-sm"> | |||
{{ form_widget(filters_form[field]) }} | |||
</div> | |||
{% endif %} | |||
{% endif %} | |||
{% endif %} | |||
</th> | |||
</th> | |||
{% endfor %} | |||
{% if _list_item_actions|length > 0 %} | |||
<th class="actions"> | |||
<button type="submit" class="btn btn-sm btn-info" data-toggle="tooltip" title="{{ "action.apply"|trans({}, 'lcshop') }}" aria-label="{{ "action.apply"|trans({}, 'lcshop') }}"> | |||
<button type="submit" form="filters-form" class="btn btn-sm btn-info" | |||
data-toggle="tooltip" title="{{ "action.apply"|trans({}, 'lcshop') }}" | |||
aria-label="{{ "action.apply"|trans({}, 'lcshop') }}"> | |||
<i class="fa fa-search"></i> | |||
</button> | |||
{% if filters_form.vars.submitted %} | |||
<a href="{{ path('easyadmin', {action: 'list', entity: _entity_config.name}) }}" class="btn btn-sm btn-warning lc-reset-filters" data-toggle="tooltip" title="{{ "action.reset"|trans({}, 'lcshop') }}" aria-label="{{ "action.reset"|trans({}, 'lcshop') }}"> | |||
<a href="{{ path('easyadmin', {action: app.request.get('action'), entity: _entity_config.name}) }}" | |||
class="btn btn-sm btn-warning lc-reset-filters" data-toggle="tooltip" | |||
title="{{ "action.reset"|trans({}, 'lcshop') }}" | |||
aria-label="{{ "action.reset"|trans({}, 'lcshop') }}"> | |||
<i class="fa fa-eraser"></i> | |||
</a> | |||
{% endif %} | |||
@@ -226,92 +229,103 @@ | |||
{% endif %} | |||
</tr> | |||
{% block table_search %} | |||
{% endblock %} | |||
</thead> | |||
<tbody> | |||
{% block table_body %} | |||
{% for item in paginator.currentPageResults %} | |||
{% if not easyadmin_is_granted(_entity_config.list.item_permission, item) %} | |||
{% set _number_of_hidden_results = _number_of_hidden_results + 1 %} | |||
{% block table_search %} | |||
{% endblock %} | |||
</thead> | |||
<tbody> | |||
{% block table_body %} | |||
{% for item in paginator.currentPageResults %} | |||
{% if not easyadmin_is_granted(_entity_config.list.item_permission, item) %} | |||
{% set _number_of_hidden_results = _number_of_hidden_results + 1 %} | |||
{% else %} | |||
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #} | |||
{% set _item_id = '' ~ attribute(item, _entity_config.primary_key_field_name) %} | |||
<tr data-id="{{ _item_id }}"> | |||
{% if _has_batch_actions %} | |||
<td><input type="checkbox" class="form-batch-checkbox" | |||
value="{{ _item_id }}"></td> | |||
{% endif %} | |||
{% for field, metadata in _fields_visible_by_user %} | |||
{% set isSortingField = metadata.property == app.request.get('sortField') %} | |||
{% set _column_label = (metadata.label ?: field|humanize)|trans(_trans_parameters) %} | |||
<td class="{{ isSortingField ? 'sorted' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | |||
</td> | |||
{% endfor %} | |||
{% if _list_item_actions|length > 0 %} | |||
{% set _column_label = 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') %} | |||
<td class="actions"> | |||
{% block item_actions %} | |||
{% set _actions_template = _entity_config.list.collapse_actions | |||
? '@EasyAdmin/default/includes/_actions_dropdown.html.twig' | |||
: '@EasyAdmin/default/includes/_actions.html.twig' %} | |||
{{ include(_actions_template, { | |||
actions: _list_item_actions, | |||
entity_config: _entity_config, | |||
request_parameters: _request_parameters, | |||
translation_domain: _entity_config.translation_domain, | |||
trans_parameters: _trans_parameters, | |||
item_id: _item_id, | |||
item: item | |||
}, with_context = false) }} | |||
{% endblock item_actions %} | |||
</td> | |||
{% endif %} | |||
</tr> | |||
{% endif %} | |||
{% else %} | |||
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #} | |||
{% set _item_id = '' ~ attribute(item, _entity_config.primary_key_field_name) %} | |||
<tr data-id="{{ _item_id }}"> | |||
{% if _has_batch_actions %} | |||
<td><input type="checkbox" class="form-batch-checkbox" | |||
value="{{ _item_id }}"></td> | |||
{% endif %} | |||
{% for field, metadata in _fields_visible_by_user %} | |||
{% set isSortingField = metadata.property == app.request.get('sortField') %} | |||
{% set _column_label = (metadata.label ?: field|humanize)|trans(_trans_parameters) %} | |||
<td class="{{ isSortingField ? 'sorted' }} {{ metadata.dataType|lower }} {{ metadata.css_class }}" {{ easyadmin_config('design.rtl') ? 'dir="rtl"' }}> | |||
{{ easyadmin_render_field_for_list_view(_entity_config.name, item, metadata) }} | |||
</td> | |||
{% endfor %} | |||
{% if _list_item_actions|length > 0 %} | |||
{% set _column_label = 'list.row_actions'|trans(_trans_parameters, 'EasyAdminBundle') %} | |||
<td class="actions"> | |||
{% block item_actions %} | |||
{% set _actions_template = _entity_config.list.collapse_actions | |||
? '@EasyAdmin/default/includes/_actions_dropdown.html.twig' | |||
: '@EasyAdmin/default/includes/_actions.html.twig' %} | |||
{{ include(_actions_template, { | |||
actions: _list_item_actions, | |||
entity_config: _entity_config, | |||
request_parameters: _request_parameters, | |||
translation_domain: _entity_config.translation_domain, | |||
trans_parameters: _trans_parameters, | |||
item_id: _item_id, | |||
item: item | |||
}, with_context = false) }} | |||
{% endblock item_actions %} | |||
</td> | |||
{% endif %} | |||
<tr> | |||
<td class="no-results" colspan="{{ _fields_visible_by_user|length + 1 }}"> | |||
{{ 'search.no_results'|trans(_trans_parameters, 'EasyAdminBundle') }} | |||
</td> | |||
</tr> | |||
{% endif %} | |||
{% else %} | |||
<tr> | |||
<td class="no-results" colspan="{{ _fields_visible_by_user|length + 1 }}"> | |||
{{ 'search.no_results'|trans(_trans_parameters, 'EasyAdminBundle') }} | |||
</td> | |||
</tr> | |||
{% endfor %} | |||
{% endfor %} | |||
{% if _number_of_hidden_results > 0 %} | |||
<tr class="datagrid-row-empty"> | |||
<td class="text-center" colspan="{{ _fields_visible_by_user|length + 1 }}"> | |||
{% if _number_of_hidden_results > 0 %} | |||
<tr class="datagrid-row-empty"> | |||
<td class="text-center" colspan="{{ _fields_visible_by_user|length + 1 }}"> | |||
<span class="datagrid-row-empty-message"><i | |||
class="fa fa-lock mr-1"></i> {{ 'security.list.hidden_results'|trans({}, 'EasyAdminBundle') }}</span> | |||
</td> | |||
</tr> | |||
{% endif %} | |||
{% endblock table_body %} | |||
</tbody> | |||
</table> | |||
{{ form_end(filters_form) }} | |||
{% block delete_form %} | |||
{% set referer = paginator.currentPage == paginator.nbPages and 1 != paginator.currentPage and 1 == paginator.currentPageResults|length | |||
? path('easyadmin', app.request.query|merge({ page: app.request.query.get('page') - 1 })) | |||
: app.request.requestUri %} | |||
{{ include('@EasyAdmin/default/includes/_delete_form.html.twig', { | |||
view: 'list', | |||
referer: referer, | |||
delete_form: delete_form_template, | |||
_translation_domain: _entity_config.translation_domain, | |||
_trans_parameters: _trans_parameters, | |||
_entity_config: _entity_config, | |||
}, with_context = false) }} | |||
{% endblock delete_form %} | |||
</td> | |||
</tr> | |||
{% endif %} | |||
{% endblock table_body %} | |||
</tbody> | |||
</table> | |||
{{ form_start(filters_form, {'attr' :{'id' : 'filters-form'}}) }} | |||
{% form_theme filters_form '@LcShop/backend/form/custom_bootstrap_4.html.twig' %} | |||
<input type="hidden" name="entity" value="{{ _entity_config.name }}"> | |||
<input type="hidden" name="menuIndex" value="{{ app.request.get('menuIndex') }}"> | |||
<input type="hidden" name="submenuIndex" value="{{ app.request.get('submenuIndex') }}"> | |||
<input type="hidden" name="sortField" value="{{ app.request.get('sortField', '') }}"> | |||
<input type="hidden" name="sortDirection" | |||
value="{{ app.request.get('sortDirection', 'DESC') }}"> | |||
<input type="hidden" name="action" value="{{ app.request.get('action') }}"> | |||
{{ form_end(filters_form) }} | |||
{% block delete_form %} | |||
{% set referer = paginator.currentPage == paginator.nbPages and 1 != paginator.currentPage and 1 == paginator.currentPageResults|length | |||
? path('easyadmin', app.request.query|merge({ page: app.request.query.get('page') - 1 })) | |||
: app.request.requestUri %} | |||
{{ include('@EasyAdmin/default/includes/_delete_form.html.twig', { | |||
view: 'list', | |||
referer: referer, | |||
delete_form: delete_form_template, | |||
_translation_domain: _entity_config.translation_domain, | |||
_trans_parameters: _trans_parameters, | |||
_entity_config: _entity_config, | |||
}, with_context = false) }} | |||
{% endblock delete_form %} | |||
{% endblock table %} | |||
</div> | |||
</div> | |||
</div> | |||
@@ -321,22 +335,23 @@ | |||
{% block content_footer %} | |||
<div class="container-fluid"> | |||
{% block paginator %} | |||
{{ include(_entity_config.templates.paginator) }} | |||
{% endblock paginator %} | |||
{% block paginator %} | |||
{{ include(_entity_config.templates.paginator) }} | |||
{% endblock paginator %} | |||
</div> | |||
{% endblock %} | |||
{% block head_stylesheets %} | |||
{{ parent() }} | |||
<link rel="stylesheet" href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/daterange/daterangepicker.css') }}"> | |||
<link rel="stylesheet" | |||
href="{{ asset('bundles/lcshop/css/backend/adminlte/plugins/daterange/daterangepicker.css') }}"> | |||
{% endblock %} | |||
{% block plugin_javascript %} | |||
{{ parent() }} | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/moment.min.js')}}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/daterangepicker.js')}}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/moment.min.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/daterange/daterangepicker.js') }}"></script> | |||
<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/jquery.highlight.js') }}"></script> | |||
{#<script src="{{ asset('bundles/lcshop/js/backend/plugin/datatables/responsive.bootstrap4.min.js') }}"></script>#} | |||
{% endblock %} |
@@ -0,0 +1,328 @@ | |||
{% extends '@LcShop/backend/default/list.html.twig' %} | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %} | |||
{% block table %} | |||
<script> | |||
window.mixinUnitValues = { | |||
unitsList: {{ getUnitsList()|json_encode|raw }} | |||
}; | |||
window.mixinPriceValues = { | |||
taxRatesList: {{ getTaxRatesList()|json_encode|raw }} | |||
}; | |||
window.appProductFamilyValues = {}; | |||
window.productUnitPriceValues = {}; | |||
</script> | |||
<ul id="product-family-advanced-types-list"> | |||
{% for i,advancedType in advancedTypes %} | |||
{% set formValues = advancedType.vars.value %} | |||
{% set productFamily = paginator.currentPageResults[i] %} | |||
<script> | |||
window.appProductFamilyValues[{{ i }}] = { | |||
title: "{{ productFamily.title }}", | |||
behaviorCountStock: "{{ productFamily.behaviorCountStock }}", | |||
behaviorStockWeek: "{{ productFamily.behaviorStockWeek }}", | |||
availableQuantity: "{{ productFamily.availableQuantity }}", | |||
availableQuantityDefault: "{{ productFamily.availableQuantityDefault }}", | |||
{% if productFamily.propertyNoveltyExpirationDate %}propertyNoveltyExpirationDate: {{ productFamily.propertyNoveltyExpirationDate }},{% endif %} | |||
typeExpirationDate: "{{ productFamily.typeExpirationDate }}", | |||
behaviorExpirationDate: "{{ productFamily.behaviorExpirationDate }}", | |||
propertyExpirationDate: "{{ productFamily.propertyExpirationDate }}", | |||
{% if productFamily.activeProducts %}activeProducts: {{ productFamily.activeProducts }},{% endif %} | |||
}; | |||
window.productUnitPriceValues[{{ i }}] = { | |||
{% if productFamily.activeProducts %}activeProducts: {{ productFamily.activeProducts }},{% endif %} | |||
behaviorPrice: "{{ productFamily.behaviorPrice }}", | |||
unit: parseInt({{ productFamily.unit.id }}), | |||
{% if productFamily.taxRate %}taxRate: parseInt({{ productFamily.taxRate.id }}),{% endif %} | |||
{% if productFamily.supplierTaxRate %}supplierTaxRate: parseInt({{ productFamily.supplierTaxRate.id }}),{% endif %} | |||
quantity: "{{ productFamily.quantity }}", | |||
price: parseFloat({{ productFamily.price }}).toFixed(3), | |||
priceByRefUnit: parseFloat({{ productFamily.priceByRefUnit }}).toFixed(3), | |||
buyingPrice: parseFloat({{ productFamily.buyingPrice }}).toFixed(3), | |||
buyingPriceByRefUnit: parseFloat({{ productFamily.buyingPriceByRefUnit }}).toFixed(3), | |||
} | |||
</script> | |||
<li class="product-family-advanced-type-item"> | |||
<div id="product-family-advanced-type-{{ i }}" class="product-family-advanced-type"> | |||
{{ form_start(advancedType, {"attr": {"ref": 'advanced-type'}}) }} | |||
<product-unit-price ref="productUnitPrice" inline-template key-form="productfamily"> | |||
<div class="row"> | |||
{{ form_row(advancedType.unit, {"attr":{'v-model': 'unit', '@change': "unitUpdated"}}) }} | |||
<div class="input-group"> | |||
{{ form_widget(advancedType.quantity, {'attr' : {'v-model': 'quantity', '@change': "quantityUpdated"}}) }} | |||
<div class="input-group-append"> | |||
<span class="input-group-text">${ unitWording }</span> | |||
</div> | |||
</div> | |||
{{ macros.priceField(advancedType.buyingPrice, advancedType.buyingPriceWithTax, 'buyingPrice', 'by-piece') }} | |||
{{ macros.priceField(advancedType.buyingPriceByRefUnit, advancedType.buyingPriceByRefUnitWithTax, 'buyingPriceByRefUnit', 'by-reference-unit') }} | |||
<div class="input-group"> | |||
{{ form_widget(advancedType.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'multiplyingFactorUpdated'}}) }} | |||
<div class="input-group-append"> | |||
<span class="input-group-text">X</span> | |||
</div> | |||
</div> | |||
{{ macros.priceField(advancedType.price, advancedType.priceWithTax, 'price', 'by-piece') }} | |||
{{ macros.priceField(advancedType.priceByRefUnit, advancedType.priceByRefUnitWithTax, 'priceByRefUnit', 'by-reference-unit') }} | |||
</div> | |||
</product-unit-price> | |||
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %} | |||
{% import '@LcShop/backend/productfamily/macros.html.twig' as product_family_macros %} | |||
{% trans_default_domain 'lcshop' %} | |||
{#{% import _self as formMacros %}#} | |||
<div class="row"> | |||
{{ macros.startCard(12, 'ProductFamily.products', 'light', true) }} | |||
<table class="table datagrid sortable lc-sortable-products products-collection-table" | |||
:data-index="formProductArray.length" | |||
data-prototype="{{ product_family_macros.product_row(form.products.vars.prototype)|e('html_attr') }}"> | |||
<thead> | |||
<tr> | |||
<th> | |||
</th> | |||
<th colspan="4" class="string"> | |||
Titre | |||
</th> | |||
<th colspan="2" class="string "> | |||
Quantité | |||
</th> | |||
<th colspan="2" class="quantity"> | |||
Unité | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class="buyingPriceByRefUnit"> | |||
PA HT / ${ getUnitReference() } | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class="priceByRefUnit"> | |||
PA TTC / ${ getUnitReference() } | |||
</th> | |||
<th colspan="3" class="price" | |||
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> | |||
PA HT | |||
</th> | |||
<th colspan="3" class="price"> | |||
PA TTC | |||
</th> | |||
<th colspan="3" class=""> | |||
Coef | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class=""> | |||
PV HT / ${ getUnitReference() } | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class="price"> | |||
PV TTC / ${ getUnitReference() } | |||
</th> | |||
<th colspan="3" class="price" | |||
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> | |||
PV HT | |||
</th> | |||
<th colspan="3" class="price"> | |||
PV TTC | |||
</th> | |||
<th colspan="2"> | |||
Marge HT | |||
</th> | |||
<th colspan="2" class="" | |||
v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'"> | |||
<span style="text-transform: uppercase"> ${typeExpirationDate}</span> | |||
</th> | |||
<th colspan="2" | |||
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'"> | |||
Stock | |||
</th> | |||
<th colspan="2" | |||
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'"> | |||
Stock par défaut | |||
</th> | |||
<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') }}'"> | |||
Semaine / Commandés | |||
</th> | |||
<th colspan="2" class=""> | |||
Action | |||
</th> | |||
</tr> | |||
</thead> | |||
<tbody class="products-collection"> | |||
<template v-for="(formProduct, key) in formProductArray"> | |||
<product-form ref="productForm" v-bind:product-family="productFamily" :template="formProduct" | |||
:key-form="key"></product-form> | |||
</template> | |||
</tbody> | |||
<tfoot> | |||
<th> | |||
Rappel | |||
</th> | |||
<th colspan="4" class="string"> | |||
${title} | |||
</th> | |||
<th colspan="2" class="string "> | |||
${productFamily.quantity} | |||
</th> | |||
<th colspan="2" class="quantity"> | |||
${productFamily.unitWording} | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class="buyingPriceByRefUnit"> | |||
${productFamily.buyingPriceByRefUnit} | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class="priceByRefUnit"> | |||
${productFamily.buyingPriceByRefUnitWithTax} | |||
</th> | |||
<th colspan="3" class="price" | |||
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> | |||
${productFamily.buyingPrice} | |||
</th> | |||
<th colspan="3" class="price"> | |||
${productFamily.buyingPriceWithTax} | |||
</th> | |||
<th colspan="3" class=""> | |||
${productFamily.multiplyingFactor} | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class=""> | |||
${productFamily.priceByRefUnit} | |||
</th> | |||
<th v-show="getBehaviorPrice() == '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_REFERENCE_UNIT') }}'" | |||
colspan="3" class="price"> | |||
${productFamily.priceByRefUnitWithTax} | |||
</th> | |||
<th colspan="3" class="price" | |||
v-show="getBehaviorPrice() =='{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_PRICE_BY_PIECE') }}'"> | |||
${productFamily.price} | |||
</th> | |||
<th colspan="3" class="price"> | |||
${productFamily.priceWithTax} | |||
</th> | |||
<th colspan="2" class="price"> | |||
${productFamily.marginProfit}€<br /> | |||
${productFamily.marginProfitPercent}% | |||
</td> | |||
<th colspan="2" class="" | |||
v-show="behaviorExpirationDate== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT') }}'"> | |||
${propertyExpirationDate} | |||
</th> | |||
<th colspan="2" | |||
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}'"> | |||
</th> | |||
<th colspan="2" | |||
v-show="behaviorCountStock== '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT') }}' && behaviorStockWeek!= '{{ constant('Lc\\ShopBundle\\Model\\ProductFamily::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE') }}'"> | |||
</th> | |||
<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="2" class=""> | |||
</th> | |||
</tfoot> | |||
</table> | |||
<button type="button" class="add_tag_link btn-add-product btn btn-default" @click="addProductForm"><span | |||
class="fa fa-plus"></span> Ajouter une déclinaison | |||
</button> | |||
<p> | |||
<strong>Aide à l'utilisation - Raccourci clavier</strong> | |||
<ul> | |||
<li><strong>TAB</strong> : Champ suivant</li> | |||
<li><strong>SHIFT + TAB</strong> : Champ précédent</li> | |||
<li><strong>FLÈCHE BAS</strong> : Déclinaison suivante</li> | |||
<li><strong>FLÈCHE HAUT</strong> : Déclinaison précédente</li> | |||
<li><strong>SHIFT + [+]</strong> : Ajout d'une nouvelle déclinaison</li> | |||
</ul> | |||
</p> | |||
<div class="clearfix"></div> | |||
{{ macros.endCard() }} | |||
</div> | |||
{% do form.products.setRendered %} | |||
<script> | |||
window.productForm = new Array(); | |||
window.formProductTemplate = new Array(); | |||
{% for keyForm,i in sortableProductsField %} | |||
{% set product = form.products[i] %} | |||
window.productForm[{{ i }}][{{ keyForm }}] = { | |||
{% if product.vars.value.title %}title: "{{ product.vars.value.title }}",{% endif %} | |||
{% if product.vars.value.quantity %}quantity: "{{ product.vars.value.quantity }}",{% endif %} | |||
{% if product.vars.value.unit %}unit: {{ product.vars.value.unit.id }},{% endif %} | |||
{% if product.vars.value.buyingPrice %}buyingPrice: parseFloat({{ product.vars.value.buyingPrice }}).toFixed(3),{% endif %} | |||
{% if product.vars.value.buyingPriceByRefUnit %}buyingPriceByRefUnit: parseFloat({{ product.vars.value.buyingPriceByRefUnit }}).toFixed(3),{% endif %} | |||
{% if product.vars.value.price %}price: parseFloat({{ product.vars.value.price }}).toFixed(3),{% endif %} | |||
{% if product.vars.value.priceByRefUnit %}priceByRefUnit: parseFloat({{ product.vars.value.priceByRefUnit }}).toFixed(3),{% 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.propertyExpirationDate %}propertyExpirationDate: "{{ product.vars.value.propertyExpirationDate }}",{% 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 }}'; | |||
{% endfor %} | |||
</script> | |||
{{ form_end(advancedType) }} | |||
</div> | |||
</li> | |||
{% endfor %} | |||
</ul> | |||
{% endblock table %} | |||
{% block head_stylesheets %} | |||
{{ parent() }} | |||
{% endblock %} | |||
{% block plugin_javascript %} | |||
{{ parent() }} | |||
{% endblock %} | |||
{% block script_javascript %} | |||
{{ parent() }} | |||
{% include '@LcShop/backend/default/block/script-vuejs.html.twig' %} | |||
<script src="{{ asset('assets/js/backend/script/productfamily/vuejs-advanced-edition-product-family.js') }}"></script> | |||
{% endblock %} |
@@ -87,10 +87,10 @@ | |||
</thead> | |||
<tbody class="products-collection"> | |||
<template v-for="(formProduct, key) in formProductArray"> | |||
<template v-for="(formProduct, blop) in formProductArray" > | |||
<product-form ref="productForm" v-bind:product-family="productFamily" :template="formProduct" | |||
:key-form="key"></product-form> | |||
v-bind:key-form="blop"></product-form> | |||
</template> | |||
</tbody> |