This commit is contained in:
tiago.kayaya
2021-12-01 15:15:32 +01:00
212 changed files with 3517 additions and 1657 deletions
@@ -1,4 +1,4 @@
<ion-header class="ion-no-border px-20">
<ion-header class="ion-no-border">
<app-header></app-header>
</ion-header>
<ion-content>
@@ -157,7 +157,7 @@ export class DespachoPrPage implements OnInit {
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -272,9 +272,9 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
this.toastService._successMessage()
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -297,10 +297,10 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado')
this.toastService._successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest('Processo não arquivado')
this.toastService._badRequest('Processo não arquivado')
}
finally {
loader.remove()
@@ -320,10 +320,10 @@ export class DespachoPrPage implements OnInit {
documents
}).toPromise()
this.toastService.successMessage('Processo criado')
this.toastService._successMessage('Processo criado')
this.close();
} catch (error) {
this.toastService.badRequest('Processo não criado')
this.toastService._badRequest('Processo não criado')
}
finally {
loader.remove()
@@ -346,10 +346,10 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('')
this.toastService._successMessage('')
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -373,10 +373,10 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.toastService._successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -391,11 +391,11 @@ export class DespachoPrPage implements OnInit {
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.popoverController.dismiss('close')
this.toastService.successMessage('Processo enviado para pendentes')
this.toastService._successMessage('Processo enviado para pendentes')
this.goBack()
}, () => {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
});
}
@@ -448,6 +448,7 @@ export class DespachoPrPage implements OnInit {
else if (actionName == 'Reexecução') {
await this.reexecutar(res.data.note, docs);
}
this.goBack();
}
});
@@ -535,7 +536,15 @@ export class DespachoPrPage implements OnInit {
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
modal.onDidDismiss().then(res => {
if(res){
const data = res.data;
if(data == 'close') {
this.goBack();
}
}
});
}
async distartExpedientModal() {
@@ -157,8 +157,9 @@ export class DespachosPrPage implements OnInit {
}
this.despachoList.push(task);
console.log(this.despachoList);
});
this.despachoList = this.sortService.sortDate(this.despachoList, 'CreateDate')
this.listToPresent = this.despachoList
}, (error) => {
@@ -117,15 +117,15 @@ export class DiplomaAssinarPage implements OnInit {
}, (error)=>{
try {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
this.goBack()
} catch (e) {
window.history.back();
} finally {
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
}
});
@@ -179,11 +179,11 @@ export class DiplomaAssinarPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage(false, ()=>{
this.toastService._successMessage(false, ()=>{
this.goBack();
})
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -80,13 +80,14 @@ export class DiplomasAssinarPage implements OnInit {
let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
this.diplomasList = [];
let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma");
diplomasAssinar = this.sortService.sortArrayISODate(diplomasAssinar);
let diplomasAssinar = diplomas.filter(data => data.activityInstanceName == "Assinar Diploma");
diplomasAssinar.forEach(element => {
let task: customTask = this.customTaskPipe.transform(element)
this.diplomasList.push(task);
});
this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate')
this.skeletonLoader = false
this.showLoader = false;
@@ -163,7 +163,7 @@ export class DiplomaPage implements OnInit {
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -282,12 +282,12 @@ export class DiplomaPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage(false, () => {
this.toastService._successMessage(false, () => {
this.close();
})
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -308,9 +308,9 @@ export class DiplomaPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.toastService._successMessage()
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -334,9 +334,9 @@ export class DiplomaPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo concluído')
this.toastService._successMessage('Processo concluído')
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -16,10 +16,10 @@
<ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="validar">
Por validar
Por validar ...
</ion-segment-button>
<ion-segment-button value="assinados">
Assinados PR
Assinados PR ...
</ion-segment-button>
</ion-segment>
</ion-toolbar>
@@ -182,7 +182,6 @@ export class DiplomasPage implements OnInit, OnDestroy {
this.skeletonLoader = false
this.showLoader = false;
let diplomasValidar = diplomas.filter(data => data.activityInstanceName == "Revisar Diploma");
let diplomasList = [];
diplomasValidar.forEach(async element => {
@@ -191,18 +190,19 @@ export class DiplomasPage implements OnInit, OnDestroy {
diplomasList.push(task);
});
this.diplomasList = this.sortService.sortArrayISODate(diplomasList.reverse());
this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate');
let diplomasAssinados = diplomas.filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = [];
let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = []
diplomasAssinados.forEach(async element => {
let task = this.pipeTask(element);
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortService.sortArrayISODate(diplomasAssinadoList).reverse();
this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate')
}, (error) => {
this.getFromDb()
@@ -220,21 +220,21 @@ export class DiplomasPage implements OnInit, OnDestroy {
let task = this.pipeTaskOffline(element)
diplomasList.push(task);
});
});
console.log(diplomasList);
console.log(diplomasList);
this.diplomasList = this.sortService.sortDate(diplomasList, 'taskStartDate');
this.diplomasList = this.sortService.sortArrayISODate(diplomasList).reverse();
let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinados = process.filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = []
diplomasAssinados.forEach(async element => {
let task = this.pipeTaskOffline(element)
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortService.sortArrayISODate(diplomasAssinadoList).reverse();
let task = this.pipeTaskOffline(element)
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'taskStartDate')
})
}
@@ -110,13 +110,13 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage('Evento aprovado', ()=>{
this.toastService._successMessage('Evento aprovado', ()=>{
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
})
} catch (error) {
this.toastService.badRequest('Evento não aprovado')
this.toastService._badRequest('Evento não aprovado')
}
finally {
loader.remove()
@@ -141,11 +141,11 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage('Evento rejeitado', () =>{
this.toastService._successMessage('Evento rejeitado', () =>{
this.router.navigate(['/home/gabinete-digital/event-list']);
})
} catch (error) {
this.toastService.badRequest('Evento não rejeitado')
this.toastService._badRequest('Evento não rejeitado')
}
finally {
loader.remove()
@@ -17,6 +17,7 @@ import { SqliteService } from '../../../../services/sqlite.service';
import { BackgroundService } from '../../../../services/background.service';
import { Platform } from '@ionic/angular';
import { ThemeService } from 'src/app/services/theme.service'
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
@Component({
@@ -62,6 +63,7 @@ export class ApproveEventPage implements OnInit {
private platform: Platform,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private offlineManager: OfflineManagerService
) {
this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]);
@@ -203,11 +205,11 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -255,11 +257,15 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
console.log('Send event to approve for revition')
this.offlineManager.storeRequestData('event-listRever', body);
});
this.toastService._successMessage('Pedido enviado');
this.goBack();
} catch (error) {
this.toastService.badRequest();
this.toastService._badRequest();
} finally {
loader.remove()
}
@@ -280,10 +286,10 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado');
await this.toastService._successMessage('Processo rejeitado');
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -358,10 +364,10 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest();
this.toastService._badRequest();
} finally {
loader.remove()
}
@@ -84,14 +84,13 @@ export class EventListPage implements OnInit {
this.platform.ready().then(() => {
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => {
this.eventsMDGPRList = this.sortService.sortArrayByDate(event).reverse()
this.eventsMDGPRList = this.sortService.sortDate(event, 'taskStartDate')
console.log("All evento to aprove from db ", event)
})
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => {
this.eventsPRList = this.sortService.sortArrayByDate(event).reverse()
console.log("All evento to aprove from db ", event)
this.eventsPRList = this.sortService.sortDate(event, 'taskStartDate')
})
})
console.log('Offlineee')
@@ -111,14 +110,14 @@ export class EventListPage implements OnInit {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse()
this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate')
this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
}
else if (this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList).reverse();
this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate')
this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
}
this.showLoader = false;
@@ -275,10 +275,10 @@ export class BookMeetingModalPage implements OnInit {
this.modalController.dismiss();
// this.distartExpedientModal();
this.toastService.successMessage('Reunião criada');
this.toastService._successMessage('Reunião criada');
} catch (error) {
this.toastService.badRequest('Reunião não criada')
this.toastService._badRequest('Reunião não criada')
}
finally {
loader.remove()
@@ -300,10 +300,10 @@ export class BookMeetingModalPage implements OnInit {
break;
}
this.close();
this.toastService.successMessage('Reunião criada');
this.toastService._successMessage('Reunião criada');
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -328,11 +328,11 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado');
await this.toastService._successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -362,11 +362,11 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
await this.toastService.successMessage('Pedido enviado');
await this.toastService._successMessage('Pedido enviado');
this.modalController.dismiss(action_parecer);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -394,10 +394,10 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
this.toastService.successMessage('Processo efetuado');
this.toastService._successMessage('Processo efetuado');
this.modalController.dismiss(action_deferimento);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -436,18 +436,18 @@ export class ExpedientTaskModalPage implements OnInit {
if(this.postData.DispatchFolder.Message){
try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado');
await this.toastService._successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho_pr);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
//loader.remove()
}
}
else{
this.validateField = true;
this.toastService.badRequest('Por favor adicione uma descrição');
this.toastService._badRequest('Por favor adicione uma descrição');
}
loader.remove();
break;
@@ -474,11 +474,11 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.successMessage('Pedido enviado');
await this.toastService._successMessage('Pedido enviado');
this.modalController.dismiss(action_parecer_pr);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -111,7 +111,7 @@
<div *ngIf="task && p.userRole(['PR'])" class="aside-right flex-column height-100 overflow-y-auto">
<div class="buttons">
<!-- <div class="buttons">
<button (click)="openExpedientActionsModal('0', fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button (click)="distartExpedientModal('descartar')" class="btn-cancel" shape="round" >Descartar</button>
<div class="solid"></div>
@@ -121,8 +121,7 @@
<button (click)="openNewGroupPage(task)" class="btn-cancel" shape="round" >Iniciar Conversa</button>
<div hidden class="solid"></div>
<button hidden class="btn-cancel" shape="round" >Delegar</button>
</div>
</div> -->
</div>
@@ -171,9 +171,9 @@ export class ExpedienteDetailPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
this.close();
this.toastService.successMessage('Processo aprovado')
this.toastService._successMessage('Processo aprovado')
} catch (error) {
this.toastService.badRequest('Processo não aprovado')
this.toastService._badRequest('Processo não aprovado')
} finally {
loader.remove()
}
@@ -196,9 +196,9 @@ export class ExpedienteDetailPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
this.toastService._successMessage()
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -293,11 +293,11 @@ export class ExpedienteDetailPage implements OnInit {
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
console.log(res);
this.toastService.successMessage('Processo enviado para pendentes')
this.toastService._successMessage('Processo enviado para pendentes')
this.goBack();
},
(error) => {
this.toastService.badRequest('Processo não enviado para pendentes')
this.toastService._badRequest('Processo não enviado para pendentes')
});
}
@@ -349,12 +349,12 @@ export class ExpedienteDetailPage implements OnInit {
this.getFromDB();
} else {
try {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
this.goBack()
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -441,9 +441,9 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
this.attachmentsService.AddAttachment(body).subscribe((res) => {
this.toastService.successMessage()
this.toastService._successMessage()
}, () => {
this.toastService.badRequest()
this.toastService._badRequest()
}, () => {
loader.remove()
});
@@ -479,7 +479,7 @@ export class ExpedienteDetailPage implements OnInit {
await this.processes.CompleteTask(body).toPromise();
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -510,10 +510,10 @@ export class ExpedienteDetailPage implements OnInit {
try {
await this.expedienteService.discard({ SerialNumber: this.task.SerialNumber }).toPromise()
this.toastService.successMessage('Processo descartado');
this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -529,10 +529,10 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.expedienteService.CompleteTask(body).toPromise();
//this.toastService.successMessage('Processo descartado');
//this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -543,10 +543,10 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -8,7 +8,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { Platform } from '@ionic/angular';
import { BackgroundService } from '../../../services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
@Component({
selector: 'app-expediente',
@@ -38,7 +38,8 @@ export class ExpedientePage implements OnInit {
public platform: Platform,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private sortService: SortService,
) { }
ngOnInit() {
@@ -70,7 +71,7 @@ export class ExpedientePage implements OnInit {
const result = res
this.taskslist = new Array();
let ress = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
let ress = result.filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
ress.forEach((element: any) => {
@@ -78,7 +79,7 @@ export class ExpedientePage implements OnInit {
this.taskslist.push(task);
this.addProcessTODb(task);
});
this.listToPresent = this.taskslist
this.listToPresent = this.sortService.sortDate(this.taskslist, 'taskStartDate')
console.log('expediente list', this.listToPresent)
this.skeletonLoader = false;
@@ -135,11 +135,11 @@ export class ExpedientePrPage implements OnInit {
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res);
this.toastService.successMessage('Processo enviado para pendentes')
this.toastService._successMessage('Processo enviado para pendentes')
this.goBack();
},
(error)=>{
this.toastService.badRequest('Processo não enviado para pendentes')
this.toastService._badRequest('Processo não enviado para pendentes')
});
}
@@ -184,15 +184,15 @@ export class ExpedientePrPage implements OnInit {
}, (error)=>{
try {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
this.goBack()
} catch (e) {
window.history.back();
} finally {
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
}
});
@@ -303,9 +303,9 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
this.close();
this.toastService.successMessage('Processo aprovado')
this.toastService._successMessage('Processo aprovado')
} catch(error) {
this.toastService.badRequest('Processo não aprovado')
this.toastService._badRequest('Processo não aprovado')
} finally {
loader.remove()
}
@@ -328,9 +328,9 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
this.toastService._successMessage()
} catch(error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -448,10 +448,10 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado');
this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -468,10 +468,10 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
// this.toastService.successMessage('Processo descartado');
// this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
// this.toastService.badRequest('Processo não descartado')
// this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -485,10 +485,10 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -12,7 +12,7 @@ import { Location } from '@angular/common'
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
@Component({
selector: 'app-expedientes-pr',
@@ -41,7 +41,8 @@ export class ExpedientesPrPage implements OnInit {
private authService: AuthService,
private router: Router,
private location: Location,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private sortService: SortService,
) {
this.loggeduser = authService.ValidatedUser;
}
@@ -80,6 +81,8 @@ export class ExpedientesPrPage implements OnInit {
this.taskslist.push(task);
});
console.log(this.taskslist);
this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate')
this.expedienteGdStore.reset(this.taskslist);
this.skeletonLoader = false
})
@@ -181,7 +181,7 @@
<!-- <div *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientesPrPage(); selectedElement='ExpedientesPr'" [class.active]="selectedElement == 'ExpedientesPr'" class="exp-card-long justify-center width-100 white-background">
<div class="center-div">
<div class="center-div">F
<div class="exp-card-icon">
<ion-icon src="assets/images/icons-expediente-presidente.svg"></ion-icon>
</div>
@@ -29,6 +29,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { SqliteService } from '../../services/sqlite.service';
import { Platform } from '@ionic/angular';
import { BackgroundService } from 'src/app/services/background.service';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({
selector: 'app-gabinete-digital',
@@ -130,7 +131,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
private platform: Platform,
private changeProfileService: ChangeProfileService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private sortService: SortService,
) {
this.loggeduser = authService.ValidatedUser;
@@ -146,10 +148,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
};
this.checkRoutes();
// this.eventoaprovacaostore.resetmd([])
// this.eventoaprovacaostore.resetpr([])
}
ngDoCheck(): void {
@@ -209,63 +207,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
}
async loadAllProcesses() {
this.processesbackend.GetTasksList("", false).subscribe(async res => {
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
if (!this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
} else if (this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
}
console.log('allProcessesList', allProcessesList);
this.addProcessToDB(allProcessesList)
this.skeletonLoader = true;
this.allProcessesList = [];
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender,
//"CreateDate": taskDate,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId,
"FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status,
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
});
}, (error) => {
console.log('gabinete digital offline', error)
this.getAllProcessFromDB();
})
this.skeletonLoader = false;
this.LoadCounts();
}
addProcessToDB(data) {
@@ -329,7 +271,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
console.log("All process from db ", allprocess)
@@ -344,21 +286,18 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
setFormatDate(start: any, end: any, allday: boolean) {
let customDate;
/* start = new Date();
end= new Date("2021-08-04T18:01:04.753Z"); */
//end = new Date("2021-09-04T18:01:04.753Z");
const totalSeconds = Math.floor((end - (start)) / 1000);;
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - (totalDays * 24);
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
//const hours = totalHours - (totalDays * 24);
//const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
// const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
let diffDays = totalDays;
let diffMinutes = minutes;
// let diffDays = totalDays;
// let diffMinutes = minutes;
if (totalDays == 0) {
if (allday) {
@@ -384,6 +323,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
(thedate.getMonth() + 1) + "/" +
thedate.getFullYear();
}
getCustomHours(thedate: Date) {
return thedate.getHours() + ":" +
thedate.getMinutes();
@@ -550,8 +490,49 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.showLoader = true;
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
let count_all_processes = Object.keys(allPreocesses_).length;
let allProcessesList = allPreocesses_;
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento')
if (!this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
} else if (this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
}
this.addProcessToDB(allProcessesList)
this.skeletonLoader = true;
this.allProcessesList = [];
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender,
//"CreateDate": taskDate,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId,
"FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status,
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList);
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise();
expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")
@@ -581,6 +562,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let despachospr = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
let despachosPr;
switch (this.loggeduser.Profile) {
case 'MDGPR':
despachosPr = despachospr.filter(data => data.activityInstanceName == "Tarefa de Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active");
@@ -594,23 +576,18 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
break;
}
let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
const eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventoaprovacaostore.countMd = eventsMDGPRList.length
this.eventoaprovacaostore.resetmd(eventsMDGPRList);
let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal PR', false).toPromise();
const eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventoaprovacaostore.countPr = eventsPRList.length
this.eventoaprovacaostore.resetpr(eventsPRList);
let diplomasValidar = despachospr.filter(data => data.activityInstanceName == "Revisar Diploma");
this.count_dip_pv = Object.keys(diplomasValidar).length;
this.deplomasStore.resetDiplomasReview(diplomasValidar)
@@ -618,8 +595,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let diplomasAssinar = despachospr.filter(data => data.activityInstanceName == "Assinar Diploma");
this.count_dip_as = Object.keys(diplomasAssinar).length;
this.deplomasStore.resetDiplomasList(diplomasAssinar)
this.deplomasStore.resetDiplomasList(diplomasAssinar)
let diplomasAssinados = despachospr.filter(data => data.activityInstanceName == "Diploma Assinado");
this.count_dip_as_pr = Object.keys(diplomasAssinados).length;
@@ -639,22 +616,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
doRefresh(event) {
console.log(event);
// this.closeAllDesktopComponents();
/* switch(this.loggeduser.Profile){
case 'MDGPR':
this.selectedElement='Correspondence';
this.showExpedients = true;
this.expedientesPage.doRefresh();
break;
case 'PR':
this.selectedElement='ExpedientesPr';
this.showExpedientesPr = true;
break;
} */
this.LoadCounts();
this.loadAllProcesses();
//this.refreshExpedientes();
this.LoadCounts();
if (event) {
setTimeout(() => {
@@ -185,7 +185,7 @@ export class PedidoPage implements OnInit {
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -373,10 +373,10 @@ export class PedidoPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.toastService._successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -393,10 +393,10 @@ export class PedidoPage implements OnInit {
note
}).toPromise()
this.toastService.successMessage('Processo arquivado')
this.toastService._successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -418,10 +418,10 @@ export class PedidoPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado')
this.toastService._successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -433,7 +433,7 @@ export class PedidoPage implements OnInit {
this.goBack();
}, () => {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
});
}
@@ -567,7 +567,15 @@ export class PedidoPage implements OnInit {
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
modal.onDidDismiss().then(res => {
if(res){
const data = res.data;
if(data == 'close') {
this.goBack();
}
}
});
}
async openForwardModal(task: any) {
@@ -120,7 +120,7 @@
<div [ngSwitch]="segment">
<div *ngSwitchCase="'parecer'" class="centered-div d-flex height-100 align-center justify-content-center" >
<div
*ngIf="!skeletonLoader && pedidosstorage.listparecer.length == 0"
*ngIf="pedidosstorage.listparecer.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
@@ -129,7 +129,7 @@
<div *ngSwitchCase="'deferimento'" class="centered-div d-flex height-100 align-center justify-content-center">
<div
*ngIf="!skeletonLoader && pedidosstorage.listdeferimento.length == 0"
*ngIf="pedidosstorage.listdeferimento.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
@@ -163,7 +163,9 @@ export class PedidosPage implements OnInit {
this.parecerList.push(task);
});
this.addPedidoToDb(this.parecerList);
this.listToPresentparecerList = this.sortService.sortArrayISODate(this.parecerList);
this.listToPresentparecerList = this.sortService.sortDate(this.parecerList, 'CreateDate')
this.pedidosstorage.resetparecer(this.listToPresentparecerList);
}
else if (this.segment == 'deferimento') {
@@ -203,7 +205,9 @@ export class PedidosPage implements OnInit {
});
});
this.addPedidoToDb(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortDate(this.deferimentoList, 'CreateDate')
this.pedidosstorage.resetdeferimento(this.listToPresentdeferimentoList);
}
@@ -102,7 +102,7 @@ export class PendentesPage implements OnInit {
});
pendentesList = removeDuplicate(pendentesList)
pendentesList = this.sortService.sortArrayISODate(pendentesList);
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate');
this.listToPresent = pendentesList;
this.skeletonLoader = false;
@@ -138,7 +138,7 @@ export class PendentesPage implements OnInit {
}
});
pendingList = pendingList;
pendingList = this.sortService.sortDate(pendingList, 'CreateDate');
this.listToPresent = pendingList;
console.log('pendentes', pendingList)