Esempio n. 1
0
 public function signup2()
 {
     if ($this->validate()) {
         $user = new user();
         $user->username = $this->email;
         $user->email = $this->email;
         $user->firstname = $this->fname;
         $user->lastname = $this->lname;
         $user->phone = $this->phone;
         $user->setPassword($this->email);
         $user->generateAuthKey();
         $transaction = \Yii::$app->db->beginTransaction();
         if ($flag = $user->save(false)) {
             $email = "*****@*****.**";
             \Yii::$app->mailer->compose(['html' => 'auth-html'], ['user' => $this])->setFrom([\Yii::$app->params['supportEmail'] => 'New Quote request'])->setTo($email)->setSubject('New Quote request')->send();
             $date = Yii::$app->formatter->asDatetime(date('Y-d-m h:i:s'));
             $car = new Car();
             //$model_name=$this->$model_name;
             $row = Ncars::find()->where('model=:model AND model_name=:model_name AND fuel=:fuel AND variant=:variant AND color=:color', array(':model' => $this->brand, ':model_name' => $this->model_name, 'fuel' => $this->fuel, 'variant' => $this->variant, 'color' => $this->color))->one();
             $user = User::find()->where('email=:email', array(':email' => $this->email))->one();
             $urequest = new Userrequest();
             $urequest->car_id = $row->id;
             $urequest->user_id = $user->id;
             $urequest->color = $this->color;
             $urequest->city = "Chennai";
             $urequest->other = $this->other;
             $urequest->delivery = "not mentioned";
             $urequest->status = 0;
             $urequest->time = $date;
             if ($flag = $urequest->save(false)) {
                 $transaction->commit();
                 return $user;
             }
         } else {
             $transaction->rollback();
             return null;
         }
     }
 }
Esempio n. 2
0
 public function actionFindcarscolor($var, $mod, $brand, $fuel)
 {
     $rows = Ncars::find()->where('model=:model AND model_name=:model_name AND fuel=:fuel AND variant=:var', array(':model' => $brand, ':model_name' => $mod, 'fuel' => $fuel, 'var' => $var))->distinct(true)->all();
     echo "<option value>--- Select Color ---</option>";
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             echo "<option value='{$row->color}'>{$row->color}</option>";
         }
     } else {
         echo "<option>No Fuel Type</option>";
     }
 }
Esempio n. 3
0
                         y=$("select#signupform-model_name").val();
                         y1=$("select#signupform-brand").val();
                         
                         
                          
                             $.get( "' . Url::toRoute('/site/findcarsvar') . '", { model: $(this).val(),mod:' . "y" . ' ,mo:' . "y1" . ' } )
                                 .done(function( data ) {
                                     $("select#' . Html::getInputId($signup, 'variant') . '").html( data );
                                 }
                             );
                         '])->label('Fuel*');
?>
             
             <?php 
//$estado3= ArrayHelper::map(Car::find()->where('model=:model AND model_name=:model_name AND fuel=:fuel', array (':model' => $signup->brand,':model_name'=>$signup->model_name,'fuel'=> $signup->fuel))->all(), 'variant', 'variant');
$estado3 = ArrayHelper::map(Ncars::find()->where('modebrand = :mode', [':mode' => $car])->all(), 'variant', 'variant');
echo $form->field($signup, 'variant')->dropDownList($estado3, ['prompt' => '--- Select Variant ---', 'onchange' => '
                         	
                         	y=$("select#signupform-model_name").val();
                         	y1=$("select#signupform-brand").val();
                         	y2=$("select#signupform-fuel").val();
                         	
                         	
                         	 
                         	    $.get( "' . Url::toRoute('/site/findcarscolor') . '", { var: $(this).val(),mod:' . "y" . ' ,brand:' . "y1" . ',fuel:' . "y2" . ' } )
                         	        .done(function( data ) {
                         	            $("select#' . Html::getInputId($signup, 'color') . '").html( data );
                         	        }
                         	    );
                         	'])->label('Variant*');
?>