public function listingBerita() { $berita = Berita::select('id', 'judul', 'deskripsi', 'created_at', 'slug'); return Datatables::of($berita)->addColumn('operation', function ($index) { return "<button value='{$index->id}' onClick='ViewModal(this);' class='btn btn-social-icon btn-dropbox btn-sm' data-toggle='modal' data-target='#viewModal' title='View Data'><i class='fa fa-share-square-o'></i></button>" . " <button value='{$index->id}' onClick='EditModal(this);' class='btn btn-social-icon btn-linkedin btn-sm ' data-toggle='modal' title='Edit Data' data-target='#myModal'><i class='fa fa-edit'></i></button>" . " <button value='{$index->id}' onClick='HapusModal(this);' class='btn btn-social-icon btn-google btn-sm' data-toggle='modal' data-target='#dellModal' title='Hapus Data'><i class='fa fa-trash'></i></button>" . " <a href='berita/post/{$index->slug}' target='_blank'> <button value='{$index->id}' class='btn btn-social-icon btn-vk btn-sm' title='View Post'><i class='fa fa-link'></i></button></a> "; })->removeColumn('slug')->make(); }
/** * @param ManageUserRequest $request * @return mixed */ public function __invoke(ManageUserRequest $request) { return Datatables::of($this->users->getForDataTable($request->get('status'), $request->get('trashed')))->editColumn('confirmed', function ($user) { return $user->confirmed_label; })->addColumn('roles', function ($user) { return $user->roles->count() ? implode("<br/>", $user->roles->pluck('name')->toArray()) : trans('labels.general.none'); })->addColumn('actions', function ($user) { return $user->action_buttons; })->withTrashed()->make(true); }
public function listingPengumuman() { // $pengumuman = Pengumuman::all(); // return response()->json( // $pengumuman->toArray() // ); $pengumuman = Pengumuman::select('id', 'judulPeng', 'created_at'); return Datatables::of($pengumuman)->addColumn('operation', function ($index) { return "<button value='{$index->id}' onClick='EditModal(this);' class='btn btn-primary' data-toggle='modal' data-target='#myModal'>Edit</button>" . " <button value='{$index->id}' onClick='HapusModal(this);' class='btn btn-danger' data-toggle='modal' data-target='#dellModal'>Hapus</button>" . " <button value='{$index->id}' onClick='ViewModal(this);' class='btn btn-default' data-toggle='modal' data-target='#viewModal'>View</button>"; })->make(); }
public function listingLowongan() { // $lowongans = Lowongan::all(); // return response()->json( // $lowongans->toArray() // ); $lowongan = Lowongan::select('id', 'judul', 'namaPt', 'deadline', 'slug'); return Datatables::of($lowongan)->addColumn('operation', function ($index) { return "<button value='{$index->id}' onClick='ViewModal(this);' class='btn btn-social-icon btn-dropbox btn-sm' data-toggle='modal' data-target='#viewModal' title='View Data'><i class='fa fa-share-square-o'></i></button>" . " <button value='{$index->id}' onClick='EditModal(this);' class='btn btn-social-icon btn-linkedin btn-sm ' data-toggle='modal' title='Edit Data' data-target='#myModal'><i class='fa fa-edit'></i></button>" . " <button value='{$index->id}' onClick='HapusModal(this);' class='btn btn-social-icon btn-google btn-sm' data-toggle='modal' data-target='#dellModal' title='Hapus Data'><i class='fa fa-trash'></i></button>" . " <a href='lowongan/post/{$index->slug}' target='_blank'> <button value='{$index->id}' class='btn btn-social-icon btn-vk btn-sm' title='View Post'><i class='fa fa-link'></i></button></a> "; })->removeColumn('slug')->make(); }
/** * @param ManageRoleRequest $request * @return mixed */ public function __invoke(ManageRoleRequest $request) { return Datatables::of($this->roles->getForDataTable())->addColumn('permissions', function ($role) { if ($role->all) { return '<span class="label label-success">' . trans('labels.general.all') . '</span>'; } return $role->permissions->count() ? implode("<br/>", $role->permissions->pluck('display_name')->toArray()) : '<span class="label label-danger">' . trans('labels.general.none') . '</span>'; })->addColumn('users', function ($role) { return $role->users->count(); })->addColumn('actions', function ($role) { return $role->action_buttons; })->make(true); }
/** * @return mixed */ public function data() { $categories = Categories::select('id', 'name', 'description', 'slug')->orderBy('id', 'desc'); return Datatables::of($categories)->editColumn('name', ' <a href="#"><b>{{$name}}</b></a> <div class="row-actions hide"> <a href="{{{ URL::to(\'admin/categories/edit/\' . $id . \'/\') }}}">Edit</a> | <a class="delete-tag" href="{{ URL::to(\'admin/categories/delete/\' . $id .\'/\') }}" onclick=" return confirm(\'Are you want to delete\')">Delete</a> | <a href="#">View</a> </div> ')->editColumn('id', '<input id="cb-select-all-1" type="checkbox" data="{{$id}}">')->make(); }
/** * @param int $corporation_id * * @return mixed */ public function getMarketData(int $corporation_id) { $orders = $this->getCorporationMarketOrders($corporation_id, false); $states = $this->getEveMarketOrderStates(); return Datatables::of($orders)->addColumn('bs', function ($row) { return view('web::partials.marketbuysell', compact('row'))->render(); })->addColumn('vol', function ($row) { return view('web::partials.marketvolume', compact('row'))->render(); })->addColumn('state', function ($row) use($states) { return $states[$row->orderState]; })->editColumn('price', function ($row) { return number($row->price); })->addColumn('total', function ($row) { return number($row->price * $row->volEntered); })->editColumn('typeName', function ($row) { return view('web::partials.markettype', compact('row'))->render(); })->make(true); }
/** * @param ManageUserRequest $request * @return mixed */ public function get(ManageUserRequest $request) { return Datatables::of($this->users->getForDataTable($request->get('status'), $request->get('trashed')))->editColumn('confirmed', function ($user) { return $user->confirmed_label; })->addColumn('roles', function ($user) { $roles = []; if ($user->roles()->count() > 0) { foreach ($user->roles as $role) { array_push($roles, $role->name); } return implode("<br/>", $roles); } else { return trans('labels.general.none'); } })->addColumn('actions', function ($user) { return $user->action_buttons; })->make(true); }
/** * @param ManageRoleRequest $request * @return mixed */ public function get(ManageRoleRequest $request) { return Datatables::of($this->roles->getForDataTable())->addColumn('permissions', function ($role) { $permissions = []; if ($role->all) { return '<span class="label label-success">' . trans('labels.general.all') . '</span>'; } if (count($role->permissions) > 0) { foreach ($role->permissions as $permission) { array_push($permissions, $permission->display_name); } return implode("<br/>", $permissions); } else { return '<span class="label label-danger">' . trans('labels.general.none') . '</span>'; } })->addColumn('users', function ($role) { return $role->users()->count(); })->addColumn('actions', function ($role) { return $role->action_buttons; })->make(true); }
public function getCharDataCkey($ckey, Request $request) { if ($request->user()->cannot('server_chars_show')) { abort('403', 'You do not have the required permission'); } $chars = ServerCharacter::where('ckey', $ckey)->select(['id', 'name', 'ckey']); return Datatables::of($chars)->removeColumn('id')->editColumn('name', '<a href="{{route(\'server.chars.show.get\',[\'char\'=>$id])}}">{{$name}}</a>')->addColumn('action', '<p><a href="{{route(\'server.chars.show.get\',[\'char\'=>$id])}}" class="btn btn-success" role="button">Show</a>@can(\'ccia_record_edit\')<a href="{{route(\'server.chars.edit.cr.get\',[\'book\'=>$id])}}" class="btn btn-info" role="button">Edit CCIA Record</a>@endcan()</p>')->make(); }
/** * * @param Project $project * @param Request $request * @return string */ public function getAllStatus($project, Request $request) { $parameters = ['project_id' => $project->id, 'org_id' => $project->org_id]; $column = DB::select(DB::raw("SELECT GROUP_CONCAT(DISTINCT CONCAT('MAX(IF(results.section_id = ',results.section_id,', results.information, NULL)) AS s', results.section_id)) AS sections FROM results WHERE (results.project_id = {$project->id});")); $query = ['pcode.id', 'pcode.pcode', 'pcode.state', 'pcode.district', 'pcode.township', 'pcode.village']; if (!empty($column[0]->sections)) { $query[] = DB::raw($column[0]->sections); } $project_id = $project->id; $org_id = $project->org_id; $status = PLocation::select($query)->where('pcode.org_id', $org_id)->with(['participants'])->leftjoin('results', function ($pcode) use($project_id) { $pcode->on('pcode.id', '=', 'results.resultable_id')->where('results.project_id', '=', $project_id); })->groupBy('pcode.id')->get(); return Datatables::of($status)->filter(function ($instance) use($request) { if ($request->has('pcode')) { $code = $request->get('pcode'); $instance->collection = $instance->collection->filter(function ($row) use($request) { return Str::contains($row['pcode'], $request->get('pcode')) ? true : false; }); } if ($request->has('region')) { $code = $request->get('region'); $instance->collection = $instance->collection->filter(function ($row) use($request) { return Str::contains($row['state'], $request->get('region')) ? true : false; }); } if ($request->has('township')) { $code = $request->get('township'); $instance->collection = $instance->collection->filter(function ($row) use($request) { return Str::contains($row['township'], $request->get('township')) ? true : false; }); } if ($request->has('station')) { $code = $request->get('station'); $instance->collection = $instance->collection->filter(function ($row) use($request) { return Str::contains($row['village'], $request->get('station')) ? true : false; }); } if ($request->has('phone')) { $code = $request->get('phone'); $instance->collection = $instance->collection->filter(function ($row) use($request) { //dd($row->toArray()); return Str::contains($row['participants'], $request->get('phone')) ? true : false; }); } if (!is_null($request->get('section')) && $request->get('section') >= 0) { $section = "s" . $request->get('section'); // array key will be s0,s1,s2 etc.. $status = $request->get('status'); if ($status == 'missing') { $instance->collection = $instance->collection->filter(function ($row) use($request, $section) { return Str::is($row[$section], null) ? true : false; }); } else { $instance->collection = $instance->collection->filter(function ($row) use($request, $section, $status) { return Str::is($row[$section], $status) ? true : false; }); } } })->editColumn('pcode', function ($modal) use($project) { //if($modal->results){ return $modal->pcode . "<a href='" . route('data.project.results.edit', [$project->id, $modal->id]) . "' title='Edit'> <i class='fa fa-edit'></i></a>"; //} })->editColumn('state', function ($modal) use($project) { $state = !is_null($modal->state) ? $modal->state : ''; return _t($state); })->editColumn('township', function ($modal) use($project) { $township = !is_null($modal->township) ? $modal->township : ''; return _t($township); })->editColumn('village', function ($modal) use($project) { $village = !is_null($modal->village) ? $modal->village : ''; return _t($village); })->make(true); }
public function getDataAll(Request $request) { if ($request->user()->cannot('ccia_action_show')) { abort('403', 'You do not have permission to edit CCIA Actions.'); } $data = CCIAAction::select(['id', 'title', 'expires_at']); return Datatables::of($data)->editColumn('title', '<a href="{{ route(\'ccia.actions.show.get\', [\'id\' => $id]) }}">{{$title}}</a>')->addColumn('action', '<p><a href="{{ route(\'ccia.actions.show.get\', [\'id\' => $id]) }}" class="btn btn-success" role="button">Show</a> @can(\'ccia_action_edit\')<a href="{{route(\'ccia.actions.edit.get\', [\'id\' => $id]) }}" class="btn btn-info" role="button">Edit</a><a href="{{route(\'ccia.actions.delete\', [\'id\' => $id]) }}" class="btn btn-danger" role="button">Delete</a>@endcan()</p>')->make(); }
/** * @return mixed */ public function getData() { $model = $this->crud['model']; $data = $model::all(); return Datatables::of($data)->make(true); }