lot of changes

This commit is contained in:
Eudes Inácio
2024-06-02 13:53:46 +01:00
parent 599d278e57
commit e9c8e0fbd9
19 changed files with 428 additions and 264 deletions
@@ -23,19 +23,19 @@ export class ApproveEventPage implements OnInit {
event: Event;
@Input() loadedEvent: EventToApproveDetails;
loadedAttachments:any;
customDate:any;
today:any;
loadedAttachments: any;
customDate: any;
today: any;
show: boolean = false;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@Input() serialNumber:string;
@Input() showComponent:string;
@Input() serialNumber: string;
@Input() showComponent: string;
@Input() componentTransparent: any
@Input() InstanceId:string;
@Input() showAside:boolean;
@Input() InstanceId: string;
@Input() showAside: boolean;
@Output() approveEventDismiss = new EventEmitter<any>();
@Output() closeEventToApprove = new EventEmitter<any>();
@@ -53,12 +53,12 @@ export class ApproveEventPage implements OnInit {
public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService,
public AgendaDataRepositoryService: AgendaDataRepositoryService
private agendaDataRepository: AgendaDataRepositoryService
) {
// Event to approve list
window['edit-approve-event-desktop'] = ()=> {
window['edit-approve-event-desktop'] = () => {
this.getTask()
}
}
@@ -80,31 +80,38 @@ export class ApproveEventPage implements OnInit {
async getTask() {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
if(res.isOk()) {
if (res.isOk()) {
this.loadedEvent = res.value;
console.log('attachment',res.value)
console.log('attachment', res.value)
this.loadedAttachments = this.loadedEvent.Attachments
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()]);
} else {
console.log(res.error.status)
}
}
async approveTask(serialNumber:string) {
async approveTask(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.modalController.dismiss(serialNumber);
this.httpErroHandle.httpsSucessMessagge('Aprovar')
this.TaskService.loadEventosParaAprovacao();
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Approved').subscribe((value) => {
console.log(value)
this.modalController.dismiss(serialNumber);
this.httpErroHandle.httpsSucessMessagge('Aprovar')
this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}))
/* await this.processes.PostTaskAction(body).toPromise() */
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
@@ -114,7 +121,7 @@ export class ApproveEventPage implements OnInit {
}
async rejectTask(serialNumber:string) {
async rejectTask(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
@@ -139,13 +146,13 @@ export class ApproveEventPage implements OnInit {
try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
} catch (error) {
console.error('getAttchaments',error)
console.error('getAttchaments', error)
}
}
async viewDocument(DocId:string, Document) {
async viewDocument(DocId: string, Document) {
const modal = await this.modalController.create({
component: ViewDocumentPage,
@@ -168,7 +175,7 @@ export class ApproveEventPage implements OnInit {
}
async openOptions(ev:any) {
async openOptions(ev: any) {
const popover = await this.popoverController.create({
component: EventActionsPopoverPage,
componentProps: {
@@ -178,7 +185,7 @@ export class ApproveEventPage implements OnInit {
event: ev,
translucent: true
});
return await popover.present().then(() =>{
return await popover.present().then(() => {
this.TaskService.loadEventosParaAprovacao()
this.getTask()
}, (error) => {
@@ -186,11 +193,11 @@ export class ApproveEventPage implements OnInit {
})
}
async emendTask(serialNumber:string) {
async emendTask(serialNumber: string) {
const modal = await this.modalController.create({
component: EmendMessageModalPage,
componentProps:{
componentProps: {
},
cssClass: 'emend-message-modal',
backdropDismiss: false
@@ -199,46 +206,53 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss()
.then( async (res) => {
.then(async (res) => {
if(res.data.option == 'save') {
if (res.data.option == 'save') {
let body = { "serialNumber": serialNumber,
"action": "Emendar",
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
"ReviewUserComment": res.data,
}
}
const loader = this.toastService.loading();
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
this.httpErroHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao();
this.close();
},((error) => {
console.log('send event to revision error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}));
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} else {
}
const loader = this.toastService.loading();
try {
await this.processes.PostTaskAction(body).toPromise();
this.httpErroHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao();
this.close();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
} else {
}
}, (error) => {
console.log(error)
});
}, (error) => {
console.log(error)
});
await modal.present();
}
goToEventsToApprove() {
if(window.location.pathname.startsWith('/home/agenda')) {
if (window.location.pathname.startsWith('/home/agenda')) {
this.close()
} else {
let navigationExtras: NavigationExtras = {
@@ -352,7 +352,7 @@
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index">
<ion-label class="width-100 d-block list" >
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Description}}</span>
<span class="attach-title-item">{{document.subject}}</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>
@@ -360,7 +360,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>
@@ -56,11 +56,11 @@ export class EditEventToApprovePage implements OnInit {
showLoader = false
get dateStart () {
get dateStart() {
return this.dateControlStart.value
}
get dateEnd () {
get dateEnd() {
return this.dateControlEnd.value
}
@@ -69,12 +69,12 @@ export class EditEventToApprovePage implements OnInit {
@ViewChild('inicio') inicio: any;
@ViewChild('picker1') picker1: any;
loadedAttachments: Attachment[]= []
loadedAttachments: any[] = []
eventProcess = {
serialNumber: "",
taskStartDate: "",
workflowInstanceDataFields:{
workflowInstanceDataFields: {
Body: "",
OccurrenceType: '',
Category: '',
@@ -97,9 +97,9 @@ export class EditEventToApprovePage implements OnInit {
}
show = false
isRecurring:string;
isRecurring: string;
isEventEdited: boolean;
profile:string;
profile: string;
eventAttendees: EventPerson[];
loadedEventAttachments: Attachment[];
@@ -111,6 +111,8 @@ export class EditEventToApprovePage implements OnInit {
Form: FormGroup;
validateFrom = false
addedAttachmentsList = [];
deletedAttachmentsList = [];
@Output() openAttendeesComponent = new EventEmitter<any>();
@Output() clearContact = new EventEmitter<any>();
@@ -118,7 +120,7 @@ export class EditEventToApprovePage implements OnInit {
@Output() setIntervenientCC = new EventEmitter<any>();
@Output() closeComponent = new EventEmitter<any>();
@Output() closeEventToApprove = new EventEmitter<any>();
@Output() approveEventDismiss = new EventEmitter<any>();
@Output() approveEventDismiss = new EventEmitter<any>();
@Input() saveData: any;
@Input() serialNumber: string
@@ -130,7 +132,7 @@ export class EditEventToApprovePage implements OnInit {
private eventsService: EventsService,
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private processes:ProcessesService,
private processes: ProcessesService,
private toastService: ToastService,
public ThemeService: ThemeService,
public httpErrorHandler: HttpErrorHandle,
@@ -142,7 +144,7 @@ export class EditEventToApprovePage implements OnInit {
ngOnInit() {
if(this.restoreTemporaryData()){
if (this.restoreTemporaryData()) {
this.setOtherData()
} else {
this.getTask();
@@ -156,60 +158,60 @@ export class EditEventToApprovePage implements OnInit {
const res: any = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
console.log('evento to apro to edit', res.value)
this.eventProcess = res.value;
this.eventProcess = res.value;
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
this.restoreDatepickerData()
this.restoreDatepickerData()
// description
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
this.eventProcess.workflowInstanceDataFields.Body = body
this.eventProcess.workflowInstanceDataFields.Category = this.eventProcess.workflowInstanceDataFields.EventType
// description
let body: any = this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
this.eventProcess.workflowInstanceDataFields.Body = body
this.eventProcess.workflowInstanceDataFields.Category = this.eventProcess.workflowInstanceDataFields.EventType
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.loadedAttachments = res.value.Attachments;
console.log(this.loadedAttachments)
this.getAttachments()
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.loadedAttachments = res.value.Attachments;
console.log(this.loadedAttachments)
this.getAttachments()
this.setOtherData()
this.setOtherData()
this.saveTemporaryData()
this.saveTemporaryData()
}
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.eventProcess.workflowInstanceDataFields.OccurrenceType = ev.filter(data => data != '-1');
}
if(ev.length == 0) {
if (ev.length == 0) {
this.eventProcess.workflowInstanceDataFields.OccurrenceType = "-1";
}
}
calculetedLastOccurrence(type:number){
var valor;
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;
}
@@ -217,28 +219,28 @@ export class EditEventToApprovePage implements OnInit {
}
defineLastOccurrence(valor:number, opcao:boolean){
defineLastOccurrence(valor: number, opcao: boolean) {
var time = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
if (opcao == true) {
time.setDate(time.getDate() + valor);
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
} else {
time = new Date(
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getMinutes()
);
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
}
}
setOtherData() {
if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) {
if (this.eventProcess.workflowInstanceDataFields.ParticipantsList) {
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
if(e.IsRequired) {
if (e.IsRequired) {
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
@@ -246,10 +248,10 @@ export class EditEventToApprovePage implements OnInit {
})
}
this.taskParticipants = removeDuplicate(this.taskParticipants)
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc)
this.taskParticipants = removeDuplicate(this.taskParticipants)
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc)
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
if (this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
this.isRecurring = "Não se repete";
}
else {
@@ -280,7 +282,7 @@ export class EditEventToApprovePage implements OnInit {
runValidation() {
this.validateFrom = true
this.validateFrom = true
}
injectValidation() {
@@ -318,7 +320,7 @@ export class EditEventToApprovePage implements OnInit {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if (this.Form.invalid) return false
// set dates to eventProcess object
this.dateControlStart = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.StartDate)).add(1, 'hours'));
@@ -326,7 +328,7 @@ export class EditEventToApprovePage implements OnInit {
// this.restoreDatepickerData()
// this.getDatepickerData()
this.taskParticipantsCc.forEach( e => {
this.taskParticipantsCc.forEach(e => {
e.IsRequired = false
})
@@ -336,9 +338,9 @@ export class EditEventToApprovePage implements OnInit {
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
}
})
@@ -375,48 +377,52 @@ export class EditEventToApprovePage implements OnInit {
console.log('edit event error: ', error)
}));
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, { attendees: this.attendeesAdded(this.eventProcess.workflowInstanceDataFields.ParticipantsList) }).subscribe((value) => {
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, this.eventProcess.workflowInstanceDataFields.ParticipantsList).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add Attendee error: ', error)
}));
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.documentAdded(this.loadedAttachments) }).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
console.log('add attachment error: ', error)
}));
if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: 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: [] }).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
console.log('remove attachment error: ', error)
}));
}
this.close()
this.httpErrorHandler.httpsSucessMessagge('Editar evento');
} catch(e) {
} catch (e) {
this.httpErrorHandler.httpStatusHandle(e);
this.toastService._badRequest('Evento não editado');
}
this.loadedAttachments.forEach((document:any)=>{
if(document['action'] == 'add') {
this.loadedAttachments.forEach((document: any) => {
if (document['action'] == 'add') {
delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
this.attachmentsService.setEventAttachmentById(document).subscribe(() => {
window['edit-approve-event-desktop']()
}, error =>{
}, error => {
this.toastService.badRequest();
});
} else if(document['action'] == 'delete') {
} else if (document['action'] == 'delete') {
delete document.action
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe(res => {
window['edit-approve-event-desktop']()
}, error =>{
}, error => {
this.toastService.badRequest()
})
}
@@ -459,10 +465,10 @@ export class EditEventToApprovePage implements OnInit {
}
async gravasAction() {
await this.save();
if(this.eventProcess['activityInstanceName'] == 'Editar Evento') {
if (this.eventProcess['activityInstanceName'] == 'Editar Evento') {
this.reenviar();
}
@@ -472,11 +478,11 @@ export class EditEventToApprovePage implements OnInit {
let body = {
serialNumber: this.eventProcess.serialNumber,
action: "Reenviar",
dataFields: {
dataFields: {
ReviewUserComment: "",
}
}
const loader = this.toastService.loading();
try {
@@ -484,13 +490,13 @@ export class EditEventToApprovePage implements OnInit {
this.toastService._successMessage();
this.goToApproveEventList();
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest();
}
} finally {
} finally {
loader.remove()
}
}
@@ -500,16 +506,16 @@ export class EditEventToApprovePage implements OnInit {
this.modalController.dismiss();
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) {
this.taskParticipants = removeDuplicate(taskParticipants) ;
this.taskParticipantsCc = removeDuplicate(taskParticipantsCc) ;
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = removeDuplicate(taskParticipants);
this.taskParticipantsCc = removeDuplicate(taskParticipantsCc);
}
async addParticipants() {
//this.saveTemporaryData();
this.openAttendeesComponent.emit({
type: "intervenient"
});
@@ -539,9 +545,9 @@ export class EditEventToApprovePage implements OnInit {
restoreTemporaryData(): boolean {
const restoredData = window['temp.path:/shared/agenda/edit-event-to-approve.ts']
const restoredData = window['temp.path:/shared/agenda/edit-event-to-approve.ts']
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData) {
if (JSON.stringify(restoredData) != "{}" && undefined != restoredData) {
this.eventProcess = restoredData.eventProcess
// restore dater for date and hours picker
@@ -559,10 +565,10 @@ export class EditEventToApprovePage implements OnInit {
try {
result = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
} catch (error) {
console.error('getAttachment',error)
console.error('getAttachment', error)
}
result.forEach((e)=>{
result.forEach((e) => {
e.action = false
})
@@ -572,8 +578,10 @@ 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)
}
async getDoc() {
@@ -583,16 +591,17 @@ export class EditEventToApprovePage implements OnInit {
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true,
eventAgenda: true,
select: true,
}
});
await modal.present();
modal.onDidDismiss().then( async (res)=>{
if(res){
modal.onDidDismiss().then(async (res) => {
if (res) {
const data: SearchList = res.data.selected;
console.log(data)
const DocumentToSave: any = {
/* const DocumentToSave: any = {
SourceTitle: data.Assunto,
ParentId: this.InstanceId,
Source: '1',
@@ -607,11 +616,12 @@ export class EditEventToApprovePage implements OnInit {
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(()=>{
// this.getAttachments();
@@ -345,7 +345,7 @@
<ion-item class="width-100">
<ion-label class="width-100">
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="attach-title-item">{{document.subject}}</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>
@@ -353,7 +353,7 @@
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
<p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate |
<p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.dateEntry |
date: 'dd-MM-yyyy HH:mm'}} </span></p>
</ion-label>
</ion-item>
@@ -17,6 +17,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
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';
import { SearchList_v2 } from 'src/app/models/search-document';
@Component({
selector: 'app-edit-event',
@@ -35,7 +36,7 @@ export class EditEventPage implements OnInit {
segment: string = "true";
eventAttendees: EventPerson[];
// minDate: string;
loadedEventAttachments: Attachment[] = [];
loadedEventAttachments: any[] = [];
recurringTypes = [];
selectedRecurringType: any;
deletedAttachmentsList = [];
@@ -344,39 +345,6 @@ export class EditEventPage implements OnInit {
}
atendeesSeletedType(type) {
var selectedType = {
'true': 1,
'false': 2,
'other': 3,
}
return selectedType[type];
}
documentAdded(documents: any[]) {
console.log('document added', documents)
return documents.map((element) => {
return {
docId: parseInt(element.SourceId),
sourceName: element.SourceName,
description: "",
applicationId: parseInt(element.ApplicationId)
};
});
}
attendeesAdded(taskParticipants: any[]) {
return taskParticipants.map((e) => {
return {
name: e.Name,
emailAddress: e.EmailAddress,
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
wxUserId: e.wxUserId,
}
});
}
async save_v2() {
this.injectValidation()
this.runValidation()
@@ -385,16 +353,6 @@ export class EditEventPage implements OnInit {
return false
}
/* this._postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
console.log('1',this._postEvent.Attendees)
console.log('2',this.postEvent.Attendees)
if (JSON.stringify(this._postEvent.Attendees) === JSON.stringify(this.postEvent.Attendees)) {
console.log(true)
} else {
console.log(false)
}
return */
this._postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.showLoader = true;
@@ -406,7 +364,7 @@ export class EditEventPage implements OnInit {
console.log('edit event error: ', error)
}));
this.agendaDataRepository.addEventAttendee(this._postEvent.EventId, { attendees: this.attendeesAdded(this._postEvent.Attendees) }).subscribe((value) => {
this.agendaDataRepository.addEventAttendee(this._postEvent.EventId, this._postEvent.Attendees).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add Attendee error: ', error)
@@ -416,7 +374,7 @@ export class EditEventPage implements OnInit {
await this.saveDocument()
if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, { "attachments": this.documentAdded(this._postEvent.Attachments) }).subscribe((value) => {
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, { "attachments": this._postEvent.Attachments }).subscribe((value) => {
console.log(value)
}, ((error) => {
this.showLoader = false
@@ -627,13 +585,17 @@ export class EditEventPage implements OnInit {
const id: any = this.loadedEventAttachments[index].Id
if (id == 'add') {
this.loadedEventAttachments[index]['remove'] = true
console.log(id)
this.deletedAttachmentsList.push(id)
/* if (id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
} else {
this.loadedEventAttachments[index]['remove'] = true
console.log(id)
this.deletedAttachmentsList.push(id)
}
} */
}
@@ -644,6 +606,7 @@ export class EditEventPage implements OnInit {
cssClass: 'modal-width-100-width-background modal',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
eventAgenda: true,
showSearchInput: true,
select: true,
}
@@ -654,7 +617,7 @@ export class EditEventPage implements OnInit {
const data = res.data;
console.log(data)
const ApplicationIdDocumentToSave: any = {
/* const ApplicationIdDocumentToSave: any = {
SourceName: data.selected.Assunto,
ParentId: this._postEvent.EventId,
SourceId: data.selected.Id,
@@ -666,10 +629,24 @@ export class EditEventPage implements OnInit {
Source: '1',
Link: '',
SerialNumber: '',
}*/
let newDocObject: SearchList_v2 = {
docId: data.selected.docId,
sourceName: data.selected.sourceName,
description: data.selected.description,
applicationId: data.selected.applicationId,
classificator: data.selected.classificator,
dateEntry: data.selected.dateEntry,
docNumber: data.selected.docNumber,
subject: data.selected.subject,
userId: data.selected.userId
}
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
this.addedAttachmentsList.push(ApplicationIdDocumentToSave)
this.loadedEventAttachments.push(data.selected)
this.addedAttachmentsList.push(data.selected)
}
});
@@ -390,14 +390,14 @@
<ion-item>
<ion-label>
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Assunto}}</span>
<span class="attach-title-item">{{document.subject}}</span>
<span class="app-name" *ngIf="!document.appName">{{ TaskService.attachmentAppName(document)}}</span>
<span class="app-name" *ngIf="document.appName">{{document.appName}}</span>
<span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
<p><span class="span-left">{{(document.EntidadeOrganicaNome || document.Sender)}}</span><span class="span-right"> {{(document.Data || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}} </span></p>
<p><span class="span-left">{{(document.EntidadeOrganicaNome || document.Sender)}}</span><span class="span-right"> {{(document.dateEntry) | date: 'dd-MM-yyyy HH:mm'}} </span></p>
</ion-label>
</ion-item>
</ion-list>
@@ -7,7 +7,7 @@ import { Event } from 'src/app/models/event.model';
import { ModalController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchList } from "src/app/models/search-document";
import { SearchList, SearchList_v2 } from "src/app/models/search-document";
import { EventAttachment, EventAttachment_v2 } from 'src/app/models/attachment.model';
import { ToastService } from 'src/app/services/toast.service';
@@ -104,7 +104,7 @@ export class NewEventPage implements OnInit {
@Output() cloneAllmobileComponent = new EventEmitter<any>();
@Output() backToChat = new EventEmitter<any>();
documents: SearchList[] = [];
documents: SearchList_v2[] = [];
loggeduser: LoginUserRespose;
@ViewChild('picker') picker: any;
@@ -424,6 +424,7 @@ export class NewEventPage implements OnInit {
cssClass: 'modal-width-100-width-background modal',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
eventAgenda: true,
showSearchInput: true,
select: true
}
@@ -432,7 +433,15 @@ export class NewEventPage implements OnInit {
modal.onDidDismiss().then((res) => {
if (res) {
const data = res.data;
/* let newDocObject: SearchList_v2 = {
docId: parseInt(data.selected.Id),
sourceName: data.selected.Assunto,
description: "",
applicationId: data.selected.ApplicationType
} */
console.log('get doc', data)
this.documents.push(data.selected);
console.log('pushed')
}
});
@@ -537,7 +546,7 @@ export class NewEventPage implements OnInit {
this.hhtpErrorHandle.httpsSucessMessagge('new event')
}
async save() {
/* async save() {
this.injectValidation()
this.runValidation()
@@ -552,9 +561,9 @@ export class NewEventPage implements OnInit {
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.postEvent.Subject = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Subject/* ); */
this.postEvent.Location = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Location/* ); */
this.postEvent.Body.Text = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Body.Text/* ); */
this.postEvent.Subject = this.postEvent.Subject
this.postEvent.Location = this.postEvent.Location
this.postEvent.Body.Text = this.postEvent.Body.Text
@@ -724,20 +733,6 @@ export class NewEventPage implements OnInit {
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove')
/* DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
if (DocumentToSave.length == (i + 1)) {
this.afterSave();
}
});
});
if (DocumentToSave.length == 0) {
this.afterSave();
} */
}, (error) => {
loader.remove()
this.showLoader = false
@@ -768,20 +763,6 @@ export class NewEventPage implements OnInit {
this.afterSave();
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove')
/* DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
if (DocumentToSave.length == (i + 1)) {
this.afterSave();
}
});
});
if (DocumentToSave.length == 0) {
this.afterSave();
} */
}, (error) => {
loader.remove()
this.showLoader = false
@@ -921,7 +902,7 @@ export class NewEventPage implements OnInit {
});
}
}
} */
selectedCalendarId() {
@@ -121,12 +121,12 @@
class="ion-no-margin ion-no-padding pa-0">
<ion-label class="width-100 d-flex align-center">
<p class="flex-grow-1 cursor-pointer" (click)="docIndex(i);LoadDocumentDetails()">
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span>
<span class="attach-title-item d-block">{{attach.subject || 'Sem título'}}</span>
<span class="span-left d-block">{{attach.Stakeholders}}</span>
</p>
<div class="d-flex pr-10 cursor-pointer" (click)="docIndex(i);LoadDocumentDetails()">
<span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span>
<span class="span-right">{{ attach.dateEntry | date: 'dd-MM-yyyy HH:mm' }}</span>
</div>
<!-- <div (click)="docIndex(i);LoadDocumentDetails()" class="doc-options">
@@ -19,6 +19,7 @@ import { NavigationExtras, Router } from '@angular/router';
import { EventController } from 'src/app/controller/event'
import { DateService } from 'src/app/services/date.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SearchList_v2 } from 'src/app/models/search-document';
@Component({
selector: 'app-view-event',
@@ -131,6 +132,9 @@ export class ViewEventPage implements OnInit {
if(res.isOk()) {
console.log('Loaded Event', res.value)
console.log('newAttahcmentList', res.value.Attachments)
let changeDate = this.dateService.fixDate(res.value as any) as any
this.loadedEvent = changeDate as any;
this.setTimeZone()