File

src/app/modules/profile/stipend/stipend.ts

Description

Просмотр стипендий

Implements

OnInit

Metadata

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

header
header: string
Type : string
Default value : Стипендии

Заголовок

loading
loading: boolean
Type : boolean

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

options
options: any
Type : any

Настройки

stipends
stipends: 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-stipend',
  templateUrl: './stipend.html',
  styleUrls: ['./stipend.scss']
})
export class ProfileStipendComponent implements OnInit {
  /**
   * Заголовок
   * @type {string}
   */
  header: string = 'Стипендии';
  /**
   * Стипендии
   */
  stipends: 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('stipend')
      .subscribe(
        data => {
          this.options = data.stipendOptions;
          this.header = data.stipendOptions.header;
        },
        error => {
          console.error(error);
        });
  }

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

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

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

results matching ""

    No results matching ""