add remarks 1

This commit is contained in:
Fiqh Pratama
2025-10-12 19:14:17 +07:00
parent 9952968d82
commit 6b2e658070
9 changed files with 295 additions and 75 deletions
@@ -116,13 +116,11 @@
</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>
<button type="button"
class="btn btn-danger btn-sm open-reject-modal"
data-action="{{ route('forms.up-country.reject', $form->id) }}">
Reject
</button>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@@ -277,13 +275,11 @@
</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">
<button type="button"
class="btn btn-danger btn-sm open-reject-modal"
data-action="{{ route('forms.vehicle.reject', $form->id) }}">
Reject
</button>
</form>
@else
@if ($form->approved_at)
{{ \Carbon\Carbon::parse($form->approved_at)->locale('id')->isoFormat('D MMMM Y') }}
@@ -824,6 +820,35 @@
</div>
</div>
</section>
<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>
@endsection
@section('scripts')
@@ -844,5 +869,21 @@
if ($('#dataTable-form_others').length) {
$('#dataTable-form_others').DataTable({ responsive: false });
}
$(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('');
});
</script>
@endsection