mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Bug fix
This commit is contained in:
@@ -500,7 +500,7 @@ export class AgendaPage implements OnInit {
|
||||
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).then(
|
||||
|
||||
(response:any) => {
|
||||
|
||||
console.log('All events MD', response)
|
||||
|
||||
// calendar
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'md')
|
||||
@@ -524,6 +524,7 @@ export class AgendaPage implements OnInit {
|
||||
else if(this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
this.eventService.getAllSharedEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => {
|
||||
console.log('All events PR', response)
|
||||
|
||||
this.CalendarStore.removeRange(startTime, endTime, 'pr')
|
||||
// calendar
|
||||
|
||||
@@ -94,23 +94,16 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
synchro.registerCallback('Online', () => {
|
||||
if(synchro.connected === true) {
|
||||
this.loadEvent();
|
||||
console.log('Onlineee view-event')
|
||||
|
||||
})
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
this.loadedEvent = event[0];
|
||||
console.log("Event ditails local,", event[0])
|
||||
})
|
||||
console.log('Offlineee')
|
||||
} else {
|
||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
this.loadedEvent = event[0];
|
||||
console.log("Event ditails local,", event[0])
|
||||
})
|
||||
|
||||
})
|
||||
console.log('Offlineee')
|
||||
}
|
||||
|
||||
/* this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
this.loadedEvent = event[0];
|
||||
@@ -160,6 +153,7 @@ export class ViewEventPage implements OnInit {
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
this.loadedEvent = res;
|
||||
this.sqliteservice.addEvent(res);
|
||||
console.log('Loaded one event', res)
|
||||
/* this.today = new Date(res.StartDate);
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
|
||||
loader.remove()
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-events',
|
||||
@@ -92,6 +93,7 @@ export class EventsPage implements OnInit {
|
||||
private screenOrientation: ScreenOrientation,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.existingScreenOrientation = this.screenOrientation.type;
|
||||
console.log(this.existingScreenOrientation);
|
||||
@@ -106,10 +108,13 @@ export class EventsPage implements OnInit {
|
||||
|
||||
});
|
||||
|
||||
try {
|
||||
this.sqliteservice.databaseConn();
|
||||
} catch (error) {
|
||||
console.log("Error creating local database: ", error)
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
try {
|
||||
this.sqliteservice.databaseConn();
|
||||
} catch (error) {
|
||||
console.log("Error creating local database: ", error)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,6 +124,20 @@ export class EventsPage implements OnInit {
|
||||
this.segment = "Combinada";
|
||||
this.profile = "mdgpr";
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == '/home/events') {
|
||||
this.RefreshEvents();
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1500)
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
}
|
||||
|
||||
this.getEventsFromLocalDb();
|
||||
|
||||
//this.checkScreenOrientation();
|
||||
@@ -185,9 +204,14 @@ export class EventsPage implements OnInit {
|
||||
|
||||
const list = mdOficialEvents.concat(mdPessoalEvents);
|
||||
console.log("getAllMdOficialPessoalEvents", list)
|
||||
/* list.forEach(element => {
|
||||
this.sqliteservice.addEvent(element)
|
||||
}); */
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
if(list.length > 0) {
|
||||
list.forEach(element => {
|
||||
this.sqliteservice.addEvent(element)
|
||||
});
|
||||
}
|
||||
}
|
||||
this.listToPresent = list
|
||||
|
||||
|
||||
@@ -208,10 +232,14 @@ export class EventsPage implements OnInit {
|
||||
|
||||
const list = prOficialEvents.concat(prPessoalEvents);
|
||||
console.log("getAllPrOficialPessoalEvents", list)
|
||||
/* list.forEach(element => {
|
||||
this.sqliteservice.addEvent(element)
|
||||
}); */
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
if(list.length > 0) {
|
||||
list.forEach(element => {
|
||||
this.sqliteservice.addEvent(element)
|
||||
});
|
||||
}
|
||||
}
|
||||
if (list.length > 0) {
|
||||
this.currentEvent = list[0].Subject;
|
||||
this.currentHoursMinutes = list[0].StartDate;
|
||||
@@ -296,6 +324,52 @@ export class EventsPage implements OnInit {
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
window.addEventListener('online',() => {
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == '/home/events') {
|
||||
this.RefreshEvents();
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1500)
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
})
|
||||
|
||||
window.addEventListener('offline', () => {
|
||||
this.sqliteservice.getAllEvents().then((event:any[]) => {
|
||||
this.listToPresent = event
|
||||
this.totalEvent = this.listToPresent.length
|
||||
this.currentEvent = this.listToPresent[0].Subject
|
||||
this.currentHoursMinutes = this.listToPresent[0].StartDate
|
||||
console.log("All events from local,", event)
|
||||
})
|
||||
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[]) => {
|
||||
var expedientlist = [];
|
||||
process.forEach((element) => {
|
||||
let task = {
|
||||
CreateDate: element.taskStartDate,
|
||||
DocumentsQty: element.totalDocuments,
|
||||
Senders: JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
SerialNumber: element.serialNumber,
|
||||
Status: JSON.parse(element.workflowInstanceDataFields).Status,
|
||||
Subject: JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
WorkflowName: element.workflowDisplayName,
|
||||
activityInstanceName: element.activityInstanceName,
|
||||
taskStartDate: element.taskStartDate,
|
||||
}
|
||||
expedientlist.push(task);
|
||||
})
|
||||
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
|
||||
this.listToPresentexpediente = ExpedienteTask;
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
if (synchro.connected === true) {
|
||||
this.showGreeting();
|
||||
|
||||
@@ -396,7 +470,11 @@ export class EventsPage implements OnInit {
|
||||
LoadList() {
|
||||
this.processes.GetTaskListExpediente(false).subscribe(result => {
|
||||
console.log("Expediente", result);
|
||||
this.sqliteservice.addProcess(result)
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
} else {
|
||||
this.sqliteservice.addProcess(result)
|
||||
}
|
||||
|
||||
const ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user