public function getAddEdit($id_document = 0)
 {
     $id_document = (int) $id_document;
     $Document = Document::findOrNew($id_document);
     $defaultUser = UserInfo::where('is_default', 1)->where('type_user_info', UserInfo::SELLER)->first();
     $countries = Country::lists('title_ru', 'country_id');
     $countries = ['0' => 'Not Defined'] + $countries;
     return View::make('backend.document.parts.add', compact('countries', 'Document', 'defaultUser'));
 }
 /**
  * Update the specified outlet in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $retailer = Retailer::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Retailer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $retailer->update($data);
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', $retailer->country_id)->lists('city', 'id');
     $addresses = Address::where('city_id', $retailer->city_id)->lists('address', 'id');
     $cats = BusinessCategory::lists('name', 'id');
     return Redirect::to('admin/retailers/' . $retailer->id . '/edit')->with('success', 'Update retailer');
 }
Example #3
0
 /**
  * Show the form for editing the specified outlet.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($outlet)
 {
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
     $retailers = Retailer::owner()->lists('name', 'id');
     $addresses = Address::select(array('addresses.id', 'addresses.address'))->lists('address', 'id');
     $images = Picture::getByRefId($outlet->id, 'outlet');
     if ($outlet->status == 'active') {
         $title = Lang::get('site/outlets/title.outlet_update');
     } else {
         $title = Lang::get('site/outlets/title.create_a_new_outlet');
     }
     return View::make('site.outlets.edit', compact('countries', 'cities', 'outlet', 'title', 'retailers', 'addresses'))->nest('imageForm', 'site.partials.image.create', ['refId' => $outlet->id, 'type' => 'outlet', 'images' => $images]);
 }
Example #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     // BEGIN ALL DATA NEEDED BY EDIT FORM
     //BEGIN VEHICLE DATA
     $vehicle = Vehicle::find($id);
     $vehicles_vin = $vehicle->vehicles_vin;
     $vehicles_year = $vehicle->model->model_year;
     $vehicles_make_id = $vehicle->model->model_make_id;
     $model_name = $vehicle->model->model_name;
     $model_trim = $vehicle->model->model_trim;
     $vehicles_name_trim = $model_name . ", " . $model_trim;
     $vehicles_body = $vehicle->model->model_body;
     $vehicles_weight_kg = $vehicle->vehicles_weight_kg;
     $vehicles_status = $vehicle->vehicles_status;
     $vehicles_color = $vehicle->vehicles_color;
     $vehicles_odometer = $vehicle->vehicles_odometer;
     $vehicles_use_type = $vehicle->vehicles_use_type;
     $vehicles_class = $vehicle->vehicles_class;
     $vehicles_use_type_table_name = $vehicle->vehicleUseType->vehicle_use_types_table_name;
     // BEGIN VEHICLES GENERIC LIST
     $vehicles_class_col_name = $vehicles_use_type_table_name . '_class';
     $vehicles_class_name = DB::table($vehicles_use_type_table_name)->find($vehicles_class)->{$vehicles_class_col_name};
     $vehicles_class_ar = ['-1' => 'Select Class'] + DB::table($vehicles_use_type_table_name)->lists($vehicles_use_type_table_name . '_class', 'id');
     // IF VEHICLE USE TYPE IS COMMERCIAL PASSENGERS
     if ($vehicles_use_type == 2) {
         $noOfPas = ['-1' => 'Select No. Of Passengers'] + DB::table($vehicles_use_type_table_name)->lists('fees_commercial_passengers_no_of_passenger', 'id');
     } else {
         $noOfPas = "";
     }
     $model_make_ar = ['-1' => 'Select Make'] + Model::where('model_year', $vehicles_year)->distinct()->orderBy('model_make_id')->lists('model_make_id', 'model_make_id');
     $model_make_ar['add_new'] = "Add New";
     $vehicles_name_trim_arr = Model::where('model_year', $vehicles_year)->where('model_make_id', $vehicles_make_id)->get(['model_name', 'model_trim'])->toArray();
     foreach ($vehicles_name_trim_arr as $vehicles_name_trim_arr_fet) {
         $name_trim = implode(', ', $vehicles_name_trim_arr_fet);
         $vehicles_name_trim_ar[$name_trim] = $name_trim;
     }
     $vehicles_name_trim_ar = array_unique($vehicles_name_trim_ar);
     asort($vehicles_name_trim_ar);
     $vehicles_name_trim_ar = ['-1' => 'Select Model'] + $vehicles_name_trim_ar;
     $vehicles_body_ar = ['-1' => 'Select Body Style'] + array_filter(array_unique(Model::where('model_year', $vehicles_year)->where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->lists('model_body', 'model_body')));
     $model_weight_kg_ar = ['-1' => "Select Gross Weight"] + array_filter(array_unique(Model::where('model_make_id', $vehicles_make_id)->where('model_name', $model_name)->where('model_trim', $model_trim)->where('model_year', $vehicles_year)->where('model_body', $vehicles_body)->lists('model_weight_kg', 'model_weight_kg')));
     // END VEHICLES GENERIC LIST
     // END VEHICLE DATA
     // BEGIN OWNERS
     $owners = $vehicle->owners;
     $owners_index_range = range(1, $owners->count());
     //$old_owners_index = implode(',', $owners_index_range);
     $old_owners_index = implode(',', $owners->lists('id'));
     // END OWNERS
     //BEGIN AUTHORIZED
     $authorized = $vehicle->authorizedDrivers;
     if ($authorized->count() > 0) {
         $old_authorized_index = implode(',', $authorized->lists('id'));
     } else {
         $old_authorized_index = "";
     }
     // END AUTHORIZED
     // REGISTRATION
     $registration = $vehicle->registration;
     // NEED TO SEND THIS SEPERATELY AS BECAUSE IS NEEDED IN JQUERY
     $registrations_no = $registration->registrations_no;
     // DOCUMENTS
     $documents = $vehicle->documents;
     if ($documents->count() > 0) {
         $documents_index_range = $documents->lists('id');
         $documents_index = implode(',', $documents_index_range);
     } else {
         $documents_index = "";
     }
     // INSURANCE
     $insurance = $vehicle->insurance;
     //LIEN
     $lien = $vehicle->lien;
     // GENERIC DATA
     $modelYears = ['-1' => 'Select Vehicle Year'] + Model::distinct()->orderBy('model_year', 'desc')->lists('model_year', 'model_year');
     $vehicleStatus = VehicleStatus::lists('vehicle_status_name', 'id');
     $colorList = ['-1' => 'Select Color'] + Color::lists('colors_name', 'id');
     $vehicleUseType = ['-1' => 'Select Vehicle Use Type'] + VehicleUseType::lists('vehicle_use_types_name', 'id');
     $country = ['-1' => 'Select Country'] + Country::lists('country_name', 'id');
     $drivingStatusName = DrivingStatus::lists('driving_status_name', 'id');
     // END ALL DATA NEEDED BY REGISTRATION FORM
     //MAKING AN ARRAY OF DATA THAT IS NEEDED IN FORM
     $data = compact('vehicle', 'vehicles_vin', 'vehicles_year', 'vehicles_make_id', 'vehicles_name_trim', 'vehicles_body', 'vehicles_weight_kg', 'vehicles_status', 'vehicles_color', 'vehicles_odometer', 'vehicles_use_type', 'vehicles_class', 'vehicles_class_name', 'vehicles_class_ar', 'noOfPas', 'model_make_ar', 'vehicles_name_trim_ar', 'vehicles_body_ar', 'model_weight_kg_ar', 'modelYears', 'modelMake', 'vehicleUseType', 'vehicleStatus', 'colorList', 'drivingStatusName', 'country', 'owners', 'old_owners_index', 'old_authorized_index', 'authorized', 'authorized_index', 'registration', 'registrations_no', 'insurance', 'lien', 'documents', 'documents_index');
     return View::make('vehicle.edit', $data);
 }
Example #5
0
 /**
  * Show the form for editing the specified country.
  *
  * @param  int  $id
  * @return Response
  */
 public function editAddress($id)
 {
     $address = Address::find($id);
     if (!empty($address)) {
         $countries = array('' => '') + Country::lists('country', 'id');
         $cities = array('' => '') + City::lists('city', 'id');
         // Title
         $title = Lang::get('site/addresses/title.address_update');
         // mode
         $mode = 'edit';
         return View::make('site/addresses/create_edit', compact('title', 'mode', 'countries', 'cities', 'address'));
     } else {
         return Redirect::to('site/addresses')->with('error', Lang::get('site/addresses/messages.does_not_exist'));
     }
 }
Example #6
0
 /**
  * Get edit user's profile
  * @param $username
  * @return mixed
  */
 public function getEdit($username)
 {
     $userModel = new User();
     $user = $userModel->getUserByUsername($username);
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
     // Check if the user exists
     if (is_null($user)) {
         return App::abort(404);
     }
     $images = Picture::getByRefId($user->id, 'user');
     return View::make('site/user/edit', compact('user', 'countries', 'cities'))->nest('imageForm', 'site.partials.image.create', ['refId' => $user->id, 'type' => 'user', 'images' => $images]);
 }
 /**
  * Show the form for creating a new resource.
  * GET /debtors/create
  *
  * @return Response
  */
 public function create()
 {
     //
     return View::make('debtors.create')->with('countries', Country::lists('name', 'id'))->with('legals', Legal::lists('name', 'id'))->with('debtor_group', DebtorsGroup::lists('name', 'id'));
 }
Example #8
0
 public static function getKeyValueData()
 {
     return array(null => 'All') + Country::lists('country', 'id');
 }