Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Transport::find();
     $query->with('chargeCity');
     $query->joinWith('chargeCity');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['transport_id' => $this->transport_id, 'city.name' => $this->charge_city_id, 'discharge_city_id' => $this->discharge_city_id, 'capacity' => $this->capacity, 'size' => $this->size, 'charge_start' => $this->charge_start, 'charge_end' => $this->charge_end, 'city_rate' => $this->city_rate, 'intercity_rate' => $this->intercity_rate, 'passage_rate' => $this->passage_rate, 'term' => $this->term, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'user_id' => $this->user_id]);
     $query->andFilterWhere(['like', 'carcase', $this->carcase])->andFilterWhere(['like', 'carcase_charge', $this->carcase_charge])->andFilterWhere(['like', 'status_charge', $this->status_charge])->andFilterWhere(['like', 'work_preferences', $this->work_preferences])->andFilterWhere(['like', 'info', $this->info]);
     return $dataProvider;
 }
Esempio n. 2
0
?>

    <?php 
echo $form->field($model, 'charge_start')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]);
?>

    <?php 
echo $form->field($model, 'charge_end')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]);
?>
    <br/>
    <h4><?php 
echo Yii::t('app', 'Work');
?>
</h4>
    <?php 
echo $form->field($model, 'work_preferences')->dropDownList(Transport::getPrefer(), ['prompt' => Yii::t('app', 'Select prefer')]);
?>
    <br/>
    <h4><?php 
echo Yii::t('app', 'Payment');
?>
</h4>
    <?php 
echo $form->field($model, 'city_rate')->textInput();
?>

    <?php 
echo $form->field($model, 'intercity_rate')->textInput();
?>

    <?php 
Esempio n. 3
0
?>

    <?php 
echo $form->field($model, 'capacity')->textInput();
?>

    <?php 
echo $form->field($model, 'size')->textInput();
?>
    <br/>
    <h4><?php 
echo Yii::t('app', 'Time');
?>
</h4>
    <?php 
echo $form->field($model, 'status_charge')->dropDownList(Transport::getStatus(), ['prompt' => Yii::t('app', 'Select the carcase')]);
?>

    <?php 
echo $form->field($model, 'charge_start')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]);
?>

    <?php 
echo $form->field($model, 'charge_end')->widget(DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]);
?>
    <br/>
    <h4><?php 
echo Yii::t('app', 'Work');
?>
</h4>
    <?php 
Esempio n. 4
0
</div>

    <div><?php 
echo $form->field($model, 'discharge_city_id')->widget(AutoComplete::className(), ['clientOptions' => ['source' => Url::to(['site/autocomplete']), 'autoFill' => true, 'minLength' => '3', 'select' => new JsExpression("function(event, ui) {\n                                         this.value = ui.item.label;\n                                         \$('#city_input2').val(ui.item.value);\n                                         return false;\n                                }")], 'options' => ['id' => 'discharge_city', 'class' => 'form-control', 'placeholder' => Yii::t('app', 'Start typing the name')]]);
?>
    </div>
    <div><?php 
echo $form->field($model, 'discharge_city_id')->hiddenInput(['id' => 'city_input2'])->label(false);
?>
</div>

    <?php 
echo $form->field($model, 'carcase')->dropDownList(Transport::getCarCase(), ['prompt' => Yii::t('app', 'Select the carcase')]);
?>
    <?php 
echo $form->field($model, 'carcase_charge')->dropDownList(Transport::getCarCaseCharge(), ['prompt' => Yii::t('app', 'Select the carcase'), 'value' => 'ANY']);
?>
    <?php 
echo $form->field($model, 'capacity');
?>
    <?php 
echo $form->field($model, 'size');
?>
    <?php 
echo $form->field($model, 'status_charge');
?>
    <?php 
echo $form->field($model, 'term');
?>
    <?php 
echo $form->field($model, 'city_rate');
Esempio n. 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTransports()
 {
     return $this->hasMany(Transport::className(), ['user_id' => 'user_id']);
 }
Esempio n. 6
0
 /**
  * Finds the Transport model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Transport the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Transport::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 7
0
 public function actionTransport($id, $quantite, $sf)
 {
     $b = 0;
     $bien = new Bien();
     $mod = new Modele();
     for ($i = 1; $i < $quantite + 1; $i++) {
         $transp = new Transport();
         $bien = Bien::find()->where(['codebien' => "" . $sf . "" . ($id + $i)])->one();
         if ($bien && $transp->load(Yii::$app->request->post()) && $mod->load(Yii::$app->request->post())) {
             $modele = $mod->modele;
             $bien->modele = $modele;
             $transp->modele = $modele;
             $transp->codebien = $bien->codebien;
             $transp->typebien = $bien->typebien;
             $transp->designationbien = $bien->designationbien;
             $transp->dateacquisition = $bien->dateacquisition;
             $transp->statutbien = $bien->statutbien;
             $transp->etatbien = $bien->etatbien;
             $transp->prixachat = $bien->prixachat;
             $transp->dureevie = $bien->dureevie;
             $transp->typeamort = $bien->typeamort;
             $transp->tauxamort = $bien->tauxamort;
             $transp->commentaire = $bien->commentaire;
             $transp->poids = $bien->poids;
             $transp->datefingarantie = $bien->datefingarantie;
             $transp->datedebugarantie = $bien->datedebugarantie;
             $transp->save();
             $bien->save();
             $b = 1;
         } else {
             return $this->render('_formTransport', ['transp' => $transp, 'bien' => $bien, 'mod' => $mod]);
         }
     }
     if ($b == 1) {
         return $this->redirect(['try']);
     } else {
         Yii::$app->getSession()->setFlash('danger', 'L enregistrement n a pas été fait !');
         return $this->render('_formTransport', ['transp' => $transp, 'bien' => $bien, 'mod' => $mod]);
     }
 }