mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
fix ownertype and category type
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<ion-header class="ion-no-border">
|
||||
<div class="header-content">
|
||||
<div class="header-title d-flex align-center justify-between width-100">
|
||||
<div class="flex-grow-1">Eventos para Aprovação</div>
|
||||
<div class="flex-grow-1">Eventos para aprovação</div>
|
||||
<div (click)="refreshing()">
|
||||
<button title="Atualizar" class="btn-no-color" >
|
||||
<ion-icon class=" font-45-em" src="assets/images/theme/gov/icon-reload.svg"></ion-icon>
|
||||
|
||||
@@ -188,22 +188,15 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.setCalendarByDefault(true)
|
||||
|
||||
this.changeProfileService.registerCallback(() => {
|
||||
this.initializeData()
|
||||
})
|
||||
|
||||
if (!this.CalendarName) {
|
||||
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
|
||||
this.CalendarName = 'Meu calendario';
|
||||
} else {
|
||||
this.CalendarName = this.eventService.calendarNamesAry[0]
|
||||
}
|
||||
}
|
||||
|
||||
this.getRecurrenceTypes();
|
||||
if (!this.restoreTemporaryData()) {
|
||||
// clear
|
||||
this.setCalendarByDefault(true)
|
||||
this.eventBody = { BodyType: "1", Text: "" };
|
||||
this.postEvent.Body = this.eventBody;
|
||||
|
||||
@@ -226,6 +219,8 @@ export class NewEventPage implements OnInit {
|
||||
this.setIntervenientCC.emit(this.taskParticipantsCc);
|
||||
|
||||
this.setDefaultTime();
|
||||
} else {
|
||||
this.hasChangeCalendar = true
|
||||
}
|
||||
|
||||
|
||||
@@ -588,379 +583,6 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
/* async save() {
|
||||
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if (this.Form.invalid) {
|
||||
|
||||
if (new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime()) {
|
||||
this.toastService._badRequest("Data de inicio menor que a data de fim")
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
this.postEvent.Subject = this.postEvent.Subject
|
||||
this.postEvent.Location = this.postEvent.Location
|
||||
this.postEvent.Body.Text = this.postEvent.Body.Text
|
||||
|
||||
|
||||
|
||||
if (this.documents.length > 0) {
|
||||
this.postEvent.HasAttachments = true;
|
||||
}
|
||||
|
||||
if (this.postEvent.EventRecurrence.Type == undefined) {
|
||||
this.postEvent.EventRecurrence.Type = '-1'
|
||||
}
|
||||
|
||||
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
this.showLoader = true;
|
||||
this.postEvent.CalendarId = CalendarId
|
||||
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
async (id) => {
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
const eventId: any = id;
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
return {
|
||||
SourceTitle: e.Assunto,
|
||||
ParentId: eventId,
|
||||
Source: '1',
|
||||
SourceId: e.Id,
|
||||
ApplicationId: e.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
await DocumentToSave.forEach((attachments, i) => {
|
||||
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
|
||||
if (DocumentToSave.length == (i + 1)) {
|
||||
this.afterSave();
|
||||
}
|
||||
});
|
||||
});
|
||||
if (DocumentToSave.length == 0) {
|
||||
this.afterSave();
|
||||
}
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event')
|
||||
let data = {
|
||||
"subject": this.postEvent.Subject,
|
||||
"start": this.postEvent.StartDate,
|
||||
"end": this.postEvent.EndDate,
|
||||
"venue": this.postEvent.Location,
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
|
||||
},
|
||||
error => {
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.hhtpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
|
||||
}
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
let loader = this.toastService.loading();
|
||||
this.postEvent.CalendarId = CalendarId
|
||||
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
(id) => {
|
||||
|
||||
loader.remove()
|
||||
|
||||
const eventId: any = id;
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
return {
|
||||
SourceTitle: e.Assunto,
|
||||
ParentId: eventId,
|
||||
Source: '1',
|
||||
SourceId: e.Id,
|
||||
ApplicationId: e.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
|
||||
DocumentToSave.forEach((attachments, i) => {
|
||||
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
|
||||
if (DocumentToSave.length == (i + 1)) {
|
||||
this.afterSave();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (DocumentToSave.length == 0) {
|
||||
this.afterSave();
|
||||
}
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event')
|
||||
let data = {
|
||||
"subject": this.postEvent.Subject,
|
||||
"start": this.postEvent.StartDate,
|
||||
"end": this.postEvent.EndDate,
|
||||
"venue": this.postEvent.Location,
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
}, (error) => {
|
||||
|
||||
//const connectionToServer = this.ServerConnectionService.BaseAPI()
|
||||
|
||||
this.hhtpErrorHandle.httpStatusHandle(error)
|
||||
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
|
||||
});
|
||||
|
||||
} else if (this.loggeduser.Profile == 'SGGPR') {
|
||||
|
||||
console.log(this.postEventToAprove)
|
||||
console.log(this.postEvent)
|
||||
console.log(this.postEvent.CalendarName)
|
||||
console.log(this.CalendarName)
|
||||
console.log(this.eventService.calendarNamesAry)
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
|
||||
let selectedCalendar
|
||||
try {
|
||||
selectedCalendar = this.eventService.calendarNamesAry.find(calendar => calendar.Fullname === this.CalendarName)
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
console.log('selectedCalendar', selectedCalendar)
|
||||
|
||||
if (selectedCalendar) {
|
||||
if (selectedCalendar.Role = 'Presidente da República') {
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
return {
|
||||
SourceTitle: e.Assunto,
|
||||
ParentId: "AGD_" + this.loggeduser.UserName + "_" + this.processeService.generateInstaceFormatDate(),
|
||||
Source: '1',
|
||||
SourceId: e.Id,
|
||||
ApplicationId: e.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
|
||||
let body = this.eventToaproveBody(this.postEvent, CalendarId, this.loggeduser.RoleID, this.loggeduser.UserId, DocumentToSave);
|
||||
await this.processeService.createEventToAprove(this.postEvent.CalendarName, 'pr', body).subscribe((id) => {
|
||||
loader.remove()
|
||||
this.afterSave();
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove')
|
||||
|
||||
|
||||
}, (error) => {
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.hhtpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
|
||||
|
||||
|
||||
} else if (selectedCalendar.Role = 'Ministro e Director do Gabinete do PR') {
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
return {
|
||||
SourceTitle: e.Assunto,
|
||||
ParentId: "AGD_" + this.loggeduser.UserName + "_" + this.processeService.generateInstaceFormatDate(),
|
||||
Source: '1',
|
||||
SourceId: e.Id,
|
||||
ApplicationId: e.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
|
||||
let body = this.eventToaproveBody(this.postEvent, CalendarId, this.loggeduser.RoleID, this.loggeduser.UserId, DocumentToSave);
|
||||
await this.processeService.createEventToAprove(this.postEvent.CalendarName, 'md', body).subscribe((id) => {
|
||||
loader.remove()
|
||||
this.afterSave();
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove')
|
||||
|
||||
}, (error) => {
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.hhtpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!selectedCalendar && this.CalendarName == "Meu calendario") {
|
||||
console.log('SG generic')
|
||||
this.postEvent.CalendarName
|
||||
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
this.postEvent.CalendarId = CalendarId
|
||||
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
(id) => {
|
||||
loader.remove();
|
||||
|
||||
const eventId: any = id;
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
return {
|
||||
SourceTitle: e.Assunto,
|
||||
ParentId: eventId,
|
||||
Source: '1',
|
||||
SourceId: e.Id,
|
||||
ApplicationId: e.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
|
||||
DocumentToSave.forEach((attachments, i) => {
|
||||
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
|
||||
if (DocumentToSave.length == (i + 1)) {
|
||||
this.afterSave();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (DocumentToSave.length == 0) {
|
||||
this.afterSave();
|
||||
}
|
||||
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event')
|
||||
let data = {
|
||||
"subject": this.postEvent.Subject,
|
||||
"start": this.postEvent.StartDate,
|
||||
"end": this.postEvent.EndDate,
|
||||
"venue": this.postEvent.Location,
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
}, (error) => {
|
||||
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.hhtpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
this.postEvent.CalendarName
|
||||
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
this.postEvent.CalendarId = CalendarId
|
||||
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
(id) => {
|
||||
loader.remove();
|
||||
|
||||
const eventId: any = id;
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
return {
|
||||
SourceTitle: e.Assunto,
|
||||
ParentId: eventId,
|
||||
Source: '1',
|
||||
SourceId: e.Id,
|
||||
ApplicationId: e.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
|
||||
DocumentToSave.forEach((attachments, i) => {
|
||||
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
|
||||
if (DocumentToSave.length == (i + 1)) {
|
||||
this.afterSave();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (DocumentToSave.length == 0) {
|
||||
this.afterSave();
|
||||
}
|
||||
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event')
|
||||
let data = {
|
||||
"subject": this.postEvent.Subject,
|
||||
"start": this.postEvent.StartDate,
|
||||
"end": this.postEvent.EndDate,
|
||||
"venue": this.postEvent.Location,
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
}, (error) => {
|
||||
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.hhtpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
|
||||
}
|
||||
} */
|
||||
|
||||
selectedCalendarId() {
|
||||
|
||||
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postEvent.CalendarName == 'Oficial') {
|
||||
|
||||
return this.eventService.calendarNamesType[this.CalendarName]['OficialId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal'] && this.postEvent.CalendarName == 'Pessoal') {
|
||||
|
||||
return this.eventService.calendarNamesType[this.CalendarName]['PessoalId']
|
||||
|
||||
} else {
|
||||
|
||||
return '11:11'
|
||||
}
|
||||
}
|
||||
|
||||
afterSave() {
|
||||
this.deleteTemporaryData();
|
||||
@@ -1039,7 +661,7 @@ export class NewEventPage implements OnInit {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1047,31 +669,6 @@ export class NewEventPage implements OnInit {
|
||||
window['temp.path:/home/agenda/new-event.component.ts'] = {}
|
||||
}
|
||||
|
||||
eventToaproveBody(event, calendarId, role, userId, attachments) {
|
||||
let toAproveObject = {
|
||||
"EventProcess": {
|
||||
"Body": event.Body,
|
||||
"Location": event.Location,
|
||||
"Subject": event.Subject,
|
||||
"StartDate": event.StartDate,
|
||||
"EndDate": event.EndDate,
|
||||
"Status": "Active",
|
||||
"IsAllDayEvent": event.IsRecurring,
|
||||
"EventType": event.EventType,
|
||||
"ParticipantsList": event.Attendees,
|
||||
"EventRecurrence": event.EventRecurrence,
|
||||
"HasAttachments": event.HasAttachments,
|
||||
"CalendarId": calendarId,
|
||||
"Role": role,
|
||||
"wxUserID": userId,
|
||||
"TimeZone": "W. Central Africa Standard Time"
|
||||
},
|
||||
"Attachments": attachments,
|
||||
"InstanceID": "AGD_" + this.loggeduser.UserName + "_" + this.processeService.generateInstaceFormatDate()
|
||||
}
|
||||
|
||||
return toAproveObject;
|
||||
}
|
||||
|
||||
async fetchContacts(filter: string) {
|
||||
console.log(this.loggeduser.Profile)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||
<div class="title width-100">
|
||||
<div class="title-container d-flex justify-space-between">
|
||||
<span class="text-center mt-0 aside-title"><label>Eventos para Aprovação</label></span>
|
||||
<span class="text-center mt-0 aside-title"><label>Eventos para aprovação</label></span>
|
||||
<div class="d-flex align-center">
|
||||
<div>
|
||||
<div class="d-flex" (click)="reorderList('old')" *ngIf="ordinance == 'recent' ">
|
||||
|
||||
Reference in New Issue
Block a user