public function sale() { //1. Check filter $search = []; $sort = []; if (Input::has('periode')) { $tmpdate = "01-" . Input::get('periode') . " 00:00:00"; $search['ondate'] = [Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->format('Y-m-d H:i:s'), Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->addMonths(1)->format('Y-m-d H:i:s')]; } else { $tmpdate = "01-" . date('m-Y') . " 00:00:00"; $search['ondate'] = [Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->format('Y-m-d H:i:s'), Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->addMonths(1)->format('Y-m-d H:i:s')]; } if (Input::has('q')) { $search['name'] = Input::get('q'); $this->page_attributes->search = Input::get('q'); } if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = []; } $this->page_attributes->filters = []; //2. Sorting if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = []; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['tanggal', 'jumlah'], 'tanggal' => $SortList->getSortingList('tanggal'), 'jumlah' => $SortList->getSortingList('jumlah')]; //3. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //4. Generate breadcrumb $breadcrumb = ['Rekap Penjualan & Penggunaan Voucher' => route('report.recap.sale')]; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //5. Get data from API $APIReport = new APIReport(); $report = $APIReport->getVoucherUsage(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['report' => $report]; //6. Generate paginator $this->paginate(route('report.recap.sale'), $report['data']['count'], $page); //7. Generate view $this->page_attributes->source = $this->page_attributes->source . 'penjualan.index'; return $this->generateView(); }
public function index() { //1. Check filter $search = []; $sort = []; if (Input::has('periode')) { $tmpdate = "01-" . Input::get('periode') . " 00:00:00"; $search['ondate'] = [Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->format('Y-m-d H:i:s'), Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->addMonths(1)->format('Y-m-d H:i:s')]; } else { $tmpdate = "01-" . date('m-Y') . " 00:00:00"; $search['ondate'] = [Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->format('Y-m-d H:i:s'), Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->addMonths(1)->format('Y-m-d H:i:s')]; } if (Input::has('q')) { $search['refnumber'] = Input::get('q'); $this->page_attributes->search = Input::get('q'); } if (Input::has('status')) { $search['status'] = Input::get('status'); } else { $search['status'] = ['wait', 'veritrans_processing_payment', 'paid', 'packed', 'shipping', 'delivered']; } $this->page_attributes->filters = ['titles' => ['status'], 'status' => ['wait', 'veritrans_processing_payment', 'paid', 'packed', 'shipping', 'delivered']]; //2. Sorting if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = []; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['tanggal', 'nota', 'tagihan'], 'tanggal' => $SortList->getSortingList('tanggal'), 'nota' => $SortList->getSortingList('nota'), 'tagihan' => $SortList->getSortingList('tagihan')]; //3. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //4. Generate breadcrumb $breadcrumb = ['Laporan Penjualan' => route('report.product.sale')]; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //5. Get data from API $APISale = new APISale(); $sale = $APISale->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['sale' => $sale]; //6. Generate paginator $this->paginate(route('report.product.sale'), $sale['data']['count'], $page); //7. Generate view $this->page_attributes->source = $this->page_attributes->source . '.index'; return $this->generateView(); }
/** * { index } * * @param * * @return * 1. Layout * 2. page_attributes * 3. page_datas * * steps * 1. set page attributes * 2. get data parameter * 3. get data * 4. set page datas * 5. generate view */ public function index() { //1. set page attributes $SortList = new SortList(); $this->page_attributes->page_subtitle = 'index'; //dummy $this->page_attributes->filters = ['b' => ['ab', 'ba'], 'c' => ['ac', 'ca']]; //dummy $this->page_attributes->sorts = ['nama' => $SortList->getSortingList('nama')]; //2. get data parameter $data_parameter = $this->setPageDataParameter(); //3. get data $APIOrg = new APIOrg(); if ($data_parameter['search'] != null) { $search = array_merge(['name' => $data_parameter['search']], $data_parameter['filter']); } else { $search = []; } if ($data_parameter['take'] != null) { $data = $APIOrg->getIndex(['search' => $search, 'sort' => $data_parameter['sort'], 'take' => $data_parameter['take'], 'skip' => ($data_parameter['page'] - 1) * $data_parameter['take']]); } else { $data = $APIOrg->getIndex(['search' => $search, 'sort' => $data_parameter['sort']]); } //4. set page datas $this->page_datas->datas = $data['data']; //5. generate view $view_source = $this->view_source_root . '.index'; $route_source = route(Route::CurrentRouteName()); return $this->generateView($view_source, $route_source); }
/** * { 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 = ['b' => ['ab', 'ba'], 'c' => ['ac', 'ca']]; //dummy $this->page_attributes->sorts = ['nama' => $SortList->getSortingList('nama')]; //2. get data parameter $data_parameter = $this->setPageDataParameter(); //3. get data $APIBranch = new APIBranch(); $search = array_merge(['name' => $data_parameter['search']], $data_parameter['filter']); $APIBranch = new APIBranch(); $APIOrg = new APIOrg(); $organisation = $APIOrg->getShow($org_id); $data = $APIBranch->getIndex($org_id, ['search' => $search, 'sort' => $data_parameter['sort'], 'take' => $data_parameter['take'], 'skip' => ($data_parameter['page'] - 1) * $data_parameter['take']]); //4. set page datas $this->page_datas->datas['branches'] = $data['data']['data']; $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]), 'Cabang' => route('branch.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 show($id) { //get data category $APICategory = new APICategory(); $category = $APICategory->getShow($id); $this->page_attributes->subtitle = $category['data']['name']; //search if (Input::has('q')) { $search = ['name' => Input::get('q'), 'categories' => str_replace(" ", "-", strtolower($category['data']['slug']))]; $this->page_attributes->search = Input::get('q'); } else { $search = ['categories' => str_replace(" ", "-", strtolower($category['data']['slug']))]; } //sort if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = []; } //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //get product data $APIProduct = new APIProduct(); $product = $APIProduct->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); //data paging $this->paginate(route('goods.category.show', ['id' => $category['data']['id']]), $product['data']['count'], $page); $category['data']['products'] = $product['data']['data']; //sorting $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['nama', 'harga', 'stok'], 'nama' => $SortList->getSortingList('nama'), 'harga' => $SortList->getSortingList('harga'), 'stok' => $SortList->getSortingList('stok')]; // data here $this->page_attributes->data = $category['data']; //breadcrumb $breadcrumb = [$category['data']['name'] => route('goods.category.show', ['id' => $category['data']['name']])]; //generate View $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); $this->page_attributes->source = $this->page_attributes->source . 'show'; return $this->generateView(); }
/** * Display all voucher * * 1. Check filter * 2. Check page * 3. Get data from API * 4. Generate paginator * 5. Generate breadcrumb * 6. Generate view * @param page, q * @return Object View */ public function index() { //1. Check filter $search = []; if (Input::has('q')) { $search['code'] = ['code' => Input::get('q')]; $this->page_attributes->search = Input::get('q'); } else { $searchResult = null; } if (Input::has('tipe')) { $search['type'] = str_replace(" ", "_", Input::get('tipe')[0]); } //sort if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } $this->page_attributes->filters = ['titles' => ['tipe'], 'tipe' => ['free shipping cost', 'debit point', 'store manager', 'promo referral']]; //2. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //3. Get data from API $APIVoucher = new APIVoucher(); $voucher = $APIVoucher->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['voucher' => $voucher]; $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['kode', 'tanggal', 'jumlah', 'kuota'], 'kode' => $SortList->getSortingList('kode'), 'tanggal' => $SortList->getSortingList('tanggal'), 'jumlah' => $SortList->getSortingList('jumlah'), 'kuota' => $SortList->getSortingList('quota')]; //4. Generate paginator $this->paginate(route('promote.voucher.index'), $voucher['data']['count'], $page); //5. Generate breadcrumb $breadcrumb = []; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //6. Generate view $this->page_attributes->source = $this->page_attributes->source . '.index'; return $this->generateView(); }
public function index($pid = null) { //initialize $APIProduct = new APIProduct(); $product = $APIProduct->getShow($pid); $this->page_attributes->subtitle = $product['data']['name']; $collection = collect($product['data']['prices']); //sorting if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); if ($sort_item[1] == 'asc') { $collection = $collection->sortBy('started_at'); } else { $collection = $collection->sortByDesc('started_at'); } } // filters & collection if (Input::has('start') && Input::has('end')) { $this->page_attributes->search = 'Periode ' . Input::get('start') . ' sampai ' . Input::get('end'); $filterStart = date('Y-m-d H:i:s', strtotime(Input::get('start'))); $filterEnd = date('Y-m-d H:i:s', strtotime(Input::get('end'))); $result = $collection->filter(function ($col) use($filterStart, $filterEnd) { return $col['started_at'] >= $filterStart && $col['started_at'] <= $filterEnd; }); } else { $result = $collection; } //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //data paging $collection = collect($result); if (count($collection) != 0) { $result = $collection->chunk($this->take); $this->paginate(route('goods.price.show', ['id' => $pid]), count($product['data']['prices']), $page); $product['data']['prices'] = $result[$page - 1]; } else { $this->paginate(route('goods.price.show', ['id' => $pid]), count($product['data']['prices']), $page); } // set data $product['data']['prices'] = $result->forPage($page, $this->take); $this->page_attributes->data = ['product' => $product['data']]; $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['tanggal'], 'tanggal' => $SortList->getSortingList('tanggal')]; //breadcrumb $breadcrumb = [$product['data']['name'] => route('goods.product.show', ['id' => $pid]), 'Harga' => route('goods.price.show', ['id' => $pid])]; //generate View $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); $this->page_attributes->source = $this->page_attributes->source . 'show'; return $this->generateView(); }
public function index() { //initialize $search = []; if (Input::has('periode')) { $tmpdate = "01-" . Input::get('periode')[0] . " 00:00:00"; $search['ondate'] = [Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->format('Y-m-d H:i:s'), Carbon::createFromFormat('d-m-Y H:i:s', $tmpdate)->addMonths(1)->format('Y-m-d H:i:s')]; } if (Input::has('q')) { $search['refnumber'] = Input::get('q'); $this->page_attributes->search = Input::get('q'); } //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //sorting if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = []; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['tanggal', 'nota', 'jumlah'], 'tanggal' => $SortList->getSortingList('tanggal'), 'nota' => $SortList->getSortingList('nota'), 'jumlah' => $SortList->getSortingList('jumlah')]; // data here $APIPurchase = new APIPurchase(); $purchase = $APIPurchase->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['purchase' => $purchase]; //paginate $this->paginate(route('shop.buy.index'), $purchase['data']['count'], $page); //breadcrumb $breadcrumb = []; //generate View $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); $this->page_attributes->source = $this->page_attributes->source . '.index'; return $this->generateView(); }
/** * Display all point * * 1. Check filter * 2. Check page * 3. Get data from API * 4. Generate paginator * 5. Generate breadcrumb * 6. Generate view * @param page, q * @return Object View */ public function index() { //1. Check filter $search = null; if (Input::has('q')) { $search = ['customername' => Input::get('q')]; $this->page_attributes->search = Input::get('q'); } else { $searchResult = null; } //sort if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = []; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['kadaluarsa', 'jumlah'], 'kadaluarsa' => $SortList->getSortingList('kadaluarsa'), 'jumlah' => $SortList->getSortingList('jumlah')]; //2. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //3. Get data from API $APIPoint = new APIPoint(); $point = $APIPoint->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['point' => $point]; //4. Generate paginator $this->paginate(route('customer.point.index'), $point['data']['count'], $page); //5. Generate breadcrumb $breadcrumb = []; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //6. Generate view $this->page_attributes->source = $this->page_attributes->source . 'index'; return $this->generateView(); }
public function show($id = null) { //initialize $this->page_attributes->subtitle = ucwords(str_replace('_', ' ', $id)); // filters if (Input::has('q')) { $this->page_attributes->search = Input::get('q'); } //sort if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } // data here $APIProduct = new APIProduct(); $product = $APIProduct->getIndex(['search' => ['labelname' => $id, 'name' => Input::get('q')], 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['nama', 'harga', 'stok'], 'nama' => $SortList->getSortingList('nama'), 'harga' => $SortList->getSortingList('harga'), 'stok' => $SortList->getSortingList('stok')]; $this->page_attributes->data = ['id' => $id, 'name' => ucwords(str_replace('_', ' ', $id)), 'product' => $product['data']['data']]; //paginate $this->paginate(route('goods.label.show', ['id' => $id]), $product['data']['count'], $page); //breadcrumb $breadcrumb = [ucwords(str_replace('_', ' ', $id)) => route('goods.label.show', $id)]; //generate View $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); $this->page_attributes->source = $this->page_attributes->source . 'show'; return $this->generateView(); }
/** * { 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 = ['branchname', 'department', 'position', 'currentgrade', 'workstatus', 'currentmaritalstatus', 'workstart', 'workend']; //dummy $this->page_attributes->sorts = ['nama' => $SortList->getSortingList('nama')]; //2. get data parameter $data_parameter = $this->setPageDataParameter(); //3. get data $APIEmployee = new APIEmployee(); $search = array_merge(['nameornik' => $data_parameter['search']], $data_parameter['filter']); $APIEmployee = new APIEmployee(); $APIOrg = new APIOrg(); $organisation = $APIOrg->getShow($org_id); $data = $APIEmployee->getIndex($org_id, ['search' => $search, 'sort' => $data_parameter['sort'], 'take' => $data_parameter['take'], 'skip' => ($data_parameter['page'] - 1) * $data_parameter['take']]); $APIBranch = new APIBranch(); $APIChart = new APIChart(); $branches = $APIBranch->getIndex($org_id, []); $positions = $APIChart->getPositions($org_id, []); $departments = $APIChart->getDepartments($org_id, []); $maritalstatuses = $APIEmployee->getMaritalStatuses($org_id, []); $grades = $APIEmployee->getGrades($org_id, []); //4. set page datas $this->page_datas->datas['employees'] = $data['data']['data']; $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['id'] = $org_id; $this->page_datas->datas['name'] = $organisation['data']['name']; $this->page_datas->datas['code'] = $organisation['data']['code']; //5. generate view $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])]); $view_source = $this->view_source_root . '.index'; $route_source = route(Route::CurrentRouteName()); return $this->generateView($view_source, $route_source); }
/** * Display all admin * * 1. Check filter * 2. Check page * 3. Get data from API * 4. Generate paginator * 5. Generate breadcrumb * 6. Generate view * @param page, q * @return Object View */ public function index() { //1. Check filter $search = []; if (Input::has('q')) { $search = ['name' => Input::get('q')]; $this->page_attributes->search = Input::get('q'); } else { $searchResult = null; } if (Input::has('role')) { $search['role'] = Input::get('role'); } $this->page_attributes->filters = ['titles' => ['role'], 'role' => ['admin', 'staff', 'store manager']]; if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } //2. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //3. Get data from API $APIAdmin = new APIAdmin(); $admin = $APIAdmin->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['admin' => $admin]; $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['nama'], 'nama' => $SortList->getSortingList('nama')]; //4. Generate paginator $this->paginate(route('config.administrative.index'), $admin['data']['count'], $page); //5. Generate breadcrumb $breadcrumb = []; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //6. Generate View $this->page_attributes->source = $this->page_attributes->source . '.index'; return $this->generateView(); }
public function index() { //initialize $filters = null; if (Input::has('q')) { $filters = ['name' => Input::get('q')]; $this->page_attributes->search = Input::get('q'); } else { $searchResult = null; } //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //sort if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } // data here $APIExtension = new APIExtension(); $extension = $APIExtension->getIndex(['search' => ['name' => Input::get('q')], 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['extension' => $extension['data']]; //sorting $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['nama'], 'nama' => $SortList->getSortingList('nama')]; //paginate $this->paginate(route('config.extension.index'), $extension['data']['count'], $page); //breadcrumb $breadcrumb = []; //generate View $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); $this->page_attributes->source = $this->page_attributes->source . 'index'; return $this->generateView(); }
/** * Display all discount * * 1. Check filter * 2. Check page * 3. Get data from API * 4. Generate paginator * 5. Generate breadcrumb * 6. Generate view * @param page, q * @return Object View */ public function index() { //1. Check filter $search = ['discount' => true]; if (Input::has('q')) { $search['name'] = Input::get('q'); $this->page_attributes->search = Input::get('q'); } else { $searchResult = null; } if (Input::has('category')) { $search['categories'] = str_replace(" ", "-", Input::get('category')); } if (Input::has('tag')) { $search['tags'] = str_replace(" ", "-", Input::get('tag')); } if (Input::has('label')) { $search['labelname'] = str_replace(" ", "_", Input::get('label')); } if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } //2. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //3. Get data from API $APIProduct = new APIProduct(); $product = $APIProduct->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $this->page_attributes->data = ['product' => $product]; //4. Generate paginator $this->paginate(route('promote.discount.index'), $product['data']['count'], $page); //5. Generate breadcrumb $breadcrumb = []; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //6. Generate View $filterTitles = ['tag', 'kategori', 'label']; $filterTags = []; $filterCategories = []; $filterLabels = []; $APITag = new APITag(); $tmpTag = $APITag->getIndex()['data']['data']; $key = 0; foreach ($tmpTag as $value) { if ($value['category_id'] != 0) { $filterTags[$key] = ucwords(str_replace("-", " ", $value['slug'])); $key++; } } $APICategory = new APICategory(); $tmpCategory = $APICategory->getIndex()['data']['data']; $key = 0; foreach ($tmpCategory as $value) { if ($value['category_id'] != 0) { $filterCategories[$key] = ucwords(str_replace("-", " ", $value['name'])); $key++; } } $APILabel = new APILabel(); $tmpLabel = $APILabel->getIndex()['data']['data']; $key = 0; foreach ($tmpLabel as $value) { $filterLabels[$key] = ucwords(str_replace("_", " ", $value['label'])); $key++; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['nama', 'harga', 'promo', 'discount'], 'nama' => $SortList->getSortingList('nama'), 'harga' => $SortList->getSortingList('harga'), 'promo' => $SortList->getSortingList('promo'), 'discount' => $SortList->getSortingList('discount')]; $this->page_attributes->filters = ['titles' => $filterTitles, 'tag' => $filterTags, 'kategori' => $filterCategories, 'label' => $filterLabels]; $this->page_attributes->source = $this->page_attributes->source . 'index'; return $this->generateView(); }
/** * Display a customer detail * * 1. Get data from API * 2. Check return status * 3. Generate breadcrumb * 4. Generate view * @param id * @return Object View */ public function show($id) { //1. Get data from API $APICustomer = new APICustomer(); $customer = $APICustomer->getShow($id); // filters if (Input::has('q')) { $search = ['refnumber' => Input::get('q'), 'userid' => $id]; $this->page_attributes->search = Input::get('q'); } else { $search = ['userid' => $id]; $this->page_attributes->search = null; } // sorting if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['tanggal', 'nota', 'tagihan'], 'tanggal' => $SortList->getSortingList('tanggal'), 'nota' => $SortList->getSortingList('nota'), 'tagihan' => $SortList->getSortingList('tagihan')]; //get curent page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } // get data $APISale = new APISale(); $sale = $APISale->getIndex(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $customer['data']['sales'] = $sale['data']['data']; //data paging $this->paginate(route('customer.customer.show', ['id' => $id]), $sale['data']['count'], $page); //2. Check return status if ($customer['status'] != 'success') { $this->errors = $customer['message']; return $this->generateRedirectRoute('customer.customer.index'); } $this->page_attributes->subtitle = $customer['data']['name']; $this->page_attributes->data = ['customer' => $customer]; //3. Generate breadcrumb $breadcrumb = [$customer['data']['name'] => route('customer.customer.show', ['id' => $id])]; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //4. Generate view $this->page_attributes->source = $this->page_attributes->source . 'show'; return $this->generateView(); }
/** * Display all sold varian * * 1. Check filter * 2. Check page * 3. Get data from API * 4. Generate paginator * 5. Generate breadcrumb * 6. Generate view * @param page, q * @return Object View */ public function SoldProduct() { //1. Check filter $search = null; if (Input::has('start') && Input::has('end')) { $tmpstart = Input::get('start') . " 00:00:00"; $tmpend = Input::get('end') . " 23:59:59"; $search['ondate'] = [Carbon::createFromFormat('d-m-Y H:i:s', $tmpstart)->format('Y-m-d H:i:s'), Carbon::createFromFormat('d-m-Y H:i:s', $tmpend)->format('Y-m-d H:i:s')]; } else { $searchResult = null; } if (Input::has('sort')) { $sort_item = explode('-', Input::get('sort')); $sort = [$sort_item[0] => $sort_item[1]]; } else { $sort = ['name' => 'asc']; } //2. Check page if (is_null(Input::get('page'))) { $page = 1; } else { $page = Input::get('page'); } //3. Get data from API $APIReport = new APIReport(); $report = $APIReport->getSoldProduct(['search' => $search, 'sort' => $sort, 'take' => $this->take, 'skip' => ($page - 1) * $this->take]); $SortList = new SortList(); $this->page_attributes->sorts = ['titles' => ['nama'], 'nama' => $SortList->getSortingList('nama')]; $this->page_attributes->data = ['report' => $report]; //4. Generate paginator $this->paginate(route('report.product.sold'), $report['data']['count'], $page); //5. Generate breadcrumb $breadcrumb = ['Laporan Penjualan Barang' => route('report.product.sold')]; $this->page_attributes->breadcrumb = array_merge($this->page_attributes->breadcrumb, $breadcrumb); //6. Generate view $this->page_attributes->source = $this->page_attributes->source . 'product.index'; return $this->generateView(); }