Guillaume 4 years ago
parent
commit
f3010993f0
9 changed files with 62 additions and 18 deletions
  1. +14
    -1
      ShopBundle/Controller/Admin/ProductFamilyController.php
  2. +4
    -0
      ShopBundle/Form/ProductFamilyCategoriesType.php
  3. +5
    -2
      ShopBundle/Repository/ProductCategoryRepository.php
  4. +5
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  5. +6
    -3
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  6. +5
    -2
      ShopBundle/Resources/translations/lcshop.fr.yaml
  7. +1
    -1
      ShopBundle/Resources/views/backend/default/layout.html.twig
  8. +11
    -7
      ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig
  9. +11
    -2
      ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig

+ 14
- 1
ShopBundle/Controller/Admin/ProductFamilyController.php View File

@@ -46,7 +46,9 @@ class ProductFamilyController extends AdminController

$formBuilder->add('warningMessageType', ChoiceType::class, array(
'choices' => array(
'field.default.warningMessageTypeOptions.alert' => 'alert',
'field.default.warningMessageTypeOptions.success' => 'success',
'field.default.warningMessageTypeOptions.error' => 'error',
'field.default.warningMessageTypeOptions.warning' => 'warning',
'field.default.warningMessageTypeOptions.info' => 'info'
),
'translation_domain' => 'lcshop',
@@ -67,6 +69,17 @@ class ProductFamilyController extends AdminController
'expanded' => true
));

$formBuilder->add('behaviorAddToCart', ChoiceType::class, array(
'empty_data' => 'by-product-family',
'choices' => array(
'field.ProductFamily.behaviorAddToCartOptions.simple' => 'simple',
'field.ProductFamily.behaviorAddToCartOptions.multiple' => 'multiple'
),
'translation_domain' => 'lcshop',
'multiple' => false,
'expanded' => true
));

$formBuilder->add('propertyOrganicLabel', ChoiceType::class, array(
'choices' => array(
'field.ProductFamily.organicLabelOptions.ab' => 'ab',

+ 4
- 0
ShopBundle/Form/ProductFamilyCategoriesType.php View File

@@ -37,6 +37,10 @@ class ProductFamilyCategoriesType extends AbstractType
'label' => $category->getTitle(),
'data' => $currentProductCategories->contains($category),
'required' => false,
'disabled'=>true,
'attr'=>[
'class'=>'none'
]
]);
foreach ($category->getChildrens() as $children) {
$builder->add('category_children_' . $children->getId(), CheckboxType::class, [

+ 5
- 2
ShopBundle/Repository/ProductCategoryRepository.php View File

@@ -32,9 +32,12 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit
{
$query = $this->findByMerchantQuery()
->andWhere('e.parent is NULL')
->andWhere('e.status >= 0')
->orderBy('e.position', 'ASC') ;

->andWhere('e.status = 1')
->orderBy('e.position', 'ASC');

return $query->getQuery()->getResult();

}

public function findAllByParent($parentCategory)

+ 5
- 0
ShopBundle/Resources/public/css/backend/custom.css View File

@@ -33,6 +33,7 @@ td.actions{white-space: nowrap; text-align: right;}
.form-check{padding-left: 0px;}

.form-sent .form-check-label input:invalid ~ .checkmark { border-color: #dc3545;}
.form-check-label input:disabled ~ .checkmark {display: none}
.form-check-label input ~ .checkmark { position: absolute; top: 0; left: 0; height: 18px; width: 18px; background-color: #eee;border: 1px solid var(--primary);}
.form-check-label.big input ~ .checkmark { height: 21px; width: 21px; }
.form-check-label input[type="checkbox"] ~ .checkmark {top: 2px;}
@@ -53,6 +54,10 @@ td.actions{white-space: nowrap; text-align: right;}
/* Create a custom radio button */


.product-categories .parent .form-group.field-checkbox .form-check-label{padding-left: 0px; font-style: italic;}
.product-categories .children .form-group.field-checkbox{margin-left: 20px}
.product-categories .form-group{margin-bottom: 0.5rem;}


/* Général */
.btn.btn-primary.action-save{float: right;}

+ 6
- 3
ShopBundle/Resources/public/js/backend/script/default/init-common.js View File

@@ -11,8 +11,8 @@ function initLcNoty() {


function custom_switch_merchants() {
$('#switch-merchant select').change(function () {
$('#switch-merchant form').submit();
$('#switch-merchant').on('change',function () {
$('#switch-merchant').parents('form').submit();
});
}

@@ -79,10 +79,13 @@ function setSelect2($select) {
var options = {
width: "100%",
dropdownAutoWidth: false,
allowClear: false,
allowClear: true,
minimumResultsForSearch: 8
};

if ($select.data('allow-clear') == 'false') {
options.allowClear= false;
}
if ($select.data('width')) {
options.width = 'auto'
}

+ 5
- 2
ShopBundle/Resources/translations/lcshop.fr.yaml View File

@@ -93,8 +93,10 @@ field:
note: Note interne
warningMessageType: Type de message d'avertissement
warningMessageTypeOptions:
alert: Alerte
info: Information
warning: Attention (jaune)
info: Information (bleu)
error: Erreur (rouge)
success: Succès (vert)
warningMessage: Contenu du message d'avertissement
newsletters: Newsletters
isPublic: Publique
@@ -109,6 +111,7 @@ field:
value: Valeur

ProductFamily:
taxRateInherited: Utiliser la TVA par défaut
activeProducts: Activer les déclinaisons
productsType: Type de déclinaisons
productsTypeHelp: 'Volume / Pods / Varieté / Parfum ...'

+ 1
- 1
ShopBundle/Resources/views/backend/default/layout.html.twig View File

@@ -105,7 +105,7 @@
<label for="switch-merchant"><i
class="fa fa-store"></i> {{ 'action.switchMerchant'|trans() }} :
</label>
<select id="switch-merchant" class="select2" data-width="auto" name="id_merchant">
<select id="switch-merchant" data-allow-clear="false" data-width="auto" class="select2" name="id_merchant">
{% for merchant in merchants %}
<option value="{{ merchant.id }}"
{% if current_merchant and current_merchant.id == merchant.id %}selected="selected"{% endif %}>

+ 11
- 7
ShopBundle/Resources/views/backend/productfamily/panel_general.html.twig View File

@@ -35,22 +35,26 @@
</div>
<div class="col-12" v-show="activeProducts == true">
{{ form_row(form.productsType) }}

{{ form_row(form.behaviorAddToCart) }}
</div>

{{ macros.endCard(true) }}
{{ macros.startCard(0, 'ProductFamily.categories','light') }}

<div class="col-12">
<div class="col-12 product-categories">
{% for category in categories %}
{% set child = 'category_' ~ category.id %}
<div class="parent">
{{ form_row(attribute(form.productCategories, child)) }}
</div>
{% for children in category.childrens %}
<div class="children">
{% set child = 'category_children_' ~ children.id %}
{{ form_row(attribute(form.productCategories, child), {attrs: {class: 'test'}}) }}
</div>
{% endfor %}

{% for children in category.childrens %}
<div class="children">
{% set child = 'category_children_' ~ children.id %}
{{ form_row(attribute(form.productCategories, child), {attrs: {class: 'test'}}) }}
</div>
{% endfor %}
{% endfor %}
</div>
{{ macros.endCard() }}

+ 11
- 2
ShopBundle/Resources/views/backend/productfamily/panel_price.html.twig View File

@@ -68,8 +68,17 @@
</div>
<div class="form-group field-price col-12">
<div class="row">
<div class="col-10 align-content-center">
{{ form_row(form.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'updateMultiplyingFactor'}}) }}
<div class="col-6 align-content-center">
<div class="form-widget">
{{ form_label(form.multiplyingFactor) }}
<div class="input-group">
{{ form_widget(form.multiplyingFactor, {'attr': {'v-model':'multiplyingFactor', '@change' : 'updateMultiplyingFactor'}}) }}
<div class="input-group-append">
<span class="input-group-text">X</span>
</div>
</div>
</div>

</div>
</div>
</div>

Loading…
Cancel
Save