<commit_before><?php

namespace hipanel\modules\client\widgets;

use Yii;
use yii\base\Widget;
use yii\helpers\Url;

class ClientSwitcher extends Widget
{
    public $model;

    public function run()
    {
        if (Yii::$app->user->can('support')) {
            $this->initClientScript();

            return $this->render('ClientSwitcher', ['model' => $this->model]);
        }

        return null;
    }

    protected function initClientScript()
    {
        $url = Url::to(['@client/view', 'id' => '']);
        $this->view->registerJs("
            $('#client-client_id').on('select2:select', function (e) {
                var selectedClientId = this.value;
                location.replace('{$url}' + selectedClientId);
            });
        ");
    }
}<commit_msg>Fixed ClientSwitcher widget, add history<commit_after><?php

namespace hipanel\modules\client\widgets;

use Yii;
use yii\base\Widget;
use yii\helpers\Url;

class ClientSwitcher extends Widget
{
    public $model;

    public function run()
    {
        if (Yii::$app->user->can('support')) {
            $this->initClientScript();

            return $this->render('ClientSwitcher', ['model' => $this->model]);
        }

        return null;
    }

    protected function initClientScript()
    {
        $url = Url::to(['@client/view', 'id' => '']);
        $this->view->registerJs("
            $('#client-client_id').on('select2:select', function (e) {
                var selectedClientId = this.value;
                window.location.href = '{$url}' + selectedClientId;
            });
        ");
    }
}
{'fraction_non_alphanumeric': 0.16394472361809045, 'fraction_numerical': 0.001256281407035176, 'mean_word_length': 2.264344262295082, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, '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': '5300582', 'n_tokens_mistral': 477, 'n_tokens_neox': 478, 'n_words': 89}