46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
$(document).ready(function() {
|
|
$('.unit_kerja').select2();
|
|
$('.sub_unit_kerja').select2();
|
|
$('.klasifikasi_dok').select2();
|
|
$('.kategori_dok').select2();
|
|
});
|
|
|
|
|
|
let colCount = 1;
|
|
function addForm(){
|
|
let col = $("#col_add_file")
|
|
|
|
let html = '';
|
|
|
|
html += ` <div class="col mt-2 d-flex align-items-start gap-2" id="col-${colCount}">
|
|
<div class="col-md-6">
|
|
<label>File</label>
|
|
<input type="file" class="form-control" name="data[${colCount}][file]" placeholder="exp : Juknis" required>
|
|
</div>
|
|
<div class="col-md-5">
|
|
<label>Klasifikasi File</label>
|
|
<select class="form-select" name="data[${colCount}][klasifikasi]">
|
|
<option value="" disable >Select Choose</option>
|
|
${klasifikasiDok.map(kla => `
|
|
<option value="${kla?.master_klasifikasi_directory_id}">${kla?.nama_klasifikasi_directory}</option>
|
|
`).join('')}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<button type="button" class="btn btn-danger mt-4 me-2" onclick="removeCol(${colCount})"><i class="fa-solid fa-trash"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
`
|
|
col.append(html)
|
|
colCount++;
|
|
|
|
}
|
|
|
|
|
|
function removeCol(count){
|
|
$(`#col-${count}`).remove()
|
|
}
|
|
|