Sfoglia il codice sorgente

ReductionCatalog Model & Controller

reduction
Fab 4 anni fa
parent
commit
dcea97df97
20 ha cambiato i file con 291 aggiunte e 162 eliminazioni
  1. +8
    -0
      ShopBundle/Context/ReductionInterface.php
  2. +9
    -5
      ShopBundle/Controller/Admin/ProductFamilyController.php
  3. +2
    -6
      ShopBundle/Form/AddressType.php
  4. +58
    -0
      ShopBundle/Form/ReductionCatalogType.php
  5. +57
    -10
      ShopBundle/Model/PriceTrait.php
  6. +7
    -32
      ShopBundle/Model/ProductFamily.php
  7. +5
    -5
      ShopBundle/Model/ReductionCatalog.php
  8. +17
    -0
      ShopBundle/Model/ReductionTrait.php
  9. +7
    -38
      ShopBundle/Repository/ProductFamilyRepository.php
  10. +11
    -5
      ShopBundle/Repository/ReductionCatalogRepository.php
  11. +2
    -0
      ShopBundle/Resources/public/css/backend/custom.css
  12. +15
    -29
      ShopBundle/Resources/public/js/backend/script/default/init-common.js
  13. +6
    -6
      ShopBundle/Resources/public/js/backend/script/reductioncatalog/vuejs-reduction-catalog.js
  14. +7
    -6
      ShopBundle/Resources/translations/lcshop.fr.yaml
  15. +0
    -1
      ShopBundle/Resources/views/backend/default/edit.html.twig
  16. +4
    -1
      ShopBundle/Resources/views/backend/default/layout.html.twig
  17. +1
    -1
      ShopBundle/Resources/views/backend/default/list.html.twig
  18. +0
    -1
      ShopBundle/Resources/views/backend/default/new.html.twig
  19. +56
    -0
      ShopBundle/Resources/views/backend/page/login.html.twig
  20. +19
    -16
      ShopBundle/Resources/views/backend/reductioncatalog/form.html.twig

+ 8
- 0
ShopBundle/Context/ReductionInterface.php Vedi File

@@ -4,4 +4,12 @@ namespace Lc\ShopBundle\Context;

interface ReductionInterface
{
/**
* Retourne le merchant courant en fonction du user ou du cookie du visitor
*
* @return MerchantInterface
*/
public function getUnit();
public function getValue();
public function getBehaviorTaxRate();
}

+ 9
- 5
ShopBundle/Controller/Admin/ProductFamilyController.php Vedi File

@@ -13,6 +13,7 @@ use Lc\ShopBundle\Context\TaxRateInterface;
use Lc\ShopBundle\Context\UnitInterface;
use Lc\ShopBundle\Form\ProductFamilyCategoriesType;
use Lc\ShopBundle\Form\ProductType;
use Lc\ShopBundle\Form\ReductionCatalogType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -36,6 +37,7 @@ class ProductFamilyController extends AdminController
$this->taxRateClass = $this->em->getClassMetadata(TaxRateInterface::class);

$formBuilder->add('productCategories', ProductFamilyCategoriesType::class);
//$formBuilder->add('reductionCatalog', ReductionCatalogType::class);

/*$formBuilder->add('taxRate', EntityType::class, array(
'class' => $this->em->getClassMetadata(TaxRateInterface::class)->name,
@@ -146,16 +148,22 @@ class ProductFamilyController extends AdminController
$entity->setUnit($repo->find($unitId));
}

//$reductionCatalogInfo = $productFamilyRequest['reductionCatalog'];



$this->processCategories($entity);
$this->processProducts($entity);

/* dump($reductionCatalog);
dump($productFamilyRequest);*/
die();

parent::updateEntity($entity);
}

public function persistEntity($entity)
{

$this->processCategories($entity);
$this->processProducts($entity);

@@ -167,8 +175,6 @@ class ProductFamilyController extends AdminController
//si il existe un et un seul produit pour ce product family n'ajoute rien supprime rien
if (count($entity->getProducts()) == 0) {
$product = new Product();
$product->setCreatedBy($this->getUser());
$product->setUpdatedBy($this->getUser());
$product->setProductFamily($entity);
$this->em->persist($product);

@@ -177,8 +183,6 @@ class ProductFamilyController extends AdminController

foreach ($entity->getProducts() as $product) {
$product->setProductFamily($entity);
$product->setCreatedBy($this->getUser());
$product->setUpdatedBy($this->getUser());
$this->em->persist($product);
$entity->addProduct($product);


+ 2
- 6
ShopBundle/Form/AddressType.php Vedi File

@@ -16,12 +16,10 @@ use Symfony\Component\Validator\Constraints\NotBlank;
class AddressType extends AbstractType
{
protected $em;
protected $security;

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

public function buildForm(FormBuilderInterface $builder, array $options)
@@ -61,9 +59,7 @@ class AddressType extends AbstractType
{
$resolver->setDefaults([
'label' => false,
'data_class' => $this->em->getClassMetadata(AddressInterface::class)->getName(),
'createdBy' => $this->security->getUser(),
'updatedBy' => $this->security->getUser(),
'data_class' => $this->em->getClassMetadata(AddressInterface::class)->getName()
]);
}
}

+ 58
- 0
ShopBundle/Form/ReductionCatalogType.php Vedi File

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

namespace Lc\ShopBundle\Form;

use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;


class ReductionCatalogType extends AbstractType
{
protected $em;

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

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title', TextType::class, ['label' => 'Titre'])
->add('behaviorTaxRate', ChoiceType::class, [
'required'=> true,
'choices' => [
'field.default.taxIncluded'=> 'tax-included',
'field.default.taxExcluded'=> 'tax-excluded'
]
])
->add('unit', ChoiceType::class, [
'required'=> true,
'choices' => [
'field.default.percent'=> 'percent',
'field.default.amount'=> 'amount'
]
])

->add('value', NumberType::class, ['required' => true])
->add('permanent', CheckboxType::class, ['required' => true])
->add('dateStart', DateTimeType::class, ['widget' => 'single_text'])
->add('dateEnd', DateTimeType::class, ['widget' => 'single_text']);
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'label' => false,
'data_class' => $this->em->getClassMetadata(ReductionCatalogInterface::class)->getName()
]);
}
}

+ 57
- 10
ShopBundle/Model/PriceTrait.php Vedi File

@@ -1,7 +1,8 @@
<?php

namespace Lc\ShopBundle\Model ;
namespace Lc\ShopBundle\Model;

use Lc\ShopBundle\Context\ReductionInterface;
use Lc\ShopBundle\Context\UnitInterface;

trait PriceTrait
@@ -30,32 +31,65 @@ trait PriceTrait

public function getPriceInherited(): ?float
{
return $this->getPrice() ;
return $this->getPrice();
}

public function getUnitInherited(): ?Unit
{
return $this->getUnit() ;
return $this->getUnit();
}

public function getTaxRateInherited(): ?TaxRate
{
return $this->getTaxRate() ;
return $this->getTaxRate();
}

public function getPriceWithTax(): ?float
{
return $this->calculatePriceWithTax($this->getPriceInherited(), $this->getTaxRateInherited()->getValue()) ;
return $this->calculatePriceWithTax($this->getPriceInherited(), $this->getTaxRateInherited()->getValue());
}

public function getPriceByUnitRef(): ?float
{
return ($this->getPriceInherited() * $this->getUnitInherited()->getCoefficient()) / $this->getQuantityInherited() ;
return ($this->getPriceInherited() * $this->getUnitInherited()->getCoefficient()) / $this->getQuantityInherited();
}

public function getPriceByUnitRefWithTax(): ?float
{
return $this->calculatePriceWithTax($this->getPriceByUnitRef(), $this->getTaxRateInherited()->getValue()) ;
return $this->calculatePriceWithTax($this->getPriceByUnitRef(), $this->getTaxRateInherited()->getValue());
}


public function getPriceWithTaxAndReduction(): ?float
{
if ($this->reductionCatalog) {
return $this->getPriceWithTaxAndReductionCatalog($this->reductionCatalog);
} else {
return null;
}
}

public function getPriceWithTaxAndReductionCatalog(ReductionInterface $reductionCatalog): ?float
{

if ($reductionCatalog->getUnit() == 'percent') {
//Théoriquement que la réduction s'applique sur le prixHT ou le prixTTC le résultat est le même,j'ai laisser mon code au cas où ;)
return $this->calculatePriceWithReductionPercent($this->getPriceWithTax(), $reductionCatalog->getValue());
/*if ($reductionCatalog->getBehaviorTaxRate() == 'tax-excluded') {
$priceReductionHT = $this->calculatePriceWithReductionPercent($this->getPriceInherited(), $reductionCatalog->getValue());
return $this->calculatePriceWithTax($priceReductionHT, $this->getTaxRateInherited()->getValue());
} else if ($reductionCatalog->getBehaviorTaxRate() == 'tax-included') {

return $this->calculatePriceWithReductionPercent($this->getPriceWithTax(), $reductionCatalog->getValue());
}*/
}elseif ($reductionCatalog->getUnit() == 'amount') {
if ($reductionCatalog->getBehaviorTaxRate() == 'tax-excluded') {
$priceReductionHT = $this->calculatePriceWithReductionAmount($this->getPriceInherited(), $reductionCatalog->getValue());
return $this->calculatePriceWithTax($priceReductionHT, $this->getTaxRateInherited()->getValue());
}else if ($reductionCatalog->getBehaviorTaxRate() == 'tax-included') {
return $this->calculatePriceWithReductionAmount($this->getPriceWithTax(), $reductionCatalog->getValue());
}
}
}

public function setPrice(float $price): self
@@ -91,8 +125,21 @@ trait PriceTrait

private function calculatePriceWithTax($priceWithoutTax, $taxRateValue): ?float
{
$price = floatval($priceWithoutTax) * ($taxRateValue/100 + 1) ;
$price = round(( ($price * 100)) / 100, 2) ;
return $price ;
$price = floatval($priceWithoutTax) * ($taxRateValue / 100 + 1);
$price = round((($price * 100)) / 100, 2);
return $price;
}

public function calculatePriceWithReductionPercent($price, $percentValue): ?float
{
$price = floatval($price) * (1 - $percentValue / 100);
$price = round((($price * 100)) / 100, 2);
return $price;
}
public function calculatePriceWithReductionAmount($price, $amountValue): ?float
{
$price = floatval($price) - $amountValue;
$price = round((($price * 100)) / 100, 2);
return $price;
}
}

+ 7
- 32
ShopBundle/Model/ProductFamily.php Vedi File

@@ -19,7 +19,8 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
{
use ProductPropertyTrait;


//Champ hydraté par ProductFamilyUtils
protected $reductionCatalog;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
@@ -32,11 +33,6 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
*/
protected $productCategories;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ReductionCatalogInterface", mappedBy="reductionCatalogs")
*/
protected $reductionCatalogs;

/**
* @ORM\Column(type="boolean")
*/
@@ -128,8 +124,7 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
protected $behaviorAddToCart;


//Champ hydraté par ProductFamilyUtils
public $reductionCatalog;


public function __construct()
{
@@ -219,37 +214,17 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
return $this;
}

/**
* @return Collection|ReductionCatalog[]
*/
public function getReductionCatalogs(): Collection
{
return $this->reductionCatalogs;
}

public function initReductionCatalogs()
{
$this->reductionCatalogs = new ArrayCollection();
}

public function addReductionCatalog(ReductionCatalog $reductionCatalog): self
public function getReductionCatalog(): ?ReductionCatalog
{
if (!$this->reductionCatalogs->contains($reductionCatalog)) {
$this->reductionCatalogs[] = $reductionCatalog;
}

return $this;
return $this->reductionCatalog;
}

public function removeReductionCatalog(ReductionCatalog $reductionCatalog): self
public function setReductionCatalog(?ReductionCatalog $reductionCatalog): self
{
if ($this->reductionCatalogs->contains($reductionCatalog)) {
$this->reductionCatalogs->removeElement($reductionCatalog);
}
$this->reductionCatalog = $reductionCatalog;

return $this;
}

/**
* @return Collection|ProductCategory[]
*/

+ 5
- 5
ShopBundle/Model/ReductionCatalog.php Vedi File

@@ -24,7 +24,7 @@ abstract class ReductionCatalog extends AbstractDocumentEntity implements Reduct
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", inversedBy="reductionCatalogs")
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface")
*/
protected $productFamilies;

@@ -43,10 +43,10 @@ abstract class ReductionCatalog extends AbstractDocumentEntity implements Reduct
*/
protected $users;

/**
/*
* @ORM\Column(type="smallint")
*/
protected $fromQuantity = 1;
// protected $fromQuantity = 1;


public function __construct()
@@ -175,7 +175,7 @@ abstract class ReductionCatalog extends AbstractDocumentEntity implements Reduct
return $this;
}

public function getFromQuantity(): ?int
/*public function getFromQuantity(): ?int
{
return $this->fromQuantity;
}
@@ -185,6 +185,6 @@ abstract class ReductionCatalog extends AbstractDocumentEntity implements Reduct
$this->fromQuantity = $fromQuantity;

return $this;
}
}*/

}

+ 17
- 0
ShopBundle/Model/ReductionTrait.php Vedi File

@@ -33,6 +33,12 @@ trait ReductionTrait
*/
protected $behaviorTaxRate;

/**
* @ORM\Column(type="boolean")
*/
protected $permanent;



public function getDateStart(): ?\DateTimeInterface
{
@@ -94,5 +100,16 @@ trait ReductionTrait
return $this;
}

public function getPermanent(): ?bool
{
return $this->permanent;
}

public function setPermanent(bool $permanent): self
{
$this->permanent = $permanent;

return $this;
}

}

+ 7
- 38
ShopBundle/Repository/ProductFamilyRepository.php Vedi File

@@ -54,7 +54,7 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor

}

public function getProductFamiliesByNovelties(){
public function getProductFamiliesNovelties(){
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.status = 1');
$query->andWhere(':now <= e.propertyNoveltyExpirationDate')
@@ -63,52 +63,21 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
return $query->getQuery()->getResult() ;
}





/**************************** OLD *********************************/

public function findNovelties()
{

public function getProductFamiliesLargeVolumes(){
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.status = 1');
$query->andWhere('e.propertyLargeVolume = 1');

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

public function findNoveltiesByParentCategories()
{
return $this->_productsByParentCategories($this->findNovelties()) ;
}

public function findOrganics()
{
public function getProductFamiliesOrganics(){
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.status = 1');
$query->andWhere('e.propertyOrganicLabel IS NOT NULL');

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

public function findOrganicsByParentCategories()
{
return $this->_productsByParentCategories($this->findOrganics()) ;
}

public function _productsByParentCategories($products)
{
$categoriesArray = [] ;
foreach($products as $product) {
$productCategories = $product->getProductCategories() ;
$category = $productCategories[0]->getParentCategory() ;
if(!isset($categoriesArray[$category->getId()])) {
$categoriesArray[$category->getId()] = [
'category' => $category,
'products' => []
] ;
}
$categoriesArray[$category->getId()]['products'][] = $product ;
}

return $categoriesArray;
}
}

+ 11
- 5
ShopBundle/Repository/ReductionCatalogRepository.php Vedi File

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Repository;

use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\ReductionCatalogInterface;
use Symfony\Component\Validator\Constraints\DateTime;

/**
* @method ReductionCatalogInterface|null find($id, $lockMode = null, $lockVersion = null)
@@ -44,20 +45,25 @@ class ReductionCatalogRepository extends BaseRepository implements DefaultReposi

public function getReductionCatalogByProductFamilyConditions($productFamilyIds, $user)
{
dump($user);

$query = $this->findByMerchantQuery();
$query->andWhere('e.status = 1');
$query->andWhere(':user MEMBER OF e.users OR e.users is empty');
$query->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty');
$query->andWhere('e.permanent = 1 OR (e.dateStart <= :now AND e.dateEnd >= :now)');
if($user){
$query->andWhere(':user MEMBER OF e.users OR e.users is empty');
$query->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty');
$query->setParameter('user', $user);
$query->setParameter('groupUser', $user->getGroupUsers());
}

$query->andWhere(':productFamily MEMBER OF e.productFamilies OR e.productFamilies is empty');
$query->andWhere(':productCategory MEMBER OF e.productCategories OR e.productCategories is empty');
$query->andWhere(':supplier MEMBER OF e.suppliers OR e.suppliers is empty');
$query->setParameter('user', $user);
$query->setParameter('groupUser', $user->getGroupUsers());
$query->setParameter('productFamily', $productFamilyIds['ids']);
$query->setParameter('productCategory', $productFamilyIds['categories']);
$query->setParameter('supplier', $productFamilyIds['suppliers']);
$query->setParameter(':now', new \DateTime());

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


+ 2
- 0
ShopBundle/Resources/public/css/backend/custom.css Vedi File

@@ -25,6 +25,8 @@ td.actions{white-space: nowrap; text-align: right;}
table th input{width: auto}
table th .select2-container--default .select2-selection--single{padding:0.3rem 0.4rem; }

/************************ LOGIN PAGE *********************/
.login-logo{display: block; margin: auto;}
/************************ form error *********************/

.form-sent .form-control:invalid{border-color: #dc3545; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23dc3545' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3E");background-repeat: no-repeat;background-position: center right calc(.375em + .1875rem); background-size: calc(.75em + .375rem) calc(.75em + .375rem);}

+ 15
- 29
ShopBundle/Resources/public/js/backend/script/default/init-common.js Vedi File

@@ -74,8 +74,8 @@ function initAdminLtePlugin() {


$('.date-time-range').each(function (i, picker) {
$(picker).daterangepicker({
//log(moment('2020-04-05 20:00:00').format( "DD/MM/YYYY HH:mm"))
options = {
timePicker: true,
timePickerIncrement: 30,
timePicker24Hour: true,
@@ -83,37 +83,23 @@ function initAdminLtePlugin() {
"format": "DD/MM/YYYY HH:mm",
"separator": " - ",
"applyLabel": "Appliquer",
"cancelLabel": "Cancel",
"fromLabel": "From",
"toLabel": "To",
"cancelLabel": "Annuler",
"fromLabel": "Du",
"toLabel": "au",
"customRangeLabel": "Custom",
"daysOfWeek": [
"Su",
"Mo",
"Tu",
"We",
"Th",
"Fr",
"Sa"
],
"monthNames": [
"January",
"February",
"March",
"Avril",
"Mai",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
],
"daysOfWeek": ["Di", "Lu", "Ma", "Me", "Je", "Ve", "Sa"],
"monthNames": ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Decembre"],
"firstDay": 1
}
};

});
if($(picker).nextAll('.date-time-range-fields').find('.date-start').val()){
options.startDate = new Date($(picker).nextAll('.date-time-range-fields').find('.date-start').val());
}
if($(picker).nextAll('.date-time-range-fields').find('.date-end').val()){
options.endDate = new Date($(picker).nextAll('.date-time-range-fields').find('.date-end').val());
}
$(picker).daterangepicker(options);
$(picker).on('apply.daterangepicker', function(ev, pickerElm) {
$(picker).nextAll('.date-time-range-fields').find('.date-start').val(pickerElm.startDate.format('YYYY-MM-DD HH:mm'));
$(picker).nextAll('.date-time-range-fields').find('.date-end').val(pickerElm.endDate.format('YYYY-MM-DD HH:mm'));

+ 6
- 6
ShopBundle/Resources/public/js/backend/script/reductioncatalog/vuejs-reduction-catalog.js Vedi File

@@ -9,12 +9,12 @@ appProductFamily = new Vue({

return Object.assign(
{
dateActive: true,
usersActive: true,
groupUsersActive: true,
suppliersActive: true,
productCategoriesActive: true,
productFamiliesActive:true
permanent: true,
usersActive: false,
groupUsersActive: false,
suppliersActive: false,
productCategoriesActive: false,
productFamiliesActive:false

}, window.appReductionCatalogValues);
},

+ 7
- 6
ShopBundle/Resources/translations/lcshop.fr.yaml Vedi File

@@ -165,20 +165,21 @@ field:
behaviorTaxRateHelp: Appliquer la réduction sur le prix HT ou le prix TTC
unit: Unité
value: Montant ou valeur

usersActive: Appliquer la réduction à tout les utilisateurs
permanent: Réduction permanante
dateRange: Date de but et date de fin
usersActive: Filtrer sur les utilisateurs
users: Appliquer aux utilisateurs

groupUsersActive: Appliquer la réduction à tout les groupes d'utilisateurs
groupUsersActive: Filtrer sur les groupes d'utilisateurs
groupUsers: Appliquer aux groupes d'utilisateurs

suppliersActive: Appliquer la réduction à tout les producteurs
suppliersActive: Filtrer sur les producteurs
suppliers: Appliquer aux producteurs

productCategoriesActive: Appliquer la réduction à toutes les catégories
productCategoriesActive: Filtrer sur les catégories
productCategories: Appliquer aux catégories

productFamiliesActive: Appliquer la réduction à tout les produits
productFamiliesActive: Filtrer sur les produits
productFamilies: Appliquer aux produits

action:

+ 0
- 1
ShopBundle/Resources/views/backend/default/edit.html.twig Vedi File

@@ -9,7 +9,6 @@
{% extends _entity_config.templates.layout %}

{% block body_id 'easyadmin-edit-' ~ _entity_config.name ~ '-' ~ _entity_id %}
{% block body_class 'edit edit-' ~ _entity_config.name|lower %}

{% block content_title %}
{% apply spaceless %}

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

@@ -52,7 +52,7 @@
</head>

{% block body %}
<body class="layout-navbar-fixed sidebar-mini">
<body class="{% block body_class %}layout-navbar-fixed sidebar-mini{% endblock %}">
{# <script>
document.body.classList.add(
'easyadmin-content-width-' + (localStorage.getItem('easyadmin/content/width') || 'normal'),
@@ -120,6 +120,9 @@
{% endif %}
{% endif %}
</li>
<li>
<a target="_blank" class="btn btn-outline-success" href="{{ path('frontend_home') }}">Afficher le site</a>
</li>
</ul>
{% endblock navbar %}
</nav>

+ 1
- 1
ShopBundle/Resources/views/backend/default/list.html.twig Vedi File

@@ -27,7 +27,7 @@
{% set _has_filters = _entity_config.list.filters|default(false) %}

{% block body_id 'easyadmin-list-' ~ _entity_config.name %}
{% block body_class 'list list-' ~ _entity_config.name|lower %}

{% block content_title %}
{% apply spaceless %}

+ 0
- 1
ShopBundle/Resources/views/backend/default/new.html.twig Vedi File

@@ -7,7 +7,6 @@
{% extends _entity_config.templates.layout %}

{% block body_id 'easyadmin-new-' ~ _entity_config.name %}
{% block body_class 'new new-' ~ _entity_config.name|lower %}

{% block content_title %}
{% apply spaceless %}

+ 56
- 0
ShopBundle/Resources/views/backend/page/login.html.twig Vedi File

@@ -0,0 +1,56 @@
{% trans_default_domain easyadmin_config('translation_domain') %}
{% extends easyadmin_config('design.templates.layout') %}

{% block body_class 'login-page' %}

{% block wrapper_wrapper %}
{% set _username_label = username_label is defined ? username_label|trans : 'login.username'|trans({}, 'EasyAdminBundle') %}
{% set _password_label = password_label is defined ? password_label|trans : 'login.password'|trans({}, 'EasyAdminBundle') %}
{% set _sign_in_label = sign_in_label is defined ? sign_in_label|trans : 'login.sign_in'|trans({}, 'EasyAdminBundle') %}

<div class="login-box">

{% block header_logo %}
<a class="login-logo {{ easyadmin_config('site_name')|length > 14 ? 'logo-long' }}" title="{{ easyadmin_config('site_name')|striptags }}" href="{{ path('easyadmin') }}">
{{ easyadmin_config('site_name')|raw }}
</a>
{% endblock header_logo %}


{% if error|default(false) %}
<div class="w-100 alert alert-danger">
{{ error.messageKey|trans(error.messageData, 'security') }}
</div>
{% endif %}

<section class="content">
<form method="post" action="{{ action|default('') }}">
{% if csrf_token_intention|default(false) %}
<input type="hidden" name="_csrf_token" value="{{ csrf_token(csrf_token_intention) }}">
{% endif %}

<input type="hidden" name="{{ target_path_parameter|default('_target_path') }}" value="{{ target_path|default(path('easyadmin')) }}" />

<div class="form-group field-text">
<label for="username" class="sr-only form-control-label required">{{ _username_label }}</label>
<div class="form-widget form-widget-with-icon">
<i class="fa fa-fw fa-user"></i>
<input type="text" id="username" name="{{ username_parameter|default('_username') }}" class="form-control" placeholder="{{ _username_label }}" value="{{ last_username|default('') }}" required autofocus>
</div>
</div>

<div class="form-group field-password">
<label for="password" class="sr-only form-control-label required">{{ _password_label }}</label>
<div class="form-widget form-widget-with-icon">
<i class="fa fa-fw fa-lock"></i>
<input type="password" id="password" name="{{ password_parameter|default('_password') }}" class="form-control" placeholder="{{ _password_label }}" required>
</div>
</div>

<div class="form-group field-button">
<button type="submit" class="btn btn-primary btn-lg btn-block" onclick="this.form.submit(); this.disabled=true;">{{ _sign_in_label }}</button>
</div>
</form>
</section>
</div>
{% endblock %}

+ 19
- 16
ShopBundle/Resources/views/backend/reductioncatalog/form.html.twig Vedi File

@@ -3,13 +3,16 @@
{% import '@LcShop/backend/default/block/macros.html.twig' as macros %}

{% set formValues = form.vars.value %}

<script>

window.appReductionCatalogValues = {
{% if formValues.users is not empty %}usersActive: false,{% endif %}
{% if formValues.groupUsers is not empty %}groupUsersActive: false,{% endif %}
{% if formValues.productFamilies is not empty %}productFamiliesActive: false,{% endif %}
{% if formValues.productCategories is not empty %}productCategoriesActive: false,{% endif %}
{% if formValues.suppliers is not empty %}suppliersActive: false,{% endif %}
{% if formValues.permanent is not null and formValues.permanent == false %}permanent: false,{% endif %}
{% if formValues.users is not empty %}usersActive: true,{% endif %}
{% if formValues.groupUsers is not empty %}groupUsersActive: true,{% endif %}
{% if formValues.productFamilies is not empty %}productFamiliesActive: true,{% endif %}
{% if formValues.productCategories is not empty %}productCategoriesActive: true,{% endif %}
{% if formValues.suppliers is not empty %}suppliersActive: true,{% endif %}
}
</script>
<div id="lc-reduction-catalog-edit" class="row">
@@ -18,10 +21,10 @@
<div class="col-12">
{{ form_row(form.title) }}
</div>
<div class="col-12">
{# <div class="col-12">
{{ form_row(form.fromQuantity) }}
</div>
#}
<div class="col-12">
{{ form_row(form.behaviorTaxRate) }}
</div>
@@ -38,13 +41,13 @@
{{ macros.endCard() }}


{{ macros.startCard(6, 'ReductionCatalog.conditions','secondary') }}
{{ macros.startCard(6, 'ReductionCatalog.conditions','success') }}
<div class="col-12">
<div class="form-group">
<div class="form-group">
{{ form_widget(form.dateActive, {"attr" : {'v-model' : 'dateActive' } }) }}
{{ form_widget(form.permanent, {"attr" : {'v-model' : 'permanent' } }) }}
</div>
<div class="input-group" v-show="dateActive == false">
<div class="input-group" v-show="permanent == false">
<div class="input-group-prepend">
<span class="input-group-text"><i class="far fa-clock"></i></span>
</div>
@@ -62,8 +65,8 @@
<div class="form-group">
{{ form_widget(form.usersActive, {"attr" : {'v-model' : 'usersActive' } }) }}
</div>
<div v-show="usersActive == false">
{{ form_row(form.users) }}
<div class="form-widget" v-show="usersActive == true">
{{ form_widget(form.users) }}
</div>
</div>
</div>
@@ -72,7 +75,7 @@
<div class="form-group">
{{ form_widget(form.groupUsersActive, {"attr" : {'v-model' : 'groupUsersActive' } }) }}
</div>
<div class="form-widget" v-show="groupUsersActive == false">
<div class="form-widget" v-show="groupUsersActive == true">
{{ form_widget(form.groupUsers) }}
</div>
</div>
@@ -83,7 +86,7 @@
<div class="form-group">
{{ form_widget(form.suppliersActive, {"attr" : {'v-model' : 'suppliersActive' } }) }}
</div>
<div class="form-widget" v-show="suppliersActive == false">
<div class="form-widget" v-show="suppliersActive == true">
{{ form_widget(form.suppliers) }}
</div>
</div>
@@ -93,7 +96,7 @@
<div class="form-group">
{{ form_widget(form.productCategoriesActive, {"attr" : {'v-model' : 'productCategoriesActive' } }) }}
</div>
<div class="form-widget" v-show="productCategoriesActive == false">
<div class="form-widget" v-show="productCategoriesActive == true">
{{ form_widget(form.productCategories) }}
</div>
</div>
@@ -103,7 +106,7 @@
<div class="form-group">
{{ form_widget(form.productFamiliesActive, {"attr" : {'v-model' : 'productFamiliesActive' } }) }}
</div>
<div class="form-widget" v-show="productFamiliesActive == false">
<div class="form-widget" v-show="productFamiliesActive == true">
{{ form_widget(form.productFamilies) }}
</div>
</div>

Loading…
Annulla
Salva