MIF_E31210174/resources/views/admin/pages/alternatif.blade.php

184 lines
4.9 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@extends('admin.layouts.main')
@section('title', 'Alternatif')
@section('content')
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="card-title">Data Alternatif</h4>
@if($errors->any())
<div class="alert alert-danger alert-dismissible fade show mt-2">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<?php
$nomer = 1;
?>
@foreach($errors->all() as $error)
<li>{{ $nomer++ }}. {{ $error }}</li>
@endforeach
</div>
@endif
<div class="table-responsive">
<table class="table datatables table-hover responsive nowrap" style="width:100%" id="dataTable-1">
<thead>
<tr>
<th>No</th>
<th>Kost</th>
<th>Jarak</th>
<th>Fasilitas</th>
<th>Harga</th>
<th>Lokasi</th>
<th>Keamanan</th>
<th>Akses Jalan</th>
</tr>
</thead>
<tbody>
@php
$no = 1;
@endphp
@foreach($alternatif as $data)
<tr>
<td>{{ $no++ }}</td>
<td>{{ $data->kost->name }}</td>
<td>{{ $data->jarak->bobot }}</td>
<td>{{ $data->fasilitas->bobot }}</td>
<td>{{ $data->harga->bobot }}</td>
<td>{{ $data->lokasi->bobot }}</td>
<td>{{ $data->keamanan->bobot }}</td>
<td>{{ $data->aksesjalan->bobot }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('script')
<script>
$('#dataTable-1').DataTable({
autoWidth: true,
// "lengthMenu": [
// [16, 32, 64, -1],
// [16, 32, 64, "All"]
// ]
dom: 'Bfrtip',
lengthMenu: [
[10, 25, 50, -1]
, ['10 rows', '25 rows', '50 rows', 'Show all']
],
buttons: [{
extend: 'colvis'
, className: 'btn btn-primary btn-sm'
, text: 'Column Visibility',
// columns: ':gt(0)'
},
{
extend: 'pageLength'
, className: 'btn btn-primary btn-sm'
, text: 'Page Length',
// columns: ':gt(0)'
},
// 'colvis', 'pageLength',
{
extend: 'excel'
, className: 'btn btn-primary btn-sm'
, exportOptions: {
columns: [0, ':visible']
}
},
// {
// extend: 'csv',
// className: 'btn btn-primary btn-sm',
// exportOptions: {
// columns: [0, ':visible']
// }
// },
{
extend: 'pdf'
, className: 'btn btn-primary btn-sm'
, exportOptions: {
columns: [0, ':visible']
}
},
{
extend: 'print'
, className: 'btn btn-primary btn-sm'
, exportOptions: {
columns: [0, ':visible']
}
},
// 'pageLength', 'colvis',
// 'copy', 'csv', 'excel', 'print'
]
, });
</script>
@if(Session::get('store'))
<script>
Swal.fire({
icon: 'success'
, title: 'Good'
, text: 'Data Berhasil Ditambahkan'
, });
</script>
@endif
@if(Session::get('update'))
<script>
Swal.fire({
icon: 'success'
, title: 'Good'
, text: 'Data Berhasil Diubah'
, });
</script>
@endif
@if(Session::get('delete'))
<script>
Swal.fire({
icon: 'success'
, title: 'Good'
, text: 'Data Berhasil Dihapus'
, });
</script>
@endif
@if(Session::get('gagal'))
<script>
Swal.fire({
icon: 'error'
, title: 'Oops..'
, text: 'Data Masih Memiliki Relasi'
, });
</script>
@endif
@endsection