mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
lot of changes
This commit is contained in:
@@ -23,19 +23,19 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
event: Event;
|
||||
@Input() loadedEvent: EventToApproveDetails;
|
||||
loadedAttachments:any;
|
||||
customDate:any;
|
||||
today:any;
|
||||
loadedAttachments: any;
|
||||
customDate: any;
|
||||
today: any;
|
||||
show: boolean = false;
|
||||
|
||||
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
|
||||
@Input() serialNumber:string;
|
||||
@Input() showComponent:string;
|
||||
@Input() serialNumber: string;
|
||||
@Input() showComponent: string;
|
||||
@Input() componentTransparent: any
|
||||
@Input() InstanceId:string;
|
||||
@Input() showAside:boolean;
|
||||
@Input() InstanceId: string;
|
||||
@Input() showAside: boolean;
|
||||
|
||||
@Output() approveEventDismiss = new EventEmitter<any>();
|
||||
@Output() closeEventToApprove = new EventEmitter<any>();
|
||||
@@ -53,12 +53,12 @@ export class ApproveEventPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHandle: HttpErrorHandle,
|
||||
public TaskService: TaskService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
// Event to approve list
|
||||
|
||||
|
||||
window['edit-approve-event-desktop'] = ()=> {
|
||||
window['edit-approve-event-desktop'] = () => {
|
||||
this.getTask()
|
||||
}
|
||||
}
|
||||
@@ -80,31 +80,38 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
async getTask() {
|
||||
|
||||
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
|
||||
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
|
||||
|
||||
if(res.isOk()) {
|
||||
if (res.isOk()) {
|
||||
this.loadedEvent = res.value;
|
||||
console.log('attachment',res.value)
|
||||
console.log('attachment', res.value)
|
||||
this.loadedAttachments = this.loadedEvent.Attachments
|
||||
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
|
||||
//
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
} else {
|
||||
console.log(res.error.status)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async approveTask(serialNumber:string) {
|
||||
async approveTask(serialNumber: string) {
|
||||
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
this.modalController.dismiss(serialNumber);
|
||||
this.httpErroHandle.httpsSucessMessagge('Aprovar')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Approved').subscribe((value) => {
|
||||
console.log(value)
|
||||
this.modalController.dismiss(serialNumber);
|
||||
this.httpErroHandle.httpsSucessMessagge('Aprovar')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
}, ((error) => {
|
||||
console.log('aprove event error: ', error)
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
}))
|
||||
/* await this.processes.PostTaskAction(body).toPromise() */
|
||||
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
@@ -114,7 +121,7 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async rejectTask(serialNumber:string) {
|
||||
async rejectTask(serialNumber: string) {
|
||||
|
||||
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
|
||||
|
||||
@@ -139,13 +146,13 @@ export class ApproveEventPage implements OnInit {
|
||||
try {
|
||||
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.InstanceId).toPromise();
|
||||
} catch (error) {
|
||||
console.error('getAttchaments',error)
|
||||
console.error('getAttchaments', error)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
async viewDocument(DocId: string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
@@ -168,7 +175,7 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async openOptions(ev:any) {
|
||||
async openOptions(ev: any) {
|
||||
const popover = await this.popoverController.create({
|
||||
component: EventActionsPopoverPage,
|
||||
componentProps: {
|
||||
@@ -178,7 +185,7 @@ export class ApproveEventPage implements OnInit {
|
||||
event: ev,
|
||||
translucent: true
|
||||
});
|
||||
return await popover.present().then(() =>{
|
||||
return await popover.present().then(() => {
|
||||
this.TaskService.loadEventosParaAprovacao()
|
||||
this.getTask()
|
||||
}, (error) => {
|
||||
@@ -186,11 +193,11 @@ export class ApproveEventPage implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
async emendTask(serialNumber:string) {
|
||||
async emendTask(serialNumber: string) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EmendMessageModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'emend-message-modal',
|
||||
backdropDismiss: false
|
||||
@@ -199,46 +206,53 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
|
||||
modal.onDidDismiss()
|
||||
.then( async (res) => {
|
||||
.then(async (res) => {
|
||||
|
||||
if(res.data.option == 'save') {
|
||||
if (res.data.option == 'save') {
|
||||
|
||||
|
||||
|
||||
let body = { "serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
"ReviewUserComment": res.data,
|
||||
"ReviewUserComment": res.data,
|
||||
}
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
try {
|
||||
/* await this.processes.PostTaskAction(body).toPromise(); */
|
||||
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
|
||||
this.httpErroHandle.httpsSucessMessagge('Rever')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.close();
|
||||
},((error) => {
|
||||
console.log('send event to revision error: ', error)
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
}));
|
||||
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.httpErroHandle.httpsSucessMessagge('Rever')
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
}, (error) => {
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
|
||||
}
|
||||
|
||||
goToEventsToApprove() {
|
||||
if(window.location.pathname.startsWith('/home/agenda')) {
|
||||
if (window.location.pathname.startsWith('/home/agenda')) {
|
||||
this.close()
|
||||
} else {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
|
||||
Reference in New Issue
Block a user