From 1ec8d36cefcf7f53b2fa9e00a3cfed902007994f Mon Sep 17 00:00:00 2001 From: captainbeer Date: Wed, 28 Feb 2018 20:14:32 +0200 Subject: [PATCH] -Searching applied --- backend/config/main.php | 3 +++ backend/controllers/CallController.php | 18 ++++++++++++++++++ composer.json | 4 +++- composer.lock | 37 ++++++++++++++++++++++++++++++++++++- frontend/assets/AppAsset.php | 43 +++++++++++++++++++++---------------------- frontend/assets/VueAsset.php | 20 ++++++++++++++++++++ frontend/views/site/index.php | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------ 7 files changed, 162 insertions(+), 48 deletions(-) create mode 100644 frontend/assets/VueAsset.php diff --git a/backend/config/main.php b/backend/config/main.php index 641bb13..d6663eb 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -52,6 +52,9 @@ 'rules' => [ [ 'class' => 'yii\rest\UrlRule', 'controller' => 'call', + 'extraPatterns' => [ + 'GET search' => 'search', + ] ], ], ], diff --git a/backend/controllers/CallController.php b/backend/controllers/CallController.php index 959a7e5..0e4cd23 100755 --- a/backend/controllers/CallController.php +++ b/backend/controllers/CallController.php @@ -2,9 +2,27 @@ namespace backend\controllers; + use common\models\Call; + use yii\data\ActiveDataProvider; use yii\rest\ActiveController; class CallController extends ActiveController { public $modelClass = 'common\models\Call'; + + public function actionSearch($word) + { + return new ActiveDataProvider( + [ + 'query' => Call::find() + ->filterWhere( + [ + 'ilike', + 'company', + trim($word), + ] + ), + ] + ); + } } \ No newline at end of file diff --git a/composer.json b/composer.json index a5b6c2f..8f47ca6 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,9 @@ "yiisoft/yii2": "~2.0.6", "yiisoft/yii2-bootstrap": "~2.0.0", "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", - "bower-asset/materialize": "^0.100.2" + "bower-asset/materialize": "^0.100.2", + "bower-asset/vue": "^2.5", + "bower-asset/axios": "^0.18.0" }, "require-dev": { "yiisoft/yii2-debug": "~2.0.0", diff --git a/composer.lock b/composer.lock index e5a34ec..eed415f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ec09898700dcf10b1fe4b54e61ad8ad4", + "content-hash": "b506c80ac36bec49cac93f43643b27ac", "packages": [ { + "name": "bower-asset/axios", + "version": "v0.18.0", + "source": { + "type": "git", + "url": "https://github.com/axios/axios.git", + "reference": "d59c70fdfd35106130e9f783d0dbdcddd145b58f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/axios/axios/zipball/d59c70fdfd35106130e9f783d0dbdcddd145b58f", + "reference": "d59c70fdfd35106130e9f783d0dbdcddd145b58f", + "shasum": null + }, + "type": "bower-asset", + "license": [ + "MIT" + ] + }, + { "name": "bower-asset/bootstrap", "version": "v3.3.7", "source": { @@ -105,6 +124,22 @@ "type": "bower-asset" }, { + "name": "bower-asset/vue", + "version": "v2.5.13", + "source": { + "type": "git", + "url": "https://github.com/vuejs/vue.git", + "reference": "d982e344b39391fe91b6dd91d51b2f0310a45e77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vuejs/vue/zipball/d982e344b39391fe91b6dd91d51b2f0310a45e77", + "reference": "d982e344b39391fe91b6dd91d51b2f0310a45e77", + "shasum": null + }, + "type": "bower-asset" + }, + { "name": "bower-asset/yii2-pjax", "version": "2.0.7.1", "source": { diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index c247898..44ceed9 100644 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -1,23 +1,22 @@ View::POS_BEGIN, + ]; + } \ No newline at end of file diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index aeab9f0..c33a833 100644 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -15,30 +15,67 @@
-
- - - - - - - - - - - - - - - - - -
CompanyStatusDuration
company ?>status ?>duration ?>
+
+
+ + + + + + + + + + + + + + + + + +
IDCompanyStatusDuration
{{call.id}}{{call.company}}{{call.status}}{{call.duration}}
+
+
+ + + +
+ +
+
+
-
+ + \ No newline at end of file -- libgit2 0.21.4