Commit 3162141f by Matteo

Gestione condivisione multipla, gestione archiviazione richieste,

aggiunta ricerca per numero fattura, aggiunto campo lingua
parent 155a7a2f
...@@ -6,4 +6,5 @@ export interface Fattura { ...@@ -6,4 +6,5 @@ export interface Fattura {
urlNotula: string; urlNotula: string;
nrProgNotula: string; nrProgNotula: string;
nrNotula: string; nrNotula: string;
checked: boolean;
} }
...@@ -11,4 +11,5 @@ export interface Richiesta { ...@@ -11,4 +11,5 @@ export interface Richiesta {
nomeFile: string; nomeFile: string;
checked: boolean; checked: boolean;
errorText: string; errorText: string;
archiviato: boolean;
} }
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
<ion-item class="input-business"> <ion-item class="input-business">
<ion-input name="email" type="text" placeholder="Indirizzo email *" [(ngModel)]="email" required></ion-input> <ion-input name="email" type="text" placeholder="Indirizzo email *" [(ngModel)]="email" required></ion-input>
</ion-item> </ion-item>
<ion-item class="input-business">
<ion-input name="lingua" type="text" placeholder="Seleziona lingua" [(ngModel)]="lingua"></ion-input>
</ion-item>
<ion-item class="item-no-border testo-form"> <ion-item class="item-no-border testo-form">
<ion-label class="testo-form" text-wrap> <ion-label class="testo-form" text-wrap>
Aggiungi, se desideri, del testo libero Aggiungi, se desideri, del testo libero
......
...@@ -31,11 +31,12 @@ export class BusinesscallPage implements OnInit { ...@@ -31,11 +31,12 @@ export class BusinesscallPage implements OnInit {
cellulare: string; cellulare: string;
email: string; email: string;
testo: string; testo: string;
lingua: string;
createMail(value): any createMail(value): any
{ {
var corpo = 'Ciao,\r\n'+value.nome+" "+value.cognome+" ha richiesto una call.\r\nIl numero di telefono è "+value.cellulare var corpo = 'Ciao,\r\n'+value.nome+" "+value.cognome+" ha richiesto una call.\r\nIl numero di telefono è "+value.cellulare
+"\r\nL'indirizzo email è "+value.email+"\r\n\r\nTESTO AGGIUNTIVO:\r\n\r\n"+value.testo+"\r\n\r\n"; +"\r\nL'indirizzo email è "+value.email+"\r\nLingua: "+value.lingua+"\r\n\r\nTESTO AGGIUNTIVO:\r\n\r\n"+value.testo+"\r\n\r\n";
let email = { let email = {
/*to: 'max@mustermann.de', /*to: 'max@mustermann.de',
cc: 'erika@mustermann.de', cc: 'erika@mustermann.de',
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
<div><strong>Cerca</strong> titolo <input type="text" name="calendar" [(ngModel)]="titolo" title="Seleziona una data"> <div><strong>Cerca</strong> titolo <input type="text" name="calendar" [(ngModel)]="titolo" title="Seleziona una data">
<ion-button (click)="cercaDocumenti()" class="search-arrow" title="Cerca documenti"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward" title="Cerca documenti"></ion-icon></ion-button></div> <ion-button (click)="cercaDocumenti()" class="search-arrow" title="Cerca documenti"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward" title="Cerca documenti"></ion-icon></ion-button></div>
</ion-row> </ion-row>
<ion-row class="search-date" id="buttons" style="display:none"> <ion-row class="search-date" id="buttonsDoc" style="display:none">
<div>Condividi documenti su whatsapp</div> <div><span class="condividi-text">Condividi documenti</span>
<ion-button (click)="condividiDocumenti()" class="search-arrow" title="Condividi documenti"><ion-icon class="button-icon" slot="icon-only" name="share-alt" title="Condividi documenti"></ion-icon></ion-button> <ion-button (click)="condividiDocumenti()" class="search-arrow" title="Condividi documenti"><ion-icon class="button-icon" slot="icon-only" name="share-alt" title="Condividi documenti"></ion-icon></ion-button></div>
</ion-row> </ion-row>
<ion-row class="search-date-border"> <ion-row class="search-date-border">
</ion-row> </ion-row>
...@@ -85,17 +85,17 @@ ...@@ -85,17 +85,17 @@
<ion-checkbox name="privacy" *ngIf="!platform.is('desktop')" [(ngModel)]="documento.checked" class="check" (click)="checkSelected(documento.idDocumento)"> </ion-checkbox> <ion-checkbox name="privacy" *ngIf="!platform.is('desktop')" [(ngModel)]="documento.checked" class="check" (click)="checkSelected(documento.idDocumento)"> </ion-checkbox>
<div class="table-row"> <div class="table-row">
<div class="row-text"> <div class="row-text">
{{documento.titolo}} <strong>{{documento.titolo}}</strong>
<div class="detail"> <div class="detail">
{{documento.data}} {{documento.data}}
</div> </div>
</div> </div>
<ion-item class="row-download item-no-border"> <ion-item class="row-download item-no-border">
<a *ngIf="platform.is('desktop')" href="{{documento.url}}" target="_blank" download tappable> <a *ngIf="platform.is('desktop')" href="{{documento.url}}" target="_blank" download tappable title="Scarica Documento">
<ion-icon name="cloud-download" title="Scarica documento"></ion-icon> <ion-icon name="cloud-download" title="Scarica documento"></ion-icon>
</a> </a>
<!--<a *ngIf="platform.is('desktop')" href="{{documento.url}}" target="_blank" download>Clicca per scaricare il documento</a>--> <!--<a *ngIf="platform.is('desktop')" href="{{documento.url}}" target="_blank" download>Clicca per scaricare il documento</a>-->
<ion-icon name="cloud-download" *ngIf="!platform.is('desktop')" (click)="getDocumento(documento.idDocumento, documento.nomeFile);" target="_blank" download tappable>Clicca per scaricare il documento</ion-icon> <ion-icon name="share-alt" *ngIf="!platform.is('desktop')" (click)="getDocumento(documento.idDocumento, documento.nomeFile);" target="_blank" download tappable title="Condividi Documento">Clicca per condividere il documento</ion-icon>
</ion-item> </ion-item>
</div> </div>
<div class="clr"></div> <div class="clr"></div>
......
import { Pair } from './../../interface/pair';
import { HttpClientDataService } from './../../service/http-client-data.service'; import { HttpClientDataService } from './../../service/http-client-data.service';
import { Documento } from './../../interface/documento'; import { Documento } from './../../interface/documento';
import { UtilService } from './../../service/util.service'; import { UtilService } from './../../service/util.service';
...@@ -71,8 +72,8 @@ export class DocumentiPage implements OnInit { ...@@ -71,8 +72,8 @@ export class DocumentiPage implements OnInit {
getDocumento(idDoc, nomeFile: string) getDocumento(idDoc, nomeFile: string)
{ {
var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/documento.do?idcliente="+this.idCliente+"&iddocumento="+idDoc; var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/documento.do?idcliente="+this.idCliente+"&iddocumento="+idDoc;
//var fileUrl = "https://crossorigin.me/https://ebookgratispertutti.files.wordpress.com/2011/01/terry-brooks-il-fuoco-degli-angeli.pdf"; //this.utilService.downloadDocumento(fileUrl, nomeFile);
this.utilService.downloadDocumento(fileUrl, nomeFile); this.utilService.shareDocumento(fileUrl, nomeFile);
} }
documentoId; documentoId;
...@@ -92,24 +93,38 @@ export class DocumentiPage implements OnInit { ...@@ -92,24 +93,38 @@ export class DocumentiPage implements OnInit {
showButtons() showButtons()
{ {
var buttons = document.getElementById('buttons'); var buttons = document.getElementById('buttonsDoc');
buttons.setAttribute("style", "display:block"); buttons.setAttribute("style", "display:block");
} }
hideButtons() hideButtons()
{ {
var buttons = document.getElementById('buttons'); var buttons = document.getElementById('buttonsDoc');
buttons.setAttribute("style", "display:none"); buttons.setAttribute("style", "display:none");
} }
docSel: Array<Pair>;
async condividiDocumenti() async condividiDocumenti()
{ {
this.docSel = new Array();
this.documenti.documenti.forEach(this.recuperaDocumento, this); this.documenti.documenti.forEach(this.recuperaDocumento, this);
this.utilService.shareDocumenti(this.docSel);
} }
async recuperaDocumento(documento: Documento, index) async recuperaDocumento(documento: Documento, index)
{ {
if(documento.checked != null && documento.checked) this.utilService.shareDocumento(documento.url, documento.nomeFile); if(documento.checked != null && documento.checked)
{
var coppia: Pair;
coppia = {
key: documento.nomeFile,
value: documento.url,
type: "string"
}
this.docSel.push(coppia);
}
//this.utilService.shareDocumento(documento.url, documento.nomeFile);
} }
chiediDocumenti(fase) chiediDocumenti(fase)
...@@ -133,6 +148,7 @@ export class DocumentiPage implements OnInit { ...@@ -133,6 +148,7 @@ export class DocumentiPage implements OnInit {
else else
{ {
this.documenti = res; this.documenti = res;
this.documenti.documenti.forEach(this.editTitle, this);
} }
}, },
(error: ErrorResponse) => { (error: ErrorResponse) => {
...@@ -143,6 +159,11 @@ export class DocumentiPage implements OnInit { ...@@ -143,6 +159,11 @@ export class DocumentiPage implements OnInit {
}); });
} }
editTitle(documento: Documento, index)
{
if(documento.titolo.indexOf("/") > 0) documento.titolo = documento.titolo.substring(0, documento.titolo.length - 11);
}
cercaDocumenti() cercaDocumenti()
{ {
this.chiediDocumenti("ricerca"); this.chiediDocumenti("ricerca");
......
...@@ -32,12 +32,7 @@ export class HomePage { ...@@ -32,12 +32,7 @@ export class HomePage {
this.loadClienti() this.loadClienti()
}, 3000) }, 3000)
} }
/*{ else this.loadClienti();
setTimeout(function () {
this.loadClienti();
}, 3000);
}
else*/ else this.loadClienti();
} }
}); });
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<ion-grid> <ion-grid>
<ion-row class="search-date"> <ion-row class="search-date">
<div *ngIf="platform.is('desktop')"> <div *ngIf="platform.is('desktop')">
<strong>Cerca</strong> da <input type="date" name="calendar" [(ngModel)]="date1" title="Seleziona una data"> a <input type="date" name="calendar" [(ngModel)]="date2" title="Seleziona una data"> <ion-button (click)="caricaRichieste()" class="search-arrow" title="Cerca domande/risposte"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward"></ion-icon></ion-button> <strong>Cerca</strong> da <input type="date" name="calendar" [(ngModel)]="date1" title="Seleziona una data"> a <input type="date" name="calendar" [(ngModel)]="date2" title="Seleziona una data">
</div> </div>
<div class="float-date" *ngIf="!platform.is('desktop')"> <div class="float-date" *ngIf="!platform.is('desktop')">
<span class="date-text"><strong>Cerca</strong> da </span> <span class="date-text"><strong>Cerca</strong> da </span>
...@@ -41,10 +41,35 @@ ...@@ -41,10 +41,35 @@
<div floating class="element-date item-no-border date-text"> <div floating class="element-date item-no-border date-text">
{{date2}} {{date2}}
</div> </div>
<ion-button (click)="caricaRichieste()" class="search-arrow"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward"></ion-icon></ion-button> </div>
</ion-row>
<ion-row class="date-div">
<div class="search-date ">
<div class="float-date">
<ion-item class="item-no-border">
<ion-checkbox name="privacy" [(ngModel)]="archiviati" class="check"> </ion-checkbox>
<ion-label>Visualizza Archiviati</ion-label>
</ion-item>
<ion-item class="item-no-border">
<ion-button (click)="caricaRichieste()" class="search-arrow"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward"></ion-icon></ion-button>
</ion-item>
</div>
<div class="clr"></div>
<ion-item class="item-no-border" id="buttonsInterviste" style="display:none">
<div *ngIf="!archiviati">
Archivia Domande/Risposte
<ion-button (click)="archiviaInterviste(true)" class="search-arrow" title="Archivia Pareri"><ion-icon class="button-icon" slot="icon-only" name="archive" title="Archivia Pareri"></ion-icon></ion-button>
</div>
<div *ngIf="archiviati">
Togli Domande/Risposte dall'archivio
<ion-button (click)="archiviaInterviste(false)" class="search-arrow" title="Riattiva Pareri"><ion-icon class="button-icon" slot="icon-only" name="undo" title="Riattiva documenti"></ion-icon></ion-button>
</div>
</ion-item>
</div> </div>
</ion-row> </ion-row>
<ion-list *ngFor="let topic of topics; trackBy: trackByDoc" class="chat-list"> <ion-list *ngFor="let topic of topics; trackBy: trackByDoc" class="chat-list">
<ion-checkbox name="privacy" [(ngModel)]="topic.checked" class="check" (click)="checkSelected(topic.idRichiesta)"> </ion-checkbox>
<div class="row-chat-list"> <div class="row-chat-list">
<div class="data" text-wrap> <div class="data" text-wrap>
{{topic.data}} {{topic.data}}
...@@ -142,151 +167,6 @@ ...@@ -142,151 +167,6 @@
</form> </form>
</div> </div>
<!--<div class="ion-page" main>
<ion-content padding>
<ion-grid align-items-center>
<ion-row>
<ion-button expand="block" (click)="openSideMenu()">Visualizza Elenco Topics</ion-button>
</ion-row>
<ion-row *ngIf="platform.is('desktop') && topicAttivo.titolo != null">
<ion-col>
<ion-grid>
<ion-row text-center center>
<ion-col>
<ion-label floating>Da:</ion-label>
</ion-col>
<ion-col>
<input type="date" name="calendar" [(ngModel)]="date1">
</ion-col>
<ion-col>
<ion-label floating>A:</ion-label>
</ion-col>
<ion-col>
<input type="date" name="calendar" [(ngModel)]="date2">
</ion-col>
<ion-col>
<ion-button color="light" (click)="caricaTopic()">Cerca</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</ion-col>
<ion-col></ion-col>
</ion-row>
<ion-row *ngIf="!platform.is('desktop') && topicAttivo.titolo != null">
<ion-col>
<ion-grid>
<ion-row text-center center>
<ion-col>
<ion-label floating>Da:</ion-label>
</ion-col>
<ion-col>
<ion-icon name="calendar" (click)="setDateDa()"></ion-icon>
</ion-col>
<ion-col>
{{date1}}
</ion-col>
<ion-col>
<ion-label floating>A:</ion-label>
</ion-col>
<ion-col>
<ion-icon name="calendar" (click)="setDateA()"></ion-icon>
</ion-col>
<ion-col>
{{date2}}
</ion-col>
<ion-col>
<ion-button color="light" (click)="caricaTopic()">Cerca</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</ion-col>
<ion-col></ion-col>
</ion-row>
</ion-grid>
<div>
<h2>{{topicAttivo.titolo}}</h2>
<div id="content">
<ion-item lines="full" *ngIf="topicAttivo.testo != null">-->
<!--<div class="chat-status" text-right >
<span class="chat-date">{{topicAttivo.data}}</span>
<span class="chat-content-center">{{topicAttivo.testo}}</span>
</div>-->
<!--<div #message class="message">
<div class="chat-message" text-right>
<div class="right-bubble">
<span class="msg-name">Me </span>
<span class="msg-date">{{topicAttivo.data}}</span>
<p text-wrap>{{topicAttivo.testo}}</p>
</div>
</div>
</div>
</ion-item>
<ion-list *ngFor="let intervento of topicAttivo.interventi;">
<ion-item lines="full" *ngIf="intervento.utente == null">-->
<!--<div class="chat-status" text-right >
<span class="chat-date">{{intervento.data}}</span>
<span class="chat-content-center">{{intervento.testo}}</span>
</div>-->
<!--<div #message class="message">
<div class="chat-message" text-right>
<div class="right-bubble">
<span class="msg-name">Me </span>
<span class="msg-date">{{intervento.data}}</span>
<p text-wrap>{{intervento.testo}}</p>
</div>
</div>
</div>
</ion-item>
<ion-item lines="full" *ngIf="intervento.utente != null">-->
<!--<div class="chat-status" text-left>
<span class="chat-date">{{intervento.data}}</span>
<span class="chat-content-center">{{intervento.testo}}</span>
</div>-->
<!--<div #message class="message">
<div class="chat-message" text-left>
<div class="left-bubble">
<span class="msg-name">{{intervento.utente}}</span>
<span class="msg-date">{{intervento.data}}</span>
<p text-wrap>{{intervento.testo}}</p>
</div>
</div>
</div>
</ion-item>
</ion-list>
</div>
</div>
</ion-content>
<ion-footer [hidden]="topicAttivo.titolo == null">-->
<!--<form #form="ngForm">
<ion-grid>
<ion-row>
<ion-col col-10>
<ion-input id= "message" type="text" placeholder="Digita un messaggio" name="message" [(ngModel)]="message"></ion-input>
</ion-col>
<ion-col col-2>
<ion-icon name="paper-plane" (click)="aggiungiIntervento(form)"></ion-icon>
</ion-col>
</ion-row>
</ion-grid>
</form>-->
<!--</ion-footer>
</div>
</div>-->
<!--<div id="modal"></div>
<div id="content"></div>-->
</div> </div>
</div> </div>
</div> </div>
......
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { MenuController, AlertController, ModalController } from '@ionic/angular'; import { MenuController, AlertController, ModalController } from '@ionic/angular';
import {ModalQuestionComponent} from '../../components/modal-question/modal-question.component';
import {OverlayEventDetail} from '@ionic/core';
import { UtilService } from '../../service/util.service'; import { UtilService } from '../../service/util.service';
import { Richiesta } from 'src/app/interface/richiesta'; import { Richiesta } from 'src/app/interface/richiesta';
import { AuthService } from 'src/app/auth/service/auth.service'; import { AuthService } from 'src/app/auth/service/auth.service';
...@@ -11,6 +9,8 @@ import {IntervisteService} from '../../service/interviste.service'; ...@@ -11,6 +9,8 @@ import {IntervisteService} from '../../service/interviste.service';
import { NewRichiestaResponse } from 'src/app/interface/new-richiesta-response'; import { NewRichiestaResponse } from 'src/app/interface/new-richiesta-response';
import { DatePicker } from '@ionic-native/date-picker/ngx'; import { DatePicker } from '@ionic-native/date-picker/ngx';
import { Platform, Events } from '@ionic/angular'; import { Platform, Events } from '@ionic/angular';
import { ParereService } from 'src/app/service/parere.service';
import { ArchiviaRichiestaResponse } from 'src/app/interface/archivia-richiesta-response';
@Component({ @Component({
selector: 'app-interviste', selector: 'app-interviste',
...@@ -29,7 +29,8 @@ export class IntervistePage implements OnInit { ...@@ -29,7 +29,8 @@ export class IntervistePage implements OnInit {
private datePicker: DatePicker, private datePicker: DatePicker,
private intervisteService: IntervisteService, private intervisteService: IntervisteService,
public platform: Platform, public platform: Platform,
public events: Events public events: Events,
public parereService: ParereService
) { ) {
this.events.publish('functionCall:startup', null); this.events.publish('functionCall:startup', null);
this.initPage(); this.initPage();
...@@ -49,6 +50,7 @@ export class IntervistePage implements OnInit { ...@@ -49,6 +50,7 @@ export class IntervistePage implements OnInit {
intervista; intervista;
bottoneVisibile: boolean; bottoneVisibile: boolean;
formInserisciIntervento: boolean; formInserisciIntervento: boolean;
archiviati: boolean;
initPage() initPage()
{ {
...@@ -63,7 +65,8 @@ export class IntervistePage implements OnInit { ...@@ -63,7 +65,8 @@ export class IntervistePage implements OnInit {
url: null, url: null,
tipo: null, tipo: null,
checked: false, checked: false,
errorText: "" errorText: "",
archiviato: false
}; };
var date : Date; var date : Date;
date = new Date(); date = new Date();
...@@ -72,6 +75,82 @@ export class IntervistePage implements OnInit { ...@@ -72,6 +75,82 @@ export class IntervistePage implements OnInit {
this.intervista = "lista"; this.intervista = "lista";
this.bottoneVisibile = true; this.bottoneVisibile = true;
this.formInserisciIntervento = false; this.formInserisciIntervento = false;
this.archiviati = false;
this.intervisteSelezionate = new Array();
this.error = "";
}
intervisteSelezionate: Array<number>;
error: string;
archiviaInterviste(archiviare: boolean)
{
this.utilService.showLoading();
this.intervisteSelezionate = new Array();
this.topics.forEach(this.raccogliInterviste, this);
this.parereService.archiviaPareri(this.idCliente, archiviare, this.intervisteSelezionate).subscribe((res: ArchiviaRichiestaResponse)=>{
this.utilService.closeLoading();
if(res.error){
this.utilService.presentAlert("Errore", "", res.error, ["OK"]);
}
else
{
if(res.richiesteNonArchiviate.length > 0)
{
this.error = "Questa è la lista degli errori:\r\n"
res.richiesteNonArchiviate.forEach(this.getErrori, this);
this.utilService.presentAlert("Errore", "", this.error, ["OK"]);
}
else{
this.hideButtons();
this.loadTopics("after");
this.apriLista();
}
}
},
(error: ErrorResponse) => {
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 procedura di creazione nuovo Topic", ["OK"]);
});
}
showButtons()
{
var buttons = document.getElementById('buttonsInterviste');
buttons.setAttribute("style", "display:block");
}
hideButtons()
{
var buttons = document.getElementById('buttonsInterviste');
buttons.setAttribute("style", "display:none");
}
richiestaId;
checkSelected(id)
{
this.richiestaId = id;
this.hideButtons()
this.topics.forEach(this.check, this);
}
check(richiesta: Richiesta, index)
{
if(richiesta.checked && richiesta.idRichiesta != this.richiestaId) this.showButtons();
if(!richiesta.checked && richiesta.idRichiesta == this.richiestaId) this.showButtons();
}
getErrori(errore: Richiesta, index)
{
this.error = "Richiesta n° " + errore.idRichiesta + ":" + errore.errorText;
}
raccogliInterviste(richiesta: Richiesta, index)
{
if(richiesta.checked) this.intervisteSelezionate.push(richiesta.idRichiesta);
} }
apriLista() apriLista()
...@@ -164,7 +243,7 @@ export class IntervistePage implements OnInit { ...@@ -164,7 +243,7 @@ export class IntervistePage implements OnInit {
if(this.date2 != null && this.date1 != "") dataA = this.utilService.dateFormatConvert(this.date2); if(this.date2 != null && this.date1 != "") dataA = this.utilService.dateFormatConvert(this.date2);
this.utilService.showLoading(); this.utilService.showLoading();
this.idCliente = AuthService.clienteSelezionato.id; this.idCliente = AuthService.clienteSelezionato.id;
this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id, dataDa, dataA).subscribe((res: RichiesteResponse)=>{ this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id, dataDa, dataA, this.archiviati).subscribe((res: RichiesteResponse)=>{
this.utilService.closeLoading(); this.utilService.closeLoading();
if(res.error){ if(res.error){
this.utilService.presentAlert("Errore", "", res.error, ["OK"]); this.utilService.presentAlert("Errore", "", res.error, ["OK"]);
...@@ -188,7 +267,7 @@ export class IntervistePage implements OnInit { ...@@ -188,7 +267,7 @@ export class IntervistePage implements OnInit {
{ {
//this.utilService.showLoading(); //this.utilService.showLoading();
this.idCliente = AuthService.clienteSelezionato.id; this.idCliente = AuthService.clienteSelezionato.id;
if(fase == "initial") this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id, null, null).subscribe((res: RichiesteResponse)=>{ if(fase == "initial") this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id, null, null, false).subscribe((res: RichiesteResponse)=>{
if(res.error){ if(res.error){
this.utilService.presentAlert("Errore", "", res.error, ["OK"]); this.utilService.presentAlert("Errore", "", res.error, ["OK"]);
} }
...@@ -206,8 +285,8 @@ export class IntervistePage implements OnInit { ...@@ -206,8 +285,8 @@ export class IntervistePage implements OnInit {
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["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"]); else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di apertura del Topic", ["OK"]);
}); });
if(fase == "after") this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id, null, null).subscribe((res: RichiesteResponse)=>{ if(fase == "after") this.intervisteService.getListaTopics(AuthService.clienteSelezionato.id, null, null, this.archiviati).subscribe((res: RichiesteResponse)=>{
this.utilService.closeLoading(); //this.utilService.closeLoading();
if(res.error){ if(res.error){
this.utilService.presentAlert("Errore", "", res.error, ["OK"]); this.utilService.presentAlert("Errore", "", res.error, ["OK"]);
} }
...@@ -217,7 +296,7 @@ export class IntervistePage implements OnInit { ...@@ -217,7 +296,7 @@ export class IntervistePage implements OnInit {
} }
}, },
(error: ErrorResponse) => { (error: ErrorResponse) => {
this.utilService.closeLoading(); //this.utilService.closeLoading();
this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]); this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
}); });
} }
...@@ -277,7 +356,6 @@ export class IntervistePage implements OnInit { ...@@ -277,7 +356,6 @@ export class IntervistePage implements OnInit {
this.idSelezionato = id; this.idSelezionato = id;
this.topics.forEach(this.setTopic, this); this.topics.forEach(this.setTopic, this);
this.intervista = "dettaglio"; this.intervista = "dettaglio";
this.mostraBottone();
} }
apriEdit() apriEdit()
...@@ -295,11 +373,13 @@ export class IntervistePage implements OnInit { ...@@ -295,11 +373,13 @@ export class IntervistePage implements OnInit {
} }
} }
setTopic(topic, index) setTopic(topic: Richiesta, index)
{ {
if(topic.idRichiesta == this.idSelezionato) if(topic.idRichiesta == this.idSelezionato)
{ {
this.topicAttivo = topic; this.topicAttivo = topic;
if(!topic.archiviato) this.mostraBottone();
else this.nascondiBottone();
//this.closeSideMenu(); //this.closeSideMenu();
} }
} }
...@@ -333,24 +413,25 @@ export class IntervistePage implements OnInit { ...@@ -333,24 +413,25 @@ export class IntervistePage implements OnInit {
saveNewTopic(form) saveNewTopic(form)
{ {
//this.utilService.showLoading(); //this.utilService.showLoading();
this.idCliente = AuthService.clienteSelezionato.id; this.idCliente = AuthService.clienteSelezionato.id;
this.intervisteService.newTopic(this.idCliente, form.value.title, form.value.question).subscribe((res: NewRichiestaResponse)=>{ this.intervisteService.newTopic(this.idCliente, form.value.title, form.value.question).subscribe((res: NewRichiestaResponse)=>{
//this.utilService.closeLoading(); //this.utilService.closeLoading();
if(res.error){ if(res.error){
this.utilService.presentAlert("Errore", "", res.error, ["OK"]); this.utilService.presentAlert("Errore", "", res.error, ["OK"]);
} }
else else
{ {
this.loadTopics("after"); this.archiviati = false;
this.apriLista(); this.loadTopics("after");
} this.apriLista();
}, }
(error: ErrorResponse) => { },
//this.utilService.closeLoading(); (error: ErrorResponse) => {
if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]); //this.utilService.closeLoading();
else if(error!=null) this.utilService.presentAlert("Errore", "", error, ["OK"]); if(error != null && error.errorMsg != null) this.utilService.presentAlert("Errore", "", error.errorMsg, ["OK"]);
else this.utilService.presentAlert("Errore", "", "Errore durante la procedura di creazione nuovo topic", ["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"]);
});
} }
/*async createModal() { /*async createModal() {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</div> </div>
<div class="clr"></div> <div class="clr"></div>
<ion-item class="item-no-border" id="buttons" style="display:none"> <ion-item class="item-no-border" id="buttonsPareri" style="display:none">
<div *ngIf="!archiviati"> <div *ngIf="!archiviati">
Archivia Pareri Archivia Pareri
<ion-button (click)="archiviaPareri(true)" class="search-arrow" title="Archivia Pareri"><ion-icon class="button-icon" slot="icon-only" name="archive" title="Archivia Pareri"></ion-icon></ion-button> <ion-button (click)="archiviaPareri(true)" class="search-arrow" title="Archivia Pareri"><ion-icon class="button-icon" slot="icon-only" name="archive" title="Archivia Pareri"></ion-icon></ion-button>
......
...@@ -51,7 +51,8 @@ export class ParerePage implements OnInit { ...@@ -51,7 +51,8 @@ export class ParerePage implements OnInit {
url: null, url: null,
tipo: null, tipo: null,
checked: false, checked: false,
errorText: "" errorText: "",
archiviato: false
}; };
this.parere = "lista"; this.parere = "lista";
this.bottoneVisibile = true; this.bottoneVisibile = true;
...@@ -137,6 +138,7 @@ export class ParerePage implements OnInit { ...@@ -137,6 +138,7 @@ export class ParerePage implements OnInit {
} }
else else
{ {
this.archiviati = false;
this.loadPareri("initial"); this.loadPareri("initial");
this.apriLista(); this.apriLista();
} }
...@@ -294,13 +296,13 @@ upload(str:any) ...@@ -294,13 +296,13 @@ upload(str:any)
showButtons() showButtons()
{ {
var buttons = document.getElementById('buttons'); var buttons = document.getElementById('buttonsPareri');
buttons.setAttribute("style", "display:block"); buttons.setAttribute("style", "display:block");
} }
hideButtons() hideButtons()
{ {
var buttons = document.getElementById('buttons'); var buttons = document.getElementById('buttonsPareri');
buttons.setAttribute("style", "display:none"); buttons.setAttribute("style", "display:none");
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<ion-grid> <ion-grid>
<ion-row class="search-date"> <ion-row class="search-date">
<div *ngIf="platform.is('desktop')"> <div *ngIf="platform.is('desktop')">
<strong>Cerca</strong> da <input type="date" name="calendar" [(ngModel)]="date1" title="Seleziona una data"> a <input type="date" name="calendar" [(ngModel)]="date2" title="Seleziona una data"> <ion-button (click)="cercaFatture()" class="search-arrow" title="Cerca fatture"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward"></ion-icon></ion-button> <strong>Cerca</strong> da <input type="date" name="calendar" [(ngModel)]="date1" title="Seleziona una data"> a <input type="date" name="calendar" [(ngModel)]="date2" title="Seleziona una data">
</div> </div>
<div class="float-date" *ngIf="!platform.is('desktop')"> <div class="float-date" *ngIf="!platform.is('desktop')">
<span class="date-text"><strong>Cerca</strong> da </span> <span class="date-text"><strong>Cerca</strong> da </span>
...@@ -39,13 +39,25 @@ ...@@ -39,13 +39,25 @@
{{date1}} {{date1}}
</div> </div>
<span class="date-text">a</span> <span class="date-text">a</span>
<ion-icon floating class="element-date date-icon" name="calendar" (click)="setDateA()"></ion-icon> <ion-icon floating class="element-date date-icon" name="calendar" (click)="setDateA()"></ion-icon>
<div floating class="element-date item-no-border date-text"> <div floating class="element-date item-no-border date-text">
{{date2}} {{date2}}
</div> </div>
<ion-button (click)="cercaFatture()" class="search-arrow"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward"></ion-icon></ion-button>
</div> </div>
</ion-row> </ion-row>
<ion-row class="search-date">
<div><strong>Cerca</strong> n° prog. not. <input type="text" name="calendar" [(ngModel)]="nProgNotula" title="Seleziona una data"></div>
</ion-row>
<ion-row class="search-date">
<div><strong>Cerca</strong> n° not. <input type="text" name="calendar" [(ngModel)]="nNotula" title="Seleziona una data">
<ion-button (click)="cercaFatture()" class="search-arrow"><ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward" title="Cerca fatture"></ion-icon></ion-button></div>
</ion-row>
<ion-row class="search-date" id="buttons" style="display:none">
<div><span class="condividi-text">Condividi documenti</span>
<ion-button (click)="condividiFatture()" class="search-arrow" title="Condividi documenti"><ion-icon class="button-icon" slot="icon-only" name="share-alt" title="Condividi documenti"></ion-icon></ion-button></div>
</ion-row>
<ion-row class="search-date-border">
</ion-row>
<ion-list *ngFor="let fattura of fatture; trackBy: trackByDoc" class="row-results"> <ion-list *ngFor="let fattura of fatture; trackBy: trackByDoc" class="row-results">
<!--<ion-col class="col"> <!--<ion-col class="col">
<p>{{fattura.nrProgNotula}}</p> <p>{{fattura.nrProgNotula}}</p>
...@@ -65,17 +77,18 @@ ...@@ -65,17 +77,18 @@
<a *ngIf="platform.is('desktop')" href="{{fattura.urlProgNotula}}" target="_blank" download tappable> <a *ngIf="platform.is('desktop')" href="{{fattura.urlProgNotula}}" target="_blank" download tappable>
<ion-icon name="cloud-download">Progetto</ion-icon> <ion-icon name="cloud-download">Progetto</ion-icon>
</a> </a>
<ion-icon name="cloud-download" *ngIf="!platform.is('desktop')" (click)="getNotula(fattura.id, fattura.nrProgNotula, true);" target="_blank" download tappable>Progetto</ion-icon> <ion-icon name="share-alt" *ngIf="!platform.is('desktop')" (click)="getNotula(fattura.id, fattura.nrProgNotula, true);" target="_blank" download tappable>Progetto</ion-icon>
<ion-label>Progetto</ion-label> <ion-label>Progetto</ion-label>
</div> </div>
<div class="group-icon"> <div class="group-icon">
<a *ngIf="platform.is('desktop') && fattura.nrNotula != null" href="{{fattura.urlNotula}}" target="_blank" download tappable> <a *ngIf="platform.is('desktop') && fattura.nrNotula != null" href="{{fattura.urlNotula}}" target="_blank" download tappable>
<ion-icon name="cloud-download">Notula</ion-icon> <ion-icon name="cloud-download">Notula</ion-icon>
</a> </a>
<ion-icon name="cloud-download" *ngIf="!platform.is('desktop') && fattura.nrNotula != null" (click)="getNotula(fattura.id, fattura.nrNotula, false);" target="_blank" download tappable>Notula</ion-icon> <ion-icon name="share-alt" *ngIf="!platform.is('desktop') && fattura.nrNotula != null" (click)="getNotula(fattura.id, fattura.nrNotula, false);" target="_blank" download tappable>Notula</ion-icon>
<ion-label *ngIf="fattura.nrNotula != null">Notula</ion-label> <ion-label *ngIf="fattura.nrNotula != null">Notula</ion-label>
</div> </div>
</div> </div>
<ion-checkbox *ngIf="!platform.is('desktop')" name="privacy" [(ngModel)]="fattura.checked" class="check" (click)="checkSelected(fattura.id)"> </ion-checkbox>
<div class="row-text-special"> <div class="row-text-special">
Progetto Notula n. {{fattura.nrProgNotula}} Progetto Notula n. {{fattura.nrProgNotula}}
<div class="detail"> <div class="detail">
......
import { Pair } from './../../interface/pair';
import { HttpClientDataService } from './../../service/http-client-data.service'; import { HttpClientDataService } from './../../service/http-client-data.service';
import { StruttureResponse } from './../../interface/strutture-response'; import { StruttureResponse } from './../../interface/strutture-response';
import { Struttura } from './../../interface/struttura'; import { Struttura } from './../../interface/struttura';
...@@ -51,7 +52,9 @@ export class SegreteriaPage implements OnInit { ...@@ -51,7 +52,9 @@ export class SegreteriaPage implements OnInit {
strutture: Struttura[]; strutture: Struttura[];
date1; date1;
date2; date2;
nProgNotula: string;
nNotula: string;
fattureSel: Array<Pair>;
initPage() initPage()
{ {
...@@ -64,6 +67,71 @@ export class SegreteriaPage implements OnInit { ...@@ -64,6 +67,71 @@ export class SegreteriaPage implements OnInit {
this.strutturaSel = null; this.strutturaSel = null;
this.idStrutturaSel = null; this.idStrutturaSel = null;
this.strutture = []; this.strutture = [];
this.nProgNotula = "";
this.nNotula = "";
this.fattureSel = new Array();
}
condividiFatture()
{
this.fattureSel = new Array();
this.fatture.forEach(this.recuperaFattura, this);
this.utilService.shareDocumenti(this.fattureSel);
}
async recuperaFattura(fattura: Fattura, index)
{
if(fattura.checked != null && fattura.checked) {
var tipo = "";
var nomeFile = "";
if(fattura.nrNotula == null)
{
tipo = "P";
nomeFile = fattura.nrProgNotula;
}
else {
tipo = "N";
nomeFile = fattura.nrNotula;
}
nomeFile += ".pdf";
var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/notula.do?idcliente="+AuthService.clienteSelezionato.id+"&idnotula="+fattura.id+"&tipo="+tipo;
var coppia: Pair;
coppia = {
key: nomeFile,
value: fileUrl,
type: "string"
}
this.fattureSel.push(coppia);
}
}
fatturaId;
checkSelected(id)
{
this.fatturaId = id;
this.hideButtons()
this.fatture.forEach(this.check, this);
}
check(fattura: Fattura, index)
{
if(fattura.checked && fattura.id != this.fatturaId) this.showButtons();
if(!fattura.checked && fattura.id == this.fatturaId) this.showButtons();
}
showButtons()
{
var buttons = document.getElementById('buttons');
buttons.setAttribute("style", "display:block");
}
hideButtons()
{
var buttons = document.getElementById('buttons');
buttons.setAttribute("style", "display:none");
} }
changeSel(sel) changeSel(sel)
...@@ -142,19 +210,22 @@ export class SegreteriaPage implements OnInit { ...@@ -142,19 +210,22 @@ export class SegreteriaPage implements OnInit {
if(isProgNotula) tipo = "P"; if(isProgNotula) tipo = "P";
else tipo = "N"; else tipo = "N";
var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/notula.do?idcliente="+AuthService.clienteSelezionato.id+"&idnotula="+idNotula+"&tipo="+tipo; var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/notula.do?idcliente="+AuthService.clienteSelezionato.id+"&idnotula="+idNotula+"&tipo="+tipo;
this.utilService.downloadDocumento(fileUrl, nomeFile); //this.utilService.downloadDocumento(fileUrl, nomeFile);
nomeFile += ".pdf";
this.utilService.shareDocumento(fileUrl, nomeFile);
} }
getEstrattoConto(idCliente, nomeFile, idStruttura) getEstrattoConto(idCliente, nomeFile, idStruttura)
{ {
var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/estrattoconto.do?idcliente="+idCliente+"&idstruttura="+idStruttura; var fileUrl = this.httpClientDataService.BASE_ADDRESS+"/intranet/estrattoconto.do?idcliente="+idCliente+"&idstruttura="+idStruttura;
this.utilService.downloadDocumento(fileUrl, nomeFile); //this.utilService.downloadDocumento(fileUrl, nomeFile);
this.utilService.shareDocumento(fileUrl, nomeFile);
} }
async redirectTo2p2() async redirectTo2p2()
{ {
var id = await this.authService.getId(); var id = await this.authService.getId();
//id = 1096; id = 1096;
this.segreteriaService.getP2pToken(id).subscribe((res)=>{ this.segreteriaService.getP2pToken(id).subscribe((res)=>{
var token = res.token; var token = res.token;
window.open(this.httpClientDataService.P2PSingleSignOnUrl+token, "_system"); window.open(this.httpClientDataService.P2PSingleSignOnUrl+token, "_system");
...@@ -202,12 +273,16 @@ export class SegreteriaPage implements OnInit { ...@@ -202,12 +273,16 @@ export class SegreteriaPage implements OnInit {
this.utilService.showLoading(); this.utilService.showLoading();
var dataA = null; var dataA = null;
var dataDa = null; var dataDa = null;
var numeroN = null;
var numeroP = null;
if(this.nNotula!= null && this.nNotula != "") numeroN = this.nNotula;
if(this.nProgNotula != null && this.nProgNotula != "") numeroP = this.nProgNotula;
if(this.date1 != null && this.date1 != "") dataDa = this.utilService.dateFormatConvert(this.date1); if(this.date1 != null && this.date1 != "") dataDa = this.utilService.dateFormatConvert(this.date1);
if(this.date2 != null && this.date2 != "") dataA = this.utilService.dateFormatConvert(this.date2); if(this.date2 != null && this.date2 != "") dataA = this.utilService.dateFormatConvert(this.date2);
var request: FattureRequest; var request: FattureRequest;
this.idCliente = AuthService.clienteSelezionato.id; this.idCliente = AuthService.clienteSelezionato.id;
if(fase == "initial") request = this.segreteriaService.createFatturaRequest(this.idCliente, 10, null, null); if(fase == "initial") request = this.segreteriaService.createFatturaRequest(this.idCliente, 10, null, null, numeroP, numeroN);
else request = this.segreteriaService.createFatturaRequest(this.idCliente,null, dataDa, dataA); else request = this.segreteriaService.createFatturaRequest(this.idCliente,null, dataDa, dataA, numeroP, numeroN);
this.segreteriaService.getFatture(request).subscribe((res: FattureResponse)=>{ this.segreteriaService.getFatture(request).subscribe((res: FattureResponse)=>{
this.utilService.closeLoading(); this.utilService.closeLoading();
if(res.error){ if(res.error){
......
...@@ -34,7 +34,7 @@ export class IntervisteService { ...@@ -34,7 +34,7 @@ export class IntervisteService {
getTopic(idCliente, idRichiesta, dataDa, dataA): Observable<RichiesteResponse> getTopic(idCliente, idRichiesta, dataDa, dataA): Observable<RichiesteResponse>
{ {
var richiesta = this.creaGetListaRichiesta(idCliente, idRichiesta, null, dataDa, dataA); var richiesta = this.creaGetListaRichiesta(idCliente, idRichiesta, null, dataDa, dataA, null);
var param = this.encodeBody(richiesta); var param = this.encodeBody(richiesta);
return this.httpClient.post<RichiesteResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/topic.do', param, this.httpClientDataService.httpOptionsJson) return this.httpClient.post<RichiesteResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/topic.do', param, this.httpClientDataService.httpOptionsJson)
.pipe( .pipe(
...@@ -53,11 +53,11 @@ export class IntervisteService { ...@@ -53,11 +53,11 @@ export class IntervisteService {
); );
} }
getListaTopics(idCliente: number, dataDa, dataA): Observable<RichiesteResponse> getListaTopics(idCliente: number, dataDa, dataA, archiviati: boolean): Observable<RichiesteResponse>
{ {
var limite = null; var limite = null;
if(dataDa == null && dataA == null) limite = 10; if(dataDa == null && dataA == null) limite = 10;
var richiesta = this.creaGetListaRichiesta(idCliente, null, limite, dataDa, dataA); var richiesta = this.creaGetListaRichiesta(idCliente, null, limite, dataDa, dataA, archiviati);
var param = this.encodeBody(richiesta); var param = this.encodeBody(richiesta);
return this.httpClient.post<RichiesteResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/richieste.do', param, this.httpClientDataService.httpOptionsJson) return this.httpClient.post<RichiesteResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/richieste.do', param, this.httpClientDataService.httpOptionsJson)
.pipe( .pipe(
...@@ -76,7 +76,7 @@ export class IntervisteService { ...@@ -76,7 +76,7 @@ export class IntervisteService {
); );
} }
creaGetListaRichiesta(id, idRichiesta, limite, dataDa, dataA): RichiesteRequest creaGetListaRichiesta(id, idRichiesta, limite, dataDa, dataA, archiviati): RichiesteRequest
{ {
var request:RichiesteRequest; var request:RichiesteRequest;
var pair:Pair; var pair:Pair;
...@@ -100,6 +100,17 @@ export class IntervisteService { ...@@ -100,6 +100,17 @@ export class IntervisteService {
} }
pairs.push(pair); pairs.push(pair);
} }
if(archiviati != null)
{
pair = {
key: "archiviato",
value: archiviati,
type: "boolean"
}
pairs.push(pair);
}
pair = { pair = {
key: "tipo", key: "tipo",
value: "DOMANDA", value: "DOMANDA",
...@@ -126,7 +137,7 @@ export class IntervisteService { ...@@ -126,7 +137,7 @@ export class IntervisteService {
filtro = params.filtri[i]; filtro = params.filtri[i];
if(first) first = false; if(first) first = false;
else request += ", "; else request += ", ";
if(filtro.type == "int") if(filtro.type == "int" || filtro.type == "boolean")
request += "\""+filtro.key + "\":"+filtro.value; request += "\""+filtro.key + "\":"+filtro.value;
else else
request += "\""+filtro.key + "\":\""+filtro.value+"\""; request += "\""+filtro.key + "\":\""+filtro.value+"\"";
......
...@@ -30,7 +30,7 @@ export class SegreteriaService { ...@@ -30,7 +30,7 @@ export class SegreteriaService {
errorRespose: ErrorResponse; errorRespose: ErrorResponse;
createFatturaRequest(id, limite, daData, aData) createFatturaRequest(id, limite, daData, aData, nProgNotula, nNotula)
{ {
var request: FattureRequest; var request: FattureRequest;
var pair:Pair; var pair:Pair;
...@@ -54,6 +54,27 @@ export class SegreteriaService { ...@@ -54,6 +54,27 @@ export class SegreteriaService {
} }
pairs.push(pair); pairs.push(pair);
} }
if(nProgNotula != null)
{
pair = {
key: "numeroProgetto",
value: nProgNotula,
type: "int"
}
pairs.push(pair);
}
if(nNotula != null)
{
pair = {
key: "numeroNotula",
value: nNotula,
type: "int"
}
pairs.push(pair);
}
request = { request = {
cliente: id, cliente: id,
limite: limite, limite: limite,
......
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { Pair } from './../interface/pair';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { LoadingController, AlertController, Platform } from '@ionic/angular'; import { LoadingController, AlertController, Platform } from '@ionic/angular';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
...@@ -132,6 +134,85 @@ export class UtilService { ...@@ -132,6 +134,85 @@ export class UtilService {
wait(); wait();
} }
fileScaricati: Array<string>;
shareDocumenti(fileSel : Array<Pair>)
{
this.fileScaricati = new Array();
this.showLoading();
/*var i = 0;
while(i < fileSel.length)
{
var fileInfo : Pair = fileSel.pop();
var path = this.file.externalDataDirectory;
var
nomeFile = nomeFile.replace(/\//g, "-");
this.download(fileInfo.value)
.subscribe(
(data) => { // Success
this.file.writeFile(path, fileInfo.key, data, { replace: true }).then((fileEntry: FileEntry) => {
this.fileScaricati.push(fileEntry.toURL());
},
(error) =>{
console.log(error);
}
);
});
i++;
}*/
fileSel.forEach(this.saveFile, this);
setTimeout(() => {
this.share()
}, 10000*fileSel.length);
}
share(){
this.closeLoading();
this.socialSharing.share(null, null, this.fileScaricati, null).then(() => {
console.log("File condiviso con successo!");
}).catch((e) => {
this.presentAlert("Avviso", "", 'Errore durante la condivisione del file:' + e, ["OK"]);
});
}
async saveFile(fileInfo: Pair, index)
{
var path = this.file.externalDataDirectory;
var nomeFile : string = fileInfo.key;
nomeFile = nomeFile.replace(/\//g, "-");
await this.download(fileInfo.value)
.subscribe(
(data) => { // Success
this.file.writeFile(path, nomeFile, data, { replace: true }).then((fileEntry: FileEntry) => {
this.fileScaricati.push(fileEntry.toURL());
},
(error) =>{
console.log(error);
}
);
});
}
shareDocumentoBis(fileUrl: string, nomeFile: string)
{
var path = "";
path = this.file.externalDataDirectory;
nomeFile = nomeFile.replace(/\//g, "-");
this.showLoading();
this.download(fileUrl)
.subscribe(
(data) => { // Success
this.file.writeFile(path, nomeFile, data, { replace: true }).then((fileEntry: FileEntry) => {
console.log("File created!");
this.fileScaricati.push(fileEntry.toURL());
},
(error) =>{
console.error(error);
}
);
});
}
shareDocumento(fileUrl: string, nomeFile: string) shareDocumento(fileUrl: string, nomeFile: string)
{ {
var path = ""; var path = "";
...@@ -144,10 +225,10 @@ export class UtilService { ...@@ -144,10 +225,10 @@ export class UtilService {
this.file.writeFile(path, nomeFile, data, { replace: true }).then((fileEntry: FileEntry) => { this.file.writeFile(path, nomeFile, data, { replace: true }).then((fileEntry: FileEntry) => {
console.log("File created!"); console.log("File created!");
this.closeLoading(); this.closeLoading();
this.socialSharing.shareViaWhatsApp(null, fileEntry.toURL(), null).then(() => { this.socialSharing.share(null, null, fileEntry.toURL(), null).then(() => {
console.log("Filecondiviso con successo!"); console.log("File condiviso con successo!");
}).catch((e) => { }).catch((e) => {
this.presentAlert("Avviso", "", 'Errore durante l\'apertura del file:' + e, ["OK"]); this.presentAlert("Avviso", "", 'Errore durante la condivisione del file:' + e, ["OK"]);
}); });
}, },
(error) =>{ (error) =>{
......
...@@ -614,7 +614,7 @@ ion-menu{ ...@@ -614,7 +614,7 @@ ion-menu{
} }
.table-row { .table-row {
.row-text { .row-text {
font-size: 18px; font-size: 15px;
display:inline-block; display:inline-block;
text-align: left; text-align: left;
.detail { .detail {
...@@ -1022,6 +1022,9 @@ ion-menu{ ...@@ -1022,6 +1022,9 @@ ion-menu{
height: 24px; height: 24px;
width: 41px; width: 41px;
} }
.condividi-text{
font-size: 18px;
}
.date-icon .date-icon
{ {
font-size: 30px; font-size: 30px;
......
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