protected function prepareMailData()
 {
     $product = Tree::find($this->getPreparedItem('id_catalog'));
     $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>");
     $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>");
     $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>");
     $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>");
     if ($this->getPreparedItem('monthly_income')) {
         $this->appendMessageBody("<p><b>Ежемесячный доход:</b> " . $this->getPreparedItem('monthly_income') . "</p>");
     }
     if ($this->getPreparedItem('credit_amount')) {
         $this->appendMessageBody("<p><b>Сумма кредита:</b> " . $this->getPreparedItem('credit_amount') . "</p>");
     }
     if ($this->getPreparedItem('term')) {
         $this->appendMessageBody("<p><b>Срок кредита:</b> " . $this->getPreparedItem('term') . "</p>");
     }
     if ($this->getPreparedItem('is_insurance_loss_job')) {
         $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>");
     }
     if ($this->getPreparedItem('is_insurance_accident')) {
         $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>");
     }
     $this->appendMessageBody("<html><body>");
 }
 protected function prepareMailData()
 {
     $product = Tree::find($this->getPreparedItem('id_catalog'));
     $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>");
     $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>");
     $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>");
     $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>");
     if ($this->getPreparedItem('id_city')) {
         $city = City::find($this->getPreparedItem('id_city'));
         if (isset($city->title_ru)) {
             $this->appendMessageBody("<p><b>Город:</b> " . $city->title_ru . "</p>");
         }
     }
     if ($this->getPreparedItem('id_shop')) {
         $shop = Shop::find($this->getPreparedItem('id_shop'));
         if (isset($shop->title_ru)) {
             $this->appendMessageBody("<p><b>Магазин:</b> " . $shop->title_ru . "</p>");
         }
     }
     if ($this->getPreparedItem('id_product_type')) {
         $productType = Product::find($this->getPreparedItem('id_product_type'));
         if (isset($productType->title_ru)) {
             $this->appendMessageBody("<p><b>Тип товара:</b> " . $productType->title_ru . "</p>");
         }
     }
     if ($this->getPreparedItem('product_price')) {
         $this->appendMessageBody("<p><b>Стоимость товара:</b> " . $this->getPreparedItem('product_price') . "</p>");
     }
     if ($this->getPreparedItem('term')) {
         $this->appendMessageBody("<p><b>Срок кредита:</b> " . $this->getPreparedItem('term') . "</p>");
     }
     if ($this->getPreparedItem('is_insurance_loss_job')) {
         $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>");
     }
     if ($this->getPreparedItem('is_insurance_accident')) {
         $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>");
     }
     $this->appendMessageBody("<html><body>");
 }
 protected function prepareMailData()
 {
     $product = Tree::find($this->getPreparedItem('id_catalog'));
     $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>");
     $this->appendMessageBody("<p><b>Паспорт:</b> " . $this->getPreparedItem('passport') . "</p>");
     $this->appendMessageBody("<p><b>ИНН:</b> " . $this->getPreparedItem('inn') . "</p>");
     $this->appendMessageBody("<p><b>Клиент банка:</b> " . ($this->getPreparedItem('is_bank_client') ? 'Да' : 'Нет') . "</p>");
     if ($this->getPreparedItem('monthly_fee')) {
         $this->appendMessageBody("<p><b>Ежемесячная плата:</b> " . $this->getPreparedItem('monthly_fee') . "</p>");
     }
     if ($this->getPreparedItem('left_to_repay_money')) {
         $this->appendMessageBody("<p><b>Осталось погашать:</b> " . $this->getPreparedItem('left_to_repay_money') . "</p>");
     }
     if ($this->getPreparedItem('credit_type')) {
         if ($this->getPreparedItem('credit_type') == 'simple') {
             $type = 'Кредит';
         } else {
             $type = 'Кредит на карте';
         }
         $this->appendMessageBody("<p><b>Тип кредита:</b> " . $type . "</p>");
     }
     if ($this->getPreparedItem('is_insurance_loss_job')) {
         $this->appendMessageBody("<p><b>Страховка от временной потери работы:</b> Да</p>");
     }
     if ($this->getPreparedItem('is_insurance_accident')) {
         $this->appendMessageBody("<p><b>Страховка от несчастного случая:</b> Да</p>");
     }
     $this->appendMessageBody("<html><body>");
 }
예제 #4
0
            }
        }
        $app->render('occupations/new.html', $data);
    })->via('GET', 'POST')->name('occupations_new');
    $app->map('/edit/:id', function ($id) use($app, $data) {
        $data['request_method'] = $app->request->getMethod();
        if ($app->request->isGet()) {
            $data['occupation'] = Occupation::with('talent', 'educationLevel')->find($id);
            $data['education_levels'] = EducationLevel::NoSchoolAdvice()->get();
            $data['talents'] = Talent::all();
        } else {
            if ($app->request->isPost()) {
                $edu_level = EducationLevel::find($app->request->post('educationlevel'));
                $talent = Talent::find($app->request->post('talent'));
                parse_str(parse_url($app->request->post('yt-video'), PHP_URL_QUERY), $urlvars);
                $job = Occupation::find($id);
                $job->name = $app->request->post('title');
                $job->description = $app->request->post('description');
                $job->youtube = $urlvars['v'];
                $job->educationLevel()->associate($edu_level);
                $job->talent()->associate($talent);
                $job->save();
                $data['new_occupation'] = $job;
            }
        }
        $app->render('occupations/edit.html', $data);
    })->via('GET', 'POST')->name('occupations_edit');
});
$app->group('/skills', function () use($app, $data) {
    $data['request_method'] = $app->request->getMethod();
    $app->get('/', function () use($app, $data) {