public function index()
 {
     if (!$this->hasPermission($this->menuPermissionName)) {
         return view($this->viewPermissiondeniedName);
     }
     $bookingcustomers = Customer::has('bookingCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
     $bookingcustomerselectlist = array();
     foreach ($bookingcustomers as $item) {
         array_push($bookingcustomerselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
     }
     $carmodels = CarModel::has('carPreemptions')->orderBy('name', 'asc')->get(['id', 'name']);
     $carmodelselectlist = array();
     foreach ($carmodels as $item) {
         array_push($carmodelselectlist, $item->id . ':' . $item->name);
     }
     $carsubmodels = CarSubModel::has('carPreemptions')->orderBy('name', 'asc')->get(['id', 'name']);
     $carsubmodelselectlist = array();
     foreach ($carsubmodels as $item) {
         array_push($carsubmodelselectlist, $item->id . ':' . $item->name);
     }
     $colors = Color::has('carPreemptions')->orderBy('code', 'asc')->get(['id', 'code', 'name']);
     $colorselectlist = array();
     foreach ($colors as $item) {
         array_push($colorselectlist, $item->id . ':' . $item->code . ' - ' . $item->name);
     }
     $buyercustomers = Customer::has('buyerCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
     $buyercustomerselectlist = array();
     foreach ($buyercustomers as $item) {
         array_push($buyercustomerselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
     }
     $salesmanemployees = Employee::has('salesmanCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
     $salesmanemployeeselectlist = array();
     foreach ($salesmanemployees as $item) {
         array_push($salesmanemployeeselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
     }
     $salesmanageremployees = Employee::has('salesmanagerCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
     $salesmanageremployeeselectlist = array();
     foreach ($salesmanageremployees as $item) {
         array_push($salesmanageremployeeselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
     }
     $approversemployees = Employee::has('approversCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
     $approversemployeeselectlist = array();
     foreach ($approversemployees as $item) {
         array_push($approversemployeeselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
     }
     $pricelists = Pricelist::has('carPreemptions')->orderBy('sellingpricewithaccessories', 'asc')->get(['id', 'sellingpricewithaccessories', 'promotion']);
     $priceselectlist = array();
     foreach ($pricelists as $item) {
         //if($item->promotion != null && $item->promotion != '')
         //array_push($priceselectlist,$item->id.':'.$item->sellingpricewithaccessories.' ('.$item->promotion.')');
         //else
         array_push($priceselectlist, $item->id . ':' . $item->sellingpricewithaccessories);
     }
     return view('carpreemption', ['bookingcustomerselectlist' => implode(";", $bookingcustomerselectlist), 'carmodelselectlist' => implode(";", $carmodelselectlist), 'carsubmodelselectlist' => implode(";", $carsubmodelselectlist), 'colorselectlist' => implode(";", $colorselectlist), 'buyercustomerselectlist' => implode(";", $buyercustomerselectlist), 'salesmanemployeeselectlist' => implode(";", $salesmanemployeeselectlist), 'salesmanageremployeeselectlist' => implode(";", $salesmanageremployeeselectlist), 'approversemployeeselectlist' => implode(";", $approversemployeeselectlist), 'priceselectlist' => implode(";", $priceselectlist)]);
 }