File

src/app/modules/search/student/student.ts

Description

Компонент для поиска студентов

Implements

OnInit

Metadata

selector search-student
styleUrls student.scss
templateUrl ./student.html

Index

Properties
Methods

Constructor

constructor(profileService: ProfileService, commonService: CommonService)

Конструктор

Parameters :
Name Type Description
profileService ProfileService
commonService CommonService

Methods

ngOnInit
ngOnInit()

Инициализация

Returns : void
onFilter
onFilter(event: )

Получение новых данных при фильтрации

Parameters :
Name Type Description
event
Returns : void
onViewProfile
onViewProfile(event: )

Получени профиля при просмотре профиля

Parameters :
Name Type Description
event
Returns : void
setCatalog
setCatalog()

Получение справочников

Returns : void

Properties

catalog
catalog: any
Type : any

Справочники для фильтров

data
data: any
Type : any

Данные

defaultImage
defaultImage: string
Type : string
Default value : assets/images/default_image.svg

Изображение по-умолчанию

header
header: string
Type : string
Default value : Поиск обучающихся

Заголовок

loading
loading: boolean
Type : boolean
Default value : true

Индикатор загрузки основных данных

profile
profile: any
Type : any

Профиль для слайдера

import { Component, OnInit } from '@angular/core';
import { ProfileService } from 'glx.ui/components/kernel/services/profile.service';
import { CommonService } from 'glx.ui/components/kernel/services/common.service';

/**
 * Компонент для поиска студентов
 */
@Component({
  selector: 'search-student',
  templateUrl: './student.html',
  styleUrls: ['./student.scss']
})

export class SearchStudentComponent implements OnInit {
  /**
   * Заголовок
   * @type {string}
   */
  header: string = 'Поиск обучающихся';
  /**
   * Изображение по-умолчанию
   * @type {string}
   */
  defaultImage: string = 'assets/images/default_image.svg';
  /**
   * Данные
   * @type {{}}
   */
  data: any = {};
  /**
   * Справочники для фильтров
   * @type {{}}
   */
  catalog: any = {};
  /**
   * Профиль для слайдера
   * @type {{}}
   */
  profile: any = {};
  /**
   * Индикатор загрузки основных данных
   * @type {boolean}
   */
  loading: boolean = true;

  /**
   * Конструктор
   * @param {ProfileService} profileService
   * @param {CommonService} commonService
   */
  constructor(private profileService: ProfileService,
              private commonService: CommonService) {
  }

  /**
   * Инициализация
   */
  ngOnInit() {
    this.catalog = {
      departments: [],
      edu_qualifications: [],
      edu_specializations: [],
    };
    this.setCatalog();
  }

  /**
   * Получение справочников
   */
  setCatalog() {
    this.commonService.get('qualifications')
      .subscribe(
        data => {
          this.catalog.edu_qualifications = [];
          this.catalog.edu_qualifications.push({'value': '', 'label': '(любая)'});
          for (let i = 0; i < data.length; i++) {
            this.catalog.edu_qualifications.push(data[i]);
          }
        },
        error => {
          console.error(error);
        });

    this.commonService.get('edudepslist')
      .subscribe(
        data => {
          this.catalog.departments = [];
          this.catalog.departments.push({'value': '', 'label': '(любое)'});
          for (let i = 0; i < data.length; i++) {
            this.catalog.departments.push(data[i]);
          }
        },
        error => {
          console.error(error);
        });

    this.commonService.get('specializations')
      .subscribe(
        data => {
          this.catalog.edu_specializations = [];
          this.catalog.edu_specializations.push({'value': '', 'label': '(любая)'});
          for (let i = 0; i < data.length; i++) {
            this.catalog.edu_specializations.push(data[i]);
          }
        },
        error => {
          console.error(error);
        });
  }

  /**
   * Получение новых данных при фильтрации
   * @param event
   */
  onFilter(event) {
    this.loading = true;
    this.profileService.searchStudents(event)
      .subscribe(
        data => {
          this.data = data;
        },
        error => {
          console.error(error);
        },
        () => {
          this.loading = false;
        });
  }

  /**
   * Получени профиля при просмотре профиля
   * @param event
   */
  onViewProfile(event) {
    this.profile = {};
    this.profileService.get(event)
      .subscribe(
        data => {
          this.profile = data;
        },
        error => {
          console.error(error);
        });
  }
}
<glx-page-title-bx [header]="header"></glx-page-title-bx>
<div class="student-search-wrapper">
  <glx-student-search
    [filterShow]="false"
    [data]="data"
    [catalog]="catalog"
    [profile]="profile"
    (onFilter)="onFilter($event)"
    (onViewProfile)="onViewProfile($event)"
    [defaultImage]="defaultImage"
    [loading]="loading"
    imagePrefix="/bitrix/galaktika/galaktika.vuzapi/public/"
    globalFilterPlaceholder="Поиск по ФИО, подразделению, направлению, группе, квалификации..."
  ></glx-student-search>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""