diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts
index 7806b556e..7fb0feba0 100644
--- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts
+++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts
@@ -8,6 +8,7 @@ import { ImageModalPage } from '../../gallery/image-modal/image-modal.page';
import { NewPublicationPage } from '../../new-publication/new-publication.page';
import { Location } from '@angular/common';
import { ThemeService } from 'src/app/services/theme.service'
+import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
@Component({
@@ -122,7 +123,7 @@ export class PublicationDetailPage implements OnInit {
} finally {
loader.remove()
}
-
+
}
@@ -146,13 +147,17 @@ export class PublicationDetailPage implements OnInit {
});
}
- openPreview(imageUrl:string){
- this.modalController.create({
- component: ImageModalPage,
+ async openPreview(item) {
+ const modal = await this.modalController.create({
+ component: ViewMediaPage,
+ cssClass: 'modal modal-desktop',
componentProps: {
- imageUrl:imageUrl,
+ image: item.FileBase64,
+ username: item.Title,
+ _updatedAt: item.DatePublication
}
- }).then(modal => modal.present());
+ });
+ modal.present();
}
diff --git a/src/app/pages/publications/view-publications/view-publications.page.scss b/src/app/pages/publications/view-publications/view-publications.page.scss
index 77534f9d2..2eed91594 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.scss
+++ b/src/app/pages/publications/view-publications/view-publications.page.scss
@@ -45,8 +45,6 @@
width: 100%; /* 400px */
height: 100%;
font-family: Roboto;
- border-top-left-radius: 25px;
- border-top-right-radius: 25px;
background-color: #fff;
overflow:hidden;
padding: 25px 20px 0px 20px;
@@ -96,9 +94,11 @@
/* padding: 0!important; */
float: left;
margin: 2.5px 0 0 5px;
+ color: #000 !important;
}
.title{
font-size: 25px;
+ color: #000 !important;
}
.actions-icon{
@@ -126,7 +126,7 @@
}
.post-img{
width: 100%;
- height: 400px;
+ //height: 400px;
margin: 0 auto;
border-radius: 0px!important;
overflow: hidden;
diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts
index 8d8839623..d95ba7411 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.ts
+++ b/src/app/pages/publications/view-publications/view-publications.page.ts
@@ -116,17 +116,12 @@ export class ViewPublicationsPage implements OnInit {
}
getPublicationDetail() {
-
- setTimeout(() => {
-
- let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
- this.item = allActions.find((e) => e.ProcessId == this.folderId);
- this.publicationDitails = this.item
- console.log('item', this.item)
-
- }, 100);
-
+ this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
+ console.log(res);
+ this.item = res;
+ });
}
+
// goes to fork
// getPublicationsIds() {
@@ -177,14 +172,14 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = false;
/* this.publicationList = new Array();
-
+
res.forEach(element => {
console.log('getPublications', element)
let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item);
});
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
-
+
this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList; */
});
@@ -232,8 +227,8 @@ export class ViewPublicationsPage implements OnInit {
forkJoin([
this.getPublicationsIds(),
this.getPublications(),
-
-
+
+
]).subscribe(allResults =>{
this.publicationList = allResults[2]
})
diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts
index 78f5c0a43..5973e67df 100644
--- a/src/app/services/functions/file.service.ts
+++ b/src/app/services/functions/file.service.ts
@@ -10,11 +10,9 @@ import { SearchList } from 'src/app/models/search-document';
import { ProcessesService } from '../processes.service';
import { ToastService } from '../toast.service';
import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera';
-import {
-FileSharer} from '@byteowls/capacitor-filesharer';
import { Filesystem, Directory } from '@capacitor/filesystem';
-import { Share } from '@capacitor/share';
-import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
+import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
const IMAGE_DIR = 'stored-images';
@@ -40,6 +38,8 @@ export class FileService {
photos: any[] = [];
idroom: any;
+ headers: HttpHeaders;
+
constructor(
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service,
@@ -50,9 +50,35 @@ export class FileService {
private toastService: ToastService,
private platform: Platform,
private loadingCtrl: LoadingController,
- private http: HttpClient
+ private http: HttpClient,
) { }
+ uploadFile(formData:any){
+ alert('OIEE')
+
+ //const geturl = environment.apiURL + 'Tasks/DelegateTask';
+ const geturl = environment.apiURL + 'lakefs/UploadFiles';
+
+ let options = {
+ headers: this.headers
+ };
+
+ return this.http.post(`${geturl}`, formData, options);
+ }
+
+ getFile(guid:any){
+ const geturl = environment.apiURL + 'lakefs/StreamFile';
+ let params = new HttpParams();
+
+ params = params.set("path", guid);
+
+ let options = {
+ headers: this.headers,
+ params: params
+ };
+ return this.http.get
(`${geturl}`, options);
+ }
+
async takePicture() {
const capturedImage = await Camera.getPhoto({
quality: 90,
@@ -89,9 +115,9 @@ export class FileService {
reader.readAsDataURL(blob);
});
- loadPicture() {
+ async loadPicture() {
const input = this.fileLoaderService.createInput({
- accept: ['image/apng', 'image/jpeg', 'image/png']
+ accept: ['image/apng', 'image/jpeg', 'image/png', '.pdf']
})
input.onchange = async () => {
@@ -195,7 +221,7 @@ export class FileService {
console.log('ALL IMAGE', this.images)
this.capturedImage = this.images[0].data
-
+
this.capturedImageTitle = new Date().getTime() + '.jpeg';
let body = {
@@ -236,11 +262,8 @@ export class FileService {
await this.saveImage(image,roomId)
}
- await Share.share({
- title: 'Check my image',
- url: image.path
- })
-
+ //this.capturedImage = this.capturedImage;
+
}
@@ -258,11 +281,6 @@ export class FileService {
await this.saveImage(capturedImage,roomId)
}
- await Share.share({
- title: 'Check my image',
- url: capturedImage.path
- })
-
/* const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
@@ -303,17 +321,17 @@ export class FileService {
reader.onloadend=()=>{
const result = reader.result as string
const base64Data = result.split(',')[1]
-
- FileSharer.share({
+
+ /* FileSharer.share({
filename:'any.pdf',
base64Data,
contentType: "application/pdf",
- })
+ }) */
reader.readAsDataURL(res)
}
-
+
})
-
+
}
addPictureToChat(roomId) {
@@ -335,10 +353,15 @@ export class FileService {
const file = this.fileLoaderService.getFirstFile(input)
console.log(file);
- const loader = this.toastService.loading();
- const imageData = await this.fileToBase64Service.convert(file)
- this.capturedImage = imageData;
+
+ const formData = new FormData();
+ formData.append("blobFile", file);
+ let guid: any = await this.uploadFile(formData).toPromise()
+ console.log(guid.path);
+
+ /* const imageData = await this.fileToBase64Service.convert(file)
+ this.capturedImage = imageData; */
this.capturedImageTitle = file.name;
let body = {
@@ -350,8 +373,12 @@ export class FileService {
//"title": this.capturedImageTitle ,
//"text": "description",
"title_link_download": false,
- "image_url": this.capturedImage,
- }]
+ //"image_url": this.capturedImage,
+ }],
+ "file":{
+ "type": "application/img",
+ "guid": guid.path,
+ }
}
}
@@ -359,10 +386,9 @@ export class FileService {
console.log(this.capturedImage)
this.chatService.sendMessage(body).subscribe(res=> {
- loader.remove();
+
//console.log(res);
},(error) => {
- loader.remove();
});
//console.log(this.capturedImage)
};
diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts
index 24404944e..0385d53b5 100644
--- a/src/app/services/processes.service.ts
+++ b/src/app/services/processes.service.ts
@@ -43,6 +43,19 @@ export class ProcessesService {
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
}
+ uploadFile(formData:any){
+ alert('OIEE')
+
+ //const geturl = environment.apiURL + 'Tasks/DelegateTask';
+ const geturl = environment.apiURL + 'lakefs/UploadFiles';
+
+ let options = {
+ headers: this.headers
+ };
+
+ return this.http.post(`${geturl}`, formData, options);
+ }
+
GetTasksList(processname: typeof GetTasksListType, onlycount:boolean): Observable
{
const geturl = environment.apiURL + 'tasks/List';
diff --git a/src/app/services/sqlite.service.ts b/src/app/services/sqlite.service.ts
index 01bd2cfb6..ce10d1711 100644
--- a/src/app/services/sqlite.service.ts
+++ b/src/app/services/sqlite.service.ts
@@ -14,11 +14,17 @@ export class SqliteService {
readonly allprocess: string = "ALLPROCESS";
readonly actions: string = "ACTIONS";
readonly publications: string = "PUBLICATIONS";
+ readonly chatlistroom: string = "CHATLISTROOM";
+ readonly chatlistUsers: string = "CHATLISTUSERS";
+ readonly chatmsg: string = "CHATMSG";
EVENTS: Array;
EXPEDIENTES: Array;
ALLPROCESS: Array;
PROCESS: Array;
ALLACTIONS: Array;
+ ALLChatROOM: Array;
+ ALLChatUSERs: Array;
+ ALLCHATMSG: Array;
constructor(private platform: Platform,
private sqlite: SQLite) {
@@ -127,8 +133,55 @@ export class SqliteService {
console.log("Sucess action Table created: ", res)
})
.catch((error) => console.log(JSON.stringify(error)));
+
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.chatlistroom} (
+ Id varchar(255) PRIMARY KEY,
+ Uids Text,
+ Usernames Text,
+ LastMessage Text,
+ UpdatedAt varchar(255)
+ )`, [])
+ .then((res) => {
+ console.log("Sucess chat list room Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.chatlistUsers} (
+ Id varchar(255) PRIMARY KEY,
+ Name varchar(255),
+ Username varchar(255)
+
+ )`, [])
+ .then((res) => {
+ console.log("Sucess chat list users Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.chatmsg} (
+ Id varchar(255) PRIMARY KEY,
+ Attachments Text,
+ Channels Text,
+ File Text,
+ Mentions Text,
+ Msg varchar(255),
+ Rid varchar(255),
+ Ts varchar(255),
+ U Text,
+ UpdatedAt varchar(255)
+ )`, [])
+ .then((res) => {
+ console.log("Sucess chat msg Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+
+
})
.catch((error) => console.log(JSON.stringify(error)));
+
+
}).catch((error) => {
console.log('Platform ready error', error)
});
@@ -191,6 +244,48 @@ export class SqliteService {
});
}
+ //chatlistroom
+ public addChatListRoom(data) {
+ console.log('INSIDE DB CHAT LIST ROOM',data,)
+ this.dbInstance.executeSql(`
+ INSERT OR REPLACE INTO ${this.chatlistroom} (Id,Uids,Usernames,LastMessage,UpdatedAt)
+ VALUES ('${data.id}','${JSON.stringify(data.uids)}','${JSON.stringify(data.usernames)}','${JSON.stringify(data.lastMessage)}','${data.updatedat}')`, [])
+ .then(() => {
+ console.log("chat room add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+ //chatlistusers
+ public addChatListUsers(data) {
+ console.log('INSIDE DB CHAT LIST ROOM',data,)
+ this.dbInstance.executeSql(`
+ INSERT OR REPLACE INTO ${this.chatlistUsers} (Id,Name,Username)
+ VALUES ('${data.id}','${data.name}','${data.username}')`, [])
+ .then(() => {
+ console.log("chat users add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+ //chatlistusers
+ public addChatMSG(data) {
+ console.log('INSIDE DB CHAT MSG',data,)
+ this.dbInstance.executeSql(`
+ INSERT OR REPLACE INTO ${this.chatmsg} (Id,Attachments,Channels,File,Mentions,Msg,Rid, Ts ,U, UpdatedAt)
+ VALUES ('${data._id}','${JSON.stringify(data.attachments)}','${JSON.stringify(data.channels)}','${JSON.stringify(data.file)}','${JSON.stringify(data.mentions)}','${data.msg}','${data.rid}','${data.ts}','${JSON.stringify(data.u)}','${data._updatedAt}')`, [])
+ .then(() => {
+ console.log("chat msg add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
//updateevent
public updateEvent(data) {
this.dbInstance.executeSql(`
@@ -348,6 +443,51 @@ export class SqliteService {
console.log(" Get all actions error", JSON.stringify(e));
});
}
+
+ //getAllChatRoom
+ getAllChatRoom() {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.chatlistroom}`, []).then((res) => {
+ this.ALLChatROOM = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLChatROOM.push(res.rows.item(i));
+ }
+ return this.ALLChatROOM;
+ }
+ }, (e) => {
+ console.log(" Get all chat room error", JSON.stringify(e));
+ });
+ }
+
+ //getAllChatUsers
+ getAllChatUsers() {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.chatlistUsers}`, []).then((res) => {
+ this.ALLChatUSERs = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLChatUSERs.push(res.rows.item(i));
+ }
+ return this.ALLChatUSERs;
+ }
+ }, (e) => {
+ console.log(" Get all chat users error", JSON.stringify(e));
+ });
+ }
+
+ //getAllChatMSG
+ getAllChatMSG(roomId) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.chatmsg} WHERE Rid = ?`, [roomId]).then((res) => {
+ this.ALLCHATMSG = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLCHATMSG.push(res.rows.item(i));
+ }
+ return this.ALLCHATMSG;
+ }
+ }, (e) => {
+ console.log(" Get all chat users error", JSON.stringify(e));
+ });
+ }
//getlistOfEventAprove
getListOfEventAprove(process, type) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, type]).then((res) => {
diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html
index 0ebc7fdbb..6d04f1ced 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.html
+++ b/src/app/shared/chat/group-messages/group-messages.page.html
@@ -44,7 +44,7 @@
A conversa original mantêm-se como chat individual