From 98a1a9a5f01e27eac7de2e50ea82d255a4997721 Mon Sep 17 00:00:00 2001 From: SatriaPriambada <satriapriambada@gmail.com> Date: Tue, 17 May 2016 15:02:09 +0700 Subject: [PATCH] all functionality done --- .../Controllers/PenjadwalanController.php | 14 ++- .../Controllers/pendaftaranController.php | 37 ++++++-- ppl2/app/Http/routes.php | 6 +- .../views/pages/konfirmasi.blade.php | 85 +++++++++++++++++++ 4 files changed, 130 insertions(+), 12 deletions(-) create mode 100644 ppl2/resources/views/pages/konfirmasi.blade.php diff --git a/ppl2/app/Http/Controllers/PenjadwalanController.php b/ppl2/app/Http/Controllers/PenjadwalanController.php index 978ebf8..ecde0d1 100644 --- a/ppl2/app/Http/Controllers/PenjadwalanController.php +++ b/ppl2/app/Http/Controllers/PenjadwalanController.php @@ -80,10 +80,16 @@ class PenjadwalanController extends Controller // $penjadwalan = Penjadwalan::find($id); - $penjadwalan->judul_kegiatan = $request->input('judul'); - $penjadwalan->nama_penyelenggara = $request->input('nama'); - $penjadwalan->ruangan = $request->input('ruangan'); - $penjadwalan->waktu = $request->input('waktu'); + $penjadwalan->keahlian = $request->input('keahlian'); + $penjadwalan->nama_institusi = $request->input('nama_institusi'); + $penjadwalan->tempat = $request->input('ruangan'); + if($request->input('ruangan') == 1){ + $penjadwalan->kapasitas = 50; + } else { + $penjadwalan->kapasitas = 100; + } + $penjadwalan->waktu = $request->input('waktu'); + $penjadwalan->durasi_ijazah = $request->input('durasi'); $penjadwalan->save(); Session::flash('message', 'Penjadwalan successfully updated'); diff --git a/ppl2/app/Http/Controllers/pendaftaranController.php b/ppl2/app/Http/Controllers/pendaftaranController.php index 9520a88..d78b016 100644 --- a/ppl2/app/Http/Controllers/pendaftaranController.php +++ b/ppl2/app/Http/Controllers/pendaftaranController.php @@ -52,6 +52,7 @@ class pendaftaranController extends Controller $pendaftaran->nip = Input::get('nip'); $pendaftaran->email = Input::get('email'); $pendaftaran->id_jadwal = 1; + $pendaftaran->nama_kegiatan = Input::get('keahlian'); $pendaftaran->save(); // redirect @@ -66,19 +67,34 @@ class pendaftaranController extends Controller * @param int $id * @return Response */ - public function update(Request $request, $id) + public function terimaKonfirmasi($id) { // $pendaftaran = pendaftaran::find($id); - $pendaftaran->judul_kegiatan = $request->input('judul'); - $pendaftaran->nama_penyelenggara = $request->input('nama'); - $pendaftaran->ruangan = $request->input('ruangan'); - $pendaftaran->waktu = $request->input('waktu'); + $pendaftaran->konfirmasi = 'diterima'; $pendaftaran->save(); - Session::flash('message', 'pendaftaran successfully updated'); - return Redirect::to('pendaftaran-diklat'); + Session::flash('message', 'pendaftaran successfully updated to diterima'); + return Redirect::to('konfirmasi'); + } + + /** + * Update the specified resource in storage. + * + * @param int $id + * @return Response + */ + public function tolakKonfirmasi($id) + { + // + $pendaftaran = pendaftaran::find($id); + + $pendaftaran->konfirmasi = 'ditolak'; + $pendaftaran->save(); + + Session::flash('message', 'pendaftaran successfully updated to ditolak'); + return Redirect::to('konfirmasi'); } /** @@ -107,4 +123,11 @@ class pendaftaranController extends Controller $week = strtotime("-1 week", $week); return view('pendaftaran-diklat', ['week' => $week, 'pendaftaran' => $pendaftaran ]); } + + public function getAll() + { + $konfirmasi = pendaftaran::all()->sortby('id_pendaftaran'); + $nip = null; + return view('pages.konfirmasi',compact('konfirmasi','nip')); + } } diff --git a/ppl2/app/Http/routes.php b/ppl2/app/Http/routes.php index 24a907c..c8f7130 100644 --- a/ppl2/app/Http/routes.php +++ b/ppl2/app/Http/routes.php @@ -119,4 +119,8 @@ Route::get('/pendaftaran-diklat/next/{week}', 'pendaftaranController@next'); Route::post('/pendaftaran-diklat/add', 'pendaftaranController@store'); -Route::get('/konfirmasi', 'konfirmasiController@index'); \ No newline at end of file +Route::get('/konfirmasi', 'pendaftaranController@getAll'); + +Route::get('/konfirmasi/{id}/terima', 'pendaftaranController@terimaKonfirmasi'); + +Route::get('/konfirmasi/{id}/tolak', 'pendaftaranController@tolakKonfirmasi'); \ No newline at end of file diff --git a/ppl2/resources/views/pages/konfirmasi.blade.php b/ppl2/resources/views/pages/konfirmasi.blade.php new file mode 100644 index 0000000..f88c3a1 --- /dev/null +++ b/ppl2/resources/views/pages/konfirmasi.blade.php @@ -0,0 +1,85 @@ +@extends('app_template') + +@section('title') + Konfirmasi +@stop + +@section('page_title') + <h2>Konfirmasi Pegawai</h2> +@stop + +@section('aside') +@stop + +@section('head_content') + @if (Session::has('message')) + <div class="alert alert-info fade in">{{ Session::get('message') }} + <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> + </div> + @endif +@stop + +@section('content') +<div class="panel panel-default"> + <div class="panel-heading font-semibold"> + <!-- Tampilkan Pesan --> + Tabel Konfirmasi pendaftaran diklat + @if($nip == null) + Semua Pegawai + @else + Pegawai NIP : {{$nip}} + @endif + </div> + <div> + <table class="table" ui-jq="footable" ui-options='{ + "paging": { + "enabled": true + }}'> + <thead> + <tr> + <th data-breakpoints="xs">No</th> + <th>NIP</th> + <th data-breakpoints="xs md">Email</th> + <th>Keahlian</th> + <th>Status</th> + <th>Ya</th> + <th>Tidak</th> + </tr> + </thead> + <tbody> + <?php $i = 1; ?> + @foreach($konfirmasi as $conf) + <tr data-expanded="true"> + <td>{{$i}}</td> + <td>{{$conf -> nip}}</td> + <td>{{$conf -> email}}</td> + <td>{{$conf -> nama_kegiatan}}</td> + <td>{{$conf -> konfirmasi}}</td> + + <td id = "yes{{$conf->id_pendaftaran}}" data-href = "{{URL::to('/')}}/konfirmasi/{{$conf->id_pendaftaran}}/terima">Terima</td> </a> + <td id = "no{{$conf->id_pendaftaran}}" data-href = "{{URL::to('/')}}/konfirmasi/{{$conf->id_pendaftaran}}/tolak">Tolak + </td> + </tr> + <?php $i++ ;?> + @endforeach + </tbody> + </table> + </div> +@stop + + +@section('js') + <script> + @foreach($konfirmasi as $conf) + $('#yes{{$conf->id_pendaftaran}}').click(function () { + window.location = "{{URL::to('/')}}/konfirmasi/{{$conf->id_pendaftaran}}/terima"; + }); + + $('#no{{$conf->id_pendaftaran}}').click(function () { + window.location = "{{URL::to('/')}}/konfirmasi/{{$conf->id_pendaftaran}}/tolak"; + }); + + @endforeach + + </script> +@stop \ No newline at end of file -- GitLab