Commit 99798df4 by Farendi Giotivano R.P

ganti kelompok

parent d5766ce3
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class DosenController extends Controller
{
public function getDosen(Request $request)
{
$keyword = $request->q;
$getDosen = GetDataApiController::getDosen();
$total_count = 0;
$incomplete_results = true;
$items = array();
if ($getDosen->isEmpty()) {
$items = array();
} else {
$no = 0;
foreach ($getDosen as $item) {
$items[$item->id]['nm_sdm'] = $item->nm_sdm;
$items[$item->id]['nm_sdm'] = $item->prodi;
$items[$item->id]['nm_sdm'] = $item->nidn;
$total_count = $total_count + 1;
}
}
$data = [
'total_count' => $total_count,
'items' => $items,
];
//dd($data);
return response()->json($data);
}
}
...@@ -65,6 +65,21 @@ class KelompokController extends Controller ...@@ -65,6 +65,21 @@ class KelompokController extends Controller
public function create() public function create()
{ {
// //
$title = 'Kelompok Mahasiswa';
$bio = auth()->user()->rBiodata;
$nim = $bio->noidentitas;
$getDosen = GetDataApiController::getDosen();
$periode = Periode::query()->where('status', 1)->first();
$data = [
'title' => $title,
'dosen' => $getDosen['data'],
'periode' => $periode,
];
return view('backend.mahasiswa.kelompok.create', $data);
} }
public function newkelompok($id) public function newkelompok($id)
...@@ -126,7 +141,7 @@ class KelompokController extends Controller ...@@ -126,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 Melakukan Verifikasi!'); return redirect()->intended(route('mahasiswa.kelompok.createnew', ['id' => encrypt($kel->kelompok_id)]))->with('success', 'Berhasil membuat kelompok!');
} }
/** /**
......
...@@ -32,17 +32,10 @@ ...@@ -32,17 +32,10 @@
@csrf @csrf
<h4 class="card-title">Kelompok Baru</h4> <h4 class="card-title">Kelompok Baru</h4>
<p class="card-title-desc"></p> <p class="card-title-desc"></p>
<div class="row mb-3">
<label for="kode" class="col-sm-2 col-form-label">Kode Kelompok</label>
<div class="col-sm-10">
<input class="form-control" type="text" id="kode" name="kode" value="{{ $kode }}" disabled>
<input type="hidden" name="kode" value="{{ $kode }}">
<input type="hidden" name="periode" value="{{ $periode['periode_id'] }}" >
</div>
</div>
<div class=" row mb-3"> <div class=" row mb-3">
<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'] }}" >
<select class="form-select select2" name="dosen"> <select class="form-select select2" name="dosen">
<option selected>Pilih Dosen</option> <option selected>Pilih Dosen</option>
@foreach($dosen as $item) @foreach($dosen as $item)
......
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
</div> </div>
</div> </div>
{{ Form::open(['url' => route('mahasiswa.kelompok.kirim'), 'method' => 'post', 'id' => 'addKelompok']) }} {{ Form::open(['url' => route('mahasiswa.kelompok.kirim'), 'method' => 'post', 'id' => 'addKelompok']) }}
{!! Form::hidden('kelompok_id', $kelompok->kelompok_id) !!} {!! Form::hidden('kelompok_id', $kelompok->kelompok_id) !!}
{{ Form::close() }} {{ Form::close() }}
...@@ -101,6 +102,9 @@ ...@@ -101,6 +102,9 @@
<div class="col-lg-12"> <div class="col-lg-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="alert alert-success alert-dismissible fade show" role="alert">
<strong>Informasi!</strong> Anggota kelompok minimal 3 dan maksimal 5 </strong>
</div>
<div class="mb-0"> <div class="mb-0">
@if($kelompok->rAnggota->count() >= 3) @if($kelompok->rAnggota->count() >= 3)
<button type="submit" class="btn btn-primary waves-effect waves-light me-1 btnSimpanKelompok" id="btnSimpanKelompok"> Submit </button> <button type="submit" class="btn btn-primary waves-effect waves-light me-1 btnSimpanKelompok" id="btnSimpanKelompok"> Submit </button>
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="float-end d-none d-md-block"> <div class="float-end d-none d-md-block">
@if($cekKel == 0) @if($cekKel == 0)
<button type="button" class="btn btn-primary waves-effect waves-light" data-bs-toggle="modal" data-bs-target="#tmbhKel">Tambah Data</button> <a href="{{ route('mahasiswa.kelompok.create') }}" class="btn btn-primary waves-effect waves-light">Tambah</a>
{{-- <button type="button" class="btn btn-primary waves-effect waves-light" data-bs-toggle="modal" data-bs-target="#tmbhKel">Tambah Data</button> --}}
@endif @endif
</div> </div>
</div> </div>
...@@ -159,46 +160,49 @@ ...@@ -159,46 +160,49 @@
</div> </div>
</div> <!-- end col --> </div> <!-- end col -->
</div> <!-- end row --> </div> <!-- end row -->
<div id="tmbhKel" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form action="{{ route('mahasiswa.kelompok.store') }}" method="POST">
@csrf
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Tambah Kelompok Baru</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="col-12">
<h5 class="font-size-16">Silahkan pilih dosen pembimbing : </h5>
<p>
<input type="hidden" name="periode" value="{{ $periode->where('status', 1)->first()->periode_id; }}" >
<select class="form-select" style="width: 100%" id="selectmodal" 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>
</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary waves-effect waves-light">Save changes</button>
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
@endsection @endsection
@section('js') @section('js')
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// $(".selectmodal").select2({
// ajax: {
// url: "https://api.github.com/search/repositories",
// 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: 'Search for a repository',
// minimumInputLength: 1,
// templateResult: formatRepo,
// templateSelection: formatRepoSelection
// });
$("#selectmodal").select2({ $("#selectmodal").select2({
dropdownParent: $("#tmbhKel") dropdownParent: $("#tmbhKel")
}); });
...@@ -242,5 +246,41 @@ ...@@ -242,5 +246,41 @@
} }
}) })
} }
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
<div id="tmbhKel" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form action="{{ route('mahasiswa.kelompok.store') }}" method="POST">
@csrf
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Tambah Kelompok Baru</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="col-12">
<h5 class="font-size-16">Silahkan pilih dosen pembimbing : </h5>
<p>
<input type="hidden" name="periode" value="{{ $periode->where('status', 1)->first()->periode_id; }}" >
<select class="form-select" style="width: 100%" id="selectmodal" 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>
</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary waves-effect waves-light">Save changes</button>
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment