Exemplo n.º 1
0
 public function departmentView($department_code, $filter)
 {
     $ticketFilter = new TicketFilter($department_code, $filter);
     $tickets = $ticketFilter->departmentViewFilter();
     $department = \App\Department::where('department_code', $department_code)->first();
     return view('helpdeskviews.department', compact('department', 'tickets', 'filter'));
 }
Exemplo n.º 2
0
 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(DepartmentRequest $request)
 {
     $dept = Department::where('id', $request['deptID'])->first();
     $dept->name = $request['name'];
     $dept->save();
     \Session::flash('success', $request['name'] . ' has been successfully updated!');
     return redirect()->back();
 }
Exemplo n.º 4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $this->data['user'] = User::where('deleted_at', null)->count();
     $this->data['user_disabled'] = User::where('deleted_at', !null)->count();
     $this->data['department'] = Department::where('enabled', 1)->count();
     $this->data['position'] = Position::where('enabled', 1)->count();
     return view('pages.admin.dashboard', $this->data);
 }
 /**
  * @param Request $request
  * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
  */
 public function getCourse(Request $request)
 {
     if ($request->ajax()) {
         $department = Department::where('name', $request->input('name'))->first();
         $courses = $department->courses->pluck('name');
         return response($courses);
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(DepartmentRequest $request)
 {
     $dept = Department::where('id', $request['deptID'])->first();
     $dept->name = $request['name'];
     $dept->updated_by = \Auth::user()->id;
     $dept->save();
     \Session::flash('success', 'well done! Role ' . $request['name'] . ' has been successfully added!');
     return redirect()->back();
 }
Exemplo n.º 7
0
 public function fuzzyQuery(Request $request)
 {
     $this->validate($request, ['keyword' => 'required|max:255']);
     $keyword = $request->get('keyword');
     $hospitals = Hospital::where('hospital_name', 'like', "%{$keyword}%")->orwhere('city', 'like', "%{$keyword}%")->orwhere('hospital_level', 'like', "%{$keyword}%")->orwhere('description', 'like', "%{$keyword}%")->get();
     $departments = Department::where('department_name', 'like', "%{$keyword}%")->orwhere('department_description', 'like', "%{$keyword}%")->get();
     $doctors = Doctor::where('doctor_name', 'like', "%{$keyword}%")->orwhere('doctor_level', 'like', "%{$keyword}%")->orwhere('doctor_description', 'like', "%{$keyword}%")->get();
     $response = ['hospitals' => $hospitals, 'department' => $departments, 'doctors' => $doctors];
     return json_encode($response);
 }
 /**
  * Display the specified resource.
  * @param Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show(Request $request, $id)
 {
     if ($request->ajax()) {
         $department = Department::where('code', $id)->first();
         $teachers = $department->teachers->pluck('name', 'id');
         $courses = $department->courses()->whereNull('isAssigned')->orWhere('isAssigned', '')->pluck('code');
         // get the code of unassigned courses in department
         return response([$courses, $teachers]);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(saveCourseRequest $request)
 {
     $course = new Course($request->except(['department', 'semester']));
     $department = Department::where('code', $request->input('department'))->first();
     $semester = Semester::find($request->input('semester'));
     $course->department()->associate($department);
     $course->semester()->associate($semester);
     $course->save();
     $request->session()->flash('status', 'Course was saved successful!');
     return back();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|string']);
     $duplicate = Department::where('name', $request->name)->first();
     if ($duplicate) {
         return response()->json(true);
     }
     $department = new Department();
     $department->name = $request->name;
     $department->save();
 }
 public static function search($query)
 {
     if (empty($query)) {
         return Collection::make();
     }
     return Department::where('name', 'like', '%' . $query . '%')->orderBy('name', 'asc')->take(5)->get(array('id', 'name'))->map(function ($department) {
         $department->label = $department->name;
         $department->type = 'department';
         $department->url = route('departments.show', $department->id);
         return $department;
     });
 }
 public function filter()
 {
     $city_id = Input::get('city');
     $departments = Department::orderBy('city_id')->get();
     if (isset($city_id)) {
         if ($city_id == 0) {
             $departments = Department::orderBy('city_id')->get();
         } else {
             $departments = Department::where('city_id', $city_id)->get();
         }
     }
     return View::make('department.all', ['category' => 1, 'departments' => $departments, 'selectedCity' => $city_id]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(saveTeacherRequest $request)
 {
     $request->merge(array('remaining_credit' => $request->input('assigned_credit')));
     // Set remaining credit equal to assigned credit
     $teacher = new Teacher($request->except(['department', 'designation']));
     $department = Department::where('name', $request->input('department'))->first();
     $designation = Designation::where('name', $request->input('designation'))->first();
     $teacher->department()->associate($department);
     $teacher->designation()->associate($designation);
     $teacher->save();
     $teacher_request = new UserRequestHandle('Teacher', $request->input('email'));
     $teacher_request->save();
     $request->session()->flash('status', 'Teacher was saved successful!');
     return back();
 }
Exemplo n.º 14
0
 public function index(Request $request)
 {
     if ($request->get('department')) {
         $services = \App\Service::filterByDepartment($request->get('department'))->get();
         $departments = \App\Department::where('id', $request->get('department'))->get();
     } elseif ($request->get('domain')) {
         $domain = \App\Domain::findOrfail($request->get('domain'));
         $services = $domain->services()->get();
         $departments = $domain->departments()->get();
     } else {
         $services = $this->services;
         $departments = \App\Department::all();
     }
     return view('services.index', ['services' => $services, 'departments' => $departments]);
 }
 /**
  * Store a newly created resource in storage.
  * @param RegisterStudentRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(RegisterStudentRequest $request)
 {
     $student = new Student($request->except(['department_code']));
     $date = strtotime($request->input('current_date'));
     $student->current_date = date('d/m/Y', $date);
     // Changed string date to Date format
     $department = Department::where('code', $request->input('department_code'))->first();
     $student->registration_no = $department->name . '-' . date('Y', $date) . '-' . sprintf("%03d", $department->students->count() + 1);
     // Create Student registration no.
     $student->department()->associate($department);
     $student->save();
     $student_request = new UserRequestHandle('Student', $request->input('email'));
     $student_request->save();
     $request->session()->flash('status', 'Student registration was successful!');
     return back();
 }
 public function index()
 {
     $user = Auth::user();
     $courses = Course::where('lecturer_id', '=', $user->id)->get();
     foreach ($courses as $course) {
         $dept = Department::where('id', '=', $course->department_id)->firstOrFail();
         $course['department_name'] = $dept->name;
         $questions = Question::where('course_id', '=', $course->id)->get();
         if (count($questions) > 0) {
             $course->questions_set = true;
         } else {
             $course->questions_set = false;
         }
     }
     return view('que.index', compact('courses'));
 }
Exemplo n.º 17
0
 /**
  * @return mixed
  */
 public function departmentViewFilter()
 {
     if ($this->filter === 'all') {
         $department = \App\Department::where('department_code', $this->department_code)->first();
         $view = $department->tickets()->get();
     } elseif ($this->filter === 'unassigned') {
         $department = \App\Department::where('department_code', $this->department_code)->first();
         $view = $department->tickets()->where('user_id', null)->get();
     } elseif ($this->filter === 'open') {
         $department = \App\Department::where('department_code', $this->department_code)->first();
         $view = $department->tickets()->where('status', $this->filter)->get();
     } elseif ($this->filter === 'close') {
         $department = \App\Department::where('department_code', $this->department_code)->first();
         $view = $department->tickets()->where('status', $this->filter)->get();
     } elseif ($this->filter === 'started') {
         $department = \App\Department::where('department_code', $this->department_code)->first();
         $view = $department->tickets()->where('activity', $this->filter)->get();
     } elseif ($this->filter === 'not_started') {
         $department = \App\Department::where('department_code', $this->department_code)->first();
         $view = $department->tickets()->where('activity', $this->filter)->get();
     }
     return $view;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(UserRequest $request, User $user)
 {
     /*  New User Table */
     $user->name = $request['Fname'];
     $user->surname = $request['Sname'];
     $user->cellphone = $request['Cell1'];
     $user->username = $request['Email'];
     $user->email = $request['Cell1'];
     $position = Position::where('slug', '=', $request['Position'])->first();
     $user->position = $position->id;
     $province = Province::where('slug', '=', $request['Province'])->first();
     $user->province = $province->id;
     $district = District::where('slug', '=', $request['District'])->first();
     $user->district = $district->id;
     $municipalityIds = array();
     foreach ($request['Municipality'] as $municipalityName) {
         $municipality = Municipality::where('slug', '=', $municipalityName)->first();
         $municipalityIds[] = $municipality->id;
     }
     $user->municipality = implode(",", $municipalityIds);
     $department = Department::where('slug', '=', $request['Department'])->first();
     $user->department = $department->id;
     $password = rand(1000, 99999);
     $user->password = \Hash::make($password);
     $user->api_key = uniqid();
     $user->status = 1;
     $user->role = 2;
     $user->save();
     \Session::flash('success', $request['Fname'] . ' ' . $request['Sname'] . ' has been added successfully!');
     $data = array('name' => $user->name, 'username' => $user->email, 'password' => $password);
     \Mail::send('emails.registrationConfirmation', $data, function ($message) use($user) {
         $message->from('*****@*****.**', 'Siyaleader');
         $message->to($user->username)->subject("Siyaleader User Registration Confirmation: " . $user->name);
     });
     return redirect('list-users');
 }
 public function store(Report $report, Request $request)
 {
     \Log::info("Request " . $request);
     $category = \Input::get('category');
     \Log::info('GET Category ' . $category);
     $sub_category = \Input::get('sub_category');
     \Log::info('GET Sub Category ' . $sub_category);
     $sub_sub_category = \Input::get('sub_sub_category');
     \Log::info('GET Sub Sub Category ' . $sub_sub_category);
     $sub_sub_category = empty($sub_sub_category) ? " " : $sub_sub_category;
     $description = \Input::get('description');
     \Log::info('Get Description :' . $description);
     $description = empty($description) ? " " : $description;
     $gps_lat = \Input::get('gps_lat');
     \Log::info('GPS Lat :' . $gps_lat);
     $gps_lng = \Input::get('gps_lng');
     \Log::info('GPS Lng :' . $gps_lng);
     $user_email = \Input::get('user_email');
     \Log::info('Email :' . $user_email);
     $priority = \Input::get('priorities');
     $priority = empty($priority) ? "Normal" : $priority;
     \Log::info('Priority :' . $priority);
     $headers = apache_request_headers();
     $response = array();
     \Log::info("Request " . $request);
     if (count($_FILES) > 0) {
         $files = $_FILES['img'];
         $name = uniqid('img-' . date('Ymd') . '-');
         $temp = explode(".", $files['name']);
         $name = $name . '.' . end($temp);
         if (file_exists("uploads/" . $name)) {
             echo $_FILES["img"]["name"] . "already exists. ";
         } else {
             $img_url = "uploads/" . $name;
             $target_file = "uploads/{$name}";
             $resized_file = "uploads/{$name}";
             $wmax = 600;
             $hmax = 480;
             $fileExt = 'jpg';
             if (move_uploaded_file($_FILES["img"]["tmp_name"], $img_url)) {
                 $this->ak_img_resize($target_file, $resized_file, $wmax, $hmax, $fileExt);
             }
         }
     }
     $img_url = isset($img_url) ? $img_url : "uploads/noimage.png";
     if (isset($headers['api_key'])) {
         $userNew = UserNew::where('api_key', '=', $headers['api_key_new'])->first();
         if (sizeof($userNew) > 0) {
             $objCat = DepartmentCategory::where('name', '=', $category)->first();
             \Log::info('Category Object :' . $objCat);
             $department = Department::where('id', '=', $objCat->department)->first();
             \Log::info('Department Object : ' . $department);
             $objSubCat = DepartmentSubCategory::where('name', '=', $sub_category)->first();
             $SubCatName = sizeof($objSubCat) > 0 ? $objSubCat->name : "";
             if (strlen($sub_sub_category) > 1) {
                 $objSubSubCat = DepartmentSubSubCategory::where('name', '=', $sub_sub_category)->first();
                 $objSubSub = $objSubSubCat->id;
             } else {
                 $objSubSubCat = 0;
                 $objSubSub = 0;
             }
             $case = new CaseReport();
             $case->description = $description;
             $case->user = $userNew->id;
             $case->reporter = $userNew->id;
             $case->department = $department->id;
             $case->category = $objCat->id;
             $case->sub_category = $objSubCat->id;
             $case->sub_sub_category = $objSubSub;
             $case->priority = $priority;
             $case->status = 'Pending';
             $case->gps_lat = $gps_lat;
             $case->precinct = 5;
             $case->img_url = $img_url;
             $case->gps_lng = $gps_lng;
             $case->save();
             $caseOwner = new CaseOwner();
             $caseOwner->user = $userNew->id;
             $caseOwner->caseId = $case->id;
             $caseOwner->type = 0;
             $caseOwner->active = 1;
             $caseOwner->save();
             $response["message"] = "Report created successfully";
             $response['error'] = FALSE;
             $data = array('name' => $userNew->name, 'caseID' => $case->id, 'caseDesc' => $case->description);
             \Mail::send('emails.sms', $data, function ($message) use($userNew) {
                 $message->from('*****@*****.**', 'Siyaleader');
                 $message->to($userNew->username)->subject("Siyaleader Notification - New Case Reported:");
             });
             if (is_object($objSubSubCat)) {
                 $firstRespondersObj = CaseResponder::where("sub_sub_category", '=', $objSubSubCat->id)->select('firstResponder')->first();
                 /*$secondRespondersObj = CaseResponder::where("sub_sub_category",'=',$objSubSubCat->id)
                                                                 ->select('secondResponder')->first();
                 
                                     $thirdRespondersObj  = CaseResponder::where("sub_sub_category",'=',$objSubSubCat->id)
                                                                 ->select('thirdResponder')->first();
                                     */
                 if (sizeof($firstRespondersObj) > 0) {
                     $case->status = "Referred";
                     $case->referred_at = \Carbon\Carbon::now('Africa/Johannesburg')->toDateTimeString();
                     $case->save();
                     $firstResponders = explode(",", $firstRespondersObj->firstResponder);
                     if ($firstRespondersObj->firstResponder > 0) {
                         foreach ($firstResponders as $firstResponder) {
                             $firstResponderUser = UserNew::find($firstResponder);
                             $caseOwner = new CaseOwner();
                             $caseOwner->user = $firstResponder;
                             $caseOwner->caseId = $case->id;
                             $caseOwner->type = 1;
                             $caseOwner->active = 1;
                             $caseOwner->save();
                             $data = array('name' => $firstResponderUser->name, 'caseID' => $case->id, 'caseDesc' => $case->description, 'caseReporter' => $case->description);
                             \Mail::send('emails.responder', $data, function ($message) use($firstResponderUser) {
                                 $message->from('*****@*****.**', 'Siyaleader');
                                 $message->to($firstResponderUser->username)->subject("Siyaleader Notification - New Case Reported:");
                             });
                             $cellphone = $firstResponderUser->email;
                             \Mail::send('emails.caseEscalatedSMS', $data, function ($message) use($cellphone) {
                                 $message->from('*****@*****.**', 'Siyaleader');
                                 $message->to('*****@*****.**')->subject("REFER: {$cellphone}");
                             });
                         }
                     }
                 }
                 /*     if (sizeof($secondRespondersObj) > 0) {
                 
                                         $secondResponders  = explode(",",$secondRespondersObj->secondResponder);
                 
                                         if($secondRespondersObj->secondResponder > 0) {
                 
                                             foreach ($secondResponders as $secondResponder) {
                 
                 
                                                 $secondResponderUser = UserNew::find($secondResponder);
                                                 $caseOwner          = new CaseOwner();
                                                 $caseOwner->user    = $secondResponder ;
                                                 $caseOwner->caseId  = $case->id;
                                                 $caseOwner->type    = 2;
                                                 $caseOwner->active  = 1;
                                                 $caseOwner->save();
                 
                                                  $data = array(
                                                         'name'   =>$secondResponderUser->name,
                                                         'caseID' =>$case->id,
                                                         'caseDesc' => $case->description,
                                                         'caseReporter' => $case->description,
                                                     );
                 
                                                 \Mail::send('emails.responder',$data, function($message) use ($secondResponderUser)
                                                 {
                                                     $message->from('*****@*****.**', 'Siyaleader');
                                                     $message->to($secondResponderUser->username)->subject("Siyaleader Notification - New Case Reported:");
                 
                                                 });
                 
                                             }
                 
                 
                 
                                         }
                                     }
                 */
                 /*        if (sizeof($thirdRespondersObj) > 0) {
                 
                                         $thirdResponders  = explode(",",$thirdRespondersObj->thirdResponder);
                 
                                         if($thirdRespondersObj->thirdResponder > 0) {
                 
                                             foreach ($thirdResponders as $thirdResponder) {
                 
                 
                                                 $thirdResponderUser = UserNew::find($thirdResponder);
                                                 $caseOwner          = new CaseOwner();
                                                 $caseOwner->user    = $thirdResponder ;
                                                 $caseOwner->caseId  = $case->id;
                                                 $caseOwner->type    = 3;
                                                 $caseOwner->active  = 1;
                                                 $caseOwner->save();
                 
                                                  $data = array(
                                                         'name'   =>$thirdResponderUser->name,
                                                         'caseID' =>$case->id,
                                                         'caseDesc' => $case->description,
                                                         'caseReporter' => $case->description,
                                                     );
                 
                                                 \Mail::send('emails.responder',$data, function($message) use ($thirdResponderUser)
                                                 {
                                                     $message->from('*****@*****.**', 'Siyaleader');
                                                     $message->to($thirdResponderUser->username)->subject("Siyaleader Notification - New Case Reported:");
                 
                                                 });
                 
                                             }
                 
                 
                 
                                         }
                                     }*/
             }
             if (sizeof($objSubCat) > 0 && $objSubSubCat == "") {
                 $firstRespondersObj = CaseResponder::where("sub_category", '=', $objSubCat->id)->select('firstResponder')->first();
                 /*  $secondRespondersObj = CaseResponder::where("sub_category",'=',$objSubCat->id)
                                                                 ->select('secondResponder')->first();
                 
                                     $thirdRespondersObj  = CaseResponder::where("sub_category",'=',$objSubCat->id)
                                                                 ->select('thirdResponder')->first();
                 
                                 */
                 if (sizeof($firstRespondersObj) > 0) {
                     $case->status = "Referred";
                     $case->referred_at = \Carbon\Carbon::now('Africa/Johannesburg')->toDateTimeString();
                     $case->save();
                     $firstResponders = explode(",", $firstRespondersObj->firstResponder);
                     if ($firstRespondersObj->firstResponder > 0) {
                         foreach ($firstResponders as $firstResponder) {
                             $firstResponderUser = UserNew::find($firstResponder);
                             $caseOwner = new CaseOwner();
                             $caseOwner->user = $firstResponder;
                             $caseOwner->caseId = $case->id;
                             $caseOwner->type = 1;
                             $caseOwner->active = 1;
                             $caseOwner->save();
                             $data = array('name' => $firstResponderUser->name, 'caseID' => $case->id, 'caseDesc' => $case->description, 'caseReporter' => $case->description);
                             \Mail::send('emails.responder', $data, function ($message) use($firstResponderUser) {
                                 $message->from('*****@*****.**', 'Siyaleader');
                                 $message->to($firstResponderUser->username)->subject("Siyaleader Notification - New Case Reported:");
                             });
                             $cellphone = $firstResponderUser->cellphone;
                             \Mail::send('emails.caseEscalatedSMS', $data, function ($message) use($cellphone) {
                                 $message->from('*****@*****.**', 'Siyaleader');
                                 $message->to('*****@*****.**')->subject("REFER: {$cellphone}");
                             });
                         }
                     }
                 }
                 /*     if (sizeof($secondRespondersObj) > 0) {
                 
                                         $secondResponders  = explode(",",$secondRespondersObj->secondResponder);
                 
                                         if($secondRespondersObj->secondResponder > 0) {
                 
                                             foreach ($secondResponders as $secondResponder) {
                 
                 
                                                 $secondResponderUser = UserNew::find($secondResponder);
                                                 $caseOwner          = new CaseOwner();
                                                 $caseOwner->user    = $secondResponder ;
                                                 $caseOwner->caseId  = $case->id;
                                                 $caseOwner->type    = 2;
                                                 $caseOwner->active  = 1;
                                                 $caseOwner->save();
                 
                                                  $data = array(
                                                         'name'   =>$secondResponderUser->name,
                                                         'caseID' =>$case->id,
                                                         'caseDesc' => $case->description,
                                                         'caseReporter' => $case->description,
                                                     );
                 
                                                 \Mail::send('emails.responder',$data, function($message) use ($secondResponderUser)
                                                 {
                                                     $message->from('*****@*****.**', 'Siyaleader');
                                                     $message->to($secondResponderUser->username)->subject("Siyaleader Notification - New Case Reported:");
                 
                                                 });
                 
                                             }
                 
                 
                 
                                         }
                                     }*/
                 /*if (sizeof($thirdRespondersObj) > 0) {
                 
                                         $thirdResponders  = explode(",",$thirdRespondersObj->thirdResponder);
                 
                                         if($thirdRespondersObj->thirdResponder > 0) {
                 
                                             foreach ($thirdResponders as $thirdResponder) {
                 
                 
                                                 $thirdResponderUser = UserNew::find($thirdResponder);
                                                 $caseOwner          = new CaseOwner();
                                                 $caseOwner->user    = $thirdResponder ;
                                                 $caseOwner->caseId  = $case->id;
                                                 $caseOwner->type    = 3;
                                                 $caseOwner->active  = 1;
                                                 $caseOwner->save();
                 
                                                  $data = array(
                                                         'name'   =>$thirdResponderUser->name,
                                                         'caseID' =>$case->id,
                                                         'caseDesc' => $case->description,
                                                         'caseReporter' => $case->description,
                                                     );
                 
                                                 \Mail::send('emails.responder',$data, function($message) use ($thirdResponderUser)
                                                 {
                                                     $message->from('*****@*****.**', 'Siyaleader');
                                                     $message->to($thirdResponderUser->username)->subject("Siyaleader Notification - New Case Reported:");
                 
                                                 });
                 
                                             }
                 
                 
                 
                                         }
                                     }*/
             }
             return \Response::json($response, 201);
         } else {
             $response['message'] = 'Access Denied. Invalid Api key';
             $response['error'] = TRUE;
             return \Response::json($response, 401);
         }
     } else {
         $response['message'] = 'Access Denied. Invalid Api key';
         $response['error'] = TRUE;
         return \Response::json($response, 401);
     }
 }
Exemplo n.º 20
0
    if ($from == 'province') {
        $object = Province::where('slug', '=', $name)->first();
    }
    if ($from == 'district') {
        $object = District::where('slug', '=', $name)->first();
    }
    if ($from == 'municipality') {
        $object = Municipality::where('slug', '=', $name)->first();
    }
    $listing = DB::table($to)->where($from, $object->id)->lists('name', 'slug');
    return $listing;
});
Route::get('/api/dropdownDepartment/{to}/{from}', function ($to, $from) {
    $name = Input::get('option');
    if ($from == 'department') {
        $object = Department::where('slug', '=', $name)->first();
        $listing = DB::table('categories')->where('department', '=', $object->id)->lists('name', 'slug');
    }
    if ($from == 'category') {
        $object = Category::where('slug', '=', $name)->first();
        $listing = DB::table('sub_categories')->where('category', '=', $object->id)->lists('name', 'slug');
    }
    if ($from == 'sub_category') {
        $object = SubCategory::where('slug', '=', $name)->first();
        $listing = DB::table('sub_sub_categories')->where('sub_category', '=', $object->id)->lists('name', 'slug');
    }
    return $listing;
});
Route::get('/api/dropdownCategory/{to}/{from}', function ($to, $from) {
    $name = Input::get('option');
    if ($from == 'category') {
Exemplo n.º 21
0
 /**
  * Store a csv created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function import(Request $request)
 {
     if ($request->file('csv-file')->isValid()) {
         $csv_file = $request->file('csv-file');
         if ("text/csv" == $csv_file->getClientMimeType()) {
             $dest_path = storage_path('temp');
             $file_name = time() . '_' . str_replace(" ", "_", $csv_file->getClientOriginalName());
             $csv_file->move($dest_path, $file_name);
             $fname = $dest_path . '/' . $file_name;
             $file = fopen($fname, "r");
             $flash_message = [];
             $flash_error = 0;
             while (!feof($file)) {
                 $tmp_data = fgetcsv($file);
                 $item['department_id'] = !empty($tmp_data[0]) ? $tmp_data[0] : '';
                 $department = Department::where('code', '=', $item['department_id'])->first();
                 if ($department) {
                     $item['department_id'] = $department->id;
                 }
                 $item['code'] = !empty($tmp_data[1]) ? $tmp_data[1] : '';
                 $item['name'] = !empty($tmp_data[2]) ? $tmp_data[2] : '';
                 $item['description'] = !empty($tmp_data[3]) ? $tmp_data[3] : '';
                 $v = Validator::make($item, ['department_id' => 'required|integer|min:1', 'code' => 'required|unique:courses|max:20', 'name' => 'required|max:254']);
                 if (!$v->fails()) {
                     Course::create($item);
                     $flash_message['success'][] = '[' . $item['code'] . '] ' . $item['name'];
                 } else {
                     $flash_error++;
                     $flash_message['error'] = $flash_error;
                 }
             }
             \Session::flash('flash_message', $flash_message);
             fclose($file);
             chmod($fname, 0777);
             unlink($fname);
         }
     }
     return redirect('/courses');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $this->AuthorizeAndRedirect('admin');
     $student = User::findOrFail($id);
     $department = Department::where('id', '=', $student->department_id)->firstOrFail();
     $student['department_name'] = $department->name;
     return view('student.show', compact('student'));
 }
Exemplo n.º 23
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $position = Position::where('active', 1)->get();
     // if is Leader
     // if staff edit != dev or yourself => denied
     if (Gate::allows('check-leader')) {
         $staff = Staff::find($id)->level->role;
         if ($staff->name != "Developer" && $id != Auth::user()->id) {
             return redirect()->route('admin.staff.index')->with('message', 'Access is denied');
         } else {
             $level = Level::where('role_id', 4)->get();
             $department = Department::where('id', Auth::user()->department_id)->where('active', 1)->get()->first();
         }
     } else {
         if (Gate::allows('check-admin')) {
             $staff = Staff::find($id)->level->role;
             if ($staff->name == "Developer" && $id != Auth::user()->id) {
                 return redirect()->route('admin.staff.index')->with('message', 'Access is denied');
             } else {
                 $department = Department::where('active', 1)->get();
                 $level = Level::where(['role_id' => 2, 'active' => 1])->orWhere(['role_id' => 3, 'active' => 1])->get();
             }
         } else {
             if (Gate::allows('check-manager')) {
                 $staff = Staff::find($id)->level->role;
                 if ($staff->name == "Manager" && $id != Auth::user()->id) {
                     return redirect()->route('admin.staff.index')->with('message', 'Access is denied');
                 } else {
                     $level = Level::where('role_id', 3)->orWhere('role_id', 4)->get();
                     if ($id == Auth::user()->id) {
                         $department = '';
                     }
                     $department = Department::where('active', 1)->get();
                 }
             } else {
                 $staff_id = Auth::user()->id;
                 if ($staff_id != $id) {
                     return redirect()->route('admin.staff.index')->with('message', 'Access is denied');
                 } else {
                     $position = Position::where('id', Auth::user()->position_id)->where('active', 1)->get();
                     $level = Level::where('id', Auth::user()->level_id)->where('active', 1)->get();
                     $department = Department::where('id', Auth::user()->department_id)->where('active', 1)->get()->first();
                 }
             }
         }
     }
     if ($id == Auth::user()->id) {
         $check_account = 1;
     } else {
         $check_account = 0;
     }
     $staff = Staff::find($id);
     return view('admin.staff.update', compact('id', 'staff', 'position', 'level', 'department', 'check_account'));
 }
Exemplo n.º 24
0
@endsection

@section('sidebar')
@include('layouts.include.sidebar')
@endsection

@section('bodycontent')
<div class = "span9">	
					{!! Form::open(array('action'=>'RoutineDisplayController@viewroomschedule', 'method'=>'post')) !!} 
						<?php 
use App\Department;
use App\User;
use App\User_detail;
$id = User::where('username', $username)->first()->id;
$department = User_detail::where('id', $id)->first()->department;
$roomtotal = Department::where('code', $department)->orderby('code')->first()->total_rooms;
?>
						<fieldset>
						<legend>Department: {{ $department }}</legend>
						<div class="control-group">
						{!! Form::label('roomcode', 'Select Room:', array('class' => 'control-label')) !!}
						<div class="controls">
						{!! Form::selectrange('selectroom',1, $roomtotal) !!}
						</div>
						<div class="controls">
						{!! Form::hidden('teacherdepart', $department) !!}
						</div>
						</div>
						<div class="control-group">
						<div class="controls">
							{!! Form::submit('Check Routine', ['class'=>'btn btn-primary','value'=>'showroomschedule', 'name'=>'showroomschedule']) !!}
Exemplo n.º 25
0
 public function importEMP($destfile)
 {
     Excel::load($destfile, function ($reader) {
         $rules = ['number' => 'required|unique:employees', 'company_id' => 'required|exists:companies,id', 'department_id' => 'required|exists:departments,id', 'bank_account' => 'required|unique:employees'];
         $sheetsCount = $reader->getSheetCount();
         for ($i = 0; $i < $sheetsCount; $i++) {
             $sheets = $reader->getSheet($i)->toArray();
             $company_name = $reader->getSheet($i)->getTitle();
             $dept['company_id'] = Company::where('name', $company_name)->value('id');
             $sheetCount = count($sheets);
             for ($j = 6; $j < $sheetCount; $j++) {
                 // Get Department ID;
                 $dept['name'] = $sheets[$j][1];
                 $dept['costcenter'] = $sheets[$j][10];
                 $employee['company_id'] = $dept['company_id'];
                 $employee['department_id'] = Department::where('name', $dept['name'])->where('company_id', $dept['company_id'])->where('costcenter', $dept['costcenter'])->value('id');
                 $employee['name'] = $sheets[$j][2];
                 $employee['number'] = $sheets[$j][3];
                 $employee['level_id'] = Level::where('credit', 400)->value('id');
                 $employee['category_id'] = Category::where('code', 1)->value('id');
                 $employee['status_id'] = Status::where('code', 1)->value('id');
                 $employee['telephone'] = $sheets[$j][4];
                 $employee['bank_account'] = $sheets[$j][8];
                 $emp_v = \Validator::make($employee, $rules);
                 if ($emp_v->fails()) {
                 } else {
                     Employee::create($employee);
                 }
             }
         }
         //END
     });
 }
Exemplo n.º 26
0
@include('layouts.adminalgo.algoclass')
@include('layouts.adminalgo.insertionSort')
@include('layouts.adminalgo.ASP_Algo')
@include('layouts.adminalgo.algomain')
<style> 
						
						nu {
							color: #FF0000;
							}
</style>
<?php 
use App\Department;
use App\Schedule;
use App\Time_table;
if (isset($_GET['depart'])) {
    $department = Department::where('code', $_GET['depart'])->first();
    $weekdays = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday');
    $scheduledata = Schedule::where('department_code', $department->code);
    if ($scheduledata->exists()) {
        echo "<h1>Department: " . $department->code . "</h1><br>";
    }
    foreach ($weekdays as $a) {
        //echo "<h2>Routine for: ".strtoupper($a)."</h2><br>";
        main_func($a, $department);
    }
    echo "<br><br>";
} else {
    echo "<h1> Hello " . $username . "  </h1>";
    $totalschedules = count(Schedule::all());
    $totaltimetables = count(Time_table::all());
    if ($totalschedules > 0 && $totaltimetables != $totalschedules) {
Exemplo n.º 27
0
@section('bodycontent')
<div class="span9">
				{!! Form::open(array('class'=>'form-horizontal', 'action'=>'CourseDetailController@addclass', 'method'=>'post')) !!} 
						@if ($errors->has())
							<div class="alert alert-danger">
								@foreach($errors->all() as $error)
									{{ $error }}<br>        
								@endforeach
							</div>
						@endif
						<?php 
use App\Course;
use App\Department;
use App\Group;
$courseinfo = Course::orderby('course_code')->lists('course_code', 'course_code');
$value = Department::where('code', $departcode)->orderby('code')->first()->code;
$groupinfo = Group::where('department', $value)->orderby('group_code')->lists('group_code', 'group_code');
?>
						<fieldset>
						<legend>Select Course</legend>
						<div class="control-group">
						{!! Form::label('coursecode', 'Select Course:', array('class' => 'control-label')) !!}
						<div class="controls">
						{!! Form::select('selectcoursecode', $courseinfo) !!}
						</div>
						</div>
						<div class="control-group">
						{!! Form::label('classcode', 'Offer to:', array('class' => 'control-label')) !!}
						<div class="controls">
						{!! Form::select('selectclass',$groupinfo, array('id' => 'selectclass')) !!}
						</div>
 public function revertAssignedWork(RevertAssignedWorkRequest $request)
 {
     if ($request->revert == 1) {
         $work = Work::where('id', '=', $request->work_id)->first();
         if ($work->created_by == $this->currentUser->getId()) {
             /**
              * İŞİ GERİ ÇEKİLİNCE
              */
             $departmentWork = DepartmentWork::where('id', '=', $work->last_department_work_id)->first();
             $departmentWithSenior = Department::where('id', '=', $departmentWork->department_id)->with('senior')->first();
             $seniorUser = $departmentWithSenior->senior[0];
             $username = $seniorUser->first_name . " " . $seniorUser->last_name;
             $username = mb_convert_case($username, MB_CASE_TITLE, 'utf-8');
             CommonController::mailSendNotQueue('IS TAKIP SISTEMI', [$seniorUser->email], ['fullname' => $username, 'message' => 'Departmanınıza açılan "' . $work->title . '" başlıklı iş geri
                 alınmıştır. Lütfen ' . $this->currentUser->first_name . ' ' . $this->currentUser->last_name . ' ile irtibata geçiniz. '], 'emails.work-mail-template');
             CommonController::sendSms('RHPOZTFYAY', $seniorUser->phone, 'Departmanınızdaki "' . $work->title . '" başlıklı iş geri
             alınmıştır.Lütfen ' . $this->currentUser->first_name . ' ' . $this->currentUser->last_name . '  ile irtibata geçiniz.');
             $work->last_department_work_id = null;
             $work->save();
         } else {
             $workDepartment = DepartmentWork::where('id', '=', $work->last_department_work_id)->first();
             $userWork = UserWork::where('id', '=', $workDepartment->last_user_work_id)->first();
             $user = User::where('id', '=', $userWork->assigned_to)->first();
             $username = $user->first_name . " " . $user->last_name;
             $username = mb_convert_case($username, MB_CASE_TITLE, 'utf-8');
             CommonController::mailSendNotQueue('IS TAKIP SISTEMI', [$user->email], ['fullname' => $username, 'message' => 'Size acılan "' . $work->title . '" başlıklı iş geri alınmıştır.
                  Lütfen departman lideriniz ile irtibata geçiniz. '], 'emails.work-mail-template');
             CommonController::sendSms('RHPOZTFYAY', $user->phone, 'Size açılmış  "' . $work->title . '" başlıklı iş geri alınmıştır.
             Lütfen departman lideri ile irtibata geçiniz.');
             $workDepartment->last_user_work_id = null;
             $workDepartment->accepted = null;
             $workDepartment->save();
         }
         return response()->json(['success' => true, 'messages' => 'İş Geri Alma İşlemi Başarılı', 'revert' => true, 'work_id' => $work->id]);
     } else {
         return response()->json(['success' => true, 'messages' => 'İş Geri Alma İşlemi Başarılı', 'revert' => false]);
     }
 }
Exemplo n.º 29
0
    <div class="bs-example">
        <div class="panel panel-primary">
            <div class="panel-heading" style="background: #009FD7;"><h4 class="panel-title">{{ $user->name }}</h4></div>
            <div class="panel-body">
                <?php 
use App\Action;
use App\Task;
use App\Department;
use App\Team;
$user_stuff = array();
$user_stuff = array_merge($user_stuff, Action::where('lead', 'like', '%' . $user->email . '%')->get()->all());
$user_stuff = array_merge($user_stuff, Action::where('collaborators', 'like', '%' . $user->email . '%')->get()->all());
$user_stuff = array_merge($user_stuff, Task::where('lead', 'like', '%' . $user->email . '%')->get()->all());
$user_stuff = array_merge($user_stuff, Task::where('collaborators', 'like', '%' . $user->email . '%')->get()->all());
$user_stuff = array_merge($user_stuff, Department::where('name', 'like', '%' . $user->department . '%')->get()->all());
?>

                <table class="table table-striped table-hover table-bordered table-responsive">
                    <tbody>
                    @foreach($user_stuff as $item)
                        <?php 
$result_class = str_replace("app\\", "", strtolower(get_class($item)));
?>
                        <tr>

                            <td><a href="/{{  $result_class }}s/show/{{ $item->id }}">{{ ucwords($result_class) }}: @if(!in_array($result_class, ["department", "team"])){{ $item->body }}@else{{ $item->name }}@endif</a></td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
 public function destroy($id)
 {
     $this->permissionSection(function () use($id) {
         DB::transaction(function () use($id) {
             $department = Department::where('id', '=', \Crypt::decrypt($id))->delete();
         });
     }, 'wts.department.delete');
     return response()->json($this->deleteResponseMessage);
 }