diff --git a/app/Form/Actions/ExportAction.php b/app/Form/Actions/ExportAction.php
index 54000524..0460fe95 100644
--- a/app/Form/Actions/ExportAction.php
+++ b/app/Form/Actions/ExportAction.php
@@ -15,22 +15,14 @@ class ExportAction
public function handle(Form $form): string
{
- $csv = Writer::createFromString();
-
- $csv->insertOne($form->getFields()->names());
-
- foreach ($form->participants as $participant) {
- $csv->insertOne($participant->getFields()->presentValues());
- }
-
- return $csv->toString();
+ return CreateExcelDocumentAction::run($form, $form->participants);
}
public function asController(Form $form, ActionRequest $request): StreamedResponse
{
$contents = $this->handle($form);
- $filename = 'tn-' . $form->slug . '.csv';
+ $filename = 'tn-' . $form->slug . '.xlsx';
Storage::disk('temp')->put($filename, $contents);
return Storage::disk('temp')->download($filename);
diff --git a/bin/copydb b/bin/copydb
index d019ee72..793a18db 100755
--- a/bin/copydb
+++ b/bin/copydb
@@ -1,4 +1,4 @@
-#/bin/bash
+#!/bin/bash
echo "drop database scoutrobot;" | sudo mysql
echo "create database scoutrobot;" | sudo mysql
diff --git a/packages/table-document b/packages/table-document
index c1d0221d..8aefd17b 160000
--- a/packages/table-document
+++ b/packages/table-document
@@ -1 +1 @@
-Subproject commit c1d0221dcd2b4200b3ff17747e31f451fcc749f0
+Subproject commit 8aefd17b06ee3c26d00b472a154a48898b884d15
diff --git a/resources/js/views/form/Index.vue b/resources/js/views/form/Index.vue
index 79b7b3c0..3710656f 100644
--- a/resources/js/views/form/Index.vue
+++ b/resources/js/views/form/Index.vue
@@ -175,7 +175,7 @@
-
+
diff --git a/tests/Feature/Form/ParticipantExportActionTest.php b/tests/Feature/Form/ParticipantExportActionTest.php
index ab2577f9..d39aa289 100644
--- a/tests/Feature/Form/ParticipantExportActionTest.php
+++ b/tests/Feature/Form/ParticipantExportActionTest.php
@@ -2,12 +2,8 @@
namespace Tests\Feature\Form;
-use App\Form\Fields\TextField;
use App\Form\Models\Form;
use App\Form\Models\Participant;
-use App\Form\Scopes\ParticipantFilterScope;
-use App\Group;
-use Carbon\Carbon;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Storage;
@@ -32,12 +28,12 @@ class ParticipantExportActionTest extends FormTestCase
->name('ZEM 2024')
->create();
- $this->get(route('form.export', ['form' => $form]))->assertDownload('tn-zem-2024.csv');
- $contents = Storage::disk('temp')->get('tn-zem-2024.csv');
- $this->assertTrue(str_contains($contents, 'Max'));
- $this->assertTrue(str_contains($contents, 'A, B'));
- $this->assertTrue(str_contains($contents, 'Pfadfinder'));
- $this->assertTrue(str_contains($contents, 'Stufe'));
- $this->assertTrue(str_contains($contents, 'Abcselect'));
+ $this->get(route('form.export', ['form' => $form]))->assertDownload('tn-zem-2024.xlsx');
+ $contents = Storage::disk('temp')->get('tn-zem-2024.xlsx');
+ $this->assertExcelContent('Max', $contents);
+ $this->assertExcelContent('A, B', $contents);
+ $this->assertExcelContent('Pfadfinder', $contents);
+ $this->assertExcelContent('Stufe', $contents);
+ $this->assertExcelContent('Abcselect', $contents);
}
}
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 8a2cb508..b90afa70 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -17,12 +17,14 @@ use PHPUnit\Framework\Assert;
use Tests\Lib\MakesHttpCalls;
use Tests\Lib\TestsInertia;
use Zoomyboy\LaravelNami\Authentication\Auth;
+use Zoomyboy\TableDocument\TestsExcelDocuments;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
use TestsInertia;
use MakesHttpCalls;
+ use TestsExcelDocuments;
protected User $me;