Fixed upload feature

Added new design to message options
This commit is contained in:
tiago.kayaya
2021-10-06 17:27:49 +01:00
parent 9a629628f3
commit cfd896dfca
8 changed files with 120 additions and 30 deletions
@@ -7,7 +7,7 @@
<div class="buttons">
<button (click)="takePicture()" full class="btn-cancel hide-desktop" shape="round" >Tirar Fotografia</button>
<button (click)="addPicture()" full class="btn-cancel" shape="round" >Anexar Fotografia</button>
<button hidden (click)="addDocument()" class="btn-cancel" shape="round" >Documento</button>
<button (click)="addDocument()" class="btn-cancel" shape="round" >Documento</button>
<button (click)="addDocGestaoDocumental()" class="btn-cancel" shape="round" >Anexar Documento (G.D.)</button>
<div class="solid"></div>
<button (click)="bookMeeting()" class="btn-cancel" shape="round" >Novo Evento</button>
+8
View File
@@ -129,6 +129,14 @@ export class ChatService {
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
}
uploadFile(formData:any, rid:string){
let url = environment.apiChatUrl+'rooms.upload/'+rid;
let opts = {
headers: this.headers,
}
return this.http.post(url, formData, opts);
}
deleteMessage(body:any){
let opts = {
headers: this.headers,
+6 -25
View File
@@ -21,6 +21,8 @@ export class FileService {
documents:SearchList[] = [];
showLoader: boolean;
files: Set<File>;
constructor(
private camera: Camera,
private fileLoaderService: FileLoaderService,
@@ -160,33 +162,12 @@ export class FileService {
console.log(file);
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name;
const formData = new FormData();
formData.append('file', file, file.name);
let body = {
"message":
{
"rid": roomId,
"msg": "",
"attachments": [{
"title": this.capturedImageTitle,
"text": "",
"title_link": this.capturedImage,
"title_link_download": true,
"message_link": this.capturedImage,
"type": "file"
}],
"file":{
"name": this.capturedImageTitle,
"type": "application/pdf",
}
}
}
this.chatService.sendMessage(body).subscribe(res=> {
this.chatService.uploadFile(formData, roomId).subscribe(res=> {
console.log(res);
loader.remove();
//console.log(res);
},(error) => {
loader.remove();
});
@@ -127,9 +127,31 @@
<ion-footer>
<div class="container width-100 d-flex">
<div>
<button class="btn-no-color" (click)="openSendGroupMessageOptions()">
<!-- <button class="btn-no-color" (click)="openSendGroupMessageOptions()">
<ion-icon class="chat-icon-options" src="assets/images/icons-add-new-event.svg"></ion-icon>
</button>
</button> -->
<ion-fab horizontal="start" vertical="bottom" slot="fixed">
<ion-fab-button color="light" size="small">
<ion-icon name="add"></ion-icon>
</ion-fab-button>
<ion-fab-list side="top">
<ion-fab-button (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addFileWebtrix()" color="light">
<ion-icon src="assets/icon/webtrix.svg"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon>
</ion-fab-button>
<ion-fab-button class="hide-desktop" (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab-list>
</ion-fab>
</div>
<div class="width-80">
<ion-item class="ion-no-padding type-message" lines="none">
@@ -632,6 +632,26 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
modal.onDidDismiss();
}
takePicture(){
this.fileService.addCameraPictureToChat(this.roomId);
}
addImage(){
this.fileService.addPictureToChat(this.roomId);
}
addFile(){
this.fileService.addDocumentToChat(this.roomId);
}
addFileWebtrix(){
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
}
bookMeeting(){
let data = {
roomId: this.roomId,
members: this.members
}
this.openNewEventPage.emit(data);
}
async _openChatOptions() {
const enterAnimation = (baseEl: any) => {
@@ -99,9 +99,33 @@
<ion-footer>
<div class="container width-100 d-flex">
<div>
<button class="btn-no-color" (click)="openSendMessageOptions()">
<!-- <button class="btn-no-color" (click)="openSendMessageOptions()">
<ion-icon class="chat-icon-options" src="assets/images/icons-add-new-event.svg"></ion-icon>
</button>
</button> -->
<ion-fab horizontal="start" vertical="bottom" slot="fixed">
<ion-fab-button color="light" size="small">
<ion-icon name="add"></ion-icon>
</ion-fab-button>
<ion-fab-list side="top">
<ion-fab-button (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addFileWebtrix()" color="light">
<ion-icon src="assets/icon/webtrix.svg"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon>
</ion-fab-button>
<ion-fab-button class="hide-desktop" (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab-list>
</ion-fab>
</div>
<div class="width-80">
<ion-item class="ion-no-padding type-message" lines="none">
@@ -379,6 +379,28 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
takePicture(){
this.fileService.addCameraPictureToChat(this.roomId);
}
addImage(){
this.fileService.addPictureToChat(this.roomId);
}
addFile(){
this.fileService.addDocumentToChat(this.roomId);
}
addFileWebtrix(){
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
}
bookMeeting(){
let data = {
roomId: this.roomId,
members: this.members
}
this.openNewEventPage.emit(data);
}
async _openChatOptions() {
const enterAnimation = (baseEl: any) => {
+13
View File
@@ -1180,6 +1180,19 @@ ngx-mat-datetime-content{
padding: 0 5px 0 5px;
}
.fab-list{
overflow: auto;
.fab-list-btn{
position: relative;
float: left;
border: 1px solid blue;
}
.fab-list-text{
border-radius: 15px;
}
}
@media only screen and (min-width: 665px) {
.loading-blocker {