<commit_before><?php

/*
 * Client module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-client
 * @package   hipanel-module-client
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
 */

namespace hipanel\modules\client\widgets\combo;

use hipanel\helpers\ArrayHelper;
use hiqdev\combo\Combo;
use yii\web\JsExpression;

/**
 * Class Client.
 */
class ContactCombo extends Combo
{
    /** {@inheritdoc} */
    public $type = 'client/contact';

    /** {@inheritdoc} */
    public $name = 'name';

    /** {@inheritdoc} */
    public $url = '/client/contact/search';

    /** {@inheritdoc} */
    public $_return = ['id', 'name', 'email'];

    /** {@inheritdoc} */
    public function getPluginOptions($options = [])
    {
        return parent::getPluginOptions([
            'select2Options' => [
                'formatResult' => new JsExpression("function (data) {
                    return data.name + '<br><span class=\"text-muted\">' + data.email + '</span>';
                }"),
            ],
        ]);
    }

    /** {@inheritdoc} */
    public function getFilter()
    {
        return ArrayHelper::merge(parent::getFilter(), [
            'select'  => ['format' => 'min'],
        ]);
    }
}<commit_msg>+ client_id filtering in ContactCombo<commit_after><?php

/*
 * Client module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-client
 * @package   hipanel-module-client
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
 */

namespace hipanel\modules\client\widgets\combo;

use hipanel\helpers\ArrayHelper;
use hiqdev\combo\Combo;
use yii\web\JsExpression;

/**
 * Class ContactCombo.
 */
class ContactCombo extends Combo
{
    /** {@inheritdoc} */
    public $type = 'client/contact';

    /** {@inheritdoc} */
    public $name = 'name';

    /** {@inheritdoc} */
    public $url = '/client/contact/search';

    /** {@inheritdoc} */
    public $_return = ['id', 'name', 'email'];

    /** {@inheritdoc} */
    public function getPluginOptions($options = [])
    {
        return parent::getPluginOptions([
            'select2Options' => [
                'formatResult' => new JsExpression("function (data) {
                    return data.name + '<br><span class=\"text-muted\">' + data.email + '</span>';
                }"),
            ],
        ]);
    }

    /**
     * @var string|integer client ID
     */
    public $client_id;

    /** {@inheritdoc} */
    public function getFilter()
    {
        return ArrayHelper::merge(parent::getFilter(), [
            'select'    => ['format' => 'min'],
            'client_id' => ['format' => $this->client_id],
        ]);
    }
}
{'fraction_non_alphanumeric': 0.17846715328467153, 'fraction_numerical': 0.0072992700729927005, 'mean_word_length': 2.2984356197352587, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3292204', 'n_tokens_mistral': 860, 'n_tokens_neox': 846, 'n_words': 163}