Exemplo n.º 1
0
 public function index(Annoucement $annoucement)
 {
     if (!Entrust::can('manage_annoucement')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     $annoucements = $annoucement->get();
     $col_data = array();
     $col_heads = array(trans('messages.Option'), trans('messages.Title'), trans('messages.Scope'), trans('messages.Start Date'), trans('messages.End Date'));
     $col_heads = Helper::putCustomHeads($this->form, $col_heads);
     $col_ids = Helper::getCustomColId($this->form);
     $values = Helper::fetchCustomValues($this->form);
     foreach ($annoucements as $annoucement) {
         $role_name = "<ol class='nl'>";
         foreach ($annoucement->Role as $role) {
             $role_name .= "<li>{$role->display_name}</li>";
         }
         $role_name .= "</ol>";
         $cols = array('<div class="btn-group btn-group-xs">' . '<a href="annoucement/' . $annoucement->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['annoucement.destroy', $annoucement->id]) . '</div>', $annoucement->annoucement_title, $role_name, Helper::showDate($annoucement->start_date), Helper::showDate($annoucement->end_date));
         $id = $annoucement->id;
         foreach ($col_ids as $col_id) {
             array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : '');
         }
         $col_data[] = $cols;
     }
     Helper::writeResult($col_data);
     return view('annoucement.index', compact('col_heads'));
 }
Exemplo n.º 2
0
 public function index(User $user, $type = null)
 {
     if (!Entrust::can('manage_user')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     $query = $user->with('roles');
     if ($type != null) {
         $query->whereHas('roles', function ($qry) use($type) {
             $qry->where('name', '=', $type);
         });
     }
     $users = $query->get();
     $col_data = array();
     $col_heads = array(trans('messages.Option'), trans('messages.Name'), trans('messages.Username'), trans('messages.Email'), trans('messages.Department'), trans('messages.Role'));
     $col_heads = Helper::putCustomHeads($this->form, $col_heads);
     $col_ids = Helper::getCustomColId($this->form);
     $values = Helper::fetchCustomValues($this->form);
     $token = csrf_token();
     foreach ($users as $user) {
         foreach ($user->roles as $role) {
             $role_name = $role->display_name;
         }
         $cols = array('<div class="btn-group btn-group-xs">' . '<a href="/user/' . $user->id . '" class="btn btn-default btn-xs" data-toggle="tooltip" title="View"> <i class="fa fa-share"></i></a> ' . '<a href="/user/welcomeEmail/' . $user->id . '/' . $token . '" class="btn btn-default btn-xs" data-toggle="tooltip" title="Send Welcome Email"> <i class="fa fa-envelope"></i></a>' . '<a href="/user/' . $user->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['user.destroy', $user->id]) . '</div>', $user->name, $user->username, $user->email, $user->Profile->department_id != null ? $user->Profile->Department->department_name : '', $role_name);
         $id = $user->id;
         foreach ($col_ids as $col_id) {
             array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : '');
         }
         $col_data[] = $cols;
     }
     Helper::writeResult($col_data);
     return view('user.index', compact('col_heads'));
 }
Exemplo n.º 3
0
 public function index(Page $page)
 {
     if (!Entrust::can('manage_page')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     $pages = $page->get();
     $col_data = array();
     $col_heads = array(trans('messages.Option'), trans('messages.Title'), trans('messages.Published'), trans('messages.Sign-in Only'));
     $col_heads = Helper::putCustomHeads($this->form, $col_heads);
     $col_ids = Helper::getCustomColId($this->form);
     $values = Helper::fetchCustomValues($this->form);
     foreach ($pages as $page) {
         $cols = array('<div class="btn-group btn-group-xs">' . '<a href="page/' . $page->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['page.destroy', $page->id]) . '</div>', $page->page_title, $page->published ? '<span class="badge badge-success">Publised</span>' : '<span class="badge badge-danger">Hold</span>', $page->sign_in_only ? '<span class="badge badge-warning">Sign-in Only</span>' : '<span class="badge badge-info">All</span>');
         $id = $page->id;
         foreach ($col_ids as $col_id) {
             array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : '');
         }
         $col_data[] = $cols;
     }
     Helper::writeResult($col_data);
     return view('page.index', compact('col_heads'));
 }
Exemplo n.º 4
0
 public function index(Holiday $holiday)
 {
     if (!Entrust::can('manage_holiday')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     $holidays = Holiday::all();
     $col_data = array();
     $col_heads = array(trans('messages.Option'), trans('messages.Date'), trans('messages.Description'));
     $col_heads = Helper::putCustomHeads($this->form, $col_heads);
     $col_ids = Helper::getCustomColId($this->form);
     $values = Helper::fetchCustomValues($this->form);
     foreach ($holidays as $holiday) {
         $cols = array('<div class="btn-group btn-group-xs">' . '<a href="/holiday/' . $holiday->id . '/edit" class="btn btn-default btn-xs"> <i class="fa fa-edit"></i></a> ' . delete_form(['holiday.destroy', $holiday->id]) . '</div>', Helper::showDate($holiday->date), $holiday->holiday_description);
         $id = $holiday->id;
         foreach ($col_ids as $col_id) {
             array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : '');
         }
         $col_data[] = $cols;
     }
     Helper::writeResult($col_data);
     $assets = ['mutidatepicker'];
     $data = ['col_heads' => $col_heads, 'assets' => $assets];
     return view('holiday.index', $data);
 }
Exemplo n.º 5
0
 public function index(Ticket $ticket, Request $request)
 {
     if (!Entrust::can('manage_ticket')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (Entrust::hasRole('admin')) {
         $query = $ticket::with('assignedUser');
     } else {
         $query = $ticket::with('assignedUser')->whereHas('assignedUser', function ($query) {
             $query->where('user_id', '=', Auth::user()->id);
         });
     }
     if ($request->input('department_id')) {
         $query->where('department_id', '=', $request->input('department_id'));
     }
     if ($request->input('ticket_type_id')) {
         $query->where('ticket_type_id', '=', $request->input('ticket_type_id'));
     }
     if ($request->input('ticket_priority')) {
         $query->where('ticket_priority', '=', $request->input('ticket_priority'));
     }
     if ($request->input('ticket_status')) {
         $query->where('ticket_status', '=', $request->input('ticket_status'));
     }
     if ($request->input('response_time_overdue')) {
         $query->where('response_due_time', '<', date('d M Y, H:i'));
     }
     if ($request->input('resolution_time_overdue')) {
         $query->where('resolution_due_time', '<', date('d M Y, H:i'));
     }
     if ($request->input('start_date')) {
         $query->where('created_at', '>=', $request->input('start_date'));
     }
     if ($request->input('end_date')) {
         $query->where('created_at', '<=', $request->input('end_date'));
     }
     if ($request->input('assigned') == 'assigned') {
         $query->Has('assignedUser');
     } elseif ($request->input('assigned') == 'unassigned') {
         $query->doesntHave('assignedUser');
     }
     if ($request->input('user_id')) {
         $query->whereHas('assignedUser', function ($query1) use($request) {
             $query1->whereIn('user_id', $request->input('user_id'));
         });
     }
     $filter_data = ['start_date' => $request->input('start_date'), 'end_date' => $request->input('end_date'), 'assigned' => $request->input('assigned'), 'department_id' => $request->input('department_id'), 'ticket_type_id' => $request->input('ticket_type_id'), 'ticket_priority' => $request->input('ticket_priority'), 'ticket_status' => $request->input('ticket_status'), 'user_id' => $request->input('user_id'), 'response_time_overdue' => $request->input('response_time_overdue'), 'resolution_time_overdue' => $request->input('resolution_time_overdue')];
     $tickets = $query->get();
     $col_data = array();
     $col_heads = array(trans('messages.Option'), trans('messages.Ticket #'), trans('messages.Name'), trans('messages.Subject'), trans('messages.Response Time'), trans('messages.Resolution Time'), trans('messages.Priority'), trans('messages.Status'));
     $col_heads = Helper::putCustomHeads($this->form, $col_heads);
     $col_ids = Helper::getCustomColId($this->form);
     $values = Helper::fetchCustomValues($this->form);
     foreach ($tickets as $ticket) {
         $cols = array('<div class="btn-group btn-group-xs">' . '<a href="/ticket/' . $ticket->id . '" class="btn btn-default btn-xs" data-toggle="tooltip" title="View"> <i class="fa fa-share"></i></a> ' . '<a href="/ticket/' . $ticket->id . '/edit" class="btn btn-default btn-xs" data-toggle="tooltip" title="Edit"> <i class="fa fa-edit"></i></a> ' . delete_form(['ticket.destroy', $ticket->id]) . '</div>', $ticket->ticket_no, $ticket->User->name, $ticket->ticket_subject, (strtotime($ticket->response_due_time) < time() ? '<span class="badge badge-danger">Overdue</span> ' : '') . Helper::showDateTime($ticket->response_due_time), (strtotime($ticket->resolution_due_time) < time() ? '<span class="badge badge-danger">Overdue</span> ' : '') . Helper::showDateTime($ticket->resolution_due_time), Helper::showTicketPriority($ticket->ticket_priority), Helper::showTicketStatus($ticket->ticket_status));
         $id = $ticket->id;
         foreach ($col_ids as $col_id) {
             array_push($cols, isset($values[$id][$col_id]) ? $values[$id][$col_id] : '');
         }
         $col_data[] = $cols;
     }
     $departments = Department::lists('department_name', 'id')->all();
     $ticket_types = TicketType::lists('ticket_type_name', 'id')->all();
     Helper::writeResult($col_data);
     $users = User::with('roles')->whereHas('roles', function ($query) {
         $query->where('roles.name', '!=', 'user');
     })->lists('name', 'id')->all();
     return view('ticket.index', compact('col_heads', 'departments', 'ticket_types', 'filter_data', 'users'));
 }