pintu2/resources/views/user/index.blade.php

262 lines
12 KiB
PHP
Raw Normal View History

2024-02-27 22:53:57 +07:00
<!-- 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">
2024-03-02 18:06:48 +07:00
<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">Admin</a></li>
2024-02-27 22:53:57 +07:00
<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>
2024-03-02 18:06:48 +07:00
<td>
@foreach ($users->roles as $role)
| {{ $role->name }}
@endforeach
</td>
2024-02-27 22:53:57 +07:00
<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">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col">
<form action="{{ route('users.update')}}" method="post">
@csrf
@method('PUT')
2024-03-02 18:06:48 +07:00
<input type="hidden" name="id" id="id" value="{{$users->id}}" required>
2024-02-27 22:53:57 +07:00
<label for="nip">NIP</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nip" id="nip" class="form-control" placeholder="Masukkan NIP Dosen" value="{{ $users->nip }}" required>
2024-02-27 22:53:57 +07:00
<label for="nama_depan">Nama Depan</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nama_depan" id="nama_depan" class="form-control" placeholder="Masukkan Nama Depan" value="{{ $users->nama_depan }}" required>
2024-02-27 22:53:57 +07:00
<label for="nama_belakang">Nama Belakang</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nama_belakang" id="nama_belakang" class="form-control" placeholder="Masukkan Nama Belakang" value="{{ $users->nama_belakang }}" required>
2024-02-27 22:53:57 +07:00
<label for="nama_gelar">Nama Lengkap Dengan Gelar</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nama_gelar" id="nama_gelar" class="form-control" placeholder="Masukkan Nama Lengkap Dengan Gelar" value="{{ $users->nama_gelar }}" required>
2024-02-27 22:53:57 +07:00
<label for="Email">Email</label>
2024-03-02 18:06:48 +07:00
<input type="email" name="email" id="Email" class="form-control" placeholder="Masukkan Email" value="{{ $users->email }}" required>
2024-02-27 22:53:57 +07:00
<label for="ettd">Kode E-TTD</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="ettd" id="ettd" class="form-control" placeholder="Masukkan Kode E-TTD" value="{{ $users->ettd }}" required>
2024-02-27 22:53:57 +07:00
</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">&times;</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">&times;</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>
2024-03-02 18:06:48 +07:00
<input type="text" name="nip" id="nip" class="form-control" placeholder="Masukkan NIP Dosen" value="{{ old('nip')}}" required>
2024-02-27 22:53:57 +07:00
<label for="nama_depan">Nama Depan</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nama_depan" id="nama_depan" class="form-control" placeholder="Masukkan Nama Depan" value="{{ old('nama_depan')}}" required>
2024-02-27 22:53:57 +07:00
<label for="nama_belakang">Nama Belakang</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nama_belakang" id="nama_belakang" class="form-control" placeholder="Masukkan Nama Belakang" value="{{ old('nama_belakang')}}" required>
2024-02-27 22:53:57 +07:00
<label for="nama_gelar">Nama Lengkap Dengan Gelar</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="nama_gelar" id="nama_gelar" class="form-control" placeholder="Masukkan Nama Lengkap Dengan Gelar" required>
2024-02-27 22:53:57 +07:00
<label for="Email">Email</label>
2024-03-02 18:06:48 +07:00
<input type="email" name="email" id="Email" class="form-control" placeholder="Masukkan Email" required>
2024-02-27 22:53:57 +07:00
<label for="ettd">Kode E-TTD</label>
2024-03-02 18:06:48 +07:00
<input type="text" name="ettd" id="ettd" class="form-control" placeholder="Masukkan Kode E-TTD" required>
2024-02-27 22:53:57 +07:00
</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