Adel-laravel/projek_pkl/resources/views/dashboard/sections/karyawan.blade.php

173 lines
4.9 KiB
PHP

@extends('layouts.app')
@section('title', 'Data Karyawan')
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
.container {
width: 90%;
max-width: 900px;
background: #ffffff;
padding: 20px;
border-radius: 20px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
h1 {
text-align: center;
margin-bottom: 20px;
color: #2c3e50;
}
.button {
display: inline-block;
padding: 14px 15px;
margin-top: 10px;
color: #ffffff;
background: #4e73df;
text-decoration: none;
border-radius: 50px;
font-weight: 600;
transition: background 0.3s ease;
}
.button:hover {
background: #ACB6E5;
}
.alert {
padding: 15px;
background-color: #d1f2eb;
color: #117864;
margin-bottom: 20px;
border-left: 6px solid #1abc9c;
border-radius: 8px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 15px;
overflow: hidden;
border-radius: 15px;
}
thead {
background-color: #4e73df;
color: white;
text-align: center;
}
th, td {
padding: 15px;
text-align: center;
font-size: 15px;
border-bottom: 1px solid #e1e1e1;
}
tbody tr:nth-child(even) {
background-color: #f4f9fd;
}
tbody tr:hover {
background-color: #e1e6fc;
}
p {
text-align: center;
margin-top: 10px;
font-size: 15px;
color: #555;
}
.button-opsi {
display: inline-block ;
padding: 10px 15px;
margin-top: 2px;
color: #ffffff;
background: #4e73df;
text-decoration: none;
border: none;
border-radius: 15px;
font-size: 15px;
font family: 'Poppins', sans-serif;
font-weight: 300;
transition: background 0.3s ease;
margin-right: 5px;
cursor: pointer;
}
.button-group {
display: flex;
justify-content: right;
margin-top: 20px;
padding: 0 20px;
font-size: 15px;
}
.btn {
padding: 10px 20px;
border-radius: 20px;
border: none;
text-decoration: none;
font-size: 15px;
color: white;
font-weight: bold;
}
.btn-kembali {
background-color: #4e73df;
}
.btn-tambah {
background-color: #4e73df;
}
</style>
@section('content')
<div class="container">
<h1 class="h3 mb-4 text-gray-800">Data Karyawan</h1>
@if(session('success'))
<div class="alert">{{ session('success') }}</div>
@endif
@if(is_countable($karyawan) && count($karyawan) > 0)
<table>
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Umur</th>
<th>Jabatan</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
@foreach ($karyawan as $row)
<tr>
<td>{{ $row->id }}</td>
<td>{{ $row->nama }}</td>
<td>{{ $row->umur }}</td>
<td>{{ $row->jabatan()->first()?->jabatan ?? '-' }}</td>
<td>
<a href="{{ route('karyawan.edit', $row->id) }}" class="button-opsi">Edit</a>
<!-- <a href="{{ route('karyawan.show', $row->id) }}" class="button-opsi">Lihat</a> -->
<form action="{{ route('karyawan.destroy', $row->id) }}" method="POST">
@csrf
@method('DELETE')
<button class="button-opsi" display: inline;>Hapus</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<p>Belum ada data karyawan yang terdaftar.</p>
@endif
<div class="button-group">
<a href="{{ route('karyawan.create') }}" class="button">+ Tambah Data Karyawan</a>
</div>
</div>
@endsection