File

src/app/modules/profile/orders/orders.ts

Description

Просмотр приказов

Implements

OnInit

Metadata

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

Настройки

orders
orders: 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-orders',
  templateUrl: './orders.html',
  styleUrls: ['./orders.scss']
})
export class ProfileOrdersComponent implements OnInit {
  /**
   * Заголовок
   * @type {string}
   */
  header: string = 'Приказы';
  /**
   * Приказы
   */
  orders: 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('orders')
      .subscribe(
        data => {
          this.options = data.orderOptions;
          this.header = data.orderOptions.header;
        },
        error => {
          console.error(error);
        });
  }

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

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

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

results matching ""

    No results matching ""