File

src/app/modules/profile/trajectory/trajectory.ts

Description

Просмотр индивидуальной траектории обучения обучающихся

Implements

OnInit

Metadata

selector profile-trajectory
styleUrls trajectory.scss
templateUrl ./trajectory.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

allowSelection
allowSelection: boolean
Type : boolean
Default value : false

Разрешить выбор дисциплин.

header
header: string
Type : string
Default value : Индивидуальная траектория обучения

Заголовок

loading
loading: boolean
Type : boolean

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

options
options: any
Type : any

Настройки

trajectory
trajectory: 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-trajectory',
  templateUrl: './trajectory.html',
  styleUrls: ['./trajectory.scss']
})
export class ProfileTrajectoryComponent implements OnInit {
  /**
   * Заголовок
   * @type {string}
   */
  header: string = 'Индивидуальная траектория обучения';
  /**
   * Разрешить выбор дисциплин.
   */
  allowSelection: boolean = false;
  /**
   * Траекория обучения
   */
  trajectory: 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('trajectory')
      .subscribe(
        data => {
          this.options = data.trajectoryOptions;
          this.header = data.trajectoryOptions.header;
        },
        error => {
          console.error(error);
        });
  }

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

    this.commonService.get('trajectories')
      .subscribe(
        data => {
          if (typeof data === 'object') {
            this.trajectory = data;
          } else {
            this.trajectory = {
              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="trajectory-wrapper">
  <glx-loading-banner
    [loading]="loading"
    [svg]="true"
    text="Подождите, идет загрузка..."
  ></glx-loading-banner>

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

results matching ""

    No results matching ""