Files
expense/resources/views/backend/pages/admins/expense.blade.php
T

890 lines
35 KiB
PHP
Raw Normal View History

2024-12-23 10:42:27 +07:00
@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')
2025-01-02 18:21:03 +07:00
<div class="table-responsive">
<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>
2024-12-23 10:42:27 +07:00
<td>
2025-01-02 18:21:03 +07:00
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
2024-12-23 10:42:27 +07:00
@endif
</td>
<td>
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
<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?');">
2024-12-23 10:42:27 +07:00
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
2025-01-02 18:21:03 +07:00
Approve
</button>
</form>
2025-10-12 19:14:17 +07:00
<button type="button"
class="btn btn-danger btn-sm open-reject-modal"
data-action="{{ route('forms.up-country.reject', $form->id) }}">
Reject
</button>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
@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
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
</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>
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
<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
2024-12-23 10:42:27 +07:00
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
</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">
2025-01-02 18:21:03 +07:00
<div class="table-responsive">
<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>
2024-12-23 10:42:27 +07:00
<td>
2025-01-02 18:21:03 +07:00
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
2024-12-23 10:42:27 +07:00
@endif
</td>
<td>
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
@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?');">
2024-12-23 10:42:27 +07:00
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
2025-01-02 18:21:03 +07:00
Approve
</button>
</form>
2025-10-12 19:14:17 +07:00
<button type="button"
class="btn btn-danger btn-sm open-reject-modal"
data-action="{{ route('forms.vehicle.reject', $form->id) }}">
2025-01-02 18:21:03 +07:00
Reject
2024-12-23 10:42:27 +07:00
</button>
@else
2025-01-02 18:21:03 +07:00
@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
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
</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>
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
<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
2024-12-23 10:42:27 +07:00
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
</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">
2025-01-02 18:21:03 +07:00
<div class="table-responsive">
<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>
2024-12-23 10:42:27 +07:00
<td>
2025-01-02 18:21:03 +07:00
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
2024-12-23 10:42:27 +07:00
@endif
</td>
<td>
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
<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?');">
2024-12-23 10:42:27 +07:00
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
2025-01-02 18:21:03 +07:00
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
2024-12-23 10:42:27 +07:00
</button>
</form>
@else
2025-01-02 18:21:03 +07:00
@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
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
</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>
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
<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
2024-12-23 10:42:27 +07:00
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
</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">
2025-01-02 18:21:03 +07:00
<div class="table-responsive">
<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>
2024-12-23 10:42:27 +07:00
<td>
2025-01-02 18:21:03 +07:00
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
2024-12-23 10:42:27 +07:00
@endif
</td>
<td>
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
<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?');">
2024-12-23 10:42:27 +07:00
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
2025-01-02 18:21:03 +07:00
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
2024-12-23 10:42:27 +07:00
</button>
</form>
@else
2025-01-02 18:21:03 +07:00
@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
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
</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>
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
<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
2024-12-23 10:42:27 +07:00
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
</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">
2025-01-02 18:21:03 +07:00
<div class="table-responsive">
<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>
2024-12-23 10:42:27 +07:00
<td>
2025-01-02 18:21:03 +07:00
@if ($form->bukti1)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti1) }}" target="_blank">
Download
</a>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
2024-12-23 10:42:27 +07:00
@endif
</td>
<td>
2025-01-02 18:21:03 +07:00
@if ($form->bukti2)
<a href="{{ NextCloudHelper::getFileUrl($form->bukti2) }}" target="_blank">
Download
</a>
2024-12-23 10:42:27 +07:00
@else
2025-01-02 18:21:03 +07:00
-
@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?');">
2024-12-23 10:42:27 +07:00
@csrf
@method('PUT')
<button type="submit" class="btn btn-success btn-sm">
2025-01-02 18:21:03 +07:00
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
2024-12-23 10:42:27 +07:00
</button>
</form>
@else
2025-01-02 18:21:03 +07:00
@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
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
</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>
2024-12-23 10:42:27 +07:00
@endif
2025-01-02 18:21:03 +07:00
<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
2024-12-23 10:42:27 +07:00
2025-01-02 18:21:03 +07:00
@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>
2024-12-23 10:42:27 +07:00
</div>
</div>
</div>
</div>
</div>
</div>
</section>
2025-10-12 19:14:17 +07:00
<section>
<div class="modal fade" id="rejectModal" tabindex="-1" role="dialog" aria-labelledby="rejectModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form id="rejectForm" method="POST" action="">
@csrf
@method('PUT')
<div class="modal-header">
<h5 class="modal-title" id="rejectModalLabel">Reject Expense</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="rejectRemarks">Remarks <span class="text-danger">*</span></label>
<textarea class="form-control" name="remarks" id="rejectRemarks" rows="3" required></textarea>
</div>
<p class="mb-0 text-muted small">Pengajuan akan ditolak setelah Anda mengirimkan catatan ini.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-danger">Reject</button>
</div>
</form>
</div>
</div>
</div>
</section>
2024-12-23 10:42:27 +07:00
@endsection
@section('scripts')
<script>
// Initialize DataTables for each table
if ($('#dataTable-form_up_country').length) {
2025-01-02 18:21:03 +07:00
$('#dataTable-form_up_country').DataTable({ responsive: false });
2024-12-23 10:42:27 +07:00
}
if ($('#dataTable-form_vehicle_running_cost').length) {
2025-01-02 18:21:03 +07:00
$('#dataTable-form_vehicle_running_cost').DataTable({ responsive: false });
2024-12-23 10:42:27 +07:00
}
if ($('#dataTable-form_entertainment_presentation').length) {
2025-01-02 18:21:03 +07:00
$('#dataTable-form_entertainment_presentation').DataTable({ responsive: false });
2024-12-23 10:42:27 +07:00
}
if ($('#dataTable-form_meeting_seminar').length) {
2025-01-02 18:21:03 +07:00
$('#dataTable-form_meeting_seminar').DataTable({ responsive: false });
2024-12-23 10:42:27 +07:00
}
if ($('#dataTable-form_others').length) {
2025-01-02 18:21:03 +07:00
$('#dataTable-form_others').DataTable({ responsive: false });
2024-12-23 10:42:27 +07:00
}
2025-10-12 19:14:17 +07:00
$(document).on('click', '.open-reject-modal', function () {
const rejectUrl = $(this).data('action');
$('#rejectForm').attr('action', rejectUrl);
$('#rejectRemarks').val('');
$('#rejectModal').modal('show');
});
$('#rejectModal').on('shown.bs.modal', function () {
$('#rejectRemarks').trigger('focus');
});
$('#rejectModal').on('hidden.bs.modal', function () {
$('#rejectForm').attr('action', '');
$('#rejectRemarks').val('');
});
2024-12-23 10:42:27 +07:00
</script>
@endsection