From df52073b4945a0895ca9c03199462fefa5fb81e0 Mon Sep 17 00:00:00 2001 From: Andrey Klochok Date: Tue, 19 May 2015 13:31:18 +0300 Subject: [PATCH] Fix _search file, select2 -> combo --- views/ticket/_advanced_form.php | 2 +- views/ticket/_search.php | 116 ++++++-------------------------- 2 files changed, 22 insertions(+), 96 deletions(-) diff --git a/views/ticket/_advanced_form.php b/views/ticket/_advanced_form.php index 32c1452..fc342c6 100644 --- a/views/ticket/_advanced_form.php +++ b/views/ticket/_advanced_form.php @@ -51,7 +51,7 @@ scenario == 'insert') : ?> field($model, 'watchers')->widget(ClientCombo::classname(), [ - 'clientType' => 'manager', +// 'clientType' => 'manager', 'pluginOptions' => [ 'select2Options' => [ 'multiple' => true, diff --git a/views/ticket/_search.php b/views/ticket/_search.php index 0f40530..c965186 100644 --- a/views/ticket/_search.php +++ b/views/ticket/_search.php @@ -1,5 +1,7 @@ - field($model, 'state')->dropDownList($state_data, ['prompt' => '']) ?> + field($model, 'state')->widget(StaticCombo::classname(), [ + 'data' => array_merge(['' => ''], $state_data), + ]); ?>
- field($model, 'author_id')->widget(Select2::classname(), [ - 'options' => ['placeholder' => 'Search for a responsible ...'], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'ajax' => [ - 'url' => Url::to(['/client/client/client-all-list']), - 'dataType' => 'json', - 'data' => new JsExpression('function(term,page) { return {search:term}; }'), - 'results' => new JsExpression('function(data,page) { return {results:data.results}; }'), - ], - 'initSelection' => new JsExpression('function (elem, callback) { - var id=$(elem).val(); - $.ajax("' . Url::to(['/client/client/client-all-list']) . '?id=" + id, { - dataType: "json" - }).done(function(data) { - callback(data.results); - }); - }') - ], - ]) ?> - - field($model, 'responsible_id')->widget(Select2::classname(), [ - 'options' => ['placeholder' => 'Search for a responsible ...'], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'ajax' => [ - 'url' => Url::to(['/client/client/can-manage-list']), - 'dataType' => 'json', - 'data' => new JsExpression('function(term,page) { return {search:term}; }'), - 'results' => new JsExpression('function(data,page) { return {results:data.results}; }'), - ], - 'initSelection' => new JsExpression('function (elem, callback) { - var id=$(elem).val(); - $.ajax("' . Url::to(['/client/client/can-manage-list']) . '?id=" + id, { - dataType: "json" - }).done(function(data) { - callback(data.results); - }); - }') - ], - ]) ?> - - field($model, 'topics')->widget(Select2::classname(), [ - 'data' => array_merge(["" => ""], $topic_data), - 'options' => ['placeholder' => 'Select a topic ...', 'multiple' => true], - 'pluginOptions' => [ - 'allowClear' => true, - ], + field($model, 'author_id')->widget(ClientCombo::classname()); ?> + + field($model, 'responsible_id')->widget(ClientCombo::classname(), [ + 'clientType' => 'manager' + ]); ?> + + field($model, 'topics')->widget(StaticCombo::classname(), [ + 'data' => array_merge(['' => ''], $topic_data), ]); ?>
- field($model, 'recipient_id')->widget(Select2::classname(), [ - 'options' => ['placeholder' => 'Search for a responsible ...'], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'ajax' => [ - 'url' => Url::to(['/client/client/client-all-list']), - 'dataType' => 'json', - 'data' => new JsExpression('function(term,page) { return {search:term}; }'), - 'results' => new JsExpression('function(data,page) { return {results:data.results}; }'), - ], - 'initSelection' => new JsExpression('function (elem, callback) { - var id=$(elem).val(); - $.ajax("' . Url::to(['/client/client/client-all-list']) . '?id=" + id, { - dataType: "json" - }).done(function(data) { - callback(data.results); - }); - }') - ], - ]) ?> - field($model, 'priority')->dropDownList(array_merge(['' => ''], $priority_data)) ?> - - field($model, 'watchers')->widget(Select2::classname(), [ - 'options' => ['placeholder' => 'Select watchers ...', 'multiple' => true], - 'pluginOptions' => [ - 'allowClear' => true, - 'minimumInputLength' => 3, - 'multiple' => true, - 'ajax' => [ - 'url' => Url::to(['/client/client/client-all-list']), - 'dataType' => 'json', - 'data' => new JsExpression('function(term,page) { return {search:term}; }'), - 'results' => new JsExpression('function(data,page) { return {results:data.results}; }'), - ], - 'initSelection' => new JsExpression('function (elem, callback) { - var id=$(elem).val(); - $.ajax("' . Url::to(['/client/client/client-all-list']) . '?id=" + id, { - dataType: "json" - }).done(function(data) { - callback(data.results); - }); - }') - ], + field($model, 'recipient_id')->widget(ClientCombo::classname(), [ + 'clientType' => 'client' ]); ?> + + field($model, 'priority')->widget(StaticCombo::classname(), [ + 'data' => array_merge(['' => ''], $priority_data), + ]);?> + + field($model, 'watchers')->widget(ClientCombo::classname()); ?>