protected function prepareMailData()
 {
     $product = Tree::find($this->getPreparedItem('id_catalog'));
     $city = City::find($this->getPreparedItem('id_city'));
     if ($city) {
         $region = Region::find($city->id_region);
     }
     //$occupation = Occupation::find($this->getPreparedItem('id_occupation'));
     $this->setMessageSubject('Заявка на услугу: ' . $product->title_ru);
     $this->appendMessageBody("<html><body>");
     $this->appendMessageBody("<p><b>Заявка на услугу:</b> " . $product->title_ru . "</p>");
     $this->appendMessageBody("<p><b>Фамилия:</b> " . $this->getPreparedItem('last_name') . "</p>");
     $this->appendMessageBody("<p><b>Имя:</b> " . $this->getPreparedItem('first_name') . "</p>");
     $this->appendMessageBody("<p><b>Отчество:</b> " . $this->getPreparedItem('patronymic_name') . "</p>");
     //$this->appendMessageBody("<p><b>Занятость:</b> ". $occupation->title_ru ."</p>");
     $this->appendMessageBody("<p><b>Email:</b> " . $this->getPreparedItem('email') . "</p>");
     $this->appendMessageBody("<p><b>Контактный телефон:</b> " . $this->getPreparedItem('phone_number') . "</p>");
     if (isset($region) && $region) {
         $this->appendMessageBody("<p><b>Область:</b> " . $region->title_ru . "</p>");
     }
     $this->appendMessageBody("<p><b>Город:</b> " . $city->title_ru . "</p>");
     $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>");
     if ($this->getPreparedItem('partner_code')) {
         $this->appendMessageBody("<p><b>Код партнера:</b> " . $this->getPreparedItem('partner_code') . "</p>");
     }
     $this->appendMessageBody("<html><body>");
 }
 public function editAction($dealerId = NULL)
 {
     $this->view->setVar("title", "Редагування дилера");
     $user = $this->session->get("user");
     $methodistBrands = \BrandsMethodists::find("user_id=" . $user->id)->toArray();
     $methodistActivities = \ActivitiesMethodists::find("user_id=" . $user->id)->toArray();
     $dealer = $dealerId ? \Dealers::findFirst($dealerId) : new \Dealers();
     if ($dealerId and !$dealer->id) {
         // не найден такой диллер
         $this->view->pick("dealer/not-found");
         return;
     }
     $city = $dealer->City;
     $this->view->regionId = $city ? $city->Region->id : NULL;
     $dealerBrands = $dealer->id ? $dealer->DealersBrands->toArray() : array();
     $dealerActivities = $dealer->id ? \DealersActivities::find("dealer_id=" . $dealer->id)->toArray() : array();
     $this->view->dealers = \Dealers::find(array('order' => 'title'));
     $this->view->regions = \Region::find();
     $this->view->regionFirst = $this->view->regions[0];
     $this->view->cities = \City::find();
     $this->view->staffListGroup = \StafflistGroup::find();
     $this->view->brands = BrandsService::getForChosenEntity(\Brands::find()->toArray(), $methodistBrands, $dealerBrands);
     $this->view->activities = ActivitiesService::getForChosenEntity(\Activities::find()->toArray(), $methodistActivities, $dealerActivities);
     $this->view->dealerStatuses = \DealerStatuses::find();
     $controllers = \Users::query()->rightJoin("UserGroups")->where("UserGroups.group_id = 3")->execute();
     $this->view->controllers = $controllers;
     $this->view->dealerControllers = $dealer->DealersControllers;
     $this->view->dealer = $dealer;
     $this->view->saved = $this->request->get("saved");
 }
Exemplo n.º 3
0
 public function processRegion($patientquery, $visitquery, $value, $title = "")
 {
     if ($value != "all") {
         $title .= " From " . Region::find($value)->region . " Region ";
         $patientquery->whereIn('id', PatientReport::where('region', $value)->get()->lists('patient_id') + array('0'));
         $visitquery->whereIn('id', PatientInfo::where('region', $value)->get()->lists('visit_id') + array('0'));
     }
     return array($patientquery, $visitquery, $title);
 }
 protected function sendSibelForm()
 {
     // fixme:
     $city = City::find($this->getPreparedItem('id_city'));
     if ($city) {
         $region = Region::find($city->id_region);
         $area = Area::find($region->id_area);
     }
     $client = new SibelClient();
     $client->setLastName($this->preparedData['last_name']);
     $client->setFirstName($this->preparedData['first_name']);
     $client->setMiddleName($this->preparedData['patronymic_name']);
     $client->setPhone($this->preparedData['phone_number']);
     $client->setProject($this->getSibelProject());
     $client->setCreatedDate(date('Y-m-d H:i:s'));
     if (isset($area) && $area && $city) {
         $client->setDescription($area->title_ru);
         $client->setComment($city->title_ru);
     }
     $orderCode = $client->registerShortApplication();
     $this->preparedData['sibel_request'] = $client->getXml();
     $this->preparedData['sibel_response'] = $orderCode;
 }
Exemplo n.º 5
0
 public function check_region1($id)
 {
     if ($id == "all") {
         return Form::select('district', array('all' => 'all') + District::lists('district', 'id'), '', array('class' => 'form-control', 'required' => 'requiered'));
     } else {
         return Form::select('district', array('all' => 'all') + Region::find($id)->district()->lists('district', 'id'), '', array('class' => 'form-control', 'required' => 'requiered'));
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $simulation = Simulation::find($id);
     if (Input::has('caption')) {
         $simulation->Caption = Input::get('caption');
     }
     $simulation->save();
     if (Input::has('Combination_Id')) {
         $simulation->Combination_Id = Input::get('Combination_Id');
         $simulation->save();
         $this->rebuild($simulation->Id);
     }
     foreach ($simulation->Parameters as $parameter) {
         if (Input::has('parameters-' . $parameter->Id)) {
             $parameter->pivot->ValueSet = Input::get('parameters-' . $parameter->Id);
             $parameter->pivot->save();
         }
     }
     if (Input::get('new-parameter-name') && Input::get('new-parameter-value') != '') {
         $parameter = Parameter::whereName(Input::get('new-parameter-name'))->first();
         if ($parameter) {
             $simulation->Parameters()->attach($parameter, ["ValueSet" => Input::get('new-parameter-value')]);
             $simulation->save();
         }
     }
     foreach ($simulation->SimulationNeedles as $simulationNeedle) {
         foreach ($simulationNeedle->Parameters as $parameter) {
             if (Input::has('needle-parameters-' . $simulationNeedle->Id . '-' . $parameter->Id)) {
                 $parameter->pivot->ValueSet = Input::get('needle-parameters-' . $simulationNeedle->Id . '-' . $parameter->Id);
                 $parameter->pivot->save();
             }
         }
         $newparameterprefix = 'needle-' . $simulationNeedle->Id . '-new-parameter-';
         if (Input::get($newparameterprefix . 'name') && Input::get($newparameterprefix . 'value') != '') {
             $parameter = Parameter::whereName(Input::get($newparameterprefix . 'name'))->first();
             if ($parameter) {
                 $simulationNeedle->Parameters()->attach($parameter, ["ValueSet" => Input::get($newparameterprefix . 'value')]);
                 $simulationNeedle->save();
             }
         }
     }
     if (Input::get('removing')) {
         if (Input::get('simulation-needle-id')) {
             $simulationNeedle = SimulationNeedle::find(Input::get('simulation-needle-id'));
             $simulationNeedle->delete();
         }
         if (Input::get('region-remove-id')) {
             $region = Region::find(Input::get('region-remove-id'));
             if (Input::get('region-remove-location')) {
                 $simulation->Regions()->newPivotStatementForId($region->Id)->where('Location', '=', Input::get('region-remove-location'))->delete();
             } else {
                 $simulation->Regions()->newPivotStatementForId($region->Id)->whereNull('Location')->delete();
             }
         }
     } else {
         if (Input::get('needle-id')) {
             $needle = Needle::find(Input::get('needle-id'));
             $simulationNeedle = new SimulationNeedle();
             $simulationNeedle->Simulation_Id = $simulation->Id;
             $simulationNeedle->Needle_Id = $needle->Id;
             $target = json_decode(Input::get('needle-target'));
             $simulationNeedle->Target_Id = PointSet::create(['X' => $target[0], 'Y' => $target[1], 'Z' => $target[2]])->Id;
             $entry = json_decode(Input::get('needle-entry'));
             $simulationNeedle->Entry_Id = PointSet::create(['X' => $entry[0], 'Y' => $entry[1], 'Z' => $entry[2]])->Id;
             $simulationNeedle->save();
         }
         if (Input::get('region-id')) {
             $region = Region::find(Input::get('region-id'));
             $simulation->Regions()->attach($region, ['Location' => Input::get('region-location')]);
             $simulation->save();
         }
     }
     return Redirect::route('simulation.edit', $id);
 }