mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix edit event to approve
This commit is contained in:
@@ -61,7 +61,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
private attachmentsService: AttachmentsService,
|
private attachmentsService: AttachmentsService,
|
||||||
) {
|
) {
|
||||||
this.activatedRoute.paramMap.subscribe(params => {
|
this.activatedRoute.paramMap.subscribe(params => {
|
||||||
//
|
//
|
||||||
|
|
||||||
if (params["params"].serialNumber) {
|
if (params["params"].serialNumber) {
|
||||||
this.serialNumber = params["params"].serialNumber;
|
this.serialNumber = params["params"].serialNumber;
|
||||||
@@ -72,7 +72,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window['approve-event-getTask'] = () => {
|
window['approve-event-getTask'] = () => {
|
||||||
this.getTask1()
|
this.getTask()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.getTask();
|
this.getTask();
|
||||||
this.backgroundservice.registerBackService('Online', () => {
|
this.backgroundservice.registerBackService('Online', () => {
|
||||||
this.getTask();
|
this.getTask();
|
||||||
@@ -95,12 +95,12 @@ export class ApproveEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addProcessToDB(data) {
|
addProcessToDB(data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessFromDB() {
|
getProcessFromDB() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getTask1 = () => {
|
getTask1 = () => {
|
||||||
@@ -108,11 +108,11 @@ export class ApproveEventPage implements OnInit {
|
|||||||
|
|
||||||
this.loadedEvent = res
|
this.loadedEvent = res
|
||||||
this.addProcessToDB(this.loadedEvent)
|
this.addProcessToDB(this.loadedEvent)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
this.today = new Date(this.loadedEvent.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()]);
|
||||||
|
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
// console.log(this.loadedEvent)
|
// console.log(this.loadedEvent)
|
||||||
throw(error)
|
throw(error)
|
||||||
@@ -133,11 +133,11 @@ export class ApproveEventPage implements OnInit {
|
|||||||
this.loadedEvent = res
|
this.loadedEvent = res
|
||||||
this.getAttachments();
|
this.getAttachments();
|
||||||
this.addProcessToDB(this.loadedEvent)
|
this.addProcessToDB(this.loadedEvent)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
this.today = new Date(this.loadedEvent.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()]);
|
||||||
|
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
// console.log(this.loadedEvent)
|
// console.log(this.loadedEvent)
|
||||||
throw(error)
|
throw(error)
|
||||||
@@ -154,7 +154,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
|
|
||||||
async approveTask(serialNumber: string) {
|
async approveTask(serialNumber: string) {
|
||||||
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
|
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
|
||||||
|
|
||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async emendTask(serialNumber: string) {
|
async emendTask(serialNumber: string) {
|
||||||
|
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: EmendMessageModalPage,
|
component: EmendMessageModalPage,
|
||||||
@@ -188,9 +188,9 @@ export class ApproveEventPage implements OnInit {
|
|||||||
|
|
||||||
modal.onDidDismiss()
|
modal.onDidDismiss()
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
|
||||||
if(res.data.option == 'save') {
|
if(res.data.option == 'save') {
|
||||||
|
|
||||||
let body = {
|
let body = {
|
||||||
"serialNumber": serialNumber,
|
"serialNumber": serialNumber,
|
||||||
"action": "Emendar",
|
"action": "Emendar",
|
||||||
@@ -198,14 +198,14 @@ export class ApproveEventPage implements OnInit {
|
|||||||
"ReviewUserComment": res.data,
|
"ReviewUserComment": res.data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.processes.PostTaskAction(body).toPromise()
|
await this.processes.PostTaskAction(body).toPromise()
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
||||||
this.offlineManager.storeRequestData('event-listRever', body);
|
this.offlineManager.storeRequestData('event-listRever', body);
|
||||||
});
|
});
|
||||||
this.httpErrorHandle.httpsSucessMessagge('Rever')
|
this.httpErrorHandle.httpsSucessMessagge('Rever')
|
||||||
@@ -217,7 +217,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
loader.remove()
|
loader.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@@ -229,7 +229,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
|
|
||||||
async rejeitar(serialNumber: string) {
|
async rejeitar(serialNumber: string) {
|
||||||
let body = { "serialNumber": serialNumber, "action": "Descartar" }
|
let body = { "serialNumber": serialNumber, "action": "Descartar" }
|
||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
try {
|
try {
|
||||||
await this.processes.PostTaskAction(body).toPromise();
|
await this.processes.PostTaskAction(body).toPromise();
|
||||||
@@ -281,6 +281,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
return await popover.present().then(() => {
|
return await popover.present().then(() => {
|
||||||
this.TaskService.loadEventosParaAprovacao()
|
this.TaskService.loadEventosParaAprovacao()
|
||||||
|
this.getTask();
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
})
|
})
|
||||||
@@ -302,9 +303,9 @@ export class ApproveEventPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
modal.onDidDismiss().then(async (res) => {
|
modal.onDidDismiss().then(async (res) => {
|
||||||
|
|
||||||
if(res.data.option == 'save') {
|
if(res.data.option == 'save') {
|
||||||
|
|
||||||
let body = {
|
let body = {
|
||||||
"serialNumber": serialNumber,
|
"serialNumber": serialNumber,
|
||||||
"action": "Emendar",
|
"action": "Emendar",
|
||||||
@@ -312,7 +313,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
"ReviewUserComment": res.data,
|
"ReviewUserComment": res.data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
@@ -327,7 +328,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
loader.remove()
|
loader.remove()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -380,7 +381,7 @@ export class ApproveEventPage implements OnInit {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('getAttchaments',error)
|
console.error('getAttchaments',error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<div class="title-content">
|
<div class="title-content">
|
||||||
<div class="middle">
|
<div class="middle">
|
||||||
<ion-label class="title">Editar evento por aprovar ccxcxcxc</ion-label> <br>
|
<ion-label class="title">Editar evento por aprovar</ion-label> <br>
|
||||||
<i style="margin-top: -5px; font-size: 15px;" > Campos marcados com * são obrigatórios</i>
|
<i style="margin-top: -5px; font-size: 15px;" > Campos marcados com * são obrigatórios</i>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
async getTask() {
|
async getTask() {
|
||||||
|
|
||||||
const result = await this.processes.GetTask(this.serialNumber).toPromise();
|
const result = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||||
|
|
||||||
|
|
||||||
this.eventProcess = result
|
this.eventProcess = result
|
||||||
this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType
|
this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType
|
||||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
||||||
@@ -190,17 +190,17 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
|
|
||||||
getRecurrenceTypes() {
|
getRecurrenceTypes() {
|
||||||
this.eventsService.getRecurrenceTypes().subscribe(res=>{
|
this.eventsService.getRecurrenceTypes().subscribe(res=>{
|
||||||
|
|
||||||
this.recurringTypes = res;
|
this.recurringTypes = res;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectedRecurringChanged(ev:any){
|
onSelectedRecurringChanged(ev:any){
|
||||||
|
|
||||||
this.calculetedLastOccurrence(ev);
|
this.calculetedLastOccurrence(ev);
|
||||||
|
|
||||||
if(ev.length > 1){
|
if(ev.length > 1){
|
||||||
|
|
||||||
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
|
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
|
||||||
}
|
}
|
||||||
if(ev.length == 0){
|
if(ev.length == 0){
|
||||||
@@ -209,7 +209,7 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculetedLastOccurrence(type:number){
|
calculetedLastOccurrence(type:number){
|
||||||
var valor;
|
var valor;
|
||||||
var opcao: boolean;
|
var opcao: boolean;
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
valor = 7;
|
valor = 7;
|
||||||
@@ -235,15 +235,15 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
|
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
|
||||||
} else {
|
} else {
|
||||||
time = new Date(
|
time = new Date(
|
||||||
time.getFullYear() + valor,
|
time.getFullYear() + valor,
|
||||||
time.getMonth(),
|
time.getMonth(),
|
||||||
time.getDate(),
|
time.getDate(),
|
||||||
time.getHours(),
|
time.getHours(),
|
||||||
time.getMinutes()
|
time.getMinutes()
|
||||||
);
|
);
|
||||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
|
this.eventProcess.workflowInstanceDataFields.LastOccurrence = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openLastOccurrence() {
|
openLastOccurrence() {
|
||||||
@@ -318,24 +318,26 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
if(document['action'] == 'add') {
|
if(document['action'] == 'add') {
|
||||||
delete document.action
|
delete document.action
|
||||||
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
|
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
|
||||||
this.toastService._successMessage();
|
window['approve-event-getTask'] ()
|
||||||
|
// this.toastService._successMessage();
|
||||||
}, error =>{
|
}, error =>{
|
||||||
if(error.status == 0) {
|
if(error.status == 0) {
|
||||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.toastService._badRequest();
|
this.toastService._badRequest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if(document['action'] == 'delete') {
|
} else if(document['action'] == 'delete') {
|
||||||
delete document.action
|
delete document.action
|
||||||
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
|
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
|
||||||
this.toastService._successMessage()
|
window['approve-event-getTask'] ()
|
||||||
|
// this.toastService._successMessage()
|
||||||
}, error =>{
|
}, error =>{
|
||||||
if(error.status == 0) {
|
if(error.status == 0) {
|
||||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.toastService._badRequest()
|
this.toastService._badRequest()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -360,7 +362,7 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
backdropDismiss: false
|
backdropDismiss: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
modal.onDidDismiss().then((data) => {
|
modal.onDidDismiss().then((data) => {
|
||||||
|
|
||||||
@@ -372,7 +374,7 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
|
|
||||||
this.setIntervenient(newAttendees);
|
this.setIntervenient(newAttendees);
|
||||||
this.setIntervenientCC(newAttendeesCC);
|
this.setIntervenientCC(newAttendeesCC);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
@@ -420,7 +422,7 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
|
|
||||||
this.loadedAttachments = result
|
this.loadedAttachments = result
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteAttachment(attachment: Attachment, index) {
|
deleteAttachment(attachment: Attachment, index) {
|
||||||
@@ -463,7 +465,7 @@ export class EditEventToApproveComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
this.loadedAttachments.push(DocumentToSave)
|
this.loadedAttachments.push(DocumentToSave)
|
||||||
|
|
||||||
|
|
||||||
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
||||||
// this.getAttachments();
|
// this.getAttachments();
|
||||||
|
|||||||
Reference in New Issue
Block a user