mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix ownertype and category type
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<ion-header>
|
||||
<div class="title-content">
|
||||
<div class="middle">
|
||||
<ion-label id="vsdfajnl" class="title" style="font-size: 21.1px">Editar Evento[]</ion-label>
|
||||
<ion-label id="vsdfajnl" class="title" style="font-size: 21.1px">Editar Evento</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
</ion-header>
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
|
||||
<div *ngIf="(sharedCalendar | async) as calendarData" class="container-div" >
|
||||
<div *ngIf="(sharedCalendar | async) as calendarData" class="container-div width-100" >
|
||||
<div class="ion-item-class-2 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div *ngIf="selectedUserCalendar == SessionStore.user.UserId && !hasChangeCalendar && SessionStore.user.Profile != 'PR'" style="margin-bottom: -20px;">
|
||||
Minha agenda
|
||||
</div>
|
||||
<mat-select [(value)]="hasChangeCalendar" (selectionChange)="changeAgenda();changeSegmentCalendar()">
|
||||
<mat-select [(value)]="selectedUserCalendar" (selectionChange)="changeAgenda();changeSegmentCalendar()">
|
||||
|
||||
<mat-option *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}">
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import { EventBody } from 'src/app/models/eventbody.model';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { SearchList } from 'src/app/models/search-document';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { Event } from '../../../models/event.model';
|
||||
@@ -15,13 +14,11 @@ import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, ThemePalette } from '@angular/material/core';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
@@ -127,17 +124,13 @@ export class NewEventPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
public eventService: EventsService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private toastService: ToastService,
|
||||
public ThemeService: ThemeService,
|
||||
private platform: Platform,
|
||||
private chatMethodService: ChatMethodsService,
|
||||
private hhtpErrorHandle: HttpErrorHandle,
|
||||
private processeService: ProcessesService,
|
||||
public TaskService: TaskService,
|
||||
private contactsService: ContactsService,
|
||||
private domSanitazerService: DomSanitizerService,
|
||||
private dateAdapter: DateAdapter<Date>,
|
||||
private agendaDataRepository: AgendaDataRepositoryService,
|
||||
public RoleIdService: RoleIdService,
|
||||
) {
|
||||
@@ -495,7 +488,6 @@ export class NewEventPage implements OnInit {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
const calendar = await this.agendaDataRepository.getCalendarByUserId(this.selectedUserCalendar)
|
||||
if(calendar.isOk()) {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="header-title">
|
||||
<label>Eventos para Aprovação</label>
|
||||
<label> Eventos para aprovação</label>
|
||||
</div>
|
||||
<div style="float:right" *ngIf="showFilter" class="d-flex align-center">
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<ion-toolbar>
|
||||
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)" *ngIf="SessionStore.user.RoleID !== 100000014 && (sharedCalendar | async) as calendarData">
|
||||
<ion-segment [(ngModel)]="selectedUserCalendar" (ionChange)="segmentChanged($event)" *ngIf="SessionStore.user.RoleID !== 100000014 && (sharedCalendar | async) as calendarData">
|
||||
<!-- <ion-segment-button value="MDGPR">
|
||||
Minha agenda
|
||||
</ion-segment-button> -->
|
||||
|
||||
@@ -34,7 +34,6 @@ export class EventListPage implements OnInit {
|
||||
// [desktop] event list to approve
|
||||
|
||||
profile: string;
|
||||
segment: any;
|
||||
showLoader: boolean;
|
||||
eventPerson: EventPerson;
|
||||
eventBody: EventBody;
|
||||
@@ -62,7 +61,6 @@ export class EventListPage implements OnInit {
|
||||
selectedUserCalendar:any;
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
private sortService: SortService,
|
||||
@@ -83,26 +81,6 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
this.eventService.onCalendarFinishLoad.subscribe(() => {
|
||||
if(!this.segment) {
|
||||
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
|
||||
this.segment = 'Meu calendario';
|
||||
} else {
|
||||
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
|
||||
}
|
||||
|
||||
// select pr by default
|
||||
const pr = this.eventService.calendarNamesAry.find( e => e.Role == 'Presidente da República')
|
||||
if(pr) {
|
||||
this.segment = pr.OwnerUserId
|
||||
}
|
||||
|
||||
this.dynamicSearch()
|
||||
} else {
|
||||
this.dynamicSearch()
|
||||
}
|
||||
})
|
||||
|
||||
this.listSubscription = this.eventoaprovacaostore.registerCallback({
|
||||
id: import.meta.url,
|
||||
funx:() => {
|
||||
@@ -140,26 +118,8 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Define the role priorities
|
||||
const rolePriorities: { [key: number]: number } = {
|
||||
100000014: 1, // Presidente da República
|
||||
100000011: 2, // Vice Presidente (example role ID)
|
||||
// Add other roles with their priorities here
|
||||
};
|
||||
|
||||
this.sharedCalendar = this.AgendaDataRepositoryService.getShareCalendarItemsLive().pipe(
|
||||
map(data => data.sort((a, b) => {
|
||||
console.log('Raw data:', data); // Debug line
|
||||
const priorityA = rolePriorities[a.roleId] || Infinity;
|
||||
const priorityB = rolePriorities[b.roleId] || Infinity;
|
||||
return priorityA - priorityB;
|
||||
}))
|
||||
)
|
||||
|
||||
this.eventService.onCalendarFinishLoad.subscribe(async() => {
|
||||
this.setCalendarByDefault()
|
||||
})
|
||||
this.sharedCalendar = this.AgendaDataRepositoryService.getShareCalendarItemsLiveWithOrder()
|
||||
this.setCalendarByDefault();
|
||||
|
||||
}
|
||||
|
||||
@@ -173,6 +133,9 @@ export class EventListPage implements OnInit {
|
||||
} else {
|
||||
this.selectedUserCalendar = SessionStore.user.UserId
|
||||
}
|
||||
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -180,10 +143,7 @@ export class EventListPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
|
||||
|
||||
}
|
||||
ngAfterViewInit(): void {}
|
||||
|
||||
reorderList(orderBy: string) {
|
||||
|
||||
@@ -197,7 +157,7 @@ export class EventListPage implements OnInit {
|
||||
|
||||
if(this.showSearch && this.searchSubject) {
|
||||
|
||||
const list = this.eventoaprovacaostore.get(this.segment).filter((task) => {
|
||||
const list = this.eventoaprovacaostore.get(this.selectedUserCalendar).filter((task) => {
|
||||
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
|
||||
subject = subject.toLowerCase();
|
||||
return subject.includes(this.searchSubject.toLowerCase())
|
||||
@@ -205,7 +165,7 @@ export class EventListPage implements OnInit {
|
||||
|
||||
this.list = this.TaskService.reorderList(this.ordinance, list)
|
||||
} else {
|
||||
const list = this.eventoaprovacaostore.get(this.segment)
|
||||
const list = this.eventoaprovacaostore.get(this.selectedUserCalendar)
|
||||
|
||||
this.list = this.TaskService.reorderList(this.ordinance, list)
|
||||
}
|
||||
@@ -221,52 +181,59 @@ export class EventListPage implements OnInit {
|
||||
async LoadToApproveEvents(tracing?: TracingType) {
|
||||
console.log('aprove event')
|
||||
this.showLoader = true;
|
||||
this.skeletonLoader = true
|
||||
|
||||
const segment: any = this.segment
|
||||
let userId;
|
||||
|
||||
if(this.segment == 'Meu calendario') {
|
||||
if(SessionStore.user.Profile == 'PR') {
|
||||
const segment = this.selectedUserCalendar
|
||||
|
||||
if(segment) {
|
||||
let userId;
|
||||
|
||||
if(this.selectedUserCalendar == SessionStore.user.UserId) {
|
||||
// color
|
||||
if(SessionStore.user.Profile == 'PR') {
|
||||
this.color = 'pr'
|
||||
} else {
|
||||
this.color = 'mdgpr'
|
||||
}
|
||||
userId = SessionStore.user.UserId
|
||||
|
||||
} else if(segment) {
|
||||
this.color = 'pr'
|
||||
} else {
|
||||
this.color = 'mdgpr'
|
||||
userId = this.selectedUserCalendar
|
||||
}
|
||||
userId = SessionStore.user.UserId
|
||||
|
||||
} else if(segment) {
|
||||
this.color = 'pr'
|
||||
userId = segment
|
||||
}
|
||||
|
||||
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||
userId,
|
||||
status: EEventFilterStatus.Pending
|
||||
}, tracing)
|
||||
this.skeletonLoader = true
|
||||
|
||||
if(allEvents.isOk()) {
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||
userId,
|
||||
status: EEventFilterStatus.Pending
|
||||
}, tracing)
|
||||
|
||||
if(allEvents.value.length >= 1) {
|
||||
const eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||
this.eventoaprovacaostore.save(segment, eventsList)
|
||||
} else {
|
||||
if(allEvents.isOk()) {
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
if(allEvents.value.length >= 1) {
|
||||
const eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||
this.eventoaprovacaostore.save(segment, eventsList)
|
||||
} else {
|
||||
this.eventoaprovacaostore.save(segment, [])
|
||||
}
|
||||
} else {
|
||||
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing.bugFlag()
|
||||
if(!isHttpError(allEvents.error)) {
|
||||
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #4')
|
||||
}
|
||||
this.eventoaprovacaostore.save(segment, [])
|
||||
// this.showLoader = false;
|
||||
}
|
||||
} else {
|
||||
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing.bugFlag()
|
||||
if(!isHttpError(allEvents.error)) {
|
||||
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #4')
|
||||
}
|
||||
this.eventoaprovacaostore.save(segment, [])
|
||||
// this.showLoader = false;
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
this.skeletonLoader = false
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ export class AgendaDataRepositoryService {
|
||||
}
|
||||
|
||||
createEvent(eventData: Event, documents, calendar: TableSharedCalendar) {
|
||||
console.log('create repository 1',eventData)
|
||||
console.log('create repository 1',eventData, calendar)
|
||||
|
||||
let eventInput = {
|
||||
userId: calendar.wxUserId,
|
||||
@@ -211,6 +211,8 @@ export class AgendaDataRepositoryService {
|
||||
}
|
||||
}
|
||||
|
||||
console.log({eventData})
|
||||
|
||||
return this.agendaDataService.updateEvent(eventId, eventInput)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ export class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
selectedCalendarOwner(CalendarName) {
|
||||
let selectedCalendar = this.findRoleIdByUserId(this.eventService.calendarNamesAry, CalendarName);
|
||||
console.log('selected', selectedCalendar )
|
||||
if (selectedCalendar) {
|
||||
if (selectedCalendar == "Presidente da República") {
|
||||
selectedCalendarOwner(roleDescription) {
|
||||
|
||||
console.log('roleDescription', roleDescription)
|
||||
if (roleDescription) {
|
||||
if (roleDescription == "Presidente da República") {
|
||||
return 1;
|
||||
} else if (selectedCalendar == "Ministro e Director do Gabinete do PR") {
|
||||
} else if (roleDescription == "Ministro e Director do Gabinete do PR") {
|
||||
return 2
|
||||
} else {
|
||||
return 3
|
||||
@@ -60,6 +60,11 @@ export class Utils {
|
||||
'Oficial': 1,
|
||||
'Pessoal': 2
|
||||
}
|
||||
|
||||
if(calendarName != 'Pessoal' && calendarName != 'Oficial') {
|
||||
throw('bad logic')
|
||||
}
|
||||
|
||||
return selectedCalendar[calendarName];
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export function APIReturn(schema: z.ZodTypeAny, path: string) {
|
||||
console.error('unexpected data structure', path)
|
||||
// Capture the Zod validation error with additional context
|
||||
console.error('Validation failed:', error.errors);
|
||||
console.log(result.value)
|
||||
} else {
|
||||
// Throw any other unexpected errors
|
||||
// throw error;
|
||||
@@ -53,6 +54,7 @@ export function APINODReturn(schema: z.ZodTypeAny, data , path: string, tracing?
|
||||
console.error('unexpected data structure', path)
|
||||
// Capture the Zod validation error with additional context
|
||||
console.error('Validation failed:', error.errors);
|
||||
console.log(data)
|
||||
|
||||
tracing?.setAttribute('APIReturn.error', 'true')
|
||||
|
||||
|
||||
@@ -320,19 +320,13 @@ export class TaskService {
|
||||
// PR dont have event to approve
|
||||
/* if(this.SessionStore.user.Profile != 'PR') { */
|
||||
try {
|
||||
for(let calendar of this.eventService.calendarNamesAry) {
|
||||
|
||||
let userId;
|
||||
const list = await this.AgendaDataRepositoryService.geCalendars()
|
||||
|
||||
if(calendar == 'Meu calendario') {
|
||||
userId = SessionStore.user.UserId
|
||||
|
||||
} else {
|
||||
userId = calendar.OwnerUserId
|
||||
}
|
||||
for(let calendar of list) {
|
||||
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||
userId,
|
||||
userId: calendar.wxUserId,
|
||||
status: EEventFilterStatus.Pending
|
||||
}, tracing)
|
||||
|
||||
@@ -342,9 +336,9 @@ export class TaskService {
|
||||
let eventsList = []
|
||||
if(allEvents.value.length >= 1) {
|
||||
eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||
this.eventoaprovacaostore.save(userId, eventsList)
|
||||
this.eventoaprovacaostore.save(calendar.wxUserId as any, eventsList)
|
||||
} else {
|
||||
this.eventoaprovacaostore.save(userId, [])
|
||||
this.eventoaprovacaostore.save(calendar.wxUserId as any, [])
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
@@ -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' ">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "01530505c",
|
||||
"SHA": "01530505c959ebfe9b9142c8c9a6de009efa9632",
|
||||
"shortSHA": "558810ab8",
|
||||
"SHA": "558810ab83f47b59507765552673fd0b687155f2",
|
||||
"branch": "feature/agenda-api-peter",
|
||||
"lastCommitAuthor": "'Peter Maquiran'",
|
||||
"lastCommitTime": "'Fri Jun 21 16:38:19 2024 +0100'",
|
||||
"lastCommitMessage": "ITOTEAM-527 permission and attachment count",
|
||||
"lastCommitNumber": "5834",
|
||||
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 5 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: .husky/pre-commit\n\tmodified: version/git-version.ts",
|
||||
"lastCommitTime": "'Fri Jun 21 16:43:02 2024 +0100'",
|
||||
"lastCommitMessage": "include husky change to the commit",
|
||||
"lastCommitNumber": "5835",
|
||||
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 6 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.html\n\tmodified: src/app/pages/agenda/new-event/new-event.page.html\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.html\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.ts\n\tmodified: src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts\n\tmodified: src/app/services/Repositorys/Agenda/utils.ts\n\tmodified: src/app/services/decorator/api-validate-schema.decorator.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/agenda/event-list/event-list.page.html\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html\n\tmodified: version/git-version.ts",
|
||||
"changeAuthor": "peter.maquiran"
|
||||
}
|
||||
Reference in New Issue
Block a user