mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
Offline web almost done
This commit is contained in:
@@ -9,6 +9,7 @@ import { momentG } from 'src/plugin/momentG';
|
|||||||
import { DomSanitizer } from "@angular/platform-browser";
|
import { DomSanitizer } from "@angular/platform-browser";
|
||||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||||
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
// showTimeline
|
// showTimeline
|
||||||
import { setHours, setMinutes } from 'date-fns';
|
import { setHours, setMinutes } from 'date-fns';
|
||||||
@@ -179,7 +180,8 @@ export class AgendaPage implements OnInit {
|
|||||||
private sqliteservice: SqliteService,
|
private sqliteservice: SqliteService,
|
||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
private backgroundservice: BackgroundService,
|
private backgroundservice: BackgroundService,
|
||||||
public ThemeService: ThemeService
|
public ThemeService: ThemeService,
|
||||||
|
private storage:Storage
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.dateAdapter.setLocale('es');
|
this.dateAdapter.setLocale('es');
|
||||||
@@ -770,6 +772,27 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
addEventToDB(response, profile) {
|
addEventToDB(response, profile) {
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
let responseArray = [];
|
||||||
|
response.forEach(element => {
|
||||||
|
let event = {
|
||||||
|
CalendarId: element.CalendarId,
|
||||||
|
CalendarName: element.CalendarName,
|
||||||
|
EndDate: element.EndDate,
|
||||||
|
EventId: element.EventId,
|
||||||
|
HasAttachments: element.HasAttachments,
|
||||||
|
HumanDate: element.HumanDate,
|
||||||
|
IsAllDayEvent: element.IsAllDayEvent,
|
||||||
|
Location: element.Location,
|
||||||
|
StartDate: element.StartDate,
|
||||||
|
Subject: element.Subject,
|
||||||
|
Profile: profile
|
||||||
|
}
|
||||||
|
responseArray.push(event)
|
||||||
|
|
||||||
|
});
|
||||||
|
this.storage.set('agendaResponse',responseArray).then(() => {
|
||||||
|
console.log('Agenda data saved')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
if (response.length > 0) {
|
if (response.length > 0) {
|
||||||
|
|
||||||
@@ -796,6 +819,18 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
console.log('ALL EVENTS FROM DB AGENDA OFFLINE')
|
console.log('ALL EVENTS FROM DB AGENDA OFFLINE')
|
||||||
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.storage.get('agendaResponse').then((events) => {
|
||||||
|
this.trasnformDataDB(events)
|
||||||
|
this.updateEventListBox()
|
||||||
|
|
||||||
|
this.myCal.update();
|
||||||
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
|
this.showLoader = false;
|
||||||
|
this.showTimeline = true;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.sqliteservice.getAllEvents().then((events: any[]) => {
|
this.sqliteservice.getAllEvents().then((events: any[]) => {
|
||||||
console.log('ALL EVENTS FROM DB', events)
|
console.log('ALL EVENTS FROM DB', events)
|
||||||
let eventArray = [];
|
let eventArray = [];
|
||||||
@@ -813,6 +848,8 @@ export class AgendaPage implements OnInit {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
updateEventListBox() {
|
updateEventListBox() {
|
||||||
|
|
||||||
if (window.innerWidth < 800) {
|
if (window.innerWidth < 800) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { BackgroundService } from 'src/app/services/background.service';
|
|||||||
import { StorageService } from 'src/app/services/storage.service';
|
import { StorageService } from 'src/app/services/storage.service';
|
||||||
import { ThemeService } from 'src/app/services/theme.service'
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
import { RouteService } from 'src/app/services/route.service';
|
import { RouteService } from 'src/app/services/route.service';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -74,6 +75,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
private storage: StorageService,
|
private storage: StorageService,
|
||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private RouteService: RouteService,
|
private RouteService: RouteService,
|
||||||
|
private ionicStorage: Storage
|
||||||
) {
|
) {
|
||||||
this.isEventEdited = false;
|
this.isEventEdited = false;
|
||||||
this.loadedEvent = new Event();
|
this.loadedEvent = new Event();
|
||||||
@@ -394,6 +396,9 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
addEventToDb(data) {
|
addEventToDb(data) {
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.ionicStorage.set('eventDetails', data).then(() => {
|
||||||
|
console.log('Details event saved')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
let event = {
|
let event = {
|
||||||
Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
|
Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
|
||||||
@@ -423,6 +428,11 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
getFromDb() {
|
getFromDb() {
|
||||||
const loader = this.toastService.loading();
|
const loader = this.toastService.loading();
|
||||||
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.ionicStorage.get('eventDetails').then((events) =>{
|
||||||
|
this.loadedEvent = events;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||||
let arrayevent = [];
|
let arrayevent = [];
|
||||||
console.log('EVENT ATTENDEES',event[0].Attendees)
|
console.log('EVENT ATTENDEES',event[0].Attendees)
|
||||||
@@ -450,6 +460,8 @@ export class ViewEventPage implements OnInit {
|
|||||||
this.loadedEvent = arrayevent[0];
|
this.loadedEvent = arrayevent[0];
|
||||||
console.log("Event ditails local,", elemet)
|
console.log("Event ditails local,", elemet)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
loader.remove()
|
loader.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { NetworkConnectionService } from 'src/app/services/network-connection.se
|
|||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
import { momentG } from 'src/plugin/momentG';
|
import { momentG } from 'src/plugin/momentG';
|
||||||
import { ThemeService } from 'src/app/services/theme.service'
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-events',
|
selector: 'app-events',
|
||||||
templateUrl: './events.page.html',
|
templateUrl: './events.page.html',
|
||||||
@@ -95,7 +96,8 @@ export class EventsPage implements OnInit {
|
|||||||
private sqliteservice: SqliteService,
|
private sqliteservice: SqliteService,
|
||||||
private networkconnection: NetworkConnectionService,
|
private networkconnection: NetworkConnectionService,
|
||||||
private backgroundservice: BackgroundService,
|
private backgroundservice: BackgroundService,
|
||||||
public ThemeService: ThemeService
|
public ThemeService: ThemeService,
|
||||||
|
private storage: Storage
|
||||||
) {
|
) {
|
||||||
/* this.existingScreenOrientation = this.screenOrientation.type;
|
/* this.existingScreenOrientation = this.screenOrientation.type;
|
||||||
console.log(this.existingScreenOrientation); */
|
console.log(this.existingScreenOrientation); */
|
||||||
@@ -317,6 +319,9 @@ export class EventsPage implements OnInit {
|
|||||||
addEventToDb(list) {
|
addEventToDb(list) {
|
||||||
|
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.storage.set('events', list).then(() => {
|
||||||
|
console.log('Init events saved')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
list.forEach(element => {
|
list.forEach(element => {
|
||||||
@@ -359,6 +364,9 @@ export class EventsPage implements OnInit {
|
|||||||
addProcessToDb(list) {
|
addProcessToDb(list) {
|
||||||
|
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.storage.set('process', list).then(() => {
|
||||||
|
console.log('Init process saved')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
list.forEach(element => {
|
list.forEach(element => {
|
||||||
@@ -376,6 +384,23 @@ export class EventsPage implements OnInit {
|
|||||||
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
|
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
|
||||||
console.log('dateeeeee', dateToday)
|
console.log('dateeeeee', dateToday)
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.storage.get('events').then((events: any[]) => {
|
||||||
|
console.log('Today events',events)
|
||||||
|
let todayEvents = new Array()
|
||||||
|
this.listToPresent = events
|
||||||
|
this.totalEvent = this.listToPresent.length
|
||||||
|
this.currentEvent = this.listToPresent[0].Subject
|
||||||
|
this.currentHoursMinutes = this.listToPresent[0].StartDate
|
||||||
|
console.log("All events from local,", events)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.storage.get('process').then((process: any[]) => {
|
||||||
|
console.log('OFOFOFOOF22222', process)
|
||||||
|
const ExpedienteTask = process.map(e => this.expedienteTaskPipe.transform(e))
|
||||||
|
this.listToPresentexpediente = ExpedienteTask;
|
||||||
|
})
|
||||||
|
|
||||||
|
this.showLoader = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.sqliteservice.getAllEvents().then((event: any[]) => {
|
this.sqliteservice.getAllEvents().then((event: any[]) => {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { Platform } from '@ionic/angular';
|
|||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
import { SortService } from 'src/app/services/functions/sort.service';
|
import { SortService } from 'src/app/services/functions/sort.service';
|
||||||
import { DataService } from 'src/app/services/data.service';
|
import { DataService } from 'src/app/services/data.service';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gabinete-digital',
|
selector: 'app-gabinete-digital',
|
||||||
@@ -135,6 +136,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private sortService: SortService,
|
private sortService: SortService,
|
||||||
private dataService: DataService,
|
private dataService: DataService,
|
||||||
|
private storage: Storage
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.loggeduser = authService.ValidatedUser;
|
this.loggeduser = authService.ValidatedUser;
|
||||||
@@ -215,7 +217,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
|||||||
addProcessToDB(data) {
|
addProcessToDB(data) {
|
||||||
this.platform.ready().then(() => {
|
this.platform.ready().then(() => {
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.storage.set('GabineteProcess', data).then(() => {
|
||||||
|
console.log('Gabinete process saved')
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
|
|
||||||
@@ -245,7 +249,39 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
|||||||
getAllProcessFromDB() {
|
getAllProcessFromDB() {
|
||||||
|
|
||||||
this.hideRefreshButton();
|
this.hideRefreshButton();
|
||||||
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.storage.get('GabineteProcess').then((allprocess: any[]) => {
|
||||||
|
console.log('ALL PROCESS WEB',allprocess )
|
||||||
|
allprocess.forEach(element => {
|
||||||
|
let date = new Date(element.taskStartDate);
|
||||||
|
date.setMonth(date.getMonth() + 1);
|
||||||
|
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||||
|
|
||||||
|
let task = {
|
||||||
|
"SerialNumber": element.serialNumber,
|
||||||
|
"Folio": element.workflowInstanceDataFields.Subject,
|
||||||
|
"Senders": element.workflowInstanceDataFields.Sender,
|
||||||
|
//"CreateDate": taskDate,
|
||||||
|
"CreateDate": new Date(element.taskStartDate),
|
||||||
|
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||||
|
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||||
|
"DocumentsQty": element.totalDocuments,
|
||||||
|
"DocId": element.workflowInstanceDataFields.DispatchDocId,
|
||||||
|
"FolderID": element.workflowInstanceDataFields.FolderID,
|
||||||
|
"WorkflowName": element.workflowDisplayName,
|
||||||
|
"activityInstanceName": element.activityInstanceName,
|
||||||
|
"Status": element.workflowInstanceDataFields.Status,
|
||||||
|
"Agenda": element.workflowInstanceDataFields.Agenda,
|
||||||
|
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
|
||||||
|
}
|
||||||
|
|
||||||
|
this.allProcessesList.push(task);
|
||||||
|
this.allProcessesList = removeDuplicate(this.allProcessesList);
|
||||||
|
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
|
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
|
||||||
allprocess.forEach(element => {
|
allprocess.forEach(element => {
|
||||||
let date = new Date(element.taskStartDate);
|
let date = new Date(element.taskStartDate);
|
||||||
@@ -280,6 +316,12 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dataTranform(data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
sortArrayISODate(myArray: any) {
|
sortArrayISODate(myArray: any) {
|
||||||
return myArray.sort(function (a, b) {
|
return myArray.sort(function (a, b) {
|
||||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||||
@@ -495,6 +537,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
|||||||
let allProcessesList = allPreocesses_;
|
let allProcessesList = allPreocesses_;
|
||||||
|
|
||||||
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento')
|
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento')
|
||||||
|
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Revisar Diploma')
|
||||||
|
|
||||||
if (!this.p.userRole(['PR'])) {
|
if (!this.p.userRole(['PR'])) {
|
||||||
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
|
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
|
||||||
|
|||||||
Reference in New Issue
Block a user