Пример #1
0
 /**
  * Mencari data absen dengan menggunakan filter search.
  *
  * @return string
  */
 public function cariAbsen()
 {
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $karyawan = Karyawan::where("id_karyawan", ">", "1")->get();
         $shifts = Shift::shift();
         if (\Input::get('karyawan') != null && \Input::get('shift') == null && \Input::get('tipe') == null) {
             $cariAbsen = Absen::where("id_karyawan", "=", \Input::get('karyawan'))->orderBy("id_absen", "DESC")->paginate(10)->appends(['karyawan' => \Input::get('karyawan')]);
         } elseif (\Input::get('karyawan') == null && \Input::get('shift') != null && \Input::get('tipe') == null) {
             $cariAbsen = Absen::where("id_shift", "=", \Input::get('shift'))->orderBy("id_absen", "DESC")->paginate(10)->appends(['shift' => \Input::get('shift')]);
         } elseif (\Input::get('karyawan') == null && \Input::get('shift') == null && \Input::get('tipe') != null) {
             $cariAbsen = Absen::where("status", "=", \Input::get('tipe'))->orderBy("id_absen", "DESC")->paginate(10)->appends(['tipe' => \Input::get('tipe')]);
         } elseif (\Input::get('karyawan') != null && \Input::get('shift') != null && \Input::get('tipe') == null) {
             $cariAbsen = Absen::where("id_karyawan", "=", \Input::get('karyawan'))->where("id_shift", "=", \Input::get('shift'))->paginate(10)->appends(['karyawan' => \Input::get('karyawan'), 'shift' => \Input::get('shift')]);
         } elseif (\Input::get('karyawan') != null && \Input::get('shift') == null && \Input::get('tipe') != null) {
             $cariAbsen = Absen::where("id_karyawan", "=", \Input::get('karyawan'))->where("status", "=", \Input::get('tipe'))->orderBy("id_absen", "DESC")->paginate(10)->appends(['karyawan' => \Input::get('karyawan'), 'tipe' => \Input::get('tipe')]);
         } elseif (\Input::get('karyawan') == null && \Input::get('shift') != null && \Input::get('tipe') != null) {
             $cariAbsen = Absen::where("id_shift", "=", \Input::get('shift'))->where("status", "=", \Input::get('tipe'))->orderBy("id_absen", "DESC")->paginate(10)->appends(['shift' => \Input::get('shift'), 'tipe' => \Input::get('tipe')]);
         } elseif (\Input::get('karyawan') != null && \Input::get('shift') != null && \Input::get('tipe') != null) {
             $cariAbsen = Absen::where("id_karyawan", "=", \Input::get('karyawan'))->where("id_shift", "=", \Input::get('shift'))->where("status", "=", \Input::get('tipe'))->orderBy("id_absen", "DESC")->paginate(10)->appends(['karyawan' => \Input::get('karyawan'), 'shift' => \Input::get('shift'), 'tipe' => \Input::get('tipe')]);
         } else {
             $cariAbsen = Absen::orderBy("id_absen", "DESC")->paginate(10)->appends(['karyawan' => \Input::get('karyawan'), 'shift' => \Input::get('shift'), 'tipe' => \Input::get('tipe')]);
         }
         return view('admin/absen/cari')->with("cariAbsen", $cariAbsen)->with("karyawan", $karyawan)->with("shifts", $shifts);
     } else {
         return view('errors/403');
     }
 }
Пример #2
0
 public function index()
 {
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $absen = Absen::all();
         $laporan = Laporan::all();
         $shift = Shift::all();
         return view('admin/index')->with("absen", $absen)->with("laporan", $laporan)->with("shift", $shift);
     } else {
         return view('errors/403');
     }
 }
Пример #3
0
 public function cariAbsen()
 {
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $karyawan = Karyawan::get();
         $shifts = Shift::shift();
         $cariAbsen = Absen::where("id_karyawan", "=", \Input::get('karyawan'))->where("id_shift", "=", \Input::get('shift'))->where("status", "=", \Input::get('tipe'))->get();
         return view('admin/absen/absen')->with("cariAbsen", $cariAbsen)->with("karyawan", $karyawan)->with("shifts", $shifts);
     } else {
         return view('errors/403');
     }
 }
 /**
  * Menampilkan data pengumuman.
  *
  * @return integer
  */
 public function index()
 {
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $absen = Absen::all();
         $laporan = Laporan::all();
         $shift = Shift::all();
         $notice = Notice::orderBy("id_notice", "DESC")->paginate(10);
         $divisi = Karyawan::divisi();
         return view('admin/pengumuman/pengumuman')->with("absen", $absen)->with("laporan", $laporan)->with("shift", $shift)->with("divisi", $divisi)->with("notice", $notice);
     } else {
         return view('errors/403');
     }
 }
Пример #5
0
 /**
  * Display a listing of the resource.
  *
  * @return string Data shift dan request.
  */
 public function index()
 {
     //
     if (Auth::check()) {
         $id_karyawan = Auth::user()->id_karyawan;
         $today = date("Y-m-d");
         $getNotice = Notice::byDivisi(Auth::user()->id_divisi);
         $shift = \DB::table('shift')->get();
         $month_end = date('Y-m-d', strtotime('last day of this month', time()));
         $shiftLine = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("id_karyawan", "=", $id_karyawan)->whereBetween("tanggal_shift", array($today, $month_end))->orderBy("id_shiftline")->get();
         $req = rModel::join("shift_line", "request.shift_lama", "=", "shift_line.tanggal_shift")->where("request.id_karyawan", "=", "{$id_karyawan}")->orderBy("id", "DESC")->first();
         return view('shift/index')->with("getNotice", $getNotice)->with("shift", $shift)->with("shiftLine", $shiftLine)->with("req", $req);
     } else {
         return \Redirect::to('login');
     }
 }
Пример #6
0
 /**
  * Display a listing of the resource.
  *
  * @return string Data shift dan request.
  */
 public function index()
 {
     //
     if (Auth::check()) {
         $id_karyawan = Auth::user()->id_karyawan;
         $today = date("Y-m-d");
         $getNotice = Notice::where("id_karyawan", "=", $id_karyawan)->where("tanggal", "=", $today)->get();
         $shift = \DB::table('shift')->get();
         $month_end = date('Y-m-d', strtotime('last day of this month', time()));
         $shiftLine = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("id_karyawan", "=", $id_karyawan)->whereBetween("tanggal_shift", array($today, $month_end))->orderBy("id_shiftline")->get();
         $req = rModel::where("id_karyawan", "=", $id_karyawan)->orderBy("id", "DESC")->first();
         \DB::table('logs')->insert(['id_karyawan' => $id_karyawan, 'content' => Auth::user()->username . ' akses halaman daftar shift', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
         return view('shift/index')->with("getNotice", $getNotice)->with("shift", $shift)->with("shiftLine", $shiftLine)->with("req", $req);
     } else {
         return \Redirect::to('login');
     }
 }
Пример #7
0
 /**
  * Display a listing of the resource.
  *
  * @return string
  */
 public function index()
 {
     if (Auth::check()) {
         $id_karyawan = Auth::user()->id_karyawan;
         $absen = Absen::where("id_karyawan", "=", $id_karyawan)->orderBy("id_absen", "DESC")->first();
         $today = date('Y-m-d');
         $report = Laporan::where("id_karyawan", "=", $id_karyawan)->where("tanggal", "=", $today)->first();
         $note = Dashboard::where("id_karyawan", "=", $id_karyawan)->first();
         $getNotice = Notice::where("id_karyawan", "=", $id_karyawan)->where("tanggal", "=", $today)->get();
         $shiftLine = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("tanggal_shift", "=", $today)->where("id_karyawan", "=", $id_karyawan)->first();
         $yesterday = date("Y-m-d", time() - 86400);
         $shiftKmrn = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("tanggal_shift", "=", $yesterday)->where("id_karyawan", "=", $id_karyawan)->first();
         $besok = date("Y-m-d", time() + 86400);
         $shiftBesok = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("tanggal_shift", "=", $besok)->where("id_karyawan", "=", $id_karyawan)->first();
         /**
          * untuk mengecek $id_karyawan 
          * masuk shift berapa
          * @return string
          */
         if ($shiftLine != null) {
             $shiftname = $shiftLine->nama_shift;
         } else {
             $shiftname = "Non Shift";
         }
         if ($absen != null) {
             $tgl = explode(" ", $absen->created_at);
             if ($absen->status == "masuk" && $tgl[0] == $yesterday) {
                 $absen = new Absen();
                 $absen->id_karyawan = $id_karyawan;
                 $absen->id_shift = $shiftKmrn->id_shift;
                 $absen->status = "keluar";
                 $absen->save();
             } elseif ($absen->status == "masuk" && $tgl[0] != $today) {
                 $absen = new Absen();
                 $absen->id_karyawan = $id_karyawan;
                 $absen->id_shift = "4";
                 $absen->status = "keluar";
                 $absen->save();
             }
         }
         return view('dashboard/index')->with("absen", $absen)->with("report", $report)->with("note", $note)->with("getNotice", $getNotice)->with("shiftLine", $shiftLine)->with("shiftKmrn", $shiftKmrn)->with("shiftBesok", $shiftBesok)->with("shiftname", $shiftname);
     } else {
         return \Redirect::to('login');
     }
 }
Пример #8
0
 public function postgenerator()
 {
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $dari = \Input::get('dari');
         $id_karyawan = \Input::get('id_karyawan');
         $sampai = \Input::get('sampai');
         $id_shift = \Input::get('id_shift');
         $dariMysql = Shift::ExplodeDate($dari, 'hari') . "/" . Shift::ExplodeDate($dari, 'bulan') . "/" . Shift::ExplodeDate($dari, 'tahun');
         $sampaiMysql = Shift::ExplodeDate($sampai, 'hari') . "/" . Shift::ExplodeDate($sampai, 'bulan') . "/" . Shift::ExplodeDate($sampai, 'tahun');
         $datePeriod = Shift::returnDates($dariMysql, $sampaiMysql);
         foreach ($datePeriod as $date) {
             $data = ["id_shift" => $id_shift, "id_karyawan" => $id_karyawan, "tanggal_shift" => $date->format('Y-m-d')];
             Shift::insert($data);
         }
         return \Redirect::to('admin/shift');
     } else {
         return view('errors/403');
     }
     //return view('admin/shift/generator');
 }
Пример #9
0
 /**
  * Update data jadwal shift karyawan.
  *
  * @return integer
  */
 public function update($id)
 {
     if (Auth::check() && Auth::user()->id_karyawan == '1') {
         $data = Shift::find($id);
         $data->id_shift = \Input::get('id_shift');
         $tgl = explode("/", \Input::get('tanggal'));
         $data->tanggal_shift = $tgl[2] . "-" . $tgl[0] . "-" . $tgl[1];
         $data->id_karyawan = \Input::get('id_karyawan');
         $data->save();
         return \Redirect::to('admin/shift');
     } else {
         return view('errors/403');
     }
 }