328 lines
14 KiB
PHP
328 lines
14 KiB
PHP
@extends('layouts.indexthird')
|
|
|
|
@section('content')
|
|
@include('modal.marhun')
|
|
|
|
@error('chkboxsag')
|
|
<script>
|
|
$.notify({
|
|
icon: 'fas fa-exclamation-triangle fa-2x',
|
|
newest_on_top: true,
|
|
message: "<strong style='font-size:15px;'>Sila pilih salah satu checkbox di atas terlebih dahulu!</strong>"
|
|
}, {
|
|
type: 'danger',
|
|
allow_dismiss: false,
|
|
placement: {
|
|
align: 'center',
|
|
from: 'bottom'
|
|
},
|
|
animate: {
|
|
enter: 'animate__animated animate__bounce',
|
|
|
|
exit: 'animate__animated animate__bounceOutDown'
|
|
}
|
|
});
|
|
</script>
|
|
@enderror
|
|
|
|
<title>Pembayaran | Portal Pelanggan</title>
|
|
<div class="container">
|
|
<div class="row">
|
|
<nav aria-label="breadcrumb">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item text-dark opacity-5"><a href="portalhome">Home</a></li>
|
|
<li class="breadcrumb-item text-dark active" aria-current="page">Pembayaran</li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
{{--
|
|
<div class="row justify-space-between py-2">
|
|
<div class="col-lg-6 col-md-8 col-sm-6 mx-auto">
|
|
<div class="nav-wrapper position-relative end-0">
|
|
<ul class="nav nav-pills nav-fill p-1" role="tablist">
|
|
<li class="nav-item">
|
|
<a class="nav-link mb-0 px-0 py-1 d-flex align-items-center justify-content-center active" data-bs-toggle="tab" href="#tabs-icons-text-2" role="tab" aria-controls="code" aria-selected="false">
|
|
<i class="material-icons text-sm me-2">dashboard</i> Tawarruq
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div> --}}
|
|
|
|
{{-- <div class="container col-11 shadow-lg p-3 bg-white rounded"> --}}
|
|
<div class="container col-11 p-3">
|
|
<div class="tab-content tab-space">
|
|
<form method="post" action="{{ route('payment.action') }}" onsubmit="return validateform()">
|
|
@csrf
|
|
<div class="card shadow">
|
|
<div class="card-body">
|
|
|
|
<div style="margin-bottom: 15px;">
|
|
<i class="text-danger">Maksimum 3 SAG dibenarkan dalam satu transaksi .</i>
|
|
</div>
|
|
<div class="table-responsive table-bordered table-hover">
|
|
<table class="table align-items-center table-flush border" id="selepas_tawarruq" style="text-align: center; width: 100%">
|
|
<thead class="thead-light bg-dark text-white text-center">
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Cawangan</th>
|
|
<th>No Rujukan</th>
|
|
<th>Keuntungan Semasa</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="list">
|
|
@foreach($belum_tebus as $index=>$bt)
|
|
@if($bt['hargajualan'] != '')
|
|
@php
|
|
$searchonline = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/portal/searchsagonline/',['norujukan' => $bt['norujukan']])->json();
|
|
|
|
$searchLelong = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url').'/api/search/lelong',[
|
|
'kodcaw' => $bt['kodcaw'],
|
|
'norujukan' => $bt['norujukan']
|
|
])->json();
|
|
|
|
if($searchLelong){
|
|
$t_lelong = Carbon\Carbon::parse($searchLelong['t_lelong'].' 00:00:00');
|
|
$tarikhini = Carbon\Carbon::parse($tarikh_hari_ini.' 00:00:00');
|
|
$diff=date_diff($tarikhini,$t_lelong);
|
|
$diff = (int)$diff->format("%R%a");
|
|
if($diff <= 2){ // 'messageamaran'=>'Rekod Gadaian Dalam Proses Lelong, Sila Hadir ke Cawangan.'
|
|
}elseif($searchLelong['t_jual'] != null && $searchLelong['hargajual'] != 0.00){
|
|
// 'messageamaran'=>'Rekod Gadaian Telah Dilelong.'
|
|
|
|
}
|
|
}
|
|
|
|
$koskeuntungan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/upahtawarruq/' . $bt['kodcaw'] . '/' . $bt['norujukan'])->json();
|
|
$keuntungan_1bln = $bt['pinjaman'] * ($bt['kadarupah'] / 100);
|
|
$ten_percent = floatval($bt['nilaimarhun']) * 0.1;
|
|
$baki_pinjaman = floatval($bt['bakipjm']);
|
|
$max_bayaran = $baki_pinjaman - $ten_percent;
|
|
@endphp
|
|
<tr {{ ($searchonline) ? 'style=background-color:#81ecec;' : '' }}>
|
|
<td>
|
|
<input type="checkbox" name="chkboxsag[]" value="{{ $bt['norujukan'] }}" id="sag-{{ $loop->iteration }}" data-norujukan="{{ $bt['norujukan'] }}" {{ ($searchonline) ? 'disabled' : '' }} />
|
|
{{-- <i data-toggle="tooltip" title="Hooray!" class="fas fa-exclamation-circle ml-3 text-right" style="font-size: 20px;"></i> --}}
|
|
</td>
|
|
<td>
|
|
@php
|
|
$namacawangan = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/cawangan/detail/' . $bt['kodcaw'] )->json();
|
|
echo ucwords(strtolower(substr($namacawangan[0]['namacaw'],8)));
|
|
@endphp
|
|
</td>
|
|
<th scope="row">
|
|
<div class="media align-items-center">
|
|
<div class="media-body">
|
|
@php
|
|
$marhun = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/marhun/' . $bt['norujukan'] )->json();
|
|
@endphp
|
|
<a href="#" class="linktarget" data-toggle="modal" data-nm="{{ number_format($bt['nilaimarhun'],2) }}" data-berat="{{ number_format($bt['berat'],2) }}" data-upah12="{{ number_format($bt['upah12'],2) }}" data-pjmnum="{{ number_format($bt['pinjaman'],2) }}" data-bakipjm="{{ number_format($bt['bakipjm'],2) }}" data-lelong="{{ $bt['taglel'] }}" data-marhun="{{ json_encode($marhun) }}" data-pinjaman="{{$bt['pinjaman']}}" data-norujukan="{{$bt['norujukan']}}" data-hargajualan="{{$bt['hargajualan']}}" data-kodcaw="{{ $bt['kodcaw'] }}" data-target="#marhunModal"><span class="name mb-0 text-sm">{{ $bt['norujukan'] }}</span></a>
|
|
</div>
|
|
</div>
|
|
</th>
|
|
<td>
|
|
{{ is_numeric($koskeuntungan) ? number_format($koskeuntungan,2) : $koskeuntungan }}
|
|
</td>
|
|
{{-- <td>
|
|
@if($bt['taglel'] === 1)
|
|
<span class="badge alert-danger">Akan Dilelong</span>
|
|
@endif
|
|
</td> --}}
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-end mt-4">
|
|
<button type="submit" class="btn btn-primary" onclick="loadingbtn();"><span class="mr-3">Seterusnya</span> <span class="badge alert-warning text-dark font-weight-bold" style="font-size:12px;" id="totalsag">0</span></button>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var apiurl = "{{ $api_url }}";
|
|
|
|
// var belumtawarruqtable = $('#belum_tawarruq').DataTable({
|
|
// "bLengthChange": false,
|
|
// "bFilter": true,
|
|
// "pagingType": "numbers",
|
|
// "paging" : false,
|
|
// language: {
|
|
// 'paginate': {
|
|
// 'previous': '<span class="fas fa-backward fa-1.5x"></span>',
|
|
// 'next': '<span class="fas fa-forward"></span>'
|
|
// }
|
|
// },
|
|
// "pageLength": 10,
|
|
// "scrollX": true
|
|
|
|
// });
|
|
|
|
var historybayarandatatable = $('#tablehistorybayaran').DataTable({
|
|
"ordering": false
|
|
});
|
|
|
|
var selepastawarruqtable = $('#selepas_tawarruq').DataTable({
|
|
"bFilter": true,
|
|
language: {
|
|
'paginate': {
|
|
'previous': '<span class="fas fa-backward fa-1.5x"></span>',
|
|
'next': '<span class="fas fa-forward"></span>'
|
|
}
|
|
},
|
|
"pageLength": 10,
|
|
"scrollX": true
|
|
});
|
|
|
|
function bayaranfunc(e,api){
|
|
|
|
let norujukan = $(e).data('norujukan');
|
|
|
|
let pinjaman = $(e).data('pinjaman');
|
|
let upah12 = $(e).data('upah12');
|
|
let bakipjm = $(e).data('bakipjm');
|
|
let berat = $(e).data('berat');
|
|
let nm = $(e).data('nm');
|
|
|
|
console.log(pinjaman,upah12,bakipjm,berat,nm);
|
|
|
|
$('#pembiayaan').text('RM ' + pinjaman);
|
|
$('#bpembiayaan').text('RM ' + bakipjm);
|
|
$('#nm').text('RM ' + nm);
|
|
$('#berat').text(berat + 'g');
|
|
$('#koskeun').text('RM ' + upah12);
|
|
|
|
|
|
|
|
$.ajax({
|
|
method: 'get',
|
|
url: api + '/api/transaction/' + norujukan,
|
|
success: function(data){
|
|
historybayarantable(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function historybayarantable(data){
|
|
var counter = 1;
|
|
|
|
historybayarandatatable.clear().draw();
|
|
$.each(data,function(index,bayaran){
|
|
|
|
var urlroute = '{{ route("resit.ansuran", ":id") }}';
|
|
urlroute = urlroute.replace(':id', bayaran['id']);
|
|
|
|
var date = new Date(bayaran['created_at']);
|
|
historybayarandatatable.row.add([
|
|
counter,
|
|
// date.toLocaleDateString(),
|
|
'<a target="_blank" href='+ urlroute + '>'+date.toLocaleDateString()+'</a>',
|
|
"RM " + bayaran['duit_masuk'],
|
|
]).draw();
|
|
counter = counter + 1;
|
|
});
|
|
}
|
|
|
|
$("input[type='checkbox'][name='chkboxsag[]']").click(function() {
|
|
var count = parseInt($('#totalsag').text());
|
|
if ($(this).is(':checked')) {
|
|
var total = count + 1;
|
|
|
|
if (total <= 3) {
|
|
$('#totalsag').text(total);
|
|
} else {
|
|
$(this).prop('checked', false);
|
|
}
|
|
} else {
|
|
var total = count - 1;
|
|
$('#totalsag').text(total);
|
|
}
|
|
});
|
|
|
|
|
|
function validateform() {
|
|
return true;
|
|
}
|
|
|
|
var api_url = "{{ config('api.url') }}";
|
|
|
|
$('.linktarget').on('click', function(event) {
|
|
|
|
var arraymarhun = $(this).data('marhun');
|
|
var norujukan = $(this).data('norujukan');
|
|
var kodcaw = $(this).data('kodcaw');
|
|
var hargajualan = $(this).data('hargajualan');
|
|
var pinjaman = $(this).data('pinjaman');
|
|
var bakipjm = $(this).data('bakipjm');
|
|
var lelong = $(this).data('lelong');
|
|
var pjmnum = $(this).data('pjmnum');
|
|
|
|
bayaranfunc(this,apiurl);
|
|
|
|
$('#pemb').text('RM ' + pjmnum);
|
|
$('#bpemb').text('RM ' + bakipjm);
|
|
|
|
if(lelong === 1)
|
|
{
|
|
$('#statuslelong').text('Akan Dilelong');
|
|
}else{
|
|
$('#statuslelong').text('-');
|
|
}
|
|
|
|
|
|
|
|
$('#norujukan_modal').val(norujukan);
|
|
$('#pinjaman_modal').val(pinjaman);
|
|
$('#tablemarhun').empty();
|
|
var bil_count = 0;
|
|
$.each(arraymarhun, function(index, marhun) {
|
|
$.each(marhun, function(index2, marhun_detail) {
|
|
|
|
var marhun_name;
|
|
$.ajax({
|
|
method: 'GET',
|
|
url: api_url + '/api/jemas/nama_marhun',
|
|
dataType: 'json',
|
|
data: {
|
|
marhun: marhun_detail['marhun']
|
|
},
|
|
success: function(marhun_ajax) {
|
|
bil_count++;
|
|
$("#tablemarhun").append("<tr><td>" + bil_count + "</td><td>" + marhun_ajax['descpt'] + "</td><td>" + marhun_detail['berat'] + "</td><td>" + marhun_detail['karat'] + "</td><td>RM " + marhun_detail['n_marhun'].toLocaleString(undefined, {
|
|
minimumFractionDigits: 2
|
|
}) + "</td><td>" + marhun_detail['nota'] + "</td></tr>");
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
if (document.addEventListener) {
|
|
window.addEventListener('pageshow', function(event) {
|
|
if (event.persisted || window.performance && window.performance.navigation.type == 2) {
|
|
$('#logout-form').submit();
|
|
// location.reload();
|
|
}
|
|
},
|
|
false);
|
|
}
|
|
</script>
|
|
|
|
@endsection
|
|
|
|
@push('js')
|
|
<script src="{{ asset('argon') }}/vendor/chart.js/dist/Chart.min.js"></script>
|
|
<script src="{{ asset('argon') }}/vendor/chart.js/dist/Chart.extension.js"></script>
|
|
@endpush
|