localize library cdn, remove approve button from transaction page, fix all fitur running datatable as well, fixing sortable datatable using new cdn, fix modal approve, add note to receiver mutations

This commit is contained in:
2025-06-16 15:01:08 +07:00
parent 9cfb566aee
commit 567e4aa5fc
45 changed files with 16202 additions and 365 deletions

View File

@@ -53,7 +53,9 @@
@if($row->status->value === 'approved')
<!-- Stock has already been moved automatically after approval -->
<span class="badge badge-success">Stock Telah Dipindahkan</span>
<div class="text-center">
<span class="btn btn-sm btn-success" style="cursor: default; pointer-events: none;">Selesai</span>
</div>
@endif
</div>

View File

@@ -48,6 +48,55 @@
</div>
@endsection
@section('styles')
<style>
/* DataTables Sorting Icons */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_desc:after {
font-family: 'Font Awesome 5 Free';
font-weight: 900;
opacity: 0.5;
}
table.dataTable thead .sorting:before {
content: "\f0dc";
}
table.dataTable thead .sorting_asc:before {
content: "\f0de";
opacity: 1;
}
table.dataTable thead .sorting_desc:before {
content: "\f0dd";
opacity: 1;
}
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
display: none;
}
/* Ensure column headers are clickable */
table.dataTable thead th {
cursor: pointer;
position: relative;
user-select: none;
}
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
cursor: pointer;
}
</style>
@endsection
@section('javascripts')
<script src="{{ mix('js/warehouse_management/mutations/index.js') }}"></script>
@endsection

View File

@@ -215,7 +215,7 @@
@if($mutation->status->value === 'received' && (auth()->user()->dealer_id == $mutation->from_dealer_id || auth()->user()->hasRole('admin')))
<!-- Approve Button for sender or admin -->
<button type="button" class="btn btn-success btn-approve" data-id="{{ $mutation->id }}">
<button type="button" class="btn btn-success btn-approve" data-toggle="modal" data-target="#approveModal{{ $mutation->id }}" data-id="{{ $mutation->id }}">
Setujui Mutasi
</button>
<!-- Reject Button for sender or admin -->
@@ -248,12 +248,12 @@
@if($mutation->status->value === 'sent' && auth()->user()->dealer_id == $mutation->to_dealer_id)
<!-- Receive Modal -->
<div class="modal fade" id="receiveModal{{ $mutation->id }}" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Terima Mutasi</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="{{ route('mutations.receive', $mutation->id) }}" method="POST">
@@ -263,6 +263,16 @@
<strong>Konfirmasi!</strong> Anda akan menerima mutasi dari <strong>{{ $mutation->fromDealer->name }}</strong>.
</div>
@if($mutation->shipping_notes)
<div class="form-group">
<label><strong>Catatan dari Pengirim:</strong></label>
<div class="alert alert-warning">
<i class="fa fa-info-circle mr-2"></i>
{{ $mutation->shipping_notes }}
</div>
</div>
@endif
<div class="form-group">
<label>Catatan Penerimaan</label>
<textarea name="reception_notes" class="form-control" rows="3" placeholder="Catatan kondisi barang saat diterima (opsional)"></textarea>
@@ -320,13 +330,13 @@
@if($mutation->status->value === 'received' && (auth()->user()->dealer_id == $mutation->from_dealer_id || auth()->user()->hasRole('admin')))
<!-- Approve Modal -->
<div class="modal fade" id="approveModal{{ $mutation->id }}" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal fade" id="approveModal{{ $mutation->id }}" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel{{ $mutation->id }}" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Setujui Mutasi</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
<h5 class="modal-title" id="approveModalLabel{{ $mutation->id }}">Setujui Mutasi</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="{{ route('mutations.approve', $mutation->id) }}" method="POST" class="approve-form">
@@ -389,12 +399,12 @@
<!-- Reject Modal -->
<div class="modal fade" id="rejectModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Tolak Mutasi</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="{{ route('mutations.reject', $mutation->id) }}" method="POST">
@@ -421,12 +431,12 @@
@if($mutation->canBeCancelled() && (auth()->user()->dealer_id == $mutation->from_dealer_id || auth()->user()->hasRole('admin')))
<!-- Cancel Modal -->
<div class="modal fade" id="cancelModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Batalkan Mutasi</h5>
<button type="button" class="close" data-dismiss="modal">
<span>&times;</span>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form action="{{ route('mutations.cancel', $mutation->id) }}" method="POST">
@@ -472,6 +482,52 @@
.approve-form .form-control.text-center {
text-align: center;
}
/* Ensure modal backdrop is properly removed */
.modal-backdrop {
z-index: 1040;
}
.modal {
z-index: 1050;
}
/* Force remove any blocking overlays */
body.modal-open {
overflow: hidden;
}
body:not(.modal-open) {
overflow: auto !important;
padding-right: 0 !important;
}
/* Ensure all modals are centered */
.modal-dialog-centered {
display: flex;
align-items: center;
min-height: calc(100% - 1rem);
}
.modal-dialog-centered::before {
display: block;
height: calc(100vh - 1rem);
content: "";
}
.modal-dialog-centered.modal-dialog-centered-sm {
min-height: calc(100% - 1rem);
}
@media (min-width: 576px) {
.modal-dialog-centered {
min-height: calc(100% - 3.5rem);
}
.modal-dialog-centered::before {
height: calc(100vh - 3.5rem);
}
}
</style>
@endsection
@@ -483,6 +539,49 @@ $(document).ready(function() {
var mutationId = $(this).data('id');
$('#approveModal' + mutationId).modal('show');
});
// Handle modal close events
$('.modal').on('hidden.bs.modal', function () {
// Reset form
if ($(this).find('form').length > 0) {
$(this).find('form')[0].reset();
}
// Remove modal backdrop manually if it exists
$('.modal-backdrop').remove();
// Ensure body is not blocked
$('body').removeClass('modal-open');
$('body').css('padding-right', '');
// Remove any overlay that might be blocking
$('.modal-backdrop, .fade.show').remove();
});
// Additional cleanup for approve modal specifically
$(document).on('click', '[data-dismiss="modal"]', function() {
var $modal = $(this).closest('.modal');
$modal.modal('hide');
setTimeout(function() {
$('.modal-backdrop').remove();
$('body').removeClass('modal-open');
$('body').css('padding-right', '');
// Force remove any remaining overlays
$('.modal-backdrop, .modal-open').remove();
$('body').removeClass('modal-open');
}, 300);
});
// Force cleanup on any modal hide
$(document).on('hide.bs.modal', '.modal', function() {
setTimeout(function() {
$('.modal-backdrop').remove();
$('body').removeClass('modal-open');
$('body').css('padding-right', '');
}, 100);
});
// Validate quantity approved in receive modal
$(document).on('input', 'input[name*="quantity_approved"]', function() {