tebus dan hargaemas

This commit is contained in:
hafifierahman
2021-01-12 11:44:04 +08:00
parent bdb4844a1d
commit a32deccf82
20 changed files with 1025 additions and 318 deletions
+160 -113
View File
@@ -219,15 +219,21 @@
</div>
<div class="col-md-4">
<div class="form-group row">
<div class="col-md-4">
Jumlah Pembiayaan Semasa
<div class="col-md-6">
Jumlah Pembiayaan Semasa / Limit Pembiayaan Semasa
</div>
<div class="col-md-8">
<div class="col-md-3">
@php
$outstanding_semasa = Http::get($api_url . '/api/gadai/customers/'. $customer_info['kpbaru'] .'/outstandingsemasa')->json();
@endphp
<input type="text" class="form-control" name="outstanding_semasa" id="outstanding_semasa" readonly value="{{ number_format($outstanding_semasa,2) }}">
</div>
<div class="col-md-3">
@php
$limit_pinjaman_semasa = 0;
@endphp
<input type="text" class="form-control" name="outstanding_semasa" id="outstanding_semasa" readonly value="{{ number_format($limit_pinjaman_semasa,2) }}">
</div>
</div>
</div>
<div class="col-md-4">
@@ -281,12 +287,12 @@
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh Gadai</th>
<th>Pembiayaan</th>
<th>Tarikh Matang</th>
<th>Nilai Marhun</th>
<th>Pembiayaan</th>
<th>Margin</th>
<th>Tempoh</th>
<th>Keuntungan</th>
<th>Tarikh Matang</th>
<th>Margin</th>
<th>Kos Keuntungan</th>
</tr>
</thead>
@@ -379,12 +385,12 @@
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="belum"/>',
'<a href=' + urlroute +'>' + gadai_detail['norujukan'] + '</a>',
gadai_detail['t_gadai'],
'RM '+formatter.format(gadai_detail['pinjaman']),
gadai_detail['t_matang'],
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
'RM '+formatter.format(gadai_detail['pinjaman']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
gadai_detail['jbg'],
'RM '+ formatter.format(keuntungan_semasa),
gadai_detail['t_matang'],
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
''
]).draw();
@@ -396,12 +402,12 @@
'<input type="radio" value='+ gadai_detail["norujukan"] +' name="sudahtebus"/>',
gadai_detail['norujukan'],
gadai_detail['t_gadai'],
'RM '+formatter.format(gadai_detail['pinjaman']),
gadai_detail['t_matang'],
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
'RM '+formatter.format(gadai_detail['pinjaman']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
gadai_detail['jbg'],
'RM '+ formatter.format(keuntungan_semasa),
gadai_detail['t_matang'],
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
''
]).draw();
@@ -413,12 +419,12 @@
counter,
gadai_detail['norujukan'],
gadai_detail['t_gadai'],
'RM '+formatter.format(gadai_detail['pinjaman']),
gadai_detail['t_matang'],
'RM '+ formatter.format(gadai_detail['nilaimarhun']),
'RM '+formatter.format(gadai_detail['pinjaman']),
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
gadai_detail['jbg'],
'RM '+ formatter.format(keuntungan_semasa),
gadai_detail['t_matang'],
(((Number(gadai_detail['pinjaman'])/Number(gadai_detail['nilaimarhun']))*100).toFixed(2)).toLocaleString("en-GB") + '%',
'RM ' + formatter.format((Number(gadai_detail['kadarupah'])*Number(gadai_detail['pinjaman'])).toFixed(2)),
''
]).draw();
@@ -477,9 +483,8 @@
{
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Something went wrong!',
footer: '<a href>Why do I have this issue?</a>'
title: 'Amaran',
text: 'Sila pilih salah satu SAG'
});
}
else
@@ -502,7 +507,30 @@
else if($("input[name='options']:checked").val() == 'sudah_tebus'){
let histid = $('input[name="sudahtebus"]:checked').val();
alert(histid);
if(histid == null)
{
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Sila pilih salah satu SAG'
});
}
else
{
$.ajax({
method:'get',
url:'{{ route("gadai.history") }}',
data:{ "norujukan" : histid},
success:function(data)
{
$('#historytebusModal').modal();
historytebustable(data);
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
}
}
}
@@ -525,8 +553,7 @@
tebusaz['norujukan'],
tebusaz['jenistebus'],
tebusaz['jbg'],
tebusaz['t_tebus'],
"<a href='#' class='btn btn-info'>Cetak</a>"
tebusaz['t_tebus']
]).draw();
counter = counter + 1;
@@ -536,64 +563,116 @@
function ubahfunc(e)
{
if($("input[name='options']:checked").val() == 'belum_tebus'){
let ubahid = $('input[name="belum"]:checked').val();
if(ubahid == null)
{
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Something went wrong!',
footer: '<a href>Why do I have this issue?</a>'
});
}
else
{
var urlroute = '{{ route("gadaian.edit", ":id") }}';
urlroute = urlroute.replace(':id', ubahid);
let ubahid = $('input[name="belum"]:checked').val();
window.location.replace(urlroute);
}
if(ubahid == null && $("input[name='options']:checked").val() == 'belum_tebus')
{
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Sila pilih salah satu SAG!'
});
return false;
}
else if($("input[name='options']:checked").val() == 'sudah_tebus'){
Swal.fire({
if($("input[name='options']:checked").val() == 'sudah_tebus')
{
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Ubah hanya untuk belum tebus sahaja!',
footer: '<a href>Why do I have this issue?</a>'
});
title: 'Amaran',
text: 'Ubah hanya untuk belum tebus sahaja!'
});
return false;
}
}
function hapusfunc()
{
let kodcaw = "{{ $cawangan_info['kodcaw'] }}";
if($("input[name='options']:checked").val() == 'belum_tebus'){
let hapusid = $('input[name="belum"]:checked').val();
const swalWithBootstrapButtons = Swal.mixin({
const swalWithBootstrapButtons = Swal.mixin
({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
})
swalWithBootstrapButtons.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Khazanah?',
text: "Ubah Rekod Pelanggan!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel!',
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
var urlroute = '{{ route("gadaian.edit", ":id") }}';
urlroute = urlroute.replace(':id', ubahid);
window.location.replace(urlroute);
}else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
});
}
function hapusfunc()
{
let kodcaw = "{{ $cawangan_info['kodcaw'] }}";
let hapusid = $('input[name="belum"]:checked').val();
let hapusidsudah = $('input[name="sudahtebus"]:checked').val();
if(hapusid == null && $("input[name='options']:checked").val() == 'belum_tebus')
{
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Sila pilih salah satu SAG!'
});
return false;
}else if(hapusidsudah == null && $("input[name='options']:checked").val() == 'sudah_tebus')
{
Swal.fire({
icon: 'error',
title: 'Amaran',
text: 'Sila pilih salah satu SAG!'
});
return false;
}
const swalWithBootstrapButtons = Swal.mixin
({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'Dapatkan Pengesahan Daripada Khazanah?',
text: "Hapus Rekod!",
icon: 'info',
showCancelButton: true,
confirmButtonText: 'Setuju!',
cancelButtonText: 'Batal',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
if($("input[name='options']:checked").val() == 'belum_tebus')
{
$.ajax({
method:'put',
url:api_url + '/api/gadai/hapus/' + kodcaw + '/' + hapusid,
@@ -601,53 +680,24 @@
{
console.log(data);
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'Hapus!',
'Data pelanggan telah dihapuskan.',
'success'
).then(function () {
location.reload();
});
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
});
else if($("input[name='options']:checked").val() == 'sudah_tebus')
{
}
else if($("input[name='options']:checked").val() == 'sudah_tebus'){
let hapusid = $('input[name="sudahtebus"]:checked').val();
const swalWithBootstrapButtons = Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
})
swalWithBootstrapButtons.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel!',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
method:'put',
url:api_url+'/api/tebus/hapus/' + kodcaw + '/' + hapusid,
@@ -656,8 +706,8 @@
if(data != "Bukan-Tebus")
{
swalWithBootstrapButtons.fire(
'Deleted!',
'Your file has been deleted.',
'Hapus!',
'Data pelanggan telah dihapuskan.',
'success'
).then(function () {
location.reload();
@@ -671,25 +721,22 @@
'error'
)
}
},error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(xhr.responseText);
}
});
} else if (
/* Read more about handling dismissals below */
result.dismiss === Swal.DismissReason.cancel
) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
});
}
}else if (result.dismiss === Swal.DismissReason.cancel) {
swalWithBootstrapButtons.fire(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
});
}
function gadaiOptionButton(noic){