MIF_E31210400/resources/views/admin/app/content/analisa/alternatif.blade.php

94 lines
4.7 KiB
PHP

@include('components.theme.pages.header')
<section>
<div class="row mb-4">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-primary">Analisa Alternatif</h6>
</div>
<div class="card-body">
<form method="post" action="{{ route('analisa.alternatif.tabel', $id_kriteria) }}">
@csrf
<?php
$jumlah = \App\Models\Alternatif::count();
foreach (\App\Models\Alternatif::all() as $key => $value) {
$pilihan_alternatif[] = $value['nama_alternatif'];
}
$n = $jumlah;
?>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th colspan="2" class="align-middle text-center">Alternatif manakah yang lebih baik ?</th>
<th>Nilai Perbandingan</th>
</tr>
</thead>
<tbody>
<?php
$urut = 0;
for ($x = 0; $x <= ($n - 2); $x++) {
for ($y = ($x + 1); $y <= ($n - 1); $y++) {
$urut++;
?>
<tr>
<td>
<div class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="pilih<?php echo $urut ?>" id="pilih1<?php echo $urut ?>" value="1" checked="">
<label class="custom-control-label" for="pilih1<?php echo $urut ?>"><?php echo $pilihan_alternatif[$x] ?></label>
</div>
</td>
<td>
<div class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="pilih<?php echo $urut ?>" id="pilih2<?php echo $urut ?>" value="2">
<label class="custom-control-label" for="pilih2<?php echo $urut ?>"><?php echo $pilihan_alternatif[$y] ?></label>
</div>
</td>
<td width="20%">
<?php
$nilai = getNilaiPerbandinganAlternatif($x, $y, $id_kriteria) ?? 0;
?>
<input type="text" class="form-control" name="bobot<?php echo $urut ?>" value="<?php echo $nilai ?>" required>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<button type="submit" class="btn btn-primary"> Selanjutnya <span
class="fas fa-arrow-right"></span></button>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-primary">Skala Perbandingan</h6>
</div>
<div class="card-body">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Nilai</th>
<th class="align-middle">Tingkat Kepentingan</th>
</tr>
</thead>
<tbody>
<?php foreach (\App\Models\Nilai::all() as $key => $value) : ?>
<tr>
<td class="text-center"><?php echo $value['jum_nilai'] ?></td>
<td><?php echo $value['ket_nilai'] ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
@include('components.theme.pages.footer')