title = 'Заказы'; $this->params[ 'breadcrumbs' ][] = $this->title; $js = <<< JS $('[name="OrderSearch[phone]"]').mask('+38(000)000-00-00', { placeholder: '+38(___)___-__-__' }); JS; $this->registerJs($js, View::POS_READY); ?>
= Html::a('Add order', [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
'GET', 'action' => Url::to([ 'order/index' ]), 'id' => 'search-form', ] ); ?>'btn btn-primary', ] ) ?>
$dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function($model) { if ($model->wasted) { return [ 'class' => 'danger' ]; } else { return []; } }, 'columns' => [ [ 'attribute' => 'id', 'filter' => $searchForm->field($searchModel, 'id') ->textInput(), 'content' => function($model) { $manager = $model->manager; if (empty( $manager )) { return $model->id; } else { return $model->id . ' ' . $manager->username; } }, ], [ 'attribute' => 'created_at', 'format' => 'date', 'filter' => $searchForm->field($searchModel, 'date_range') ->widget( DateRangePicker::className(), [ 'convertFormat' => false, 'pluginOptions' => [ 'locale' => [ 'format' => 'D-M-Y', 'separator' => ' to ', ], 'opens' => 'left', ], ] ) ->label(false) ->render(), ], [ 'attribute' => 'deadline', 'content' => function($model) { if ($model->deadline == '') { return ''; } else { return \Yii::$app->formatter->asDate($model->deadline); } }, ], 'name', 'total', [ 'attribute' => 'pay', 'content' => function($model) { if ($model->pay == false) { return ''; } else { return ''; } }, ], 'phone', 'adress', [ 'attribute' => 'label', 'filter' => false, 'value' => function($model) { /** * @var Order $modl */ if (empty( $model->orderLabel )) { return '--'; } else { return $model->orderLabel->label; } }, ], [ 'attribute' => 'body', 'content' => function($model) { if (!empty( $model->body )) { return StringHelper::truncate($model->body, 12, '...'); } else { return ''; } }, ], 'sms', [ 'class' => 'yii\grid\ActionColumn', 'template' => \Yii::$app->user->identity->isAdmin( ) ? '{view} {update} {delete}' : '{view} {update}', 'buttons' => [ 'update' => function($url, $model) { return Html::a( Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-pencil' ]), $url, [ 'target' => '_blank' ] ); }, ], ], ], ] ); ?>