/** * { index } * * @param * * @return */ public function index($org_id = 0) { //1. validate if (is_null($org_id)) { App::abort(403, 'Id Organisasi tidak ada'); } //2. get data $SortList = new SortList(); $this->page_attributes->page_subtitle = 'index'; //dummy $this->page_attributes->filters = []; //dummy $this->page_attributes->sorts = []; //2. get data parameter $data_parameter = $this->setPageDataParameter(); //3. get data $search = array_merge(['name' => $data_parameter['search']], $data_parameter['filter']); $APIOrg = new APIOrg(); $organisation = $APIOrg->getShow($org_id); //4. set page datas $this->page_datas->datas['id'] = $org_id; $this->page_datas->datas['name'] = $organisation['data']['name']; //5. generate view $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$organisation['data']['name'] => route('org.show', ['id' => $org_id]), 'Kebijakan' => route('policy.index', ['org_id' => $org_id])]); $view_source = $this->view_source_root . '.index'; $route_source = route(Route::CurrentRouteName()); return $this->generateView($view_source, $route_source); }
public function index() { //page attributes $this->page_attributes->page_title = $this->page_title; $this->page_attributes->filters = ['b']; //get data parameter $data_parameter = $this->setPageDataParameter(); //data $APIOrg = new APIOrg(); $data = $APIOrg->getIndex(['take' => $data_parameter['take'], 'skip' => ($data_parameter['page'] - 1) * $data_parameter['take']]); //page datas $this->page_datas->datas = $data; //generate view $view_source = $this->view_source_root; $route_source = route(Route::CurrentRouteName()); return $this->generateView($view_source, $route_source); }
/** * { FindOrgByName } * * @param *1. name * * @return * 1. id * 2. name * * Step: * 1. get data * 2. validate * 3. returning data */ public function FindOrgByName($name = null) { //1. get data $APIOrg = new APIOrg(); $search = array_merge(['name' => $name]); $org = $APIOrg->getIndex(['search' => $search]); //2. validate if ($org['status'] != 'success') { return abort(404); } //3. returning data $datas = []; foreach ($org['data']['data'] as $key => $dt) { $datas[$key]['id'] = $dt['id']; $datas[$key]['name'] = ucwords($dt['name']); } return $datas; }
/** * { create } * * @param * 1. id * 2. org_id * * @return * 1. Layout * 2. page_attributes * 3. page_datas * * steps * 1. validate * 2. get data * 3. set page attributes * 4. set page datas * 5. generate view */ public function create($org_id = null, $id = null) { //1. validate if (is_null($org_id)) { App::abort(403, 'Id Organisasi tidak ada'); } // 2 & 3 $APIOrg = new APIOrg(); $org = $APIOrg->getShow($org_id); if (!is_null($id)) { //2. get data $APIBranch = new APIBranch(); $data = $APIBranch->getShow($org_id, $id); //3. set page attributes $current_route = route(Route::CurrentRouteName(), ['org_id' => $org_id, 'id' => $id]); $this->page_attributes->page_subtitle = 'Edit Cabang ' . $data['data']['name']; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$org['data']['name'] => route('org.show', ['id' => $org_id]), 'Cabang' => route('branch.index', ['org_id' => $org_id]), 'Edit Cabang ' . $data['data']['name'] => $current_route]); } else { //2. get data $data['data']['id'] = ""; $data['data']['organisation_id'] = $org_id; $data['data']['name'] = null; $data['data']['address'] = null; $data['data']['phone'] = null; $data['data']['email'] = null; $data['data']['charts'] = []; //3. set page attributes $current_route = route(Route::CurrentRouteName(), ['org_id' => $org_id]); $this->page_attributes->page_subtitle = 'Cabang Baru'; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$org['data']['name'] => route('org.show', ['id' => $org_id]), 'Cabang' => route('branch.index', ['org_id' => $org_id]), 'Cabang Baru' => $current_route]); } $APIBranch = new APIBranch(); $branches = $APIBranch->getIndex($org_id, []); //4. set page datas $this->page_datas->datas['id'] = $org_id; $this->page_datas->datas['name'] = $org['data']['name']; $this->page_datas->datas['branch'] = $data['data']; $this->page_datas->datas['branches'] = $branches['data']['data']; //5. generate view $view_source = $this->view_source_root . '.create'; $route_source = $current_route; return $this->generateView($view_source, $route_source); }
/** * { create } * * @param * 1. id * 2. org_id * * @return * 1. Layout * 2. page_attributes * 3. page_datas * * steps * 1. validate * 2. get data * 3. set page attributes * 4. set page datas * 5. generate view */ public function create($org_id = null, $id = null) { //1. validate if (is_null($org_id)) { App::abort(403, 'Id Organisasi tidak ada'); } // 2 & 3 $APIOrg = new APIOrg(); $organisation = $APIOrg->getShow($org_id); $APICalendar = new APICalendar(); $employees = $APICalendar->getIndex($org_id, []); $APIBranch = new APIBranch(); $APIChart = new APIChart(); $branches = $APIBranch->getIndex($org_id, []); $positions = $APIChart->getPositions($org_id, []); $departments = $APIChart->getDepartments($org_id, []); $maritalstatuses = $APICalendar->getMaritalStatuses($org_id, []); $grades = $APICalendar->getGrades($org_id, []); if (!is_null($id)) { //2. get data $data = $APICalendar->getShow($org_id, $id); //3. set page attributes $current_route = route(Route::CurrentRouteName(), ['org_id' => $org_id, 'id' => $id]); $this->page_attributes->page_subtitle = 'Edit Karyawan ' . $data['data']['name']; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$organisation['data']['name'] => route('org.show', ['id' => $org_id]), 'Karyawan' => route('employee.index', ['org_id' => $org_id]), 'Edit Karyawan ' . $data['data']['name'] => $current_route]); } else { //2. get data $data['data'] = null; //3. set page attributes $current_route = route(Route::CurrentRouteName(), ['org_id' => $org_id]); $this->page_attributes->page_subtitle = 'Karyawan Baru'; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$organisation['data']['name'] => route('org.show', ['id' => $org_id]), 'Karyawan' => route('employee.index', ['org_id' => $org_id]), 'Karyawan Baru' => $current_route]); } $APICalendar = new APICalendar(); $employees = $APICalendar->getIndex($org_id, []); //4. set page datas $this->page_datas->datas['branches'] = $branches['data']['data']; $this->page_datas->datas['positions'] = $positions['data']; $this->page_datas->datas['departments'] = $departments['data']; $this->page_datas->datas['maritalstatuses'] = $maritalstatuses['data']; $this->page_datas->datas['grades'] = $grades['data']; $this->page_datas->datas['employees'] = $employees['data']['data']; $this->page_datas->datas['employee'] = $data['data']; $this->page_datas->datas['id'] = $org_id; $this->page_datas->datas['name'] = $organisation['data']['name']; $this->page_datas->datas['code'] = $organisation['data']['code']; //5. generate view $view_source = $this->view_source_root . '.create'; $route_source = $current_route; return $this->generateView($view_source, $route_source); }
/** * { create } * * @param * 1. org_id * 2. branch_id * 3. id * * @return * 1. Layout * 2. page_attributes * 3. page_datas * * steps * 1. validate * 2. get data * 3. set page attributes * 4. set page datas * 5. generate view */ public function create($org_id = null, $branch_id = null, $id = null) { //1. validate if (is_null($org_id)) { App::abort(403, 'Id Organisasi tidak ada'); } if (is_null($branch_id)) { App::abort(403, 'Id branch tidak ada'); } // 2 & 3 $APIOrg = new APIOrg(); $org = $APIOrg->getShow($org_id); if (!is_null($id)) { //2. get data $APIChart = new APIChart(); $data = $APIChart->getShow($org_id, $branch_id, $id); $data['data']['organisation_id'] = $org_id; //3. set page attributes $current_route = route(Route::CurrentRouteName(), ['org_id' => $org_id, 'branch_id' => $branch_id, 'id' => $id]); $this->page_attributes->page_subtitle = 'edit'; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$org['data']['name'] => route('org.show', ['id' => $org_id]), 'Edit Struktur ' . $data['data']['name'] => $current_route]); } else { //2. get data $data['data']['id'] = ""; $data['data']['organisation_id'] = $org_id; $data['data']['branch_id'] = $branch_id; $data['data']['name'] = null; $data['data']['department'] = null; $data['data']['path'] = null; //3. set page attributes $current_route = route(Route::CurrentRouteName(), ['org_id' => $org_id, 'branch_id' => $branch_id]); $this->page_attributes->page_subtitle = 'Struktur baru'; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, [$org['data']['name'] => route('org.show', ['id' => $org_id]), 'Cabang Baru' => $current_route]); } //4. set page datas $this->page_datas->datas = $data['data']; //5. generate view $view_source = $this->view_source_root . '.create'; $route_source = $current_route; return $this->generateView($view_source, $route_source); }