Compare commits
No commits in common. "35a8c59055c8446075241b039b930cd799592220" and "e5008d127d8ee4f5e3a84598a7353e0dcd04fbc2" have entirely different histories.
35a8c59055
...
e5008d127d
|
@ -32,8 +32,6 @@ class FormStoreAction
|
|||
'mail_bottom' => 'array',
|
||||
'header_image' => 'required|exclude',
|
||||
'mailattachments' => 'present|array|exclude',
|
||||
'is_active' => 'boolean',
|
||||
'is_private' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ class FormUpdateAction
|
|||
'registration_until' => 'present|nullable|date',
|
||||
'mail_top' => 'array',
|
||||
'mail_bottom' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
'is_private' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ class Form extends Model implements HasMedia
|
|||
'description' => 'json',
|
||||
'mail_top' => 'json',
|
||||
'mail_bottom' => 'json',
|
||||
'is_active' => 'boolean',
|
||||
'is_private' => 'boolean',
|
||||
];
|
||||
|
||||
/** @var array<int, string> */
|
||||
|
@ -135,8 +133,6 @@ class Form extends Model implements HasMedia
|
|||
'from' => $this->from->timestamp,
|
||||
'to' => $this->to->timestamp,
|
||||
'name' => $this->name,
|
||||
'is_active' => $this->is_active,
|
||||
'is_private' => $this->is_private,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ class FormResource extends JsonResource
|
|||
'registration_until' => $this->registration_until?->format('Y-m-d H:i:s'),
|
||||
'config' => $this->config,
|
||||
'participants_count' => $this->participants_count,
|
||||
'is_active' => $this->is_active,
|
||||
'is_private' => $this->is_private,
|
||||
'links' => [
|
||||
'participant_index' => route('form.participant.index', ['form' => $this->getModel()]),
|
||||
'update' => route('form.update', ['form' => $this->getModel()]),
|
||||
|
@ -73,8 +71,6 @@ class FormResource extends JsonResource
|
|||
'specialTypes' => SpecialType::forSelect(),
|
||||
'default' => [
|
||||
'description' => [],
|
||||
'is_active' => true,
|
||||
'is_private' => false,
|
||||
'name' => '',
|
||||
'excerpt' => '',
|
||||
'from' => null,
|
||||
|
|
|
@ -19,7 +19,6 @@ class FormFilterScope extends ScoutFilter
|
|||
public function __construct(
|
||||
public ?string $search = '',
|
||||
public bool $past = false,
|
||||
public bool $inactive = false,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -36,10 +35,6 @@ class FormFilterScope extends ScoutFilter
|
|||
$filters->push('to > ' . now()->timestamp);
|
||||
}
|
||||
|
||||
if ($this->inactive === false) {
|
||||
$filters->push('is_active = true');
|
||||
}
|
||||
|
||||
$options['filter'] = $filters->implode(' AND ');
|
||||
|
||||
return $engine->search($query, $options);
|
||||
|
|
|
@ -146,9 +146,9 @@ return [
|
|||
]
|
||||
],
|
||||
Form::class => [
|
||||
'filterableAttributes' => ['to', 'is_active', 'is_private'],
|
||||
'filterableAttributes' => ['to'],
|
||||
'searchableAttributes' => ['name'],
|
||||
'sortableAttributes' => ['from'],
|
||||
'sortableAttributes' => ['from',],
|
||||
'displayedAttributes' => ['from', 'name', 'id', 'to'],
|
||||
'pagination' => [
|
||||
'maxTotalHits' => 1000000,
|
||||
|
|
|
@ -47,8 +47,6 @@ class FormFactory extends Factory
|
|||
'registration_until' => $this->faker->dateTimeBetween('now', '+2 weeks')->format('Y-m-d H:i:s'),
|
||||
'mail_top' => EditorRequestFactory::new()->create(),
|
||||
'mail_bottom' => EditorRequestFactory::new()->create(),
|
||||
'is_active' => true,
|
||||
'is_private' => false,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->boolean('is_active')->default(true)->after('name');
|
||||
$table->boolean('is_private')->default(false)->after('name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('forms', function (Blueprint $table) {
|
||||
$table->dropColumn('is_active');
|
||||
$table->dropColumn('is_private');
|
||||
});
|
||||
}
|
||||
};
|
|
@ -39,11 +39,7 @@
|
|||
<div class="flex flex-col mt-3">
|
||||
<ui-tabs v-model="active" :entries="tabs"></ui-tabs>
|
||||
<div v-show="active === 0" class="grid grid-cols-2 gap-3">
|
||||
<div class="flex space-x-3">
|
||||
<f-text id="name" v-model="single.name" class="grow" name="name" label="Name" required></f-text>
|
||||
<f-switch id="is_active" v-model="single.is_active" name="is_active" label="Aktiv"></f-switch>
|
||||
<f-switch id="is_private" v-model="single.is_private" name="is_private" label="Privat"></f-switch>
|
||||
</div>
|
||||
<f-text id="name" v-model="single.name" name="name" label="Name" required></f-text>
|
||||
<f-singlefile
|
||||
id="header_image"
|
||||
v-model="single.header_image"
|
||||
|
@ -124,7 +120,6 @@
|
|||
<page-filter breakpoint="xl">
|
||||
<f-text id="search" :model-value="getFilter('search')" name="search" label="Suchen …" size="sm" @update:model-value="setFilter('search', $event)"></f-text>
|
||||
<f-switch id="past" :model-value="getFilter('past')" label="vergangene zeigen" size="sm" @update:model-value="setFilter('past', $event)"></f-switch>
|
||||
<f-switch id="inactive" :model-value="getFilter('inactive')" label="inaktive zeigen" size="sm" @update:model-value="setFilter('inactive', $event)"></f-switch>
|
||||
</page-filter>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
|
||||
|
|
|
@ -74,19 +74,6 @@ class FormApiListActionTest extends FormTestCase
|
|||
->assertJsonCount(1, 'meta.agegroups');
|
||||
}
|
||||
|
||||
public function testItDoesntDisplayInactiveForms(): void
|
||||
{
|
||||
$this->loginNami()->withoutExceptionHandling();
|
||||
|
||||
Form::factory()->isActive(false)->withImage('headerImage', 'lala-2.jpg')->count(1)->create();
|
||||
Form::factory()->isActive(true)->withImage('headerImage', 'lala-2.jpg')->count(2)->create();
|
||||
|
||||
sleep(1);
|
||||
$this->get('/api/form?perPage=15&filter=' . $this->filterString(['inactive' => true]))->assertJsonCount(3, 'data');
|
||||
$this->get('/api/form?perPage=15&filter=' . $this->filterString(['inactive' => false]))->assertJsonCount(2, 'data');
|
||||
$this->get('/api/form?perPage=15&filter=' . $this->filterString([]))->assertJsonCount(2, 'data');
|
||||
}
|
||||
|
||||
public function testItDisplaysDailyForms(): void
|
||||
{
|
||||
Carbon::setTestNow(Carbon::parse('2023-03-02'));
|
||||
|
|
|
@ -46,8 +46,6 @@ class FormIndexActionTest extends FormTestCase
|
|||
->assertInertiaPath('data.data.0.from', '2023-05-05')
|
||||
->assertInertiaPath('data.data.0.participants_count', 5)
|
||||
->assertInertiaPath('data.data.0.to', '2023-06-07')
|
||||
->assertInertiaPath('data.data.0.is_active', true)
|
||||
->assertInertiaPath('data.data.0.is_private', false)
|
||||
->assertInertiaPath('data.data.0.registration_from', '2023-05-06 04:00:00')
|
||||
->assertInertiaPath('data.data.0.registration_until', '2023-04-01 05:00:00')
|
||||
->assertInertiaPath('data.data.0.links.participant_index', route('form.participant.index', ['form' => $form]))
|
||||
|
@ -58,8 +56,6 @@ class FormIndexActionTest extends FormTestCase
|
|||
->assertInertiaPath('data.meta.default.name', '')
|
||||
->assertInertiaPath('data.meta.default.description', [])
|
||||
->assertInertiaPath('data.meta.default.excerpt', '')
|
||||
->assertInertiaPath('data.meta.default.is_active', true)
|
||||
->assertInertiaPath('data.meta.default.is_private', false)
|
||||
->assertInertiaPath('data.meta.default.mailattachments', [])
|
||||
->assertInertiaPath('data.meta.default.config', null)
|
||||
->assertInertiaPath('data.meta.base_url', url(''))
|
||||
|
@ -81,18 +77,6 @@ class FormIndexActionTest extends FormTestCase
|
|||
->assertInertiaCount('data.data', 2);
|
||||
}
|
||||
|
||||
public function testItDoesntReturnInactiveForms(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Form::factory()->isActive(false)->count(1)->create();
|
||||
Form::factory()->isActive(true)->count(2)->create();
|
||||
|
||||
sleep(1);
|
||||
$this->callFilter('form.index', [])->assertInertiaCount('data.data', 2);
|
||||
$this->callFilter('form.index', ['inactive' => true])->assertInertiaCount('data.data', 3);
|
||||
$this->callFilter('form.index', ['inactive' => false])->assertInertiaCount('data.data', 2);
|
||||
}
|
||||
|
||||
public function testItOrdersByStartDateDesc(): void
|
||||
{
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
|
|
|
@ -8,6 +8,7 @@ use App\Lib\Events\Succeeded;
|
|||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Generator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tests\RequestFactories\EditorRequestFactory;
|
||||
|
||||
class FormStoreActionTest extends FormTestCase
|
||||
|
@ -41,7 +42,6 @@ class FormStoreActionTest extends FormTestCase
|
|||
$this->assertEquals(json_decode('{"time":1,"blocks":[{"id":11,"type":"paragraph","data":{"text":"lala"},"tunes":{"condition":{"mode":"all","ifs":[]}}}],"version":"1.0"}', true), $form->mail_top);
|
||||
$this->assertEquals(json_decode('{"time":1,"blocks":[{"id":12,"type":"paragraph","data":{"text":"lalab"},"tunes":{"condition":{"mode":"all","ifs":[]}}}],"version":"1.0"}', true), $form->mail_bottom);
|
||||
$this->assertEquals('2023-05-04 01:00', $form->registration_from->format('Y-m-d H:i'));
|
||||
$this->assertEquals(true, $form->is_active);
|
||||
$this->assertEquals('2023-07-07 01:00', $form->registration_until->format('Y-m-d H:i'));
|
||||
$this->assertEquals('2023-07-07', $form->from->format('Y-m-d'));
|
||||
$this->assertEquals('2023-07-08', $form->to->format('Y-m-d'));
|
||||
|
|
|
@ -48,28 +48,6 @@ class FormUpdateActionTest extends FormTestCase
|
|||
$this->assertEquals(['firstname'], $form->fresh()->meta['active_columns']);
|
||||
}
|
||||
|
||||
public function testItUpdatesActiveState(): void
|
||||
{
|
||||
$this->login()->loginNami()->withoutExceptionHandling();
|
||||
$form = Form::factory()->create();
|
||||
|
||||
$this->patchJson(route('form.update', ['form' => $form]), FormRequest::new()->isActive(false)->create())->assertSessionDoesntHaveErrors()->assertOk();
|
||||
$this->assertFalse($form->fresh()->is_active);
|
||||
$this->patchJson(route('form.update', ['form' => $form]), FormRequest::new()->isActive(true)->create())->assertSessionDoesntHaveErrors()->assertOk();
|
||||
$this->assertTrue($form->fresh()->is_active);
|
||||
}
|
||||
|
||||
public function testItUpdatesPrivateState(): void
|
||||
{
|
||||
$this->login()->loginNami()->withoutExceptionHandling();
|
||||
$form = Form::factory()->create();
|
||||
|
||||
$this->patchJson(route('form.update', ['form' => $form]), FormRequest::new()->isPrivate(false)->create())->assertSessionDoesntHaveErrors()->assertOk();
|
||||
$this->assertFalse($form->fresh()->is_private);
|
||||
$this->patchJson(route('form.update', ['form' => $form]), FormRequest::new()->isPrivate(true)->create())->assertSessionDoesntHaveErrors()->assertOk();
|
||||
$this->assertTrue($form->fresh()->is_private);
|
||||
}
|
||||
|
||||
public function testItUpdatesActiveColumnsWhenFieldsAdded(): void
|
||||
{
|
||||
$this->login()->loginNami()->withoutExceptionHandling();
|
||||
|
|
Loading…
Reference in New Issue