bugs solved

This commit is contained in:
Eudes Inácio
2023-08-11 16:14:25 +01:00
parent 2bfec82113
commit 408f68b22e
20 changed files with 263 additions and 129 deletions
@@ -56,7 +56,7 @@ export class BookMeetingModalPage implements OnInit {
public touchUi = false;
public enableMeridian = false;
public minDate = new Date();
public ionicMinDate = new Date().toISOString().slice(0,10)
public ionicMinDate = new Date().toISOString().slice(0, 10)
// curent timestamp + 15 minutes
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
@@ -77,11 +77,11 @@ export class BookMeetingModalPage implements OnInit {
showLoader = false
get dateStart () {
get dateStart() {
return this.dateControlStart.value;
}
get dateEnd () {
get dateEnd() {
return this.dateControlEnd.value;
}
@@ -95,9 +95,9 @@ export class BookMeetingModalPage implements OnInit {
taskParticipants: EventPerson[];
taskParticipantsCc: EventPerson[] = [];
taskDocId:string;
loadedAttachments:any;
documents:SearchList[] = [];
taskDocId: string;
loadedAttachments: any;
documents: SearchList[] = [];
adding: "intervenient" | "CC" = "intervenient";
@@ -106,46 +106,46 @@ export class BookMeetingModalPage implements OnInit {
eventAttendees: EventPerson[];
formLocationSatus: boolean = false;
showAttendees= false;
showAttendees = false;
emptyTextDescription = "Sem intervenientes selecionados";
CalendarName
sessionStore = SessionStore;
environment = environment
constructor(
private modalController: ModalController,
private navParams: NavParams,
private attachmentsService: AttachmentsService,
public calendarService: EventsService,
public calendarService: EventsService,
private toastService: ToastService,
public ThemeService: ThemeService,
public eventService: EventsService,
public RoleIdService: RoleIdService,
private httpErroHandle: HttpErrorHandle
) {
this.taskParticipants = [];
this.task = this.navParams.get('task');
this.postData = new Event();
this.eventBody = { BodyType : "1", Text : ""};
this.postData.Body = this.eventBody;
) {
this.taskParticipants = [];
this.postData.Subject = this.task.Folio;
this.postData.CalendarName = "Oficial";
this.task = this.navParams.get('task');
let startDate = this.roundTimeQuarterHour()
this.dateControlStart = new FormControl(moment(startDate));
this.dateControlEnd = new FormControl(moment(this.roundTimeQuarterHourPlus15(startDate)));
this.postData = new Event();
this.eventBody = { BodyType: "1", Text: "" };
this.postData.Body = this.eventBody;
this.postData.Category = 'Reunião'
this.postData.Subject = this.task.Folio;
this.postData.CalendarName = "Oficial";
if(!this.CalendarName) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
let startDate = this.roundTimeQuarterHour()
this.dateControlStart = new FormControl(moment(startDate));
this.dateControlEnd = new FormControl(moment(this.roundTimeQuarterHourPlus15(startDate)));
this.postData.Category = 'Reunião'
if (!this.CalendarName) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
// console.log(this.eventService.calendarNamesAry)
} else {
@@ -153,7 +153,7 @@ export class BookMeetingModalPage implements OnInit {
}
}
if(this.taskParticipants.length == 0) {
if (this.taskParticipants.length == 0) {
this.taskParticipants = [{
EmailAddress: SessionStore.user.Email,
IsRequired: true,
@@ -173,10 +173,10 @@ export class BookMeetingModalPage implements OnInit {
this.getRecurrenceTypes();
}
getRecurrenceTypes() {
this.calendarService.getRecurrenceTypes().subscribe(res=>{
this.calendarService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res;
});
}
@@ -185,8 +185,8 @@ export class BookMeetingModalPage implements OnInit {
changeAgenda() {
setTimeout(() => {
if(this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.calendarService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
if (this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.calendarService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
} else if (this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial']) {
@@ -204,14 +204,14 @@ export class BookMeetingModalPage implements OnInit {
}, 50)
}
setDefaultTime() {
this.postData.StartDate = this.roundTimeQuarterHour();
this.postData.StartDate = this.roundTimeQuarterHour();
this.postData.EndDate = this.roundTimeQuarterHourPlus15(this.postData.StartDate);
}
getAttachments() {
this.attachmentsService.getAttachmentsBySerial(this.task.SerialNumber).subscribe(res=>{
this.attachmentsService.getAttachmentsBySerial(this.task.SerialNumber).subscribe(res => {
this.loadedAttachments = res;
});
}
@@ -227,11 +227,11 @@ export class BookMeetingModalPage implements OnInit {
runValidation() {
this.validateFrom = true
this.validateFrom = true
}
get dateValid() {
return new Date(this.dateControlStart.value).getTime() < new Date(this.dateControlEnd.value).getTime() ? 'ok': null
return new Date(this.dateControlStart.value).getTime() < new Date(this.dateControlEnd.value).getTime() ? 'ok' : null
}
injectValidation() {
@@ -262,19 +262,19 @@ export class BookMeetingModalPage implements OnInit {
async saveTask() {
if(SessionStore.user.Profile != 'PR') {
if (SessionStore.user.Profile != 'PR') {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if (this.Form.invalid) return false
}
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.eventBody={
this.eventBody = {
BodyType: '1',
Text: this.postData.Body.Text,
}
this.postData = {
let postData = {
EventId: '',
Subject: this.postData.Subject,
Body: this.eventBody,
@@ -296,18 +296,32 @@ export class BookMeetingModalPage implements OnInit {
Type: this.EventRecurrenceType,
LastOccurrence: this.Occurrence
},
Attachments: []
}
const DocumentToSave = this.documents.map((e) => {
console.log('ASSUNTO', e.Assunto)
return {
ApplicationId: e.ApplicationType,
Source: 1,
SourceId: e.Id,
SourceName:e.Assunto,
Description: e.Assunto,
Stakeholders: e.EntidadeOrganicaNome
}
});
postData.Attachments = DocumentToSave;
if(this.task.FsId == '8') {
if (this.task.FsId == '8') {
const loader = this.toastService.loading()
try {
const CalendarId = this.selectedCalendarId()
await this.calendarService.genericPostExpedientEvent(this.task.DocId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
await this.calendarService.genericPostExpedientEvent(this.task.DocId, postData, "", this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.modalController.dismiss();
this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
@@ -320,14 +334,14 @@ export class BookMeetingModalPage implements OnInit {
}
else if(this.task.FsId == '361') {
else if (this.task.FsId == '361') {
console.log('361')
const loader = this.toastService.loading()
try {
const CalendarId = this.selectedCalendarId()
console.log({CalendarId})
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
console.log({ CalendarId })
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, postData, "", this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.close();
this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
@@ -346,8 +360,8 @@ export class BookMeetingModalPage implements OnInit {
selectedCalendarId () {
selectedCalendarId() {
if (this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postData.CalendarName == 'Oficial') {
return this.calendarService.calendarNamesType[this.CalendarName]['OficialId']
@@ -365,10 +379,10 @@ export class BookMeetingModalPage 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
@@ -381,7 +395,7 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data) {
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -403,7 +417,7 @@ export class BookMeetingModalPage implements OnInit {
openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence')
if(input) {
if (input) {
input.click()
}
}
@@ -412,10 +426,10 @@ export class BookMeetingModalPage 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
@@ -428,7 +442,7 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data) {
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -448,8 +462,8 @@ export class BookMeetingModalPage implements OnInit {
async distartExpedientModal() {
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
componentProps: {
serialNumber: this.task.SerialNumber,
componentProps: {
serialNumber: this.task.SerialNumber,
},
cssClass: 'discart-expedient-modal',
backdropDismiss: false
@@ -457,11 +471,11 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then(
()=> {}
() => { }
, (error) => {
console.log(error)
})
await modal.present();
await modal.present();
}
async getDoc() {
@@ -475,37 +489,38 @@ export class BookMeetingModalPage implements OnInit {
}
});
await modal.present();
modal.onDidDismiss().then((res)=> {
if(res){
const data = res.data;
this.documents.push(data.selected);
}
}, (error) => {
console.log(error)
});
modal.onDidDismiss().then((res) => {
if (res) {
const data = res.data;
this.documents.push(data.selected);
console.log(this.documents)
}
}, (error) => {
console.log(error)
});
}
removeAttachment(index: number){
this.documents = this.documents.filter( (e, i) => index != i);
removeAttachment(index: number) {
this.documents = this.documents.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;
}
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
}
setIntervenient(data){
setIntervenient(data) {
this.taskParticipants = data;
}
setIntervenientCC(data){
setIntervenientCC(data) {
this.taskParticipantsCc = data;
}
@@ -515,8 +530,8 @@ export class BookMeetingModalPage implements OnInit {
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
} else if (minutes > 30) {
@@ -527,25 +542,25 @@ export class BookMeetingModalPage implements OnInit {
date.setMinutes(15)
}
}
}
return date
}
roundTimeQuarterHourPlus15(date:Date) {
roundTimeQuarterHourPlus15(date: Date) {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
return _date
const minutes = _date.getMinutes();
_date.setMinutes(minutes + 15)
return _date
}
setStartDate() {
this.postData.StartDate = this.roundTimeQuarterHour();
}
setEndDate(){
setEndDate() {
this.postData.EndDate = this.postData.StartDate;
}