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"
class="width-100 d-block"
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-select>
</mat-form-field>
@@ -63,6 +63,7 @@ export class CreateProcessPage implements OnInit {
loadedAttachments: any;
subjectTypes: any;
selectedTypes: string[] = [];
placeholderSubject: string;
postData: Despacho;
dispatchFolder: Folder;
@@ -125,7 +126,13 @@ export class CreateProcessPage implements OnInit {
this.postData = new Despacho();
this.participants = this.participants = new Array();
//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;
@@ -22,6 +22,7 @@ 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';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -75,8 +76,8 @@ export class DocumentSetUpMeetingPage implements OnInit {
taskParticipants: EventPerson[] = [];
taskParticipantsCc: EventPerson[] = [];
taskDocId:string;
loadedAttachments:any;
taskDocId: string;
loadedAttachments: any;
attachments: SearchList[] = [];
@@ -85,24 +86,26 @@ export class DocumentSetUpMeetingPage implements OnInit {
postData: Event;
formLocationSatus: boolean = false;
showAttendees= false;
showAttendees = false;
loggeduser: LoginUserRespose;
emptyTextDescription = "Selecionar intervenientes";
document: SearchFolderDetails | SearchDocumentDetails | any;
subject: string;
docs:any[] = [];
docs: any[] = [];
eventPipe = new EventPipe()
eventPipe = new EventPipe()
CalendarName;
CalendarNameShow = true
CalendarNamesOptions
testeFormDefaul = "Eudes"
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
private router:Router,
private router: Router,
private navParams: NavParams,
authService: AuthService,
private toastService: ToastService,
@@ -111,15 +114,16 @@ export class DocumentSetUpMeetingPage implements OnInit {
public ThemeService: ThemeService,
public _eventService: EventsService,
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
this.loggeduser = SessionStore.user;
this.document = this.navParams.get('document')
if(Array.isArray(this.document)) {
if (Array.isArray(this.document)) {
const E = this.document
this.document = []
E.forEach((e)=> {
E.forEach((e) => {
this.document.push({
ApplicationId: e.ApplicationId || e.ApplicationType,
Source: 1,
@@ -151,7 +155,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
if(Array.isArray(this.document)) {
if (Array.isArray(this.document)) {
this.attachments = this.document
} else {
this.attachments = [this.document]
@@ -160,22 +164,22 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.subject = this.navParams.get('subject')
this.postData = new Event();
this.postData.Body ={ BodyType : "1", Text : ""};
this.postData.Body = { BodyType: "1", Text: "" };
this.postData.Subject = this.subject
this.postData.CalendarName = "Oficial";
this.postData.Category = 'Reunião'
if(!this.CalendarName) {
if(this._eventService.calendarNamesAry.includes('Meu calendario')) {
if (!this.CalendarName) {
if (this._eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this._eventService.calendarNamesAry[0]
}
}
if(this.taskParticipants.length == 0) {
if (this.taskParticipants.length == 0) {
this.taskParticipants = [
// {
// EmailAddress: SessionStore.user.Email,
@@ -194,6 +198,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "intervenient";
this.setDefaultTime()
this.getRecurrenceTypes();
this.fetchContacts("")
}
@@ -203,15 +208,15 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
if(e) {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if (e) {
e.disabled = true;
}
})
}, 1000);
getRecurrenceTypes() {
this.calendarService.getRecurrenceTypes().subscribe( res=> {
this.calendarService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res;
});
}
@@ -222,13 +227,13 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
setStartDate() {
if(!this.postData.StartDate) {
if (!this.postData.StartDate) {
this.postData.StartDate = this.roundTimeQuarterHour();
}
}
setEndDate() {
if(!this.postData.EndDate) {
if (!this.postData.EndDate) {
this.postData.EndDate = this.roundTimeQuarterHourPlus15(this.postData.StartDate);
}
}
@@ -238,11 +243,11 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
runValidation() {
this.validateFrom = true
this.validateFrom = true
}
get dateValid() {
return new Date(this.postData.StartDate).getTime() < new Date(this.postData.EndDate).getTime() ? 'ok': null
return new Date(this.postData.StartDate).getTime() < new Date(this.postData.EndDate).getTime() ? 'ok' : null
}
injectValidation() {
@@ -258,7 +263,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
CalendarName: new FormControl(this.postData.CalendarName, [
// Validators.required
]),
Date: new FormControl( (this.dateValid), [
Date: new FormControl((this.dateValid), [
Validators.required
]),
participantes: new FormControl(this.taskParticipants, [
@@ -279,7 +284,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.CalendarNameShow = true
if(this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
@@ -300,10 +305,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
async saveTask() {
if(this.loggeduser.Profile == 'MDGPR') {
if (this.loggeduser.Profile == 'MDGPR') {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if (this.Form.invalid) return false
}
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
@@ -343,7 +348,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
}, (error) => {
laoder.remove();
this.httpErroHandle.httpStatusHandle(error)
}, ()=>{
}, () => {
laoder.remove();
});
@@ -353,10 +358,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "intervenient";
if(window.innerWidth <= 801){
if (window.innerWidth <= 801) {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
@@ -367,7 +372,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data) {
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -391,10 +396,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "CC";
if(window.innerWidth <= 800) {
if (window.innerWidth <= 800) {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
@@ -407,7 +412,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data){
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -437,30 +442,30 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
});
modal.onDidDismiss().then((res)=> {
if(res){
const data = res.data;
this.attachments.push(data.selected);
}
}, (error) => {
console.log(error)
});
modal.onDidDismiss().then((res) => {
if (res) {
const data = res.data;
this.attachments.push(data.selected);
}
}, (error) => {
console.log(error)
});
await modal.present();
await modal.present();
}
removeAttachment(index: number) {
this.attachments = this.attachments.filter( (e, i) => index != i);
this.attachments = this.attachments.filter((e, i) => index != i);
}
validateFormInputs() {
let formLocation = this.postData.Location.trim();
if(!this.postData.Location && formLocation.length <= 0){
if (!this.postData.Location && formLocation.length <= 0) {
this.formLocationSatus = true;
}
}
selectedCalendarId () {
selectedCalendarId() {
if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postData.CalendarName == 'Oficial') {
return this._eventService.calendarNamesType[this.CalendarName]['OficialId']
@@ -474,7 +479,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) {
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
}
@@ -497,7 +502,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
@@ -514,10 +519,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
return date
}
roundTimeQuarterHourPlus15(date:Date) {
roundTimeQuarterHourPlus15(date: Date) {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
const minutes = _date.getMinutes();
_date.setMinutes(minutes + 15)
return _date
}
@@ -525,5 +530,34 @@ export class DocumentSetUpMeetingPage implements OnInit {
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;
IsRequired: boolean;
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 { ProcessesService } from 'src/app/services/processes.service';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -93,6 +94,9 @@ export class NewEventPage implements OnInit {
roomId: string;
globalEnd = new Date('1999')
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
@@ -105,7 +109,8 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
this.loggeduser = SessionStore.user;
this.postEvent = new Event();
@@ -196,6 +201,7 @@ export class NewEventPage implements OnInit {
this.checkRoleInArray()
this.changeAgenda()
this.fetchContacts("")
}
ngOnDestroy() {
@@ -831,4 +837,33 @@ export class NewEventPage implements OnInit {
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 { environment } from 'src/environments/environment';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const moment = _rollupMoment || _moment;
@@ -114,6 +115,9 @@ export class BookMeetingModalPage implements OnInit {
sessionStore = SessionStore;
environment = environment
loggeduser: LoginUserRespose;
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
@@ -125,7 +129,8 @@ export class BookMeetingModalPage implements OnInit {
public eventService: EventsService,
public RoleIdService: RoleIdService,
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
@@ -136,7 +141,7 @@ export class BookMeetingModalPage implements OnInit {
console.log('fulltask', this.fulltask)
if(this.fulltask?.Documents) {
if (this.fulltask?.Documents) {
this.documents = this.fulltask.Documents
}
@@ -174,6 +179,7 @@ export class BookMeetingModalPage implements OnInit {
}
this.changeAgenda();
this.loggeduser = SessionStore.user;
}
ngOnInit() {
@@ -182,6 +188,7 @@ export class BookMeetingModalPage implements OnInit {
this.getAttachments();
this.setDefaultTime()
this.getRecurrenceTypes();
this.fetchContacts("")
}
@@ -191,8 +198,8 @@ export class BookMeetingModalPage implements OnInit {
}
myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
if(e) {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if (e) {
e.disabled = true;
}
})
@@ -327,8 +334,8 @@ export class BookMeetingModalPage implements OnInit {
return {
ApplicationId: e.ApplicationType || e.ApplicationId,
Source: 1,
SourceId: e.Id || e.DocId || e.SourceId,
SourceName:e.Assunto,
SourceId: e.Id || e.DocId || e.SourceId,
SourceName: e.Assunto,
Description: e.Assunto,
Stakeholders: e.EntidadeOrganicaNome
}
@@ -417,7 +424,7 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then((data) => {
console.log('attenes return', data)
if (data) {
data = data['data'];
@@ -587,4 +594,33 @@ export class BookMeetingModalPage implements OnInit {
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"
class="width-100 d-block"
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-select>
</mat-form-field>
@@ -96,6 +96,7 @@ export class ExpedientTaskModalPage implements OnInit {
validateFrom = false;
validateField = false;
document: any
placeholderSubject: string;
get toppingsValues() {
return this.toppings.value;
@@ -150,7 +151,12 @@ export class ExpedientTaskModalPage implements OnInit {
// 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.participants = this.participants = new Array();
@@ -34,6 +34,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { Subject } from 'rxjs';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
dateInput: "YYYY-MMMM-DD HH:mm"
@@ -131,6 +132,8 @@ export class NewEventPage implements OnInit {
CalendarNamesOptions = ['Oficial', 'Pessoal']
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[] = [];
constructor(
private modalController: ModalController,
@@ -142,7 +145,8 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user;
@@ -220,6 +224,7 @@ export class NewEventPage implements OnInit {
}
})
}
console.log('Attendes',this.taskParticipants)
this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
@@ -234,6 +239,7 @@ export class NewEventPage implements OnInit {
this.injectValidation();
this.changeAgenda()
this.fetchContacts("")
}
@@ -987,5 +993,34 @@ export class NewEventPage implements OnInit {
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'
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'
export const environment: Environment = oaprDev
export const environment: Environment = DevDev