File

src/app/modules/profile/bup/bup.ts

Description

Просмотр БУПа (Базовый учебный план) обучающегося

Implements

OnInit

Metadata

selector profile-bup
styleUrls bup.scss
templateUrl ./bup.html

Index

Properties
Methods

Constructor

constructor(commonService: CommonService, settingsService: SettingsService)

Конструктор

Parameters :
Name Type Description
commonService CommonService
settingsService SettingsService

Methods

getData
getData()

Получение данных

Returns : void
getOptions
getOptions()

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

Returns : void
ngOnInit
ngOnInit()

Получение настроек и данных

Returns : void

Properties

bup
bup: any
Type : any

БУП

header
header: string
Type : string
Default value : Учебный план

Заголовок

loading
loading: boolean
Type : boolean

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

options
options: any
Type : any

Настройки интерфейса

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

/**
 * Просмотр БУПа (Базовый учебный план) обучающегося
 */
@Component({
  selector: 'profile-bup',
  templateUrl: './bup.html',
  styleUrls: ['./bup.scss']
})
export class ProfileBupComponent implements OnInit {
  /**
   * Заголовок
   * @type {string}
   */
  header: string = 'Учебный план';
  /**
   * БУП
   */
  bup: any;
  /**
   * Настройки интерфейса
   */
  options: any;
  /**
   * Индикатор загрузки основных данных
   * @type {boolean}
   */
  loading: boolean;

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

  /**
   * Получение настроек и данных
   */
  ngOnInit() {
    this.getOptions();
    this.getData();
  }

  /**
   * Получение настроек
   */
  getOptions() {
    this.settingsService.getSection('bup')
      .subscribe(
        data => {
          this.options = data.bupOptions;
          this.header = data.bupOptions.header;
        },
        error => {
          console.error(error);
        });
  }

  /**
   * Получение данных
   */
  getData() {
    let loaderTimeout = setTimeout(() => {
      this.loading = true;
    }, 200);

    this.commonService.get('bups')
      .subscribe(
        data => {
          if (typeof data === 'object') {
            this.bup = data;
          } else {
            this.bup = {
              sections: []
            };
          }
        },
        error => {
          console.error(error);
        },
        () => {
          clearTimeout(loaderTimeout);
          this.loading = false;
        });

    setTimeout(() => {
      clearTimeout(loaderTimeout);
      this.loading = false;
    }, 10000);
  }

}
<glx-page-title-bx
  [header]="header"
></glx-page-title-bx>

<div class="bup-wrapper">
  <glx-loading-banner
    [loading]="loading"
    [svg]="true"
    text="Подождите, идет загрузка..."
  ></glx-loading-banner>

  <glx-bup-viewer
    *ngIf="!loading && bup && options"
    [data]="bup"
    [options]="options"
  ></glx-bup-viewer>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""