Lkp status overtime

parent a1749ed8
@extends('ui::layouts.app')
@section('content')
<div class="ui container">
<div class="ui segment">
<h3 class="ui header">Senarai Status Mileage</h3>
<div class="ui container" style="width: 100%;">
<!-- Outer Segment Card -->
<div class="ui segment" style="border-radius: 8px; padding: 25px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
<a href="{{ route('mileage::lkpstatus.create') }}" class="ui button primary style-mb">
<i class="plus icon"></i> Tambah Status
</a>
<!-- Teal Ribbon Label -->
<div class="ui teal ribbon label" style="font-size: 1rem; padding: 8px 16px; margin-bottom: 20px;">
Senarai Status Mileage
</div>
<table class="ui celled table">
<thead>
<tr>
<th>Ref ID</th>
<th>Keterangan</th>
<th>Status</th>
<th class="center aligned">Tindakan</th>
</tr>
</thead>
<tbody>
@forelse($items as $item)
<tr>
<td>{{ $item->ref_id }}</td>
<td>{{ $item->description }}</td>
<td>
@if($item->status == 1)
<span class="ui green label">Aktif</span>
@else
<span class="ui red label">Tidak Aktif</span>
@endif
</td>
<td class="center aligned">
<a href="{{ route('mileage::lkpstatus.show', $item->id) }}" class="ui button icon basic compact"><i class="eye icon"></i></a>
<a href="{{ route('mileage::lkpstatus.edit', $item->id) }}" class="ui button icon primary compact"><i class="edit icon"></i></a>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="center aligned">Tiada rekod.</td>
<!-- Header Row with Title and Button -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
<h1 class="ui header" style="margin: 0; font-size: 2rem; font-weight: 700; color: #222;">
Senarai Status Mileage
</h1>
<a href="{{ route('mileage::lkpstatus.create') }}" class="ui primary button" style="border-radius: 4px; padding: 10px 20px;">
Permohonan Baharu
</a>
</div>
@if (session('success'))
<div class="ui positive message">
<p>{{ session('success') }}</p>
</div>
@endif
<!-- Inner Box with Header Bar and Table -->
<div style="border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden;">
<!-- Table Header Bar with Search -->
<div style="display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background-color: #fff; border-bottom: 1px solid #eee;">
<h3 class="ui header" style="margin: 0; font-size: 1.1rem; color: #333; font-weight: 600;">
Senarai Status Mileage
</h3>
<div class="ui icon input" style="width: 220px;">
<input type="text" placeholder="Search..." style="border-radius: 4px; border: 1px solid #ddd; padding: 6px 12px;">
<i class="search icon"></i>
</div>
</div>
<!-- Main Data Table -->
<table class="ui single line table" style="border: none; margin: 0;">
<thead>
<tr style="background-color: #f9fafb; color: #666; font-size: 0.85rem; text-transform: uppercase;">
<th style="width: 8%; padding-left: 20px;">NO</th>
<th style="width: 20%;">REF ID</th>
<th>KETERANGAN</th>
<th style="width: 20%;">STATUS</th>
<th class="center aligned" style="width: 20%;">TINDAKAN</th>
</tr>
@endforelse
</tbody>
</table>
</thead>
<tbody>
@forelse($items as $index => $item)
<tr>
<td style="padding-left: 20px; color: #666;">{{ $index + 1 }}</td>
<td style="font-weight: 600; color: #333;">{{ $item->ref_id }}</td>
<td style="color: #444;">{{ $item->description }}</td>
<td>
@if($item->status == 1)
<span class="ui green label" style="font-weight: 500; border-radius: 4px; padding: 6px 12px;">
Aktif
</span>
@else
<span class="ui label" style="background-color: #a8a8a8; color: #fff; font-weight: 500; border-radius: 4px; padding: 6px 12px;">
Tidak Aktif
</span>
@endif
</td>
<td class="center aligned">
<a href="{{ route('mileage::lkpstatus.show', $item->id) }}" class="ui primary button compact" style="border-radius: 4px; padding: 8px 16px; font-weight: 600;">
<i class="eye icon"></i> Lihat
</a>
<a href="{{ route('mileage::lkpstatus.edit', $item->id) }}" class="ui warning button compact" style="border-radius: 4px; padding: 8px 16px; font-weight: 600; background-color: #f0ad4e; color: #fff;">
<i class="edit icon"></i> Kemaskini
</a>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="center aligned" style="padding: 30px; color: #888;">Tiada rekod dijumpai.</td>
</tr>
@endforelse
</tbody>
</table>
<!-- Table Footer Pagination Bar -->
<div style="display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background-color: #fff; border-top: 1px solid #eee; font-size: 0.9rem; color: #666;">
<div>
Showing 1-{{ count($items) }} from {{ count($items) }}
</div>
<div class="ui pagination menu mini" style="margin: 0; box-shadow: none; border: 1px solid #e0e0e0;">
<a class="item disabled"><i class="chevron left icon"></i></a>
<a class="active item">1</a>
<a class="item disabled"><i class="chevron right icon"></i></a>
</div>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui container" style="width: 100%;">
<div class="ui teal ribbon label" style="font-size: 1rem; padding: 8px 16px; margin-bottom: 15px;">
Tambah Status Overtime
</div>
<div class="ui segment" style="border-radius: 8px; padding: 25px;">
<h2 class="ui header" style="margin-bottom: 20px; font-weight: 700;">Tambah Status Overtime</h2>
@if ($errors->any())
<div class="ui negative message">
<ul class="list">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('overtime::lkpstatus.store') }}" method="POST" class="ui form">
@csrf
<div class="field">
<label>Ref ID / Kod Status <small style="color: #666; font-weight: normal;">(Biarkan kosong untuk auto-generate)</small></label>
<input type="number" name="ref_id" value="{{ old('ref_id') }}" placeholder="Contoh: 1">
</div>
<div class="field required">
<label>Keterangan / Description</label>
<input type="text" name="description" value="{{ old('description') }}" placeholder="Contoh: Draf / Permohonan Baru" required>
</div>
<div class="field required">
<label>Status Aktif</label>
<select name="status" class="ui dropdown" required>
<option value="1" {{ old('status', '1') == '1' ? 'selected' : '' }}>Aktif</option>
<option value="0" {{ old('status') == '0' ? 'selected' : '' }}>Tidak Aktif</option>
</select>
</div>
<div style="margin-top: 20px;">
<a href="{{ route('overtime::lkpstatus.index') }}" class="ui button">Kembali</a>
<button type="submit" class="ui primary button">Simpan</button>
</div>
</form>
</div>
</div>
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui container" style="width: 100%;">
<div class="ui teal ribbon label" style="font-size: 1rem; padding: 8px 16px; margin-bottom: 15px;">
Kemaskini Status Overtime
</div>
<div class="ui segment" style="border-radius: 8px; padding: 25px;">
<h2 class="ui header" style="margin-bottom: 20px; font-weight: 700;">Kemaskini Status Overtime</h2>
@if ($errors->any())
<div class="ui negative message">
<ul class="list">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('overtime::lkpstatus.update', $status->id) }}" method="POST" class="ui form">
@csrf
@method('PUT')
<div class="field required">
<label>Ref ID / Kod Status</label>
<input type="number" name="ref_id" value="{{ old('ref_id', $status->ref_id) }}" required>
</div>
<div class="field required">
<label>Keterangan / Description</label>
<input type="text" name="description" value="{{ old('description', $status->description) }}" required>
</div>
<div class="field required">
<label>Status Aktif</label>
<select name="status" class="ui dropdown" required>
<option value="1" {{ old('status', $status->status) == 1 ? 'selected' : '' }}>Aktif</option>
<option value="0" {{ old('status', $status->status) == 0 ? 'selected' : '' }}>Tidak Aktif</option>
</select>
</div>
<div style="margin-top: 20px;">
<a href="{{ route('overtime::lkpstatus.index') }}" class="ui button">Kembali</a>
<button type="submit" class="ui primary button">Kemaskini</button>
</div>
</form>
</div>
</div>
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui container" style="width: 100%;">
<!-- Outer Segment Card -->
<div class="ui segment" style="border-radius: 8px; padding: 25px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">
<!-- Teal Ribbon Label (Placed inside the card container) -->
<div class="ui teal ribbon label" style="font-size: 1rem; padding: 8px 16px; margin-bottom: 20px;">
Senarai Status Overtime
</div>
<!-- Header Row with Title and Button -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
<h1 class="ui header" style="margin: 0; font-size: 2rem; font-weight: 700; color: #222;">
Senarai Status Overtime
</h1>
<a href="{{ route('overtime::lkpstatus.create') }}" class="ui primary button" style="border-radius: 4px; padding: 10px 20px;">
Permohonan Baharu
</a>
</div>
@if (session('success'))
<div class="ui positive message">
<p>{{ session('success') }}</p>
</div>
@endif
<!-- Inner Box with Header Bar and Table -->
<div style="border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden;">
<!-- Table Header Bar with Search -->
<div style="display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background-color: #fff; border-bottom: 1px solid #eee;">
<h3 class="ui header" style="margin: 0; font-size: 1.1rem; color: #333; font-weight: 600;">
Senarai Status Overtime
</h3>
<div class="ui icon input" style="width: 220px;">
<input type="text" placeholder="Search..." style="border-radius: 4px; border: 1px solid #ddd; padding: 6px 12px;">
<i class="search icon"></i>
</div>
</div>
<!-- Main Data Table -->
<table class="ui single line table" style="border: none; margin: 0;">
<thead>
<tr style="background-color: #f9fafb; color: #666; font-size: 0.85rem; text-transform: uppercase;">
<th style="width: 8%; padding-left: 20px;">NO</th>
<th style="width: 20%;">REF ID</th>
<th>KETERANGAN</th>
<th style="width: 20%;">STATUS</th>
<th class="center aligned" style="width: 20%;">TINDAKAN</th>
</tr>
</thead>
<tbody>
@forelse($items as $index => $item)
<tr>
<td style="padding-left: 20px; color: #666;">{{ $index + 1 }}</td>
<td style="font-weight: 600; color: #333;">{{ $item->ref_id }}</td>
<td style="color: #444;">{{ $item->description }}</td>
<td>
@if($item->status == 1)
<span class="ui green label" style="font-weight: 500; border-radius: 4px; padding: 6px 12px;">
Aktif
</span>
@else
<span class="ui label" style="background-color: #a8a8a8; color: #fff; font-weight: 500; border-radius: 4px; padding: 6px 12px;">
Tidak Aktif
</span>
@endif
</td>
<td class="center aligned">
<a href="{{ route('overtime::lkpstatus.show', $item->id) }}" class="ui primary button compact" style="border-radius: 4px; padding: 8px 16px; font-weight: 600;">
<i class="eye icon"></i> Lihat
</a>
<a href="{{ route('overtime::lkpstatus.edit', $item->id) }}" class="ui warning button compact" style="border-radius: 4px; padding: 8px 16px; font-weight: 600; background-color: #f0ad4e; color: #fff;">
<i class="edit icon"></i> Kemaskini
</a>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="center aligned" style="padding: 30px; color: #888;">Tiada rekod dijumpai.</td>
</tr>
@endforelse
</tbody>
</table>
<!-- Table Footer Pagination Bar -->
<div style="display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background-color: #fff; border-top: 1px solid #eee; font-size: 0.9rem; color: #666;">
<div>
Showing 1-{{ count($items) }} from {{ count($items) }}
</div>
<div class="ui pagination menu mini" style="margin: 0; box-shadow: none; border: 1px solid #e0e0e0;">
<a class="item disabled"><i class="chevron left icon"></i></a>
<a class="active item">1</a>
<a class="item disabled"><i class="chevron right icon"></i></a>
</div>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
@extends('ui::layouts.app')
@section('content')
<div class="ui container" style="width: 100%;">
<div class="ui teal ribbon label" style="font-size: 1rem; padding: 8px 16px; margin-bottom: 15px;">
Maklumat Status Overtime
</div>
<div class="ui segment" style="border-radius: 8px; padding: 25px;">
<h2 class="ui header" style="margin-bottom: 20px; font-weight: 700;">Maklumat Status Overtime</h2>
<table class="ui celled definition table">
<tbody>
<tr>
<td class="four wide column"><strong>ID</strong></td>
<td>{{ $item->id }}</td>
</tr>
<tr>
<td><strong>Ref ID</strong></td>
<td>{{ $item->ref_id }}</td>
</tr>
<tr>
<td><strong>Keterangan</strong></td>
<td>{{ $item->description }}</td>
</tr>
<tr>
<td><strong>Status</strong></td>
<td>
@if($item->status == 1)
<span class="ui green label">Aktif</span>
@else
<span class="ui red label">Tidak Aktif</span>
@endif
</td>
</tr>
</tbody>
</table>
<div style="margin-top: 20px;">
<a href="{{ route('overtime::lkpstatus.index') }}" class="ui button">Kembali</a>
<a href="{{ route('overtime::lkpstatus.edit', $item->id) }}" class="ui primary button">Kemaskini</a>
</div>
</div>
</div>
@endsection
\ No newline at end of file
......@@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Route;
use App\Enums\Permission;
use Portal\Overtime\Http\Controllers\OtTaskController;
use Portal\Overtime\Http\Controllers\LkpStatusController;
Route::group(
[
......@@ -112,5 +113,14 @@ function () {
Route::put('ot-task/{id}', [OtTaskController::class, 'update'])->name('ot-task.update');
Route::delete('ot-task/{id}', [OtTaskController::class, 'destroy'])->name('ot-task.destroy');
// LKP Status (Overtime)
Route::get('lkpstatus', [LkpStatusController::class, 'index'])->name('lkpstatus.index');
Route::get('lkpstatus/create', [LkpStatusController::class, 'create'])->name('lkpstatus.create');
Route::post('lkpstatus', [LkpStatusController::class, 'store'])->name('lkpstatus.store');
Route::get('lkpstatus/{id}', [LkpStatusController::class, 'show'])->name('lkpstatus.show');
Route::get('lkpstatus/{id}/edit', [LkpStatusController::class, 'edit'])->name('lkpstatus.edit');
Route::put('lkpstatus/{id}', [LkpStatusController::class, 'update'])->name('lkpstatus.update');
Route::delete('lkpstatus/{id}', [LkpStatusController::class, 'destroy'])->name('lkpstatus.destroy');
}
);
\ No newline at end of file
<?php
namespace Portal\Overtime\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Portal\Overtime\Model\LkpStatus;
class LkpStatusController extends Controller
{
public function index()
{
$items = LkpStatus::ot()->orderBy('ref_id', 'asc')->get();
return view('overtime::lkpstatus.index', compact('items'));
}
public function create()
{
return view('overtime::lkpstatus.create');
}
public function store(Request $request)
{
$request->validate([
'ref_id' => 'nullable|integer',
'description' => 'required|string|max:255',
'status' => 'required|boolean',
]);
$refId = $request->filled('ref_id')
? $request->ref_id
: (LkpStatus::where('module', 'ot')->max('ref_id') ?? 0) + 1;
LkpStatus::create([
'module' => 'ot',
'ref_id' => $refId,
'description' => $request->description,
'status' => $request->status,
]);
return redirect()
->route('overtime::lkpstatus.index')
->with('success', 'Status created successfully.');
}
public function show($id)
{
$item = LkpStatus::ot()->findOrFail($id);
return view('overtime::lkpstatus.show', compact('item'));
}
public function edit($id)
{
$status = LkpStatus::ot()->findOrFail($id);
return view('overtime::lkpstatus.edit', compact('status'));
}
public function update(Request $request, $id)
{
$status = LkpStatus::ot()->findOrFail($id);
$request->validate([
'ref_id' => 'required|integer',
'description' => 'required|string|max:255',
'status' => 'required|boolean',
]);
$status->update([
'ref_id' => $request->ref_id,
'description' => $request->description,
'status' => $request->status,
]);
return redirect()
->route('overtime::lkpstatus.index')
->with('success', 'Status updated successfully.');
}
public function destroy($id)
{
$status = LkpStatus::ot()->findOrFail($id);
$status->delete();
return redirect()
->route('overtime::lkpstatus.index')
->with('success', 'Status deleted successfully.');
}
}
\ No newline at end of file
......@@ -3,12 +3,23 @@
namespace Portal\Overtime\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class LkpStatus extends Model
{
use SoftDeletes;
protected $table = 'lkp_status';
protected $table = 'lkp_status';
protected $guarded = ['id'];
protected $fillable = [
'module',
'ref_id',
'description',
'status',
];
/**
* Scope query to only include overtime (ot) statuses.
*/
public function scopeOt($query)
{
return $query->where('module', 'ot');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment