ソースを参照

export csv individuel form

v1
charly 3年前
コミット
5834269364
4個のファイルの変更141行の追加39行の削除
  1. +23
    -23
      public/build/entrypoints.json
  2. +13
    -13
      public/build/manifest.json
  3. +102
    -2
      src/Controller/Admin/IndividualDataCrudController.php
  4. +3
    -1
      translations/admin.fr.yaml

+ 23
- 23
public/build/entrypoints.json ファイルの表示

@@ -2,14 +2,14 @@
"entrypoints": {
"adminlte-plugins": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js.5b9cb885.js",
"/build/vendors-node_modules_jquery_src_jquery_js.2a8ff255.js",
"/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.22d0763b.js",
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-57a6be.35767fac.js",
"/build/adminlte-plugins.12a6c89b.js"
"/build/adminlte-plugins.a206a66e.js"
],
"css": [
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-57a6be.fa890b12.css"
@@ -17,12 +17,12 @@
},
"adminlte-index": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js.5b9cb885.js",
"/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-f7c72f.c0107d2e.js",
"/build/adminlte-index.848d15a8.js"
"/build/adminlte-index.3de48d32.js"
],
"css": [
"/build/adminlte-index.e4548695.css"
@@ -30,10 +30,10 @@
},
"adminlte-form": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js.5b9cb885.js",
"/build/adminlte-form.66bf23e9.js"
"/build/adminlte-form.4079807b.js"
],
"css": [
"/build/adminlte-form.59862983.css"
@@ -41,13 +41,13 @@
},
"adminlte-sort": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js.5b9cb885.js",
"/build/vendors-node_modules_jquery_src_jquery_js.2a8ff255.js",
"/build/vendors-node_modules_jquery-ui-dist_jquery-ui_js.d62744d3.js",
"/build/adminlte-sort.b528cdf7.js"
"/build/adminlte-sort.72f3a9ea.js"
],
"css": [
"/build/adminlte-sort.8d9ca659.css"
@@ -55,9 +55,9 @@
},
"adminlte-field-filemanager": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/adminlte-field-filemanager.a2c5059a.js"
"/build/adminlte-field-filemanager.d8302fb7.js"
],
"css": [
"/build/adminlte-field-filemanager.aacd1c4c.css"
@@ -65,13 +65,13 @@
},
"adminlte-field-collection": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js.5b9cb885.js",
"/build/vendors-node_modules_jquery_src_jquery_js.2a8ff255.js",
"/build/vendors-node_modules_jquery-ui-dist_jquery-ui_js.d62744d3.js",
"/build/adminlte-field-collection.764e7e37.js"
"/build/adminlte-field-collection.db18b61c.js"
],
"css": [
"/build/adminlte-field-collection.55dda2c2.css"
@@ -79,19 +79,19 @@
},
"adminlte-main": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/adminlte-main.9b6dba80.js"
"/build/adminlte-main.e8feeffc.js"
],
"css": [
"/build/adminlte-main.bbf0afa0.css"
"/build/adminlte-main.87244ec8.css"
]
},
"sov-reminder": {
"js": [
"/build/runtime.061a64b9.js",
"/build/sov-reminder.05b85c23.js"
"/build/runtime.cbcc88f9.js",
"/build/sov-reminder.27580486.js"
],
"css": [
"/build/sov-reminder.05d9ff45.css"
@@ -99,13 +99,13 @@
},
"sov-ticket": {
"js": [
"/build/runtime.061a64b9.js",
"/build/sov-ticket.da296284.js"
"/build/runtime.cbcc88f9.js",
"/build/sov-ticket.df76c7a0.js"
]
},
"app-backend": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js.5b9cb885.js",
"/build/app-backend.9246973d.js"
@@ -116,7 +116,7 @@
},
"app-frontend": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_jquery_src_jquery_js.2a8ff255.js",
@@ -125,12 +125,12 @@
"/build/app-frontend.0eab0ec9.js"
],
"css": [
"/build/app-frontend.0ae7c1c8.css"
"/build/app-frontend.1e476ca5.css"
]
},
"app-bulle": {
"js": [
"/build/runtime.061a64b9.js",
"/build/runtime.cbcc88f9.js",
"/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-e7c189.7a170faa.js",
"/build/app-bulle.522340dc.js"
]

+ 13
- 13
public/build/manifest.json ファイルの表示

@@ -1,28 +1,28 @@
{
"build/adminlte-plugins.js": "/build/adminlte-plugins.12a6c89b.js",
"build/adminlte-plugins.js": "/build/adminlte-plugins.a206a66e.js",
"build/adminlte-index.css": "/build/adminlte-index.e4548695.css",
"build/adminlte-index.js": "/build/adminlte-index.848d15a8.js",
"build/adminlte-index.js": "/build/adminlte-index.3de48d32.js",
"build/adminlte-form.css": "/build/adminlte-form.59862983.css",
"build/adminlte-form.js": "/build/adminlte-form.66bf23e9.js",
"build/adminlte-form.js": "/build/adminlte-form.4079807b.js",
"build/adminlte-sort.css": "/build/adminlte-sort.8d9ca659.css",
"build/adminlte-sort.js": "/build/adminlte-sort.b528cdf7.js",
"build/adminlte-sort.js": "/build/adminlte-sort.72f3a9ea.js",
"build/adminlte-field-filemanager.css": "/build/adminlte-field-filemanager.aacd1c4c.css",
"build/adminlte-field-filemanager.js": "/build/adminlte-field-filemanager.a2c5059a.js",
"build/adminlte-field-filemanager.js": "/build/adminlte-field-filemanager.d8302fb7.js",
"build/adminlte-field-collection.css": "/build/adminlte-field-collection.55dda2c2.css",
"build/adminlte-field-collection.js": "/build/adminlte-field-collection.764e7e37.js",
"build/adminlte-main.css": "/build/adminlte-main.bbf0afa0.css",
"build/adminlte-main.js": "/build/adminlte-main.9b6dba80.js",
"build/adminlte-field-collection.js": "/build/adminlte-field-collection.db18b61c.js",
"build/adminlte-main.css": "/build/adminlte-main.87244ec8.css",
"build/adminlte-main.js": "/build/adminlte-main.e8feeffc.js",
"build/sov-reminder.css": "/build/sov-reminder.05d9ff45.css",
"build/sov-reminder.js": "/build/sov-reminder.05b85c23.js",
"build/sov-ticket.js": "/build/sov-ticket.da296284.js",
"build/sov-reminder.js": "/build/sov-reminder.27580486.js",
"build/sov-ticket.js": "/build/sov-ticket.df76c7a0.js",
"build/app-backend.css": "/build/app-backend.3d882954.css",
"build/app-backend.js": "/build/app-backend.9246973d.js",
"build/app-frontend.css": "/build/app-frontend.0ae7c1c8.css",
"build/app-frontend.css": "/build/app-frontend.1e476ca5.css",
"build/app-frontend.js": "/build/app-frontend.0eab0ec9.js",
"build/app-bulle.js": "/build/app-bulle.522340dc.js",
"build/runtime.js": "/build/runtime.061a64b9.js",
"build/runtime.js": "/build/runtime.cbcc88f9.js",
"build/pdfmake.js": "/build/pdfmake.fbf70324.js",
"build/canvg.js": "/build/canvg.5e04b23d.js",
"build/canvg.js": "/build/canvg.23051f37.js",
"build/xlsx.js": "/build/xlsx.05855660.js",
"build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js": "/build/vendors-node_modules_core-js_internals_export_js.a0c0cb57.js",
"build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js": "/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",

+ 102
- 2
src/Controller/Admin/IndividualDataCrudController.php ファイルの表示

@@ -4,6 +4,10 @@ namespace App\Controller\Admin;

use App\Entity\Configuration;
use App\Entity\IndividualData;
use App\Repository\DreamStore;
use App\Repository\ProjectBoostStore;
use App\Repository\ProjectInspiringStore;
use App\Repository\RevoltStore;
use App\Type\DreamType;
use App\Type\ProjectBoostType;
use App\Type\ProjectInspiringType;
@@ -12,20 +16,41 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use Symfony\Component\HttpFoundation\Request;
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Generator\CsvGenerator;

class IndividualDataCrudController extends AbstractCrudController
{
protected DreamStore $dreamStore;
protected RevoltStore $revoltStore;
protected ProjectBoostStore $projectBoostStore;
protected ProjectInspiringStore $projectInspiringStore;

public function __construct(
DreamStore $dreamStore,
RevoltStore $revoltStore,
ProjectBoostStore $projectBoostStore,
ProjectInspiringStore $projectInspiringStore
) {
$this->dreamStore = $dreamStore;
$this->revoltStore = $revoltStore;
$this->projectBoostStore = $projectBoostStore;
$this->projectInspiringStore = $projectInspiringStore;
}

public static function getEntityFqcn(): string
{
return IndividualData::class;
@@ -103,8 +128,7 @@ class IndividualDataCrudController extends AbstractCrudController
EntityDto $entityDto,
FieldCollection $fields,
FilterCollection $filters
): QueryBuilder
{
): QueryBuilder {
$queryBuilder = parent::createIndexQueryBuilder(
$searchDto,
$entityDto,
@@ -116,4 +140,80 @@ class IndividualDataCrudController extends AbstractCrudController

return $queryBuilder;
}

public function configureActions(Actions $actions): Actions
{
parent::configureActions($actions);

$export = Action::new('export', 'actions.export')
->setIcon('fa fa-download')
->linkToCrudAction('exportCsv')
->setCssClass('btn btn-primary')
->createAsGlobalAction();

return $actions->add(Crud::PAGE_INDEX, $export);
}

public function exportCsv(Request $request)
{
$csv = new CsvGenerator();
$csv->enableConvertEncoding('ISO-8859-1');
$csv->setTitle('Export_Liste', true);

$columns = [
'category' => 'Catégorie',
'thematic' => 'Thématique',
'subthematic' => 'Contribution',
'territory' => 'Lieu',
'description' => 'Description'
];
$csv->setColumns($columns);

$resultArray = $this->generateAllResultArray();

$csv = $this->generateCsvData($csv, $resultArray);

return $csv->getReponse();
}

private function generateAllResultArray(): array
{
$dreamArray = $this->dreamStore->get();
$revoltArray = $this->revoltStore->get();
$projectBoostArray = $this->projectBoostStore->get();
$projectInspiringArray = $this->projectInspiringStore->get();

return array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray);
}

private function generateCsvData($csv, $resultArray)
{
foreach ($resultArray as $result) {
$territory = $subthematic = $thematic = "";
if ($result->getIndividualData()) {
$territory = $result->getIndividualData()->getTerritory()->getName();


if ($result->getSubthematic()) {
$subthematic = $result->getSubthematic()->getName();
}

if ($result->getThematic()) {
$thematic = $result->getThematic()->getName();
}

$data = [
'category' => $result->__toString(),
'thematic' => $thematic,
'subthematic' => $subthematic,
'territory' => $territory,
'description' => $result->getDescription()
];

$csv->row($data);
}
}

return $csv;
}
}

+ 3
- 1
translations/admin.fr.yaml ファイルの表示

@@ -88,4 +88,6 @@ form:
revolt:
description: Description
thematic: Thématique
subthematic: Sous-thème
subthematic: Sous-thème
actions:
export: Export CSV

読み込み中…
キャンセル
保存