Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CaseStatus::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(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Deletes an existing CaseStatus model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel(CaseStatus::className(), $id)->delete();
     return $this->redirect(['index']);
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStatusCode()
 {
     return $this->hasOne(CaseStatus::className(), ['id' => 'status_code']);
 }
Example #4
0
<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use yii\helpers\ArrayHelper;
use app\enums\States;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\admin\models\search\Record */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Manage Records');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="record-manage">

    <?php 
$columns = [['label' => '#', 'attribute' => 'id', 'headerOptions' => ['style' => 'width: 100px;']], ['attribute' => 'infraction_date', 'format' => 'date', 'headerOptions' => ['style' => 'width: 100px;']], ['attribute' => 'state_id', 'value' => function ($model) {
    return States::labelById($model->state_id);
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => States::listData(), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => 150]], 'filterInputOptions' => ['placeholder' => 'Choose State'], 'format' => 'raw', 'headerOptions' => ['style' => 'width: 160px;']], ['attribute' => 'license', 'headerOptions' => ['style' => 'width: 100px;']], ['attribute' => 'status_id', 'value' => function ($model) {
    return $model->statusName;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(\app\models\CaseStatus::find()->orderBy('name')->asArray()->all(), 'id', 'name'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'width' => 250]], 'filterInputOptions' => ['placeholder' => 'Choose State'], 'format' => 'raw', 'headerOptions' => ['style' => 'width: 260px;']], ['attribute' => 'created_at', 'format' => 'date', 'headerOptions' => ['style' => 'width: 100px;']], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}']];
?>

    <?php 
echo GridView::widget(['id' => 'crud-datatable', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'columns' => $columns, 'toggleDataOptions' => ['all' => ['icon' => 'resize-full', 'class' => 'btn btn-default', 'label' => Yii::t('app', 'All'), 'title' => Yii::t('app', 'Show all data')], 'page' => ['icon' => 'resize-small', 'class' => 'btn btn-default', 'label' => Yii::t('app', 'Page'), 'title' => Yii::t('app', 'Show first page data')]], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', [''], ['data-pjax' => 1, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reload Grid')]) . '{toggleData}' . '{export}']], 'striped' => true, 'condensed' => true, 'responsive' => true, 'panel' => ['type' => 'primary', 'heading' => '<i class="glyphicon glyphicon-list"></i> ' . $this->title, 'before' => '<em>' . Yii::t('app', '* Resize table columns just like a spreadsheet by dragging the column edges.') . '</em>', 'after' => false]]);
?>

</div>
Example #5
0
<?php 
echo $form->field($record, 'open_date')->widget(DatePicker::classname(), ['type' => DatePicker::TYPE_COMPONENT_APPEND, 'options' => ['placeholder' => 'Enter date ...'], 'pluginOptions' => ['orientation' => 'bottom', 'format' => Yii::$app->params['date.view.format'], 'autoclose' => true]]);
?>

<?php 
echo $form->field($record, 'state_id')->dropDownList(app\enums\States::listData());
?>

<?php 
echo $form->field($record, 'license')->textInput(['maxlength' => true]);
?>

<?php 
echo $form->field($record, 'ticket_fee')->textInput();
?>

<?php 
echo $form->field($record, 'ticket_payment_expire_date')->widget(DatePicker::classname(), ['type' => DatePicker::TYPE_COMPONENT_APPEND, 'options' => ['placeholder' => 'Enter date ...'], 'pluginOptions' => ['orientation' => 'bottom', 'format' => Yii::$app->params['date.view.format'], 'autoclose' => true]]);
?>

<?php 
echo $form->field($record, 'comments')->textarea(['rows' => 6]);
?>

<?php 
echo $form->field($record, 'user_plea_request')->textarea(['rows' => 6]);
?>

<?php 
echo $form->field($record, 'status_id')->dropDownList(\app\models\CaseStatus::find()->select(['name', 'id'])->indexBy('id')->column());