269 lines
11 KiB
PHP
269 lines
11 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-12">
|
|
<h3 class="text-center text-uppercase">gadaian</h3>
|
|
<div class="form-group row col-12">
|
|
<div class="col-6">
|
|
<div class="form-group row">
|
|
<input type="hidden" name="kodcaw" id="kodcaw" value="{{$cawangan_info['kodcaw']}}">
|
|
<input type="hidden" name="nokp" id="nokp" value="{{ $customer_info['kpbaru'] }}">
|
|
<input type="hidden" name="jantina" id="jantina" value="{{ $customer_info['jantina'] }}">
|
|
<input type="hidden" name="bangsa" id="bangsa" value="{{ $customer_info['bangsa'] }}">
|
|
<div class="col-4">
|
|
Nama
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="name" id="name" readonly value="{{ $customer_info['nama'] }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
No Pelanggan
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="nopelanggan" readonly id="nopelanggan" value="{{ $customer_info['nopelanggan'] }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
No Rujukan
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="norujukan" id="norujukan" readonly value="{{ $norujukan }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
Jumlah Pinjaman Semasa
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="pinjaman_semasa" id="pinjaman_semasa" readonly value="">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
Limit Pinjaman Semasa
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="limit_pinjaman" id="limit_pinjaman" readonly value="{{ $limit_pinjaman_semasa }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 text-right mb-2">
|
|
<a class="btn btn-primary" href="{{ route('daftar_marhun',['norujukan'=>$norujukan ]) }}">DAFTAR MARHUN</a>
|
|
</div>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<table class="table" id="myTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Bil</th>
|
|
<th>Kuantiti</th>
|
|
<th>Marhun</th>
|
|
<th>Keterangan</th>
|
|
<th>Nilai Marhun</th>
|
|
<th>Karat</th>
|
|
<th>Berat</th>
|
|
<th>Nota</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form action="">
|
|
<div class="col-12 form-group row">
|
|
<div class="col-4">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
PINJAMAN MAX
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" readonly name="pinjaman_max_teller" id="pinjaman_max_teller">
|
|
</div>
|
|
</diV>
|
|
</div>
|
|
<div class="col-4">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
UPAH SEBULAN
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" readonly name="upah_sebulan" id="upah_sebulan">
|
|
</div>
|
|
</diV>
|
|
</div>
|
|
<div class="col-4">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
ID PELULUS
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="id_pelulus" id="id_pelulus">
|
|
</div>
|
|
</diV>
|
|
</div>
|
|
<div class="col-4">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
PINJAMAN
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" name="pinjaman" id="pinjaman">
|
|
</div>
|
|
</diV>
|
|
</div>
|
|
<div class="col-4">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
UPAH 6 BULAN
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" readonly name="upah_6bln" id="upah_6bln">
|
|
</div>
|
|
</diV>
|
|
</div>
|
|
<div class="col-4">
|
|
<div class="form-group row">
|
|
<div class="col-4">
|
|
PINJAMAN MAX PELULUS
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" readonly name="pinjaman_max_pelulus" id="pinjaman_max_pelulus">
|
|
</div>
|
|
</diV>
|
|
</div>
|
|
<div class="col-12">
|
|
<input type="button" class="float-right btn btn-danger mr-2" value="BATAL">
|
|
<input type="button" name="terima_gadai" id="terima_gadai" class="float-right btn btn-primary mr-2" value="TERIMA">
|
|
<input type="button" class="float-right btn btn-primary mr-2" value="TAMBAH GADAI">
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var tablemarhun = $('#myTable').DataTable({
|
|
"ordering": false
|
|
});
|
|
var total_nilai_marhun = 0;
|
|
var total_berat = 0;
|
|
var kadarupah = 0;
|
|
var marhun_details = '';
|
|
function marhuntable(data){
|
|
var counter = 1;
|
|
total_nilai_marhun = 0;
|
|
total_berat = 0;
|
|
tablemarhun.clear().draw();
|
|
$.each(data,function(index,marhun){
|
|
$.each(marhun,function(index,marhun_detail){
|
|
total_nilai_marhun = total_nilai_marhun + Number(marhun_detail['n_marhun']);
|
|
total_berat = total_berat + Number(marhun_detail['berat']);
|
|
marhun_details = marhun_details + marhun_detail['bil'] + " " + marhun_detail['marhun'] +",";
|
|
tablemarhun.row.add([
|
|
counter,
|
|
marhun_detail['bil'],
|
|
marhun_detail['marhun'],
|
|
" ",
|
|
marhun_detail['n_marhun'],
|
|
marhun_detail['karat'],
|
|
marhun_detail['berat'],
|
|
marhun_detail['nota']
|
|
]).draw();
|
|
counter = counter + 1;
|
|
});
|
|
});
|
|
var max_teller = total_nilai_marhun * 0.7;
|
|
var max_pelulus = total_nilai_marhun * 0.75;
|
|
|
|
$('#pinjaman_max_teller').val(max_teller.toFixed(2));
|
|
$('#pinjaman_max_pelulus').val(max_pelulus.toFixed(2));
|
|
}
|
|
|
|
$(document).ready( function () {
|
|
var norujukan = $('#norujukan').val();
|
|
|
|
$.ajax({
|
|
method:'GET',
|
|
url:'http://localhost:8000/api/marhun/'+norujukan,
|
|
success:function(data){
|
|
marhuntable(data);
|
|
}
|
|
})
|
|
} );
|
|
|
|
$('#pinjaman').change(function(){
|
|
var pinjaman = Number(this.value);
|
|
|
|
if(pinjaman > 0 && pinjaman < 401){
|
|
kadarupah = 1.25/100;
|
|
}else if(pinjaman >= 401 && pinjaman < 2001){
|
|
kadarupah = 1.5/100;
|
|
}else if(pinjaman >= 2001 ){
|
|
kadarupah = 1.7/100;
|
|
}
|
|
|
|
var upah_sebulan = pinjaman * kadarupah;
|
|
var upah_6bln = upah_sebulan * 6;
|
|
|
|
$('#upah_sebulan').val(upah_sebulan.toFixed(2));
|
|
$('#upah_6bln').val(upah_6bln.toFixed(2));
|
|
});
|
|
|
|
$('#terima_gadai').click(function(){
|
|
var kodcaw = $('#kodcaw').val();
|
|
var nokp = $('#nokp').val();
|
|
var jantina = $('#jantina').val();
|
|
var bangsa = $('#bangsa').val();
|
|
var nopelanggan = $('#nopelanggan').val();
|
|
var norujukan = $('#norujukan').val();
|
|
var pinjaman = $('#pinjaman').val();
|
|
|
|
var percentpinj = Number(pinjaman)/Number(total_nilai_marhun);
|
|
// console.log(kodcaw,nokp,jantina,bangsa,nopelanggan,norujukan,pinjaman,percentpinj);
|
|
// $.ajax({
|
|
// method:'POST',
|
|
// url: 'http://localhost:8000/api/gadai/'+kodcaw,
|
|
// dataType:'json',
|
|
// data:{
|
|
// 'kodcaw': kodcaw,
|
|
// 'norujukan' : norujukan,
|
|
// 'nopelanggan' : nopelanggan,
|
|
// 'nokp' : nokp,
|
|
// 'nilaimarhun' : total_nilai_marhun.toFixed(2),
|
|
// 'berat' : total_berat,
|
|
// 'pinjaman' : pinjaman.toFixed(2),
|
|
// 'kadarupah' : kadarupah
|
|
// 'marhun' : marhun_details,
|
|
// 'jantina' : jantina,
|
|
// 'bangsa' : bangsa,
|
|
// 'percentpinj' : percentpinj.toFixed(2)
|
|
// },
|
|
// success:function(data){
|
|
// alert('Gadai Berjaya');
|
|
// },
|
|
// error: function(xhRequest, ErrorText, thrownError){
|
|
// alert('Gadai Tidak Berjaya');
|
|
// console.log(xhRequest);
|
|
// }
|
|
// });
|
|
})
|
|
</script>
|
|
@endsection
|