Merged in afiqhamzah/feat/add-modal-prevent-gadaian-PS-edit (pull request #81)
Add modal prevent gadaian PS Edit
This commit is contained in:
@@ -860,11 +860,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let table_norujukan = gadai_detail["norujukan"];
|
let table_norujukan = gadai_detail["norujukan"];
|
||||||
let radio_action = "onclick=checkCanChangeGadaianDetail(" + "'" + table_norujukan + "'" + ")";
|
|
||||||
|
|
||||||
if(gadai_detail["percentpinj"] != 0)
|
if(gadai_detail["percentpinj"] != 0)
|
||||||
xtawarruq.row.add([
|
xtawarruq.row.add([
|
||||||
'<input type="radio" value='+ gadai_detail["norujukan"] + ' ' + radio_action +' name="belum"/>',
|
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="belum"/>',
|
||||||
'<a href="#" onclick="checkserah(this)" data-pinjaman='+ gadai_detail['pinjaman'] +' data-hargajualan='+ gadai_detail['hargajualan'] +' data-norujukan='+ gadai_detail['norujukan'] +' data-url=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
'<a href="#" onclick="checkserah(this)" data-pinjaman='+ gadai_detail['pinjaman'] +' data-hargajualan='+ gadai_detail['hargajualan'] +' data-norujukan='+ gadai_detail['norujukan'] +' data-url=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
||||||
gadai_detail['t_gadai'],
|
gadai_detail['t_gadai'],
|
||||||
tarikh_matang,
|
tarikh_matang,
|
||||||
@@ -905,9 +903,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let table_norujukan = gadai_detail["norujukan"];
|
let table_norujukan = gadai_detail["norujukan"];
|
||||||
let radio_action = "onclick=checkCanChangeGadaianDetail(" + "'" + table_norujukan + "'" + ")";
|
|
||||||
tablegadai.row.add([
|
tablegadai.row.add([
|
||||||
'<input type="radio" value='+ gadai_detail["norujukan"] + ' ' + radio_action +' name="belum"/>',
|
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="belum"/>',
|
||||||
'<a href="#" onclick="checkserah(this)" data-pinjaman='+ gadai_detail['pinjaman'] +' data-hargajualan='+ gadai_detail['hargajualan'] +' data-norujukan='+ gadai_detail['norujukan'] +' data-url=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
'<a href="#" onclick="checkserah(this)" data-pinjaman='+ gadai_detail['pinjaman'] +' data-hargajualan='+ gadai_detail['hargajualan'] +' data-norujukan='+ gadai_detail['norujukan'] +' data-url=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
||||||
gadai_detail['t_gadai'],
|
gadai_detail['t_gadai'],
|
||||||
tarikh_matang,
|
tarikh_matang,
|
||||||
@@ -1606,9 +1603,49 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ubahPembiayaanSemulaErrorHandling()
|
||||||
|
{
|
||||||
|
let selected = document.querySelector('#navtawarruqdannottawarruq input[type="radio"][name="belum"]:checked')
|
||||||
|
|
||||||
|
let navTawarruq = document.querySelector('#nav-tawarruq');
|
||||||
|
|
||||||
|
// check if selected radio button in SAG Baru tab. If not SAG Baru tab. Execution will bypass the validation here and continue to next validation flow
|
||||||
|
if( ! navTawarruq.contains(selected)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selected === null){
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'error',
|
||||||
|
title: 'Amaran',
|
||||||
|
text: 'Sila pilih salah satu SAG!'
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isPS = checkPS(selected.value)
|
||||||
|
|
||||||
|
if(isPS){
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'error',
|
||||||
|
title: 'Amaran',
|
||||||
|
text: 'Ubah Gadai Tidak Dibenarkan Untuk Gadaian Pembiayaan Semula'
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function ubahfunc(e){
|
function ubahfunc(e){
|
||||||
|
|
||||||
|
let isError = ubahPembiayaanSemulaErrorHandling()
|
||||||
|
if(isError){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let ubahid = $('input[name="belum"]:checked').val();
|
let ubahid = $('input[name="belum"]:checked').val();
|
||||||
let harini = new Date();harini.setHours(0, 0, 0, 0);
|
let harini = new Date();harini.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
@@ -2606,5 +2643,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
Reference in New Issue
Block a user