mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
All GET methods for the module Publications have been integrated.
- Create new folder for publications have been integrated. - Adicional touch to display the data in a more friendly way added.
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
import { GalleryPage } from '../gallery/gallery.page';
|
||||
/* import { Camera } from '@ionic-native/camera/ngx'; */
|
||||
|
||||
import {Plugins, CameraResultType, CameraSource} from '@capacitor/core';
|
||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
/* import { Camera } from '@ionic-native/camera/ngx'; */
|
||||
|
||||
/* const { Camera } = Plugins; */
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-publication',
|
||||
@@ -8,11 +17,23 @@ import { GalleryPage } from '../gallery/gallery.page';
|
||||
styleUrls: ['./new-publication.page.scss'],
|
||||
})
|
||||
export class NewPublicationPage implements OnInit {
|
||||
publication: Publication;
|
||||
pub: Publication = new Publication();
|
||||
|
||||
publicationType:string;
|
||||
publicationTitle:string;
|
||||
imgUrl:any;
|
||||
|
||||
photo: SafeResourceUrl;
|
||||
|
||||
guestPicture:any;
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
/* private camera: Camera, */
|
||||
private sanitizer: DomSanitizer,
|
||||
private publications: PublicationsService,
|
||||
) {
|
||||
this.publicationType = this.navParams.get('publicationType');
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
@@ -20,10 +41,49 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.setTitle();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* async takePictures() {
|
||||
try {
|
||||
const profilePicture = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
allowEditing: false,
|
||||
resultType: CameraResultType.Base64,
|
||||
}).then(res =>{
|
||||
console.log(res);
|
||||
|
||||
});
|
||||
console.log(profilePicture);
|
||||
|
||||
this.guestPicture = "data:image/jpg;base64," + profilePicture.base64String;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
|
||||
save(){
|
||||
|
||||
if(this.publication.processId){
|
||||
this.publication = {
|
||||
publicationId:this.publication.publicationId,
|
||||
processId:this.publication.processId,
|
||||
title: this.publication.title,
|
||||
description: this.publication.description,
|
||||
imageUrl:this.publication.imageUrl,
|
||||
date: this.publication.date,
|
||||
}
|
||||
console.log('Edit');
|
||||
}
|
||||
else{
|
||||
console.log('Create');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
close(){
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
@@ -35,7 +95,10 @@ export class NewPublicationPage implements OnInit {
|
||||
this.publicationTitle = 'Nova Publicação'
|
||||
}
|
||||
else if(this.publicationType == '3'){
|
||||
this.publicationTitle = 'Editar Publicação'
|
||||
this.publicationTitle = 'Editar Publicação';
|
||||
this.pub = this.navParams.get('publication');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,4 +114,38 @@ export class NewPublicationPage implements OnInit {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async takePicture(){
|
||||
const image = await Plugins.Camera.getPhoto({
|
||||
quality: 100,
|
||||
allowEditing: false,
|
||||
resultType: CameraResultType.DataUrl,
|
||||
source: CameraSource.Camera
|
||||
});
|
||||
|
||||
this.photo = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl));
|
||||
}
|
||||
openCamera(){
|
||||
/* this.camera.getPicture({
|
||||
sourceType: this.camera.PictureSourceType.CAMERA,
|
||||
destinationType: this.camera.DestinationType.FILE_URI,
|
||||
}).then((res)=>{
|
||||
this.imgUrl = res;
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
});
|
||||
console.log('camera'); */
|
||||
|
||||
}
|
||||
|
||||
getGallery(){
|
||||
/* this.camera.getPicture({
|
||||
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
}).then((res)=>{
|
||||
this.imgUrl = 'data:image/jpeg;base64,' + res;
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
}); */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user