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
+14
View File
@@ -10,6 +10,20 @@ export class SearchList {
ApplicationName: string; ApplicationName: string;
} }
export class SearchList_v2 {
docId: number;
sourceName: string;
description: string;
applicationId: number;
classificator: string;
dateEntry: string;
docNumber: string;
subject: string;
userId: number
}
export class Attachments { export class Attachments {
Id?: number Id?: number
ParentId?: any ParentId?: any
@@ -369,13 +369,13 @@
<ion-item> <ion-item>
<ion-label> <ion-label>
<p class="d-flex ion-justify-content-between"> <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">{{document.appName}}</span> <span class="app-name">{{document.appName}}</span>
<span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" > <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> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </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 || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}} </span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -680,6 +680,7 @@ export class NewEventPage implements OnInit {
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
eventAgenda: true,
select: true select: true
} }
}); });
+25 -10
View File
@@ -54,8 +54,8 @@
</button> </button>
</div> --> </div> -->
<div class="input-text d-flex ion-align-items-center pm-10 pl-10"> <div class="input-text d-flex ion-align-items-center pm-10 pl-10">
<ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' class="search-input {{Cy.p.search.input.subject}}" type="search" <ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject'
placeholder="Assunto"></ion-input> class="search-input {{Cy.p.search.input.subject}}" type="search" placeholder="Assunto"></ion-input>
</div> </div>
<!-- <div (click)="clearSearchInput()" class="d-flex align-center icon"> <!-- <div (click)="clearSearchInput()" class="d-flex align-center icon">
@@ -71,13 +71,20 @@
</div> </div>
<div *ngIf="!showAdvanceSearch" class="icon-z icon-most-searched-word-open pl-10 cursor-pointer" (click)="showHideAdvanceSearch(true)"> <div *ngIf="!showAdvanceSearch" class="icon-z icon-most-searched-word-open pl-10 cursor-pointer"
<ion-icon *ngIf="ThemeService.currentTheme == 'default' && type!='Agenda'" src="assets/images/theme/gov/filter_icon_grey.svg" class="icon" slot="end"></ion-icon> (click)="showHideAdvanceSearch(true)">
<ion-icon *ngIf="ThemeService.currentTheme != 'default'&& type!='Agenda' " src="assets/images/theme/gov/filter_icon_grey.svg" class="icon" slot="end"></ion-icon> <ion-icon *ngIf="ThemeService.currentTheme == 'default' && type!='Agenda'"
src="assets/images/theme/gov/filter_icon_grey.svg" class="icon" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme != 'default'&& type!='Agenda' "
src="assets/images/theme/gov/filter_icon_grey.svg" class="icon" slot="end"></ion-icon>
</div> </div>
<div *ngIf="showAdvanceSearch " class="icon-z icon-most-searched-word-open align-md-baseline pl-10 cursor-pointer" (click)="showHideAdvanceSearch(false)" > <div *ngIf="showAdvanceSearch "
<ion-icon *ngIf="ThemeService.currentTheme == 'default' && type!='Agenda' "src="assets/images/theme/gov/filter_icon.svg" class="icon" slot="end"></ion-icon> class="icon-z icon-most-searched-word-open align-md-baseline pl-10 cursor-pointer"
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && type!='Agenda'" src="assets/images/theme/gov/filter_icon.svg" class="icon" slot="end"></ion-icon> (click)="showHideAdvanceSearch(false)">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' && type!='Agenda' "
src="assets/images/theme/gov/filter_icon.svg" class="icon" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && type!='Agenda'"
src="assets/images/theme/gov/filter_icon.svg" class="icon" slot="end"></ion-icon>
</div> </div>
</div> </div>
@@ -292,14 +299,14 @@
<div class="content ion-align-items-center"> <div class="content ion-align-items-center">
<div class="d-flex ion-justify-content-between "> <div class="d-flex ion-justify-content-between ">
<span class="result-name">{{ searchDocument.Assunto}}</span> <span class="result-name">{{ searchDocument.subject}}</span>
<span class="app-name" <span class="app-name"
*ngIf="itemIcons() == 'AccoesPresidenciais & ArquivoDespachoElect' || itemIcons() == 'Correspondencia' ">{{ *ngIf="itemIcons() == 'AccoesPresidenciais & ArquivoDespachoElect' || itemIcons() == 'Correspondencia' ">{{
searchDocument.appName}}</span> searchDocument.appName}}</span>
</div> </div>
<div class="d-flex ion-justify-content-between "> <div class="d-flex ion-justify-content-between ">
<span class="organic-entity">{{ searchDocument.EntidadeOrganicaNome }}</span> <span class="organic-entity">{{ searchDocument.EntidadeOrganicaNome }}</span>
<span class="documente-date">{{ formateIsoDate(searchDocument.Data) }}</span> <span class="documente-date">{{ formateIsoDate(searchDocument.dateEntry) }}</span>
</div> </div>
<div *ngIf="select" (click)="view(searchDocument)"> Ver</div> <div *ngIf="select" (click)="view(searchDocument)"> Ver</div>
@@ -309,6 +316,14 @@
</ul> </ul>
</div> </div>
<!-- <a href="#" class="previous">&laquo; Previous</a>
<a href="#" class="next">Next &raquo;</a> -->
<div class="nextAndPreviewDiv" >
<a href="#" class="previous round" (click)="previeweButton($event)">&#8249;</a>
<div>{{pageNumber + "/" + totalPage}}</div>
<a href="#" class="next round" (click)="nextButton($event)" >&#8250;</a>
</div>
</div> </div>
</div> </div>
+30
View File
@@ -290,3 +290,33 @@ ion-slide {
.swiper-container { .swiper-container {
width: 100%; width: 100%;
} }
a {
text-decoration: none;
display: inline-block;
padding: 8px 16px;
}
a:hover {
background-color: #ddd;
color: black;
}
.previous {
background-color: #f1f1f1;
color: black;
}
.next {
background-color: #ffb81c;
color: white;
}
.round {
border-radius: 50%;
}
.nextAndPreviewDiv {
display:inline-flex
}
+75 -1
View File
@@ -18,6 +18,8 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { momentG } from 'src/plugin/momentG'; import { momentG } from 'src/plugin/momentG';
import { Cy } from 'cypress/enum' import { Cy } from 'cypress/enum'
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SessionStore } from 'src/app/store/session.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -91,9 +93,13 @@ export class SearchPage implements OnInit {
select: boolean = false; select: boolean = false;
showSearchInput = false showSearchInput = false
eventAgenda = false;
checkRoutPublication: boolean; checkRoutPublication: boolean;
checkDateEnd: boolean; checkDateEnd: boolean;
datePickerPlaceholder: string; datePickerPlaceholder: string;
pageNumber = 1;
pageSize = 10;
totalPage: number;
@ViewChild('picker1') picker1: any; @ViewChild('picker1') picker1: any;
@@ -107,7 +113,8 @@ export class SearchPage implements OnInit {
private navParams: NavParams, private navParams: NavParams,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private router: Router, private router: Router,
private httpErrorhandle: HttpErrorHandle) { private httpErrorhandle: HttpErrorHandle,
private agendaDataRepository: AgendaDataRepositoryService) {
this.ordinance = "recent"; this.ordinance = "recent";
this.currentPath = window.location.pathname; this.currentPath = window.location.pathname;
@@ -117,6 +124,7 @@ export class SearchPage implements OnInit {
this.select = this.navParams.get('select'); this.select = this.navParams.get('select');
this.showSearchInput = this.navParams.get('showSearchInput'); this.showSearchInput = this.navParams.get('showSearchInput');
this.eventAgenda = this.navParams.get('eventAgenda')
if (this.type == null || this.type == undefined) { if (this.type == null || this.type == undefined) {
@@ -382,8 +390,34 @@ export class SearchPage implements OnInit {
} else { } else {
this.showLoader = true; this.showLoader = true;
this.agendaDataRepository.getDocumentAttachments(361, SessionStore.user.UserId, this.searchSubject, this.pageNumber, this.pageSize).subscribe((values) => {
this.totalPage = values.data.total / this.pageSize;
this.totalPage = Math.round(this.totalPage)
console.log(values.data.result)
this.searchDocuments = this.sortArrayISODate(values.data.result);
this.reorderList(this.ordinance);
// hide show document
if (this.searchDocuments.length >= 1) {
this.showDocuments = true;
} else {
this.showDocuments = false
}
this.showLoader = false;
this.loadWordCloud();
}, error => {
this.showLoader = false;
// this.searchResult = "Registo não encontrado"
this.httpErrorhandle.httpStatusHandle(error)
// console.log(error)
})
return
this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '0').subscribe(res => { , this.searchOrganicEntiryCode, this.searchDocTypeId, '0').subscribe(res => {
console.log(this.searchDocTypeId)
return
if (!res.Categories.length) { if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura"; this.searchResult = "Não encontramos o que procura";
@@ -418,6 +452,32 @@ export class SearchPage implements OnInit {
}); });
} }
} }
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect" && this.eventAgenda == true) {
this.showLoader = true;
this.agendaDataRepository.getDocumentAttachments(361, SessionStore.user.UserId, this.searchSubject, this.pageNumber, this.pageSize).subscribe((values) => {
this.totalPage = values.data.total / this.pageSize;
this.totalPage = Math.round(this.totalPage)
console.log(values.data.result)
this.searchDocuments = this.sortArrayISODate(values.data.result);
this.reorderList(this.ordinance);
// hide show document
if (this.searchDocuments.length >= 1) {
this.showDocuments = true;
} else {
this.showDocuments = false
}
this.showLoader = false;
this.loadWordCloud();
}, error => {
this.showLoader = false;
// this.searchResult = "Registo não encontrado"
this.httpErrorhandle.httpStatusHandle(error)
// console.log(error)
})
}
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect") { else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
this.searchCategories = []; this.searchCategories = [];
@@ -1136,4 +1196,18 @@ export class SearchPage implements OnInit {
await modal.present(); await modal.present();
} }
nextButton(event) {
event.preventDefault();
this.pageNumber++;
this.basicSearch()
}
previeweButton(event) {
event.preventDefault();
if (this.pageNumber > 1) {
this.pageNumber--;
this.basicSearch()
}
}
} }
@@ -93,7 +93,7 @@ export class AgendaDataRepositoryService {
type: this.utils.calendarTypeSeleted(eventData.Category), type: this.utils.calendarTypeSeleted(eventData.Category),
category: this.utils.calendarCategorySeleted(eventData.CalendarName), category: this.utils.calendarCategorySeleted(eventData.CalendarName),
attendees: this.utils.attendeesAdded(eventData.Attendees), attendees: this.utils.attendeesAdded(eventData.Attendees),
attachments: this.utils.documentAdded(documents), attachments: documents,
recurrence: { recurrence: {
frequency: 0, frequency: 0,
occurrences: 0, occurrences: 0,
@@ -125,8 +125,10 @@ export class AgendaDataRepositoryService {
return this.agendaDataService.updateEvent(eventId, eventInput) return this.agendaDataService.updateEvent(eventId, eventInput)
} }
addEventAttendee(id,attendeeData) { addEventAttendee(id,attendeeData,) {
return this.agendaDataService.addEventAttendee(id,attendeeData); console.log(attendeeData)
console.log(this.utils.attendeesEdit(attendeeData))
return this.agendaDataService.addEventAttendee(id,{ attendees: this.utils.attendeesAdded(attendeeData) });
} }
addEventAttachment(id,attachmentData) { addEventAttachment(id,attachmentData) {
@@ -153,6 +155,14 @@ export class AgendaDataRepositoryService {
} }
eventToaprovalStatus(eventId, status) { eventToaprovalStatus(eventId, status) {
return this.agendaDataService.updateEventStatus(eventId,this.utils.statusEventAproval(status)) let statusObject = {
status: this.utils.statusEventAproval(status),
comment: ""
}
return this.agendaDataService.updateEventStatus(eventId,statusObject)
}
getDocumentAttachments(applicationId,userId,subject,pageNumber,pageSize) {
return this.agendaDataService.getDocumentAttachment(applicationId,userId,subject,pageNumber,pageSize)
} }
} }
@@ -106,4 +106,13 @@ export class AgendaDataService {
getToken(): Observable<any> { getToken(): Observable<any> {
return this.http.get<any>(`${this.baseUrl}/Users/token`); return this.http.get<any>(`${this.baseUrl}/Users/token`);
} }
getDocumentAttachment(aplicationId,userId,value,PageNumber,PageSize): Observable<any> {
const params = new HttpParams()
.set('userId', userId)
.set('Value', value)
.set('PageNumber', PageNumber)
.set('PageSize', PageSize);
return this.http.get<any>(`${this.baseUrl}/Documents/Attachments${aplicationId}`, {params});
}
} }
@@ -21,7 +21,8 @@ export class EventMapper {
"EndDate": dto.endDate, "EndDate": dto.endDate,
"EventType": "Single", "EventType": "Single",
"Attendees": dto.attendees.map((e) => ({ "Attendees": dto.attendees.map((e) => ({
Id: e.id, //Id: e.id,
wxUserId: e.wxUserId,
EmailAddress: e.emailAddress, EmailAddress: e.emailAddress,
Name: e.name, Name: e.name,
IsRequired: e.attendeeType == '0' ? true : false, IsRequired: e.attendeeType == '0' ? true : false,
@@ -73,6 +73,19 @@ export class Utils {
} }
editDocumentAdded(documents: any[]) {
console.log('document added', documents)
return documents.map((element) => {
return {
docId: parseInt(element.SourceId),
sourceName: element.SourceName,
description: "",
applicationId: parseInt(element.ApplicationId)
};
});
}
atendeesSeletedType(type) { atendeesSeletedType(type) {
var selectedType = { var selectedType = {
@@ -105,4 +118,15 @@ export class Utils {
} }
return selectedType[type]; return selectedType[type];
} }
attendeesEdit(taskParticipants: any[]) {
return taskParticipants.map((e) => {
return {
name: e.Name,
emailAddress: e.EmailAddress,
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
wxUserId: e.wxUserId || e.Id,
}
});
}
} }
@@ -53,7 +53,7 @@ export class ApproveEventPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle, private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService, public TaskService: TaskService,
public AgendaDataRepositoryService: AgendaDataRepositoryService private agendaDataRepository: AgendaDataRepositoryService
) { ) {
// Event to approve list // Event to approve list
@@ -80,7 +80,7 @@ export class ApproveEventPage implements OnInit {
async getTask() { 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; this.loadedEvent = res.value;
@@ -101,10 +101,17 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise() this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Approved').subscribe((value) => {
console.log(value)
this.modalController.dismiss(serialNumber); this.modalController.dismiss(serialNumber);
this.httpErroHandle.httpsSucessMessagge('Aprovar') this.httpErroHandle.httpsSucessMessagge('Aprovar')
this.TaskService.loadEventosParaAprovacao(); this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}))
/* await this.processes.PostTaskAction(body).toPromise() */
} catch (error) { } catch (error) {
this.httpErroHandle.httpStatusHandle(error) this.httpErroHandle.httpStatusHandle(error)
} finally { } finally {
@@ -205,7 +212,8 @@ export class ApproveEventPage implements OnInit {
let body = { "serialNumber": serialNumber, let body = {
"serialNumber": serialNumber,
"action": "Emendar", "action": "Emendar",
"dataFields": { "dataFields": {
"ReviewUserComment": res.data, "ReviewUserComment": res.data,
@@ -215,10 +223,16 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
try { try {
await this.processes.PostTaskAction(body).toPromise(); /* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
this.httpErroHandle.httpsSucessMessagge('Rever') this.httpErroHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao(); this.TaskService.loadEventosParaAprovacao();
this.close(); this.close();
},((error) => {
console.log('send event to revision error: ', error)
this.httpErroHandle.httpStatusHandle(error)
}));
} catch (error) { } catch (error) {
this.httpErroHandle.httpStatusHandle(error) this.httpErroHandle.httpStatusHandle(error)
} finally { } finally {
@@ -352,7 +352,7 @@
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index"> <ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index">
<ion-label class="width-100 d-block list" > <ion-label class="width-100 d-block list" >
<p class="d-flex ion-justify-content-between"> <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 == 8"> Correspondencia </span>
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span> <span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </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> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </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-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -69,7 +69,7 @@ export class EditEventToApprovePage implements OnInit {
@ViewChild('inicio') inicio: any; @ViewChild('inicio') inicio: any;
@ViewChild('picker1') picker1: any; @ViewChild('picker1') picker1: any;
loadedAttachments: Attachment[]= [] loadedAttachments: any[] = []
eventProcess = { eventProcess = {
serialNumber: "", serialNumber: "",
@@ -111,6 +111,8 @@ export class EditEventToApprovePage implements OnInit {
Form: FormGroup; Form: FormGroup;
validateFrom = false validateFrom = false
addedAttachmentsList = [];
deletedAttachmentsList = [];
@Output() openAttendeesComponent = new EventEmitter<any>(); @Output() openAttendeesComponent = new EventEmitter<any>();
@Output() clearContact = new EventEmitter<any>(); @Output() clearContact = new EventEmitter<any>();
@@ -375,25 +377,29 @@ export class EditEventToApprovePage implements OnInit {
console.log('edit event error: ', error) 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) console.log(value)
}, ((error) => { }, ((error) => {
console.log('add Attendee error: ', error) console.log('add Attendee error: ', error)
})); }));
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.documentAdded(this.loadedAttachments) }).subscribe((value) => { if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.loadedAttachments }).subscribe((value) => {
console.log(value) console.log(value)
}, ((error) => { }, ((error) => {
this.showLoader = false this.showLoader = false
console.log('add attachment error: ', error) console.log('add attachment error: ', error)
})); }));
}
if (this.deletedAttachmentsList.length > 0) {
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: [] }).subscribe((value) => { this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: [] }).subscribe((value) => {
console.log(value) console.log(value)
}, ((error) => { }, ((error) => {
this.showLoader = false this.showLoader = false
console.log('remove attachment error: ', error) console.log('remove attachment error: ', error)
})); }));
}
this.close() this.close()
@@ -572,8 +578,10 @@ export class EditEventToApprovePage implements OnInit {
} }
deleteAttachment(attachment: Attachment, index) { deleteAttachment(attachment: Attachment, index) {
const id: any = this.loadedEventAttachments[index].Id
console.log(attachment) console.log(attachment)
this.loadedAttachments[index]['action'] = 'delete' this.loadedAttachments[index]['action'] = 'delete'
this.deletedAttachmentsList.push(id)
} }
async getDoc() { async getDoc() {
@@ -583,6 +591,7 @@ export class EditEventToApprovePage implements OnInit {
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
eventAgenda: true,
select: true, select: true,
} }
}); });
@@ -592,7 +601,7 @@ export class EditEventToApprovePage implements OnInit {
const data: SearchList = res.data.selected; const data: SearchList = res.data.selected;
console.log(data) console.log(data)
const DocumentToSave: any = { /* const DocumentToSave: any = {
SourceTitle: data.Assunto, SourceTitle: data.Assunto,
ParentId: this.InstanceId, ParentId: this.InstanceId,
Source: '1', Source: '1',
@@ -607,10 +616,11 @@ export class EditEventToApprovePage implements OnInit {
Description: data.DocTypeDesc, Description: data.DocTypeDesc,
SourceName: data.Assunto, SourceName: data.Assunto,
Stakeholders: data.EntidadeOrganicaNome, Stakeholders: data.EntidadeOrganicaNome,
}; }; */
this.loadedAttachments.push(DocumentToSave) this.loadedAttachments.push(data)
this.addedAttachmentsList.push(data)
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{ // await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
@@ -345,7 +345,7 @@
<ion-item class="width-100"> <ion-item class="width-100">
<ion-label class="width-100"> <ion-label class="width-100">
<p class="d-flex ion-justify-content-between"> <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 == '8'"> Correspondencia </span>
<span class="app-name" *ngIf="document.ApplicationId == '386'"> AccoesPresidenciais </span> <span class="app-name" *ngIf="document.ApplicationId == '386'"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == '361' "> ArquivoDespachoElect </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> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </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> date: 'dd-MM-yyyy HH:mm'}} </span></p>
</ion-label> </ion-label>
</ion-item> </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 { ContactsService } from 'src/app/services/contacts.service'
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service'; import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service'; import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SearchList_v2 } from 'src/app/models/search-document';
@Component({ @Component({
selector: 'app-edit-event', selector: 'app-edit-event',
@@ -35,7 +36,7 @@ export class EditEventPage implements OnInit {
segment: string = "true"; segment: string = "true";
eventAttendees: EventPerson[]; eventAttendees: EventPerson[];
// minDate: string; // minDate: string;
loadedEventAttachments: Attachment[] = []; loadedEventAttachments: any[] = [];
recurringTypes = []; recurringTypes = [];
selectedRecurringType: any; selectedRecurringType: any;
deletedAttachmentsList = []; 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() { async save_v2() {
this.injectValidation() this.injectValidation()
this.runValidation() this.runValidation()
@@ -385,16 +353,6 @@ export class EditEventPage implements OnInit {
return false 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._postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.showLoader = true; this.showLoader = true;
@@ -406,7 +364,7 @@ export class EditEventPage implements OnInit {
console.log('edit event error: ', error) 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) console.log(value)
}, ((error) => { }, ((error) => {
console.log('add Attendee error: ', error) console.log('add Attendee error: ', error)
@@ -416,7 +374,7 @@ export class EditEventPage implements OnInit {
await this.saveDocument() await this.saveDocument()
if (this.addedAttachmentsList.length > 0) { 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) console.log(value)
}, ((error) => { }, ((error) => {
this.showLoader = false this.showLoader = false
@@ -627,13 +585,17 @@ export class EditEventPage implements OnInit {
const id: any = this.loadedEventAttachments[index].Id 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) this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
} else { } else {
this.loadedEventAttachments[index]['remove'] = true this.loadedEventAttachments[index]['remove'] = true
console.log(id) console.log(id)
this.deletedAttachmentsList.push(id) this.deletedAttachmentsList.push(id)
} } */
} }
@@ -644,6 +606,7 @@ export class EditEventPage implements OnInit {
cssClass: 'modal-width-100-width-background modal', cssClass: 'modal-width-100-width-background modal',
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
eventAgenda: true,
showSearchInput: true, showSearchInput: true,
select: true, select: true,
} }
@@ -654,7 +617,7 @@ export class EditEventPage implements OnInit {
const data = res.data; const data = res.data;
console.log(data) console.log(data)
const ApplicationIdDocumentToSave: any = { /* const ApplicationIdDocumentToSave: any = {
SourceName: data.selected.Assunto, SourceName: data.selected.Assunto,
ParentId: this._postEvent.EventId, ParentId: this._postEvent.EventId,
SourceId: data.selected.Id, SourceId: data.selected.Id,
@@ -666,10 +629,24 @@ export class EditEventPage implements OnInit {
Source: '1', Source: '1',
Link: '', Link: '',
SerialNumber: '', 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.loadedEventAttachments.push(data.selected)
this.addedAttachmentsList.push(ApplicationIdDocumentToSave) this.addedAttachmentsList.push(data.selected)
} }
}); });
@@ -390,14 +390,14 @@
<ion-item> <ion-item>
<ion-label> <ion-label>
<p class="d-flex ion-justify-content-between"> <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">{{ TaskService.attachmentAppName(document)}}</span>
<span class="app-name" *ngIf="document.appName">{{document.appName}}</span> <span class="app-name" *ngIf="document.appName">{{document.appName}}</span>
<span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" > <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> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </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-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -7,7 +7,7 @@ import { Event } from 'src/app/models/event.model';
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { SearchPage } from 'src/app/pages/search/search.page'; 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 { EventAttachment, EventAttachment_v2 } from 'src/app/models/attachment.model';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
@@ -104,7 +104,7 @@ export class NewEventPage implements OnInit {
@Output() cloneAllmobileComponent = new EventEmitter<any>(); @Output() cloneAllmobileComponent = new EventEmitter<any>();
@Output() backToChat = new EventEmitter<any>(); @Output() backToChat = new EventEmitter<any>();
documents: SearchList[] = []; documents: SearchList_v2[] = [];
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
@ViewChild('picker') picker: any; @ViewChild('picker') picker: any;
@@ -424,6 +424,7 @@ export class NewEventPage implements OnInit {
cssClass: 'modal-width-100-width-background modal', cssClass: 'modal-width-100-width-background modal',
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
eventAgenda: true,
showSearchInput: true, showSearchInput: true,
select: true select: true
} }
@@ -432,7 +433,15 @@ export class NewEventPage implements OnInit {
modal.onDidDismiss().then((res) => { modal.onDidDismiss().then((res) => {
if (res) { if (res) {
const data = res.data; 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); this.documents.push(data.selected);
console.log('pushed')
} }
}); });
@@ -537,7 +546,7 @@ export class NewEventPage implements OnInit {
this.hhtpErrorHandle.httpsSucessMessagge('new event') this.hhtpErrorHandle.httpsSucessMessagge('new event')
} }
async save() { /* async save() {
this.injectValidation() this.injectValidation()
this.runValidation() this.runValidation()
@@ -552,9 +561,9 @@ export class NewEventPage implements OnInit {
} }
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.postEvent.Subject = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Subject/* ); */ this.postEvent.Subject = this.postEvent.Subject
this.postEvent.Location = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Location/* ); */ this.postEvent.Location = this.postEvent.Location
this.postEvent.Body.Text = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Body.Text/* ); */ this.postEvent.Body.Text = this.postEvent.Body.Text
@@ -724,20 +733,6 @@ export class NewEventPage implements OnInit {
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove') 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) => { }, (error) => {
loader.remove() loader.remove()
this.showLoader = false this.showLoader = false
@@ -768,20 +763,6 @@ export class NewEventPage implements OnInit {
this.afterSave(); this.afterSave();
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove') 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) => { }, (error) => {
loader.remove() loader.remove()
this.showLoader = false this.showLoader = false
@@ -921,7 +902,7 @@ export class NewEventPage implements OnInit {
}); });
} }
} } */
selectedCalendarId() { selectedCalendarId() {
@@ -121,12 +121,12 @@
class="ion-no-margin ion-no-padding pa-0"> class="ion-no-margin ion-no-padding pa-0">
<ion-label class="width-100 d-flex align-center"> <ion-label class="width-100 d-flex align-center">
<p class="flex-grow-1 cursor-pointer" (click)="docIndex(i);LoadDocumentDetails()"> <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> <span class="span-left d-block">{{attach.Stakeholders}}</span>
</p> </p>
<div class="d-flex pr-10 cursor-pointer" (click)="docIndex(i);LoadDocumentDetails()"> <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>
<!-- <div (click)="docIndex(i);LoadDocumentDetails()" class="doc-options"> <!-- <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 { EventController } from 'src/app/controller/event'
import { DateService } from 'src/app/services/date.service'; import { DateService } from 'src/app/services/date.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service'; import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SearchList_v2 } from 'src/app/models/search-document';
@Component({ @Component({
selector: 'app-view-event', selector: 'app-view-event',
@@ -131,6 +132,9 @@ export class ViewEventPage implements OnInit {
if(res.isOk()) { if(res.isOk()) {
console.log('Loaded Event', res.value) console.log('Loaded Event', res.value)
console.log('newAttahcmentList', res.value.Attachments)
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.loadedEvent = changeDate as any;
this.setTimeZone() this.setTimeZone()