Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  * @param array $params
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AdminEmployees::find()->select(['id' => 'employees.id', 'fio' => 'employees.snp', 'cell_number' => 'cell_numbers.cell_number', 'email' => 'emails.email_address', 'job_title' => 'employees.job_title'])->from('employees')->leftJoin('cell_numbers', 'cell_numbers.employee_id = employees.id AND cell_numbers.status = 1')->leftJoin('emails', 'emails.employee_id = employees.id AND emails.status = 1');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'LOWER(snp)', mb_strtolower($this->fio)])->andFilterWhere(['like', 'emails.email_address', $this->email])->andFilterWhere(['like', 'cell_numbers.cell_number', $this->cell_number]);
     return $dataProvider;
 }
Exemplo n.º 2
0
?>

<div class="employees-search">

    <?php 
$form = ActiveForm::begin(['layout' => 'horizontal', 'action' => ['site/admin_workplace?tab=2'], 'method' => 'get']);
?>

    <?php 
echo $form->field($model, 'fio', ['horizontalCssClasses' => ['wrapper' => 'col-xs-9']])->widget(AutoComplete::className(), ['clientOptions' => ['source' => AdminEmployees::arrayFios()], 'options' => ['class' => 'form-control']]);
?>
    <?php 
echo $form->field($model, 'cell_number', ['horizontalCssClasses' => ['wrapper' => 'col-xs-9']])->widget(AutoComplete::className(), ['clientOptions' => ['source' => AdminEmployees::arrayCells()], 'options' => ['class' => 'form-control']]);
?>
    <?php 
echo $form->field($model, 'email', ['horizontalCssClasses' => ['wrapper' => 'col-xs-9']])->widget(AutoComplete::className(), ['clientOptions' => ['source' => AdminEmployees::arrayEmails()], 'options' => ['class' => 'form-control']]);
?>

    <div style="float: right">
        <?php 
echo Html::submitButton('Поиск', ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Сбрсить', ['site/admin_workplace', 'tab' => 2], ['class' => 'btn btn-default']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Exemplo n.º 3
0
    <?php 
} elseif ($tab == 2) {
    ?>
        <div id = "find-employee" class="col-xs-12 col-md-7 col-md-pull-5">
            <?php 
    //var_dump($employeeProvider->models[0]);
    if ($employeeProvider->models) {
        $model = $employeeProvider->models[0];
    } else {
        echo '<h3> По вашему запросу нет данных...</h3>';
        echo '</div></div></div>';
        return;
    }
    echo '<h3>' . $model['fio'] . '</h3>';
    echo 'Мобильный: ' . Yii::$app->formatter->asPhone($model['cell_number']) . '<br>' . 'Email: ' . $model['email'] . '<br>' . 'Должность: ' . $model->job_title . '<br>';
    $wpProvider = AdminEmployees::workplacesProvider($model->id);
    $old_branch = '';
    $old_device = '';
    $table = false;
    foreach ($wpProvider->models as $wpModel) {
        $branch = $wpModel['branch_title'] . ' ' . $wpModel['id'];
        if ($branch != $old_branch) {
            if ($table) {
                echo '</table>';
                $table = false;
            }
            echo '<h3><a href="admin_workplace?tab=1&AdminWorkplacesSearch[id]=' . $wpModel['id'] . '">' . $branch . ($wpModel['status'] == 1 ? ' (основное)' : '') . '</a></h3>';
            echo 'Помещение: ' . $wpModel['room_title'] . '<br>';
            echo 'Описание: ' . $wpModel['workplaces_title'] . '<br>';
            echo 'Вн.номер: ' . $wpModel['voip_number'] . '<br>';
            $old_branch = $branch;