233 lines
9.3 KiB
PHP
233 lines
9.3 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
|
|
<div class="container-fluid">
|
|
<div class="row ">
|
|
<div class="col-md-11 mx-auto card p-4">
|
|
|
|
@if ($message = Session::get('success'))
|
|
<div class="alert alert-success">
|
|
<p>{{ $message }}</p>
|
|
</div>
|
|
@endif
|
|
@if ($message = Session::get('failed'))
|
|
<div class="alert alert-danger">
|
|
<p>{{ $message }}</p>
|
|
</div>
|
|
@endif
|
|
<?php
|
|
$totaluser = count($alluser);
|
|
?>
|
|
<form id="exportform" action="{{route('pengguna.export')}}" method="POST">
|
|
@csrf
|
|
<input type="hidden" name="type" value="User">
|
|
<table class="table table-striped table-xl" id="pengguna" style="width:100%">
|
|
<thead class="bg-primary text-white">
|
|
<tr>
|
|
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
|
|
<th>Nama</th>
|
|
<th>Nama Pengguna</th>
|
|
<th>Emel</th>
|
|
<th>Cawangan</th>
|
|
<th>Taraf</th>
|
|
<th>Status</th>
|
|
<th class="text-center">Tindakan</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
@foreach ($alluser as $user)
|
|
<tr>
|
|
<td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $user->id }}"></td>
|
|
<td>{{ $user->name }}</td>
|
|
<td>{{ $user->username }}</td>
|
|
<td>{{ $user->email }}</td>
|
|
<td>{{ $user->kodcaw }}</td>
|
|
|
|
<td>
|
|
@foreach ($user->roles as $taraf)
|
|
<button class="btn btn-primary btn-sm hovernone" disabled>{{$taraf->name}}</button>
|
|
@endforeach
|
|
</td>
|
|
<td>
|
|
@if ($user->status =='active')
|
|
<button class="btn btn-success btn-sm hovernone-success" disabled>{{$user->status}}</button>
|
|
@elseif ($user->status == 'inactive')
|
|
<button class="btn btn-warning btn-sm hovernone-warning" disabled>{{$user->status}}</button>
|
|
@elseif ($user->status =='banned')
|
|
<button class="btn btn-danger btn-sm hovernone-danger" disabled>{{$user->status}}</button>
|
|
@endif
|
|
|
|
</td>
|
|
<td class="text-center">
|
|
<a href="{{ route('pengguna.show',$user->id) }}" data-toggle="tooltip" data-placement="top" title="Kemaskini" style="margin-right:30px"><i class="far fa-edit"></i></a>
|
|
<a class="confirmdel" href="{{ route('pengguna.delete',$user->id) }}" data-toggle="tooltip" data-placement="top" title="Padam"><i class="far fa-trash-alt"></i></a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal fade" tabindex="-1" id="myModal">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Tambah Pengguna</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form action="{{ route('pengguna.storepengguna') }}" method="POST" id="formpengguna">
|
|
@csrf
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="name">Nama</label>
|
|
<input type="text" class="form-control" name="name" id="name" required>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="username">Nama Pengguna</label>
|
|
<input type="text" class="form-control" name="username" id="username" required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="name">Cawangan</label>
|
|
<select class="custom-select" name="caw" id="caw">
|
|
<option disabled>Pilih Cawangan</option>
|
|
<option selected value="">-</option>
|
|
@foreach ($caw as $item)
|
|
<option value="{{$item->caw_code}}">{{$item->caw_name}}</option>
|
|
@endforeach
|
|
|
|
<!-- <option value="all">Select All</option> -->
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="email">Emel</label>
|
|
<input type="email" class="form-control" name="email" id="email">
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<h4 class="col-md-3">Taraf Pengguna</h4>
|
|
<div class="form-group col-md-9">
|
|
@foreach ($allRolesPluck as $namataraf)
|
|
<div class="col-4 form-check form-check-inline">
|
|
<input class="form-check-input" name="taraf{{$namataraf}}" type="checkbox" id="taraf{{$namataraf}}" value="{{$namataraf}}">
|
|
<label class="form-check-label" for="taraf{{$namataraf}}">{{$namataraf}}</label>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
|
|
<button type="button" class="btn btn-primary" onclick="storepengguna()">Simpan</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
//Enable tooltips everywhere
|
|
$(function() {
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
})
|
|
$('a.confirmdel').confirm({
|
|
title: 'Confirmation',
|
|
content: 'Anda pasti?',
|
|
type: 'orange',
|
|
typeAnimated: true,
|
|
buttons: {
|
|
Delete: {
|
|
btnClass: 'btn-warning',
|
|
action: function() {
|
|
location.href = this.$target.attr('href');
|
|
}
|
|
},
|
|
Batal: {
|
|
btnClass: 'btn-default',
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
var tablepengguna = $('#pengguna').DataTable({
|
|
"columnDefs": [{
|
|
"targets": 0,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"targets": 4,
|
|
"orderable": false
|
|
},
|
|
{
|
|
"targets": 5,
|
|
"orderable": false
|
|
}
|
|
],
|
|
order: [
|
|
[1, 'asc']
|
|
],
|
|
// "ordering": false,
|
|
"info": false,
|
|
"lengthChange": false,
|
|
"pageLength": 15,
|
|
dom: 'Bfrtip',
|
|
buttons: [
|
|
// 'copy', 'excel', 'pdf'
|
|
// { text: 'copy', className: 'btn btn-primary' },
|
|
{
|
|
className: 'btn btn-outline-success pl-4 pr-4 btn-sm adduser',
|
|
text: '<i class="fas fa-plus" id="test"></i>',
|
|
titleAttr: 'Tambah Pengguna',
|
|
action: function(e, dt, node, config) {
|
|
//alert( 'Button activated' );
|
|
// console.log('hye');
|
|
|
|
$('#myModal').modal("show");
|
|
$('#myModal').on('shown.bs.modal', function() {
|
|
$('#rolename').trigger('focus')
|
|
})
|
|
}
|
|
},
|
|
|
|
{
|
|
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
|
|
titleAttr: 'Export to CSV',
|
|
text: '<i class="fas fa-download"></i>',
|
|
action: function(e, dt, node, config) {
|
|
$("#exportform").submit();
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
$('.adduser').tooltip();
|
|
$('.export').tooltip();
|
|
// $( '.dt-buttons').addClass('btn-group');
|
|
$('.adduser').removeClass('dt-button');
|
|
$('.export').removeClass('dt-button');
|
|
|
|
|
|
function selectall(cb) {
|
|
tablepengguna.rows().nodes().to$().find('input[type="checkbox"]').each(function() {
|
|
$(this).prop('checked', cb.checked);
|
|
})
|
|
}
|
|
|
|
function storepengguna() {
|
|
$("#formpengguna").submit();
|
|
}
|
|
</script>
|
|
|
|
@endsection
|