teste mobile done!

This commit is contained in:
Eudes Inácio
2024-06-04 09:38:11 +01:00
parent 9265622e65
commit 9fcf116102
19 changed files with 468 additions and 281 deletions
@@ -389,11 +389,11 @@
</div>
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
<ion-list class="width-100 list" *ngIf="!document.remove">
<ion-list class="width-100 list">
<ion-item class="width-100 ion-no-border ion-no-padding">
<ion-label class="width-100">
<p class="p-item-title d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="attach-title-item">{{document.subject || document.SourceName || document.sourceName}}</span>
<span class="close-button text-black" (click)="deleteAttachment(document.Id, i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
@@ -435,7 +435,7 @@
<ion-footer class="ion-no-border">
<ion-toolbar class="footer-toolbar px-20">
<ion-buttons slot="start">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
<ion-label>Gravar</ion-label>
</button>
</ion-buttons>
@@ -19,6 +19,7 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { environment } from 'src/environments/environment';
import { ContactsService } from 'src/app/services/contacts.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -89,6 +90,8 @@ export class EditEventPage implements OnInit {
sesseionStora = SessionStore
environment = environment
allDayCheck: boolean = false;
deletedAttachmentsList = [];
addedAttachmentsList = [];
constructor(
private modalController: ModalController,
@@ -101,7 +104,8 @@ export class EditEventPage implements OnInit {
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle,
private contactsService: ContactsService,
private domSanitazerService: DomSanitizerService
private domSanitazerService: DomSanitizerService,
private agendaDataRepository: AgendaDataRepositoryService
) {
/* this.postEvent = new Event(); */
@@ -123,6 +127,8 @@ export class EditEventPage implements OnInit {
this.postEvent.Attendees[index].UserType = userData.UserType
}
console.log('jhv',this.postEvent.Category)
}
@@ -155,15 +161,15 @@ export class EditEventPage implements OnInit {
this.isRecurring = "Repete";
}
this.getAttachments(this.postEvent.EventId);
this.loadedEventAttachments = this.postEvent?.Attachments
this.CalendarNameOwnerName = this.eventsService.detectCalendarNameByCalendarId(this.postEvent.CalendarId)
this.changeAgenda()
}
ngOnInit() {
console.log(this.postEvent?.Attachments)
console.log(this.loadedEventAttachments)
window.onresize = (event) => {
// if not mobile remove all component
if (window.innerWidth >= 1024) {
@@ -202,7 +208,7 @@ export class EditEventPage implements OnInit {
}
cancel() {
this.modalController.dismiss({action:'cancel'});
this.modalController.dismiss({ action: 'cancel' });
}
goBack() {
@@ -358,6 +364,59 @@ export class EditEventPage implements OnInit {
}
}
async save_v2() {
this.injectValidation()
this.runValidation()
if (this.Form.invalid) {
return false
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
try {
this.agendaDataRepository.updateEvent(this.postEvent.EventId, this.postEvent).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('edit event error: ', error)
}));
this.agendaDataRepository.addEventAttendee(this.postEvent.EventId, this.postEvent.Attendees).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add Attendee error: ', error)
}));
await this.saveDocument()
if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.postEvent.EventId, this.loadedEventAttachments).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('add attachment error: ', error)
}));
}
if (this.deletedAttachmentsList.length > 0) {
this.agendaDataRepository.removeEventAttachment(this.postEvent.EventId, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
console.log(value)
}, ((error) => {
console.log('remove attachment error: ', error)
}));
}
this.isEventEdited = true;
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
console.log('edit: ', error)
}
}
async save() {
@@ -403,7 +462,7 @@ export class EditEventPage implements OnInit {
this.httpErrorHandle.httpStatusHandle(error)
});
} else {
console.log('edid calendar id',this.postEvent.CalendarId);
console.log('edid calendar id', this.postEvent.CalendarId);
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
if (window['reloadCalendar']) {
@@ -568,12 +627,13 @@ export class EditEventPage implements OnInit {
deleteAttachment(attachmentID: string, index) {
const id: any = this.loadedEventAttachments[index].Id
this.deletedAttachmentsList.push(id)
if (id == 'add') {
/* if (id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index)
} else {
this.loadedEventAttachments[index]['remove'] = true
}
} */
}
@@ -585,6 +645,7 @@ export class EditEventPage implements OnInit {
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true,
eventAgenda: true,
select: true,
}
});
@@ -593,7 +654,7 @@ export class EditEventPage implements OnInit {
if (res) {
const data = res.data;
const ApplicationIdDocumentToSave: any = {
/* const ApplicationIdDocumentToSave: any = {
SourceName: data.selected.Assunto,
ParentId: this.postEvent.EventId,
SourceId: data.selected.Id,
@@ -606,11 +667,11 @@ export class EditEventPage implements OnInit {
Source: '1',
Link: '',
SerialNumber: '',
}
} */
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
this.postEvent.Attachments = this.loadedEventAttachments;
this.loadedEventAttachments.push(data.selected)
this.addedAttachmentsList.push(data.selected)
}
})
@@ -642,52 +703,52 @@ export class EditEventPage implements OnInit {
}
onCheckboxChange(event: any) {
console.log(this.postEvent.CalendarId)
if (this.allDayCheck) {
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
onCheckboxChange(event: any) {
console.log(this.postEvent.CalendarId)
if (this.allDayCheck) {
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
console.log('Recurso ativado!!');
} else {
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
console.log('Recurso desativado');
console.log('Recurso ativado!!');
} else {
this.postEvent.IsAllDayEvent = this.allDayCheck;
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
console.log('Recurso desativado');
}
}
}
setAlldayTime(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0);
setAlldayTime(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0);
return date
}
return date
}
setAlldayTimeEndDate(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(23)
date.setMinutes(59)
date.setSeconds(0);
setAlldayTimeEndDate(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(23)
date.setMinutes(59)
date.setSeconds(0);
return date
}
return date
}
setAlldayTimeEndDateNotAlday(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(23)
date.setMinutes(0)
date.setSeconds(0);
setAlldayTimeEndDateNotAlday(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(23)
date.setMinutes(0)
date.setSeconds(0);
return date
}
return date
}
}
@@ -8,6 +8,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service'
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@Component({
@@ -16,28 +17,29 @@ import { TaskService } from 'src/app/services/task.service'
styleUrls: ['./event-actions-popover.page.scss'],
})
export class EventActionsPopoverPage implements OnInit {
serialNumber:string;
serialNumber: string;
instanceId: string;
activityInstanceName: string
constructor(
private navParams: NavParams,
private processes:ProcessesService,
private processes: ProcessesService,
private modalController: ModalController,
private popoverController: PopoverController,
private toastService: ToastService,
private RouteService: RouteService,
private httpErrorHandle: HttpErrorHandle,
public ThemeService: ThemeService,
public TaskService: TaskService) {
this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('InstanceId');
this.activityInstanceName = this.navParams.get('InstanceId');
public TaskService: TaskService,
private agendaDataRepository: AgendaDataRepositoryService) {
this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('InstanceId');
this.activityInstanceName = this.navParams.get('InstanceId');
}
ngOnInit() {
window.onresize = (event) => {
if( window.innerWidth >= 800){
if (window.innerWidth >= 800) {
this.popoverController.dismiss();
}
};
@@ -55,14 +57,21 @@ export class EventActionsPopoverPage implements OnInit {
async approveTask() {
let body = { "serialNumber": this.serialNumber, "action": "Aprovar" }
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.goBack();
/* await this.processes.PostTaskAction(body).toPromise() */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Approved').subscribe((value) => {
console.log(value)
this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.goBack();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
}
@@ -74,8 +83,8 @@ export class EventActionsPopoverPage implements OnInit {
async ReenviarTask() {
let body = { "serialNumber": this.serialNumber, "action": "Reenviar" }
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
@@ -93,10 +102,10 @@ export class EventActionsPopoverPage implements OnInit {
async emendarTask() {
this.closePopover();
const modal = await this.modalController.create({
component: EmendMessageModalPage,
componentProps:{
componentProps: {
},
cssClass: 'emend-message-modal',
backdropDismiss: false
@@ -104,36 +113,42 @@ export class EventActionsPopoverPage implements OnInit {
modal.onDidDismiss()
.then( async (res) => {
if(res.data.option == 'save') {
let body = { "serialNumber": this.serialNumber,
"action": "Emendar",
"dataFields": {
.then(async (res) => {
if (res.data.option == 'save') {
let body = {
"serialNumber": this.serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
}
}
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao()
this.goBack();
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Revision').subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao()
this.goBack();
}, ((error) => {
console.log('send event to revision error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}));
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
} else {
}
} else {
});
}
});
await modal.present();
@@ -143,11 +158,16 @@ export class EventActionsPopoverPage implements OnInit {
let body = { "serialNumber": this.serialNumber, "action": "Descartar" }
const loader = this.toastService.loading();
try {
await this.processes.PostTaskAction(body).toPromise();
this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.goBack();
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Declined').subscribe((value) => {
this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.goBack();
}, ((error) => {
console.log('reject event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
}
@@ -171,10 +191,10 @@ export class EventActionsPopoverPage implements OnInit {
});
modal.onDidDismiss().then(res => {});
modal.onDidDismiss().then(res => { });
await modal.present();
}
}
@@ -95,7 +95,7 @@
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
<p class="flex-grow-1" >
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span>
<span class="attach-title-item d-block">{{attach.SourceName || attach.subject || attach.sourceName || 'Sem título'}}</span>
<span class="span-left d-block">{{attach.Stakeholders}}</span>
</p>
@@ -16,7 +16,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
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 { AttachmentsService } from 'src/app/services/attachments.service';
import { DateService } from 'src/app/services/date.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
@@ -155,7 +155,7 @@ export class ViewEventPage implements OnInit {
// });
// }
openOptions() {}
openOptions() { }
close() {
this.modalController.dismiss(this.isEventEdited);
@@ -194,10 +194,10 @@ export class ViewEventPage implements OnInit {
let res = await this.agendaDataRepository.getEventById(this.eventId)
if(res.isOk()) {
if (res.isOk()) {
console.log('Loaded Event', res.value)
loader.remove()
let changeDate = this.dateService.fixDate(res.value as any) as any
let changeDate = this.dateService.fixDate(res.value as any) as any
this.loadedEvent = changeDate as any;
this.setTimeZone()
} else {
@@ -210,36 +210,36 @@ export class ViewEventPage implements OnInit {
}
loadEvent1() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
// this.addEventToDb(res);
}, (error) => {
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
/* loadEvent1() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
}, (error) => {
});
}
}
}
// this.addEventToDb(res);
}, (error) => {
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
}, (error) => {
});
}
}
} */
deleteYesOrNo() {
this.alertController.create({
@@ -268,7 +268,31 @@ export class ViewEventPage implements OnInit {
const loader = this.toastService.loading()
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
console.log(this.loadedEvent.EventId)
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, (error) => {
console.log('delete event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}, () => {
loader.remove();
});
/* if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
@@ -281,7 +305,7 @@ export class ViewEventPage implements OnInit {
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, () => { },
}, () => { },
() => {
loader.remove();
});
@@ -300,15 +324,15 @@ export class ViewEventPage implements OnInit {
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
},
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
},
() => {
loader.remove();
});
});
}
} */
}
@@ -360,8 +384,8 @@ export class ViewEventPage implements OnInit {
if (res) {
setTimeout(() => {
/* this.loadEvent(); */
this.loadEvent1()
this.loadEvent();
/* this.loadEvent1() */
}, 250);
this.isEventEdited = true;
console.log('res', res, res.data?.action, 'cancel')
@@ -394,13 +418,13 @@ export class ViewEventPage implements OnInit {
if (res.data?.action == 'cancel') {
setTimeout(() => {
/* this.loadEvent(); */
this.loadEvent1()
this.loadEvent();
/* this.loadEvent1() */
}, 250);
this.isEventEdited = true;
if(res.data.Attendees?.length >= 1) {
if (res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true
this.getAttachments()
}
@@ -413,7 +437,7 @@ export class ViewEventPage implements OnInit {
}, 250);
this.isEventEdited = true;
if(res.data.Attendees?.length >= 1) {
if (res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true
this.getAttachments()
}
@@ -432,11 +456,11 @@ export class ViewEventPage implements OnInit {
getAttachments() {
if(this.loadedEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res=>{
if (this.loadedEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res => {
this.loadedEvent.Attachments = res;
},((erro) => {
}, ((erro) => {
console.error('editgetAttchament', erro)
}));
}