46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Admin;
|
|
|
|
use App\Models\DpaVersion;
|
|
use LivewireUI\Modal\ModalComponent;
|
|
|
|
/**
|
|
* Confirmation before a processing agreement goes into force (R23).
|
|
*
|
|
* Publishing is not a save: acceptance is per version, so from this moment every
|
|
* customer who had accepted the previous one is outstanding again. That is the
|
|
* correct behaviour and an expensive one to trigger by a misplaced click.
|
|
*
|
|
* Mutates nothing itself — it dispatches back to ProcessingAgreements, whose
|
|
* publish() keeps the permission check it already had.
|
|
*/
|
|
class ConfirmPublishDpa extends ModalComponent
|
|
{
|
|
public string $uuid;
|
|
|
|
public string $version = '';
|
|
|
|
public function mount(string $uuid): void
|
|
{
|
|
$this->authorize('dpa.manage');
|
|
|
|
$version = DpaVersion::query()->where('uuid', $uuid)->firstOrFail();
|
|
|
|
$this->uuid = $uuid;
|
|
$this->version = $version->version;
|
|
}
|
|
|
|
public function confirm(): void
|
|
{
|
|
$this->authorize('dpa.manage');
|
|
$this->dispatch('dpa-publish-confirmed', uuid: $this->uuid);
|
|
$this->closeModal();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.admin.confirm-publish-dpa');
|
|
}
|
|
}
|