mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
This commit is contained in:
+10
-20
@@ -11,6 +11,7 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
|
|||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
||||||
|
import { StorageService } from 'src/app/services/storage.service';
|
||||||
|
|
||||||
|
|
||||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||||
@@ -41,7 +42,8 @@ export class AppComponent {
|
|||||||
private statusBar: StatusBar,
|
private statusBar: StatusBar,
|
||||||
private screenOrientation: ScreenOrientation,
|
private screenOrientation: ScreenOrientation,
|
||||||
private sqliteservice: SqliteService,
|
private sqliteservice: SqliteService,
|
||||||
private backgroundservice: BackgroundService
|
private backgroundservice: BackgroundService,
|
||||||
|
private storageservice: StorageService
|
||||||
) {
|
) {
|
||||||
this.initializeApp();
|
this.initializeApp();
|
||||||
}
|
}
|
||||||
@@ -58,27 +60,15 @@ export class AppComponent {
|
|||||||
console.log('Orientation locked')
|
console.log('Orientation locked')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
this.storageservice.get('networkCheckStore').then((network) => {
|
||||||
|
if(network === 'online') {
|
||||||
} else {
|
console.log('Network app componente check', network)
|
||||||
try {
|
this.backgroundservice.online()
|
||||||
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')) {
|
|
||||||
} else {
|
} else {
|
||||||
|
console.log('Network app componente check', network)
|
||||||
|
this.backgroundservice.offline();
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
window.addEventListener('offline', () => {
|
|
||||||
console.log('Became offline')
|
|
||||||
this.backgroundservice.offline()
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ export class AgendaPage implements OnInit {
|
|||||||
dropdownScrollWeal = false
|
dropdownScrollWeal = false
|
||||||
CalendarStore = CalendarStore
|
CalendarStore = CalendarStore
|
||||||
listToPresent
|
listToPresent
|
||||||
|
array = []
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private alertCtrl: AlertController,
|
private alertCtrl: AlertController,
|
||||||
@@ -232,6 +233,8 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
|
this.getFromDB();
|
||||||
|
|
||||||
const pathname = window.location.pathname
|
const pathname = window.location.pathname
|
||||||
let realoadCounter = 0
|
let realoadCounter = 0
|
||||||
this.router.events.forEach((event) => {
|
this.router.events.forEach((event) => {
|
||||||
@@ -240,14 +243,14 @@ export class AgendaPage implements OnInit {
|
|||||||
this.segment = "Combinado";
|
this.segment = "Combinado";
|
||||||
}
|
}
|
||||||
if (realoadCounter != 0) {
|
if (realoadCounter != 0) {
|
||||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||||
}
|
}
|
||||||
realoadCounter++;
|
realoadCounter++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.backgroundservice.registerBackService('Online', () => {
|
this.backgroundservice.registerBackService('Online', () => {
|
||||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onresize = (event) => {
|
window.onresize = (event) => {
|
||||||
@@ -487,6 +490,7 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadRangeEvents(startTime: Date, endTime: Date) {
|
loadRangeEvents(startTime: Date, endTime: Date) {
|
||||||
|
this.array = [];
|
||||||
|
|
||||||
this.rangeStartDate = startTime
|
this.rangeStartDate = startTime
|
||||||
this.rangeEndDate = endTime
|
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 })
|
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.update();
|
||||||
this.myCal.loadEvents();
|
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 })
|
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.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
this.showTimeline = true;
|
this.showTimeline = true;
|
||||||
|
|
||||||
}).finally(() => {
|
}).catch((error) => {
|
||||||
|
this.getFromDB()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
this.showLoader = false;
|
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 })
|
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.update();
|
||||||
this.myCal.loadEvents();
|
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 })
|
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.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
@@ -614,7 +625,10 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}).finally(() => {
|
}).catch((error) => {
|
||||||
|
this.getFromDB()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
counter++;
|
counter++;
|
||||||
if (counter == 2) {
|
if (counter == 2) {
|
||||||
this.showLoader = false;
|
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 })
|
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.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
@@ -644,7 +660,10 @@ export class AgendaPage implements OnInit {
|
|||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).finally(() => {
|
}).catch((error) => {
|
||||||
|
this.getFromDB()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
counter++;
|
counter++;
|
||||||
if (counter == 2) {
|
if (counter == 2) {
|
||||||
this.showLoader = false;
|
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 })
|
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.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
@@ -685,7 +705,10 @@ export class AgendaPage implements OnInit {
|
|||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}).finally(() => {
|
}).catch((error) => {
|
||||||
|
this.getFromDB()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
if (counter == 1 || this.loggeduser.Profile == 'PR') {
|
if (counter == 1 || this.loggeduser.Profile == 'PR') {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
@@ -697,7 +720,6 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trasnformData(response,profile) {
|
trasnformData(response,profile) {
|
||||||
let array = []
|
|
||||||
response.forEach(element => {
|
response.forEach(element => {
|
||||||
let event = {
|
let event = {
|
||||||
startTime: new Date(element.StartDate),
|
startTime: new Date(element.StartDate),
|
||||||
@@ -708,10 +730,9 @@ export class AgendaPage implements OnInit {
|
|||||||
profile: profile,
|
profile: profile,
|
||||||
id: element.EventId,
|
id: element.EventId,
|
||||||
}
|
}
|
||||||
array.push(event)
|
this.array.push(event)
|
||||||
});
|
});
|
||||||
|
this.listToPresent = this.array;
|
||||||
this.listToPresent = array;
|
|
||||||
console.log('LIST TO PRESET', this.listToPresent)
|
console.log('LIST TO PRESET', this.listToPresent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ThemeService } from 'src/app/services/theme.service';
|
import { ThemeService } from 'src/app/services/theme.service';
|
||||||
|
import { StorageService} from 'src/app/services/storage.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -13,7 +14,8 @@ export class BackgroundService {
|
|||||||
}[] = []
|
}[] = []
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private themeservice: ThemeService
|
private themeservice: ThemeService,
|
||||||
|
private storageservice: StorageService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
online() {
|
online() {
|
||||||
@@ -24,6 +26,7 @@ export class BackgroundService {
|
|||||||
document.body.style.setProperty(`--color3`, "#d9d9d9");
|
document.body.style.setProperty(`--color3`, "#d9d9d9");
|
||||||
document.body.style.setProperty(`--color4`, "#d9d9d9ee");
|
document.body.style.setProperty(`--color4`, "#d9d9d9ee");
|
||||||
document.body.style.setProperty(`--color5`, "#ececec");
|
document.body.style.setProperty(`--color5`, "#ececec");
|
||||||
|
this.storageservice.store('networkCheckStore','online');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
document.body.style.setProperty(`--color`, "#0782C9");
|
document.body.style.setProperty(`--color`, "#0782C9");
|
||||||
@@ -31,6 +34,7 @@ export class BackgroundService {
|
|||||||
document.body.style.setProperty(`--color3`, "#0782C9");
|
document.body.style.setProperty(`--color3`, "#0782C9");
|
||||||
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
||||||
document.body.style.setProperty(`--color5`, "#45BAFF");
|
document.body.style.setProperty(`--color5`, "#45BAFF");
|
||||||
|
this.storageservice.store('networkCheckStore','online');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.callBacks.forEach((e) => {
|
this.callBacks.forEach((e) => {
|
||||||
@@ -46,6 +50,7 @@ export class BackgroundService {
|
|||||||
document.body.style.setProperty(`--color3`, "#ffb703");
|
document.body.style.setProperty(`--color3`, "#ffb703");
|
||||||
document.body.style.setProperty(`--color4`, "#ffb703");
|
document.body.style.setProperty(`--color4`, "#ffb703");
|
||||||
document.body.style.setProperty(`--color5`, "#ffb703");
|
document.body.style.setProperty(`--color5`, "#ffb703");
|
||||||
|
this.storageservice.store('networkCheckStore','offline');
|
||||||
this.callBacks.forEach((e) => {
|
this.callBacks.forEach((e) => {
|
||||||
if (e.type == 'Offline') {
|
if (e.type == 'Offline') {
|
||||||
e.funx()
|
e.funx()
|
||||||
|
|||||||
Reference in New Issue
Block a user