remove status pending and complete
This commit is contained in:
@@ -164,6 +164,24 @@ use Illuminate\Support\Facades\Auth;
|
||||
.mutation-detail-table input {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.bg-warning-light {
|
||||
background-color: #fff3cd !important;
|
||||
border: 1px solid #ffeaa7;
|
||||
}
|
||||
|
||||
.form-control-plaintext.border {
|
||||
background-color: #f8f9fa;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.alert ul {
|
||||
padding-left: 1.2rem;
|
||||
}
|
||||
|
||||
.alert ul li {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@@ -718,16 +736,17 @@ use Illuminate\Support\Facades\Auth;
|
||||
<!-- Tab Penerimaan Mutasi -->
|
||||
<div class="tab-pane" id="penerimaan" role="tabpanel">
|
||||
<div class="mt-3">
|
||||
<h6 class="mb-3">Daftar Mutasi yang Perlu Diterima</h6>
|
||||
<h6 class="mb-3">Daftar Mutasi yang Perlu Diterima & Disetujui</h6>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover" id="receiveMutationsTable">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="20%">No. Mutasi</th>
|
||||
<th width="25%">Dealer Asal</th>
|
||||
<th width="15%">Status</th>
|
||||
<th width="10%">Total Item</th>
|
||||
<th width="15%">Tanggal</th>
|
||||
<th width="15%">No. Mutasi</th>
|
||||
<th width="20%">Dealer Asal</th>
|
||||
<th width="20%">Dealer Tujuan</th>
|
||||
<th width="12%">Status</th>
|
||||
<th width="8%">Total Item</th>
|
||||
<th width="10%">Tanggal</th>
|
||||
<th width="15%">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -764,6 +783,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
</div>
|
||||
<form id="receiveMutationForm" action="" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="from_transaction_page" value="1">
|
||||
<div class="modal-body">
|
||||
<div id="mutationDetailContent">
|
||||
<div class="text-center">
|
||||
@@ -775,7 +795,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
|
||||
<button type="submit" class="btn btn-success" id="receiveButton" style="display: none;">
|
||||
<i class="fa fa-check"></i> Terima Mutasi
|
||||
<i class="fa fa-check"></i> Terima
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1312,6 +1332,16 @@ use Illuminate\Support\Facades\Auth;
|
||||
setTimeout(function() {
|
||||
$('.nav-link[href="#mutasi"]').tab('show');
|
||||
}, 100);
|
||||
@elseif(session('active_tab') == 'penerimaan')
|
||||
// Activate stock tab and penerimaan sub-tab
|
||||
$('.nav-link[href="#stock"]').tab('show');
|
||||
setTimeout(function() {
|
||||
$('.nav-link[href="#penerimaan"]').tab('show');
|
||||
// Initialize table after tab is shown
|
||||
setTimeout(function() {
|
||||
initReceiveMutationsTable();
|
||||
}, 200);
|
||||
}, 100);
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@@ -1348,8 +1378,8 @@ use Illuminate\Support\Facades\Auth;
|
||||
var successMessage = '{{ session("success") }}';
|
||||
var activeTab = '{{ session("active_tab") }}';
|
||||
|
||||
if (successMessage.toLowerCase().includes('mutasi') || activeTab === 'mutasi') {
|
||||
// Reset mutasi form after success
|
||||
if (successMessage.toLowerCase().includes('mutasi') && (successMessage.toLowerCase().includes('berhasil dibuat') || activeTab === 'mutasi')) {
|
||||
// Reset mutasi form after success for CREATING mutations
|
||||
$('#mutasiForm')[0].reset();
|
||||
$('#products-tbody-mutasi').html(`
|
||||
<tr class="product-row-mutasi" data-index="0">
|
||||
@@ -1385,6 +1415,38 @@ use Illuminate\Support\Facades\Auth;
|
||||
$("#btn-save-mutasi").attr("disabled", false);
|
||||
$("#btn-save-mutasi").removeClass("disabled");
|
||||
$("#btn-save-mutasi").html('Kirim Mutasi');
|
||||
} else if (successMessage.toLowerCase().includes('penerimaan') || (successMessage.toLowerCase().includes('mutasi') && successMessage.toLowerCase().includes('diterima')) || activeTab === 'penerimaan') {
|
||||
// For penerimaan mutasi, just refresh the table without resetting form
|
||||
// Activate the correct tab first
|
||||
$('.nav-link[href="#stock"]').tab('show');
|
||||
setTimeout(function() {
|
||||
$('.nav-link[href="#penerimaan"]').tab('show');
|
||||
// Stay on penerimaan tab and refresh table
|
||||
setTimeout(function() {
|
||||
if (receiveMutationsTable && $.fn.DataTable.isDataTable('#receiveMutationsTable')) {
|
||||
receiveMutationsTable.ajax.reload(null, false); // Don't reset paging
|
||||
} else {
|
||||
// Initialize table if not already initialized
|
||||
initReceiveMutationsTable();
|
||||
}
|
||||
}, 300);
|
||||
}, 100);
|
||||
// Close any open modals
|
||||
$('#mutationDetailModal').modal('hide');
|
||||
} else if (successMessage.toLowerCase().includes('disetujui') || successMessage.toLowerCase().includes('ditolak') || activeTab === 'persetujuan') {
|
||||
// For approval/rejection, refresh the table
|
||||
$('.nav-link[href="#stock"]').tab('show');
|
||||
setTimeout(function() {
|
||||
$('.nav-link[href="#penerimaan"]').tab('show');
|
||||
// Refresh table to show updated status
|
||||
setTimeout(function() {
|
||||
if (receiveMutationsTable && $.fn.DataTable.isDataTable('#receiveMutationsTable')) {
|
||||
receiveMutationsTable.ajax.reload(null, false);
|
||||
} else {
|
||||
initReceiveMutationsTable();
|
||||
}
|
||||
}, 300);
|
||||
}, 100);
|
||||
} else if (successMessage.toLowerCase().includes('opname') || activeTab === 'opname') {
|
||||
// Reset opname form after success
|
||||
$('#opnameForm')[0].reset();
|
||||
@@ -1645,6 +1707,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
columns: [
|
||||
{data: 'mutation_number', name: 'mutation_number'},
|
||||
{data: 'from_dealer', name: 'from_dealer'},
|
||||
{data: 'to_dealer', name: 'to_dealer'},
|
||||
{data: 'status', name: 'status', orderable: false},
|
||||
{data: 'total_items', name: 'total_items'},
|
||||
{data: 'created_at', name: 'created_at'},
|
||||
@@ -1656,6 +1719,8 @@ use Illuminate\Support\Facades\Auth;
|
||||
});
|
||||
}
|
||||
|
||||
// Function removed since we use single table for both receive and approval mutations
|
||||
|
||||
// Show mutation detail modal
|
||||
function showMutationDetail(mutationId) {
|
||||
$('#mutationDetailModal').modal('show');
|
||||
@@ -1698,6 +1763,8 @@ use Illuminate\Support\Facades\Auth;
|
||||
function renderMutationDetail(mutation) {
|
||||
var statusColor = mutation.status_color;
|
||||
var statusLabel = mutation.status_label;
|
||||
var isReceived = mutation.status.value === 'received';
|
||||
var canBeReceived = mutation.can_be_received;
|
||||
|
||||
// Set form action URL
|
||||
$('#receiveMutationForm').attr('action', '{{ route("mutations.receive", ":id") }}'.replace(':id', mutation.id));
|
||||
@@ -1735,13 +1802,6 @@ use Illuminate\Support\Facades\Auth;
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-12">
|
||||
<label for="mutationNotes"><strong>Catatan Penerimaan:</strong></label>
|
||||
<textarea name="reception_notes" id="mutationNotes" class="form-control" rows="3" placeholder="Masukkan catatan jika diperlukan..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h6 class="mb-3">Detail Produk & Penerimaan:</h6>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered mutation-detail-table">
|
||||
@@ -1756,9 +1816,12 @@ use Illuminate\Support\Facades\Auth;
|
||||
<tbody>
|
||||
`;
|
||||
|
||||
// Add product details with form inputs
|
||||
// Add product details with form inputs or read-only display
|
||||
if (mutation.mutation_details && mutation.mutation_details.length > 0) {
|
||||
mutation.mutation_details.forEach(function(detail) {
|
||||
var quantityValue = detail.quantity_approved || detail.quantity_requested;
|
||||
var notesValue = detail.notes || '';
|
||||
|
||||
detailHtml += `
|
||||
<tr>
|
||||
<td>${detail.product.name}</td>
|
||||
@@ -1766,21 +1829,53 @@ use Illuminate\Support\Facades\Auth;
|
||||
<span class="font-weight-bold text-info">${parseFloat(detail.quantity_requested).toFixed(2)}</span>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number"
|
||||
name="products[${detail.id}][quantity_approved]"
|
||||
class="form-control quantity-approved-input"
|
||||
min="0"
|
||||
max="${detail.quantity_requested}"
|
||||
step="0.01"
|
||||
value="${detail.quantity_requested}"
|
||||
data-max="${detail.quantity_requested}"
|
||||
placeholder="0.00">
|
||||
`;
|
||||
|
||||
if (canBeReceived && !isReceived) {
|
||||
// Editable input for mutations that can be received
|
||||
detailHtml += `
|
||||
<input type="number"
|
||||
name="products[${detail.id}][quantity_approved]"
|
||||
class="form-control quantity-approved-input"
|
||||
min="0"
|
||||
max="${detail.quantity_requested}"
|
||||
step="0.01"
|
||||
value="${detail.quantity_requested}"
|
||||
data-max="${detail.quantity_requested}"
|
||||
placeholder="0.00">
|
||||
`;
|
||||
} else {
|
||||
// Read-only display for received mutations
|
||||
detailHtml += `
|
||||
<span class="font-weight-bold ${quantityValue == detail.quantity_requested ? 'text-success' : 'text-warning'}">
|
||||
${parseFloat(quantityValue).toFixed(2)}
|
||||
</span>
|
||||
${quantityValue != detail.quantity_requested ?
|
||||
'<small class="text-muted d-block">(Sebagian)</small>' : ''}
|
||||
`;
|
||||
}
|
||||
|
||||
detailHtml += `
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="products[${detail.id}][notes]"
|
||||
class="form-control"
|
||||
rows="2"
|
||||
placeholder="Catatan untuk produk ini..."></textarea>
|
||||
`;
|
||||
|
||||
if (canBeReceived && !isReceived) {
|
||||
// Editable textarea for mutations that can be received
|
||||
detailHtml += `
|
||||
<textarea name="products[${detail.id}][notes]"
|
||||
class="form-control"
|
||||
rows="2"
|
||||
placeholder="Catatan untuk produk ini...">${notesValue}</textarea>
|
||||
`;
|
||||
} else {
|
||||
// Read-only display for received mutations
|
||||
detailHtml += `
|
||||
<span class="text-muted">${notesValue || '-'}</span>
|
||||
`;
|
||||
}
|
||||
|
||||
detailHtml += `
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
@@ -1798,21 +1893,76 @@ use Illuminate\Support\Facades\Auth;
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<strong>Petunjuk:</strong>
|
||||
Masukkan quantity yang disetujui untuk setiap produk. Quantity tidak boleh melebihi quantity yang diminta.
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-12">
|
||||
<label for="mutationNotes"><strong>Catatan Penerimaan:</strong></label>
|
||||
`;
|
||||
|
||||
if (canBeReceived && !isReceived) {
|
||||
// Editable textarea for mutations that can be received
|
||||
detailHtml += `
|
||||
<textarea name="reception_notes" id="mutationNotes" class="form-control" rows="3"
|
||||
placeholder="Masukkan catatan kondisi barang saat diterima (opsional)...">${mutation.reception_notes || ''}</textarea>
|
||||
`;
|
||||
} else {
|
||||
// Read-only display for received mutations
|
||||
detailHtml += `
|
||||
<div class="form-control-plaintext border rounded p-2 bg-light" style="min-height: 60px;">
|
||||
${mutation.reception_notes || '<em class="text-muted">Tidak ada catatan</em>'}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
detailHtml += `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
$('#mutationDetailContent').html(detailHtml);
|
||||
|
||||
// Show receive button if mutation can be received
|
||||
if (mutation.can_be_received) {
|
||||
$('#receiveButton').show();
|
||||
// Add instructions based on status
|
||||
if (canBeReceived && !isReceived) {
|
||||
detailHtml += `
|
||||
<div class="alert alert-info mb-0">
|
||||
<div class="d-flex align-items-start">
|
||||
<i class="fa fa-info-circle mt-1 mr-2"></i>
|
||||
<div>
|
||||
<strong>Instruksi Penerimaan:</strong>
|
||||
<ul class="mb-0 mt-2">
|
||||
<li>Periksa kondisi fisik produk yang diterima</li>
|
||||
<li>Masukkan quantity yang benar-benar diterima untuk setiap produk</li>
|
||||
<li>Quantity yang disetujui tidak boleh melebihi quantity yang diminta</li>
|
||||
<li>Berikan catatan jika ada produk yang rusak atau tidak sesuai</li>
|
||||
</ul>
|
||||
<div class="mt-2 p-2 rounded">
|
||||
<small><strong>Perhatian:</strong> Setelah diterima, catatan tidak dapat diubah lagi. Pastikan informasi sudah benar sebelum menerima mutasi.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else if (isReceived) {
|
||||
detailHtml += `
|
||||
<div class="alert alert-success mb-0">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="fa fa-check-circle mr-2"></i>
|
||||
<div>
|
||||
<strong>Status:</strong> Mutasi telah diterima dan siap untuk disetujui.
|
||||
<br><small>Stock akan dipindahkan setelah Anda menyetujui mutasi ini.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// Add validation for quantity inputs
|
||||
$('#mutationDetailContent').html(detailHtml);
|
||||
|
||||
// Show receive button only if mutation can be received
|
||||
if (canBeReceived && !isReceived) {
|
||||
$('#receiveButton').show();
|
||||
} else {
|
||||
$('#receiveButton').hide();
|
||||
}
|
||||
|
||||
// Add validation for quantity inputs (only for editable fields)
|
||||
$('.quantity-approved-input').on('input', function() {
|
||||
var value = parseFloat($(this).val()) || 0;
|
||||
var max = parseFloat($(this).data('max')) || 0;
|
||||
@@ -1864,16 +2014,31 @@ use Illuminate\Support\Facades\Auth;
|
||||
|
||||
if (typeof Swal !== 'undefined') {
|
||||
Swal.fire({
|
||||
title: 'Terima Mutasi?',
|
||||
text: "Mutasi akan diterima dengan quantity dan catatan yang telah Anda masukkan",
|
||||
type: 'question',
|
||||
title: 'Konfirmasi Penerimaan Mutasi',
|
||||
html: `
|
||||
<div class="text-left">
|
||||
<p class="mb-3">Dengan menerima mutasi ini:</p>
|
||||
<ul class="text-muted mb-3" style="font-size: 14px;">
|
||||
<li>Anda mengkonfirmasi telah menerima produk dari dealer pengirim</li>
|
||||
<li>Data quantity dan catatan yang dimasukkan akan disimpan</li>
|
||||
<li>Mutasi akan masuk ke tahap persetujuan untuk memindahkan stock</li>
|
||||
<li>Catatan dan data penerimaan tidak dapat diubah setelah diterima</li>
|
||||
</ul>
|
||||
<div class="alert alert-info">
|
||||
<i class="fa fa-info-circle mr-2"></i>
|
||||
<small><strong>Info:</strong> Pastikan semua data sudah benar sebelum menerima mutasi.</small>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#28a745',
|
||||
cancelButtonColor: '#6c757d',
|
||||
confirmButtonText: 'Ya, Terima',
|
||||
cancelButtonText: 'Batal'
|
||||
confirmButtonText: 'Ya, Terima Mutasi',
|
||||
cancelButtonText: 'Batal',
|
||||
width: '500px'
|
||||
}).then((result) => {
|
||||
if (result.value) {
|
||||
if (result.isConfirmed) {
|
||||
// Set loading state
|
||||
$('#receiveButton').prop('disabled', true).html('<i class="fa fa-spinner fa-spin"></i> Memproses...');
|
||||
|
||||
@@ -1896,6 +2061,138 @@ use Illuminate\Support\Facades\Auth;
|
||||
}, 100);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Handle approve button click
|
||||
$(document).on('click', '.btn-approve-mutation', function() {
|
||||
var mutationId = $(this).data('id');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Persetujuan Mutasi',
|
||||
html: `
|
||||
<div class="text-left">
|
||||
<p class="mb-3">Dengan menyetujui mutasi ini:</p>
|
||||
<ul class="text-muted mb-3" style="font-size: 14px;">
|
||||
<li>Stock akan dipindahkan secara otomatis dari dealer asal ke dealer tujuan</li>
|
||||
<li>Proses mutasi akan selesai dan tidak dapat dibatalkan</li>
|
||||
<li>Perubahan stock akan tercatat dalam log sistem</li>
|
||||
</ul>
|
||||
<div class="form-group text-left">
|
||||
<label for="approval-notes" class="font-weight-bold">Catatan Persetujuan:</label>
|
||||
<textarea id="approval-notes" class="form-control" rows="3" placeholder="Masukkan catatan persetujuan (opsional)..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#28a745',
|
||||
cancelButtonColor: '#6c757d',
|
||||
confirmButtonText: 'Ya, Setujui Mutasi',
|
||||
cancelButtonText: 'Batal',
|
||||
width: '500px',
|
||||
preConfirm: () => {
|
||||
return document.getElementById('approval-notes').value;
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Create form and submit
|
||||
var form = $('<form>').attr({
|
||||
method: 'POST',
|
||||
action: '{{ route("mutations.approve", ":id") }}'.replace(':id', mutationId)
|
||||
});
|
||||
|
||||
form.append($('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: '_token',
|
||||
value: $('meta[name="csrf-token"]').attr('content')
|
||||
}));
|
||||
|
||||
form.append($('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: 'from_transaction_page',
|
||||
value: '1'
|
||||
}));
|
||||
|
||||
if (result.value) {
|
||||
form.append($('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: 'approval_notes',
|
||||
value: result.value
|
||||
}));
|
||||
}
|
||||
|
||||
$('body').append(form);
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle reject button click
|
||||
$(document).on('click', '.btn-reject-mutation', function() {
|
||||
var mutationId = $(this).data('id');
|
||||
|
||||
Swal.fire({
|
||||
title: 'Konfirmasi Penolakan Mutasi',
|
||||
html: `
|
||||
<div class="text-left">
|
||||
<div class="alert alert-warning mb-3">
|
||||
<i class="fa fa-exclamation-triangle mr-2"></i>
|
||||
<strong>Perhatian:</strong> Mutasi yang ditolak tidak dapat diubah lagi dan proses akan dihentikan.
|
||||
</div>
|
||||
<div class="form-group text-left">
|
||||
<label for="rejection-reason" class="font-weight-bold">Alasan Penolakan: <span class="text-danger">*</span></label>
|
||||
<textarea id="rejection-reason" class="form-control" rows="3" placeholder="Jelaskan alasan penolakan mutasi ini..." required></textarea>
|
||||
<small class="text-muted">Alasan penolakan wajib diisi untuk dokumentasi.</small>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#dc3545',
|
||||
cancelButtonColor: '#6c757d',
|
||||
confirmButtonText: 'Ya, Tolak Mutasi',
|
||||
cancelButtonText: 'Batal',
|
||||
width: '500px',
|
||||
preConfirm: () => {
|
||||
const reason = document.getElementById('rejection-reason').value;
|
||||
if (!reason || reason.trim() === '') {
|
||||
Swal.showValidationMessage('Alasan penolakan harus diisi!');
|
||||
return false;
|
||||
}
|
||||
return reason;
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed && result.value) {
|
||||
// Create form and submit
|
||||
var form = $('<form>').attr({
|
||||
method: 'POST',
|
||||
action: '{{ route("mutations.reject", ":id") }}'.replace(':id', mutationId)
|
||||
});
|
||||
|
||||
form.append($('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: '_token',
|
||||
value: $('meta[name="csrf-token"]').attr('content')
|
||||
}));
|
||||
|
||||
form.append($('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: 'from_transaction_page',
|
||||
value: '1'
|
||||
}));
|
||||
|
||||
form.append($('<input>').attr({
|
||||
type: 'hidden',
|
||||
name: 'rejection_reason',
|
||||
value: result.value
|
||||
}));
|
||||
|
||||
$('body').append(form);
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Save active tab to localStorage
|
||||
$('.nav-link').on('click', function() {
|
||||
var target = $(this).attr('href');
|
||||
|
||||
@@ -52,25 +52,8 @@
|
||||
@endif
|
||||
|
||||
@if($row->status->value === 'approved')
|
||||
<!-- Complete/Receive Button -->
|
||||
@can('complete-mutation')
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-primary btn-complete mr-2"
|
||||
data-id="{{ $row->id }}"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#completeModal{{ $row->id }}">
|
||||
Selesaikan
|
||||
</button>
|
||||
@endcan
|
||||
|
||||
<!-- Cancel Button -->
|
||||
@can('edit-mutation')
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-warning btn-cancel mr-2"
|
||||
data-id="{{ $row->id }}">
|
||||
Batal
|
||||
</button>
|
||||
@endcan
|
||||
<!-- Stock has already been moved automatically after approval -->
|
||||
<span class="badge badge-success">Stock Telah Dipindahkan</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -86,6 +69,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
<strong>Konfirmasi!</strong> Anda akan menyetujui mutasi yang telah diterima oleh <strong>{{ $row->toDealer->name }}</strong>.
|
||||
<br><strong>Stock akan dipindahkan secara otomatis setelah disetujui.</strong>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -128,7 +112,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted">Setelah disetujui, stock akan siap untuk dipindahkan.</p>
|
||||
<p class="text-muted">Setelah disetujui, stock akan dipindahkan secara otomatis.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
@@ -223,7 +207,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted">Setelah menerima, mutasi akan menunggu persetujuan dari pengirim sebelum stock dipindahkan.</p>
|
||||
<p class="text-muted">Setelah menerima, mutasi akan menunggu persetujuan dari pengirim. Stock akan dipindahkan otomatis setelah disetujui.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
@@ -234,26 +218,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal untuk Complete -->
|
||||
<div class="modal fade" id="completeModal{{ $row->id }}" tabindex="-1" aria-labelledby="completeModalLabel{{ $row->id }}" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="completeModalLabel{{ $row->id }}">Selesaikan Mutasi</h5>
|
||||
</div>
|
||||
<form action="{{ route('mutations.complete', $row->id) }}" method="POST">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
<strong>Konfirmasi!</strong> Stock akan dipindahkan dari <strong>{{ $row->fromDealer->name }}</strong> ke <strong>{{ $row->toDealer->name }}</strong>.
|
||||
</div>
|
||||
<p>Apakah Anda yakin ingin menyelesaikan mutasi ini? Tindakan ini tidak dapat dibatalkan.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary">Ya, Selesaikan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Complete Modal is no longer needed since stock moves automatically after approval -->
|
||||
@@ -158,7 +158,7 @@
|
||||
<td>{{ $detail->product->name }}</td>
|
||||
<td class="text-center">{{ number_format($detail->quantity_requested, 2) }}</td>
|
||||
<td class="text-center">
|
||||
@if($mutation->status->value === 'received' || $mutation->status->value === 'approved' || $mutation->status->value === 'completed')
|
||||
@if($mutation->status->value === 'received' || $mutation->status->value === 'approved')
|
||||
{{ number_format($detail->quantity_approved ?? 0, 2) }}
|
||||
@else
|
||||
<span class="text-muted">Belum ditentukan</span>
|
||||
@@ -187,7 +187,7 @@
|
||||
<td colspan="2" class="text-right">Total</td>
|
||||
<td class="text-center">{{ number_format($mutation->mutationDetails->sum('quantity_requested'), 2) }}</td>
|
||||
<td class="text-center">
|
||||
@if($mutation->status->value === 'received' || $mutation->status->value === 'approved' || $mutation->status->value === 'completed')
|
||||
@if($mutation->status->value === 'received' || $mutation->status->value === 'approved')
|
||||
{{ number_format($mutation->mutationDetails->sum('quantity_approved'), 2) }}
|
||||
@else
|
||||
<span class="text-muted">-</span>
|
||||
@@ -225,10 +225,8 @@
|
||||
@endif
|
||||
|
||||
@if($mutation->status->value === 'approved')
|
||||
<!-- Complete Button -->
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#completeModal">
|
||||
Selesaikan Mutasi
|
||||
</button>
|
||||
<!-- Stock has already been moved automatically after approval -->
|
||||
<span class="badge badge-success">Stock Telah Dipindahkan</span>
|
||||
@endif
|
||||
|
||||
@if($mutation->canBeCancelled() && (auth()->user()->dealer_id == $mutation->from_dealer_id || auth()->user()->hasRole('admin')))
|
||||
@@ -308,7 +306,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted">Setelah menerima, mutasi akan menunggu persetujuan dari pengirim sebelum stock dipindahkan.</p>
|
||||
<p class="text-muted">Setelah menerima, mutasi akan menunggu persetujuan dari pengirim. Stock akan dipindahkan otomatis setelah disetujui.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
@@ -378,7 +376,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="text-muted">Setelah disetujui, stock akan siap untuk dipindahkan.</p>
|
||||
<p class="text-muted">Setelah disetujui, stock akan dipindahkan secara otomatis.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
@@ -420,35 +418,6 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($mutation->status->value === 'approved')
|
||||
<!-- Complete Modal -->
|
||||
<div class="modal fade" id="completeModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Selesaikan Mutasi</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="{{ route('mutations.complete', $mutation->id) }}" method="POST">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-info">
|
||||
<strong>Konfirmasi!</strong> Stock akan dipindahkan dari <strong>{{ $mutation->fromDealer->name }}</strong> ke <strong>{{ $mutation->toDealer->name }}</strong>.
|
||||
</div>
|
||||
<p>Apakah Anda yakin ingin menyelesaikan mutasi ini? Tindakan ini tidak dapat dibatalkan.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary">Ya, Selesaikan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@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">
|
||||
|
||||
Reference in New Issue
Block a user