This commit is contained in:
Peter Maquiran
2021-06-09 15:32:54 +01:00
15 changed files with 119 additions and 123 deletions
+2 -2
View File
@@ -81,11 +81,11 @@ export class DelegarPage implements OnInit {
this.modalController.dismiss(null);
}
async saveTask(){
async saveTask() {
if(this.taskParticipants.length > 1){
this.alertService.presentErrorMessage("Selecione apenas um destinatário");
}
else{
else {
let body = {
"SerialNumber": this.task.SerialNumber,
"DispatchDocId": this.task.DocId,
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router';
import { DailyWorkTask, tasksList } from '../../../models/dailyworktask.model';
import { ProcessesService } from 'src/app/services/processes.service';
import { formatDate } from '@angular/common';
@@ -29,10 +29,6 @@ constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
) {
}
ngOnInit() {
this.activatedRoute.queryParams.subscribe(params => {
if(params['segment'] == 'validar') {
@@ -43,8 +39,15 @@ constructor(
this.LoadList();
});
}
ngOnInit() {
this.LoadList();
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
this.LoadList();
}
});
}
segmentChanged(ev: any) {
@@ -91,10 +91,10 @@ export class ApproveEventPage implements OnInit {
console.log(body);
try {
//await this.processes.PostTaskAction(body).toPromise()
await this.processes.PostTaskAction(body).toPromise()
//this.successMessage()
this.toastService.successMessage('Evento rejeitado!');
//this.goBack();
this.toastService.successMessage('Evento aprovado');
this.goBack();
} catch (error) {
this.badRequest()
}
@@ -119,7 +119,6 @@ export class ApproveEventPage implements OnInit {
async rejectTask(serialNumber:string){
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body);
try {
this.processes.PostTaskAction(body).toPromise();
//await this.successMessage('Processo rejeitado');
@@ -109,7 +109,7 @@
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
<button (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" *ngIf="hideSendToPendentes" >Enviar para Pendentes</button>
<div hidden class="solid"></div>
<button hidden class="btn-cancel" shape="round" >Delegar</button>
<button hidden (click)="showToast()" class="btn-cancel" shape="round" >ShowToast</button>
@@ -39,6 +39,8 @@ export class ExpedienteDetailPage implements OnInit {
intervenientes: any;
cc: any = [];
hideSendToPendentes = true
constructor(private activateRoute: ActivatedRoute,
private processes: ProcessesService,
@@ -54,19 +56,23 @@ export class ExpedienteDetailPage implements OnInit {
private toastService: ToastService,
private animationController: AnimationController
) {
this.activatedRoute.queryParams.subscribe(params => {
if(params["serialNumber"]) {
this.serialnumber = params["serialNumber"];
console.log(params["serialNumber"]);
}
if(params["type"] == "pendentes") {
this.hideSendToPendentes = false
}
});
}
ngOnInit() {
this.profile = "mdgpr";
console.log('HERE');
console.log(this.serialnumber);
this.activateRoute.paramMap.subscribe(paramMap => {
if (!paramMap.has('SerialNumber')) {
@@ -88,50 +94,39 @@ export class ExpedienteDetailPage implements OnInit {
this.toastService.presentToast('Não foi possível fazer login"');
}
goBack() {
this.activatedRoute.queryParams.subscribe(params => {
if(params["from"] == "inicio") {
this.router.navigate(['/home/events']);
} else {
let navigationExtras: NavigationExtras = {
queryParams: {
"expedientes": true
"expedientes": true,
}
};
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
if( window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/expediente']);
} else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
if (params["type"] == 'pendentes') {
}
});
}
/* goBack(){
let navigationExtras: NavigationExtras = {
queryParams: {
"expedientes": true,
}
};
if( window.innerWidth < 801){
this.router.navigate(['/home/gabinete-digital/expediente']);
} else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
} */
sendExpedienteToPending(){
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res);
@@ -47,10 +47,6 @@ export class ExpedientePage implements OnInit {
});
}
notImplemented(){
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
openExpedientDetailPage(data){
console.log(data);
this.openExpedientDetail.emit(data);
@@ -111,23 +107,5 @@ export class ExpedientePage implements OnInit {
}
async viewExpedientDetail(serialNumber:any) {
console.log(this.profile);
const modal = await this.modalController.create({
component: ExpedienteDetailPage,
componentProps:{
enterAnimation: "",
serialNumber: serialNumber,
profile: this.profile,
},
cssClass: 'modal modal-desktop',
});
await modal.present();
modal.onDidDismiss().then((res)=>{
console.log('refresh list');
this.LoadList();
});
}
}
@@ -303,6 +303,7 @@ export class GabineteDigitalPage implements OnInit {
else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showEventsToApprove = true;
this.eventsToApprove.doRefresh();
}
}
@@ -60,7 +60,7 @@ export class PendentesPage implements OnInit {
"pedidos": true,
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
// window.history.back();
@@ -176,7 +176,8 @@ export class PendentesPage implements OnInit {
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": serialNumber,
"from": "pendentes"
"from": "pendentes",
"type": "pendentes"
}
};
this.router.navigate(['/home/gabinete-digital/expediente/expediente-detail'], navigationExtras);
+4 -1
View File
@@ -11,7 +11,8 @@ ion-content{
.main-wrapper{
background: linear-gradient(180deg, #42B9FE 0%, #0782C9 100%) !important;
display: flex;
height: calc(100% - 50Px);
width: 100vw;
height: 100vh;
overflow: auto;
}
@@ -133,6 +134,8 @@ ion-item{
}
.main-content {
width: 100vw;
height: 100vh;
background-color: white;
text-align: center;
align-items: center;
+31 -24
View File
@@ -65,10 +65,14 @@ export class LoginPage implements OnInit {
ngOnInit() {}
//Function to validade the login inputs
validateInput() {
validateUsername() {
return (
this.username.trim().length > 0
&& this.password.trim().length > 0
);
}
validatePassword() {
return (
this.password.trim().length > 0
);
}
@@ -106,34 +110,37 @@ export class LoginPage implements OnInit {
async Login() {
if (this.validateInput()) {
this.userattempt = {
username: this.username,
password: this.password,
domainName: environment.domain,
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)) {
//this.loginRocketChat();
this.authService.loginChat(this.userattempt);
//this.getToken();
if(!this.pin) {
this.setPint = true
this.pin = true
} else {
this.router.navigate(['/home/events']);
if (this.validateUsername()) {
if(this.validatePassword()){
this.userattempt = {
username: this.username,
password: this.password,
domainName: environment.domain,
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)) {
//this.loginRocketChat();
this.authService.loginChat(this.userattempt);
//this.getToken();
if(!this.pin) {
this.setPint = true
this.pin = true
} else {
this.router.navigate(['/home/events']);
}
}
else {
this.toastService.badRequest('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar');
}
}
else {
//this.toastService.presentToast('Não foi possível fazer login"');
this.presentAlert('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar.');
else{
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
}
}
else {
//this.toastService.presentToast('Preencha todos campos');
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
}
}
+2 -2
View File
@@ -82,7 +82,7 @@ export class ToastService {
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(7000)
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
@@ -105,7 +105,7 @@ export class ToastService {
setTimeout(()=>{
modal.dismiss()
},3000)
},7000)
}
}
@@ -7,7 +7,7 @@
</button>
</div>
<ion-toolbar>
<ion-segment [(ngModel)]="segment">
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="MDGPR">
Seu calendário
</ion-segment-button>
@@ -36,37 +36,45 @@ export class EventsToApprovePage implements OnInit {
ngOnInit() {
this.segment = this.loggeduser.Profile;
console.log(this.segment);
this.LoadToApproveEvents();
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
this.doRefresh();
this.LoadToApproveEvents();
}
});
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth <= 1024){
this.modalController.dismiss();
}
};
}
LoadToApproveEvents() {
segmentChanged(ev: any) {
this.LoadToApproveEvents();
}
async LoadToApproveEvents() {
this.showLoader = true;
let prEvents = await this.processes.GetToApprovedEvents('PR','false').toPromise();
this.eventsPRList = prEvents;
console.log(this.eventsPRList);
this.processes.GetToApprovedEvents('PR','false').subscribe(res=>{
/* this.processes.GetToApprovedEvents('PR','false').subscribe(res=>{
this.showLoader = false;
this.eventsPRList = res;
console.log('this.eventsPRList', this.eventsPRList)
});
this.processes.GetToApprovedEvents('MDGPR','false').subscribe(res=>{
}); */
let mdEvents = await this.processes.GetToApprovedEvents('MDGPR','false').toPromise();
this.eventsMDGPRList = mdEvents;
console.log(this.eventsMDGPRList);
/* this.processes.GetToApprovedEvents('MDGPR','false').subscribe(res=>{
this.showLoader = false;
this.eventsMDGPRList = res;
console.log('this.eventsMDGPRList', this.eventsMDGPRList)
});
}); */
this.showLoader = false;
}
goToEventDetail(eventToAprove){
@@ -121,11 +129,7 @@ export class EventsToApprovePage implements OnInit {
doRefresh() {
console.log('Refresh Events');
this.LoadToApproveEvents();
console.log('refresh');
setTimeout(() => {
}, 2000);
}
close(){
this.modalController.dismiss(null);
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { NavigationEnd, NavigationExtras, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd, NavigationExtras, Router } from '@angular/router';
import { CalendarComponent } from 'ionic2-calendar';
import { DailyWorkTask } from '../../../models/dailyworktask.model';
@@ -32,8 +32,10 @@ export class ExpedientsPage implements OnInit {
private modalController: ModalController,
private alertService: AlertService,
private router: Router,
private activatedRoute: ActivatedRoute,
) {
this.profile = 'mdgpr';
}
ngOnInit() {
@@ -101,7 +103,8 @@ export class ExpedientsPage implements OnInit {
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": serialNumber,
"from": "gabinete"
"from": "gabinete",
"type": "pendentes"
}
};
this.router.navigate(['/home/gabinete-digital/expediente/expediente-detail'], navigationExtras);
@@ -155,32 +155,34 @@ export class PendentesPage implements OnInit {
goToDespacho(serialNumber:any){
let navigationExtras: NavigationExtras = {
queryParams: {
queryParams: {
"serialNumber": serialNumber,
}
}
};
this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras);
this.router.navigate(['/home/gabinete-digital/despachos/despacho'], navigationExtras);
}
goToPedido(serialNumber:any){
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": serialNumber,
}
};
this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras);
}
goToPedido(serialNumber:any) {
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": serialNumber,
}
}
this.router.navigate(['/home/gabinete-digital/pedidos/pedido'], navigationExtras);
}
goToExpediente(serialNumber:any){
let navigationExtras: NavigationExtras = {
queryParams: {
"serialNumber": serialNumber,
"from": "gabinete"
"from": "gabinete",
"type": "pendentes"
}
};
}
this.router.navigate(['/home/gabinete-digital/expediente/expediente-detail'], navigationExtras)
this.router.navigate(['/home/gabinete-digital/expediente/expediente-detail'], navigationExtras);
}
async openDespacho(serialNumber:string){