Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-11-24 15:10:15 +01:00
3 changed files with 47 additions and 31 deletions
+10 -20
View File
@@ -11,6 +11,7 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { StorageService } from 'src/app/services/storage.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -41,7 +42,8 @@ export class AppComponent {
private statusBar: StatusBar,
private screenOrientation: ScreenOrientation,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService
private backgroundservice: BackgroundService,
private storageservice: StorageService
) {
this.initializeApp();
}
@@ -58,27 +60,15 @@ export class AppComponent {
console.log('Orientation locked')
}
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
try {
this.sqliteservice.databaseConn();
} catch (error) {
console.log("Error creating local database: ", error)
}
}
window.addEventListener('online', () => {
console.log('Became online')
this.backgroundservice.online()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storageservice.get('networkCheckStore').then((network) => {
if(network === 'online') {
console.log('Network app componente check', network)
this.backgroundservice.online()
} else {
console.log('Network app componente check', network)
this.backgroundservice.offline();
}
});
window.addEventListener('offline', () => {
console.log('Became offline')
this.backgroundservice.offline()
});
})
});
}
+31 -10
View File
@@ -161,6 +161,7 @@ export class AgendaPage implements OnInit {
dropdownScrollWeal = false
CalendarStore = CalendarStore
listToPresent
array = []
constructor(
private alertCtrl: AlertController,
@@ -232,6 +233,8 @@ export class AgendaPage implements OnInit {
ngOnInit() {
this.getFromDB();
const pathname = window.location.pathname
let realoadCounter = 0
this.router.events.forEach((event) => {
@@ -240,14 +243,14 @@ export class AgendaPage implements OnInit {
this.segment = "Combinado";
}
if (realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
realoadCounter++;
}
});
this.backgroundservice.registerBackService('Online', () => {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
});
window.onresize = (event) => {
@@ -487,6 +490,7 @@ export class AgendaPage implements OnInit {
}
loadRangeEvents(startTime: Date, endTime: Date) {
this.array = [];
this.rangeStartDate = startTime
this.rangeEndDate = endTime
@@ -514,6 +518,7 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -540,13 +545,17 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
this.showLoader = false;
})
@@ -567,6 +576,7 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -603,6 +613,7 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -614,7 +625,10 @@ export class AgendaPage implements OnInit {
}
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
@@ -633,6 +647,8 @@ export class AgendaPage implements OnInit {
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -644,7 +660,10 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
}
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
@@ -674,6 +693,7 @@ export class AgendaPage implements OnInit {
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -685,7 +705,10 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
}
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
if (counter == 1 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
}
@@ -697,7 +720,6 @@ export class AgendaPage implements OnInit {
}
trasnformData(response,profile) {
let array = []
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
@@ -708,10 +730,9 @@ export class AgendaPage implements OnInit {
profile: profile,
id: element.EventId,
}
array.push(event)
this.array.push(event)
});
this.listToPresent = array;
this.listToPresent = this.array;
console.log('LIST TO PRESET', this.listToPresent)
}
+6 -1
View File
@@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { ThemeService } from 'src/app/services/theme.service';
import { StorageService} from 'src/app/services/storage.service';
@Injectable({
providedIn: 'root'
@@ -13,7 +14,8 @@ export class BackgroundService {
}[] = []
constructor(
private themeservice: ThemeService
private themeservice: ThemeService,
private storageservice: StorageService
) { }
online() {
@@ -24,6 +26,7 @@ export class BackgroundService {
document.body.style.setProperty(`--color3`, "#d9d9d9");
document.body.style.setProperty(`--color4`, "#d9d9d9ee");
document.body.style.setProperty(`--color5`, "#ececec");
this.storageservice.store('networkCheckStore','online');
} else {
document.body.style.setProperty(`--color`, "#0782C9");
@@ -31,6 +34,7 @@ export class BackgroundService {
document.body.style.setProperty(`--color3`, "#0782C9");
document.body.style.setProperty(`--color4`, "#0782c9f0");
document.body.style.setProperty(`--color5`, "#45BAFF");
this.storageservice.store('networkCheckStore','online');
}
this.callBacks.forEach((e) => {
@@ -46,6 +50,7 @@ export class BackgroundService {
document.body.style.setProperty(`--color3`, "#ffb703");
document.body.style.setProperty(`--color4`, "#ffb703");
document.body.style.setProperty(`--color5`, "#ffb703");
this.storageservice.store('networkCheckStore','offline');
this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx()