MIF_E31211789/resources/views/pages/pengelola/editor/index.blade.php

127 lines
5.2 KiB
PHP

@extends('layouts.main')
@section('title', 'Tugas Editor')
@section('content')
<div class="pagetitle">
<h1>Tugas Editor</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="">Pengelola</a></li>
<li class="breadcrumb-item active">Tugas Editor</li>
</ol>
</nav>
</div>
<!-- End Page Title -->
<section class="section">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between">
<h5 class="card-title">Tugas Editor</h5>
</div>
<div class="tab-content pt-2" id="borderedTabJustifiedContent">
<div class="tab-pane fade show active" id="bordered-justified-home" role="tabpanel"
aria-labelledby="home-tab">
<form class="row g-3 " action="" id="stepForm" method="POST"
enctype="multipart/form-data">
@csrf
@method('PUT')
{{-- <input type="hidden" name="id_buku" value="{{ $id }}"> --}}
<div class="table-responsive">
<table class="table table-hover table-bordered" id="myTable">
<thead>
<tr>
<th class="text-center">No</th>
<th class="text-center">Nama</th>
<th class="text-center">Role</th>
<th class="text-center">Aksi</th>
</tr>
</thead>
<tbody class="text-center">
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
@if (session('success'))
<script>
Swal.fire({
icon: 'success',
title: 'Berhasil',
text: '{{ session('success') }}'
});
</script>
@endif
@if (session('error'))
<script>
Swal.fire({
icon: 'error',
title: 'Gagal',
text: '{{ session('error') }}'
});
</script>
@endif
<script>
$(document).ready(function() {
$('#myTable').DataTable({
processing: true,
responsive: true,
serverSide: true,
ajax: '{{ route('pengelola.editor.dataeditor') }}',
columns: [{
data: 'DT_RowIndex',
name: 'DT_RowIndex'
},
{
data: 'name',
name: 'name'
},
{
data: 'role.nama_role',
name: 'role.nama_role'
},
{
data: null,
render: function(data) {
return '<div class="row justify-content-center">' +
'<div class="col-auto">' +
'<a href="{{ route('pengelola.editor.edit', '') }}/' + data
.id_users +
'" class="btn btn-info m-1" ' +
'"><i class="bi bi-calendar-check"></i> Tugaskan Editor </a>' +
'</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>
</section>
@endsection