Files
siakad/resources/views/superuser/reset-password.blade.php
T

95 lines
4.9 KiB
PHP

@php
$generated = session('generated_password');
$profile = $account?->profile;
$rows = $account ? array_filter([
'Username' => $account->username,
$account->role->identifierLabel() => $profile?->nomor_induk,
'Jabatan' => $profile?->jabatan ?? null,
'Unit kerja' => $profile?->unit_kerja ?? null,
'Masuk terakhir' => $account->last_login_at?->locale('id')->isoFormat('D MMMM YYYY, HH.mm'),
], fn ($value) => filled($value)) : [];
@endphp
<x-layouts.app title="Atur ulang kata sandi">
<x-ui.page-header
title="Atur ulang kata sandi"
description="Cari akun dengan NIP atau NIM, lalu tetapkan kata sandi baru untuk pemiliknya."
/>
<div class="stack stack--lg">
@if (is_array($generated))
<x-ui.alert tone="warning" :title="'Kata sandi baru untuk '.$generated['name']">
<p>Kata sandi: <strong class="num" data-generated-password>{{ $generated['password'] }}</strong></p>
<p>Hanya ditampilkan sekali. Sampaikan langsung kepada pemilik akun, jangan lewat kanal terbuka.</p>
</x-ui.alert>
@endif
<x-glass.panel padding="lg">
<form method="GET" action="{{ route('superuser.reset-password') }}" role="search" novalidate>
<x-form.section title="Cari akun" :columns="1">
<x-form.field name="username" label="NIP atau NIM" :value="$username" inputmode="text" autocomplete="off" spellcheck="false" required />
</x-form.section>
<x-form.actions>
<x-ui.button type="submit" variant="secondary" icon="magnifying-glass">Cari akun</x-ui.button>
</x-form.actions>
</form>
</x-glass.panel>
@if ($username !== '' && $account === null)
<x-ui.alert tone="danger" title="Akun tidak ditemukan">
Tidak ada akun SIAKAD dengan NIP atau NIM {{ $username }}. Periksa kembali penulisannya.
</x-ui.alert>
@endif
@if ($account)
<div class="split">
<x-glass.panel padding="lg" class="grid content-start gap-6">
<div class="flex items-center gap-4">
<x-ui.avatar :name="$account->name" size="lg" />
<div class="grid gap-2 justify-items-start min-w-0">
<h2 class="text-title">{{ $account->name }}</h2>
<div class="cluster cluster--sm">
<x-ui.badge tone="gold">{{ $account->role->label() }}</x-ui.badge>
@if ($account->is_active)
<x-ui.badge tone="success" icon="check-circle">Aktif</x-ui.badge>
@else
<x-ui.badge tone="danger" icon="x-circle">Dibekukan</x-ui.badge>
@endif
</div>
</div>
</div>
<dl class="ledger border-t border-rule pt-6">
@foreach ($rows as $label => $value)
<div class="ledger__row"><dt>{{ $label }}</dt><dd>{{ $value }}</dd></div>
@endforeach
</dl>
</x-glass.panel>
<x-glass.panel padding="lg">
<form method="POST" action="{{ route('superuser.reset-password.update') }}" novalidate x-data="{ acak: @js((bool) old('acak')) }">
@csrf
@method('PUT')
<input type="hidden" name="username" value="{{ $account->username }}">
<x-form.section title="Kata sandi baru" description="Minimal 8 karakter berisi huruf dan angka, tanpa spasi." :columns="1">
<x-form.checkbox name="acak" label="Buat kata sandi acak" x-model="acak" />
<div x-show="!acak" class="grid gap-4">
<x-form.field name="password" label="Kata sandi baru" type="password" autocomplete="new-password" maxlength="49" required />
<x-form.field name="password_confirmation" label="Ulangi kata sandi baru" type="password" autocomplete="new-password" maxlength="49" required />
</div>
</x-form.section>
@unless ($account->is_active)
<p class="text-ink-2">Akun ini dibekukan. Mengatur ulang kata sandi tidak mengaktifkannya kembali.</p>
@endunless
<x-form.actions>
<x-ui.button type="submit" icon="key">Simpan kata sandi</x-ui.button>
</x-form.actions>
</form>
</x-glass.panel>
</div>
@endif
</div>
</x-layouts.app>