ubah dan hapus

This commit is contained in:
hafifierahman
2021-01-10 08:04:46 +08:00
parent e20de6278f
commit c00906aecb
7 changed files with 948 additions and 48 deletions
@@ -59,6 +59,33 @@ class GadaianController extends Controller
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('gadaian.index',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan','api_url'));
}
public function edit(Request $request,$norujukan){
$api_url = config('api.url');
$current = Carbon::now();
$current = new Carbon();
$curent_year = substr($current->year,2,2);
$curent_month = sprintf("%02d", $current->month);
$current_day = sprintf("%02d", $current->day);
// dd($current_day);
$gadaiannorujukan = Http::get(config('api.url') . '/api/gadai/norujukan/'. $norujukan)->json();
if(sizeof($gadaiannorujukan) != 0)
$gadaiannorujukan = $gadaiannorujukan[0][0];
$noic = $request->noic;
$customers_info = Http::get(config('api.url') . '/api/customers/'. $gadaiannorujukan['nokp'])->json();
$customer_info = $customers_info[0];
$limit_pinjaman_semasa = 0;
$auth_user = Auth::user();
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $auth_user['cawangan'])->json();
return view('gadaian.edit',compact('customer_info','limit_pinjaman_semasa','cawangan_info','norujukan','api_url'));
}
public function store(Request $request){
$auth_user = Auth::user();
@@ -91,6 +118,37 @@ class GadaianController extends Controller
return redirect()->route('customer_info');
}
public function editstore(Request $request){
$auth_user = Auth::user();
// dd($request);
$total_nilai_marhun = $request->total_nilai_marhun;
$total_nilai_marhun = str_replace(',','',$total_nilai_marhun);
$margin_pinjaman = $request->pinjaman / $total_nilai_marhun;
// dd($margin_pinjaman);
$kadarupah = $request->kadarkeuntungan * 100;
$keuntungan6bulan = $request->keuntungan_6bln;
$keuntungan12bulan = $request->keuntungan_sebulan*12;
$hargajualan = $request->pinjaman + $keuntungan12bulan;
$gadai = Http::put(config('api.url').'/api/gadai/norujukan/'. $auth_user['cawangan'] .'/' . $request->norujukan_gadai,[
'kodcaw' => $auth_user['cawangan'],
'nilaimarhun' => round($total_nilai_marhun, 2),
'berat' => round($request->total_berat, 2),
'pinjaman' => round($request->pinjaman, 2),
'kadarupah' => round($kadarupah, 2),
'marhun' => $request->marhun_detail,
'percentpinj' => $margin_pinjaman,
'teller'=> $auth_user['name'],
'upah6' => $keuntungan6bulan,
'upah12' => $keuntungan12bulan,
'hargajualan' => $hargajualan,
'kuantiti_marhun' => $request->kuantiti_marhun
])->json();
$request->session()->forget('page_reload');
$request->session()->forget('norujukan');
return redirect()->route('customer_info');
}
public function batal(Request $request){
$norujukan = $request->norujukan;
$auth_user = Auth::user();
@@ -181,6 +239,37 @@ class GadaianController extends Controller
return view('print.resitansuran',compact('transaction','gadai','customers_info'));
}
public function resittebus($id)
{
$gadai = Http::get(config('api.url') . '/api/gadai/norujukan/'. $id)->json();
if(sizeof($gadai) != 0)
$gadai = $gadai[0][0];
$customers_info = Http::get(config('api.url') . '/api/customers/'. $gadai['nokp'])->json();
if(sizeof($customers_info) != 0)
$customers_info = $customers_info[0];
$penebusan = Http::get(config('api.url') . '/api/listpenebusanhistory/ALS',[ "norujukan" => $id])->json();
if(sizeof($penebusan) != 0)
$penebusan = $penebusan[0];
$wakil = Http::get(config('api.url') . '/api/getwakil/ALS/code/' . $penebusan['nowakil'])->json();
// dd($wakil);
if(sizeof($wakil) != 0)
$wakil = $wakil[0];
return view('print.resittebus',compact('transaction','gadai','customers_info','penebusan','wakil'));
}
public function history(Request $request)
{
$auth_user = Auth::user();
+4 -12
View File
@@ -510,18 +510,10 @@
}
else
{
$.ajax({
method:'get',
url:'{{ route("gadai.history") }}',
data:{ "norujukan" : ubahid},
success:function(data)
{
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
var urlroute = '{{ route("gadaian.edit", ":id") }}';
urlroute = urlroute.replace(':id', ubahid);
window.location.replace(urlroute);
}
}
+803
View File
@@ -0,0 +1,803 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 col-lg-12">
<h3 class="text-center text-uppercase">gadaian</h3>
<div class="form-group row col-12">
<input type="hidden" name="kodcaw" id="kodcaw" value="{{$cawangan_info['kodcaw']}}">
<input type="hidden" name="nokp" id="nokp" value="{{ $customer_info['kpbaru'] }}">
<div class="col-md-4">
<div class="form-group row">
<div class="col-md-4">
No Rujukan
</div>
<div class="col-md-8">
<input type="text" class="form-control" name="norujukan" id="norujukan" readonly value="{{ $norujukan }}">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group row">
<div class="col-md-4">
Jumlah Pembiayaan Semasa
</div>
<div class="col-md-8">
@php
$outstanding_semasa = Http::get($api_url . '/api/gadai/customers/'. $customer_info['kpbaru'] .'/outstandingsemasa')->json();
@endphp
<input type="text" class="form-control" name="pinjaman_semasa" id="pinjaman_semasa" readonly value="{{ number_format($outstanding_semasa,2) }}">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group row">
<div class="col-md-4">
Limit Pembiayaan Semasa
</div>
<div class="col-md-8">
<input type="text" class="form-control" name="limit_pinjaman" id="limit_pinjaman" readonly value="{{ $limit_pinjaman_semasa }}">
</div>
</div>
</div>
</div>
<div class="col-12 text-right mb-2">
<button type="button" style="margin:auto" class="btn btn-primary" data-toggle="modal" data-target="#daftar_marhun">Daftar Marhun</button>
</div>
<div class="card">
<div class="card-body">
<table class="table" id="myTable">
<thead>
<tr>
<th>Bil</th>
<th>Marhun</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 name="gadaistore" action="{{ route('gadai.editstore') }}" method='post' onsubmit="verifyGadai(this)">
{{-- <!-- <form action="{{ route('gadai.store') }}" method='post'> --> --}}
@csrf
<div class="col-12 form-group row">
<div class="col-md-4">
<div class="form-group row">
<div class="col-5">
Pembiayaan Max
</div>
<div class="col-7 input-group">
<input type="text" style="height:50px !important" class="form-control" readonly name="pembiayaan_max_teller" id="pembiayaan_max_teller">
<div class="input-group-append">
<span class="input-group-text span-pinjaman-max"></span>
</div>
</div>
</diV>
</div>
<div class="col-3">
<div class="form-group row">
<div class="col-md-6">
Keuntungan Sebulan
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly name="keuntungan_sebulan" id="keuntungan_sebulan">
</div>
</diV>
</div>
<div class="col-5">
<div class="form-group row">
</diV>
</div>
<div class="col-md-4">
<div class="form-group row">
<div class="col-5">
Pembiayaan
</div>
<div class="col-7 input-group">
<input type="text" class="form-control" name="pinjaman" id="pinjaman">
<div class="input-group-append">
<span class="input-group-text span-pinjaman">0 %</span>
</div>
</div>
</diV>
</div>
<div class="col-3">
<div class="form-group row">
<div class="col-md-6">
Keuntungan 6 Bulan
</div>
<div class="col-md-6">
<input type="text" class="form-control" readonly name="keuntungan_6bln" id="keuntungan_6bln">
</div>
</diV>
</div>
<div class="col-5">
<div class="form-group row">
<div class="col-md-6">
Pembiayaan Max Pelulus
</div>
<div class="col-md-6 input-group">
<input type="text" class="form-control" readonly name="pembiyaan_max_pelulus" id="pembiyaan_max_pelulus">
<div class="input-group-append">
<span class="input-group-text span-pinjaman-max-pelulus"></span>
</div>
</div>
</diV>
</div>
<div class="col-12">
<input type="text" name="norujukan_gadai" id="norujukan_gadai" value="{{ $norujukan }}" hidden>
<input type="text" name="marhun_detail" id="marhun_detail" value="" hidden>
<input type="text" name="total_berat" id="total_berat" value="" hidden>
<input type="text" name="kadarkeuntungan" id="kadarkeuntungan" value="" hidden>
<input type="text" name="kuantiti_marhun" id="kuantiti_marhun" value="" hidden>
<input type="text" name="total_nilai_marhun" id="total_nilai_marhun" value="" hidden>
<a href="{{ url()->previous() }}" class="float-right btn btn-danger mr-2">Batal</a>
<input type="submit" name="terima_gadai" id="terima_gadai" class="float-right btn btn-primary mr-2" value="Terima">
</div>
</div>
</form>
</div>
</div>
<!-- modal daftar marhun-->
<div class="modal fade" id="daftar_marhun" tabindex="-1" data-backdrop="static" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="ModalLabel">Daftar Marhun</h5>
</div>
<div class="modal-body">
<form action="" id="maklumat_marhun" method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group row">
<input type="hidden" name="kodcaw" id="kodcaw" value="">
<div class="col-md-4">No Rujukan</div>
<div class="col-md-8"><input class="form-control" type="text" name="norujukan_marhun" id="norujukan_marhun" value="{{ $norujukan }}"></div>
<div class="col-md-4">Marhun</div>
<div class="col-md-8">
<select class="form-control" name="marhun" id="marhun">
<option disabled selected value> -- Pilih Jenis Marhun -- </option>
</select>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Nota</label>
<select name="nota" id="nota" class="select2 form-control" multiple="multiple" data-placeholder="Nota Tambahan" style="width: 100%;">
<option>Rosak</option>
<option>Putus</option>
<option>Patah</option>
<option>Permata</option>
<option>Sebelah</option>
</select>
</div>
</div>
<div class="col-md-4">Karat</div>
<div class="col-md-8">
<select class="form-control" name="karat" id="karat">
<option disabled selected value> -- Pilih Karat -- </option>
</select>
</div>
<div class="col-md-4">Berat</div>
<div class="col-md-8"><input class="form-control" type="text" name="berat_emas" id="berat_emas"></div>
<div class="col-md-4">Harga</div>
<div class="col-md-8"><input class="form-control" type="text" name="harga" id="harga" readonly></div>
<div class="col-md-4">Nilai Marhun</div>
<div class="col-md-8"><input class="form-control" type="text" name="nilai_marhun" id="nilai_marhun" readonly></div>
<div class="col-md-4">Bilangan Marhun</div>
<div class="col-md-8"><input class="form-control" type="text" name="bilangan_marhun" id="bilangan_marhun" readonly></div>
<div class="col-md-4">Jumlah Nilai Marhun</div>
<div class="col-md-8"><input class="form-control" type="text" name="jumlah_nilai_marhun" id="jumlah_nilai_marhun" readonly></div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-12">
<img style="width:200px" src="{{ asset('img/logo_arrahn_baru.png') }}" alt="">
</div>
</div>
<div class="row">
<div class="form-group row" style="margin-right:auto;margin-left:auto">
<button class="btn btn-primary mr-2">KAMERA</button>
<button class="btn btn-primary">MUAT NAIK</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<div class="form-group row">
<input class="btn btn-primary mr-2" type="button" name="tambah_marhun" id="tambah_marhun" value="Tambah">
<input class="btn btn-primary mr-2" type="button" name="terima_marhun" id="terima_marhun" value="Terima">
<button type="button" class="btn btn-danger" name="batal_marhun" id="batal_marhun">Batal</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var api_url = "<?php echo $api_url ?>";
function disableF5(e) { if ((e.which || e.keyCode) == 116) e.preventDefault(); };
$(document).ready( function () {
$(document).on("keydown", disableF5);
var norujukan = $('#norujukan').val();
getMarhun(norujukan);
$.ajax({
method:'GET',
url: api_url + '/api/jemas',
success:function(data){
$.each(data,function(index,jemas){
$("#marhun").append(new Option(jemas['descpt'], jemas['marhun']));
})
}
});
$.ajax({
method:'GET',
url: api_url + '/api/harga_emas',
success:function(data){
$.each(data,function(index,harga_emas){
var text = harga_emas['karat']+' - '+harga_emas['keterangan'];
$("#karat").append(new Option(text, harga_emas['karat']));
})
}
});
});
function getMarhun(norujukan){
$.ajax({
method:'GET',
url: api_url + '/api/marhun/'+norujukan,
success:function(data){
marhuntable(data);
}
});
}
$('#karat').change(function(){
var karat = this.value;
karat = karat.replace(/\./g,'-');
var berat = $('#berat_emas').val();
getHargaEmas(karat,berat)
});
$('#berat_emas').on('input',function(){
var berat = this.value;
var karat = $('#karat').val();
karat = karat.replace(/\./g,'-');
getHargaEmas(karat,berat)
})
$('#batal_marhun').click(function(){
$('#nota').val('').trigger("change");
$('#marhun').val(0);
$('#karat').val(0);
$('#berat_emas').val("");
$('#harga').val("");
$('#nilai_marhun').val("");
$('#daftar_marhun').modal('hide');
})
function getHargaEmas(karat,berat){
$.ajax({
method:'GET',
url: api_url + '/api/harga_emas/'+karat,
success:function(data){
var nilai_marhun = data['harga2'] * berat;
$('#harga').val(data['harga2']);
$('#nilai_marhun').val(formatter.format(nilai_marhun));
}
})
}
var tablemarhun = $('#myTable').DataTable({
"ordering": false
});
$(".select2").select2({
dropdownParent: $('#daftar_marhun'),
tags: true,
tokenSeparators: [',', ' '],
allowClear: true,
closeOnSelect: false
});
var total_nilai_marhun = 0;
var total_berat = 0;
var kadarupah = 0;
var jumlah_marhun = 0;
var jumlah_nilai_marhun = 0;
function marhuntable(data){
var counter = 1;
total_nilai_marhun = 0;
total_berat = 0;
var marhun_details = '';
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['marhun'],
'RM ' + formatter.format(marhun_detail['n_marhun']),
marhun_detail['karat'],
formatter.format(marhun_detail['berat']),
marhun_detail['nota']
]).draw();
counter = counter + 1;
});
});
if(total_nilai_marhun > 0 && total_nilai_marhun < 401){
kadarupah = 1.25/100;
}else if(total_nilai_marhun >= 401 && total_nilai_marhun < 2001){
kadarupah = 1.5/100;
}else if(total_nilai_marhun >= 2001 ){
kadarupah = 1.7/100;
}
$('#total_nilai_marhun').val(formatter.format(total_nilai_marhun));
$('#marhun_detail').val(marhun_details);
$('#total_berat').val(formatter.format(total_berat));
$('#kadarkeuntungan').val(formatter.format(kadarupah));
$('#kuantiti_marhun').val(formatter.format(jumlah_marhun));
$.ajax({
method:'GET',
url: api_url + '/api/maxpinjaman',
success:function(data){
var pinjaman_pelulus = 0;
var pinjaman_teller = 0;
$.each(data,function(index,pinjaman){
if(pinjaman['user_type'] == 'teller'){
pinjaman_teller = Number(pinjaman['max']);
}
if(pinjaman['user_type'] == 'khazanah'){
pinjaman_pelulus = Number(pinjaman['max']);
}
});
$('.span-pinjaman-max-pelulus').text(formatter.format(pinjaman_pelulus) + ' %');
$('.span-pinjaman-max').text(formatter.format(pinjaman_teller) + ' %');
var max_teller = total_nilai_marhun * (pinjaman_teller/100);
var max_pelulus = total_nilai_marhun * (pinjaman_pelulus/100);
$('#pembiayaan_max_teller').val(formatter.format(max_teller));
$('#pembiyaan_max_pelulus').val(formatter.format(max_pelulus));
}
});
}
$('#pinjaman').on('input',function(){
var pinjaman = Number(this.value);
var nilaimarhun = Number($('#jumlah_nilai_marhun').val());
var keuntungan_sebulan = pinjaman * kadarupah;
var keuntungan_6bln = keuntungan_sebulan * 6;
percent_pinjaman = (Number(pinjaman)/Number(total_nilai_marhun))*100;
$('.span-pinjaman').text(formatter.format(percent_pinjaman.toFixed(2)) + ' %');
$('#keuntungan_sebulan').val(formatter.format(keuntungan_sebulan.toFixed(2)));
$('#keuntungan_6bln').val(formatter.format(keuntungan_6bln.toFixed(2)));
});
const formatter = new Intl.NumberFormat('en-US', {
minimumFractionDigits: 2
});
$('#terima_marhun').click(function(){
var kodcaw = $('#kodcaw').val();
var norujukan = $('#norujukan').val();
var marhun = $('#marhun').val();
var karat = $('#karat').val();
var berat_emas = $('#berat_emas').val();
var harga = $('#harga').val();
var nilaimarhun = $('#nilai_marhun').val();
var nilai_marhun = Number(nilaimarhun.replace(/[^0-9.-]+/g,""));
var nota_array = $('#nota').val();
if(nota_array != null){
var nota = nota_array.toString();
}else{
var nota = '';
}
if(marhun == null && karat == null && berat_emas == ''){
$('#daftar_marhun').modal('hide');
}
else{
$.ajax({
method:'POST',
url: api_url + '/api/marhun/'+kodcaw,
dataType:'json',
data:{
'norujukan': norujukan,
'marhun' : marhun,
'nota':nota,
'karat' : karat,
'berat_emas' :berat_emas,
'harga' : harga,
'nilai_marhun' : nilai_marhun
},
success:function(successdata){
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Tambah Marhun Berjaya'
});
$('#nota').val('').trigger("change");
$('#marhun').val(0);
$('#karat').val(0);
$('#berat_emas').val("");
$('#harga').val("");
$('#nilai_marhun').val("");
jumlah_marhun += 1;
jumlah_nilai_marhun += Number(nilai_marhun);
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
$('#jumlah_nilai_marhun').val(formatter.format(jumlah_nilai_marhun));
getMarhun(norujukan);
$('#daftar_marhun').modal('hide');
},
error: function(xhRequest, ErrorText, thrownError){
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Tambah Marhun Tidak Berjaya'
});
console.log(xhRequest);
}
});
}
});
$('#tambah_marhun').click(function(){
var kodcaw = $('#kodcaw').val();
var norujukan = $('#norujukan').val();
var marhun = $('#marhun').val();
var karat = $('#karat').val();
var berat_emas = $('#berat_emas').val();
var harga = $('#harga').val();
var nilaimarhun = $('#nilai_marhun').val();
var nilai_marhun = Number(nilaimarhun.replace(/[^0-9.-]+/g,""));
var nota_array = $('#nota').val();
if(nota_array != null){
var nota = nota_array.toString();
}else{
var nota = '';
}
$.ajax({
method:'POST',
url: api_url + '/api/marhun/'+kodcaw,
dataType:'json',
data:{
'norujukan': norujukan,
'marhun' : marhun,
'nota':nota,
'karat' : karat,
'berat_emas' :berat_emas,
'harga' : harga,
'nilai_marhun' : nilai_marhun
},
success:function(data){
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Tambah Marhun Berjaya'
});
$('#nota').val('').trigger("change");
$('#marhun').val(0);
$('#karat').val(0);
$('#berat_emas').val("");
$('#harga').val("");
$('#nilai_marhun').val("");
jumlah_marhun += 1;
jumlah_nilai_marhun += Number(nilai_marhun);
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
$('#jumlah_nilai_marhun').val(formatter.format(jumlah_nilai_marhun));
getMarhun(norujukan);
},
error: function(xhRequest, ErrorText, thrownError){
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Tambah Marhun Tidak Berjaya'
});
console.log(xhRequest);
}
});
})
function verifyGadai(func){
var kodcaw = $('#kodcaw').val();
var nokp = $('#nokp').val();
var nopelanggan = $('#nopelanggan').val();
var norujukan = $('#norujukan').val();
var pinjaman = Number($('#pinjaman').val());
var total_nilai_marhun = $('#total_nilai_marhun').val();
var nilai_marhun_total = Number(total_nilai_marhun.replace(/[^0-9.-]+/g,""));
var pembiayaan_max_teller = $('#pembiayaan_max_teller').val();
var pembiayaan_max_teller = Number(pembiayaan_max_teller.replace(/[^0-9.-]+/g,""));
var pembiyaan_max_pelulus = $('#pembiyaan_max_pelulus').val();
var pembiyaan_max_pelulus = Number(pembiyaan_max_pelulus.replace(/[^0-9.-]+/g,""));
var min_pinjaman = nilai_marhun_total * 0.10;
var max_pinjaman = nilai_marhun_total * 0.80;
if(pinjaman < min_pinjaman){
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Sila Masukan Pembiayaan, Minimal Pembiayaan ialah RM '+ formatter.format(min_pinjaman)
});
event.preventDefault();
return false;
}
else if(pinjaman > max_pinjaman){
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Pinjaman Melebihi Margin Yang Dibenarkan'
});
event.preventDefault();
return false;
}
else{
if(pinjaman > Number(pembiyaan_max_pelulus)+10){
// Swal.fire({
// icon: 'error',
// title: 'Amaran!',
// text: 'Pembiayaan Memerlukan Kelulusan Operasi'
// });
// event.preventDefault();
// return false;
const swalWithBootstrapButtons = Swal.mixin
({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Operasi?',
text: "Tetapan margin melebihi 75% untuk Operasi!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
Swal.fire({
title: 'Tunggu Pengesahan Daripada Operasi.',
icon: 'info',
width: 600,
padding: '3em',
background: '#fffff',
showCancelButton: false,
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false
})
$.ajax({
method:'post',
url: "{{ route('operasi.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
},
success:function(data){
console.log(data);
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function()
{
$.ajax({
method:'get',
url: "{{ route('operasi.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
if(data != '')
{
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}, 3000);
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
});
event.preventDefault();
return false;
}else if(pinjaman > Number(pembiayaan_max_teller)+10){
const swalWithBootstrapButtons = Swal.mixin
({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Khazanah?',
text: "Tetapan margin melebihi 70% untuk Khazanah!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
Swal.fire({
title: 'Tunggu Pengesahan Daripada Khazanah.',
icon: 'info',
width: 600,
padding: '3em',
background: '#fffff',
showCancelButton: false,
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false
})
$.ajax({
method:'post',
url: "{{ route('khazanah.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
},
success:function(data){
console.log(data);
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
//TIME INTERVAL
let timerInterval;
timerInterval = setInterval(function()
{
$.ajax({
method:'get',
url: "{{ route('khazanah.getkelulusan') }}",
data: {
"norujukan" : norujukan
},
success:function(data){
if(data != '')
{
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Anda Berjaya Menerima Pengesahan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}, 3000);
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
});
event.preventDefault();
return false;
}
}
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Gadaian Berjaya Disimpan'
});
return true;
}
</script>
@endsection
+26 -13
View File
@@ -183,7 +183,7 @@
<div class="col-8">
<input type="text" id="bayaran" placeholder="0.00" class="form-control" disabled/>
</div>
</diV>
</div>
<div class="form-group row" id="divtambahpinjaman">
<div class="col-4">
TAMBAH PEMBIAYAAN(RM)
@@ -193,7 +193,8 @@
</div>
<div class="col-4">
@php
$maxgadai = ($gadai['nilaimarhun'] * 0.7) - $gadai['pinjaman'];
$maxgadai = ($gadai['nilaimarhun'] * 0.8) - $gadai['bakipjm'];
@endphp
<input type="text" id="tambahpinjamsebenar" placeholder="0.00" value="{{ $maxgadai }}" class="form-control" disabled/>
</div>
@@ -683,10 +684,14 @@ function bayaransemua()
var pinjaman = "{{ $gadai['pinjaman']}}";
var ansuran = 0;
var addpinjaman = 0;
var bakipinjaman = 0;
var bakipinjaman = $('#perludibayar').val();
var bakiupah = 0;
var historygadaian = 0;
var marhun = "{{ $gadai['marhun'] }}";
var nowakil = nw;
var urlroute = '{{ route("resit.tebus", ":id") }}';
urlroute = urlroute.replace(':id', norujukan);
$.ajax({
method:'PUT',
@@ -703,14 +708,18 @@ function bayaransemua()
"bakipinjaman" : bakipinjaman,
"bakiupah" : bakiupah,
"historygadaian" : historygadaian,
"marhun" : marhun
"marhun" : marhun,
"nowakil" : nowakil
},
success:function(success_data){
Swal.fire(
'Good job!',
'You clicked the button!',
'success'
).then(function() {
Swal.fire({
icon: 'success',
title: 'Good job!',
text: 'You clicked the button!',
footer: '<a href>Why do I have this issue?</a>'
}).then(function() {
window.open(urlroute, '_blank');
window.location.replace("{{ url()->previous() }}");
})
}
@@ -902,7 +911,7 @@ function bayaransemua()
var pinjaman = parseFloat("{{ $gadai['pinjaman']}}");
var marhun_detail = marhun_baru;
var kuantiti_marhun = Number("{{sizeof($marhun)}}") - array_recno.length;
var nowakil = '';
var nowakil = nw;
console.log("Pinjaman Baru Sekali Lagi: " + pinjamanbaru);
// console.log('lebihan : ' + lebihan + ' ');
@@ -910,9 +919,9 @@ function bayaransemua()
console.log("nilai_marhun_lama:" + nilai_marhun_lama + " " + "nilai_marhun:" + nilai_marhun + " " + "pinjamanbaru:" + pinjamanbaru + " " + "bakipinjaman:" + bakipinjaman + " ");
console.log("historygadaian:" + historygadaian + " " + "marhun:" + marhun + " " + "total_berat:" + total_berat + " " + "pinjaman:" + pinjaman + " ");
console.log("marhun_detail: " + marhun_detail + "kuantiti_marhun: " + kuantiti_marhun);
console.log(nowakil);
// return;
return;
var kadarupahbaru = 0;
@@ -1079,6 +1088,7 @@ function bayaransemua()
}
let nw = 0;
function wakilfunction(e)
{
@@ -1116,6 +1126,9 @@ function wakilfunction(e)
title: 'Maklumat anda Berjaya Direkodkan!'
});
console.log(data.NOWAKIL);
nw = data.NOWAKIL;
$('#wakiltxt').prop( "disabled", true );
$(e).html("Ubah");
$(e).attr("onclick","ubahwakil(this)");
@@ -1169,7 +1182,7 @@ function daftarwakil()
{
$('#WakilModal').hide();
$('#WakilModal').modal('hide');
nw = nowakil;
Swal.fire({
allowOutsideClick: false,
allowEscapeKey: false,
@@ -431,9 +431,6 @@ hr.new5 {
<tr>
<td style="width:10px">(-) Bayaran Pelanggan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['duit_masuk'],2) }} </td>
</tr>
<tr>
<td style="width:10px">(-) Rebate</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['duit_masuk'],2) }} </td>
</tr>
<tr>
<td style="width:10px"><b>Baki Harga Jualan</b></td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['bakiharga'],2) }} </td>
</tr>
+23 -19
View File
@@ -393,28 +393,26 @@ hr.new5 {
</table>
<br>
<table id="inside">
<tr>
<td colspan="3">Marhun</td> <td>: {{ $gadai['marhun'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> No SAG</td><td> {{ $transaction['norujukan'] }} </td>
<td colspan="3">Marhun</td> <td>: {{ $gadai['marhun'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> No SAG</td><td> {{ $gadai['norujukan'] }} </td>
</tr>
<tr>
<td colspan="3">Nama</td> <td>: {{ $customers_info['nama'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> Tarikh Bayar</td><td>@php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp</td>
<td colspan="3">Nama</td> <td>: {{ $customers_info['nama'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> Tarikh Bayar</td><td>@php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp</td>
</tr>
<tr>
<td colspan="3">No K/P </td> <td>: {{ $customers_info['kpbaru'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> Tempoh Simpan</td><td> {{ $gadai['tempoh'] }} </td>
</tr>
<tr>
<td colspan="3">Nama Wakil </td> <td>: </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
<td colspan="3">Nama Wakil </td> <td>: @php if(sizeof($wakil) != 0){ echo $wakil['NAMA'];} else echo ''; @endphp </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
</tr>
<tr>
<td colspan="3">No K/P Wakil </td> <td>: </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
<td colspan="3">No K/P Wakil </td> <td>: @php if(sizeof($wakil) != 0) echo $wakil['NOKP']; else echo ''; @endphp </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
</tr>
</table>
<br>
@@ -423,16 +421,19 @@ hr.new5 {
<table id="payment">
<tr>
<td style="width:10px"> Tarikh Bayaran</td><td style="width:5px"> </td><td style="width:10px">@php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp</td>
<td style="width:10px"> Tarikh Bayaran</td><td style="width:5px"> </td><td style="width:10px">@php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp</td>
</tr>
<tr>
<td style="width:10px">Harga Jualan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format(($transaction['bakiharga'] + $transaction['duit_masuk']),2) }} </td>
<td style="width:10px">Harga Jualan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format(($gadai['hargajualan']),2) }} </td>
</tr>
<tr>
<td style="width:10px">(-) Bayaran Pelanggan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['duit_masuk'],2) }} </td>
<td style="width:10px">(-) Bayaran Pelanggan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($penebusan['BakiPjm'],2) }} </td>
</tr>
<tr>
<td style="width:10px"><b>Baki Harga Jualan</b></td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['bakiharga'],2) }} </td>
<td style="width:10px">(-) Rebate</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($penebusan['rebate'],2) }} </td>
</tr>
<tr>
<td style="width:10px"><b>Baki Harga Jualan</b></td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($gadai['bakihargajualan'],2) }} </td>
</tr>
@@ -492,10 +493,10 @@ hr.new5 {
<table id="inside">
<tr>
<td colspan="3">Marhun</td> <td>: {{ $gadai['marhun'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> No SAG</td><td> {{ $transaction['norujukan'] }} </td>
<td colspan="3">Marhun</td> <td>: {{ $gadai['marhun'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> No SAG</td><td> {{ $gadai['norujukan'] }} </td>
</tr>
<tr>
<td colspan="3">Nama</td> <td>: {{ $customers_info['nama'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> Tarikh Bayar</td><td> @php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp </td>
<td colspan="3">Nama</td> <td>: {{ $customers_info['nama'] }} </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> Tarikh Bayar</td><td> @php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp </td>
</tr>
<tr>
@@ -505,12 +506,12 @@ hr.new5 {
<tr>
<td colspan="3">Nama Wakil </td> <td>: </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
<td colspan="3">Nama Wakil </td> <td>: @php if(sizeof($wakil) != 0){ echo $wakil['NAMA'];} else echo ''; @endphp </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
</tr>
<tr>
<td colspan="3">No K/P Wakil </td> <td>: </td> <td colspan="3"> <t/d> <td> </td><td> </td><td> </td><td> </td>
<td colspan="3">No K/P Wakil </td> <td>: @php if(sizeof($wakil) != 0) echo $wakil['NOKP']; else echo ''; @endphp</td> <td colspan="3"> <td> </td><td> </td><td> </td><td> </td>
</tr>
</table>
<br>
@@ -519,16 +520,19 @@ hr.new5 {
<table id="payment">
<tr>
<td style="width:10px"> Tarikh Bayaran</td><td style="width:5px"> </td><td style="width:10px">@php $time = new DateTime($transaction['created_at']); $date = $time->format('n/j/Y'); echo $date; @endphp</td>
<td style="width:10px"> Tarikh Bayaran</td><td style="width:5px"> </td><td style="width:10px">@php $time = new DateTime($penebusan['t_tebus']); $date = $time->format('n/j/Y'); echo $date; @endphp</td>
</tr>
<tr>
<td style="width:10px">Harga Jualan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format(($transaction['bakiharga'] + $transaction['duit_masuk']),2) }} </td>
<td style="width:10px">Harga Jualan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format(($gadai['hargajualan']),2) }} </td>
</tr>
<tr>
<td style="width:10px">(-) Bayaran Pelanggan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['duit_masuk'],2) }} </td>
<td style="width:10px">(-) Bayaran Pelanggan</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($penebusan['BakiPjm'],2) }} </td>
</tr>
<tr>
<td style="width:10px"><b>Baki Harga Jualan</b></td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($transaction['bakiharga'],2) }}</td>
<td style="width:10px">(-) Rebate</td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($penebusan['rebate'],2) }} </td>
</tr>
<tr>
<td style="width:10px"><b>Baki Harga Jualan</b></td><td style="width:5px"> </td><td style="width:10px">RM {{ number_format($gadai['bakihargajualan'],2) }}</td>
</tr>
+3 -1
View File
@@ -121,7 +121,8 @@ Route::get('/getkelulusan',['as'=>'khazanah.getkelulusan','uses'=>'KhazanahContr
Route::post('/createkelulusan',['as'=>'khazanah.createkelulusan','uses'=>'KhazanahController@createkelulusan'])->middleware('auth','teller');
Route::put('/updatekelulusan',['as'=>'khazanah.updatekelulusan','uses'=>'KhazanahController@updatekelulusan'])->middleware('auth','khazanah');
Route::post('/createpanjar',['as'=>'khazanah.createpanjar','uses'=>'KhazanahController@createkelulusan'])->middleware('auth','teller');
Route::get('/gadaian/edit/{norujukan}',['as'=>'gadaian.edit','uses'=>'GadaianController@edit'])->middleware('auth','teller');
Route::post('/gadai/edit/store',['as'=>'gadai.editstore','uses'=>'GadaianController@editstore'])->middleware('auth','teller');
//Laporan Baru
Route::get('/laporan/lelongan',['as'=>'laporan.lelongan','uses'=>'KhazanahController@laporanLelongan'])->middleware('auth','khazanah');
@@ -145,6 +146,7 @@ Route::get('laporan/ringkasanterkumpul/cetak',['as'=>'ringkasanterkumpul.laporan
//Resit Ansurans
Route::get('/resit/{id}',['as'=>'resit.ansuran','uses'=>'GadaianController@resit'])->middleware('auth','teller');
Route::get('/resit/tebus/{id}',['as'=>'resit.tebus','uses'=>'GadaianController@resittebus'])->middleware('auth','teller');
Route::post('/barcodescanned',['as'=>'barcode.scanned','uses'=>'KhazanahController@barcodescanned'])->middleware('auth','khazanah');