new update

This commit is contained in:
afiq
2021-02-10 17:15:14 +08:00
parent 9fda49d031
commit ccd5962dbf
3 changed files with 123 additions and 66 deletions
+70 -15
View File
@@ -18,7 +18,6 @@
</button>
</div>
<div class="modal-body">
<form id="kemaskiniform">
<div class='row form-group'>
<div class='col-md-6'>
@@ -302,8 +301,8 @@
<th>No Rujukan</th>
<th>Tarikh Gadai</th>
<th>Tarikh Matang</th>
<th>Nilai Marhun</th>
<th>Pembiayaan</th>
<th>Baki Harga Jualan</th>
<th>Baki Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
<th>Keuntungan</th>
@@ -320,8 +319,8 @@
<th>No Rujukan</th>
<th>Tarikh Gadai</th>
<th>Tarikh Matang</th>
<th>Nilai Marhun</th>
<th>Pembiayaan</th>
<th>Baki Harga Jualan</th>
<th>Baki Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
<th>Keuntungan</th>
@@ -336,8 +335,8 @@
<th>No Rujukan</th>
<th>Tarikh Gadai</th>
<th>Tarikh Matang</th>
<th>Nilai Marhun</th>
<th>Pembiayaan</th>
<th>Baki Harga Jualan</th>
<th>Baki Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
<th>Keuntungan</th>
@@ -348,7 +347,7 @@
<div class="text-center">
<button class="btn btn-primary" onclick="ubahfunc(this)">Ubah</button>
<button class="btn btn-primary" onclick="hapusfunc()">Hapus</button>
<button class="btn btn-primary" onclick="histfunc()">History</button>
<button class="btn btn-primary" onclick="histfunc()">Rekod Gadaian</button>
</div>
</div>
@@ -404,6 +403,10 @@
"scrollX": true
});
var historybayarandatatable = $('#tablehistorybayaran').DataTable({
"ordering": false
});
const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2
});
@@ -425,8 +428,8 @@
'<a href=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
gadai_detail['t_gadai'],
gadai_detail['t_matang1'],
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
'RM '+formatter.format(gadai_detail['pinjaman']),
'RM '+ formatter.format(gadai_detail['bakihargajualan']),
'RM '+formatter.format(gadai_detail['bakipjm']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
gadai_detail['jbg'],
'RM '+ formatter.format((Number(gadai_detail['kadarupah'])/100)*Number(gadai_detail['bakipjm'])*Number(gadai_detail['jbg']))
@@ -438,8 +441,8 @@
gadai_detail['norujukan'],
gadai_detail['t_gadai'],
gadai_detail['t_matang1'],
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
'RM '+formatter.format(gadai_detail['pinjaman']),
'RM '+ formatter.format(gadai_detail['bakihargajualan']),
'RM '+formatter.format(gadai_detail['bakipjm']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
gadai_detail['jbg'],
'RM '+ formatter.format((Number(gadai_detail['kadarupah'])/100)*Number(gadai_detail['bakipjm'])*Number(gadai_detail['jbg']))
@@ -451,8 +454,8 @@
gadai_detail['norujukan'],
gadai_detail['t_gadai'],
gadai_detail['t_matang1'],
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
'RM '+formatter.format(gadai_detail['pinjaman']),
'RM '+ formatter.format(gadai_detail['bakihargajualan']),
'RM '+formatter.format(gadai_detail['bakipjm']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
gadai_detail['jbg'],
'RM '+ formatter.format((Number(gadai_detail['kadarupah'])/100)*Number(gadai_detail['bakipjm'])*Number(gadai_detail['jbg']))
@@ -495,7 +498,6 @@
function histfunc(){
if($("input[name='options']:checked").val() == 'belum_tebus'){
let histid = $('input[name="belum"]:checked').val();
if(histid == null){
Swal.fire({
icon: 'error',
@@ -516,6 +518,20 @@
alert(xhr.responseText);
}
});
$.ajax({
method: 'get',
url: api_url + '/api/transaction/' + histid,
success: function(data){
historybayarantable(data);
}
});
$.ajax({
method:'get',
url:api_url + '/api/gadai/norujukan/'+histid,
success:function(gadai){
rekodasal(gadai);
}
});
}
}else if($("input[name='options']:checked").val() == 'sudah_tebus'){
let histid = $('input[name="sudahtebus"]:checked').val();
@@ -539,9 +555,48 @@
alert(xhr.responseText);
}
});
$.ajax({
method: 'get',
url: api + '/api/transaction/' + histid,
success: function(data){
historybayarantable(data);
}
});
$.ajax({
method:'get',
url:api_url + '/api/gadai/norujukan/'+histid,
success:function(gadai){
rekodasal(gadai);
}
});
}
}
}
function rekodasal(gadaian){
$('#hargajualanmodal').text('RM ' + formatter.format(gadaian[0][0]['hargajualan']));
$('#pembiayaanmodal').text('RM ' + formatter.format(gadaian[0][0]['pinjaman']));
$('#nilaimarhunmodal').text('RM ' + formatter.format(gadaian[0][0]['nilaimarhun']));
}
function historybayarantable(data){
var counter = 1;
historybayarandatatable.clear().draw();
$.each(data,function(index,bayaran){
var urlroute = '{{ route("resit.ansuran", ":id") }}';
urlroute = urlroute.replace(':id', bayaran['id']);
console.log(bayaran['']);
historybayarandatatable.row.add([
counter,
bayaran['created_at'],
"RM " + bayaran['duit_masuk'],
'<a class="btn btn-info" target="_blank" href='+ urlroute +'>Cetak</a>'
]).draw();
counter = counter + 1;
});
}
var historytebusbayaran = $('#tablehistorytebus').DataTable({