add history in chat to record meeting created!

This commit is contained in:
tiago.kayaya
2021-12-22 10:31:10 +01:00
parent 16294f93c3
commit fa5f67453e
28 changed files with 1268 additions and 53 deletions
@@ -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()
}
}