166 lines
6.1 KiB
PHP
166 lines
6.1 KiB
PHP
@extends('layout.main')
|
|
|
|
@section('title', 'Riwayat')
|
|
|
|
@section('content')
|
|
<div class="content-wrapper">
|
|
<div class="content-header">
|
|
<div class="container-fluid">
|
|
<div class="row mb-2">
|
|
<div class="col-sm-6">
|
|
<h1 class="m-0">Riwayat</h1>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Main content -->
|
|
<section class="content">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3 class="card-title">Riwayat Analisa</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<table id="myTable" class="table table-bordered table-hover">
|
|
<thead class="text-center">
|
|
<tr>
|
|
<th>No</th>
|
|
<th>Strategi</th>
|
|
<th>Opsi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="text-center">
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
@if (session('success'))
|
|
<script>
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Berhasil',
|
|
text: '{{ session('success') }}'
|
|
});
|
|
</script>
|
|
@endif
|
|
@if ($errors->any())
|
|
<script>
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Oopss...',
|
|
text: '{{ $errors->first() }}'
|
|
});
|
|
</script>
|
|
@endif
|
|
|
|
@if (Auth::user()->id_role == 1)
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#myTable").DataTable({
|
|
processing: true,
|
|
ordering: true,
|
|
responsive: true,
|
|
serverSide: true,
|
|
ajax: "{{ route('admin.riwayat') }}",
|
|
columns: [{
|
|
data: 'DT_RowIndex',
|
|
name: 'DT_RowIndex'
|
|
},
|
|
{
|
|
data: 'gameplay',
|
|
name: 'gameplay'
|
|
},
|
|
{
|
|
data: null,
|
|
render: function(data) {
|
|
return '<div class="row justify-content-center">' +
|
|
'<div class="col-auto">' +
|
|
'<a href="{{ route('admin.riwayat.show', '') }}/' + data
|
|
.id_analisa + '" class="btn btn-info m-1">Detail Hasil</a>' +
|
|
'</div>' +
|
|
'</div>';
|
|
}
|
|
}
|
|
],
|
|
rowCallback: function(row, data, index) {
|
|
var dt = this.api();
|
|
$(row).attr('data-id', data.id);
|
|
$('td:eq(0)', row).html(dt.page.info().start + index + 1);
|
|
}
|
|
});
|
|
|
|
$('.datatable-input').on('input', function() {
|
|
var searchText = $(this).val().toLowerCase();
|
|
|
|
$('.table tr').each(function() {
|
|
var rowData = $(this).text().toLowerCase();
|
|
if (rowData.indexOf(searchText) === -1) {
|
|
$(this).hide();
|
|
} else {
|
|
$(this).show();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
@else
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#myTable").DataTable({
|
|
processing: true,
|
|
ordering: true,
|
|
responsive: true,
|
|
serverSide: true,
|
|
ajax: "{{ route('riwayat') }}",
|
|
columns: [{
|
|
data: 'DT_RowIndex',
|
|
name: 'DT_RowIndex'
|
|
},
|
|
{
|
|
data: 'gameplay',
|
|
name: 'gameplay'
|
|
},
|
|
{
|
|
data: null,
|
|
render: function(data) {
|
|
return '<div class="row justify-content-center">' +
|
|
'<div class="col-auto">' +
|
|
'<a href="{{ route('admin.riwayat.show', '') }}/' + data
|
|
.id_analisa + '" class="btn btn-info m-1">Detail Hasil</a>' +
|
|
'</div>' +
|
|
'</div>';
|
|
}
|
|
}
|
|
],
|
|
rowCallback: function(row, data, index) {
|
|
var dt = this.api();
|
|
$(row).attr('data-id', data.id);
|
|
$('td:eq(0)', row).html(dt.page.info().start + index + 1);
|
|
}
|
|
});
|
|
|
|
$('.datatable-input').on('input', function() {
|
|
var searchText = $(this).val().toLowerCase();
|
|
|
|
$('.table tr').each(function() {
|
|
var rowData = $(this).text().toLowerCase();
|
|
if (rowData.indexOf(searchText) === -1) {
|
|
$(this).hide();
|
|
} else {
|
|
$(this).show();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
@endif
|
|
@endsection
|