mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
teste mobile done!
This commit is contained in:
@@ -389,11 +389,11 @@
|
||||
</div>
|
||||
|
||||
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
|
||||
<ion-list class="width-100 list" *ngIf="!document.remove">
|
||||
<ion-list class="width-100 list">
|
||||
<ion-item class="width-100 ion-no-border ion-no-padding">
|
||||
<ion-label class="width-100">
|
||||
<p class="p-item-title d-flex ion-justify-content-between">
|
||||
<span class="attach-title-item">{{document.SourceName}}</span>
|
||||
<span class="attach-title-item">{{document.subject || document.SourceName || document.sourceName}}</span>
|
||||
<span class="close-button text-black" (click)="deleteAttachment(document.Id, i)" >
|
||||
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
|
||||
</span>
|
||||
@@ -435,7 +435,7 @@
|
||||
<ion-footer class="ion-no-border">
|
||||
<ion-toolbar class="footer-toolbar px-20">
|
||||
<ion-buttons slot="start">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
|
||||
<ion-label>Gravar</ion-label>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -89,6 +90,8 @@ export class EditEventPage implements OnInit {
|
||||
sesseionStora = SessionStore
|
||||
environment = environment
|
||||
allDayCheck: boolean = false;
|
||||
deletedAttachmentsList = [];
|
||||
addedAttachmentsList = [];
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
@@ -101,7 +104,8 @@ export class EditEventPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private contactsService: ContactsService,
|
||||
private domSanitazerService: DomSanitizerService
|
||||
private domSanitazerService: DomSanitizerService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
|
||||
/* this.postEvent = new Event(); */
|
||||
@@ -123,6 +127,8 @@ export class EditEventPage implements OnInit {
|
||||
this.postEvent.Attendees[index].UserType = userData.UserType
|
||||
}
|
||||
|
||||
console.log('jhv',this.postEvent.Category)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -155,15 +161,15 @@ export class EditEventPage implements OnInit {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
|
||||
this.loadedEventAttachments = this.postEvent?.Attachments
|
||||
|
||||
this.CalendarNameOwnerName = this.eventsService.detectCalendarNameByCalendarId(this.postEvent.CalendarId)
|
||||
this.changeAgenda()
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log(this.postEvent?.Attachments)
|
||||
console.log(this.loadedEventAttachments)
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
if (window.innerWidth >= 1024) {
|
||||
@@ -202,7 +208,7 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
|
||||
cancel() {
|
||||
this.modalController.dismiss({action:'cancel'});
|
||||
this.modalController.dismiss({ action: 'cancel' });
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@@ -358,6 +364,59 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async save_v2() {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if (this.Form.invalid) {
|
||||
return false
|
||||
}
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
try {
|
||||
|
||||
this.agendaDataRepository.updateEvent(this.postEvent.EventId, this.postEvent).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('edit event error: ', error)
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.postEvent.EventId, this.postEvent.Attendees).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
|
||||
|
||||
await this.saveDocument()
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.postEvent.EventId, this.loadedEventAttachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.removeEventAttachment(this.postEvent.EventId, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
this.isEventEdited = true;
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
|
||||
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
console.log('edit: ', error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
async save() {
|
||||
|
||||
@@ -403,7 +462,7 @@ export class EditEventPage implements OnInit {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
} else {
|
||||
console.log('edid calendar id',this.postEvent.CalendarId);
|
||||
console.log('edid calendar id', this.postEvent.CalendarId);
|
||||
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
|
||||
|
||||
if (window['reloadCalendar']) {
|
||||
@@ -568,12 +627,13 @@ export class EditEventPage implements OnInit {
|
||||
deleteAttachment(attachmentID: string, index) {
|
||||
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
this.deletedAttachmentsList.push(id)
|
||||
|
||||
if (id == 'add') {
|
||||
/* if (id == 'add') {
|
||||
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
|
||||
} else {
|
||||
this.loadedEventAttachments[index]['remove'] = true
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
}
|
||||
@@ -585,6 +645,7 @@ export class EditEventPage implements OnInit {
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
showSearchInput: true,
|
||||
eventAgenda: true,
|
||||
select: true,
|
||||
}
|
||||
});
|
||||
@@ -593,7 +654,7 @@ export class EditEventPage implements OnInit {
|
||||
if (res) {
|
||||
const data = res.data;
|
||||
|
||||
const ApplicationIdDocumentToSave: any = {
|
||||
/* const ApplicationIdDocumentToSave: any = {
|
||||
SourceName: data.selected.Assunto,
|
||||
ParentId: this.postEvent.EventId,
|
||||
SourceId: data.selected.Id,
|
||||
@@ -606,11 +667,11 @@ export class EditEventPage implements OnInit {
|
||||
Source: '1',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
|
||||
this.postEvent.Attachments = this.loadedEventAttachments;
|
||||
this.loadedEventAttachments.push(data.selected)
|
||||
this.addedAttachmentsList.push(data.selected)
|
||||
|
||||
}
|
||||
})
|
||||
@@ -642,52 +703,52 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
onCheckboxChange(event: any) {
|
||||
console.log(this.postEvent.CalendarId)
|
||||
if (this.allDayCheck) {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
|
||||
onCheckboxChange(event: any) {
|
||||
console.log(this.postEvent.CalendarId)
|
||||
if (this.allDayCheck) {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
|
||||
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
return date
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ 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';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -16,28 +17,29 @@ import { TaskService } from 'src/app/services/task.service'
|
||||
styleUrls: ['./event-actions-popover.page.scss'],
|
||||
})
|
||||
export class EventActionsPopoverPage implements OnInit {
|
||||
serialNumber:string;
|
||||
serialNumber: string;
|
||||
instanceId: string;
|
||||
activityInstanceName: string
|
||||
|
||||
constructor(
|
||||
private navParams: NavParams,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private popoverController: PopoverController,
|
||||
private toastService: ToastService,
|
||||
private RouteService: RouteService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
public ThemeService: ThemeService,
|
||||
public TaskService: TaskService) {
|
||||
this.serialNumber = this.navParams.get('serialNumber');
|
||||
this.instanceId = this.navParams.get('InstanceId');
|
||||
this.activityInstanceName = this.navParams.get('InstanceId');
|
||||
public TaskService: TaskService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService) {
|
||||
this.serialNumber = this.navParams.get('serialNumber');
|
||||
this.instanceId = this.navParams.get('InstanceId');
|
||||
this.activityInstanceName = this.navParams.get('InstanceId');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
window.onresize = (event) => {
|
||||
if( window.innerWidth >= 800){
|
||||
if (window.innerWidth >= 800) {
|
||||
this.popoverController.dismiss();
|
||||
}
|
||||
};
|
||||
@@ -55,14 +57,21 @@ export class EventActionsPopoverPage implements OnInit {
|
||||
|
||||
async approveTask() {
|
||||
let body = { "serialNumber": this.serialNumber, "action": "Aprovar" }
|
||||
|
||||
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
|
||||
this.goBack();
|
||||
/* await this.processes.PostTaskAction(body).toPromise() */
|
||||
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Approved').subscribe((value) => {
|
||||
console.log(value)
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
|
||||
this.goBack();
|
||||
}, ((error) => {
|
||||
console.log('aprove event error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}))
|
||||
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}
|
||||
@@ -74,8 +83,8 @@ export class EventActionsPopoverPage implements OnInit {
|
||||
|
||||
async ReenviarTask() {
|
||||
let body = { "serialNumber": this.serialNumber, "action": "Reenviar" }
|
||||
|
||||
|
||||
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
@@ -93,10 +102,10 @@ export class EventActionsPopoverPage implements OnInit {
|
||||
|
||||
async emendarTask() {
|
||||
this.closePopover();
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EmendMessageModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'emend-message-modal',
|
||||
backdropDismiss: false
|
||||
@@ -104,36 +113,42 @@ export class EventActionsPopoverPage implements OnInit {
|
||||
|
||||
|
||||
modal.onDidDismiss()
|
||||
.then( async (res) => {
|
||||
|
||||
|
||||
if(res.data.option == 'save') {
|
||||
let body = { "serialNumber": this.serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
.then(async (res) => {
|
||||
|
||||
|
||||
if (res.data.option == 'save') {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
"ReviewUserComment": res.data,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rever')
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.goBack();
|
||||
|
||||
try {
|
||||
/* await this.processes.PostTaskAction(body).toPromise(); */
|
||||
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Revision').subscribe((value) => {
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rever')
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.goBack();
|
||||
}, ((error) => {
|
||||
console.log('send event to revision error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}));
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}
|
||||
finally {
|
||||
loader.remove()
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
|
||||
@@ -143,11 +158,16 @@ export class EventActionsPopoverPage implements OnInit {
|
||||
let body = { "serialNumber": this.serialNumber, "action": "Descartar" }
|
||||
|
||||
const loader = this.toastService.loading();
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
|
||||
this.goBack();
|
||||
try {
|
||||
/* await this.processes.PostTaskAction(body).toPromise(); */
|
||||
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Declined').subscribe((value) => {
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
|
||||
this.goBack();
|
||||
}, ((error) => {
|
||||
console.log('reject event error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}))
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}
|
||||
@@ -171,10 +191,10 @@ export class EventActionsPopoverPage implements OnInit {
|
||||
});
|
||||
|
||||
|
||||
modal.onDidDismiss().then(res => {});
|
||||
modal.onDidDismiss().then(res => { });
|
||||
await modal.present();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
|
||||
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
||||
<p class="flex-grow-1" >
|
||||
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span>
|
||||
<span class="attach-title-item d-block">{{attach.SourceName || attach.subject || attach.sourceName || 'Sem título'}}</span>
|
||||
|
||||
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
||||
</p>
|
||||
|
||||
@@ -16,7 +16,7 @@ import { StorageService } from 'src/app/services/storage.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorHandle} from 'src/app/services/http-error-handle.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { DateService } from 'src/app/services/date.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
@@ -155,7 +155,7 @@ export class ViewEventPage implements OnInit {
|
||||
// });
|
||||
// }
|
||||
|
||||
openOptions() {}
|
||||
openOptions() { }
|
||||
close() {
|
||||
|
||||
this.modalController.dismiss(this.isEventEdited);
|
||||
@@ -194,10 +194,10 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
let res = await this.agendaDataRepository.getEventById(this.eventId)
|
||||
|
||||
if(res.isOk()) {
|
||||
if (res.isOk()) {
|
||||
console.log('Loaded Event', res.value)
|
||||
loader.remove()
|
||||
let changeDate = this.dateService.fixDate(res.value as any) as any
|
||||
let changeDate = this.dateService.fixDate(res.value as any) as any
|
||||
this.loadedEvent = changeDate as any;
|
||||
this.setTimeZone()
|
||||
} else {
|
||||
@@ -210,36 +210,36 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
loadEvent1() {
|
||||
|
||||
|
||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res;
|
||||
this.setTimeZone()
|
||||
// this.addEventToDb(res);
|
||||
}, (error) => {
|
||||
});
|
||||
} else {
|
||||
|
||||
|
||||
if(this.CalendarId) {
|
||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
||||
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res;
|
||||
/* loadEvent1() {
|
||||
|
||||
|
||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res;
|
||||
this.setTimeZone()
|
||||
|
||||
}, (error) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// this.addEventToDb(res);
|
||||
}, (error) => {
|
||||
});
|
||||
} else {
|
||||
|
||||
|
||||
if(this.CalendarId) {
|
||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
||||
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res;
|
||||
this.setTimeZone()
|
||||
|
||||
}, (error) => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
deleteYesOrNo() {
|
||||
this.alertController.create({
|
||||
@@ -268,7 +268,31 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
|
||||
console.log(this.loadedEvent.EventId)
|
||||
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Evento removido',
|
||||
buttons: ['OK']
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
alert.dismiss();
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('delete event')
|
||||
}, (error) => {
|
||||
console.log('delete event error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}, () => {
|
||||
loader.remove();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
@@ -281,7 +305,7 @@ export class ViewEventPage implements OnInit {
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('delete event')
|
||||
}, () => { },
|
||||
}, () => { },
|
||||
() => {
|
||||
loader.remove();
|
||||
});
|
||||
@@ -300,15 +324,15 @@ export class ViewEventPage implements OnInit {
|
||||
}, 1500);
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('delete event')
|
||||
}, (error) => {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
},
|
||||
}, (error) => {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
},
|
||||
() => {
|
||||
loader.remove();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
|
||||
@@ -360,8 +384,8 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
if (res) {
|
||||
setTimeout(() => {
|
||||
/* this.loadEvent(); */
|
||||
this.loadEvent1()
|
||||
this.loadEvent();
|
||||
/* this.loadEvent1() */
|
||||
}, 250);
|
||||
this.isEventEdited = true;
|
||||
console.log('res', res, res.data?.action, 'cancel')
|
||||
@@ -394,13 +418,13 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
if (res.data?.action == 'cancel') {
|
||||
setTimeout(() => {
|
||||
/* this.loadEvent(); */
|
||||
this.loadEvent1()
|
||||
this.loadEvent();
|
||||
/* this.loadEvent1() */
|
||||
|
||||
}, 250);
|
||||
this.isEventEdited = true;
|
||||
|
||||
if(res.data.Attendees?.length >= 1) {
|
||||
if (res.data.Attendees?.length >= 1) {
|
||||
this.loadedEvent.HasAttachments = true
|
||||
this.getAttachments()
|
||||
}
|
||||
@@ -413,7 +437,7 @@ export class ViewEventPage implements OnInit {
|
||||
}, 250);
|
||||
this.isEventEdited = true;
|
||||
|
||||
if(res.data.Attendees?.length >= 1) {
|
||||
if (res.data.Attendees?.length >= 1) {
|
||||
this.loadedEvent.HasAttachments = true
|
||||
this.getAttachments()
|
||||
}
|
||||
@@ -432,11 +456,11 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
|
||||
getAttachments() {
|
||||
if(this.loadedEvent.HasAttachments) {
|
||||
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res=>{
|
||||
if (this.loadedEvent.HasAttachments) {
|
||||
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res => {
|
||||
this.loadedEvent.Attachments = res;
|
||||
|
||||
},((erro) => {
|
||||
}, ((erro) => {
|
||||
console.error('editgetAttchament', erro)
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
*ngFor="let attachment of loadedAttachments"
|
||||
(click)="viewDocument(attachment.DocId, attachment)">
|
||||
<ion-label>
|
||||
<p class="attach-title-item d-block">{{attachment.Description || 'Sem título'}}</p>
|
||||
<p class="attach-title-item d-block">{{attachment.sourceName || attachment.Description || 'Sem título'}}</p>
|
||||
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
@@ -95,15 +95,16 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async getTask () {
|
||||
async getTask() {
|
||||
|
||||
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
|
||||
|
||||
if(res.isOk()) {
|
||||
console.log(res)
|
||||
if (res.isOk()) {
|
||||
this.loadedEvent = res.value;
|
||||
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
|
||||
//
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
this.loadedAttachments = res.value.Attachments
|
||||
} else {
|
||||
console.log(res.error.status)
|
||||
this.httpErrorHandle.httpStatusHandle(res.error)
|
||||
@@ -117,10 +118,18 @@ export class ApproveEventPage implements OnInit {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
|
||||
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Approved').subscribe(async (value) => {
|
||||
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
|
||||
}, ((error) => {
|
||||
console.log('aprove event error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}))
|
||||
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
@@ -147,7 +156,7 @@ export class ApproveEventPage implements OnInit {
|
||||
modal.onDidDismiss()
|
||||
.then(async (res) => {
|
||||
|
||||
if(res.data.option == 'save') {
|
||||
if (res.data.option == 'save') {
|
||||
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
@@ -161,14 +170,17 @@ export class ApproveEventPage implements OnInit {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
.catch(() => {
|
||||
|
||||
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rever')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.goBack();
|
||||
}, ((error) => {
|
||||
console.log('send event to revision error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
this.offlineManager.storeRequestData('event-listRever', body);
|
||||
});
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rever')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.goBack();
|
||||
}));
|
||||
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
@@ -181,7 +193,7 @@ export class ApproveEventPage implements OnInit {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
await modal.present();
|
||||
|
||||
}
|
||||
|
||||
@@ -190,10 +202,15 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.goBack();
|
||||
/* await this.processes.PostTaskAction(body).toPromise(); */
|
||||
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
|
||||
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.goBack();
|
||||
}, ((error) => {
|
||||
console.log('reject event error: ', error)
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}))
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
}
|
||||
@@ -262,7 +279,7 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
|
||||
if(res.data.option == 'save') {
|
||||
if (res.data.option == 'save') {
|
||||
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
@@ -337,7 +354,7 @@ export class ApproveEventPage implements OnInit {
|
||||
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.loadedEvent.workflowInstanceDataFields.InstanceId).toPromise();
|
||||
console.log(this.loadedAttachments)
|
||||
} catch (error) {
|
||||
console.error('getAttchaments',error)
|
||||
console.error('getAttchaments', error)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -173,6 +173,7 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
|
||||
async LoadToApproveEvents() {
|
||||
console.log('aprove event')
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ export class AgendaDataRepositoryService {
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
console.log('Response',response.data)
|
||||
console.log('Output',EventMapper.toDomain(response.data))
|
||||
return EventMapper.toDomain(response.data)
|
||||
})
|
||||
).toPromise()
|
||||
@@ -91,7 +93,7 @@ export class AgendaDataRepositoryService {
|
||||
type: this.utils.calendarTypeSeleted(eventData.Category),
|
||||
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
|
||||
attendees: this.utils.attendeesAdded(eventData.Attendees),
|
||||
attachments: documents,
|
||||
attachments: this.utils.documentAdded(documents),
|
||||
recurrence: {
|
||||
frequency: 0,
|
||||
occurrences: 0,
|
||||
@@ -130,7 +132,7 @@ export class AgendaDataRepositoryService {
|
||||
}
|
||||
|
||||
addEventAttachment(id,attachmentData) {
|
||||
return this.agendaDataService.addEventAttachment(id,attachmentData);
|
||||
return this.agendaDataService.addEventAttachment(id,{ attachments: this.utils.documentAdded(attachmentData) });
|
||||
}
|
||||
|
||||
deleteEvent(eventId) {
|
||||
|
||||
@@ -25,10 +25,10 @@ export class EventMapper {
|
||||
wxUserId: e.wxUserId,
|
||||
EmailAddress: e.emailAddress,
|
||||
Name: e.name,
|
||||
IsRequired: e.attendeeType == '0' ? true : false,
|
||||
IsRequired: e.attendeeType == 'Required',
|
||||
UserType: "GD",
|
||||
// "IsPR": false,
|
||||
Acknowledgment: e.attendeeType == '0' ? true : false,
|
||||
attendeeType: e.attendeeType
|
||||
// "RoleDescription": null,
|
||||
// "RoleId": 0
|
||||
})),
|
||||
|
||||
@@ -72,9 +72,10 @@ export class EventToApproveDetailsMapper {
|
||||
...dto.attendees.map( e => ({
|
||||
Name: e.name,
|
||||
EmailAddress: e.emailAddress,
|
||||
IsRequired: e.attendeeType == '0' ? true : false,
|
||||
IsRequired: e.attendeeType == 'Required',
|
||||
UserType: "GD",
|
||||
wxUserId: e.wxUserId
|
||||
wxUserId: e.wxUserId,
|
||||
attendeeType: e.attendeeType
|
||||
}))
|
||||
],
|
||||
//"EventOrganizer": "{\"$type\":\"GabineteDigital.k2RESTidentifier_EventPerson, GabineteDigital, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\",\"EmailAddress\":\"agenda.mdgpr@gabinetedigital.local\",\"Name\":\"Agenda do Ministro e Director do Gabinete do PR\",\"IsRequired\":true}",
|
||||
@@ -104,6 +105,7 @@ export class EventToApproveDetailsMapper {
|
||||
"Documents": null,
|
||||
"PrivateMessage": null,
|
||||
Attachments: dto.attachments.map( e => ({
|
||||
id: e.id,
|
||||
DocId: e.docId,
|
||||
Description: e.sourceName,
|
||||
Stakeholders: '',
|
||||
|
||||
@@ -7,7 +7,7 @@ export const AttachmentInputDTOSchema = z.object({
|
||||
description: z.string().nullable(),
|
||||
applicationId: z.number().int(),
|
||||
}).strict();
|
||||
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
|
||||
const EAttendeeTypeDTO = z.enum(["Required", "Acknowledgment", "Optional"]);
|
||||
|
||||
|
||||
const CommentSchema = z.object({
|
||||
|
||||
@@ -64,10 +64,10 @@ export class Utils {
|
||||
console.log('added doc create event',documents)
|
||||
return documents.map((e) => {
|
||||
return {
|
||||
docId: parseInt(e.Id),
|
||||
sourceName: e.Assunto,
|
||||
docId: e.docId,
|
||||
sourceName: e.subject || e.sourceNames,
|
||||
description: "",
|
||||
applicationId: parseInt(JSON.stringify(e.ApplicationType))
|
||||
applicationId: e.applicationId
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export class DateService {
|
||||
const month = String(date.getMonth() + 1).padStart(2,'0');
|
||||
const fullYear = date.getFullYear();
|
||||
const formattedDate = `${fullYear}-${month}-${_date} 23:59`;
|
||||
res.EndDate = formattedDate
|
||||
res.EndDate = new Date(formattedDate).toISOString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -129,9 +129,14 @@ export class ApproveEventPage implements OnInit {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
/* await this.processes.PostTaskAction(body).toPromise() */
|
||||
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
|
||||
this.httpErroHandle.httpsSucessMessagge('Rejeitar');
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
}, ((error) => {
|
||||
console.log('reject event error: ', error)
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
}))
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log('here!!!')
|
||||
if (this.restoreTemporaryData()) {
|
||||
this.setOtherData()
|
||||
} else {
|
||||
@@ -384,7 +384,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}));
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.loadedAttachments }).subscribe((value) => {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
@@ -393,13 +393,13 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: [] }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
this.close()
|
||||
|
||||
@@ -578,10 +578,12 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
deleteAttachment(attachment: Attachment, index) {
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
console.log(attachment)
|
||||
this.loadedAttachments[index]['action'] = 'delete'
|
||||
this.deletedAttachmentsList.push(id)
|
||||
if (this.loadedEventAttachments[index].Id) {
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
console.log(attachment)
|
||||
this.loadedAttachments[index]['action'] = 'delete'
|
||||
this.deletedAttachmentsList.push(id)
|
||||
}
|
||||
}
|
||||
|
||||
async getDoc() {
|
||||
|
||||
@@ -374,7 +374,7 @@ export class EditEventPage implements OnInit {
|
||||
await this.saveDocument()
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, { "attachments": this._postEvent.Attachments }).subscribe((value) => {
|
||||
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, this._postEvent.Attachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
|
||||
@@ -288,9 +288,9 @@
|
||||
<div class="d-flex container-div width-100" >
|
||||
<ion-list class="width-100 ">
|
||||
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index">
|
||||
<ion-label class="width-100 d-block list" *ngIf="document.action != 'delete' ">
|
||||
<ion-label class="width-100 d-block list">
|
||||
<p class="d-flex ion-justify-content-between">
|
||||
<span class="attach-title-item">{{document.SourceName}}</span>
|
||||
<span class="attach-title-item">{{document.subject || document.Description || 'Sem título'}}</span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
||||
@@ -298,7 +298,7 @@
|
||||
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
|
||||
</span>
|
||||
</p>
|
||||
<p><span class="span-left" *ngIf="document.Stakeholders != false">{{document.Stakeholders}}</span><span class="span-right" *ngIf="document.CreateDate != false"> {{document.CreateDate }} </span></p>
|
||||
<p><span class="span-left" *ngIf="document.Stakeholders != false">{{document.Stakeholders}}</span><span class="span-right" *ngIf="document.dateEntry != false"> {{document.dateEntry }} </span></p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-compo
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -44,7 +45,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
public showSeconds = false;
|
||||
public touchUi = false;
|
||||
public enableMeridian = false;
|
||||
public minDate = new Date().toISOString().slice(0,10)
|
||||
public minDate = new Date().toISOString().slice(0, 10)
|
||||
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
||||
public maxDate: any;
|
||||
public stepHour = 1;
|
||||
@@ -62,12 +63,14 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
@ViewChild('picker1') picker1: any;
|
||||
|
||||
serialNumber: string
|
||||
loadedAttachments: Attachment[]= []
|
||||
loadedAttachments: any[] = []
|
||||
addedAttachmentsList: any[] = []
|
||||
deletedAttachmentsList: any[] = []
|
||||
|
||||
eventProcess = {
|
||||
serialNumber: "",
|
||||
taskStartDate: "",
|
||||
workflowInstanceDataFields:{
|
||||
workflowInstanceDataFields: {
|
||||
Body: "",
|
||||
OccurrenceType: '',
|
||||
Category: '',
|
||||
@@ -91,10 +94,10 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
show = false
|
||||
|
||||
postEvent: Event;
|
||||
isRecurring:string;
|
||||
isRecurring: string;
|
||||
isEventEdited: boolean;
|
||||
segment:string = "true";
|
||||
profile:string;
|
||||
segment: string = "true";
|
||||
profile: string;
|
||||
eventAttendees: EventPerson[];
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
@@ -115,11 +118,12 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
private eventsService: EventsService,
|
||||
public alertController: AlertController,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private toastService: ToastService,
|
||||
private router:Router,
|
||||
private router: Router,
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHalde: HttpErrorHandle
|
||||
private httpErroHalde: HttpErrorHandle,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
// Edit event to approve
|
||||
this.serialNumber = this.navParams.get('serialNumber');
|
||||
@@ -129,6 +133,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
console.log('Here you ares')
|
||||
this.getTask()
|
||||
this.getRecurrenceTypes();
|
||||
}
|
||||
@@ -138,8 +143,8 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
myInterval = setInterval(() => {
|
||||
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
|
||||
if(e) {
|
||||
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
|
||||
if (e) {
|
||||
e.disabled = true;
|
||||
}
|
||||
})
|
||||
@@ -147,80 +152,86 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
async getTask() {
|
||||
|
||||
const result = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
/* const result = await this.processes.GetTask(this.serialNumber).toPromise(); */
|
||||
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
|
||||
|
||||
if (res.isOk()) {
|
||||
console.log('Loaded Event', res.value)
|
||||
|
||||
this.eventProcess = result
|
||||
this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType
|
||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
||||
this.eventProcess = res.value as any
|
||||
this.eventProcess.workflowInstanceDataFields.Category = res.value.workflowInstanceDataFields.EventType
|
||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
||||
|
||||
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
|
||||
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
|
||||
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
|
||||
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
|
||||
|
||||
// description
|
||||
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
// description
|
||||
let body: any = this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
try {
|
||||
this.getAttachments()
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
|
||||
} catch (error) {
|
||||
this.httpErroHalde.httpStatusHandle(error)
|
||||
}
|
||||
|
||||
|
||||
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
if(e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
this.loadedAttachments = res.value.Attachments
|
||||
/* this.getAttachments()
|
||||
*/
|
||||
if (this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
})
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
if (e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
this.httpErroHalde.httpStatusHandle(res.error)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* }) */
|
||||
}
|
||||
|
||||
getRecurrenceTypes() {
|
||||
this.eventsService.getRecurrenceTypes().subscribe(res=>{
|
||||
this.eventsService.getRecurrenceTypes().subscribe(res => {
|
||||
|
||||
this.recurringTypes = res;
|
||||
});
|
||||
}
|
||||
|
||||
onSelectedRecurringChanged(ev:any){
|
||||
onSelectedRecurringChanged(ev: any) {
|
||||
|
||||
this.calculetedLastOccurrence(ev);
|
||||
|
||||
if(ev.length > 1){
|
||||
if (ev.length > 1) {
|
||||
|
||||
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
|
||||
}
|
||||
if(ev.length == 0){
|
||||
if (ev.length == 0) {
|
||||
this.postEvent.EventRecurrence.Type = "-1";
|
||||
}
|
||||
}
|
||||
|
||||
calculetedLastOccurrence(type:number){
|
||||
calculetedLastOccurrence(type: number) {
|
||||
var valor;
|
||||
var opcao: boolean;
|
||||
if (type == 0) {
|
||||
valor = 7;
|
||||
opcao = true;
|
||||
} else if(type == 1){
|
||||
} else if (type == 1) {
|
||||
valor = 30;
|
||||
opcao = true;
|
||||
} else if(type == 2){
|
||||
} else if (type == 2) {
|
||||
valor = 1;
|
||||
opcao = false;
|
||||
}else if(type == 3){
|
||||
} else if (type == 3) {
|
||||
valor = 5;
|
||||
opcao = false;
|
||||
}
|
||||
@@ -228,7 +239,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
defineLastOccurrence(valor:number, opcao:boolean){
|
||||
defineLastOccurrence(valor: number, opcao: boolean) {
|
||||
var time = new Date(this.endDate);
|
||||
if (opcao == true) {
|
||||
time.setDate(time.getDate() + valor);
|
||||
@@ -248,7 +259,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
openLastOccurrence() {
|
||||
let input: any = document.querySelector('#last-occurrence')
|
||||
if(input) {
|
||||
if (input) {
|
||||
input.click()
|
||||
}
|
||||
}
|
||||
@@ -262,15 +273,15 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
save() {
|
||||
// set dates to eventProcess object
|
||||
|
||||
this.taskParticipantsCc.forEach(e=>{
|
||||
this.taskParticipantsCc.forEach(e => {
|
||||
e.IsRequired = false
|
||||
})
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc)
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e=>{
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
|
||||
if(e.hasOwnProperty('$type')) {
|
||||
if (e.hasOwnProperty('$type')) {
|
||||
delete e.$type
|
||||
}
|
||||
})
|
||||
@@ -306,15 +317,47 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
|
||||
/* this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
|
||||
this.httpErroHalde.httpsSucessMessagge('Editar evento')
|
||||
window['approve-event-getTask']()
|
||||
}, error =>{
|
||||
this.httpErroHalde.httpStatusHandle(error)
|
||||
})
|
||||
}) */
|
||||
|
||||
this.agendaDataRepository.updateEvent(this.eventProcess.serialNumber, event).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('edit event error: ', error)
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, this.eventProcess.workflowInstanceDataFields.ParticipantsList).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
|
||||
|
||||
this.loadedAttachments.forEach((document:any)=>{
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('add attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* this.loadedAttachments.forEach((document:any)=>{
|
||||
if(document['action'] == 'add') {
|
||||
delete document.action
|
||||
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
|
||||
@@ -343,17 +386,17 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}) */
|
||||
|
||||
this.close();
|
||||
}
|
||||
|
||||
async openAttendees() {
|
||||
|
||||
if(window.innerWidth <= 1024) {
|
||||
if (window.innerWidth <= 1024) {
|
||||
const modal = await this.modalController.create({
|
||||
component: AttendeesPageModal,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
adding: this.adding,
|
||||
taskParticipants: this.taskParticipants,
|
||||
taskParticipantsCc: this.taskParticipantsCc
|
||||
@@ -366,7 +409,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then((data) => {
|
||||
|
||||
if(data) {
|
||||
if (data) {
|
||||
data = data['data'];
|
||||
|
||||
const newAttendees: EventPerson[] = data['taskParticipants'];
|
||||
@@ -402,7 +445,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
this.openAttendees();
|
||||
}
|
||||
|
||||
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) {
|
||||
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
|
||||
this.taskParticipants = taskParticipants;
|
||||
this.taskParticipantsCc = taskParticipantsCc;
|
||||
}
|
||||
@@ -416,7 +459,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
console.error('getAttachments', error)
|
||||
}
|
||||
|
||||
result.forEach((e)=>{
|
||||
result.forEach((e) => {
|
||||
e.action = false
|
||||
})
|
||||
|
||||
@@ -426,8 +469,16 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
deleteAttachment(attachment: Attachment, index) {
|
||||
console.log( this.loadedAttachments)
|
||||
const id: any = this.loadedAttachments[index].id
|
||||
let update = this.removeItemById(this.loadedAttachments, id)
|
||||
this.loadedAttachments = update
|
||||
console.log( update)
|
||||
this.deletedAttachmentsList.push(id)
|
||||
}
|
||||
|
||||
this.loadedAttachments[index]['action'] = 'delete'
|
||||
removeItemById(array, id) {
|
||||
return array.filter(item => item.id !== id);
|
||||
}
|
||||
|
||||
async getDoc() {
|
||||
@@ -437,34 +488,36 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
showSearchInput: true,
|
||||
eventAgenda: true,
|
||||
select: true,
|
||||
}
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
if(res){
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if (res) {
|
||||
|
||||
const data: SearchList = res.data.selected;
|
||||
|
||||
const DocumentToSave: any = {
|
||||
SourceTitle: data.Assunto,
|
||||
ParentId: this.InstanceId,
|
||||
Source: '1',
|
||||
SourceId: data.Id,
|
||||
ApplicationId: data.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
action: 'add',
|
||||
CreateDate: data.Data,
|
||||
Data: data.Data,
|
||||
Description: data.DocTypeDesc,
|
||||
SourceName: data.Assunto,
|
||||
Stakeholders: data.EntidadeOrganicaNome,
|
||||
};
|
||||
console.log(data)
|
||||
/* const DocumentToSave: any = {
|
||||
SourceTitle: data.Assunto,
|
||||
ParentId: this.InstanceId,
|
||||
Source: '1',
|
||||
SourceId: data.Id,
|
||||
ApplicationId: data.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
action: 'add',
|
||||
CreateDate: data.Data,
|
||||
Data: data.Data,
|
||||
Description: data.DocTypeDesc,
|
||||
SourceName: data.Assunto,
|
||||
Stakeholders: data.EntidadeOrganicaNome,
|
||||
}; */
|
||||
|
||||
|
||||
this.loadedAttachments.push(DocumentToSave)
|
||||
this.loadedAttachments.push(data)
|
||||
this.addedAttachmentsList.push(data)
|
||||
|
||||
|
||||
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
||||
|
||||
Reference in New Issue
Block a user