Commit ee044a3e by Matteo

Upload file funziona + disattivati loading alert da ios

parent cf2d93a9
...@@ -99,6 +99,8 @@ export class ParerePage implements OnInit { ...@@ -99,6 +99,8 @@ export class ParerePage implements OnInit {
selection: boolean = false; selection: boolean = false;
clickCheckbox: boolean = false; clickCheckbox: boolean = false;
filename: string = "";
toggleGroup(id : number) toggleGroup(id : number)
{ {
if(this.clickCheckbox) if(this.clickCheckbox)
...@@ -210,7 +212,10 @@ export class ParerePage implements OnInit { ...@@ -210,7 +212,10 @@ export class ParerePage implements OnInit {
{ {
this.utilService.showLoading(); this.utilService.showLoading();
this.idCliente = AuthService.clienteSelezionato.id; this.idCliente = AuthService.clienteSelezionato.id;
this.parereService.newParere(this.idCliente, form.value.title, form.value.question, result.file, form.value.file).subscribe((res: NewRichiestaResponse)=>{ var filename;
if(this.platform.is("ios")) filename = this.filename;
else filename = form.value.file;
this.parereService.newParere(this.idCliente, form.value.title, form.value.question, result.file, filename).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"]);
...@@ -340,6 +345,7 @@ upload(str:any) ...@@ -340,6 +345,7 @@ upload(str:any)
{ {
var element : HTMLInputElement = document.querySelector('input[type=file]'); var element : HTMLInputElement = document.querySelector('input[type=file]');
var file: Blob = element.files[0]; var file: Blob = element.files[0];
this.filename = element.value;
var reader = new FileReader(); var reader = new FileReader();
reader.onloadend = function () { reader.onloadend = function () {
......
...@@ -153,7 +153,7 @@ export class ParereService { ...@@ -153,7 +153,7 @@ export class ParereService {
if(nomeFile.indexOf('/') != -1) nomeFile = nomeFile.substring(nomeFile.lastIndexOf('/')+1); if(nomeFile.indexOf('/') != -1) nomeFile = nomeFile.substring(nomeFile.lastIndexOf('/')+1);
else if(nomeFile.indexOf('\\') != -1) nomeFile = nomeFile.substring(nomeFile.lastIndexOf('\\')+1); else if(nomeFile.indexOf('\\') != -1) nomeFile = nomeFile.substring(nomeFile.lastIndexOf('\\')+1);
if(!this.platform.is("ios") && file != null) file = file.substring(file.lastIndexOf('base64,')+7); if(file != null) file = file.substring(file.lastIndexOf('base64,')+7);
var richiesta = this.creaRichiestaNuova(id, title, question, file, nomeFile); var richiesta = this.creaRichiestaNuova(id, title, question, file, nomeFile);
var param = this.encodeNuovaRichiesta(richiesta); var param = this.encodeNuovaRichiesta(richiesta);
return this.httpClient.post<NewRichiestaResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/newrichiesta.do', param, this.httpClientDataService.httpOptionsJson) return this.httpClient.post<NewRichiestaResponse>(this.httpClientDataService.BASE_ADDRESS+'/intranet/newrichiesta.do', param, this.httpClientDataService.httpOptionsJson)
......
...@@ -118,6 +118,7 @@ export class UtilService { ...@@ -118,6 +118,7 @@ export class UtilService {
} }
async showLoading() { async showLoading() {
if(this.platform.is("ios")) return null;
this.loader = await this.loadingCtrl.create({ this.loader = await this.loadingCtrl.create({
message: "Please wait...", message: "Please wait...",
}); });
...@@ -126,6 +127,7 @@ export class UtilService { ...@@ -126,6 +127,7 @@ export class UtilService {
} }
closeLoading() { closeLoading() {
if(this.platform.is("ios")) return null;
if(this.loaders.length > 0) if(this.loaders.length > 0)
{ {
this.loader = this.loaders.pop(); this.loader = this.loaders.pop();
......
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