272 lines
12 KiB
PHP
272 lines
12 KiB
PHP
|
<!-- Extend Layout -->
|
||
|
@extends('layout.app')
|
||
|
<!-- Add Custom CSS -->
|
||
|
@push('css')
|
||
|
<link rel="stylesheet" href="{{asset('/')}}plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
|
||
|
<link rel="stylesheet" href="{{asset('/')}}plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
|
||
|
<link rel="stylesheet" href="{{asset('/')}}plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
|
||
|
@endpush
|
||
|
<!-- Add Content Here -->
|
||
|
@section('content')
|
||
|
<!-- Include Sidebar -->
|
||
|
@include('layout.navbars.sidebar')
|
||
|
<div class="content-wrapper">
|
||
|
<!-- Main content -->
|
||
|
<section class="content-header">
|
||
|
<div class="container-fluid">
|
||
|
<div class="row mb-2">
|
||
|
<div class="col-sm-6">
|
||
|
<h1>Manajemen User</h1>
|
||
|
</div>
|
||
|
<div class="col-sm-6">
|
||
|
<ol class="breadcrumb float-sm-right">
|
||
|
<li class="breadcrumb-item"><a href="#">Admin</a></li>
|
||
|
<li class="breadcrumb-item active">Manajemen User</li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div><!-- /.container-fluid -->
|
||
|
</section>
|
||
|
|
||
|
<section class="content">
|
||
|
<div class="card">
|
||
|
<div class="card-body">
|
||
|
@if ($errors->any())
|
||
|
<div class="alert alert-danger">
|
||
|
<ul>
|
||
|
@foreach ($errors->all() as $error )
|
||
|
<li>{{ $error }}</li>
|
||
|
@endforeach
|
||
|
</ul>
|
||
|
</div>
|
||
|
@endif
|
||
|
@if(session('success'))
|
||
|
<div class="alert alert-success">
|
||
|
<ul>
|
||
|
<li>{{ session('success') }}</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
@endif
|
||
|
@if(session('error'))
|
||
|
<div class="alert alert-danger">
|
||
|
<ul>
|
||
|
<li>{{ session('error') }}</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
@endif
|
||
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-default">
|
||
|
Tambah Data
|
||
|
</button>
|
||
|
<table id="example1" class="table table-bordered table-striped">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>NIP</th>
|
||
|
<th>Nama Dengan Gelar</th>
|
||
|
<th>Email</th>
|
||
|
<th>User Roles</th>
|
||
|
<th>Action</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
@foreach ($user as $users)
|
||
|
<tr>
|
||
|
<td>{{ $users->nip }}</td>
|
||
|
<td>{{ $users->nama_gelar }}</td>
|
||
|
<td>{{ $users->email }}</td>
|
||
|
<td>{{ $users->nama_roles }}</td>
|
||
|
<td class="text-center">
|
||
|
<button class="btn btn-sm btn-success" data-toggle="modal" data-target="#user{{$users->id}}">Edit</button> |
|
||
|
<button class="btn btn-sm btn-danger" data-toggle="modal" data-target="#userdestroy{{$users->id}}">Hapus</button></td>
|
||
|
</tr>
|
||
|
<!-- MODAL EDIT PERUSER-->
|
||
|
<div class="modal fade" id="user{{$users->id}}">
|
||
|
<div class="modal-dialog">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h4 class="modal-title">Edit Data</h4>
|
||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
|
<span aria-hidden="true">×</span>
|
||
|
</button>
|
||
|
</div>
|
||
|
<div class="modal-body">
|
||
|
<div class="row">
|
||
|
<div class="col">
|
||
|
<form action="{{ route('users.update')}}" method="post">
|
||
|
@csrf
|
||
|
@method('PUT')
|
||
|
<input type="hidden" name="id" id="id" value="{{$users->id}}">
|
||
|
<label for="nip">NIP</label>
|
||
|
<input type="text" name="nip" id="nip" class="form-control" placeholder="Masukkan NIP Dosen" value="{{ $users->nip }}">
|
||
|
<label for="nama_depan">Nama Depan</label>
|
||
|
<input type="text" name="nama_depan" id="nama_depan" class="form-control" placeholder="Masukkan Nama Depan" value="{{ $users->nama_depan }}">
|
||
|
<label for="nama_belakang">Nama Belakang</label>
|
||
|
<input type="text" name="nama_belakang" id="nama_belakang" class="form-control" placeholder="Masukkan Nama Belakang" value="{{ $users->nama_belakang }}">
|
||
|
<label for="nama_gelar">Nama Lengkap Dengan Gelar</label>
|
||
|
<input type="text" name="nama_gelar" id="nama_gelar" class="form-control" placeholder="Masukkan Nama Lengkap Dengan Gelar" value="{{ $users->nama_gelar }}">
|
||
|
<label for="Email">Email</label>
|
||
|
<input type="email" name="email" id="Email" class="form-control" placeholder="Masukkan Email" value="{{ $users->email }}">
|
||
|
<label for="ettd">Kode E-TTD</label>
|
||
|
<input type="text" name="ettd" id="ettd" class="form-control" placeholder="Masukkan Kode E-TTD" value="{{ $users->ettd }}">
|
||
|
<label for="user_roles_id">Role User</label>
|
||
|
<select name="user_roles_id" id="user_roles_id" class="form-control">
|
||
|
<option>Pilih Role User</option>
|
||
|
@foreach($role as $roles)
|
||
|
<option value="{{$roles->id}}" {{ $users->user_roles_id === $roles->id ? 'selected' : '' }}>{{$roles->nama}}</option>
|
||
|
@endforeach
|
||
|
</select>
|
||
|
</div>
|
||
|
<!-- /.col -->
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal-footer justify-content-between">
|
||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||
|
<button type="submit" class="btn btn-primary">Edit</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- /.modal-content -->
|
||
|
</div>
|
||
|
<!-- /.modal-dialog -->
|
||
|
</div>
|
||
|
<!-- MODAl DELETE PER USER-->
|
||
|
<div class="modal fade" id="userdestroy{{$users->id}}">
|
||
|
<div class="modal-dialog">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h4 class="modal-title">Hapus Data</h4>
|
||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
|
<span aria-hidden="true">×</span>
|
||
|
</button>
|
||
|
</div>
|
||
|
<div class="modal-body">
|
||
|
<div class="row">
|
||
|
<div class="col">
|
||
|
<form action="{{ route('users.destroy')}}" method="post">
|
||
|
@csrf
|
||
|
@method('DELETE')
|
||
|
Anda Yakin ingin Menghapus Data ini ?
|
||
|
<input type="hidden" name="id" id="id" value="{{$users->id}}">
|
||
|
</div>
|
||
|
<!-- /.col -->
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal-footer justify-content-between">
|
||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||
|
<button type="submit" class="btn btn-danger">Delete</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- /.modal-content -->
|
||
|
</div>
|
||
|
<!-- /.modal-dialog -->
|
||
|
</div>
|
||
|
@endforeach
|
||
|
</tbody>
|
||
|
<tfoot>
|
||
|
<tr>
|
||
|
<th>NIP</th>
|
||
|
<th>Nama Dengan Gelar</th>
|
||
|
<th>Email</th>
|
||
|
<th>User Roles</th>
|
||
|
<th>Action</th>
|
||
|
</tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
</div>
|
||
|
<!-- /.card-body -->
|
||
|
<div class="card-footer">
|
||
|
.
|
||
|
</div>
|
||
|
<!-- /.card-footer-->
|
||
|
</div>
|
||
|
<!-- /.card -->
|
||
|
|
||
|
<!-- /.Modal ADD DATA -->
|
||
|
<div class="modal fade" id="modal-default">
|
||
|
<div class="modal-dialog">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h4 class="modal-title">Tambah Data</h4>
|
||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
|
<span aria-hidden="true">×</span>
|
||
|
</button>
|
||
|
</div>
|
||
|
<div class="modal-body">
|
||
|
<div class="row">
|
||
|
<div class="col">
|
||
|
<form action="{{ route('users.store')}}" method="post">
|
||
|
@csrf
|
||
|
<label for="nip">NIP</label>
|
||
|
<input type="text" name="nip" id="nip" class="form-control" placeholder="Masukkan NIP Dosen" value="{{ old('nip')}}">
|
||
|
<label for="nama_depan">Nama Depan</label>
|
||
|
<input type="text" name="nama_depan" id="nama_depan" class="form-control" placeholder="Masukkan Nama Depan" value="{{ old('nama_depan')}}">
|
||
|
<label for="nama_belakang">Nama Belakang</label>
|
||
|
<input type="text" name="nama_belakang" id="nama_belakang" class="form-control" placeholder="Masukkan Nama Belakang" value="{{ old('nama_belakang')}}">
|
||
|
<label for="nama_gelar">Nama Lengkap Dengan Gelar</label>
|
||
|
<input type="text" name="nama_gelar" id="nama_gelar" class="form-control" placeholder="Masukkan Nama Lengkap Dengan Gelar">
|
||
|
<label for="Email">Email</label>
|
||
|
<input type="email" name="email" id="Email" class="form-control" placeholder="Masukkan Email">
|
||
|
<label for="ettd">Kode E-TTD</label>
|
||
|
<input type="text" name="ettd" id="ettd" class="form-control" placeholder="Masukkan Kode E-TTD">
|
||
|
<label for="user_roles_id">Role User</label>
|
||
|
<select name="user_roles_id" id="user_roles_id" class="form-control">
|
||
|
<option selected>Pilih Role User</option>
|
||
|
@foreach($role as $roles)
|
||
|
<option value="{{$roles->id}}">{{$roles->nama}}</option>
|
||
|
@endforeach
|
||
|
</select>
|
||
|
</div>
|
||
|
<!-- /.col -->
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="modal-footer justify-content-between">
|
||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||
|
<button type="submit" class="btn btn-primary">Tambah</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!-- /.modal-content -->
|
||
|
</div>
|
||
|
<!-- /.modal-dialog -->
|
||
|
</div>
|
||
|
</section>
|
||
|
<!-- /.content -->
|
||
|
</div>
|
||
|
@endsection
|
||
|
|
||
|
<!-- Add Custom JS -->
|
||
|
@push('js')
|
||
|
<!-- DataTables & Plugins -->
|
||
|
<script src="{{asset('/')}}plugins/datatables/jquery.dataTables.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/jszip/jszip.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/pdfmake/pdfmake.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/pdfmake/vfs_fonts.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-buttons/js/buttons.html5.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-buttons/js/buttons.print.min.js"></script>
|
||
|
<script src="{{asset('/')}}plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
|
||
|
<!-- Page specific script -->
|
||
|
<script>
|
||
|
$(function () {
|
||
|
$("#example1").DataTable({
|
||
|
"responsive": true, "lengthChange": false, "autoWidth": false,
|
||
|
// "buttons": [{
|
||
|
// // New button configuration
|
||
|
// text: 'Tambah Data', // Replace with your desired button text
|
||
|
// action: function ( e, dt, node, config ) {
|
||
|
// // Perform your custom action here, e.g., open a new tab with the external link
|
||
|
// window.location.href = "#tambahUser";
|
||
|
// }
|
||
|
// }
|
||
|
// ,"csv", "excel", "pdf", "print", "colvis"
|
||
|
// ]
|
||
|
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
|
||
|
});
|
||
|
</script>
|
||
|
@endpush
|
||
|
|