fix nota tambahan dan fix untuk kuantiti

This commit is contained in:
Hafifie PKB
2024-10-08 15:58:19 +08:00
parent cb21cd260f
commit 886a602842
3 changed files with 76 additions and 13 deletions
+41 -10
View File
@@ -379,24 +379,22 @@
$('#beratpermata').val("");
}
$('#kuantiti').val('');
$('#karat').val('');
if(marhun == 'G/B' || marhun == 'WFR' || marhun == 'SYE' || marhun == 'DNR'){
if(marhun == 'DNR' || marhun == 'SYE'){
$('#karat option').show();
$('#karat option').not('[value="21.0K"]').not('[value="22.0K"]').not('[value="23.0K"]').not('[value="24.0K"]').not('[value="24.0Kgb"]').not(':first').hide();
$('#sltkarat option').show();
$('#sltkarat option').not('[value="21.0K"]').not('[value="22.0K"]').not('[value="23.0K"]').not('[value="24.0K"]').not('[value="24.0Kgb"]').not(':first').hide();
}else{
$('#karat option').show();
$('#karat option').not('[value="21.0K"]').not('[value="22.0K"]').not('[value="23.0K"]').not('[value="24.0K"]').not('[value="24.0Kgb"]').not(':first').hide();
$('#sltkarat option').show();
$('#sltkarat option').not('[value="21.0K"]').not('[value="22.0K"]').not('[value="23.0K"]').not('[value="24.0K"]').not('[value="24.0Kgb"]').not(':first').hide();
}
$('#text-berat').html('Berat Keseluruhan');
$('#kuantiti').attr('disabled', false);
$('#kuantiti_edit').attr('disabled', false);
}else{
$('#karat option').show();
$('#kuantiti_edit').val(1);
$('#sltkarat option').show();
$('#text-berat').html('Berat');
$('#kuantiti').attr('disabled', true);
$('#kuantiti_edit').attr('disabled', true);
}
});
@@ -431,6 +429,26 @@
$(".div_anggaran_edit").css("display", "none");
$('#beratpermataedit').val("");
}
$('#kuantiti').val('');
$('#karat').val('');
if(marhun == 'G/B' || marhun == 'WFR' || marhun == 'SYE' || marhun == 'DNR'){
if(marhun == 'DNR' || marhun == 'SYE'){
$('#karat option').show();
$('#karat option').not('[value="21.0K"]').not('[value="22.0K"]').not('[value="23.0K"]').not('[value="24.0K"]').not('[value="24.0Kgb"]').not(':first').hide();
}else{
$('#karat option').show();
$('#karat option').not('[value="21.0K"]').not('[value="22.0K"]').not('[value="23.0K"]').not('[value="24.0K"]').not('[value="24.0Kgb"]').not(':first').hide();
}
$('#text-berat').html('Berat Keseluruhan');
$('#kuantiti').attr('disabled', false);
}else{
$('#karat option').show();
$('#text-berat').html('Berat');
$('#kuantiti').attr('disabled', true);
}
});
$('#karat').change(function(){
@@ -520,6 +538,12 @@
closeOnSelect: false
});
$('#nota_edit').select2({
tags: true,
placeholder: "Select or add options",
width: 'resolve'
});
$(".select2_batupermata").select2({
dropdownParent: $('#editMarhunModal'),
tags: true,
@@ -729,6 +753,13 @@
success:function(data){
$.each(data,function(index,jemas){
$("#marhun_edit").append(new Option(jemas['descpt'], jemas['marhun']));
res.forEach(function(value) {
if ($('#nota_edit').find("option[value='" + value + "']").length === 0) {
let newOption = new Option(value, value, true, true);
$('#nota_edit').append(newOption).trigger('change');
}
});
$('#nota_edit').val(res).trigger('change');
$('#kuantiti_edit').val(kuantiti);