From fbcd634a8a358cc2e22a6e3936476c089ce20c22 Mon Sep 17 00:00:00 2001 From: "kreaweb.be" Date: Mon, 23 Sep 2024 14:54:23 +0200 Subject: [PATCH] Added Summary field on Person --- app/Livewire/Forms/People/ProfileForm.php | 6 ++ app/Livewire/People/Edit/Profile.php | 6 +- app/Models/Person.php | 2 + .../2024_03_03_300001_create_people_table.php | 2 + lang/de/person.php | 1 + lang/en/person.php | 1 + lang/nl/person.php | 1 + .../views/livewire/people/datasheet.blade.php | 73 +++++++++++-------- .../livewire/people/edit/profile.blade.php | 6 ++ .../views/livewire/people/profile.blade.php | 53 ++++++++------ 10 files changed, 97 insertions(+), 54 deletions(-) diff --git a/app/Livewire/Forms/People/ProfileForm.php b/app/Livewire/Forms/People/ProfileForm.php index 01ac770d..557488e7 100644 --- a/app/Livewire/Forms/People/ProfileForm.php +++ b/app/Livewire/Forms/People/ProfileForm.php @@ -35,6 +35,8 @@ class ProfileForm extends Form public $pob = null; + public $summary = null; + // ----------------------------------------------------------------------- #[Computed(persist: true, seconds: 3600, cache: true)] public function genders(): Collection @@ -68,6 +70,8 @@ public function rules(): array new DobValid, ], 'pob' => ['nullable', 'string', 'max:255'], + + 'summary' => ['nullable', 'string', 'max:65535'], ]; } @@ -90,6 +94,8 @@ public function validationAttributes(): array 'yob' => __('person.yob'), 'dob' => __('person.dob'), 'pob' => __('person.pob'), + + 'summary' => __('person.summary'), ]; } } diff --git a/app/Livewire/People/Edit/Profile.php b/app/Livewire/People/Edit/Profile.php index 89ba8b24..1f38383a 100644 --- a/app/Livewire/People/Edit/Profile.php +++ b/app/Livewire/People/Edit/Profile.php @@ -36,6 +36,8 @@ public function mount(): void $this->profileForm->yob = $this->person->yob ?? null; $this->profileForm->dob = $this->person->dob ? Carbon::parse($this->person->dob)->format('Y-m-d') : null; $this->profileForm->pob = $this->person->pob; + + $this->profileForm->summary = $this->person->summary; } public function saveProfile() @@ -69,7 +71,9 @@ public function isDirty(): bool $this->profileForm->yob != $this->person->yob or $this->profileForm->dob != ($this->person->dob ? Carbon::parse($this->person->dob)->format('Y-m-d') : null) or - $this->profileForm->pob != $this->person->pob; + $this->profileForm->pob != $this->person->pob or + + $this->profileForm->summary != $this->person->summary; } // ------------------------------------------------------------------------------ diff --git a/app/Models/Person.php b/app/Models/Person.php index 3bf0599e..c43b28ea 100644 --- a/app/Models/Person.php +++ b/app/Models/Person.php @@ -46,6 +46,8 @@ class Person extends Model implements HasMedia 'dob', 'yob', 'pob', 'dod', 'yod', 'pod', + 'summary', + 'street', 'number', 'postal_code', 'city', 'province', 'state', diff --git a/database/migrations/2024_03_03_300001_create_people_table.php b/database/migrations/2024_03_03_300001_create_people_table.php index d3400bfa..ded7f85c 100644 --- a/database/migrations/2024_03_03_300001_create_people_table.php +++ b/database/migrations/2024_03_03_300001_create_people_table.php @@ -33,6 +33,8 @@ public function up(): void $table->integer('yod')->nullable(); $table->string('pod')->nullable(); + $table->text('summary')->nullable(); + $table->string('street', 100)->nullable(); $table->string('number', 20)->nullable(); $table->string('postal_code', 20)->nullable(); diff --git a/lang/de/person.php b/lang/de/person.php index de3e8a0e..8dbcd2eb 100644 --- a/lang/de/person.php +++ b/lang/de/person.php @@ -91,6 +91,7 @@ 'dod' => 'Sterbedatum', 'yod' => 'Sterbejahr', 'pod' => 'Sterbeort', + 'summary' => 'Zusammenfassung', 'email' => 'E-Mail Adresse', 'password' => 'Passwort', 'address' => 'Adresse', diff --git a/lang/en/person.php b/lang/en/person.php index 61c14180..1d3a03f1 100644 --- a/lang/en/person.php +++ b/lang/en/person.php @@ -91,6 +91,7 @@ 'dod' => 'Date of death', 'yod' => 'Year of death', 'pod' => 'Place of death', + 'summary' => 'Summary', 'email' => 'Email', 'password' => 'Password', 'address' => 'Address', diff --git a/lang/nl/person.php b/lang/nl/person.php index e8c4ece3..3fedb2c8 100644 --- a/lang/nl/person.php +++ b/lang/nl/person.php @@ -91,6 +91,7 @@ 'dod' => 'Datum overlijden', 'yod' => 'Jaar overlijden', 'pod' => 'Plaats overlijden', + 'summary' => 'Samenvatting', 'email' => 'E-mail', 'password' => 'Password', 'address' => 'Adres', diff --git a/resources/views/livewire/people/datasheet.blade.php b/resources/views/livewire/people/datasheet.blade.php index d5fa635f..8cc71636 100644 --- a/resources/views/livewire/people/datasheet.blade.php +++ b/resources/views/livewire/people/datasheet.blade.php @@ -1,4 +1,4 @@ -
+
{{-- names --}} @@ -9,25 +9,25 @@ - + - + - + - + - + - + - + - + {{-- sex & gender --}} @@ -36,7 +36,7 @@ - + - + - + {{-- birth --}} @@ -56,17 +56,17 @@ - + - + - + - + @@ -79,20 +79,20 @@ - + - + - + - + - - + + @else {{-- contact --}} @@ -101,15 +101,15 @@ - + - - + + - + - + @endif @@ -117,6 +117,21 @@ + + + + + + + + + + + + + + + {{-- family --}} @@ -144,9 +159,9 @@ @endif - + - +
  {{ __('person.names') }}
  {{ __('person.firstname') }} :{{ $person->firstname }}{{ $person->firstname }}
  {{ __('person.surname') }} :{{ $person->surname }}{{ $person->surname }}
  {{ __('person.birthname') }} :{{ $person->birthname }}{{ $person->birthname }}
  {{ __('person.nickname') }} :{{ $person->nickname }}{{ $person->nickname }}
{{ __('person.sex') }} & {{ __('person.gender') }}  
  {{ __('person.sex') }} : @@ -44,10 +44,10 @@
  {{ __('person.gender') }} :{{ $person->gender }}{{ $person->gender }}
{{ __('person.birth') }}  
  {{ __('person.dob') }} : {{ $person->birth_formatted }}
  {{ __('person.pob') }} :{{ $person->pob }}{{ $person->pob }}
  {{ __('person.age') }} : {{ $person->age }}{{ __('person.death') }}  
  {{ __('person.dod') }} : {{ $person->death_formatted }}
  {{ __('person.pod') }} :{{ $person->pod }}{{ $person->pod }}
 {{ __('person.cemetery') }} :{!! implode('
', array_filter([$person->getMetadataValue('cemetery_location_name'), nl2br(e($person->getMetadataValue('cemetery_location_address')))])) !!}
{{ __('person.cemetery') }} :{!! implode('
', array_filter([$person->getMetadataValue('cemetery_location_name'), nl2br(e($person->getMetadataValue('cemetery_location_address')))])) !!}
{{ __('person.contact') }}  
 {{ __('person.address') }} :{!! nl2br(e($person->address)) !!}{{ __('person.address') }} :{!! nl2br(e($person->address)) !!}
  {{ __('person.phone') }} :{{ $person->phone }}{{ $person->phone }}
 
 {{ __('person.summary') }} 
 {{ $person->summary }}
 
{{ __('person.family') }}
 {{ __('person.parents') }} :{{ __('person.parents') }} : @if ($person->parents) {{ $person->parents->person_1->name }} {{ $person->parents->person_1->birth_year }}
diff --git a/resources/views/livewire/people/edit/profile.blade.php b/resources/views/livewire/people/edit/profile.blade.php index 0f4c49f0..f637c325 100644 --- a/resources/views/livewire/people/edit/profile.blade.php +++ b/resources/views/livewire/people/edit/profile.blade.php @@ -74,6 +74,12 @@
+ + + {{-- summary --}} +
+ +
diff --git a/resources/views/livewire/people/profile.blade.php b/resources/views/livewire/people/profile.blade.php index f0ce270d..64179320 100644 --- a/resources/views/livewire/people/profile.blade.php +++ b/resources/views/livewire/people/profile.blade.php @@ -1,4 +1,4 @@ -
+
@@ -68,36 +68,36 @@
- + - + - + - + - + - + - + - + - + - + - + - + - + - + @if ($person->isDeceased()) - + - + - + - + - + - + @else @@ -153,13 +153,18 @@ @endif - + - + - + @endif + + + + +
{{ __('person.firstname') }}{{ $person->firstname }}{{ $person->firstname }}
{{ __('person.surname') }}{{ $person->surname }}{{ $person->surname }}
{{ __('person.birthname') }}{{ $person->birthname }}{{ $person->birthname }}
{{ __('person.nickname') }}{{ $person->nickname }}{{ $person->nickname }}
{{ __('person.sex') }} ({{ __('person.biological') }}) {{ $person->sex == 'm' ? __('app.male') : __('app.female') }}
{{ __('person.gender') }}{{ $person->gender ? $person->gender->name : '' }}{{ $person->gender ? $person->gender->name : '' }}
{{ __('person.dob') }} {{ $person->birth_formatted }} @@ -106,13 +106,13 @@ @endif
{{ __('person.pob') }}{{ $person->pob }}{{ $person->pob }}
{{ __('person.dod') }} {{ $person->death_formatted }} @@ -121,13 +121,13 @@ @endif
{{ __('person.pod') }}{{ $person->pod }}{{ $person->pod }}
{{ __('person.cemetery') }}{{ $person->getMetadataValue('cemetery_location_name') }}{{ $person->getMetadataValue('cemetery_location_name') }}
@@ -139,7 +139,7 @@ @endif {!! nl2br(e($person->getMetadataValue('cemetery_location_address'))) !!}{!! nl2br(e($person->getMetadataValue('cemetery_location_address'))) !!}
{!! nl2br(e($person->address)) !!}{!! nl2br(e($person->address)) !!}
{{ __('person.phone') }}{{ $person->phone }}{{ $person->phone }}
{{ __('person.summary') }}{{ $person->summary }}