Files
erahn-click/resources/views/pembayaran/senaraibayaran.blade.php
T
hafifierahman 2b53de7007 fix skit2
2021-09-27 10:59:10 +08:00

209 lines
7.7 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>
<form method="post" action="{{ route('payment.action') }}" onsubmit="return validateform()">
@csrf
<!-- Light table -->
<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>Keuntungan</th>
<th>Nilai Marhun</th>
<th>Berat</th>
<th>Marhun</th>
<th>JBG</th>
<th>Kadar Upah</th>
<th>Tindakan</th>
</tr>
</thead>
<tbody class="list">
@foreach($belum_tebus as $index=>$bt)
@if($bt['hargajualan'] != '')
<tr>
<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['bakiupah'],2) }}
</td>
<td>
{{ number_format($bt['nilaimarhun'],2) }}
</td>
<td>
{{ number_format($bt['berat'],2) }}
</td>
<td>
{{ $bt['marhun'] }}
</td>
<td>
{{ number_format($bt['jbg'],2) }}
</td>
<td>
{{ number_format($bt['kadarupah'],2) }}
</td>
<td>
<input type="checkbox" name="chkboxsag[]" value="{{ $bt['norujukan'] }}" id="sag-{{ $loop->iteration }}" data-norujukan="{{ $bt['norujukan'] }}"/>
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<br>
<div class="d-flex justify-content-end">
<button type="submit" class="btn btn-primary">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>'
}
}
});
$("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>");
}
});
});
});
});
</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