/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Interessado::find(); $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(['idinteressado' => $this->idinteressado, 'bairro_id' => $this->bairro_id, 'datanascimento' => $this->datanascimento, 'crianca' => $this->crianca]); $query->andFilterWhere(['like', 'cpf', $this->cpf])->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'pontodereferencia', $this->pontodereferencia])->andFilterWhere(['like', 'sexo', $this->sexo])->andFilterWhere(['like', 'rg', $this->rg])->andFilterWhere(['like', 'telefone', $this->telefone])->andFilterWhere(['like', 'endereco', $this->endereco]); return $dataProvider; }
<?php use yii\helpers\Html; use yii\widgets\DetailView; /* @var $this yii\web\View */ /* @var $model frontend\models\Triagem */ $this->title = ""; //$model->interessado; $this->params['breadcrumbs'][] = ['label' => 'Triagens', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="triagem-view"> <h1> <?php $interessado = \frontend\models\Interessado::find()->where(['idinteressado' => $model->interessado])->orderBy(['nome' => SORT_ASC])->one(); //echo $interessado->nome; $model->interessado = $interessado->nome; ?> </h1> <p> <?php echo Html::a('Atualizar', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'tipotriagem', 'idinstituicoes', 'interessado', 'date', 'descricao']]); ?>
/** * Finds the Interessado model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Interessado the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Interessado::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getInteressado020() { return $this->hasOne(Interessado::className(), ['idinteressado' => 'interessado02']); }
/** * @return \yii\db\ActiveQuery */ public function getInteressados() { return $this->hasMany(Interessado::className(), ['bairro_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getRequerente0() { return $this->hasOne(Interessado::className(), ['idInteressado' => 'interessado']); }
$form = ActiveForm::begin(); ?> <div class="row"> <div class="col-md-10"> <div class="col-md-5"><?php echo $form->field($model, 'requerente')->dropDownList(ArrayHelper::map(\frontend\models\Interessado::find()->all(), 'cpf', 'nome'), ['prompt' => 'Selecione']); ?> </div> </div> </div> </div > <div class="row"> <div class="col-md-10"> <div class="col-md-5"><?php echo $form->field($model, 'requerente')->dropDownList(ArrayHelper::map(\frontend\models\Interessado::find()->all(), 'cpf', 'nome'), ['prompt' => 'Selecione']); ?> </div> </div> <div class="col-md-10"> <div class="col-md-5"> <?php echo $form->field($model, 'tipoTriagem')->dropDownList(['encaminhamento' => 'Encaminhamento', 'pre_atendimento' => 'Pré-atendimento', 'orientacao' => 'Orientação'], ['prompt' => 'Selecione']); ?> </div> </div> <div class="col-md-5"> <div class="col-md-5"> <?php echo $form->field($model, 'idInstituicoes')->dropDownList($instituicoes, ['prompt' => 'Selecione']); ?>