tangguh lelong operasi

This commit is contained in:
Amir
2022-07-24 15:05:07 +08:00
parent ab93b87dbb
commit bea531c835
2 changed files with 108 additions and 150 deletions
+17 -5
View File
@@ -39,6 +39,7 @@ use App\Models\Negeri;
use Carbon\Carbon;
use App\Models\LelongTebus;
use App\Models\TangguhLelong;
use App\Models\Tetapan;
use App\Models\TransaksiKeuntungan;
@@ -1065,7 +1066,8 @@ class LelongController extends Controller
}
public function deletemarhun(Request $request){
// dd($request->checkboxdata);
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateTimeString();
$data = $request->checkboxdata;
foreach($data as $index=>$norujukan)
{
@@ -1074,13 +1076,23 @@ class LelongController extends Controller
$currentdate = $currentdate->toDateTimeString();
$marhun = LelongBid::where('norujukan','=',$norujukan)->first();
$marhunTangguhLelong = new TangguhLelong;
$marhunTangguhLelong->lelong_id = $marhun->lelong_id;
$marhunTangguhLelong->lelongbid_id = $marhun->id; //lelongbid_id
$marhunTangguhLelong->norujukan = $marhun->norujukan;
$marhunTangguhLelong->pinjaman = $marhun->pinjaman;
$marhunTangguhLelong->tarikhtangguh = $currentdate; //tarikhtangguh
$marhunTangguhLelong->ditangguh_oleh = $user->id; //ditangguh_oleh
$marhunTangguhLelong->ditangguh_pada = $currentdate; //ditangguh_oleh
$marhunTangguhLelong->nota = "Ditangguh Oleh Operasi (" . $user->name . ")"; //ditangguh_oleh
$marhunTangguhLelong->save();
$marhun->delete();
$updategadai = Gadai::where('norujukan','=', $norujukan)->first();
$updategadai->taglel = 0;
$updategadai->save();
// $updategadai = Gadai::where('norujukan','=', $norujukan)->first();
// $updategadai->taglel = 0;
// $updategadai->save();
//insert loguser
$loguser = new LogUser;
$loguser->user_id = $user->id;
$loguser->date = $currentdate;
+91 -145
View File
@@ -7,43 +7,45 @@
<div class="col-md-11 mx-auto card p-4">
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<button type="button" class="btn btn-light" ><a href="javascript:window.history.go(-1);"><h3><i class="fas fa-arrow-alt-circle-left"></i></h3></a></button>
</div>
<table cellspacing="" cellpadding="4" text-align="left" border="0" height="25" align="left" id="sim" class="table table-striped table-xl">
<thead class="bg-light ">
@foreach ($arrayinfo as $laporan)
<tr>
<td><b>ID Lelong: {{ $laporan['laporan']['lelong_id']}} <b></td>
<td><b>Fasa Lelong: {{ $laporan['laporan']['fasa']}} <b></td>
<td><b>Tarikh Lelong : @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $laporan['laporan']['tarikh_lelong'] );
$datez = $myDateTime->format('d-m-Y');
echo($datez);
@endphp</b></td>
@foreach($laporan['details'] as $details)
<td><b>Nama Cawangan : {{ $details['caw_name']}}</b></td>
<td><b>Kod Cawangan : {{ $details['caw_code']}}</b></td>
@endforeach
</tr>
@endforeach
</thead>
</table>
<button type="button" class="btn btn-light"><a href="javascript:window.history.go(-1);">
<h3><i class="fas fa-arrow-alt-circle-left"></i></h3>
</a></button>
</div>
<table cellspacing="" cellpadding="4" text-align="left" border="0" height="25" align="left" id="sim" class="table table-striped table-xl">
<thead class="bg-light ">
@foreach ($arrayinfo as $laporan)
<tr>
<td><b>ID Lelong: {{ $laporan['laporan']['lelong_id']}} <b></td>
<td><b>Fasa Lelong: {{ $laporan['laporan']['fasa']}} <b></td>
<td><b>Tarikh Lelong : @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $laporan['laporan']['tarikh_lelong'] );
$datez = $myDateTime->format('d-m-Y');
echo($datez);
@endphp</b></td>
@foreach($laporan['details'] as $details)
<td><b>Nama Cawangan : {{ $details['caw_name']}}</b></td>
<td><b>Kod Cawangan : {{ $details['caw_code']}}</b></td>
@endforeach
</tr>
@endforeach
</thead>
</table>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<div class="text-left pt-4">
<a href="{{ route('lelong.senaraimarhunsimulasi',[$lelongid,$cawid]) }}" class="btn btn-success">Simulasi Lelong</a>
<a href="{{ route('lelong.listsagbycust',[$lelongid,$cawid]) }}" class="btn btn-success">Senarai Mengikut Nama Pelangan</a>
<a href="{{ route('lelong.senaraimarhunsimulasi',[$lelongid,$cawid]) }}" class="btn btn-success">Simulasi Lelong</a>
<a href="{{ route('lelong.listsagbycust',[$lelongid,$cawid]) }}" class="btn btn-success">Senarai Mengikut Nama Pelangan</a>
</div>
</div>
<form id="deletesag" action="{{route('lelong.deletemarhun')}}" method="POST">
@csrf
<input type="hidden" name="lelongid" value="{{$lelongid}}">
@@ -52,8 +54,8 @@
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>No Rujukan</th>
<th>Nama Pelanggan</th>
<th>No Rujukan</th>
<th>Nama Pelanggan</th>
<th>Tempoh</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
@@ -68,133 +70,77 @@
</thead>
<tbody>
@foreach ($arraymarhun as $index=> $marhun)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $marhun['norujukan']}}</td>
<td>{{ $marhun['nama']}}</td>
<td>{{ number_format($marhun['tempoh'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['bakiupah'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['cajlelong'], 2, '.', ',') }}</td>
<?php
$rugi = 0;
$baki = 0;
if(strpos($marhun['baki'], '-') !== false)
{
$rugi = $marhun['baki'];
}
else {
$baki = $marhun['baki'];
}
?>
<td>{{number_format($rugi, 2, '.', ',')}}</td>
<td>{{number_format($baki, 2, '.', ',')}}</td>
<td class="text-center">
<input type="checkbox" aria-label="Checkbox for following text input" onclick="btnDelete(this)" name="checkboxdata[]" value="{{ $marhun['norujukan'] }}">
</td>
</tr>
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $marhun['norujukan']}}</td>
<td>{{ $marhun['nama']}}</td>
<td>{{ number_format($marhun['tempoh'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['bakiupah'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['cajlelong'], 2, '.', ',') }}</td>
<?php
$rugi = 0;
$baki = 0;
if (strpos($marhun['baki'], '-') !== false) {
$rugi = $marhun['baki'];
} else {
$baki = $marhun['baki'];
}
?>
<td>{{number_format($rugi, 2, '.', ',')}}</td>
<td>{{number_format($baki, 2, '.', ',')}}</td>
<td class="text-center">
<input type="checkbox" aria-label="Checkbox for following text input" id="checkboxdata[]" name="checkboxdata[]" value="{{ $marhun['norujukan'] }}">
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="text-right pt-4">
{{-- <a href="{{ route('lelong.show',$lelongid) }}" class="btn btn-primary">Kembali</a> --}}
<button type="button" class="btn btn-danger" id="btndelete" onclick="confirm()">Hapus</button>
<button type="button" class="btn btn-danger" onclick="confirm()">Hapus</button>
</div>
{{-- <a href="{{url('lelong/senarailelong')}}" class="btn btn-primary">Kembali</a> --}}
</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();
title: 'Confirmation',
content: 'Anda pasti?',
type: 'red',
typeAnimated: true,
buttons: {
Delete: {
btnClass: 'btn-danger',
action: function() {
$("#deletesag").submit();
}
},
Batal: {
btnClass: 'btn-default',
action: function() {}
}
},
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": 999999,
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();
// }
// }
// ]
});
var tablemarhun = $('#marhun').DataTable({
"info": false,
"lengthChange": false,
"pageLength": 999999,
dom: 'Bfrtip',
});
</script>
@endsection
@endsection