342 lines
14 KiB
PHP
342 lines
14 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
@include('layouts.headers.cards')
|
|
@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
|
|
|
|
<!-- Header -->
|
|
<div class="header bg-primary pb-6">
|
|
<div class="container-fluid">
|
|
<div class="header-body">
|
|
<div class="row align-items-center py-4">
|
|
<div class="col-lg-6 col-7">
|
|
|
|
<nav aria-label="breadcrumb" class="d-none d-md-inline-block ml-md-4">
|
|
<ol class="breadcrumb breadcrumb-links breadcrumb-dark">
|
|
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fas fa-home"></i></a></li>
|
|
<li class="breadcrumb-item active" aria-current="page">Senarai Bayaran</li>
|
|
</ol>
|
|
</nav>
|
|
</div>
|
|
{{-- <div class="col-lg-6 col-5 text-right">
|
|
<a href="#" class="btn btn-sm btn-neutral">New</a>
|
|
<a href="#" class="btn btn-sm btn-neutral">Filters</a>
|
|
</div> --}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Page content -->
|
|
<div class="container-fluid mt--6">
|
|
<div class="row">
|
|
<div class="col">
|
|
|
|
<br>
|
|
<div class="container col-11 shadow-lg p-3 mb-5 bg-white rounded">
|
|
<!-- Card header -->
|
|
<div class="card-header border-0">
|
|
<h3 class="mb-0">Pembayaran SAG</h3>
|
|
</div>
|
|
|
|
|
|
<div class="nav-wrapper">
|
|
<ul class="nav nav-pills mt-4 " id="tabs-icons-text" role="tablist">
|
|
<li class="nav-item">
|
|
<a class="nav-link mb-sm-3 mb-md-0 active" id="tabs-icons-text-1-tab" data-toggle="tab" href="#tabs-icons-text-1" role="tab" aria-controls="tabs-icons-text-1" aria-selected="true">Ar-Rahn</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link mb-sm-3 mb-md-0" id="tabs-icons-text-2-tab" data-toggle="tab" href="#tabs-icons-text-2" role="tab" aria-controls="tabs-icons-text-2" aria-selected="false">Tawarruq</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<form method="post" action="{{ route('payment.action') }}" onsubmit="return validateform()">
|
|
@csrf
|
|
<div class="card shadow">
|
|
<div class="card-body">
|
|
<div class="tab-content" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="tabs-icons-text-1" role="tabpanel" aria-labelledby="tabs-icons-text-1-tab">
|
|
<div class="table-responsive table-striped">
|
|
<table class="table align-items-center table-flush" id="belum_tawarruq">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th>No Rujukan</th>
|
|
<th>Pembiayaan</th>
|
|
<th>Tempoh Simpan</th>
|
|
<th>Upah telah bayar</th>
|
|
<th>Upah semasa</th>
|
|
<th>Tindakan</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="list">
|
|
@foreach($belum_tebus as $index=>$bt)
|
|
@if($bt['hargajualan'] == '')
|
|
@php
|
|
|
|
$koskeuntungan = Http::get(config('api.url') . '/api/upahbukantawarruq/' . $bt['kodcaw'] . '/' . $bt['norujukan'])->json();
|
|
$searchonline = Http::get(config('api.url') . '/portal/searchsagonline/',['norujukan' => $bt['norujukan']])->json();
|
|
|
|
$searchLelong = Http::get(config('api.url').'/api/search/lelong',[
|
|
'kodcaw' => $bt['kodcaw'],
|
|
'norujukan' => $bt['norujukan']
|
|
])->json();
|
|
|
|
$tarikh_hari_ini = Carbon\Carbon::now()->toDateString();
|
|
|
|
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.'
|
|
}
|
|
}
|
|
@endphp
|
|
<tr {{ ($searchonline) ? 'style=background-color:#81ecec;' : '' }}>
|
|
<td scope="row">
|
|
<div class="media align-items-center">
|
|
<div class="media-body">
|
|
@php
|
|
$marhun = Http::get(config('api.url') . '/api/marhun/' . $bt['norujukan'] )->json();
|
|
@endphp
|
|
<a href="#" class="linktarget" data-toggle="modal" 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>
|
|
</td>
|
|
<td>
|
|
{{ number_format($bt['pinjaman'],2) }}
|
|
</td>
|
|
<td>
|
|
{{ number_format($bt['tempoh'],2) }}
|
|
</td>
|
|
<td>
|
|
{{ number_format($bt['telahbayar'],2) }}
|
|
</td>
|
|
<td>
|
|
{{ number_format($koskeuntungan,2) }}
|
|
</td>
|
|
<td>
|
|
<input type="checkbox" name="chkboxsag[]" value="{{ $bt['norujukan'] }}" id="sag-{{ $loop->iteration }}" data-norujukan="{{ $bt['norujukan'] }}" {{ ($searchonline || $koskeuntungan <= 0) ? 'disabled' : '' }} />
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="tab-pane fade" id="tabs-icons-text-2" role="tabpanel" aria-labelledby="tabs-icons-text-2-tab">
|
|
|
|
<!-- Light table -->
|
|
<div class="table-responsive table-striped">
|
|
<table class="table align-items-center table-flush" id="selepas_tawarruq">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th>No Rujukan</th>
|
|
<th>Pembiayaan</th>
|
|
<th>B. Pembiayaan</th>
|
|
<th>Keuntungan (6bulan)</th>
|
|
<th>Keuntungan</th>
|
|
<th>Tindakan</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="list">
|
|
@foreach($belum_tebus as $index=>$bt)
|
|
@if($bt['hargajualan'] != '')
|
|
@php
|
|
$searchonline = Http::get(config('api.url') . '/portal/searchsagonline/',['norujukan' => $bt['norujukan']])->json();
|
|
|
|
$searchLelong = Http::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::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;' : '' }}>
|
|
<th scope="row">
|
|
<div class="media align-items-center">
|
|
<div class="media-body">
|
|
@php
|
|
$marhun = Http::get(config('api.url') . '/api/marhun/' . $bt['norujukan'] )->json();
|
|
@endphp
|
|
<a href="#" class="linktarget" data-toggle="modal" 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>
|
|
{{ number_format($bt['pinjaman'],2) }}
|
|
</td>
|
|
<td>
|
|
{{ number_format($bt['bakipjm'],2) }}
|
|
</td>
|
|
<td>
|
|
{{ number_format($bt['bakiupah'],2) }}
|
|
</td>
|
|
<td>
|
|
{{ number_format($koskeuntungan,2) }}
|
|
</td>
|
|
<td>
|
|
<input type="checkbox" name="chkboxsag[]" value="{{ $bt['norujukan'] }}" id="sag-{{ $loop->iteration }}" data-norujukan="{{ $bt['norujukan'] }}" {{ ($searchonline || $koskeuntungan <= 0) ? 'disabled' : '' }} />
|
|
{{-- <i data-toggle="tooltip" title="Hooray!" class="fas fa-exclamation-circle ml-3 text-right" style="font-size: 20px;"></i> --}}
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<br>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-end mt-2">
|
|
<button type="submit" class="btn btn-primary" onclick="loadingbtn();">Checkout<span class="rounded bg-red ml-2 pr-1 pl-1" id="totalsag">0</span></button>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
var belumtawarruqtable = $('#belum_tawarruq').DataTable({
|
|
"bLengthChange": false,
|
|
"bFilter": true,
|
|
"bInfo": false,
|
|
language: {
|
|
'paginate': {
|
|
'previous': '<span class="fas fa-backward"></span>',
|
|
'next': '<span class="fas fa-forward"></span>'
|
|
}
|
|
}
|
|
});
|
|
|
|
var selepastawarruqtable = $('#selepas_tawarruq').DataTable({
|
|
"bLengthChange": false,
|
|
"bFilter": true,
|
|
"bInfo": false,
|
|
language: {
|
|
'paginate': {
|
|
'previous': '<span class="fas fa-backward"></span>',
|
|
'next': '<span class="fas fa-forward"></span>'
|
|
}
|
|
}
|
|
});
|
|
|
|
$("input[type='checkbox'][name='chkboxsag[]']").click(function() {
|
|
var count = parseInt($('#totalsag').text());
|
|
if ($(this).is(':checked')) {
|
|
var total = count + 1;
|
|
$('#totalsag').text(total);
|
|
} 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');
|
|
|
|
$('#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 |