Exemple #1
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup1()
 {
     if ($this->validate()) {
         $user = new user();
         $user->username = $this->email;
         $user->email = $this->email;
         $user->firstname = $this->fname;
         $user->lastname = $this->lname;
         $user->setPassword($this->password);
         $user->generateAuthKey();
         if ($user->save()) {
             \Yii::$app->mailer->compose(['html' => 'auth-html'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Authenticate your account ' . \Yii::$app->name)->send();
             $date = Yii::$app->formatter->asDatetime(date('Y-d-m h:i:s'));
             $car = new Car();
             //$model_name=$this->$model_name;
             $row = Car::find()->where('model=:model AND model_name=:model_name AND fuel=:fuel AND variant=:variant', array(':model' => $this->brand, ':model_name' => $this->model_name, 'fuel' => $this->fuel, 'variant' => $this->variant))->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 = $this->city;
             $urequest->other = $this->other;
             $urequest->delivery = $this->delivery;
             $urequest->status = 0;
             $urequest->time = $date;
             if ($urequest->save()) {
                 return $user;
             }
         } else {
             return null;
         }
     }
 }
Exemple #2
0
 public function actionQuote($quote)
 {
     $model = new ReplyForm();
     $access = [new Accessform()];
     $color = [new Colorform()];
     $mod = "";
     $pieces = explode("-", $quote);
     $var = User::find()->where(['dealerid' => $pieces[0]])->one();
     $var1 = Userrequest::find()->where(['user_id' => $var->id])->one();
     $cars = Car::find()->where(['id' => $var1->car_id])->one();
     if ($model->load(Yii::$app->request->post())) {
         $access = Model::createMultiple(Accessform::classname());
         Model::loadMultiple($access, Yii::$app->request->post());
         foreach ($access as $acc) {
             $mod = $mod . $acc->access . ":" . $acc->price . "#";
         }
         $email = "*****@*****.**";
         \Yii::$app->mailer->compose(['html' => 'dealer-html'], ['reply' => $model, 'access' => $mod, 'quote' => $quote, 'var' => $var, 'var1' => $var1, 'cars' => $cars])->setFrom([\Yii::$app->params['supportEmail'] => 'New Quote from Dealer'])->setTo($email)->setSubject('New Quote from Dealer')->send();
         return $this->render('thankd', ['reply' => $model, 'access' => $mod, 'quote' => $quote, 'var' => $var, 'var1' => $var1, 'cars' => $cars]);
     }
     return $this->render('quote', ['model' => $model, 'quote' => $quote, 'var' => $var, 'var1' => $var1, 'cars' => $cars, 'Maccess' => empty($modelsAccessform) ? [new Accessform()] : $modelsAccessform, 'Colors' => empty($modelsColorform) ? [new Colorform()] : $modelsColorform]);
 }
Exemple #3
0
$blank = ["In 1 Week" => "In 1 Week"];
?>


<div class="customer-form" style="margin-top: 5%;">

    <?php 
$form = ActiveForm::begin(['id' => 'dynamic-form']);
?>
    <div class="row">
        <div class="col-md-6">
            <?php 
echo $form->field($modelDealership, 'dealership_name')->textInput(['maxlength' => true]);
?>
            <?php 
$estado = ArrayHelper::map(Car::find()->all(), 'model', 'model');
echo $form->field($modelDealership, 'brand')->dropDownList($estado)->label('Brand*');
?>
            <?php 
echo $form->field($modelDealership, 'mcode')->textInput(['maxlength' => true])->label("Manufacturer Dealer Code (For Authentication with Manufacturer):*");
?>
            
                      
                    </div>
            
                </div>
                
                
            <div class="row">
                <div class="col-md-6">
            
Exemple #4
0
 /**
  * Finds the Car model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Car the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Car::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #5
0
<th>Variant</th>
<th>Color</th>
<th>Delivery</th>
<th>On-Road Price</th>
<th>Quote	Specification</th>

</tr>




<?php 
if (count($rows) > 0) {
    foreach ($rows as $row) {
        echo "<tr>";
        $car = Car::find()->where('id=:id', array('id' => $row->car_id))->one();
        $reqs = Carrequest::find()->where('request_id=:id', array('id' => $row->id))->all();
        if (count($reqs) > 0) {
            foreach ($reqs as $req) {
                if ($req->status == 1) {
                    $reply = Reply::find()->where('request_id=:id', array('id' => $req->id))->one();
                    echo "<td>" . $row->id . "</td>";
                    echo "<td>" . $req->dealer_id . "</td>";
                    echo "<td>" . $car->model . "</td>";
                    echo "<td>" . $car->model_name . "</td>";
                    echo "<td>" . $car->fuel . "</td>";
                    echo "<td>" . $car->variant . "</td>";
                    echo "<td>" . $row->color . "</td>";
                    echo "<td>" . $row->delivery . "</td>";
                    if (count($reply) > 0) {
                        echo "<td><b>" . $reply->price . "</b></td>";
Exemple #6
0
echo $form->field($signup, 'fuel')->dropDownList($estado4, ['onchange' => '
                    
                    
                     y1 =test;
                     y2 =test1;
                     
                        $.get( "' . Url::toRoute('/site/findcarsvar') . '", { model: $(this).val(),mod:' . "y1" . ' ,mo:' . "y2" . ' } )
                            .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');
echo $form->field($signup, 'variant')->dropDownList($estado3, ['prompt' => '--- Select Variant ---'])->label('Variant*');
?>
            
            <?php 
echo $form->field($signup, 'color')->dropDownlist($color, ['prompt' => '---- Select Color ----', 'selector' => 'lable'])->label('Color*');
?>
            <?php 
echo $form->field($signup, 'city')->dropDownlist($city, ['prompt' => '---- Select City ----', 'selector' => 'lable'])->label('City*');
?>
             <?php 
echo $form->field($signup, 'delivery')->dropDownlist($delivery, ['prompt' => '---- In Week(s) ----', 'selector' => 'lable'])->label('Delivery*');
?>
             
             <?php 
echo $form->field($signup, 'otherr', ['inputOptions' => ['placeholder' => "Ex: I am looking for chrome door handles and seat covers as accessories."]])->textarea(['rows' => '6'])->label('Message');
Exemple #7
0
$estado1 = ArrayHelper::map(Car::find()->where('model = :model_name', [':model_name' => $model->brand])->all(), 'model_name', 'model_name');
echo $form->field($model, 'model_name')->dropDownList($blank, ['test=$(this).val();', 'onchange' => '
                                          $.get( "' . Url::toRoute('/site/findcarsfuel') . '", { model: $(this).val() } )
                                              .done(function( data ) {
                                                  $("select#' . Html::getInputId($model, 'fuel') . '").html( data );
                                              }
                                              
                                          );
                                          
                                          test=$(this).val();
                                      '])->label('Model*');
?>
                          
                          <?php 
$estado4 = ArrayHelper::map(Car::find()->where('model = :model_name', [':model_name' => $model->brand])->all(), 'fuel', 'fuel');
$estado2 = ArrayHelper::map(Car::find()->where('fuel = :fuel', [':fuel' => $model->fuel])->all(), 'fuel', 'fuel');
echo $form->field($model, 'fuel')->dropDownList($blank, ['onchange' => '
                                      y=$("select#requestform-model_name").val();
                                      y1=$("select#requestform-brand").val();
                                      
                                      
                                       
                                          $.get( "' . Url::toRoute('/site/findcarsvar') . '", { model: $(this).val(),mod:' . "y" . ' ,mo:' . "y1" . ' } )
                                              .done(function( data ) {
                                                  $("select#' . Html::getInputId($model, 'variant') . '").html( data );
                                              }
                                          );
                                      '])->label('Fuel*');
?>