Files
lelong/resources/views/simulasi/listsagbycust.blade.php
T
2022-07-17 10:55:17 +08:00

244 lines
11 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col-md-11 mx-auto card p-4">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<div class="text-left pt-4">
<a href="{{ route('analisa.senaraimarhunlel',[$simulasi_id,$cawid]) }}" class="btn btn-success">Simulasi Lelong</a>
<a href="{{ route('analisa.listsagbycust',[$simulasi_id,'cawid'=>$cawid]) }}" class="btn btn-success">Senarai Mengikut Nama Pelangan</a>
</div>
<form id="deletesag" action="{{route('analisa.deletemarhunlel')}}" method="POST">
@csrf
<input type="hidden" name="simulasi_id" value="{{$simulasi_id}}">
<input type="hidden" name="cawid" value="{{$cawid}}">
<table class="table table-striped table-xl" id="marhun" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>Nama Pelanggan</th>
<th>No.KP</th>
<th>No.Rujukan</th>
<th>Tempoh</th>
<th>K.Tlh Byr(RM)</th>
<th>K.6Bulan(RM)</th>
<th>K.Semasa(RM)</th>
<th>Pembiayaan Asal(RM)</th>
<th>Baki Pembiayaan(RM)</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
<!-- <th>Harga Asas (RM)</th> -->
<!-- <th>Caj Lelong (%)</th>
<th>Baki Lelong (RM)</th> -->
<!-- <th>Tindakan</th> -->
</tr>
</thead>
<tbody>
@foreach ($marhuns as $index=> $marhun)
<tr>
<td>{{$loop->iteration}}</td>
<td style='word-wrap'>{{ $marhun['nama']['nama']}}</td>
<td style='word-wrap'>{{ $marhun['nokp']}}</td>
<td style='word-wrap'>@foreach ($marhun['listsag'] as $item)
{{$loop->iteration}}. {{ $item['norujukan'] }}<br>
@endforeach</td>
<td>@foreach ($marhun['listsag'] as $item)
{{ $item['tempoh'] }}<br>
@endforeach</td>
<td align = 'right'>
@php $jumktlhbyr = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumktlhbyr = $jumktlhbyr + $item['ktlhbyr'];
@endphp
{{ number_format($item['ktlhbyr'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumktlhbyr, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jum6bulan = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jum6bulan = $jum6bulan + $item['bakiupah'];
@endphp
{{ number_format($item['bakiupah'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jum6bulan, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jum6bulan = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jum6bulan = $jum6bulan + $item['keuntungan'];
@endphp
{{ number_format($item['keuntungan'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jum6bulan, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumpinjasal = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumpinjasal = $jumpinjasal + $item['pinjaman'];
@endphp
{{ number_format($item['pinjaman'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumpinjasal, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumpinjaman = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumpinjaman = $jumpinjaman + $item['bakipjm'];
@endphp
{{ number_format($item['bakipjm'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumpinjaman, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumberat = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumberat = $jumberat + $item['berat'];
@endphp
{{ number_format($item['berat'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumberat, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumnilaimarhun = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumnilaimarhun = $jumnilaimarhun + $item['nilaimarhun'];
@endphp
{{ number_format($item['nilaimarhun'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumnilaimarhun, 2, '.', ',') }}</strong>
</td>
<!-- <td align = 'right'>
@php $jumhargaasas = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumhargaasas = $jumhargaasas + $item['hargaasas'];
@endphp
{{ number_format($item['hargaasas'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumhargaasas, 2, '.', ',') }}</strong>
</td> -->
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
</div>
<script>
$("#btndelete").prop("disabled", true);
function btnDelete(e) {
var count = 0;
tablemarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
if($(this).prop('checked') === true)
{
count = count + 1;
}
// $(this).prop('checked', e.checked);
})
if(count != 0)
{
$("#btndelete").prop("disabled", false);
}
else
{
$("#btndelete").prop("disabled", true);
}
// let checkbox = $('#checkboxdata').val();
// console.log(checkbox)
// $("#btndelete").prop("disabled", checkboxdata.length === 0);
}
function confirm() {
$.confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'red',
typeAnimated: true,
buttons: {
Delete: {
btnClass: 'btn-danger',
action: function () {
$("#deletesag").submit();
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
}
var tablemarhun = $('#marhun').DataTable( {
"columnDefs": [
{
"targets": 13,
"orderable": false
},
// {
// "targets": 4,
// "orderable": false
// }
],
// order: [[1, 'asc']],
// "ordering": false,
"info": false,
"lengthChange": false,
"pageLength": 10000000,
dom: 'Bfrtip',
// buttons: [
// // 'copy', 'excel', 'pdf'
// // { text: 'copy', className: 'btn btn-primary' },
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm adduser',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Pengguna',
// action: function ( e, dt, node, config ) {
// alert( 'Button activated' );
// }
// },
// {
// className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
// titleAttr: 'Export to CSV',
// text: '<i class="fas fa-download"></i>',
// action: function ( e, dt, node, config ) {
// $("#exportform").submit();
// }
// }
// ]
});
</script>
@endsection