예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Typesolicitation::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'desc', $this->desc]);
     return $dataProvider;
 }
예제 #2
0
        </div>
        <div class="col-md-4">
            <?php 
echo $form->field($model, 'location_id')->dropDownList(ArrayHelper::map(Location::find()->where(['is_active' => 1])->orderBy("fullname ASC")->all(), 'id', 'fullname'), ['prompt' => 'Todos']);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-md-4">
            <?php 
echo $form->field($model, 'typeperson_id')->dropDownList(ArrayHelper::map(Typeperson::find()->orderBy("name ASC")->all(), 'id', 'name'), ['prompt' => 'Todos']);
?>
        </div>
        <div class="col-md-4">
            <?php 
echo $form->field($model, 'typesolicitation_id')->dropDownList(ArrayHelper::map(Typesolicitation::find()->orderBy("name ASC")->all(), 'id', 'name'), ['prompt' => 'Todos']);
?>
        </div>
        <div class="col-md-4">
            <?php 
echo $form->field($model, 'status_id')->dropDownList(ArrayHelper::map(Status::find()->orderBy("name ASC")->all(), 'id', 'name'), ['prompt' => 'Todos']);
?>
        </div>        
    </div>

    <?php 
// echo $form->field($model, 'location_id')
?>

    <?php 
// echo $form->field($model, 'status_id')
예제 #3
0
파일: index.php 프로젝트: phprocks/cadastro
    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>
    <hr/>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'tableOptions' => ['class' => 'table table-striped table-hover'], 'emptyText' => '</br><p class="text-danger">Nenhuma solicitação encontrada!</p>', 'summary' => "<p class=\"text-primary \">Você possui {totalCount} solicitações</p>", 'filterModel' => $searchModel, 'rowOptions' => function ($model) {
    if ($model->status_id == 98) {
        return ['class' => 'text-muted'];
    }
}, 'columns' => [['attribute' => 'id', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 6%;text-align:left']], ['attribute' => 'created', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 7%;text-align:center'], 'format' => ['date', 'php:d/m/Y']], ['attribute' => 'location_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) {
    return $model->location->nickname;
}, 'filter' => ArrayHelper::map(Location::find()->orderBy('nickname')->asArray()->all(), 'id', 'nickname'), 'contentOptions' => ['style' => 'width: 7%;text-align:left']], ['attribute' => 'cpf_cnpj', 'enableSorting' => true, 'contentOptions' => ['style' => 'width: 15%;text-align:left']], ['attribute' => 'typeperson_id', 'enableSorting' => true, 'value' => function ($model) {
    return $model->typeperson->name;
}, 'filter' => ArrayHelper::map(Typeperson::find()->orderBy('name')->asArray()->all(), 'id', 'name'), 'contentOptions' => ['style' => 'width: 12%;text-align:left']], ['attribute' => 'typesolicitation_id', 'enableSorting' => true, 'value' => function ($model) {
    return $model->typesolicitation->name;
}, 'filter' => ArrayHelper::map(Typesolicitation::find()->orderBy('name')->asArray()->all(), 'id', 'name'), 'contentOptions' => ['style' => 'width: 15%;text-align:left']], ['attribute' => 'status_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) {
    //return $model->status->name;
    return '<span style="color:' . $model->status->color . '"><i class="fa fa-circle"></i> ' . $model->status->name . '</span>';
}, 'filter' => ArrayHelper::map(Status::find()->orderBy('name')->asArray()->all(), 'id', 'name'), 'contentOptions' => ['style' => 'width: 15%;text-align:left']], ['attribute' => 'analyst_id', 'format' => 'raw', 'enableSorting' => true, 'value' => function ($model) {
    return $model->analyst ? $model->analyst->username : '******';
}, 'contentOptions' => ['style' => 'width: 15%;text-align:left']], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['style' => 'width: 10%;text-align:right'], 'template' => '{view} {update}', 'buttons' => ['view' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-eye-open" ></span>', $url, ['title' => 'Visualizar']);
}, 'update' => function ($url, $model) {
    return $model->status_id < 98 ? Html::a('<span class="glyphicon glyphicon-pencil" ></span>', $url, ['title' => 'Alterar']) : Html::a('<span class="glyphicon glyphicon-ban-circle" ></span>', "#", ['title' => 'Alteração não permitida!']);
}, 'upload' => function ($url, $model) {
    return $model->status_id != 98 ? Html::a('<span class="glyphicon glyphicon-upload" ></span>', $url, ['title' => 'Anexar Arquivo']) : '';
}]]]]);
?>

</div>
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTypesolicitation()
 {
     return $this->hasOne(Typesolicitation::className(), ['id' => 'typesolicitation_id']);
 }
 /**
  * Finds the Typesolicitation model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Typesolicitation the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Typesolicitation::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }