komuditi pukal
This commit is contained in:
@@ -300,8 +300,8 @@
|
||||
url: api_url + '/api/harga_emas/'+karat,
|
||||
success:function(data){
|
||||
|
||||
var nilai_marhun = data['harga2'] * berat;
|
||||
$('#harga').val(data['harga2']);
|
||||
var nilai_marhun = data['harga'] * berat;
|
||||
$('#harga').val(data['harga']);
|
||||
$('#nilai_marhun').val(formatter.format(nilai_marhun));
|
||||
}
|
||||
})
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form name="gadaistore" action="{{ route('gadai.store') }}" method='post' onsubmit="verifyGadai(this)">
|
||||
{{-- <!-- <form action="{{ route('gadai.store') }}" method='post'> --> --}}
|
||||
<form name="gadaistore" action="{{ route('gadai.store') }}" method='post' onsubmit="return verifyGadai(this)">
|
||||
<!-- <form action="{{ route('gadai.store') }}" method='post' name="gadaistore" id="gadaistore"> -->
|
||||
@csrf
|
||||
<div class="col-12 form-group row">
|
||||
<div class="col-md-4">
|
||||
@@ -293,8 +293,8 @@
|
||||
url: api_url + '/api/harga_emas/'+karat,
|
||||
success:function(data){
|
||||
|
||||
var nilai_marhun = data['harga2'] * berat;
|
||||
$('#harga').val(data['harga2']);
|
||||
var nilai_marhun = data['harga'] * berat;
|
||||
$('#harga').val(data['harga']);
|
||||
$('#nilai_marhun').val(formatter.format(nilai_marhun));
|
||||
}
|
||||
})
|
||||
@@ -466,7 +466,8 @@
|
||||
$('#berat_emas').val("");
|
||||
$('#harga').val("");
|
||||
$('#nilai_marhun').val("");
|
||||
|
||||
$('#daftar_marhun').modal('hide');
|
||||
|
||||
jumlah_marhun += 1;
|
||||
jumlah_nilai_marhun += Number(nilai_marhun);
|
||||
$('#bilangan_marhun').val(formatter.format(jumlah_marhun));
|
||||
@@ -579,6 +580,7 @@
|
||||
});
|
||||
|
||||
function verifyGadai(func){
|
||||
event.preventDefault();
|
||||
var kodcaw = $('#kodcaw').val();
|
||||
var nokp = $('#nokp').val();
|
||||
var nopelanggan = $('#nopelanggan').val();
|
||||
@@ -586,13 +588,14 @@
|
||||
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 count_error = 0;
|
||||
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($.isNumeric(pinjaman) == false){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
@@ -610,8 +613,7 @@
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
else if(pinjaman > max_pinjaman){
|
||||
}else if(pinjaman > max_pinjaman){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Amaran!',
|
||||
@@ -619,250 +621,229 @@
|
||||
});
|
||||
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;
|
||||
}else{
|
||||
$.ajax({
|
||||
method:'get',
|
||||
url: api_url + '/api/komuditi/check',
|
||||
success:function(data){
|
||||
var check_komuditi = Object.keys(data).length;
|
||||
if(check_komuditi == 0){
|
||||
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){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Baki Unit Komuditi Tidak Mencukupi',
|
||||
text: 'Sila Hubungi Operasi Untuk Membuat Pembelian Komuditi'
|
||||
});
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
if(pinjaman > Number(pembiyaan_max_pelulus)+10){
|
||||
const swalWithBootstrapButtons = Swal.mixin({
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-success',
|
||||
cancelButton: 'btn btn-danger'
|
||||
},
|
||||
buttonsStyling: 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();
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
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;
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
method:'post',
|
||||
url: "{{ route('operasi.createkelulusan') }}",
|
||||
data: {
|
||||
"_token": "{{ csrf_token() }}",
|
||||
"norujukan" : norujukan
|
||||
},
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
var err = eval("(" + xhr.responseText + ")");
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
},error: function(xhr, status, error) {
|
||||
var err = eval("(" + xhr.responseText + ")");
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
});
|
||||
//TIME INTERVAL
|
||||
let timerInterval;
|
||||
|
||||
}, 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;
|
||||
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(
|
||||
'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
|
||||
});
|
||||
|
||||
}else if(pinjaman > Number(pembiayaan_max_teller)+10){
|
||||
|
||||
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();
|
||||
|
||||
const swalWithBootstrapButtons = Swal.mixin
|
||||
({
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-success',
|
||||
cancelButton: 'btn btn-danger'
|
||||
},
|
||||
buttonsStyling: false
|
||||
})
|
||||
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
|
||||
})
|
||||
|
||||
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;
|
||||
|
||||
});
|
||||
$.ajax({
|
||||
method:'post',
|
||||
url: "{{ route('khazanah.createkelulusan') }}",
|
||||
data: {
|
||||
"_token": "{{ csrf_token() }}",
|
||||
"norujukan" : norujukan
|
||||
},
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
var err = eval("(" + xhr.responseText + ")");
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
},error: function(xhr, status, error) {
|
||||
var err = eval("(" + xhr.responseText + ")");
|
||||
alert(xhr.responseText);
|
||||
}
|
||||
});
|
||||
//TIME INTERVAL
|
||||
let timerInterval;
|
||||
|
||||
}, 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;
|
||||
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 (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'
|
||||
});
|
||||
$(func).attr("onSubmit","return true;");
|
||||
$(func).submit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user