Skip to content

Commit

Permalink
Fix _search file, select2 -> combo
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed May 19, 2015
1 parent f41eb95 commit df52073
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 96 deletions.
2 changes: 1 addition & 1 deletion views/ticket/_advanced_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<?php if ($model->scenario == 'insert') : ?>
<?= $form->field($model, 'watchers')->widget(ClientCombo::classname(), [
'clientType' => 'manager',
// 'clientType' => 'manager',
'pluginOptions' => [
'select2Options' => [
'multiple' => true,
Expand Down
116 changes: 21 additions & 95 deletions views/ticket/_search.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use hipanel\modules\client\widgets\combo\ClientCombo;
use hipanel\widgets\combo\StaticCombo;
use kartik\widgets\Select2;
use kartik\widgets\DatePicker;
use yii\web\JsExpression;
Expand Down Expand Up @@ -53,109 +55,33 @@
]
]); ?>
</div>
<?php echo $form->field($model, 'state')->dropDownList($state_data, ['prompt' => '']) ?>
<?= $form->field($model, 'state')->widget(StaticCombo::classname(), [
'data' => array_merge(['' => ''], $state_data),
]); ?>
</div>

<div class="col-md-4">
<?php echo $form->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);
});
}')
],
]) ?>

<?php echo $form->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);
});
}')
],
]) ?>

<?= $form->field($model, 'topics')->widget(Select2::classname(), [
'data' => array_merge(["" => ""], $topic_data),
'options' => ['placeholder' => 'Select a topic ...', 'multiple' => true],
'pluginOptions' => [
'allowClear' => true,
],
<?= $form->field($model, 'author_id')->widget(ClientCombo::classname()); ?>

<?= $form->field($model, 'responsible_id')->widget(ClientCombo::classname(), [
'clientType' => 'manager'
]); ?>

<?= $form->field($model, 'topics')->widget(StaticCombo::classname(), [
'data' => array_merge(['' => ''], $topic_data),
]); ?>
</div>

<div class="col-md-4">
<?php echo $form->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);
});
}')
],
]) ?>
<?php echo $form->field($model, 'priority')->dropDownList(array_merge(['' => ''], $priority_data)) ?>

<?php echo $form->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);
});
}')
],
<?= $form->field($model, 'recipient_id')->widget(ClientCombo::classname(), [
'clientType' => 'client'
]); ?>

<?= $form->field($model, 'priority')->widget(StaticCombo::classname(), [
'data' => array_merge(['' => ''], $priority_data),
]);?>

<?php echo $form->field($model, 'watchers')->widget(ClientCombo::classname()); ?>
</div>


Expand Down

0 comments on commit df52073

Please sign in to comment.