list gadai detail
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
@section('content')
|
||||
<?php
|
||||
$customer_info = Session::get('customer_info');
|
||||
$belum_tebus = Session::get('belum_tebus');
|
||||
?>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
@@ -64,13 +65,13 @@
|
||||
<div class="col-12 mt-3 form-group row">
|
||||
<div class="btn-group btn-group-toggle col-6" data-toggle="buttons">
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="options" id="option1" autocomplete="off"> BELUM TEBUS
|
||||
<input type="radio" name="options" id="option1" value="belum_tebus" autocomplete="off" checked> BELUM TEBUS
|
||||
</label>
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="options" id="option2" autocomplete="off"> SUDAH TEBUS
|
||||
<input type="radio" name="options" id="option2" value="sudah_tebus" autocomplete="off"> SUDAH TEBUS
|
||||
</label>
|
||||
<label class="btn btn-primary">
|
||||
<input type="radio" name="options" id="option3" autocomplete="off"> LELONG
|
||||
<input type="radio" name="options" id="option3" value="lelong" autocomplete="off"> LELONG
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
@@ -86,11 +87,11 @@
|
||||
<th>Bil</th>
|
||||
<th>No Rujukan</th>
|
||||
<th>Tarikh Gadai</th>
|
||||
<th>Pinjaman</th>
|
||||
<th>Pembiayaan</th>
|
||||
<th>Nilai Marhun</th>
|
||||
<th>JBG</th>
|
||||
<th>Upah</th>
|
||||
<th>Tebus/Upah</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Keuntungan</th>
|
||||
<!-- <th>Tebus/Upah</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
@@ -100,8 +101,70 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var tablegadai = $('#myTable').DataTable();
|
||||
function gadaiTable(data){
|
||||
var counter = 1;
|
||||
tablegadai.clear();
|
||||
$.each(data,function(index,gadai){
|
||||
$.each(gadai, function(index,gadai_detail){
|
||||
tablegadai.row.add([
|
||||
counter,
|
||||
gadai_detail['norujukan'],
|
||||
gadai_detail['t_gadai'],
|
||||
'RM '+ gadai_detail['pinjaman'].toLocaleString("en-GB"),
|
||||
'RM '+ gadai_detail['nilaimarhun'].toLocaleString("en-GB"),
|
||||
'0',
|
||||
'RM '+ ((gadai_detail['kadarupah']/100)*gadai_detail['pinjaman']*gadai_detail['tempoh'])
|
||||
]).draw();
|
||||
|
||||
counter = counter + 1;
|
||||
});
|
||||
});
|
||||
}
|
||||
$(document).ready( function () {
|
||||
$('#myTable').DataTable();
|
||||
var noic = $("#noic").val();
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url:"http://localhost:8000/api/customers/"+noic+"/gadai/belum_tebus",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
}
|
||||
});
|
||||
$("input[name='options']").click(function(){
|
||||
gadaiOptionButton(noic)
|
||||
});
|
||||
} );
|
||||
|
||||
function gadaiOptionButton(noic){
|
||||
tablegadai.clear();
|
||||
if($("input[name='options']:checked").val() == 'belum_tebus'){
|
||||
// console.log(noic);
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url:"http://localhost:8000/api/customers/"+noic+"/gadai/belum_tebus",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
if($("input[name='options']:checked").val() == 'sudah_tebus'){
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url:"http://localhost:8000/api/customers/"+noic+"/gadai/sudah_tebus",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
if($("input[name='options']:checked").val() == 'lelong'){
|
||||
$.ajax({
|
||||
method:"GET",
|
||||
url:"http://localhost:8000/api/customers/"+noic+"/gadai/lelong",
|
||||
success: function(data){
|
||||
gadaiTable(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user