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
+17 -3
View File
@@ -10,9 +10,23 @@ 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
Source: number Source: number
SourceId: any SourceId: any
SourceName: any SourceName: any
@@ -36,7 +50,7 @@ export class SearchDocumentDetails {
export class SearchFolderDetails { export class SearchFolderDetails {
ApplicationID: number ApplicationID: number
ApplicationId: number ApplicationId: number
Assunto:string Assunto: string
DateDispatch: string DateDispatch: string
DispatchNumber: string DispatchNumber: string
Docs: string Docs: string
@@ -44,7 +58,7 @@ export class SearchFolderDetails {
DocumentsTotal: 2 DocumentsTotal: 2
IntervenerList: string[] IntervenerList: string[]
Interveners: string Interveners: string
Nature:string Nature: string
Sender: null | string Sender: null | string
SenderId: null | string SenderId: null | string
Status: string Status: string
@@ -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
} }
}); });
+26 -11
View File
@@ -44,7 +44,7 @@
<!-- Search drop down --> <!-- Search drop down -->
<div class="advance-search pa-0 pt-10 pr-10 flex-md-grow-1"> <div class="advance-search pa-0 pt-10 pr-10 flex-md-grow-1">
<ion-form > <ion-form>
<div class="searchParent"> <div class="searchParent">
<div class="d-flex search-input-container ion-justify-content-between searchChild"> <div class="d-flex search-input-container ion-justify-content-between searchChild">
@@ -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
}
+83 -9
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) {
@@ -141,8 +149,8 @@ export class SearchPage implements OnInit {
} }
myInterval = setInterval(() => { myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => { document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if(e) { if (e) {
e.disabled = true; e.disabled = true;
} }
}) })
@@ -204,7 +212,7 @@ export class SearchPage implements OnInit {
ngOnInit() { ngOnInit() {
if(this.currentPath.includes('/home/publications')) { if (this.currentPath.includes('/home/publications')) {
this.checkRoutPublication = false; this.checkRoutPublication = false;
this.checkDateEnd = true; this.checkDateEnd = true;
this.datePickerPlaceholder = 'Data Inicio*' this.datePickerPlaceholder = 'Data Inicio*'
@@ -382,8 +390,34 @@ export class SearchPage implements OnInit {
} else { } else {
this.showLoader = true; this.showLoader = true;
this.search.basicSearch(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId 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.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 = [];
@@ -536,7 +596,7 @@ export class SearchPage implements OnInit {
} else { } else {
this.showLoader = true; this.showLoader = true;
this.search.basicSearch(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => { , this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => {
if (!res.Categories.length) { if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura"; this.searchResult = "Não encontramos o que procura";
@@ -579,7 +639,7 @@ export class SearchPage implements OnInit {
} }
}); });
} }
if (this.searchSubject.trim() == "" && searchDocumentDate == null&& searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) { if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa"; this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
console.log('enter text'); console.log('enter text');
@@ -793,13 +853,13 @@ export class SearchPage implements OnInit {
// }); // });
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) { if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa"; this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
console.log('enter text'); console.log('enter text');
} else { } else {
this.showLoader = true; this.showLoader = true;
this.search.basicSearchPublication(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId this.search.basicSearchPublication(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '386').subscribe(res => { , this.searchOrganicEntiryCode, this.searchDocTypeId, '386').subscribe(res => {
if (!res.Categories.length) { if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura"; this.searchResult = "Não encontramos o que procura";
@@ -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,
}
});
}
} }
@@ -23,19 +23,19 @@ export class ApproveEventPage implements OnInit {
event: Event; event: Event;
@Input() loadedEvent: EventToApproveDetails; @Input() loadedEvent: EventToApproveDetails;
loadedAttachments:any; loadedAttachments: any;
customDate:any; customDate: any;
today:any; today: any;
show: boolean = false; show: boolean = false;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@Input() serialNumber:string; @Input() serialNumber: string;
@Input() showComponent:string; @Input() showComponent: string;
@Input() componentTransparent: any @Input() componentTransparent: any
@Input() InstanceId:string; @Input() InstanceId: string;
@Input() showAside:boolean; @Input() showAside: boolean;
@Output() approveEventDismiss = new EventEmitter<any>(); @Output() approveEventDismiss = new EventEmitter<any>();
@Output() closeEventToApprove = new EventEmitter<any>(); @Output() closeEventToApprove = new EventEmitter<any>();
@@ -53,12 +53,12 @@ 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
window['edit-approve-event-desktop'] = ()=> { window['edit-approve-event-desktop'] = () => {
this.getTask() this.getTask()
} }
} }
@@ -80,31 +80,38 @@ 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;
console.log('attachment',res.value) console.log('attachment', res.value)
this.loadedAttachments = this.loadedEvent.Attachments this.loadedAttachments = this.loadedEvent.Attachments
this.today = new Date(res.value.workflowInstanceDataFields.StartDate); 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 { } else {
console.log(res.error.status) console.log(res.error.status)
} }
} }
async approveTask(serialNumber:string) { async approveTask(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" } let body = { "serialNumber": serialNumber, "action": "Aprovar" }
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) => {
this.modalController.dismiss(serialNumber); console.log(value)
this.httpErroHandle.httpsSucessMessagge('Aprovar') this.modalController.dismiss(serialNumber);
this.TaskService.loadEventosParaAprovacao(); 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) { } catch (error) {
this.httpErroHandle.httpStatusHandle(error) this.httpErroHandle.httpStatusHandle(error)
} finally { } finally {
@@ -114,7 +121,7 @@ export class ApproveEventPage implements OnInit {
} }
async rejectTask(serialNumber:string) { async rejectTask(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" } let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
@@ -139,13 +146,13 @@ export class ApproveEventPage implements OnInit {
try { try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
} catch (error) { } 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({ const modal = await this.modalController.create({
component: ViewDocumentPage, 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({ const popover = await this.popoverController.create({
component: EventActionsPopoverPage, component: EventActionsPopoverPage,
componentProps: { componentProps: {
@@ -178,7 +185,7 @@ export class ApproveEventPage implements OnInit {
event: ev, event: ev,
translucent: true translucent: true
}); });
return await popover.present().then(() =>{ return await popover.present().then(() => {
this.TaskService.loadEventosParaAprovacao() this.TaskService.loadEventosParaAprovacao()
this.getTask() this.getTask()
}, (error) => { }, (error) => {
@@ -186,11 +193,11 @@ export class ApproveEventPage implements OnInit {
}) })
} }
async emendTask(serialNumber:string) { async emendTask(serialNumber: string) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: EmendMessageModalPage, component: EmendMessageModalPage,
componentProps:{ componentProps: {
}, },
cssClass: 'emend-message-modal', cssClass: 'emend-message-modal',
backdropDismiss: false backdropDismiss: false
@@ -199,46 +206,53 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss() modal.onDidDismiss()
.then( async (res) => { .then(async (res) => {
if(res.data.option == 'save') { if (res.data.option == 'save') {
let body = { "serialNumber": serialNumber, let body = {
"action": "Emendar", "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": { "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(); }, (error) => {
console.log(error)
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)
});
await modal.present(); await modal.present();
} }
goToEventsToApprove() { goToEventsToApprove() {
if(window.location.pathname.startsWith('/home/agenda')) { if (window.location.pathname.startsWith('/home/agenda')) {
this.close() this.close()
} else { } else {
let navigationExtras: NavigationExtras = { let navigationExtras: NavigationExtras = {
@@ -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>
@@ -56,11 +56,11 @@ export class EditEventToApprovePage implements OnInit {
showLoader = false showLoader = false
get dateStart () { get dateStart() {
return this.dateControlStart.value return this.dateControlStart.value
} }
get dateEnd () { get dateEnd() {
return this.dateControlEnd.value return this.dateControlEnd.value
} }
@@ -69,12 +69,12 @@ 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: "",
taskStartDate: "", taskStartDate: "",
workflowInstanceDataFields:{ workflowInstanceDataFields: {
Body: "", Body: "",
OccurrenceType: '', OccurrenceType: '',
Category: '', Category: '',
@@ -97,9 +97,9 @@ export class EditEventToApprovePage implements OnInit {
} }
show = false show = false
isRecurring:string; isRecurring: string;
isEventEdited: boolean; isEventEdited: boolean;
profile:string; profile: string;
eventAttendees: EventPerson[]; eventAttendees: EventPerson[];
loadedEventAttachments: Attachment[]; loadedEventAttachments: Attachment[];
@@ -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>();
@@ -130,7 +132,7 @@ export class EditEventToApprovePage implements OnInit {
private eventsService: EventsService, private eventsService: EventsService,
public alertController: AlertController, public alertController: AlertController,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private processes:ProcessesService, private processes: ProcessesService,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
public httpErrorHandler: HttpErrorHandle, public httpErrorHandler: HttpErrorHandle,
@@ -142,7 +144,7 @@ export class EditEventToApprovePage implements OnInit {
ngOnInit() { ngOnInit() {
if(this.restoreTemporaryData()){ if (this.restoreTemporaryData()) {
this.setOtherData() this.setOtherData()
} else { } else {
this.getTask(); this.getTask();
@@ -156,60 +158,60 @@ export class EditEventToApprovePage implements OnInit {
const res: any = await this.agendaDataRepository.getEventToApproveById(this.serialNumber) const res: any = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
console.log('evento to apro to edit', res.value) 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 // description
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '') let body: any = this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
this.eventProcess.workflowInstanceDataFields.Body = body this.eventProcess.workflowInstanceDataFields.Body = body
this.eventProcess.workflowInstanceDataFields.Category = this.eventProcess.workflowInstanceDataFields.EventType this.eventProcess.workflowInstanceDataFields.Category = this.eventProcess.workflowInstanceDataFields.EventType
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
this.loadedAttachments = res.value.Attachments; this.loadedAttachments = res.value.Attachments;
console.log(this.loadedAttachments) console.log(this.loadedAttachments)
this.getAttachments() this.getAttachments()
this.setOtherData() this.setOtherData()
this.saveTemporaryData() this.saveTemporaryData()
} }
getRecurrenceTypes() { getRecurrenceTypes() {
this.eventsService.getRecurrenceTypes().subscribe(res=>{ this.eventsService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res; this.recurringTypes = res;
}); });
} }
onSelectedRecurringChanged(ev:any) { onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev); this.calculetedLastOccurrence(ev);
if(ev.length > 1) { if (ev.length > 1) {
this.eventProcess.workflowInstanceDataFields.OccurrenceType = ev.filter(data => data != '-1'); this.eventProcess.workflowInstanceDataFields.OccurrenceType = ev.filter(data => data != '-1');
} }
if(ev.length == 0) { if (ev.length == 0) {
this.eventProcess.workflowInstanceDataFields.OccurrenceType = "-1"; this.eventProcess.workflowInstanceDataFields.OccurrenceType = "-1";
} }
} }
calculetedLastOccurrence(type:number){ calculetedLastOccurrence(type: number) {
var valor; var valor;
var opcao: boolean; var opcao: boolean;
if (type == 0) { if (type == 0) {
valor = 7; valor = 7;
opcao = true; opcao = true;
} else if(type == 1){ } else if (type == 1) {
valor = 30; valor = 30;
opcao = true; opcao = true;
} else if(type == 2){ } else if (type == 2) {
valor = 1; valor = 1;
opcao = false; opcao = false;
}else if(type == 3){ } else if (type == 3) {
valor = 5; valor = 5;
opcao = false; opcao = false;
} }
@@ -217,7 +219,7 @@ export class EditEventToApprovePage implements OnInit {
} }
defineLastOccurrence(valor:number, opcao:boolean){ defineLastOccurrence(valor: number, opcao: boolean) {
var time = new Date(this.eventProcess.workflowInstanceDataFields.EndDate); var time = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
if (opcao == true) { if (opcao == true) {
time.setDate(time.getDate() + valor); time.setDate(time.getDate() + valor);
@@ -236,9 +238,9 @@ export class EditEventToApprovePage implements OnInit {
} }
setOtherData() { setOtherData() {
if(this.eventProcess.workflowInstanceDataFields.ParticipantsList) { if (this.eventProcess.workflowInstanceDataFields.ParticipantsList) {
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => { this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
if(e.IsRequired) { if (e.IsRequired) {
this.taskParticipants.push(e); this.taskParticipants.push(e);
} else { } else {
this.taskParticipantsCc.push(e); this.taskParticipantsCc.push(e);
@@ -246,10 +248,10 @@ export class EditEventToApprovePage implements OnInit {
}) })
} }
this.taskParticipants = removeDuplicate(this.taskParticipants) this.taskParticipants = removeDuplicate(this.taskParticipants)
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc) this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc)
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) { if (this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
this.isRecurring = "Não se repete"; this.isRecurring = "Não se repete";
} }
else { else {
@@ -280,7 +282,7 @@ export class EditEventToApprovePage implements OnInit {
runValidation() { runValidation() {
this.validateFrom = true this.validateFrom = true
} }
injectValidation() { injectValidation() {
@@ -318,7 +320,7 @@ export class EditEventToApprovePage implements OnInit {
this.injectValidation() this.injectValidation()
this.runValidation() this.runValidation()
if(this.Form.invalid) return false if (this.Form.invalid) return false
// set dates to eventProcess object // set dates to eventProcess object
this.dateControlStart = new FormControl(moment(new Date(this.eventProcess.workflowInstanceDataFields.StartDate)).add(1, 'hours')); 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.restoreDatepickerData()
// this.getDatepickerData() // this.getDatepickerData()
this.taskParticipantsCc.forEach( e => { this.taskParticipantsCc.forEach(e => {
e.IsRequired = false 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 = 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 delete e.$type
} }
}) })
@@ -375,48 +377,52 @@ 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) {
console.log(value) this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.loadedAttachments }).subscribe((value) => {
}, ((error) => { console.log(value)
this.showLoader = false }, ((error) => {
console.log('add attachment error: ', error) this.showLoader = false
})); 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()
this.httpErrorHandler.httpsSucessMessagge('Editar evento'); this.httpErrorHandler.httpsSucessMessagge('Editar evento');
} catch(e) { } catch (e) {
this.httpErrorHandler.httpStatusHandle(e); this.httpErrorHandler.httpStatusHandle(e);
this.toastService._badRequest('Evento não editado'); this.toastService._badRequest('Evento não editado');
} }
this.loadedAttachments.forEach((document:any)=>{ this.loadedAttachments.forEach((document: any) => {
if(document['action'] == 'add') { if (document['action'] == 'add') {
delete document.action delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{ this.attachmentsService.setEventAttachmentById(document).subscribe(() => {
window['edit-approve-event-desktop']() window['edit-approve-event-desktop']()
}, error =>{ }, error => {
this.toastService.badRequest(); this.toastService.badRequest();
}); });
} else if(document['action'] == 'delete') { } else if (document['action'] == 'delete') {
delete document.action delete document.action
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{ this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe(res => {
window['edit-approve-event-desktop']() window['edit-approve-event-desktop']()
}, error =>{ }, error => {
this.toastService.badRequest() this.toastService.badRequest()
}) })
} }
@@ -462,7 +468,7 @@ export class EditEventToApprovePage implements OnInit {
await this.save(); await this.save();
if(this.eventProcess['activityInstanceName'] == 'Editar Evento') { if (this.eventProcess['activityInstanceName'] == 'Editar Evento') {
this.reenviar(); this.reenviar();
} }
@@ -472,7 +478,7 @@ export class EditEventToApprovePage implements OnInit {
let body = { let body = {
serialNumber: this.eventProcess.serialNumber, serialNumber: this.eventProcess.serialNumber,
action: "Reenviar", action: "Reenviar",
dataFields: { dataFields: {
ReviewUserComment: "", ReviewUserComment: "",
} }
} }
@@ -484,13 +490,13 @@ export class EditEventToApprovePage implements OnInit {
this.toastService._successMessage(); this.toastService._successMessage();
this.goToApproveEventList(); this.goToApproveEventList();
} catch (error) { } catch (error) {
if(error.status == 0) { if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão') this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else { } else {
this.toastService._badRequest(); this.toastService._badRequest();
} }
} finally { } finally {
loader.remove() loader.remove()
} }
} }
@@ -500,9 +506,9 @@ export class EditEventToApprovePage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) { dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = removeDuplicate(taskParticipants) ; this.taskParticipants = removeDuplicate(taskParticipants);
this.taskParticipantsCc = removeDuplicate(taskParticipantsCc) ; this.taskParticipantsCc = removeDuplicate(taskParticipantsCc);
} }
@@ -539,9 +545,9 @@ export class EditEventToApprovePage implements OnInit {
restoreTemporaryData(): boolean { 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 this.eventProcess = restoredData.eventProcess
// restore dater for date and hours picker // restore dater for date and hours picker
@@ -559,10 +565,10 @@ export class EditEventToApprovePage implements OnInit {
try { try {
result = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise(); result = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
} catch (error) { } catch (error) {
console.error('getAttachment',error) console.error('getAttachment', error)
} }
result.forEach((e)=>{ result.forEach((e) => {
e.action = false e.action = false
}) })
@@ -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,16 +591,17 @@ export class EditEventToApprovePage implements OnInit {
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
eventAgenda: true,
select: true, select: true,
} }
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then(async (res) => {
if(res){ if (res) {
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()