aliran tunai fix carry forward baki

This commit is contained in:
hafifierahman
2021-02-17 16:30:54 +08:00
parent 7859060bb1
commit 2acfa73d31
4 changed files with 632 additions and 529 deletions
+52 -11
View File
@@ -22,17 +22,58 @@ class AliranTunaiController extends Controller
if(sizeof($alirantunai) == 0) if(sizeof($alirantunai) == 0)
{ {
$alirantunai = Http::post(config('api.url') . '/api/tunai/daftarTunai/' . $auth_user['cawangan'], [
'kodcaw' => $auth_user['cawangan'], $latesttunai = Http::get(config('api.url') . '/api/GetLatestTunai/'. $auth_user['cawangan'], ['kodlaluan' => $auth_user['name']])->json();
'teller' => $auth_user['name'],
'bakiawal' => 0.00,
'masuk' => 0.00, if(sizeof($latesttunai) > 0)
'yuran' => 0.00, {
'keluar' => 0.00,
'baki' => 0.00,
'tambah' => 0.00, if($latesttunai[0]['baki'] != 0)
'kurang' => 0.00 {
])->json(); $alirantunai = Http::post(config('api.url') . '/api/tunai/daftarTunai/' . $auth_user['cawangan'], [
'kodcaw' => $auth_user['cawangan'],
'teller' => $auth_user['name'],
'bakiawal' => $latesttunai[0]['baki'],
'masuk' => 0.00,
'yuran' => 0.00,
'keluar' => 0.00,
'baki' => $latesttunai[0]['baki'],
'tambah' => 0.00,
'kurang' => 0.00
])->json();
}
else
{
$alirantunai = Http::post(config('api.url') . '/api/tunai/daftarTunai/' . $auth_user['cawangan'], [
'kodcaw' => $auth_user['cawangan'],
'teller' => $auth_user['name'],
'bakiawal' => 0.00,
'masuk' => 0.00,
'yuran' => 0.00,
'keluar' => 0.00,
'baki' => 0.00,
'tambah' => 0.00,
'kurang' => 0.00
])->json();
}
}
else{
$alirantunai = Http::post(config('api.url') . '/api/tunai/daftarTunai/' . $auth_user['cawangan'], [
'kodcaw' => $auth_user['cawangan'],
'teller' => $auth_user['name'],
'bakiawal' => 0.00,
'masuk' => 0.00,
'yuran' => 0.00,
'keluar' => 0.00,
'baki' => 0.00,
'tambah' => 0.00,
'kurang' => 0.00
])->json();
}
} }
$denominasi=Http::get(config('api.url').'/api/DenominasiController/'.$auth_user['cawangan'])->json(); $denominasi=Http::get(config('api.url').'/api/DenominasiController/'.$auth_user['cawangan'])->json();
+53 -35
View File
@@ -15,23 +15,44 @@
<div class="col-md-12"> <div class="col-md-12">
<a href="{{ url('/') }}"><i class="fas fa-arrow-left"></i> Kembali</a> <a href="{{ url('/') }}"><i class="fas fa-arrow-left"></i> Kembali</a>
<h3 class="text-uppercase text-center">aliran tunai</h3> <h3 class="text-uppercase text-center">aliran tunai</h3>
<div class="row justify-content-center">
<div class="col-lg-4 col-md-6 col-sm-12"> <div class="row justify-content-center">
<div class="justify-content-center col-4">
<div class="col-12">
<div class="small-box bg-info"> <div class="small-box bg-info">
<div class="inner"> <div class="inner">
<h3>RM {{ number_format($alirantunai['bakiawal'],2) }}</h3> <h4>RM {{ number_format($alirantunai['bakiawal'],2) }}</h4>
<p>Baki Awal Tunai</p> <p>Baki Awal Tunai</p>
</div> </div>
<div class="icon"> <div class="icon">
<i class="ion ion-cash"></i> <i class="fas fa-money-bill-alt"></i>
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-12">
<div class="col-12">
<div class="small-box bg-info">
<div class="inner">
<h4 id="bakiakhir">RM {{ number_format($alirantunai['baki'],2) }}</h4>
<p>Baki Tunai Semasa</p>
</div>
<div class="icon">
<i class="fas fa-cash-register"></i>
</div>
</div>
</div>
</div>
<div class="justify-content-center col-4">
<div class="col-12">
<div class="small-box bg-success"> <div class="small-box bg-success">
<div class="inner"> <div class="inner">
<h3>RM {{ number_format($alirantunai['tambah'],2) }}</h3> <h4>RM {{ number_format($alirantunai['tambah'],2) }}</h4>
<p>Pendahuluan</p> <p>Pendahuluan</p>
</div> </div>
@@ -40,10 +61,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-lg-4 col-md-6 col-sm-12"> <div class="col-12">
<div class="small-box bg-danger"> <div class="small-box bg-danger">
<div class="inner"> <div class="inner">
<h3>RM {{ number_format($alirantunai['kurang'],2) }}</h3> <h4>RM {{ number_format($alirantunai['kurang'],2) }}</h4>
<p>Serahan</p> <p>Serahan</p>
</div> </div>
@@ -53,34 +74,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row justify-content-center"> <div class="justify-content-center col-4">
<div class="col-lg-4 col-md-6 col-sm-12"> <div class="col-12">
<div class="small-box bg-warning">
<div class="inner">
<h3 id="bakiakhir">RM {{ number_format($alirantunai['baki'],2) }}</h3>
<p>Baki Akhir Tunai</p>
</div>
<div class="icon">
<i class="fas fa-cash-register"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12">
<div class="small-box bg-success"> <div class="small-box bg-success">
<div class="inner"> <div class="inner">
<h3>RM {{ number_format($alirantunai['keluar'],2) }}</h3> <h4>RM {{ number_format($alirantunai['masuk'],2) }}</h4>
{{-- <h3>{{ $GT['gcount'] }}</h3> --}}
<p>Jumlah Gadaian</p>
</div>
<div class="icon">
<i class="fas fa-minus-square"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 col-sm-12">
<div class="small-box bg-danger">
<div class="inner">
<h3>RM {{ number_format($alirantunai['masuk'],2) }}</h3>
{{-- <h3>{{ $GT['tcount'] }}</h3> --}} {{-- <h3>{{ $GT['tcount'] }}</h3> --}}
<p>Jumlah Penebusan</p> <p>Jumlah Penebusan</p>
</div> </div>
@@ -88,8 +88,26 @@
<i class="fas fa-plus-square"></i> <i class="fas fa-plus-square"></i>
</div> </div>
</div> </div>
</div>
<div class="col-12">
<div class="small-box bg-danger">
<div class="inner">
<h4>RM {{ number_format($alirantunai['keluar'],2) }}</h4>
{{-- <h3>{{ $GT['gcount'] }}</h3> --}}
<p>Jumlah Gadaian</p>
</div>
<div class="icon">
<i class="fas fa-minus-square"></i>
</div>
</div>
</div> </div>
</div> </div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12 text-center"> <div class="col-md-12 text-center">
<input type="button" class="btn btn-lg btn-primary" value="TAMBAH MODAL" data-kodcaw="{{ $auth_user['cawangan'] }}" data-teller="{{ $auth_user['name'] }}" id="tambahmodal" onclick="openuptambahdanserah(this)"> <input type="button" class="btn btn-lg btn-primary" value="TAMBAH MODAL" data-kodcaw="{{ $auth_user['cawangan'] }}" data-teller="{{ $auth_user['name'] }}" id="tambahmodal" onclick="openuptambahdanserah(this)">
+250 -207
View File
@@ -716,220 +716,226 @@
var min_pinjaman = nilai_marhun_total * 0.10; var min_pinjaman = nilai_marhun_total * 0.10;
var max_pinjaman = nilai_marhun_total * 0.80; var max_pinjaman = nilai_marhun_total * 0.80;
if(pinjaman < min_pinjaman){ let teller = "{{ Auth::user()->name }}";
let bakiakhir = 0;
var kodcaw = $('#kodcaw').val();
$.ajax({
method: 'get',
url: api_url + '/api/GetCurrentTunai/' + kodcaw,
async: false,
dataType:'json',
data:{
'kodlaluan': teller
},
success:function(data){
bakiakhir = data.baki;
}
});
if(bakiakhir < pinjaman)
{
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Baki Akhir Tunai Lebih Rendah Daripada Nilai Marhun Yang Ingin Digadaikan. Sila Tambah Pendahuluan di Laman Aliran Tunai Segera. '
});
event.preventDefault();
return false;
}else{
if($.isNumeric(pinjaman) == false){
$("#terima_gadai").prop('disabled', false); $("#terima_gadai").prop('disabled', false);
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Amaran!', title: 'Amaran!',
text: 'Sila Masukan Pembiayaan, Minimal Pembiayaan ialah RM '+ formatter.format(min_pinjaman) text: 'Sila Masukkan Nombor Sahaja'
}); });
event.preventDefault(); event.preventDefault();
return false; return false;
} }
else if(pinjaman > max_pinjaman){ if(pinjaman < min_pinjaman){
$("#terima_gadai").prop('disabled', false); $("#terima_gadai").prop('disabled', false);
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Amaran!', title: 'Amaran!',
text: 'Pinjaman Melebihi Margin Yang Dibenarkan' text: 'Sila Masukan Pembiayaan, Minimal Pembiayaan ialah RM '+ formatter.format(min_pinjaman)
});
event.preventDefault();
return false;
}
else{
if(pinjaman > Number(pembiyaan_max_pelulus)+10 || pinjaman >=10000){
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
if(pinjaman > Number(pembiyaan_max_pelulus)+10){
var errortext = "Tetapan margin melebihi 75% untuk Operasi!";
}
if(pinjaman >= 10000){
var errortext = "Pinjaman Melebihi 10000";
}
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Operasi',
text: errortext,
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Hantar',
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 (result.dismiss === Swal.DismissReason.cancel){
swalWithBootstrapButtons.fire(
'Batal',
'Malumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
}); });
event.preventDefault(); event.preventDefault();
return false; return false;
}
else if(pinjaman > max_pinjaman){
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Pinjaman Melebihi Margin Yang Dibenarkan'
});
event.preventDefault();
return false;
}
else{
if(pinjaman > Number(pembiyaan_max_pelulus)+10 || pinjaman >=10000){
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
}else if(pinjaman > Number(pembiayaan_max_teller)+10){ if(pinjaman > Number(pembiyaan_max_pelulus)+10){
const swalWithBootstrapButtons = Swal.mixin({ var errortext = "Tetapan margin melebihi 75% untuk Operasi!";
customClass: { }
confirmButton: 'btn btn-success', if(pinjaman >= 10000){
cancelButton: 'btn btn-danger' var errortext = "Pinjaman Melebihi 10000";
}, }
buttonsStyling: false
})
swalWithBootstrapButtons.fire({ swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Khazanah?', title: 'Dapatkan Pengesahan Operasi',
text: "Tetapan margin melebihi 70% untuk Khazanah!", text: errortext,
icon: 'info', icon: 'info',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Hantar', confirmButtonText: 'Hantar',
cancelButtonText: 'Batal', cancelButtonText: 'Batal',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
let norujukan = $('#norujukan').val(); let norujukan = $('#norujukan').val();
Swal.fire({ Swal.fire({
title: 'Tunggu Pengesahan Daripada Khazanah.', title: 'Tunggu Pengesahan Daripada Operasi.',
icon: 'info', icon: 'info',
width: 600, width: 600,
padding: '3em', padding: '3em',
background: '#fffff', background: '#fffff',
showCancelButton: false, showCancelButton: false,
showConfirmButton: false, showConfirmButton: false,
allowOutsideClick: false, allowOutsideClick: false,
allowEscapeKey: false, allowEscapeKey: false,
allowEnterKey: false allowEnterKey: false
}) })
$.ajax({ $.ajax({
method:'post', method:'post',
url: "{{ route('khazanah.createkelulusan') }}", url: "{{ route('operasi.createkelulusan') }}",
data: { data: {
"_token": "{{ csrf_token() }}", "_token": "{{ csrf_token() }}",
"norujukan" : norujukan "norujukan" : norujukan
// "teller" : teller, // "teller" : teller,
// "dategadai" : dategadai, // "dategadai" : dategadai,
// "bilgadai" : noic, // "bilgadai" : noic,
// "jumpinjam" : jumpinjam, // "jumpinjam" : jumpinjam,
// "teller" : teller // "teller" : teller
},
success:function(data){ },
success:function(data){
console.log(data); console.log(data);
},error: function(xhr, status, error) { },error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")"); var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText); alert(xhr.responseText);
} }
}); });
//TIME INTERVAL //TIME INTERVAL
let timerInterval; 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 (result.dismiss === Swal.DismissReason.cancel){
swalWithBootstrapButtons.fire(
'Batal',
'Malumat Gadaian Tidak Berjaya Disimpan',
'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: 'Hantar',
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
})
timerInterval = setInterval(function(){
$.ajax({ $.ajax({
method:'get', method:'post',
url: "{{ route('khazanah.getkelulusan') }}", url: "{{ route('khazanah.createkelulusan') }}",
data: { data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan "norujukan" : norujukan
// "teller" : teller,
// "dategadai" : dategadai,
// "bilgadai" : noic,
// "jumpinjam" : jumpinjam,
// "teller" : teller
}, },
success:function(data){ success:function(data){
if(data != '') console.log(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) { },error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")"); var err = eval("(" + xhr.responseText + ")");
@@ -937,31 +943,68 @@
} }
}); });
}, 3000); //TIME INTERVAL
let timerInterval;
} else if (result.dismiss === Swal.DismissReason.cancel) { timerInterval = setInterval(function(){
swalWithBootstrapButtons.fire( $.ajax({
'Batal', method:'get',
'Maklumat Gadaian Tidak Berjaya Disimpan', url: "{{ route('khazanah.getkelulusan') }}",
'error' data: {
) "norujukan" : norujukan
} },
}); success:function(data){
event.preventDefault(); if(data != '')
return false; {
} clearInterval(timerInterval);
else if(pinjaman < 10000){ Swal.fire({
Swal.fire({ icon: 'success',
icon: 'success', title: 'Anda Berjaya Menerima Pengesahan'
title: 'Berjaya!', }).then(function(){
text: 'Gadaian Berjaya Disimpan'
}); $(func).attr("onSubmit","return true;");
return true; $(func).submit();
return true;
});
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}, 3000);
} else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
});
event.preventDefault();
return false;
}
else if(pinjaman < 10000){
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Gadaian Berjaya Disimpan'
});
return true;
}
} }
} }
} }
</script> </script>
@endsection @endsection
+277 -276
View File
@@ -402,38 +402,6 @@
minimumFractionDigits: 2 minimumFractionDigits: 2
}); });
$('#daftar_marhun').on('show.bs.modal', function(event) {
let teller = "{{ Auth::user()->name }}";
let bakiakhir = 0;
var kodcaw = $('#kodcaw').val();
$.ajax({
method: 'get',
url: api_url + '/api/GetCurrentTunai/' + kodcaw,
async: false,
dataType:'json',
data:{
'kodlaluan': teller
},
success:function(data){
bakiakhir = data.baki;
}
});
if(bakiakhir <= total_nilai_marhun)
{
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Baki Akhir Tunai Lebih Rendah Daripada Nilai Marhun Yang Ingin Digadaikan. Sila Tambah Pendahuluan di Laman Aliran Tunai Segera. '
});
return false;
}
});
$('#terima_marhun').click(function(){ $('#terima_marhun').click(function(){
var kodcaw = $('#kodcaw').val(); var kodcaw = $('#kodcaw').val();
var norujukan = $('#norujukan').val(); var norujukan = $('#norujukan').val();
@@ -657,7 +625,37 @@
var min_pinjaman = nilai_marhun_total * 0.10; var min_pinjaman = nilai_marhun_total * 0.10;
var max_pinjaman = nilai_marhun_total * 0.80; var max_pinjaman = nilai_marhun_total * 0.80;
if($.isNumeric(pinjaman) == false){ let teller = "{{ Auth::user()->name }}";
let bakiakhir = 0;
var kodcaw = $('#kodcaw').val();
$.ajax({
method: 'get',
url: api_url + '/api/GetCurrentTunai/' + kodcaw,
async: false,
dataType:'json',
data:{
'kodlaluan': teller
},
success:function(data){
bakiakhir = data.baki;
}
});
if(bakiakhir < pinjaman)
{
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Baki Akhir Tunai Lebih Rendah Daripada Nilai Marhun Yang Ingin Digadaikan. Sila Tambah Pendahuluan di Laman Aliran Tunai Segera. '
});
event.preventDefault();
return false;
}else{
if($.isNumeric(pinjaman) == false){
$("#terima_gadai").prop('disabled', false); $("#terima_gadai").prop('disabled', false);
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
@@ -666,292 +664,295 @@
}); });
event.preventDefault(); event.preventDefault();
return false; return false;
} }
if(pinjaman < min_pinjaman){ if(pinjaman < min_pinjaman){
$("#terima_gadai").prop('disabled', false); $("#terima_gadai").prop('disabled', false);
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Amaran!', title: 'Amaran!',
text: 'Sila Masukan Pembiayaan, Minimal Pembiayaan ialah RM '+ formatter.format(min_pinjaman) text: 'Sila Masukan Pembiayaan, Minimal Pembiayaan ialah RM '+ formatter.format(min_pinjaman)
}); });
event.preventDefault(); event.preventDefault();
return false; return false;
}else if(pinjaman > max_pinjaman){ }else if(pinjaman > max_pinjaman){
$("#terima_gadai").prop('disabled', false); $("#terima_gadai").prop('disabled', false);
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Amaran!', title: 'Amaran!',
text: 'Pinjaman Melebihi Margin Yang Dibenarkan' text: 'Pinjaman Melebihi Margin Yang Dibenarkan'
}); });
event.preventDefault(); event.preventDefault();
return false; return false;
}else{ }else{
$.ajax({ $.ajax({
method:'get', method:'get',
url: api_url + '/api/komuditi/check', url: api_url + '/api/komuditi/check',
success:function(data){ success:function(data){
var check_komuditi = Object.keys(data).length; var check_komuditi = Object.keys(data).length;
if(check_komuditi == 0){ if(check_komuditi == 0){
$("#terima_gadai").prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
});
event.preventDefault();
return false;
}else{
if(Number(data['unit_komuditi']) < pinjaman){
$("#terima_gadai").prop('disabled', false); $("#terima_gadai").prop('disabled', false);
Swal.fire({ Swal.fire({
icon: 'error', icon: 'error',
title: 'Baki Unit Komuditi Tidak Mencukupi', title: 'Unit Komuditi Berbaki Minumum',
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi' text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
}); });
event.preventDefault(); event.preventDefault();
return false; return false;
} }else{
else{ if(Number(data['unit_komuditi']) < pinjaman){
if(pinjaman > Number(pembiyaan_max_pelulus)+10 || pinjaman >= 10000){ $("#terima_gadai").prop('disabled', false);
const swalWithBootstrapButtons = Swal.mixin({ Swal.fire({
customClass: { icon: 'error',
confirmButton: 'btn btn-success', title: 'Baki Unit Komuditi Tidak Mencukupi',
cancelButton: 'btn btn-danger' text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
},
buttonsStyling: false
}); });
event.preventDefault();
return false;
}
else{
if(pinjaman > Number(pembiyaan_max_pelulus)+10 || pinjaman >= 10000){
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
});
if(pinjaman > Number(pembiyaan_max_pelulus)+10){ if(pinjaman > Number(pembiyaan_max_pelulus)+10){
var errortext = "Tetapan margin melebihi 75% untuk Operasi!"; var errortext = "Tetapan margin melebihi 75% untuk Operasi!";
} }
if(pinjaman >= 10000){ if(pinjaman >= 10000){
var errortext = "Pinjaman Melebihi 10000"; var errortext = "Pinjaman Melebihi 10000";
} }
swalWithBootstrapButtons.fire({ swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Operasi', title: 'Dapatkan Pengesahan Operasi',
text: errortext, text: errortext,
icon: 'info', icon: 'info',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Hantar', confirmButtonText: 'Hantar',
cancelButtonText: 'Batal', cancelButtonText: 'Batal',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
let norujukan = $('#norujukan').val(); let norujukan = $('#norujukan').val();
let nm = $('#total_nilai_marhun').val();let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text(); let nm = $('#total_nilai_marhun').val();let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text();
let komen = "Pembiayaan Melebihi Margin 75%|" + nm + "|" + ber + "|" + marg + "|"; let komen = "Pembiayaan Melebihi Margin 75%|" + nm + "|" + ber + "|" + marg + "|";
let jumpinjam = $('#pinjaman').val(); let jumpinjam = $('#pinjaman').val();
let teller = "{{ Auth::user()->name }}"; let teller = "{{ Auth::user()->name }}";
Swal.fire({ Swal.fire({
title: 'Tunggu Pengesahan Daripada Operasi.', title: 'Tunggu Pengesahan Daripada Operasi.',
icon: 'info', icon: 'info',
width: 600, width: 600,
padding: '3em', padding: '3em',
background: '#fffff', background: '#fffff',
showCancelButton: false, showCancelButton: false,
showConfirmButton: false, showConfirmButton: false,
allowOutsideClick: false, allowOutsideClick: false,
allowEscapeKey: false, allowEscapeKey: false,
allowEnterKey: false allowEnterKey: false
}) })
$.ajax({
method:'post',
url: "{{ route('operasi.createkelulusan') }}",
data: {
"_token": "{{ csrf_token() }}",
"norujukan" : norujukan,
"komen" : komen,
"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({ $.ajax({
method:'get', method:'post',
url: "{{ route('operasi.getkelulusan') }}", url: "{{ route('operasi.createkelulusan') }}",
data: { data: {
"norujukan" : norujukan "_token": "{{ csrf_token() }}",
"norujukan" : norujukan,
"komen" : komen,
"jumpinjam" : jumpinjam,
"teller" : teller
}, },
success:function(data){ success:function(data){
if(data != ''){ console.log(data);
clearInterval(timerInterval);
Swal.fire({
icon: 'success',
title: 'Telah Disahkan'
}).then(function(){
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
});
}
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")"); var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText); alert(xhr.responseText);
} }
}); });
}, 3000);
}else if (result.dismiss === Swal.DismissReason.cancel){
$("#terima_gadai").prop('disabled', false);
swalWithBootstrapButtons.fire(
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'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({ //TIME INTERVAL
title: 'Dapatkan Pengesahan Khazanah', let timerInterval;
text: "Tetapan margin melebihi 70% untuk Khazanah!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Hantar',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
let norujukan = $('#norujukan').val(); timerInterval = setInterval(function(){
let nm = $('#total_nilai_marhun').val();let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text(); $.ajax({
let komen = "Pembiayaan Melebihi Margin 70%|" + nm + "|" + ber + "|" + marg + "|"; method:'get',
let jumpinjam = $('#pinjaman').val(); url: "{{ route('operasi.getkelulusan') }}",
let teller = "{{ Auth::user()->name }}"; data: {
"norujukan" : norujukan
Swal.fire({ },
title: 'Tunggu Pengesahan Daripada Khazanah.', success:function(data){
icon: 'info', if(data != ''){
width: 600, clearInterval(timerInterval);
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,
"komen" : komen,
"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);
if(data == 'batal')
{
Swal.fire({ Swal.fire({
icon: 'warning', icon: 'success',
title: 'Telah Dibatalkan' title: 'Telah Disahkan'
}).then(function(){ }).then(function(){
$("#terima_gadai").prop('disabled', false);
return false;
});
}else{
Swal.fire({
icon: 'success',
title: 'Telah Disahkan'
}).then(function(){
$(func).attr("onSubmit","return true;"); $(func).attr("onSubmit","return true;");
$(func).submit(); $(func).submit();
return true; return true;
}); });
} }
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
} }
});
}, 3000);
}else if (result.dismiss === Swal.DismissReason.cancel){
$("#terima_gadai").prop('disabled', false);
swalWithBootstrapButtons.fire(
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'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
});
},error: function(xhr, status, error) { swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Khazanah',
text: "Tetapan margin melebihi 70% untuk Khazanah!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Hantar',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
let norujukan = $('#norujukan').val();
let nm = $('#total_nilai_marhun').val();let ber = $('#total_berat').val();let marg = $('.span-pinjaman').text();
let komen = "Pembiayaan Melebihi Margin 70%|" + nm + "|" + ber + "|" + marg + "|";
let jumpinjam = $('#pinjaman').val();
let teller = "{{ Auth::user()->name }}";
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,
"komen" : komen,
"jumpinjam" : jumpinjam,
"teller" : teller
},
success:function(data){
console.log(data);
},
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")"); var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText); alert(xhr.responseText);
} }
}); });
}, 3000);
} else if (result.dismiss === Swal.DismissReason.cancel) { //TIME INTERVAL
$("#terima_gadai").prop('disabled', false); let timerInterval;
swalWithBootstrapButtons.fire(
'Batal', timerInterval = setInterval(function(){
'Maklumat Gadaian Tidak Berjaya Disimpan', $.ajax({
'error' method:'get',
) url: "{{ route('khazanah.getkelulusan') }}",
} data: {
}); "norujukan" : norujukan
event.preventDefault(); },
return false; success:function(data){
}
else if( pinjaman < 10000){ if(data != '')
Swal.fire({ {
icon: 'success', clearInterval(timerInterval);
title: 'Berjaya!',
text: 'Gadaian Berjaya Disimpan' if(data == 'batal')
}); {
$(func).attr("onSubmit","return true;"); Swal.fire({
$(func).submit(); icon: 'warning',
return true; title: 'Telah Dibatalkan'
}).then(function(){
$("#terima_gadai").prop('disabled', false);
return false;
});
}else{
Swal.fire({
icon: 'success',
title: 'Telah Disahkan'
}).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 (result.dismiss === Swal.DismissReason.cancel) {
$("#terima_gadai").prop('disabled', false);
swalWithBootstrapButtons.fire(
'Batal',
'Maklumat Gadaian Tidak Berjaya Disimpan',
'error'
)
}
});
event.preventDefault();
return false;
}
else if( pinjaman < 10000){
Swal.fire({
icon: 'success',
title: 'Berjaya!',
text: 'Gadaian Berjaya Disimpan'
});
$(func).attr("onSubmit","return true;");
$(func).submit();
return true;
}
} }
} }
} }
} });
}); }
} }
} }