Commit ee044a3e by Matteo

Upload file funziona + disattivati loading alert da ios

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