add document from gestao digital

This commit is contained in:
tiago.kayaya
2021-09-14 15:57:24 +01:00
parent a59a4749ca
commit 427191ec36
7 changed files with 113 additions and 16 deletions
@@ -8,7 +8,7 @@
<button hidden (click)="notImplemented()" full class="btn-cancel" shape="round" >Tirar Fotografia</button>
<button hidden (click)="notImplemented()" class="btn-cancel" shape="round" >Digitalizar Documento</button>
<button (click)="anexarFoto()" full class="btn-cancel" shape="round" >Anexar Fotografia</button>
<button hidden (click)="getDoc()" class="btn-cancel" shape="round" >Anexar 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" >Marcar reunião</button>
<button (click)="close()" full class="btn-cancel mobile-only" shape="round" >Cancelar</button>
@@ -72,6 +72,10 @@ export class ChatOptionsFeaturesPage implements OnInit {
this.modalController.dismiss('picture');
}
addDocGestaoDocumental(){
this.modalController.dismiss('documentoGestaoDocumental');
}
laodPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
@@ -171,7 +175,6 @@ export class ChatOptionsFeaturesPage implements OnInit {
const data = res.data;
this.documents.push(data.selected);
console.log(res.data);
}
});
}
@@ -382,7 +382,6 @@ export class ExpedienteDetailPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then( async(res)=>{
alert('AQUI')
let body = res['data'];
if(res['data']) {
const loader = this.toastService.loading()
@@ -1,6 +1,7 @@
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';
@@ -16,6 +17,7 @@ export class FileService {
private camera: Camera,
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service,
private iab: InAppBrowser,
) { }
takePicture() {
@@ -68,4 +70,9 @@ export class FileService {
return data;
};
}
viewDocumentByUrl(url) {
const browser = this.iab.create(url,"_blank");
browser.show();
}
}
@@ -44,11 +44,22 @@
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
</div>
<div>
<div class="messages">
<ion-label>{{msg.msg}}</ion-label>
<div *ngIf="msg.attachments">
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<img src="{{file.image_url}}" alt="image" >
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
<div *ngIf="file.thumb_url">
<div class="file d-flex">
<ion-thumbnail slot="start">
<img src="{{file.thumb_url}}" alt="image">
</ion-thumbnail>
<ion-label>
<h3 (click)="viewDocument(file.title_link)" class="file-title cursor-pointer">{{file.title}}</h3>
<p *ngIf="file.text">{{file.text}}</p>
</ion-label>
</div>
</div>
</div>
</div>
{{last ? scrollToBottom() : ''}}
@@ -144,18 +144,32 @@
float: right;
}
.title{
display: inline;
color: #0782c9;
font-weight: bold;
margin-bottom: 5px;
display: inline;
color: #0782c9;
font-weight: bold;
margin-bottom: 5px;
.time{
color: #797979;
text-align: right;
margin-left: 10px;
float: right;
.time{
color: #797979;
text-align: right;
margin-left: 10px;
float: right;
}
}
.messages{
.message-attachments{
.file{
align-items: center;
.file-title{
color: #000;
text-decoration: underline;
}
.file-title:hover{
color: #0782c9;
}
}
}
}
}
}
ion-footer{
@@ -13,6 +13,10 @@ import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/ch
import { TimeService } from 'src/app/services/functions/time.service';
import { FileLoaderService } from 'src/app/services/file/file-loader.service';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchList } from 'src/app/models/search-document';
import { ProcessesService } from 'src/app/services/processes.service';
import { FileService } from 'src/app/services/functions/file.service';
@Component({
selector: 'app-group-messages',
@@ -26,6 +30,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
message:any;
messages:any;
allUsers:any[] = [];
documents:SearchList[] = [];
room:any = new Array();
@@ -64,6 +69,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
private timeService: TimeService,
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service,
private processesService: ProcessesService,
private fileService: FileService,
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true;
@@ -435,6 +442,59 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
};
}
async addDocGestaoDocumental(){
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
select: true,
showSearchInput: true,
}
});
await modal.present();
modal.onDidDismiss().then(async res=>{
if(res){
const data = res.data;
this.documents.push(data.selected);
console.log(res.data.selected);
console.log(res.data.selected.Id);
console.log(res.data.selected.ApplicationType);
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
console.log(url_no_options);
console.log('Oie');
let body = {
"message":
{
"rid": this.roomId,
"msg": "",
"attachments": [{
"title": res.data.selected.Assunto,
"text": res.data.selected.DocTypeDesc,
"title_link": url_no_options,
"title_link_download": true,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
"message_link": url_no_options,
}]
}
}
this.chatService.sendMessage(body).subscribe(res=> {
console.log(res);
},(error) => {
});
}
});
}
viewDocument(url:string){
this.fileService.viewDocumentByUrl(url);
}
async _openChatOptions() {
const enterAnimation = (baseEl: any) => {
@@ -485,6 +545,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
else if(res['data'] == 'picture'){
this.loadPicture();
}
else if(res['data'] == 'documentoGestaoDocumental'){
this.addDocGestaoDocumental();
}
});
}