Skip to content

Commit

Permalink
Show consent options in a collapsible format to make it easier to see…
Browse files Browse the repository at this point in the history
… whats on the page
  • Loading branch information
cannycookie committed Feb 13, 2024
1 parent 6e1eefa commit ac205a3
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/Livewire/ConsentOptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ public function infolist(Infolist $infolist): Infolist
->record($this->user)
->schema([

Fieldset::make('Your consent is required')->schema([

TextEntry::make('info')
->label('')
->label("")
->size(TextEntry\TextEntrySize::Medium)
->default(new HtmlString("Hi {$this->user->fullName}, please read these terms and conditions carefully, we will email a copy to {$this->user->email}")),
->default(new HtmlString("Hi {$this->user->firstname}, <br>Please read these terms and conditions carefully, we will email a copy to {$this->user->email}"))
->extraAttributes(['class'=>'mb-4']),

RepeatableEntry::make('collections')
->label('')
Expand Down Expand Up @@ -104,8 +105,18 @@ public function infolist(Infolist $infolist): Infolist
->state(function (ConsentOption $record): string {
return new HtmlString('<strong>Last Updated</strong>: '.$record->updated_at->format('d M Y'));
})
]),
])
->collapsible()
->collapsed(function(ConsentOption $record){
$first = $this->user->collections->first();
return !($first->id === $record->id);

})
->persistCollapsed()
->id(fn (ConsentOption $record) => "consent-option-{$record->id}")
,
])
->contained(false)
->columns(2)
->columnSpanFull(),
Actions::make([
Expand All @@ -119,8 +130,8 @@ public function infolist(Infolist $infolist): Infolist
$this->acceptConsent();
}),
])->alignEnd(),
])->columns(1),
])->columns(3);

])->columns(1);
}

public function previousConsents($key)
Expand Down

0 comments on commit ac205a3

Please sign in to comment.