mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
All changes i made
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
@@ -211,9 +211,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
let containerHeight = windowHeight - e.srcElement.clientHeight;
|
||||
|
||||
if (scroll > this.currentPosition) {
|
||||
//alert('BOTTOM');
|
||||
} else {
|
||||
//alert('UP');
|
||||
this.scrollingOnce = false;
|
||||
}
|
||||
if ((containerHeight - 100) > scroll) {
|
||||
|
||||
@@ -242,9 +242,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
let containerHeight = windowHeight - e.srcElement.clientHeight;
|
||||
|
||||
if (scroll > this.currentPosition) {
|
||||
//alert('BOTTOM');
|
||||
} else {
|
||||
//alert('UP');
|
||||
this.scrollingOnce = false;
|
||||
}
|
||||
if ((containerHeight - 100) > scroll) {
|
||||
|
||||
@@ -83,7 +83,7 @@ export class AllProcessesPage implements OnInit {
|
||||
|
||||
updateAllProcess = () => {
|
||||
this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento)
|
||||
.concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list)
|
||||
.concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.contactList).concat(this.despachoStore.list)
|
||||
.concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class">
|
||||
<ion-input placeholder="Localização*" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input>
|
||||
<ion-input placeholder="Localização" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Error messages -->
|
||||
@@ -324,6 +324,6 @@
|
||||
<ion-footer class="background-whit">
|
||||
<div class="buttons">
|
||||
<button class="btn-cancel cursor-pointer" shape="round" (click)="close()">Cancelar</button>
|
||||
<button class="btn-ok cursor-pointer" shape="round" (click)="save()">Enviar</button>
|
||||
<button class="btn-ok cursor-pointer" shape="round" (click)="save()">Gravar</button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Event, EventToApproveEdit } from '../../../models/event.model';
|
||||
import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -117,7 +118,8 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
private processes:ProcessesService,
|
||||
private toastService: ToastService,
|
||||
private router:Router,
|
||||
public ThemeService: ThemeService
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHalde: HttpErrorHandle
|
||||
) {
|
||||
// Edit event to approve
|
||||
this.serialNumber = this.navParams.get('serialNumber');
|
||||
@@ -153,7 +155,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
this.getAttachments()
|
||||
|
||||
} catch (error) {
|
||||
|
||||
this.httpErroHalde.httpStatusHandle(error)
|
||||
}
|
||||
|
||||
|
||||
@@ -310,14 +312,9 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
|
||||
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
|
||||
this.toastService._successMessage('Evento editado');
|
||||
this.httpErroHalde.httpsSucessMessagge('Editar evento')
|
||||
}, error =>{
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest('Evento não editado');
|
||||
}
|
||||
this.httpErroHalde.httpStatusHandle(error)
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
<!-- <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 == 'Presidente da República'"> Agenda do PR {{ i.OwnerUserIds }}</div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname }} </div>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
@@ -27,20 +28,20 @@
|
||||
<ion-refresher-content>
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<div class="main-content overflow-y-auto height-100" [ngSwitch]="segment" *ngIf="eventaprovacaostore.listpr">
|
||||
<div class="main-content overflow-y-auto height-100" >
|
||||
|
||||
<div *ngSwitchCase="'MDGPR'" class="height-100">
|
||||
<div class="height-100">
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listmd">
|
||||
<div >
|
||||
|
||||
<ion-list class="width-100" *ngIf="eventaprovacaostore.listmd.length != 0" >
|
||||
<ion-list class="width-100" >
|
||||
<div
|
||||
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor="let event of eventaprovacaostore.listmd"
|
||||
*ngFor="let event of eventoaprovacaostore.get(segment)"
|
||||
(click)="goToEventDetail(event)"
|
||||
>
|
||||
<!-- (click)="openApproveModal(event)" -->
|
||||
<div class="event-mdgpr-{{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>
|
||||
@@ -55,10 +56,10 @@
|
||||
</ion-list>
|
||||
</div>
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listmd" class="centered-div">
|
||||
<div *ngIf="eventoaprovacaostore.get(segment)" class="centered-div">
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listmd.length == 0">
|
||||
<div *ngSwitchCase="'MDGPR'">
|
||||
<div *ngIf="eventoaprovacaostore.get(segment).length == 0">
|
||||
<div >
|
||||
<div class="d-flex height-90 align-center justify-content-center"
|
||||
>
|
||||
Lista vazia
|
||||
@@ -67,41 +68,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngSwitchCase="'PR'">
|
||||
<div *ngIf="eventaprovacaostore.listpr.length != 0">
|
||||
<ion-list class="width-100" *ngSwitchCase="'PR'">
|
||||
<div class="width-100" *ngIf="eventaprovacaostore.listpr">
|
||||
<div
|
||||
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor="let event of eventaprovacaostore.listpr"
|
||||
(click)="goToEventDetail(event)"
|
||||
>
|
||||
<div class="item 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ion-list>
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="eventaprovacaostore.listpr.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
|
||||
<div *ngSwitchCase="'PR'" >
|
||||
<div class="d-flex align-center justify-content-center"
|
||||
*ngIf="eventaprovacaostore.listpr.length < 1">
|
||||
Lista vazia
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
|
||||
@@ -27,10 +27,13 @@ export class EventsToApprovePage implements OnInit {
|
||||
eventBody: EventBody;
|
||||
categories: string[];
|
||||
serialnumber:string;
|
||||
loggeduser: LoginUserRespose;
|
||||
segment:string;
|
||||
eventaprovacaostore = EventoAprovacaoStore;
|
||||
|
||||
eventsList: any = []
|
||||
color: 'pr' | 'mdgpr'
|
||||
eventoaprovacaostore = EventoAprovacaoStore;
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private modalController: ModalController,
|
||||
@@ -40,12 +43,17 @@ export class EventsToApprovePage implements OnInit {
|
||||
private storage: Storage,
|
||||
public eventService: EventsService,
|
||||
)
|
||||
{
|
||||
this.loggeduser = SessionStore.user;
|
||||
}
|
||||
{}
|
||||
|
||||
ngOnInit() {
|
||||
this.segment = this.loggeduser.Profile;
|
||||
if(!this.segment) {
|
||||
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
|
||||
this.segment = 'Meu calendario';
|
||||
} else {
|
||||
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
|
||||
}
|
||||
}
|
||||
|
||||
this.LoadToApproveEvents();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
@@ -68,37 +76,50 @@ export class EventsToApprovePage implements OnInit {
|
||||
|
||||
async LoadToApproveEvents() {
|
||||
this.showLoader = true;
|
||||
|
||||
this.getFromDB();
|
||||
if(this.segment != 'PR') {
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial
|
||||
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
|
||||
this.eventsMDGPRList = ( this.eventsMDGPRList || []).filter(function(item) {
|
||||
const segment = this.segment
|
||||
|
||||
if(this.segment == 'Meu calendario') {
|
||||
// color
|
||||
if(SessionStore.user.Profile == 'PR') {
|
||||
this.color = 'pr'
|
||||
} else {
|
||||
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.eventsList = this.eventsList.filter(function(item) {
|
||||
return item.activityInstanceName != 'Editar Evento'
|
||||
}) || []
|
||||
|
||||
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
|
||||
|
||||
})
|
||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||
} else {
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
|
||||
}
|
||||
else if(this.segment == 'PR') {
|
||||
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
|
||||
// console.log(prEventsOficial)
|
||||
// console.log(prEventsPessoal)
|
||||
this.eventsPRList = prEventsOficial
|
||||
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
|
||||
this.eventsPRList = (this.eventsPRList || []).filter(function(item) {
|
||||
|
||||
this.color = 'pr'
|
||||
|
||||
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
|
||||
try {
|
||||
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
|
||||
} catch(error) {
|
||||
this.eventsList = []
|
||||
}
|
||||
|
||||
this.eventsList = this.eventsList.filter(function(item) {
|
||||
return item.activityInstanceName != 'Editar Evento'
|
||||
})
|
||||
|
||||
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
|
||||
|
||||
})
|
||||
this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
|
||||
}) || []
|
||||
|
||||
this.eventsList = this.eventsList
|
||||
this.eventsList = this.eventsList
|
||||
this.showLoader = false;
|
||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { customTask, fullTask } from 'src/app/models/dailyworktask.model';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos-options',
|
||||
@@ -32,6 +33,7 @@ export class DespachosOptionsPage implements OnInit {
|
||||
public p: PermissionService,
|
||||
public ThemeService: ThemeService,
|
||||
private RouteService: RouteService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
) {
|
||||
this.task = this.navParams.get('task')
|
||||
this.fulltask = this.navParams.get('fulltask')
|
||||
@@ -74,18 +76,13 @@ export class DespachosOptionsPage implements OnInit {
|
||||
const loader = this.toastService.loading()
|
||||
this.popoverController.dismiss();
|
||||
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
|
||||
this.toastService._successMessage()
|
||||
this.httpErrorHandle.httpsSucessMessagge('Enviar para Pendentes')
|
||||
loader.remove()
|
||||
|
||||
this.close();
|
||||
},(error)=>{
|
||||
loader.remove()
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest('Processo não encontrado')
|
||||
}
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-textarea-class flex-grow-1">
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea>
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção*"></ion-textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as moment from 'moment';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-action',
|
||||
@@ -40,6 +41,7 @@ export class EditActionPage implements OnInit {
|
||||
constructor(
|
||||
private publicationsService: PublicationsService,
|
||||
private toastService: ToastService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
) {
|
||||
this.folder = new PublicationFolder();
|
||||
}
|
||||
@@ -107,15 +109,11 @@ export class EditActionPage implements OnInit {
|
||||
await this.publicationsService.UpdatePresidentialAction(body).toPromise()
|
||||
this.close();
|
||||
this.updateDesktopComponent.emit();
|
||||
this.toastService._successMessage('Acção presidencial atualizada')
|
||||
this.httpErrorHandle.httpsSucessMessagge('Editar Acção')
|
||||
this.getActions.emit()
|
||||
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest('Não foi possivel atualizar a acção presidencial')
|
||||
}
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-textarea-class flex-grow-1" [class.input-error]="Form?.get('Detail')?.invalid && validateFrom ">
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea>
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção*"></ion-textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as moment from 'moment';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -36,7 +37,8 @@ export class NewActionPage implements OnInit {
|
||||
|
||||
constructor(
|
||||
private publication: PublicationsService,
|
||||
private toastService: ToastService
|
||||
private toastService: ToastService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
) {
|
||||
this.folder = new PublicationFolder();
|
||||
|
||||
@@ -121,16 +123,11 @@ export class NewActionPage implements OnInit {
|
||||
try {
|
||||
await this.publication.CreatePublicationFolder(this.folder).toPromise()
|
||||
this.close();
|
||||
this.toastService._successMessage('Acção presidencial criada')
|
||||
this.httpErrorHandle.httpsSucessMessagge('Acção criada')
|
||||
|
||||
this.getActions.emit()
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest('Não foi possivel criar a acção presidencial')
|
||||
}
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-textarea-class flex-grow-1" [class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Message" name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto..."></ion-textarea>
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Message" name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { Camera, CameraResultType, CameraSource} from '@capacitor/camera';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
@Component({
|
||||
selector: 'app-new-publication',
|
||||
templateUrl: './new-publication.page.html',
|
||||
@@ -48,7 +49,8 @@ export class NewPublicationPage implements OnInit {
|
||||
public photoService: PhotoService,
|
||||
private publications: PublicationsService,
|
||||
private toastService: ToastService,
|
||||
public ThemeService: ThemeService
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHandle: HttpErrorHandle
|
||||
) {
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
}
|
||||
@@ -115,11 +117,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.pub.Title, [
|
||||
// Validators.required,
|
||||
Validators.required,
|
||||
// Validators.minLength(4)
|
||||
]),
|
||||
Message: new FormControl(this.pub.Message, [
|
||||
// Validators.required
|
||||
Validators.required,
|
||||
Validators.maxLength(1000)
|
||||
])
|
||||
})
|
||||
@@ -131,7 +133,11 @@ export class NewPublicationPage implements OnInit {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if(this.Form.invalid) return false
|
||||
if(this.Form.invalid) {
|
||||
return false
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if(this.publicationType == '3') {
|
||||
|
||||
@@ -155,15 +161,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -188,15 +190,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -220,15 +218,11 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
@@ -255,15 +249,11 @@ export class NewPublicationPage implements OnInit {
|
||||
try {
|
||||
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise()
|
||||
this.toastService._successMessage()
|
||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
if(error.status == 0) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
this.toastService._badRequest()
|
||||
}
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user