Files
lelong/resources/views/notisperingatan/shownotisperingatanall.blade.php

456 lines
21 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col">
<div class="card">
<div class="card-header header-style">
<a href="{{ route('notisperingatan.senarainotisall') }}" class="header-style-icon">
<i class="fas fa-arrow-left"></i>
</a>
<div class="header-style-title">
butiran Notis Peringatan
</div>
</div>
<div class="card-body">
@if ($message = Session::get('success'))
<div class="alert alert-success">
{{ $message }}
</div>
@endif
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-notis" role="tabpanel" aria-labelledby="nav-notis-tab">
<br>
<form id="exportform" action="{{route('lelong.exportkali')}}" method="POST">
@csrf
<input type="hidden" name="type" value="User">
{{-- {{dd($tarikhnotis)}} --}}
<input type="hidden" name="tarikhnotis" value="{{ $tarikhnotis }}">
<input type="hidden" name="notisid" value="{{ $notisid }}">
<div class="row">
<div class="col-md-12 col-lg">
<div class="form-group row">
<label class="col-6 col-form-label">Tarikh Notis</label>
<div class="col-6">
<div class="input-group">
<input type="text" readonly class="form-control bg-light" value=" @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikhnotis );
$t_lelong = $myDateTime->format('d-m-Y');
echo($t_lelong);
@endphp">
</div>
</div>
</div>
<div class="form-group row">
<label class="col-6 col-form-label">Bilangan Lelong</label>
<div class="col-6">
<div class="input-group">
<input type="text" readonly class="form-control bg-light" value=" {{$total_marhun}}">
</div>
</div>
</div>
<div class="form-group row">
<label class="col-6 col-form-label">Nilai Marhun Keseluruhan</label>
<div class="col-6">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">RM</div>
</div>
<input type="text" readonly class="form-control bg-light" value="{{ number_format($total_nilaimarhun, 2, '.', ',') }}">
</div>
</div>
</div>
<div class="form-group row">
<label class="col-6 col-form-label">Pembiayaan Keseluruhan</label>
<div class="col-6">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">RM</div>
</div>
<input type="text" readonly class="form-control bg-light" value="{{ number_format($total_pinjaman, 2, '.', ',') }}">
</div>
</div>
</div>
<div class="form-group row">
<label class="col-6 col-form-label">Keuntungan Keseluruhan</label>
<div class="col-6">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">RM</div>
</div>
<input type="text" readonly class="form-control bg-light" value="{{ number_format($total_bakiupah, 2, '.', ',') }}">
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
<div class="mb-3">
<a href=" {{ route('notisperingatan.kemaskinidatanotis',$tarikhnotis) }}" class="btn btn-outline-success">Kemaskini Data</a>
</div>
{{-- <button class="btn mb-5 btn-outline-success" type="submit">Muat Turun PDF</button> --}}
<div style="overflow-x:auto">
<table class="table text-right table-bordered" id="notis" style="width:100%">
<thead class="bg-primary text-white">
<tr class="text-center">
<th>No</th>
{{-- <th>T.Notis</th> --}}
<th>Cawangan</th>
<th>Bil SAG</th>
<th>Fasa</th>
<th>Dari JBG</th>
<th>Hingga JBG</th>
<th>Berat (gm)</th>
<th>Nilai Marhun Asal(RM)</th>
<th>Pembiayaan (RM)</th>
{{-- <th>Keuntungan (RM)</th> --}}
<th>Status</th>
<th>Surat Notis</th>
<th>Blast Whatsapp</th>
</tr>
</thead>
<tbody>
@foreach ($arraycaw as $index=>$caw)
<tr>
<td>{{$index+1}}</td>
{{-- <td style='white-space:nowrap;'>@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $caw['t_notis'] );
$t_lelong = $myDateTime->format('d-m-Y');
echo($t_lelong);
@endphp</td> --}}
<td style='white-space:nowrap;'><a href=" {{ route('notisperingatan.senaraimarhunnotis',['notisid'=>$caw['notis_id'],'cawid'=>$caw['id_cawangan']]) }} " style="color:#3490dc">{{ $caw['cawangan'] }}</a></td>
<td>{{ $caw['bil_marhun'] }}</td>
<td>{{ $caw['fasa'] }}</td>
<td>{{ $caw['daritempoh'] }}</td>
<td>{{ $caw['hinggatempoh'] }}</td>
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['n_marhun'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['pinjaman'], 2, '.', ',') }}</td>
{{-- <td>{{ number_format($caw['bakiupah'], 2, '.', ',') }}</td> --}}
{{-- {{dd($caw)}} --}}
<td>@if($caw['status'] == 1)
<span class="badge badge-pill badge-warning">
{{ 'Baru Daftar' }}
</span>
@elseif($caw['status'] == 2)
<span class="badge badge-pill badge-primary">
{{ 'Surat Notis' }}
</span>
@elseif($caw['status'] == 3)
<span class="badge badge-pill badge-success">
{{ 'Blast Whatsapp' }}
</span>
@endif
</td>
<td class="text-center">
@if($caw['fasa'] == 1)
<a class="confirmrefresh btn m-1 btn-info downloadFasa1" data-notisid="{{$caw['notis_id']}}" data-cawid="{{$caw['id_cawangan']}}" data-toggle="tooltip" data-placement="top" title="Muat Turun Notis Peringatan Fasa 1" style="margin-right:40px" ><i class="fas fa-download"></i></a>
@elseif($caw['fasa'] == 2)
<a class="confirmrefresh btn m-1 btn-info downloadFasa2" data-notisid="{{$caw['notis_id']}}" data-cawid="{{$caw['id_cawangan']}}" data-toggle="tooltip" data-placement="top" title="Muat Turun Notis Peringatan Fasa 2" style="margin-right:40px" ><i class="fas fa-download"></i></a>
@endif
</td>
<td class="text-center">
@if($caw['status'] == 2)
<a class="confirmrefresh btn m-1 btn-success" href="{{ route('notisperingatan.blastnotisperingatan',['notisid'=>$caw['notis_id'],'cawid'=>$caw['id_cawangan']]) }}" data-toggle="tooltip" data-placement="top" title="Blast Whatsapp" style="margin-right:40px" ><i class="fas fa-phone"></i></a>
@elseif($caw['status'] == 3)
SELESAI
@elseif($caw['status'] == 1)
BELUM POS DAFTAR
@endif
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="2"><b>JUMLAH KESELURUHAN</b></td>
<td><b>{{ $total_marhun }}</b></td>
<td></td>
<td></td>
<td></td>
<td><b>{{ number_format($total_berat, 2, '.', ',') }}</b></td>
<td><b>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</b></td>
<td><b>{{ number_format($total_pinjaman, 2, '.', ',') }}</b></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
</form>
</div>
</div>
<div class="modal fade" tabindex="-1" id="modalfilter">
<div class="modal-dialog modal-lg">
{{-- <div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Filter By</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div> --}}
<div class="modal-body">
<form action="{{ route('analisa.filter') }}" method="POST" id="formfilter">
@csrf
<div class="row justify-content-center">
<div class="col-md-8">
<div class="form-group row">
<input type="hidden" name="idmarhun" id="idmarhun" >
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="button" class="btn btn-primary" onclick="">Jana Semula notis</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$("#hideform").hide();
$('#btnsimpan').prop('disabled', true)
function kemaskini() {
var inputdata = $("td.input").find("input");
if(inputdata.length ==0)
{
$("td.input").each(function(index) {
// console.log(index)
var la = $(this).html();
// if(index%2 ==0 ) //even-0-2-4
// {
$(this).html("<input type='text' name='harga2[]' id=harga2"+index+" value="+la+" />");
// }
// else //odd-1-3-5-7
// {
// $(this).html("<input type='text' name='harga[]' id=harga"+index+" value="+la+" />");
// }
})
$("#hideform").show();
$("#btnkemaskini").hide();
}
else
{
$("td.input").each(function() {
var la = $(this).html();
$(this).html($(la).val());
})
$("#hideform").hide();
$("#btnkemaskini").show();
}
}
function calculate(e)
{
let hargaasasbaru = $('#txthargaasas').val();
let jeniskarat = $(e).data('jeniskarat');
// let maxcolumn = 2;
let count = 0;
let indexarray = 0;
$("td.input").each(function(index) {
if(hargaasasbaru)
{
$('#btnsimpan').prop('disabled', false)
// if(index%2 == 0)
// {
let harga1 = parseFloat(hargaasasbaru);
let harga2 = parseFloat(jeniskarat[indexarray]['dariharga916']);
let newhargaasas = harga1 + (harga2);
count++;
$('#harga2'+index).val(newhargaasas.toFixed(2));
// }
// else
// {
// let harga1 = parseInt(hargaasasbaru);
// let harga2 = parseInt(jeniskarat[indexarray]['dariharga916']);
// let newhargaasas = (harga1 + (harga2))/2.72;;
// count++;
// $('#harga'+index).val(newhargaasas.toFixed(2));
// }
// if(count == maxcolumn)
// {
// count = 0;
indexarray++;
// }
}
else
{
$('#btnsimpan').prop('disabled', true)
let dummy =0;
// if(index%2 == 0)
// {
$('#harga2'+index).val(dummy.toFixed(2));
// }
// else
// {
// $('#harga'+index).val(dummy.toFixed(2));
// }
}
})
}
function save(){
$('#formhargaasas').submit();
}
$('a.confirmdel').confirm({
title: 'Confirmation',
content: 'Anda pasti?',
type: 'orange',
typeAnimated: true,
buttons: {
Delete: {
btnClass: 'btn-warning',
action: function () {
location.href = this.$target.attr('href');
}
},
Batal: {
btnClass: 'btn-default',
action: function () {}
}
}
});
var tablenotis = $('#notis').DataTable( {
"columnDefs": [
{
"targets": 0,
"orderable": false
}
],
order: [[0, 'asc']],
// "ordering": false,
"searching":false,
"info": false,
"lengthChange": false,
"pageLength": 100,
dom: 'Bfrtip',
buttons: [
// {
// className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
// titleAttr: 'Download to PDF',
// text: '<i class="fas fa-download"></i>',
// action: function ( e, dt, node, config ) {
// $("#exportform").submit();
// }
// }
]
});
$('.addsim').tooltip();
$('.export').tooltip();
// $( '.dt-buttons').addClass('btn-group');
$( '.addsim').removeClass('dt-button');
$( '.export').removeClass('dt-button');
function selectall(cb) {
tablenotis.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
$(this).prop('checked', cb.checked);
})
}
$(".downloadFasa1").click(function(){
var notisid = $(this).data("notisid");
var cawid = $(this).data("cawid");
$.confirm({
content: function() {
var self = this;
var data = '';
return $.ajax({
method: 'GET',
url: "{{ route('notisperingatan.jananotisperingatan2') }}",
data: {
notisid: notisid,
cawid: cawid
},
xhrFields: {
responseType: 'blob'
},
}).done(function(response) {
var blob = new Blob([response]);
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "Penjanaan Notis Peringatan Fasa 1 " + notisid + ".pdf";
link.click();
self.setTitle('<span style="color:green;">Muat Turun Berjaya.</span>');
}).fail(function(response) {
console.log(response);
alert(response);
self.setTitle('<span style="color:red;">Gagal! Sila hubungi iT.</span>');
});
},
buttons: {
ok: {
keys: ['enter'],
action: function(){
location.reload();
}
},
}
});
});
$(".downloadFasa2").click(function(){
var notisid = $(this).data("notisid");
var cawid = $(this).data("cawid");
$.confirm({
content: function() {
var self = this;
var data = '';
return $.ajax({
method: 'GET',
url: "{{ route('notisperingatan.jananotisperingatan2fasa2') }}",
data: {
notisid: notisid,
cawid: cawid
},
xhrFields: {
responseType: 'blob'
},
}).done(function(response) {
var blob = new Blob([response]);
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = "Penjanaan Notis Peringatan Fasa 2 " + notisid + ".pdf";
link.click();
self.setTitle('<span style="color:green;">Muat Turun Berjaya.</span>');
}).fail(function(response) {
console.log(response);
alert(response);
self.setTitle('<span style="color:red;">Gagal! Sila hubungi iT.</span>');
});
},
buttons: {
ok: {
keys: ['enter'],
action: function(){
location.reload();
}
},
}
});
});
</script>
@endsection