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);
+34 -2
View File
@@ -402,7 +402,7 @@
$('#marhun_edit').change(function(){
var marhun = this.value;
if (!arrayBatuPermata.includes(marhun)) {
$(".col_edit_permata").css("display", "block");
} else {
@@ -411,6 +411,24 @@
$(".div_anggaran_edit").css("display", "none");
$('#beratpermataedit').val("");
}
if(marhun == 'G/B' || marhun == 'WFR' || marhun == 'SYE' || marhun == 'DNR'){
if(marhun == 'DNR' || marhun == 'SYE'){
$('#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{
$('#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_edit').attr('disabled', false);
}else{
$('#kuantiti_edit').val(1);
$('#sltkarat option').show();
$('#text-berat').html('Berat');
$('#kuantiti_edit').attr('disabled', true);
}
});
$('#karat').change(function(){
@@ -493,6 +511,12 @@
allowClear: true,
closeOnSelect: false
});
$('#nota_edit').select2({
tags: true,
placeholder: "Select or add options",
width: 'resolve'
});
$(".select2_batupermata").select2({
dropdownParent: $('#editMarhunModal'),
@@ -1643,7 +1667,15 @@
success:function(data){
$.each(data,function(index,jemas){
$("#marhun_edit").append(new Option(jemas['descpt'], jemas['marhun']));
$('#nota_edit').val(res).trigger('change');
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);
+1 -1
View File
@@ -29,7 +29,7 @@
<div class="col-md-12">
<div class="form-group">
<label>Nota</label>
<select name="nota_edit" id="nota_edit" class="select2_nota form-control" multiple="multiple" data-placeholder="Nota Tambahan" style="width: 100%;">
<select name="nota_edit" id="nota_edit" class="form-control" multiple="multiple" data-placeholder="Nota Tambahan" style="width: 100%;">
<option value="Rosak">Rosak</option>
<option value="Putus">Putus</option>
<option value="Patah">Patah</option>