mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
improve setup meeting from task
This commit is contained in:
@@ -29,32 +29,34 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div" (click)="changeAgenda()">
|
||||
<div *ngIf="(sharedCalendar | async) as calendarData" class="container-div" >
|
||||
<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>
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
|
||||
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
|
||||
|
||||
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
|
||||
<mat-option *ngFor="let calendars of _eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
<div *ngIf="utils.hasPrCalendar(calendarData) && !hasChangeCalendar " style="margin-bottom: -20px;">PR </div>
|
||||
<div *ngIf="selectedUserCalendar == SessionStore.user.UserId && !hasChangeCalendar && SessionStore.user.Profile != 'PR'" style="margin-bottom: -20px;">
|
||||
Minha agenda
|
||||
</div>
|
||||
<mat-select [(value)]="selectedUserCalendar" (selectionChange)="changeAgenda();changeSegmentCalendar()">
|
||||
|
||||
<mat-option *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}">
|
||||
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGENDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId"> Agenda {{calendars.wxFullName}} </div>
|
||||
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId && SessionStore.user.Profile != 'PR'">
|
||||
Minha agenda
|
||||
</div>
|
||||
|
||||
</mat-option>
|
||||
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,42 +103,6 @@
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
<div *ngIf="(sharedCalendar | async) as calendarData" class="container-div" >
|
||||
<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>
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<div *ngIf="utils.hasPrCalendar(calendarData) && !hasChangeCalendar " style="margin-bottom: -20px;">PR</div>
|
||||
<div *ngIf="selectedUserCalendar == sessionStore.user.UserId && !hasChangeCalendar && sessionStore.user.Profile != 'PR' " style="margin-bottom: -20px;">
|
||||
Minha agenda
|
||||
</div>
|
||||
|
||||
<mat-select [(value)]="selectedUserCalendar" (selectionChange)="changeAgenda();changeSegmentCalendar()">
|
||||
|
||||
<mat-option *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}">
|
||||
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != sessionStore.user.RoleID">AGENDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != sessionStore.user.UserId"> Agenda do {{calendars.wxFullName}} </div>
|
||||
<div *ngIf="calendars.wxUserId == sessionStore.user.UserId && sessionStore.user.Profile != 'PR'">
|
||||
Minha agenda
|
||||
</div>
|
||||
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
|
||||
@@ -22,7 +22,6 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/module/agenda/data/repository/agenda-data-repository.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -30,6 +29,8 @@ import { TableSharedCalendar } from 'src/app/module/agenda/data/data-source/agen
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { RoleIdService } from 'src/app/services/role-id.service';
|
||||
import { Utils } from 'src/app/module/agenda/utils';
|
||||
import { AgendaService } from 'src/app/module/agenda/domain/agenda.service'
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -110,6 +111,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
sharedCalendar: Observable<TableSharedCalendar[]>
|
||||
selectedUserCalendar:any;
|
||||
sessionStore = SessionStore;
|
||||
SessionStore=SessionStore
|
||||
hasChangeCalendar = false
|
||||
eventRecurence = 'never';
|
||||
|
||||
@@ -125,10 +127,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
public _eventService: EventsService,
|
||||
private httpErroHandle: HttpErrorHandle,
|
||||
public TaskService: TaskService,
|
||||
private contactsService: ContactsService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService,
|
||||
public RoleIdService: RoleIdService,
|
||||
public utils: Utils,
|
||||
private AgendaService: AgendaService
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
this.document = this.navParams.get('document')
|
||||
@@ -203,6 +205,23 @@ export class DocumentSetUpMeetingPage 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.agendaDataRepository.getSharedCalendar()
|
||||
|
||||
this.sharedCalendar = this.agendaDataRepository.getShareCalendarItemsLive().pipe(
|
||||
map(data => data.sort((a, b) => {
|
||||
const priorityA = rolePriorities[a.roleId] || Infinity;
|
||||
const priorityB = rolePriorities[b.roleId] || Infinity;
|
||||
return priorityA - priorityB;
|
||||
}))
|
||||
)
|
||||
|
||||
this.changeAgenda()
|
||||
|
||||
this.postData.EventRecurrence = {
|
||||
@@ -218,7 +237,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
ngOnInit() {
|
||||
this.adding = "intervenient";
|
||||
this.setDefaultTime()
|
||||
this.getRecurrenceTypes();
|
||||
// this.getRecurrenceTypes();
|
||||
this.fetchContacts("")
|
||||
this.setCalendarByDefault(true)
|
||||
}
|
||||
@@ -258,11 +277,11 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
})
|
||||
}, 1000);
|
||||
|
||||
getRecurrenceTypes() {
|
||||
this.calendarService.getRecurrenceTypes().subscribe(res => {
|
||||
this.recurringTypes = res;
|
||||
});
|
||||
}
|
||||
// getRecurrenceTypes() {
|
||||
// this.calendarService.getRecurrenceTypes().subscribe(res => {
|
||||
// this.recurringTypes = res;
|
||||
// });
|
||||
// }
|
||||
|
||||
setDefaultTime() {
|
||||
this.setStartDate()
|
||||
@@ -551,20 +570,6 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
selectedCalendarId() {
|
||||
|
||||
if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postData.CalendarName == 'Oficial') {
|
||||
return this._eventService.calendarNamesType[this.CalendarName]['OficialId']
|
||||
|
||||
} else if (this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal'] && this.postData.CalendarName == 'Pessoal') {
|
||||
|
||||
return this._eventService.calendarNamesType[this.CalendarName]['PessoalId']
|
||||
|
||||
} else {
|
||||
return '11:11'
|
||||
}
|
||||
}
|
||||
|
||||
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
|
||||
this.taskParticipants = taskParticipants;
|
||||
this.taskParticipantsCc = taskParticipantsCc;
|
||||
@@ -612,37 +617,18 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
return _date
|
||||
}
|
||||
|
||||
checkRoleInArray(str) {
|
||||
return this._eventService.calendarRole.includes(str);
|
||||
}
|
||||
|
||||
async fetchContacts(filter: string) {
|
||||
|
||||
if (this.loggeduser.Profile == 'PR') {
|
||||
this.contactsService.getContacts(filter).subscribe(result => {
|
||||
if (this.eventPersons != null) {
|
||||
this.eventPersons.forEach(attendee => {
|
||||
const index: number = result.findIndex((cont) => {
|
||||
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
|
||||
});
|
||||
const result = await this.AgendaService.setDefaultParticipants()
|
||||
|
||||
result.splice(index, 1);
|
||||
|
||||
});
|
||||
}
|
||||
this.contacts = result;
|
||||
//console.log('Attendes Email', this.loggeduser.Email)
|
||||
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
|
||||
//console.log('Attendes Email', filterLoggedUserEmail)
|
||||
|
||||
this.contacts = filterLoggedUserEmail;
|
||||
const newAttendees: EventPerson[] = this.contacts;
|
||||
|
||||
this.setIntervenient(newAttendees);
|
||||
//console.log('Attendes Email', this.contacts)
|
||||
if(result.isOk()) {
|
||||
if(result.value) {
|
||||
this.setIntervenient(result.value);
|
||||
console.log('Attendes Email', result.value)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user