\r\n
\r\n","import {ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild} from '@angular/core';\r\nimport {FormBuilder, FormControl, FormGroup} from '@angular/forms';\r\nimport {DataIntervalService} from 'app/shared/services/data-service/data-interval/data-interval.service';\r\nimport {ranges} from '../../../fake.db/data';\r\nimport {Util} from 'app/shared/models/generico/util';\r\n\r\n@Component({\r\n selector: 'app-intervalo-data',\r\n templateUrl: './intervalo-data.component.html',\r\n styleUrls: ['./intervalo-data.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class IntervaloDataComponent implements OnInit, OnChanges {\r\n @ViewChild('inData1') dateInput?: ElementRef;\r\n @Input('placeholder') placerholder = '';\r\n @Input('selData1') selData1 = null;\r\n @Output('setData') setData = new EventEmitter();\r\n @Output('go') go = new EventEmitter();\r\n ranges: any = ranges;\r\n form: FormGroup;\r\n valorData: string;\r\n // [moment().subtract(29, 'days'), moment()]\r\n // selData1={\r\n // inicio: moment().subtract(29, 'days'),\r\n // fim: moment()\r\n // Dia mãximo do mês y ...\r\n // }\r\n constructor(\r\n private dataIntervalService: DataIntervalService,\r\n private fb: FormBuilder\r\n ) {\r\n this.initForm();\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (this.selData1) {\r\n this.setData.emit(this.selData1);\r\n this.go.emit({});\r\n }\r\n }\r\n\r\n initForm() {\r\n this.form = this.fb.group({\r\n data: []\r\n });\r\n }\r\n\r\n validarCaracter(evento: any) {\r\n this.dataIntervalService.validarCaracter(evento);\r\n }\r\n\r\n validarData(evento: any, idInput: string, formcontrolname: string): void {\r\n const formControl: FormControl = (this.form.get(formcontrolname) as FormControl);\r\n this.dataIntervalService.validarData(evento, formControl, idInput);\r\n\r\n if (this.dataIntervalService.getValido()) {\r\n\r\n this.valorData = this.dataIntervalService.getValorData();\r\n\r\n this.setData.emit({\r\n inicio: this.format((this.valorData as string).split('-')[0]),\r\n fim: this.format((this.valorData as string).split('-')[1])\r\n });\r\n }\r\n }\r\n\r\n // format2( strDate: string): any {\r\n // return new Date(Util.strParaDataISO(strDate.replace(/\\s/g,'')\r\n // .replace(/[/]/g,'-').split('-')\r\n // .reverse().toString()\r\n // .replace(/[,]/g,'-')))\r\n // .toISOString();\r\n // }\r\n\r\n format(strDate: string): any {\r\n return new Date(Util.strParaDataISO(strDate.replace(/\\s/g, '').replace(/[/]/g, '-').split('-').reverse().toString().replace(/[,]/g, '-'))).toISOString();\r\n }\r\n\r\n getDataInterval(event: any, idInput: string) {\r\n if (event?.inicio?._d && event?.fim?._d) {\r\n this.dataIntervalService.setValorData(this.formatarStrParaDataISO((Util.strParaDataISO(event?.inicio?._d) as string).split('-')) + ' - ' +\r\n this.formatarStrParaDataISO(\r\n (Util.strParaDataISO(event?.fim?._d) as string).split('-')));\r\n\r\n\r\n this.valorData = this.dataIntervalService.getValorData();\r\n\r\n this.setData.emit({\r\n inicio: this.format((this.valorData as string).split('-')[0]),\r\n fim: this.format((this.valorData as string).split('-')[1]).replace('T00:00', 'T23:59')\r\n });\r\n }\r\n }\r\n\r\n validarIntervalo(dia1: number, mes1: number, ano1: number, dia2: number, mes2: number, ano2: number): boolean {\r\n return this.dataIntervalService.validarIntervalo(dia1, mes1, ano1, dia2, mes2, ano2);\r\n }\r\n\r\n maxDia(mes: number, ano?: number): number {\r\n\r\n return this.dataIntervalService.maxDia(mes, ano);\r\n }\r\n\r\n\r\n formatarStrParaDataISO(data: string[]): string {\r\n return this.dataIntervalService.formatarStrParaDataISO(data);\r\n }\r\n\r\n reverteFormatarStrParaDataISO(data: string[]): string {\r\n return this.dataIntervalService.reverteFormatarStrParaDataISO(data);\r\n }\r\n\r\n}\r\n","
\r\n \r\n {{ placerholder }}\r\n \r\n \r\n\r\n
\r\n","import {CurrencyPipe} from '@angular/common';\r\nimport {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';\r\nimport {FormBuilder, FormControl, FormGroup} from '@angular/forms';\r\nimport {FormatarQuantidadePipe} from 'app/shared/pipes/formatar-quantidade.pipe';\r\nimport {timer} from 'rxjs';\r\nimport {take} from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'app-intervalo-valores',\r\n templateUrl: './intervalo-valores.component.html',\r\n styleUrls: ['./intervalo-valores.component.scss'],\r\n providers: [CurrencyPipe, FormatarQuantidadePipe]\r\n})\r\nexport class IntervaloValoresComponent implements OnInit, OnChanges {\r\n canOver = true;\r\n permitir = false;\r\n auxMin = '';\r\n auxMax = '';\r\n @Input('placeholder') placeholder: any;\r\n @Input('min') min: any;\r\n @Input('max') max: any;\r\n @Input('limpar') limpar: boolean;\r\n @Input() errorMessage = '';\r\n @Input('descricao') descricao: any;\r\n @Output('setValores') valores = new EventEmitter();\r\n\r\n FORM = {\r\n empresas: 'idEmpresas',\r\n movimentos: 'idMovimentos',\r\n tipoMovimentos: 'tipoMovimentos',\r\n armazens: 'idArmazens',\r\n artigos: 'idArtigos',\r\n dataInicio: 'dataInicio',\r\n dataFim: 'dataFim',\r\n min: 'min',\r\n max: 'max',\r\n montanteMin: 'montanteMin',\r\n montanteMax: 'montanteMax',\r\n minVer: 'minVer',\r\n maxVer: 'maxVer',\r\n montanteMinVer: 'montanteMinVer',\r\n montanteMaxVer: 'montanteMaxVer',\r\n minQuantidadeAux: 'minQuantidadeAux',\r\n maxQuantidadeAux: 'maxQuantidadeAux',\r\n minMontanteAux: 'minMontanteAux',\r\n maxMontanteAux: 'maxMontanteAux',\r\n caracterQuantidadeMinValido: 'caracterQuantidadeMinValido',\r\n caracterQuantidadeMaxValido: 'caracterQuantidadeMaxValido',\r\n caracterMontanteMinValido: 'caracterMontanteMinValido',\r\n caracterMontanteMaxValido: 'caracterMontanteMaxValido'\r\n };\r\n\r\n filterForm: FormGroup = this.fb.group({\r\n [this.FORM.empresas]: [],\r\n [this.FORM.movimentos]: [],\r\n [this.FORM.tipoMovimentos]: [],\r\n [this.FORM.armazens]: [],\r\n [this.FORM.artigos]: [],\r\n [this.FORM.dataInicio]: null,\r\n [this.FORM.dataFim]: null,\r\n [this.FORM.min]: [null],\r\n [this.FORM.max]: [null],\r\n [this.FORM.montanteMin]: [],\r\n [this.FORM.montanteMax]: [],\r\n [this.FORM.minVer]: [''],\r\n [this.FORM.maxVer]: [''],\r\n [this.FORM.montanteMinVer]: [''],\r\n [this.FORM.montanteMaxVer]: [''],\r\n [this.FORM.minQuantidadeAux]: [''],\r\n [this.FORM.maxQuantidadeAux]: [''],\r\n [this.FORM.minMontanteAux]: [''],\r\n [this.FORM.maxMontanteAux]: [''],\r\n [this.FORM.caracterQuantidadeMinValido]: [],\r\n [this.FORM.caracterQuantidadeMaxValido]: [],\r\n [this.FORM.caracterMontanteMinValido]: [],\r\n [this.FORM.caracterMontanteMaxValido]: []\r\n });\r\n\r\n constructor(\r\n private fb: FormBuilder,\r\n private formatarQuantidadePipe: FormatarQuantidadePipe\r\n ) {\r\n this.placeholder = 'texto default';\r\n }\r\n\r\n ngOnInit(): void {\r\n if (this.min === null) {\r\n this.filterForm.get(this.FORM.minVer).setValue('');\r\n\r\n }\r\n\r\n if (this.max === null) {\r\n this.filterForm.get(this.FORM.maxVer).setValue('');\r\n }\r\n }\r\n\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (this.limpar) {\r\n this.auxMin = '';\r\n this.auxMax = '';\r\n this.filterForm.get(this.FORM.min).setValue(null);\r\n this.filterForm.get(this.FORM.minVer).setValue('');\r\n this.filterForm.get(this.FORM.max).setValue(null);\r\n this.filterForm.get(this.FORM.maxVer).setValue('');\r\n }\r\n\r\n\r\n if (this.min === null) {\r\n this.filterForm.get(this.FORM.min).setValue(this.min);\r\n this.filterForm.get(this.FORM.minVer).setValue('');\r\n\r\n }\r\n\r\n if (this.max === null) {\r\n this.filterForm.get(this.FORM.max).setValue(this.FORM.max);\r\n this.filterForm.get(this.FORM.maxVer).setValue('');\r\n }\r\n }\r\n\r\n get f() {\r\n return this.filterForm.controls;\r\n }\r\n\r\n delay(milliseconds: number) {\r\n return timer(milliseconds).pipe(take(1)).toPromise();\r\n }\r\n\r\n OnHidden(evento: any) {\r\n setTimeout(() => {\r\n\r\n this.canOver = true;\r\n }, 0);\r\n }\r\n\r\n async setState(evento: any) {\r\n // await this.delay(100);\r\n setTimeout(() => {\r\n\r\n this.canOver = false;\r\n }, 0);\r\n const auxMin = this.filterForm.get(this.FORM.minVer).value;\r\n const auxMax = this.filterForm.get(this.FORM.maxVer).value;\r\n const min: number = auxMin && auxMin !== '' ? parseFloat(auxMin.replace(/[.]/g, '').replace(/,/g, '.')) : null;\r\n const max: number = auxMax && auxMax !== '' ? parseFloat(auxMax.replace(/[.]/g, '').replace(/,/g, '.')) : null;\r\n this.filterForm.get(this.FORM.minVer).setErrors(null);\r\n this.filterForm.get(this.FORM.maxVer).setErrors(null);\r\n\r\n if (min && max) {\r\n min > max ? this.filterForm.get(this.FORM.minVer).setErrors({inválido: true}) : '';\r\n min > max ? this.filterForm.get(this.FORM.maxVer).setErrors({inválido: true}) : '';\r\n }\r\n\r\n this.filterForm.get(this.FORM.minVer).markAsTouched();\r\n this.filterForm.get(this.FORM.maxVer).markAsTouched();\r\n }\r\n\r\n validarEntrada(event: any, formControlEstado: FormControl) {\r\n this.permitir = true;\r\n const keyCode: number = event.charCode;\r\n\r\n if (keyCode === 8 || keyCode === 32 || keyCode === 45\r\n || (keyCode >= 48 && keyCode <= 57)) {\r\n formControlEstado.setValue(true);\r\n return;\r\n }\r\n formControlEstado.setValue(false);\r\n }\r\n\r\n\r\n async validarMin(\r\n valor: string,\r\n formControlVer: FormControl,\r\n formControl: FormControl,\r\n formControlAux: FormControl,\r\n formControlEstado: FormControl,\r\n from) {\r\n let sinalValido = true;\r\n valor = valor.replace(/\\s/g, '');\r\n\r\n // Aqui\r\n if (valor.includes('-')) {\r\n sinalValido = valor.startsWith('-') && 1 >= valor.match(/-/g).length;\r\n }\r\n // Aqui\r\n const valido: boolean = formControlEstado.value;\r\n\r\n if ((!valido || !sinalValido) && this.permitir) {\r\n this.permitir = false;\r\n formControl.setValue(formControlAux.value);\r\n formControlVer.setValue(formControlAux.value);\r\n return;\r\n }\r\n\r\n\r\n this.permitir = false;\r\n await this.formatarQuantidadePipe.transform(\r\n (valor + '').replace(/^[0][,][0][0]/g, '')\r\n .replace(/^[0][,][0]/g, '')\r\n .replace(/^[0][,]/g, '')\r\n .replace(/\\./g, '')\r\n .replace(/,/g, '')\r\n ).then(async (valorAux) => {\r\n\r\n await formControl.setValue(valorAux);\r\n await formControlVer.setValue(valorAux);\r\n await formControlAux.setValue(valorAux);\r\n\r\n if (from === 'min') {\r\n this.auxMin = valorAux;\r\n\r\n } else if (from === 'max') {\r\n this.auxMax = valorAux;\r\n\r\n }\r\n\r\n const min: number = this.auxMin && this.auxMin !== '' ? parseFloat(this.auxMin.replace(/[.]/g, '').replace(/,/g, '.')) : null;\r\n const max: number = this.auxMax && this.auxMax !== '' ? parseFloat(this.auxMax.replace(/[.]/g, '').replace(/,/g, '.')) : null;\r\n this.filterForm.get(this.FORM.minVer).setErrors(null);\r\n this.filterForm.get(this.FORM.maxVer).setErrors(null);\r\n if (this.auxMin && this.auxMax) {\r\n min > max ? this.filterForm.get(this.FORM.minVer).setErrors({inválido: true}) : '';\r\n min > max ? this.filterForm.get(this.FORM.maxVer).setErrors({inválido: true}) : '';\r\n\r\n }\r\n\r\n this.filterForm.get(this.FORM.minVer).markAsTouched();\r\n this.filterForm.get(this.FORM.maxVer).markAsTouched();\r\n\r\n\r\n this.valores.emit({\r\n min,\r\n max,\r\n valido: (this.filterForm.get(this.FORM.minVer).valid && this.filterForm.get(this.FORM.maxVer).valid)\r\n });\r\n\r\n\r\n }\r\n );\r\n }\r\n\r\n}\r\n","
\r\n","import {\r\n AfterViewInit,\r\n ChangeDetectionStrategy,\r\n Component,\r\n EventEmitter,\r\n Input,\r\n OnChanges,\r\n OnInit,\r\n Output,\r\n SimpleChanges,\r\n ViewChildren\r\n} from '@angular/core';\r\nimport {FormBuilder, FormGroup} from '@angular/forms';\r\nimport {MatCheckbox} from '@angular/material/checkbox';\r\nimport {MatSelect} from '@angular/material/select';\r\n\r\n@Component({\r\n selector: 'app-select-retecoes-check-box',\r\n templateUrl: './select-retecoes-check-box.component.html',\r\n styleUrls: ['./select-retecoes-check-box.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush\r\n})\r\nexport class SelectRetecoesCheckBoxComponent implements OnInit, AfterViewInit, OnChanges {\r\n @Input() lista: any[] = [];\r\n @Input() chaveId = '';\r\n @Input() chaveTexto = '';\r\n @Input() placeholder = '';\r\n @Input() limpar = false;\r\n @Output() obterSelecionadoId = new EventEmitter();\r\n @ViewChildren('check') check: any[] = [];\r\n listaInterna: any [] = [];\r\n semaforo = true;\r\n idSelected = 0;\r\n ocultarCheckBoxNoForm = true;\r\n form: FormGroup;\r\n\r\n constructor(private fb: FormBuilder) {\r\n this.form = this.initForm();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (this.limpar) {\r\n this.ocultarCheckBoxNoForm = true;\r\n this.form.get('selecionado').setValue('');\r\n }\r\n\r\n const obj = {\r\n [this.chaveId]: 0,\r\n [this.chaveTexto]: 'Não usa'\r\n };\r\n this.listaInterna = this.lista;\r\n this.listaInterna.push(obj);\r\n this.listaInterna.sort((a, b) => a[this.chaveId] - b[this.chaveId]);\r\n\r\n }\r\n\r\n initForm(): FormGroup {\r\n return this.fb.group({\r\n selecionado: []\r\n });\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n initStr(): string {\r\n return '
Não Usa1';\r\n }\r\n\r\n ngAfterViewInit() {\r\n const el = document.getElementById('mat-select-value-1');\r\n if (el) {\r\n // el.children[0].innerHTML = this.initStr();\r\n }\r\n }\r\n\r\n pevDefault(evento) {\r\n evento.preventDefault();\r\n }\r\n\r\n setFromCheckBox(id: number) {\r\n this.idSelected = id;\r\n const checks: MatCheckbox[] = (this.check as any)._results as MatCheckbox[];\r\n this.semaforo = false;\r\n checks[0].checked = id !== 0;\r\n }\r\n\r\n\r\n onSelect(evento: any) {\r\n if (evento?.value && (evento?.value as []).length > 1) {\r\n evento.value = (evento?.value as []).slice(1, 2);\r\n }\r\n (evento?.source as MatSelect)?.close();\r\n }\r\n\r\n // MatCheckbox\r\n setOption(id: number) {\r\n if (!id) {\r\n id = this.idSelected;\r\n } else {\r\n this.semaforo = true;\r\n }\r\n\r\n const checks: MatCheckbox[] = (this.check as any)._results as MatCheckbox[];\r\n let desmarcar = true;\r\n checks.forEach(check => {\r\n if (id === parseInt(check.id, 10)) {\r\n desmarcar = !(id !== 0 && !check.checked);\r\n\r\n if (this.semaforo) {\r\n check.toggle();\r\n } else {\r\n this.semaforo = true;\r\n }\r\n\r\n // && (check.checked !== false || )\r\n // if (id !== '0' ){\r\n\r\n // desmarcar = false;\r\n // } else {\r\n // desmarcar = true;\r\n // }\r\n\r\n // if (check.checked === false) {\r\n // desmarcar = true;\r\n // }\r\n checks[0].checked = true;\r\n } else {\r\n check.checked = false;\r\n }\r\n });\r\n\r\n if (desmarcar) {\r\n checks[0].checked = false;\r\n this.ocultarCheckBoxNoForm = true;\r\n this.form.get('selecionado').setValue('0');\r\n this.obterSelecionadoId.emit({\r\n idSelecionado: null\r\n });\r\n } else {\r\n this.ocultarCheckBoxNoForm = false;\r\n this.obterSelecionadoId.emit({\r\n idSelecionado: this.form.get('selecionado').value\r\n });\r\n }\r\n }\r\n}\r\n","
\r\n\r\n \r\n\r\n {{placeholder}}\r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n\r\n \r\n \r\n {{item[chaveTexto]}}\r\n \r\n {{item[chaveTexto]}}\r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n
\r\n","import { Component, Input, OnInit, Output, ViewChild, EventEmitter } from '@angular/core';\r\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\r\nimport { Country, CountryCod } from 'app/shared/models/artigos/country-code-json/country-cod';\r\n\r\n@Component({\r\n selector: 'app-telefone',\r\n templateUrl: './telefone.component.html',\r\n styleUrls: ['./telefone.component.scss']\r\n})\r\nexport class TelefoneComponent implements OnInit {\r\n isoCountryCode: Country = null;\r\n indicativoActual: string = '';\r\n telInvalido: boolean = true;\r\n selected = [];\r\n listaContriesFlag: any[] = [];\r\n selTel: Country = null;\r\n countryCode: string;\r\n strSelect1: string;\r\n strSelect2: string;\r\n @Input('accao') accao='';\r\n @Input('telefone') telefone='';\r\n @Output('changePhone') changePhone = new EventEmitter();\r\n formGroupTel: FormGroup;\r\n constructor(\r\n public countryCod: CountryCod,\r\n private fb: FormBuilder\r\n ) { \r\n this.listaContriesFlag = this.countryCod.getContryObject();\r\n this.initStrSelect();\r\n this.countryCode = '';\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n initStrSelect() {\r\n this.strSelect1 = '
'\r\n this.strSelect2 = '
'\r\n}\r\n\r\nisbackSpaceKeyBoard(evento) {\r\n let keyCode: number = evento.keyCode;\r\n let fg = this.formGroupTel as FormGroup;\r\n\r\n if (keyCode === 8) {\r\n fg.get('caracterValido').setValue(true);\r\n }\r\n\r\n}\r\n\r\nvalidarTel(idInPut: string, value: any, index: number) {\r\n let bool: boolean = true;\r\n if (value.length > 1) {\r\n if ((value as string)\r\n .substring(1, (value as string).length)\r\n .includes('+')) {\r\n bool = false;\r\n }\r\n }\r\n\r\n let fg = this.formGroupTel as FormGroup;\r\n let valido: boolean = fg.get('caracterValido').value && bool;\r\n\r\n if (!valido) {\r\n fg?.get('contacto').setValue(\r\n fg?.get('valorAux').value\r\n );\r\n return\r\n }\r\n // this.aoEscrever(formControl, idInPut, index);\r\n const regExp = RegExp('(([+]|[00])([1-9]([0-9]|[0-9]{0}){3})[ ]([0-9]|[0-9]{0}){7})|(([+]|[00])([1-9]([0-9]|[0-9]{0}){3})([0-9]|[0-9]{0}){7})');\r\n \r\n // const regExp = RegExp('(([+]|[00])([1-9]([0-9]|[0-9]{0}){3})[ ][0-9]{4}([0-9]|[0-9]{0}){7})|(([+]|[00])([1-9]([0-9]|[0-9]{0}){3})[0-9]{4}([0-9]|[0-9]{0}){7})');\r\n \r\n\r\n if (regExp.test(value)) {\r\n this.telInvalido = false;\r\n } else {\r\n this.telInvalido = true;\r\n }\r\n\r\n fg?.get('valorAux').setValue(\r\n fg?.get('contacto').value\r\n );\r\n\r\n let native: HTMLElement = document.getElementById(idInPut).children[0] as HTMLElement;\r\n\r\n //Usar os primeiros 5 caracteres, para cada uns dos 5... buscar o indicativo.\r\n let codISO: string;\r\n if (value.split(' ').length > 1) {\r\n if ((value.split(' ')[0] as string)\r\n .startsWith('00')) {\r\n codISO = (value.split(' ') as string)[0]\r\n .replace('00', '+');\r\n\r\n } else {\r\n\r\n codISO = value.split(' ')[0];\r\n }\r\n } else {\r\n if ((value.split(' ')[0] as string)\r\n .startsWith('00')) {\r\n value = (value.split(' ') as string)[0]\r\n .replace('00', '+');\r\n\r\n }\r\n const valor: string = value;\r\n const sub04: string = valor && valor.length > 4 ? valor.substring(0, 5) : null;\r\n const sub03: string = valor && valor.length > 3 ? valor.substring(0, 4) : null;\r\n const sub02: string = valor && valor.length > 2 ? valor.substring(0, 3) : null;\r\n const sub01: string = valor && valor.length > 1 ? valor.substring(0, 2) : null;\r\n\r\n let listaContriesFlagAux: Country[] = this.countryCod.getContryObject();\r\n\r\n listaContriesFlagAux.sort((a, b) => {\r\n return parseInt(b.dialCode) - parseInt(a.dialCode);\r\n });\r\n\r\n for (let i = 0; i < listaContriesFlagAux.length; i++) {\r\n\r\n if (sub04) {\r\n //Condição para quebrar ... Se cumprir quebrar ...\r\n if (listaContriesFlagAux[i].dialCode === sub04) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n if (sub03) {\r\n if (listaContriesFlagAux[i].dialCode === sub03) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n if (sub02) {\r\n if (listaContriesFlagAux[i].dialCode === sub02) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n if (sub01) {\r\n if (listaContriesFlagAux[i].dialCode === sub01) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n let control: FormControl = fg\r\n .get('contacto') as FormControl;\r\n\r\n let country: Country[] = this.listaContriesFlag.filter((country: Country) => {\r\n return country.dialCode === codISO\r\n });\r\n \r\n \r\n \r\n if (country.length > 0) {\r\n this.indicativoActual = codISO;\r\n fg?.get('selectedCountryCode')\r\n .setValue(country[0]);\r\n native.innerHTML = this.strSelect1 + country[0].flag + this.strSelect2;\r\n this.changePhone.emit({\r\n telefone: country[0].flag\r\n })\r\n } else {\r\n this.indicativoActual = '';\r\n // fg?.get('contacto').setErrors({\r\n // Inválido: true\r\n // }, { emitEvent: true });\r\n native.innerHTML = this.strSelect1 + '' + this.strSelect2;\r\n this.changePhone.emit({\r\n telefone: ''\r\n })\r\n fg?.get('selectedCountryCode')\r\n .setValue(null);\r\n }\r\n // control.markAsTouched({ onlySelf: true });\r\n // fg?.get('contacto').markAsTouched({ onlySelf: true })\r\n\r\n\r\n\r\n}\r\n\r\nreconhecerCaracter(evento: any) {\r\n\r\n let charCode: number = evento.charCode;\r\n const str: string = evento.target.value;\r\n\r\n let fg = this.formGroupTel as FormGroup;\r\n if ((\r\n (charCode >= 48 && charCode <= 57)\r\n || charCode === 43\r\n || charCode === 32 || charCode === 8)) {\r\n fg.get('caracterValido').setValue(true);\r\n } else {\r\n fg.get('caracterValido').setValue(false);\r\n\r\n }\r\n\r\n}\r\n\r\nchangeCountryCode(idInPut: string, country: Country) {\r\n this.isoCountryCode = null;\r\n\r\n let fg = this.formGroupTel as FormGroup;\r\n\r\n let native: HTMLElement = document\r\n .getElementById(idInPut)\r\n .children[0] as HTMLElement;\r\n\r\n let valor: string[] = [];\r\n let contacto: string = '';\r\n\r\n if ((fg\r\n .get('contacto')\r\n .value.split(' ') as [])\r\n .length > 1\r\n ) {\r\n valor = fg\r\n .get('contacto')\r\n .value.split(' ');\r\n } else {\r\n contacto = (fg\r\n .get('contacto')\r\n .value as string).replace(this.indicativoActual, '');\r\n }\r\n\r\n let valorAux = ''\r\n for (let i = 1; i < valor.length; i++) {\r\n\r\n valorAux += ' ' + valor[i]\r\n }\r\n\r\n native.innerHTML = this.strSelect1 + country.flag + this.strSelect2;\r\n\r\n let countryCode: string = '';\r\n\r\n this.indicativoActual = country.dialCode;\r\n if (valor.length > 1) {\r\n countryCode = valor.length > 1 ? country.dialCode + valorAux :\r\n country.dialCode + ' ';\r\n } else {\r\n countryCode = country.dialCode + contacto;\r\n }\r\n\r\n\r\n fg\r\n .get('contacto').setValue(countryCode);\r\n\r\n fg\r\n .get('valorAux').setValue(this.countryCode);\r\n}\r\n\r\ngetformGroupTel(countryCod?: string) {\r\n // , [Validators.pattern('[+]([1-9]([0-9]|[0-9]{0}){3})[ ][0-9]{4}([0-9]|[0-9]{0}){7}')]\r\n return this.fb.group({\r\n contacto: [''],\r\n caracterValido: [false],\r\n valorAux: [countryCod ? countryCod : ''],\r\n selectedCountryCode: []\r\n })\r\n}\r\n\r\n @ViewChild('matSelect1') matSelect1: any;\r\n async initContacto(idComponent: string) {\r\n let fg = this.formGroupTel as FormGroup;\r\n if (document.getElementById(idComponent)) {\r\n //??\r\n let native: HTMLElement = await document\r\n .getElementById(idComponent)\r\n .children[0] as HTMLElement;\r\n\r\n let country: Country[] = null;\r\n if (this.isoCountryCode && this.isoCountryCode.dialCode) {\r\n country = await this.listaContriesFlag.filter((country: Country) => {\r\n return country.dialCode.toLowerCase() === this.isoCountryCode.dialCode\r\n .toLowerCase()\r\n });\r\n\r\n\r\n } else {\r\n country = await this.listaContriesFlag.filter((country: Country) => {\r\n return country.flag.toLowerCase() === localStorage\r\n .getItem('__cod__Pais')\r\n .replace(/\\s/g, '').toLowerCase()\r\n });\r\n }\r\n\r\n let countryCode: string = country.length > 0 ?\r\n country[0].dialCode + ' ' : '';\r\n\r\n if (this.isoCountryCode && this.telefone) {\r\n countryCode = this.isoCountryCode.dialCode + ' ' + this.telefone;\r\n\r\n } else if (this.telefone) {\r\n\r\n //Verificar se começa com 00\r\n if ((this.telefone.split(' ')[0] as string)\r\n .startsWith('00')) {\r\n this.telefone = this.telefone.replace('00', '+');\r\n\r\n }\r\n // if (this.isoCountryCode && this.isoCountryCode.dialCode) {\r\n const valor: string = this.telefone;\r\n let codISO: string = '';\r\n const sub04: string = valor && valor.length > 4 ? valor.substring(0, 5) : null;\r\n const sub03: string = valor && valor.length > 3 ? valor.substring(0, 4) : null;\r\n const sub02: string = valor && valor.length > 2 ? valor.substring(0, 3) : null;\r\n const sub01: string = valor && valor.length > 1 ? valor.substring(0, 2) : null;\r\n\r\n let listaContriesFlagAux: Country[] = this.countryCod.getContryObject();\r\n\r\n listaContriesFlagAux.sort((a, b) => {\r\n return parseInt(b.dialCode) - parseInt(a.dialCode);\r\n });\r\n\r\n for (let i = 0; i < listaContriesFlagAux.length; i++) {\r\n\r\n if (sub04) {\r\n //Condição para quebrar ... Se cumprir quebrar ...\r\n if (listaContriesFlagAux[i].dialCode === sub04) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n if (sub03) {\r\n if (listaContriesFlagAux[i].dialCode === sub03) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n if (sub02) {\r\n if (listaContriesFlagAux[i].dialCode === sub02) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n if (sub01) {\r\n if (listaContriesFlagAux[i].dialCode === sub01) {\r\n codISO = listaContriesFlagAux[i].dialCode;\r\n break;\r\n }\r\n }\r\n\r\n }\r\n\r\n this.indicativoActual = codISO;\r\n country = this.listaContriesFlag.filter((country: Country) => {\r\n return country.dialCode === codISO\r\n });\r\n if (country) {\r\n fg?.get('selectedCountryCode')\r\n .setValue(country[0]);\r\n\r\n }\r\n countryCode = this.telefone;\r\n\r\n\r\n\r\n // } else {\r\n // countryCode = country.length > 0 ?\r\n // country[0].dialCode + ' ' + this.telefone : '';\r\n // }\r\n\r\n }\r\n\r\n this.indicativoActual = countryCode;\r\n fg.get('contacto').setValue(countryCode);\r\n fg?.get('valorAux').setValue(\r\n countryCode\r\n );\r\n\r\n if (this.accao !== 'D') {\r\n fg.get('valorAux').setValue(this.countryCode);\r\n }\r\n if (country.length > 0) {\r\n\r\n fg.get('selectedCountryCode')\r\n .setValue(country[0]);\r\n native.innerHTML = this.strSelect1 + country[0].flag + this.strSelect2;\r\n } else {\r\n native.innerHTML = this.strSelect1 + '' + this.strSelect2;\r\n }\r\n }\r\n\r\n }\r\n\r\n}\r\n","\r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-pdf',\r\n templateUrl: './pdf.component.html',\r\n styleUrls: ['./pdf.component.scss']\r\n})\r\nexport class PdfComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","\r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-progress',\r\n templateUrl: './progress.component.html',\r\n styleUrls: ['./progress.component.scss']\r\n})\r\nexport class ProgressComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","
\r\n","import {NgModule} from '@angular/core';\r\nimport {RouterModule} from '@angular/router';\r\nimport {SharedMaterialModule} from '../shared-material.module';\r\nimport {TranslateModule} from '@ngx-translate/core';\r\nimport {CommonModule} from '@angular/common';\r\nimport {FormsModule, ReactiveFormsModule} from '@angular/forms';\r\nimport {PerfectScrollbarModule} from 'ngx-perfect-scrollbar';\r\nimport {SearchModule} from '../search/search.module';\r\nimport {SharedPipesModule} from '../pipes/shared-pipes.module';\r\nimport {FlexLayoutModule} from '@angular/flex-layout';\r\nimport {SharedDirectivesModule} from '../directives/shared-directives.module';\r\n// ONLY REQUIRED FOR **SIDE** NAVIGATION LAYOUT\r\nimport {HeaderSideComponent} from './header-side/header-side.component';\r\nimport {SidebarSideComponent} from './sidebar-side/sidebar-side.component';\r\n// ONLY REQUIRED FOR **TOP** NAVIGATION LAYOUT\r\nimport {HeaderTopComponent} from './header-top/header-top.component';\r\nimport {SidebarTopComponent} from './sidebar-top/sidebar-top.component';\r\n// ONLY FOR DEMO\r\nimport {CustomizerComponent} from './customizer/customizer.component';\r\n// ALWAYS REQUIRED\r\nimport {AdminLayoutComponent} from './layouts/admin-layout/admin-layout.component';\r\nimport {AuthLayoutComponent} from './layouts/auth-layout/auth-layout.component';\r\nimport {NotificationsComponent} from './notifications/notifications.component';\r\nimport {SidenavComponent} from './sidenav/sidenav.component';\r\nimport {FooterComponent} from './footer/footer.component';\r\nimport {BreadcrumbComponent} from './breadcrumb/breadcrumb.component';\r\nimport {AppComfirmComponent} from '../services/app-confirm/app-confirm.component';\r\nimport {AppLoaderComponent} from '../services/app-loader/app-loader.component';\r\nimport {ButtonLoadingComponent} from './button-loading/button-loading.component';\r\nimport {EgretSidebarComponent, EgretSidebarTogglerDirective} from './egret-sidebar/egret-sidebar.component';\r\nimport {BottomSheetShareComponent} from './bottom-sheet-share/bottom-sheet-share.component';\r\nimport {EgretNotifications2Component} from './egret-notifications2/egret-notifications2.component';\r\nimport {ExportExcelComponent} from './modais/export-excel/export-excel.component';\r\nimport {ExportPdfComponent} from './modais/export-pdf/export-pdf.component';\r\nimport {ProgressComponent} from './progress/progress.component';\r\nimport {TabAccoesMultiplas} from './tab-accoes-multiplas/tab-accoes-multiplas';\r\nimport {ModalSessaoExpirada} from './modal-sessao-expirada/modal-sessao-expirada';\r\nimport {BtnSmComponent} from './botoes/btn-sm';\r\nimport {ModalBaseComponent} from './modais/modal-base/modal-base.component';\r\nimport {CardAddFicheiroComponent} from './cards/card-add-ficheiro';\r\nimport {InputAutocompleteComponent} from './input-autocomplete/input-autocomplete.component';\r\nimport {MatIconModule} from '@angular/material/icon';\r\nimport {AvisoComponent} from './modal-aviso/aviso/aviso.component';\r\nimport {ScrollingModule} from '@angular/cdk/scrolling';\r\nimport {OverlayPanelModule} from 'primeng/overlaypanel';\r\nimport {IntervaloComponent} from './intervalo/intervalo.component';\r\nimport {AutoCompleteComponent} from './novos-componentes/auto-complete/auto-complete.component';\r\nimport {IntervaloDataComponent} from './novos-componentes/intervalo-data/intervalo-data.component';\r\nimport {NgxDaterangepickerMd} from 'ngx-daterangepicker-material';\r\nimport {IntervaloValoresComponent} from './novos-componentes/intervalo-valores/intervalo-valores.component';\r\nimport {ModalCargaDescarga} from '../../views/facturacao/modais/modal-carga-descarga/modal-carga-descarga';\r\nimport {TelefoneComponent} from './novos-componentes/telefone/telefone.component';\r\nimport {ModalRemoverComponent} from './notifications/modais/modal-remover/modal-remover.component';\r\nimport {NgxMaskModule} from 'ngx-mask';\r\nimport {SelectRetecoesCheckBoxComponent} from './novos-componentes/select-retecoes-check-box/select-retecoes-check-box.component';\r\nimport {ContactoComponent} from './novos-componentes/contacto/contacto.component';\r\nimport {TabelaItensFinComponent} from './Tabelas/tabela-itens-fin/tabela-itens-fin.component';\r\nimport {FiltarArtigoPipe} from 'app/views/facturacao/facturacao/saft/pipes/filtar-artigo.pipe';\r\nimport {Autocomplete} from './autocomplete/autocomplete';\r\nimport {PosLayoutComponent} from './layouts/pos-layout/pos-layout.component';\r\nimport {PosNavegacaoComponent} from '../../views/pos/componentes/pos-navegacao/pos-navegacao.component';\r\nimport {PosContainer} from '../../views/pos/componentes/pos-container/pos-container';\r\nimport {KCardComponent} from '@shared/components/k-card/k-card.component';\r\nimport {KCardColumnComponent} from '@shared/components/k-card-column/k-card-column.component';\r\nimport {KTiposArquivosComponent} from '@shared/components/k-tipos-arquivos/k-tipos-arquivos.component';\r\nimport {NgxDatatableModule} from '@swimlane/ngx-datatable';\r\nimport {KArquivosComponent} from '@shared/components/k-arquivos/k-arquivos.component';\r\nimport {KArquivoComponent} from '@shared/components/k-arquivo/k-arquivo.component';\r\nimport { PhoneComponent } from '@shared/components/telefone/app-phone';\r\nimport {DocumentosComponent} from '@shared/components/documentos/documentos.component';\r\nimport {PdfComponent} from '@shared/components/pdf/pdf.component';\r\nimport { TecladoModule } from '../keyboard/teclado.module';\r\nimport { ModalErroComponent } from './modal-erro/modal-erro.component';\r\nimport { AppFone} from '@shared/components/forms/app-phone';\r\nimport { AppDialCode } from '@shared/components/forms/app-dial-code';\r\n\r\nconst components = [\r\n HeaderTopComponent,\r\n SidebarTopComponent,\r\n SidenavComponent,\r\n NotificationsComponent,\r\n SidebarSideComponent,\r\n HeaderSideComponent,\r\n AdminLayoutComponent,\r\n AuthLayoutComponent,\r\n PosLayoutComponent,\r\n PosNavegacaoComponent,\r\n PosContainer,\r\n BreadcrumbComponent,\r\n AppComfirmComponent,\r\n AppLoaderComponent,\r\n EgretNotifications2Component,\r\n CustomizerComponent,\r\n ButtonLoadingComponent,\r\n EgretSidebarComponent,\r\n FooterComponent,\r\n EgretSidebarTogglerDirective,\r\n BottomSheetShareComponent,\r\n ExportExcelComponent,\r\n ExportPdfComponent,\r\n ProgressComponent,\r\n TabAccoesMultiplas,\r\n ModalSessaoExpirada,\r\n BtnSmComponent,\r\n ModalBaseComponent,\r\n CardAddFicheiroComponent,\r\n InputAutocompleteComponent,\r\n AvisoComponent,\r\n IntervaloComponent,\r\n AutoCompleteComponent,\r\n IntervaloDataComponent,\r\n IntervaloValoresComponent,\r\n ModalCargaDescarga,\r\n TelefoneComponent,\r\n ModalRemoverComponent,\r\n SelectRetecoesCheckBoxComponent,\r\n ContactoComponent,\r\n TabelaItensFinComponent,\r\n FiltarArtigoPipe,\r\n Autocomplete,\r\n KCardComponent,\r\n KCardColumnComponent,\r\n KTiposArquivosComponent,\r\n KArquivosComponent,\r\n KArquivoComponent,\r\n PhoneComponent,\r\n DocumentosComponent,\r\n AppFone, AppDialCode,\r\n];\r\n\r\n@NgModule({\r\n imports: [\r\n MatIconModule,\r\n CommonModule,\r\n FormsModule,\r\n RouterModule,\r\n TranslateModule,\r\n FlexLayoutModule,\r\n PerfectScrollbarModule,\r\n SearchModule,\r\n SharedPipesModule,\r\n SharedDirectivesModule,\r\n SharedMaterialModule,\r\n ReactiveFormsModule,\r\n ScrollingModule,\r\n OverlayPanelModule,\r\n NgxDaterangepickerMd.forRoot(),\r\n NgxMaskModule,\r\n NgxDatatableModule,\r\n TecladoModule\r\n ],\r\n declarations: [\r\n components,\r\n PdfComponent,\r\n ModalErroComponent\r\n ],\r\n // entryComponents: [AppComfirmComponent, AppLoaderComponent, BottomSheetShareComponent],\r\n exports: [\r\n components,\r\n PdfComponent\r\n ]\r\n})\r\nexport class SharedComponentsModule {\r\n}\r\n","import {Component, OnInit, OnDestroy, AfterViewInit} from '@angular/core';\r\nimport {NavigationService} from '../../../shared/services/navigation.service';\r\nimport {ThemeService} from '../../services/theme.service';\r\nimport {Subscription} from 'rxjs';\r\nimport {ILayoutConf, LayoutService} from 'app/shared/services/layout.service';\r\nimport {JwtAuthService} from 'app/shared/services/auth/jwt-auth.service';\r\nimport { UtilizadorSessao } from 'app/shared/models/aplicacao/utilizador-sessao';\r\nimport { LoginService } from 'app/shared/services/aplicacao-service/login.service';\r\n\r\n@Component({\r\n selector: 'app-sidebar-side',\r\n templateUrl: './sidebar-side.component.html'\r\n})\r\nexport class SidebarSideComponent implements OnInit, OnDestroy, AfterViewInit {\r\n public menuItems: any[];\r\n public appLogo = 'assets/images/logo/kiami.png';\r\n public hasIconTypeMenuItem: boolean;\r\n public iconTypeMenuTitle: string;\r\n private menuItemsSub: Subscription;\r\n public layoutConf: ILayoutConf;\r\n\r\n constructor(\r\n private navService: NavigationService,\r\n public themeService: ThemeService,\r\n private layout: LayoutService,\r\n public jwtAuth: JwtAuthService,\r\n private loginService: LoginService\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n this.iconTypeMenuTitle = this.navService.iconTypeMenuTitle;\r\n this.menuItemsSub = this.navService.menuItems$.subscribe(menuItem => {\r\n this.menuItems = menuItem;\r\n // Checks item list has any icon type.\r\n this.hasIconTypeMenuItem = !!this.menuItems.filter(\r\n item => item.type === 'icon'\r\n ).length;\r\n });\r\n this.layoutConf = this.layout.layoutConf;\r\n\r\n let utilizador: UtilizadorSessao = this.loginService?.getUtilizadorSessao();\r\n this.filtrarMenu(utilizador?.sistema);\r\n }\r\n\r\n\r\n filtrarMenu( sistema: boolean) {\r\n if (!sistema){\r\n let menu: any= this.menuItems.find(menu => menu?.code === 'ADMINI');\r\n menu.sub = menu?.sub?.filter( sub => sub?.name !== 'Módulos');\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.menuItemsSub) {\r\n this.menuItemsSub.unsubscribe();\r\n }\r\n }\r\n\r\n toggleCollapse() {\r\n if (\r\n this.layoutConf.sidebarCompactToggle\r\n ) {\r\n this.appLogo = 'assets/images/logo/kiami.png';\r\n this.layout.publishLayoutChange({\r\n sidebarCompactToggle: false\r\n });\r\n } else {\r\n this.appLogo = 'assets/images/logo/icon.png';\r\n this.layout.publishLayoutChange({\r\n // sidebarStyle: \"compact\",\r\n sidebarCompactToggle: true\r\n });\r\n }\r\n }\r\n}\r\n","\r\n","import { Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core';\r\n// import PerfectScrollbar from 'perfect-scrollbar';\r\nimport { NavigationService } from \"../../../shared/services/navigation.service\";\r\nimport { Subscription } from \"rxjs\";\r\n\r\n@Component({\r\n selector: 'app-sidebar-top',\r\n templateUrl: './sidebar-top.component.html'\r\n})\r\nexport class SidebarTopComponent implements OnInit, OnDestroy, AfterViewInit {\r\n // private sidebarPS: PerfectScrollbar;\r\n public menuItems: any[];\r\n private menuItemsSub: Subscription;\r\n constructor(\r\n private navService: NavigationService\r\n ) { }\r\n\r\n ngOnInit() {\r\n this.menuItemsSub = this.navService.menuItems$.subscribe(menuItem => {\r\n this.menuItems = menuItem.filter(item => item.type !== 'icon' && item.type !== 'separator');\r\n });\r\n }\r\n ngAfterViewInit() {\r\n // setTimeout(() => {\r\n // this.sidebarPS = new PerfectScrollbar('#sidebar-top-scroll-area', {\r\n // suppressScrollX: true\r\n // })\r\n // })\r\n }\r\n ngOnDestroy() {\r\n // if(this.sidebarPS) {\r\n // this.sidebarPS.destroy();\r\n // }\r\n if( this.menuItemsSub ) {\r\n this.menuItemsSub.unsubscribe()\r\n }\r\n }\r\n\r\n}\r\n","\r\n","import {CmsFormulario} from 'app/shared/models/cms/cms-formularios';\r\nimport {Component, Input, OnInit} from '@angular/core';\r\nimport {Menu} from 'app/shared/models/aplicacao/menu';\r\nimport {Observable, Subscription} from 'rxjs';\r\nimport {ProcessosClassificacoes} from 'app/shared/models/processos/processosclassificacoes';\r\nimport {Entidades} from 'app/shared/models/clientes/entidades';\r\nimport {ArtigoClassificacao} from 'app/shared/models/artigos/artigo-classificacao';\r\nimport {menuCode} from '../../fake.db/data';\r\nimport {AplicacaoService} from 'app/shared/services/aplicacao-service/aplicacao.service';\r\nimport {ClientesGeraisService} from 'app/shared/services/clientes-service/clientes-gerais.service';\r\n\r\nimport {ArtigosService} from 'app/shared/services/artigos/artigos.service';\r\nimport {ProcessosService} from 'app/shared/services/processos/processos.service';\r\nimport {MenuDataService} from 'app/shared/services/aplicacao-service/data/menu-data.service';\r\nimport {LoginService} from 'app/shared/services/aplicacao-service/login.service';\r\nimport {Utilizadores} from 'app/shared/models/aplicacao/utilizadores';\r\nimport {JwtHelperService} from '@auth0/angular-jwt';\r\nimport {MenuDinamico} from 'app/shared/models/aplicacao/menudinamico';\r\nimport {AppDataService} from 'app/shared/services/data/app-data.service';\r\nimport {CmsPaginaListagem} from 'app/shared/models/cms/cms-paginaListagem';\r\nimport {RecursosHumanosService} from 'app/shared/services/recursos-humanos/recursos-humanos.service';\r\nimport {CmsGeralService} from 'app/shared/services/cms/cms-geral.service';\r\nimport {EqClassificacaoService} from '../../services/equipamentos/eq-classificacao.service';\r\nimport {EqClassificacao} from '../../models/equipamentos/eq-classificacao';\r\nimport {NavigationStart, Router} from '@angular/router';\r\nimport * as moment from 'moment';\r\nimport {AppStoreService} from 'app/shared/services/aplicacao-service/data/app-store.service';\r\nimport {DefinirDadosDoFooterService} from '../footer/definir-dados-do -footer/definir-dados-do-footer.service';\r\nimport {FinancasService} from '../../services/financas/financas.service';\r\nimport {JwtAuthService} from '../../services/auth/jwt-auth.service';\r\nimport {NotificacaoService} from '@services/notificacao/notificacao.service';\r\nimport {PosService} from '@services/pos/pos.service';\r\n\r\n@Component({\r\n selector: 'app-sidenav',\r\n templateUrl: './sidenav.template.html',\r\n styleUrls: ['./sidenav.component.scss']\r\n})\r\nexport class SidenavComponent implements OnInit {\r\n menus: Menu[];\r\n linkUrlRota = '';\r\n idClassRota = '';\r\n // tslint:disable-next-line: no-input-rename\r\n @Input('items') public menuItems: any[] = [];\r\n // tslint:disable-next-line:no-input-rename\r\n @Input('hasIconMenu') public hasIconTypeMenuItem: boolean;\r\n // tslint:disable-next-line:no-input-rename\r\n @Input('iconMenuTitle') public iconTypeMenuTitle: string;\r\n\r\n public listamenus: Menu[] = [];\r\n public listamenu: string[] = [];\r\n public listaMenusObservable$: Observable
;\r\n public clientesEntidades: Entidades[] = [];\r\n public processosClassificacoes: ProcessosClassificacoes[] = [];\r\n public artigosClassificacao: ArtigoClassificacao[] = [];\r\n public idMenuActivo: number;\r\n public idMenuPOSActivo: number;\r\n public idMenuVendaActivo: number;\r\n public PermissoesPOS: any[] = [];\r\n public PermissoesVenda: any[] = [];\r\n\r\n listaMenu: any[] = [];\r\n listaMenuArtigo: any[] = [];\r\n listaMenuProc: MenuDinamico[] = [];\r\n listaMenuEvent: MenuDinamico[] = [];\r\n listaMenuClient: MenuDinamico[] = [];\r\n listaMenuFornecedor: MenuDinamico[] = [];\r\n listaMenuEquipamento: MenuDinamico[] = [];\r\n subscriptions: Subscription[] = [];\r\n codigoMenu = menuCode;\r\n utlizador: any;\r\n jwtHelper = new JwtHelperService();\r\n decodedToken: any;\r\n codigoMenuFinancas = 'FACTUR';\r\n codigoMenuPOS = 'POS';\r\n codigoMenuCompra = 'COMPRA';\r\n codigoMenuTesouraria = 'TESOUR';\r\n codigoMenuArtigos = 'ARTIGO';\r\n codigoMenuProcessos = 'PROCES';\r\n codigoMenuCliente = 'CLIENT';\r\n codigoMenuEvento = 'EVENTO';\r\n codigoMenuCMS = 'GESCON';\r\n codigoMenurRecursosHumanos = 'RECHUM';\r\n codMenuEquipamento = 'EQUATI';\r\n UsaDashboard = false;\r\n usaMenuFacturacao = false;\r\n usaMenuPOS = false;\r\n usaMenuCompra = false;\r\n usaMenuTesouraria = false;\r\n usaMenuArtigo = false;\r\n usaMenuProcesso = false;\r\n usaMenuCliente = false;\r\n usaMenuFornecedor = false;\r\n usaMenuCMS = false;\r\n usaMenuEvento = false;\r\n usaMenuRecursosHumanos = false;\r\n paginas: CmsPaginaListagem[] = [];\r\n gruposRegistos: any[] = [];\r\n listaFormularios: CmsFormulario[] = [];\r\n idIdioma = 1;\r\n rotaActual: string;\r\n listaEstuturasOrganizativas: any[] = [];\r\n listaModulosEventos: any[] = [];\r\n codIdiomaDefoult: any = 'PT';\r\n\r\n ConfiguracaoCMS: any;\r\n galerias: any[] = [];\r\n EmDesenvolvimento = false;\r\n public gereStock = false;\r\n // gereStock = false;\r\n equipamentos: EqClassificacao[] = [];\r\n dadosAplicacao: any;\r\n usaMenuEquipamento: boolean;\r\n confAdm = {\r\n name: 'Conf. {ART}',\r\n type: 'dropDown',\r\n sub: [\r\n {name: 'Famílias', state: 'configuracoes/tipos'},\r\n {name: 'Categorias', state: 'configuracoes/categoria'},\r\n {name: 'Variantes', state: 'configuracoes/variantes/lista'},\r\n {name: 'Estados', state: 'configuracoes/estados'},\r\n {name: 'Tipos de Arquivos', state: 'configuracoes/tiposArquivos'},\r\n {name: 'E-mails', state: 'configuracoes/emails/lista'},\r\n {\r\n name: 'E-mails Automáticos',\r\n state: 'configuracoes/emails/automaticos'\r\n },\r\n {name: 'Ciclos de Renovação', state: 'configuracoes/ciclos'}\r\n ]\r\n };\r\n vendaConfig!: any;\r\n POSCONSCONF: boolean;\r\n\r\n constructor(\r\n private aplicacaoService: AplicacaoService,\r\n private clientesGeraisService: ClientesGeraisService,\r\n private artigosService: ArtigosService,\r\n private processosService: ProcessosService,\r\n private loginService: LoginService,\r\n private menuData: MenuDataService,\r\n private appDataService: AppDataService,\r\n private geralService: CmsGeralService,\r\n public appStore: AppDataService,\r\n private definirDadosDoFooterService: DefinirDadosDoFooterService,\r\n private rota: Router,\r\n private recursosHumanosService: RecursosHumanosService,\r\n private equipamentoClassService: EqClassificacaoService,\r\n private financaService: FinancasService,\r\n private aplicacaoDado: AppStoreService,\r\n private jwtAuthService: JwtAuthService,\r\n private _notificacao: NotificacaoService,\r\n private _posServico: PosService,\r\n ) {\r\n this.appStore.getRotalActual().subscribe((res: any) => {\r\n this.rotaActual = res;\r\n });\r\n this.utlizador = this.loginService.getUtilizadorSessao();\r\n this.getMenusAplicacao();\r\n }\r\n\r\n getPermissoesPOS(utlizador: Utilizadores) {\r\n this._posServico.permissoesUtilizador(utlizador.idUtilizador).subscribe(per => {\r\n this.PermissoesPOS = per?.objecto;\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.getAplicacao();\r\n this.aplicacaoService.gereStock$.subscribe(s => this.gereStock = s);\r\n this.actualizarToken();\r\n this.setRotaActiva();\r\n }\r\n\r\n // A tratar\r\n getAplicacao() {\r\n if (this.aplicacaoDado.aplicacao) {\r\n this.aplicacaoDado.getAplicacao().subscribe(app => {\r\n this.DadosAplicacao(app);\r\n });\r\n } else {\r\n this.aplicacaoService.getAplicacaoGeral().subscribe((res: any) => {\r\n localStorage.setItem('codPais', res?.codPais ? res?.codPais.replace(/\\s/g, '') : '');\r\n localStorage.setItem('gereStocks', res.gereStocks ? res.gereStocks : false);\r\n this.DadosAplicacao(res);\r\n });\r\n }\r\n }\r\n\r\n naturezasActivas(ns: any[]) {\r\n return ns?.filter(n => n.activo) ?? [];\r\n }\r\n\r\n replaceConf(str: string, _class: ArtigoClassificacao) {\r\n return _class?.codNatureza === 'S' && this.getArtigo(6)?.activo && str.includes('Configurações') ?\r\n `Conf. ${_class?.classificacaoP}` : str;\r\n }\r\n\r\n // getPluralizedWord(palavra: string): string {\r\n // return pluralize.plural(palavra, 2, 'pt');\r\n // }\r\n\r\n DadosAplicacao(res) {\r\n if (res) {\r\n this.definirDadosDoFooterService.definirValores({\r\n licencaEmpresa: res?.licencaEmpresa,\r\n aplicacao: res\r\n });\r\n this.dadosAplicacao = res;\r\n this.aplicacaoDado.setAplicacao(this.dadosAplicacao);\r\n if (this.usaMenuPOS && this.dadosAplicacao?.gerePermissoesUtilizador) {\r\n this.getPermissoesPOS(this.utlizador);\r\n }\r\n\r\n this.EmDesenvolvimento = res.codTipoInstalacao === 'D';\r\n this.gereStock = res.gereStocks;\r\n this.jwtAuthService.gerePermissoesUtilizador$.next(res.gerePermissoesUtilizador);\r\n this.aplicacaoService.gereStockBS.next(this.gereStock);\r\n if (this.dadosAplicacao && this.dadosAplicacao.dataValidade) {\r\n const dataValidade = moment(\r\n new Date(this.dadosAplicacao.dataValidade)\r\n );\r\n const dataHoje = moment((new Date()).setHours(0, 0, 0, 0));\r\n const diasEmFalta = dataValidade.diff(dataHoje, 'days');\r\n this.appStore.diasEmFalta.next(diasEmFalta);\r\n if (diasEmFalta < 15) {\r\n this.appStore.$mostrarAviso.next(true);\r\n } else {\r\n this.appStore.$mostrarAviso.next(false);\r\n }\r\n }\r\n localStorage.setItem('__cod__Pais', res.codPais);\r\n localStorage.setItem('moedaEmpresa', res.moeda1);\r\n if (!res.gereMarcacoesArtigos) {\r\n const i = this.menuItems.findIndex(m => m.code === 'MARCA');\r\n if (i > -1) {\r\n this.menuItems.splice(i, 1);\r\n }\r\n }\r\n }\r\n }\r\n\r\n getMenusAplicacao() {\r\n this.menuData.getListaMenus().subscribe((menus) => {\r\n if (menus.length > 0) {\r\n this.listamenus = menus;\r\n this.UsaDashboard = menus.some(m => m.codMenu === 'DASHBO');\r\n this.criarListaMenu(menus);\r\n } else {\r\n this.aplicacaoService.getMenus().subscribe((res) => {\r\n this.listamenus = res;\r\n this.criarListaMenu(res);\r\n this.menuData.setListaMenus(res);\r\n });\r\n }\r\n });\r\n }\r\n\r\n setRotaActiva() {\r\n this.rota.events.subscribe((event: any) => {\r\n if (event instanceof NavigationStart) {\r\n const partesRota = event.url.split('/');\r\n this.linkUrlRota = event.url.split('/')[1];\r\n localStorage.setItem('rotaMenuActivo', this.linkUrlRota);\r\n if (partesRota && partesRota.length > 0) {\r\n localStorage.setItem('idClassRota', partesRota[partesRota.length - 1]);\r\n }\r\n }\r\n });\r\n\r\n if (localStorage.getItem('rotaMenuActivo')) {\r\n this.linkUrlRota = localStorage.getItem('rotaMenuActivo');\r\n this.idClassRota = localStorage.getItem('idClassRota');\r\n }\r\n }\r\n\r\n configuracaoVenda(){\r\n // tslint:disable-next-line:prefer-for-of\r\n this.subscriptions.push(\r\n this.financaService.getConfiguracao().subscribe(c => {\r\n const reno = this.menuItems.find(x => x.code === 'RENOVA');\r\n const ren = this.listamenus.find(x => x.codMenu === 'RENOVA');\r\n const admini = this.menuItems.find(x => x.code === 'ADM');\r\n // TODO: Implementar principio DRY nesta area. By XP //\r\n this.vendaConfig = c.objecto;\r\n if (!this.vendaConfig.usaRenovaveis) {\r\n const i = this.menuItems.indexOf(reno);\r\n if (i > -1) {\r\n this.menuItems.splice(i, 1);\r\n }\r\n } else if (reno) {\r\n reno.name = this.vendaConfig.nomeRenovaveisP;\r\n reno.sub[0].name = this.vendaConfig.nomeRenovaveisP;\r\n if (ren?.menu) {\r\n ren.menu = this.vendaConfig.nomeRenovaveisP;\r\n }\r\n }\r\n\r\n if (!this.vendaConfig.usaAdministrativos) {\r\n const i = this.menuItems.indexOf(admini);\r\n if (i > -1) {\r\n this.menuItems.splice(i, 1);\r\n }\r\n }\r\n })\r\n );\r\n\r\n }\r\n\r\n criarListaMenu(menus: Menu[]) {\r\n\r\n const menu = menus.find(m => m?.codMenu === 'RECHUM');\r\n\r\n if (menu) {\r\n const listaMenusDinamico = menus.find(m => m.codMenu === 'CLIENT')?.menusDinamicos?.filter(m => m.idClassificacao !== 5);\r\n\r\n if (listaMenusDinamico) {\r\n\r\n menus.find(m => m.codMenu === 'CLIENT').menusDinamicos = listaMenusDinamico;\r\n }\r\n }\r\n\r\n for (const element of menus) {\r\n this.listamenu.push(element.codMenu);\r\n if (element.codMenu.toUpperCase() === 'COMUNI') {\r\n this.menuData.moduloComActivo.next(true);\r\n }\r\n if (element.codMenu === this.codigoMenuCliente) {\r\n if (!this.usaMenuCliente) {\r\n this.listaMenuClient = element.menusDinamicos;\r\n this.clientesGeraisService.getEntidades().subscribe((res) => {\r\n this.clientesEntidades = res.objecto;\r\n });\r\n this.usaMenuCliente = true;\r\n }\r\n }\r\n\r\n if (element.codMenu === this.codigoMenuArtigos) {\r\n if (!this.usaMenuArtigo) {\r\n this.listaMenuArtigo = element.menusDinamicos;\r\n this.artigosService.getClassificacoesArtigos().subscribe(\r\n (res) => {\r\n this.artigosClassificacao = res;\r\n });\r\n this.usaMenuArtigo = true;\r\n }\r\n }\r\n\r\n if (element.codMenu === this.codMenuEquipamento) {\r\n if (!this.usaMenuEquipamento) {\r\n this.listaMenuEquipamento = element?.menusDinamicos ?? [];\r\n this.usaMenuEquipamento = true;\r\n this.equipamentoClassService\r\n .getClassificacoes()\r\n .subscribe(x => this.equipamentos = x.objecto.filter(e => e.activo));\r\n }\r\n }\r\n\r\n if (element.codMenu === this.codigoMenuCMS) {\r\n if (!this.usaMenuCMS) {\r\n this.usaMenuCMS = true;\r\n this.getMenusCMS();\r\n }\r\n }\r\n if (element.codMenu === this.codigoMenuProcessos) {\r\n if (!this.usaMenuProcesso) {\r\n this.listaMenuProc = element.menusDinamicos;\r\n this.processosService.getClassificacoes()?.subscribe((res) => {\r\n this.processosClassificacoes = res.objecto;\r\n },\r\n (error) => {\r\n console.log('Erro1', error);\r\n });\r\n this.usaMenuProcesso = true;\r\n this.appDataService.setEstadoModuloProcessos(this.usaMenuProcesso);\r\n }\r\n }\r\n if (element.codMenu === this.codigoMenuFinancas) {\r\n this.usaMenuFacturacao = true;\r\n this.configuracaoVenda();\r\n }\r\n if (element.codMenu === this.codigoMenuCompra) {\r\n this.usaMenuCompra = true;\r\n }\r\n\r\n if (element.codMenu === this.codigoMenuPOS) {\r\n this.usaMenuPOS = true;\r\n }\r\n\r\n\r\n if (element.codMenu === this.codigoMenurRecursosHumanos) {\r\n if (!this.usaMenuRecursosHumanos) {\r\n this.usaMenuRecursosHumanos = true;\r\n this.recursosHumanosService.getListaEstruturasOrgnizativas().subscribe(x => {\r\n this.listaEstuturasOrganizativas = x.objecto.filter(y => y.activo === true);\r\n },\r\n erro => {\r\n });\r\n }\r\n }\r\n\r\n }\r\n }\r\n\r\n\r\n getNomeModulo(idClassificacao?: number): string {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n if (obj && obj.nomeModuloP?.length > 0) {\r\n return obj.nomeModuloP;\r\n } else {\r\n return 'Módulos';\r\n }\r\n }\r\n return 'Módulos';\r\n }\r\n\r\n getNomeEvento(idClassificacao?: number): string {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n if (obj && obj?.nomeEventoP?.length > 0) {\r\n return obj?.nomeEventoP;\r\n } else {\r\n return obj?.classificacaoP;\r\n }\r\n }\r\n return '';\r\n }\r\n\r\n getNomeRealizacao(idClassificacao?: number): string {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n if (obj && obj?.nomeRealizacaoP?.length > 0) {\r\n return obj?.nomeRealizacaoP;\r\n } else {\r\n return obj?.classificacaoP;\r\n }\r\n }\r\n return '';\r\n }\r\n\r\n getEquipamento(id: number) {\r\n return this.equipamentos.find(x => x.id === id);\r\n }\r\n\r\n usarModulo(idClassificacao: number): boolean {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n if (obj && obj.idOpcModulos > 1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n multiplasRealizacoes(idClassificacao: number): boolean {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n if (obj?.multiplasRealizacoes) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n usaInscricao(idClassificacao: number): boolean {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n return obj && obj.idOpcInscricoes > 1;\r\n }\r\n return false;\r\n }\r\n\r\n opcaoCertificado(idClassificacao: number): boolean {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n return obj && obj.idOpcCertificados > 1;\r\n }\r\n return false;\r\n }\r\n\r\n Formacao(idClassificacao: number): boolean {\r\n if (idClassificacao > 0) {\r\n const obj = this.listaModulosEventos?.find(x => x.idClassificacao === idClassificacao);\r\n return obj && obj.codNatureza === 'F';\r\n }\r\n return false;\r\n }\r\n\r\n getMenuNaoDinamico(codMenu: string, i): boolean {\r\n return !this.listamenus.find((m) => m.codMenu === codMenu)?.dinamico;\r\n }\r\n\r\n getCliente(idEntidade: number): Entidades {\r\n if (this.clientesEntidades) {\r\n return this.clientesEntidades?.find((m) => m.idEntidade === idEntidade);\r\n }\r\n return null;\r\n }\r\n\r\n getArtigo(idClassificacao: number): ArtigoClassificacao {\r\n return this.artigosClassificacao?.find(m => m.idClassificacao === idClassificacao) ?? null;\r\n }\r\n\r\n getProcessos(idClassificacao: number): ProcessosClassificacoes {\r\n if (this.processosClassificacoes) {\r\n return this.processosClassificacoes.find(\r\n (m) => m.idClassificacao === idClassificacao\r\n );\r\n }\r\n return null;\r\n }\r\n\r\n getConfiguracaoVenda() {\r\n\r\n }\r\n\r\n getMenu(codMenu: string): Menu {\r\n return this.listamenus.find((m) => m.codMenu === codMenu);\r\n }\r\n\r\n async actualizarToken() {\r\n const token = localStorage.getItem('token');\r\n this.decodedToken = await this.jwtHelper.decodeToken(token);\r\n this.loginService.decodedToken = this.decodedToken;\r\n }\r\n\r\n getMenusCMS() {\r\n this.geralService.getMenusCMS().subscribe((res: any) => {\r\n const dadosMenu = res?.objecto;\r\n this.paginas = dadosMenu?.paginas;\r\n this.gruposRegistos = [...dadosMenu?.gruposRegistos];\r\n this.listaFormularios = dadosMenu?.listaFormularios;\r\n this.galerias = dadosMenu?.galerias;\r\n this.ConfiguracaoCMS = dadosMenu?.configuracaoCMS;\r\n });\r\n }\r\n\r\n // Only for demo purpose\r\n addMenuItem() {\r\n this.menuItems.push({\r\n name: 'ITEM',\r\n type: 'dropDown',\r\n tooltip: 'Item',\r\n icon: 'done',\r\n state: 'material',\r\n sub: [\r\n {name: 'SUBITEM', state: 'cards'},\r\n {name: 'SUBITEM', state: 'buttons'}\r\n ]\r\n });\r\n }\r\n\r\n activarDropDown(id: number, state?: string, rota?: string) {\r\n if (this.idMenuActivo === id) {\r\n return (this.idMenuActivo = null);\r\n }\r\n return (this.idMenuActivo = id);\r\n }\r\n\r\n activarDropDownPos(id: number, state?: string) {\r\n if (this.PermissoesPOS?.length <= 0 && !this.utlizador?.sisAdmin && this.dadosAplicacao?.gerePermissoesUtilizador) {\r\n this._notificacao.notificar('Sem permissão POS', false, 5000);\r\n this.idMenuPOSActivo = null;\r\n return;\r\n }\r\n\r\n if (this.idMenuPOSActivo === id) {\r\n return (this.idMenuPOSActivo = null);\r\n }\r\n return (this.idMenuPOSActivo = id);\r\n }\r\n\r\n activarDropDownVenda(id: number, state?: string) {\r\n if (this.PermissoesVenda?.length <= 0 && !this.utlizador?.sisAdmin && this.dadosAplicacao?.gerePermissoesUtilizador) {\r\n this._notificacao.notificar('Sem permissões de Venda!', false, 5000);\r\n this.idMenuVendaActivo = null;\r\n return;\r\n }\r\n\r\n if (this.idMenuVendaActivo === id) {\r\n return (this.idMenuVendaActivo = null);\r\n }\r\n return (this.idMenuVendaActivo = id);\r\n }\r\n\r\n consultarVenda(subMenu: string) {\r\n console.log('Consultar doc', subMenu);\r\n }\r\n\r\n\r\n consultarConfPOS() {\r\n if (this.PermissoesPOS?.filter(p => p.codPermissao === 'POCONSCONF')?.length > 0 || this.utlizador?.sisAdmin || !this.dadosAplicacao?.gerePermissoesUtilizador) {\r\n this.POSCONSCONF = true;\r\n } else {\r\n this._notificacao.notificar('Sem permissão para consultar as configurações do POS!', false, 5000);\r\n }\r\n }\r\n\r\n openFullScreen() {\r\n\r\n }\r\n}\r\n","\r\n
\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n
\r\n
\r\n
","import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';\r\nimport {AccaoEntidade} from '../../models/clientes/accao-entidade';\r\nimport {Entidades} from '../../models/clientes/entidades';\r\n\r\n@Component({\r\n // tslint:disable-next-line:component-selector\r\n selector: 'accoes-multiplas-tabela',\r\n template: `\r\n \r\n \r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n\r\n \r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n\r\n \r\n\r\n \r\n \r\n\r\n\r\n
\r\n\r\n
\r\n\r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n \r\n\r\n \r\n
\r\n
\r\n \r\n `\r\n// tslint:disable-next-line:component-class-suffix\r\n})\r\nexport class TabAccoesMultiplas implements OnChanges, OnInit {\r\n @Output() aoEnviarEmail: EventEmitter = new EventEmitter();\r\n @Output() aoImprimir: EventEmitter = new EventEmitter();\r\n @Output() aoImprimirEtiqueta: EventEmitter = new EventEmitter();\r\n @Output() aoDeletar: EventEmitter = new EventEmitter();\r\n @Output() aoRemover: EventEmitter = new EventEmitter();\r\n @Output() aoAdicionar: EventEmitter = new EventEmitter();\r\n @Output() aoExportarExcel: EventEmitter = new EventEmitter();\r\n @Output() aoImportarExcel: EventEmitter = new EventEmitter();\r\n @Output() aoExportarPDF: EventEmitter = new EventEmitter();\r\n @Output() aoNavegarRota: EventEmitter = new EventEmitter();\r\n @Output() aoAvaliar: EventEmitter = new EventEmitter();\r\n @Output() aoPagarDocumento: EventEmitter = new EventEmitter();\r\n @Output() aoFiltrar: EventEmitter = new EventEmitter();\r\n @Output() aoLimpar: EventEmitter = new EventEmitter();\r\n @Output() aoMudarLista: EventEmitter = new EventEmitter();\r\n\r\n @Input() podeEliminar: boolean;\r\n @Input() podeImprimir: boolean;\r\n @Input() podeExportarExcel: boolean;\r\n @Input() podeImportarExcel: boolean;\r\n @Input() podeExportarPDF: boolean;\r\n @Input() podeEnviarEmail: boolean;\r\n @Input() podeImprimirEtiqueta: boolean;\r\n @Input() podePagarDoc: boolean;\r\n @Input() podeCriarItem: boolean;\r\n @Input() podeAddItem: boolean;\r\n @Input() podeMudarLista: boolean;\r\n @Input() podeFiltrar: boolean;\r\n @Input() podeLimpar: boolean;\r\n @Input() podeMudarListaComMenu: boolean;\r\n @Input() mostrarBtnCriar = true;\r\n @Input() mostrarBtnAdd = false;\r\n @Input() accaoEntidade: AccaoEntidade;\r\n @Input() listaAccoes: AccaoEntidade[] = [];\r\n @Input() podeInserirCLI;\r\n @Input() mostrarAvaliacao: boolean;\r\n @Input() entidade: Entidades;\r\n @Input() tituloBtn: string;\r\n @Input() tituloBtnAdd: string;\r\n @Input() rotaItem: string;\r\n @Input() indiceTab: number;\r\n icon = '';\r\n iconLista: any = {\r\n 1: 'list',\r\n 2: 'view_list',\r\n 3: 'grid_view'\r\n };\r\n\r\n ngOnInit() {\r\n this.icon = this.iconLista[this.indiceTab];\r\n }\r\n\r\n enviarEmail() {\r\n this.aoEnviarEmail.emit(true);\r\n }\r\n\r\n pagarDocumento() {\r\n this.aoPagarDocumento.emit(true);\r\n }\r\n\r\n remover() {\r\n this.aoRemover.emit(true);\r\n }\r\n\r\n adicionar() {\r\n this.aoAdicionar.emit();\r\n }\r\n\r\n deletar() {\r\n this.aoDeletar.emit(true);\r\n }\r\n\r\n exportarExcel() {\r\n this.aoExportarExcel.emit(true);\r\n }\r\n\r\n exportarPDF() {\r\n this.aoExportarPDF.emit(true);\r\n }\r\n\r\n mudarLista(indice: number, icon: string) {\r\n this.icon = this.iconLista[indice];\r\n this.aoMudarLista.emit(indice);\r\n }\r\n\r\n navegar() {\r\n this.aoNavegarRota.emit(true);\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n }\r\n\r\n}\r\n","import {Component, EventEmitter, forwardRef, Input, OnChanges, Output, SimpleChanges} from '@angular/core';\r\nimport {AbstractControl, ControlValueAccessor, NG_VALUE_ACCESSOR, Validator} from '@angular/forms';\r\nimport {Country} from '../../models/artigos/country-code-json/country-cod';\r\nimport {Paises} from '../../models/aplicacao/paises';\r\nimport {Accao} from '../../models/ENUM';\r\n\r\n@Component({\r\n selector: 'app-phone',\r\n template: `\r\n \r\n
\r\n \r\n
\r\n \r\n {{ label }}\r\n \r\n \r\n
\r\n
\r\n `,\r\n styles: [\r\n `\r\n .label-indicativo {\r\n height: 35px;\r\n border-radius: 0.4em 0 0 0.4em;\r\n border: 1px solid rgba(0, 0, 0, 0.15) !important;\r\n display: inline-flex;\r\n justify-content: center;\r\n align-items: center;\r\n background: #ffffff !important;\r\n padding-left: 5px !important;\r\n padding-right: 2px !important;\r\n min-width: 90px;\r\n }\r\n\r\n #telefone {\r\n display: inline-flex;\r\n align-items: center;\r\n width: 100%;\r\n }\r\n `,\r\n ],\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => PhoneComponent),\r\n multi: true,\r\n },\r\n ],\r\n})\r\nexport class PhoneComponent implements ControlValueAccessor, OnChanges, Validator {\r\n @Input() paises: Paises[] = [{idPais:6,codPais:\"AO\",pais:\"Angola\",nacionalidade:\"Angolana\",naturalidade:\"Angolana\",indicativo:\"+244\"},{idPais:1,codPais:\"AF\",pais:\"Afeganistão\",nacionalidade:\"Afegã\",naturalidade:\"Afegã\",indicativo:\"+93\"},{idPais:2,codPais:\"ZA\",pais:\"África do Sul\",nacionalidade:\"Sul- Africana\",naturalidade:\"Sul- Africana\",indicativo:\"+27\"},{idPais:3,codPais:\"AL\",pais:\"Albânia\",nacionalidade:\"Albanês\",naturalidade:\"Albanês\",indicativo:\"+355\"},{idPais:4,codPais:\"DE\",pais:\"Alemanha\",nacionalidade:\"Alemã\",naturalidade:\"Alemã\",indicativo:\"+49\"},{idPais:5,codPais:\"AD\",pais:\"Andorra\",nacionalidade:\"Andorrana\",naturalidade:\"Andorrana\",indicativo:\"+376\"},{idPais:7,codPais:\"AG\",pais:\"Antiga e Barbuda\",nacionalidade:\"Antiguana\",naturalidade:\"Antiguana\",indicativo:\"+1268\"},{idPais:8,codPais:\"SA\",pais:\"Arábia Saudita\",nacionalidade:\"Árabe \",naturalidade:\"Árabe \",indicativo:\"+966\"},{idPais:9,codPais:\"DZ\",pais:\"Argélia\",nacionalidade:\"Argelina\",naturalidade:\"Argelina\",indicativo:\"+213\"},{idPais:10,codPais:\"AR\",pais:\"Argentina\",nacionalidade:\"Argentina\",naturalidade:\"Argentina\",indicativo:\"+54\"},{idPais:11,codPais:\"AM\",pais:\"Arménia\",nacionalidade:\"Armenia\",naturalidade:\"Armenia\",indicativo:\"+374\"},{idPais:12,codPais:\"AU\",pais:\"Austrália\",nacionalidade:\"Australiana\",naturalidade:\"Australiana\",indicativo:\"+61\"},{idPais:13,codPais:\"AT\",pais:\"Áustria\",nacionalidade:\"Austriaca\",naturalidade:\"Austriaca\",indicativo:\"+43\"},{idPais:14,codPais:\"AZ\",pais:\"Azerbaijão\",nacionalidade:\"Azeri\",naturalidade:\"Azeri\",indicativo:\"+994\"},{idPais:15,codPais:\"BS\",pais:\"Bahamas\",nacionalidade:\"Bahamense\",naturalidade:\"Bahamense\",indicativo:\"+1242\"},{idPais:16,codPais:\"BD\",pais:\"Bangladesh\",nacionalidade:\"Bangladês\",naturalidade:\"Bangladês\",indicativo:\"+880\"},{idPais:17,codPais:\"BB\",pais:\"Barbados\",nacionalidade:\"Barbadiana\",naturalidade:\"Barbadiana\",indicativo:\"+1246\"},{idPais:18,codPais:\"BH\",pais:\"Barém\",nacionalidade:\"Baremita\",naturalidade:\"Baremita\",indicativo:\"+973\"},{idPais:19,codPais:\"BE\",pais:\"Bélgica\",nacionalidade:\"Belga\",naturalidade:\"Belga\",indicativo:\"+32\"},{idPais:20,codPais:\"BZ\",pais:\"Belize\",nacionalidade:\"Belizenha\",naturalidade:\"Belizenha\",indicativo:\"+501\"},{idPais:21,codPais:\"BJ\",pais:\"Benim\",nacionalidade:\"Beninense\",naturalidade:\"Beninense\",indicativo:\"+229\"},{idPais:22,codPais:\"BY\",pais:\"Bielorrússia\",nacionalidade:\"Bielorussa\",naturalidade:\"Bielorussa\",indicativo:\"+375\"},{idPais:23,codPais:\"BO\",pais:\"Bolívia\",nacionalidade:\"Boliviana\",naturalidade:\"Boliviana\",indicativo:\"+591\"},{idPais:24,codPais:\"BA\",pais:\"Bósnia e Herzegovina\",nacionalidade:\"Bósnia\",naturalidade:\"Bósnia\",indicativo:\"+387\"},{idPais:25,codPais:\"BW\",pais:\"Botsuana\",nacionalidade:\"Bechuana\",naturalidade:\"Bechuana\",indicativo:\"+267\"},{idPais:26,codPais:\"BR\",pais:\"Brasil\",nacionalidade:\"Brasileira\",naturalidade:\"Brasileira\",indicativo:\"+55\"},{idPais:27,codPais:\"BN\",pais:\"Brunei\",nacionalidade:\"Bruneana\",naturalidade:\"Bruneana\",indicativo:\"+673\"},{idPais:28,codPais:\"BG\",pais:\"Bulgária\",nacionalidade:\"Búlgara\",naturalidade:\"Búlgara\",indicativo:\"+359\"},{idPais:29,codPais:\"BF\",pais:\"Burquina Faso\",nacionalidade:\"Burquinense\",naturalidade:\"Burquinense\",indicativo:\"+226\"},{idPais:30,codPais:\"BI\",pais:\"Burúndi\",nacionalidade:\"Burundês\",naturalidade:\"Burundês\",indicativo:\"+257\"},{idPais:31,codPais:\"BT\",pais:\"Butão\",nacionalidade:\"Butanense\",naturalidade:\"Butanense\",indicativo:\"+975\"},{idPais:32,codPais:\"CV\",pais:\"Cabo Verde\",nacionalidade:\"Cabo-veridiana\",naturalidade:\"Cabo-veridiana\",indicativo:\"+238\"},{idPais:33,codPais:\"CM\",pais:\"Camarões\",nacionalidade:\"Camaronense\",naturalidade:\"Camaronense\",indicativo:\"+237\"},{idPais:34,codPais:\"KH\",pais:\"Camboja\",nacionalidade:\"Cambojana\",naturalidade:\"Cambojana\",indicativo:\"+855\"},{idPais:35,codPais:\"CA\",pais:\"Canadá\",nacionalidade:\"Canadense\",naturalidade:\"Canadense\",indicativo:\"+1\"},{idPais:36,codPais:\"QA\",pais:\"Catar\",nacionalidade:\"Catarense\",naturalidade:\"Catarense\",indicativo:\"+974\"},{idPais:37,codPais:\"KZ\",pais:\"Cazaquistão\",nacionalidade:\"Cazaque\",naturalidade:\"Cazaque\",indicativo:\"+77\"},{idPais:38,codPais:\"TD\",pais:\"Chade\",nacionalidade:\"Chadiana\",naturalidade:\"Chadiana\",indicativo:\"+235\"},{idPais:39,codPais:\"CL\",pais:\"Chile\",nacionalidade:\"Chilena\",naturalidade:\"Chilena\",indicativo:\"+56\"},{idPais:40,codPais:\"CN\",pais:\"China\",nacionalidade:\"Chinesa\",naturalidade:\"Chinesa\",indicativo:\"+86\"},{idPais:41,codPais:\"CY\",pais:\"Chipre\",nacionalidade:\"Cipriota\",naturalidade:\"Cipriota\",indicativo:\"+357\"},{idPais:42,codPais:\"CO\",pais:\"Colômbia\",nacionalidade:\"Colombiana\",naturalidade:\"Colombiana\",indicativo:\"+57\"},{idPais:43,codPais:\"KM\",pais:\"Comores\",nacionalidade:\"Comoriana\",naturalidade:\"Comoriana\",indicativo:\"+269\"},{idPais:44,codPais:\"CG\",pais:\"Congo-Brazzaville\",nacionalidade:\"Congolesa\",naturalidade:\"Congolesa\",indicativo:\"+242\"},{idPais:45,codPais:\"KP\",pais:\"Coreia do Norte\",nacionalidade:\"Norte-Coreana\",naturalidade:\"Norte-Coreana\",indicativo:\"+850\"},{idPais:46,codPais:\"KR\",pais:\"Coreia do Sul\",nacionalidade:\"Sul-Coreana\",naturalidade:\"Sul-Coreana\",indicativo:\"+82\"},{idPais:47,codPais:\"- \",pais:\"Cosovo\",nacionalidade:\"Cosovar\",naturalidade:\"Cosovar\",indicativo:null},{idPais:48,codPais:\"CI\",pais:\"Costa do Marfim\",nacionalidade:\"Costa Marfinense\",naturalidade:\"Costa Marfinense\",indicativo:\"+225\"},{idPais:49,codPais:\"CR\",pais:\"Costa Rica\",nacionalidade:\"Costa-riquenha\",naturalidade:\"Costa-riquenha\",indicativo:\"+506\"},{idPais:50,codPais:\"HR\",pais:\"Croácia\",nacionalidade:\"Croata\",naturalidade:\"Croata\",indicativo:\"+385\"},{idPais:51,codPais:\"KW\",pais:\"Cuaite\",nacionalidade:\"Cuaitiana\",naturalidade:\"Cuaitiana\",indicativo:\"+965\"},{idPais:52,codPais:\"CU\",pais:\"Cuba\",nacionalidade:\"Cubana\",naturalidade:\"Cubana\",indicativo:\"+53\"},{idPais:53,codPais:\"DK\",pais:\"Dinamarca\",nacionalidade:\"Dinamarquesa\",naturalidade:\"Dinamarquesa\",indicativo:\"+45\"},{idPais:54,codPais:\"DM\",pais:\"Dominica\",nacionalidade:\"Dominiquense\",naturalidade:\"Dominiquense\",indicativo:\"+1767\"},{idPais:55,codPais:\"EG\",pais:\"Egito\",nacionalidade:\"Egípcia\",naturalidade:\"Egípcia\",indicativo:\"+20\"},{idPais:56,codPais:\"AE\",pais:\"Emirados Árabes Unidos\",nacionalidade:\"Árabe \",naturalidade:\"Árabe \",indicativo:\"+971\"},{idPais:57,codPais:\"EC\",pais:\"Equador\",nacionalidade:\"Equatoriana\",naturalidade:\"Equatoriana\",indicativo:\"+593\"},{idPais:58,codPais:\"ER\",pais:\"Eritreia\",nacionalidade:\"Eritreu\",naturalidade:\"Eritreu\",indicativo:\"+291\"},{idPais:59,codPais:\"SK\",pais:\"Eslováquia\",nacionalidade:\"Eslovaca\",naturalidade:\"Eslovaca\",indicativo:\"+421\"},{idPais:60,codPais:\"SI\",pais:\"Eslovénia\",nacionalidade:\"Eslovena\",naturalidade:\"Eslovena\",indicativo:\"+386\"},{idPais:61,codPais:\"ES\",pais:\"Espanha\",nacionalidade:\"Espanhola\",naturalidade:\"Espanhola\",indicativo:\"+34\"},{idPais:62,codPais:\"PS\",pais:\"Estado da Palestina\",nacionalidade:\"Palestina \",naturalidade:\"Palestina \",indicativo:\"+970\"},{idPais:63,codPais:\"US\",pais:\"Estados Unidos\",nacionalidade:\"Americana \",naturalidade:\"Americana \",indicativo:\"+1\"},{idPais:64,codPais:\"EE\",pais:\"Estónia\",nacionalidade:\"Estoniana\",naturalidade:\"Estoniana\",indicativo:\"+372\"},{idPais:65,codPais:\"ET\",pais:\"Etiópia\",nacionalidade:\"Etíope\",naturalidade:\"Etíope\",indicativo:\"+251\"},{idPais:66,codPais:\"FJ\",pais:\"Fiji\",nacionalidade:\"Fijiana \",naturalidade:\"Fijiana \",indicativo:\"+679\"},{idPais:67,codPais:\"PH\",pais:\"Filipinas\",nacionalidade:\"Filipina\",naturalidade:\"Filipina\",indicativo:\"+63\"},{idPais:68,codPais:\"FI\",pais:\"Finlândia\",nacionalidade:\"Filandesa\",naturalidade:\"Filandesa\",indicativo:\"+358\"},{idPais:69,codPais:\"FR\",pais:\"França\",nacionalidade:\"Francesa\",naturalidade:\"Francesa\",indicativo:\"+33\"},{idPais:70,codPais:\"GA\",pais:\"Gabão\",nacionalidade:\"Gabonense\",naturalidade:\"Gabonense\",indicativo:\"+241\"},{idPais:71,codPais:\"GM\",pais:\"Gâmbia\",nacionalidade:\"Gambiana\",naturalidade:\"Gambiana\",indicativo:\"+220\"},{idPais:72,codPais:\"GH\",pais:\"Gana\",nacionalidade:\"Ganense\",naturalidade:\"Ganense\",indicativo:\"+233\"},{idPais:73,codPais:\"GE\",pais:\"Geórgia\",nacionalidade:\"Geórgica\",naturalidade:\"Geórgica\",indicativo:\"+995\"},{idPais:74,codPais:\"GD\",pais:\"Granada\",nacionalidade:\"Granadina\",naturalidade:\"Granadina\",indicativo:\"+1473\"},{idPais:75,codPais:\"GR\",pais:\"Grécia\",nacionalidade:\"Grega\",naturalidade:\"Grega\",indicativo:\"+30\"},{idPais:76,codPais:\"GT\",pais:\"Guatemala\",nacionalidade:\"Guatemalteca\",naturalidade:\"Guatemalteca\",indicativo:\"+502\"},{idPais:77,codPais:\"GY\",pais:\"Guiana\",nacionalidade:\"Guianense\",naturalidade:\"Guianense\",indicativo:\"+595\"},{idPais:78,codPais:\"GN\",pais:\"Guiné\",nacionalidade:\"Guineana\",naturalidade:\"Guineana\",indicativo:\"+224\"},{idPais:79,codPais:\"GQ\",pais:\"Guiné Equatorial\",nacionalidade:\"Guiné-Equatoriana\",naturalidade:\"Guiné-Equatoriana\",indicativo:\"+240\"},{idPais:80,codPais:\"GW\",pais:\"Guiné-Bissau\",nacionalidade:\"Guineense\",naturalidade:\"Guineense\",indicativo:\"+245\"},{idPais:81,codPais:\"HT\",pais:\"Haiti\",nacionalidade:\"Haitiana\",naturalidade:\"Haitiana\",indicativo:\"+509\"},{idPais:82,codPais:\"HN\",pais:\"Honduras\",nacionalidade:\"Hondurenha\",naturalidade:\"Hondurenha\",indicativo:\"+504\"},{idPais:83,codPais:\"HU\",pais:\"Hungria\",nacionalidade:\"Hungara\",naturalidade:\"Hungara\",indicativo:\"+36\"},{idPais:84,codPais:\"YE\",pais:\"Iémen\",nacionalidade:\"Iemenita\",naturalidade:\"Iemenita\",indicativo:\"+967\"},{idPais:198,codPais:\"KY\",pais:\"Ilhas Caimão\",nacionalidade:\"Caimanense\",naturalidade:\"Caimanense\",indicativo:\"+ 345\"},{idPais:85,codPais:\"MH\",pais:\"Ilhas Marechal\",nacionalidade:\"Marechalina\",naturalidade:\"Marechalina\",indicativo:\"+692\"},{idPais:86,codPais:\"IN\",pais:\"Índia\",nacionalidade:\"Indiana\",naturalidade:\"Indiana\",indicativo:\"+91\"},{idPais:87,codPais:\"ID\",pais:\"Indonésia\",nacionalidade:\"Indonesa\",naturalidade:\"Indonesa\",indicativo:\"+62\"},{idPais:88,codPais:\"IR\",pais:\"Irão\",nacionalidade:\"Iraniana\",naturalidade:\"Iraniana\",indicativo:\"+98\"},{idPais:89,codPais:\"IQ\",pais:\"Iraque\",nacionalidade:\"Iraquiana\",naturalidade:\"Iraquiana\",indicativo:\"+964\"},{idPais:90,codPais:\"IE\",pais:\"Irlanda\",nacionalidade:\"Irlandesa\",naturalidade:\"Irlandesa\",indicativo:\"+353\"},{idPais:91,codPais:\"IS\",pais:\"Islândia\",nacionalidade:\"Islandesa\",naturalidade:\"Islandesa\",indicativo:\"+354\"},{idPais:92,codPais:\"IL\",pais:\"Israel\",nacionalidade:\"Israelense\",naturalidade:\"Israelense\",indicativo:\"+972\"},{idPais:93,codPais:\"IT\",pais:\"Itália\",nacionalidade:\"Italiana\",naturalidade:\"Italiana\",indicativo:\"+39\"},{idPais:94,codPais:\"JM\",pais:\"Jamaica\",nacionalidade:\"Jamaicana\",naturalidade:\"Jamaicana\",indicativo:\"+1876\"},{idPais:95,codPais:\"JP\",pais:\"Japão\",nacionalidade:\"Japonesa\",naturalidade:\"Japonesa\",indicativo:\"+81\"},{idPais:96,codPais:\"DJ\",pais:\"Jibuti\",nacionalidade:\"Jibutiana\",naturalidade:\"Jibutiana\",indicativo:\"+253\"},{idPais:97,codPais:\"JO\",pais:\"Jordânia\",nacionalidade:\"Jordão\",naturalidade:\"Jordão\",indicativo:\"+962\"},{idPais:98,codPais:\"LA\",pais:\"Laos\",nacionalidade:\"Laosiana\",naturalidade:\"Laosiana\",indicativo:\"+856\"},{idPais:99,codPais:\"LS\",pais:\"Lesoto\",nacionalidade:\"Lesotiana\",naturalidade:\"Lesotiana\",indicativo:\"+266\"},{idPais:100,codPais:\"LV\",pais:\"Letónia\",nacionalidade:\"Letoniana\",naturalidade:\"Letoniana\",indicativo:\"+371\"},{idPais:101,codPais:\"LB\",pais:\"Líbano\",nacionalidade:\"Libanesa\",naturalidade:\"Libanesa\",indicativo:\"+961\"},{idPais:102,codPais:\"LR\",pais:\"Libéria\",nacionalidade:\"Liberiana\",naturalidade:\"Liberiana\",indicativo:\"+231\"},{idPais:103,codPais:\"LY\",pais:\"Líbia\",nacionalidade:\"Líbia\",naturalidade:\"Líbia\",indicativo:\"+218\"},{idPais:104,codPais:\"LI\",pais:\"Listenstaine\",nacionalidade:\"Listenstainense\",naturalidade:\"Listenstainense\",indicativo:\"+423\"},{idPais:105,codPais:\"LT\",pais:\"Lituânia\",nacionalidade:\"Lituana\",naturalidade:\"Lituana\",indicativo:\"+370\"},{idPais:106,codPais:\"LU\",pais:\"Luxemburgo\",nacionalidade:\"Luxemburguesa\",naturalidade:\"Luxemburguesa\",indicativo:\"+352\"},{idPais:107,codPais:\"MK\",pais:\"Macedónia\",nacionalidade:\"Macedônia\",naturalidade:\"Macedônia\",indicativo:\"+389\"},{idPais:108,codPais:\"MG\",pais:\"Madagáscar\",nacionalidade:\"Madagascarense\",naturalidade:\"Madagascarense\",indicativo:\"+261\"},{idPais:109,codPais:\"MY\",pais:\"Malásia\",nacionalidade:\"Malaia\",naturalidade:\"Malaia\",indicativo:\"+60\"},{idPais:110,codPais:\"MW\",pais:\"Maláui\",nacionalidade:\"Malauiana\",naturalidade:\"Malauiana\",indicativo:\"+265\"},{idPais:111,codPais:\"MV\",pais:\"Maldivas\",nacionalidade:\"Maldiva\",naturalidade:\"Maldiva\",indicativo:\"+960\"},{idPais:112,codPais:\"ML\",pais:\"Mali\",nacionalidade:\"Maliana\",naturalidade:\"Maliana\",indicativo:\"+223\"},{idPais:113,codPais:\"MT\",pais:\"Malta\",nacionalidade:\"Maltês\",naturalidade:\"Maltês\",indicativo:\"+356\"},{idPais:114,codPais:\"MA\",pais:\"Marrocos\",nacionalidade:\"Marroquina\",naturalidade:\"Marroquina\",indicativo:\"+212\"},{idPais:115,codPais:\"MU\",pais:\"Maurícia\",nacionalidade:\"Mauriciana\",naturalidade:\"Mauriciana\",indicativo:\"+230\"},{idPais:116,codPais:\"MR\",pais:\"Mauritânia\",nacionalidade:\"Mauritana\",naturalidade:\"Mauritana\",indicativo:\"+222\"},{idPais:117,codPais:\"MX\",pais:\"México\",nacionalidade:\"Mexicana\",naturalidade:\"Mexicana\",indicativo:\"+52\"},{idPais:118,codPais:\"MM\",pais:\"Mianmar\",nacionalidade:\"Birmanesa\",naturalidade:\"Birmanesa\",indicativo:\"+95\"},{idPais:119,codPais:\"FM\",pais:\"Micronésia\",nacionalidade:\"Micronésia\",naturalidade:\"Micronésia\",indicativo:\"+691\"},{idPais:120,codPais:\"MZ\",pais:\"Moçambique\",nacionalidade:\"Moçambicana\",naturalidade:\"Moçambicana\",indicativo:\"+258\"},{idPais:121,codPais:\"MD\",pais:\"Moldávia\",nacionalidade:\"Moldávia\",naturalidade:\"Moldávia\",indicativo:\"+373\"},{idPais:122,codPais:\"MC\",pais:\"Mónaco\",nacionalidade:\"Monegasca\",naturalidade:\"Monegasca\",indicativo:\"+377\"},{idPais:123,codPais:\"MN\",pais:\"Mongólia\",nacionalidade:\"Mongol\",naturalidade:\"Mongol\",indicativo:\"+976\"},{idPais:124,codPais:\"ME\",pais:\"Montenegro\",nacionalidade:\"Montenegrina\",naturalidade:\"Montenegrina\",indicativo:\"+382\"},{idPais:125,codPais:\"NA\",pais:\"Namíbia\",nacionalidade:\"Namibiana\",naturalidade:\"Namibiana\",indicativo:\"+264\"},{idPais:126,codPais:\"NR\",pais:\"Nauru\",nacionalidade:\"Nauruana\",naturalidade:\"Nauruana\",indicativo:\"+674\"},{idPais:127,codPais:\"NP\",pais:\"Nepal\",nacionalidade:\"Nepalesa\",naturalidade:\"Nepalesa\",indicativo:\"+977\"},{idPais:128,codPais:\"NI\",pais:\"Nicarágua\",nacionalidade:\"Nicaraguense\",naturalidade:\"Nicaraguense\",indicativo:\"+505\"},{idPais:129,codPais:\"NE\",pais:\"Níger\",nacionalidade:\"Nigerina\",naturalidade:\"Nigerina\",indicativo:\"+227\"},{idPais:130,codPais:\"NG\",pais:\"Nigéria\",nacionalidade:\"Nigeriana\",naturalidade:\"Nigeriana\",indicativo:\"+234\"},{idPais:131,codPais:\"NO\",pais:\"Noruega\",nacionalidade:\"Noroeguesa\",naturalidade:\"Noroeguesa\",indicativo:\"+47\"},{idPais:132,codPais:\"NZ\",pais:\"Nova Zelândia\",nacionalidade:\"Neozelandesa\",naturalidade:\"Neozelandesa\",indicativo:\"+64\"},{idPais:133,codPais:\"OM\",pais:\"Omã\",nacionalidade:\"Omanense\",naturalidade:\"Omanense\",indicativo:\"+968\"},{idPais:134,codPais:\"NL\",pais:\"Países Baixos\",nacionalidade:\"Holandesa\",naturalidade:\"Holandesa\",indicativo:\"+31\"},{idPais:135,codPais:\"PW\",pais:\"Palau\",nacionalidade:\"Palauense\",naturalidade:\"Palauense\",indicativo:\"+680\"},{idPais:136,codPais:\"PA\",pais:\"Panamá\",nacionalidade:\"Panamenha\",naturalidade:\"Panamenha\",indicativo:\"+507\"},{idPais:137,codPais:\"PG\",pais:\"Papua Nova Guiné\",nacionalidade:\"Papuásia\",naturalidade:\"Papuásia\",indicativo:\"+675\"},{idPais:138,codPais:\"PK\",pais:\"Paquistão\",nacionalidade:\"Paquistanesa\",naturalidade:\"Paquistanesa\",indicativo:\"+92\"},{idPais:139,codPais:\"PY\",pais:\"Paraguai\",nacionalidade:\"Paraguaia\",naturalidade:\"Paraguaia\",indicativo:\"+595\"},{idPais:140,codPais:\"PE\",pais:\"Peru\",nacionalidade:\"Peruana\",naturalidade:\"Peruana\",indicativo:\"+51\"},{idPais:141,codPais:\"PL\",pais:\"Polónia\",nacionalidade:\"Polonesa\",naturalidade:\"Polonesa\",indicativo:\"+48\"},{idPais:142,codPais:\"PT\",pais:\"Portugal\",nacionalidade:\"Portuguesa\",naturalidade:\"Portuguesa\",indicativo:\"+351\"},{idPais:143,codPais:\"KE\",pais:\"Quénia\",nacionalidade:\"Queniana\",naturalidade:\"Queniana\",indicativo:\"+254\"},{idPais:144,codPais:\"KG\",pais:\"Quirguistão\",nacionalidade:\"Quirguistanesa\",naturalidade:\"Quirguistanesa\",indicativo:\"+996\"},{idPais:145,codPais:\"KI\",pais:\"Quiribáti\",nacionalidade:\"Quiribatiana\",naturalidade:\"Quiribatiana\",indicativo:\"+686\"},{idPais:146,codPais:\"GB\",pais:\"Reino Unido\",nacionalidade:\"Britânica\",naturalidade:\"Britânica\",indicativo:\"+44\"},{idPais:147,codPais:\"CF\",pais:\"República Centro-Africana\",nacionalidade:\"Centro-Africana\",naturalidade:\"Centro-Africana\",indicativo:\"+236\"},{idPais:148,codPais:\"CZ\",pais:\"República Checa\",nacionalidade:\"Checa\",naturalidade:\"Checa\",indicativo:\"+420\"},{idPais:149,codPais:\"CD\",pais:\"República Democrática do Congo\",nacionalidade:\"Congolesa\",naturalidade:\"Congolesa\",indicativo:\"+243\"},{idPais:150,codPais:\"DO\",pais:\"República Dominicana\",nacionalidade:\"Dominicana\",naturalidade:\"Dominicana\",indicativo:\"+1849\"},{idPais:151,codPais:\"RO\",pais:\"Roménia\",nacionalidade:\"Romena\",naturalidade:\"Romena\",indicativo:\"+40\"},{idPais:152,codPais:\"RW\",pais:\"Ruanda\",nacionalidade:\"Ruandesa\",naturalidade:\"Ruandesa\",indicativo:\"+250\"},{idPais:153,codPais:\"RU\",pais:\"Rússia\",nacionalidade:\"Russa\",naturalidade:\"Russa\",indicativo:\"+7\"},{idPais:154,codPais:\"SB\",pais:\"Salomão\",nacionalidade:\"Salomônica\",naturalidade:\"Salomônica\",indicativo:\"+677\"},{idPais:155,codPais:\"SV\",pais:\"Salvador\",nacionalidade:\"Salvador\",naturalidade:\"Salvador\",indicativo:\"+503\"},{idPais:156,codPais:\"WS\",pais:\"Samoa\",nacionalidade:\"Samoana\",naturalidade:\"Samoana\",indicativo:\"+685\"},{idPais:157,codPais:\"LC\",pais:\"Santa Lúcia\",nacionalidade:\"Santa-Lucense\",naturalidade:\"Santa-Lucense\",indicativo:\"+1758\"},{idPais:158,codPais:\"KN\",pais:\"São Cristóvão e Neves\",nacionalidade:\"São-Cristovense\",naturalidade:\"São-Cristovense\",indicativo:\"+1869\"},{idPais:159,codPais:\"SM\",pais:\"São Marinho\",nacionalidade:\"São-Marinense\",naturalidade:\"São-Marinense\",indicativo:\"+378\"},{idPais:160,codPais:\"ST\",pais:\"São Tomé e Príncipe\",nacionalidade:\"São-Tomense\",naturalidade:\"São-Tomense\",indicativo:\"+239\"},{idPais:161,codPais:\"VC\",pais:\"São Vicente e Granadinas\",nacionalidade:\"São-Vicentina\",naturalidade:\"São-Vicentina\",indicativo:\"+1784\"},{idPais:162,codPais:\"SC\",pais:\"Seicheles\",nacionalidade:\"Seichelense\",naturalidade:\"Seichelense\",indicativo:\"+248\"},{idPais:163,codPais:\"SN\",pais:\"Senegal\",nacionalidade:\"Senegalesa\",naturalidade:\"Senegalesa\",indicativo:\"+221\"},{idPais:164,codPais:\"SL\",pais:\"Serra Leoa\",nacionalidade:\"Serra-Leoanesa\",naturalidade:\"Serra-Leoanesa\",indicativo:\"+232\"},{idPais:165,codPais:\"RS\",pais:\"Sérvia\",nacionalidade:\"Servia\",naturalidade:\"Servia\",indicativo:\"+381\"},{idPais:166,codPais:\"SG\",pais:\"Singapura\",nacionalidade:\"Singapurense\",naturalidade:\"Singapurense\",indicativo:\"+65\"},{idPais:167,codPais:\"SY\",pais:\"Síria\",nacionalidade:\"Síria\",naturalidade:\"Síria\",indicativo:\"+963\"},{idPais:168,codPais:\"SO\",pais:\"Somália\",nacionalidade:\"Somali\",naturalidade:\"Somali\",indicativo:\"+252\"},{idPais:169,codPais:\"LK\",pais:\"Sri Lanca\",nacionalidade:\"Srilankesa\",naturalidade:\"Srilankesa\",indicativo:\"+94\"},{idPais:170,codPais:\"SZ\",pais:\"Suazilândia\",nacionalidade:\"Suazi\",naturalidade:\"Suazi\",indicativo:\"+268\"},{idPais:171,codPais:\"SD\",pais:\"Sudão\",nacionalidade:\"Sudanense\",naturalidade:\"Sudanense\",indicativo:\"+249\"},{idPais:172,codPais:\"SS\",pais:\"Sudão do Sul\",nacionalidade:\"Sul-Sudanense\",naturalidade:\"Sul-Sudanense\",indicativo:\"+211\"},{idPais:173,codPais:\"SE\",pais:\"Suécia\",nacionalidade:\"Sueca\",naturalidade:\"Sueca\",indicativo:\"+46\"},{idPais:174,codPais:\"CH\",pais:\"Suíça\",nacionalidade:\"Suiça\",naturalidade:\"Suiça\",indicativo:\"+41\"},{idPais:175,codPais:\"SR\",pais:\"Suriname\",nacionalidade:\"Suinamês\",naturalidade:\"Suinamês\",indicativo:\"+597\"},{idPais:176,codPais:\"TH\",pais:\"Tailândia\",nacionalidade:\"Tailandesa\",naturalidade:\"Tailandesa\",indicativo:\"+66\"},{idPais:177,codPais:\"TW\",pais:\"Taiuã\",nacionalidade:\"Taiwanesa\",naturalidade:\"Taiwanesa\",indicativo:\"+886\"},{idPais:178,codPais:\"TJ\",pais:\"Tajiquistão\",nacionalidade:\"Tajique\",naturalidade:\"Tajique\",indicativo:\"+992\"},{idPais:179,codPais:\"TZ\",pais:\"Tanzânia\",nacionalidade:\"Tanzaniana\",naturalidade:\"Tanzaniana\",indicativo:\"+255\"},{idPais:180,codPais:\"TL\",pais:\"Timor-Leste\",nacionalidade:\"Timorense\",naturalidade:\"Timorense\",indicativo:\"+670\"},{idPais:181,codPais:\"TG\",pais:\"Togo\",nacionalidade:\"Togolesa\",naturalidade:\"Togolesa\",indicativo:\"+228\"},{idPais:182,codPais:\"TO\",pais:\"Tonga\",nacionalidade:\"Tonganesa\",naturalidade:\"Tonganesa\",indicativo:\"+676\"},{idPais:183,codPais:\"TT\",pais:\"Trindade e Tobago\",nacionalidade:\"Trinitária\",naturalidade:\"Trinitária\",indicativo:\"+1868\"},{idPais:184,codPais:\"TN\",pais:\"Tunísia\",nacionalidade:\"Tunisiana\",naturalidade:\"Tunisiana\",indicativo:\"+216\"},{idPais:185,codPais:\"TM\",pais:\"Turcomenistão\",nacionalidade:\"Turcomena\",naturalidade:\"Turcomena\",indicativo:\"+993\"},{idPais:186,codPais:\"TR\",pais:\"Turquia\",nacionalidade:\"Turca\",naturalidade:\"Turca\",indicativo:\"+90\"},{idPais:187,codPais:\"TV\",pais:\"Tuvalu\",nacionalidade:\"Tuvaluana \",naturalidade:\"Tuvaluana \",indicativo:\"+688\"},{idPais:188,codPais:\"UA\",pais:\"Ucrânia\",nacionalidade:\"Ucraniana\",naturalidade:\"Ucraniana\",indicativo:\"+380\"},{idPais:189,codPais:\"UG\",pais:\"Uganda\",nacionalidade:\"Ugandesa\",naturalidade:\"Ugandesa\",indicativo:\"+256\"},{idPais:190,codPais:\"UY\",pais:\"Uruguai\",nacionalidade:\"Uruguaia\",naturalidade:\"Uruguaia\",indicativo:\"+598\"},{idPais:191,codPais:\"UZ\",pais:\"Usbequistão\",nacionalidade:\"Uzbeque\",naturalidade:\"Uzbeque\",indicativo:\"+998\"},{idPais:192,codPais:\"VU\",pais:\"Vanuatu\",nacionalidade:\"Vunuatuana\",naturalidade:\"Vunuatuana\",indicativo:\"+678\"},{idPais:193,codPais:\"VA\",pais:\"Vaticano\",nacionalidade:\"Vaticano\",naturalidade:\"Vaticano\",indicativo:\"+379\"},{idPais:194,codPais:\"VE\",pais:\"Venezuela\",nacionalidade:\"Venezualena\",naturalidade:\"Venezualena\",indicativo:\"+58\"},{idPais:195,codPais:\"VN\",pais:\"Vietnã\",nacionalidade:\"Vietnamita\",naturalidade:\"Vietnamita\",indicativo:\"+84\"},{idPais:196,codPais:\"ZM\",pais:\"Zâmbia\",nacionalidade:\"Zambiana\",naturalidade:\"Zambiana\",indicativo:\"+260\"},{idPais:197,codPais:\"ZW\",pais:\"Zimbábwe\",nacionalidade:\"Zimbabueana\",naturalidade:\"Zimbabueana\",indicativo:\"+263\"}];\r\n @Input() label = 'Telefone';\r\n @Input() id: string | number = '';\r\n valorTelefone = '';\r\n indicativo = '';\r\n @Input() translateYValue = 7;\r\n @Input() accao = '';\r\n @Output() aoMudarIndicativo = new EventEmitter();\r\n paisesAux: Country[] = [];\r\n paisSeleccionado!: Paises;\r\n Telefone = '';\r\n hasError = false;\r\n readonly actions = Accao;\r\n onChange: any = () => {\r\n }\r\n\r\n onTouch: any = () => {\r\n }\r\n\r\n set value(val: any) {\r\n\r\n if (val && this.paises) {\r\n\r\n for (const item of this.paises) {\r\n if (val.startsWith(item.indicativo)) {\r\n this.paisSeleccionado = item;\r\n this.aoMudarIndicativo.emit(item.indicativo);\r\n this.Telefone = val.split(item.indicativo)[1];\r\n return;\r\n } else {\r\n this.Telefone = val;\r\n this.paisSeleccionado = null;\r\n this.aoMudarIndicativo.emit(null);\r\n }\r\n }\r\n } else {\r\n this.Telefone = val;\r\n }\r\n }\r\n\r\n writeValue(valor: any) {\r\n if (valor) {\r\n this.value = valor;\r\n this.valorTelefone = valor;\r\n } else {\r\n this.value = '+244';\r\n }\r\n }\r\n\r\n registerOnChange(fn: any) {\r\n this.onChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any) {\r\n this.onTouch = fn;\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (changes && changes['paises'] && changes['paises']?.currentValue) {\r\n this.paises = changes['paises'].currentValue;\r\n this.paisesAux = changes['paises'].currentValue;\r\n if (!this.Telefone) {\r\n this.paisSeleccionado = this.paises.find(\r\n (p) => p.codPais === 'AO'\r\n );\r\n if (this.paisSeleccionado && this.paisSeleccionado.indicativo && this.Telefone && this.Telefone.trim().length > 0) {\r\n this.aoMudarIndicativo.emit(this.paisSeleccionado.indicativo);\r\n }\r\n } else {\r\n this.aoMudarIndicativo.emit('');\r\n }\r\n }\r\n }\r\n\r\n onInput(event: any) {\r\n }\r\n\r\n onBlur() {\r\n if (this.Telefone && this.Telefone.trim().length > 0) {\r\n this.onChange(`${this.paisSeleccionado.indicativo} ${this.Telefone}`);\r\n this.aoMudarIndicativo.emit(this.paisSeleccionado?.indicativo);\r\n } else {\r\n this.onChange(`${this.paisSeleccionado.indicativo}`);\r\n }\r\n }\r\n\r\n onChangeIndicativo(pais: Paises) {\r\n this.paisSeleccionado = pais;\r\n if (this.Telefone && this.Telefone.trim().length > 0) {\r\n this.onChange(\r\n `${this.paisSeleccionado.indicativo} ${this.Telefone}`\r\n );\r\n this.aoMudarIndicativo.emit(this.paisSeleccionado?.indicativo);\r\n } else {\r\n this.onChange(``);\r\n }\r\n }\r\n\r\n isUSAOrCAPhoneNumber(phoneNumber: string): string {\r\n const canadianRegex = /^(\\+?1\\s*[-\\/\\.]?)?\\(?[2-9]\\d{2}\\)?[-\\/\\.]?\\s*\\d{3}[-\\/\\.]?\\s*\\d{4}$/;\r\n const americanRegex = /^(\\+?1\\s*[-\\/\\.]?)?[2-9]\\d{2}\\s*[-\\/\\.]?\\s*\\d{3}\\s*[-\\/\\.]?\\s*\\d{4}$/;\r\n\r\n if (canadianRegex.test(phoneNumber)) {\r\n return 'CA';\r\n } else if (americanRegex.test(phoneNumber)) {\r\n return 'US';\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n validate(control: AbstractControl): { [key: string]: any } | null {\r\n this.hasError = !this.paisSeleccionado || this.Telefone.trim() === '';\r\n return this.hasError ? {required: true} : null;\r\n }\r\n}\r\n","import { Breakpoints } from '@angular/cdk/layout';\r\nimport { FiltroMetodoPagamentoDto } from 'app/shared/models/financas/filtro-metodo-pagamento.dto';\r\n\r\nexport const mapaAccao = new Map([\r\n ['D', 'Consultar'],\r\n ['C', 'Criar'],\r\n ['E', 'Editar'],\r\n]);\r\n\r\nexport const btnGravarFA = new Map([\r\n ['GI', 'Gravar e imprimir'],\r\n ['GE', 'Gravar e enviar por e-mail'],\r\n ]);\r\n\r\nexport const breakPointMap = new Map([\r\n [Breakpoints.XSmall, 'XSmall'],\r\n [Breakpoints.Small, 'Small'],\r\n [Breakpoints.Medium, 'Medium'],\r\n [Breakpoints.Large, 'Large'],\r\n [Breakpoints.XLarge, 'XLarge'],\r\n // [Breakpoints.Tablet, 'Tablet'],\r\n // [Breakpoints.Web, 'Web'],\r\n // [Breakpoints.WebLandscape, 'WebLandscape'],\r\n // [Breakpoints.WebPortrait, 'WebPortrait'],\r\n // [Breakpoints.Handset, 'Handset'],\r\n]);\r\n\r\nexport const lgPainel = {\r\n XSmall: 320,\r\n Small: 400,\r\n Medium: 500,\r\n Large: 600,\r\n XLarge: 700,\r\n};\r\n\r\nexport const modalOverLay = {\r\n XSmall: 100,\r\n Small: 100,\r\n Medium: 100,\r\n Large: 80,\r\n XLarge: 70,\r\n};\r\n\r\nexport const FILTRO_METODO_PAGAMENTO: FiltroMetodoPagamentoDto = {\r\n recebimento: true,\r\n pagamento: false,\r\n utilizador: null\r\n};\r\n","import { Directive, ElementRef, HostListener, Input, Renderer2 } from '@angular/core';\r\n\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[address]'\r\n})\r\nexport class AddressDirective {\r\n @Input('texto') texto: string = '';\r\n constructor(private el: ElementRef, private renderer: Renderer2) {\r\n this.renderer.setStyle(el.nativeElement, 'height', '40px');\r\n this.renderer.setStyle(el.nativeElement, 'resize', 'none');\r\n this.renderer.setStyle(el.nativeElement, 'overflow-y', 'hidden');\r\n this.renderer.setStyle(el.nativeElement, 'width', '441px');\r\n this.renderer.setAttribute(el.nativeElement, 'maxlength', '156');\r\n this.renderer.setAttribute(el.nativeElement, 'rows', '3');\r\n this.renderer.setAttribute(el.nativeElement, 'cols', '40');\r\n }\r\n @HostListener('paste', ['$event']) onPaste(event: ClipboardEvent) {\r\n const linhas = this.texto.match(/\\n/g);\r\n if (linhas && linhas.length > 1) {event.preventDefault(); return; }\r\n if (linhas) {\r\n if (linhas.length === 1 && this.texto.split('\\n')[1].length > 52) {\r\n event.preventDefault();\r\n } else if (linhas.length > 1 && this.texto.split('\\n')[2].length > 23) {\r\n event.preventDefault();\r\n }\r\n } else if (this.texto.length > 156) {\r\n event.preventDefault();\r\n }\r\n }\r\n\r\n @HostListener('keypress', ['$event']) onKeyPress(event: any) {\r\n const linhas = event.target.value.match(/\\n/g);\r\n if (linhas && linhas.length > 3) {event.preventDefault(); return; }\r\n if (linhas) {\r\n if (linhas.length === 1 && event.target.value.split('\\n')[1].length > 52) {\r\n event.preventDefault();\r\n } else if (linhas.length > 1 && event.target.value.split('\\n')[2].length > 23) {\r\n event.preventDefault();\r\n }\r\n if (linhas.length > 1 && event.charCode === 13) {\r\n event.preventDefault();\r\n }\r\n } else if (event.target.value.length > 156) {\r\n event.preventDefault();\r\n }\r\n }\r\n} // Directive //\r\n","import {Directive, ElementRef, HostListener, Input, OnInit} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Directive({\r\n selector: '[appBlockSpace]'\r\n})\r\nexport class BlockSpaceDirective implements OnInit {\r\n private regex: RegExp = new RegExp(/^\\d*\\,?\\d{0,2}$/g);\r\n private specialKeys: string[] = ['Backspace', 'Tab', 'End', 'Home', '-', 'Space', ];\r\n@Input() valorMax;\r\nvalorActual: any;\r\n constructor(private el: ElementRef) {\r\n this.valorActual = this.el.nativeElement.value;\r\n }\r\n\r\n ngOnInit() {\r\n console.log('Valor do Input agora: ', this.valorActual)\r\n }\r\n @HostListener('keydown', ['$event']) onKeyDown(event: KeyboardEvent) {\r\n console.log('Pressed Key', event.key);\r\n console.log('Key', event.key);\r\n if (this.specialKeys.indexOf(event.key) !== -1) {\r\n return;\r\n }\r\n\r\n\r\n console.log('Valor do input: ', this.valorActual);\r\n const position = this.el.nativeElement.selectionStart;\r\n // const next: string = [valorActual.slice(0, position), event.key === ',' ? ',' : event.key, valorActual.slice(position)].join('');\r\n // if (Util.convertToFloat(next)) {console.log('Max: ', next); event.preventDefault(); }\r\n // if (next && !String(next).match(this.regex)) { event.preventDefault(); }\r\n }\r\n}\r\n","import {Directive, HostListener, OnChanges} from '@angular/core';\r\nimport {NgControl, NgModel} from '@angular/forms';\r\nimport {CurrencyPipe, DecimalPipe} from '@angular/common';\r\n\r\n@Directive({\r\n selector: '[appCurrencyI18n]',\r\n providers: [NgModel, CurrencyPipe, DecimalPipe],\r\n 'host': {\r\n '(blur)': 'onInputChange($event)',\r\n '(focus)': 'onInputChange($event)'\r\n },\r\n})\r\nexport class CurrencyI18nDirective {\r\n constructor(\r\n private model: NgModel,\r\n private currencyPipe: CurrencyPipe,\r\n public ngControl: NgControl\r\n ) {\r\n }\r\n\r\n onInputChange($event) {\r\n const value = $event.target.value;\r\n if (!value) {\r\n return;\r\n }\r\n\r\n let plainNumber: number;\r\n let formattedValue: string;\r\n\r\n const decimalSeparatorIndex = value.lastIndexOf(',');\r\n if (decimalSeparatorIndex > 0) {\r\n // if input has decimal part\r\n const wholeNumberPart = value.substring(0, decimalSeparatorIndex);\r\n const decimalPart = value.substr(decimalSeparatorIndex + 1);\r\n plainNumber = parseFloat(\r\n wholeNumberPart.replace(/[^\\d]/g, '') + '.' + decimalPart\r\n );\r\n } else {\r\n // input does not have decimal part\r\n plainNumber = parseFloat(value.replace(/[^\\d]/g, ''));\r\n }\r\n\r\n if (!plainNumber) {\r\n formattedValue = '';\r\n } else {\r\n formattedValue = this.currencyPipe.transform(\r\n plainNumber.toFixed(2),\r\n 'AOA',\r\n 'symbol'\r\n );\r\n }\r\n\r\n this.ngControl.valueAccessor.writeValue(formattedValue);\r\n }\r\n}\r\n","import {Directive, ElementRef, HostListener} from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[appDecimalPlaces]'\r\n})\r\nexport class DecimalPlacesDirective {\r\n private regex: RegExp = new RegExp(/^\\d*\\,?\\d{0,2}$/g);\r\n private specialKeys: string[] = ['Backspace', 'Tab', 'End', 'Home', '-', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\r\n\r\n constructor(private el: ElementRef) {}\r\n\r\n @HostListener('keydown', ['$event']) onKeyDown(event: KeyboardEvent) {\r\n\r\n if (this.specialKeys.indexOf(event.key) !== -1) {\r\n return;\r\n }\r\n\r\n let current: string = this.el.nativeElement.value;\r\n const position = this.el.nativeElement.selectionStart;\r\n // const next: string = [current.slice(0, position), event.key === 'Decimal' ? ',' : event.key, current.slice(position)].join('');\r\n const next: string = [current.slice(0, position), event.key === ',' ? ',' : event.key, current.slice(position)].join('');\r\n console.log('Valor: ', next);\r\n // if (parseFloat(next) >= 100) { event.preventDefault();}\r\n console.log('Pressed', current);\r\n if (next && !String(next).match(this.regex)) {\r\n event.preventDefault();\r\n }\r\n }\r\n}\r\n","import { Directive, HostListener, Inject } from '@angular/core';\r\nimport { DropdownLinkDirective } from './dropdown-link.directive';\r\n\r\n@Directive({\r\n selector: '[appDropdownToggle]',\r\n})\r\nexport class DropdownAnchorDirective {\r\n protected navlink: DropdownLinkDirective;\r\n\r\n constructor(@Inject(DropdownLinkDirective) navlink: DropdownLinkDirective) {\r\n this.navlink = navlink;\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n onClick(e: any) {\r\n this.navlink.toggle();\r\n }\r\n}\r\n","import { Directive, HostBinding, Inject, Input, OnInit, OnDestroy } from '@angular/core';\r\n\r\nimport { AppDropdownDirective } from './dropdown.directive';\r\n\r\n@Directive({\r\n selector: '[appDropdownLink]',\r\n})\r\nexport class DropdownLinkDirective implements OnInit, OnDestroy {\r\n @Input() public group: any;\r\n\r\n protected _open: boolean;\r\n protected nav: AppDropdownDirective;\r\n\r\n @HostBinding('class.open')\r\n @Input()\r\n get open(): boolean {\r\n return this._open;\r\n }\r\n\r\n set open(value: boolean) {\r\n this._open = value;\r\n // if (value) {\r\n // this.nav.closeOtherLinks(this);\r\n // }\r\n }\r\n\r\n public constructor(@Inject(AppDropdownDirective) nav: AppDropdownDirective) {\r\n this.nav = nav;\r\n }\r\n\r\n public ngOnInit(): any {\r\n this.nav.addLink(this);\r\n }\r\n\r\n public ngOnDestroy(): any {\r\n this.nav.removeGroup(this);\r\n }\r\n\r\n public toggle(): any {\r\n this.open = !this.open;\r\n }\r\n}\r\n","import {Directive, OnInit} from '@angular/core';\r\nimport {NavigationEnd, Router} from '@angular/router';\r\nimport {DropdownLinkDirective} from './dropdown-link.directive';\r\nimport {Subscription} from 'rxjs';\r\nimport {filter} from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[appDropdown]'\r\n})\r\nexport class AppDropdownDirective implements OnInit {\r\n protected navlinks: DropdownLinkDirective[] = [];\r\n\r\n private _router: Subscription;\r\n\r\n public closeOtherLinks(openLink: DropdownLinkDirective): void {\r\n this.navlinks.forEach((link: DropdownLinkDirective) => {\r\n if (link !== openLink) {\r\n link.open = false;\r\n }\r\n });\r\n }\r\n\r\n public addLink(link: DropdownLinkDirective): void {\r\n this.navlinks.push(link);\r\n }\r\n\r\n public removeGroup(link: DropdownLinkDirective): void {\r\n const index = this.navlinks.indexOf(link);\r\n if (index !== -1) {\r\n this.navlinks.splice(index, 1);\r\n }\r\n }\r\n\r\n public getUrl() {\r\n return this.router.url;\r\n }\r\n\r\n public ngOnInit(): any {\r\n this._router = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {\r\n this.navlinks.forEach((link: DropdownLinkDirective) => {\r\n if (link.group) {\r\n const routeUrl = this.getUrl();\r\n const currentUrl = routeUrl.split('/');\r\n if (currentUrl.indexOf(link.group) > 0) {\r\n link.open = true;\r\n this.closeOtherLinks(link);\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n constructor(private router: Router) {\r\n }\r\n\r\n}\r\n","import {\r\n Directive,\r\n ElementRef,\r\n Attribute,\r\n OnInit,\r\n Input,\r\n Renderer2,\r\n NgZone,\r\n SimpleChanges,\r\n OnChanges,\r\n OnDestroy,\r\n ChangeDetectorRef\r\n} from \"@angular/core\";\r\nimport * as hl from \"highlight.js\";\r\nimport { HttpClient } from \"@angular/common/http\";\r\nimport { Subject } from \"rxjs\";\r\nimport { takeUntil } from \"rxjs/operators\";\r\n\r\n@Directive({\r\n host: {\r\n \"[class.hljs]\": \"true\",\r\n \"[innerHTML]\": \"highlightedCode\"\r\n },\r\n selector: \"[egretHighlight]\"\r\n})\r\nexport class EgretHighlightDirective implements OnInit, OnChanges, OnDestroy {\r\n constructor(\r\n private el: ElementRef,\r\n private cdr: ChangeDetectorRef,\r\n private _zone: NgZone,\r\n private http: HttpClient\r\n ) {\r\n this.unsubscribeAll = new Subject();\r\n }\r\n // Inner highlighted html\r\n highlightedCode: string;\r\n\r\n @Input() path: string;\r\n @Input(\"egretHighlight\") code: string;\r\n private unsubscribeAll: Subject;\r\n @Input() languages: string[];\r\n\r\n ngOnInit() {\r\n if (this.code) {\r\n this.highlightElement(this.code);\r\n }\r\n if (this.path) {\r\n this.highlightedCode = \"Loading...\"\r\n this.http\r\n .get(this.path, { responseType: \"text\" })\r\n .pipe(takeUntil(this.unsubscribeAll))\r\n .subscribe(response => {\r\n this.highlightElement(response, this.languages);\r\n });\r\n }\r\n }\r\n\r\n ngOnDestroy() {\r\n this.unsubscribeAll.next();\r\n this.unsubscribeAll.complete();\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (\r\n changes[\"code\"] &&\r\n changes[\"code\"].currentValue &&\r\n changes[\"code\"].currentValue !== changes[\"code\"].previousValue\r\n ) {\r\n this.highlightElement(this.code);\r\n // console.log('hljs on change', changes)\r\n }\r\n }\r\n\r\n highlightElement(code: string, languages?: string[]) {\r\n this._zone.runOutsideAngular(() => {\r\n const res = hl.highlightAuto(code);\r\n this.highlightedCode = res.value;\r\n // this.cdr.detectChanges();\r\n // console.log(languages)\r\n });\r\n }\r\n}\r\n","import { Directive, Host, Self, Optional, OnDestroy, OnInit } from '@angular/core';\r\nimport { MediaChange, MediaObserver } from \"@angular/flex-layout\";\r\nimport { Subscription } from \"rxjs\";\r\nimport { MatSidenav } from '@angular/material/sidenav';\r\n\r\n\r\n@Directive({\r\n selector: '[EgretSideNavToggle]'\r\n})\r\nexport class EgretSideNavToggleDirective implements OnInit, OnDestroy {\r\n isMobile;\r\n screenSizeWatcher: Subscription;\r\n constructor(\r\n private mediaObserver: MediaObserver,\r\n @Host() @Self() @Optional() public sideNav: MatSidenav\r\n ) { \r\n }\r\n\r\n ngOnInit() {\r\n this.initSideNav();\r\n }\r\n\r\n ngOnDestroy() {\r\n if(this.screenSizeWatcher) {\r\n this.screenSizeWatcher.unsubscribe()\r\n }\r\n }\r\n\r\n updateSidenav() {\r\n var self = this;\r\n setTimeout(() => {\r\n self.sideNav.opened = !self.isMobile;\r\n self.sideNav.mode = self.isMobile ? 'over' : 'side';\r\n })\r\n }\r\n initSideNav() {\r\n this.isMobile = this.mediaObserver.isActive('xs') || this.mediaObserver.isActive('sm');\r\n // console.log(this.isMobile)\r\n this.updateSidenav();\r\n this.screenSizeWatcher = this.mediaObserver.media$.subscribe((change: MediaChange) => {\r\n this.isMobile = (change.mqAlias == 'xs') || (change.mqAlias == 'sm');\r\n this.updateSidenav();\r\n });\r\n }\r\n\r\n}\r\n","import {\r\n Directive,\r\n OnInit,\r\n OnDestroy,\r\n HostBinding,\r\n Input,\r\n HostListener\r\n} from \"@angular/core\";\r\nimport { takeUntil } from \"rxjs/operators\";\r\nimport { Subject } from \"rxjs\";\r\nimport { MatchMediaService } from \"app/shared/services/match-media.service\";\r\nimport { EgretSidenavHelperService } from \"./egret-sidenav-helper.service\";\r\nimport { MatSidenav } from \"@angular/material/sidenav\";\r\nimport { MediaObserver } from \"@angular/flex-layout\";\r\n\r\n@Directive({\r\n selector: \"[egretSidenavHelper]\"\r\n})\r\nexport class EgretSidenavHelperDirective implements OnInit, OnDestroy {\r\n @HostBinding(\"class.is-open\")\r\n isOpen: boolean;\r\n\r\n @Input(\"egretSidenavHelper\")\r\n id: string;\r\n\r\n @Input(\"isOpen\")\r\n isOpenBreakpoint: string;\r\n\r\n private unsubscribeAll: Subject;\r\n\r\n constructor(\r\n private matchMediaService: MatchMediaService,\r\n private egretSidenavHelperService: EgretSidenavHelperService,\r\n private matSidenav: MatSidenav,\r\n private mediaObserver: MediaObserver\r\n ) {\r\n // Set the default value\r\n this.isOpen = true;\r\n\r\n this.unsubscribeAll = new Subject();\r\n }\r\n\r\n ngOnInit(): void {\r\n this.egretSidenavHelperService.setSidenav(this.id, this.matSidenav);\r\n\r\n if (this.mediaObserver.isActive(this.isOpenBreakpoint)) {\r\n this.isOpen = true;\r\n this.matSidenav.mode = \"side\";\r\n this.matSidenav.toggle(true);\r\n } else {\r\n this.isOpen = false;\r\n this.matSidenav.mode = \"over\";\r\n this.matSidenav.toggle(false);\r\n }\r\n\r\n this.matchMediaService.onMediaChange\r\n .pipe(takeUntil(this.unsubscribeAll))\r\n .subscribe(() => {\r\n if (this.mediaObserver.isActive(this.isOpenBreakpoint)) {\r\n this.isOpen = true;\r\n this.matSidenav.mode = \"side\";\r\n this.matSidenav.toggle(true);\r\n } else {\r\n this.isOpen = false;\r\n this.matSidenav.mode = \"over\";\r\n this.matSidenav.toggle(false);\r\n }\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.unsubscribeAll.next();\r\n this.unsubscribeAll.complete();\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: \"[egretSidenavToggler]\"\r\n})\r\nexport class EgretSidenavTogglerDirective {\r\n @Input(\"egretSidenavToggler\")\r\n public id: any;\r\n\r\n constructor(private egretSidenavHelperService: EgretSidenavHelperService) {}\r\n\r\n @HostListener(\"click\")\r\n onClick() {\r\n // console.log(this.egretSidenavHelperService.getSidenav(this.id))\r\n this.egretSidenavHelperService.getSidenav(this.id).toggle();\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { MatSidenav } from \"@angular/material/sidenav\";\r\n\r\n@Injectable({\r\n providedIn: \"root\"\r\n})\r\nexport class EgretSidenavHelperService {\r\n sidenavList: MatSidenav[];\r\n\r\n constructor() {\r\n this.sidenavList = [];\r\n }\r\n\r\n setSidenav(id, sidenav): void {\r\n this.sidenavList[id] = sidenav;\r\n }\r\n\r\n getSidenav(id): any {\r\n return this.sidenavList[id];\r\n }\r\n}\r\n","import { Directive, ElementRef, Input, OnInit, Renderer2 } from '@angular/core';\r\n\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[statusBgColor]'\r\n})\r\nexport class EstadoBgColorDirective implements OnInit {\r\n @Input() statusPag: string = '';\r\n bgClass: string = 'light-blue-700 light-blue-700-fg';\r\n constructor(private el: ElementRef, private renderer: Renderer2) {\r\n }\r\n ngOnInit() {\r\n this.setBgClass();\r\n }\r\n\r\n// class=\"pr-1 pl-1\r\n// {{row?.estadoPagamento && row.estadoPagamento?.toLowerCase().trim() ===\r\n// ' Por Pagar '.toLowerCase().trim() ? 'orange-800 orange-800-fg':\r\n// row?.estadoPagamento && row.estadoPagamento?.toLowerCase().trim() ===\r\n// ' Pago '.toLowerCase().trim() ? 'light-green-800 light-green-800-fg':\r\n// row.estadoPagamento?.toLowerCase().trim() ===\r\n// ' Anulado '.toLowerCase().trim() ? 'red-A100 red-A400-fg':'light-blue-700 light-blue-700-fg'\r\n// }}\"\r\n setBgClass() {\r\n switch (true) {\r\n case this.statusPag.toLowerCase().trim() === 'por pagar': {\r\n this.bgClass = 'orange-800 orange-800-fg';\r\n }\r\n break;\r\n case this.statusPag.toLowerCase().trim() === 'pago':\r\n {\r\n this.bgClass = 'light-green-800 light-green-800-fg';\r\n }\r\n break;\r\n case this.statusPag.toLowerCase().trim() === 'anulado':\r\n {\r\n this.bgClass = 'light-green-800 light-green-800-fg';\r\n }\r\n break;\r\n }\r\n\r\n this.renderer.setAttribute(this.el.nativeElement, 'class', this.bgClass);\r\n }\r\n}\r\n","import {Directive, ElementRef, HostListener} from '@angular/core';\r\nimport {FixedStoreService} from '../services/data/fixed-store.service';\r\n\r\n@Directive({\r\n selector: '[appFixTop]'\r\n})\r\nexport class FixTopDirective {\r\n constructor(private el: ElementRef, private fixStore: FixedStoreService) {\r\n\r\n this.el.nativeElement.addEventListener('scroll', () => {\r\n if (window.pageYOffset < this.el.nativeElement.offsetTop) {\r\n fixStore.setFixTop(true);\r\n } else {\r\n fixStore.setFixTop(false);\r\n }\r\n if (this.el.nativeElement.offsetHeight < 5) {\r\n fixStore.setFixTop(false);\r\n }\r\n })\r\n }\r\n\r\n\r\n}\r\n","import { Directive, ElementRef, Attribute, OnInit } from '@angular/core';\r\n\r\n@Directive({ selector: '[fontSize]' })\r\nexport class FontSizeDirective implements OnInit {\r\n constructor( @Attribute('fontSize') public fontSize: string, private el: ElementRef) { }\r\n ngOnInit() {\r\n this.el.nativeElement.fontSize = this.fontSize;\r\n }\r\n}\r\n","import {Directive, ElementRef, HostListener, Input, OnInit} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Directive({\r\n selector: '[appFormatDecimals]'\r\n})\r\nexport class FormatDecimalsDirective implements OnInit {\r\n private regex: RegExp = new RegExp(/^\\d*\\,?\\d{0,2}$/g);\r\n private specialKeys: string[] = ['Backspace', 'Tab', 'End', 'Home', '-', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\r\n@Input() valorMax;\r\nvalorActual: any;\r\n constructor(private el: ElementRef) {\r\n this.valorActual = this.el.nativeElement.value;\r\n }\r\n\r\n ngOnInit() {\r\n console.log('Valor do Input agora: ', this.valorActual)\r\n }\r\n @HostListener('keydown', ['$event']) onKeyDown(event: KeyboardEvent) {\r\n console.log('Pressed Key', event.key);\r\n\r\n if (this.specialKeys.indexOf(event.key) !== -1) {\r\n return;\r\n }\r\n\r\n\r\n console.log('Valor do input: ', this.valorActual);\r\n const position = this.el.nativeElement.selectionStart;\r\n // const next: string = [valorActual.slice(0, position), event.key === ',' ? ',' : event.key, valorActual.slice(position)].join('');\r\n // if (Util.convertToFloat(next)) {console.log('Max: ', next); event.preventDefault(); }\r\n // if (next && !String(next).match(this.regex)) { event.preventDefault(); }\r\n }\r\n}\r\n","import {Directive, HostListener, Input} from '@angular/core';\r\nimport {CurrencyPipe} from '@angular/common';\r\nimport {Util} from '../models/generico/util';\r\n\r\n\r\n\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[formatarHora]',\r\n})\r\nexport class FormatarHoraDirective {\r\n @Input() valor = '';\r\n @HostListener('input', ['$event']) onInput(event: Event) {\r\n let target = event.target as HTMLInputElement;\r\n target.value = target.value.toUpperCase().replace(/[a-zA-Z\\sç;?><_=+/ºª%$#\"!|()&´`«»'}{*^~\\t\\n]/gi, '');\r\n }\r\n}\r\n","import {Directive, ElementRef, Input} from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[fundoCard]'\r\n}) export class FundoCardDirective {\r\n @Input() setFundoCard: number;\r\n fundos: any[] = [\r\n {fundo: 'background: url(/assets/images/backgrounds/circles.png), linear-gradient(90deg, rgb(223 223 227) -19.83%, rgb(69,153,238) 189.85%);!important;' },\r\n {fundo: 'background: url(/assets/images/backgrounds/circles.png), linear-gradient(90deg, rgb(223 223 227) -19.83%, rgb(193,9,68) 189.85%);!important;' },\r\n {fundo: 'background: url(/assets/images/backgrounds/circles.png), linear-gradient(90deg, rgb(223 223 227) -19.83%, rgb(69,153,238) 189.85%);!important;' },\r\n {fundo: 'background: url(/assets/images/backgrounds/circles.png), linear-gradient(90deg, rgb(223 223 227) -19.83%, rgb(238,131,69) 189.85%);!important;' }\r\n ];\r\n\r\n constructor(private el: ElementRef) {\r\n el.nativeElement.style.background = this.fundos[this.setFundoCard]?.fundo;\r\n }\r\n}","import {Directive, ElementRef, HostListener, Input} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Directive({\r\n selector: '[appInputDecimals]'\r\n})\r\nexport class InputDecimalsDirective {\r\n private regex: RegExp = new RegExp(/^\\d*\\,?\\d{0,2}$/g);\r\n private specialKeys: string[] = ['Backspace', 'Tab', 'End', 'Home', '-', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\r\n@Input() valorMax;\r\n constructor(private el: ElementRef) {}\r\n\r\n @HostListener('keydown', ['$event']) onKeyDown(event: KeyboardEvent) {\r\n console.log('Pressed Key', event.key);\r\n\r\n if (this.specialKeys.indexOf(event.key) !== -1) {\r\n return;\r\n }\r\n\r\n let current: string = this.el.nativeElement.value;\r\n const position = this.el.nativeElement.selectionStart;\r\n const next: string = [current.slice(0, position), event.key === ',' ? ',' : event.key, current.slice(position)].join('');\r\n if (Util.convertToFloat(next) > this.valorMax) {console.log('Max: ', next); event.preventDefault(); }\r\n if (next && !String(next).match(this.regex)) {\r\n event.preventDefault();\r\n }\r\n }\r\n}\r\n","import {Directive, HostListener, Input} from '@angular/core';\r\nimport {CurrencyPipe} from '@angular/common';\r\nimport {Util} from '../models/generico/util';\r\n\r\nexport enum Format {\r\n Cod = 'codigo',\r\n Decimal = 'decimal',\r\n Data = 'data',\r\n Perc = 'perc',\r\n GPS = 'GPS',\r\n Tel = 'Tel',\r\n Time = 'Time'\r\n}\r\n\r\n@Directive({\r\n selector: '[appInputFormat]',\r\n providers: [CurrencyPipe]\r\n})\r\nexport class InputFormatDirective {\r\n @Input('appInputFormat') format = '';\r\n\r\n constructor(private currencyPipe: CurrencyPipe) {\r\n }\r\n\r\n @HostListener('input', ['$event'])\r\n onInput(event: Event) {\r\n const target = event.target as HTMLInputElement;\r\n let position = target.selectionStart;\r\n switch (this.format) {\r\n case Format.Cod:\r\n target.value = target.value.toUpperCase().replace(/[^a-zA-Z0-9\\-\\\\\\/.#]+/g, '');\r\n break;\r\n case Format.Decimal:\r\n this.parseDecimal(target);\r\n break;\r\n case Format.Perc:\r\n this.parseDecimal(target);\r\n target.value = String(Util.clamp(Util.convertToFloat(target.value), 0, 100));\r\n this.parseDecimal(target);\r\n break;\r\n case Format.Data:\r\n for (let i = 0; i < target.value.length; i++) {\r\n if (i === 2 || i === 5) {\r\n target.value = target.value[i] !== '/' ? target.value.slice(0, i) : target.value;\r\n } else if (isNaN(Number(target.value[i]))) {\r\n target.value = target.value.slice(0, i);\r\n }\r\n }\r\n break;\r\n case Format.GPS:\r\n target.value = this.formatCoordinates(target.value.replace(/[^0-9.-]/g, ''));\r\n break;\r\n case Format.Tel: {\r\n const val = target.value;\r\n target.value = val.replace(/[^0-9\\s]/g, '');\r\n position -= Number(val.length !== target.value.length);\r\n target.selectionStart = position;\r\n target.selectionEnd = position;\r\n }\r\n break;\r\n case Format.Time:\r\n Util.timeInput(target);\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n formatCoordinates(value: string) {\r\n if (!value) {\r\n return '';\r\n }\r\n\r\n const [degreesPart, minutesPart] = value\r\n .replace(/[^0-9.]/g, '')\r\n .split('.');\r\n return `${value.includes('-') ? '-' : ''}${degreesPart}.${minutesPart || ''}`;\r\n }\r\n\r\n /**\r\n * Formata o valor de um <‘input’/> em decimal.\r\n * @deprecated Usar a directiva [currencyMask] no lugar desta função.\r\n */\r\n private parseDecimal(target: HTMLInputElement) {\r\n console.error('Usar a directiva [currencyMask] no lugar desta função.');\r\n let position = target.selectionStart;\r\n const value = Math.round(Math.abs(Util.convertToFloat(target.value)) * 100) / 100;\r\n const txt = this.currencyPipe.transform(isNaN(value) ? 0 : value, '', '');\r\n if (txt.length < target.value.length) {\r\n position--;\r\n } else if (txt.length > target.value.length && target.value.includes(',')) {\r\n position++;\r\n }\r\n target.value = txt;\r\n target.selectionStart = position;\r\n target.selectionEnd = position;\r\n }\r\n\r\n}\r\n","import { Directive, ElementRef, HostListener } from '@angular/core';\r\nimport { NgControl } from '@angular/forms';\r\n\r\n@Directive({\r\n selector: '[appInputToUpper]'\r\n}) export class InputToUpperDirective {\r\n constructor(private el: ElementRef, private control: NgControl) {}\r\n @HostListener('input', ['$event']) onInput(event: Event) {\r\n const input = event.target as HTMLInputElement;\r\n const value = input.value.toUpperCase();\r\n input.value = value;\r\n if (this.control?.control) {\r\n this.control.control.setValue(value, {\r\n emitEvent: false\r\n });\r\n }\r\n }\r\n}\r\n","import {ContentChild, Directive, Input, TemplateRef} from '@angular/core';\r\nimport {SectionDirective} from '@directives/section.directive';\r\n\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[k-card-column]',\r\n})\r\nexport class KCardColumnDirective {\r\n @ContentChild(SectionDirective, {read: TemplateRef, static: true})\r\n _cellTemplateQuery: TemplateRef;\r\n\r\n @Input('section')\r\n _cellTemplateInput: TemplateRef;\r\n\r\n get sectionTemplate(): TemplateRef {\r\n return this._cellTemplateInput || this._cellTemplateQuery;\r\n }\r\n\r\n constructor() {\r\n }\r\n\r\n}\r\n","import { Directive, Input, TemplateRef, ViewContainerRef, OnInit } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[appIsMobile]'\r\n})\r\nexport class IsMobileDirective implements OnInit {\r\n\r\n shouldDisplayOnMobile = false;\r\n @Input('appIsMobile') set showOnMobile(condition: boolean) {\r\n this.shouldDisplayOnMobile = condition;\r\n this.updateView();\r\n }\r\n\r\n constructor(private templateRef: TemplateRef, private viewContainer: ViewContainerRef) {}\r\n\r\n ngOnInit(): void {\r\n this.updateView();\r\n }\r\n\r\n private updateView(): void {\r\n const isMobile = this.isMobileDevice();\r\n if (isMobile && this.shouldDisplayOnMobile) {\r\n this.viewContainer.createEmbeddedView(this.templateRef);\r\n } else {\r\n this.viewContainer.clear();\r\n }\r\n }\r\n\r\n private isMobileDevice(): boolean {\r\n return /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\r\n }\r\n}\r\n","import {Directive, ElementRef, HostListener, Input} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Directive({\r\n selector: '[maxDigitos]'\r\n})\r\nexport class MaxDigitosDirective {\r\n @Input() valorMax: number;\r\n private regex: RegExp = new RegExp(/^\\d*,?\\d{0,2}$/g);\r\n private specialKeys: string[] = ['Backspace', 'Tab', 'End', 'Home', '-', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\r\n\r\n constructor(private el: ElementRef) {\r\n }\r\n\r\n @HostListener('keydown', ['$event']) onKeyDown(event: KeyboardEvent) {\r\n\r\n if (this.specialKeys.indexOf(event.key) !== -1) {\r\n return;\r\n }\r\n\r\n const current: string = this.el.nativeElement.value;\r\n const position = this.el.nativeElement.selectionStart;\r\n const next: string = [current.slice(0, position), event.key === ',' ? ',' : event.key, current.slice(position)].join('');\r\n if (Util.convertToFloat(next) >= this.valorMax) {\r\n console.log('Max Sao iguais: ', next);\r\n event.preventDefault();\r\n }\r\n\r\n if (next && !String(next).match(this.regex)) {\r\n event.preventDefault();\r\n }\r\n }\r\n}\r\n","import {Directive, HostListener, Input} from '@angular/core';\r\nimport {AbstractControl} from '@angular/forms';\r\n\r\nexport interface TipoSelecao {\r\n control: AbstractControl;\r\n list?: any[];\r\n}\r\n\r\n@Directive({\r\n selector: '[appOptionSelection]'\r\n})\r\nexport class OptionSelectionDirective {\r\n @Input('appOptionSelection') option!: TipoSelecao;\r\n\r\n constructor() {\r\n }\r\n\r\n @HostListener('click', ['$event'])\r\n onClick(event: MouseEvent) {\r\n const values = this.option.control.value.filter(l => l !== undefined);\r\n // Selecionar todos\r\n if (this.option?.list && this.option) {\r\n this.option.control.patchValue(values.length >= this.option.list.length ? [] : this.option?.list);\r\n return;\r\n }\r\n // Selecionar todos os booleanos\r\n this.option.control.patchValue(values.length >= 2 ? [] : [true, false]);\r\n }\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[phone]',\r\n})\r\nexport class PhoneDirective {\r\n @Input() valor = '';\r\n @HostListener('input', ['$event']) onInput(event: Event) {\r\n let target = event.target as HTMLInputElement;\r\n target.value = target.value.toUpperCase().replace(/[a-zA-Zç;?><_=+/ºª%$#\"!|()&´`«»'}{*^~\\t\\n]/gi, '');\r\n }\r\n}\r\n","import { Directive, ElementRef, HostListener, OnInit } from '@angular/core';\r\n\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[posInputUpdate]'\r\n}) export class PosInputUpdateDirective implements OnInit {\r\nconstructor(private el: ElementRef) {\r\n}\r\nngOnInit() {\r\n console.log(this.el.nativeElement);\r\n}\r\n @HostListener('change', ['$event']) onChange(event: any) {\r\n console.log(event);\r\n if (event.target !== event.currentTarget && this.el.nativeElement.classList.contains('open')) {\r\n // console.log(event)\r\n }\r\n }\r\n @HostListener('click', ['$event']) onClick(event: any) {\r\n console.log(event);\r\n if (event.target !== event.currentTarget && this.el.nativeElement.classList.contains('open')) {\r\n // console.log(event)\r\n }\r\n }\r\n}\r\n","import { Directive, ElementRef, Attribute, OnInit, HostListener } from '@angular/core';\r\n\r\n@Directive({ selector: '[scrollTo]' })\r\nexport class ScrollToDirective implements OnInit {\r\n constructor( @Attribute('scrollTo') public elmID: string, private el: ElementRef) { }\r\n\r\n ngOnInit() {}\r\n\r\n currentYPosition() {\r\n // Firefox, Chrome, Opera, Safari\r\n if (self.pageYOffset) return self.pageYOffset;\r\n // Internet Explorer 6 - standards mode\r\n if (document.documentElement && document.documentElement.scrollTop)\r\n return document.documentElement.scrollTop;\r\n // Internet Explorer 6, 7 and 8\r\n if (document.body.scrollTop) return document.body.scrollTop;\r\n return 0;\r\n };\r\n\r\n elmYPosition(eID) {\r\n var elm = document.getElementById(eID);\r\n var y = elm.offsetTop;\r\n var node: any = elm;\r\n while (node.offsetParent && node.offsetParent != document.body) {\r\n node = node.offsetParent;\r\n y += node.offsetTop;\r\n }\r\n return y;\r\n };\r\n\r\n @HostListener('click', ['$event'])\r\n smoothScroll() {\r\n if(!this.elmID)\r\n return;\r\n var startY = this.currentYPosition();\r\n var stopY = this.elmYPosition(this.elmID);\r\n var distance = stopY > startY ? stopY - startY : startY - stopY;\r\n if (distance < 100) {\r\n scrollTo(0, stopY);\r\n return;\r\n }\r\n var speed = Math.round(distance / 50);\r\n if (speed >= 20) speed = 20;\r\n var step = Math.round(distance / 25);\r\n var leapY = stopY > startY ? startY + step : startY - step;\r\n var timer = 0;\r\n if (stopY > startY) {\r\n for (var i = startY; i < stopY; i += step) {\r\n setTimeout(\"window.scrollTo(0, \" + leapY + \")\", timer * speed);\r\n leapY += step;\r\n if (leapY > stopY) leapY = stopY;\r\n timer++;\r\n }\r\n return;\r\n }\r\n for (var i = startY; i > stopY; i -= step) {\r\n setTimeout(\"window.scrollTo(0, \" + leapY + \")\", timer * speed);\r\n leapY -= step;\r\n if (leapY < stopY) leapY = stopY;\r\n timer++;\r\n }\r\n return false;\r\n };\r\n}","import {Directive, TemplateRef} from '@angular/core';\r\n\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: '[section]'\r\n})\r\nexport class SectionDirective {\r\n constructor(public template: TemplateRef) {\r\n }\r\n}\r\n","import {Directive, ElementRef, HostListener, OnInit, Renderer2} from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[appSelectedActive]'\r\n})\r\nexport class SelectedActiveDirective implements OnInit {\r\n constructor(private el: ElementRef, private renderer: Renderer2) {\r\n }\r\nactive: boolean;\r\n element = this.el.nativeElement;\r\n @HostListener('click', ['$event']) onClick(e) {\r\n this.active = !this.active;\r\n if (this.active) {\r\n this.renderer.addClass(this.element, 'filtroActivo');\r\n } else {\r\n this.renderer.removeClass(this.element, 'filtroActivo');\r\n }\r\n }\r\n ngOnInit() {\r\n\r\n }\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\n\r\nimport {FontSizeDirective} from './font-size.directive';\r\nimport {ScrollToDirective} from './scroll-to.directive';\r\nimport {AppDropdownDirective} from './dropdown.directive';\r\nimport {DropdownAnchorDirective} from './dropdown-anchor.directive';\r\nimport {DropdownLinkDirective} from './dropdown-link.directive';\r\nimport {EgretSideNavToggleDirective} from './egret-side-nav-toggle.directive';\r\nimport {EgretSidenavHelperDirective, EgretSidenavTogglerDirective} from './egret-sidenav-helper/egret-sidenav-helper.directive';\r\nimport {EgretHighlightDirective} from './egret-highlight.directive';\r\nimport {SelectedActiveDirective} from './selected-active.directive';\r\nimport {TwoDecimalsDirective} from './two-decimals.directive';\r\nimport {DecimalPlacesDirective} from './decimal-places.directive';\r\nimport {InputDecimalsDirective} from './input-decimals.directive';\r\nimport {FormatDecimalsDirective} from './format-decimals.directive';\r\nimport {FixTopDirective} from './fix-top.directive';\r\nimport {BlockSpaceDirective} from './block-space.directive';\r\nimport {MaxDigitosDirective} from './max-digitos.directive';\r\nimport {FundoCardDirective} from './fundo-card.directive';\r\nimport {CurrencyI18nDirective} from './currency-i18n.directive';\r\nimport {InputFormatDirective} from './input-format.directive';\r\nimport {OptionSelectionDirective} from './option-selection.directive';\r\nimport {ToggleOpenDirective} from './toggle-open.directive';\r\nimport {FormatarHoraDirective} from './formatar-hora.directive';\r\nimport {AddressDirective} from './address.directive';\r\nimport {EstadoBgColorDirective} from './estado-bg-color.directive';\r\nimport {SectionDirective} from '@directives/section.directive';\r\nimport {KCardColumnDirective} from '@directives/k-card-column.directive';\r\nimport { PhoneDirective } from '@directives/phone.directive';\r\nimport { PosInputUpdateDirective } from '@directives/pos-input-update.directive';\r\nimport { IsMobileDirective } from '@directives/layouts/is-mobile.directive';\r\nimport { InputToUpperDirective } from '@directives/input-to-uppercase.directive';\r\nimport { AppFlagDirective } from '@shared/components/forms/app-flag.directive';\r\n\r\n\r\nconst DIRECTIVES = [\r\n FontSizeDirective,\r\n ScrollToDirective,\r\n AppDropdownDirective,\r\n DropdownAnchorDirective,\r\n DropdownLinkDirective,\r\n EgretSideNavToggleDirective,\r\n EgretSidenavHelperDirective,\r\n EgretSidenavTogglerDirective,\r\n EgretHighlightDirective,\r\n SelectedActiveDirective,\r\n TwoDecimalsDirective,\r\n InputDecimalsDirective,\r\n DecimalPlacesDirective,\r\n FormatDecimalsDirective,\r\n FixTopDirective,\r\n BlockSpaceDirective,\r\n MaxDigitosDirective,\r\n FundoCardDirective,\r\n CurrencyI18nDirective,\r\n InputFormatDirective,\r\n OptionSelectionDirective,\r\n ToggleOpenDirective,\r\n FormatarHoraDirective,\r\n KCardColumnDirective,\r\n SectionDirective,\r\n AddressDirective,\r\n EstadoBgColorDirective,\r\n PhoneDirective,\r\n PosInputUpdateDirective,\r\n IsMobileDirective, InputToUpperDirective, AppFlagDirective\r\n];\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule\r\n ],\r\n declarations: DIRECTIVES,\r\n exports: DIRECTIVES\r\n})\r\nexport class SharedDirectivesModule {\r\n}\r\n\r\n","import { Directive, ElementRef, HostListener, OnInit, Renderer2 } from '@angular/core';\r\nimport { Router, NavigationEnd } from '@angular/router';\r\nimport { DropdownLinkDirective } from './dropdown-link.directive';\r\nimport { Subscription } from 'rxjs';\r\nimport { filter } from 'rxjs/operators';\r\n\r\n@Directive({\r\n selector: '[appToggleOpen]'\r\n})\r\nexport class ToggleOpenDirective implements OnInit {\r\n protected navlinks: DropdownLinkDirective[] = [];\r\n\r\n private _router: Subscription;\r\n\r\n public closeOtherLinks(openLink: DropdownLinkDirective): void {\r\n this.navlinks.forEach((link: DropdownLinkDirective) => {\r\n if (link !== openLink) {\r\n link.open = false;\r\n }\r\n });\r\n }\r\n\r\n \r\n public getUrl() {\r\n return this.router.url;\r\n }\r\n \r\n public ngOnInit(): any {\r\n this._router = this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe((event: NavigationEnd) => {\r\n this.navlinks.forEach((link: DropdownLinkDirective) => {\r\n if (link.group) {\r\n const routeUrl = this.getUrl();\r\n const currentUrl = routeUrl.split('/');\r\n if (currentUrl.indexOf( link.group ) > 0) {\r\n link.open = true;\r\n this.closeOtherLinks(link);\r\n }\r\n }\r\n });\r\n });\r\n }\r\n\r\n @HostListener('click', ['$event']) onClick(event: any) {\r\n // event.stopPropagation();\r\n if (event.target !== event.currentTarget && this.el.nativeElement.classList.contains('open')) {\r\n // console.log(event)\r\n }\r\n }\r\n constructor(private router: Router, private el: ElementRef, private renderer: Renderer2) {}\r\n\r\n}\r\n","import {Directive, ElementRef, HostListener} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Directive({\r\n selector: '[appTwoDecimals]'\r\n})\r\nexport class TwoDecimalsDirective {\r\n private regex: RegExp = new RegExp(/^\\d*\\,?\\d{0,2}$/g);\r\n private specialKeys: string[] = ['Backspace', 'Tab', 'End', 'Home', '-', 'ArrowLeft', 'ArrowRight', 'Del', 'Delete'];\r\n\r\n constructor(private el: ElementRef) {}\r\n\r\n @HostListener('keydown', ['$event']) onKeyDown(event: KeyboardEvent) {\r\n\r\n if (this.specialKeys.indexOf(event.key) !== -1) {\r\n return;\r\n }\r\n\r\n let current: string = this.el.nativeElement.value;\r\n const position = this.el.nativeElement.selectionStart;\r\n const next: string = [current.slice(0, position), event.key === ',' ? ',' : event.key, current.slice(position)].join('');\r\n if (Util.convertToFloat(next) > 100) {console.log('Max: ', next); event.preventDefault(); }\r\n if (next && !String(next).match(this.regex)) {\r\n event.preventDefault();\r\n }\r\n }\r\n}\r\n","import {ProcessosTarefas} from '../models/processos/processostarefas';\r\nimport {FiltrosClientes} from '../models/clientes/filtros/filtroclientes';\r\nimport * as moment from 'moment';\r\nimport {Accao} from '../models/ENUM';\r\n\r\nexport const tabMessages = {\r\n emptyMessage: 'Sem dados para mostrar',\r\n totalMessage: 'Total',\r\n selectedMessage: 'seleccionados'\r\n};\r\n\r\nexport const imagensLista: any[] = [\r\n {src: 'assets/images/sq-1.jpg'},\r\n {src: 'assets/images/sq-2.jpg'},\r\n {src: 'assets/images/sq-3.jpg'},\r\n {src: 'assets/images/sq-4.jpg'},\r\n {src: 'assets/images/sq-5.jpg'},\r\n {src: 'assets/images/sq-6.jpg'},\r\n {src: 'assets/images/sq-7.jpg'},\r\n {src: 'assets/images/sq-8.jpg'},\r\n {src: 'assets/images/sq-9.jpg'},\r\n {src: 'assets/images/sq-10.jpg'},\r\n {src: 'assets/images/sq-11.jpg'},\r\n {src: 'assets/images/sq-12.jpg'}\r\n];\r\n\r\nexport const Operacoes: { [key: string]: string } = {\r\n [Accao.cadastrar]: 'Criar',\r\n [Accao.editar]: 'Editar',\r\n [Accao.detalhes]: 'Consultar'\r\n};\r\n\r\nexport const lista: number[] = [];\r\n\r\nexport const tarefas: ProcessosTarefas[] = [];\r\n\r\nexport const menuCode = [\r\n {\r\n codMenu: 'CLIENT',\r\n RotaAPI: '',\r\n menu: 'Clientes'\r\n },\r\n {\r\n codMenu: 'RECHUM',\r\n RotaAPI: '',\r\n menu: 'Recursos Humanos'\r\n },\r\n {\r\n codMenu: 'ARTIGO',\r\n RotaAPI: '',\r\n menu: 'Artigos'\r\n },\r\n {\r\n codMenu: 'PROCES',\r\n RotaAPI: '',\r\n menu: 'Processos'\r\n },\r\n {\r\n codMenu: 'VENDAS',\r\n RotaAPI: '',\r\n menu: 'Vendas'\r\n },\r\n\r\n {\r\n codMenu: 'EVENTO',\r\n RotaAPI: '',\r\n menu: 'Eventos'\r\n },\r\n\r\n {\r\n codMenu: 'COMUNI',\r\n RotaAPI: '',\r\n menu: 'Comunicação'\r\n },\r\n {\r\n codMenu: 'UTILIZ',\r\n RotaAPI: '',\r\n menu: 'Utilizadores'\r\n },\r\n {\r\n codMenu: 'EQUIPA',\r\n RotaAPI: '',\r\n menu: 'Equipamentos'\r\n },\r\n {\r\n codMenu: 'GAR',\r\n RotaAPI: '',\r\n menu: 'Gestão de Arquivos'\r\n },\r\n {\r\n codMenu: 'ADMINI',\r\n RotaAPI: '',\r\n menu: 'Administração'\r\n }\r\n];\r\n\r\nexport const model = new FiltrosClientes(\r\n 1,\r\n 1,\r\n '',\r\n '',\r\n '',\r\n '',\r\n '',\r\n '',\r\n lista,\r\n lista\r\n);\r\n\r\nexport const myBase64 = '';\r\n\r\nexport const artigosFA = [{\r\n idClassificacao: 3,\r\n classificacaoP: 'Artigos',\r\n idArtigo: 40,\r\n codArtigo: '2020_KIAMI',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: '2020_KIAMI',\r\n descricao: '2020_KIAMI',\r\n condicoesAdesao: '2020_KIAMI',\r\n informacaoAdicional: '2020_KIAMI',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 2000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto Composto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 3,\r\n classificacaoP: 'Artigos',\r\n idArtigo: 42,\r\n codArtigo: '202020213108',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: '202020213108',\r\n descricao: '202020213108',\r\n condicoesAdesao: '202020213108',\r\n informacaoAdicional: '202020213108',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 20000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto Composto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 3,\r\n classificacaoP: 'Artigos',\r\n idArtigo: 41,\r\n codArtigo: '202991995',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: '202991995',\r\n descricao: '202991995',\r\n condicoesAdesao: '202991995',\r\n informacaoAdicional: '202991995',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 200000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto Composto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 110,\r\n codArtigo: 'SH00000016',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Ads',\r\n descricao: 'asd',\r\n condicoesAdesao: 'asd',\r\n informacaoAdicional: 'asd',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 2222,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 110,\r\n codArtigo: 'SH00000016',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Ads',\r\n descricao: 'asd',\r\n condicoesAdesao: 'asd',\r\n informacaoAdicional: 'asd',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 2222,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 9,\r\n codArtigo: 'KIAMI_2020',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Calças brancas',\r\n descricao: 'Nossas Calças',\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 5,\r\n codIva: 'M00 ',\r\n taxaIva: 0,\r\n 'precoM1': 50,\r\n 'precoM2': 50,\r\n imagem: '9.jpeg',\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 9,\r\n codArtigo: 'KIAMI_2020',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Calças brancas',\r\n descricao: 'Nossas Calças',\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 5,\r\n codIva: 'M00 ',\r\n taxaIva: 0,\r\n 'precoM1': 50,\r\n 'precoM2': 50,\r\n imagem: '9.jpeg',\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 13,\r\n codArtigo: 'ARTIGO',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Camisolas pretas.',\r\n descricao: 'Nossas camisolas pretas.',\r\n condicoesAdesao: 'Condições editada.',\r\n informacaoAdicional: 'Informação editada.',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 648,\r\n 'precoM2': 648,\r\n imagem: '13.jpeg',\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 13,\r\n codArtigo: 'ARTIGO',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Camisolas pretas.',\r\n descricao: 'Nossas camisolas pretas.',\r\n condicoesAdesao: 'Condições editada.',\r\n informacaoAdicional: 'Informação editada.',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 648,\r\n 'precoM2': 648,\r\n imagem: '13.jpeg',\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 4,\r\n codArtigo: 'ARTIGO -1',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Com Fornecedor',\r\n descricao: 'Artigo com Fornecedor',\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 100,\r\n 'precoM2': 600,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 4,\r\n codArtigo: 'ARTIGO -1',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Com Fornecedor',\r\n descricao: 'Artigo com Fornecedor',\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 100,\r\n 'precoM2': 600,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 3,\r\n classificacaoP: 'Artigos',\r\n idArtigo: 64,\r\n codArtigo: 'COSTA_2021',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'COSTA_2021',\r\n descricao: 'COSTA_2021',\r\n condicoesAdesao: 'COSTA_2021',\r\n informacaoAdicional: 'COSTA_2021',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 20000,\r\n 'precoM2': 20000,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto Composto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 3,\r\n classificacaoP: 'Artigos',\r\n idArtigo: 63,\r\n codArtigo: 'DEF_2021',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'DEF_2021',\r\n descricao: 'DEF_2021',\r\n condicoesAdesao: 'DEF_2021',\r\n informacaoAdicional: 'DEF_2021',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 0.55,\r\n 'precoM2': 2000,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto Composto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 133,\r\n codArtigo: '3234567890',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Designacao',\r\n descricao: 'Descriao',\r\n condicoesAdesao: 'Condicoes de Adesao',\r\n informacaoAdicional: 'Informacao Adicional',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 2345,\r\n 'precoM2': 2345,\r\n imagem: '133.jpeg',\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto',\r\n estado: 'Suspenso'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 111,\r\n codArtigo: 'SH00000017',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'dffdf',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 13323,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 111,\r\n codArtigo: 'SH00000017',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'dffdf',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 13323,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 120,\r\n codArtigo: 'SH00000025',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Marcação',\r\n descricao: 'Marcação',\r\n condicoesAdesao: 'Marcação',\r\n informacaoAdicional: 'Marcação',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 4000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 120,\r\n codArtigo: 'SH00000025',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Marcação',\r\n descricao: 'Marcação',\r\n condicoesAdesao: 'Marcação',\r\n informacaoAdicional: 'Marcação',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 4000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 10,\r\n codArtigo: 'P_2020',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Nossas Calças Jeans',\r\n descricao: 'Calças Jeans',\r\n condicoesAdesao: 'Condições segundo produto',\r\n informacaoAdicional: 'Informações segundo produto',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 10,\r\n 'precoM2': 10,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 10,\r\n codArtigo: 'P_2020',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Nossas Calças Jeans',\r\n descricao: 'Calças Jeans',\r\n condicoesAdesao: 'Condições segundo produto',\r\n informacaoAdicional: 'Informações segundo produto',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 10,\r\n 'precoM2': 10,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Produto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 119,\r\n codArtigo: 'SH00000024',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Obrigatorio',\r\n descricao: 'Obrigatorio',\r\n condicoesAdesao: 'Obrigatorio',\r\n informacaoAdicional: 'Obrigatorio',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 3444,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 119,\r\n codArtigo: 'SH00000024',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Obrigatorio',\r\n descricao: 'Obrigatorio',\r\n condicoesAdesao: 'Obrigatorio',\r\n informacaoAdicional: 'Obrigatorio',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 3444,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 2,\r\n classificacaoP: 'Produtos',\r\n idArtigo: 134,\r\n codArtigo: 'PC-GAMER22',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'pv',\r\n descricao: 'nada a descrever',\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 5000000,\r\n 'precoM2': 20000,\r\n imagem: '134.jpeg',\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: false,\r\n tipo: 'Produto',\r\n estado: 'Inactivo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 29,\r\n codArtigo: 'S28',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'sddfd',\r\n descricao: 'vxf',\r\n condicoesAdesao: 'xcv',\r\n informacaoAdicional: 'xcv',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 233234,\r\n 'precoM2': 233234,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 87,\r\n codArtigo: 'ACA',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'sdf',\r\n descricao: 'asdsad',\r\n condicoesAdesao: 'asdas',\r\n informacaoAdicional: 'asd',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 5000,\r\n 'precoM2': 4000,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 32,\r\n codArtigo: 'MC 220',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Serviço 2021',\r\n descricao: 'a',\r\n condicoesAdesao: 'a',\r\n informacaoAdicional: 'a',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 7777,\r\n 'precoM2': 7777,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 31,\r\n codArtigo: '001245',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Servico Rotura',\r\n descricao: 'Bla',\r\n condicoesAdesao: 'Bla',\r\n informacaoAdicional: 'Bla',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 2000,\r\n 'precoM2': 2000,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 135,\r\n codArtigo: '00000001',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Serviço teste',\r\n descricao: null,\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 0.55,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: false,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 113,\r\n codArtigo: 'SH00000019',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 0,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 113,\r\n codArtigo: 'SH00000019',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 0,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 121,\r\n codArtigo: '00000000',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste',\r\n descricao: null,\r\n condicoesAdesao: null,\r\n informacaoAdicional: null,\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 3000,\r\n 'precoM2': 299,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: false,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 115,\r\n codArtigo: 'SH00000020',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste 0012',\r\n descricao: 'asdasd',\r\n condicoesAdesao: 'asd',\r\n informacaoAdicional: 'asd',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 2000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 115,\r\n codArtigo: 'SH00000020',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste 0012',\r\n descricao: 'asdasd',\r\n condicoesAdesao: 'asd',\r\n informacaoAdicional: 'asd',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 2000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 112,\r\n codArtigo: 'SH00000018',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste 2',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 2000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 112,\r\n codArtigo: 'SH00000018',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste 2',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 2000,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 117,\r\n codArtigo: 'SH00000022',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste 2021-03-09',\r\n descricao: 'Teste 2021-03-09',\r\n condicoesAdesao: 'Teste 2021-03-09',\r\n informacaoAdicional: 'Teste 2021-03-09',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 12122,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 117,\r\n codArtigo: 'SH00000022',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Teste 2021-03-09',\r\n descricao: 'Teste 2021-03-09',\r\n condicoesAdesao: 'Teste 2021-03-09',\r\n informacaoAdicional: 'Teste 2021-03-09',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 12122,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 118,\r\n codArtigo: 'SH00000023',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'tipoObrigatorio',\r\n descricao: 'tipoObrigatorio',\r\n condicoesAdesao: 'tipoObrigatorio',\r\n informacaoAdicional: 'tipoObrigatorio',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 978979,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 118,\r\n codArtigo: 'SH00000023',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Tipo Obrigatorio',\r\n descricao: 'Tipo de servico obrigatorio',\r\n condicoesAdesao: 'tipoObrigatorio',\r\n informacaoAdicional: 'tipoObrigatorio',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 978979,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 2,\r\n codUnidade: 'CX',\r\n unidadeSingular: 'Caixa',\r\n unidadePlural: 'Caixas',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 116,\r\n codArtigo: 'SH00000021',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Transportes de Luxo (UBER EAT)',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 0,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 116,\r\n codArtigo: 'SH00000021',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'Transportes',\r\n descricao: '',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 4,\r\n codIva: '14',\r\n taxaIva: 14,\r\n 'precoM1': 0,\r\n 'precoM2': 0,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 109,\r\n codArtigo: 'SH00000015',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'zasdasd',\r\n descricao: 'Escrevendo Alguma coisa',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 0,\r\n 'precoM2': 123123,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço Composto',\r\n estado: 'Activo'\r\n}, {\r\n idClassificacao: 1,\r\n classificacaoP: 'Serviços',\r\n idArtigo: 109,\r\n codArtigo: 'SH00000015',\r\n idIdioma: 1,\r\n codIdioma: null,\r\n artigo: 'zasdasd',\r\n descricao: 'Escrevendo Alguma coisa',\r\n condicoesAdesao: '',\r\n informacaoAdicional: '',\r\n idIva: 6,\r\n codIva: 'M02',\r\n taxaIva: 0,\r\n 'precoM1': 0,\r\n 'precoM2': 123123,\r\n imagem: null,\r\n idUnidadeMedida: 1,\r\n codUnidade: 'UN',\r\n unidadeSingular: 'Unidade',\r\n unidadePlural: 'Unidades',\r\n sujeitoARetencao: true,\r\n tipo: 'Serviço Composto',\r\n estado: 'Activo'\r\n}];\r\n\r\nexport const ranges: any = {\r\n 'Hoje': [moment(), moment()],\r\n 'Ontem': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],\r\n 'Últimos 7 dias': [moment().subtract(6, 'days'), moment()],\r\n 'Últimos 30 dias': [moment().subtract(29, 'days'), moment()],\r\n 'Mês corrente': [moment().startOf('month'), moment().endOf('month')],\r\n 'Ano corrente': [moment().startOf('year'), moment().endOf('year')],\r\n 'Último mês': [moment().subtract(1, 'month').startOf('month'),\r\n moment().subtract(1, 'month').endOf('month')]\r\n};\r\n\r\nexport const horasEvento = [\r\n {id: 1, valor: '00:00'},\r\n {id: 2, valor: '00:15'},\r\n {id: 3, valor: '00:30'},\r\n {id: 4, valor: '00:45'},\r\n {id: 5, valor: '01:00'},\r\n {id: 6, valor: '01:15'},\r\n {id: 7, valor: '01:30'},\r\n {id: 8, valor: '01:45'},\r\n {id: 9, valor: '02:00'},\r\n {id: 10, valor: '02:15'},\r\n {id: 11, valor: '02:30'},\r\n {id: 12, valor: '02:45'},\r\n {id: 13, valor: '03:00'},\r\n {id: 14, valor: '03:15'},\r\n {id: 15, valor: '03:30'},\r\n {id: 16, valor: '03:45'},\r\n {id: 17, valor: '04:00'},\r\n {id: 18, valor: '04:15'},\r\n {id: 19, valor: '04:30'},\r\n {id: 20, valor: '04:45'},\r\n {id: 21, valor: '05:00'},\r\n {id: 22, valor: '05:15'},\r\n {id: 23, valor: '05:30'},\r\n {id: 24, valor: '05:45'},\r\n {id: 25, valor: '06:00'},\r\n {id: 26, valor: '06:15'},\r\n {id: 27, valor: '06:30'},\r\n {id: 28, valor: '06:45'},\r\n {id: 29, valor: '07:00'},\r\n {id: 30, valor: '07:15'},\r\n {id: 31, valor: '07:30'},\r\n {id: 32, valor: '07:45'},\r\n {id: 33, valor: '08:00'},\r\n {id: 34, valor: '08:15'},\r\n {id: 35, valor: '08:30'},\r\n {id: 36, valor: '08:45'},\r\n {id: 37, valor: '09:00'},\r\n {id: 38, valor: '09:15'},\r\n {id: 39, valor: '09:30'},\r\n {id: 40, valor: '09:45'},\r\n {id: 41, valor: '10:00'},\r\n {id: 42, valor: '10:15'},\r\n {id: 43, valor: '10:30'},\r\n {id: 44, valor: '10:45'},\r\n {id: 45, valor: '11:00'},\r\n {id: 46, valor: '11:15'},\r\n {id: 47, valor: '11:30'},\r\n {id: 48, valor: '11:45'},\r\n {id: 49, valor: '12:00'},\r\n {id: 50, valor: '12:15'},\r\n {id: 51, valor: '12:30'},\r\n {id: 52, valor: '12:45'},\r\n {id: 53, valor: '13:00'},\r\n {id: 54, valor: '13:15'},\r\n {id: 55, valor: '13:30'},\r\n {id: 56, valor: '13:45'},\r\n {id: 57, valor: '14:00'},\r\n {id: 58, valor: '14:15'},\r\n {id: 59, valor: '14:30'},\r\n {id: 60, valor: '14:45'},\r\n {id: 61, valor: '15:00'},\r\n {id: 62, valor: '15:15'},\r\n {id: 63, valor: '15:30'},\r\n {id: 64, valor: '15:45'},\r\n {id: 65, valor: '16:00'},\r\n {id: 66, valor: '16:15'},\r\n {id: 67, valor: '16:30'},\r\n {id: 68, valor: '16:45'},\r\n {id: 69, valor: '17:00'},\r\n {id: 70, valor: '17:15'},\r\n {id: 71, valor: '17:30'},\r\n {id: 72, valor: '17:45'},\r\n {id: 73, valor: '18:00'},\r\n {id: 74, valor: '18:15'},\r\n {id: 75, valor: '18:30'},\r\n {id: 76, valor: '18:45'},\r\n {id: 77, valor: '19:00'},\r\n {id: 78, valor: '19:15'},\r\n {id: 79, valor: '19:30'},\r\n {id: 80, valor: '19:45'},\r\n {id: 81, valor: '20:00'},\r\n {id: 82, valor: '20:15'},\r\n {id: 83, valor: '20:30'},\r\n {id: 84, valor: '20:45'},\r\n {id: 85, valor: '21:00'},\r\n {id: 86, valor: '21:15'},\r\n {id: 87, valor: '21:30'},\r\n {id: 88, valor: '21:45'},\r\n {id: 89, valor: '22:00'},\r\n {id: 90, valor: '22:15'},\r\n {id: 91, valor: '22:30'},\r\n {id: 92, valor: '22:45'},\r\n {id: 93, valor: '23:00'},\r\n {id: 94, valor: '23:15'},\r\n {id: 95, valor: '23:30'},\r\n {id: 96, valor: '23:45'}\r\n];\r\n","import { Injectable } from \"@angular/core\";\r\nimport {\r\n CanActivate,\r\n ActivatedRouteSnapshot,\r\n RouterStateSnapshot,\r\n Router,\r\n} from '@angular/router';\r\nimport { JwtAuthService } from \"../services/auth/jwt-auth.service\";\r\n\r\n@Injectable()\r\nexport class AuthGuard implements CanActivate {\r\n\r\n constructor(private router: Router, private jwtAuth: JwtAuthService) {}\r\n\r\n canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\r\n if (this.jwtAuth.isLoggedIn()) {\r\n return true;\r\n } else {\r\n this.router.navigate([\"/sessoes/login\"], {\r\n queryParams: {\r\n return: state.url\r\n }\r\n });\r\n return false;\r\n }\r\n }\r\n}\r\n","import {Injectable} from '@angular/core';\r\nimport {ActivatedRouteSnapshot, CanActivateChild, Router, RouterStateSnapshot, UrlTree} from '@angular/router';\r\nimport {Observable} from 'rxjs';\r\nimport {LoginService} from '@services/aplicacao-service/login.service';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class UserValidadorGuard implements CanActivateChild {\r\n constructor(private router: Router, private loginService: LoginService) {\r\n }\r\n\r\n canActivateChild(\r\n route: ActivatedRouteSnapshot,\r\n state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree {\r\n const usr = this.loginService.getUtilizadorSessao();\r\n if (usr?.validador && !state.url.includes('/artigos/inscricoes/QRCODE/')) {\r\n this.router.navigate(['/artigos/inscricoes/QRCODE/0']).finally();\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n","export function getQueryParam(prop) {\r\n var params = {};\r\n var search = decodeURIComponent(window.location.href.slice(window.location.href.indexOf('?') + 1));\r\n var definitions = search.split('&');\r\n definitions.forEach(function (val, key) {\r\n var parts = val.split('=', 2);\r\n params[parts[0]] = parts[1];\r\n });\r\n return (prop && prop in params) ? params[prop] : params;\r\n}","import { Injectable } from '@angular/core';\r\nimport {\r\n HttpEvent,\r\n HttpInterceptor,\r\n HttpHandler,\r\n HttpRequest\r\n} from '@angular/common/http';\r\nimport { Observable } from 'rxjs';\r\nimport { JwtAuthService } from '../services/auth/jwt-auth.service';\r\n\r\n@Injectable()\r\nexport class TokenInterceptor implements HttpInterceptor {\r\n constructor(private jwtAuth: JwtAuthService) {}\r\n\r\n intercept(\r\n req: HttpRequest,\r\n next: HttpHandler\r\n ): Observable> {\r\n const token = localStorage.getItem('token');\r\n let requisicaoAlterada;\r\n if (token) {\r\n requisicaoAlterada = req.clone({\r\n setHeaders: {\r\n Authorization: `Bearer ${token}`\r\n },\r\n });\r\n } else {\r\n requisicaoAlterada = req;\r\n }\r\n return next.handle(requisicaoAlterada);\r\n }\r\n}\r\n","import {\r\n Directive,\r\n OnInit,\r\n ElementRef,\r\n Renderer2,\r\n HostListener\r\n} from '@angular/core';\r\n\r\nimport { Subscription } from 'rxjs';\r\nimport { NgControl } from '@angular/forms';\r\n\r\nimport { KeyboardService } from '../keyboard.service';\r\nimport { DecimalPipe } from '@angular/common';\r\nenum MaskExpression {\r\n EMPTY_STRING = '',\r\n DOT = '.',\r\n COMMA = ',',\r\n MINUS = '-',\r\n}\r\n@Directive({\r\n // tslint:disable-next-line:directive-selector\r\n selector: 'input[oskInputNum]',\r\n providers: [DecimalPipe],\r\n exportAs: 'oskInputNum',\r\n})\r\nexport class OskInputNumDirective implements OnInit {\r\n private keySubscription: Subscription;\r\n private backspaceSubscription: Subscription;\r\n private enterSubscription: Subscription;\r\n private measure: HTMLElement;\r\n private allowNegativeNumbers = false;\r\n private decimalMarker = ',';\r\n private thousandSeparator = '.';\r\n\r\n\r\n constructor(private render: Renderer2,\r\n private el: ElementRef, private keyboard: KeyboardService,\r\n private ngControl: NgControl,\r\n private decimalPipe: DecimalPipe) {}\r\n\r\n ngOnInit() {\r\n // TODO I'm sure there's an \"Angular way\" of doing this\r\n const thisStyle = window.getComputedStyle(this.el.nativeElement);\r\n this.measure = document.createElement('span');\r\n this.measure.style.position = 'absolute';\r\n this.measure.style.right = '100%';\r\n this.measure.style.font = thisStyle.font;\r\n document.body.appendChild(this.measure);\r\n this.el.nativeElement.value = this.decimalPipe.transform(this.el.nativeElement.value.replaceAll('.', '').replaceAll(',', '.'), '1.2-2');\r\n }\r\n\r\n @HostListener('focus')\r\n private onFocus() {\r\n this.keyboard.fireKeyboardRequested(true);\r\n this.subscribeToKeyboardEvents();\r\n }\r\n\r\n @HostListener('input', ['$event']) private onInput(event: Event): void {\r\n const target = event.target as HTMLInputElement;\r\n target.value = target.value.toUpperCase().replace(/[a-zA-Zç;.?><_=+/ºª%$#\"!|()&´`«»'}{*^~\\t\\n]/gi, '');\r\n }\r\n\r\n @HostListener('blur')\r\n private onBlur() {\r\n this.keyboard.fireKeyboardRequested(false);\r\n this.unsubscribeFromKeyboardEvents();\r\n }\r\n\r\n private subscribeToKeyboardEvents() {\r\n this.keySubscription = this.keyboard.keyPressed.subscribe(key =>\r\n this.onKey(key)\r\n );\r\n this.backspaceSubscription = this.keyboard.backspacePressed.subscribe(_ =>\r\n this.onBackspace()\r\n );\r\n this.enterSubscription = this.keyboard.enterPressed.subscribe(_ =>\r\n this.onEnter()\r\n );\r\n }\r\n\r\n private unsubscribeFromKeyboardEvents() {\r\n this.keySubscription.unsubscribe();\r\n this.backspaceSubscription.unsubscribe();\r\n this.enterSubscription.unsubscribe();\r\n }\r\n\r\n private _stripToDecimal(str: string): string {\r\n return str\r\n .split(MaskExpression.EMPTY_STRING)\r\n .filter((i: string, idx: number) => {\r\n const isDecimalMarker =\r\n typeof this.decimalMarker === 'string'\r\n ? i === this.decimalMarker\r\n : // TODO (inepipenko) use utility type\r\n (this.decimalMarker as string).includes(\r\n i as MaskExpression.COMMA | MaskExpression.DOT\r\n );\r\n return (\r\n i.match('^-?\\\\d') ||\r\n i === this.thousandSeparator ||\r\n isDecimalMarker ||\r\n (i === MaskExpression.MINUS && idx === 0 && this.allowNegativeNumbers)\r\n );\r\n })\r\n .join(MaskExpression.EMPTY_STRING);\r\n }\r\n\r\n private onKey(key: string) {\r\n if (key && key === '.') {\r\n return;\r\n }\r\n let inputCurrentValue = this.el.nativeElement.value;\r\n const valorComVirgula = this.el.nativeElement.value;\r\n // TODO Refactor this into a single method with the code in onBackspace\r\n const element = this.el.nativeElement,\r\n start = element.selectionStart,\r\n end = element.selectionEnd;\r\n\r\n // Verificar se tem pontos e substituir //\r\n // if (inputCurrentValue.includes('.') || !inputCurrentValue.includes(',')) {\r\n // inputCurrentValue = inputCurrentValue.replaceAll('.', '');\r\n // this.ngControl.control.setValue(inputCurrentValue);\r\n // }\r\n\r\n // Se inclui virgulas, verificar se tem digitos depois da virgula //\r\n // const splitLength = inputCurrentValue && (inputCurrentValue.split(',')[1]) ? (inputCurrentValue.split(',')[1]).toString().length : 0;\r\n // if (inputCurrentValue.includes(',') && splitLength > 0 && splitLength < 2) {\r\n // inputCurrentValue = inputCurrentValue.replace(',', '.');\r\n // this.ngControl.control.setValue(inputCurrentValue);\r\n // }\r\n\r\n // if (inputCurrentValue.includes(',') && splitLength >= 2) {\r\n // inputCurrentValue = inputCurrentValue.split(',')[0] + ',' + inputCurrentValue.split(',')[1].slice(0, 2);\r\n // inputCurrentValue = inputCurrentValue.replace(',', '.');\r\n // this.ngControl.control.setValue(this._stripToDecimal(inputCurrentValue));\r\n // return;\r\n // }\r\n\r\n \r\n // if (inputCurrentValue.includes(',')) {\r\n // inputCurrentValue = inputCurrentValue.split(',')[0] + ',' + inputCurrentValue.split(',')[1].slice(0, 2);\r\n // inputCurrentValue = inputCurrentValue.replace(',', '.');\r\n // this.ngControl.control.setValue(this._stripToDecimal(inputCurrentValue));\r\n // return;\r\n // }\r\n\r\n\r\n this.measure.textContent = element.value.substr(0, start) + key;\r\n element.value =\r\n element.value.substr(0, start) + key + element.value.substr(end);\r\n\r\n element.focus();\r\n element.selectionStart = element.selectionEnd = start + 1;\r\n\r\n this.updateScrollPosition();\r\n }\r\n\r\n private onBackspace() {\r\n let element = this.el.nativeElement,\r\n start = element.selectionStart,\r\n end = element.selectionEnd;\r\n\r\n if (start === 0) {\r\n return;\r\n }\r\n\r\n if (start === end) {\r\n start--;\r\n }\r\n this.measure.textContent = element.value.substr(0, start);\r\n element.value = element.value.substr(0, start) + element.value.substr(end);\r\n element.focus();\r\n element.selectionStart = element.selectionEnd = start;\r\n this.updateScrollPosition();\r\n }\r\n\r\n private updateScrollPosition() {\r\n const element = this.el.nativeElement;\r\n element.scrollLeft = this.measure.offsetWidth - (element.clientWidth - 10);\r\n if (element.value && !this.ngControl.control.value) {\r\n this.ngControl.control.setValue(element.value.replaceAll(',', '.'));\r\n }\r\n const event = new Event('input', { bubbles: true });\r\n this.el.nativeElement.dispatchEvent(event);\r\n }\r\n\r\n private onEnter() {\r\n\r\n }\r\n\r\n}\r\n","import { Directive, Input, HostBinding, HostListener, OnInit, OnDestroy } from '@angular/core';\r\nimport { KeyboardService } from '../keyboard.service';\r\n\r\n\r\n@Directive({\r\n selector: '[appTeclas]'\r\n})\r\nexport class TeclasDirective implements OnInit, OnDestroy {\r\n private _values: string[];\r\n\r\n @Input('appTeclas') values: string;\r\n\r\n @HostBinding('innerText') currentValue: string;\r\n\r\n constructor(private keyboard: KeyboardService) { }\r\n\r\n ngOnInit() {\r\n this._values = this.values.split(' ');\r\n // this.currentValue = this._values[0];\r\n this.currentValue = this.values;\r\n }\r\n\r\n ngOnDestroy() {\r\n this.keyboard.shiftChanged.unsubscribe();\r\n this.keyboard.altChanged.unsubscribe();\r\n }\r\n\r\n\r\n\r\n @HostListener('click')\r\n onClick() {\r\n this.keyboard.fireKeyPressed(this.currentValue);\r\n }\r\n}\r\n","import { Directive, Input, HostBinding, HostListener, OnInit, OnDestroy } from '@angular/core';\r\nimport { KeyboardService } from './keyboard.service';\r\n\r\n@Directive({\r\n selector: '[appKeyboardKey]'\r\n})\r\nexport class KeyboardKeyDirective implements OnInit, OnDestroy {\r\n private _values: string[];\r\n private isShifted: boolean;\r\n private isAlt: boolean;\r\n\r\n @Input('appKeyboardKey') values: string;\r\n @Input() capsActive: boolean = false;\r\n\r\n @HostBinding('innerText') currentValue: string;\r\n\r\n constructor(private keyboard: KeyboardService) { }\r\n\r\n ngOnInit() {\r\n this._values = this.values.split(' ');\r\n this.currentValue = this.capsActive ? (this._values[0]).toUpperCase() : this._values[0];\r\n\r\n this.keyboard.shiftChanged.subscribe(shift => {\r\n this.isShifted = shift;\r\n this.updateCurrentValue();\r\n });\r\n this.keyboard.altChanged.subscribe(alt => {\r\n this.isAlt = alt;\r\n this.updateCurrentValue();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.keyboard.shiftChanged.unsubscribe();\r\n this.keyboard.altChanged.unsubscribe();\r\n }\r\n\r\n updateCurrentValue() {\r\n if (!this.capsActive) {\r\n this.currentValue = this._values[0];\r\n } else {\r\n this.currentValue = this._values[0].toUpperCase();\r\n }\r\n\r\n // if (!this.isAlt) {\r\n // if (!this.capsActive) {\r\n // this.currentValue = this._values[0];\r\n // } else {\r\n // this.currentValue = this._values[0].toUpperCase();\r\n // }\r\n // } else {\r\n // if (!this.isShifted) {\r\n // this.currentValue = this._values[1];\r\n // } else {\r\n // this.currentValue = this._values[2];\r\n // }\r\n // }\r\n }\r\n\r\n @HostListener('click')\r\n onClick() {\r\n this.keyboard.fireKeyPressed(this.capsActive ? this.currentValue.toUpperCase() : this.currentValue);\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Subject, Subscription } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class KeyboardService {\r\n private _shift: boolean = false;\r\n\r\n private _alt: boolean = false;\r\n\r\n private _keyboardRequested: Subject;\r\n private _shiftChanged: Subject;\r\n private _altChanged: Subject;\r\n private _keyPressed: Subject;\r\n private _backspacePressed: Subject;\r\n private _enterPressed: Subject;\r\n\r\n constructor() {\r\n this._keyboardRequested = new Subject();\r\n this._shiftChanged = new Subject();\r\n this._altChanged = new Subject();\r\n this._keyPressed = new Subject();\r\n this._backspacePressed = new Subject();\r\n this._enterPressed = new Subject();\r\n }\r\n\r\n get shift(): boolean {\r\n return this._shift;\r\n }\r\n\r\n set shift(value:boolean) {\r\n this._shiftChanged.next(this._shift = value);\r\n }\r\n\r\n get alt(): boolean {\r\n return this._alt;\r\n }\r\n\r\n set alt(value: boolean) {\r\n this._altChanged.next(this._alt = value);\r\n }\r\n\r\n get keyboardRequested() {\r\n return this._keyboardRequested;\r\n }\r\n\r\n get shiftChanged() {\r\n return this._shiftChanged;\r\n }\r\n\r\n get altChanged() {\r\n return this._altChanged;\r\n }\r\n\r\n get keyPressed() {\r\n return this._keyPressed;\r\n }\r\n\r\n get backspacePressed() {\r\n return this._backspacePressed;\r\n }\r\n\r\n get enterPressed() {\r\n return this._enterPressed;\r\n }\r\n\r\n fireKeyboardRequested(show: boolean) {\r\n this._keyboardRequested.next(show);\r\n }\r\n\r\n fireKeyPressed(key:string) {\r\n this._keyPressed.next(key);\r\n }\r\n\r\n fireBackspacePressed() {\r\n this._backspacePressed.next();\r\n }\r\n\r\n fireEnterPressed() {\r\n this._enterPressed.next();\r\n }\r\n\r\n checkB4Unsubscribe(sub: Subscription) {\r\n if(sub && !sub.closed){\r\n sub.unsubscribe();\r\n }\r\n }\r\n}\r\n","import { Component, OnInit, OnDestroy, HostListener, HostBinding, ElementRef, Input, AfterViewInit } from '@angular/core';\r\n\r\nimport { Subscription } from 'rxjs';\r\nimport { KeyboardService } from '../keyboard.service';\r\n\r\n@Component({\r\n selector: 'app-keyboard',\r\n templateUrl: './keyboard.component.html',\r\n styleUrls: ['./keyboard.component.css']\r\n})\r\nexport class KeyboardComponent implements OnInit, OnDestroy, AfterViewInit {\r\n @HostBinding('class.shown')\r\n private shown: boolean;\r\n @Input() tipoTeclado: any = {\r\n numerico: false,\r\n alpha: true\r\n };\r\n private keyboardSubscription: Subscription;\r\n alphaKeysActive: boolean = true;\r\n symbolKeysActive: boolean = false;\r\n capsActive: boolean = false;\r\n\r\n constructor(private el: ElementRef, public keyboard: KeyboardService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.keyboardSubscription = this.keyboard.keyboardRequested.subscribe(show => {\r\n this.shown = !show;\r\n });\r\n }\r\n ngAfterViewInit() {}\r\n\r\n ngOnDestroy() {\r\n this.keyboardSubscription.unsubscribe();\r\n }\r\n\r\n onShift() {\r\n this.keyboard.shift = !this.keyboard.shift;\r\n }\r\n\r\n\r\n onAlt() {\r\n this.keyboard.alt = !this.keyboard.alt;\r\n this.keyboard.shift = false;\r\n }\r\n\r\n onBackspace() {\r\n this.keyboard.fireBackspacePressed();\r\n }\r\n\r\n onEnter() {\r\n this.keyboard.fireEnterPressed();\r\n }\r\n\r\n mudarTeclas(){\r\n this.symbolKeysActive = !this.symbolKeysActive;\r\n this.alphaKeysActive = !this.alphaKeysActive;\r\n }\r\n @HostListener('mousedown', ['$event'])\r\n @HostListener('click', ['$event'])\r\n onMouseEvent(event: MouseEvent) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n}\r\n","\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n
\r\n","import { Component, OnInit, OnDestroy, HostListener, HostBinding, ElementRef, Input, AfterViewInit, EventEmitter, Output } from '@angular/core';\r\n\r\nimport { Subscription } from 'rxjs';\r\nimport { KeyboardService } from '../keyboard.service';\r\n\r\n@Component({\r\n // tslint:disable-next-line:component-selector\r\n selector: 'teclado-numerico',\r\n template: `\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n
\r\n
\r\n `,\r\n styleUrls: ['./teclado-numerico.view.css']\r\n})\r\nexport class TecladoNumericoView implements OnInit, OnDestroy, AfterViewInit {\r\n @HostBinding('class.shown')\r\n private shown: boolean;\r\n @Output() aoPressTecla = new EventEmitter();\r\n @Output() aoPressBackspace = new EventEmitter();\r\n @Output() aoLimprar = new EventEmitter();\r\n @Input() tecladoLivre = false;\r\n @Input() tipoTeclado: any = {\r\n numerico: false,\r\n alpha: true\r\n };\r\n private keyboardSubscription: Subscription;\r\n\r\n constructor(private el: ElementRef, public keyboard: KeyboardService) {\r\n }\r\n\r\n ngOnInit() {\r\n this.keyboardSubscription = this.keyboard.keyboardRequested.subscribe(show => {\r\n if (show) {\r\n this.shown = true;\r\n } else {\r\n this.shown = true;\r\n }\r\n });\r\n }\r\n\r\n numeroSelecionado(valor:number){\r\n this.aoPressTecla.emit(valor);\r\n }\r\n ngAfterViewInit() {\r\n\r\n }\r\n\r\n ngOnDestroy() {\r\n this.keyboardSubscription.unsubscribe();\r\n }\r\n\r\n onShift() {\r\n this.keyboard.shift = !this.keyboard.shift;\r\n }\r\n\r\n onBackspace() {\r\n this.aoPressBackspace.emit(true);\r\n }\r\n\r\n onClear(){\r\n this.aoLimprar.emit(true);\r\n }\r\n\r\n @HostListener('mousedown', ['$event'])\r\n @HostListener('click', ['$event'])\r\n onMouseEvent(event: MouseEvent) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n}\r\n","import {\r\n Directive,\r\n OnInit,\r\n ElementRef,\r\n Renderer2,\r\n HostListener, OnDestroy, HostBinding\r\n} from '@angular/core';\r\nimport { KeyboardService } from \"./keyboard.service\";\r\nimport { Subscription } from \"rxjs\";\r\nimport { NgControl } from '@angular/forms';\r\n\r\n@Directive({\r\n selector: \"[appOskInput]\",\r\n})\r\nexport class OskInputDirective implements OnInit, OnDestroy {\r\n private keySubscription: Subscription;\r\n private backspaceSubscription: Subscription;\r\n private enterSubscription: Subscription;\r\n private measure: HTMLElement;\r\n @HostBinding('innerText') currentValue: string;\r\n constructor(private render: Renderer2,\r\n private el: ElementRef, private keyboard: KeyboardService, private control: NgControl) {\r\n }\r\n\r\n ngOnInit() {\r\n let thisStyle = window.getComputedStyle(this.el.nativeElement);\r\n this.measure = document.createElement(\"span\");\r\n this.measure.style.position = \"absolute\";\r\n this.measure.style.right = \"100%\";\r\n this.measure.style.font = thisStyle.font;\r\n document.body.appendChild(this.measure);\r\n }\r\n\r\n @HostListener(\"focus\")\r\n private onFocus() {\r\n this.keyboard.fireKeyboardRequested(true);\r\n this.subscribeToKeyboardEvents();\r\n }\r\n\r\n @HostListener(\"blur\")\r\n private onBlur() {\r\n this.keyboard.fireKeyboardRequested(false);\r\n this.unsubscribeFromKeyboardEvents();\r\n }\r\n\r\n private subscribeToKeyboardEvents() {\r\n this.keySubscription = this.keyboard.keyPressed.subscribe(key =>\r\n this.onKey(key)\r\n );\r\n this.backspaceSubscription = this.keyboard.backspacePressed.subscribe(_ =>\r\n this.onBackspace()\r\n );\r\n\r\n }\r\n\r\n private unsubscribeFromKeyboardEvents() {\r\n // this.keySubscription.unsubscribe();\r\n this.keyboard.checkB4Unsubscribe(this.keySubscription);\r\n // this.backspaceSubscription.unsubscribe();\r\n this.keyboard.checkB4Unsubscribe(this.backspaceSubscription);\r\n // this.enterSubscription.unsubscribe();\r\n this.keyboard.checkB4Unsubscribe(this.enterSubscription);\r\n }\r\n\r\n private onKey(key: string) {\r\n // TODO Refactor this into a single method with the code in onBackspace\r\n let element = this.el.nativeElement,\r\n start = element.selectionStart,\r\n end = element.selectionEnd;\r\n\r\n this.measure.textContent = element.value.substr(0, start) + key;\r\n element.value =\r\n element.value.substr(0, start) + key + element.value.substr(end);\r\n\r\n element.focus();\r\n element.selectionStart = element.selectionEnd = start + 1;\r\n\r\n this.updateScrollPosition();\r\n }\r\n\r\n private onBackspace() {\r\n let element = this.el.nativeElement,\r\n start = element.selectionStart,\r\n end = element.selectionEnd;\r\n\r\n if (start === 0) {\r\n return;\r\n }\r\n\r\n if (start === end) {\r\n start--;\r\n }\r\n this.measure.textContent = element.value.substr(0, start);\r\n element.value = element.value.substr(0, start) + element.value.substr(end);\r\n element.focus();\r\n element.selectionStart = element.selectionEnd = start;\r\n this.updateScrollPosition();\r\n }\r\n\r\n private updateScrollPosition() {\r\n let element = this.el.nativeElement;\r\n element.scrollLeft = this.measure.offsetWidth - (element.clientWidth - 10);\r\n this.actualizarControl(element.value);\r\n const event = new Event('input', { bubbles: true });\r\n this.el.nativeElement.dispatchEvent(event);\r\n }\r\n\r\n actualizarControl(novoValor: string) {\r\n if (this.control && this.control.control) {\r\n this.control.control.setValue(novoValor);\r\n }\r\n }\r\n\r\n\r\n ngOnDestroy() {\r\n this.keyboard.shiftChanged.unsubscribe();\r\n this.keyboard.altChanged.unsubscribe();\r\n }\r\n // @HostListener('click') onClick() { this.keyboard.fireKeyPressed(this.currentValue); }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { KeyboardKeyDirective } from './keyboard-key.directive';\r\nimport { OskInputDirective } from './osk-input.directive';\r\nimport { VirtualKeyboardDirective } from './virtual-keyboard.directive';\r\nimport { KeyboardComponent } from './keyboard/keyboard.component';\r\nimport { ReactiveFormsModule } from '@angular/forms';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FlexModule } from '@angular/flex-layout';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { TeclasDirective } from './directivas/teclas.directive';\r\nimport { TecladoNumericoView } from './numerico/teclado-numerico.view';\r\nimport { OskInputNumDirective } from './directivas/osk-input-num.directive';\r\nimport { PosTecladoVirtual } from '../../views/pos/componentes/keyboard/pos-teclado-virtual';\r\nimport { DragDropModule } from '@angular/cdk/drag-drop';\r\nconst componentes = [KeyboardKeyDirective,\r\n OskInputDirective, OskInputNumDirective,\r\n VirtualKeyboardDirective, KeyboardComponent, PosTecladoVirtual,\r\n TeclasDirective, TecladoNumericoView];\r\n@NgModule({\r\n imports: [ReactiveFormsModule, CommonModule, FlexModule, MatIconModule, DragDropModule],\r\n exports: componentes,\r\n declarations: componentes,\r\n}) export class TecladoModule {\r\n\r\n}\r\n","import { Directive, HostListener, Input } from '@angular/core';\r\nimport { NgControl } from '@angular/forms';\r\n\r\n@Directive({\r\n selector: '[appVirtualKeyboard]'\r\n})\r\nexport class VirtualKeyboardDirective {\r\n @Input() appVirtualKeyboard: string[] = [];\r\n\r\n constructor(private ngControl: NgControl) {}\r\n\r\n @HostListener('click', ['$event.target']) onClick(target: HTMLElement) {\r\n const key = target.innerText;\r\n if (!this.ngControl.control || !key) return;\r\n\r\n let currentValue = this.ngControl.control.value || '';\r\n if (key === '←') {\r\n this.ngControl.control.setValue(currentValue.slice(0, -1));\r\n } else if (key === 'Space') {\r\n this.ngControl.control.setValue(currentValue + ' ');\r\n } else {\r\n this.ngControl.control.setValue(currentValue + key);\r\n }\r\n }\r\n}\r\n","export enum Genero {\r\n genMasculino = 1,\r\n genFeminino = 2\r\n}\r\n\r\nexport enum Accao {\r\n editar = 'E',\r\n detalhes = 'D',\r\n cadastrar = 'C'\r\n}\r\n\r\nexport enum Opc {\r\n NAO = 1,\r\n OPCIONAL = 2,\r\n OBRIGATORIO = 3\r\n}\r\n","import { UtilizadorSessao } from \"../../aplicacao/utilizador-sessao\";\r\n\r\nexport class ArtigoFiltros {\r\n constructor(\r\n public IdClassificacao?: number,\r\n public CodIdioma?: string,\r\n public CodArtigo?: string,\r\n public IdTiposArtigo?: number[],\r\n public Descricao?: string,\r\n public IdEstado?: number[],\r\n public IdUnidade?: number[],\r\n public Marcacao?: boolean[],\r\n public ValorMinMoeda1?: number,\r\n public ValorMaxMoeda1?: number,\r\n public ValorMinMoeda2?: number,\r\n public ValorMaxMoeda2?: number,\r\n public DataInicio?: string,\r\n public DataFim?: string,\r\n public Imagem?: boolean[],\r\n public renovavel?: boolean,\r\n public utilizadorSessao?: UtilizadorSessao\r\n ) {\r\n }\r\n}\r\n","\r\nexport class CountryCod {\r\n\r\n constructor() { }\r\n\r\n str = 'dialCode: +1 % flag:\tCA % countryName:\tCanada %' +\r\n 'dialCode: +1 % flag:\tUS % countryName:\tUnited States %' +\r\n 'dialCode: +1242 % flag:\t\tBS % countryName:\tBahamas %' +\r\n 'dialCode: +1246 % flag:\t\tBB % countryName:\tBarbados %' +\r\n 'dialCode: +1264 % flag:\t \tAI % countryName:\tAnguilla %' +\r\n 'dialCode: +1268 % flag:\t\tAG % countryName:\tAntigua and Barbuda %' +\r\n 'dialCode: +1284 % flag:\t \tVG % countryName:\tVirgin Islands, British %' +\r\n 'dialCode: +1340 % flag:\t\tVI % countryName:\tVirgin Islands, U.S. %' +\r\n 'dialCode: +1441 % flag:\t \tBM % countryName:\tBermuda %' +\r\n 'dialCode: +1473 % flag:\t \tGD % countryName:\tGrenada %' +\r\n 'dialCode: +1649 % flag:\t\tTC % countryName:\tTurks and Caicos Islands %' +\r\n 'dialCode: +1664 % flag:\t\tMS % countryName:\tMontserrat %' +\r\n 'dialCode: +1670 % flag:\t \tMP % countryName:\tNorthern Mariana Islands %' +\r\n 'dialCode: +1671 % flag:\t \tGU % countryName:\tGuam %' +\r\n 'dialCode: +1684 % flag:\t\tAS % countryName:\tAmerican Samoa %' +\r\n 'dialCode: +1758 % flag:\t \tLC % countryName:\tSaint Lucia %' +\r\n 'dialCode: +1767 % flag:\t \tDM % countryName:\tDominica %' +\r\n 'dialCode: +1784 % flag:\t\tVC % countryName:\tSaint Vincent and the Grenadines %' +\r\n 'dialCode: +1849 % flag:\t \tDO % countryName:\tDominican Republic %' +\r\n 'dialCode: +1868 % flag:\t\tTT % countryName:\tTrinidad and Tobago %' +\r\n 'dialCode: +1869 % flag:\t \tKN % countryName:\tSaint Kitts and Nevis %' +\r\n 'dialCode: +1876 % flag:\t \tJM % countryName:\tJamaica %' +\r\n 'dialCode: +1939 % flag:\t\tPR % countryName:\tPuerto Rico %' +\r\n 'dialCode: +20 \t % flag:\tEG % countryName:\tEgypt %' +\r\n 'dialCode: +211 \t % flag:\tSS % countryName:\tSouth Sudan %' +\r\n 'dialCode: +212 % flag: \tMA % countryName:\tMorocco %' +\r\n 'dialCode: +213 \t % flag:\tDZ % countryName:\tAlgeria %' +\r\n 'dialCode: +216 % flag:\tTN % countryName:\tTunisia %' +\r\n 'dialCode: +218 % flag:\tLY % countryName:\tLibyan Arab Jamahiriya %' +\r\n 'dialCode: +220 % flag: \tGM % countryName:\tGambia %' +\r\n 'dialCode: +221 % flag: \tSN % countryName:\tSenegal %' +\r\n 'dialCode: +222 % flag:\tMR % countryName:\tMauritania %' +\r\n 'dialCode: +223 % flag: \tML % countryName:\tMali %' +\r\n 'dialCode: +224 % flag:\t \tGN % countryName:\tGuinea %' +\r\n 'dialCode: +225 % flag: \tCI % countryName:\tCote dIvoire %' +\r\n 'dialCode: +226 \t % flag:\tBF % countryName:\tBurkina Faso %' +\r\n 'dialCode: +227 % flag: \tNE % countryName:\tNiger %' +\r\n 'dialCode: +228 % flag: \tTG % countryName:\tTogo %' +\r\n 'dialCode: +229 % flag:\tBJ % countryName:\tBenin %' +\r\n 'dialCode: +230 % flag: \tMU % countryName:\tMauritius %' +\r\n 'dialCode: +231 % flag:\tLR % countryName:\tLiberia %' +\r\n 'dialCode: +232 % flag: \tSL % countryName:\tSierra Leone %' +\r\n 'dialCode: +233 % flag: \tGH % countryName:\tGhana %' +\r\n 'dialCode: +234 % flag: \tNG % countryName:\tNigeria %' +\r\n 'dialCode: +235 % flag: \tTD % countryName:\tChad %' +\r\n 'dialCode: +236 % flag: \tCF % countryName:\tCentral African Republic %' +\r\n 'dialCode: +237 \t % flag:\tCM % countryName:\tCameroon %' +\r\n 'dialCode: +238 % flag: \tCV % countryName:\tCape Verde %' +\r\n 'dialCode: +239 % flag:\tST % countryName:\tSao Tome and Principe %' +\r\n 'dialCode: +240 % flag:\tGQ % countryName:\tEquatorial Guinea %' +\r\n 'dialCode: +241 % flag: \tGA % countryName:\tGabon %' +\r\n 'dialCode: +242 % flag: \tCG % countryName:\tCongo %' +\r\n 'dialCode: +243 % flag: \tCD % countryName:\tCongo, The Democratic Republic of the Congo %' +\r\n 'dialCode: +244 % flag:\tAO % countryName:\tAngola %' +\r\n 'dialCode: +245 % flag:\tGW % countryName:\tGuinea-Bissau %' +\r\n 'dialCode: +246 % flag:\tIO % countryName:\tBritish Indian Ocean Territory %' +\r\n 'dialCode: +248 % flag:\tSC % countryName:\tSeychelles %' +\r\n 'dialCode: +249 % flag: \tSD % countryName:\tSudan %' +\r\n 'dialCode: +250 % flag: \tRW % countryName:\tRwanda %' +\r\n 'dialCode: +251 % flag: \tET % countryName:\tEthiopia %' +\r\n 'dialCode: +252 \t % flag:\tSO % countryName:\tSomalia %' +\r\n 'dialCode: +253 % flag:\tDJ % countryName:\tDjibouti %' +\r\n 'dialCode: +254 % flag:\tKE % countryName:\tKenya %' +\r\n 'dialCode: +255 \t % flag:\tTZ % countryName:\tTanzania, United Republic of Tanzania %' +\r\n 'dialCode: +256 % flag:\tUG % countryName:\tUganda %' +\r\n 'dialCode: +257 % flag: \tBI % countryName:\tBurundi %' +\r\n 'dialCode: +258 % flag: \tMZ % countryName:\tMozambique %' +\r\n 'dialCode: +260 \t % flag:\tZM % countryName:\tZambia %' +\r\n 'dialCode: +261 % flag: \tMG % countryName:\tMadagascar %' +\r\n 'dialCode: +262 % flag: \tTF % countryName:\tFrench Southern Territories %' +\r\n 'dialCode: +262 % flag:\tYT % countryName:\tMayotte %' +\r\n 'dialCode: +262 % flag: \tRE % countryName:\tReunion %' +\r\n 'dialCode: +263 % flag: \tZW % countryName:\tZimbabwe %' +\r\n 'dialCode: +264 % flag: \tNA % countryName:\tNamibia %' +\r\n 'dialCode: +265 % flag: \tMW % countryName:\tMalawi %' +\r\n 'dialCode: +266 % flag:\tLS % countryName:\tLesotho %' +\r\n 'dialCode: +267 % flag: \tBW % countryName:\tBotswana %' +\r\n 'dialCode: +268 % flag: \tSZ % countryName:\tSwaziland %' +\r\n 'dialCode: +269 % flag: \tKM % countryName:\tComoros %' +\r\n 'dialCode: +27 \t % flag:\tZA % countryName:\tSouth Africa %' +\r\n 'dialCode: +290 % flag: \tSH % countryName:\tSaint Helena, Ascension and Tristan Da Cunha %' +\r\n 'dialCode: +291 % flag: \tER % countryName:\tEritrea %' +\r\n 'dialCode: +297 \t % flag:\tAW % countryName:\tAruba %' +\r\n 'dialCode: +298 \t % flag:\tFO % countryName:\tFaroe Islands %' +\r\n 'dialCode: +299 % flag: \tGL % countryName:\tGreenland %' +\r\n 'dialCode: +30 % flag: \tGR % countryName:\tGreece %' +\r\n 'dialCode: +31 % flag: \tNL % countryName:\tNetherlands %' +\r\n 'dialCode: +32 % flag: \tBE % countryName:\tBelgium %' +\r\n 'dialCode: +33 % flag: \tFR % countryName:\tFrance %' +\r\n 'dialCode: +34 % flag: \tES % countryName:\tSpain %' +\r\n 'dialCode: +345 % flag: \tKY % countryName:\tCayman Islands %' +\r\n 'dialCode: +350 % flag: \tGI % countryName:\tGibraltar %' +\r\n 'dialCode: +351 % flag: \tPT % countryName:\tPortugal %' +\r\n 'dialCode: +352 % flag: \tLU % countryName:\tLuxembourg %' +\r\n 'dialCode: +353 % flag: \tIE % countryName:\tIreland %' +\r\n 'dialCode: +354 % flag: \tIS % countryName:\tIceland %' +\r\n 'dialCode: +355 % flag: \tAL % countryName:\tAlbania %' +\r\n 'dialCode: +356 % flag: \tMT % countryName:\tMalta %' +\r\n 'dialCode: +357 % flag: \tCY % countryName:\tCyprus %' +\r\n 'dialCode: +358 % flag: \tAX % countryName:\tÅland Islands %' +\r\n 'dialCode: +358 % flag: \tFI % countryName:\tFinland %' +\r\n 'dialCode: +359 % flag: \tBG % countryName:\tBulgaria %' +\r\n 'dialCode: +36 % flag: \tHU % countryName:\tHungary %' +\r\n 'dialCode: +370 \t % flag:\tLT % countryName:\tLithuania %' +\r\n 'dialCode: +371 % flag: \tLV % countryName:\tLatvia %' +\r\n 'dialCode: +372 % flag: \tEE % countryName:\tEstonia %' +\r\n 'dialCode: +373 % flag: \tMD % countryName:\tMoldova %' +\r\n 'dialCode: +374 % flag: \tAM % countryName:\tArmenia %' +\r\n 'dialCode: +375 % flag: \tBY % countryName:\tBelarus %' +\r\n 'dialCode: +376 % flag: \tAD % countryName:\tAndorra %' +\r\n 'dialCode: +377 % flag:\t \tMC % countryName:\tMonaco %' +\r\n 'dialCode: +378 % flag: \tSM % countryName:\tSan Marino %' +\r\n 'dialCode: +379 % flag: \tVA % countryName:\tHoly See (Vatican City State) %' +\r\n 'dialCode: +380 % flag: \tUA % countryName:\tUkraine %' +\r\n 'dialCode: +381 % flag:\t \tRS % countryName:\tSerbia %' +\r\n 'dialCode: +382 % flag: \tME % countryName:\tMontenegro %' +\r\n 'dialCode: +383 % flag: \tXK % countryName:\tKosovo %' +\r\n 'dialCode: +385 % flag: \tHR % countryName:\tCroatia %' +\r\n 'dialCode: +386 % flag:\tSI % countryName:\tSlovenia %' +\r\n 'dialCode: +387 % flag: \tBA % countryName:\tBosnia and Herzegovina %' +\r\n 'dialCode: +389 % flag: \tMK % countryName:\tNorth Macedonia %' +\r\n 'dialCode: +39 % flag: \tIT % countryName:\tItaly %' +\r\n 'dialCode: +40 % flag: \tRO % countryName:\tRomania %' +\r\n 'dialCode: +41 % flag:\tCH % countryName:\tSwitzerland %' +\r\n 'dialCode: +420 % flag: \tCZ % countryName:\tCzech Republic %' +\r\n 'dialCode: +421 % flag: \tSK % countryName:\tSlovakia %' +\r\n 'dialCode: +423 % flag:\tLI % countryName:\tLiechtenstein %' +\r\n 'dialCode: +43 % flag: \tAT % countryName:\tAustria %' +\r\n 'dialCode: +44 % flag: \tGG % countryName:\tGuernsey %' +\r\n 'dialCode: +44 % flag:\t \tIM % countryName:\tIsle of Man %' +\r\n 'dialCode: +44 % flag:\t \tJE % countryName:\tJersey %' +\r\n 'dialCode: +44 % flag:\t \tGB % countryName:\tUnited Kingdom %' +\r\n 'dialCode: +45 % flag:\t \tDK % countryName:\tDenmark %' +\r\n 'dialCode: +46 % flag: \tSE % countryName:\tSweden %' +\r\n 'dialCode: +47 % flag:\t \tBV % countryName:\tBouvet Island %' +\r\n 'dialCode: +47 % flag: \tNO % countryName:\tNorway %' +\r\n 'dialCode: +47 % flag: \tSJ % countryName:\tSvalbard and Jan Mayen %' +\r\n 'dialCode: +48 % flag: \tPL % countryName:\tPoland %' +\r\n 'dialCode: +49 % flag: \tDE % countryName:\tGermany %' +\r\n 'dialCode: +500 % flag: \tFK % countryName:\tFalkland Islands (Malvinas) %' +\r\n 'dialCode: +500 % flag: \tGS % countryName:\tSouth Georgia and the South Sandwich Islands %' +\r\n 'dialCode: +501 % flag:\tBZ % countryName:\tBelize %' +\r\n 'dialCode: +502 % flag: \tGT % countryName:\tGuatemala %' +\r\n 'dialCode: +503 % flag:\tSV \t % countryName: El Salvador %' +\r\n 'dialCode: +504 % flag: \tHN % countryName:\tHonduras %' +\r\n 'dialCode: +505 % flag:\tNI % countryName:\tNicaragua %' +\r\n 'dialCode: +506 \t % flag:\tCR % countryName:\tCosta Rica %' +\r\n 'dialCode: +507 % flag: \tPA % countryName:\tPanama %' +\r\n 'dialCode: +508 % flag: \tPM % countryName:\tSaint Pierre and Miquelon %' +\r\n 'dialCode: +509 % flag:\tHT % countryName:\tHaiti %' +\r\n 'dialCode: +51 % flag:\tPE % countryName:\tPeru %' +\r\n 'dialCode: +52 % flag: \tMX % countryName:\tMexico %' +\r\n 'dialCode: +53 % flag: \tCU % countryName:\tCuba %' +\r\n 'dialCode: +54 % flag: \tAR % countryName:\tArgentina %' +\r\n 'dialCode: +55 % flag: \tBR % countryName:\tBrazil %' +\r\n 'dialCode: +56 % flag: \tCL % countryName:\tChile %' +\r\n 'dialCode: +57 % flag: \tCO % countryName:\tColombia %' +\r\n 'dialCode: +58 % flag: \tVE % countryName:\tVenezuela, Bolivarian Republic of Venezuela %' +\r\n 'dialCode: +590 % flag: \tGP % countryName:\tGuadeloupe %' +\r\n 'dialCode: +590 \t % flag:\tBL % countryName:\tSaint Barthelemy %' +\r\n 'dialCode: +590 \t % flag:\tMF % countryName:\tSaint Martin %' +\r\n 'dialCode: +591 % flag:\tBO % countryName:\tBolivia, Plurinational State of bolivia %' +\r\n 'dialCode: +592 % flag: \tGY % countryName:\tGuyana %' +\r\n 'dialCode: +593 % flag: \tEC % countryName:\tEcuador %' +\r\n 'dialCode: +594 % flag: \tGF % countryName:\tFrench Guiana %' +\r\n 'dialCode: +595 % flag: \tPY % countryName:\tParaguay %' +\r\n 'dialCode: +596 % flag: \tMQ % countryName:\tMartinique %' +\r\n 'dialCode: +597 % flag: \tSR % countryName:\tSuriname %' +\r\n 'dialCode: +598 % flag: \tUY % countryName:\tUruguay %' +\r\n // 'dialCode: +599 % flag:\tAN % countryName:\tNetherlands Antilles %' +\r\n 'dialCode: +60 % flag: \tMY % countryName:\tMalaysia %' +\r\n 'dialCode: +61 % flag: \tAU % countryName:\tAustralia %' +\r\n 'dialCode: +61 % flag: \tCX % countryName:\tChristmas Island %' +\r\n 'dialCode: +61 % flag: \tCC % countryName:\tCocos (Keeling) Islands %' +\r\n 'dialCode: +62 \t % flag:\tID % countryName:\tIndonesia %' +\r\n 'dialCode: +63 \t % flag:\tPH % countryName:\tPhilippines %' +\r\n 'dialCode: +64 % flag: \tNZ % countryName:\tNew Zealand %' +\r\n 'dialCode: +64 % flag: \tPN % countryName:\tPitcairn %' +\r\n 'dialCode: +65 % flag: \tSG % countryName:\tSingapore %' +\r\n 'dialCode: +66 % flag: \tTH % countryName:\tThailand %' +\r\n 'dialCode: +670 % flag: \tTL % countryName:\tTimor-Leste %' +\r\n 'dialCode: +672 % flag:\tAQ % countryName:\tAntarctica %' +\r\n 'dialCode: +672 % flag: \tHM % countryName:\tHeard Island and Mcdonald Islands %' +\r\n 'dialCode: +672 % flag: \tNF % countryName:\tNorfolk Island %' +\r\n 'dialCode: +673 % flag: \tBN % countryName:\tBrunei Darussalam %' +\r\n 'dialCode: +674 % flag:\tNR % countryName:\tNauru %' +\r\n 'dialCode: +675 \t % flag:\tPG % countryName:\tPapua New Guinea %' +\r\n 'dialCode: +676 \t % flag:\tTO % countryName:\tTonga %' +\r\n 'dialCode: +677 \t % flag:\tSB % countryName:\tSolomon Islands %' +\r\n 'dialCode: +678 \t % flag:\tVU % countryName:\tVanuatu %' +\r\n 'dialCode: +679 % flag:\tFJ % countryName:\tFiji %' +\r\n 'dialCode: +680 \t % flag:\tPW % countryName:\tPalau %' +\r\n 'dialCode: +681 \t % flag:\tWF % countryName:\tWallis and Futuna %' +\r\n 'dialCode: +682 \t % flag:\tCK % countryName:\tCook Islands %' +\r\n 'dialCode: +683 \t % flag:\tNU % countryName:\tNiue %' +\r\n 'dialCode: +685 \t % flag:\tWS % countryName:\tSamoa %' +\r\n 'dialCode: +686 \t % flag:\tKI % countryName:\tKiribati %' +\r\n 'dialCode: +687 \t % flag:\tNC % countryName:\tNew Caledonia %' +\r\n 'dialCode: +688 \t % flag:\tTV % countryName:\tTuvalu %' +\r\n 'dialCode: +689 \t % flag:\tPF % countryName:\tFrench Polynesia %' +\r\n 'dialCode: +690 \t % flag:\tTK % countryName:\tTokelau %' +\r\n 'dialCode: +691 \t % flag:\tFM % countryName:\tMicronesia, Federated States of Micronesia %' +\r\n 'dialCode: +692 \t % flag:\tMH % countryName:\tMarshall Islands %' +\r\n 'dialCode: +7 \t % flag:\tKZ % countryName:\tKazakhstan %' +\r\n 'dialCode: +7 \t % flag:\tRU % countryName:\tRussia %' +\r\n 'dialCode: +81 % flag:\tJP % countryName:\tJapan %' +\r\n 'dialCode: +82 % flag: \tKR % countryName:\tKorea, Republic of South Korea %' +\r\n 'dialCode: +84 % flag: \tVN % countryName:\tVietnam %' +\r\n 'dialCode: +850 % flag: \tKP % countryName:\tKorea, Democratic Peoples Republic of Korea %' +\r\n 'dialCode: +852 % flag: \tHK % countryName:\tHong Kong %' +\r\n 'dialCode: +853 % flag: \tMO % countryName:\tMacao %' +\r\n 'dialCode: +855 % flag: \tKH % countryName:\tCambodia %' +\r\n 'dialCode: +856 % flag: \tLA % countryName:\tLaos %' +\r\n 'dialCode: +86 % flag: \tCN % countryName:\tChina %' +\r\n 'dialCode: +880 % flag: \tBD % countryName:\tBangladesh %' +\r\n 'dialCode: +886 % flag:\tTW % countryName:\tTaiwan %' +\r\n 'dialCode: +90 % flag: \tTR % countryName:\tTürkiye %' +\r\n 'dialCode: +91 % flag: \tIN % countryName:\tIndia %' +\r\n 'dialCode: +92 % flag: \tPK % countryName:\tPakistan %' +\r\n 'dialCode: +93 % flag: \tAF % countryName:\tAfghanistan %' +\r\n 'dialCode: +94 % flag: \tLK % countryName:\tSri Lanka %' +\r\n 'dialCode: +95 % flag:\tMM % countryName:\tMyanmar %' +\r\n 'dialCode: +960 % flag: \tMV % countryName:\tMaldives %' +\r\n 'dialCode: +961 % flag: \tLB % countryName:\tLebanon %' +\r\n 'dialCode: +962 % flag: \tJO % countryName:\tJordan %' +\r\n 'dialCode: +963 % flag: \tSY % countryName:\tSyrian Arab Republic %' +\r\n 'dialCode: +964 % flag: \tIQ % countryName:\tIraq %' +\r\n 'dialCode: +965 % flag:\tKW % countryName:\tKuwait %' +\r\n 'dialCode: +966 % flag: \tSA % countryName:\tSaudi Arabia %' +\r\n 'dialCode: +967 % flag: \tYE % countryName:\tYemen %' +\r\n 'dialCode: +968 % flag: \tOM % countryName:\tOman %' +\r\n 'dialCode: +970 % flag: \tPS % countryName:\tPalestinian Territory, Occupied %' +\r\n 'dialCode: +971 % flag: \tAE % countryName:\tUnited Arab Emirates %' +\r\n 'dialCode: +972 % flag: \tIL % countryName:\tIsrael %' +\r\n 'dialCode: +973 % flag: \tBH % countryName:\tBahrain %' +\r\n 'dialCode: +974 % flag: \tQA % countryName:\tQatar %' +\r\n 'dialCode: +975 % flag: \tBT % countryName:\tBhutan %' +\r\n 'dialCode: +976 % flag: \tMN % countryName:\tMongolia %' +\r\n 'dialCode: +977 % flag: \tNP % countryName:\tNepal %' +\r\n 'dialCode: +98 % flag: \tIR % countryName:\tIran, Islamic Republic of Persian Gulf %' +\r\n 'dialCode: +992 % flag: \tTJ % countryName:\tTajikistan %' +\r\n 'dialCode: +993 \t % flag:\tTM % countryName:\tTurkmenistan %' +\r\n 'dialCode: +994 % flag:\tAZ % countryName:\tAzerbaijan %' +\r\n 'dialCode: +995 % flag:\tGE % countryName:\tGeorgia %' +\r\n 'dialCode: +996 \t % flag:\tKG % countryName:\tKyrgyzstan %' +\r\n 'dialCode: +998 % flag: \tUZ % countryName:\tUzbekistan'\r\n\r\n public getContryObject(): {\r\n dialCode: string,\r\n flag: string,\r\n countryName: string\r\n }[] {\r\n\r\n\r\n let arr: string[] = this.str\r\n .replace(/\\t/g, '')\r\n .replace(/dialCode:/g, '')\r\n .replace(/flag:/g, '')\r\n .replace(/countryName:/g, '')\r\n .split('%');\r\n\r\n let obj: {\r\n dialCode: string,\r\n flag: string,\r\n countryName: string\r\n }[] = [];\r\n\r\n\r\n for (let i = 0; i < arr.length; i += 3) {\r\n obj[obj.length] = {\r\n dialCode: arr[i].replace(/\\s/g, ''),\r\n flag: arr[i + 1].replace(/\\s/g, ''),\r\n countryName: arr[i + 2]\r\n }\r\n }\r\n\r\n obj.sort((country1: Country, country2 : Country) => {\r\n return country1.countryName.localeCompare(country2.countryName);\r\n });\r\n\r\n return obj;\r\n\r\n }\r\n\r\n\r\n}\r\n\r\n\r\nexport interface Country{\r\n dialCode: string,\r\n flag: string,\r\n countryName: string\r\n}","import {AbstractControl, FormArray, ValidationErrors, ValidatorFn} from '@angular/forms';\r\nimport {Util} from '../../generico/util';\r\nimport moment from 'moment';\r\n\r\nexport class CustomValidators {\r\n static greaterThanDate(startControl: AbstractControl): ValidatorFn {\r\n return (endControl: AbstractControl): ValidationErrors | null => {\r\n if (!startControl.value || !endControl.value) {\r\n return null;\r\n }\r\n const startDate: Date = moment.isMoment(startControl.value) ? startControl.value.toDate() : new Date(startControl.value);\r\n const endDate: Date = moment.isMoment(endControl.value) ? endControl.value.toDate() : new Date(endControl.value);\r\n if (startDate > endDate) {\r\n return {greaterThan: true};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static equals(incomeControl: AbstractControl): ValidatorFn {\r\n return (thisControl: AbstractControl): ValidationErrors | null => {\r\n const incomeValue: string = incomeControl.value;\r\n const thisValue: string = thisControl.value;\r\n if (!incomeValue || !thisValue) {\r\n return null;\r\n }\r\n\r\n return incomeValue !== thisValue ? {equal: true} : null;\r\n };\r\n }\r\n\r\n static lesserThanDate(startControl: AbstractControl): ValidatorFn {\r\n return (endControl: AbstractControl): ValidationErrors | null => {\r\n if (!startControl.value || !endControl.value) {\r\n return null;\r\n }\r\n const startDate: Date = moment.isMoment(startControl.value) ? startControl.value.toDate() : new Date(startControl.value);\r\n const endDate: Date = moment.isMoment(endControl.value) ? endControl.value.toDate() : new Date(endControl.value);\r\n if (startDate < endDate) {\r\n return {lesserThan: true};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static greaterThan(startControl: AbstractControl, integer: boolean = false): ValidatorFn {\r\n return (endControl: AbstractControl): ValidationErrors | null => {\r\n if (startControl.value !== 0 && endControl.value !== 0 && (!startControl.value || !endControl.value)) {\r\n return null;\r\n }\r\n const start: number = integer ? parseInt(startControl.value, 10) : Util.convertToFloat(startControl.value);\r\n const end: number = integer ? parseInt(endControl.value, 10) : Util.convertToFloat(endControl.value);\r\n if (end > start) {\r\n return {greaterThan: {max: start, value: end}};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static lesserThan(startControl: AbstractControl, integer: boolean = false): ValidatorFn {\r\n return (endControl: AbstractControl): ValidationErrors | null => {\r\n if (startControl.value !== 0 && endControl.value !== 0 && (!startControl.value || !endControl.value)) {\r\n return null;\r\n }\r\n const start: number = integer ? parseInt(startControl.value, 10) : Util.convertToFloat(startControl.value);\r\n const end: number = integer ? parseInt(endControl.value, 10) : Util.convertToFloat(endControl.value);\r\n if (start > end) {\r\n return {lesserThan: {min: start, value: end}};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static greaterThanEqual(startControl: AbstractControl, integer: boolean = false): ValidatorFn {\r\n return (endControl: AbstractControl): ValidationErrors | null => {\r\n if (!startControl.value || !endControl.value) {\r\n return null;\r\n }\r\n const start: number = integer ? parseInt(startControl.value, 10) : Util.convertToFloat(startControl.value);\r\n const end: number = integer ? parseInt(endControl.value, 10) : Util.convertToFloat(endControl.value);\r\n if (end >= start) {\r\n return {greaterThanEqual: {max: startControl.value, value: endControl.value}};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static lesserThanEqual(startControl: AbstractControl, integer: boolean = false): ValidatorFn {\r\n return (endControl: AbstractControl): ValidationErrors | null => {\r\n if (!startControl.value || !endControl.value) {\r\n return null;\r\n }\r\n const start: number = integer ? parseInt(startControl.value, 10) : Util.convertToFloat(startControl.value);\r\n const end: number = integer ? parseInt(endControl.value, 10) : Util.convertToFloat(endControl.value);\r\n if (start >= end) {\r\n return {lesserThanEqual: {min: startControl.value, value: endControl.value}};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static notEmpty(): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors | null => {\r\n const formArray = control as FormArray;\r\n if (!formArray || formArray.length === 0) {\r\n return {empty: true};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static notEmptyArray(): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors | null => {\r\n const array = control.value;\r\n if (!Array.isArray(array) || array?.length === 0) {\r\n return {empty: true};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static greaterThanZero(): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors | null => {\r\n const value = Util.convertToFloat(control.value);\r\n if (isNaN(value) || value <= 0) {\r\n return {greaterThanZero: true};\r\n }\r\n return null;\r\n };\r\n }\r\n\r\n static destinatario(): ValidatorFn {\r\n return (control: AbstractControl): ValidationErrors | null => {\r\n const value = control.value;\r\n if (!value) {\r\n return null;\r\n }\r\n const regex = /^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$/;\r\n const val = value.split(/[,;]/).filter(email => !regex.test(email.trim()));\r\n return val.length <= 0 ? null : {invalid: {emails: val.join(';')}};\r\n };\r\n }\r\n}\r\n","export class FiltrosClientes {\r\n DocIdentificacao?: string;\r\n constructor(\r\n public IdEntidade?: number,\r\n public CodigoFiltro?: number,\r\n public Codigo?: string,\r\n public Email?: string,\r\n public Nome?: string,\r\n public NIF?: string,\r\n public DataRegistoDe?: string,\r\n public DataRegistoAte?: string,\r\n public IdTipos?: number[],\r\n public IdEstados?: number[],\r\n public CodPaises?: string[],\r\n public CodIdiomas?: string[],\r\n public NumeroRegistos?: number,\r\n public PageSize?: number,\r\n public PageIndex?: number,\r\n public Utilizador?: any,\r\n public FiltrarData?: boolean,\r\n ) {\r\n }\r\n}\r\n","export interface ClienteFacturacao {\r\n idEntidade?: number;\r\n entidadeP?: string;\r\n idCliente?: number;\r\n idDadosFacturacao?: number;\r\n idMetodoPagRec?: number;\r\n idCondicaoPagamento?: number;\r\n metodoPagRec?: string;\r\n mesesDiaFixo?: number;\r\n diaFixo?: boolean;\r\n dias?: string;\r\n codCliente?: string;\r\n nome?: string;\r\n cidade?: string;\r\n email?: string;\r\n nif?: string;\r\n niffact?: string;\r\n idEstado?: number;\r\n estado?: string;\r\n idMoeda?: number;\r\n codMoeda?: string;\r\n nomeFact?: string;\r\n nifFact?: string;\r\n idPaisFact?: number;\r\n codPaisFact?: string;\r\n paisFact?: string;\r\n idProvinciaFact?: number;\r\n provinciaFact?: string;\r\n provicnciaFact?: string;\r\n idMunicipioFact?: number;\r\n municipioFact?: string;\r\n idZonaFact?: number;\r\n zonaFact?: string;\r\n moradaFact?: string;\r\n codPostalFact?: string;\r\n codPersonJuridica?: string;\r\n designacaoCodPostalFact?: string;\r\n clientesRetencoes?: any [];\r\n dadosComerciais?:any;\r\n activoFact?: boolean;\r\n generico?: boolean;\r\n precoDefault?: number;\r\n entidadeCliente?: boolean;\r\n entidadeFornecedor?: boolean;\r\n entidadeEstado?: boolean;\r\n entidadeColaborador?: boolean\r\n}\r\n\r\n\r\nexport function newClienteFat(c: any) {\r\n return {\r\n idEntidade: c.idEntidade,\r\n idCliente: c.idCliente,\r\n codCliente: c.codigo,\r\n nif: c.nif,\r\n nome: c.nome,\r\n idMetodoPagRec: c.idMetodoPagRec\r\n };\r\n}\r\n","import {Entidades} from '../clientes/entidades';\r\nimport {AbstractControl, FormArray, FormControl, FormGroup, Validators} from '@angular/forms';\r\nimport {Paises} from '../aplicacao/paises';\r\nimport {DAY} from 'app/views/artigos/renovavel-form/renovavel-form.component';\r\nimport {DataTypes} from 'app/views/gestao-arquivos/ga-tipo-campo/ga-tipo-campo.component';\r\nimport {Permissoes} from '../aplicacao/permissoes';\r\nimport * as XLSX from 'xlsx';\r\n\r\nexport class Util {\r\n\r\n public OpcaoNaoUsado = 1;\r\n\r\n static timeInput(target: HTMLInputElement) {\r\n const position = target.selectionStart;\r\n target.value = this.timeFormat(target.value);\r\n const offset = Number(target.value.length === 4);\r\n target.selectionStart = position + offset;\r\n target.selectionEnd = target.selectionStart;\r\n }\r\n\r\n static timeFormat(value: string) {\r\n let formattedValue = value.replace(/\\D/g, '');\r\n\r\n if (formattedValue.length > 2) {\r\n const minutes = parseInt(formattedValue.slice(2), 10) > 59 ? 59 : formattedValue.slice(2);\r\n const hours = parseInt(formattedValue.slice(0, 2), 10) > 23 ? 23 : formattedValue.slice(0, 2);\r\n formattedValue = `${hours}:${minutes}`;\r\n }\r\n\r\n return formattedValue.slice(0, 5);\r\n }\r\n\r\n static formatTimeWithTwoDigits(date: Date): string {\r\n if (!date) {\r\n return '00:00';\r\n }\r\n date = new Date(date);\r\n const hours = date.getHours().toString().padStart(2, '0');\r\n const minutes = date.getMinutes().toString().padStart(2, '0');\r\n date.setSeconds(0);\r\n return `${hours}:${minutes}`;\r\n }\r\n\r\n static timeStringToDecimal(timeString: string): number {\r\n const [hoursStr, minutesStr] = timeString.split(':');\r\n const hours = parseInt(hoursStr, 10);\r\n const minutes = parseInt(minutesStr, 10);\r\n return this.timeDecimal(hours, minutes);\r\n }\r\n\r\n static groupByCodeArea(permissoes: Permissoes[]): Record {\r\n return permissoes.reduce((groups, permissao) => {\r\n const {area} = permissao;\r\n if (!groups[area]) {\r\n groups[area] = [];\r\n }\r\n groups[area].push(permissao);\r\n return groups;\r\n }, {} as Record);\r\n }\r\n\r\n static organizarTiposArtigo(tipos: any[]): any[] {\r\n return tipos.reduce((acc, element) => {\r\n const updatedAcc = [...acc, element];\r\n if (element.tiposFilhos?.length > 0) {\r\n return [...updatedAcc, ...this.organizarTiposArtigo(element.tiposFilhos)];\r\n }\r\n return updatedAcc;\r\n }, []);\r\n }\r\n\r\n static repeat(arr: any, n: number) {\r\n return [].concat(...Array(n).fill(arr));\r\n }\r\n\r\n static timeDecimal(hours: number, minutes: number) {\r\n const decimalHours = hours + (minutes / 60);\r\n return Math.round(decimalHours * 100) / 100;\r\n }\r\n\r\n static base64ToArray(base64: string) {\r\n const bytes = this.base64ToArrayBuffer(base64);\r\n const workbook = XLSX.read(bytes, {type: 'array'});\r\n const worksheet = workbook.Sheets[workbook.SheetNames[0]];\r\n return XLSX.utils.sheet_to_json(worksheet);\r\n }\r\n\r\n static sliceArrayIntoChunks(dataArray: any, chunkSize: number, transform?: (item: any) => any) {\r\n const chunks = [];\r\n for (let i = 0; i < dataArray.length; i += chunkSize) {\r\n const chunk = dataArray.slice(i, i + chunkSize);\r\n chunks.push(transform ? transform(chunk) : chunk);\r\n }\r\n return chunks;\r\n }\r\n\r\n static bytesToBase64(bytes: string) {\r\n let binary = '';\r\n for (let i = 0; i < bytes.length; i++) {\r\n binary += String.fromCharCode(bytes.charCodeAt(i));\r\n }\r\n return btoa(binary);\r\n }\r\n\r\n static arrayToBase64(arrayChunk) {\r\n const jsonString = JSON.stringify(arrayChunk);\r\n const bytes = new TextEncoder().encode(jsonString);\r\n const binaryString = String.fromCharCode(...bytes);\r\n return btoa(binaryString);\r\n }\r\n\r\n static deepCompare(obj1, obj2) {\r\n // Check if the two items are the same object in memory\r\n if (obj1 === obj2) {\r\n return true;\r\n }\r\n\r\n // Check if either item is null or not an object\r\n if (typeof obj1 !== 'object' || obj1 === null ||\r\n typeof obj2 !== 'object' || obj2 === null) {\r\n return obj1 === obj2;\r\n }\r\n\r\n // Check if both items are arrays\r\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\r\n if (obj1.length !== obj2.length) {\r\n return false;\r\n }\r\n for (let i = 0; i < obj1.length; i++) {\r\n if (!this.deepCompare(obj1[i], obj2[i])) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n // Check if both items are dates\r\n if (obj1 instanceof Date && obj2 instanceof Date) {\r\n return obj1.getTime() === obj2.getTime();\r\n }\r\n\r\n // Check if both items are regular expressions\r\n if (obj1 instanceof RegExp && obj2 instanceof RegExp) {\r\n return obj1.toString() === obj2.toString();\r\n }\r\n\r\n // Get the keys of both objects\r\n const keys1 = Object.keys(obj1);\r\n const keys2 = Object.keys(obj2);\r\n\r\n // Check if the objects have the same number of properties\r\n if (keys1.length !== keys2.length) {\r\n return false;\r\n }\r\n\r\n // Check if all properties in obj1 exist in obj2 with the same values\r\n for (const key of keys1) {\r\n if (!keys2.includes(key) || !this.deepCompare(obj1[key], obj2[key])) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n static areObjectsEqual(obj1, obj2) {\r\n // Get the keys of the objects\r\n const keys1 = Object.keys(obj1);\r\n const keys2 = Object.keys(obj2);\r\n\r\n // Check if the number of properties is the same\r\n if (keys1.length !== keys2.length) {\r\n return false;\r\n }\r\n\r\n // Check the values of each property\r\n for (const key of keys1) {\r\n // Check if the property exists in both objects\r\n if (!(key in obj2)) {\r\n return false;\r\n }\r\n\r\n // Compare the values of the properties\r\n if (obj1[key] !== obj2[key]) {\r\n return false;\r\n }\r\n }\r\n\r\n // All properties have the same values\r\n return true;\r\n }\r\n\r\n static getValue(obj: any, key: string) {\r\n const keys = key.split('.');\r\n let value = obj;\r\n\r\n for (const element of keys) {\r\n value = value ? value[element] : null;\r\n }\r\n\r\n return value;\r\n }\r\n\r\n static compareObjectsByKeys(obj1: any, obj2: any, keys: string[]) {\r\n // Check if both inputs are objects\r\n if (typeof obj1 !== 'object' || typeof obj2 !== 'object') {\r\n return false;\r\n }\r\n\r\n // Compare each key\r\n return keys.every(key => this.getValue(obj1, key) === this.getValue(obj2, key));\r\n }\r\n\r\n static timeString(decimalTime) {\r\n const hours = Math.floor(decimalTime);\r\n const minutes = Math.round((decimalTime % 1) * 60);\r\n return `${hours}:${minutes.toString().padStart(2, '0')}`;\r\n }\r\n\r\n static formatTime(date: Date) {\r\n date = date ? new Date(date) : null;\r\n if (isNaN(date?.getTime())) {\r\n return '';\r\n }\r\n const d0 = new Date(date);\r\n const m0 = d0.getMinutes() < 10 ? `0${d0.getMinutes()}` : `${d0.getMinutes()}`;\r\n const h0 = d0.getHours() < 10 ? `0${d0.getHours()}` : `${d0.getHours()}`;\r\n return `${h0}:${m0}`;\r\n }\r\n\r\n static moradaInput(e: Event) {\r\n const textarea = e.target as HTMLTextAreaElement;\r\n const lineHeight = parseInt(getComputedStyle(textarea).lineHeight, 10);\r\n const lines = Math.floor(textarea.scrollHeight / lineHeight);\r\n const brs = textarea.value.split('\\n');\r\n\r\n if (brs.length > 3) {\r\n textarea.value = brs.slice(0, 3).join('\\n');\r\n return;\r\n }\r\n\r\n if (lines > 3) {\r\n textarea.value = textarea.value.slice(0, -1);\r\n }\r\n }\r\n\r\n static duration(startDate: Date, endDate: Date) {\r\n const t0 = startDate?.getTime();\r\n const tf = endDate?.getTime();\r\n if ((isNaN(t0) || isNaN(tf)) || (startDate > endDate)) {\r\n return '';\r\n }\r\n\r\n const duration = tf - t0;\r\n const totalSeconds = Math.floor(duration / 1000);\r\n\r\n if (totalSeconds < 60) {\r\n return `${totalSeconds} segundos`;\r\n } else if (totalSeconds < 3600) {\r\n const totalMinutes = Math.floor(totalSeconds / 60);\r\n return `${totalMinutes} minutos`;\r\n } else if (totalSeconds < 86400) {\r\n const hours = Math.floor(totalSeconds / 3600);\r\n const minutes = Math.floor((totalSeconds % 3600) / 60);\r\n return `${hours} horas, ${minutes} minutos`;\r\n } else if (totalSeconds < 2592000) {\r\n const days = Math.floor(totalSeconds / 86400);\r\n const hours = Math.floor((totalSeconds % 86400) / 3600);\r\n const minutes = Math.floor(((totalSeconds % 86400) % 3600) / 60);\r\n return `${days} dias, ${hours} horas, ${minutes} minutos`;\r\n } else if (totalSeconds < 31536000) {\r\n const months = Math.floor(totalSeconds / 2592000);\r\n return `${months} meses`;\r\n } else {\r\n const years = Math.floor(totalSeconds / 31536000);\r\n return `${years} anos`;\r\n }\r\n }\r\n\r\n static calculateMinutes(startDate: Date, endDate: Date) {\r\n const t0 = startDate?.getTime();\r\n const tf = endDate?.getTime();\r\n if ((isNaN(t0) || isNaN(tf)) || (startDate > endDate)) {\r\n return null;\r\n }\r\n const duration = tf - t0;\r\n const diffInMinutes = duration / (1000 * 60);\r\n return Math.round(diffInMinutes);\r\n }\r\n\r\n static calculateIntervals(startDate: Date, endDate: Date, intervaloMinutos: number) {\r\n const t0 = startDate?.getTime();\r\n const tf = endDate?.getTime();\r\n if ((isNaN(t0) || isNaN(tf)) || (startDate > endDate)) {\r\n return null;\r\n }\r\n const duration = tf - t0;\r\n const intervalDurationInMilliseconds = intervaloMinutos * 1000 * 60;\r\n return duration / intervalDurationInMilliseconds;\r\n }\r\n\r\n static parseDuration(durationString: string): number[] {\r\n const parts = durationString.split(', ');\r\n const result: number[] = [0, 0, 0, 0, 0];\r\n\r\n for (const part of parts) {\r\n if (part.endsWith(' anos')) {\r\n result[0] = parseInt(part.replace(' anos', ''), 10);\r\n } else if (part.endsWith(' meses')) {\r\n result[1] = parseInt(part.replace(' meses', ''), 10);\r\n } else if (part.endsWith(' dias')) {\r\n result[2] = parseInt(part.replace(' dias', ''), 10);\r\n } else if (part.endsWith(' horas')) {\r\n result[3] = parseInt(part.replace(' horas', ''), 10);\r\n } else if (part.endsWith(' minutos')) {\r\n result[4] = parseInt(part.replace(' minutos', ''), 10);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n static base64ToArrayBuffer(base64: string): ArrayBuffer {\r\n const byteString = atob(base64.split(',')[1]);\r\n const ab = new ArrayBuffer(byteString.length);\r\n const ia = new Uint8Array(ab);\r\n for (let i = 0; i < byteString.length; i++) {\r\n ia[i] = byteString.charCodeAt(i);\r\n }\r\n return ab;\r\n }\r\n\r\n static UTCDate(inicio: Date, fim: Date) {\r\n if (inicio && fim) {\r\n const d0 = new Date(inicio);\r\n const d1 = new Date(fim);\r\n return [\r\n new Date(Date.UTC(d0.getFullYear(), d0.getMonth(), d0.getDate())),\r\n new Date(Date.UTC(d1.getFullYear(), d1.getMonth(), d1.getDate()))\r\n ];\r\n }\r\n return [];\r\n }\r\n\r\n static _UTCDate(date: Date | string) {\r\n date = date ? new Date(date) : null;\r\n return date ? new Date(Date.UTC(\r\n date.getFullYear(),\r\n date.getMonth(),\r\n date.getDate(),\r\n date.getHours(),\r\n date.getMinutes())) : null;\r\n }\r\n\r\n static clamp(value: number, min: number, max: number) {\r\n return Math.min(Math.max(value, min), max);\r\n }\r\n\r\n static addDays(date: Date, qtd: number = 1): Date {\r\n return new Date(date.getTime() + qtd * DAY);\r\n }\r\n\r\n static isLeapYear(year: number): boolean {\r\n return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);\r\n }\r\n\r\n static getDaysInMonth(year: number, month: number): number {\r\n return [31, (this.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];\r\n }\r\n\r\n static addMonths(date: Date, value: number = 1): Date {\r\n const n = date.getDate();\r\n const df = new Date(date);\r\n df.setDate(1);\r\n df.setMonth(df.getMonth() + value);\r\n df.setDate(Math.min(n, this.getDaysInMonth(df.getFullYear(), df.getMonth())));\r\n return df;\r\n }\r\n\r\n static getControlErrors(control: FormControl, name: string, errorMap: { [p: string]: string }) {\r\n let errorMessage = '';\r\n if (control.errors) {\r\n Object.keys(control.errors).forEach((errorKey: string) => {\r\n switch (errorKey) {\r\n case 'min':\r\n errorMessage += `${name}: ${errorMap[errorKey]}. Min: ${control.errors['min']['min']}. \\n`;\r\n break;\r\n case 'max':\r\n errorMessage += `${name}: ${errorMap[errorKey]}. Max: ${control.errors['max']['max']}. \\n`;\r\n break;\r\n case 'lesserThan':\r\n errorMessage += `${name}: ${errorMap[errorKey]}. Max: ${control.errors['lesserThan']['min']}. \\n`;\r\n break;\r\n case 'greaterThan':\r\n errorMessage += `${name}: ${errorMap[errorKey]}. Min: ${control.errors['greaterThan']['max']}. \\n`;\r\n break;\r\n case 'lesserThanEqual':\r\n errorMessage += `${name}: ${errorMap[errorKey]}. Max: ${control.errors['lesserThanEqual']['min']}. \\n`;\r\n break;\r\n case 'greaterThanEqual':\r\n errorMessage += `${name}: ${errorMap[errorKey]}. Min: ${control.errors['greaterThanEqual']['max']}. \\n`;\r\n break;\r\n default:\r\n errorMessage += `${name}: ${errorMap[errorKey]}. \\n`;\r\n break;\r\n }\r\n });\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n static getFormErrors(form: FormGroup | FormArray, formNameMap: { [key: string]: string }, errorMap: { [key: string]: string }): string {\r\n let errorMessage = '';\r\n\r\n // Iterate over all the controls in the form group\r\n Object.keys(form.controls).forEach((key: string) => {\r\n const control = form.controls[key];\r\n\r\n // If the control is a form group, recursively call the function\r\n if (control instanceof FormGroup || control instanceof FormArray) {\r\n const nestedErrorMessage = Util.getFormErrors(control, formNameMap, errorMap);\r\n\r\n if (nestedErrorMessage) {\r\n errorMessage += `${formNameMap[key] ?? `[${parseInt(key, 10) + 1}]`}: ${nestedErrorMessage}\\n`;\r\n }\r\n }\r\n\r\n // If the control has errors, concatenate the error messages\r\n if (control.errors) {\r\n Object.keys(control.errors).forEach((errorKey: string) => {\r\n switch (errorKey) {\r\n case 'min':\r\n errorMessage += `${formNameMap[key]}: ${errorMap[errorKey]}. Min: ${control.errors['min']['min']}. \\n`;\r\n break;\r\n case 'max':\r\n errorMessage += `${formNameMap[key]}: ${errorMap[errorKey]}. Max: ${control.errors['max']['max']}. \\n`;\r\n break;\r\n case 'lesserThan':\r\n errorMessage += `${formNameMap[key]}: ${errorMap[errorKey]}. Max: ${control.errors['lesserThan']['min']}. \\n`;\r\n break;\r\n case 'greaterThan':\r\n errorMessage += `${formNameMap[key]}: ${errorMap[errorKey]}. Min: ${control.errors['greaterThan']['max']}. \\n`;\r\n break;\r\n case 'lesserThanEqual':\r\n errorMessage += `${formNameMap[key]}: ${errorMap[errorKey]}. Max: ${control.errors['lesserThanEqual']['min']}. \\n`;\r\n break;\r\n case 'greaterThanEqual':\r\n errorMessage += `${formNameMap[key]}: ${errorMap[errorKey]}. Min: ${control.errors['greaterThanEqual']['max']}. \\n`;\r\n break;\r\n case 'minlength':\r\n errorMessage += `${formNameMap[key] ?? `[${parseInt(key, 10) + 1}]`}: Deve ter no minímo ${control.errors['minlength']['requiredLength']} caracteres. Comprimento: ${control.errors['minlength']['actualLength']}. \\n`;\r\n break;\r\n case 'maxlength':\r\n errorMessage += `${formNameMap[key] ?? `[${parseInt(key, 10) + 1}]`}: Deve ter no máximo ${control.errors['maxlength']['requiredLength']} caracteres. Comprimento: ${control.errors['maxlength']['actualLength']}. \\n`;\r\n break;\r\n case 'invalid':\r\n errorMessage += `${formNameMap[key] ?? `[${parseInt(key, 10) + 1}]`}: ${errorMap[errorKey]}.\\n E-mails: ${control.errors['invalid']['emails']}. \\n`;\r\n break;\r\n default:\r\n errorMessage += `${formNameMap[key] ?? `[${parseInt(key, 10) + 1}]`}: ${errorMap[errorKey]}. \\n`;\r\n break;\r\n }\r\n });\r\n }\r\n });\r\n\r\n return errorMessage;\r\n }\r\n\r\n static getErrorKey(form: FormGroup): string {\r\n for (const key of Object.keys(form.controls)) {\r\n const control = form.controls[key];\r\n\r\n // If the control is a form group, recursively call the function\r\n if (control instanceof FormGroup) {\r\n const errorKey = Util.getErrorKey(control);\r\n if (errorKey) {\r\n return errorKey;\r\n }\r\n }\r\n\r\n // If the control has errors return the key\r\n if (control.errors) {\r\n const parentKey = this.findParentKey(control);\r\n return parentKey ? `${parentKey}.${key}` : key;\r\n }\r\n }\r\n\r\n return '';\r\n }\r\n\r\n static parseValue(value: string, type: string) {\r\n switch (type) {\r\n case DataTypes.BOOL:\r\n value = String(value)?.toLowerCase()?.trim();\r\n return value === 'true' || value === 'sim';\r\n case DataTypes.DATE:\r\n return value ? new Date(value) : '';\r\n default:\r\n return value;\r\n }\r\n }\r\n\r\n static stringfyValue(value: string, type: string) {\r\n switch (type) {\r\n case DataTypes.BOOL:\r\n return value === 'true' ? 'Sim' : 'Não';\r\n case DataTypes.DATE:\r\n return this.formatDate(new Date(value));\r\n default:\r\n return value;\r\n }\r\n }\r\n\r\n static formatDate(date) {\r\n const day = String(date.getDate()).padStart(2, '0');\r\n const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed\r\n const year = date.getFullYear();\r\n\r\n return `${day}/${month}/${year}`;\r\n }\r\n\r\n static collectTree(list: any[], filtered: any[], key: string, fk: string) {\r\n let result = [...filtered];\r\n for (const child of filtered) {\r\n result = [...result, ...this.collectTree(list, list.filter(a => child[key] === a[fk]), key, fk)];\r\n }\r\n return result;\r\n }\r\n\r\n static compareLists(list1: any[], list2: any[]) {\r\n const added = [];\r\n const removed = [];\r\n const modified = [];\r\n\r\n // Check for added elements\r\n for (const item of list2) {\r\n if (!list1.some((x) => x.id === item.id)) {\r\n added.push(item);\r\n }\r\n }\r\n\r\n // Check for removed elements\r\n for (const item of list1) {\r\n if (!list2.some((x) => x.id === item.id)) {\r\n removed.push(item);\r\n }\r\n }\r\n\r\n // Check for modified elements\r\n for (const item2 of list2) {\r\n const item1 = list1.find((x) => x.id === item2.id);\r\n if (item1 && JSON.stringify(item1) !== JSON.stringify(item2)) {\r\n modified.push({old: item1, new: item2});\r\n }\r\n }\r\n\r\n return {added, removed, modified};\r\n }\r\n\r\n static findParentKey(formControl: AbstractControl): string | null {\r\n const root = formControl.parent?.parent;\r\n if (!root) {\r\n return null;\r\n }\r\n\r\n return Object.keys(root.controls).find(key => root.controls[key] === formControl.parent) || null;\r\n }\r\n\r\n static getLabelProvincia(codPais: string, paises?: Paises[]): string {\r\n return paises?.find((p) => p.codPais === codPais)?.idOpcCodigoPostal < 2\r\n ? 'Distrito'\r\n : 'Província';\r\n }\r\n\r\n static getLabelMunicipio(codPais: string, paises?: Paises[]): string {\r\n return paises?.find((p) => p.codPais === codPais)?.idOpcCodigoPostal < 2\r\n ? 'Concelho'\r\n : 'Munícipio';\r\n }\r\n\r\n public static isHttpRequest(url: string): boolean {\r\n const regex = /^(http:\\/\\/|https:\\/\\/)/;\r\n return regex.test(url);\r\n }\r\n\r\n public static filterNonOverlappingDates(objects: any[]) {\r\n return objects.filter((obj, index, arr) => {\r\n const {dataInicio, dataFim} = obj;\r\n\r\n // Check if there is any overlap with previous objects\r\n for (let i = 0; i < index; i++) {\r\n const prevObj = arr[i];\r\n if (dataInicio <= prevObj.dataFim && dataFim >= prevObj.dataInicio) {\r\n return false; // Overlapping dates, exclude the object\r\n }\r\n }\r\n\r\n return true; // Non-overlapping dates, include the object\r\n });\r\n }\r\n\r\n public static strToDate(valor: string) {\r\n if (valor) {\r\n const dataString = valor\r\n .split('-')\r\n .reverse()\r\n .toString()\r\n .replace(',', '-')\r\n .replace(',', '-');\r\n const dataConvertida = new Date(dataString).getTime();\r\n return dataConvertida;\r\n }\r\n\r\n return '';\r\n }\r\n\r\n public static strParaDataISO(dataStr: any) {\r\n if (dataStr) {\r\n return Util.FromStrToDate(\r\n new Intl.DateTimeFormat('pt-PT').format(Date.parse(dataStr))\r\n );\r\n } else {\r\n return '';\r\n }\r\n }\r\n\r\n public static FromStrToDate(valor: any) {\r\n return valor\r\n ? valor\r\n .split('/')\r\n .reverse()\r\n .toString()\r\n .replace(',', '-')\r\n .replace(',', '-')\r\n : '';\r\n }\r\n\r\n public static convertToFloat(valor: string | number): number {\r\n if (typeof (valor) === 'number') {\r\n return this.DuasCasasDecimais(valor);\r\n }\r\n\r\n if (valor?.includes(',')) {\r\n return this.DuasCasasDecimais(parseFloat(\r\n String(valor)\r\n .replaceAll('.', '')\r\n .replace(',', '.')\r\n .replace(/[^0-9.,]/g, ''))\r\n );\r\n } else {\r\n return this.DuasCasasDecimais(parseFloat(\r\n String(valor)\r\n .replace(',', '.')\r\n .replace(/[^0-9.,]/g, ''))\r\n );\r\n }\r\n }\r\n\r\n static round(value: number, decimals: number = 0): number {\r\n if (decimals < 0) {\r\n throw new Error('Decimals must be non-negative');\r\n }\r\n\r\n const factor = Math.pow(10, decimals);\r\n const tempValue = value * factor;\r\n const roundedTemp = Math.round(tempValue);\r\n let diff = Math.abs(tempValue - roundedTemp);\r\n diff = Math.round(diff * factor) / factor;\r\n\r\n if (diff >= 0.5) {\r\n return Math.round(tempValue + Math.sign(tempValue) * 0.001) / factor;\r\n }\r\n\r\n return Number((Math.round(tempValue) / factor).toFixed(decimals));\r\n }\r\n\r\n public static convertToFloat3Casas(valor: string | number): number {\r\n if (typeof (valor) === 'number') {\r\n return this.TresCasasDecimais(valor);\r\n }\r\n return this.TresCasasDecimais(parseFloat(\r\n String(valor)\r\n .replaceAll('.', '')\r\n .replace(',', '.')\r\n .replace(/[^0-9.,]/g, ''))\r\n );\r\n }\r\n\r\n static TresCasasDecimais(valor?: number | string): number {\r\n if (typeof valor === 'string') {\r\n // Tenta converter a string em um número.\r\n valor = valor.replace('.', '');\r\n valor = parseFloat(valor.replace(',', '.'));\r\n }\r\n\r\n if (typeof valor !== 'number' || isNaN(valor)) {\r\n // Se o valor não é um número válido, retorne zero ou outro valor padrão.\r\n return 0;\r\n }\r\n\r\n return Math.round((valor || 0) * 1000) / 1000;\r\n }\r\n\r\n static DuasCasasDecimais(valor?: number | string): number {\r\n if (typeof valor === 'string') {\r\n if (valor?.includes(',')) {\r\n valor = valor.replace('.', '');\r\n }\r\n valor = parseFloat(valor.replace(',', '.'));\r\n }\r\n\r\n if (typeof valor !== 'number' || isNaN(valor)) {\r\n return 0;\r\n }\r\n\r\n return Math.round((valor || 0) * 100) / 100;\r\n }\r\n\r\n\r\n public static replaceSliceInStrToDate(valor: any) {\r\n if (valor) {\r\n return valor.split('/').toString().replace(',', '-').replace(',', '-');\r\n }\r\n return '';\r\n }\r\n\r\n public static getData(dia: number, mes: number, ano: any): string {\r\n const mesActual = mes + 1;\r\n const data =\r\n ano.toString() +\r\n '-' +\r\n (mesActual < 10 ? '0' + mesActual.toString() : mesActual.toString()) +\r\n '-' +\r\n (dia < 10 ? '0' + dia.toString() : dia.toString());\r\n return data;\r\n }\r\n\r\n public static momToDate(momentDate: any): string {\r\n if (momentDate) {\r\n if (momentDate._isAMomentObject) {\r\n const mesActual = momentDate._i.month + 1;\r\n const data =\r\n momentDate._i.year.toString() +\r\n '-' +\r\n (mesActual < 10 ? '0' + mesActual.toString() : mesActual.toString()) +\r\n '-' +\r\n (momentDate._i.date < 10\r\n ? '0' + momentDate._i.date.toString()\r\n : momentDate._i.date.toString());\r\n return data;\r\n } else {\r\n const rgx = new RegExp('/', 'gi');\r\n const date = Intl.DateTimeFormat('en-GB').format(new Date(momentDate));\r\n return date.replace(rgx, '-');\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n public static getAnoData(dia: number, mes: number, ano: any): string {\r\n return ano;\r\n }\r\n\r\n public static getLabelNome(entidade: Entidades) {\r\n return entidade.idOpcPriUltimoNome === 1 ? 'Nome' : 'Nome completo';\r\n }\r\n\r\n public static alterarFormatoData(data: string) {\r\n if (data) {\r\n return (\r\n data.substring(6, 11) +\r\n '-' +\r\n data.substring(3, 5) +\r\n '-' +\r\n data.substring(0, 2)\r\n );\r\n }\r\n return '';\r\n }\r\n\r\n public static getFormErros(form: AbstractControl) {\r\n if (form instanceof FormControl) {\r\n return form.errors ?? null;\r\n }\r\n if (form instanceof FormArray) {\r\n return form.errors ?? null;\r\n }\r\n if (form instanceof FormGroup) {\r\n const groupErrors = form.errors;\r\n const formErrors = groupErrors ? {groupErrors} : {};\r\n Object.keys(form.controls).forEach((key) => {\r\n const error = this.getFormErros(form.get(key));\r\n if (error !== null) {\r\n formErrors[key] = error;\r\n }\r\n });\r\n return Object.keys(formErrors).length > 0 ? formErrors : null;\r\n }\r\n }\r\n\r\n public static formatarDecimal(strNum: any): string {\r\n const valor = strNum.toString();\r\n if (valor) {\r\n if (valor.includes('.')) {\r\n const valorComVirgula = valor.toString().replace('.', ',');\r\n const partesDoNumero = valorComVirgula.split(',');\r\n let numeroFormatado = '';\r\n if (partesDoNumero[1].length === 1) {\r\n numeroFormatado = partesDoNumero[0] + ',' + partesDoNumero[1] + '0';\r\n } else {\r\n numeroFormatado = partesDoNumero[0] + ',' + partesDoNumero[1];\r\n }\r\n return numeroFormatado;\r\n } else {\r\n return valor + ',00';\r\n }\r\n } else {\r\n return '0,00';\r\n }\r\n }\r\n\r\n public static reverterDecimal(valor: any) {\r\n if (valor && typeof valor === 'string' && valor.includes(',')) {\r\n const valorComPonto = valor.toString().replace(',', '.');\r\n return parseFloat(valorComPonto);\r\n } else {\r\n return valor;\r\n }\r\n }\r\n\r\n public static fromStrToDate(date: any) {\r\n const dtTime = new Intl.DateTimeFormat('pt-PT', {\r\n year: 'numeric',\r\n month: 'numeric',\r\n day: 'numeric'\r\n }).format(Date.parse(date));\r\n return dtTime;\r\n }\r\n\r\n public static DownloadXML(dados) {\r\n const element = document.createElement('a');\r\n const blob = new Blob([dados.objecto], {\r\n type: 'text/xml'\r\n });\r\n element.href = URL.createObjectURL(blob);\r\n element.setAttribute('download', dados.mensagem);\r\n document.body.appendChild(element);\r\n element.click();\r\n }\r\n\r\n public static downloadAnexo(anexo: string, nomeAnexo: string) {\r\n if (!anexo) {\r\n return;\r\n }\r\n const link = document.createElement('a');\r\n link.href = anexo;\r\n link.download = nomeAnexo;\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n\r\n public static midpointRound(number) {\r\n return number < 0 ? -Math.round(-number * 2) / 2 : Math.round(number * 2) / 2;\r\n }\r\n\r\n public static CurrencyEnToPt(valor) {\r\n const delimiter = ',';\r\n const val = valor.split('.', 2);\r\n const d = val[1];\r\n let i = parseInt(val[0], 10);\r\n if (isNaN(i)) {\r\n return '';\r\n }\r\n let minus = '';\r\n if (i < 0) {\r\n minus = '-';\r\n }\r\n i = Math.abs(i);\r\n let n = String(i);\r\n const valTemp = [];\r\n while (n.length > 3) {\r\n const nn = n.substr(n.length - 3);\r\n valTemp.unshift(nn);\r\n n = n.substr(0, n.length - 3);\r\n }\r\n if (n.length > 0) {\r\n val.unshift(n);\r\n }\r\n n = valTemp.join(delimiter);\r\n if (d.length < 1) {\r\n valor = n;\r\n } else {\r\n valor = n + '.' + d;\r\n }\r\n valor = minus + valor;\r\n return valor;\r\n }\r\n\r\n public static validarCodigoLivre(classificacao, form: any, campo: any) {\r\n if (!classificacao) {\r\n const valorCodigo = form.get(campo).value;\r\n if (valorCodigo.trim().length < 1) {\r\n form.get(campo).setValue('');\r\n form.get(campo).setValidators(Validators.required);\r\n form.get(campo).updateValueAndValidity();\r\n form.get(campo).markAsTouched({onlySelf: true});\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // Função para formatação de casas decimais //\r\n\r\n public static formatarCasasDecimais(valor) {\r\n // Valor string //\r\n if (valor && typeof valor === 'string') {\r\n if (valor.includes(',')) {\r\n const decimalPart = valor.split(',', 2)[1];\r\n const integerPart = valor.split(',', 2)[0];\r\n if (decimalPart.length > 1) {\r\n return valor;\r\n } else {\r\n return integerPart + ',' + decimalPart + '0';\r\n }\r\n } else {\r\n return valor + ',00';\r\n }\r\n }\r\n\r\n // Valor numérico //\r\n if (valor && typeof valor === 'number') {\r\n const num = '' + valor;\r\n if (num.includes('.')) {\r\n const decimalPart = num.split('.', 2)[1];\r\n const integerPart = num.split('.', 2)[0];\r\n if (decimalPart.length > 1) {\r\n return valor;\r\n } else {\r\n return integerPart + ',' + decimalPart + '0';\r\n }\r\n } else {\r\n return valor + ',00';\r\n }\r\n }\r\n }\r\n\r\n public static DataConvertida(data: any): string {\r\n if (data) {\r\n const d = new Date(data);\r\n const novaData = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(\r\n d.getDate()\r\n )}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;\r\n return novaData;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n public static AnoData(data: any): number {\r\n if (data) {\r\n const d = new Date(data);\r\n const novaData = d.getFullYear();\r\n return novaData;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n static crawl(a: any, prop: string) {\r\n const keyParts = prop.split('.');\r\n let value = a;\r\n for (const part of keyParts) {\r\n value = value[part];\r\n }\r\n return value;\r\n }\r\n\r\n static parseDate(value: Date | string) {\r\n if (!value) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const [datePart, timePart] = value.split('T');\r\n const [yy, MM, dd] = datePart.split('-').map(Number);\r\n const [hh, mm] = timePart.split(':').map(Number);\r\n return new Date(yy, MM - 1, dd, hh, mm);\r\n }\r\n return new Date(value);\r\n }\r\n\r\n strParaDouble(valor: any) {\r\n if (valor) {\r\n return valor.replaceAll(/\\./gi, '').replace(',', '.');\r\n } else {\r\n return 0;\r\n }\r\n }\r\n}\r\n\r\n\r\nfunction pad(value) {\r\n return value.toString().padStart(2, 0);\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { PessoasContactos } from '../models/clientes/pessoas-contactos';\r\nimport { GrupoContactoCliDto } from '../models/clientes/grupo-contacto-cli.dto';\r\n\r\n@Pipe({\r\n name: 'agruparContactos',\r\n pure: true\r\n}) export class AgruparContactosPipe implements PipeTransform {\r\n grupoContactos: GrupoContactoCliDto[] = [];\r\n transform(pessoaContacto: PessoasContactos): any {\r\n if(pessoaContacto && pessoaContacto.contactos && pessoaContacto.contactos.length > 0) {\r\n for(let i = 0; i < pessoaContacto.contactos.length; i++) {\r\n if (!this.grupoContactos.find(x => x.idTipoContacto === pessoaContacto.contactos[i].idTipoContacto)) {\r\n this.grupoContactos.push({\r\n idTipoContacto: pessoaContacto.contactos[i].idTipoContacto,\r\n tipoContacto: pessoaContacto.contactos[i].tipoContacto,\r\n contactos: [],\r\n });\r\n }\r\n }\r\n for(let i = 0; i < this.grupoContactos.length; i++){\r\n for(let j = 0; j < pessoaContacto.contactos.length; j++){\r\n if(this.grupoContactos[i].idTipoContacto === pessoaContacto.contactos[j].idTipoContacto){\r\n this.grupoContactos[i].contactos.push({\r\n activo: pessoaContacto.contactos[j].activo,\r\n contacto: pessoaContacto.contactos[j].contacto,\r\n })\r\n }\r\n }\r\n }\r\n }\r\n return this.grupoContactos.sort((a, b) => {\r\n return a.idTipoContacto - b.idTipoContacto;\r\n });\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'all',\r\n pure: true,\r\n})\r\nexport class AllPipe implements PipeTransform {\r\n\r\n transform(items: any[], predicate: (item: any) => boolean): boolean {\r\n if (!items || !predicate) {\r\n return false;\r\n }\r\n return items.every(item => predicate(item));\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'calculoDeVaga'\n})\nexport class CalculoDeVagaPipe implements PipeTransform {\n\n transform( realizacao: any): string| number {\n realizacao?.vagas === 'Ilimitadas' ? 'Ilimitadas' : (parseInt(realizacao?.vagas, 10) - realizacao.qtdInscritos);\n\n const regex = RegExp('^[0-9]+$');\n\n if (realizacao?.vagas ) {\n\n\n return realizacao?.vagas === 'Ilimitadas' ? 'Ilimitadas' : regex.test(realizacao?.vagas) && regex.test(realizacao.qtdInscritos)? \n (parseInt(realizacao?.vagas, 10) - realizacao.qtdInscritos): '';\n } else {\n return '';\n }\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { formatDate } from '@angular/common';\r\n\r\n@Pipe({\r\n name: 'codTipo',\r\n pure: true\r\n}) export class CodTipoPipe implements PipeTransform {\r\n public transform(valor: any, codTipo: string): any {\r\n if (valor) {\r\n if (codTipo === 'BOL') {\r\n return valor ? 'Sim' : 'Não';\r\n }\r\n\r\n if (codTipo === 'DEC') {\r\n return valor;\r\n }\r\n\r\n if (codTipo === 'INT') {\r\n return valor;\r\n }\r\n\r\n if (codTipo === 'TXT') {\r\n return valor;\r\n }\r\n\r\n if (codTipo === 'DAT') {\r\n return formatDate(valor, 'dd/MM/yyyy', 'pt');\r\n }\r\n }\r\n return '';\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'colCriador',\r\n pure : true\r\n})\r\nexport class ColCriadorPipe implements PipeTransform {\r\n\r\n public transform(criador: any, prop: string): any {\r\n if (criador && criador[prop]) {\r\n return criador[prop];\r\n }\r\n return '';\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'colName',\r\n pure: true\r\n})\r\nexport class ColNamePipe implements PipeTransform {\r\n\r\n public transform(valor: any): any {\r\n let precoStr = '';\r\n if (typeof(valor) === 'string') {\r\n if (valor.includes(',')) {\r\n precoStr = valor.replace(',', '.');\r\n return parseFloat(precoStr);\r\n }\r\n } else {\r\n return parseFloat(valor);\r\n }\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'colTipo',\r\n pure: true\r\n})\r\nexport class ColTipoPipe implements PipeTransform {\r\n\r\n public transform(tipo: any, prop: string): any {\r\n if (tipo && tipo[prop]) {\r\n return tipo[prop];\r\n }\r\n return '';\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'codTitulo',\r\n pure: true\r\n}) export class CodTituloPipe implements PipeTransform {\r\n public transform(valor: any, titulo: string): any {\r\n if (valor) {\r\n\r\n }\r\n return '';\r\n }\r\n}\r\n","export enum IdOpc {\r\n 'NaoObrigatorio' = 1,\r\n 'Opcional' = 2,\r\n 'Obrigatorio' = 3\r\n}","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { TipoDocumento } from 'app/shared/models/financas/documentos/documentosTipos';\r\n\r\n@Pipe({\r\n name: 'tipoDocumento'\r\n})\r\nexport class TipoDocumentoPipe implements PipeTransform {\r\n\r\n transform( tiposDocumentos: TipoDocumento [], codAreaTesouraria: string): TipoDocumento [] {\r\n\r\n if ( tiposDocumentos?.length > 0 ) {\r\n \r\n tiposDocumentos = tiposDocumentos?.filter(tipoDocumento => \r\n tipoDocumento?.codAreaTesouraria?.toLowerCase() === codAreaTesouraria?.toLowerCase());\r\n }\r\n return tiposDocumentos;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { FormGroup } from '@angular/forms';\r\nimport { CompraTipoDocumentoDto } from 'app/shared/models/compras/documentos/compra-tipo-documento.dto';\r\nimport { Documentos } from 'app/shared/models/financas/documentos/documentos';\r\nimport { IdOpc } from '../enum/idOpc';\r\n\r\n@Pipe({\r\n name: 'validarDocumentoCompra'\r\n})\r\nexport class ValidarDocumentoCompraPipe implements PipeTransform {\r\n\r\n transform( formDocumento: FormGroup, \r\n tipoDocSelecionado: CompraTipoDocumentoDto,\r\n \r\n ): unknown {\r\n\r\n let erroDocReferencia: boolean;\r\n if (tipoDocSelecionado.idOpcDocReferencia === IdOpc.Obrigatorio) {\r\n // erroDocReferencia = \r\n }\r\n\r\n\r\n return null;\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {Util} from 'app/shared/models/generico/util';\r\n\r\n@Pipe({\r\n name: 'convertToFloat'\r\n})\r\nexport class ConvertToFloatPipe implements PipeTransform {\r\n\r\n transform(value: unknown, ...args: unknown[]): unknown {\r\n if (typeof (value) === 'number') {\r\n return Util.DuasCasasDecimais(value);\r\n }\r\n return Util.DuasCasasDecimais(parseFloat(\r\n String(value)\r\n .replaceAll('.', '')\r\n .replace(',', '.')\r\n .replace(/[^0-9.,]/g, ''))\r\n );\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { Util } from '../models/generico/util';\r\n\r\n@Pipe({\r\n name: 'dataReversePt'\r\n})\r\nexport class DataReversePtPipe implements PipeTransform {\r\n \r\n transform( data: Date): string {\r\n if (data) {\r\n return Util.momToDate(data);\r\n }\r\n\r\n return '';\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\nimport { FaseProcesso } from '../models/processos/processos';\r\n\r\n@Pipe({\r\n name: 'descArtigos',\r\n pure: true\r\n})\r\nexport class DescArtigoPipe implements PipeTransform {\r\n\r\n public transform(fases: FaseProcesso[]): any {\r\n if (fases && fases.length > 0) {\r\n return !!fases.find(f => f.artigos.length > 0);\r\n }\r\n return false;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DocumentosPendentes} from \"app/shared/models/financas/documentos-por-regularizar/documentos-por-regularizar\";\r\n@Pipe({\r\n name: 'docStatus',\r\n pure: true\r\n})\r\nexport class DocStatusPipe implements PipeTransform {\r\n // https://dev-back.kiami.ao/fin/api/v1/documentos/estadosPagamento\r\n // F - facturado - E- emitido - T - retificado, \r\n public transform(doc: DocumentosPendentes): any {\r\n if(doc && doc.codDocumento){\r\n if(doc.codDocumento === 'A'){ // Anulado\r\n return \"red-500-fg text-white\";\r\n }\r\n if(doc.codDocumento === 'P'){ // Aprovado\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'N'){ // Em análise\"\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'E'){ // Emitido\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'F'){ // Facturado\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'C'){ // Parcialmente Facturado\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'D'){ // Pendente\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'R'){ // Rectificado (Parcialmente)\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'T'){ // Rectificado (Totalmente)\r\n return \"bg-secundary text-white\";\r\n }\r\n if(doc.codDocumento === 'J'){ // Rejeitado\r\n return \"bg-secundary text-white\";\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Pipe({\r\n name: 'duration'\r\n})\r\nexport class DurationPipe implements PipeTransform {\r\n\r\n transform(dataInicio: Date, dataFim: Date) {\r\n return !dataInicio || !dataFim ? '' : Util.duration(new Date(dataInicio), new Date(dataFim));\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { Documentos } from '../models/financas/documentos/documentos';\r\nconst COD_VALIDOS = {\r\n 'R': true,\r\n 'T': true,\r\n 'A': true,\r\n};\r\n@Pipe({\r\n name: 'estadoDocValido',\r\n pure: true\r\n}) export class EstadoDocValidoPipe implements PipeTransform {\r\n transform(documento: Documentos): boolean {\r\n if (documento && documento?.codEstadoDocumento) {\r\n return COD_VALIDOS[documento?.codEstadoDocumento.toUpperCase()];\r\n }\r\n return false;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from \"@angular/core\";\r\n\r\n@Pipe({ name: 'excerpt' })\r\nexport class ExcerptPipe implements PipeTransform {\r\n transform(text: string, limit: number = 5) {\r\n if(text.length <= limit)\r\n return text;\r\n return text.substring(0, limit) + '...';\r\n }\r\n}","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\nimport { FaseProcesso } from '../models/processos/processos';\r\n\r\n@Pipe({\r\n name: 'faseTemItems',\r\n pure: true\r\n})\r\nexport class FaseTemArtigoPipe implements PipeTransform {\r\n\r\n public transform(fases: FaseProcesso[] = []): boolean {\r\n return !!fases.find(f => f.artigos && f.artigos.length > 0);\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'filterById',\r\n})\r\nexport class FilterByIdPipe implements PipeTransform {\r\n transform(items: any[], id: number): any[] {\r\n if (!items) {\r\n return [];\r\n }\r\n if (!id) {\r\n return items;\r\n }\r\n return items.filter(item => item.id !== id);\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'filterFn',\r\n pure: false\r\n})\r\nexport class FilterFnPipe implements PipeTransform {\r\n transform(items: any[], predicate: (item: any, ...args: any[]) => boolean, ...args: any[]): any[] {\r\n if (!items || !predicate) {\r\n return items;\r\n }\r\n return items.filter(item => predicate(item, ...args));\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'filtrarPessoaContactoRelacao',\r\n pure: true\r\n})\r\nexport class FiltrarPessoaContactoRelacaoPipe implements PipeTransform {\r\n\r\n transform(pessoasContactosRelacoes:any[], value: string): any[] {\r\n const termo = value;\r\n if (pessoasContactosRelacoes.length > 0 && termo){\r\n pessoasContactosRelacoes = pessoasContactosRelacoes.filter( pessoaContactoRelacao => {\r\n return (pessoaContactoRelacao?.relacao.toLowerCase() as string)\r\n .includes( termo.toLowerCase());\r\n })\r\n }\r\n\r\n return pessoasContactosRelacoes;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'filtroEmailsManuais',\r\n pure: true\r\n})\r\nexport class FiltroEmailsManuaisPipe implements PipeTransform {\r\n\r\n transform(emailsManuais:any[], value: string): any[] {\r\n const termo = value;\r\n if (emailsManuais.length > 0 && termo){\r\n emailsManuais = emailsManuais.filter( emailManual => {\r\n return (emailManual?.descricao.toLowerCase() as string)\r\n .includes( termo.toLowerCase());\r\n })\r\n }\r\n\r\n return emailsManuais;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'listaTemMaisDe'\r\n})\r\nexport class ListaTemMaisDePipe implements PipeTransform {\r\n\r\n transform(lista: any [], valor: number): boolean {\r\n if (lista) {\r\n\r\n return lista.length > valor; \r\n }\r\n\r\n return false;\r\n } \r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Pipe({\r\n name: 'formatTime'\r\n})\r\nexport class FormatTimePipe implements PipeTransform {\r\n\r\n transform(value: Date): string {\r\n return Util.formatTimeWithTwoDigits(value);\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'numOrdinal'\r\n})\r\nexport class FormatarOrdinalPipe implements PipeTransform {\r\nnumeraisOrdinais = ['Segunda', 'Terceira', 'Quarta', 'Quinta', 'Sexta', 'Sétima',\r\n 'Oitava', 'Nona', 'Décima', 'Décima Primeira', 'Décima Segunda', 'Décima Terceira', 'Décima Quarta',\r\n 'Décima Quinta', 'Décima Sexta', 'Décima Sétima', 'Décima Oitava', 'Décima Nona', 'Vigésima', 'Vigésima Primeira',\r\n 'Vigésima Segunda', 'Vigésima Terceira', 'Vigésima Quarta', 'Vigésima Quinta', 'Vigésima Sexta', 'Vigésima Sétima', 'Vigésima Oitava',\r\n 'Vigésima Nona', 'Trigésima', 'Trigésima Primeira', 'Trigésima Segunda', 'Trigésima Terceira', 'Trigésima Quarta', 'Trigésima Quinta'];\r\n public transform(valor: any): any {\r\n if (valor && typeof(valor) === 'number' && valor < this.numeraisOrdinais.length) {\r\n return this.numeraisOrdinais[valor - 1];\r\n } else {}\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'formatarQuantidade'\r\n})\r\nexport class FormatarQuantidadePipe implements PipeTransform {\r\n\r\n async transform(valor1: string): Promise {\r\n let valor: string = valor1.replace(/\\s/g, '');\r\n let sinal: string = '';\r\n \r\n if (valor) {\r\n if ( valor.includes('-')){\r\n \r\n if (valor.length === 1) {\r\n return '-';\r\n } else if (valor === '') {\r\n return '0,00'\r\n }\r\n\r\n valor = valor.split('-')[1];\r\n valor = parseInt(valor)+'';\r\n valor = await valor.replace(/^[0][0]/g, '').replace(/^[0]/g, '');\r\n sinal = '-';\r\n } \r\n else {\r\n valor = parseInt(valor)+'';\r\n if ( valor === '0'){\r\n return '0,00';\r\n }\r\n }\r\n\r\n if (valor.length > 2) {\r\n let str1: string = '';\r\n let str2: string = '';\r\n let strAux: string = '';\r\n if (!valor.includes('.')) {\r\n str1 = valor.substring((valor.length - 2), valor.length);\r\n str2 = valor.substring(0, (valor.length - 2));\r\n } else {\r\n str1 = valor.split('.')[1];\r\n str2 = valor.split('.')[0];\r\n }\r\n \r\n \r\n for (let i = str2.length; i > 3; i -= 3) {\r\n strAux = '.' + str2.substring((i - 3), i) + strAux;\r\n if (i - 3 < 4) {\r\n strAux = str2.substring(0, (i - 3)) + strAux;\r\n\r\n }\r\n }\r\n if (strAux !==''){\r\n strAux = sinal+' '+strAux + ',' + str1;\r\n }else {\r\n strAux = sinal+' '+str2 + ',' + str1;\r\n \r\n }\r\n return strAux;\r\n } else {\r\n if (valor.length === 2) {\r\n valor = sinal +' 0,'+valor;\r\n\r\n } else\r\n if (valor.length === 1){\r\n\r\n valor = sinal +' 0,0'+valor;\r\n } else {\r\n\r\n valor = valor !==''? sinal +' 0,'+valor: '0,00';\r\n }\r\n }\r\n }\r\n\r\n return valor;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'getmenu',\r\n pure: true\r\n}) export class GetMenuPipe implements PipeTransform {\r\npublic transform( codMenu: string, listaMenus: any[]): any {\r\n if (codMenu && codMenu.length > 0 && listaMenus && listaMenus.length > 0) {\r\n return listaMenus.find((m) => m.codMenu === codMenu).menu;\r\n }\r\n return '';\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from \"@angular/core\";\r\n\r\n@Pipe({\r\n name: \"getValueByKey\",\r\n pure: false\r\n})\r\nexport class GetValueByKeyPipe implements PipeTransform {\r\n transform(value: any[], id: number, property: string): any {\r\n const filteredObj = value.find(item => {\r\n if (item.id !== undefined) {\r\n return item.id === id;\r\n }\r\n\r\n return false;\r\n });\r\n\r\n if (filteredObj) {\r\n return filteredObj[property];\r\n }\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'iconFicheiro'\r\n})\r\nexport class IconFicheiroPipe implements PipeTransform {\r\n\r\n transform(valor: any, ...args: unknown[]): any {\r\n let extensaoFicheiro = '';\r\n let partesLinkFicheiro;\r\n if (valor) {\r\n partesLinkFicheiro = valor.nome.split('.');\r\n\r\n if (partesLinkFicheiro?.length > 0) {\r\n extensaoFicheiro = partesLinkFicheiro[partesLinkFicheiro.length - 1];\r\n console.log('Extensao ', extensaoFicheiro)\r\n }\r\n\r\n switch (extensaoFicheiro) {\r\n case 'pdf': return 'assets/images/icons/pdf-icon.svg';\r\n case 'msword': return 'assets/images/file-types/005-documents.svg';\r\n case 'vnd.openxmlformats-officedocument.wordprocessingml.document': return 'assets/images/icons/word-icon.svg';\r\n // Ficheiro Excel\r\n case 'vnd.openxmlformats-officedocument.spreadsheetml.sheet': return 'assets/images/icons/xcel-icon.svg';\r\n // Ficheiro PowerPoint\r\n case 'vnd.openxmlformats-officedocument.presentationml.presentation': return 'assets/images/icons/powerpoint-icon.svg';\r\n case 'jpeg': return valor.link;\r\n case 'jpg': return valor.link;\r\n case 'png': return valor.link;\r\n case 'svg': return valor.link;\r\n case 'webp': return valor.link;\r\n default: return 'assets/images/icons/default_ficheiro.svg';\r\n }\r\n\r\n }\r\n }\r\n}\r\n","import { Input, Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({ name: 'inputContactoCerto' })\r\nexport class InputContactoCerto implements PipeTransform {\r\n @Input('tipoContacto') tipoContacto: string = '';\r\n\r\n constructor() {}\r\n\r\n transform(valor: any): any {\r\n if (valor && this.tipoContacto) {\r\n return valor === this.tipoContacto;\r\n }\r\n return false;\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'inserirQuebraLinha'\r\n})\r\nexport class InserirQuebraLinhaPipe implements PipeTransform {\r\n rgx = new RegExp('\\n', 'gi');\r\n public transform(valor: any): any {\r\n if (typeof(valor) === 'string') {\r\n const strNova = valor.replace(this.rgx, '
');\r\n return strNova;\r\n } else {\r\n return valor;\r\n }\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Pipe({\r\n name: 'kDate'\r\n})\r\nexport class KDatePipe implements PipeTransform {\r\n\r\n transform(value?: Date | string): string {\r\n const date = Util.parseDate(value);\r\n if (!date) {\r\n return '';\r\n }\r\n const year = date.getFullYear();\r\n const month = date.getMonth() + 1;\r\n const day = date.getDate();\r\n const hours = date.getHours();\r\n const minutes = date.getMinutes();\r\n return `${this.padZero(day)}/${this.padZero(month)}/${year} ${this.padZero(hours)}:${this.padZero(minutes)}`;\r\n }\r\n\r\n private padZero(num: number): string {\r\n return num.toString().padStart(2, '0');\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'labelMunicipio'\r\n})\r\nexport class LabelMunicipioPipe implements PipeTransform {\r\n\r\n public transform(valor: any, ...args): any {\r\n if (valor && typeof(valor.trim()) === 'string' && valor.trim().length > 0 && valor.toUpperCase() === 'AO') {\r\n return 'Município';\r\n } else {\r\n return 'Freguesia';\r\n }\r\n }\r\n\r\n}\r\n","import {Input, Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'labelProvincia'\r\n})\r\nexport class LabelProvinciaPipe implements PipeTransform {\r\n@Input() valorLabel;\r\n public transform(valor: any, ...args): any {\r\n if (valor && typeof(valor.trim()) === 'string' && valor.trim().length > 0 && valor.toUpperCase() === 'AO') {\r\n return 'Pronvícia';\r\n } else {\r\n return 'Distrito';\r\n }\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'linkYouTube',\r\n pure: true\r\n})\r\nexport class LinkYoutubePipe implements PipeTransform {\r\nconstructor(protected sanitizer: DomSanitizer) {\r\n}\r\n public transform(link: any): any {\r\n let idLinkVideo = '';\r\n let partesLink;\r\n if (link && link.includes('www.youtube.com')) {\r\n partesLink = link.split('=');\r\n if (partesLink?.length > 0) {\r\n idLinkVideo = partesLink[1];\r\n return 'https://i.ytimg.com/vi/' + idLinkVideo + '/hqdefault.jpg?';\r\n }\r\n }\r\n\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport { Empresa } from 'app/shared/models/empresa/empresa';\r\n\r\n@Pipe({\r\n name: 'mostrarCodEmpresa',\r\n pure: true\r\n})\r\nexport class MostrarCodEmpresaPipe implements PipeTransform {\r\n\r\n transform(empresas: Empresa[]): boolean {\r\n\r\n if ( empresas && empresas?.length >1 ){\r\n let tamanho = 0;\r\n for( let i = 0; i < empresas?.length; i++) {\r\n if ( empresas[i]?.estado?.toLowerCase() ===\"Activo\".toLowerCase()){\r\n tamanho ++;\r\n }\r\n if ( tamanho > 1) {\r\n return true;\r\n }\r\n }\r\n } else {\r\n\r\n return false;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'msgExpiracao',\r\n pure: true\r\n})export class MsgExpiracaoPipe implements PipeTransform {\r\n public transform(valor: number): any {\r\n let msgExpiracao = '';\r\n switch (true) {\r\n case (valor > 1): {\r\n msgExpiracao = ` A sua licença expira em ${valor} dias!`;\r\n break;\r\n }\r\n case (valor === 1): {\r\n msgExpiracao = ` A sua licença expira em ${valor} dia!`;\r\n break;\r\n }\r\n case (valor === 0): {\r\n msgExpiracao = ` A sua licença expira hoje!`;\r\n break;\r\n }\r\n case (valor === -1): {\r\n msgExpiracao = ` A sua licença expirou há ${Math.abs(valor)} dia!`;\r\n break;\r\n }\r\n case (valor < -1): {\r\n msgExpiracao = ` A sua licença expirou há ${Math.abs(valor)} dias!`;\r\n break;\r\n }\r\n default: msgExpiracao = ` A sua licença expirou!`;\r\n break;\r\n }\r\n return msgExpiracao;\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Pipe({\r\n name: 'parseValue'\r\n})\r\nexport class ParseValuePipe implements PipeTransform {\r\n\r\n transform(value: string, type: string): string {\r\n return Util.parseValue(value, type).toString();\r\n }\r\n\r\n}\r\n","import { Input, Pipe, PipeTransform } from '@angular/core';\r\nimport { PessoasContactosRelacoes } from '../models/clientes/pessoas-contactos-relacoes';\r\n\r\n@Pipe({\r\n name: 'codPerson',\r\n pure: true\r\n}) export class PorPersonalidadePipe implements PipeTransform {\r\n\r\n transform(valores: PessoasContactosRelacoes[], codigo: string): any {\r\n if (valores.length > 0 && codigo) {\r\n return valores.filter(valor => valor.codPersonJuridica === codigo);\r\n }\r\n return [];\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'printWithBr'\r\n})\r\nexport class PrintWithBrPipe implements PipeTransform {\r\n\r\n public transform(valor: any): any {\r\n if (typeof(valor) === 'string') {\r\n const frase = valor.split('\\n');\r\n let fraseFormata = '';\r\n frase.forEach((item, index) => {\r\n if (index < frase.length - 2) {\r\n fraseFormata += item + '
';\r\n } else {fraseFormata += item; }\r\n });\r\n return fraseFormata;\r\n\r\n } else {\r\n return valor;\r\n }\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from \"@angular/core\";\r\n\r\n@Pipe({ name: 'relativeTime' })\r\nexport class RelativeTimePipe implements PipeTransform {\r\n transform(value: Date) {\r\n if(!(value instanceof Date))\r\n value = new Date(value);\r\n\r\n let seconds: number = Math.floor(((new Date()).getTime() - value.getTime()) / 1000);\r\n let interval: number = Math.floor(seconds / 31536000);\r\n \r\n if (interval > 1) {\r\n return interval + \" years ago\";\r\n }\r\n interval = Math.floor(seconds / 2592000);\r\n if (interval > 1) {\r\n return interval + \" months ago\";\r\n }\r\n interval = Math.floor(seconds / 86400);\r\n if (interval > 1) {\r\n return interval + \" days ago\";\r\n }\r\n interval = Math.floor(seconds / 3600);\r\n if (interval > 1) {\r\n return interval + \" hours ago\";\r\n }\r\n interval = Math.floor(seconds / 60);\r\n if (interval > 1) {\r\n return interval + \" minutes ago\";\r\n }\r\n return Math.floor(seconds) + \" seconds ago\";\r\n }\r\n}","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'safe',\r\n pure: true\r\n})\r\nexport class SafePipe implements PipeTransform {\r\nconstructor(protected sanitizer: DomSanitizer) {\r\n}\r\n public transform(valor: any, tipo: string): SafeHtml | SafeStyle | SafeUrl| SafeResourceUrl | SafeScript {\r\n switch (tipo) {\r\n case 'html' : return this.sanitizer.bypassSecurityTrustHtml(valor);\r\n case 'style' : return this.sanitizer.bypassSecurityTrustStyle(valor);\r\n case 'script' : return this.sanitizer.bypassSecurityTrustScript(valor);\r\n case 'url' : return this.sanitizer.bypassSecurityTrustUrl(valor);\r\n case 'resourceUrl' : return this.sanitizer.bypassSecurityTrustResourceUrl(valor);\r\n default: return;\r\n }\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe(\r\n {\r\n name: 'bgFicheiro',\r\n pure: true\r\n }\r\n)\r\nexport class SetBgFicheiroPipe implements PipeTransform{\r\n public transform(valor: any, ...args): any {\r\n let extensao = '';\r\n if (valor) {\r\n let splittedString = valor.split('.');\r\n extensao = splittedString[splittedString.length - 1];\r\n if (extensao.toLowerCase() === 'svg') {\r\n return 'bg-light-gray';\r\n }\r\n }\r\n }\r\n}\r\n","import {NgModule} from '@angular/core';\r\nimport {CommonModule} from '@angular/common';\r\n\r\nimport {RelativeTimePipe} from './relative-time.pipe';\r\nimport {ExcerptPipe} from './excerpt.pipe';\r\nimport {GetValueByKeyPipe} from './get-value-by-key.pipe';\r\nimport {SafePipe} from './safe.pipe';\r\nimport {StringFloatPipe} from './string-float.pipe';\r\nimport {FormatarOrdinalPipe} from './formatar-ordinal.pipe';\r\nimport {TipoFicheiroPipe} from './tipo-ficheiro.pipe';\r\nimport {InserirQuebraLinhaPipe} from './inserir-quebra-linha.pipe';\r\nimport {PrintWithBrPipe} from './print-with-br.pipe';\r\nimport {LabelProvinciaPipe} from './label-provincia.pipe';\r\nimport {LabelMunicipioPipe} from './label-municipio.pipe';\r\nimport {StrNormalCasePipe} from './str-normal-case.pipe';\r\nimport {LinkYoutubePipe} from './link-youtube.pipe';\r\nimport {TamanhoFicheiroPipe} from './tamanhoFicheiro.pipe';\r\nimport {IconFicheiroPipe} from './icon-ficheiro.pipe';\r\nimport {SetBgFicheiroPipe} from './set-bg-ficheiro.pipe';\r\nimport {DataReversePtPipe} from './data-reverse-pt.pipe';\r\nimport {FilterByIdPipe} from './filter-by-id.pipe';\r\nimport {FormatarQuantidadePipe} from './formatar-quantidade.pipe';\r\nimport {CalculoDeVagaPipe} from './calculo-vagas-disponivel/calculo-de-vaga.pipe';\r\nimport {GetMenuPipe} from './get-menu/get-menu.pipe';\r\nimport {MostrarCodEmpresaPipe} from './mostrar-codEmpresa/mostrar-cod-empresa.pipe';\r\nimport {TipoDocumentoPipe} from './compras/tipo-documento.pipe';\r\nimport {ValidarDocumentoCompraPipe} from './compras/validar-documento.ts/validar-documento-compra.pipe';\r\nimport {ListaTemMaisDePipe} from './financas-shared/listas/lista-tem-mais-de.pipe';\r\nimport {FiltrarPessoaContactoRelacaoPipe} from './filtros-auto-complete/pipe/filtrar-pessoa-contacto-relacao.pipe';\r\nimport {FiltroEmailsManuaisPipe} from './filtros-auto-complete/pipe/filtro-emails-manuais.pipe';\r\nimport {ColNamePipe} from './col-name.pipe';\r\nimport {ColCriadorPipe} from './col-criador.pipe';\r\nimport {ColTipoPipe} from './col-tipo.pipe';\r\nimport {CodTipoPipe} from './cod-tipo.pipe';\r\nimport {CodTituloPipe} from './col-titulo.pipe';\r\nimport {MsgExpiracaoPipe} from './msg-expiracao.pipe';\r\nimport {FilterFnPipe} from './filter-fn.pipe';\r\nimport { SomeFnPipe } from './some-fn.pipe';\r\nimport { SumPipe } from './sum.pipe';\r\nimport { TabTotalizadorPipe } from './tabela-totalizador/tab-totalizador.pipe';\r\nimport { AllPipe } from './all.pipe';\r\nimport { ConvertToFloatPipe } from './convert-to-float.pipe';\r\nimport { ParseValuePipe } from './parse-value.pipe';\r\nimport { AgruparContactosPipe } from '@pipes/agrupar-contactos.pipe';\r\nimport { InputContactoCerto } from '@pipes/input-contacto-certo';\r\nimport { PorPersonalidadePipe } from '@pipes/por-personalidade.pipe';\r\nimport {DocStatusPipe} from '@pipes/doc-status.pipe';\r\nimport { DurationPipe } from './duration.pipe';\r\nimport { FormatTimePipe } from './format-time.pipe';\r\nimport { KDatePipe } from './k-date.pipe';\r\nimport { EstadoDocValidoPipe } from '@pipes/estado-doc-valido.pipe';\r\nimport { TabStockTotalPipe } from '@pipes/tabela-totalizador/tab-stock-total.pipe';\r\nimport { TabStockExistenciaPipe } from '@pipes/tabela-totalizador/tab-stock-existencia.pipe';\r\nimport { TabTotalTempoPipe } from '@pipes/tabela-totalizador/tab-total-tempo.pipe';\r\nimport { FaseTemArtigoPipe } from '@pipes/fase-tem-artigo.pipe';\r\nimport { DescArtigoPipe } from '@pipes/desc-artigo.pipe';\r\nimport { TemProcIdArtigoPipe } from '@pipes/tem-proc-id-artigo.pipe';\r\n\r\nconst pipes = [\r\n RelativeTimePipe,\r\n ExcerptPipe,\r\n GetValueByKeyPipe,\r\n StringFloatPipe,\r\n FormatarOrdinalPipe,\r\n TipoFicheiroPipe,\r\n InserirQuebraLinhaPipe,\r\n PrintWithBrPipe,\r\n LabelProvinciaPipe,\r\n LabelMunicipioPipe,\r\n StrNormalCasePipe,\r\n LinkYoutubePipe,\r\n TamanhoFicheiroPipe,\r\n IconFicheiroPipe,\r\n SetBgFicheiroPipe,\r\n CalculoDeVagaPipe,\r\n GetMenuPipe,\r\n MostrarCodEmpresaPipe,\r\n TipoDocumentoPipe,\r\n ValidarDocumentoCompraPipe,\r\n ListaTemMaisDePipe,\r\n FiltrarPessoaContactoRelacaoPipe,\r\n FiltroEmailsManuaisPipe,\r\n ColNamePipe,\r\n ColCriadorPipe,\r\n ColTipoPipe,\r\n CodTipoPipe,\r\n CodTituloPipe,\r\n MsgExpiracaoPipe,\r\n AgruparContactosPipe,\r\n InputContactoCerto,\r\n PorPersonalidadePipe,\r\n DocStatusPipe,\r\n EstadoDocValidoPipe,\r\n TabStockTotalPipe,\r\n TabStockExistenciaPipe,\r\n TabTotalTempoPipe,\r\n FaseTemArtigoPipe,\r\n DescArtigoPipe,\r\n TemProcIdArtigoPipe,\r\n FaseTemArtigoPipe\r\n];\r\n\r\n@NgModule({\r\n imports: [\r\n CommonModule\r\n ],\r\n declarations: [\r\n pipes,\r\n SafePipe,\r\n DataReversePtPipe,\r\n FilterByIdPipe,\r\n FormatarQuantidadePipe,\r\n FilterFnPipe,\r\n SomeFnPipe,\r\n SumPipe,\r\n TabTotalizadorPipe,\r\n AllPipe,\r\n ConvertToFloatPipe,\r\n ParseValuePipe,\r\n DurationPipe,\r\n FormatTimePipe,\r\n KDatePipe,\r\n\r\n ],\r\n exports: [\r\n pipes,\r\n SafePipe,\r\n FilterByIdPipe,\r\n FilterFnPipe,\r\n SomeFnPipe,\r\n SumPipe,\r\n TabTotalizadorPipe,\r\n AllPipe,\r\n ConvertToFloatPipe,\r\n ParseValuePipe,\r\n DurationPipe,\r\n FormatTimePipe,\r\n KDatePipe\r\n ]\r\n})\r\nexport class SharedPipesModule {\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'someFn'\r\n})\r\nexport class SomeFnPipe implements PipeTransform {\r\n\r\n transform(items: any[], predicate: (item: any, ...args: any[]) => boolean, ...args: any[]): boolean {\r\n if (!items || !predicate) {\r\n return false;\r\n }\r\n return items.some(item => predicate(item, ...args));\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'toNormalCase'\r\n})\r\nexport class StrNormalCasePipe implements PipeTransform {\r\nconstructor(protected sanitizer: DomSanitizer) {\r\n}\r\n public transform(valor: any): any {\r\n if (valor) {\r\n const wholeStr = valor.toLowerCase();\r\n return wholeStr.substring(0, 1).toUpperCase() + wholeStr.substring(1);\r\n }\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'strToFloat'\r\n})\r\nexport class StringFloatPipe implements PipeTransform {\r\n\r\n public transform(valor: any): any {\r\n let precoStr = '';\r\n if (typeof(valor) === 'string') {\r\n if (valor.includes(',')) {\r\n precoStr = valor.replace(',', '.');\r\n return parseFloat(precoStr);\r\n }\r\n } else {\r\n return parseFloat(valor);\r\n }\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {Util} from '../models/generico/util';\r\n\r\n@Pipe({\r\n name: 'sum'\r\n})\r\nexport class SumPipe implements PipeTransform {\r\n\r\n transform(value: string | number, value2: string | number): number {\r\n return Util.convertToFloat(value) + Util.convertToFloat(value2);\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\ninterface MovimentoStock {\r\n codArmazem: string;\r\n codArtigo: string;\r\n codDocumento: string;\r\n codEmpresa: string;\r\n codMovimento: string;\r\n dataCriacao: Date | string;\r\n dataMovimento: Date | string;\r\n idArmazem: number;\r\n idArtigo: number;\r\n idEmpresa: number;\r\n idMovimento: number;\r\n movimento: string;\r\n nomeArtigo: string;\r\n preco: number;\r\n quantidade: number;\r\n total: number;\r\n unidadeMedida: string;\r\n url: string;\r\n utilizador: any;\r\n cliente: any;\r\n}\r\n@Pipe({\r\n name: 'tabStockExistencia',\r\n pure: true\r\n}) export class TabStockExistenciaPipe implements PipeTransform {\r\ntransform(movimentos: any[] = [], propKey?: string) {\r\n const totalSaidas: number = this.calcTotalMovimentos(movimentos, 'S', propKey);\r\n const totalEntradas: number = this.calcTotalMovimentos(movimentos, 'E', propKey);\r\n return totalEntradas - totalSaidas;\r\n}\r\n\r\ncalcTotalMovimentos(dados: any[]= [], codMov: string, propKey: string) {\r\n let movimentos: MovimentoStock[] = [];\r\n let total = 0;\r\n if (dados && dados.length && dados.length > 0) {\r\n movimentos = dados.filter(m => m.codMovimento === codMov);\r\n total = movimentos.reduce((a, obj) => {\r\n return a + obj[propKey];\r\n }, 0);\r\n }\r\n return total;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\ninterface MovimentoStock {\r\n codArmazem: string;\r\n codArtigo: string;\r\n codDocumento: string;\r\n codEmpresa: string;\r\n codMovimento: string;\r\n dataCriacao: Date | string;\r\n dataMovimento: Date | string;\r\n idArmazem: number;\r\n idArtigo: number;\r\n idEmpresa: number;\r\n idMovimento: number;\r\n movimento: string;\r\n nomeArtigo: string;\r\n preco: number;\r\n quantidade: number;\r\n total: number;\r\n unidadeMedida: string;\r\n url: string;\r\n utilizador: any;\r\n cliente: any;\r\n}\r\n@Pipe({\r\n name: 'tabStockTotal',\r\n pure: true\r\n}) export class TabStockTotalPipe implements PipeTransform {\r\ntransform(dados: any[] = [], codMov?: string, propKey?: string) {\r\nlet movimentos: MovimentoStock[] = [];\r\nlet total = 0;\r\nif (dados && dados.length && dados.length > 0) {\r\n movimentos = dados.filter(m => m.codMovimento === codMov);\r\n total = movimentos.reduce((a, obj) => {\r\n return a + obj[propKey];\r\n }, 0);\r\n}\r\n return total;\r\n}\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'tabTotalTempo',\r\n pure: true,\r\n})\r\nexport class TabTotalTempoPipe implements PipeTransform {\r\n transform(listaDados: any[], prop?: string): any {\r\n let total = 0;\r\n if (listaDados && listaDados.length && listaDados.length > 0) {\r\n total = listaDados.reduce((a, obj) => {\r\n return a + obj['tempo'];\r\n }, 0);\r\n }\r\n return total;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'tabTotalizador',\r\n pure: true,\r\n})\r\nexport class TabTotalizadorPipe implements PipeTransform {\r\n transform(listaDados: any[], prop: string): any {\r\n let total = 0;\r\n if (listaDados && listaDados.length && listaDados.length > 0) {\r\n if (prop && prop.length && prop.length > 0) {\r\n if (prop === 'pendenteTotal') {\r\n total = listaDados.reduce((a, obj) => {\r\n return a + (obj[prop] + obj['pendenteIva']);\r\n }, 0);\r\n } else {\r\n total = listaDados.reduce((a, obj) => {\r\n return a + obj[prop];\r\n }, 0);\r\n }\r\n\r\n }\r\n }\r\n return total;\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'tamanho'\r\n}) export class TamanhoFicheiroPipe implements PipeTransform {\r\n public transform(valor: any): any {\r\n return Math.round(valor / (1024 ** 2) * Math.pow(10, 2)) / Math.pow(10, 2);\r\n }\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'temProcIdArtigo',\r\n pure: true,\r\n}) export class TemProcIdArtigoPipe implements PipeTransform {\r\n transform(artigos: any): any {\r\n if (artigos.length > 0) {\r\n return artigos.filter(a => a.idProcessoArtigo && a.idProcessoArtigo > 0).map((artigo, indice) => {\r\n return {\r\n ...artigo,\r\n idItemTab: indice + 1,\r\n };\r\n });\r\n }\r\n return [];\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {DomSanitizer} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'tipoFicheiro',\r\n pure: true\r\n})\r\nexport class TipoFicheiroPipe implements PipeTransform {\r\n constructor(protected sanitizer: DomSanitizer) {\r\n }\r\n\r\n public transform(valor: any): any {\r\n let extensaoFicheiro = '';\r\n let metaDadosFicheiro = '';\r\n let partesLinkFicheiro;\r\n if (valor) {\r\n if (valor.split(';')[0] && valor.split(';')[0].length > 0) {\r\n console.log('', valor.split(';')[0]);\r\n metaDadosFicheiro = valor.split(';')[0];\r\n partesLinkFicheiro = metaDadosFicheiro.split('/');\r\n } else {\r\n console.log('', valor.split('.'));\r\n if (valor.split('.') && valor.split('.').length > 0) {\r\n partesLinkFicheiro = valor.split('.');\r\n }\r\n }\r\n\r\n if (partesLinkFicheiro?.length > 0) {\r\n const parts = partesLinkFicheiro[partesLinkFicheiro.length - 1].split('.');\r\n extensaoFicheiro = parts[parts.length - 1];\r\n }\r\n\r\n switch (extensaoFicheiro) {\r\n case 'pdf':\r\n return 'assets/images/icons/pdf-icon.svg';\r\n case 'msword':\r\n return 'assets/images/file-types/005-documents.svg';\r\n case 'docx':\r\n return 'assets/images/file-types/005-documents.svg';\r\n case 'vnd.openxmlformats-officedocument.wordprocessingml.document':\r\n return 'assets/images/icons/word-icon.svg';\r\n // Ficheiro Excel :: 'vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'sheet'\r\n case 'sheet':\r\n return 'assets/images/icons/xcel-icon.svg';\r\n case 'xlsx':\r\n return 'assets/images/icons/xcel-icon.svg';\r\n // Ficheiro PowerPoint\r\n case 'vnd.openxmlformats-officedocument.presentationml.presentation':\r\n return 'assets/images/icons/powerpoint-icon.svg';\r\n case 'pptx':\r\n return 'assets/images/icons/powerpoint-icon.svg';\r\n case 'jpeg':\r\n return valor;\r\n case 'jpg':\r\n return valor;\r\n case 'png':\r\n return valor;\r\n case 'svg':\r\n return valor;\r\n case 'webp':\r\n return valor;\r\n default:\r\n return 'assets/images/icons/default_ficheiro.svg';\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n}\r\n","import {\r\n Component,\r\n OnInit,\r\n Output,\r\n EventEmitter,\r\n OnDestroy,\r\n Input\r\n} from \"@angular/core\";\r\nimport { FormControl } from \"@angular/forms\";\r\nimport { Subscription } from \"rxjs\";\r\nimport { debounceTime } from \"rxjs/operators\";\r\nimport { SearchService } from \"../search.service\";\r\nimport { Router, ActivatedRoute } from \"@angular/router\";\r\n\r\n@Component({\r\n selector: \"egret-search-input-over\",\r\n templateUrl: \"./search-input-over.component.html\",\r\n styleUrls: [\"./search-input-over.component.scss\"]\r\n})\r\nexport class SearchInputOverComponent implements OnInit, OnDestroy {\r\n isOpen: boolean;\r\n @Input('resultPage') resultPage: string;\r\n @Input('placeholder') placeholder: string = \"Search here\";\r\n @Output(\"search\") search = new EventEmitter();\r\n searchCtrl = new FormControl();\r\n searchCtrlSub: Subscription;\r\n constructor(\r\n private searchService: SearchService,\r\n private router: Router,\r\n private route: ActivatedRoute\r\n ) {}\r\n\r\n ngOnInit() {\r\n this.searchCtrl.valueChanges.pipe(debounceTime(200))\r\n .subscribe(value => {\r\n this.search.emit(value);\r\n this.searchService.searchTerm.next(value);\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n if (this.searchCtrlSub) {\r\n this.searchCtrlSub.unsubscribe();\r\n }\r\n }\r\n navigateToResult() {\r\n if(this.resultPage) {\r\n this.router.navigateByUrl(this.resultPage);\r\n }\r\n }\r\n open() {\r\n this.isOpen = true;\r\n this.navigateToResult();\r\n }\r\n close() {\r\n this.isOpen = false;\r\n }\r\n toggle() {\r\n this.isOpen = !this.isOpen;\r\n }\r\n}\r\n","\r\n
\r\n
\r\n \r\n
\r\n
close\r\n
\r\n","import { NgModule } from \"@angular/core\";\r\nimport { CommonModule } from \"@angular/common\";\r\nimport { SearchInputOverComponent } from \"./search-input-over/search-input-over.component\";\r\nimport { ReactiveFormsModule } from \"@angular/forms\";\r\nimport { MatButtonModule } from \"@angular/material/button\";\r\nimport { MatIconModule } from \"@angular/material/icon\";\r\n\r\n@NgModule({\r\n declarations: [SearchInputOverComponent],\r\n exports: [SearchInputOverComponent],\r\n imports: [ReactiveFormsModule, MatIconModule, MatButtonModule, CommonModule]\r\n})\r\nexport class SearchModule {}\r\n","import { Injectable } from '@angular/core';\r\nimport { BehaviorSubject } from 'rxjs';\r\nimport { Observable } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SearchService {\r\n public searchTerm: BehaviorSubject = new BehaviorSubject('');\r\n public searchTerm$: Observable = this.searchTerm.asObservable();\r\n\r\n constructor() {}\r\n}\r\n","import {Injectable} from '@angular/core';\r\nimport {\r\n CalcularItensTotalDto,\r\n DocumentoCalculoRetencoesDto,\r\n DocumentoCalculoTotaisDto,\r\n FADocumentosItensDto,\r\n FINRetencoesDto\r\n} from './Dtos/DtosCalculoFin';\r\nimport {Util} from 'app/shared/models/generico/util';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class CalculosFinancasService {\r\n constructor() {\r\n }\r\n\r\n CalcularRetencoes(dadosCalcular: any): DocumentoCalculoRetencoesDto {\r\n const dadosCalcularDto = converterParaCamelCase(dadosCalcular);\r\n\r\n let Total: number = 0;\r\n if (dadosCalcularDto.retencoesCLiente !== null) {\r\n for (let item of dadosCalcularDto.retencoesCLiente) {\r\n Total += this.CalcularRetencao(dadosCalcularDto.itens, item);\r\n }\r\n }\r\n dadosCalcularDto.valorRetencao = Total;\r\n return dadosCalcularDto;\r\n }\r\n\r\n private CalcularRetencao(itens: any, retencao: FINRetencoesDto): number {\r\n let itensTemp = itens.filter((i) => i.idRetencao === retencao.idRetencao);\r\n\r\n if (itensTemp.length <= 0) {\r\n return 0;\r\n }\r\n\r\n let TotalItem: number = itensTemp.reduce(\r\n (acc, curr) => acc + (Util.convertToFloat(curr.subTotal) ?? 0),\r\n 0\r\n );\r\n let montate: number = 0;\r\n\r\n if (TotalItem > retencao.valorMinimo) {\r\n montate = TotalItem * (retencao.valorPercentual / 100);\r\n }\r\n\r\n return Math.round(montate * 100) / 100;\r\n }\r\n\r\n calcularTotais(dadosCalcularDto: DocumentoCalculoTotaisDto): any {\r\n let dadosCalcular = converterParaCamelCase(dadosCalcularDto);\r\n dadosCalcular.totalGeral = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce((acc, item) => acc + (item.totalGeral || 0), 0)\r\n );\r\n dadosCalcular.totalIliq = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce((acc, item) => acc + (item.subTotalIliq || 0), 0)\r\n );\r\n dadosCalcular.totalDescontos = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce((acc, item) => acc + item.desconto, 0)\r\n );\r\n dadosCalcular.totalIva = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce((acc, item) => acc + (item.imposto || 0), 0)\r\n );\r\n\r\n dadosCalcular.totalIliq += dadosCalcular.totalDescontos;\r\n\r\n if (dadosCalcular.conversaoDirecta) {\r\n return this.conversaoDirectaItem(dadosCalcular);\r\n } else {\r\n return this.ConversaoIndirectaItem(dadosCalcular);\r\n }\r\n }\r\n\r\n CalcularTotais(dadosCalcularDto: any): DocumentoCalculoTotaisDto {\r\n let dadosCalcular = converterParaCamelCase(dadosCalcularDto);\r\n\r\n dadosCalcular.totalGeral = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce(\r\n (acc, curr) => acc + Util.convertToFloat(curr.totalGeral),\r\n 0\r\n )\r\n );\r\n\r\n dadosCalcular.totalIliq = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce(\r\n (acc, curr) => acc + Util.convertToFloat(curr.subTotalIliq),\r\n 0\r\n )\r\n );\r\n\r\n dadosCalcular.totalDescontos = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce(\r\n (acc, curr) => acc + Util.convertToFloat(curr.desconto),\r\n 0\r\n )\r\n );\r\n dadosCalcular.totalIva = this.DuasCasasDecimais(\r\n dadosCalcular.itens.reduce(\r\n (acc, curr) => acc + Util.convertToFloat(curr.imposto),\r\n 0\r\n )\r\n );\r\n\r\n\r\n dadosCalcular = dadosCalcular.conversaoDirecta == true\r\n ? this.conversaoDirecta(dadosCalcular)\r\n : this.ConversaoIndirecta(dadosCalcular);\r\n return dadosCalcular;\r\n }\r\n\r\n CalcularTotaisMoedaEstrangeira(\r\n dadosCalcularDto: any\r\n ): DocumentoCalculoTotaisDto {\r\n let dadosCalcular = converterParaCamelCase(dadosCalcularDto);\r\n\r\n dadosCalcular = dadosCalcular.conversaoDirecta\r\n ? this.conversaoDirecta(dadosCalcular)\r\n : this.ConversaoIndirecta(dadosCalcular);\r\n\r\n return dadosCalcular;\r\n }\r\n\r\n private conversaoDirecta(\r\n dadosCalcular: DocumentoCalculoTotaisDto\r\n ): DocumentoCalculoTotaisDto {\r\n if (\r\n !dadosCalcular.conversaoDirecta ||\r\n dadosCalcular.taxaCambio == null ||\r\n dadosCalcular.taxaCambio <= 0\r\n ) {\r\n return dadosCalcular;\r\n }\r\n\r\n let taxacambio: number = dadosCalcular.taxaCambio;\r\n\r\n dadosCalcular.totalIvaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIva * taxacambio\r\n );\r\n dadosCalcular.totalMoedaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIliq * taxacambio\r\n );\r\n dadosCalcular.totalIliqCliente =\r\n dadosCalcular.totalMoedaCliente + dadosCalcular.totalIvaCliente;\r\n\r\n return dadosCalcular;\r\n }\r\n\r\n private ConversaoIndirecta(\r\n dadosCalcular: DocumentoCalculoTotaisDto\r\n ): DocumentoCalculoTotaisDto {\r\n if (\r\n dadosCalcular?.conversaoDirecta ||\r\n dadosCalcular?.taxaCambio == null ||\r\n dadosCalcular?.taxaCambio <= 0\r\n ) {\r\n return dadosCalcular;\r\n }\r\n\r\n let taxacambio: number = dadosCalcular.taxaCambio;\r\n\r\n dadosCalcular.totalIvaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIva / taxacambio\r\n );\r\n dadosCalcular.totalMoedaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIliq / taxacambio\r\n );\r\n dadosCalcular.totalIliqCliente =\r\n dadosCalcular.totalMoedaCliente + dadosCalcular.totalIvaCliente;\r\n\r\n return dadosCalcular;\r\n }\r\n\r\n //itens\r\n CalcularValoresIten(item: FADocumentosItensDto): FADocumentosItensDto {\r\n item = this.CalcularItem(item);\r\n return item;\r\n }\r\n\r\n CalcularValoresItens(itens: FADocumentosItensDto[]): FADocumentosItensDto[] {\r\n const listaItem: FADocumentosItensDto[] = [];\r\n for (const item of itens) {\r\n listaItem.push(this.CalcularItem(item));\r\n }\r\n\r\n return listaItem;\r\n }\r\n\r\n CalcularItem(item: FADocumentosItensDto): FADocumentosItensDto {\r\n item.quantidade = this.TresCasasDecimais(item.quantidade);\r\n item.impostoDedutivelPerc = this.DuasCasasDecimais(item.impostoDedutivelPerc);\r\n item.descontoPerc = this.DuasCasasDecimais(item.descontoPerc);\r\n item.taxaImposto = this.DuasCasasDecimais(item.taxaImposto);\r\n item.preco = this.DuasCasasDecimais(item.preco);\r\n item.desconto = this.CalcularDesconto(item);\r\n item.subTotal = this.DuasCasasDecimais(item.quantidade * item.preco - item.desconto);\r\n item.imposto = this.DuasCasasDecimais((item.taxaImposto / 100) * item.subTotal);\r\n item.total = this.DuasCasasDecimais(item.subTotal);\r\n item.totalGeral = this.DuasCasasDecimais(item.subTotal + item.imposto);\r\n item.subTotalIliq = this.DuasCasasDecimais(item.quantidade * item.preco);\r\n return item;\r\n }\r\n\r\n \r\n CalcularItemPOS(item: any): any {\r\n item.quantidade = this.TresCasasDecimais(item.quantidade);\r\n item.impostoDedutivelPerc = this.DuasCasasDecimais(item.impostoDedutivelPerc);\r\n item.descontoPerc = this.DuasCasasDecimais(item.descontoPerc);\r\n if(item.descontoPerc>100){\r\n item.descontoPerc=100;\r\n }\r\n item.taxaImposto = this.DuasCasasDecimais(item.taxaImposto);\r\n item.preco = this.DuasCasasDecimais(item.preco);\r\n item.desconto = this.CalcularDesconto(item);\r\n item.subTotal = this.DuasCasasDecimais(item.quantidade * item.preco - item.desconto);\r\n item.imposto = this.DuasCasasDecimais((item.taxaImposto / 100) * item.subTotal);\r\n item.totalGeral = this.DuasCasasDecimais(item.subTotal + item.imposto);\r\n item.subTotalIliq = this.DuasCasasDecimais(item.quantidade * item.preco);\r\n item.total = item.subTotal;\r\n return item;\r\n }\r\n\r\n CalcularDesconto(item: FADocumentosItensDto): number {\r\n if (item.descontoPerc <= 100) {\r\n const desconto = Util.convertToFloat(item.quantidade) * Util.convertToFloat(item.preco) * (Util.convertToFloat(item.descontoPerc) / 100);\r\n return desconto;\r\n }\r\n const desconto = Util.convertToFloat(item.quantidade) * Util.convertToFloat(item.preco) * 1 || 0;\r\n return desconto;\r\n }\r\n\r\n CalcularValoresItem(dadosCalcularDto: CalcularItensTotalDto): any {\r\n let calculo = converterParaCamelCase(dadosCalcularDto);\r\n\r\n const itemResp = this.CalcularValoresIten(calculo.item);\r\n const item = itemResp;\r\n const index = calculo.itens.findIndex((i) => i.idItem === item.idItem);\r\n calculo.itens[index] = itemResp;\r\n calculo.totais.itens = calculo.itens.filter((a) => a.idArtigo > 0);\r\n const totais = this.CalcularTotais(calculo.totais);\r\n\r\n const retorno = {item, totais: totais};\r\n return retorno;\r\n }\r\n\r\n CalcularValoresItensTotais(dadosCalcularDto: CalcularItensTotalDto): any {\r\n let calculo = converterParaCamelCase(dadosCalcularDto);\r\n const itens = this.CalcularValoresItens(calculo.itens);\r\n\r\n calculo.totais.itens = itens.filter((a) => a.idArtigo > 0);\r\n const totais = this.CalcularTotais(calculo.totais);\r\n const retorno = {itens, totais: totais};\r\n return retorno;\r\n }\r\n\r\n conversaoDirectaItem(dadosCalcular: DocumentoCalculoTotaisDto): any {\r\n if (\r\n !dadosCalcular.conversaoDirecta ||\r\n dadosCalcular.taxaCambio === null ||\r\n dadosCalcular.taxaCambio <= 0\r\n ) {\r\n return dadosCalcular;\r\n }\r\n\r\n const taxacambio = dadosCalcular.taxaCambio;\r\n\r\n dadosCalcular.totalIvaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIva * taxacambio\r\n );\r\n dadosCalcular.totalMoedaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIliq * taxacambio\r\n );\r\n dadosCalcular.totalIliqCliente =\r\n dadosCalcular.totalMoedaCliente + dadosCalcular.totalIvaCliente;\r\n\r\n return dadosCalcular;\r\n }\r\n\r\n ConversaoIndirectaItem(\r\n dadosCalcular: DocumentoCalculoTotaisDto\r\n ): DocumentoCalculoTotaisDto {\r\n if (\r\n !dadosCalcular.conversaoDirecta ||\r\n dadosCalcular.taxaCambio === null ||\r\n dadosCalcular.taxaCambio <= 0\r\n ) {\r\n return dadosCalcular;\r\n }\r\n\r\n const taxacambio = dadosCalcular.taxaCambio;\r\n\r\n dadosCalcular.totalIvaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIva / taxacambio\r\n );\r\n dadosCalcular.totalMoedaCliente = this.DuasCasasDecimais(\r\n dadosCalcular.totalIliq / taxacambio\r\n );\r\n dadosCalcular.totalIliqCliente =\r\n dadosCalcular.totalMoedaCliente + dadosCalcular.totalIvaCliente;\r\n\r\n return dadosCalcular;\r\n }\r\n\r\n retornarPrecoArtigo(precos: any[], posicaoPreco: number): number {\r\n if (precos?.length <= 0) {\r\n return 0;\r\n }\r\n let precoDef = precos[0];\r\n switch (posicaoPreco) {\r\n case 1:\r\n return retornarValorPosicao1(precoDef);\r\n case 2:\r\n return retornarValorPosicao2(precoDef);\r\n case 3:\r\n return retornarValorPosicao3(precoDef);\r\n default:\r\n return retornarValorPosicao1(precoDef);\r\n }\r\n }\r\n\r\n DuasCasasDecimaisTeste(valor?: number | string): number {\r\n if (typeof valor === 'string') {\r\n // Tenta converter a string em um número.\r\n valor = valor.replace(/\\./g, '').replace(',', '.');\r\n valor = parseFloat(valor);\r\n }\r\n\r\n if (typeof valor !== 'number' || isNaN(valor)) {\r\n // Se o valor não é um número válido, retorne zero ou outro valor padrão.\r\n return 0;\r\n }\r\n return Math.round((valor || 0) * 100) / 100;\r\n }\r\n TresCasasDecimais(valor?: number | string): number {\r\n if (typeof valor === 'string') {\r\n // Tenta converter a string em um número.\r\n valor = valor.replace('.', '');\r\n valor = parseFloat(valor.replace(',', '.'));\r\n }\r\n \r\n if (typeof valor !== 'number' || isNaN(valor)) {\r\n // Se o valor não é um número válido, retorne zero ou outro valor padrão.\r\n return 0;\r\n }\r\n \r\n return Math.round((valor || 0) * 1000) / 1000;\r\n }\r\n \r\n DuasCasasDecimais(valor?: number | string): number {\r\n if (typeof valor === 'string') {\r\n // Tenta converter a string em um número.\r\n valor = valor.replace(/\\./g, '').replace(',', '.');\r\n valor = parseFloat(valor);\r\n }\r\n\r\n if (typeof valor !== 'number' || isNaN(valor)) {\r\n // Se o valor não é um número válido, retorne zero ou outro valor padrão.\r\n return 0;\r\n }\r\n return Math.round((valor || 0) * 100) / 100;\r\n }\r\n}\r\n\r\nfunction converterParaCamelCase(obj: any): any {\r\n if (obj === null || typeof obj !== 'object') {\r\n return obj;\r\n }\r\n\r\n if (Array.isArray(obj)) {\r\n return obj.map((item) => converterParaCamelCase(item));\r\n }\r\n\r\n const camelCaseObj: { [key: string]: any } = {};\r\n\r\n for (const key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n const camelCaseKey = key.charAt(0).toLowerCase() + key.slice(1);\r\n camelCaseObj[camelCaseKey] = converterParaCamelCase(obj[key]);\r\n }\r\n }\r\n\r\n return camelCaseObj;\r\n}\r\n\r\nfunction retornarValorPosicao1(precoDef: any): number {\r\n return precoDef.preco1;\r\n}\r\n\r\nfunction retornarValorPosicao2(precoDef: any): number {\r\n return precoDef?.preco2 < 0 ? retornarValorPosicao1(precoDef) : precoDef.preco2;\r\n}\r\n\r\nfunction retornarValorPosicao3(precoDef: any): number {\r\n return precoDef?.preco3 < 0 ? retornarValorPosicao2(precoDef) : precoDef.preco3;\r\n}\r\n","import {Injectable} from '@angular/core';\r\nimport {HttpClient, HttpHeaders} from '@angular/common/http';\r\nimport {BehaviorSubject, Observable} from 'rxjs';\r\nimport {Aplicacao} from 'app/shared/models/aplicacao/aplicacao';\r\nimport {environment} from 'environments/environment';\r\nimport {EmailLog} from 'app/shared/models/aplicacao/emailLog';\r\nimport {Perfis} from 'app/shared/models/aplicacao/perfis';\r\nimport {Pais} from 'app/shared/models/recursos-humanos/pais';\r\nimport {Provincia} from 'app/shared/models/recursos-humanos/provincia';\r\nimport { filter, shareReplay, tap } from 'rxjs/operators';\r\nimport {Resposta} from 'app/shared/models/resposta';\r\nimport {Idioma} from '../../models/aplicacao/idioma';\r\n\r\nconst httpOptions = {\r\n headers: new HttpHeaders({\r\n Authorization: 'Bearer ' + localStorage.getItem('token')\r\n })\r\n};\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AplicacaoService {\r\n private aplicacao$ = new BehaviorSubject(null);\r\n baseUrlAplicacao: string;\r\n baseUrlCliente: string;\r\n InstalacaoUrl: string;\r\n gereStockBS: BehaviorSubject = new BehaviorSubject(null);\r\n $dadosApp = new BehaviorSubject(null);\r\n gereStock$: Observable = this.gereStockBS.asObservable();\r\n\r\n codPais: string;\r\n\r\n constructor(\r\n private http: HttpClient,\r\n ) {\r\n this.baseUrlAplicacao = `${environment.apiAplicacao}`;\r\n this.baseUrlCliente = `${environment.apiClientes}`;\r\n this.InstalacaoUrl = `${environment.instalacao}`;\r\n const gereStockJson = localStorage.getItem('gereStocks');\r\n // const gereStock = gereStockJson !== null ? JSON.parse(gereStockJson) : null;\r\n // this.gereStockBS = new BehaviorSubject(gereStock);\r\n this.gereStock$ = this.gereStockBS.asObservable();\r\n this.codPais = localStorage.getItem('codPais') ? localStorage.getItem('codPais') : '';\r\n this.gereStock$.subscribe(s => localStorage.setItem('gereStocks', String(s)));\r\n\r\n }\r\n\r\n public getCodPais(): string {\r\n return this.codPais;\r\n }\r\n\r\n public getGereStocks() {\r\n return this.gereStockBS.value;\r\n }\r\n\r\n getInstalacao(nomeInstalacao: string): Observable {\r\n const modelo = {NomeLinkInstalacao: nomeInstalacao};\r\n return this.http.post(this.InstalacaoUrl, modelo);\r\n }\r\n\r\n //#region Área feita antes de 01-04-2021\r\n getLogotipoApp(): Observable {\r\n return this.http.get(this.baseUrlAplicacao + 'aplicacao/logotipo', httpOptions);\r\n }\r\n\r\n getMkEmails() {\r\n return this.http.get>(this.baseUrlAplicacao + 'Mykiami/emails', httpOptions);\r\n }\r\n\r\n putMkEmail(req: any) {\r\n return this.http.post>(this.baseUrlAplicacao + 'Mykiami/emails', req, httpOptions);\r\n }\r\n\r\n getAplicacao(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/aplicacao', httpOptions)\r\n .pipe(shareReplay(1), tap(res => this.$dadosApp.next(res)));\r\n }\r\n\r\n getAplicacaoGeral(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/aplicacao', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getMeses(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/meses', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getMenus(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/menus/1', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getMoedas(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/moedas', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getTiposEmpregos(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/TiposEmprego', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getIdiomas(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/idiomas', httpOptions)\r\n .pipe(shareReplay(1));\r\n\r\n }\r\n\r\n getTodosIdiomas(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/todosIdiomas', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getIdiomaAplicacao() {\r\n return this.http.get(this.baseUrlAplicacao + 'aplicacao/idiomas/utilizadores', httpOptions);\r\n }\r\n\r\n getProeficiencia(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/proeficienciaidiomas', httpOptions)\r\n .pipe();\r\n }\r\n\r\n gravarPermissoes(modelo: any) {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'permissoes', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n getPermissoes(): Observable {\r\n return this.http.get(this.baseUrlAplicacao + 'permissoes', httpOptions);\r\n }\r\n\r\n\r\n getPermissoesTipos(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/tipos', httpOptions)\r\n .pipe();\r\n }\r\n\r\n // ECARVALHO - Retirar\r\n getPermissoesAplicacao(idUtilizador: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/' + idUtilizador, httpOptions)\r\n .pipe();\r\n }\r\n\r\n getPermissoesUtilizador(idUtilizador: number): Observable {\r\n return this.http\r\n .get(\r\n this.baseUrlAplicacao + 'permissoes/utilizador/' + idUtilizador,\r\n httpOptions\r\n );\r\n }\r\n\r\n getPermissoesUtilizadorArea(idUtilizador: number, codArea: string) {\r\n httpOptions['params'] = {codArea};\r\n return this.http.get>(`${this.baseUrlAplicacao}permissoes/areas/${idUtilizador}`, httpOptions);\r\n }\r\n\r\n getPaises(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/paises/true', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getEstados(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/estados', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getProvincias(codPais: string): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/provincias/' + codPais, httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getGrausAcademicos(): Observable {\r\n\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'Aplicacao/GrausAcademicos', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getMunicipios(codPais: string, idProvincia: number) {\r\n if (codPais && codPais.length > 0 && idProvincia > 0) {\r\n return this.http\r\n .get(\r\n this.baseUrlAplicacao + 'aplicacao/municipios/' + codPais + '/' + idProvincia,\r\n httpOptions\r\n )\r\n .pipe(shareReplay(1));\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n getZonas(idMunicipio: number): Observable {\r\n return this.http\r\n .get(\r\n this.baseUrlAplicacao + 'aplicacao/zonas/' + idMunicipio,\r\n httpOptions\r\n )\r\n .pipe();\r\n }\r\n\r\n getSexos(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/sexos', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getEstadosCivis(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/estadoscivis', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getCategoriasContactos(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/categoriascontactos', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getTiposContactos(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/tiposcontactos', httpOptions)\r\n .pipe(shareReplay(1));\r\n }\r\n\r\n getOpcoesInsercao(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/opcoesinsercao', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getUnidades(idTipo: number): Observable {\r\n return this.http.get(this.baseUrlAplicacao + 'aplicacao/unidadesmedidas/' + idTipo, httpOptions);\r\n }\r\n\r\n getEmails(\r\n activo: boolean,\r\n disponivelEmails: boolean\r\n ): Observable {\r\n return this.http\r\n .get(\r\n this.baseUrlAplicacao +\r\n 'emails/emailenvio/' +\r\n activo +\r\n '/' +\r\n disponivelEmails,\r\n httpOptions\r\n )\r\n .pipe();\r\n }\r\n\r\n getLogs() {\r\n return this.http.get>(`${this.baseUrlAplicacao}emails/logs`, httpOptions);\r\n }\r\n\r\n getLog(id: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'emails/emaillog/' + id, httpOptions)\r\n .pipe();\r\n }\r\n\r\n removerLog(modelo: any) {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'emails/emaillog/remover', modelo, httpOptions);\r\n }\r\n\r\n removerLogLote(logs: number[]) {\r\n return this.http.post>(`${this.baseUrlAplicacao}emails/log/remover`, logs);\r\n }\r\n\r\n getEmail(idEmail: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'emails/emailenvio/' + idEmail, httpOptions)\r\n .pipe();\r\n }\r\n\r\n servidoresEmail(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'emails/servidoresEmail/', httpOptions)\r\n .pipe();\r\n }\r\n\r\n servidorEmail(idservidor: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'emails/servidorEmail/' + idservidor, httpOptions)\r\n .pipe();\r\n }\r\n\r\n\r\n salvarEmail(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'emails/emailenvio/salvar', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n alterarSenhaEmail(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'emails/emailenvio/alterarSenhaEmail', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n enviarEmail(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'emails/enviaremail', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n enviarEmailCliente(req: any) {\r\n return this.http.post>(this.baseUrlAplicacao + 'emails/enviaremail/clientes', req, httpOptions);\r\n }\r\n\r\n enviarEmailTeste(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'emails/teste', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n editarAplicacao(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'aplicacao/editarAplicacao/', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n getAppIcones(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'aplicacao/icones', httpOptions)\r\n .pipe();\r\n }\r\n\r\n //#endregion\r\n //#region Ária de Permissões do Perfil\r\n\r\n getPerfis(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/perfil', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getPerfil(id: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/perfil/' + id, httpOptions)\r\n .pipe();\r\n }\r\n\r\n getPerfisPermissoes(): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/perfil/permissoes', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getPerfilPermissoes(id: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/perfil/permissoes/' + id, httpOptions)\r\n .pipe();\r\n }\r\n\r\n getPerfilUtilizador(id: number): Observable {\r\n return this.http\r\n .get(this.baseUrlAplicacao + 'permissoes/perfil/utilizador/' + id, httpOptions)\r\n .pipe();\r\n }\r\n\r\n gravarPerfil(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'permissoes/perfil', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n eliminarPerfil(idPerfil: number): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'permissoes/perfil/eliminar', idPerfil, httpOptions)\r\n .pipe();\r\n }\r\n\r\n eliminarPermissaoPerfil(idPerfilPermissao: number): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'permissoes/perfil/permissao/eliminar', idPerfilPermissao, httpOptions)\r\n .pipe();\r\n }\r\n\r\n gravarPerfilPermissoes(modelo: any) {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'permissoes/perfil/gravarPermissoes', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n gravarPerfilUtilizador(modelo: any): Observable {\r\n return this.http\r\n .post(this.baseUrlAplicacao + 'permissoes/perfil/utilizador', modelo, httpOptions)\r\n .pipe();\r\n }\r\n\r\n getmetodosPagRec(): Observable {\r\n return this.http\r\n .get(this.baseUrlCliente + 'clientes/comercial/metodosPagRec', httpOptions)\r\n .pipe();\r\n }\r\n\r\n getCondicoesPagamento(): Observable {\r\n return this.http\r\n .get(this.baseUrlCliente + 'clientes/comercial/condicoespagamento', httpOptions)\r\n .pipe();\r\n }\r\n\r\n\r\n getAreasPermissoes() {\r\n return this.http.get>(this.baseUrlAplicacao + 'aplicacao/areas');\r\n }\r\n\r\n //#endregion\r\n putPermissaoEq(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/equipamentos/lote', req);\r\n }\r\n\r\n putPermissaoFi(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/financas/lote', req);\r\n }\r\n\r\n putPermissaoAr(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/artigos/lote', req);\r\n }\r\n\r\n getPermissaoEq(idUtilizador: number, codPermissao: string) {\r\n return this.http.get>(this.baseUrlAplicacao + `permissoes/${idUtilizador}/equipamentos`, {params: {codPermissao}});\r\n }\r\n\r\n deletePermissoes(codArea: string, permissoes: number[]) {\r\n return this.http.post>(this.baseUrlAplicacao + `permissoes/remover-lote`, permissoes, {params: {codArea}});\r\n }\r\n\r\n putPermissaoFaPos(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/facturacao-pos/lote', req);\r\n }\r\n\r\n putPermissaoAdmin(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/admin/lote', req);\r\n }\r\n\r\n putPermissaoCl(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/entidades/lote', req);\r\n }\r\n\r\n putPermissaoPr(req: any[]) {\r\n return this.http.post>(this.baseUrlAplicacao + 'permissoes/processos/lote', req);\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Aplicacao } from 'app/shared/models/aplicacao/aplicacao';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AppStoreService {\r\n public aplicacao$ = new BehaviorSubject(null);\r\n public aplicacao = false;\r\n\r\n constructor() {}\r\n\r\n setAplicacao(aplicacao: Aplicacao) {\r\n if(!this.aplicacao){\r\n this.aplicacao$.next(aplicacao);\r\n }\r\n }\r\n\r\n getAplicacao(): Observable {\r\n this.aplicacao=true;\r\n return this.aplicacao$.asObservable();\r\n }\r\n}\r\n","import {Injectable} from '@angular/core';\r\nimport {Menu} from 'app/shared/models/aplicacao/menu';\r\nimport {BehaviorSubject, Observable} from 'rxjs';\r\nimport {map} from 'rxjs/operators';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class MenuDataService {\r\n private listaMenus$ = new BehaviorSubject