Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simpkm
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Farendi Giotivano R.P
simpkm
Commits
df864293
Commit
df864293
authored
Nov 07, 2022
by
Farendi Giotivano R.P
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menu reviewer
parent
2b583998
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
204 additions
and
10 deletions
+204
-10
app/Http/Controllers/Operator/UserController.php
+7
-6
resources/views/backend/operator/user/index.blade.php
+164
-0
resources/views/backend/operator/user/row_role.blade.php
+8
-0
resources/views/layouts/master.blade.php
+2
-3
resources/views/layouts/menu.blade.php
+18
-0
routes/web.php
+5
-1
No files found.
app/Http/Controllers/Operator/UserController.php
View file @
df864293
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
namespace
App\Http\Controllers\Operator
;
namespace
App\Http\Controllers\Operator
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
App\Models\
Admin\
Role
;
use
App\Models\Role
;
use
App\Models\User
;
use
App\Models\User
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -18,13 +18,14 @@ class UserController extends Controller
...
@@ -18,13 +18,14 @@ class UserController extends Controller
*/
*/
public
function
index
()
public
function
index
()
{
{
$data
[
'users'
]
=
User
::
with
([
'biodata'
,
'rolesCustom'
])
->
whereHas
(
'rolesCustom'
,
function
(
$q
){
$data
[
'title'
]
=
'Daftar User'
;
$q
->
whereIn
(
'name'
,
[
'satuan'
,
'verifikator'
]);
$data
[
'users'
]
=
User
::
with
([
'rBiodata'
,
'rolesCustom'
])
->
whereHas
(
'rolesCustom'
,
function
(
$q
){
$q
->
whereIn
(
'name'
,
[
'dosen'
,
'reviewer'
]);
})
->
get
();
})
->
get
();
$data
[
'roles'
]
=
Role
::
query
(
)
->
orderBy
(
'name'
)
->
get
();
$data
[
'roles'
]
=
Role
::
whereIn
(
'name'
,
[
'reviewer'
,
'operator'
]
)
->
orderBy
(
'name'
)
->
get
();
return
view
(
'
admin
.user.index'
,
$data
);
return
view
(
'
backend.operator
.user.index'
,
$data
);
}
}
public
function
removeRole
(
Request
$request
)
public
function
removeRole
(
Request
$request
)
...
@@ -42,7 +43,7 @@ class UserController extends Controller
...
@@ -42,7 +43,7 @@ class UserController extends Controller
$data
[
'user'
]
=
User
::
query
()
->
find
(
decrypt
(
$request
->
user_id
));
$data
[
'user'
]
=
User
::
query
()
->
find
(
decrypt
(
$request
->
user_id
));
$data
[
'user'
]
->
assignRole
(
$data
[
'role'
]);
$data
[
'user'
]
->
assignRole
(
$data
[
'role'
]);
return
view
(
'
admin
.user.row_role'
,
$data
);
return
view
(
'
backend.operator
.user.row_role'
,
$data
);
}
}
/**
/**
...
...
resources/views/backend/operator/user/index.blade.php
0 → 100644
View file @
df864293
@
extends
(
'layouts.master'
)
@
section
(
'title'
)
Dashboard
@
endsection
@
section
(
'header'
)
<
div
class
="
page
-
title
">
<h3>Dashboard</h3>
</div>
@endsection
@section('contents')
<!-- start page title -->
<div class="
page
-
title
-
box
">
<div class="
row
align
-
items
-
center
">
<div class="
col
-
md
-
8
">
<h6 class="
page
-
title
">{!!
$title
!!}</h6>
<ol class="
breadcrumb
m
-
0
">
<li class="
breadcrumb
-
item
">Dosen</li>
<li class="
breadcrumb
-
item
">{!!
$title
!!}</li>
</ol>
</div>
<div class="
col
-
md
-
4
">
<div class="
float
-
end
d
-
none
d
-
md
-
block
">
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="
row
">
<div class="
col
-
12
">
<div class="
card
">
<div class="
card
-
body
">
<table id="
datatable
" class="
table
table
-
bordered
dt
-
responsive
" style="
border
-
collapse
:
collapse
;
border
-
spacing
:
0
;
width
:
100
%
;
">
<thead>
<tr>
<th>No.</th>
<th>Nama</th>
<th>Email</th>
<th>Roles</th>
</tr>
</thead>
<tbody>
@foreach (
$users
as
$item
)
@php
$userToken
= Str::random(30);
@endphp
<tr>
<td>{{
$loop->iteration
}}</td>
<td>
{{
$item->name
}} <br>
{{
$item->rBiodata
->noidentitas }}
</td>
<td>
{{
$item->email
}}
</td>
<td>
@foreach (
$item->rolesCustom
as
$role
)
<div id="
{{
$userToken
}}
">
<div class="
row
mb
-
2
">
<div class="
col
-
md
-
4
">
{{
$role->name
}}
</div>
<div class="
col
-
md
-
6
">
<button type="
button
" onclick="
removeRole
(
'{{ encrypt($item->id) }}'
,
'{{ encrypt($role->id) }}'
,
this
)
" style="
padding
:
8
px
" class="
btn
btn
-
sm
btn
-
danger
"><i class="
fa
fa
-
times
"></i></button>
</div>
</div>
</div>
@endforeach
<div class="
row
">
<div class="
col
-
md
-
7
">
<div class="
input
-
group
mb
-
3
">
<select class="
form
-
select
" name="" id="
select_
{{
$userToken
}}
">
@foreach (
$roles
as
$role
)
<option value="
{{
encrypt
(
$role
->
id
)
}}
">{{
$role->name
}}</option>
@endforeach
</select>
<div class="
input
-
group
-
append
">
<button style="
padding
:
8
px
" onclick="
addRole
(
'{{ $userToken }}'
,
'{{ encrypt($item->id) }}'
)
" class="
btn
btn
-
sm
btn
-
success
" type="
button
">Tambah</button>
</div>
</div>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div> <!-- end col -->
</div> <!-- end row -->
@endsection
@section('js')
<script src="
{{
asset
(
'theme/js/pages/datatables.init.js'
)
}}
"></script>
<script>
$("
body
").on("
click
", "
.
delete
", function (e) {
e.preventDefault();
var id = $(this).data('id');
Swal.fire({
title: "
Apakah
Anda
Yakin
?
",
text: "
Anda
akan
menghapus
data
ini
!
",
icon: "
warning
",
showCancelButton: true,
confirmButtonColor: "
#DD6B55",
confirmButtonText
:
"Yes"
,
cancelButtonText
:
"No"
})
.
then
((
result
)
=>
{
if
(
result
.
value
)
{
Swal
.
close
();
$
(
"#"
+
id
)
.
submit
();
}
else
if
(
result
.
dismiss
===
Swal
.
DismissReason
.
cancel
)
{
Swal
.
fire
(
'Dibatalkan'
,
'Data batal dihapus'
,
'error'
);
}
});
});
function
removeRole
(
user_id
,
role_id
,
element
){
var
token
=
"{{ csrf_token() }}"
;
var
request
=
$
.
ajax
({
url
:
"{{ route('operator.remove-role') }}"
,
type
:
"POST"
,
dataType
:
"html"
,
data
:
{
user_id
:
user_id
,
role_id
:
role_id
,
_token
:
token
},
success
:
function
(
result
){
$
(
element
)
.
parent
()
.
parent
()
.
remove
();
}
})
}
function
addRole
(
user_token
,
user_id
){
var
token
=
"{{ csrf_token() }}"
;
var
role_id
=
$
(
'#select_'
+
user_token
)
.
val
();
var
request
=
$
.
ajax
({
url
:
"{{ route('operator.add-role') }}"
,
type
:
"POST"
,
dataType
:
"html"
,
data
:
{
user_id
:
user_id
,
role_id
:
role_id
,
_token
:
token
},
success
:
function
(
result
){
$
(
'#'
+
user_token
)
.
append
(
result
);
}
})
}
</
script
>
@
endsection
resources/views/backend/operator/user/row_role.blade.php
0 → 100644
View file @
df864293
<div
class=
"row mb-2"
>
<div
class=
"col-md-4"
>
{{ $role->name }}
</div>
<div
class=
"col-md-6"
>
<button
type=
"button"
onclick=
"removeRole('{{ encrypt($user->id) }}', '{{ encrypt($role->id) }}', this)"
style=
"padding: 8px"
class=
"btn btn-sm btn-danger"
><i
class=
"fa fa-times"
></i></button>
</div>
</div>
resources/views/layouts/master.blade.php
View file @
df864293
...
@@ -41,11 +41,10 @@
...
@@ -41,11 +41,10 @@
<
div
class
="
dropdown
d
-
inline
-
block
">
<
div
class
="
dropdown
d
-
inline
-
block
">
<button type="
button
" class="
btn
header
-
item
waves
-
effect
" id="
page
-
header
-
user
-
dropdown
" data-bs-toggle="
dropdown
" aria-haspopup="
true
" aria-expanded="
false
">
<button type="
button
" class="
btn
header
-
item
waves
-
effect
" id="
page
-
header
-
user
-
dropdown
" data-bs-toggle="
dropdown
" aria-haspopup="
true
" aria-expanded="
false
">
@if (Auth::user()->roles->first()->name != 'mahasiswa')
@if (Auth::user()->roles->first()->name != 'mahasiswa')
<img src="
https
://
siakadu
.
unesa
.
ac
.
id
/
photo
/
fotomhs
/
{{
Auth
::
user
()
->
rBiodata
->
noidentitas
}}
.
jpg
" alt="
Header
Avatar
" class="
rounded
-
circle
header
-
profile
-
user
" >
<img src="
https
://
siakadu
.
unesa
.
ac
.
id
/
photo
/
fotomhs
/
{{
is_null
(
Auth
::
user
()
->
rBiodata
)
?
'01'
:
Auth
::
user
()
->
rBiodata
->
noidentitas
}}
.
jpg
" alt="
Header
Avatar
" class="
rounded
-
circle
header
-
profile
-
user
" >
@else
@else
<img src="
https
://
siakadu
.
unesa
.
ac
.
id
/
photo
/
{{
Auth
::
user
()
->
rBiodata
->
noidentitas
}}
.
jpg
" alt="
Header
Avatar
" class="
rounded
-
circle
header
-
profile
-
user
" >
<img src="
https
://
siakadu
.
unesa
.
ac
.
id
/
photo
/
{{
is_null
(
Auth
::
user
()
->
rBiodata
)
?
'01'
:
Auth
::
user
()
->
rBiodata
->
noidentitas
}}
.
jpg
" alt="
Header
Avatar
" class="
rounded
-
circle
header
-
profile
-
user
" >
@endif
@endif
</button>
</button>
...
...
resources/views/layouts/menu.blade.php
View file @
df864293
...
@@ -155,6 +155,24 @@
...
@@ -155,6 +155,24 @@
</li>
</li>
@endif
@endif
@if (Auth::user()->hasrole(['reviewer']))
<li
class=
"menu-title"
>
Menu Reviewer
</li>
<li>
<a
href=
"{{ URL::to('/reviewer/seleksi-internal') }}"
class=
"waves-effect"
><i
class=
"ti-check"
></i><span>
Seleksi Internal
</span></a>
</li>
<li>
<a
href=
"javascript: void(0);"
class=
"has-arrow waves-effect"
>
<i
class=
"ti-layers-alt"
></i>
<span>
Monev Internal
</span>
</a>
<ul
class=
"sub-menu"
aria-expanded=
"false"
>
<li><a
href=
"{{ URL::to('/reviewer/monev/I') }}"
>
Monev Internal I
</a></li>
<li><a
href=
"{{ URL::to('/reviewer/monev/II') }}"
>
Monev Internal II
</a></li>
<li><a
href=
"{{ URL::to('/reviewer/monev/III') }}"
>
Monev Internal III
</a></li>
</ul>
</li>
@endif
</ul>
</ul>
</div>
</div>
<!-- Sidebar -->
<!-- Sidebar -->
...
...
routes/web.php
View file @
df864293
...
@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
...
@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
use
App\Http\Controllers\DashboardController
;
use
App\Http\Controllers\DashboardController
;
use
App\Http\Controllers\Operator\JenisController
;
use
App\Http\Controllers\Operator\JenisController
;
use
App\Http\Controllers\Operator\UserController
;
use
App\Http\Controllers\Operator\SelectController
;
use
App\Http\Controllers\Operator\SelectController
;
use
App\Http\Controllers\Mahasiswa\AnggotaController
;
use
App\Http\Controllers\Mahasiswa\AnggotaController
;
use
App\Http\Controllers\Operator\ReviewerController
;
use
App\Http\Controllers\Operator\ReviewerController
;
...
@@ -167,6 +167,10 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
...
@@ -167,6 +167,10 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route
::
resource
(
'monev-internal-proposal'
,
MonevProposalController
::
class
)
->
except
([
'index'
]);
Route
::
resource
(
'monev-internal-proposal'
,
MonevProposalController
::
class
)
->
except
([
'index'
]);
Route
::
get
(
'/monev-internal-reviewer-approval/{id}/{status}'
,
[
MonevProposalController
::
class
,
'approval'
])
->
name
(
'monev-internal.approval'
);
Route
::
get
(
'/monev-internal-reviewer-approval/{id}/{status}'
,
[
MonevProposalController
::
class
,
'approval'
])
->
name
(
'monev-internal.approval'
);
Route
::
get
(
'getMonevProposal'
,
[
MonevProposalController
::
class
,
'getData'
])
->
name
(
'getMonevProposal'
);
Route
::
get
(
'getMonevProposal'
,
[
MonevProposalController
::
class
,
'getData'
])
->
name
(
'getMonevProposal'
);
Route
::
resource
(
'user'
,
UserController
::
class
);
Route
::
post
(
'/user/remove-role'
,
[
UserController
::
class
,
'removeRole'
])
->
name
(
'remove-role'
);
Route
::
post
(
'/user/add-role'
,
[
UserController
::
class
,
'addRole'
])
->
name
(
'add-role'
);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment