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(\Yii::t('app', 'Добавить заказ'), [ 'create' ], [ 'class' => 'btn btn-success btn-lg' ]) ?>
'GET', 'action' => Url::to([ 'order/index' ]), 'id' => 'search-form', ] ); ?> 'collapse', // 'data-target' => '#search-fields', // 'class' => 'btn btn-default' //]); //?>
true,
'dataProvider' => $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 Html::a($model->id, ['update', 'id' => $model->id], ['target' => '_blank', 'data-pjax' => '0']);
} else {
return Html::a($model->id, ['update', 'id' => $model->id], ['target' => '_blank', 'data-pjax' => '0']) . '
' . $manager->username;
}
},
],
[
'attribute' => 'created_at',
'content' => function($model) {
return date('d/m/Y', $model->created_at) . '
' . date('G:i', $model->created_at);
},
'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,
'php:d M'
) . '
' . \Yii::$app->formatter->asDate($model->deadline, 'php:Y г');
}
},
],
'name',
[
'attribute' => 'total',
'content' => function($model) {
if (empty($model->total)) {
return '';
} else {
return $model->total;
}
},
],
[
'attribute' => 'pay',
'content' => function($model) {
if ($model->pay == false) {
return '';
} else {
return '';
}
},
],
[
'attribute' => 'phone',
'content' => function($model) {
return $model->phone . '
' . $model->phone2;
}
],
[
'attribute' => 'adress',
'content' => function($model) {
if (!empty($model->adress)) {
return Html::a(
StringHelper::truncate($model->adress, 10, '...'),
'#',
[
'data-toggle' => 'tooltip',
'title' => $model->adress,
'onclick' => 'event.preventDefault();',
]
);
} else {
return '';
}
},
],
[
'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, 10, '...');
} else {
return '';
}
},
],
[
'attribute' => 'sms',
'content' => function($model) {
if (!empty($model->sms)) {
return Html::a(
StringHelper::truncate($model->sms, 10, '...'),
'#',
[
'data-toggle' => 'tooltip',
'title' => $model->sms,
'onclick' => 'event.preventDefault();',
]
);
} else {
return '';
}
},
],
[
'class' => 'yii\grid\ActionColumn',
'template' => \Yii::$app->user->identity->isAdmin(
) ? '{history} {view} {update} {delete}' : '{view} {update}',
'buttons' => [
'update' => function($url, $model) {
return Html::a(
Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-pencil' ]),
$url,
[
'target' => '_blank',
'data-pjax' => '0',
]
);
},
'history' => function($url, $model) {
return Html::a(
Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-time' ]),
['log', 'id' => $model->id],
[
'target' => '_blank',
'data-pjax' => '0',
]
);
},
],
],
],
]
);
?>