/**
  * 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();
 }