CluPilotCloud/resources/views/livewire/admin/vpn-config-access.blade.php

49 lines
2.6 KiB
PHP

<div class="p-6">
<h3 class="text-base font-semibold text-ink">{{ __('vpn.get_config_title', ['name' => $name]) }}</h3>
@if ($config === null)
<p class="mt-1 text-sm text-muted">{{ __('vpn.get_config_body') }}</p>
<form wire:submit="reveal" class="mt-4 space-y-3">
{{-- autocomplete hint keeps password managers from offering to save
this as a new login for the site. --}}
<x-ui.input name="password" type="password" wire:model="password"
:label="__('vpn.your_password')" autocomplete="current-password" />
<div class="flex justify-end gap-2">
<x-ui.button variant="secondary" type="button" x-on:click="Livewire.dispatch('closeModal')">{{ __('vpn.cancel') }}</x-ui.button>
<x-ui.button variant="primary" type="submit" wire:loading.attr="disabled">
<x-ui.icon name="unlock" class="size-4" />{{ __('vpn.reveal') }}
</x-ui.button>
</div>
</form>
@else
<div class="mt-3" x-data="vpnConfigActions(@js($this->filename()))">
<pre x-ref="config" class="max-h-64 overflow-auto rounded-lg border border-line bg-surface-2 p-4 font-mono text-xs leading-relaxed text-body">{{ $config }}</pre>
<div class="mt-3 flex flex-wrap items-center gap-2">
<x-ui.button variant="primary" x-on:click="download()">
<x-ui.icon name="download" class="size-4" />{{ __('vpn.download') }}
</x-ui.button>
<x-ui.button variant="secondary" x-on:click="copy()">
<x-ui.icon name="copy" class="size-4" />
<span x-text="copied ? @js(__('vpn.copied')) : @js(__('vpn.copy'))"></span>
</x-ui.button>
<x-ui.button variant="secondary" wire:click="toggleQr" wire:loading.attr="disabled">
<x-ui.icon name="qr-code" class="size-4" />{{ $showQr ? __('vpn.qr_hide') : __('vpn.qr_show') }}
</x-ui.button>
<p x-show="failed" x-cloak class="text-xs text-danger">{{ __('vpn.copy_failed') }}</p>
</div>
@if ($qrSvg)
<div class="mt-4 flex flex-col items-center gap-2 rounded-lg border border-line p-4">
<div>{!! $qrSvg !!}</div>
<p class="text-xs text-muted">{{ __('vpn.qr_hint') }}</p>
</div>
@endif
<div class="mt-5 flex justify-end">
<x-ui.button variant="secondary" x-on:click="Livewire.dispatch('closeModal')">{{ __('common.close') }}</x-ui.button>
</div>
</div>
@endif
</div>