Пример #1
0
 public function carian2($carian)
 {
     if (Request::ajax()) {
         if ($carian != '') {
             $users = Staff::where('nama', 'like', '%' . $carian . '%')->get();
             $count = 1;
             $output = '<table class="table table-striped table-bordered responsive">
                             <thead>
                             <tr>
                                 <th>Bil</th>
                                 <th>Nama</th>
                                 <th>Sambungan</th>
                                 <th>Speed Dial</th>
                                 <th>Jawatan</th>
                             </tr>
                             </thead>
                             <tbody>';
             foreach ($users as $user) {
                 $kemaskini = URL::route('staff-kemaskini') . '/' . $user->noPekerja;
                 $output .= '<tr>
                                     <td>' . $count++ . '</td>
                                     <td class="center"><b>' . $user->nama . '</b></td>
                                     <td class="center"><b>' . $user->sambungan . '</b></td>';
                 $speedDial = '';
                 if (strlen($user->speedDial) < 4) {
                     $speedDial = '# ' . $user->speedDial;
                 } else {
                     $speedDial = $user->speedDial;
                 }
                 $output .= '   <td class="center"><b>' . $speedDial . '</b></td>
                                     <td class="center"><b>' . $user->jawatan . '</b></td>
                                 </tr>';
             }
             $output .= '    </tbody>
                         </table>';
             if ($users->count() == 0) {
                 $output = '<table class="table table-striped table-bordered responsive">
                             <thead>
                             <tr>
                                 <th>Bil</th>
                                 <th>Nama</th>
                                 <th>No Telefon</th>
                                 <th>Speed Dial</th>
                                 <th>No Faks</th>
                                 <th>Alamat</th>
                             </tr>
                             </thead>
                             <tbody>
                             <tr>
                                     <td colspan="6"><font color="red">Tiada Maklumat</font></td>
                                 </tr>
                             </tbody>
                             </table>';
             }
             return $output;
         } else {
             return '';
         }
     }
 }
Пример #2
0
 public function senaraiSpeedDial2()
 {
     $staff = Staff::where('speedDial', '<>', '0')->where('speedDial', '<>', '')->orderBy('speedDial', 'asc')->get();
     $syarikat = Syarikat::where('speedDial', '<>', '')->where('speedDial', '<>', '0')->orderBy('speedDial', 'asc')->get();
     $speedDialData[] = '';
     foreach ($staff as $staf) {
         $speedDialData[$staf->speedDial] = ['nama' => $staf->nama, 'bahagian' => $staf->bahagian, 'speedDial' => $staf->speedDial, 'noPhone' => $staf->noPhone];
     }
     foreach ($syarikat as $sykt) {
         $speedDialData[$sykt->speedDial] = ['nama' => $sykt->nama, 'bahagian' => $sykt->alamat, 'speedDial' => $sykt->speedDial, 'noPhone' => $sykt->noTel];
     }
     echo '<pre>', var_dump($speedDialData), '</pre>';
     foreach ($speedDialData as $data) {
         echo $data->nama;
     }
     return 'done';
     return View::make('/admin/senarai/speedDial2')->with('title', 'Senarai Speed Dial')->with('data', $speedDialData);
 }
Пример #3
0
 public function apiSearch($username)
 {
     $users = Staff::where('nama', 'like', '%' . $username . '%')->get();
     return $users = json_encode($users);
 }
Пример #4
0
 public function show($id)
 {
     $this->breadcrumb->append_crumb('Home', base_url());
     $this->breadcrumb->append_crumb('Staff Detail', base_url() . '');
     $staff = new Staff();
     $data['staff'] = $staff->where('staff_id', $id)->get();
     $family = new Family();
     $data['families'] = $family->where('staff_fam_staff_id', $data['staff']->staff_id)->get();
     $work = new Work();
     $data['works'] = $work->where('staff_id', $data['staff']->staff_id)->get();
     $education = new Education();
     $data['educations'] = $education->where('staff_id', $data['staff']->staff_id)->get();
     $medical = new Medical();
     $data['medicals'] = $medical->where('staff_id', $data['staff']->staff_id)->get();
     $asset_detail = new Asset_Detail();
     $data['asset_details'] = $asset_detail->where('staff_id', $data['staff']->staff_id)->get();
     $data['btn_back'] = anchor('staffs/', 'Back');
     $data['btn_edit'] = anchor('staffs/edit/' . $data['staff']->staff_id, 'Edit');
     $this->load->view('staffs/show', $data);
 }
Пример #5
0
 function get_count_dep($cb, $dept)
 {
     $staff = new Staff();
     $query = $staff->where('staff_cabang', 'Bandung')->where('staff_departement', 'Accounting')->count();
     return $query;
 }