Files
lelong/resources/views/marhun/lihatubahmutumarhun.blade.php
T
Nur Izzati Zulkifli 45295a30c3 update space (RM)
2023-03-03 17:33:43 +08:00

420 lines
25 KiB
PHP

@extends('layouts.app')
@section('content')
<env name="TELESCOPE_ENABLED" value="false"/>
<div class="container-fluid">
<div class="row ">
<div class="col mx-auto p-4">
<div class="card">
<div class="card-header header-style">
<a href="javascript:window.history.go(-1);" class="header-style-icon">
<i class="fas fa-arrow-left"></i>
</a>
<div class="header-style-title">
Perubahan Semakan Marhun
</div>
</div>
<div class="card-body">
<form action="{{ route('pengesahan.terimaperubahan') }}" method="POST" id="formmutumarhun">
@csrf
<input type="hidden" name="norujukan" value="{{ $norujukan }}" />
<input type="hidden" name="lelong_id" value="{{ $id }}" />
<input type="hidden" name="lelongbid_id" value="{{ $lelongbid['id'] }}" />
<input type="hidden" name="jenis_button" value="terima" id="jenis_button" />
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<div class="container">
{{-- <a href="{{ route('pengesahan.perubahanmutumarhun', $id) }}" class="btn btn-primary">Kembali</a> --}}
<div class="row">
<div class="col-6 col-sm-4">
<p> <b>No Rujukan : </b> {{ $lelongbid->norujukan }}</p>
<p> <b>Tempoh : </b> {{ $lelongbid->jbg }}</p>
<p> <b>Kod Cawangan : </b> {{ $lelongbid->kodcaw }}</p>
</div>
<div class="col-6 col-sm-4">
<p> <b>Harga Asas (RM) : </b>{{ number_format($marhuns[0]['totalnewhargaasas'], 2, '.', ',') }}</p>
<p> <b>Pembiayaan (RM) : </b> {{ number_format($marhuns[0]['pembiayaan'], 2, '.', ',') }}</p>
<p> <b>Keuntungan (RM) : </b> {{ number_format($marhuns[0]['bakiupah'], 2, '.', ',') }}</p>
{{-- <p> <b>Caj Lelong(RM) : </b> {{ number_format($marhuns[0]['cajlelong'], 2, '.', ',') }}</p>
<p> <b>Baki Lelong(RM) : </b>{{ number_format($marhuns[0]['baki_lelong'], 2, '.', ',') }}</p>
<p> <b>Rugi Lelong(RM) : </b>{{ number_format($marhuns[0]['rugi_lelong'], 2, '.', ',') }}</p> --}}
</div>
<div class="col-6 col-sm-4">
{{-- <p> <b>Hargaasas(RM) : </b>{{ number_format($marhuns[0]['totalnewhargaasas'], 2, '.', ',') }}</p>
<p> <b>Pembiayaan(RM) : </b> {{ number_format($marhuns[0]['pembiayaan'], 2, '.', ',') }}</p>
<p> <b>Keuntungan(RM) : </b> {{ number_format($marhuns[0]['bakiupah'], 2, '.', ',') }}</p> --}}
<p> <b>Caj Lelong (RM) : </b> {{ number_format($marhuns[0]['cajlelong'], 2, '.', ',') }}</p>
<p> <b>Baki Lelong (RM) : </b>{{ number_format($marhuns[0]['baki_lelong'], 2, '.', ',') }}</p>
<p> <b>Rugi Lelong (RM) : </b>{{ number_format($marhuns[0]['rugi_lelong'], 2, '.', ',') }}</p>
</div>
</div>
</div>
<table class='table text-center table-bordered table-hover' id="tablemutumarhun" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>Marhun</th>
<th>Karat </th>
<th>Berat (gm)</th>
{{-- <th>Harga Gadai (RM)/gm</th> --}}
<th>Harga Lelong (RM)</th>
<th>N. Marhun Asal</th>
{{-- <th>N. Marhun Lelong</th> --}}
<th>Harga Asas</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@php $sumhargaasas = 0 @endphp
@foreach($arraylelbidmarhun as $index1=>$detail)
{{-- {{dd($detail[0]['marhun'])}} --}}
<tr>
<td>{{ $loop->iteration }}</td>
<td>
@if(empty($detail[0]['status_ubah']['status_ubah']))
{{ $detail[0]['old_marhun'] }}
@elseif(!empty($detail[0]['status_ubah']['status_ubah']))
@if($detail[0]['status_ubah']['request_marhun'] == NULL)
{{ $detail[0]['old_marhun'] }}
@elseif($detail[0]['old_marhun'] != $detail[0]['status_ubah']['request_marhun'])
{{ $detail[0]['old_marhun'] }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i>{{ $detail[0]['status_ubah']['request_marhun'] }}
@elseif($detail[0]['old_marhun'] == $detail[0]['status_ubah']['request_marhun'])
{{ $detail[0]['old_marhun'] }}
@else
{{ $detail[0]['old_marhun'] }}
@endif
@endif
{{-- {{ $detail[0]['status_ubah'] }} --}}
</td>
<td class="col-2">
@if(empty($detail[0]['status_ubah']['status_ubah']))
{{ $detail[0]['old_karat'] }}
@elseif(!empty($detail[0]['status_ubah']['status_ubah']))
@if($detail[0]['status_ubah']['request_karat'] == NULL)
{{ $detail[0]['old_karat'] }}
@elseif($detail[0]['old_karat'] != $detail[0]['status_ubah']['request_karat'])
{{ $detail[0]['old_karat'] }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> {{ $detail[0]['status_ubah']['request_karat'] }}
@elseif($detail[0]['old_karat'] == $detail[0]['status_ubah']['request_karat'])
{{ $detail[0]['old_karat'] }}
@endif
@endif
{{-- {{ $detail[0]['karat'] }} --}}
</td>
<td class="col-2">
@if(empty($detail[0]['status_ubah']['status_ubah']))
{{ $detail[0]['old_berat'] }}
@elseif(!empty($detail[0]['status_ubah']['status_ubah']))
@if($detail[0]['status_ubah']['request_berat'] == NULL)
{{ $detail[0]['old_berat'] }}
@elseif($detail[0]['old_berat'] != $detail[0]['status_ubah']['request_berat'])
{{ $detail[0]['old_berat'] }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> {{ $detail[0]['status_ubah']['request_berat'] }}
@elseif($detail[0]['old_berat'] == $detail[0]['status_ubah']['request_berat'])
{{ $detail[0]['old_berat'] }}
@endif
@endif
{{-- {{ $detail[0]['berat'] }} --}}
</td>
{{-- <td>
@if(empty($gadai[$index1]['harga']))
-
@elseif(!empty($gadai[$index1]['harga']))
{{ number_format ($gadai[$index1]['harga'], 2, '.', ',') }}
@endif
</td> --}}
<td>
{{-- {{dd($detail[0]['karatnew']['harga2'])}} --}}
@if(empty($detail[0]['status_ubah']['status_ubah']))
{{number_format($detail[0]['harga'], 2, '.', ',') }}
@elseif(!empty($detail[0]['status_ubah']['status_ubah']))
@if($detail[0]['status_ubah']['status_ubah'] == 8)
{{-- {{ number_format($detail[0]['old_harga'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{number_format($detail[0]['karatnew']['harga2'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 9)
{{-- {{ number_format($detail[0]['old_harga'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{number_format($detail[0]['karatnew']['harga2'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 10)
{{-- {{ number_format($detail[0]['old_harga'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{number_format($detail[0]['harga'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 5)
{{-- {{ number_format($detail[0]['old_harga'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{number_format($detail[0]['karatnew']['harga2'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 1)
{{-- {{ number_format($detail[0]['old_harga'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{number_format($detail[0]['karatnew']['harga2'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 4)
{{-- {{ number_format($detail[0]['old_harga'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{number_format($detail[0]['harga'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 7)
{{number_format($detail[0]['harga'], 2, '.', ',') }}
@else
{{number_format($detail[0]['harga'], 2, '.', ',') }}
@endif
@endif
</td>
<td>@if(empty($gadai[$index1]['n_marhun']))
-
@elseif(!empty($gadai[$index1]['n_marhun']))
{{ number_format($gadai[$index1]['n_marhun'], 2, '.', ',') }}
@endif
</td>
<td>
{{-- {{dd($detail[0]['karatnew']['harga2'])}} --}}
@if(empty($detail[0]['status_ubah']['status_ubah']))
{{ number_format($detail[0]['hargaasas'], 2, '.', ',') }}
@elseif(!empty($detail[0]['status_ubah']['status_ubah']))
@if($detail[0]['status_ubah']['status_ubah'] == 8)
{{-- @php
$newhargaasas = bcdiv($detail[0]['status_ubah']['request_berat'] * $detail[0]['karatnew']['harga2'], 1);
@endphp --}}
{{-- {{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 9)
{{-- {{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 10)
{{-- {{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 5)
{{-- {{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 1)
{{-- {{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 4)
{{-- {{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i> --}}
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 7)
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@elseif($detail[0]['status_ubah']['status_ubah'] == 3)
{{ number_format($detail[0]['old_hargaasas'], 2, '.', ',') }}
@else
{{ number_format($detail[0]['newhargaasas'], 2, '.', ',') }}
@endif
@endif
</td>
<td>
{{-- {{dd($detail[$index1]['status_ubah']['status_ubah'])}} --}}
@if(empty($detail[0]['status_ubah']['status_ubah']))
<button class="btn btn-info btn-sm hovernone-info" disabled>TIADA PERUBAHAN</button>
@elseif(!empty($detail[0]['status_ubah']['status_ubah']))
@if($detail[0]['status_ubah']['status_ubah'] == 8)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN MUTU,BERAT & MARHUN</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 10)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN BERAT & MARHUN</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 9)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN MUTU & MARHUN</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 5)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN MUTU & BERAT</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 1)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN MUTU</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 4)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN BERAT</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 7)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN MARHUN</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 3)
<button class="btn btn-danger btn-sm hovernone-danger" disabled>MOHON HAPUS MARHUN</button>
@elseif($detail[0]['status_ubah']['status_ubah']== 2)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENAMBAHAN MARHUN</button>
@else
<button class="btn btn-warning btn-sm hovernone-warning" disabled>TIADA PERUBAHAN</button>
@endif
@endif
</td>
{{-- <td>
@if(isset($detail[0]['status_ubah']['status_ubah']) == 1)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PERUBAHAN MUTU</button>
@elseif(isset($detail[0]['status_ubah']['status_ubah']) == 2)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENAMBAHAN MARHUN</button>
@elseif(isset($detail[0]['status_ubah']['status_ubah'])== 3)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENGHAPUSAN MARHUN</button>
@elseif(isset($detail[0]['status_ubah']['status_ubah']) == 4)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENGURANGAN BERAT</button>
@elseif(isset($detail[0]['status_ubah']['status_ubah']) == 5)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENGURANGAN MUTU & BERAT</button>
@else
<button class="btn btn-warning btn-sm hovernone-warning" disabled>TIADA PERUBAHAN</button>
@endif
</td> --}}
</tr>
{{-- @php $sumhargaasas += $newhargaasas @endphp --}}
{{-- {{ $sumhargaasas }} --}}
@endforeach
</tbody>
</table>
<div class="modal-footer" style="margin-top:2%;">
{{-- <button type="button" class="btn btn-danger" onclick="functerima(this)" id="tidaksah" >Tidak Sah</button> --}}
{{-- <button type="button" class="btn btn-success" onclick="functerima(this)" id="terima" >Sahkan</button> --}}
</div>
</form>
</div>
<div class="modal fade" data-backdrop="static" tabindex="-1" id="modalremark">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Tangguh Lelong</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('pengesahan.terimaperubahan') }}" method="POST" id="formremark">
@csrf
<input type="hidden" name="norujukan" value="{{ $norujukan }}" />
<input type="hidden" name="kodcaw" value="{{ $lelongbid->kodcaw }}" />
<input type="hidden" name="lelong_id" value="{{ $id }}" />
<input type="hidden" name="lelongbid_id" value="{{ $lelongbid->id }}" />
<input type="hidden" name="jenis_button" value="tangguhlelong" id="jenis_button" />
<div class="form-group">
<label for="message-text" class="col-form-label" style="font-color:red;* "><b>Sila Pilih Sebab Tangguh Lelong:</b></label>
<br>
<br>
<input type="radio" checked onclick="selectRugiBesar()" id="mutu" name="nota" value="Perubahan Mutu Tinggi">
<label for="mutu">Perubahan Mutu Tinggi</label><br>
<input type="radio" onclick="selectRugiBesar()" id="berat" name="nota" value="Perubahan Berat Besar">
<label for="berat">Perubahan Berat Besar</label><br>
<input type="radio" onclick="selectRugiBesar()" id="rugi" name="nota" value="Rugi Besar">
<label for="rugi">Rugi Besar</label><br>
<input type="radio" name="nota" onclick="selectLain()">
<label for="lainlain">Lain-lain</label><br>
<textarea class="form-control" name="nota" disabled id="lainlain" style="width: 100%;" rows="3"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" style="width:15%;" onclick="selectRugiBesar()" data-dismiss="modal">Batal</button>
<button type="button" class="btn btn-primary" style="width:15%;" onclick="submit(this)">Sahkan</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function selectLain() {
$("#lainlain").attr("disabled", false);
}
function selectRugiBesar() {
$("#lainlain").attr("disabled", true);
$("#lainlain").val("");
}
//Enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
function functerima(e){
let jenis=event.target.id;
if(jenis == "terima")
{
$('#jenis_button').val(jenis);
$("#formmutumarhun").submit();
}
else if(jenis == "tangguhlelong")
{
$('#jenis_button').val(jenis);
$('#modalremark').modal('show');
let idmarhun = $(e).data('idmarhun');
let norujukan = $(e).data('norujukan');
$('#idmarhun').val(idmarhun);
$('#norujukan').val(norujukan);
console.log(idmarhun, norujukan);
// $("#formmutumarhun").submit();
}
else if(jenis == "tidaksah")
{
$('#jenis_button').val(jenis);
$("#formmutumarhun").submit();
}
}
function submit(e)
{
let idmarhun = $(e).data('idmarhun');
let norujukan = $(e).data('norujukan');
$('#idmarhun').val(idmarhun);
$('#norujukan').val(norujukan);
$("#formremark").submit();
}
var tablemutumarhun = $('#tablemutumarhun').DataTable( {
"columnDefs": [
{
"targets": 0,
"orderable": false
},
{
"targets": 9,
"orderable": true
}
],
order: [[0, 'asc']],
// "ordering": false,
"info": false,
"lengthChange": false,
// "pageLength": 15,
"paginate" : false,
// dom: 'Bfrtip',
// buttons: [
// // 'copy', 'excel', 'pdf'
// // { text: 'copy', className: 'btn btn-primary' },
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm addsim',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Simulasi',
// 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();
// }
// }
// ]
});
// $('.addsim').tooltip();
// $('.export').tooltip();
// // $( '.dt-buttons').addClass('btn-group');
// $( '.addsim').removeClass('dt-button');
// $( '.export').removeClass('dt-button');
// function selectall(cb) {
// tablemutumarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
// $(this).prop('checked', cb.checked);
// })
// }
</script>
@endsection