コード例 #1
0
 public function edit($idPart)
 {
     $part = $this->partRepo->find($idPart);
     $part = $this->partRepo->getInputs($part);
     $this->helper->validateRecord($part);
     $vehicle_id = VehicleRepositoryEloquent::getVehicles(true);
     $vendor_id = ContactRepositoryEloquent::getContacts('vendor', true);
     $part_type_id = TypeRepositoryEloquent::getTypes('part');
     $part_model_id = ModelRepositoryEloquent::getModels('part', array_keys($part_type_id->toArray())[0]);
     $part_id = self::getParts($idPart, true);
     $typedialog = TypeRepositoryEloquent::getDialogStoreOptions('part');
     $modeldialog = ModelRepositoryEloquent::getDialogStoreOptions('part');
     $modeldialog['model_type_id'] = $part->part_type_id;
     $attributes = [];
     if (config('app.attributes_api_url') != null) {
         $attributes = AttributeRepositoryEloquent::getAttributesWithValues('part.' . $part->partType->name, $idPart);
     }
     $sensor_data = $filters = null;
     if ($part->partType->name == Lang::get('setup.sensor')) {
         $filters = $this->helper->getFilters($this->request->all(), $this->tireSensorRepo->getFields(), $this->request);
         $filters['id'] = $part->id;
         $filters['sort'] = 'created_at';
         $filters['order'] = 'desc';
         $sensor_data = $this->tireSensorRepo->results($filters);
     }
     return view("part.edit", compact('part', 'vehicle_id', 'vendor_id', 'part_type_id', 'part_model_id', 'part_id', 'sensor_data', 'filters', 'attributes', 'modeldialog', 'typedialog'));
 }
コード例 #2
0
 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'));
 }
コード例 #3
0
 public function getModelsByType($entityKey = null, $idType = null)
 {
     echo ModelRepositoryEloquent::getModels($entityKey, $idType);
 }