merge with developer

This commit is contained in:
Eudes Inácio
2021-09-21 06:16:06 +01:00
42 changed files with 934 additions and 296 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ export class AttachmentsService {
deleteEventAttachmentById(attachmentId) {
let geturl = environment.apiURL + `Attachments/Delete?attachmentId=${attachmentId}`;
let geturl = environment.apiURL + 'Attachments/Delete';
let params = new HttpParams();
+33 -5
View File
@@ -412,7 +412,7 @@ export class EventsService {
return this.http.post<string>(`${puturl}`, event, options)
}
deleteEvent(eventid:string, eventDeleteType:number)
deleteEvent(eventid:string, eventDeleteType:number, calendarName:string)
{
const puturl = environment.apiURL + 'calendar/DeleteEvent';
let params = new HttpParams();
@@ -421,10 +421,38 @@ export class EventsService {
// 0 for occurence and 1 for serie (delete all events)
params = params.set("eventDeleteType", eventDeleteType.toString());
let options = {
headers: this.headers,
params: params
};
let options;
switch (this.loggeduser.Profile) {
case 'MDGPR':
if(calendarName == 'Pessoal'){
options = {
headers: this.headersMdPessoal,
params: params
};
}
else if(calendarName == 'Oficial'){
options = {
headers: this.headersMdOficial,
params: params
};
}
break;
case 'PR':
if(calendarName == 'Pessoal'){
options = {
headers: this.headersPrPessoal,
params: params
};
}
else if(calendarName == 'Oficial'){
options = {
headers: this.headersPrOficial,
params: params
};
}
break;
}
return this.http.delete(`${puturl}`, options)
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { FileService } from './file.service';
describe('FileService', () => {
let service: FileService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(FileService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,78 @@
import { Injectable } from '@angular/core';
import { FileLoaderService } from '../file/file-loader.service';
import { FileToBase64Service } from '../file/file-to-base64.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
//Cordova
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
@Injectable({
providedIn: 'root'
})
export class FileService {
capturedImage:any;
capturedImageTitle:any;
constructor(
private camera: Camera,
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service,
private iab: InAppBrowser,
) { }
takePicture() {
const options: CameraOptions = {
quality: 50,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
targetWidth: 720,
targetHeight: 720,
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64 (DATA_URL): m
//let base64Image = 'data:image/jpeg;base64,' + imageData;
this.capturedImage = 'data:image/png;base64,'+imageData;
this.capturedImageTitle = new Date().getTime() + '.jpeg';
}, (err) => {
/* console.log(err); */
});
let data = {
image:this.capturedImage,
name: this.capturedImageTitle
}
return data;
}
loadPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
input.onchange = async () => {
const file = this.fileLoaderService.getFirstFile(input)
console.log(file);
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name;
let data = {
image:this.capturedImage,
name: this.capturedImageTitle
}
return data;
};
}
viewDocumentByUrl(url) {
const browser = this.iab.create(url,"_blank");
browser.show();
}
}