added MD as default interveninete when PR are creating events ou mettings

This commit is contained in:
Eudes Inácio
2023-11-07 11:44:13 +01:00
parent e352956350
commit f4e0d56946
11 changed files with 219 additions and 65 deletions
@@ -69,7 +69,7 @@
appearance="fill" appearance="fill"
class="width-100 d-block" class="width-100 d-block"
appearance="none"> appearance="none">
<mat-select [multiple]="false" [(ngModel)]="selectedTypes" placeholder="Selecione o tipo de assunto*"> <mat-select [multiple]="false" [(ngModel)]="selectedTypes" placeholder="{{placeholderSubject}}">
<mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option> <mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@@ -63,6 +63,7 @@ export class CreateProcessPage implements OnInit {
loadedAttachments: any; loadedAttachments: any;
subjectTypes: any; subjectTypes: any;
selectedTypes: string[] = []; selectedTypes: string[] = [];
placeholderSubject: string;
postData: Despacho; postData: Despacho;
dispatchFolder: Folder; dispatchFolder: Folder;
@@ -125,7 +126,13 @@ export class CreateProcessPage implements OnInit {
this.postData = new Despacho(); this.postData = new Despacho();
this.participants = this.participants = new Array(); this.participants = this.participants = new Array();
//Initialize SubjectTypes Array with the value "Indefinido" //Initialize SubjectTypes Array with the value "Indefinido"
/* this.selectedTypes = ['99999850']; */ if(this.loggeduser.Profile == 'PR') {
this.selectedTypes = ['99999850'];
this.placeholderSubject = 'Indefinido'
} else {
this.placeholderSubject = 'Selecione o tipo de assunto*'
}
let NumberPDPP; let NumberPDPP;
@@ -22,6 +22,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -99,6 +100,8 @@ export class DocumentSetUpMeetingPage implements OnInit {
CalendarNamesOptions CalendarNamesOptions
testeFormDefaul = "Eudes" testeFormDefaul = "Eudes"
environment = environment environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -111,7 +114,8 @@ export class DocumentSetUpMeetingPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
public _eventService: EventsService, public _eventService: EventsService,
private httpErroHandle: HttpErrorHandle, private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService public TaskService: TaskService,
private contactsService: ContactsService,
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.document = this.navParams.get('document') this.document = this.navParams.get('document')
@@ -194,6 +198,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "intervenient"; this.adding = "intervenient";
this.setDefaultTime() this.setDefaultTime()
this.getRecurrenceTypes(); this.getRecurrenceTypes();
this.fetchContacts("")
} }
@@ -525,5 +530,34 @@ export class DocumentSetUpMeetingPage implements OnInit {
return this._eventService.calendarRole.includes(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()
});
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)
}
);
}
}
} }
+2 -1
View File
@@ -3,5 +3,6 @@ export class EventPerson{
Name: string; Name: string;
IsRequired: boolean; IsRequired: boolean;
UserType: string; UserType: string;
IsPR: boolean IsPR: boolean;
RoleDescription: string;
} }
@@ -22,6 +22,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -93,6 +94,9 @@ export class NewEventPage implements OnInit {
roomId: string; roomId: string;
globalEnd = new Date('1999') globalEnd = new Date('1999')
environment = environment environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -105,7 +109,8 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService, private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle, private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService, private processeService: ProcessesService,
public TaskService: TaskService public TaskService: TaskService,
private contactsService: ContactsService,
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.postEvent = new Event(); this.postEvent = new Event();
@@ -196,6 +201,7 @@ export class NewEventPage implements OnInit {
this.checkRoleInArray() this.checkRoleInArray()
this.changeAgenda() this.changeAgenda()
this.fetchContacts("")
} }
ngOnDestroy() { ngOnDestroy() {
@@ -831,4 +837,33 @@ export class NewEventPage implements OnInit {
return toAproveObject; return toAproveObject;
} }
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()
});
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)
}
);
}
}
} }
@@ -23,6 +23,7 @@ import { RoleIdService } from 'src/app/services/role-id.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const moment = _rollupMoment || _moment; const moment = _rollupMoment || _moment;
@@ -114,6 +115,9 @@ export class BookMeetingModalPage implements OnInit {
sessionStore = SessionStore; sessionStore = SessionStore;
environment = environment environment = environment
loggeduser: LoginUserRespose;
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -125,7 +129,8 @@ export class BookMeetingModalPage implements OnInit {
public eventService: EventsService, public eventService: EventsService,
public RoleIdService: RoleIdService, public RoleIdService: RoleIdService,
private httpErroHandle: HttpErrorHandle, private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService public TaskService: TaskService,
private contactsService: ContactsService,
) { ) {
@@ -174,6 +179,7 @@ export class BookMeetingModalPage implements OnInit {
} }
this.changeAgenda(); this.changeAgenda();
this.loggeduser = SessionStore.user;
} }
ngOnInit() { ngOnInit() {
@@ -182,6 +188,7 @@ export class BookMeetingModalPage implements OnInit {
this.getAttachments(); this.getAttachments();
this.setDefaultTime() this.setDefaultTime()
this.getRecurrenceTypes(); this.getRecurrenceTypes();
this.fetchContacts("")
} }
@@ -417,7 +424,7 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
console.log('attenes return', data)
if (data) { if (data) {
data = data['data']; data = data['data'];
@@ -587,4 +594,33 @@ export class BookMeetingModalPage implements OnInit {
this.postData.EndDate = this.postData.StartDate; this.postData.EndDate = this.postData.StartDate;
} }
async fetchContacts(filter: string) {
console.log(this.loggeduser)
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()
});
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)
}
);
}
}
} }
@@ -112,7 +112,7 @@
appearance="fill" appearance="fill"
class="width-100 d-block" class="width-100 d-block"
appearance="none"> appearance="none">
<mat-select [multiple]="false" [(ngModel)]="selectedTypes" placeholder="Selecione o tipo de assunto*"> <mat-select [multiple]="false" [(ngModel)]="selectedTypes" placeholder="{{placeholderSubject}}">
<mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option> <mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@@ -96,6 +96,7 @@ export class ExpedientTaskModalPage implements OnInit {
validateFrom = false; validateFrom = false;
validateField = false; validateField = false;
document: any document: any
placeholderSubject: string;
get toppingsValues() { get toppingsValues() {
return this.toppings.value; return this.toppings.value;
@@ -150,7 +151,12 @@ export class ExpedientTaskModalPage implements OnInit {
// console.log('this.document', this.document) // console.log('this.document', this.document)
/* this.selectedTypes = ['99999850']; */ if(this.loggeduser.Profile == 'PR') {
this.selectedTypes = ['99999850'];
this.placeholderSubject = 'Indefinido'
} else {
this.placeholderSubject = 'Selecione o tipo de assunto*'
}
this.postData = new Despacho(); this.postData = new Despacho();
this.participants = this.participants = new Array(); this.participants = this.participants = new Array();
@@ -34,6 +34,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
dateInput: "YYYY-MMMM-DD HH:mm" dateInput: "YYYY-MMMM-DD HH:mm"
@@ -131,6 +132,8 @@ export class NewEventPage implements OnInit {
CalendarNamesOptions = ['Oficial', 'Pessoal'] CalendarNamesOptions = ['Oficial', 'Pessoal']
environment = environment environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[] = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
@@ -142,7 +145,8 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService, private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle, private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService, private processeService: ProcessesService,
public TaskService: TaskService public TaskService: TaskService,
private contactsService: ContactsService,
) { ) {
this.dateAdapter.setLocale('pt'); this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
@@ -220,6 +224,7 @@ export class NewEventPage implements OnInit {
} }
}) })
} }
console.log('Attendes',this.taskParticipants)
this.taskParticipants = removeDuplicate(this.taskParticipants); this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc); this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
@@ -234,6 +239,7 @@ export class NewEventPage implements OnInit {
this.injectValidation(); this.injectValidation();
this.changeAgenda() this.changeAgenda()
this.fetchContacts("")
} }
@@ -987,5 +993,34 @@ export class NewEventPage implements OnInit {
return toAproveObject; return toAproveObject;
} }
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()
});
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;
this.taskParticipants.push(this.contacts[0]);
this.setIntervenient.emit(this.taskParticipants);
console.log('Attendes Email', this.taskParticipants)
}
);
}
}
} }
+1 -1
View File
@@ -4,4 +4,4 @@ import { doneITProd } from './suport/doneIt'
import { DevDev } from './suport/dev' import { DevDev } from './suport/dev'
export const environment: Environment = oaprProd; export const environment: Environment = DevDev;
+1 -1
View File
@@ -4,4 +4,4 @@ import { doneITDev } from './suport/doneIt'
import { DevDev } from './suport/dev' import { DevDev } from './suport/dev'
export const environment: Environment = oaprDev export const environment: Environment = DevDev