From 0759a2e5589eb48cd5fa3f7c36de412fd7236fbf Mon Sep 17 00:00:00 2001 From: Yoga Adrian <yoga.adrians14@gmail.com> Date: Thu, 12 May 2016 16:00:42 +0700 Subject: [PATCH] backend statisik --- .../Http/Controllers/PendFormalController.php | 14 +++- ppl2/app/Http/routes.php | 2 + .../views/pages/statistikStrata.blade.php | 68 +++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 ppl2/resources/views/pages/statistikStrata.blade.php diff --git a/ppl2/app/Http/Controllers/PendFormalController.php b/ppl2/app/Http/Controllers/PendFormalController.php index b25ea01..3ff71d6 100644 --- a/ppl2/app/Http/Controllers/PendFormalController.php +++ b/ppl2/app/Http/Controllers/PendFormalController.php @@ -10,6 +10,8 @@ use App\PendidikanFormal; use Session; +use DB; + class PendFormalController extends Controller { // @@ -21,9 +23,19 @@ class PendFormalController extends Controller public function getPendidikan($nip) { $pend = PendidikanFormal::where('nip',$nip)->get(); - return view('pages.pendidikanPegawai',compact('pend','nip'));; + return view('pages.pendidikanPegawai',compact('pend','nip')); } + public function getStatistikStrata() { + $pend = DB::table('pendidikan_formal') + ->select(DB::raw('count(*) as jumlah, tingkatan')) + ->groupBy('tingkatan') + ->get(); + $nip = null; + return $pend; + } + + public function edit($id) { $pend = PendidikanFormal::find($id); return view('pages.editFormal', compact('pend')); diff --git a/ppl2/app/Http/routes.php b/ppl2/app/Http/routes.php index d9d6066..a353246 100644 --- a/ppl2/app/Http/routes.php +++ b/ppl2/app/Http/routes.php @@ -27,6 +27,8 @@ Route::get('pendidikan-formal/{id}/edit','PendFormalController@edit'); Route::get('pendidikan-formal/all/{nip}','PendFormalController@getPendidikan'); +Route::get('pendidikan-formal/statistik','PendFormalController@getStatistikStrata'); + Route::post('pendidikan-formal/add', 'PendFormalController@store'); Route::get('pendidikan-formal', 'PendFormalController@getAll'); diff --git a/ppl2/resources/views/pages/statistikStrata.blade.php b/ppl2/resources/views/pages/statistikStrata.blade.php new file mode 100644 index 0000000..5025a69 --- /dev/null +++ b/ppl2/resources/views/pages/statistikStrata.blade.php @@ -0,0 +1,68 @@ +@extends('app_template') + +@section('title') + Pendidikan Formal Pegawai +@stop + +@section('page_title') + <h2>Pendidikan Formal Pegawai</h2> +@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 + <div class="row"> + <div class="col-md-3"> + <button class="btn m-b-sm m-r-sm btn-success" onclick="location.href = '{{URL::to('/')}}/pendidikan-formal/new';"><i class="m-r-xs fa fa-plus"></i>Tambahkan Pendidikan</button> + </div> + <div class="col-md-6"> + <form action = "{{URL::to('/')}}/pendidikan-formal/search" method="GET"> + <div class="input-group"> + <input type="text" class="form-control" placeholder="Cari berdasarkan NIP" name="query" required> + <span class="input-group-btn"> + <button class="btn btn-default" type="submit">Go!</button> + </span> + </div> + </form> + </div> + </div> +@stop + +@section('content') +<div class="panel panel-default"> + <div class="panel-heading font-semibold"> + <!-- Tampilkan Pesan --> + Tabel Pendidikan + @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">tingkatan</th> + <th>strata</th> + </tr> + </thead> + <tbody> + <?php $i = 1; ?> + @foreach($pend as $pendidikan) + <tr data-expanded="true"> + <td>{{$pendidikan -> jumlah}}</td> + <td>{{$pendidikan -> tingkatan}}</td> + </tr> + <?php $i++ ;?> + @endforeach + </tbody> + </table> + </div> +@stop \ No newline at end of file -- GitLab