added view expense by user

This commit is contained in:
Jagad R R
2024-12-23 10:42:27 +07:00
parent 73d779ba85
commit 83307c47e8
9 changed files with 912 additions and 40 deletions
@@ -12,6 +12,11 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use Spatie\Permission\Models\Role; use Spatie\Permission\Models\Role;
use App\Helpers\NextcloudHelper; use App\Helpers\NextcloudHelper;
use App\Models\FormUpCountry;
use App\Models\FormEntertaimentPresentation;
use App\Models\FormVehicleRunningCost;
use App\Models\FormOthers;
use App\Models\FormMeetingSeminar;
class AdminsController extends Controller class AdminsController extends Controller
{ {
@@ -121,6 +126,33 @@ class AdminsController extends Controller
return redirect()->route('admin.admins.index'); return redirect()->route('admin.admins.index');
} }
public function expense($user_id)
{
$formUpCountry = FormUpCountry::where('user_id', $user_id)->get();
$formEntertaimentPresentation = FormEntertaimentPresentation::where('user_id', $user_id)->get();
$formVehicleRunningCost = FormVehicleRunningCost::where('user_id', $user_id)->get();
$formOthers = FormOthers::where('user_id', $user_id)->get();
$formMeetingSeminar = FormMeetingSeminar::where('user_id', $user_id)->get();
// Combine all forms into a single array with keys for each form type
$forms = [
'form_up_country' => $formUpCountry,
'form_entertainment_presentation' => $formEntertaimentPresentation,
'form_vehicle_running_cost' => $formVehicleRunningCost,
'form_others' => $formOthers,
'form_meeting_seminar' => $formMeetingSeminar,
];
// Pass the forms and page information to the view
return view('backend.pages.admins.expense', [
'pageInfo' => [
'title' => 'Form Management',
],
'forms' => $forms,
]);
}
public function destroy(int $id): RedirectResponse public function destroy(int $id): RedirectResponse
{ {
$this->checkAuthorization(auth()->user(), ['admin.delete']); $this->checkAuthorization(auth()->user(), ['admin.delete']);
@@ -129,7 +129,7 @@ class FormEntertainmentPresentationController extends Controller
]); ]);
session()->flash('success', 'Form has been created.'); session()->flash('success', 'Form has been created.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
public function edit($id) public function edit($id)
@@ -221,7 +221,7 @@ class FormEntertainmentPresentationController extends Controller
]); ]);
session()->flash('success', 'Form has been updated.'); session()->flash('success', 'Form has been updated.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
public function approve($id) public function approve($id)
@@ -236,7 +236,7 @@ class FormEntertainmentPresentationController extends Controller
]); ]);
session()->flash('success', 'Form has been approved.'); session()->flash('success', 'Form has been approved.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
public function finalApprove($id) public function finalApprove($id)
@@ -246,7 +246,7 @@ class FormEntertainmentPresentationController extends Controller
$form = FormEntertaimentPresentation::findOrfail($id); $form = FormEntertaimentPresentation::findOrfail($id);
if($form->approved_at == null) { if($form->approved_at == null) {
session()->flash('error', 'Form must be approved by MIS first.'); session()->flash('error', 'Form must be approved by MIS first.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
$form->update([ $form->update([
@@ -256,7 +256,7 @@ class FormEntertainmentPresentationController extends Controller
]); ]);
session()->flash('success', 'Form has been final approved.'); session()->flash('success', 'Form has been final approved.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
public function open($id) public function open($id)
@@ -271,7 +271,7 @@ class FormEntertainmentPresentationController extends Controller
]); ]);
session()->flash('success', 'Form has been opened.'); session()->flash('success', 'Form has been opened.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
public function reject($id) public function reject($id)
@@ -284,7 +284,7 @@ class FormEntertainmentPresentationController extends Controller
]); ]);
session()->flash('success', 'Form has been rejected.'); session()->flash('success', 'Form has been rejected.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
public function destroy($id) public function destroy($id)
@@ -295,6 +295,6 @@ class FormEntertainmentPresentationController extends Controller
$form->delete(); $form->delete();
session()->flash('success', 'Form has been deleted.'); session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.entertainment'); return redirect()->back();
} }
} }
@@ -122,7 +122,7 @@ class FormMeetingSeminarController extends Controller
]); ]);
session()->flash('success', 'Form has been created.'); session()->flash('success', 'Form has been created.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
public function edit($id) public function edit($id)
@@ -207,7 +207,7 @@ class FormMeetingSeminarController extends Controller
]); ]);
session()->flash('success', 'Form has been updated.'); session()->flash('success', 'Form has been updated.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
public function approve($id) public function approve($id)
@@ -222,7 +222,7 @@ class FormMeetingSeminarController extends Controller
]); ]);
session()->flash('success', 'Form has been approved.'); session()->flash('success', 'Form has been approved.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
public function finalApprove($id) public function finalApprove($id)
@@ -232,7 +232,7 @@ class FormMeetingSeminarController extends Controller
$form = FormMeetingSeminar::findOrfail($id); $form = FormMeetingSeminar::findOrfail($id);
if($form->approved_at == null) { if($form->approved_at == null) {
session()->flash('error', 'Form must be approved by MIS first.'); session()->flash('error', 'Form must be approved by MIS first.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
$form->update([ $form->update([
@@ -242,7 +242,7 @@ class FormMeetingSeminarController extends Controller
]); ]);
session()->flash('success', 'Form has been final approved.'); session()->flash('success', 'Form has been final approved.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
public function open($id) public function open($id)
@@ -257,7 +257,7 @@ class FormMeetingSeminarController extends Controller
]); ]);
session()->flash('success', 'Form has been opened.'); session()->flash('success', 'Form has been opened.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
public function reject($id) public function reject($id)
@@ -270,7 +270,7 @@ class FormMeetingSeminarController extends Controller
]); ]);
session()->flash('success', 'Form has been rejected.'); session()->flash('success', 'Form has been rejected.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
public function destroy($id) public function destroy($id)
@@ -281,6 +281,6 @@ class FormMeetingSeminarController extends Controller
$form->delete(); $form->delete();
session()->flash('success', 'Form has been deleted.'); session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.meeting'); return redirect()->back();
} }
} }
@@ -125,7 +125,7 @@ class FormOtherController extends Controller
]); ]);
session()->flash('success', 'Form has been created.'); session()->flash('success', 'Form has been created.');
return redirect()->route('forms.other'); return redirect()->back();
} }
public function edit($id) public function edit($id)
@@ -212,7 +212,7 @@ class FormOtherController extends Controller
]); ]);
session()->flash('success', 'Form has been updated.'); session()->flash('success', 'Form has been updated.');
return redirect()->route('forms.other'); return redirect()->back();
} }
public function approve($id) public function approve($id)
@@ -227,7 +227,7 @@ class FormOtherController extends Controller
]); ]);
session()->flash('success', 'Form has been approved.'); session()->flash('success', 'Form has been approved.');
return redirect()->route('forms.other'); return redirect()->back();
} }
public function finalApprove($id) public function finalApprove($id)
@@ -237,7 +237,7 @@ class FormOtherController extends Controller
$form = FormOthers::findOrfail($id); $form = FormOthers::findOrfail($id);
if($form->approved_at == null) { if($form->approved_at == null) {
session()->flash('error', 'Form must be approved by MIS first.'); session()->flash('error', 'Form must be approved by MIS first.');
return redirect()->route('forms.other'); return redirect()->back();
} }
$form->update([ $form->update([
@@ -247,7 +247,7 @@ class FormOtherController extends Controller
]); ]);
session()->flash('success', 'Form has been final approved.'); session()->flash('success', 'Form has been final approved.');
return redirect()->route('forms.other'); return redirect()->back();
} }
public function open($id) public function open($id)
@@ -262,7 +262,7 @@ class FormOtherController extends Controller
]); ]);
session()->flash('success', 'Form has been opened.'); session()->flash('success', 'Form has been opened.');
return redirect()->route('forms.other'); return redirect()->back();
} }
public function reject($id) public function reject($id)
@@ -275,7 +275,7 @@ class FormOtherController extends Controller
]); ]);
session()->flash('success', 'Form has been rejected.'); session()->flash('success', 'Form has been rejected.');
return redirect()->route('forms.other'); return redirect()->back();
} }
public function destroy($id) public function destroy($id)
@@ -286,6 +286,6 @@ class FormOtherController extends Controller
$form->delete(); $form->delete();
session()->flash('success', 'Form has been deleted.'); session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.other'); return redirect()->back();
} }
} }
@@ -133,7 +133,7 @@ class FormUpCountryController extends Controller
]); ]);
session()->flash('success', 'Form has been created.'); session()->flash('success', 'Form has been created.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
public function edit($id) public function edit($id)
@@ -229,7 +229,7 @@ class FormUpCountryController extends Controller
]); ]);
session()->flash('success', 'Form has been updated.'); session()->flash('success', 'Form has been updated.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
public function approve($id) public function approve($id)
@@ -244,7 +244,7 @@ class FormUpCountryController extends Controller
]); ]);
session()->flash('success', 'Form has been approved.'); session()->flash('success', 'Form has been approved.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
public function reject($id) public function reject($id)
@@ -257,7 +257,7 @@ class FormUpCountryController extends Controller
]); ]);
session()->flash('success', 'Form has been rejected.'); session()->flash('success', 'Form has been rejected.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
public function finalApprove($id) public function finalApprove($id)
@@ -267,7 +267,7 @@ class FormUpCountryController extends Controller
$form = FormUpCountry::findOrfail($id); $form = FormUpCountry::findOrfail($id);
if($form->approved_at == null) { if($form->approved_at == null) {
session()->flash('error', 'Form must be approved by MIS first.'); session()->flash('error', 'Form must be approved by MIS first.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
$form->update([ $form->update([
@@ -277,7 +277,7 @@ class FormUpCountryController extends Controller
]); ]);
session()->flash('success', 'Form has been final approved.'); session()->flash('success', 'Form has been final approved.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
public function open($id) public function open($id)
@@ -292,7 +292,7 @@ class FormUpCountryController extends Controller
]); ]);
session()->flash('success', 'Form has been opened.'); session()->flash('success', 'Form has been opened.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
public function destroy($id) public function destroy($id)
@@ -303,6 +303,6 @@ class FormUpCountryController extends Controller
$form->delete(); $form->delete();
session()->flash('success', 'Form has been deleted.'); session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.up-country'); return redirect()->back();
} }
} }
@@ -128,7 +128,7 @@ class FormVehicleController extends Controller
]); ]);
session()->flash('success', 'Form has been created.'); session()->flash('success', 'Form has been created.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
public function edit($id) public function edit($id)
@@ -221,7 +221,7 @@ class FormVehicleController extends Controller
]); ]);
session()->flash('success', 'Form has been updated.'); session()->flash('success', 'Form has been updated.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
public function approve($id) public function approve($id)
@@ -236,7 +236,7 @@ class FormVehicleController extends Controller
]); ]);
session()->flash('success', 'Form has been approved.'); session()->flash('success', 'Form has been approved.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
public function finalApprove($id) public function finalApprove($id)
@@ -246,7 +246,7 @@ class FormVehicleController extends Controller
$form = FormVehicleRunningCost::findOrfail($id); $form = FormVehicleRunningCost::findOrfail($id);
if($form->approved_at == null) { if($form->approved_at == null) {
session()->flash('error', 'Form must be approved by MIS first.'); session()->flash('error', 'Form must be approved by MIS first.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
$form->update([ $form->update([
@@ -256,7 +256,7 @@ class FormVehicleController extends Controller
]); ]);
session()->flash('success', 'Form has been final approved.'); session()->flash('success', 'Form has been final approved.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
public function open($id) public function open($id)
@@ -271,7 +271,7 @@ class FormVehicleController extends Controller
]); ]);
session()->flash('success', 'Form has been opened.'); session()->flash('success', 'Form has been opened.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
public function reject($id) public function reject($id)
@@ -284,7 +284,7 @@ class FormVehicleController extends Controller
]); ]);
session()->flash('success', 'Form has been rejected.'); session()->flash('success', 'Form has been rejected.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
public function destroy($id) public function destroy($id)
@@ -295,6 +295,6 @@ class FormVehicleController extends Controller
$form->delete(); $form->delete();
session()->flash('success', 'Form has been deleted.'); session()->flash('success', 'Form has been deleted.');
return redirect()->route('forms.vehicle'); return redirect()->back();
} }
} }
@@ -0,0 +1,838 @@
@extends('layouts.app')
@section('title')
{{ $pageInfo['title'] }}
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>{{ $pageInfo['title'] }}</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-form"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a> / </li>
<li class="breadcrumb-form active">&nbsp;{{ $pageInfo['title'] }}</li>
</ol>
</div>
</div>
</div>
</section>
@php
use App\Helpers\NextCloudHelper;
@endphp
<section class="content">
<div class="container-fluid">
<!-- Form Up Country Table -->
<div class="row">
<div class="col-12 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Up Country</h4>
<div class="data-tables">
@include('backend.layouts.partials.messages')
<table id="dataTable-form_up_country">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Rayon</th>
<th>Tanggal</th>
<th>Tujuan</th>
<th>Jarak</th>
<th>Total</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
<th>Account Number</th>
<th>Status</th>
@if (auth()->user()->can('approval.approve') || auth()->user()->can('final_approval.approve'))
<th>Approval</th>
@endif
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_up_country'] as $index => $form)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $form->user->name }}</td>
<td>{{ $form->rayon->code }}</td>
<td>{{ \Carbon\Carbon::parse($form->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $form->tujuan }}</td>
<td>{{ $form->jarak }} km</td>
<td>{{ number_format($form->total, 0, ',', '.') }}</td>
<td>
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $form->account_number }}</td>
<td>
@if ($form->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $form->status }}</span>
@elseif ($form->status == 'Approved' || $form->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $form->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $form->status }}</span>
@endif
</td>
@if (auth()->user()->can('approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'On Progress')
<form action="{{ route('forms.up-country.approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Approve
</button>
</form>
<form action="{{ route('forms.up-country.reject', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-danger btn-sm">
Reject
</button>
</form>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@elseif($form->rejected_at)
{{ \Carbon\Carbon::parse($form->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
@else
-
@endif
@endif
</td>
@elseif(auth()->user()->can('final_approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'Approved' && $form->approved_at && !$form->final_approved_at)
<form action="{{ route('forms.up-country.final-approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Final Approve
</button>
</form>
@else
@if ($form->final_approved_at)
<form action="{{ route('forms.up-country.open', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Open
</button>
</form>
@else
-
@endif
@endif
</td>
@endif
<td>
@if (auth()->user()->can('forms.country.edit'))
<a href="{{ route('forms.up-country.edit', $form->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.country.delete'))
<form action="{{ route('forms.up-country.destroy', $form->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this form?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Form Vehicle Running Cost Table -->
<div class="row">
<div class="col-12 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Vehicle Running Cost</h4>
<div class="data-tables">
<table id="dataTable-form_vehicle_running_cost">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Tanggal</th>
<th>Liter</th>
<th>Harga</th>
<th>Jarak</th>
<th>Tipe Bensin</th>
<th>Nomor Polisi</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
<th>Account Number</th>
<th>Status</th>
@if (auth()->user()->can('approval.approve') || auth()->user()->can('final_approval.approve'))
<th>Approval</th>
@endif
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_vehicle_running_cost'] as $index => $form)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $form->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($form->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
<td>{{ $form->liter }}</td>
<td>{{ number_format($form->harga, 0, ',', '.') }}</td>
<td>{{ $form->jarak }}</td>
<td>{{ $form->tipe_bensin }}</td>
<td>{{ $form->nopol }}</td>
<td>
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $form->account_number }}</td>
<td>
@if ($form->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $form->status }}</span>
@elseif ($form->status == 'Approved' || $form->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $form->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $form->status }}</span>
@endif
</td>
@if (auth()->user()->can('approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'On Progress')
<form action="{{ route('forms.vehicle.approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Approve
</button>
</form>
<form action="{{ route('forms.vehicle.reject', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-danger btn-sm">
Reject
</button>
</form>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@elseif($form->rejected_at)
{{ \Carbon\Carbon::parse($form->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
@else
-
@endif
@endif
</td>
@elseif(auth()->user()->can('final_approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'Approved' && $form->approved_at && !$form->final_approved_at)
<form action="{{ route('forms.vehicle.final-approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Final Approve
</button>
</form>
@else
@if ($form->final_approved_at)
<form action="{{ route('forms.vehicle.open', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Open
</button>
</form>
@else
-
@endif
@endif
</td>
@endif
<td>
@if (auth()->user()->can('forms.vehicle.edit'))
<a href="{{ route('forms.vehicle.edit', $form->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.vehicle.delete'))
<form action="{{ route('forms.vehicle.destroy', $form->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this form?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Form Entertainment Presentation Table -->
<div class="row">
<div class="col-12 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Entertainment Presentation</h4>
<div class="data-tables">
<table id="dataTable-form_entertainment_presentation">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Tanggal</th>
<th>Jenis</th>
<th>Keterangan</th>
<th>Total</th>
<th>Nama Penerima</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
<th>Account Number</th>
<th>Status</th>
@if (auth()->user()->can('approval.approve') || auth()->user()->can('final_approval.approve'))
<th>Approval</th>
@endif
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_entertainment_presentation'] as $index => $form)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $form->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($form->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $form->jenis }}</td>
<td>{{ $form->keterangan }}</td>
<td>{{ number_format($form->total, 0, ',', '.') }}</td>
<td>{{ $form->name }}</td>
<td>
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $form->account_number }}</td>
<td>
@if ($form->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $form->status }}</span>
@elseif ($form->status == 'Approved' || $form->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $form->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $form->status }}</span>
@endif
</td>
@if (auth()->user()->can('approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'On Progress')
<form action="{{ route('forms.entertainment.approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Approve
</button>
</form>
<form action="{{ route('forms.entertainment.reject', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-danger btn-sm">
Reject
</button>
</form>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@elseif($form->rejected_at)
{{ \Carbon\Carbon::parse($form->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
@else
-
@endif
@endif
</td>
@elseif(auth()->user()->can('final_approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'Approved' && $form->approved_at && !$form->final_approved_at)
<form action="{{ route('forms.entertainment.final-approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Final Approve
</button>
</form>
@else
@if ($form->final_approved_at)
<form action="{{ route('forms.entertainment.open', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Open
</button>
</form>
@else
-
@endif
@endif
</td>
@endif
<td>
@if (auth()->user()->can('forms.entertainment.edit'))
<a href="{{ route('forms.entertainment.edit', $form->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.entertainment.delete'))
<form action="{{ route('forms.entertainment.destroy', $form->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this form?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Form Meeting Seminar Table -->
<div class="row">
<div class="col-12 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Meeting Seminar</h4>
<div class="data-tables">
<table id="dataTable-form_meeting_seminar">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Tanggal</th>
<th>Allowance</th>
<th>Transport Ankot</th>
<th>Hotel</th>
<th>Total</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
<th>Account Number</th>
<th>Status</th>
@if (auth()->user()->can('approval.approve') || auth()->user()->can('final_approval.approve'))
<th>Approval</th>
@endif
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_meeting_seminar'] as $index => $form)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $form->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($form->created_at)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ number_format($form->allowance, 0, ',', '.') }}</td>
<td>{{ number_format($form->transport_ankot, 0, ',', '.') }}</td>
<td>{{ number_format($form->hotel, 0, ',', '.') }}</td>
<td>{{ number_format($form->total, 0, ',', '.') }}</td>
<td>
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $form->account_number }}</td>
<td>
@if ($form->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $form->status }}</span>
@elseif ($form->status == 'Approved' || $form->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $form->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $form->status }}</span>
@endif
</td>
@if (auth()->user()->can('approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'On Progress')
<form action="{{ route('forms.meeting.approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Approve
</button>
</form>
<form action="{{ route('forms.meeting.reject', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-danger btn-sm">
Reject
</button>
</form>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@elseif($form->rejected_at)
{{ \Carbon\Carbon::parse($form->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
@else
-
@endif
@endif
</td>
@elseif(auth()->user()->can('final_approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'Approved' && $form->approved_at && !$form->final_approved_at)
<form action="{{ route('forms.meeting.final-approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Final Approve
</button>
</form>
@else
@if ($form->final_approved_at)
<form action="{{ route('forms.meeting.open', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Open
</button>
</form>
@else
-
@endif
@endif
</td>
@endif
<td>
@if (auth()->user()->can('forms.meeting.edit'))
<a href="{{ route('forms.meeting.edit', $form->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.meeting.delete'))
<form action="{{ route('forms.meeting.destroy', $form->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this form?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Form Others Table -->
<div class="row">
<div class="col-12 mt-5">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Others</h4>
<div class="data-tables">
<table id="dataTable-form_others">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Tanggal</th>
<th>Jenis</th>
<th>Keterangan</th>
<th>Total</th>
<th>Bukti 1</th>
<th>Bukti 2</th>
<th>Bukti 3</th>
<th>Account Number</th>
<th>Status</th>
@if (auth()->user()->can('approval.approve') || auth()->user()->can('final_approval.approve'))
<th>Approval</th>
@endif
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_others'] as $index => $form)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $form->user->name }}</td>
<td>{{ \Carbon\Carbon::parse($form->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $form->kategori->name }}</td>
<td>{{ $form->keterangan }}</td>
<td>{{ number_format($form->total, 0, ',', '.') }}</td>
<td>
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti2) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>
@if ($form->bukti3)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti3) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $form->account_number }}</td>
<td>
@if ($form->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $form->status }}</span>
@elseif ($form->status == 'Approved' || $form->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $form->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $form->status }}</span>
@endif
</td>
@if (auth()->user()->can('approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'On Progress')
<form action="{{ route('forms.other.approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Approve
</button>
</form>
<form action="{{ route('forms.other.reject', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to reject this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-danger btn-sm">
Reject
</button>
</form>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@elseif($form->rejected_at)
{{ \Carbon\Carbon::parse($form->rejected_at)->locale('id')->isoFormat('D MMMM Y') }}
@else
-
@endif
@endif
</td>
@elseif(auth()->user()->can('final_approval.approve'))
<td>
{{-- approve / reject button --}}
@if ($form->status == 'Approved' && $form->approved_at && !$form->final_approved_at)
<form action="{{ route('forms.other.final-approve', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Final Approve
</button>
</form>
@else
@if ($form->final_approved_at)
<form action="{{ route('forms.other.open', $form->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this form?');">
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
Open
</button>
</form>
@else
-
@endif
@endif
</td>
@endif
<td>
@if (auth()->user()->can('forms.other.edit'))
<a href="{{ route('forms.other.edit', $form->id) }}" class="btn btn-warning btn-sm">
<i class="fas fa-edit text-white"></i>
</a>
@endif
@if (auth()->user()->can('forms.other.delete'))
<form action="{{ route('forms.other.destroy', $form->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this form?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
// Initialize DataTables for each table
if ($('#dataTable-form_up_country').length) {
$('#dataTable-form_up_country').DataTable({ responsive: true });
}
if ($('#dataTable-form_vehicle_running_cost').length) {
$('#dataTable-form_vehicle_running_cost').DataTable({ responsive: true });
}
if ($('#dataTable-form_entertainment_presentation').length) {
$('#dataTable-form_entertainment_presentation').DataTable({ responsive: true });
}
if ($('#dataTable-form_meeting_seminar').length) {
$('#dataTable-form_meeting_seminar').DataTable({ responsive: true });
}
if ($('#dataTable-form_others').length) {
$('#dataTable-form_others').DataTable({ responsive: true });
}
</script>
@endsection
@@ -64,6 +64,7 @@
@endforeach @endforeach
</td> </td>
<td> <td>
<a class="btn btn-success text-white" href="{{ route('admin.admins.expense', $admin->id) }}">View Expense</a>
@if (auth()->user()->can('admin.edit')) @if (auth()->user()->can('admin.edit'))
<a class="btn btn-success text-white" <a class="btn btn-success text-white"
href="{{ route('admin.admins.edit', $admin->id) }}">Edit</a> href="{{ route('admin.admins.edit', $admin->id) }}">Edit</a>
+1
View File
@@ -35,6 +35,7 @@ Route::group(['prefix' => 'admin', 'as' => 'admin.'], function () {
*/ */
Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => ['auth:admin', 'menu']], function () { Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => ['auth:admin', 'menu']], function () {
Route::resource('admins', AdminsController::class); Route::resource('admins', AdminsController::class);
Route::get('/admins/expense/{user_id}', [AdminsController::class, 'expense'])->name('admins.expense');
Route::resource('roles', RolesController::class); Route::resource('roles', RolesController::class);
Route::get('/admin', [DashboardController::class, 'index'])->name('dashboard'); Route::get('/admin', [DashboardController::class, 'index'])->name('dashboard');