Procházet zdrojové kódy

Intégration app reduction

packProduct
Fab před 2 roky
rodič
revize
1af1ca8e71
5 změnil soubory, kde provedl 29 přidání a 0 odebrání
  1. +3
    -0
      Controller/AdminControllerTrait.php
  2. +12
    -0
      Field/AssociationField.php
  3. +9
    -0
      Resources/views/admin/reduction/field/amount.html.twig
  4. +1
    -0
      Resources/views/admin/reduction/reduction_cart/field/total_left.html.twig
  5. +4
    -0
      Resources/views/admin/reduction/reduction_cart/field/total_used.html.twig

+ 3
- 0
Controller/AdminControllerTrait.php Zobrazit soubor

@@ -335,5 +335,8 @@ trait AdminControllerTrait
public function getCurrentSection(){
return $this->get(SectionResolver::class)->getCurrent();
}
public function getCurrentMerchant(){
return $this->get(MerchantResolver::class)->getCurrent();
}
}


+ 12
- 0
Field/AssociationField.php Zobrazit soubor

@@ -78,6 +78,12 @@ final class AssociationField implements FieldInterface
return $this;
}

public function setLeftJoin($entityName): self{
$this->queryBuilderParameters['leftJoin'][] = $entityName;

return $this;
}


public function addOrderBy($field, $direction ='ASC') : self
{
@@ -111,6 +117,12 @@ final class AssociationField implements FieldInterface
}
}

if (isset($param['leftJoin'])) {
foreach ($param['leftJoin'] as $i=>$entityName) {
$qb->leftJoin('e.'.$entityName, $entityName)->addSelect($entityName);
}
}

/*if (isset($param['devAlias'])) {
$qb->andWhere('e.devAlias = :devAlias')->setParameter(
'devAlias',

+ 9
- 0
Resources/views/admin/reduction/field/amount.html.twig Zobrazit soubor

@@ -0,0 +1,9 @@

{% set item = entity.instance %}
{% if item.unit == constant('App\\Entity\\Config\\Unit::UNIT_PERCENT') %}
{% set unit = '%' %}
{% elseif item.unit == constant('App\\Entity\\Config\\Unit::UNIT_AMOUNT') %}
{% set unit = '€' %}
{% endif %}

-{{ item.value }}{{ unit }}

+ 1
- 0
Resources/views/admin/reduction/reduction_cart/field/total_left.html.twig Zobrazit soubor

@@ -0,0 +1 @@
{{ item.availableQuantity - orderUtils.getReductionCartUsedQuantity(item) }}

+ 4
- 0
Resources/views/admin/reduction/reduction_cart/field/total_used.html.twig Zobrazit soubor

@@ -0,0 +1,4 @@
{% set item = entity.instance %}
{% set totalUsed = order_shop_container.store.getReductionCartUsedQuantity(item) %}
<span class="badge badge-success">{{ totalUsed }}</span> utilisé(s)
/ <span class="badge badge-primary">{{ item.availableQuantity - totalUsed }}</span> restante(s)

Načítá se…
Zrušit
Uložit