Files
lelong/resources/views/simulasi/listsagbycust.blade.php
T
2022-07-07 12:01:07 +08:00

225 lines
10 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.listsagbycust',[$simulasi_id,'cawid'=>$cawid]) }}" class="btn btn-success">Senarai 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.Rujukan</th>
<th>Tempoh</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
<th>Harga Asas (RM)</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan (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'>@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 $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>
<td align = 'right'>
@php $jumpinjaman = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumpinjaman = $jumpinjaman + $item['pinjaman'];
@endphp
{{ number_format($item['pinjaman'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumpinjaman, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumbakiupah = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumbakiupah = $jumbakiupah + $item['bakiupah'];
@endphp
{{ number_format($item['bakiupah'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumbakiupah, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumcajlelong = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumcajlelong = $jumcajlelong + $item['cajlelong'];
@endphp
{{ number_format($item['cajlelong'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumcajlelong, 2, '.', ',') }}</strong>
</td>
<td align = 'right'>
@php $jumbaki = 0;@endphp
@foreach ($marhun['listsag'] as $item)
@php
$jumbaki = $jumbaki + $item['baki'];
@endphp
{{ number_format($item['baki'], 2, '.', ',') }}<br>
@endforeach
<strong>Total: {{ number_format($jumbaki, 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