@extends('layouts.app') @section('content') @php $canManage = auth()->user()->canManageLicenses(); $isAdmin = auth()->user()->isSlamSuperAdmin(); $state = $license->expiryState($soonDays); $usagePercent = $license->usagePercent(); $isPerpetual = $license->is_perpetual || $license->license_type === \App\Models\License::TYPE_PERPETUAL; $statusLabels = [ 'create' => 'Tambah', 'update' => 'Ubah', 'delete' => 'Hapus (Trash)', 'restore' => 'Pulihkan', 'purge' => 'Hapus permanen', 'reveal' => 'Tampilkan kunci', 'renew' => 'Perpanjang', 'import' => 'Impor', 'export' => 'Ekspor', ]; $fieldLabels = [ 'qty_total' => 'Qty', 'expired_at' => 'Tanggal berakhir', 'cost' => 'Biaya', 'start_date' => 'Tanggal mulai', 'verified_at' => 'Verifikasi', ]; @endphp
{{ $license->product?->vendor ?? 'Lisensi' }}

{{ $license->displayName() }}

{{ $license->typeLabel() }} @if ($license->sbu) SBU {{ $license->sbu }} @endif @if ($state === 'perpetual') Perpetual @elseif ($state === 'expired') Kedaluwarsa @elseif ($state === 'soon') Segera berakhir @else Aktif @endif @if ($license->isNonCompliant()) ⚠ Tidak patuh @endif @if ($license->status === \App\Models\License::STATUS_CANCELLED) Dibatalkan @endif · {{ $license->assignedSeatsCount() }} / {{ $license->qty_total }} seat terpakai
Kembali @if ($canManage) Ubah @endif @if ($canManage && ($isAdmin || $license->created_by === auth()->id()))
@csrf @method('DELETE')
@endif

Informasi kontrak

@php $info = [ 'Produk' => $license->product?->name, 'Vendor' => $license->product?->vendor, 'SBU' => $license->sbu, 'Edisi / paket' => $license->edition, 'Tenant / domain' => $license->tenant_or_domain, 'Tanggal mulai' => $license->start_date?->format('d-m-Y'), 'Tanggal berakhir' => $isPerpetual ? 'Perpetual' : $license->expired_at?->format('d-m-Y'), 'Terverifikasi' => $license->verified_at?->format('d-m-Y H:i'), 'Biaya' => $license->cost !== null ? trim(($license->currency ?: 'IDR').' '.number_format((float) $license->cost, 2, ',', '.')) : null, 'Siklus bayar' => $license->billingCycleLabel(), 'PO / Invoice' => $license->po_invoice_no, 'Reseller' => $license->reseller, 'Penanggung jawab' => $license->owner?->name, 'Status data' => $license->statusLabel(), 'Terakhir diubah' => $license->updated_at?->format('d-m-Y H:i'), ]; @endphp @foreach ($info as $label => $value)
{{ $label }} {{ filled($value) ? $value : '—' }} @if ($label === 'Tanggal berakhir' && ! $isPerpetual) @if ($license->verified_at) ✓ terverifikasi @else belum diverifikasi @endif @endif
@endforeach
Catatan

{{ $license->notes ?: '—' }}

Rahasia

Kunci lisensi
••••••••
@if ($license->hasLicenseKey() && $canManage) @elseif (! $license->hasLicenseKey()) Tidak ada kunci tersimpan @else Hanya Super Admin / IT Staff @endif

Setiap tampil/salin meminta password login, tercatat di audit log, dan disembunyikan otomatis setelah 30 detik.

Seat & penggunaan

Terpakai {{ $license->assignedSeatsCount() }} · tersedia {{ $license->availableSeats() }} @if ($license->isNonCompliant()) · melebihi qty@endif

@if ($seats->where('seat_status', \App\Models\LicenseSeat::STATUS_UNUSED)->isNotEmpty() || $seats->where('seat_status', \App\Models\LicenseSeat::STATUS_UNLICENSED)->isNotEmpty()) Buka tindak lanjut @endif
@if ($canManage)
+ Tambah seat
@csrf
@if ($license->assignedSeatsCount() >= $license->qty_total)
Seat terpakai sudah mencapai/melebihi Qty. Untuk tetap assign, centang konfirmasi dan isi alasan.
@endif
+ Tambah seat massal
@csrf
@endif @php $nearestSeatExpiry = $seats->whereNotNull('expired_at')->sortBy('expired_at')->first()?->expired_at; $nearestSeatExpiryDays = $nearestSeatExpiry ? (int) now()->startOfDay()->diffInDays($nearestSeatExpiry->copy()->startOfDay(), false) : null; $nearestSeatAccounts = $nearestSeatExpiry ? $seats->filter(fn ($seat) => $seat->expired_at?->toDateString() === $nearestSeatExpiry->toDateString())->pluck('assignee_name')->values() : collect(); @endphp @if ($nearestSeatExpiry)
Peringatan: tanggal expired seat terdekat {{ $nearestSeatExpiry->format('d-m-Y') }} @if ($nearestSeatExpiryDays < 0) (sudah lewat {{ abs($nearestSeatExpiryDays) }} hari). @elseif ($nearestSeatExpiryDays === 0) (hari ini). @else ({{ $nearestSeatExpiryDays }} hari lagi). @endif
Akun: {{ $nearestSeatAccounts->implode(', ') }}
@endif
@forelse ($seats as $seat) @empty @endforelse
Akun / perangkat Pemakai Status Tanggal Aksi
{{ $seat->assignee_name }}
{{ $seat->assigneeTypeLabel() }} @if ($seat->credential_ref) · kredensial @elseif ($seat->hasAccountPassword()) · 🔒 password tersimpan @endif
@if ($seat->remark)
{{ $seat->remark }}
@endif
{{ $seat->employee_name ?: '—' }} @if ($seat->department)
{{ $seat->department }}
@endif
@php $seatBadge = match ($seat->seat_status) { \App\Models\LicenseSeat::STATUS_ASSIGNED => 'badge-selesai', \App\Models\LicenseSeat::STATUS_UNUSED => 'badge-terlambat', \App\Models\LicenseSeat::STATUS_UNLICENSED => 'badge-open', default => 'badge-berjalan', }; @endphp {{ $seat->statusLabel() }} @if ($canManage)
@csrf @method('PATCH')
@endif
Assign {{ $seat->assigned_at?->format('d-m-Y') ?? '—' }}
@if ($seat->released_at)
Lepas {{ $seat->released_at->format('d-m-Y') }}
@endif @if ($seat->last_used_at)
Dipakai {{ $seat->last_used_at->format('d-m-Y') }}
@endif @if ($seat->expired_at)
Expired {{ $seat->expired_at->format('d-m-Y') }}
@endif
@if ($canManage) Ubah @endif @if ($canManage && $seat->isActive())
@csrf @method('DELETE')
@else — @endif
Belum ada seat tercatat.

Riwayat perubahan

@forelse ($histories as $history) @empty @endforelse
Waktu Jenis Field Lama → baru Catatan Oleh
{{ $history->created_at?->format('d-m-Y H:i') }} {{ $history->change_type === 'renewal' ? 'Perpanjangan' : 'Ubah' }} {{ $fieldLabels[$history->field] ?? $history->field }} {{ $history->old_value ?: '—' }} → {{ $history->new_value ?: '—' }} {{ $history->note ?: '—' }} {{ $history->changer?->name ?? 'sistem' }}
Belum ada riwayat qty/tanggal.

Pemakaian seat

{{ $license->assignedSeatsCount() }} / {{ $license->qty_total }}
Tersedia
{{ $license->availableSeats() }}
Unused
{{ $license->unusedSeatsCount() }}
Unlicensed
{{ $license->unlicensedSeatsCount() }}
Tidak patuh
{{ $license->isNonCompliant() ? 'Ya' : 'Tidak' }}
@if ($canManage && ! $isPerpetual)

Perpanjang

@csrf
@endif

Aktivitas terakhir

@forelse ($recentAudits as $audit)
{{ $statusLabels[$audit->action] ?? $audit->action }} · {{ $audit->user?->name ?? 'sistem' }} · {{ $audit->created_at?->format('d-m-Y H:i') }}
@empty

Belum ada aktivitas.

@endforelse @if ($isAdmin) Lihat audit log → @endif
@include('licenses._reveal-dialog') @endsection