parfum/resources/views/livewire/studio/master/user/index.blade.php
2025-11-17 15:22:15 +07:00

223 lines
12 KiB
PHP

<flux:main>
<div class="flex justify-between items-center">
<div>
<flux:heading size="xl">{{ $pageTitle }}</flux:heading>
</div>
@can('create user')
<div>
<flux:button href="{{ route('studio.master.user.create') }}" variant="primary" wire:navigate.hover
class="text-sm">
Tambah
</flux:button>
</div>
@endcan
</div>
<div class="mt-6">
<flux:callout icon="megaphone" color="blue" class="mb-6">
<flux:callout.heading>Informasi</flux:callout.heading>
<flux:callout.text>
Jika pegawai keluar / resign, maka silakan ubah statusnya menjadi "Tidak Aktif" dan jangan dihapus buat
informasi data.
</flux:callout.text>
</flux:callout>
<div class="mb-6 grid grid-cols-1 lg:grid-cols-2 gap-4">
<flux:input icon="magnifying-glass" placeholder="Cari pegawai..." wire:model.live.debounce.500ms="search"
autocomplete="off" />
<flux:checkbox.group wire:model.live="status" variant="buttons">
@foreach (\App\Enums\UserStatus::cases() as $status)
<flux:checkbox value="{{ $status->value }}" label="{{ $status->label() }}" />
@endforeach
</flux:checkbox.group>
</div>
<flux:separator class="mb-6" />
@if (!empty($employees))
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 items-start">
@foreach ($employees as $employee)
<flux:card
class="relative space-y-4 transition-transform duration-300 ease-out hover:-translate-y-1 hover:shadow-lg">
<div
class="flex flex-col items-center text-center mb-4 p-4 rounded-t-lg {{ $employee['user']['status']['gradient'] }}">
<flux:avatar circle size="xl" name="{{ $employee['full_name'] }}" class="mb-3" />
<flux:heading size="lg" class="mb-1 text-white">{{ $employee['full_name'] }}
</flux:heading>
<div class="text-sm text-white/80 mb-2">{{ $employee['code'] }}</div>
</div>
<flux:separator></flux:separator>
<div class="space-y-3">
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">
Kredensial
</flux:heading>
<div class="flex items-start gap-2 text-sm">
<flux:icon.envelope
class="w-4 h-4 text-gray-500 dark:text-white flex-shrink-0 mt-0.5" />
<div class="text-gray-700 dark:text-gray-300">
<flux:text>{{ $employee['user']['email'] }}</flux:text>
<flux:text class="text-xs">{{ $employee['user']['username'] }}</flux:text>
</div>
</div>
</div>
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">Telepon
</flux:heading>
<div class="flex items-center gap-2 text-sm">
<flux:icon.phone class="w-4 h-4 text-gray-500 dark:text-white" />
<flux:text>{{ $employee['phone_number'] }}</flux:text>
</div>
</div>
@if ($employee['address'])
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">
Alamat
</flux:heading>
<div class="flex items-start gap-2 text-sm">
<flux:icon.map-pin
class="w-4 h-4 text-gray-500 dark:text-white flex-shrink-0 mt-0.5" />
<flux:text>{{ $employee['address'] }}</flux:text>
</div>
</div>
@endif
<div class="grid grid-cols-2 gap-3">
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">
Jenis
Kelamin</flux:heading>
<flux:badge color="{{ $employee['gender']['color'] }}" size="sm">
{{ $employee['gender']['label'] }}
</flux:badge>
</div>
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">Gaji
</flux:heading>
<flux:text>{{ $employee['base_salary'] }}</flux:text>
</div>
</div>
@if ($employee['referral_code'])
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">Kode
Referral</flux:heading>
<flux:badge color="zinc" size="sm">{{ $employee['referral_code'] }}
</flux:badge>
</div>
@endif
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">Outlet
</flux:heading>
<div class="flex flex-wrap gap-2">
@foreach ($employee['outlets'] as $outlet)
<span class="text-xs text-gray-400 border border-gray-400 rounded px-2 py-1">
{{ $outlet }}
</span>
@endforeach
</div>
</div>
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">Peran
</flux:heading>
<div class="flex flex-wrap gap-2">
@foreach ($employee['roles'] as $role)
<span class="text-xs text-gray-400 border border-gray-400 rounded px-2 py-1">
{{ $role }}
</span>
@endforeach
</div>
</div>
<div>
<flux:heading class="uppercase font-semibold text-gray-500 dark:text-gray-400 ">
Informasi
Tanggal</flux:heading>
<div class="bg-gray-200 dark:bg-gray-800 rounded-lg p-3">
<div class="flex flex-col gap-2 text-xs">
<div>
<span class="font-medium text-gray-900 dark:text-white">Tgl Lahir:</span>
<span
class="text-gray-700 dark:text-gray-300">{{ $employee['birthdate'] }}</span>
<span class="text-gray-500">({{ $employee['birth_age'] }})</span>
</div>
<div>
<span class="font-medium text-gray-900 dark:text-white">Tgl
Bergabung:</span>
<span
class="text-gray-700 dark:text-gray-300">{{ $employee['hire_date'] }}</span>
<span class="text-gray-500">({{ $employee['hire_ago'] }})</span>
</div>
@if ($employee['resign_date'])
<div>
<span class="font-medium text-gray-900 dark:text-white">Tgl
Resign:</span>
<span
class="text-gray-700 dark:text-gray-300">{{ $employee['resign_date'] }}</span>
<span class="text-gray-500">({{ $employee['resign_ago'] }})</span>
</div>
@endif
</div>
</div>
</div>
</div>
@canany(['update user', 'delete user'])
@if (auth()->id() !== $employee['user']['id'])
<flux:separator></flux:separator>
<div class="flex gap-2 pt-2">
@can('reset password user')
<flux:modal.trigger name="reset-password">
<flux:tooltip content="Reset Kata Sandi">
<flux:button variant="primary" color="blue" icon="lock-open" size="sm"
wire:click="$dispatch('fn:confirmAction', { id: '{{ $employee['user']['hash'] }}', title: 'Reset Kata Sandi', message: 'Anda yakin ingin mereset kata sandi pegawai ini menjadi {{ config('myconfig.password_default') }}?' ,confirmButtonText: 'Ya, Reset' })">
</flux:button>
</flux:tooltip>
</flux:modal.trigger>
@endcan
@can('update user')
<flux:tooltip content="Ubah">
<flux:button
href="{{ route('studio.master.user.edit', $employee['user']['hash']) }}"
wire:navigate.hover variant="primary" color="yellow" icon="pencil-square"
size="sm"></flux:button>
</flux:tooltip>
@endcan
@can('delete user')
<flux:modal.trigger name="delete">
<flux:tooltip content="Hapus">
<flux:button variant="danger" icon="trash" size="sm"
wire:click="$dispatch('fn:confirmAction', {id: '{{ $employee['user']['hash'] }}'})">
</flux:button>
</flux:tooltip>
</flux:modal.trigger>
@endcan
</div>
@endif
@endcanany
</flux:card>
@endforeach
</div>
@else
@include('components.lottie.not-found')
@endif
</div>
@include('components.confirmation.delete')
@include('components.confirmation.reset-password')
</flux:main>
@assets
<script src="https://unpkg.com/@lottiefiles/dotlottie-wc@0.8.5/dist/dotlottie-wc.js" type="module"></script>
@endassets