revised form vehicle, entertainment and other
This commit is contained in:
@@ -32,11 +32,11 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jenis</label>
|
||||
<label class="form-label">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control form-control-md" name="jenis" required>
|
||||
<option value="">Pilih Jenis</option>
|
||||
<option value="entertainment" {{ old('jenis') == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||
@@ -45,39 +45,31 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nama Penerima</label>
|
||||
<label class="form-label">Nama Penerima <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="name" required value="{{ old('name') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Alamat</label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" required>{{ old('keterangan') }}</textarea>
|
||||
<label class="form-label">NPWP / NIK <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ old('nik_or_npwp') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">NPWP / NIK</label>
|
||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ old('nik_or_npwp') }}">
|
||||
<label class="form-label">Alamat <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<textarea class="form-control" name="keterangan" required>{{ old('keterangan') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jenis</label>
|
||||
<label class="form-label">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control form-control-md" name="jenis" required>
|
||||
<option value="">Pilih Jenis</option>
|
||||
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||
@@ -46,39 +46,31 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nama Penerima</label>
|
||||
<label class="form-label">Nama Penerima <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="name" required value="{{ $form->name }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Alamat</label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ $form->alamat }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
<label class="form-label">NPWP / NIK <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ $form->nik_or_npwp }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">NPWP / NIK</label>
|
||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ $form->nik_or_npwp }}">
|
||||
<label class="form-label">Alamat <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ $form->alamat }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(optional)</span></label>
|
||||
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<textarea class="form-control" name="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="col-lg-4 col-6">
|
||||
<div class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('total'), 0, ',', '.') }}</h3>
|
||||
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('approved_total'), 0, ',', '.') }}</h3>
|
||||
<p>Approved Expenses</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
@@ -84,15 +84,14 @@
|
||||
<thead class="bg-light text-capitalize">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Nama</th>
|
||||
<th>User</th>
|
||||
<th>Nama Penerima</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>Total Approved</th>
|
||||
<th>Bukti</th>
|
||||
<th>Account Number</th>
|
||||
<th>Status</th>
|
||||
@if (auth()->user()->can('approval.approve'))
|
||||
@@ -112,32 +111,15 @@
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $item->user->name }}</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
|
||||
<td>{{ $item->jenis }}</td>
|
||||
<td>{{ $item->keterangan }}</td>
|
||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||
<td>{{ $item->name }}</td>
|
||||
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
|
||||
<td>
|
||||
@if ($item->bukti1)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($item->bukti2)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($item->bukti3)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
|
||||
@if ($item->bukti_total)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
@@ -158,10 +140,10 @@
|
||||
<td>
|
||||
{{-- approve / reject button --}}
|
||||
@if ($item->status == 'On Progress')
|
||||
<form action="{{ route('forms.entertainment.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
<form action="javascript:void(0);" class="d-inline">
|
||||
<button type="button"
|
||||
class="btn btn-success btn-sm open-approve-modal"
|
||||
data-id="{{ route('forms.entertainment.approve', $item->id) }}">
|
||||
Approve
|
||||
</button>
|
||||
</form>
|
||||
@@ -213,6 +195,12 @@
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
@if (auth()->user()->can('forms.entertainment.view'))
|
||||
<a href="{{ route('forms.entertainment.view', $item->id) }}" class="btn btn-primary btn-sm">
|
||||
<i class="fas fa-eye text-white"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->can('forms.entertainment.edit'))
|
||||
<a href="{{ route('forms.entertainment.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
||||
<i class="fas fa-edit text-white"></i>
|
||||
@@ -239,20 +227,178 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="approveForm" method="POST" action="">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Loading spinner -->
|
||||
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal content (hidden initially) -->
|
||||
<div id="modalContent" class="d-none">
|
||||
<p>Please review the details below:</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>User:</strong> <span id="user"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>NIK/NPWP Penerima:</strong> <span id="nik_or_npwp"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Nama Penerima:</strong> <span id="name"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Alamat Penerima:</strong> <span id="alamat"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jenis:</strong> <span id="jenis"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Bukti Total Pengeluaran:</strong> <span id="bukti_total"></span>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="mt-2">Please select the items you want to approve:</p>
|
||||
<ul class="list-group list-unstyled">
|
||||
<li>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="total_bensin" name="total_bensin">
|
||||
<label class="custom-control-label" for="total_bensin">Total Pengeluaran (<span id="total_bensin_value"></span>)</label>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="form-group">
|
||||
<label for="total">Total</label>
|
||||
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Approve</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: false,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
$(document).ready(function () {
|
||||
// Uncheck all checkboxes on page refresh
|
||||
$('.custom-control-input').prop('checked', false);
|
||||
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: false,
|
||||
dom: 'Bfrtip',
|
||||
buttons: ['excel', 'pdf', 'print']
|
||||
});
|
||||
}
|
||||
|
||||
// Handle Approve Button Click
|
||||
$('.open-approve-modal').on('click', function () {
|
||||
const approveUrl = $(this).data('id');
|
||||
|
||||
// Show spinner and hide content initially
|
||||
$('#loadingSpinner').show();
|
||||
$('#modalContent').addClass('d-none');
|
||||
|
||||
$('#approveForm').attr('action', approveUrl); // Set the form action
|
||||
$('#loadingSpinner').addClass('d-flex');
|
||||
$('#approveModal').modal('show'); // Show the modal
|
||||
|
||||
// Get detail from /forms/up-country/detail/{id}
|
||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
|
||||
$('#total_bensin_value').text(formatter.format(data.total));
|
||||
$('#total_bensin').data('value', data.total);
|
||||
|
||||
// Detail data
|
||||
$('#user').text(data.user.name);
|
||||
$('#nik_or_npwp').text(data.nik_or_npwp);
|
||||
$('#name').text(data.name);
|
||||
$('#alamat').text(data.alamat);
|
||||
$('#expense_number').text(data.expense_number);
|
||||
$('#jenis').text(data.jenis);
|
||||
$('#keterangan').text(data.keterangan);
|
||||
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
}));
|
||||
|
||||
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||
|
||||
// Hide spinner and show content
|
||||
$('#loadingSpinner').hide();
|
||||
$('#loadingSpinner').removeClass('d-flex');
|
||||
$('#loadingSpinner').addClass('d-none');
|
||||
$('#modalContent').removeClass('d-none');
|
||||
|
||||
// Reset the total to zero
|
||||
$('#total').val(0);
|
||||
});
|
||||
});
|
||||
|
||||
// Update total dynamically
|
||||
$('.custom-control-input').on('change', function () {
|
||||
let total = 0;
|
||||
|
||||
// Calculate the total based on checked checkboxes
|
||||
$('.custom-control-input:checked').each(function () {
|
||||
total += parseFloat($(this).data('value') || 0);
|
||||
});
|
||||
|
||||
// Update the total field with formatted value
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
|
||||
$('#total').val(formatter.format(total));
|
||||
});
|
||||
|
||||
// Uncheck all checkboxes when the modal is closed
|
||||
$('#approveModal').on('hidden.bs.modal', function () {
|
||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||
$('#total').val('0'); // Reset total to 0
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Lihat Expense Entertainment & Presentation</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ route('forms.entertainment.update', $form->id) }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">No Expense</label>
|
||||
<input type="text" class="form-control" name="expense_number" value="{{ $form->expense_number }}" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<input type="date" class="form-control" name="tanggal" readonly value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jenis</label>
|
||||
<select class="form-control form-control-md" name="jenis" disabled>
|
||||
<option value="">Pilih Jenis</option>
|
||||
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
||||
<option value="sponsorship" {{ $form->jenis == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nama Penerima</label>
|
||||
<input type="text" class="form-control" name="name" readonly value="{{ $form->name }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">NPWP / NIK</label>
|
||||
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" readonly value="{{ $form->nik_or_npwp }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Alamat</label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" readonly value="{{ $form->alamat }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<input type="string" class="form-control" name="total" id="total" readonly value="{{ $form->total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti Total</label><br>
|
||||
<a href="{{ $form->bukti_total }}" target="_blank">Lihat Bukti</a>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" readonly>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<a href="{{ route('forms.entertainment') }}" class="btn btn-secondary">Kembali</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
new AutoNumeric('#total', {
|
||||
digitGroupSeparator: '.', // Pemisah ribuan
|
||||
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
|
||||
currencySymbol: 'Rp.', // Simbol mata uang
|
||||
decimalPlaces: 0, // Tidak ada angka desimal
|
||||
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Kategori</label>
|
||||
<label class="form-label">Kategori <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control" name="kategori_id" id="kategori_id" required>
|
||||
<option value="">Pilih Kategori</option>
|
||||
@foreach ($kategori as $item)
|
||||
@@ -43,31 +43,23 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="date" class="form-control" name="tanggal" id="tanggal" required value="{{ old('tanggal') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ old('keterangan') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ old('keterangan') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Kategori</label>
|
||||
<label class="form-label">Kategori <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control" name="kategori_id" id="kategori_id" required>
|
||||
<option value="">Pilih Kategori</option>
|
||||
@foreach ($kategori as $item)
|
||||
@@ -44,31 +44,23 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="date" class="form-control" name="tanggal" id="tanggal" required value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total</label>
|
||||
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ $form->bukti1 }}">
|
||||
<label class="form-label">Bukti Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="file" class="form-control" name="bukti_total" value="{{ $form->bukti_total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ $form->bukti2 }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ $form->bukti3 }}">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -89,9 +89,7 @@
|
||||
<th>Jenis</th>
|
||||
<th>Keterangan</th>
|
||||
<th>Total</th>
|
||||
<th>Bukti 1</th>
|
||||
<th>Bukti 2</th>
|
||||
<th>Bukti 3</th>
|
||||
<th>Bukti Total</th>
|
||||
<th>Account Number</th>
|
||||
<th>Status</th>
|
||||
@if (auth()->user()->can('approval.approve'))
|
||||
@@ -116,26 +114,8 @@
|
||||
<td>{{ $item->keterangan }}</td>
|
||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||
<td>
|
||||
@if ($item->bukti1)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($item->bukti2)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($item->bukti3)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
|
||||
@if ($item->bukti_total)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
@@ -156,10 +136,10 @@
|
||||
<td>
|
||||
{{-- approve / reject button --}}
|
||||
@if ($item->status == 'On Progress')
|
||||
<form action="{{ route('forms.other.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
<form action="javascript:void(0);" class="d-inline">
|
||||
<button type="button"
|
||||
class="btn btn-success btn-sm open-approve-modal"
|
||||
data-id="{{ route('forms.other.approve', $item->id) }}">
|
||||
Approve
|
||||
</button>
|
||||
</form>
|
||||
@@ -237,20 +217,168 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="approveForm" method="POST" action="">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Loading spinner -->
|
||||
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal content (hidden initially) -->
|
||||
<div id="modalContent" class="d-none">
|
||||
<p>Please review the details below:</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>User:</strong> <span id="user"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Kategori:</strong> <span id="kategori"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Tanggal & Waktu:</strong> <span id="tanggal"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Bukti Total Pengeluaran:</strong> <span id="bukti_total"></span>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="mt-2">Please select the items you want to approve:</p>
|
||||
<ul class="list-group list-unstyled">
|
||||
<li>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="total_pengeluaran" name="total_pengeluaran">
|
||||
<label class="custom-control-label" for="total_pengeluaran">Total Pengeluaran (<span id="total_pengeluaran_value"></span>)</label>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="form-group">
|
||||
<label for="total">Total</label>
|
||||
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Approve</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: false,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
$(document).ready(function () {
|
||||
// Uncheck all checkboxes on page refresh
|
||||
$('.custom-control-input').prop('checked', false);
|
||||
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: false,
|
||||
dom: 'Bfrtip',
|
||||
buttons: ['excel', 'pdf', 'print']
|
||||
});
|
||||
}
|
||||
|
||||
// Handle Approve Button Click
|
||||
$('.open-approve-modal').on('click', function () {
|
||||
const approveUrl = $(this).data('id');
|
||||
|
||||
// Show spinner and hide content initially
|
||||
$('#loadingSpinner').show();
|
||||
$('#modalContent').addClass('d-none');
|
||||
|
||||
$('#approveForm').attr('action', approveUrl); // Set the form action
|
||||
$('#loadingSpinner').addClass('d-flex');
|
||||
$('#approveModal').modal('show'); // Show the modal
|
||||
|
||||
// Get detail from /forms/up-country/detail/{id}
|
||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
|
||||
$('#kategori').text(data.kategori.name);
|
||||
$('#keterangan').text(data.keterangan);
|
||||
$('#total_pengeluaran_value').text(formatter.format(data.total));
|
||||
$('#total_pengeluaran').data('value', data.total);
|
||||
|
||||
// Detail data
|
||||
$('#user').text(data.user.name);
|
||||
$('#expense_number').text(data.expense_number);
|
||||
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
}));
|
||||
|
||||
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||
|
||||
// Hide spinner and show content
|
||||
$('#loadingSpinner').hide();
|
||||
$('#loadingSpinner').removeClass('d-flex');
|
||||
$('#loadingSpinner').addClass('d-none');
|
||||
$('#modalContent').removeClass('d-none');
|
||||
|
||||
// Reset the total to zero
|
||||
$('#total').val(0);
|
||||
});
|
||||
});
|
||||
|
||||
// Update total dynamically
|
||||
$('.custom-control-input').on('change', function () {
|
||||
let total = 0;
|
||||
|
||||
// Calculate the total based on checked checkboxes
|
||||
$('.custom-control-input:checked').each(function () {
|
||||
total += parseFloat($(this).data('value') || 0);
|
||||
});
|
||||
|
||||
// Update the total field with formatted value
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
|
||||
$('#total').val(formatter.format(total));
|
||||
});
|
||||
|
||||
// Uncheck all checkboxes when the modal is closed
|
||||
$('#approveModal').on('hidden.bs.modal', function () {
|
||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||
$('#total').val('0'); // Reset total to 0
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Pilih Rayon</label>
|
||||
<select class="form-control form-control-md" name="rayon_id" readonly>
|
||||
<select class="form-control form-control-md" name="rayon_id" disabled>
|
||||
<option value="">Pilih Rayon</option>
|
||||
@foreach ($rayons as $rayon)
|
||||
<option value="{{ $rayon->id }}" {{ $form->rayon_id == $rayon->id ? 'selected' : '' }}>{{ $rayon->name }}</option>
|
||||
|
||||
@@ -32,52 +32,44 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Liter Bensin</label>
|
||||
<label class="form-label">Liter Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="liter" required value="{{ old('liter') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total Harga Bensin</label>
|
||||
<label class="form-label">Total Harga Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak (km)</label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ old('jarak') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>
|
||||
{{ old('keterangan') }}
|
||||
</textarea>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti Total Harga Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak (km) <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ old('jarak') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Bensin</label>
|
||||
<label class="form-label">Tipe Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control" name="tipe_bensin" required value="{{ old('tipe_bensin') }}">
|
||||
<option value="pertamax">Pertamax</option>
|
||||
<option value="pertalite">Pertalite</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nomor Polisi</label>
|
||||
<label class="form-label">Nomor Polisi <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ old('nopol') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>
|
||||
{{ old('keterangan') }}
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -32,50 +32,43 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="datetime-local" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Liter Bensin</label>
|
||||
<label class="form-label">Liter Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="liter" required value="{{ $form->liter }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total Harga Bensin</label>
|
||||
<label class="form-label">Total Harga Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak (km)</label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ $form->jarak }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
<label class="form-label">Bukti Total Harga Bensin <span class="font-italic font-weight-normal">(optional)</span></label>
|
||||
<input type="file" class="form-control" name="bukti_total" value="{{ old('bukti_total') }}">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Bensin</label>
|
||||
<label class="form-label">Jarak (km) <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" required value="{{ $form->jarak }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control" name="tipe_bensin" required>
|
||||
<option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
||||
<option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nomor Polisi</label>
|
||||
<label class="form-label">Nomor Polisi <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="nopol" id="nopol" required value="{{ $form->nopol }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 1</label>
|
||||
<input type="file" class="form-control" name="bukti1" value="{{ $form->bukti1 }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 2</label>
|
||||
<input type="file" class="form-control" name="bukti2" value="{{ $form->bukti2 }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti 3</label>
|
||||
<input type="file" class="form-control" name="bukti3" value="{{ $form->bukti3 }}">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" required>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="col-lg-4 col-6">
|
||||
<div class="small-box bg-success">
|
||||
<div class="inner">
|
||||
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('total'), 0, ',', '.') }}</h3>
|
||||
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Closed'])->sum('approved_total'), 0, ',', '.') }}</h3>
|
||||
<p>Approved Expenses</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
@@ -88,12 +88,11 @@
|
||||
<th>Tanggal</th>
|
||||
<th>Liter</th>
|
||||
<th>Total</th>
|
||||
<th>Total Approved</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>Bukti</th>
|
||||
<th>Account Number</th>
|
||||
<th>Status</th>
|
||||
@if (auth()->user()->can('approval.approve'))
|
||||
@@ -116,30 +115,13 @@
|
||||
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
|
||||
<td>{{ $item->liter }}</td>
|
||||
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
|
||||
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
|
||||
<td>{{ $item->jarak }} km</td>
|
||||
<td>{{ $item->tipe_bensin }}</td>
|
||||
<td>{{ $item->nopol }}</td>
|
||||
<td>
|
||||
@if ($item->bukti1)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti1) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($item->bukti2)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti2) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if ($item->bukti3)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti3) }}" target="_blank">
|
||||
@if ($item->bukti_total)
|
||||
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
|
||||
Download
|
||||
</a>
|
||||
@else
|
||||
@@ -160,10 +142,10 @@
|
||||
<td>
|
||||
{{-- approve / reject button --}}
|
||||
@if ($item->status == 'On Progress')
|
||||
<form action="{{ route('forms.vehicle.approve', $item->id) }}" method="POST" class="d-inline"onsubmit="return confirm('Are you sure you want to approve this item?');">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<button type="submit" class="btn btn-success btn-sm">
|
||||
<form action="javascript:void(0);" class="d-inline">
|
||||
<button type="button"
|
||||
class="btn btn-success btn-sm open-approve-modal"
|
||||
data-id="{{ route('forms.vehicle.approve', $item->id) }}">
|
||||
Approve
|
||||
</button>
|
||||
</form>
|
||||
@@ -215,6 +197,12 @@
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
@if (auth()->user()->can('forms.vehicle.view'))
|
||||
<a href="{{ route('forms.vehicle.view', $item->id) }}" class="btn btn-primary btn-sm">
|
||||
<i class="fas fa-eye text-white"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->can('forms.vehicle.edit'))
|
||||
<a href="{{ route('forms.vehicle.edit', $item->id) }}" class="btn btn-warning btn-sm">
|
||||
<i class="fas fa-edit text-white"></i>
|
||||
@@ -241,20 +229,183 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="approveForm" method="POST" action="">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Loading spinner -->
|
||||
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal content (hidden initially) -->
|
||||
<div id="modalContent" class="d-none">
|
||||
<p>Please review the details below:</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>User:</strong> <span id="user"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Tipe:</strong> Vehicle Running Cost
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Tanggal & Waktu:</strong> <span id="tanggal"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jarak:</strong> <span id="jarak"></span> km
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Total Liter Bensin:</strong> <span id="liter"></span> liter
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>No Polisi:</strong> <span id="nopol"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Tipe Bensin:</strong> <span id="tipe_bensin"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Bukti Total Harga Bensin:</strong> <span id="bukti_total"></span>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="mt-2">Please select the items you want to approve:</p>
|
||||
<ul class="list-group list-unstyled">
|
||||
<li>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="total_bensin" name="total_bensin">
|
||||
<label class="custom-control-label" for="total_bensin">Total Harga Bensin (<span id="total_bensin_value"></span>)</label>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="form-group">
|
||||
<label for="total">Total</label>
|
||||
<input type="text" class="form-control" id="total" name="total" value="0" readonly>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Approve</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: false,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
$(document).ready(function () {
|
||||
// Uncheck all checkboxes on page refresh
|
||||
$('.custom-control-input').prop('checked', false);
|
||||
|
||||
if ($('#dataTable').length) {
|
||||
$('#dataTable').DataTable({
|
||||
responsive: false,
|
||||
dom: 'Bfrtip',
|
||||
buttons: ['excel', 'pdf', 'print']
|
||||
});
|
||||
}
|
||||
|
||||
// Handle Approve Button Click
|
||||
$('.open-approve-modal').on('click', function () {
|
||||
const approveUrl = $(this).data('id');
|
||||
|
||||
// Show spinner and hide content initially
|
||||
$('#loadingSpinner').show();
|
||||
$('#modalContent').addClass('d-none');
|
||||
|
||||
$('#approveForm').attr('action', approveUrl); // Set the form action
|
||||
$('#loadingSpinner').addClass('d-flex');
|
||||
$('#approveModal').modal('show'); // Show the modal
|
||||
|
||||
// Get detail from /forms/up-country/detail/{id}
|
||||
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
|
||||
$('#total_bensin_value').text(formatter.format(data.total));
|
||||
$('#total_bensin').data('value', data.total);
|
||||
$('#jarak').text(data.jarak);
|
||||
$('#liter').text(data.liter);
|
||||
$('#nopol').text(data.nopol);
|
||||
$('#tipe_bensin').text(data.tipe_bensin);
|
||||
$('#keterangan').text(data.keterangan);
|
||||
|
||||
// Detail data
|
||||
$('#user').text(data.user.name);
|
||||
$('#expense_number').text(data.expense_number);
|
||||
$('#tanggal').text(new Date(data.tanggal).toLocaleDateString('id-ID', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
}));
|
||||
|
||||
$('#bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
||||
|
||||
// Hide spinner and show content
|
||||
$('#loadingSpinner').hide();
|
||||
$('#loadingSpinner').removeClass('d-flex');
|
||||
$('#loadingSpinner').addClass('d-none');
|
||||
$('#modalContent').removeClass('d-none');
|
||||
|
||||
// Reset the total to zero
|
||||
$('#total').val(0);
|
||||
});
|
||||
});
|
||||
|
||||
// Update total dynamically
|
||||
$('.custom-control-input').on('change', function () {
|
||||
let total = 0;
|
||||
|
||||
// Calculate the total based on checked checkboxes
|
||||
$('.custom-control-input:checked').each(function () {
|
||||
total += parseFloat($(this).data('value') || 0);
|
||||
});
|
||||
|
||||
// Update the total field with formatted value
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0
|
||||
});
|
||||
|
||||
$('#total').val(formatter.format(total));
|
||||
});
|
||||
|
||||
// Uncheck all checkboxes when the modal is closed
|
||||
$('#approveModal').on('hidden.bs.modal', function () {
|
||||
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
||||
$('#total').val('0'); // Reset total to 0
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -0,0 +1,96 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1>Lihat Expense Vehicle Running Cost</h1>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">No Expense</label>
|
||||
<input type="text" class="form-control" name="expense_number" value="{{ $form->expense_number }}" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal</label>
|
||||
<input type="datetime-local" class="form-control" name="tanggal" readonly value="{{ $form->tanggal }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Liter Bensin</label>
|
||||
<input type="text" class="form-control" name="liter" readonly value="{{ $form->liter }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total Harga Bensin</label>
|
||||
<input type="string" class="form-control" name="total" id="total" readonly value="{{ $form->total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Bukti Total Harga Bensin</label><br>
|
||||
<a href="{{ $form->bukti_total }}" target="_blank">Lihat Bukti</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jarak (km)</label>
|
||||
<input type="number" class="form-control" name="jarak" id="jarak" readonly value="{{ $form->jarak }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Bensin</label>
|
||||
<select class="form-control" name="tipe_bensin" disabled>
|
||||
<option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
||||
<option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nomor Polisi</label>
|
||||
<input type="text" class="form-control" name="nopol" id="nopol" readonly value="{{ $form->nopol }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan</label>
|
||||
<textarea class="form-control" name="keterangan" id="keterangan" readonly>{{ $form->keterangan }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<a href="{{ route('forms.vehicle') }}" class="btn btn-secondary">Kembali</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
new AutoNumeric('#total', {
|
||||
digitGroupSeparator: '.', // Pemisah ribuan
|
||||
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
|
||||
currencySymbol: 'Rp.', // Simbol mata uang
|
||||
decimalPlaces: 0, // Tidak ada angka desimal
|
||||
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user