Browse Source

Export commande producteurs

feature/export_comptable
Fab 4 years ago
parent
commit
366c5a1cbd
7 changed files with 102 additions and 35 deletions
  1. +2
    -0
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +12
    -4
      ShopBundle/EventSubscriber/ListEventSubscriber.php
  3. +1
    -0
      ShopBundle/Form/Backend/Filters/ListFilterType.php
  4. +2
    -1
      ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js
  5. +7
    -0
      ShopBundle/Resources/views/backend/default/list-fields/field_datetime.html.twig
  6. +30
    -30
      ShopBundle/Resources/views/backend/default/list.html.twig
  7. +48
    -0
      ShopBundle/Services/CsvGenerator.php

+ 2
- 0
ShopBundle/Controller/Backend/ProductFamilyController.php View File

$sortableProductsField = array(); $sortableProductsField = array();
foreach ($editForm->get('products')->getData() as $k => $product) { foreach ($editForm->get('products')->getData() as $k => $product) {
$sortableProductsField[$product->getPosition()] = $k; $sortableProductsField[$product->getPosition()] = $k;

} }

ksort($sortableProductsField); ksort($sortableProductsField);


$editForm->handleRequest($this->request); $editForm->handleRequest($this->request);

+ 12
- 4
ShopBundle/EventSubscriber/ListEventSubscriber.php View File

$criteria['merchant'] = $currentMerchant; $criteria['merchant'] = $currentMerchant;
} }


if ($entityObject instanceof FilterMultipleMerchantsInterface) {

/* if ($entityObject instanceof FilterMultipleMerchantsInterface) {
$paginator->nbResultsTotal = $entityRepo->count(array());


// TODO : Filter sur le merchant courant; Pour le moment dans ce contexte on ne charge rien de plus, par de nbResultsOnline en fonction du merchant // TODO : Filter sur le merchant courant; Pour le moment dans ce contexte on ne charge rien de plus, par de nbResultsOnline en fonction du merchant


}else {
}else {*/


if ($entityObject instanceof StatusInterface) { if ($entityObject instanceof StatusInterface) {

for ($status = -1; $status <= 1; $status++) { for ($status = -1; $status <= 1; $status++) {
$criteria['status'] = $status; $criteria['status'] = $status;
if ($status == -1) { if ($status == -1) {
$paginator->nbResultsOnline = $entityRepo->count($criteria); $paginator->nbResultsOnline = $entityRepo->count($criteria);
} }
} }

$paginator->nbResultsTotal = $paginator->nbResultsOnline + $paginator->nbResultsOffline;

}else{
$paginator->nbResultsTotal = $entityRepo->count($criteria);
} }
}
$paginator->nbResultsTotal = $entityRepo->count(array());
//}


} }
} }

+ 1
- 0
ShopBundle/Form/Backend/Filters/ListFilterType.php View File

break; break;
case 'association': case 'association':
$classImplements = class_implements($field['targetEntity']); $classImplements = class_implements($field['targetEntity']);
dump($classImplements);
$builder->add($field['property'], EntityType::class, array( $builder->add($field['property'], EntityType::class, array(
'class' => $field['targetEntity'], 'class' => $field['targetEntity'],
'placeholder'=> '--', 'placeholder'=> '--',

+ 2
- 1
ShopBundle/Resources/public/js/backend/script/productfamily/vuejs-product-family.js View File

$('.lc-sortable-products tr.lc-draggable').each(function (index, li) { $('.lc-sortable-products tr.lc-draggable').each(function (index, li) {
oldKey = $(li).find('.field-position').val(); oldKey = $(li).find('.field-position').val();
$(li).find('.field-position').val(index); $(li).find('.field-position').val(index);
//log($(li).find('.field-position').val());
}); });
if(post)this.postForm();
//if(post)this.postForm();
} }
}, },



+ 7
- 0
ShopBundle/Resources/views/backend/default/list-fields/field_datetime.html.twig View File

{#{{ value|date('U')}}#}
{% if field_options.format == "d/m/Y h:i A e" %}
{% set format = "d/m/Y H:i" %}
{% else %}
{% set format = field_options.format %}
{% endif %}
<time data-timestamp="{{ value|date('U') }}" title="{{ value|date('r') }}">{{ value|date(format) }}</time>

+ 30
- 30
ShopBundle/Resources/views/backend/default/list.html.twig View File

{% endblock %} {% endblock %}


</h2> </h2>
{% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %}
{% set _action = easyadmin_get_action_for_list_view('new', _entity_config.name) %}
{% block new_action %}
<div class="button-action">

<div class="button-action">
{% if easyadmin_action_is_enabled_for_list_view('new', _entity_config.name) %}
{% set _action = easyadmin_get_action_for_list_view('new', _entity_config.name) %}
{% block new_action %}

<a class="float-right {{ _action.css_class|default('') }}" <a class="float-right {{ _action.css_class|default('') }}"
href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}" href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}"
target="{{ _action.target }}"> target="{{ _action.target }}">
<i class="fa fa-fw fa-plus"></i> <i class="fa fa-fw fa-plus"></i>
{{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }} {{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }}
</a> </a>
{% endblock new_action %}
{% endif %}
{% if _entity_config['list']['btn_init_export_purchase_order'] is defined %}
<a class="float-right btn-sm btn-success action-sort"
href="{{ path('easyadmin', { entity: 'Supplier', action: 'initExportPurchaseOrder' }) }}">
<i class="fa fa-undo"></i> Réinitialiser export bons de commande
</a>
{% endif %}

{% if _entity_config['list']['edit_position'] is defined %}
<a class="float-right btn-sm btn-success action-sort"
href="{{ path('easyadmin', _request_parameters|merge({ action: 'sort' })) }}">
<i class="fa fa-sort"></i> Modifier position
</a>
{% endif %}

{% if app.request.get('action') == 'listChildren' and app.request.get('entity') == 'ProductCategory' %}
<a class="float-right btn-sm btn-primary"
href="{{ path('easyadmin', {action: 'list', entity: 'ProductCategory'}) }}">
<i class="fa fa-chevron-left"></i> Retour à la catégorie parente
</a>
{% endif %}

</div>


{% if _entity_config['list']['btn_init_export_purchase_order'] is defined %}
<a class="float-right btn-sm btn-success action-sort"
href="{{ path('easyadmin', { entity: 'Supplier', action: 'initExportPurchaseOrder' }) }}"
target="{{ _action.target }}">
<i class="fa fa-undo"></i> Réinitialiser export bons de commande
</a>
{% endif %}

{% if _entity_config['list']['edit_position'] is defined %}
<a class="float-right btn-sm btn-success action-sort"
href="{{ path('easyadmin', _request_parameters|merge({ action: 'sort' })) }}"
target="{{ _action.target }}">
<i class="fa fa-sort"></i> Modifier position
</a>
{% endif %}

{% if app.request.get('action') == 'listChildren' and app.request.get('entity') == 'ProductCategory' %}
<a class="float-right btn-sm btn-primary"
href="{{ path('easyadmin', {action: 'list', entity: 'ProductCategory'}) }}">
<i class="fa fa-chevron-left"></i> Retour à la catégorie parente
</a>
{% endif %}

</div>
{% endblock new_action %}
{% endif %}
{% endblock card_header %} {% endblock card_header %}


</div> </div>

+ 48
- 0
ShopBundle/Services/CsvGenerator.php View File

<?php

namespace Lc\ShopBundle\Services;

use Cocur\Slugify\Slugify;
use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Configuration\ConfigManager;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\PageInterface;
use Lc\ShopBundle\Context\PointSaleInterface;
use Lc\ShopBundle\Context\ReminderInterface;
use Lc\ShopBundle\Context\TaxRateInterface;
use Lc\ShopBundle\Context\UnitInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Context\UserPointSaleInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class CsvGenerator
{
protected $em ;
protected $parameterBag ;
protected $merchantUtils ;
protected $session;
protected $translator;
protected $configManager;
protected $arrayToExport;
protected $columns;


public function __construct()
{

}

public function setColumns($columns){
$this->columns = $columns;
}

public function setCell($row, $column, $value){
$this->arrayToExport[$row][$column] = $value;
}



}

Loading…
Cancel
Save