I have a table which contain two buttons, one is for uploading a file and the other one is for giving score. What I want to do is to give a condition for the second button which is the scoring button, whereby it can't be clicked (disabled) if there is no file uploaded. How can I achieve this?
Here is what my table looks like:
And here is my AdminController for the table
public function showpekerjaanppk(){
if(Auth::user()->status=='super'){
$pekerjaan = Pekerjaan::with('penyedia','user')->paginate();
return view('admin.showpekerjaan', compact('pekerjaan'));
}else{
$pekerjaan = Auth::user()->pekerjaans;
return view('admin.showpekerjaan', compact('pekerjaan'));
}
//return view('admin.showpekerjaan', compact('penyedia','pekerjaan','totalAvg'));
}
And here is my blade file for the table
<section >
<div >
<div >
<div >
<div >
<div >
@if (Auth::user()->status=='super')
<h3 ><b>{{$penyedia->nama}}</b></h3> <br>
<h3 >Nilai Total: <b>{{$totalAvg}}</b></h3>
@else
<h3 ><b></b></h3> <br>
<h3 ></b></h3>
@endif
<!-- /.card-header -->
<div >
<table id="tabelpekerjaan" >
<thead>
<tr>
<th style="width: 10px" rowspan="2">No.</th>
<th rowspan="2">Tanggal</th>
<th rowspan="2">Paket Pekerjaan</th>
<th rowspan="2">Nama Perusahaan</th>
<th rowspan="2">Lokasi Pekerjaan</th>
<th rowspan="2">PPK</th>
<th rowspan="2">Nilai Kontrak</th>
<th rowspan="2">Nilai</th>
<th rowspan="2">BAHP</th>
<th colspan="2">Aksi</th>
</tr>
<tr>
<td>BAHP</td>
<td>Nilai</td>
</tr>
</thead>
<tbody>
@php $no = 1; /*$totalNilai = 0.0;*/ @endphp
@foreach ($pekerjaan as $pekerjaans)
<tr>
<td>{{$no }}</td>
<td>{{$pekerjaans->tanggal}}</td>
<td>{{$pekerjaans->pekerjaan}}</td>
<td>{{$pekerjaans->penyedia->nama}}</td>
<td>{{$pekerjaans->lokasi}}</td>
<td>{{$pekerjaans->user->name}}</td>
<td>Rp. {{number_format($pekerjaans->nilai_kontrak,0,',',',')}}</td>
@php
$pekerjaans->nilai_total = $pekerjaans->nilai_1 $pekerjaans->nilai_2 $pekerjaans->nilai_3 $pekerjaans->nilai_4;
@endphp
<td>{{$pekerjaans->nilai_total}}</td>
<td>{{$pekerjaans->bahp}}</td>
<td>
<a href="/bahp/{{$pekerjaans->id}}" type="button" >Upload</a>
</td>
<td>
<a href="/nilai/{{$pekerjaans->id}}" type="button" >Penilaian</a> //disabled untill file uploaded
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
@if (Auth::user()->status=='super')
<div >
<a href="/datanilai_penyedia" type="button" >Kembali</a>
</div>
@endif
</div>
</section>
Thank you in advance.
CodePudding user response:
@if(isset($pekerjaans->yourFileCulmnName))
<td>
<a href="/nilai/{{$pekerjaans->id}}" type="button" >Penilaian</a> //disabled untill file uploaded
</td>
@endif