Add has_nami to participant api index

This commit is contained in:
philipp lang 2024-06-20 23:25:14 +02:00
parent 0526b52b6b
commit 646b292249
2 changed files with 9 additions and 0 deletions

View File

@ -57,6 +57,7 @@ class ParticipantResource extends JsonResource
'default_filter_value' => ParticipantFilterScope::$nan,
'filters' => $filterData,
'form_meta' => $form->meta,
'has_nami_field' => $form->getFields()->hasNamiField(),
'links' => [
'update_form_meta' => route('form.update-meta', ['form' => $form]),
],

View File

@ -51,6 +51,7 @@ class ParticipantIndexActionTest extends FormTestCase
->assertJsonPath('meta.columns.6.display_attribute', 'birthday_display')
->assertJsonPath('meta.columns.0.display_attribute', 'vorname_display')
->assertJsonPath('meta.form_meta.active_columns', ['vorname', 'select', 'stufe', 'test1'])
->assertJsonPath('meta.has_nami_field', false)
->assertJsonPath('meta.links.update_form_meta', route('form.update-meta', ['form' => $form]))
->assertJsonPath('meta.form_meta.sorting', ['vorname', 'asc']);
}
@ -72,6 +73,13 @@ class ParticipantIndexActionTest extends FormTestCase
$this->callFilter('form.participant.index', ['data' => []], ['form' => $form])->assertJsonPath('meta.filter.data.check', ParticipantFilterScope::$nan);
}
public function testItDisplaysHasNamiField(): void
{
$this->login()->loginNami()->withoutExceptionHandling();
$form = Form::factory()->fields([$this->namiField('mitglieder')])->create();
$this->callFilter('form.participant.index', [], ['form' => $form])->assertJsonPath('meta.has_nami_field', true);
}
public function testItFiltersParticipantsByCheckboxValue(): void
{
$this->login()->loginNami()->withoutExceptionHandling();