mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
save
This commit is contained in:
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
<div class="item-date" [class.item-date-active]="group._id ==idSelected" *ngIf="group.lastMessage">{{showDateDuration(group._updatedAt)}}</div>
|
||||
</div>
|
||||
<div class="item-description d-flex align-items-center" [class.item-description-active]="group._id ==idSelected" *ngIf="group.lastMessage">
|
||||
<div *ngIf="group.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="group._id ==idSelected">
|
||||
<div class="item-message">{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} </div>
|
||||
<div class="item-files" *ngIf="group.lastMessage.file">
|
||||
<fa-icon icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group._id == idSelected"></fa-icon>
|
||||
|
||||
@@ -111,19 +111,19 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.scrollChangeCallback = () => this.onContentScrolled(event);
|
||||
window.addEventListener('scroll', this.scrollChangeCallback, true);
|
||||
|
||||
const gesture = this.gestureController.create({
|
||||
el: this.rectangle.nativeElement,
|
||||
gestureName:'long-press',
|
||||
onStart: () => { alert('OP') },
|
||||
/* onMove () => {
|
||||
console.log('Move');
|
||||
}, */
|
||||
onEnd: () => {
|
||||
console.log('ENNNNNDS');
|
||||
},
|
||||
})
|
||||
// const gesture = this.gestureController.create({
|
||||
// el: this.rectangle.nativeElement,
|
||||
// gestureName:'long-press',
|
||||
// onStart: () => { alert('OP') },
|
||||
// /* onMove () => {
|
||||
// console.log('Move');
|
||||
// }, */
|
||||
// onEnd: () => {
|
||||
// console.log('ENNNNNDS');
|
||||
// },
|
||||
// })
|
||||
|
||||
gesture.enable();
|
||||
// gesture.enable();
|
||||
}
|
||||
|
||||
handlePress(id?:string){
|
||||
@@ -426,7 +426,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-picture'){
|
||||
this.fileService.addPictureToChat(roomId);
|
||||
this.fileService.addPictureToChatMobile(roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-document'){
|
||||
|
||||
@@ -17,21 +17,23 @@ export class FileLoaderService {
|
||||
|
||||
|
||||
createInput({accept, type = 'file'}:createInput): HTMLInputElement {
|
||||
|
||||
|
||||
let input = document.createElement('input');
|
||||
input.type = type || 'file';
|
||||
input.accept = accept.join(', ')
|
||||
|
||||
|
||||
// input.onchange = () => {
|
||||
// // you can use this method to get file and perform respective operations
|
||||
// let files = Array.from(input.files);
|
||||
// console.log(files);
|
||||
// };
|
||||
|
||||
|
||||
input.click();
|
||||
|
||||
return input
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
getFirstFile(input: HTMLInputElement) {
|
||||
|
||||
@@ -86,38 +86,114 @@ export class FileService {
|
||||
}
|
||||
|
||||
addCameraPictureToChat(roomId){
|
||||
let data = this.takePicture();
|
||||
if(data.name != null){
|
||||
|
||||
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) => {
|
||||
this.capturedImage = 'data:image/png;base64,'+imageData;
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
"title": data.name,
|
||||
"title": this.capturedImageTitle,
|
||||
"title_link_download": false,
|
||||
"image_url": data.image,
|
||||
"image_url": this.capturedImage,
|
||||
}]
|
||||
}
|
||||
}
|
||||
const loader = this.toastService.loading();
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
console.log(res);
|
||||
loader.remove();
|
||||
},(error) => {
|
||||
|
||||
loader.remove();
|
||||
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
|
||||
});
|
||||
}
|
||||
else{
|
||||
|
||||
}, (err) => {
|
||||
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
addPictureToChatMobile(roomId) {
|
||||
alert('Here')
|
||||
|
||||
const options: CameraOptions = {
|
||||
quality: 90,
|
||||
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
encodingType: this.camera.EncodingType.JPEG,
|
||||
mediaType: this.camera.MediaType.PICTURE,
|
||||
targetWidth: 720,
|
||||
targetHeight: 720,
|
||||
correctOrientation: true
|
||||
}
|
||||
|
||||
this.camera.getPicture(options).then((imageData) => {
|
||||
let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||
this.capturedImage = imageData;
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
|
||||
//const loader = this.toastService.loading();
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
//"title": this.capturedImageTitle ,
|
||||
//"text": "description",
|
||||
"title_link_download": false,
|
||||
"image_url": this.capturedImage,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.capturedImage)
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
//loader.remove();
|
||||
//console.log(res);
|
||||
},(error) => {
|
||||
//loader.remove();
|
||||
});
|
||||
|
||||
|
||||
}, (err) => {
|
||||
//console.log(err);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
addPictureToChat(roomId) {
|
||||
|
||||
const input = this.fileLoaderService.createInput({
|
||||
accept: ['image/apng', 'image/jpeg', 'image/png']
|
||||
})
|
||||
|
||||
|
||||
setInterval(()=>{
|
||||
console.log(input.value)
|
||||
}, 550)
|
||||
|
||||
|
||||
input.onchange = async () => {
|
||||
|
||||
alert('Onchange AQUI')
|
||||
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
console.log(file);
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
<ion-fab-button hidden (click)="addImage()" color="light">
|
||||
<ion-icon name="image"></ion-icon>
|
||||
</ion-fab-button>
|
||||
<ion-fab-button hidden class="hide-desktop" (click)="takePicture()" color="light">
|
||||
<ion-fab-button class="hide-desktop" (click)="takePicture()" color="light">
|
||||
<ion-icon name="camera"></ion-icon>
|
||||
</ion-fab-button>
|
||||
<ion-fab-button (click)="addFileWebtrix()" color="light">
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
<ion-fab-button hidden (click)="addFile()" color="light">
|
||||
<ion-icon name="document"></ion-icon>
|
||||
</ion-fab-button>
|
||||
<ion-fab-button (click)="addImage()" color="light">
|
||||
<ion-fab-button hidden (click)="addImage()" color="light">
|
||||
<ion-icon name="image"></ion-icon>
|
||||
</ion-fab-button>
|
||||
<ion-fab-button class="hide-desktop" (click)="takePicture()" color="light">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="buttons">
|
||||
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
|
||||
<button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button>
|
||||
<button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
|
||||
<button hidden (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
|
||||
<button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Gestão Documental</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="bookMeeting()" class="btn-ok" shape="round" >Novo Evento</button>
|
||||
|
||||
Reference in New Issue
Block a user