diff --git a/backend/views/cart/index.php b/backend/views/cart/index.php index a70caf8..9d2ef9a 100644 --- a/backend/views/cart/index.php +++ b/backend/views/cart/index.php @@ -10,6 +10,7 @@ use kartik\date\DatePicker; $this->title = Yii::t('app', 'Заказы'); $this->params['breadcrumbs'][] = $this->title; + ?>
@@ -25,6 +26,13 @@ $this->params['breadcrumbs'][] = $this->title; 'id', 'account_id', + ['label' =>'Информация', + 'value' =>function ($data) { + $info = $data->scode . ' /n'; + $info .= $data->name; + return $info; + }, + ], 'sum', [ 'label' =>'Статус', @@ -34,17 +42,18 @@ $this->params['breadcrumbs'][] = $this->title; 'manager_name', [ 'label' =>'Дата', + 'value' =>function ($data) { + return date('Y-m-d', $data->dt); + }, 'attribute' => 'dt', 'filter' => DatePicker::widget([ - 'name' => 'data1', - // 'value' => '01-Feb-2015', + 'model' =>$searchModel, + 'language' =>'ru', + 'size' =>'xs', + 'separator' =>'по', + 'attribute' => 'dt', 'type' => DatePicker::TYPE_RANGE, - 'name2' => 'data2', - // 'value2' => '27-Feb-2015', - 'pluginOptions' => [ - 'autoclose'=>true, - 'format' => 'dd-M-yyyy' - ] + 'attribute2' => 'date_to', ]), ], diff --git a/common/models/CartBillsSearch.php b/common/models/CartBillsSearch.php index 94bf8c1..dbe355f 100644 --- a/common/models/CartBillsSearch.php +++ b/common/models/CartBillsSearch.php @@ -13,7 +13,7 @@ use common\models\CartBillsView; */ class CartBillsSearch extends CartBillsView { - +public $date_to; /** * @inheritdoc */ @@ -21,7 +21,7 @@ class CartBillsSearch extends CartBillsView { return [ [['id', 'account_id', 'status'], 'integer'], - [['data1,data2'], 'safe'], + [['dt', 'date_to'], 'string', 'max' => 10], ]; } @@ -50,8 +50,7 @@ class CartBillsSearch extends CartBillsView ]); $this->load($params); - //$timestamp= mktime($hours,$minutes,$seconds,$month,$day,$year); - CustomVarDamp::dumpAndDie(date_timestamp_get($params['data1'])); + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); @@ -61,10 +60,20 @@ class CartBillsSearch extends CartBillsView $query->andFilterWhere([ 'id' => $this->id, 'account_id' => $this->account_id, - 'timestamp' => $this->dt, 'status_id' => $this->status, ]); + if($this->dt !== null || $this->date_to !== null){ + $date_from = mktime(0,0,0,(int)substr($this->dt,4,2),(int)substr($this->dt,1,2),(int)substr($this->dt,7,4)); + $date_to = mktime(23,59,59,(int)substr($this->date_to,4,2),(int)substr($this->date_to,1,2),(int)substr($this->date_to,7,4)); + + $query->andFilterWhere([ + 'between', 'dt', $date_from, $date_to + ]); + } + + + // $query->andFilterWhere(['like', 'f1', $this->f1]) // ->andFilterWhere(['like', 'f2', $this->f2]) // ->andFilterWhere(['like', 'f3', $this->f3]) @@ -73,4 +82,9 @@ class CartBillsSearch extends CartBillsView return $dataProvider; } + + public static function findById($id){ + + return CartBillsView::find()->where(['id' => $id])->one(); + } } diff --git a/composer.lock b/composer.lock index 53ed4be..3fcbc33 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2d5c03f681f1c72d09f36e10af144465", + "hash": "ce73f971f407fe869277da60d0444492", "content-hash": "4c8b69eb2733ca32596e438952d2f182", "packages": [ { -- libgit2 0.21.4