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
935276dc
Commit
935276dc
authored
Feb 16, 2023
by
Farendi Giotivano R.P
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ganti kelompok
parent
63fa1098
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
50 deletions
+84
-50
app/Http/Controllers/Api/DosenController.php
+17
-9
app/Http/Controllers/Mahasiswa/KelompokController.php
+2
-1
resources/views/backend/mahasiswa/kelompok/create.blade.php
+60
-6
resources/views/backend/mahasiswa/kelompok/index.blade.php
+0
-34
routes/api.php
+5
-0
No files found.
app/Http/Controllers/Api/DosenController.php
View file @
935276dc
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Http\Controllers\Api
;
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\GetDataApiController
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
class
DosenController
extends
Controller
class
DosenController
extends
Controller
...
@@ -16,30 +17,37 @@ class DosenController extends Controller
...
@@ -16,30 +17,37 @@ class DosenController extends Controller
$total_count
=
0
;
$total_count
=
0
;
$incomplete_results
=
true
;
$incomplete_results
=
true
;
$items
=
array
();
$items
=
[];
if
(
empty
(
$getDosen
))
{
if
(
$getDosen
->
isEmpty
())
{
$items
=
array
();
$items
=
array
();
}
else
{
}
else
{
$no
=
0
;
$no
=
0
;
foreach
(
$getDosen
as
$item
)
{
foreach
(
$getDosen
[
'data'
]
as
$key
=>
$item
)
{
$items
[
$item
->
id
][
'nm_sdm'
]
=
$item
->
nm_sdm
;
$items
[
$item
->
id
][
'nm_sdm'
]
=
$item
->
prodi
;
if
(
str_contains
(
strtolower
(
$item
[
'nm_sdm'
]),
strtolower
(
$keyword
))){
$items
[
$item
->
id
][
'nm_sdm'
]
=
$item
->
nidn
;
$itemData
=
[
'id'
=>
encrypt
(
$item
[
'id_sdm'
]
.
'_'
.
$item
[
'nm_sdm'
]
.
'_'
.
$item
[
'nidn'
]),
'full_name'
=>
$item
[
'nm_sdm'
],
'description'
=>
$item
[
'prodi'
],
'nidn'
=>
$item
[
'nidn'
],
];
$items
[]
=
$itemData
;
$total_count
=
$total_count
+
1
;
$total_count
=
$total_count
+
1
;
}
}
}
}
}
$data
=
[
$data
=
[
'total_count'
=>
$total_count
,
'total_count'
=>
$total_count
,
'incomplete_results'
=>
false
,
'items'
=>
$items
,
'items'
=>
$items
,
];
];
//dd($data);
//dd($data);
return
response
(
)
->
json
(
$data
);
return
response
(
$data
,
200
);
}
}
}
}
app/Http/Controllers/Mahasiswa/KelompokController.php
View file @
935276dc
...
@@ -71,6 +71,7 @@ class KelompokController extends Controller
...
@@ -71,6 +71,7 @@ class KelompokController extends Controller
$getDosen
=
GetDataApiController
::
getDosen
();
$getDosen
=
GetDataApiController
::
getDosen
();
$periode
=
Periode
::
query
()
->
where
(
'status'
,
1
)
->
first
();
$periode
=
Periode
::
query
()
->
where
(
'status'
,
1
)
->
first
();
$data
=
[
$data
=
[
'title'
=>
$title
,
'title'
=>
$title
,
'dosen'
=>
$getDosen
[
'data'
],
'dosen'
=>
$getDosen
[
'data'
],
...
@@ -140,7 +141,7 @@ class KelompokController extends Controller
...
@@ -140,7 +141,7 @@ class KelompokController extends Controller
'created_user'
=>
Auth
::
user
()
->
id
'created_user'
=>
Auth
::
user
()
->
id
]);
]);
return
redirect
()
->
intended
(
route
(
'mahasiswa.kelompok.createnew'
,
[
'id'
=>
encrypt
(
$kel
->
kelompok_id
)]))
->
with
(
'success'
,
'Berhasil membuat elompok!'
);
return
redirect
()
->
intended
(
route
(
'mahasiswa.kelompok.createnew'
,
[
'id'
=>
encrypt
(
$kel
->
kelompok_id
)]))
->
with
(
'success'
,
'Berhasil membuat
K
elompok!'
);
}
}
/**
/**
...
...
resources/views/backend/mahasiswa/kelompok/create.blade.php
View file @
935276dc
...
@@ -36,11 +36,8 @@
...
@@ -36,11 +36,8 @@
<label class="
col
-
sm
-
2
col
-
form
-
label
">Dosen Pembimbing</label>
<label class="
col
-
sm
-
2
col
-
form
-
label
">Dosen Pembimbing</label>
<div class="
col
-
sm
-
10
">
<div class="
col
-
sm
-
10
">
<input type="
hidden
" name="
periode
" value="
{{
$periode
[
'periode_id'
]
}}
" >
<input type="
hidden
" name="
periode
" value="
{{
$periode
[
'periode_id'
]
}}
" >
<select class="
form
-
select
select2
" name="
dosen
">
<select class="
form
-
select
" id="
selectDosen
" name="
dosen
">
<option selected>Pilih Dosen</option>
@foreach(
$dosen
as
$item
)
<option value="
{{
encrypt
(
$item
[
'id_sdm'
]
.
'_'
.
$item
[
'nm_sdm'
]
.
'_'
.
$item
[
'nidn'
])
}}
">{{
$item['nm_sdm']
.' - '.
$item['prodi']
}}</option>
@endforeach
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -65,7 +62,64 @@
...
@@ -65,7 +62,64 @@
@section('js')
@section('js')
<script>
<script>
$(document).ready(function() {
$(document).ready(function() {
$("
.
select2
").select2();
$("
#selectDosen").select2({
ajax
:
{
url
:
"{{ route('api.getDosen') }}"
,
dataType
:
'json'
,
delay
:
250
,
data
:
function
(
params
)
{
return
{
q
:
params
.
term
,
// search term
page
:
params
.
page
};
},
processResults
:
function
(
data
,
params
)
{
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params
.
page
=
params
.
page
||
1
;
return
{
results
:
data
.
items
,
pagination
:
{
more
:
(
params
.
page
*
30
)
<
data
.
total_count
}
};
},
cache
:
true
},
placeholder
:
'Pilih Dosen Pembimbing'
,
minimumInputLength
:
1
,
templateResult
:
formatRepo
,
templateSelection
:
formatRepoSelection
});
});
});
function
formatRepo
(
repo
)
{
if
(
repo
.
loading
)
{
return
repo
.
text
;
}
var
$container
=
$
(
"<div class='select2-result-repository clearfix'>"
+
"<div class='select2-result-repository__meta'>"
+
"<div class='select2-result-repository__title'></div>"
+
"<div class='select2-result-repository__description'></div>"
+
"</div>"
+
"</div>"
);
$container
.
find
(
".select2-result-repository__title"
)
.
text
(
repo
.
full_name
);
$container
.
find
(
".select2-result-repository__description"
)
.
text
(
repo
.
description
);
return
$container
;
}
function
formatRepoSelection
(
repo
)
{
return
repo
.
full_name
||
repo
.
text
;
}
</
script
>
</
script
>
@
endsection
@
endsection
resources/views/backend/mahasiswa/kelompok/index.blade.php
View file @
935276dc
...
@@ -248,39 +248,5 @@
...
@@ -248,39 +248,5 @@
}
}
function
formatRepo
(
repo
)
{
if
(
repo
.
loading
)
{
return
repo
.
text
;
}
var
$container
=
$
(
"<div class='select2-result-repository clearfix'>"
+
"<div class='select2-result-repository__avatar'><img src='"
+
repo
.
owner
.
avatar_url
+
"' /></div>"
+
"<div class='select2-result-repository__meta'>"
+
"<div class='select2-result-repository__title'></div>"
+
"<div class='select2-result-repository__description'></div>"
+
"<div class='select2-result-repository__statistics'>"
+
"<div class='select2-result-repository__forks'><i class='fa fa-flash'></i> </div>"
+
"<div class='select2-result-repository__stargazers'><i class='fa fa-star'></i> </div>"
+
"<div class='select2-result-repository__watchers'><i class='fa fa-eye'></i> </div>"
+
"</div>"
+
"</div>"
+
"</div>"
);
$container
.
find
(
".select2-result-repository__title"
)
.
text
(
repo
.
full_name
);
$container
.
find
(
".select2-result-repository__description"
)
.
text
(
repo
.
description
);
$container
.
find
(
".select2-result-repository__forks"
)
.
append
(
repo
.
forks_count
+
" Forks"
);
$container
.
find
(
".select2-result-repository__stargazers"
)
.
append
(
repo
.
stargazers_count
+
" Stars"
);
$container
.
find
(
".select2-result-repository__watchers"
)
.
append
(
repo
.
watchers_count
+
" Watchers"
);
return
$container
;
}
function
formatRepoSelection
(
repo
)
{
return
repo
.
full_name
||
repo
.
text
;
}
</
script
>
</
script
>
@
endsection
@
endsection
routes/api.php
View file @
935276dc
<?php
<?php
use
App\Http\Controllers\Api\DosenController
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Route
;
use
Illuminate\Support\Facades\Route
;
...
@@ -17,3 +18,7 @@ use Illuminate\Support\Facades\Route;
...
@@ -17,3 +18,7 @@ use Illuminate\Support\Facades\Route;
Route
::
middleware
(
'auth:sanctum'
)
->
get
(
'/user'
,
function
(
Request
$request
)
{
Route
::
middleware
(
'auth:sanctum'
)
->
get
(
'/user'
,
function
(
Request
$request
)
{
return
$request
->
user
();
return
$request
->
user
();
});
});
Route
::
group
([
'namespace'
=>
'Api'
],
function
()
{
Route
::
get
(
'getDosen'
,
[
DosenController
::
class
,
'getDosen'
])
->
name
(
'api.getDosen'
);
});
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