|
|
|
@ -24,6 +24,10 @@
|
|
|
|
|
</option> |
|
|
|
|
@endforeach |
|
|
|
|
</select> |
|
|
|
|
<label for="name" class="col-form-label">Customer: <span class="text-danger">*</span></label> |
|
|
|
|
<input class="form-control" name="name" type="name" id="name" |
|
|
|
|
value="{{ $data_peti->customer->name }}" readonly> |
|
|
|
|
|
|
|
|
|
<label for="exit_at" class="col-form-label">Tanggal Peminjaman: <span |
|
|
|
|
class="text-danger">*</span></label> |
|
|
|
|
<input class="form-control" name="exit_at" type="date" id="exit_at" value="{{ old('exit_at') }}" |
|
|
|
@ -31,8 +35,7 @@
|
|
|
|
|
|
|
|
|
|
<label for="est_pengembalian" class="col-form-label">Estimasi Tanggal Pengembalian: <span |
|
|
|
|
class="text-danger">*</span></label> |
|
|
|
|
<input class="form-control" name="est_pengembalian" type="date" id="est_pengembalian" |
|
|
|
|
value="{{ old('est_pengembalian') }}" required> |
|
|
|
|
<input class="form-control" name="est_pengembalian" type="date" id="est_pengembalian" required> |
|
|
|
|
|
|
|
|
|
<label for="exit_warehouse" class="col-form-label">Asal Gudang: <span |
|
|
|
|
class="text-danger">*</span></label> |
|
|
|
@ -51,9 +54,51 @@
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- auto disable form pada saat sudah di simpan--> |
|
|
|
|
<script> |
|
|
|
|
document.getElementById('peminjamanForm').addEventListener('submit', function() { |
|
|
|
|
document.getElementById('submitButton').setAttribute('disabled', 'true'); |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<!-- otomatis tgl otomatis 1 minggu setelah pembuatan peminjaman --> |
|
|
|
|
<script> |
|
|
|
|
// Mendapatkan elemen input tanggal peminjaman |
|
|
|
|
const exitDateInput = document.getElementById('exit_at'); |
|
|
|
|
|
|
|
|
|
// Mendapatkan elemen input estimasi tanggal pengembalian |
|
|
|
|
const estimatedReturnDateInput = document.getElementById('est_pengembalian'); |
|
|
|
|
|
|
|
|
|
// Menambahkan event listener ke input tanggal peminjaman |
|
|
|
|
exitDateInput.addEventListener('input', function() { |
|
|
|
|
// Mendapatkan tanggal peminjaman dalam format tanggal JavaScript |
|
|
|
|
const exitDate = new Date(this.value); |
|
|
|
|
|
|
|
|
|
// Menghitung tanggal estimasi pengembalian (7 hari setelah tanggal peminjaman) |
|
|
|
|
const estimatedReturnDate = new Date(exitDate); |
|
|
|
|
estimatedReturnDate.setDate(exitDate.getDate() + 7); |
|
|
|
|
|
|
|
|
|
// Mengisi nilai estimasi tanggal pengembalian |
|
|
|
|
estimatedReturnDateInput.valueAsDate = estimatedReturnDate; |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<!-- otomatis asal gudang berdasarkan detail peti --> |
|
|
|
|
<script> |
|
|
|
|
// Mendapatkan elemen select detail peti |
|
|
|
|
const petiSelect = document.getElementById('peti_id'); |
|
|
|
|
|
|
|
|
|
// Mendapatkan elemen select asal gudang |
|
|
|
|
const exitWarehouseSelect = document.getElementById('exit_warehouse'); |
|
|
|
|
|
|
|
|
|
// Menambahkan event listener ke select detail peti |
|
|
|
|
petiSelect.addEventListener('change', function() { |
|
|
|
|
// Mendapatkan data-warehouse-id dari option yang dipilih |
|
|
|
|
const selectedOption = this.options[this.selectedIndex]; |
|
|
|
|
const warehouseId = selectedOption.getAttribute('data-warehouse-id'); |
|
|
|
|
|
|
|
|
|
// Memilih asal gudang berdasarkan data-warehouse-id |
|
|
|
|
exitWarehouseSelect.value = warehouseId; |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
@endsection |
|
|
|
|