142 lines
7.7 KiB
PHP
142 lines
7.7 KiB
PHP
<div>
|
|
<x-navigation.breadcrumb />
|
|
|
|
<div class="px-2 space-y-6">
|
|
<!-- Account deletion -->
|
|
<section class="bg-background-secondary border border-neutral rounded-lg p-6 space-y-6">
|
|
<div>
|
|
<h2 class="text-lg font-semibold text-base">{{ __('compliance-tools::client.deletion_heading') }}</h2>
|
|
<p class="mt-1 text-sm text-base/60 leading-relaxed">
|
|
{{ __('compliance-tools::client.deletion_description') }}
|
|
</p>
|
|
</div>
|
|
|
|
@php
|
|
$deletionStatus = __('compliance-tools::client.deletion_status_none');
|
|
if ($deletionRequest) {
|
|
$deletionStatus = match ($deletionRequest->status) {
|
|
\Paymenter\Extensions\Others\ComplianceTools\Models\AccountDeletionRequest::STATUS_PENDING => __('compliance-tools::client.deletion_status_pending'),
|
|
\Paymenter\Extensions\Others\ComplianceTools\Models\AccountDeletionRequest::STATUS_COMPLETED => __('compliance-tools::client.deletion_status_completed', ['date' => optional($deletionRequest->processed_at)->toDayDateTimeString()]),
|
|
\Paymenter\Extensions\Others\ComplianceTools\Models\AccountDeletionRequest::STATUS_DENIED => __('compliance-tools::client.deletion_status_denied'),
|
|
default => __('compliance-tools::client.deletion_status_none'),
|
|
};
|
|
}
|
|
|
|
$disableDeletion = $deletionRequest && in_array($deletionRequest->status, [
|
|
\Paymenter\Extensions\Others\ComplianceTools\Models\AccountDeletionRequest::STATUS_PENDING,
|
|
\Paymenter\Extensions\Others\ComplianceTools\Models\AccountDeletionRequest::STATUS_COMPLETED,
|
|
]);
|
|
@endphp
|
|
|
|
<div class="bg-background border border-neutral rounded-md px-4 py-3 text-sm text-base font-medium">
|
|
{{ $deletionStatus }}
|
|
</div>
|
|
|
|
<form wire:submit.prevent="submitDeletionRequest" onsubmit="return confirm('{{ addslashes(__('compliance-tools::client.deletion_confirm')) }}');" class="space-y-5">
|
|
<h2 class="text-lg font-semibold text-base">Reason for Request</h2>
|
|
|
|
<textarea
|
|
name="reason"
|
|
wire:model.defer="reason"
|
|
placeholder="{{ __('compliance-tools::client.deletion_reason_label') }}"
|
|
rows="3"
|
|
class="min-h-[7rem] mt-4 w-full border border-gray-300 rounded-md p-2 resize-none"
|
|
></textarea>
|
|
|
|
<button
|
|
type="submit"
|
|
class="bg-red-600 text-white px-4 py-2 rounded-md hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed w-fit"
|
|
@if($disableDeletion) disabled @endif
|
|
>
|
|
{{ __('compliance-tools::client.deletion_submit') }}
|
|
</button>
|
|
</form>
|
|
</section>
|
|
|
|
<!-- Support PIN -->
|
|
<section class="bg-background-secondary border border-neutral rounded-lg p-6 space-y-6">
|
|
<div>
|
|
<h2 class="text-lg font-semibold text-base">{{ __('compliance-tools::client.pin_heading') }}</h2>
|
|
<p class="mt-1 text-sm text-base/60 leading-relaxed">
|
|
{{ __('compliance-tools::client.pin_description') }}
|
|
</p>
|
|
</div>
|
|
|
|
@php
|
|
$hasGeneratedPin = filled($generatedPin);
|
|
$maskedPin = $hasGeneratedPin ? str_repeat('•', strlen($generatedPin)) : '';
|
|
$plainPin = $generatedPin ?? '';
|
|
$disableRevoke = !$activePin;
|
|
@endphp
|
|
|
|
@if($hasGeneratedPin)
|
|
<div class="bg-primary/20 border border-primary/40 rounded-md px-4 py-4 space-y-4 text-center"
|
|
x-data="{
|
|
pin: @js($plainPin),
|
|
async copy() {
|
|
if (!this.pin) return;
|
|
try {
|
|
await navigator.clipboard.writeText(this.pin);
|
|
} catch (e) {
|
|
const helper = document.createElement('textarea');
|
|
helper.value = this.pin;
|
|
helper.style.position = 'fixed';
|
|
helper.style.opacity = '0';
|
|
document.body.appendChild(helper);
|
|
helper.select();
|
|
document.execCommand('copy');
|
|
document.body.removeChild(helper);
|
|
}
|
|
$wire.pinCopied();
|
|
}
|
|
}">
|
|
<p class="text-sm font-semibold text-primary flex items-center justify-center gap-2">
|
|
<x-ri-key-line class="size-5" />
|
|
{{ __('compliance-tools::client.pin_plaintext_notice') }}
|
|
</p>
|
|
<p class="font-mono text-2xl tracking-[0.6em] text-primary select-all">
|
|
{{ $showGeneratedPin ? $generatedPin : $maskedPin }}
|
|
</p>
|
|
<div class="flex flex-wrap justify-center gap-3">
|
|
<button type="button" wire:click="toggleGeneratedPinVisibility" class="bg-gray-200 text-gray-800 px-3 py-2 rounded-md hover:bg-gray-300 md:w-fit !w-auto">
|
|
@if($showGeneratedPin)
|
|
<x-ri-eye-off-line class="size-4" />
|
|
{{ __('compliance-tools::client.pin_hide') }}
|
|
@else
|
|
<x-ri-eye-line class="size-4" />
|
|
{{ __('compliance-tools::client.pin_show') }}
|
|
@endif
|
|
</button>
|
|
|
|
<button type="button" class="bg-gray-200 text-gray-800 px-3 py-2 rounded-md hover:bg-gray-300 md:w-fit !w-auto" x-on:click="copy()">
|
|
<x-ri-file-copy-line class="size-4" />
|
|
{{ __('compliance-tools::client.pin_copy') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@elseif($activePin)
|
|
<div class="bg-success/20 border border-success/40 rounded-md px-4 py-3 text-sm text-success flex items-center gap-2">
|
|
<x-ri-shield-check-line class="size-5" />
|
|
{{ __('compliance-tools::client.pin_active_until', ['date' => optional($activePin->expires_at)->toDayDateTimeString()]) }}
|
|
</div>
|
|
@else
|
|
<div class="bg-background border border-neutral rounded-md px-4 py-3 text-sm text-base font-medium">
|
|
{{ __('compliance-tools::client.pin_none') }}
|
|
</div>
|
|
@endif
|
|
|
|
<div class="flex flex-col md:flex-row gap-3 md:items-center">
|
|
<button type="button" wire:click="generatePin" class="bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 md:w-fit flex items-center gap-2">
|
|
<x-ri-refresh-line class="size-4" />
|
|
{{ __('compliance-tools::client.pin_generate') }}
|
|
</button>
|
|
|
|
<button type="button" wire:click="revokePin" class="bg-gray-200 text-gray-800 px-4 py-2 rounded-md hover:bg-gray-300 md:w-fit flex items-center gap-2" @if($disableRevoke) disabled @endif>
|
|
<x-ri-close-circle-line class="size-4" />
|
|
{{ __('compliance-tools::client.pin_revoke') }}
|
|
</button>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|