Commit 87e57069 by Matteo

Testato per webapp

parent 84726ff9
......@@ -19,6 +19,9 @@
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="browser">
<preference name="ShowSplashScreen" value="false" />
</platform>
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
......
......@@ -31,7 +31,9 @@ export class ChangePwdPage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di cambio password", ["OK"]);
});
});
}
......
......@@ -8,7 +8,7 @@
<div class="body">
<div class="contenitore">
<div class="logo-grande">
<img src="../../../../assets/icon/2p2-logo-color.svg" />
<img src="assets/icon/2p2-logo-color.svg" />
</div>
<form #form="ngForm" (ngSubmit)="login(form)" class="form">
<ion-grid>
......
......@@ -3,7 +3,7 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Router } from "@angular/router";
import { AuthService } from '../../service/auth.service';
import { UtilService } from '../../../service/util.service';
import { Events } from '@ionic/angular';
import { Platform, Events } from '@ionic/angular';
@Component({
selector: 'app-login',
......@@ -13,7 +13,7 @@ import { Events } from '@ionic/angular';
})
export class LoginPage implements OnInit {
constructor(private authService: AuthService, private router: Router, private utilService: UtilService, public events: Events,) { }
constructor(private authService: AuthService, private router: Router, private utilService: UtilService, public events: Events,public platform: Platform) { }
async login(form){
await this.utilService.showLoading();
......@@ -31,7 +31,9 @@ export class LoginPage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di login", ["OK"]);
}
);
}
......
......@@ -8,7 +8,7 @@
<!--<ion-icon name="arrow-dropleft-circle" color="#2b94d1" class="back"></ion-icon>-->
</ion-buttons>
<ion-title class="logo-piccolo">
<img src="../../../../assets/icon/2p2-logo-color.svg">
<img src="assets/icon/2p2-logo-color.svg">
</ion-title>
</ion-toolbar>
</ion-col>
......
......@@ -29,7 +29,9 @@ export class ResetPage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di reset password", ["OK"]);
});
}
......
......@@ -30,6 +30,7 @@ export class AuthService {
error: true,
errorMsg: ""
};
this.clientiSalvati = false;
AuthService.clienti = [];
AuthService.clienteSelezionato = {
denominazione: null,
......@@ -121,9 +122,16 @@ export class AuthService {
);
}
clientiSalvati: boolean;
areClientiSalvati() : boolean
{
return this.clientiSalvati;
}
login(value) : Observable<ErrorResponse>{
var param = UtilService.encodeBody({utente: value.username, password: value.password});
//return this.httpClient.post<ErrorResponse>('https://www.google.com/', param, this.httpClientDataService.httpOptions)
this.clientiSalvati = false;
return this.httpClient.post<ErrorResponse>(this.httpClientDataService.BASE_ADDRESS+'/autenticazione/login.do', param, this.httpClientDataService.httpOptions)
.pipe(
catchError(this.handleError),
......@@ -136,7 +144,9 @@ export class AuthService {
console.log(successData);
});
this.storage.set("name",res.nome);
this.storage.set("clienti", res.clienti);
this.storage.set("clienti", res.clienti).then((successData)=>{
this.clientiSalvati = true;
});
this.storage.set("logged",true);
}
else
......
......@@ -14,7 +14,7 @@
<!--<ion-icon name="arrow-dropleft-circle" color="#2b94d1" class="back"></ion-icon>-->
</ion-buttons>
<ion-title class="logo-piccolo">
<img src="../../../assets/icon/2p2-logo-color.svg">
<img src="assets/icon/2p2-logo-color.svg">
</ion-title>
</ion-toolbar>
</ion-col>
......
......@@ -95,7 +95,9 @@ export class DocumentiPage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la richiesta dei documenti", ["OK"]);
});
}
......
......@@ -7,7 +7,7 @@
<ion-icon name="menu" color="light" class="menu-show" tappable></ion-icon>
</ion-buttons>
<ion-title class="logo-piccolo">
<img src="../../../assets/icon/2p2-logo-medium.svg">
<img src="assets/icon/2p2-logo-medium.svg">
</ion-title>
<ion-buttons (click)="logout()" slot="end">
<ion-icon name="exit" color="light" class="exit" tappable></ion-icon>
......
......@@ -5,6 +5,8 @@ import { Events, MenuController } from '@ionic/angular';
import { AuthService } from '../../auth/service/auth.service';
import { UtilService } from '../../service/util.service';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
......@@ -19,7 +21,16 @@ export class HomePage {
};
this.events.subscribe('functionCall:startup', eventData => {
if(this.clienteSelezionato.id == null) {
this.loadClienti();
if(!authService.areClientiSalvati())
{
UtilService.wait();
}
/*{
setTimeout(function () {
this.loadClienti();
}, 3000);
}
else*/ this.loadClienti();
}
});
}
......
......@@ -3,7 +3,7 @@
<div class="central-home">
<div tappable class="box">
<div tappable class="icon" (click)="apriPagina('documenti')">
<img src="../../../assets/img/consulto-documenti.svg" (click)="apriPagina('documenti')" tappable/>
<img src="assets/img/consulto-documenti.svg" (click)="apriPagina('documenti')" tappable/>
</div>
<div tappable class="section-title" (click)="apriPagina('documenti')">
Consulto i miei documenti
......@@ -11,7 +11,7 @@
</div>
<div class="box" tappable>
<div class="icon" tappable>
<img src="../../../assets/img/chiedo-parere.svg" (click)="apriPagina('pareri')" tappable/>
<img src="assets/img/chiedo-parere.svg" (click)="apriPagina('pareri')" tappable/>
</div>
<div class="section-title" (click)="apriPagina('pareri')" tappable>
Chiedo un parere al consulente
......@@ -19,7 +19,7 @@
</div>
<div class="box" tappable>
<div class="icon" tappable>
<img src="../../../assets/img/domande-risposte.svg" (click)="apriPagina('interviste')" tappable/>
<img src="assets/img/domande-risposte.svg" (click)="apriPagina('interviste')" tappable/>
</div>
<div class="section-title" (click)="apriPagina('interviste')" tappable>
Domande e risposte
......@@ -27,7 +27,7 @@
</div>
<div class="box" tappable>
<div class="icon" tappable>
<img src="../../../assets/img/segreteria.svg" (click)="apriPagina('segreteria')" tappable/>
<img src="assets/img/segreteria.svg" (click)="apriPagina('segreteria')" tappable/>
</div>
<div class="section-title" (click)="apriPagina('segreteria')" tappable>
La mia segreteria
......
......@@ -82,7 +82,9 @@ export class IntervistePage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante il caricamento del Topic", ["OK"]);
});
return true;
}
......@@ -129,7 +131,9 @@ export class IntervistePage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di apertura del Topic", ["OK"]);
});
if(fase == "after") this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id).subscribe((res: RichiesteResponse)=>{
this.utilService.closeLoading();
......@@ -231,7 +235,9 @@ export class IntervistePage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di aggiunta Intervento", ["OK"]);
});
return true;
}
......@@ -252,7 +258,9 @@ export class IntervistePage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di creazione nuovo topic", ["OK"]);
});
}
......
......@@ -79,7 +79,9 @@ export class ParerePage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di richiesta Topic", ["OK"]);
});
}
......@@ -121,7 +123,9 @@ export class ParerePage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di creazione nuovo Topic", ["OK"]);
});
/* <input type="file" name="file" (change)="upload($event)" />
......@@ -168,7 +172,9 @@ upload(str:any)
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la richiesta di limite Pareri superato", ["OK"]);
});
return true;
}
......
......@@ -8,7 +8,7 @@
<!--<ion-icon name="arrow-dropleft-circle" color="#2b94d1" class="back"></ion-icon>-->
</ion-buttons>
<ion-title class="logo-piccolo">
<img src="../../../assets/icon/2p2-logo-color.svg">
<img src="assets/icon/2p2-logo-color.svg">
</ion-title>
</ion-toolbar>
</ion-col>
......
......@@ -117,7 +117,9 @@ export class SegreteriaPage implements OnInit {
window.open(this.httpClientDataService.P2PSingleSignOnUrl+token, "_system");
},
(error: ErrorResponse) => {
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante l'sso verso 2P2", ["OK"]);
});
}
......@@ -133,21 +135,20 @@ export class SegreteriaPage implements OnInit {
loadStrutture()
{
//this.utilService.showLoading();
this.utilService.showLoading();
this.segreteriaService.getStrutture(AuthService.clienteSelezionato.id).subscribe((res: StruttureResponse)=>{
//this.utilService.closeLoading();
this.utilService.closeLoading();
this.strutture = res.strutture;
if(this.strutture.length > 0) this.strutturaSel = this.strutture[0];
},
(error: ErrorResponse) => {
//this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
this.utilService.closeLoading();
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la richiesta lista strutture", ["OK"]);
});
}
downloadEstrattoConto()
{}
cercaFatture()
{
this.loadFatture("ricerca");
......@@ -172,7 +173,9 @@ export class SegreteriaPage implements OnInit {
},
(error: ErrorResponse) => {
this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante richiesta delle fatture", ["OK"]);
});
}
......
import { Injectable } from '@angular/core';
import { HttpHeaders} from '@angular/common/http';
import { environment } from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class HttpClientDataService {
//LocalHost
//BASE_ADDRESS: string = 'http://localhost:8080/stman';
constructor() {
this.BASE_ADDRESS = environment.BASE_ADDRESS;
this.P2PSingleSignOnUrl = environment.P2PSingleSignOnUrl;
this.P2PTokenUrl = environment.P2PTokenUrl;
}
//Test
BASE_ADDRESS: string = 'http://aimsviluppo.aimconsulting.it:8085/stman';
BASE_ADDRESS: string = '';
//Produzione
//BASE_ADDRESS: string = 'http://5.8.104.230:8080/stman';
P2PTokenUrl: string = "";
P2PTokenUrl: string = "https://www.2p2.it/auth-request";
P2PSingleSignOnUrl: string = "https://www.2p2.it/?token=";
P2PSingleSignOnUrl: string = "";
httpFormData = {
headers: new HttpHeaders({
......@@ -37,5 +37,4 @@ export class HttpClientDataService {
})
};
constructor() { }
}
......@@ -5,6 +5,13 @@ import { File} from '@ionic-native/file/ngx';
import { FileOpener } from '@ionic-native/file-opener/ngx';
import { Router } from "@angular/router";
const delay = ms => new Promise(res => setTimeout(res, ms));
const wait = async () => {
await delay(3000);
console.log("Waited 3s");
}
@Injectable({
providedIn: 'root'
})
......@@ -86,6 +93,11 @@ export class UtilService {
return MIMETypes[ext];
}
static wait()
{
wait();
}
downloadDocumento(fileUrl: string, nomeFile: string)
{
var path = "";
......
export const environment = {
production: true
production: true,
BASE_ADDRESS: 'http://5.8.104.230:8080/stman',
P2PTokenUrl: "https://www.2p2.it/auth-request",
P2PSingleSignOnUrl: "https://www.2p2.it/?token="
};
......@@ -3,9 +3,14 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
BASE_ADDRESS: 'http://aimsviluppo.aimconsulting.it:8085/stman',
//BASE_ADDRESS: 'http://localhost:8080/stman,
P2PTokenUrl: "https://www.2p2.it/auth-request",
P2PSingleSignOnUrl: "https://www.2p2.it/?token="
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
......
......@@ -240,17 +240,6 @@ strong {
--color:#2b94d1 !important;
}
.back {
position:absolute;
@media (min-width: 1024px) {
top:48 px;
}
/*@media (max-width: 1024px) {
top:20 px;
}*/
width: 30px;
height: 30px;
}
.logo-piccolo img {
max-width: 100px;
}
......@@ -395,7 +384,7 @@ strong {
.menu-show{
@media (min-width: 1024px) {
zoom: 4.0;
top:48 px;
}
width: 34px;
height: 34px;
......@@ -411,7 +400,7 @@ strong {
}
.exit {
@media (min-width: 1024px) {
zoom: 4.0;
top:48 px;
}
width: 34px;
height: 34px;
......@@ -419,6 +408,18 @@ strong {
}
}
.back {
position:absolute;
@media (min-width: 1024px) {
top:48 px;
}
/*@media (max-width: 1024px) {
top:20 px;
}*/
width: 30px;
height: 30px;
}
/*.toolbar-md-primary, .toolbar-ios-primary {
color: #2b94d1 !important;
--color:#2b94d1 !important;
......
......@@ -5,6 +5,11 @@
<meta charset="utf-8" />
<title>Intranet</title>
<!--In caso di deploy per Desktop-->
<!--<base href="/" />-->
<!--In tutti gli altri casi-->
<base href="/" />
<!--<link href="css/awesome.scss" rel="stylesheet">
<link href="css/styles.scss" rel="stylesheet">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment