diff --git a/views/order/index.php b/views/order/index.php index dee3f1d..84b54ba 100755 --- a/views/order/index.php +++ b/views/order/index.php @@ -61,120 +61,120 @@ JS;

-
- field($searchModel, 'label') - ->widget( - Select2::className(), - [ - 'data' => Label::find() - ->joinWith('lang') - ->select( - [ - 'CONCAT(order_label.label,order_label_lang.title) AS name', - 'id', - ] - ) - ->indexBy('id') - ->asArray() - ->column(), - 'options' => [ 'placeholder' => 'Select a state ...' ], - 'pluginOptions' => [ - 'allowClear' => true, - 'multiple' => true, - ], - ] - ); - ?> - field($searchModel, 'delivery') - ->widget( - Select2::className(), - [ - 'data' => Delivery::find() - ->joinWith('lang') - ->select('order_delivery_lang.title, id') - ->indexBy('id') - ->asArray() - ->column(), - 'options' => [ 'placeholder' => 'Select a state ...' ], - 'pluginOptions' => [ - 'allowClear' => true, - 'multiple' => true, - ], - ] - ); - ?> - - field($searchModel, 'sku') - ->widget( - Select2::className(), - [ - 'options' => [ 'placeholder' => 'Search for a product ...' ], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'language' => [ - 'errorLoading' => new JsExpression( - "function () { return 'Waiting for results...'; }" - ), - ], - 'ajax' => [ - 'url' => \yii\helpers\Url::to([ 'find-product' ]), - 'dataType' => 'json', - 'data' => $query, - ], - 'escapeMarkup' => new JsExpression( - 'function (markup) { return markup; }' - ), - 'templateResult' => new JsExpression( - 'function(data) { return data.sku; }' - ), - 'templateSelection' => new JsExpression( - 'function (data) { +
+ field($searchModel, 'label') + ->widget( + Select2::className(), + [ + 'data' => Label::find() + ->joinWith('lang') + ->select( + [ + 'CONCAT(order_label.label,order_label_lang.title) AS name', + 'id', + ] + ) + ->indexBy('id') + ->asArray() + ->column(), + 'options' => [ 'placeholder' => 'Select a state ...' ], + 'pluginOptions' => [ + 'allowClear' => true, + 'multiple' => true, + ], + ] + ); + ?> + field($searchModel, 'delivery') + ->widget( + Select2::className(), + [ + 'data' => Delivery::find() + ->joinWith('lang') + ->select('order_delivery_lang.title, id') + ->indexBy('id') + ->asArray() + ->column(), + 'options' => [ 'placeholder' => 'Select a state ...' ], + 'pluginOptions' => [ + 'allowClear' => true, + 'multiple' => true, + ], + ] + ); + ?> + + field($searchModel, 'sku') + ->widget( + Select2::className(), + [ + 'options' => [ 'placeholder' => 'Search for a product ...' ], + 'pluginOptions' => [ + 'allowClear' => true, + 'minimumInputLength' => 3, + 'language' => [ + 'errorLoading' => new JsExpression( + "function () { return 'Waiting for results...'; }" + ), + ], + 'ajax' => [ + 'url' => \yii\helpers\Url::to([ 'find-product' ]), + 'dataType' => 'json', + 'data' => $query, + ], + 'escapeMarkup' => new JsExpression( + 'function (markup) { return markup; }' + ), + 'templateResult' => new JsExpression( + 'function(data) { return data.sku; }' + ), + 'templateSelection' => new JsExpression( + 'function (data) { if(data.sku == undefined) { return "sku"; } else { return data.sku; } }' - ), - ], - ] - ); - - ?> -
- - -
- field($searchModel, 'manager_id') - ->dropDownList( - ArrayHelper::map( - User::find() - ->asArray() - ->all(), - 'id', - 'username' - ), - [ 'prompt' => \Yii::t('app', 'Выберите менеджера ...') ] - ) ?> - - field($searchModel, 'email') - ->textInput() ?> - -
-
- field($searchModel, 'declaration') - ->textInput() ?> - - field($searchModel, 'consignment') - ->textInput() ?> -
+ ), + ], + ] + ); + + ?> +
+ + +
+ field($searchModel, 'manager_id') + ->dropDownList( + ArrayHelper::map( + User::find() + ->asArray() + ->all(), + 'id', + 'username' + ), + [ 'prompt' => \Yii::t('app', 'Выберите менеджера ...') ] + ) ?> + + field($searchModel, 'email') + ->textInput() ?> + +
+
+ field($searchModel, 'declaration') + ->textInput() ?> + + field($searchModel, 'consignment') + ->textInput() ?> +

@@ -197,7 +197,7 @@ JS; ->textInput(), 'content' => function($model) { $manager = $model->manager; - if (empty( $manager )) { + if (empty($manager)) { return $model->id; } else { return $model->id . '
' . $manager->username; @@ -206,7 +206,9 @@ JS; ], [ 'attribute' => 'created_at', - 'format' => ['date', 'php:d/m/Y G:i'], + '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(), @@ -235,7 +237,16 @@ JS; }, ], 'name', - 'total', + [ + 'attribute' => 'total', + 'content' => function($model) { + if (empty($model->total)) { + return ''; + } else { + return $model->total; + } + }, + ], [ 'attribute' => 'pay', 'content' => function($model) { @@ -250,12 +261,16 @@ JS; [ '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();', - ]); + if (!empty($model->adress)) { + return Html::a( + StringHelper::truncate($model->adress, 10, '...'), + '#', + [ + 'data-toggle' => 'tooltip', + 'title' => $model->adress, + 'onclick' => 'event.preventDefault();', + ] + ); } else { return ''; } @@ -268,7 +283,7 @@ JS; /** * @var Order $modl */ - if (empty( $model->orderLabel )) { + if (empty($model->orderLabel)) { return '--'; } else { return $model->orderLabel->label; @@ -278,7 +293,7 @@ JS; [ 'attribute' => 'body', 'content' => function($model) { - if (!empty( $model->body )) { + if (!empty($model->body)) { return StringHelper::truncate($model->body, 12, '...'); } else { return ''; @@ -288,12 +303,16 @@ JS; [ 'attribute' => 'sms', 'content' => function($model) { - if (!empty( $model->sms )) { - return Html::a(StringHelper::truncate($model->sms, 12, '...'), '#', [ - 'data-toggle' => 'tooltip', - 'title' => $model->sms, - 'onclick' => 'event.preventDefault();', - ]); + if (!empty($model->sms)) { + return Html::a( + StringHelper::truncate($model->sms, 12, '...'), + '#', + [ + 'data-toggle' => 'tooltip', + 'title' => $model->sms, + 'onclick' => 'event.preventDefault();', + ] + ); } else { return ''; } -- libgit2 0.21.4