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({
+53 -14
View File
@@ -8,23 +8,62 @@
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table id="tablehistorytebus" class="table table-striped table-bordered text-center">
<thead>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div>Harga Jualan : <span id="hargajualanmodal"></span></div>
</div>
<div class="col-12">
<div>Pembiayaan : <span id="pembiayaanmodal"></span></div>
</div>
<div class="col-12">
<div>Nilai Marhun : <span id="nilaimarhunmodal"></span></div>
</div>
</div>
<ul class="nav nav-tabs" id="custom-tabs-one-tab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="custom-tabs-one-home-tab" data-toggle="pill" href="#custom-tabs-one-home" role="tab" aria-controls="custom-tabs-one-home" aria-selected="true">Rekod Bayaran</a>
</li>
<li class="nav-item">
<a class="nav-link" id="custom-tabs-one-profile-tab" data-toggle="pill" href="#custom-tabs-one-profile" role="tab" aria-controls="custom-tabs-one-profile" aria-selected="false">Rekod SAG</a>
</li>
</ul>
<div class="tab-content" id="custom-content-below-tabContent">
<div class="tab-pane fade show active" id="custom-tabs-one-home" role="tabpanel" aria-labelledby="custom-content-below-home-tab">
<hr>
<h4>Rekod Bayaran</h4>
<table id="tablehistorybayaran" class="table table-striped table-bordered text-center">
<thead>
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Jenis Tebus</th>
<th>JBG</th>
<th>Tarikh Tebus</th>
<th>Bil</th>
<th>Tarikh Bayaran</th>
<th>Bayaran</th>
<th>Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="custom-tabs-one-profile" role="tabpanel" aria-labelledby="custom-content-below-profile-tab">
<hr>
<h4>Rekod SAG</h4>
<table id="tablehistorytebus" class="table table-striped table-bordered text-center">
<thead>
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Jenis Tebus</th>
<th>JBG</th>
<th>Tarikh Tebus</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-lg" data-dismiss="modal">Batal</button>
</div>
-37
View File
@@ -264,7 +264,6 @@
<div class="col-12">
<input type="button" class="float-right btn btn-danger mr-2" value="BATAL" onclick="window.location.replace('{{ url()->previous() }}')">
<input type="button" class="float-right btn btn-primary mr-2" value="TERIMA" onclick="bayaransemua()">
<input type="button" class="float-left btn btn-warning mr-2" value="HISTORY" id="histbtn" onclick="historybayaran()">
</div>
</div>
</form>
@@ -1475,42 +1474,6 @@ function ubahwakil(e)
}
function historybayaran()
{
$.ajax({
method: 'get',
url: api + '/api/transaction/' + norujukan,
success: function(data)
{
historybayarantable(data);
$('#historybayaranModal').modal();
}
});
}
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;
});
}
// Restricts input for the set of matched elements to the given inputFilter function.
(function($) {
$.fn.inputFilter = function(inputFilter) {