File

src/app/modules/dashboard/home/home.ts

Description

Компонент рабочего стола

Выводит разделы личного кабинета в удобном виде.

Implements

OnInit

Metadata

selector dashboard-home
styleUrls home.scss
templateUrl ./home.html

Index

Properties
Methods

Constructor

constructor(profileService: ProfileService)

Конструктор

Parameters :
Name Type Description
profileService ProfileService

Methods

ngOnInit
ngOnInit()

Получаем профиль текущего пользователя. Узнаем его Роль и формируем items.

Returns : void

Properties

header
header: string
Type : string
Default value : Рабочий стол

Заголовок

items
items: any
Type : any

Данные для вывода на карточках

role
role: string
Type : string

Роль текущего профиля. От этого зависит то, что будет в items

import { Component, OnInit } from '@angular/core';

import { ProfileService } from 'glx.ui/components/kernel/services/profile.service';

/**
 * Компонент рабочего стола
 *
 * Выводит разделы личного кабинета в удобном виде.
 */
@Component({
  selector: 'dashboard-home',
  templateUrl: './home.html',
  styleUrls: ['./home.scss']
})
export class DashboardHomeComponent implements OnInit {
  /**
   * Заголовок
   * @type {string}
   */
  header: string = 'Рабочий стол';
  /**
   * Данные для вывода на карточках
   */
  items: any;
  /**
   * Роль текущего профиля. От этого зависит то, что будет в items
   * @type {string} student | employee
   */
  role: string;

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

  /**
   * Получаем профиль текущего пользователя. Узнаем его Роль и формируем items.
   */
  ngOnInit() {
    this.profileService.getCurrent()
      .subscribe(
        data => {
          this.role = data.role;
          switch (data.role) {
            case 'student':
              this.items = {
                studmon: {
                  mainClass: '',
                  image: 'assets/images/bg/bg_lb.jpg',
                  icon: 'fa-line-chart',
                  header: 'Личные достижения',
                  description: 'Учет личных достижений студента, аспиранта. Бально-рейтинговая система оценки достижений.',
                  buttons: [
                    {
                      name: 'Список достижений',
                      link: '/monitoring/',
                      class: 'panel-link',
                      external: true
                    }
                  ]
                },
                university: {
                  image: 'assets/images/bg/bg_g.jpg',
                  icon: 'fa-institution',
                  header: 'Университет',
                  description: 'Общие сервисы',
                  buttons: [
                    {
                      name: 'Организационная структура',
                      link: '/search/structure/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Список сотрудников',
                      link: '/search/staff/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Учебная структура',
                      link: '/search/structure_edu/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Список обучающихся',
                      link: '/search/student/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Общие документы',
                      link: '/documents/',
                      class: 'panel-link',
                      external: true
                    },
                  ]
                },
                profile: {
                  mainClass: '',
                  image: 'assets/images/bg/bg_r.jpg',
                  header: 'Обо мне',
                  icon: 'fa-user-circle-o',
                  description: '',
                  buttons: [
                    {
                      name: 'Мой профиль',
                      link: '/profile/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Редактировать профиль',
                      link: '/user/edit/',
                      class: 'panel-link',
                    },
                  ]
                },
                docs: {
                  image: 'assets/images/bg/bg_br.jpg',
                  header: 'Личные документы',
                  icon: 'fa-folder-open-o',
                  description: 'Организацонно-распорядительные документы организации',
                  buttons: [
                    {
                      name: 'Приказы',
                      link: '/profile/orders/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Договоры',
                      link: '/profile/contracts/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Стипендии',
                      link: '/profile/stipend/',
                      class: 'panel-link',
                    },
                  ]
                },
                edu: {
                  image: 'assets/images/bg/bg_y.jpg',
                  header: 'Учебный процесс',
                  icon: 'fa-graduation-cap',
                  description: 'Информация о процессе обучения',
                  buttons: [
                    {
                      name: 'Базовый учебный план (БУП)',
                      link: '/profile/bup/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Рабочий учебный план (РУП)',
                      link: '/profile/rup/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Траектория обучения',
                      link: '/profile/trajectory/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Успеваемость',
                      link: '/profile/marks/',
                      class: 'panel-link',
                    },
                  ]
                }
              };
              break;
            case 'employee':
              this.items = {
                studmon: {
                  image: 'assets/images/bg/bg_lb.jpg',
                  icon: 'fa-line-chart',
                  header: 'Личные достижения',
                  description: '',
                  buttons: [
                    {
                      name: 'Список достижений',
                      link: '/monitoring/',
                      class: 'panel-link',
                      external: true
                    },
                    {
                      name: 'Верификации достижений',
                      link: '/monitoring/curator/',
                      class: 'panel-link',
                      external: true
                    },
                    {
                      name: 'Администрирование модуля',
                      link: '/monitoring/admin/',
                      class: 'panel-link',
                      external: true
                    },
                  ]
                },
                university: {
                  image: 'assets/images/bg/bg_g.jpg',
                  icon: 'fa-institution',
                  header: 'Университет',
                  description: 'Общие сервисы',
                  buttons: [
                    {
                      name: 'Организационная структура',
                      link: '/search/structure/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Список сотрудников',
                      link: '/search/staff/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Учебная структура',
                      link: '/search/structure_edu/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Список обучающихся',
                      link: '/search/student/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Общие документы',
                      link: '/documents/',
                      class: 'panel-link',
                      external: true
                    },
                  ]
                },
                profile: {
                  image: 'assets/images/bg/bg_r.jpg',
                  header: 'Обо мне',
                  icon: 'fa-user-circle-o',
                  description: '',
                  buttons: [
                    {
                      name: 'Мой профиль',
                      link: '/profile/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Редактировать профиль',
                      link: '/user/edit/',
                      class: 'panel-link',
                    },
                  ]
                },
                docs: {
                  image: 'assets/images/bg/bg_br.jpg',
                  header: 'Личные документы',
                  icon: 'fa-folder-open-o',
                  description: 'Организацонно-распорядительные документы организации',
                  buttons: [
                    {
                      name: 'Приказы',
                      link: '/profile/orders/',
                      class: 'panel-link',
                    },
                    {
                      name: 'Договора',
                      link: '/profile/contracts/',
                      class: 'panel-link',
                    },
                  ]
                }
              };
              break;
          }
        },
        error => {
          console.error(error);
        });
  }
}
<glx-page-title-bx [header]="header"></glx-page-title-bx>
<div class="dashboard-viewer-wrapper">
  <div class="row" *ngIf="items">
    <div class="col-12 col-xl-6">
      <glx-dashboard-panel
        [header]="items.studmon.header"
        [description]="items.studmon.description"
        [buttons]="items.studmon.buttons"
        [image]="items.studmon.image"
        [icon]="items.studmon.icon"
        [mainClass]="items.studmon.mainClass"
      ></glx-dashboard-panel>
    </div>
    <div class="col-12 col-xl-6">
      <glx-dashboard-panel
        [header]="items.profile.header"
        [description]="items.profile.description"
        [buttons]="items.profile.buttons"
        [image]="items.profile.image"
        [icon]="items.profile.icon"
        [mainClass]="items.profile.mainClass"
      ></glx-dashboard-panel>
    </div>
    <div class="col-12 col-xl-6">
      <glx-dashboard-panel
        [header]="items.docs.header"
        [description]="items.docs.description"
        [buttons]="items.docs.buttons"
        [image]="items.docs.image"
        [icon]="items.docs.icon"
        [mainClass]="items.docs.mainClass"
      ></glx-dashboard-panel>
    </div>
    <div class="col-12 col-xl-6" *ngIf="role==='student'">
      <glx-dashboard-panel
        [header]="items.edu.header"
        [description]="items.edu.description"
        [buttons]="items.edu.buttons"
        [image]="items.edu.image"
        [icon]="items.edu.icon"
        [mainClass]="items.edu.mainClass"
      ></glx-dashboard-panel>
    </div>
    <div class="col-12 col-xl-6">
      <glx-dashboard-panel
        [header]="items.university.header"
        [description]="items.university.description"
        [buttons]="items.university.buttons"
        [image]="items.university.image"
        [icon]="items.university.icon"
        [mainClass]="items.university.mainClass"
      ></glx-dashboard-panel>
    </div>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""