This commit is contained in:
tiago.kayaya
2021-10-20 10:38:54 +01:00
9 changed files with 77 additions and 97 deletions
+27 -53
View File
@@ -508,23 +508,7 @@ export class AgendaPage implements OnInit {
this.CalendarStore.pushEvent(response, 'md');
console.log('CALENDAR STORE', this.CalendarStore.eventSource)
let array = []
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: "md",
id: element.EventId,
}
array.push(event)
});
this.listToPresent = array;
console.log('LIST TO PRESET', this.listToPresent)
this.trasnformData(response,'md');
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -550,7 +534,7 @@ export class AgendaPage implements OnInit {
this.CalendarStore.removeRange(startTime, endTime, 'pr')
// calendar
this.CalendarStore.pushEvent(response, 'pr');
this.listToPresent = response;
this.trasnformData(response,'pr');
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -576,23 +560,7 @@ export class AgendaPage implements OnInit {
// startTime = 1, endTime = 31
this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(response, 'pr');
let array = []
response.array.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.profile,
id: element.EventId,
}
array.push(event)
});
this.listToPresent = array;
// this.CalendarStore.eventSource
this.trasnformData(response,'pr')
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -629,7 +597,7 @@ export class AgendaPage implements OnInit {
// loop
this.CalendarStore.pushEvent(eventsList, 'md');
this.listToPresent = eventsList;
this.trasnformData(response,'md')
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -659,7 +627,7 @@ export class AgendaPage implements OnInit {
/* this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(eventsList, 'pr'); */
this.listToPresent = eventsList;
this.trasnformData(response,'pr')
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -699,7 +667,7 @@ export class AgendaPage implements OnInit {
this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(eventsList, 'pr');
this.listToPresent = eventsList;
this.trasnformData(eventsList,'pr')
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -726,6 +694,25 @@ export class AgendaPage implements OnInit {
}
}
trasnformData(response,profile) {
let array = []
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: profile,
id: element.EventId,
}
array.push(event)
});
this.listToPresent = array;
console.log('LIST TO PRESET', this.listToPresent)
}
addEventToDB(response, profile) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
@@ -756,20 +743,7 @@ export class AgendaPage implements OnInit {
this.sqliteservice.getAllEvents().then((events: any[]) => {
console.log('ALL EVENTS FROM DB', events)
let eventArray = [];
events.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.Profile,
id: element.EventId,
}
eventArray.push(event);
});
this.listToPresent = eventArray
this.trasnformData(events,this.profile)
this.updateEventListBox()
this.myCal.update();
@@ -777,7 +751,7 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
this.showTimeline = true;
})
}
@@ -118,6 +118,8 @@ export class DespachoPrPage implements OnInit {
"activityInstanceName": res.activityInstanceName,
}
this.fulltask = res;
console.log(this.task);
console.log('GetTask', res);
@@ -111,6 +111,9 @@ export class ExpedientTaskModalPage implements OnInit {
this.loggeduser = userAuth.ValidatedUser;
this.task = this.navParams.get('task');
console.log('create dispatch with this data', this.task);
this.SearchFolder = this.navParams.get('SearchFolder');
this.aplicationId = this.navParams.get('aplicationId')
@@ -3,7 +3,7 @@ import { ActivatedRoute, NavigationStart, Router } from '@angular/router';
import { CalendarComponent } from 'ionic2-calendar';
import { customTask, DailyWorkTask } from '../../../models/dailyworktask.model';
import { ProcessesService } from 'src/app/services/processes.service';
import { ModalController, NavParams } from '@ionic/angular';
import { ModalController, NavParams, Platform } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { ModalService } from 'src/app/services/modal.service';
@@ -48,7 +48,8 @@ export class PedidosPage implements OnInit {
private modalService: ModalService,
private sqliteservice: SqliteService,
private sortService: SortService,
private backgroundservice: BackgroundService
private backgroundservice: BackgroundService,
private platform: Platform
) {
//Inicializar segment
this.segment = 'parecer';
@@ -158,7 +159,7 @@ export class PedidosPage implements OnInit {
}
this.parecerList.push(task);
});
this.sqliteservice.addProcess(this.parecerList);
this.addPedidoToDb(this.parecerList);
this.listToPresentparecerList = this.sortService.sortArrayISODate(this.parecerList);
}
@@ -198,7 +199,7 @@ export class PedidosPage implements OnInit {
}
});
});
this.sqliteservice.addProcess(this.deferimentoList);
this.addPedidoToDb(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(this.deferimentoList);
}
@@ -209,6 +210,13 @@ export class PedidosPage implements OnInit {
}
addPedidoToDb(pedido) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.addProcess(pedido);
}
}
getFromDb() {
let parecerlist = [];