From a02bcb13a35495397840d9f62330d0106e93817a Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 21 Aug 2023 17:36:32 +0100 Subject: [PATCH] general review --- src/app/pages/agenda/agenda.page.ts | 28 ++-- .../agenda/new-event/new-event.page.html | 2 +- .../events/attendees/attendees.page.html | 4 +- .../expediente-detail.page.ts | 1 + .../new-publication/new-publication.page.ts | 13 +- .../view-publications.page.ts | 8 ++ .../events/attendees/attendees.page.html | 4 +- src/app/services/task.service.ts | 125 +++++++++--------- .../attendee-modal/attendee-modal.page.html | 4 +- .../new-publication/new-publication.page.ts | 13 +- .../view-publications.page.ts | 9 ++ .../store/eventoaprovacao-store.service.ts | 2 +- src/global.scss | 1 + version/git-version.ts | 10 +- 14 files changed, 131 insertions(+), 93 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index a409d91e3..9903032c1 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -952,12 +952,14 @@ export class AgendaPage implements OnInit { this.IsEvent = 'add'; if (window.innerWidth <= 1024) { - let taskParticipants = [{ - EmailAddress: SessionStore.user.Email, - IsRequired: true, - Name: SessionStore.user.FullName, - UserType: "GD" - }] + let taskParticipants = [ + // { + // EmailAddress: SessionStore.user.Email, + // IsRequired: true, + // Name: SessionStore.user.FullName, + // UserType: "GD" + // } + ] const modal = await this.modalCtrl.create({ component: NewEventPage, componentProps: { @@ -981,12 +983,14 @@ export class AgendaPage implements OnInit { await modal.present(); } else { this.mobileComponent.showAddNewEvent = true; - this.taskParticipants = [{ - EmailAddress: SessionStore.user.Email, - IsRequired: true, - Name: SessionStore.user.FullName, - UserType: "GD" - }] + this.taskParticipants = [ + // { + // EmailAddress: SessionStore.user.Email, + // IsRequired: true, + // Name: SessionStore.user.FullName, + // UserType: "GD" + // } + ] } } diff --git a/src/app/pages/agenda/new-event/new-event.page.html b/src/app/pages/agenda/new-event/new-event.page.html index c76596c9a..d2196a135 100644 --- a/src/app/pages/agenda/new-event/new-event.page.html +++ b/src/app/pages/agenda/new-event/new-event.page.html @@ -133,7 +133,7 @@ [stepHour]="1" [stepMinute]="15" - > + > diff --git a/src/app/pages/events/attendees/attendees.page.html b/src/app/pages/events/attendees/attendees.page.html index 2001ab9fb..ff769cee9 100644 --- a/src/app/pages/events/attendees/attendees.page.html +++ b/src/app/pages/events/attendees/attendees.page.html @@ -1,6 +1,6 @@ - Adicionar intervenientes + Pesquisar contactos @@ -90,7 +90,7 @@ diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index 1f9a98c81..b7b06d731 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -693,6 +693,7 @@ export class ExpedienteDetailPage implements OnInit { } async openOptions(taskAction?: any) { + const popover = await this.popoverController.create({ component: OptsExpedientePage, cssClass: 'exp-options', diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 01de8ea31..df8665e0c 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -227,8 +227,9 @@ export class NewPublicationPage implements OnInit { try { - await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() + const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') + console.log({response}) this.close(); } catch (error) { @@ -255,8 +256,9 @@ export class NewPublicationPage implements OnInit { const loader = this.toastService.loading() try { - await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() + const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErrorHandle.httpsSucessMessagge('Criar publicação') + console.log({response}) this.close(); } catch (error) { @@ -281,9 +283,9 @@ export class NewPublicationPage implements OnInit { const loader = this.toastService.loading() try { - await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() + const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErrorHandle.httpsSucessMessagge('Publicação Editada') - + console.log({response}) this.close(); } catch (error) { this.httpErrorHandle.httpStatusHandle(error) @@ -293,7 +295,8 @@ export class NewPublicationPage implements OnInit { } - this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId) + this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId) + } else { diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index c7b85af1b..6acf59bc5 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -169,6 +169,14 @@ export class ViewPublicationsPage implements OnInit { for( let publicationId of loadLater) { await this.loadPublication(publicationId, folderId) } + + for(let localPublication of this.publicationFolderService.publicationList[folderId]) { + + const apiPublication = publicationIds.includes(localPublication.DocumentId) + if(!apiPublication) { + this.publicationFolderService.deletePost(folderId, localPublication.DocumentId) + } + } this.showLoader = false; diff --git a/src/app/services/events/attendees/attendees.page.html b/src/app/services/events/attendees/attendees.page.html index 8d7a3724c..e479e51dc 100644 --- a/src/app/services/events/attendees/attendees.page.html +++ b/src/app/services/events/attendees/attendees.page.html @@ -1,6 +1,6 @@ - Adicionar intervenientes + Pesquisar contactos @@ -85,7 +85,7 @@ diff --git a/src/app/services/task.service.ts b/src/app/services/task.service.ts index 12407e95b..0b0b23e3b 100644 --- a/src/app/services/task.service.ts +++ b/src/app/services/task.service.ts @@ -19,6 +19,7 @@ import { customTask } from '../models/dailyworktask.model'; import { Router } from '@angular/router'; import { v4 as uuidv4 } from 'uuid' import { ChangeProfileService } from './change-profile.service'; +import { PermissionService } from './permission.service'; @Injectable({ providedIn: 'root' @@ -66,6 +67,7 @@ export class TaskService { public eventService: EventsService, private router: Router, private changeProfileService: ChangeProfileService, + public p: PermissionService, ) { this.changeProfileService.registerCallback(() => { @@ -324,6 +326,7 @@ export class TaskService { eventsList = []; } + console.log(calendar, eventsList) this.eventoaprovacaostore.save(calendar, eventsList) } else { @@ -335,6 +338,7 @@ export class TaskService { eventsList = [] } + console.log(calendar, eventsList) this.eventoaprovacaostore.save(calendar.OwnerUserId, eventsList) } } @@ -350,68 +354,71 @@ export class TaskService { async loadDiplomas() { - this.showLoaderNum++ + if(this.p.userPermission([this.p.permissionList.Gabinete.md_tasks]) || this.p.userPermission([this.p.permissionList.Gabinete.pr_tasks])) { + this.showLoaderNum++ - try { - - let depachoAPI = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise(); - - - if(SessionStore.user.Profile != 'PR') { - - let depacho: any = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho"); - depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active"); - - depacho = depacho.map((e)=> this.customTaskPipe.transform(e)) - - this.despachoprstore.reset(depacho) - - } else if(SessionStore.user.Profile == 'PR') { - - let depacho: any = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active") - depacho = depacho.map((e)=> this.customTaskPipe.transform(e)) - this.despachoprstore.reset(depacho) - - } - - - let gerarDiploma = depachoAPI.reverse().filter(data => data.activityInstanceName == "Gerar Diploma" || data.activityInstanceName == "Retificar Diploma"); - let diplomasList = [] - - gerarDiploma.forEach(element => { - let task: customTask = this.customTaskPipe.transform(element); - diplomasList.push(task); - }); - - diplomasList = diplomasList - this.deplomasStore.resetDiplomaGerar(diplomasList); + try { + + let depachoAPI = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise(); - - let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma"); - - diplomasValidar = diplomasValidar.filter(data => data.activityInstanceName != "Tarefa de Despacho"); - - - this.deplomasStore.resetDiplomasReview(diplomasValidar.map((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(); - - return this.customTaskPipe.transform(element) - })) - - - let diplomasAssinar: any = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma"); - diplomasAssinar = diplomasAssinar.map((element) => this.expedienteTaskPipe.transform(element)) - this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar) - - let diplomasAssinados: any = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado"); - diplomasAssinados = diplomasAssinados.map((element) => this.expedienteTaskPipe.transform(element)) - this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados) - } catch (error) {} + + if(SessionStore.user.Profile != 'PR') { + + let depacho: any = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho"); + depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active"); + + depacho = depacho.map((e)=> this.customTaskPipe.transform(e)) - this.showLoaderNum-- + this.despachoprstore.reset(depacho) + + } else if(SessionStore.user.Profile == 'PR') { + + let depacho: any = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active") + depacho = depacho.map((e)=> this.customTaskPipe.transform(e)) + this.despachoprstore.reset(depacho) + + } + + + let gerarDiploma = depachoAPI.reverse().filter(data => data.activityInstanceName == "Gerar Diploma" || data.activityInstanceName == "Retificar Diploma"); + let diplomasList = [] + + gerarDiploma.forEach(element => { + let task: customTask = this.customTaskPipe.transform(element); + diplomasList.push(task); + }); + + diplomasList = diplomasList + this.deplomasStore.resetDiplomaGerar(diplomasList); + + + let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma"); + + diplomasValidar = diplomasValidar.filter(data => data.activityInstanceName != "Tarefa de Despacho"); + + + this.deplomasStore.resetDiplomasReview(diplomasValidar.map((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(); + + return this.customTaskPipe.transform(element) + })) + + + let diplomasAssinar: any = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma"); + diplomasAssinar = diplomasAssinar.map((element) => this.expedienteTaskPipe.transform(element)) + this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar) + + let diplomasAssinados: any = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado"); + diplomasAssinados = diplomasAssinados.map((element) => this.expedienteTaskPipe.transform(element)) + this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados) + } catch (error) {} + + this.showLoaderNum-- + } + } diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.html b/src/app/shared/event/attendee-modal/attendee-modal.page.html index fc05547bf..d8e0fff25 100644 --- a/src/app/shared/event/attendee-modal/attendee-modal.page.html +++ b/src/app/shared/event/attendee-modal/attendee-modal.page.html @@ -1,6 +1,6 @@ - Adicionar intervenientes + Pesquisar contactos @@ -87,7 +87,7 @@ diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index 91211de48..4e1a59bee 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -184,8 +184,9 @@ export class NewPublicationPage implements OnInit { const loader = this.toastService.loading() try { - await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() + const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErroHandle.httpsSucessMessagge('Criar publicação') + console.log({response}) this.goBack(); } catch (error) { @@ -212,9 +213,10 @@ export class NewPublicationPage implements OnInit { try { - await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() + const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErroHandle.httpsSucessMessagge('Criar publicação') + console.log({response}) this.goBack(); } catch (error) { @@ -241,9 +243,10 @@ export class NewPublicationPage implements OnInit { const loader = this.toastService.loading() try { - await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() + const response =await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() this.httpErroHandle.httpsSucessMessagge('Criar publicação') + console.log({response}) this.goBack(); } catch (error) { this.httpErroHandle.httpStatusHandle(error) @@ -254,7 +257,9 @@ export class NewPublicationPage implements OnInit { } - this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId) + this.PublicationFolderService.deletePost(this.publication.DocumentId, this.publication.ProcessId) + + } else { diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index 5c32d81ea..c2b7d8b41 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -144,6 +144,15 @@ export class ViewPublicationsPage implements OnInit { for( let publicationId of loadLater) { await this.loadPublication(publicationId, folderId) } + + + for(let localPublication of this.publicationFolderService.publicationList[folderId]) { + + const apiPublication = publicationIds.includes(localPublication.DocumentId) + if(!apiPublication) { + this.publicationFolderService.deletePost(folderId, localPublication.DocumentId) + } + } this.showLoader = false; diff --git a/src/app/store/eventoaprovacao-store.service.ts b/src/app/store/eventoaprovacao-store.service.ts index d4d2ef805..c60c06de6 100644 --- a/src/app/store/eventoaprovacao-store.service.ts +++ b/src/app/store/eventoaprovacao-store.service.ts @@ -89,7 +89,7 @@ export class EventoaprovacaoStoreService { } - + value = value.filter(e => e.activityInstanceName != 'Comunicar Evento') value = value.map( e => this.EventoApprovePipe.transform(e, e)) this._list[segment] = value diff --git a/src/global.scss b/src/global.scss index 996b141a9..63f748142 100644 --- a/src/global.scss +++ b/src/global.scss @@ -1648,4 +1648,5 @@ h5, .buttons{ .ngx-mat-timepicker input { user-select: none !important; + color: black !important; } \ No newline at end of file diff --git a/version/git-version.ts b/version/git-version.ts index f3076a18c..705272442 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "68c849d0e", - "SHA": "68c849d0ee02f2a0c171db7d67c953e919c90167", + "shortSHA": "dd1ba46b0", + "SHA": "dd1ba46b0d1ee7bf71b440bc76657ab208659ba4", "branch": "developer-prod", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Mon Aug 21 12:22:19 2023 +0100'", + "lastCommitTime": "'Mon Aug 21 12:27:17 2023 +0100'", "lastCommitMessage": "replicate contact function", - "lastCommitNumber": "5177", + "lastCommitNumber": "5187", "change": "", - "changeStatus": "On branch developer-prod\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: android/app/src/main/AndroidManifest.xml\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.html\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/pages/events/events.page.html\n\tmodified: src/app/pages/publications/publications.page.html\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/header/header.page.scss\n\tmodified: src/app/tiny-mce/tiny-mce.page.html\n\tnew file: src/assets/images/md.webp\n\tnew file: src/assets/images/ministro.png\n\tnew file: src/assets/images/presidente.png\n\tnew file: src/assets/images/secretaria_geral.png\n\tnew file: src/assets/images/sg.jpeg\n\tmodified: version/git-version.ts", + "changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.html\n\tmodified: src/app/pages/events/attendees/attendees.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.ts\n\tmodified: src/app/services/events/attendees/attendees.page.html\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/event/attendee-modal/attendee-modal.page.html\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts\n\tmodified: src/app/store/eventoaprovacao-store.service.ts\n\tmodified: src/global.scss", "changeAuthor": "peter.maquiran" } \ No newline at end of file