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
@@ -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)
}
});