This commit is contained in:
tiago.kayaya
2021-12-28 16:09:48 +01:00
49 changed files with 1733 additions and 347 deletions
+4
View File
@@ -227,6 +227,10 @@ const routes = [
{
path: 'view-media',
loadChildren: () => import('./modals/view-media/view-media.module').then( m => m.ViewMediaPageModule)
},
{
path: 'view-event',
loadChildren: () => import('./modals/view-event/view-event.module').then( m => m.ViewEventPageModule)
},
+4
View File
@@ -355,6 +355,10 @@ const routes: Routes = [
},
]
},
{
path:':eventId/:caller',
loadChildren: () => import('../pages/agenda/view-event/view-event.module').then( m => m.ViewEventPageModule),
},
],
@@ -290,6 +290,7 @@ export class CreateProcessPage implements OnInit {
await this.despachoService.EfectuarDespacho({serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
this.modalController.dismiss();
this.toastService._successMessage('Despacho criado');
} catch (error) {
this.toastService._badRequest('Processo não efectuado');
@@ -32,7 +32,7 @@
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
@@ -65,7 +65,7 @@
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
@@ -123,7 +123,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -166,7 +166,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -182,7 +182,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewEventPage } from './view-event.page';
const routes: Routes = [
{
path: '',
component: ViewEventPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ViewEventPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ViewEventPageRoutingModule } from './view-event-routing.module';
import { ViewEventPage } from './view-event.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ViewEventPageRoutingModule
],
declarations: [ViewEventPage]
})
export class ViewEventPageModule {}
@@ -0,0 +1,128 @@
<ion-header class="ion-no-border">
</ion-header>
<ion-content class="container-wrapper main-content-l height-100 white ">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content d-flex height-100" [className]="isModal ? '_main-content d-flex height-100 ma-0 px-20 pt-30 pb-20 background-white' : 'main-content d-flex height-100'">
<div class="content d-flex flex-column width-100">
<div class="main-header d-flex">
<div class="title-content d-flex justify-between width-100">
<div class="left">
<button class="btn-no-color d-flex align-center" (click)="goBack()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</button>
</div>
<div class="middle">
<p class="title"><span>{{loadedEvent.Subject}}</span></p>
</div>
<div class="menu-options d-flex">
<button class="btn-no-color" (click)="editEvent()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/icons-edit.svg" ></ion-icon>
</button>
<button class="btn-no-color" (click)="deleteEvent()">
<ion-icon class="delete" name="trash-sharp"></ion-icon>
</button>
</div>
</div>
</div>
<div class="overflow-y-auto">
<div class="upper-content ml-45">
<div class="content-location">
<span class="date">{{loadedEvent.Location}}</span>
<div *ngIf="loadedEvent.Organizer">
<div *ngIf="loadedEvent.Organizer.Name == 'Agenda do Presidente da República' ">
<span class="label" *ngIf="loadedEvent.CalendarName == 'Oficial' " style="background-color: #99e47b;">{{loadedEvent.CalendarName}}</span>
<span class="label" *ngIf="loadedEvent.CalendarName == 'Pessoal' " style="background-color: #958bfc;">{{loadedEvent.CalendarName}}</span>
</div>
<div *ngIf="loadedEvent.Organizer.Name == 'Agenda do Ministro e Director do Gabinete do PR' ">
<span class="label" *ngIf="loadedEvent.CalendarName == 'Oficial' " style="background-color: #ffb703;">{{loadedEvent.CalendarName}}</span>
<span class="label" *ngIf="loadedEvent.CalendarName == 'Pessoal' " style="background-color: #f05d5e;">{{loadedEvent.CalendarName}}</span>
</div>
</div>
</div>
<div class="content-details">
<ion-label>
<p>{{customDate}}</p>
<p>das {{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
<p *ngIf="!loadedEvent.IsRecurring">(Não se repete)</p>
<p *ngIf="loadedEvent.IsRecurring">
<span *ngIf="loadedEvent.EventRecurrence.Type == 0">Diário</span>
<span *ngIf="loadedEvent.EventRecurrence.Type == 1">Semanal</span>
<span *ngIf="loadedEvent.EventRecurrence.Type == 2">Mensal</span>
<span *ngIf="loadedEvent.EventRecurrence.Type == 3">Anual</span>
<span *ngIf="loadedEvent.EventRecurrence.Type == -1">Nunca</span>
</p>
</ion-label>
</div>
</div>
<div class="line"></div>
<div class="middle-content">
<div *ngIf="loadedEvent.Attendees">
<h5>Intervenientes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let attendee of loadedEvent.Attendees">
<p>{{attendee.Name}}</p>
</div>
</ion-label>
</ion-item>
</div>
<div *ngIf="loadedEvent.Body.Text">
<h5>Detalhes</h5>
<ion-item lines="none" class="ion-no-margin ion-no-padding">
<div disabled class="width-100" [innerHTML]="loadedEvent.Body.Text" rows="6"></div>
</ion-item>
<div class="line"></div>
</div>
</div>
<div *ngIf="loadedEvent.Attachments" class="bottom-content width-100">
<h5>Documentos Anexados</h5>
<ion-list class="width-100">
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
<p class="flex-grow-1" >
<span class="attach-title-item d-block">{{attach.SourceName}}</span>
<span class="span-left d-block">{{attach.Stakeholders}}</span>
</p>
<div class="d-flex pr-10">
<span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span>
</div>
<div (click)="docIndex(i);LoadDocumentDetails()" class="cursor-pointer" style="width: 35px; height: 41px;" autoHide="false">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg" ></ion-icon>
</div>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
</div>
<div class="aside-right flex-column height-100">
<div class="buttons">
<button (click)="editEvent()" full class="btn-ok" shape="round" >Editar</button>
<div class="solid"></div>
<button (click)="deleteEvent()" full class="btn-delete" shape="round" >Eliminar</button>
</div>
</div>
</div>
</ion-content>
@@ -0,0 +1,301 @@
@import '~src/function.scss';
ion-content{
--background:transparent;
/* --padding-top:0px;
--padding-start: 20px;
--padding-end: 20px;
font-size: 18px; */
overflow: auto;
}
ion-menu{
--height: 225px;
}
.header-toolbar{
--background:transparent;
--opacity: 1;
}
.main-header{
width: 100%; /* 400px */
font-family: Roboto;
background-color: #fff;
color:#000;
transform: translate3d(0, 1px, 0);
.title-content{
width: 100% !important;
margin: 0px auto;
padding: 0 !important;
background: #fff;
overflow: auto;
.left{
width: 37px;
float: left;
font-size: 35px;
}
.middle{
width: calc(100% - 138.5px) !important;
padding: 0 !important;
float: left;
margin: 0 !important;
overflow: auto;
p{
margin: 0 !important;
}
}
.header-icon-right{
width: 45px;
font-size: 45px;
float: right;
}
.menu-options{
width: fit-content;
height: fit-content;
align-items: flex-start;
justify-content: flex-start;
float: right;
padding: 1px;
margin-left: 15px;
}
.menu-options .edit{
font-size: 35px;
float: left;
}
.menu-options .delete{
padding: 7px;
font-size: 21px;
color:#fff;
background: #d30606;
border-radius: 20px;
margin-left: 10px;
}
}
.title{
font-size: 25px;
}
}
.main-content{
width: 100%;
font-family: Roboto;
background-color: #fff !important;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
overflow:auto;
.content{
padding: 30px 20px 0 20px !important;
margin: 0;
float: left;
}
.upper-content{
width: calc(100%-50px);
margin-left: 50px;
font-size: 18px;
.content-location{
width: 100%;
margin: 0 auto;
padding: 0;
overflow: auto;
.date{
width: calc(100% - 105px);
float: left;
}
}
.location-detail{
width: 210px;
font-weight: 700;
font-size: 18px;
float: left;
margin: 5px 5px 5px 0px;
}
.button-mdgpr-Oficial{
width: 91px;
--border-radius: 20px;
--background: #ffb703;
margin-left: 5px;
float: left;
}
.button-mdgpr-Pessoal{
width: 91px;
--border-radius: 20px;
--background: #f05d5e;
margin-left: 5px;
float: left;
}
.button-pr-Oficial{
width: 91px;
--border-radius: 20px;
--background: #cbeecb;
margin-left: 5px;
float: left;
}
.button-pr-Pessoal{
width: 91px;
--border-radius: 20px;
--background: #cab0dc;
margin-left: 5px;
float: left;
}
.button-calendar-type ion-button{
height: 25px;
}
.button-edit-event {
width: 140px;
height: 44px;
border-radius: 22.5px;
--background: #e0e9ee;
--color:#061b52;
}
.content-details p{
font-size: 16px;
}
}
.line{
width: 100% !important;
margin-top: 15px;
border-top: 1px solid #d8d8d8;
}
.middle-conten{
width: 100% !important;
overflow: auto;
.middle-content h3, .middle-content p{
font-size: 16px;
}
}
.bottom-content{
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
}
.attach-document{
font-size: 15px;
color: var(--title-text-color);
margin: 5px 5px 5px 10px;
padding: 5px;
float: left;
}
.attach-icon{
width: 37px;
font-size: 35px;
float: left;
}
.attach-title-item{
width: 100%;
font-size: 15px;
color: var(--title-text-color);
}
/* SPAN */
.span-left{
float: left;
font-size: 15x;
}
.span-right{
text-align: right;
float: right;
font-size: 13px;
}
}
}
.aside-right{
padding: 30px 20px 0 20px !important;
.arrow-right{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
font-size: 35px;
}
}
.buttons{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
}
}
.solid {
display: block;
width: 90%;
border-top: 1px solid #ebebeb;
margin: 0 auto !important;
margin-bottom: 10px !important;
}
}
textarea{
border:none;
--background:#fff !important;
}
@media only screen and (max-width: 800px) {
.content{
width: 100% !important;
}
.aside-right{
display: none;
}
}
@media only screen and (min-width: 801px) {
.menu-options{
display: none !important;
}
.content{
width: 65%;
border-right: 1px solid #d8d8d8;
}
.aside-right{
width: 35%;
}
}
@media only screen and (min-width: 1024px){
.content{
width: 70%;
}
.aside-right{
width: 30%;
}
}
@media only screen and (min-width: 1140px){
.content{
width: 75%;
}
.aside-right{
width: 25%;
}
}
.label{
border-radius: 20px;
background: #ffb703;
float: right;
padding: 5px 13.5px 5px 13.5px;
color: #fff;
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ViewEventPage } from './view-event.page';
describe('ViewEventPage', () => {
let component: ViewEventPage;
let fixture: ComponentFixture<ViewEventPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ViewEventPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ViewEventPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,419 @@
import { Component, OnInit } from '@angular/core';
import { AlertController, ModalController, PopoverController, Platform, NavParams } from '@ionic/angular';
import { EventBody } from 'src/app/models/eventbody.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ProcessesService } from 'src/app/services/processes.service';
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
import { ActivatedRoute, Router } from '@angular/router';
import { ToastService } from 'src/app/services/toast.service';
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
import { Location } from '@angular/common'
import { SqliteService } from 'src/app/services/sqlite.service';
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { BackgroundService } from 'src/app/services/background.service';
import { StorageService } from 'src/app/services/storage.service';
import { ThemeService } from 'src/app/services/theme.service'
import { Event } from '../../models/event.model';
import { EditEventPage } from 'src/app/pages/agenda/edit-event/edit-event.page';
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
@Component({
selector: 'app-view-event',
templateUrl: './view-event.page.html',
styleUrls: ['./view-event.page.scss'],
})
export class ViewEventPage implements OnInit {
loadedEvent: Event;
isEventEdited: boolean;
eventBody: EventBody;
loadedAttachments: any;
pageId: string;
showLoader: boolean;
minDate: Date;
profile: string;
eventId: string;
caller: string;
customDate: any;
today: any;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
dicIndex = 0;
isModal = false
header = true
task: ExpedientTaskModalPageNavParamsTask;
LoadedDocument: any = null;
constructor(
private modalController: ModalController,
private navParams: NavParams,
private eventsService: EventsService,
public alertController: AlertController,
private iab: InAppBrowser,
private processes: ProcessesService,
public popoverController: PopoverController,
private activatedRoute: ActivatedRoute,
private router: Router,
private toastService: ToastService,
private location: Location,
public platform: Platform,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
private storage: StorageService,
public ThemeService: ThemeService
) {
this.eventId = this.navParams.get('eventId');
this.isEventEdited = false;
this.loadedEvent = new Event();
this.eventBody = { BodyType: "1", Text: "" };
this.loadedEvent.Body = this.eventBody;
}
ngOnInit() {
this.loadEvent();
this.backgroundservice.registerBackService('Online', () => {
this.storage.get('eventEdit').then((req) => {
JSON.parse(req).forEach(element => {
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
this.storage.remove('eventEdit')
console.log('eventEdit synchnize', res)
})
});
})
this.storage.get('eventDelete').then((req) => {
JSON.parse(req).forEach(element => {
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
this.storage.remove('eventDelete')
console.log('eventEdit synchnize', res)
})
});
})
this.loadEvent();
});
window.onresize = (event) => {
// if not mobile remove all component
if (window.innerWidth >= 1024) {
this.modalController.dismiss(this.isEventEdited);
}
};
}
close() {
this.modalController.dismiss(this.isEventEdited);
}
goBack() {
this.close();
}
doRefresh(ev) {
this.loadEvent();
ev.target.complete();
}
loadEvent() {
const loader = this.toastService.loading();
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
this.addEventToDb(res);
console.log('Loaded one event', res)
/* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove()
}, (error) => {
console.log('errorstatus ss',error.status)
if (error.status === 0) {
this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
loader.remove()
this.modalController.dismiss('Eevent not Foud');
this.location.back();
}
loader.remove()
});
}
deleteEvent() {
const loader = this.toastService.loading()
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.toastService.successMessage('Evento apagado');
}, () => { },
() => {
loader.remove();
});
loader.remove();
}
async OpenDeleteEventModal() {
const modal = await this.modalController.create({
component: EliminateEventPage,
componentProps: {
eventId: this.loadedEvent.EventId,
caller: this.caller,
},
cssClass: 'discart-expedient-modal',
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
if (res) {
setTimeout(() => {
/* this.loadEvent(); */
this.loadEvent()
}, 250);
this.isEventEdited = true;
}
});
}
async editEventDetail() {
const modal = await this.modalController.create({
component: EditEventPage,
componentProps: {
eventId: this.loadedEvent.EventId,
caller: this.caller,
},
cssClass: 'modal modal-desktop',
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
if (res) {
setTimeout(() => {
/* this.loadEvent(); */
this.loadEvent()
}, 250);
this.isEventEdited = true;
}
});
}
async editEvent() {
console.log(this.loadedEvent);
let classs;
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: EditEventPage,
componentProps: {
event: this.loadedEvent,
caller: this.caller,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
if (res) {
setTimeout(() => {
/* this.loadEvent(); */
this.loadEvent()
}, 250);
this.isEventEdited = true;
}
});
}
docIndex(index: number) {
this.dicIndex = index
}
async LoadDocumentDetails() {
const docId = this.loadedEvent.Attachments[this.dicIndex].SourceId
const applicationId: any = this.loadedEvent.Attachments[this.dicIndex].ApplicationId
const selectedDoc = this.loadedEvent.Attachments[this.dicIndex]
console.log('selectedDoc', selectedDoc)
this.task = {
serialNumber: '',
taskStartDate: '',
isEvent: true,
workflowInstanceDataFields: {
FolderID: '',
Subject: selectedDoc.SourceName,
SourceSecFsID: selectedDoc.ApplicationId || selectedDoc['ApplicationID'],
SourceType: 'DOC',
SourceID: selectedDoc.SourceId,
DispatchNumber: ''
}
}
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: this.task.workflowInstanceDataFields.Subject,
url: '',
title_link: '',
},
Document: this.loadedEvent.Attachments[this.dicIndex],
applicationId: this.task.workflowInstanceDataFields.SourceSecFsID,
docId: selectedDoc.SourceId,
folderId: '',
task: this.task
},
cssClass: 'modal modal-desktop'
});
await modal.present();
}
async openBookMeetingModal() {
let classs;
if (window.innerWidth < 701) {
classs = 'book-meeting-modal modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: DocumentSetUpMeetingPage,
componentProps: {
subject: this.task.workflowInstanceDataFields.Subject,
document: this.loadedEvent.Attachments[this.dicIndex],
},
cssClass: classs,
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res => {
//this.location.back();
});
}
// efetuar despacho
async openExpedientActionsModal(taskAction: any) {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: ExpedientTaskModalPage,
componentProps: {
taskAction: taskAction,
task: this.task,
seachDocuments: this.loadedEvent.Attachments[this.dicIndex],
aplicationId: this.loadedEvent.Attachments[this.dicIndex].ApplicationId || this.loadedEvent.Attachments[this.dicIndex]['ApplicationID']
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then(async (res) => { });
}
addEventToDb(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
let event = {
Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
Body: JSON.stringify(data.Body) || JSON.stringify(''),
CalendarId: data.CalendarId,
CalendarName: data.CalendarName,
Category: data.Category,
EndDate: data.EndDate,
EventId: data.EventId,
EventRecurrence: JSON.stringify(data.EventRecurrence) || JSON.stringify(''),
EventType: data.EventType,
HasAttachments: data.HasAttachments,
IsAllDayEvent: data.IsAllDayEvent,
IsMeeting: data.IsMeeting,
IsRecurring: data.IsRecurring,
Location: data.Location,
Organizer: JSON.stringify(data.Organizer) || JSON.stringify(''),
StartDate: data.StartDate,
Subject: data.Subject,
TimeZone: data.TimeZone
}
this.sqliteservice.updateEvent(event);
}
}
getFromDb() {
const loader = this.toastService.loading();
this.sqliteservice.getEventById(this.eventId).then((event) => {
let arrayevent = [];
console.log('EVENT ATTENDEES',event[0].Attendees)
let elemet = {
Attendees: (typeof JSON.parse(event[0].Attendees) === 'undefined') ? "" : JSON.parse(event[0].Attendees),
Body: JSON.parse(event[0].Body) || "",
CalendarId: event[0].CalendarId,
CalendarName: event[0].CalendarName,
Category: event[0].Category,
EndDate: event[0].EndDate,
EventId: event[0].EventId,
EventRecurrence: JSON.parse(event[0].EventRecurrence) || "",
EventType: event[0].EventType,
HasAttachments: event[0].HasAttachments,
IsAllDayEvent: event[0].IsAllDayEvent,
IsMeeting: event[0].IsMeeting,
IsRecurring: event[0].IsRecurring,
Location: event[0].Location,
Organizer: JSON.parse(event[0].Organizer) || "",
StartDate: event[0].StartDate,
Subject: event[0].Subject,
TimeZone: event[0].TimeZone
}
arrayevent.push(elemet);
this.loadedEvent = arrayevent[0];
console.log("Event ditails local,", elemet)
})
loader.remove()
}
}
@@ -20,7 +20,7 @@ ion-menu{
background-color: #fff;
color:#000;
transform: translate3d(0, 1px, 0);
.title-content{
width: 100% !important;
margin: 0px auto;
@@ -95,7 +95,7 @@ ion-menu{
width: calc(100%-50px);
margin-left: 50px;
font-size: 18px;
.content-location{
width: 100%;
margin: 0 auto;
@@ -106,10 +106,10 @@ ion-menu{
width: calc(100% - 105px);
float: left;
}
}
.location-detail{
width: 210px;
font-weight: 700;
@@ -175,10 +175,10 @@ ion-menu{
font-size: 16px;
}
}
.bottom-content{
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -214,12 +214,12 @@ ion-menu{
}
.aside-right{
padding: 30px 20px 0 20px !important;
.arrow-right{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -230,11 +230,10 @@ ion-menu{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -269,12 +268,12 @@ ion-menu{
width: 65%;
border-right: 1px solid #d8d8d8;
}
.aside-right{
width: 35%;
}
}
@media only screen and (min-width: 1024px){
.content{
width: 70%;
@@ -283,7 +282,7 @@ ion-menu{
width: 30%;
}
}
@media only screen and (min-width: 1140px){
.content{
width: 75%;
@@ -299,4 +298,4 @@ ion-menu{
float: right;
padding: 5px 13.5px 5px 13.5px;
color: #fff;
}
}
+10 -6
View File
@@ -72,8 +72,9 @@
<div *ngIf="dm.lastMessage" class="item-description" [class.item-description-active]="dm._id == idSelected">
<ion-label *ngIf="dm.lastMessage">{{dm.lastMessage.msg}}</ion-label>
<ion-label *ngIf="dm.lastMessage.file">
<fa-icon icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="dm._id == idSelected"></fa-icon>
<span> {{dm.lastMessage.file.name}}</span>
<fa-icon *ngIf="dm.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="dm._id == idSelected"></fa-icon>
<fa-icon *ngIf="dm.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="dm._id == idSelected"></fa-icon>
<span> {{dm.lastMessage.file.name || dm.lastMessage.file.subject }}</span>
</ion-label>
<ion-label *ngIf="dm.lastMessage.attachments">
<div *ngIf="dm.lastMessage.attachments[0].image_url">
@@ -124,9 +125,10 @@
</div>
<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>
<span> {{group.lastMessage.file.name}}</span>
<div class="item-files add-ellipsis" *ngIf="group.lastMessage.file">
<fa-icon *ngIf="group.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group._id == idSelected"></fa-icon>
<fa-icon *ngIf="group.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="group._id == idSelected"></fa-icon>
<span class="item-files-title"> {{group.lastMessage.file.name || group.lastMessage.file.subject}}</span>
</div>
<div class="item-files" *ngIf="group.lastMessage.attachments">
<div *ngIf="group.lastMessage.attachments[0].image_url">
@@ -162,11 +164,13 @@
</div>
<!-- Aside right -->
<div class="aside-content d-none flex-column height-100">
<app-empty-chat [texto]="emptyTextDescription"
class="height-100 flex-column"
[style.display]="showEmptyComponent ? 'flex' : 'none'"
#messagecontainer>
</app-empty-chat>
<app-messages class=" height-100 flex-column"
*ngIf="showMessages"
[style.display]="showMessages ? 'flex' : 'none'"
@@ -226,6 +230,7 @@
<app-new-event
[profile]=""
[roomId]="groupRoomId"
[selectedSegment]=segment
[taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc"
@@ -235,7 +240,6 @@
(openAttendeesComponent)="openAttendeesComponent($event)"
(cloneAllmobileComponent)="closeNewEventComponent()"
[style.display]="showNewEvent ? 'flex' : 'none'"
[roomId]="groupRoomId"
class=" height-100 flex-column">
</app-new-event>
+5
View File
@@ -126,6 +126,11 @@ ion-content{
}
.item-files{
float: left;
overflow: auto;
.item-files-title{
width: 100%;
}
}
}
.item-description-active{
+192 -16
View File
@@ -30,6 +30,7 @@ import { TimeService } from 'src/app/services/functions/time.service';
import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { StorageService } from 'src/app/services/storage.service';
@@ -121,7 +122,8 @@ export class ChatPage implements OnInit {
private dataService: DataService,
private router: Router,
private sqlservice: SqliteService,
private platform: Platform
private platform: Platform,
private storageservice: StorageService
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
@@ -144,6 +146,8 @@ export class ChatPage implements OnInit {
this.loggedUser = res;
console.log(this.loggedUser);
this.load();
this.getDirectMessagesDB();
});
/* websocket functions */
@@ -329,6 +333,7 @@ export class ChatPage implements OnInit {
IsRequired: "true",
}
});
this.groupRoomId = data.roomId;
this.closeAllDesktopComponents();
if (window.innerWidth < 701) {
console.log('Mobile');
@@ -408,20 +413,39 @@ export class ChatPage implements OnInit {
});
}
getDirectMessagesDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storageservice.get("rooms").then((rooms) =>{
this.userDirectMessages = rooms.sort((a, b) => {
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
console.log('DIRECTMESSAGE FROM DB', this.userDirectMessages);
console.log('ROOMS FROM DB', rooms)
})
this.storageservice.get('chatusers').then((users) => {
this.dmUsers = users.filter(data => data.username != this.loggedUserChat.me.username);
})
} else {
this.sqlservice.getAllChatRoom().then((rooms: any) => {
console.log('ROOMS FROM DB', rooms)
let roomsArray = [];
rooms.forEach(element => {
let roomListDB = {
_id: element.Id,
uids: JSON.parse(element.Uids),
usernames: JSON.parse(element.Usernames),
lastMessage: JSON.parse(element.LastMessage),
uids: this.isJson(element.Uids),
usernames: this.isJson(element.Usernames),
lastMessage: this.isJson(element.LastMessage),
_updatedAt: element.UpdatedAt
}
roomsArray.push(roomListDB)
if(element.customFields == "undefined") {
roomsArray.push(roomListDB)
}
});
this.userDirectMessages = roomsArray.sort((a, b) => {
@@ -456,6 +480,22 @@ export class ChatPage implements OnInit {
transformDataRoomList(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let roomsArray = [];
data.forEach(element => {
let roomList = {
_id: element._id,
uids: element.uids,
usernames: element.usernames,
lastMessage: element.lastMessage,
_updatedAt: element._updatedAt
}
console.log(' Web TRANSFORM ROOM LIST', roomList)
roomsArray.push(roomList)
});
this.storageservice.store('rooms', roomsArray);
} else {
data.forEach(element => {
let roomList = {
@@ -474,6 +514,18 @@ export class ChatPage implements OnInit {
transformDataUserList(users) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let usersArray = [];
users.forEach(element => {
console.log('TRANSFORM USER CHAT 1', element)
let chatusers = {
_id: element._id,
name: element.name,
username: element.username
}
console.log('TRANSFORM USER CHAT 2', chatusers)
usersArray.push(chatusers);
});
this.storageservice.store('chatusers',usersArray);
} else {
users.forEach(element => {
console.log('TRANSFORM USER CHAT 1', element)
@@ -496,13 +548,16 @@ export class ChatPage implements OnInit {
console.log('Chat list', res);
if (res != 200) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.userDirectMessages = res.ims.sort((a, b) => {
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
}
} */
//console.log(res.ims);
//console.log(this.userDirectMessages);
if (this.route.url != "/home/chat") {
//console.log("Timer message stop")
@@ -539,24 +594,136 @@ export class ChatPage implements OnInit {
this.chatService.getAllUsers().subscribe(res => {
console.log('chatusers', res);
this.transformDataUserList(res['users'])
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
console.log(this.dmUsers);
}
});
}
getGroupsDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storageservice.get("grouprooms").then((rooms) =>{
this.allGroups = rooms.sort((a, b) => {
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
console.log('GROUPS FROM DB', this.allGroups)
})
this.storageservice.get('chatusers').then((users) => {
this.dmUsers = users.filter(data => data.username != this.loggedUserChat.me.username);
})
} else {
this.sqlservice.getAllChatRoom().then((rooms: any) => {
let roomsArray = [];
rooms.forEach(element => {
let fddf = this.isJson(element.LastMessage);
let roomListDB = {
_id: element.Id,
customFields: this.isJson(element.customFields),
name: element.name,
lastMessage: this.isJson(element.LastMessage),
_updatedAt: element.UpdatedAt
}
if(element.customFields != "undefined") {
roomsArray.push(roomListDB)
}
});
this.allGroups = roomsArray.sort((a, b) => {
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
console.log('Group FROM DB', this.allGroups);
})
/* this.sqlservice.getAllChatUsers().then((userslist: any) => {
console.log('USERS FOM DB 1', userslist)
let chatusersArray = [];
userslist.forEach(element => {
console.log('USERS FOM DB 2', element)
let userListDB = {
_id: element.Id,
name: element.Name,
username: element.Username
}
chatusersArray.push(userListDB);
});
this.dmUsers = chatusersArray.filter(data => data.username != this.loggedUserChat.me.username);
}) */
}
}
transformGroups(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let groupsArray = [];
data.forEach(element => {
let roomList = {
_id: element._id,
uids: element.uids,
usernames: element.usernames,
name: element.name,
customFields: element.customFields,
lastMessage: element.lastMessage,
_updatedAt: element._updatedAt
}
console.log(' Web TRANSFORM ROOM LIST', roomList)
groupsArray.push(roomList)
});
this.storageservice.store('grouprooms', groupsArray);
} else {
data.forEach(element => {
let roomList = {
id: element._id,
uids: element.uids,
usernames: element.usernames,
customFields: element.customFields,
name: element.name,
lastMessage: element.lastMessage,
updatedat: element._updatedAt
}
console.log('TRANSFORM ROOM LIST', roomList)
this.sqlservice.addChatListRoom(roomList);
});
}
}
async getGroups(event?) {
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res: any) => {
//console.log(res);
this.showLoader = false;
if (res.groups != 200) {
this.transformGroups(res.groups);
this.getGroupsDB();
/* this.privateGroups = res.groups;
this.transformGroups(res.groups);
this.getGroupsDB();
this.privateGroups = res.groups;
this.allGroups = this.privateGroups.sort((a, b) => {
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
console.log('Chat list group' , res); */
//console.log(this.allGroups);
/* }); */
if (this.route.url != "/home/chat") {
console.log("Timer message stop")
}
@@ -574,6 +741,15 @@ export class ChatPage implements OnInit {
});
}
isJson(str) {
try {
JSON.parse(str);
} catch (e) {
return str;
}
return JSON.parse(str);
}
async selectContact() {
const modal = await this.modalController.create({
component: ContactsPage,
@@ -57,7 +57,7 @@
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'>
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.msg !=''" (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
@@ -119,6 +119,15 @@
</div>
{{last ? scrollToBottom() : ''}}
</div>
<div *ngIf="msg.file" class="info-meeting">
<div *ngIf="msg.file.type == 'application/meeting'">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
</div>
{{last ? scrollToBottom() : ''}}
</div>
</div>
</div>
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
@@ -235,6 +235,37 @@
}
}
.info-meeting{
/* width: 322px; */
width: em(422px);
background: var(--chat-alert-msg-color);
text-align: center;
font-size: 13px;
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rem;
/* margin: 15px 0px 15px 0px; */
border-radius: 8px;
.info-meeting-small{
font-size: 10px;
font-style: italic;
}
.info-meeting-medium{
font-size: 12px;
}
.info-meeting-normal{
color: #0782c9;
font-weight: 700;
text-decoration: underline;
}
.info-meeting-normal:hover{
text-decoration: underline;
color: #0782c9;
}
}
ion-footer{
padding-top: 7.5px;
padding-bottom: 7.5px;
@@ -281,7 +312,7 @@
.preview-slides {
margin-top: 20%;
background: #e6e6e6;
img {
padding-top: 20px;
padding-bottom: 20px;
@@ -299,15 +330,15 @@
.image-card {
overflow: visible;
}
.image-card {
z-index: 9;
}
.backdrop {
height: 200%;
width: 100%;
background: black;
position: absolute;
z-index: 10;
}
}
@@ -22,6 +22,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service'
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
@Component({
selector: 'app-group-messages',
@@ -166,6 +167,27 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.currentPosition = scroll;
}
async goToEvent(eventId: any) {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps: {
eventId: eventId,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
});
}
ngOnDestroy() {
window.removeEventListener('scroll', this.scrollChangeCallback, true);
}
+10 -1
View File
@@ -51,7 +51,7 @@
<div (click)="handleClick()" class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last"
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId" >
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)">
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
@@ -91,6 +91,15 @@
{{last ? scrollToBottom() : ''}}
</div>
</div>
<div *ngIf="msg.file" class="info-meeting">
<div *ngIf="msg.file.type == 'application/meeting'">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
</div>
{{last ? scrollToBottom() : ''}}
</div>
</div>
</div>
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
@@ -190,6 +190,37 @@
}
}
.info-meeting{
/* width: 322px; */
width: em(422px);
background: var(--chat-alert-msg-color);
text-align: center;
font-size: 13px;
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rem;
/* margin: 15px 0px 15px 0px; */
border-radius: 8px;
.info-meeting-small{
font-size: 10px;
font-style: italic;
}
.info-meeting-medium{
font-size: 12px;
}
.info-meeting-normal{
color: #0782c9;
font-weight: 700;
text-decoration: underline;
}
.info-meeting-normal:hover{
text-decoration: underline;
color: #0782c9;
}
}
ion-footer{
padding-top: 7.5px;
padding-bottom: 7.5px;
+192 -173
View File
@@ -1,5 +1,5 @@
import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'
import { ActivatedRoute, Router } from '@angular/router'
import { GestureController, Gesture, ModalController, NavParams, PopoverController, IonSlides, Platform } from '@ionic/angular';
import { map } from 'rxjs/operators';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@@ -27,6 +27,7 @@ import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.
import { SqliteService } from 'src/app/services/sqlite.service';
import { elementAt } from 'rxjs-compat/operator/elementAt';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
const IMAGE_DIR = 'stored-images';
@@ -39,20 +40,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
showLoader: boolean;
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
@ViewChild('rectangle') private rectangle: ElementRef;
canvas: any
ctx: any
loggedUser: any;
message = '';
messages:any;
userPresence='';
dmUsers:any;
roomId:string;
el:any;
members:any;
scrollingOnce:boolean = true;
messages: any;
userPresence = '';
dmUsers: any;
roomId: string;
el: any;
members: any;
scrollingOnce: boolean = true;
chatMessageStore = ChatMessageStore;
chatUserStorage = ChatUserStorage;
@@ -64,11 +65,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
attendees: EventPerson[] = [];
longPressActive = false;
showMessageOptions = false;
selectedMsgId:string;
selectedMsgId: string;
dicIndex = 0;
task: ExpedientTaskModalPageNavParamsTask;
LoadedDocument:any = null;
LoadedDocument: any = null;
recording = false;
storedFileNames = [];
@@ -100,7 +101,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
console.log('ROOM ID', this.roomId)
window.onresize = (event) => {
if( window.innerWidth > 701){
if (window.innerWidth > 701) {
this.modalController.dismiss();
}
};
@@ -133,7 +134,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.startRecording();
this.calculateDuration();
},
onEnd: ev =>{
onEnd: ev => {
Haptics.impact({ style: ImpactStyle.Light })
this.stopRecording();
}
@@ -141,51 +142,51 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
longpress.enable();
}
calculateDuration(){
if(!this.recording){
calculateDuration() {
if (!this.recording) {
this.duration = 0;
this.durationDisplay = '';
return;
}
this.duration += 1;
const minutes = Math.floor(this.duration / 60);
const seconds = (this.duration % 60).toString().padStart(2,'0');
const seconds = (this.duration % 60).toString().padStart(2, '0');
this.durationDisplay = `${minutes}:${seconds}`;
setTimeout(()=>{
setTimeout(() => {
this.calculateDuration();
}, 1000)
}
async loadFiles(){
async loadFiles() {
Filesystem.readdir({
path: '',
directory: Directory.Data
}).then(result =>{
}).then(result => {
console.log(result);
const temp:any[] = result.files.reverse();
const temp: any[] = result.files.reverse();
this.storedFileNames = temp[0];
console.log(this.storedFileNames);
})
}
startRecording(){
if(this.recording){
startRecording() {
if (this.recording) {
return;
}
this.recording = true;
VoiceRecorder.startRecording();
}
stopRecording(){
if(!this.recording){
stopRecording() {
if (!this.recording) {
return;
}
this.recording = false;
VoiceRecorder.stopRecording().then(async (result: RecordingData) =>{
VoiceRecorder.stopRecording().then(async (result: RecordingData) => {
this.recording = false;
if(result.value && result.value.recordDataBase64){
if (result.value && result.value.recordDataBase64) {
const recordData = result.value.recordDataBase64;
console.log(recordData);
this.myAudio = recordData;
@@ -200,7 +201,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async playFile(fileName?:any){
async playFile(fileName?: any) {
const audioFile = await Filesystem.readFile({
path: fileName,
directory: Directory.Data
@@ -214,33 +215,33 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
handlePress(id?:string){
handlePress(id?: string) {
this.selectedMsgId = id;
this.showMessageOptions = true;
}
handleClick(){
handleClick() {
this.showMessageOptions = false;
this.selectedMsgId = "";
}
deleteMessage(msgId:string){
deleteMessage(msgId: string) {
let body = {
"roomId": this.roomId,
"msgId": msgId,
"asUser": false,
}
if(msgId){
if (msgId) {
this.alertService.confirmDeleteMessage(body);
}
else{
else {
this.toastService.badRequest('Não foi possível apagar');
}
this.showMessageOptions = false;
this.selectedMsgId = "";
}
setStatus(status:string){
setStatus(status: string) {
let body = {
message: '',
status: status,
@@ -250,40 +251,58 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
notImplemented(){
notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
close(){
close() {
this.modalController.dismiss();
}
load(){
load() {
this.serverLongPull();
this.getChatMembers();
}
doRefresh(ev:any){
doRefresh(ev: any) {
this.load();
ev.target.complete();
}
scrollToBottom(): void {
try {
if(this.scrollingOnce){
if (this.scrollingOnce) {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
//this.scrollingOnce = false;
}
} catch(err) { }
} catch (err) { }
}
scrollToBottomClicked(): void {
try {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
} catch(err) { }
} catch (err) { }
}
async goToEvent(eventId: any) {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps: {
eventId: eventId,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
});
}
onContentScrolled(e) {
this.startPosition = e.srcElement.scrollTop;
@@ -297,10 +316,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//alert('UP');
this.scrollingOnce = false;
}
if((containerHeight - 100) > scroll){
if ((containerHeight - 100) > scroll) {
this.scrollToBottomBtn = true;
}
else{
else {
this.scrollToBottomBtn = false;
}
this.currentPosition = scroll;
@@ -320,7 +339,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"rid": this.roomId, "msg": this.message
}
}
this.chatService.sendMessage(body).subscribe(res=> {
this.chatService.sendMessage(body).subscribe(res => {
//this.loadMessages();
this.scrollingOnce = true;
});
@@ -340,23 +359,23 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
viewDocument(file:any, url?:string){
viewDocument(file: any, url?: string) {
console.log(file);
if(file.type == "application/webtrix") {
if (file.type == "application/webtrix") {
this.openViewDocumentModal(file);
}
else{
else {
let fullUrl = "https://www.tabularium.pt" + url;
this.fileService.viewDocumentByUrl(fullUrl);
}
}
docIndex(index: number){
docIndex(index: number) {
this.dicIndex = index
}
async openViewDocumentModal(file:any){
async openViewDocumentModal(file: any) {
let task = {
serialNumber: '',
@@ -373,17 +392,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
let doc = {
"Id": "",
"ParentId": "",
"Source": 1,
"ApplicationId": file.ApplicationId,
"CreateDate": "",
"Data": null,
"Description":"",
"Link": null,
"SourceId": file.DocId,
"SourceName": file.Assunto,
"Stakeholders": "",
"Id": "",
"ParentId": "",
"Source": 1,
"ApplicationId": file.ApplicationId,
"CreateDate": "",
"Data": null,
"Description": "",
"Link": null,
"SourceId": file.DocId,
"SourceName": file.Assunto,
"Stakeholders": "",
}
const modal = await this.modalController.create({
@@ -408,7 +427,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
getChatMembers() {
this.showLoader = true;
this.chatService.getMembers(this.roomId).subscribe(res=> {
this.chatService.getMembers(this.roomId).subscribe(res => {
this.members = res['members'];
this.dmUsers = res['members'].filter(data => data.username != this.loggedUser.me.username)
console.log(res);
@@ -417,32 +436,32 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
showDateDuration(start:any){
showDateDuration(start: any) {
let end;
end = new Date();
start = new Date(start);
let customizedDate;
const totalSeconds = Math.floor((end - (start))/1000);;
const totalMinutes = Math.floor(totalSeconds/60);
const totalHours = Math.floor(totalMinutes/60);
const totalDays = Math.floor(totalHours/24);
const totalSeconds = Math.floor((end - (start)) / 1000);;
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - ( totalDays * 24 );
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
const hours = totalHours - (totalDays * 24);
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
if(totalDays == 0){
if(start.getDate() == new Date().getDate()){
if (totalDays == 0) {
if (start.getDate() == new Date().getDate()) {
let time = start.getHours() + ":" + this.addZero(start.getUTCMinutes());
return time;
}
else{
else {
return 'Ontem';
}
}
else{
let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear();
else {
let date = start.getDate() + "/" + (start.getMonth() + 1) + "/" + start.getFullYear();
return date;
}
}
@@ -467,7 +486,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
return await popover.present();
}
async addContacts(){
async addContacts() {
const modal = await this.modalController.create({
component: ContactsPage,
componentProps: {},
@@ -481,19 +500,19 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async bookMeeting() {
this.attendees = this.members.map((val)=>{
this.attendees = this.members.map((val) => {
return {
Name: val.name,
EmailAddress: val.username+"@"+environment.domain,
EmailAddress: val.username + "@" + environment.domain,
IsRequired: "true",
}
});
console.log(this.attendees);
this.popoverController.dismiss();
if( window.innerWidth <= 1024){
if (window.innerWidth <= 1024) {
const modal = await this.modalController.create({
component: NewEventPage,
componentProps:{
componentProps: {
attendees: this.attendees,
},
cssClass: 'modal modal-desktop',
@@ -501,7 +520,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
await modal.present();
modal.onDidDismiss().then((data) => {
if(data){
if (data) {
}
});
@@ -524,24 +543,24 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
translucent: true
});
await popover.present();
popover.onDidDismiss().then((res)=>{
popover.onDidDismiss().then((res) => {
console.log(res['data']);
if(res['data'] == 'meeting'){
if (res['data'] == 'meeting') {
this.bookMeeting();
}
else if(res['data'] == 'take-picture'){
else if (res['data'] == 'take-picture') {
this.fileService.addCameraPictureToChat(roomId);
//this.loadPicture();
}
else if(res['data'] == 'add-picture'){
else if (res['data'] == 'add-picture') {
this.fileService.addPictureToChatMobile(roomId);
//this.loadPicture();
}
else if(res['data'] == 'add-document'){
else if (res['data'] == 'add-document') {
this.fileService.addDocumentToChat(this.roomId);
//this.loadDocument();
}
else if(res['data'] == 'documentoGestaoDocumental'){
else if (res['data'] == 'documentoGestaoDocumental') {
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
//this.addDocGestaoDocumental();
@@ -558,19 +577,19 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
let chatmsgArray = [];
let array = []
msg.forEach(element => {
console.log('CHANNEL ELEMENT',element.channels)
console.log('CHANNEL ELEMENT', element.channels)
let msgChat = {
_id: element.Id,
attachments: this.isJson(element.Attachments),
channels: this.isJson(element.Channels),
file: this.isJson(element.File),
mentions: this.isJson(element.Mentions),
msg: element.Msg,
rid: element.Rid,
ts: element.Ts,
u: this.isJson(element.U),
_updatedAt: element.UpdatedAt
_id: element.Id,
attachments: this.isJson(element.Attachments),
channels: this.isJson(element.Channels),
file: this.isJson(element.File),
mentions: this.isJson(element.Mentions),
msg: element.Msg,
rid: element.Rid,
ts: element.Ts,
u: this.isJson(element.U),
_updatedAt: element.UpdatedAt
}
chatmsgArray.push(msgChat)
@@ -584,12 +603,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
isJson(str) {
try {
JSON.parse(str);
JSON.parse(str);
} catch (e) {
return "";
return "";
}
return JSON.parse(str);
}
}
@@ -627,47 +646,47 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.chatService.getRoomMessages(roomId).subscribe(async res => {
console.log("Chat message",res)
console.log("Chat message", res)
this.transformDataMSG(res['messages'])
this.transformDataMSG(res['messages'])
this.getRoomMessageDB(this.roomId);
if (res == 502) {
// Connection timeout
// happens when the synchro was pending for too long
// let's reconnect
await this.serverLongPull();
}
else if (res != 200) {
// Show Error
//showMessage(response.statusText);
//this.loadMessages()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
if (res == 502) {
// Connection timeout
// happens when the synchro was pending for too long
// let's reconnect
await this.serverLongPull();
}
//console.log(this.messages);
// Reconnect in one second
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
} else {
//Check if modal is opened
if(document.querySelector('.isMessagesChatOpened')){
await new Promise(resolve => setTimeout(resolve, 5000));
await this.serverLongPull();
//console.log('Timer message running')
else if (res != 200) {
// Show Error
//showMessage(response.statusText);
//this.loadMessages()
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
}
}
} else {
// Got message
//let message = await response.text();
//this.loadMessages()
await this.serverLongPull();
}
//console.log(this.messages);
// Reconnect in one second
if (this.route.url != "/home/chat") {
console.log("Timer message stop")
} else {
//Check if modal is opened
if (document.querySelector('.isMessagesChatOpened')) {
await new Promise(resolve => setTimeout(resolve, 5000));
await this.serverLongPull();
//console.log('Timer message running')
}
}
} else {
// Got message
//let message = await response.text();
//this.loadMessages()
await this.serverLongPull();
}
});
}
@@ -679,45 +698,45 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
centeredSlides: true
};
zoomActive = false;
zoomScale = 1;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale/5;
this.changeDetectorRef.detectChanges();
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale / 5;
this.changeDetectorRef.detectChanges();
}
}
}
}
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
// Card back to normal
card.el.style['z-index'] = 9;
// Card back to normal
card.el.style['z-index'] = 9;
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
async openPreview(msg) {
const modal = await this.modalController.create({
component: ViewMediaPage,
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
@@ -729,22 +748,22 @@ touchStart(card) {
}
imageSize(img){
imageSize(img) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
canvas.width = 300
canvas.height = 234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
}
getPicture(img){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
getPicture(img) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width = 300
canvas.height = 234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
@@ -35,7 +35,7 @@
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
@@ -68,7 +68,7 @@
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
@@ -125,7 +125,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -166,7 +166,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -182,7 +182,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -251,4 +250,4 @@ ion-button{
background-color: #e0e0e0;
padding-left: 4px;
}
}
}
@@ -84,7 +84,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -125,7 +125,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -141,7 +141,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -210,4 +209,4 @@ ion-button{
background-color: #e0e0e0;
padding-left: 4px;
}
}
}
@@ -54,7 +54,7 @@ ion-content, .header-2, .main-content{
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
@@ -87,7 +87,7 @@ ion-content, .header-2, .main-content{
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
@@ -144,7 +144,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -185,7 +185,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -201,7 +201,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -36,7 +36,7 @@
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
@@ -69,7 +69,7 @@
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
@@ -126,7 +126,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -167,7 +167,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -183,7 +183,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -40,12 +40,12 @@ ion-menu{
float: left;
/* overflow: auto;
width: 100%; */
border-right: 1px solid #d8d8d8;
border-right: 1px solid #d8d8d8;
.upper-content{
margin-left: 40px;
font-size: 18px;
.content-location{
margin-top: 0px !important;
width: 100%;
@@ -87,10 +87,10 @@ ion-menu{
font-size: 16px;
}
}
.bottom-content{
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -132,13 +132,6 @@ ion-menu{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
/* .arrow-right-icon{
width: 37px;
float: right;
font-size: 35px;
overflow: hidden;
} */
}
.aside-buttons{
width: 100% !important;
@@ -149,7 +142,6 @@ ion-menu{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -261,6 +261,7 @@ export class BookMeetingModalPage implements OnInit {
}
if(this.task.FsId == '8') {
alert('Chegou')
const loader = this.toastService.loading()
try {
switch (this.loggeduser.Profile) {
@@ -307,11 +308,9 @@ export class BookMeetingModalPage implements OnInit {
} finally {
loader.remove()
}
}
if(true) {
//
else{
this.toastService._successMessage('Não é possível marcar a reunião de momento');
}
}
@@ -183,7 +183,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -37,7 +37,7 @@
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
@@ -70,7 +70,7 @@
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
@@ -124,7 +124,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -165,7 +165,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -181,7 +181,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -90,7 +90,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -131,7 +131,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -147,7 +147,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -164,6 +164,9 @@ export class PendentesPage implements OnInit {
if (WorkflowName == 'Despacho') {
this.router.navigate(['/home/gabinete-digital/despachos', SerialNumber, 'gabinete-digital']);
}
else if (WorkflowName == 'Despacho do Presidente da República') {
this.router.navigate(['/home/gabinete-digital/despachos', SerialNumber, 'gabinete-digital']);
}
else if (WorkflowName == 'Pedido de Parecer' || WorkflowName == 'Pedido de Deferimento' || WorkflowName == 'Pedido de Parecer do Presidente') {
this.router.navigate(['/home/gabinete-digital/pedidos', SerialNumber, 'gabinete-digital']);
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ChatMethodsService } from './chat-methods.service';
describe('ChatMethodsService', () => {
let service: ChatMethodsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChatMethodsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,31 @@
import { Injectable } from '@angular/core';
import { ChatService } from '../chat.service';
@Injectable({
providedIn: 'root'
})
export class ChatMethodsService {
constructor(private chatService: ChatService) {
}
sendMessage(roomId:string, data:any) {
let body = {
"message":
{
"rid": roomId,
"msg":"",
"file":{
"type": "application/meeting",
"subject": data.subject,
"start_date": data.start,
"end_date": data.end,
"venue": data.venue,
"id": data.id,
}
}
}
this.chatService.sendMessage(body).subscribe(res=> {});
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MethodsService } from './methods.service';
describe('MethodsService', () => {
let service: MethodsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MethodsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+11
View File
@@ -0,0 +1,11 @@
import { Injectable } from '@angular/core';
import { ChatService } from '../chat.service';
@Injectable({
providedIn: 'root'
})
export class MethodsService {
constructor(private chatService: ChatService) {
}
}
+5 -3
View File
@@ -140,7 +140,9 @@ export class SqliteService {
Uids Text,
Usernames Text,
LastMessage Text,
UpdatedAt varchar(255)
UpdatedAt varchar(255),
customFields Text,
name varchar(255)
)`, [])
.then((res) => {
console.log("Sucess chat list room Table created: ", res)
@@ -248,8 +250,8 @@ export class SqliteService {
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}')`, [])
INSERT OR REPLACE INTO ${this.chatlistroom} (Id,Uids,Usernames,LastMessage,UpdatedAt,customFields,name)
VALUES ('${data.id}','${JSON.stringify(data.uids)}','${JSON.stringify(data.usernames)}','${JSON.stringify(data.lastMessage)}','${data.updatedat}','${JSON.stringify(data.customFields)}','${data.name}')`, [])
.then(() => {
console.log("chat room add with Success");
@@ -145,7 +145,6 @@
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -25,6 +25,7 @@ import { ViewChild } from '@angular/core';
import { FormGroup, Validators } from '@angular/forms';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
const moment = _rollupMoment || _moment;
@@ -70,6 +71,7 @@ export class NewEventPage implements OnInit {
selectedRecurringType: any;
@Input() profile:string;
@Input() roomId:string;
@Input() selectedSegment: string;
@Input() selectedDate: Date;
@Input() taskParticipants: EventPerson[] = [];
@@ -120,7 +122,8 @@ export class NewEventPage implements OnInit {
private toastService: ToastService,
private userService: AuthService,
private dateAdapter: DateAdapter<any>,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private chatMethodService: ChatMethodsService,
// private translate: TranslateService
) {
this.dateAdapter.setLocale('pt');
@@ -341,7 +344,6 @@ export class NewEventPage implements OnInit {
return false
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
if(this.documents.length >= 0) {
@@ -353,27 +355,16 @@ export class NewEventPage implements OnInit {
}
if(this.loggeduser.Profile == 'MDGPR') {
// console.log('MD - Aqui');
// console.log(this.postEvent);
this.showLoader = true;
console.log(this.postEvent);
let loader = this.toastService.loading();
console.log(this.postEvent);
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
async (id) => {
loader.remove()
this.showLoader = false
const eventId: any = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
@@ -386,32 +377,30 @@ export class NewEventPage implements OnInit {
SerialNumber: ''
};
});
await DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.afterSave();
}
});
});
if(DocumentToSave.length == 0){
this.afterSave();
}
this.toastService._successMessage('Evento criado')
this.toastService._successMessage('Evento criado');
let data = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
"end": this.postEvent.EndDate,
"venue": this.postEvent.Location,
"id": id,
}
this.chatMethodService.sendMessage(this.roomId,data);
},
error => {
loader.remove()
this.showLoader = false
this.toastService._badRequest('Evento não criado')
});
}
@@ -439,19 +428,15 @@ export class NewEventPage implements OnInit {
DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.afterSave();
}
});
});
if(DocumentToSave.length == 0){
this.afterSave();
}
this.toastService.successMessage('Evento criado')
});
}
@@ -45,7 +45,7 @@
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last">
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" >
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.msg !=''" >
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before">
@@ -111,6 +111,15 @@
</div>
{{last ? scrollToBottom() : ''}}
</div>
<div *ngIf="msg.file" class="info-meeting">
<div *ngIf="msg.file.type == 'application/meeting'">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
</div>
{{last ? scrollToBottom() : ''}}
</div>
</div>
</div>
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
@@ -125,6 +125,35 @@
line-height: 1.2rem;
}
}
.info-meeting{
/* width: 322px; */
width: em(422px);
background: var(--chat-alert-msg-color);
text-align: center;
font-size: 13px;
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rem;
/* margin: 15px 0px 15px 0px; */
border-radius: 8px;
.info-meeting-small{
font-size: 10px;
font-style: italic;
}
.info-meeting-medium{
font-size: 12px;
}
.info-meeting-normal{
font-weight: 700;
}
.info-meeting-normal:hover{
text-decoration: underline;
color: #0782c9;
}
}
.messages{
font-size: 13px;
font-family: Roboto;
@@ -21,6 +21,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service'
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
/*
import * as pdfjsLib from 'pdfjs-dist';
@@ -143,6 +144,27 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} catch(err) { }
}
async goToEvent(eventId: any) {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps: {
eventId: eventId,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
});
}
ngAfterViewInit() {
this.scrollChangeCallback = () => this.onContentScrolled(event);
window.addEventListener('scroll', this.scrollChangeCallback, true);
@@ -38,7 +38,7 @@
</ion-refresher>
<div class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of chatMessageStore.message[roomId]; let last = last">
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45'>
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.msg !=''">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before">
@@ -57,15 +57,15 @@
<!-- <img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" (click)="imageSize(file.image_url)"> -->
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
</div>
<div>
<div class="file">
<!-- <canvas id="pdf_canvas"></canvas> -->
<!-- <div *ngIf="msg.file.type">
<div class="file">
<div (click)="viewDocument(msg, file.title_link)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" icon="file-word" class="excel-icon"></fa-icon>
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
<ion-icon *ngIf="msg.file.type == 'application/meeting'" src="assets/icon/webtrix.svg"></ion-icon>
</span>
<ion-label class="file-title">{{file.title}}</ion-label>
</div>
@@ -76,13 +76,22 @@
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span *ngIf="msg.file.type != 'application/webtrix'">{{msg.file.type.replace('application/','').toUpperCase()}}</span>
</ion-label>
</div>
</div>
</div> -->
</div>
</div>
{{last ? scrollToBottom() : ''}}
</div>
</div>
<div *ngIf="msg.file" class="info-meeting">
<div *ngIf="msg.file.type == 'application/meeting'">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
</div>
{{last ? scrollToBottom() : ''}}
</div>
</div>
</div>
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
@@ -100,6 +100,34 @@
border-radius: 8px;
border: 1px solid red;
}
.info-meeting{
/* width: 322px; */
width: em(422px);
background: var(--chat-alert-msg-color);
text-align: center;
font-size: 13px;
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rem;
/* margin: 15px 0px 15px 0px; */
border-radius: 8px;
.info-meeting-small{
font-size: 10px;
font-style: italic;
}
.info-meeting-medium{
font-size: 12px;
}
.info-meeting-normal{
font-weight: 700;
}
.info-meeting-normal:hover{
text-decoration: underline;
color: #0782c9;
}
}
.messages{
font-size: 13px;
+24 -6
View File
@@ -18,6 +18,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service'
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { ViewEventPage } from 'src/app/modals/view-event/view-event.page';
@Component({
selector: 'app-messages',
@@ -74,7 +75,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private gestureController: GestureController,
private http:HttpClient,
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef
private changeDetectorRef: ChangeDetectorRef,
private router: Router,
) {
this.loggedUser = authService.ValidatedUserChat['data'];
@@ -200,17 +202,33 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
return this.timeService.showDateDuration(start);
}
async goToEvent(eventId: any) {
let classs;
if (window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps: {
eventId: eventId,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then((res) => {
console.log(res);
});
}
sendMessage() {
//this.synchro.$send({})
let body = {
"message":
{
"rid": this.roomId, "msg": this.message
"rid": this.roomId, "msg": this.message,
}
}
this.chatService.sendMessage(body).subscribe(res=> {
this.scrollingOnce = true;
});
@@ -84,7 +84,7 @@ ion-button{
.bottom-content{
//width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
@@ -125,7 +125,7 @@ ion-button{
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
.arrow-right-icon{
width: 37px;
float: right;
@@ -141,7 +141,6 @@ ion-button{
.btn-ok, .btn-cancel, .btn-delete{
height: auto !important;
font-size: 16px !important;
font-weight: 600 !important;
width: 100% !important;
margin-bottom: 10px !important;
padding: 15px !important;
@@ -82,7 +82,7 @@
<div class="item width-100">
<div class="exp-top-detail">
<div class="subject">
<ion-label>{{ task.Folio }} {{ task.Status }}</ion-label>
<ion-label>{{ task.Folio }}</ion-label>
</div>
<div class="exp-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-attachment.svg"></ion-icon>
@@ -82,6 +82,9 @@ export class PendentesPage implements OnInit {
if(WorkflowName == 'Despacho') {
this.router.navigate(['/home/gabinete-digital/despachos',SerialNumber,'gabinete-digital']);
}
else if (WorkflowName == 'Despacho do Presidente da República') {
this.router.navigate(['/home/gabinete-digital/despachos', SerialNumber, 'gabinete-digital']);
}
else if(WorkflowName == 'Pedido de Parecer' || WorkflowName == 'Pedido de Deferimento' || WorkflowName == 'Pedido de Parecer do Presidente') {
this.router.navigate(['/home/gabinete-digital/pedidos',SerialNumber,'gabinete-digital']);
}
@@ -1,24 +1,28 @@
<!-- <ion-header class="ion-no-border">
</ion-header> -->
<ion-header class="ion-no-border">
<div *ngIf="publication.Title != ''" class="title-content d-flex pl-20 pt-25">
<div class="back-icon cursor-pointer" (click)="goBack()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</div>
<div class="div-title">
<ion-label class="title"> {{publication.Title}}</ion-label>
<p class="post-data">{{publication.DatePublication | date: 'dd-MM-yy | h:mm'}}</p>
</div>
</div>
<div *ngIf="publication.Title == ''" class="title-contentd-flex pl-20 pt-25">
<div class="back-icon cursor-pointer">
<ion-icon (click)="goBack()" slot="end" src='assets/images/assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</div>
<div class="div-title">
<ion-label class="title"><ion-skeleton-text animated style="width: 60%;"></ion-skeleton-text></ion-label>
<p class="post-data"><ion-skeleton-text animated style="width: 20%;"></ion-skeleton-text></p>
</div>
</div>
</ion-header>
<ion-content>
<div class="content-container">
<div *ngIf="publication.Title != ''">
<div class="title-content d-flex pl-20">
<div class="back-icon cursor-pointer" (click)="goBack()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</div>
<div class="div-title">
<ion-label class="title"> {{publication.Title}}</ion-label>
<p class="post-data">{{publication.DatePublication | date: 'dd-MM-yy | h:mm'}}</p>
</div>
</div>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
@@ -37,17 +41,7 @@
</div>
</div>
<div *ngIf="publication.Title == ''">
<div class="title-content">
<div class="back-icon cursor-pointer">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " (click)="close()" slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " (click)="close()" slot="end" src='assets/images/assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</div>
<div class="div-title">
<ion-label class="title"><ion-skeleton-text animated style="width: 60%;"></ion-skeleton-text></ion-label>
<p class="post-data"><ion-skeleton-text animated style="width: 20%;"></ion-skeleton-text></p>
</div>
</div>
<div class="post-item">
<div class="post-item px-20">
<div class="post-img">
<img src="/assets/icon/icon-no-image.svg" alt="image">
</div>
@@ -9,14 +9,15 @@
ion-toolbar{
border-width: 0 !important;
}
.div-top-header{
/* .div-top-header{
width: 400px;
margin: 0 auto;
background-color: #0782c9;
overflow: auto;
padding-top: 15px;
border: 0!important;
}
border: 1px solid blue;
} */
.div-search{
font-size: 45px;
float: left;
@@ -47,13 +48,18 @@
.content-container{
width: 100%;
margin:0 auto;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background: #ffffff;
height: 100%;
padding: 25px 0px 0 0px;
padding: 0 !important;
overflow: auto;
}
.post-item{
//Do something
}
.title-content{
overflow: auto;
}
@@ -86,4 +92,4 @@
.post-description{
margin: 0 auto;
margin-bottom: 35px;
}
}