Ver código fonte

Merge branch 'develop'

develop
Guillaume 2 anos atrás
pai
commit
c22332af25
7 arquivos alterados com 50 adições e 15 exclusões
  1. +1
    -1
      Controller/AbstractAdminController.php
  2. +9
    -0
      Controller/ControllerTrait.php
  3. +3
    -0
      Definition/Field/AbstractFieldDefinition.php
  4. +6
    -0
      Resources/assets/app/adminlte/main/scss/_common.scss
  5. +26
    -10
      Resources/assets/functions/prices.js
  6. +4
    -4
      Resources/assets/functions/widgets.js
  7. +1
    -0
      Resources/translations/admin.fr.yaml

+ 1
- 1
Controller/AbstractAdminController.php Ver arquivo

@@ -342,7 +342,7 @@ abstract class AbstractAdminController extends EaAbstractCrudController
}

$newEntity = $entityComponent->duplicateEntity($context->getEntity()->getInstance());
$em->create($newEntity);
$em->create($newEntity, false);
$em->flush();

$url = $this->get(AdminUrlGenerator::class)

+ 9
- 0
Controller/ControllerTrait.php Ver arquivo

@@ -40,6 +40,15 @@ use Twig\Environment;

trait ControllerTrait
{
/*
* Fonctions privées
*/
protected function _setNoLimitMemoryAndTime()
{
ini_set('memory_limit', '-1');
set_time_limit(0);
}

//TODO si vous avez une erreur avec le :array c'est qu'il faut passer à symfony 5.4.
//Suivez la procédure suivante : https://symfony.com/doc/current/setup/unstable_versions.html#upgrading-your-project-to-an-unstable-symfony-version
//En gros il faut changer tout les dépendances symfony/ qui sont en 5.3 par 5.4 dans composer.json

+ 3
- 0
Definition/Field/AbstractFieldDefinition.php Ver arquivo

@@ -8,6 +8,7 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Field\AssociationField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\ImageManagerField;
@@ -55,6 +56,8 @@ abstract class AbstractFieldDefinition
'status' => StatusField::new('status')->setSortable(true),
'createdAt' => DateTimeField::new('createdAt')->setSortable(true),
'updatedAt' => DateTimeField::new('updatedAt')->setSortable(true),
'createdBy' => AssociationField::new('createdBy'),
'updatedBy' => AssociationField::new('updatedBy')
];
}


+ 6
- 0
Resources/assets/app/adminlte/main/scss/_common.scss Ver arquivo

@@ -146,3 +146,9 @@ table.fixedHeader-floating {
}

.badge.stripped{background-image: url('../img/stripped.png');}

.ui-sortable-helper {
display: table;
}
.lc-draggable{width: 100%;}
.sortable{width: 100%}

+ 26
- 10
Resources/assets/functions/prices.js Ver arquivo

@@ -1,12 +1,20 @@

export class SovPrices {

static getPrice(priceWithTax, taxRate) {
return parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1)).toFixed(4);
static getPrice(priceWithTax, taxRate,round) {
let price = parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1));
if(round ==false){
return price;
}
return price.toFixed(4);
}

static getPriceWithTax(priceWithoutTax, taxRate) {
return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).toFixed(2);
static getPriceWithTax(priceWithoutTax, taxRate, round) {
let priceWithTax = parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1));
if(round ==false){
return priceWithTax;
}
return priceWithTax.toFixed(2);
}

static getMargin(price, buyingPrice){
@@ -17,18 +25,26 @@ export class SovPrices {
return parseFloat(((price - buyingPrice) / price) * 100).toFixed(2);
}

static applyReductionPercent(price, percentage)
static applyReductionPercent(price, percentage, round)
{
return this.applyPercent(price, -percentage);
return this.applyPercent(price, -percentage,round);
}

static applyReductionAmount(price, amount)
static applyReductionAmount(price, amount, round)
{
return parseFloat(price - amount).toFixed(2);
let priceWithReduction = parseFloat(price - amount);
if(round ==false){
return priceWithReduction;
}
return priceWithReduction.toFixed(2);
}

static applyPercent(price, percentage)
static applyPercent(price, percentage, round)
{
return parseFloat(price * (percentage / 100 + 1)).toFixed(2);
let priceWithReduction = parseFloat(price * (percentage / 100 + 1));
if(round ==false){
return priceWithReduction;
}
return priceWithReduction.toFixed(2);
}
}

+ 4
- 4
Resources/assets/functions/widgets.js Ver arquivo

@@ -19,12 +19,12 @@ export class SovWidgets {
options.width = 'auto'
}

options.placeholder = "";

// @TODO : génère une erreur
/*if ($select.find('option[value=""]')) {
if ($select.find('option[value=""]').length) {
options.placeholder = $select.find('option[value=""]').html()
}*/

options.placeholder = "";
}

var myselect = $select.select2(options);


+ 1
- 0
Resources/translations/admin.fr.yaml Ver arquivo

@@ -119,6 +119,7 @@ entity:
label_plurial: Blocs
default:
fields:
placeholder: Sélectionner une valeur
id: Id
confirmDelete: Confirmer la suppression
createdAt: Créé le

Carregando…
Cancelar
Salvar