public function syarikat($id) { $syarikat = Syarikat::find($id); if ($syarikat->delete()) { echo "<script>alert('Hapus Syarikat Berjaya')</script>"; } else { echo "<script>alert('Hapus Syarikat Gagal')</script>"; } return View::make('admin/carian/carianSyarikat')->with('title', 'Carian Syarikat'); }
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); }
public function kemaskiniSyarikat() { if (Request::ajax()) { $data = Input::all(); $id = $data['id']; $syarikat = Syarikat::find($id); $syarikat->nama = $data['nama']; $syarikat->noTel = $data['noTel']; $syarikat->noTel2 = $data['noTel2']; $syarikat->noTel3 = $data['noTel3']; $syarikat->sambungan = $data['sambungan']; $syarikat->speedDial = $data['speedDial']; $syarikat->noFaks = $data['noFaks']; $syarikat->alamat = $data['alamat']; if ($syarikat->save()) { return 'Save Succeeded'; } else { return 'Failed to save'; } } }
public function kemaskini($id) { $syarikat = Syarikat::find($id); return View::make('admin.kemaskini.syarikat')->with('title', 'Kemaskini Syarikat')->with('syarikat', $syarikat); }
public function carian2($carian) { if (Request::ajax()) { if ($carian != '') { $users = Syarikat::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>No Telefon</th> <th>Sambungan</th> <th>Speed Dial</th> <th>No Faks</th> <th>Alamat</th> <th>Pilihan</th> </tr> </thead> <tbody>'; foreach ($users as $user) { $output .= '<tr> <td>' . $count++ . '</td> <td class="center"><b>' . $user->nama . '</b></td> <td class="center"><b>' . $user->noTel . '<br />' . $user->noTel2 . '<br />' . $user->noTel3 . '</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->noFaks . '</b></td> <td class="center"><b>' . $user->alamat . '</b></td> <td>[ <a href="' . URL::route('syarikat-delete', array($user->id)) . '">Hapus</a> ] [ <a href="' . URL::route('syarikat-kemaskini', array($user->id)) . '">Kemaskini</a> ]</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> <th>Pilihan</th> </tr> </thead> <tbody> <tr> <td colspan="7"><font color="red">Tiada Maklumat</font></td> </tr> </tbody> </table>'; } return $output; } else { return ''; } } }
public function carian3($carian) { if (Request::ajax()) { if ($carian != '') { $users = Syarikat::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>No Telefon</th> <th>Speed Dial</th> <th>No Faks</th> <th>Alamat</th> </tr> </thead> <tbody>'; foreach ($users as $user) { $output .= '<tr> <td>' . $count++ . '</td> <td class="center">' . $user->nama . '</td> <td class="center">' . $user->noTel . '<br />' . $user->noTel2 . '<br />' . $user->noTel3 . '</td>'; $speedDial = ''; if (strlen($user->speedDial) < 4) { $speedDial = '# ' . $user->speedDial; } else { $speedDial = $user->speedDial; } $output .= ' <td class="center">' . $speedDial . '</td> <td class="center">' . $user->noFaks . '</td> <td class="center">' . $user->alamat . '</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 ''; } } }
public function daftarSyarikatPost() { if (Request::ajax()) { $data = Input::all(); $syarikat = new Syarikat(); $syarikat->nama = strtoupper($data['nama']); $syarikat->noTel = $data['noTel']; $syarikat->noTel2 = $data['noTel2']; $syarikat->noTel3 = $data['noTel3']; $syarikat->sambungan = $data['sambungan']; $syarikat->speedDial = $data['speedDial']; $syarikat->noFaks = $data['noFaks']; $syarikat->alamat = strtoupper($data['alamat']); if ($syarikat->save()) { return 1; } else { return 0; } } }