Example #1
0
 public static function getPeersByStatus($competencyId, $userNip, $status)
 {
     $peers = CompetencyPeers::where('user_id', '=', $userNip)->where('competency_id', '=', $competencyId)->where('status', '=', $status)->groupBy('rater_id')->get();
     return $peers;
 }
 public function getPrs()
 {
     $breadcrumbs = array(array("Kompetensi" => ""), array("Pengukuran" => ""), array("Kemajuan" => ""), array("Orang Lain" => ""));
     $user = Auth::user();
     //list Peers
     $listPeers = CompetencyPeers::with('user', 'rater')->where('rater_id', '=', $user->nip)->where(function ($query) {
         $query->where('status', '=', 'kolega');
         //                    ->orWhere('status', '=', 'customer');
     })->get();
     $riwJabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $user->nip);
     $bawahan = DafUnitStaff::with('bawahan.bawahan')->where('unit_staf_id', '=', $riwJabatan->unit_staf_id)->first();
     $atasan = DafUnitStaff::with('atasan')->where('unit_staf_id', '=', $riwJabatan->unit_staf_id)->first();
     $data = array();
     $competencyType = CompetencyType::all();
     foreach ($listPeers as $peers) {
         //get jabatan
         $riwJabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $peers->user_id);
         $totalProfile = count(CompetencyProfile::getProfileAll($riwJabatan->unit_staf_id, $this->competencyData->id));
         $checkProfile = count(CompetencyProfile::checkTestPrs($peers->user_id, $user->nip, $riwJabatan->unit_staf_id, $this->competencyData->id));
         $result = array();
         foreach ($competencyType as $rowType) {
             $profile = CompetencyProfile::getProfile($riwJabatan->unit_staf_id, $this->competencyData->id, $rowType->id);
             $result[] = array('type' => array('id' => $rowType->id, 'name' => $rowType->name), 'profile' => $profile);
         }
         $data[] = array('id' => $peers->id, 'nip' => $peers->user_id, 'nama' => $peers->user->nama, 'status' => $peers->status, 'progress' => "" . $totalProfile - $checkProfile . " pengisian dari " . $totalProfile . " kompetensi", 'data' => $result);
     }
     //list bawahan level 1 & 2
     if (isset($bawahan->bawahan) && $bawahan->bawahan != null) {
         foreach ($bawahan->bawahan as $rowBawahanlvl1) {
             //get user
             $userBawahan = RiwJabStruk::getUser($this->competencyData->date_start, $rowBawahanlvl1->unit_staf_id);
             if (isset($userBawahan) && $userBawahan != null) {
                 $riwJabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $userBawahan->nip);
                 $totalProfile = count(CompetencyProfile::getProfileAll($riwJabatan->unit_staf_id, $this->competencyData->id));
                 $checkProfile = count(CompetencyProfile::checkTestPrs($userBawahan->nip, $user->nip, $riwJabatan->unit_staf_id, $this->competencyData->id));
                 $result = array();
                 foreach ($competencyType as $rowType) {
                     $profile = CompetencyProfile::getProfile($riwJabatan->unit_staf_id, $this->competencyData->id, $rowType->id);
                     $result[] = array('type' => array('id' => $rowType->id, 'name' => $rowType->name), 'profile' => $profile);
                 }
                 $data[] = array('id' => $userBawahan->nip, 'nip' => $userBawahan->nip, 'nama' => $userBawahan->pegawai->nama, 'status' => 'bawahan level 1', 'progress' => "" . $totalProfile - $checkProfile . " pengisian dari " . $totalProfile . " kompetensi", 'data' => $result);
             }
             //list bawahan level 2
             if (isset($bawahan->bawahan->bawahan) && $bawahan->bawahan->bawahan != null) {
                 foreach ($bawahan->bawahan as $rowBawahanlvl2) {
                     //get user
                     $userBawahan = RiwJabStruk::getUser($this->competencyData->date_start, [$rowBawahanlvl2->unit_staf_id]);
                     if (isset($userBawahan) && $userBawahan != null) {
                         $riwJabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $userBawahan->nip);
                         $totalProfile = count(CompetencyProfile::getProfileAll($riwJabatan->unit_staf_id, $this->competencyData->id));
                         $checkProfile = count(CompetencyProfile::checkTestPrs($userBawahan->nip, $user->nip, $riwJabatan->unit_staf_id, $this->competencyData->id));
                         $result = array();
                         foreach ($competencyType as $rowType) {
                             $profile = CompetencyProfile::getProfile($riwJabatan->unit_staf_id, $this->competencyData->id, $rowType->id);
                             $result[] = array('type' => array('id' => $rowType->id, 'name' => $rowType->name), 'profile' => $profile);
                         }
                         $data[] = array('id' => $userBawahan->nip, 'nip' => $userBawahan->nip, 'nama' => $userBawahan->pegawai->nama, 'status' => 'bawahan level 2', 'progress' => "" . $totalProfile - $checkProfile . " pengisian dari " . $totalProfile . " kompetensi", 'data' => $result);
                     }
                 }
             }
         }
     }
     //list atasan
     if (isset($atasan->atasan) && $atasan->atasan != null) {
         $rowAtasan = $atasan->atasan;
         //get user
         $userBawahan = RiwJabStruk::getUser($this->competencyData->date_start, $rowAtasan->unit_staf_id);
         if (isset($userBawahan) && $userBawahan != null) {
             $riwJabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $userBawahan->nip);
             $totalProfile = count(CompetencyProfile::getProfileAll($riwJabatan->unit_staf_id, $this->competencyData->id));
             $checkProfile = count(CompetencyProfile::checkTestPrs($userBawahan->nip, $user->nip, $riwJabatan->unit_staf_id, $this->competencyData->id));
             $result = array();
             foreach ($competencyType as $rowType) {
                 $profile = CompetencyProfile::getProfile($riwJabatan->unit_staf_id, $this->competencyData->id, $rowType->id);
                 $result[] = array('type' => array('id' => $rowType->id, 'name' => $rowType->name), 'profile' => $profile);
             }
             $data[] = array('id' => $userBawahan->nip, 'nip' => $userBawahan->nip, 'nama' => $userBawahan->pegawai->nama, 'status' => 'atasan', 'progress' => "" . $totalProfile - $checkProfile . " pengisian dari " . $totalProfile . " kompetensi", 'data' => $result);
         }
     }
     //        return $data;
     $this->layout->breadcrumbs = View::make('layouts.breadcrumb', compact('breadcrumbs'));
     $this->layout->content = View::make('competency::progress.peers', compact('data'));
 }
 public function apiDetail($id)
 {
     $competencyActive = Competency::getActive();
     $peers = CompetencyPeers::with('rater.jabatanpengukuran.jabatan.unit')->find($id);
     return $peers;
 }
Example #4
0
 public function peersAction($typeId, $step = 1)
 {
     $page = $step - 1;
     if (Request::isMethod('post')) {
     } else {
         //data dari session
         $nip = Auth::user()->nip;
         $jabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $nip);
         //cek peers
         $peers = CompetencyPeers::getSoftPeers($this->competencyData->id, $nip);
         if ($peers != null) {
             //get jabatan Array
             $jabatanArray = RiwJabStruk::getJabatanofPeers($this->competencyData->date_start, $peers);
             //get profile by jabatan Array
             $profiles = CompetencyProfile::getProfilefromPeers($this->competencyData->id, $jabatanArray, $typeId)->take(1)->skip($page)->first();
             //get jabatan from profiles
             $jabatanProfile = CompetencyProfile::getJabatanfromProfile($this->competencyData->id, $profiles->competency_dictionary_id);
             //get user detail from jabatan
             $jabatan = array_intersect($jabatanArray, $jabatanProfile);
             $users = RiwJabStruk::getUserfromJabatan($this->competencyData->date_start, $jabatan);
             $this->layout->content = View::make('competency::test.peers', compact('profiles', 'users'));
         } else {
             dd('error');
         }
     }
 }
 public function postAction($type, $id)
 {
     $userNip = Auth::user()->nip;
     $peers = CompetencyPeers::find($id);
     if ($peers != null) {
         //get User
         $pegawai = MasterPegawai::find($peers->user_id);
     } else {
         $pegawai = MasterPegawai::find($id);
     }
     // cek memiliki recap_id atau enggak
     $recap = CompetencyRecap::where('competency_id', '=', $this->competencyData->id)->where('user_nip', '=', $pegawai->nip)->first();
     if (is_null($recap)) {
         //get jabatan
         $riwJabatan = RiwJabStruk::getJabatanOnCompetency($this->competencyData->date_start, $pegawai->nip);
         $recap = new CompetencyRecap();
         $recap->competency_id = $this->competencyData->id;
         $recap->user_nip = $pegawai->nip;
         $recap->occupation_id = $riwJabatan->unit_staf_id;
         $recap->save();
     }
     //simpan ke dalam database
     $test = new CompetencyTest();
     $test->competency_id = $this->competencyData->id;
     $test->competency_recap_id = $recap->id;
     $test->competency_dictionary_id = Input::get('compId');
     $test->user_id = $pegawai->nip;
     $test->rater_id = $userNip;
     $test->level = Input::get('level');
     $test->evidence = Input::get('evidence');
     if ($test->save()) {
         return Redirect::to('competency/test/prs/action/' . $type . '/' . $id . '');
     }
 }