mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Mobile first
This commit is contained in:
+83
-65
@@ -31,7 +31,7 @@ export class HomePage implements OnInit {
|
||||
totalExpediente = 0;
|
||||
profile: string;
|
||||
|
||||
constructor(private ngZone: NgZone,private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
|
||||
constructor(private zone: NgZone, private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
|
||||
|
||||
ngOnInit() {
|
||||
//Initialize profile as mdgpr
|
||||
@@ -52,38 +52,56 @@ export class HomePage implements OnInit {
|
||||
this.processesbackend.GetTasksList("Expediente", true).subscribe(result => {
|
||||
this.totalExpediente = result;
|
||||
});
|
||||
/*
|
||||
(PushNotifications as any).requestPermission().then(result => {
|
||||
PushNotifications.register();
|
||||
|
||||
//Mobile first
|
||||
|
||||
/* WLAuthorizationManager.obtainAccessToken("").then(
|
||||
(token) => {
|
||||
console.log('--> pingMFP(): Success ', token);
|
||||
this.zone.run(() => {
|
||||
//this.title = "Yay!";
|
||||
//this.status = "Connected to MobileFirst Server";
|
||||
});
|
||||
|
||||
PushNotifications.addListener(
|
||||
'registration',
|
||||
(token: PushNotificationToken) => {
|
||||
alert('Push registration success, token: ' + token.value);
|
||||
console.log('FIREBASE: ', token.value)
|
||||
this.storageService.store(this.username,token.value);
|
||||
},
|
||||
var resourceRequest = new WLResourceRequest( "/adapters/javaAdapter/resource/greet/",
|
||||
WLResourceRequest.GET
|
||||
);
|
||||
|
||||
resourceRequest.setQueryParameter("name", "world");
|
||||
resourceRequest.send().then(
|
||||
(response) => {
|
||||
// Will display "Hello world" in an alert dialog.
|
||||
alert("Success: " + response.responseText);
|
||||
},
|
||||
(error) => {
|
||||
alert("Failure: " + JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('--> pingMFP(): failure ', error.responseText);
|
||||
this.zone.run(() => {
|
||||
//this.title = "Bummer...";
|
||||
//this.status = "Failed to connect to MobileFirst Server";
|
||||
});
|
||||
}
|
||||
); */
|
||||
|
||||
console.log(this.storageService.get(this.username)) */
|
||||
|
||||
PushNotifications.addListener('registrationError', (error: any) => {
|
||||
alert('Error on registration: ' + JSON.stringify(error));
|
||||
});
|
||||
|
||||
PushNotifications.addListener('pushNotificationReceived', notification => {
|
||||
PushNotifications.addListener('pushNotificationReceived', notification => {
|
||||
|
||||
//const isPushNotification = !!notification.title || !!notification.body;
|
||||
|
||||
|
||||
// if this is a push notification received when the app is in the foreground on Android
|
||||
//if (isAndroid && isPushNotification) {
|
||||
|
||||
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
|
||||
console.log('Recived: ', notification)
|
||||
|
||||
// We schedule a LocalNotification 1 second later since Capacitor for Android doesn't show anything in this case
|
||||
console.log('Recived: ', notification)
|
||||
//}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
PushNotifications.addListener(
|
||||
'pushNotificationActionPerformed',
|
||||
@@ -92,7 +110,7 @@ export class HomePage implements OnInit {
|
||||
let object = notification.notification.data.Object;
|
||||
let idObject = notification.notification.data.IdObject;
|
||||
|
||||
console.log('Complete Object: ', notification.notification )
|
||||
console.log('Complete Object: ', notification.notification)
|
||||
|
||||
console.log('Service: ', service);
|
||||
console.log('Object: ', object);
|
||||
@@ -103,8 +121,8 @@ export class HomePage implements OnInit {
|
||||
} else if (service === "agenda") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "gabinete-digital" && object != "expediente") {*/
|
||||
// this.router.navigate(['/home/', service]);
|
||||
// }
|
||||
// this.router.navigate(['/home/', service]);
|
||||
// }
|
||||
|
||||
//if (service != null) {
|
||||
|
||||
@@ -119,22 +137,22 @@ export class HomePage implements OnInit {
|
||||
|
||||
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
|
||||
|
||||
if (service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
this.viewEventDetail(idObject)
|
||||
} /*else if (service === "gabinete-digital" && object != "expediente" || object != "event-list") {
|
||||
if (service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
this.viewEventDetail(idObject)
|
||||
} /*else if (service === "gabinete-digital" && object != "expediente" || object != "event-list") {
|
||||
this.router.navigate(['/home/gabinete-digital']);
|
||||
} */else if (service === "gabinete-digital" && object === "expediente") {
|
||||
this.viewExpedientDetail(idObject)
|
||||
} else if (service === "gabinete-digital" && object === "event-list") {
|
||||
/* this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])}) */
|
||||
this.openApproveModal(idObject);
|
||||
} else if (service === "accoes" && object === "accao") {
|
||||
this.viewPublications(idObject)
|
||||
} else if (service === "accoes" && object === "publicacao") {
|
||||
this.viewPublicationDetail(idObject)
|
||||
}
|
||||
|
||||
this.viewExpedientDetail(idObject)
|
||||
} else if (service === "gabinete-digital" && object === "event-list") {
|
||||
/* this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])}) */
|
||||
this.openApproveModal(idObject);
|
||||
} else if (service === "accoes" && object === "accao") {
|
||||
this.viewPublications(idObject)
|
||||
} else if (service === "accoes" && object === "publicacao") {
|
||||
this.viewPublicationDetail(idObject)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -175,27 +193,27 @@ export class HomePage implements OnInit {
|
||||
|
||||
LocalNotificationAction.
|
||||
|
||||
LocalNotifications.schedule({
|
||||
notifications: [
|
||||
{
|
||||
title: notification.title,
|
||||
body: notification.body,
|
||||
id: 1,
|
||||
schedule: { at: new Date(Date.now() + 1000) },
|
||||
sound: null,
|
||||
attachments: null,
|
||||
actionTypeId: "",
|
||||
extra: null,
|
||||
foreground: true,
|
||||
}
|
||||
]
|
||||
});
|
||||
LocalNotifications.schedule({
|
||||
notifications: [
|
||||
{
|
||||
title: notification.title,
|
||||
body: notification.body,
|
||||
id: 1,
|
||||
schedule: { at: new Date(Date.now() + 1000) },
|
||||
sound: null,
|
||||
attachments: null,
|
||||
actionTypeId: "",
|
||||
extra: null,
|
||||
foreground: true,
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber){
|
||||
async openApproveModal(eventSerialNumber) {
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
serialNumber: eventSerialNumber,
|
||||
},
|
||||
cssClass: 'cal-modal',
|
||||
@@ -205,35 +223,35 @@ export class HomePage implements OnInit {
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
async viewEventDetail(eventId:any) {
|
||||
async viewEventDetail(eventId: any) {
|
||||
console.log(this.profile);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewEventPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
eventId: eventId,
|
||||
},
|
||||
cssClass: 'modal',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res)=>{
|
||||
if(res){
|
||||
modal.onDidDismiss().then((res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async viewExpedientDetail(serialNumber:any) {
|
||||
async viewExpedientDetail(serialNumber: any) {
|
||||
console.log(this.profile);
|
||||
console.log("Expediente id: ", serialNumber);
|
||||
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ExpedienteDetailPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
serialNumber: serialNumber,
|
||||
profile: this.profile,
|
||||
},
|
||||
@@ -241,8 +259,8 @@ export class HomePage implements OnInit {
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res)=>{
|
||||
if(res){
|
||||
modal.onDidDismiss().then((res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user