Commit e2c6da19 by Matteo

Modifica gestione strutture non configurate

parent bd35dc02
......@@ -12,8 +12,8 @@ android {
applicationId "it.aimconsulting.intranet"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 18
versionName "0.0.18"
versionCode 23
versionName "1.0.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
......
......@@ -19,6 +19,8 @@
"@angular/platform-browser": "~12.1.1",
"@angular/platform-browser-dynamic": "~12.1.1",
"@angular/router": "~12.1.1",
"@awesome-cordova-plugins/app-version": "^5.39.1",
"@awesome-cordova-plugins/core": "^5.39.1",
"@capacitor/android": "3.2.4",
"@capacitor/app": "1.0.3",
"@capacitor/core": "3.2.4",
......@@ -42,6 +44,8 @@
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"cordova-plugin-android-permissions": "^1.1.2",
"cordova-plugin-app-version": "^0.1.12",
"cordova-plugin-appversion": "^1.0.0",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-email-composer": "^0.9.2",
"cordova-plugin-file": "^6.0.2",
......
......@@ -5,5 +5,6 @@ export interface DocumentiRequest {
cliente: number;
limite: number;
struttura:number;
usaStruttura:boolean;
filtri: Pair[];
}
......@@ -51,7 +51,7 @@ export class DocumentiPage implements OnInit {
eventsIdle()
{
this.translate = this.utilService.translate;
if(EventsService.clienteCambiato)
if(EventsService.clienteCambiato || EventsService.strutturaSelected || EventsService.strutturaSelectedHome)
{
this.chiediDocumenti("initial");
this.recuperaTitoli();
......@@ -211,9 +211,14 @@ export class DocumentiPage implements OnInit {
this.idCliente = AuthService.clienteSelezionato.id;
var idReferente = AuthService.idReferente;
var strutturaSel = this.utilService.getStrutturaSel();
if(strutturaSel == null) return;
if(strutturaSel == null)
{
this.titoli = [];
return;
}
this.utilService.showLoading();
request = this.docService.createTitoloRequest(idReferente, this.idCliente,strutturaSel.id);
var usaStruttura: boolean = strutturaSel!=null?strutturaSel.id != 6:true;
request = this.docService.createTitoloRequest(idReferente, this.idCliente,strutturaSel.id, usaStruttura);
this.docService.getTitoli(request).subscribe((res: TitoliDocumentiResponse)=>{
this.utilService.closeLoading();
if(res.error){
......@@ -243,10 +248,19 @@ export class DocumentiPage implements OnInit {
this.idCliente = AuthService.clienteSelezionato.id;
var idReferente = AuthService.idReferente;
var strutturaSel = this.utilService.getStrutturaSel();
if(strutturaSel == null) return;
var usaStruttura: boolean = strutturaSel!=null?strutturaSel.id != 6:true;
if(strutturaSel == null)
{
this.documenti = {
cliente: null,
error: "",
documenti: []
};
return;
}
this.utilService.showLoading();
if(fase == "initial") request = this.docService.createInitialRequest(idReferente, this.idCliente, strutturaSel.id);
else request = this.docService.createRequest(idReferente, this.idCliente,null,tit,null,dataDa, dataA, strutturaSel.id);
if(fase == "initial") request = this.docService.createInitialRequest(idReferente, this.idCliente, strutturaSel.id, usaStruttura);
else request = this.docService.createRequest(idReferente, this.idCliente,null,tit,null,dataDa, dataA, strutturaSel.id, usaStruttura);
this.docService.getDocumenti(request).subscribe((res: DocumentiResponse)=>{
this.utilService.closeLoading();
if(res.error){
......
......@@ -399,7 +399,11 @@ export class SegreteriaPage implements OnInit {
var strutturaSel = null;
if(this.platform.is("desktop")) strutturaSel = this.utilService.getStrutturaSel();
else strutturaSel = this.strutturaSel;
if(strutturaSel == null) return;
if(strutturaSel == null)
{
this.fatture = [];
return;
}
this.utilService.showLoading();
if(fase == "initial") request = this.segreteriaService.createFatturaRequest(this.idCliente, 10, null, null, numeroP, numeroN, strutturaSel.id);
else request = this.segreteriaService.createFatturaRequest(this.idCliente,null, dataDa, dataA, numeroP, numeroN, strutturaSel.id);
......
......@@ -25,13 +25,13 @@ export class DocumentiService {
encodeBodyTitoliDocumenti(params: DocumentiRequest) {
var request = "{\"referente\" : "+params.referente+",\"cliente\" : "+params.cliente+",\"limite\" : "+params.limite+
",\"struttura\" : "+params.struttura+",\"filtri\" : {}}";
",\"struttura\" : "+params.struttura+",\"usaStruttura\" : "+params.usaStruttura+",\"filtri\" : {}}";
return request;
}
encodeBodyDocumenti(params: DocumentiRequest) {
var request = "{\"referente\" : "+params.referente+", \"cliente\" : "+params.cliente+",\"limite\" : "+params.limite+
",\"struttura\" : "+params.struttura+",\"filtri\" : {";
",\"struttura\" : "+params.struttura+",\"usaStruttura\" : "+params.usaStruttura+",\"filtri\" : {";
var filtro;
var first = true;
var i;
......@@ -48,7 +48,7 @@ export class DocumentiService {
return request;
}
createTitoloRequest(idReferente, id: any, strutturaSel: number) {
createTitoloRequest(idReferente, id: any, strutturaSel: number, usaStruttura: boolean) {
var request:DocumentiRequest;
var pairs: Pair[] = new Array();
......@@ -58,13 +58,14 @@ export class DocumentiService {
cliente: id,
limite: null,
struttura: strutturaSel,
usaStruttura: usaStruttura,
filtri: pairs
};
return request;
}
createRequest(idReferente, id, limite, titolo, tipo, daData, aData, strutturaSel): DocumentiRequest
createRequest(idReferente, id, limite, titolo, tipo, daData, aData, strutturaSel, usaStruttura): DocumentiRequest
{
var request:DocumentiRequest;
var pair:Pair;
......@@ -115,20 +116,21 @@ export class DocumentiService {
cliente: id,
limite: limite,
struttura: strutturaSel,
usaStruttura: usaStruttura,
filtri: pairs
};
return request;
}
createInitialRequest(idReferente, id, strutturaSel): DocumentiRequest
createInitialRequest(idReferente, id, strutturaSel, usaStruttura): DocumentiRequest
{
return this.createRequest(idReferente, id, 10, null, null, null, null, strutturaSel);
return this.createRequest(idReferente, id, 10, null, null, null, null, strutturaSel, usaStruttura);
}
getTitoli(value: DocumentiRequest) : Observable<TitoliDocumentiResponse>{
var param = this.encodeBodyTitoliDocumenti(value);
return this.httpClient.post<TitoliDocumentiResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/getTitoliDocumenti.do', param, this.httpClientDataService.httpOptionsJson)
return this.httpClient.post<TitoliDocumentiResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/getTitoliDocumentiStruttura.do', param, this.httpClientDataService.httpOptionsJson)
.pipe(
catchError(this.handleError),
tap( (res: TitoliDocumentiResponse ) => {
......@@ -148,7 +150,7 @@ export class DocumentiService {
getDocumenti(value: DocumentiRequest): Observable<DocumentiResponse>{
var param = this.encodeBodyDocumenti(value);
return this.httpClient.post<DocumentiResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/documentiByStruttura.do', param, this.httpClientDataService.httpOptionsJson)
return this.httpClient.post<DocumentiResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/documentiByStrutturaNew.do', param, this.httpClientDataService.httpOptionsJson)
.pipe(
catchError(this.handleError),
tap( (res: DocumentiResponse ) => {
......
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