Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component } from '@angular/core';
- import {
- GetApplicationLanguages,
- GetLanguagesBaseContainer,
- RemoveLanguageActions,
- ChangeDefaultLanguageActios
- } from '@hr-portal/features';
- import { Store } from '@ngrx/store';
- import { LocalizationService } from 'abp-ng2-module/dist/src/localization/localization.service';
- import { CreateOrEditDialogActions } from '../../../create-or-edit-language-dialog';
- import { ApplicationLanguageListDto } from '@hr-portal/shared';
- import { Router, ActivatedRoute } from '@angular/router';
- @Component({
- selector: 'hr-portal-languages-table',
- templateUrl: './language-table.container.html'
- })
- export class AppLanguagesTableContainer extends GetLanguagesBaseContainer {
- cols = [
- {
- field: 'name',
- header: this.localization.localize('Language', 'HRPortal')
- },
- {
- field: 'displayName',
- header: this.localization.localize('Language_Name', 'HRPortal')
- },
- {
- field: 'isDisabled',
- header: this.localization.localize('IsDisabled', 'HRPortal')
- },
- {
- field: 'isDefault',
- header: this.localization.localize('DefaultLanguage', 'HRPortal')
- }
- ];
- optionsMenuforDefault = [
- {
- label: this.localization.localize('Language_SetAsDefault', 'HRPortal'),
- icon: 'la la-eye',
- command: () => {
- this.setAsDefault();
- }
- },
- {
- label: this.localization.localize('Edit', 'HRPortal'),
- icon: 'la la-edit',
- command: () => {
- this.editLanguage();
- }
- }
- ];
- optionsMenu = [
- ...this.optionsMenuforDefault,
- {
- label: this.localization.localize('Remove', 'HRPortal'),
- icon: 'pi pi-times',
- command: () => {
- this.removeLanguage();
- }
- }
- ];
- selectedRow: any;
- getBooleanTranslation(value: boolean): string {
- if (value) return this.localization.localize('Yes', 'HRPortal');
- else return this.localization.localize('No', 'HRPortal');
- }
- constructor(
- store$: Store<any>,
- private router: Router,
- private activatedRoute: ActivatedRoute,
- private localization: LocalizationService
- ) {
- super(store$);
- }
- ngOnInit(): void {
- this.store$.dispatch(GetApplicationLanguages.getLanguages());
- }
- setUpSelectedRow(selectedRow) {
- this.selectedRow = selectedRow;
- }
- removeLanguage() {
- if (this.selectedRow && this.selectedRow.id)
- this.store$.dispatch(
- RemoveLanguageActions.removeLanguage({ id: this.selectedRow.id })
- );
- }
- editLanguage() {
- if (this.selectedRow && this.selectedRow.id)
- this.store$.dispatch(
- CreateOrEditDialogActions.openCreateOrEditAcitonsDialog({
- id: this.selectedRow.id
- })
- );
- }
- navigate(name: string) {
- this.router.navigate(['.', 'texts', name], {
- relativeTo: this.activatedRoute
- });
- }
- setAsDefault() {
- if (this.selectedRow && this.selectedRow.name)
- this.store$.dispatch(
- ChangeDefaultLanguageActios.changeDefaultLanguage({
- input: {
- name: this.selectedRow.name
- }
- })
- );
- }
- onPage(paginator: any) {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement