All changes i made

This commit is contained in:
Eudes Inácio
2023-02-27 09:34:36 +01:00
77 changed files with 8025 additions and 6717 deletions
@@ -38,7 +38,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div>
<div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input>
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input>
</div>
</div>
@@ -34,7 +34,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input>
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="postEvent.Location"></ion-input>
</div>
</div>
<!-- Error messages -->
@@ -321,7 +321,7 @@
<ion-title></ion-title>
<ion-buttons slot="end">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>Enviar</ion-label>
<ion-label>Gravar</ion-label>
</button>
</ion-buttons>
</ion-toolbar>
@@ -14,6 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ParticipantsPipe } from 'src/app/pipes/participants.pipe';
import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({
selector: 'app-edit-event',
@@ -92,7 +93,8 @@ export class EditEventPage implements OnInit {
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private toastService: ToastService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) {}
ngOnInit() {
@@ -332,7 +334,7 @@ export class EditEventPage implements OnInit {
} catch (e) {}
}
this.showLoader = false;
this.toastService.successMessage()
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
} else {
await this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).toPromise()
if(this.initCalendarName != this.postEvent.CalendarName) {
@@ -346,13 +348,13 @@ export class EditEventPage implements OnInit {
} catch (e) {}
}
this.showLoader = false;
this.toastService.successMessage()
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
}
} catch(error) {
this.showLoader = false
this.toastService.badRequest()
this.httpErrorHandle.httpStatusHandle(error)
}
this.clearPostEvent.emit();
@@ -10,10 +10,7 @@
</div>
<ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<!-- <ion-segment-button value="MDGPR">
Minha agenda
</ion-segment-button> -->
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : 'PR'">
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId ">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
@@ -30,39 +27,17 @@
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content overflow-y-auto height-100" [ngSwitch]="segment" *ngIf="eventsMDGPRList">
<div class="main-content overflow-y-auto height-100" >
<!-- <div class="header-content width-100"> -->
<!-- </div> -->
<ion-list class="width-100" *ngSwitchCase="'MDGPR'" >
<div
class="item item-hover ion-no-padding width-100 cursor-pointer"
*ngFor="let event of eventsMDGPRList"
(click)="openApproveModal(event.serialNumber, event)"
>
<div class="event-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type"> {{ event.activityInstanceName }} </div>
</div>
</div>
</div>
</div>
</ion-list>
<ion-list class="width-100" *ngSwitchCase="'PR'">
<div class="width-100" *ngIf="eventsPRList">
<ion-list class="width-100">
<div class="width-100" >
<div
class="item ion-no-padding width-100 cursor-pointer"
*ngFor="let event of eventsPRList"
*ngFor="let event of eventoaprovacaostore.get(segment)"
(click)="openApproveModal(event.serialNumber, event)"
>
<div class="event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="event-{{color}}-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
@@ -78,30 +53,9 @@
</div>
</div>
</div>
</ion-list>
<ion-list class="width-100" *ngSwitchCase="'Unknown'">
<div class="width-100" *ngIf="eventsGenericList">
<div
class="item ion-no-padding width-100 cursor-pointer"
*ngFor="let event of eventsGenericList"
(click)="openApproveModal(event.serialNumber, event)"
>
<div class="event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type"> {{ event.activityInstanceName }} </div>
</div>
</div>
</div>
</div>
</div>
</ion-list>
</div>
</ion-content>
@@ -7,6 +7,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { SortService } from 'src/app/services/functions/sort.service';
import { SessionStore } from 'src/app/store/session.service';
import { EventsService } from 'src/app/services/events.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
@Component({
selector: 'app-event-list',
@@ -17,15 +18,16 @@ export class EventListPage implements OnInit {
// [desktop] event list to approve
showLoader: boolean;
eventsPRList: any = []
eventsMDGPRList: any = []
eventsGenericList: any = []
eventsList: any = []
eventPerson: EventPerson;
eventBody: EventBody;
categories: string[];
serialnumber:string;
loggeduser: LoginUserRespose;
segment:string;
eventoaprovacaostore = EventoAprovacaoStore;
color: 'pr' | 'mdgpr'
@Input() profile:string;
@Input() showComponent:string;
@@ -44,11 +46,13 @@ export class EventListPage implements OnInit {
ngOnInit() {
this.segment = this.loggeduser.Profile;
if(this.segment != "PR" && this.segment != "MDGPR") {
this.segment = "Unknown";
if(!this.segment) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
}
const pathname = window.location.pathname
this.router.events.forEach((event) => {
@@ -75,83 +79,54 @@ export class EventListPage implements OnInit {
async LoadToApproveEvents() {
this.showLoader = true;
try {
if(this.segment == 'MDGPR') {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
let allEvents = mdEventsOficial.concat(mdEventsPessoal);
if(allEvents.length > 0) {
this.eventsMDGPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
}
else if(this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
let allEvents = prEventsOficial
if(allEvents.length > 0) {
this.eventsPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
const segment = this.segment
if(this.segment == 'Meu calendario') {
// color
if(SessionStore.user.Profile == 'PR') {
this.color = 'pr'
} else {
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
if(genericEvents.length > 0) {
this.eventsGenericList = this.sortService.sortArrayByDate(genericEvents).reverse();
}
this.showLoader = false;
this.color = 'mdgpr'
}
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
this.eventsList = [];
}
this.eventoaprovacaostore.save(segment, this.eventsList)
} else {
this.color = 'pr'
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
this.eventsList = []
}
} catch(erro) {
this.showLoader = false;
this.eventsList = this.eventsList
this.eventsList = this.eventsList
this.eventoaprovacaostore.save(segment, this.eventsList)
}
this.showLoader = false;
}
async LoadToApproveEventsNoLoader() {
try {
if(this.segment == 'MDGPR') {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
let allEvents = mdEventsOficial
if(allEvents.length > 0) {
this.eventsMDGPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
}
else if(this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
let allEvents = prEventsOficial
if(allEvents.length > 0) {
this.eventsPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
} else {
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
if(genericEvents.length > 0) {
this.eventsGenericList = this.sortService.sortArrayByDate(genericEvents).reverse();
}
this.showLoader = false;
}
} catch(erro) {
this.showLoader = false;
}
this.LoadToApproveEvents()
}
async openApproveModal(eventSerialNumber, data) {
let a = this.eventsMDGPRList.filter((elem) => {
//
return eventSerialNumber == elem.serialNumber
});
this.approveEventDismiss.emit({
"serialNumber": eventSerialNumber,
"action": "Aprovar",
@@ -66,7 +66,7 @@
</div>
<div class="ion-input-class flex-grow-1 width-100" [class.input-error]="Form?.get('Location')?.invalid && validateFrom " >
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" type="text" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input>
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" type="text" placeholder="Localização" [(ngModel)]="postEvent.Location"></ion-input>
</div>
</div>
@@ -341,7 +341,7 @@
<ion-title></ion-title>
<ion-buttons slot="end">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>Enviar</ion-label>
<ion-label>Gravar</ion-label>
</button>
</ion-buttons>
</ion-toolbar>
@@ -27,6 +27,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
import { ServerConnectionService } from 'src/app/services/server-connection.service';
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -130,8 +131,9 @@ export class NewEventPage implements OnInit {
private dateAdapter: DateAdapter<any>,
public ThemeService: ThemeService,
private chatMethodService: ChatMethodsService,
private ServerConnectionService: ServerConnectionService
private ServerConnectionService: ServerConnectionService,
// private translate: TranslateService
private hhtpErrorHandle: HttpErrorHandle
) {
this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user;
@@ -521,7 +523,7 @@ export class NewEventPage implements OnInit {
if(DocumentToSave.length == 0) {
this.afterSave();
}
this.toastService._successMessage('Evento criado');
this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
@@ -540,12 +542,7 @@ export class NewEventPage implements OnInit {
console.log(error, 'error')
loader.remove()
this.showLoader = false
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não criado')
}
this.hhtpErrorHandle.httpStatusHandle(error)
});
}
@@ -585,7 +582,7 @@ export class NewEventPage implements OnInit {
if(DocumentToSave.length == 0){
this.afterSave();
}
this.toastService._successMessage('Evento criado');
this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
@@ -597,17 +594,11 @@ export class NewEventPage implements OnInit {
if(this.roomId) {
this.chatMethodService.sendMessage(this.roomId,data);
}
this.toastService._successMessage('Evento criado')
},(error) => {
//const connectionToServer = this.ServerConnectionService.BaseAPI()
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não criado')
}
this.hhtpErrorHandle.httpStatusHandle(error)
loader.remove()
this.showLoader = false
@@ -651,7 +642,7 @@ export class NewEventPage implements OnInit {
this.afterSave();
}
this.toastService._successMessage('Evento criado');
this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
@@ -663,16 +654,11 @@ export class NewEventPage implements OnInit {
if(this.roomId) {
this.chatMethodService.sendMessage(this.roomId,data);
}
this.toastService._successMessage('Evento criado')
},(error)=>{
loader.remove()
this.showLoader = false
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não criado')
}
this.hhtpErrorHandle.httpStatusHandle(error)
});
}
@@ -14,6 +14,7 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service';
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
@Component({
@@ -58,6 +59,7 @@ export class ViewEventPage implements OnInit {
public popoverController: PopoverController,
private toastService: ToastService,
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) {
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -115,11 +117,7 @@ export class ViewEventPage implements OnInit {
type: 'close'
})
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
this.httpErrorHandle.httpStatusHandle(error)
});
} else {
@@ -141,11 +139,7 @@ export class ViewEventPage implements OnInit {
type: 'close'
})
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
this.httpErrorHandle.httpStatusHandle(error)
});
}
}
@@ -182,9 +176,11 @@ export class ViewEventPage implements OnInit {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService._successMessage('Evento eliminado');
this.httpErrorHandle.httpsSucessMessagge('delete event')
this.close();
},()=>{},
},(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{
loader.remove();
});
@@ -192,9 +188,11 @@ export class ViewEventPage implements OnInit {
if(this.CalendarId) {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.CalendarId).subscribe(async () => {
this.toastService._successMessage('Evento eliminado');
this.httpErrorHandle.httpsSucessMessagge('delete event');
this.close();
},()=>{},
},(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{
loader.remove();
});
@@ -208,17 +206,21 @@ export class ViewEventPage implements OnInit {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService._successMessage('Evento eliminado');
this.httpErrorHandle.httpsSucessMessagge('delete event');
this.close();
},()=>{},
},(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{
loader.remove();
});
} else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.CalendarId).subscribe(async () => {
this.toastService._successMessage('Evento eliminado');
this.httpErrorHandle.httpsSucessMessagge('delete event');
this.close();
},()=>{},
},(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{
loader.remove();
});