buat penebusan lar aiyo ini pun nak tanya ka
This commit is contained in:
@@ -220,6 +220,47 @@
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
{{-- Sudah Tebus --}}
|
||||
|
||||
<table id="dahtebusTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Gadai</th>
|
||||
<th>Pembiayaan</th>
|
||||
<th>Nilai Marhun</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Keuntungan</th>
|
||||
<th>Tarikh Matang</th>
|
||||
<th>Margin</th>
|
||||
<th>Kos Keuntungan</th>
|
||||
<th>Hapus Gadai</th>
|
||||
<!-- <th>Tebus/Upah</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<table id="lelongTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Gadai</th>
|
||||
<th>Pembiayaan</th>
|
||||
<th>Nilai Marhun</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Keuntungan</th>
|
||||
<th>Tarikh Matang</th>
|
||||
<th>Margin</th>
|
||||
<th>Kos Keuntungan</th>
|
||||
<th>Hapus Gadai</th>
|
||||
<!-- <th>Tebus/Upah</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -232,40 +273,105 @@
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
var tabledahtebus = $('#dahtebusTable').DataTable({
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
var tablelelong = $('#lelongTable').DataTable({
|
||||
"scrollX": true
|
||||
});
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
minimumFractionDigits: 2
|
||||
})
|
||||
function gadaiTable(data){
|
||||
function gadaiTable(data,jenistebus){
|
||||
var counter = 1;
|
||||
|
||||
tablegadai.clear().draw();
|
||||
tabledahtebus.clear().draw();
|
||||
tablelelong.clear().draw();
|
||||
|
||||
$.each(data,function(index,gadai){
|
||||
$.each(gadai, function(index,gadai_detail){
|
||||
var keuntungan_semasa = (gadai_detail['kadarupah']/100)*gadai_detail['bakipjm']*gadai_detail['jbg'];
|
||||
tablegadai.row.add([
|
||||
counter,
|
||||
gadai_detail['norujukan'],
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+formatter.format(gadai_detail['pinjaman']),
|
||||
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
|
||||
gadai_detail['jbg'],
|
||||
'RM '+ formatter.format(keuntungan_semasa),
|
||||
gadai_detail['t_matang'],
|
||||
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
|
||||
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
|
||||
''
|
||||
]).draw();
|
||||
|
||||
if(jenistebus == "belum_tebus")
|
||||
{
|
||||
var keuntungan_semasa = (gadai_detail['kadarupah']/100)*gadai_detail['bakipjm']*gadai_detail['jbg'];
|
||||
|
||||
var urlroute = '{{ route("penebusan", ":id") }}';
|
||||
urlroute = urlroute.replace(':id', gadai_detail["norujukan"]);
|
||||
|
||||
tablegadai.row.add([
|
||||
counter,
|
||||
'<a href=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+formatter.format(gadai_detail['pinjaman']),
|
||||
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
|
||||
gadai_detail['jbg'],
|
||||
'RM '+ formatter.format(keuntungan_semasa),
|
||||
gadai_detail['t_matang'],
|
||||
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
|
||||
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
|
||||
''
|
||||
]).draw();
|
||||
}
|
||||
else if(jenistebus == "sudah_tebus")
|
||||
{
|
||||
var keuntungan_semasa = (gadai_detail['kadarupah']/100)*gadai_detail['bakipjm']*gadai_detail['jbg'];
|
||||
tabledahtebus.row.add([
|
||||
counter,
|
||||
gadai_detail['norujukan'],
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+formatter.format(gadai_detail['pinjaman']),
|
||||
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
|
||||
gadai_detail['jbg'],
|
||||
'RM '+ formatter.format(keuntungan_semasa),
|
||||
gadai_detail['t_matang'],
|
||||
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
|
||||
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
|
||||
''
|
||||
]).draw();
|
||||
}
|
||||
else if(jenistebus == "lelong")
|
||||
{
|
||||
var keuntungan_semasa = (gadai_detail['kadarupah']/100)*gadai_detail['bakipjm']*gadai_detail['jbg'];
|
||||
tablelelong.row.add([
|
||||
counter,
|
||||
gadai_detail['norujukan'],
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+formatter.format(gadai_detail['pinjaman']),
|
||||
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
|
||||
gadai_detail['jbg'],
|
||||
'RM '+ formatter.format(keuntungan_semasa),
|
||||
gadai_detail['t_matang'],
|
||||
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
|
||||
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
|
||||
''
|
||||
]).draw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
counter = counter + 1;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
$(document).ready( function () {
|
||||
$('#myTable').parents('div.dataTables_wrapper').first().hide();
|
||||
$('#dahtebusTable').parents('div.dataTables_wrapper').first().hide();
|
||||
$('#lelongTable').parents('div.dataTables_wrapper').first().hide();
|
||||
|
||||
var noic = $("#noic").val();
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url: api_url + "/api/customers/"+noic+"/gadai/belum_tebus",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
$('#myTable').parents('div.dataTables_wrapper').first().show();
|
||||
gadaiTable(data,"belum_tebus");
|
||||
}
|
||||
});
|
||||
$("input[name='options']").click(function(){
|
||||
@@ -276,30 +382,44 @@
|
||||
function gadaiOptionButton(noic){
|
||||
tablegadai.clear().draw();
|
||||
if($("input[name='options']:checked").val() == 'belum_tebus'){
|
||||
|
||||
$('#myTable').parents('div.dataTables_wrapper').first().show();
|
||||
$('#dahtebusTable').parents('div.dataTables_wrapper').first().hide();
|
||||
$('#lelongTable').parents('div.dataTables_wrapper').first().hide();
|
||||
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url: api_url + "/api/customers/"+noic+"/gadai/belum_tebus",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
gadaiTable(data,"belum_tebus");
|
||||
}
|
||||
});
|
||||
}
|
||||
if($("input[name='options']:checked").val() == 'sudah_tebus'){
|
||||
|
||||
$('#myTable').parents('div.dataTables_wrapper').first().hide();
|
||||
$('#dahtebusTable').parents('div.dataTables_wrapper').first().show();
|
||||
$('#lelongTable').parents('div.dataTables_wrapper').first().hide();
|
||||
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url: api_url + "/api/customers/"+noic+"/gadai/sudah_tebus",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
gadaiTable(data,"sudah_tebus");
|
||||
}
|
||||
});
|
||||
}
|
||||
if($("input[name='options']:checked").val() == 'lelong'){
|
||||
|
||||
$('#myTable').parents('div.dataTables_wrapper').first().hide();
|
||||
$('#dahtebusTable').parents('div.dataTables_wrapper').first().hide();
|
||||
$('#lelongTable').parents('div.dataTables_wrapper').first().show();
|
||||
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url: api_url + "/api/customers/"+noic+"/gadai/lelong",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
gadaiTable(data,"lelong");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user