public function edit($idType)
 {
     $type = $this->typeRepo->find($idType);
     $this->helper->validateRecord($type);
     $company_id = CompanyRepositoryEloquent::getCompanies();
     return view("type.edit", compact('type', 'company_id'));
 }
 public function edit($idModel)
 {
     $model = $this->modelRepo->find($idModel);
     $this->helper->validateRecord($model);
     $company_id = CompanyRepositoryEloquent::getCompanies();
     $model_type_id = TypeRepositoryEloquent::getTypes();
     $vendor_id = ContactRepositoryEloquent::getContacts();
     return view("model.edit", compact('model', 'model_type_id', 'company_id', 'vendor_id'));
 }
 public function edit($idContact)
 {
     $contact = $this->contactRepo->find($idContact);
     $this->helper->validateRecord($contact);
     $company_id = CompanyRepositoryEloquent::getCompanies();
     $contact_type_id = TypeRepositoryEloquent::getTypes('contact');
     $typedialog = TypeRepositoryEloquent::getDialogStoreOptions('contact');
     $driver_profile = $this->contactRepo->getDriverProfile($idContact);
     $attributes = [];
     if (config('app.attributes_api_url') != null) {
         $attributes = AttributeRepositoryEloquent::getAttributesWithValues('contact.' . $contact->type->name, $idContact);
     }
     return view("contact.edit", compact('contact', 'contact_type_id', 'typedialog', 'company_id', 'driver_profile', 'attributes'));
 }
 public function edit($idUser)
 {
     $user = $this->userRepo->find($idUser);
     $this->helper->validateRecord($user);
     $role = $user->getRoles()[0];
     $user->role_id = Role::where('slug', $role)->first()->id;
     $contact = $this->contactRepo->find($user['contact_id']);
     $this->helper->validateRecord($contact);
     $role = $this->helper->getAvailableRoles();
     $language = $user->getAvailableLanguages();
     $companies = CompanyRepositoryEloquent::getCompanies();
     $contacts = ContactRepositoryEloquent::getContacts();
     return view("user.edit", compact('user', 'contact', 'role', 'language', 'companies', 'contacts'));
 }
 public function edit($idTrip)
 {
     $trip = $this->tripRepo->find($idTrip);
     $trip = $this->tripRepo->getInputs($trip);
     $this->helper->validateRecord($trip);
     $company_id = CompanyRepositoryEloquent::getCompanies();
     $vehicle_id = VehicleRepositoryEloquent::getVehicles();
     $driver_id = ContactRepositoryEloquent::getContacts('driver');
     $vendor_id = ContactRepositoryEloquent::getContacts('vendor', true);
     $trip_type_id = TypeRepositoryEloquent::getTypes('trip');
     $fuel_type = TypeRepositoryEloquent::getTypes('fuel');
     $typedialog = TypeRepositoryEloquent::getDialogStoreOptions('trip');
     $attributes = [];
     if (config('app.attributes_api_url') != null) {
         $attributes = AttributeRepositoryEloquent::getAttributesWithValues('trip.' . $trip->type->name, $idTrip);
     }
     return view("trip.edit", compact('trip', 'driver_id', 'vendor_id', 'company_id', 'vehicle_id', 'trip_type_id', 'fuel_type', 'attributes', 'typedialog'));
 }
 public function edit($idEntry)
 {
     $entry = $this->entryRepo->find($idEntry);
     $entry = $this->entryRepo->getInputs($entry);
     $this->helper->validateRecord($entry);
     $company_id = CompanyRepositoryEloquent::getCompanies();
     $entry_type_id = TypeRepositoryEloquent::getTypes('entry');
     $vendor_id = ContactRepositoryEloquent::getContacts('vendor', true);
     $vehicle_id = VehicleRepositoryEloquent::getVehicles();
     $parts = PartRepositoryEloquent::getPartsByVehicle($entry->vehicle_id);
     $entry_parts = [];
     $typedialog = TypeRepositoryEloquent::getDialogStoreOptions('entry');
     foreach ($entry->partsEntries->toArray() as $entryPart) {
         $entry_parts[] = $entryPart['part_id'];
     }
     $attributes = [];
     if (config('app.attributes_api_url') != null) {
         $attributes = AttributeRepositoryEloquent::getAttributesWithValues('entry.' . $entry->type->name, $idEntry);
     }
     return view("entry.edit", compact('entry', 'entry_type_id', 'company_id', 'vehicle_id', 'vendor_id', 'parts', 'entry_parts', 'attributes', 'typedialog'));
 }
 public function edit($idVehicle)
 {
     $vehicle = $this->vehicleRepo->find($idVehicle);
     $this->helper->validateRecord($vehicle);
     $company_id = CompanyRepositoryEloquent::getCompanies();
     $model_vehicle_id = ModelRepositoryEloquent::getModels('vehicle');
     $vehicleLastPlace = $this->vehicleRepo->getVehiclesLastPlace($idVehicle);
     $vehicleLastPlace = !empty($vehicleLastPlace[0]) ? $vehicleLastPlace[0] : null;
     $fields = ['id', 'vehicle', 'part-type', 'cost'];
     $filters = $this->helper->getFilters($this->request->all(), $fields, $this->request);
     $filters['vehicle_id'] = $vehicle->id;
     $parts = $this->partRepo->results($filters);
     $modeldialog = ModelRepositoryEloquent::getDialogStoreOptions('vehicle');
     $tires = $this->partRepo->getTires();
     $tiresVehicle = $this->partRepo->getTiresVehicle($idVehicle);
     $tiresPositions = $this->partRepo->getTiresPositions($tiresVehicle, $idVehicle);
     $part_type_id = $this->partRepo->getTiresTypeId();
     $tiresModels = [];
     if (!empty($part_type_id)) {
         $tiresModels = ModelRepositoryEloquent::getModels('part', $part_type_id);
     }
     if (!empty($vehicle->geofence)) {
         $vehicle->geofence = json_decode($vehicle->geofence, true);
     }
     $attributes = [];
     if (config('app.attributes_api_url') != null) {
         $attributes = AttributeRepositoryEloquent::getAttributesWithValues('vehicle.' . $vehicle->model->type->name, $idVehicle);
     }
     if (empty($vehicle->model->map)) {
         $vehicle->model->map = str_pad("", 24, "0", STR_PAD_RIGHT);
     } else {
         $vehicle->model->map = substr($vehicle->model->map, 0, 24);
         $vehicle->model->map = str_pad($vehicle->model->map, 24, "0", STR_PAD_RIGHT);
     }
     return view("vehicle.edit", compact('vehicle', 'model_vehicle_id', 'company_id', 'part_type_id', 'vehicleLastPlace', 'parts', 'tires', 'tiresPositions', 'tiresModels', 'attributes', 'filters', 'modeldialog'));
 }