diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
index db164ad97..51d0dabe7 100644
--- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts
+++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
@@ -25,39 +25,43 @@ import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { PermissionService } from 'src/app/services/worker/permission.service';
+import { SqliteService } from '../../services/sqlite.service';
+import { synchro } from '../../services/socket/synchro.service';
+import { Platform } from '@ionic/angular';
+
@Component({
selector: 'app-gabinete-digital',
templateUrl: './gabinete-digital.page.html',
styleUrls: ['./gabinete-digital.page.scss'],
})
-export class GabineteDigitalPage implements OnInit, DoCheck {
+export class GabineteDigitalPage implements OnInit, DoCheck {
- segment:string;
- segmentVista:string;
+ segment: string;
+ segmentVista: string;
showLoader: boolean;
- public profile:string;
+ public profile: string;
allProcessesList: any = new Array();
skeletonLoader: boolean;
- count_exp_dailywork=0;
- count_exp_pr =0
- count_desp_dailywork=0;
- count_desp_pending=0;
- count_par_dailywork=0;
- count_par_pending=0;
- count_def_dailywork=0;
- count_def_pending=0;
- count_exp_pp : string;
- count_exp_pd : string;
- count_dip_apr : string;
- count_dip_as_pr =0
- count_dip_pv=0;
+ count_exp_dailywork = 0;
+ count_exp_pr = 0
+ count_desp_dailywork = 0;
+ count_desp_pending = 0;
+ count_par_dailywork = 0;
+ count_par_pending = 0;
+ count_def_dailywork = 0;
+ count_def_pending = 0;
+ count_exp_pp: string;
+ count_exp_pd: string;
+ count_dip_apr: string;
+ count_dip_as_pr = 0
+ count_dip_pv = 0;
count_dip_as = 0;
count_de_pr = 0;
- count_ev_apr=0;
- count_ev_md=0;
+ count_ev_apr = 0;
+ count_ev_md = 0;
count_total_pending = 0;
count_desp_pr_active = 0;
count_all_processes = 0;
@@ -66,7 +70,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
desktopComponent: any = {
showEventList: false,
- showExpediente : false,
+ showExpediente: false,
}
showAllProcesses = false;
@@ -84,7 +88,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
showSignedDiploma = false;
emptyTextDescription = 'Sem opção selecionada';
- serialNumber:string;
+ serialNumber: string;
loggeduser: LoginUserRespose;
mdgpr = "MDGPR";
@@ -105,6 +109,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
//
// pipe
+ synch = synchro;
+
customTaskPipe = new CustomTaskPipe()
@@ -113,7 +119,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
@ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage;
constructor(
- private processesbackend:ProcessesService,
+ private processesbackend: ProcessesService,
private modalController: ModalController,
private activatedRoute: ActivatedRoute,
private router: Router,
@@ -122,27 +128,27 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
public waitForDomService: WaitForDomService,
private notificationsService: NotificationsService,
private despachoRule: DespachoService,
+ private sqliteservice: SqliteService,
+ private platform: Platform,
private changeProfileService: ChangeProfileService
- ) {
+ ) {
- this.loggeduser = authService.ValidatedUser;
+ this.loggeduser = authService.ValidatedUser;
+ window.onresize = (event) => {
+ // if not mobile remove all component
+ if (window.innerWidth < 701) {
+ this.modalController.dismiss();
+ this.segmentVista = "listview";
+ }
+ else {
+ this.segmentVista = "boxview";
+ }
+ };
+ this.checkRoutes();
- window.onresize = (event) => {
- // if not mobile remove all component
- if( window.innerWidth < 701){
- this.modalController.dismiss();
- this.segmentVista = "listview";
- }
- else{
- this.segmentVista = "boxview";
- }
- };
- this.checkRoutes();
-
-
- // this.eventoaprovacaostore.resetmd([])
- // this.eventoaprovacaostore.resetpr([])
+ // this.eventoaprovacaostore.resetmd([])
+ // this.eventoaprovacaostore.resetpr([])
}
@@ -165,52 +171,30 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
ngOnInit() {
- if( window.innerWidth < 701) {
+ if (window.innerWidth < 701) {
this.segmentVista = "listview";
}
- else{
+ else {
this.segmentVista = "boxview"
}
- const pathname = window.location.pathname
+ this.getAllProcessFromDB()
- this.router.events.forEach((event) => {
- if(event instanceof NavigationEnd && event.url == pathname) {
-
- this.waitForDomService.selector({
- selector: 'app-gabinete-digital ion-content .aside-wrapper',
- callback: ()=> {
- this.checkRoutes();
- this.LoadCounts();
- this.loadAllProcesses();
- }
- })
- }
- });
-
- this.hideRefreshButton();
-
- this.waitForDomService.selector({
- selector: 'app-gabinete-digital ion-content .aside-wrapper',
- callback: ()=> {
- this.loadAllProcesses();
- }
- })
-
}
async loadAllProcesses() {
- let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
+ let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
- if(!this.p.userRole(['PR'])) {
- allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Assinar Diplomas')
+ if (!this.p.userRole(['PR'])) {
+ allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
} else if (this.p.userRole(['PR'])) {
- allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Diploma Assinado')
+ allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
}
console.log('allProcessesList', allProcessesList);
+ this.addProcessToDB(allProcessesList)
this.skeletonLoader = true;
this.allProcessesList = [];
@@ -218,7 +202,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
- let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
@@ -238,69 +222,158 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
- this.allProcessesList.push(task);
- this.allProcessesList = removeDuplicate( this.allProcessesList)
- this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
+ this.allProcessesList.push(task);
+ this.allProcessesList = removeDuplicate(this.allProcessesList)
+ this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
+
+
- this.totalDocumentStore.resetCount( this.allProcessesList.length)
});
this.skeletonLoader = false;
}
- sortArrayISODate(myArray: any){
- return myArray.sort(function(a, b) {
+ addProcessToDB(data) {
+ this.platform.ready().then(() => {
+ data.forEach(element => {
+
+ let process = {
+ "serialNumber": element.serialNumber,
+ "workflowInstanceFolio": element.workflowInstanceFolio,
+ "Documents": element.Documents,
+ "actions": element.actions,
+ "activityInstanceName": element.activityInstanceName,
+ "formURL": element.formURL,
+ "originator": element.originator,
+ "taskStartDate": element.taskStartDate,
+ "totalDocuments": element.totalDocuments,
+ "workflowDisplayName": element.workflowDisplayName,
+ "workflowID": element.workflowID,
+ "workflowInstanceDataFields": element.workflowInstanceDataFields,
+ "workflowInstanceID": element.workflowInstanceID,
+ "workflowName": element.workflowName
+ }
+
+ this.sqliteservice.addProcess(process);
+ });
+ });
+ }
+
+ getAllProcessFromDB() {
+
+ if (synchro.connected === true ) {
+ const pathname = window.location.pathname
+ this.router.events.forEach((event) => {
+ if (event instanceof NavigationEnd && event.url == pathname) {
+
+ this.waitForDomService.selector({
+ selector: 'app-gabinete-digital ion-content .aside-wrapper',
+ callback: () => {
+ this.checkRoutes();
+ this.LoadCounts();
+ }
+ })
+ }
+ });
+
+ this.hideRefreshButton();
+
+ this.waitForDomService.selector({
+ selector: 'app-gabinete-digital ion-content .aside-wrapper',
+ callback: () => {
+ this.loadAllProcesses();
+ }
+ })
+ } else {
+ this.hideRefreshButton();
+
+ this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
+ allprocess.forEach(element => {
+ let date = new Date(element.taskStartDate);
+ date.setMonth(date.getMonth() + 1);
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
+
+ var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
+
+ let task = {
+ "SerialNumber": element.serialNumber,
+ "Folio": workflowInstanceDataFields.Subject,
+ "Senders": workflowInstanceDataFields.Sender,
+ "CreateDate": taskDate,
+ "DocumentURL": workflowInstanceDataFields.ViewerRequest,
+ "Remetente": workflowInstanceDataFields.Remetente,
+ "DocumentsQty": element.totalDocuments,
+ "DocId": workflowInstanceDataFields.DispatchDocId,
+ "FolderID": workflowInstanceDataFields.FolderID,
+ "WorkflowName": element.workflowDisplayName,
+ "activityInstanceName": element.activityInstanceName,
+ "Status": workflowInstanceDataFields.Status,
+ "Agenda": workflowInstanceDataFields.Agenda,
+ "customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
+ }
+
+ this.allProcessesList.push(task);
+ this.allProcessesList = removeDuplicate(this.allProcessesList)
+ this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
+
+ });
+ console.log("All process from db ", allprocess)
+ })
+ }
+ }
+
+ sortArrayISODate(myArray: any) {
+ return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
});
}
- setFormatDate(start:any, end:any, allday:boolean){
+ setFormatDate(start: any, end: any, allday: boolean) {
let customDate;
/* start = new Date();
end= new Date("2021-08-04T18:01:04.753Z"); */
//end = new Date("2021-09-04T18:01:04.753Z");
- 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);
let diffDays = totalDays;
let diffMinutes = minutes;
- if(totalDays == 0){
- if(allday){
- customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" (todo dia)";
+ if (totalDays == 0) {
+ if (allday) {
+ customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
console.log(customDate);
return customDate;
}
- else
- {
+ else {
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
- customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" | "+this.getCustomHours(end);
+ customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
return customDate;
}
}
- else{
- customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+
- " (termina:"+ this.getCustomDate(end)+","+this.getCustomHours(end)+")";
+ else {
+ customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
+ " (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
return customDate;
}
}
- getCustomDate(thedate: Date){
+ getCustomDate(thedate: Date) {
return thedate.getDate() + "/" +
- (thedate.getMonth()+1) + "/" +
- thedate.getFullYear();
+ (thedate.getMonth() + 1) + "/" +
+ thedate.getFullYear();
}
- getCustomHours(thedate: Date){
+ getCustomHours(thedate: Date) {
return thedate.getHours() + ":" +
- thedate.getMinutes();
+ thedate.getMinutes();
}
goToProcess(serialNumber:string, workflowName:string, activityName:string){
@@ -313,42 +386,42 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
if(activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho'){
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
}
- else if(activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma'){
- this.router.navigate(['/home/gabinete-digital/diplomas',serialNumber,'gabinete-digital']);
+ else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
+ this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
}
- else if(activityName == 'Diploma Assinado'){
- this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']);
+ else if (activityName == 'Diploma Assinado') {
+ this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
}
}
- else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
- this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
+ this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
}
- else if(workflowName == 'Expediente') {
- this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Expediente') {
+ this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
}
- else if(workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
- this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
+ this.router.navigate(['/home/gabinete-digital/expedientes-pr', serialNumber, 'gabinete-digital']);
}
else if (workflowName == "Pedido de Parecer do Presidente") {
- this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
+ this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
}
/* else if (workflowName == "Expediente") {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
} */
- else if(workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
- this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital']);
+ else if (workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
+ this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
}
- else {
+ else {
console.log('cant find page for this task')
}
}
- onSegmentVistaChange(){
+ onSegmentVistaChange() {
}
- checkUser(){
- this.selectedElement='allProcessesTag';
+ checkUser() {
+ this.selectedElement = 'allProcessesTag';
this.showAllProcesses = true;
/* switch(this.loggeduser.Profile){
case 'MDGPR':
@@ -360,77 +433,77 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
} */
}
- hideRefreshButton(){
+ hideRefreshButton() {
window.onresize = (event) => {
- if( window.innerWidth < 701) {
+ if (window.innerWidth < 701) {
this.hideRefreshBtn = false;
this.hideInMobile = false;
this.segmentVista = "listview";
}
- else{
+ else {
this.hideRefreshBtn = true;
this.hideInMobile = true;
this.segmentVista = "boxview";
}
}
- if(window.innerWidth < 701){
+ if (window.innerWidth < 701) {
this.hideRefreshBtn = false;
this.hideInMobile = false;
this.segmentVista = "listview";
}
- else{
+ else {
this.hideRefreshBtn = true;
this.hideInMobile = true;
this.segmentVista = "boxview";
}
}
- checkRoutes(){
+ checkRoutes() {
this.closeAllDesktopComponents();
- if(this.router.url == '/home/gabinete-digital?processes=true'){
+ if (this.router.url == '/home/gabinete-digital?processes=true') {
this.openAllProcessesPage();
- this.selectedElement='allProcessesTag';
+ this.selectedElement = 'allProcessesTag';
}
- if(this.router.url == '/home/gabinete-digital?eventos=true'){
+ if (this.router.url == '/home/gabinete-digital?eventos=true') {
this.openEventsToApprovePage();
- this.selectedElement='approval';
+ this.selectedElement = 'approval';
}
- else if(this.router.url == '/home/gabinete-digital?expedientes=true'){
+ else if (this.router.url == '/home/gabinete-digital?expedientes=true') {
this.openExpedientListPage();
- if(this.loggeduser.Profile == 'MDGPR'){
- this.selectedElement='Correspondence';
+ if (this.loggeduser.Profile == 'MDGPR') {
+ this.selectedElement = 'Correspondence';
}
- else{
- this.selectedElement='Expediente Presidente'
+ else {
+ this.selectedElement = 'Expediente Presidente'
}
}
- else if(this.router.url == '/home/gabinete-digital?pendentes=true'){
+ else if (this.router.url == '/home/gabinete-digital?pendentes=true') {
this.openPendentesPage('');
- this.selectedElement='Pending';
+ this.selectedElement = 'Pending';
}
- else if(this.router.url == '/home/gabinete-digital?despachos=true'){
+ else if (this.router.url == '/home/gabinete-digital?despachos=true') {
this.openDespachosPage('');
- this.selectedElement='Dispatches';
+ this.selectedElement = 'Dispatches';
}
- else if(this.router.url == '/home/gabinete-digital?pedidos=true'){
+ else if (this.router.url == '/home/gabinete-digital?pedidos=true') {
this.openPedidosPage('parecer');
- this.selectedElement='RequestsForOpinion';
+ this.selectedElement = 'RequestsForOpinion';
}
- else if(this.router.url == '/home/gabinete-digital?expedientespr=true'){
+ else if (this.router.url == '/home/gabinete-digital?expedientespr=true') {
this.openExpedientesPrPage();
- this.selectedElement='Expediente Presidente'
+ this.selectedElement = 'Expediente Presidente'
}
- else if(this.router.url == '/home/gabinete-digital?despachospr=true'){
+ else if (this.router.url == '/home/gabinete-digital?despachospr=true') {
this.openDespachosPrPage('');
- this.selectedElement='DispatchesPr'
+ this.selectedElement = 'DispatchesPr'
}
- else if(this.router.url == '/home/gabinete-digital?diplomas=true'){
+ else if (this.router.url == '/home/gabinete-digital?diplomas=true') {
this.openDiplomasPage('validar');
- this.selectedElement='DiplomasPorValidar';
+ this.selectedElement = 'DiplomasPorValidar';
}
- else if(this.router.url == '/home/gabinete-digital?diplomasassinar=true'){
- this. openDiplomasAssinarPage();
- this.selectedElement='DiplomasAssinar';
+ else if (this.router.url == '/home/gabinete-digital?diplomasassinar=true') {
+ this.openDiplomasAssinarPage();
+ this.selectedElement = 'DiplomasAssinar';
}
else if (this.router.url == '/home/gabinete-digital?parecer=true') {
this.openPedidosPage('parecer')
@@ -438,7 +511,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
else if (this.router.url == '/home/gabinete-digital?deferimento=true') {
this.openPedidosPage('deferimento')
}
- else{
+ else {
this.checkUser();
}
}
@@ -465,15 +538,15 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
let count_all_processes = Object.keys(allPreocesses_).length;
- this.totalDocumentStore.resetCount(count_all_processes)
+
let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise();
expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")
this.expedientegbstore.count = expedientes.length
- let despachos = await this.despachoRule.getList({updateStore: true})
- if(despachos) {
+ let despachos = await this.despachoRule.getList({ updateStore: true })
+ if (despachos) {
this.despachoStore.reset(despachos)
}
@@ -489,7 +562,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.count_def_dailywork = Object.keys(deferimentos.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
this.pedidosstore.countdeferimento = this.count_def_dailywork;
- let pendentes =await this.processesbackend.GetPendingTasks(false).toPromise();
+ let pendentes = await this.processesbackend.GetPendingTasks(false).toPromise();
this.count_total_pending = Object.keys(pendentes).length;
this.pendentesstore.count = this.count_total_pending;
@@ -539,7 +612,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.count_dip_as_pr = Object.keys(diplomasAssinados).length;
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
- this.processesbackend.GetToApprovedEvents('Agenda','true').subscribe(res=>{
+ this.processesbackend.GetToApprovedEvents('Agenda', 'true').subscribe(res => {
this.count_ev_apr = res;
});
@@ -555,56 +628,56 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
console.log(event);
// this.closeAllDesktopComponents();
- /* switch(this.loggeduser.Profile){
- case 'MDGPR':
- this.selectedElement='Correspondence';
- this.showExpedients = true;
- this.expedientesPage.doRefresh();
- break;
- case 'PR':
- this.selectedElement='ExpedientesPr';
- this.showExpedientesPr = true;
- break;
- } */
+ /* switch(this.loggeduser.Profile){
+ case 'MDGPR':
+ this.selectedElement='Correspondence';
+ this.showExpedients = true;
+ this.expedientesPage.doRefresh();
+ break;
+ case 'PR':
+ this.selectedElement='ExpedientesPr';
+ this.showExpedientesPr = true;
+ break;
+ } */
this.LoadCounts();
this.loadAllProcesses();
//this.refreshExpedientes();
- if(event){
+ if (event) {
setTimeout(() => {
event.target.complete();
}, 2000);
}
- else{
+ else {
console.log('null');
}
}
- selectedElementF(element:string) {
+ selectedElementF(element: string) {
if (window.innerWidth > 701) {
- return element == this.selectedElement
+ return element == this.selectedElement
}
return false;
}
openAllProcessesPage() {
this.closeAllDesktopComponents();
- let navigationExtras: NavigationExtras = { queryParams: {"processes": true,}};
- if( window.innerWidth < 701) {
+ let navigationExtras: NavigationExtras = { queryParams: { "processes": true, } };
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital']);
}
else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showAllProcesses = true;
- this.selectedElement="allProcessesTag";
+ this.selectedElement = "allProcessesTag";
}
}
openEventsToApprovePage() {
this.closeAllDesktopComponents();
- let navigationExtras: NavigationExtras = { queryParams: {"eventos": true,}};
- if( window.innerWidth < 701) {
+ let navigationExtras: NavigationExtras = { queryParams: { "eventos": true, } };
+ if (window.innerWidth < 701) {
//this.openEventsToApproveList(profile);
this.router.navigate(['/home/gabinete-digital/event-list']);
}
@@ -617,26 +690,26 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
openExpedientListPage() {
this.closeAllDesktopComponents();
- switch(this.loggeduser.Profile){
+ switch (this.loggeduser.Profile) {
case 'MDGPR':
- if( window.innerWidth < 701) {
+ if (window.innerWidth < 701) {
//this.openExpedientList();
this.router.navigate(['/home/gabinete-digital/expediente']);
}
else {
- this.selectedElement='Correspondence'
- let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,}};
+ this.selectedElement = 'Correspondence'
+ let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showExpedients = true;
}
break;
case 'PR':
- if( window.innerWidth < 701) {
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
}
else {
- this.selectedElement='ExpedientesPr'
- let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,}};
+ this.selectedElement = 'ExpedientesPr'
+ let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showExpedientesPr = true;
}
@@ -645,20 +718,20 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
}
- openPedidosPage(segment:string) {
+ openPedidosPage(segment: string) {
this.closeAllDesktopComponents();
let navigationExtras: NavigationExtras;
if (segment == 'deferimento') {
- navigationExtras= { queryParams: {"deferimento": true,}};
+ navigationExtras = { queryParams: { "deferimento": true, } };
this.segment = 'deferimento'
} else if (segment == 'parecer') {
- navigationExtras = { queryParams: {"parecer": true,}};
+ navigationExtras = { queryParams: { "parecer": true, } };
this.segment = 'parecer'
}
- if( window.innerWidth < 701) {
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras);
}
else {
@@ -668,78 +741,78 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
if (segment == 'deferimento') {
this.selectedElement = 'RequestForApproval'
} else if (segment == 'parecer') {
- this.selectedElement='RequestsForOpinion'
+ this.selectedElement = 'RequestsForOpinion'
}
}
}
- openDespachosPage(segment?:string) {
+ openDespachosPage(segment?: string) {
this.closeAllDesktopComponents();
- if( window.innerWidth < 701){
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/despachos']);
}
- else{
- let navigationExtras: NavigationExtras = {queryParams: {"despachos": true,}};
+ else {
+ let navigationExtras: NavigationExtras = { queryParams: { "despachos": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDespachos = true;
}
}
- openDespachosPrPage(segment?:string) {
+ openDespachosPrPage(segment?: string) {
this.closeAllDesktopComponents();
- if( window.innerWidth < 701){
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/despachos-pr']);
}
- else{
- let navigationExtras: NavigationExtras = {queryParams: {"despachospr": true,}};
+ else {
+ let navigationExtras: NavigationExtras = { queryParams: { "despachospr": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDespachosPr = true;
}
}
- openPendentesPage(segment?:string){
+ openPendentesPage(segment?: string) {
this.closeAllDesktopComponents();
- if( window.innerWidth < 701){
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/pendentes']);
}
- else{
- let navigationExtras: NavigationExtras = { queryParams: {"pendentes": true,}};
+ else {
+ let navigationExtras: NavigationExtras = { queryParams: { "pendentes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showPendentes = true;
}
}
- openExpedientesPrPage(segment?:string){
+ openExpedientesPrPage(segment?: string) {
this.closeAllDesktopComponents();
- if( window.innerWidth < 701) {
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
}
else {
- this.selectedElement='ExpedientesPr'
- let navigationExtras: NavigationExtras = { queryParams: {"expedientespr": true,}};
+ this.selectedElement = 'ExpedientesPr'
+ let navigationExtras: NavigationExtras = { queryParams: { "expedientespr": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showExpedientesPr = true;
}
}
- openDiplomasPage(segment:string) {
+ openDiplomasPage(segment: string) {
let navigationExtras: NavigationExtras;
if (segment == 'validar') {
- navigationExtras= { queryParams: {"validar": true,}};
+ navigationExtras = { queryParams: { "validar": true, } };
} else if (segment == 'assinados') {
- navigationExtras = { queryParams: {"assinados": true,}};
+ navigationExtras = { queryParams: { "assinados": true, } };
}
this.segment = segment;
- if( window.innerWidth < 701){
+ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/diplomas'], navigationExtras);
}
- else{
+ else {
this.closeAllDesktopComponents();
this.segment = segment;
- let navigationExtras: NavigationExtras = { queryParams: {"diplomas": true,}};
+ let navigationExtras: NavigationExtras = { queryParams: { "diplomas": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDiplomas = true;
}
@@ -747,14 +820,14 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
openDiplomasAssinarPage() {
this.closeAllDesktopComponents();
- if( window.innerWidth < 701){
- this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
- }
- else{
- let navigationExtras: NavigationExtras = { queryParams: {"diplomasassinar": true,}};
- this.router.navigate(['/home/gabinete-digital'], navigationExtras);
- this.showDiplomasAssinar = true;
- }
+ if (window.innerWidth < 701) {
+ this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
}
+ else {
+ let navigationExtras: NavigationExtras = { queryParams: { "diplomasassinar": true, } };
+ this.router.navigate(['/home/gabinete-digital'], navigationExtras);
+ this.showDiplomasAssinar = true;
+ }
+ }
}
diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts
index b1d06e7f4..f68414f54 100644
--- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts
+++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts
@@ -19,6 +19,10 @@ import { ForwardPage } from 'src/app/modals/forward/forward.page';
import { Location } from '@angular/common';
import { PedidoService } from 'src/app/Rules/pedido.service';
+
+import { SqliteService } from 'src/app/services/sqlite.service';
+import { synchro } from 'src/app/services/socket/synchro.service';
+
import { PermissionService } from 'src/app/services/worker/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@@ -31,10 +35,10 @@ export class PedidoPage implements OnInit {
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"];
- customDate:any;
+ customDate: any;
task: any;
- attachments:any;
+ attachments: any;
fulltask: any;
eventsList: Event[];
serialnumber: string;
@@ -56,31 +60,32 @@ export class PedidoPage implements OnInit {
private toastService: ToastService,
public p: PermissionService,
private location: Location,
- private pedidoService: PedidoService
- ) {
- this.loggeduser = authService.ValidatedUser;
+ private pedidoService: PedidoService,
+ private sqliteservice: SqliteService,
+ ) {
+ this.loggeduser = authService.ValidatedUser;
- this.activatedRoute.paramMap.subscribe(params => {
- // console.log(params["params"]);
+ this.activatedRoute.paramMap.subscribe(params => {
+ // console.log(params["params"]);
- if(params["params"].SerialNumber) {
- this.serialnumber = params["params"].SerialNumber;
- }
- if(params["params"].caller) {
- this.caller = params["params"].caller;
- }
+ if (params["params"].SerialNumber) {
+ this.serialnumber = params["params"].SerialNumber;
+ }
+ if (params["params"].caller) {
+ this.caller = params["params"].caller;
+ }
- });
- }
+ });
+ }
ngOnInit() {
- this.LoadTaskDetail(this.serialnumber);
+ this.getfromDb()
}
close() {
this.modalController.dismiss();
}
- notImplemented(){
+ notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
@@ -92,12 +97,13 @@ export class PedidoPage implements OnInit {
this.processes.GetTask(this.serialnumber).subscribe(res => {
this.fulltask = res
+ console.log('FULLTAK ONLINe', this.fulltask);
- if(res.workflowDisplayName == 'Pedido de Parecer' || res.workflowDisplayName == 'Pedido de Parecer do Presidente'){
+ if (res.workflowDisplayName == 'Pedido de Parecer' || res.workflowDisplayName == 'Pedido de Parecer do Presidente') {
let date = new Date(res.taskStartDate);
date.setMonth(date.getMonth() + 1);
- let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = {
"SerialNumber": res.serialNumber,
@@ -117,12 +123,13 @@ export class PedidoPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status,
}
console.log(this.task);
+ this.sqliteservice.updateProcess(res);
}
- else if(res.workflowDisplayName == 'Pedido de Deferimento'){
+ else if (res.workflowDisplayName == 'Pedido de Deferimento') {
let date = new Date(res.taskStartDate);
date.setMonth(date.getMonth() + 1);
- let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = {
"SerialNumber": res.serialNumber,
@@ -141,28 +148,32 @@ export class PedidoPage implements OnInit {
"activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status,
}
+ this.sqliteservice.updateProcess(res);
}
let thedate = new Date(res.taskStartDate);
- this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
+ this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
- this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users=>{
- this.intervenientes = users.filter(user=>{
+ this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => {
+ this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() =>{
+ console.log('Pedido ')
+ })
+ this.intervenientes = users.filter(user => {
return user.Type == 'I';
});
- this.cc = users.filter(user=>{
+ this.cc = users.filter(user => {
return user.Type == 'CC';
});
});
this.getDocumentDetails(res.workflowInstanceDataFields.FolderID, '361');
- }, (error)=>{
+ }, (error) => {
try {
this.goBack()
this.close()
} catch (e) {
window.history.back();
- } finally {
- if(error.status == 0) {
+ } finally {
+ if (error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService.badRequest('Processo não encontrado')
@@ -172,8 +183,102 @@ export class PedidoPage implements OnInit {
});
}
- getDocumentDetails(forlderId:string, applicationId:string){
- this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{
+ getfromDb() {
+ if (synchro.connected === true) {
+ this.LoadTaskDetail(this.serialnumber);
+ }
+
+ if (synchro.connected === false) {
+ this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
+
+ console.log('PROCESS BY ID', process,this.serialnumber )
+
+ let fulltak = {
+ Documents: JSON.parse(process[0].Documents),
+ actions: JSON.parse(process[0].actions),
+ activityInstanceName: process[0].activityInstanceName,
+ formURL: process[0].formURL,
+ originator: JSON.parse(process[0].originator),
+ serialNumber: process[0].serialNumber,
+ taskStartDate: process[0].taskStartDate,
+ totalDocuments: process[0].totalDocuments,
+ workflowDisplayName: process[0].workflowDisplayName,
+ workflowID: process[0].workflowID,
+ workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
+ workflowInstanceFolio: process[0].workflowInstanceFolio,
+ workflowInstanceID: process[0].workflowInstanceID,
+ workflowName: process[0].workflowName
+ }
+
+ this.fulltask = fulltak;
+ console.log('FULLTAK OFFLINE', this.fulltask);
+
+ if (process[0].workflowDisplayName == 'Pedido de Parecer' || process[0].workflowDisplayName == 'Pedido de Parecer do Presidente') {
+ let date = new Date(process[0].taskStartDate);
+ date.setMonth(date.getMonth() + 1);
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
+
+ this.task = {
+ "SerialNumber": process[0].serialNumber,
+ "Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
+ "Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
+ "CreateDate": taskDate,
+ "DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
+ "Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
+ "Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
+ "FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
+ "FsId": '361',
+ "DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
+ "WorkflowName": process[0].workflowDisplayName,
+ "DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
+ "ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
+ "activityInstanceName": process[0].activityInstanceName,
+ "Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
+ }
+
+ this.attachments = JSON.parse(process[0].Documents);
+ } else if (process[0].workflowDisplayName == 'Pedido de Deferimento') {
+
+ let date = new Date(process[0].taskStartDate);
+ date.setMonth(date.getMonth() + 1);
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
+ this.task = {
+ "SerialNumber": process[0].serialNumber,
+ "Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
+ "Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
+ "CreateDate": taskDate,
+ "DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
+ "Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
+ "Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
+ "FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
+ "FsId": '361',
+ "DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
+ "WorkflowName": process[0].workflowDisplayName,
+ "DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
+ "ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
+ "activityInstanceName": process[0].activityInstanceName,
+ "Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
+ }
+ this.attachments = JSON.parse(process[0].Documents);
+ }
+
+ let thedate = new Date(process[0].taskStartDate);
+ this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
+
+ this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
+ return user.Type == 'I';
+ });
+ this.cc = JSON.parse(process[0].interveners).filter(user => {
+ return user.Type == 'CC';
+ });
+ this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361');
+
+ })
+ }
+ }
+
+ getDocumentDetails(forlderId: string, applicationId: string) {
+ this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
this.attachments = res.Documents;
console.log(res['Documents']);
})
@@ -215,14 +320,14 @@ export class PedidoPage implements OnInit {
task: this.task,
serialNumber: this.task.SerialNumber,
fulltask: this.fulltask,
- taskAction:taskAction,
+ taskAction: taskAction,
showEnviarPendentes: false
},
translucent: true
});
await popover.present();
- popover.onDidDismiss().then(( res =>{
+ popover.onDidDismiss().then((res => {
if( res['data'] == 'close') {
this.goBack()
@@ -233,7 +338,7 @@ export class PedidoPage implements OnInit {
}))
}
- async repreciar(note:string, documents:any) {
+ async repreciar(note: string, documents: any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Reapreciação",
@@ -241,7 +346,7 @@ export class PedidoPage implements OnInit {
"dataFields": {
"ReviewUserComment": note,
},
- "AttachmentList" :documents,
+ "AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -253,17 +358,18 @@ export class PedidoPage implements OnInit {
this.close();
} catch (error) {
this.toastService.badRequest()
- } finally {
+ } finally {
loader.remove()
}
}
- async arquivar(note:string, documents:any) {
+ async arquivar(note: string, documents: any) {
const loader = this.toastService.loading()
try {
- await this.pedidoService.arquivar({serialNumber: this.serialnumber,
+ await this.pedidoService.arquivar({
+ serialNumber: this.serialnumber,
documents,
note
}).toPromise()
@@ -278,7 +384,7 @@ export class PedidoPage implements OnInit {
}
- async assignar(note:string, documents:any) {
+ async assignar(note: string, documents: any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Reencaminhar",
@@ -286,7 +392,7 @@ export class PedidoPage implements OnInit {
"dataFields": {
"ReviewUserComment": note,
},
- "AttachmentList" :documents,
+ "AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -297,16 +403,16 @@ export class PedidoPage implements OnInit {
this.close();
} catch (error) {
this.toastService.badRequest()
- } finally {
+ } finally {
loader.remove()
}
}
sendExpedienteToPending() {
- this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
+ this.processes.SetTaskToPending(this.serialnumber).subscribe(res => {
this.goBack();
- },()=>{
+ }, () => {
this.toastService.badRequest('Processo não encontrado')
});
@@ -315,9 +421,9 @@ export class PedidoPage implements OnInit {
async openExpedientActionsModal(taskAction: any, task: any) {
let classs;
- if( window.innerWidth <= 800) {
+ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
- } else {
+ } else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
@@ -330,7 +436,7 @@ export class PedidoPage implements OnInit {
cssClass: classs,
});
await modal.present();
- modal.onDidDismiss().then(res=>{
+ modal.onDidDismiss().then(res => {
console.log('Modal closed');
this.goBack();
});
@@ -338,9 +444,9 @@ export class PedidoPage implements OnInit {
async openBookMeetingModal(task: any) {
let classs;
- if( window.innerWidth <= 800){
+ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop'
- } else {
+ } else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
@@ -376,7 +482,7 @@ export class PedidoPage implements OnInit {
console.log(this.fulltask);
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
- componentProps: {
+ componentProps: {
serialNumber: this.fulltask.SerialNumber,
folderId: this.fulltask.workflowInstanceDataFields.FolderID,
action: 'complete',
@@ -386,8 +492,8 @@ export class PedidoPage implements OnInit {
});
await modal.present();
- modal.onDidDismiss().then(res=>{
- if(res['data']=='close'){
+ modal.onDidDismiss().then(res => {
+ if (res['data'] == 'close') {
this.close();
/* console.log('2Expedient Discard closed2');
this.close();
@@ -401,9 +507,9 @@ export class PedidoPage implements OnInit {
console.log(task);
let classs;
- if( window.innerWidth <= 800){
+ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop'
- } else {
+ } else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
@@ -421,9 +527,9 @@ export class PedidoPage implements OnInit {
async openForwardModal(task: any) {
let classs;
- if( window.innerWidth <= 800) {
+ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop'
- } else {
+ } else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
@@ -442,9 +548,9 @@ export class PedidoPage implements OnInit {
console.log(task);
let classs;
- if( window.innerWidth <= 800){
+ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop'
- } else {
+ } else {
classs = 'add-note-modal-no-height showAsideOptions'
}
const modal = await this.modalController.create({
@@ -457,21 +563,21 @@ export class PedidoPage implements OnInit {
backdropDismiss: false
});
await modal.present();
- modal.onDidDismiss().then(res=>{
+ modal.onDidDismiss().then(res => {
this.goBack();
});
}
- async openAddNoteModal(actionName:string) {
+ async openAddNoteModal(actionName: string) {
let classs;
- if( window.innerWidth <= 800){
+ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
- } else {
+ } else {
classs = 'add-note-modal-no-height'
}
const modal = await this.modalController.create({
component: AddNotePage,
- componentProps:{
+ componentProps: {
showAttachmentBtn: true,
},
cssClass: classs,
@@ -481,8 +587,8 @@ export class PedidoPage implements OnInit {
await modal.present();
- modal.onDidDismiss().then( async (res) => {
- const DocumentToSave = await res.data.documents.map( async (e) => {
+ modal.onDidDismiss().then(async (res) => {
+ const DocumentToSave = await res.data.documents.map(async (e) => {
return {
ApplicationId: e.ApplicationType,
SourceId: e.Id,
@@ -493,16 +599,16 @@ export class PedidoPage implements OnInit {
Attachments: DocumentToSave,
}
- if(res.data){
- if(actionName == 'Solicitar Reapreciação') {
+ if (res.data) {
+ if (actionName == 'Solicitar Reapreciação') {
await this.repreciar(res.data.note, docs);
this.goBack();
}
- else if(actionName == 'Arquivar') {
+ else if (actionName == 'Arquivar') {
await this.arquivar(res.data.note, docs);
this.goBack();
}
- else if(actionName == 'Assignar') {
+ else if (actionName == 'Assignar') {
await this.assignar(res.data.note, docs);
}
}
diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.html b/src/app/pages/gabinete-digital/pedidos/pedidos.page.html
index 29943d512..0b6ff7050 100644
--- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.html
+++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.html
@@ -38,13 +38,13 @@
-
+
@@ -77,11 +77,11 @@
-
+
diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts
index ccc747f4a..94e381f86 100644
--- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts
+++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.ts
@@ -7,6 +7,10 @@ import { ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { ModalService } from 'src/app/services/modal.service';
+
+import { SqliteService } from 'src/app/services/sqlite.service';
+import { synchro } from 'src/app/services/socket/synchro.service';
+
@Component({
selector: 'app-pedidos',
templateUrl: './pedidos.page.html',
@@ -18,6 +22,8 @@ export class PedidosPage implements OnInit {
taskslist:DailyWorkTask[] = [];
parecerList:any[] = [];
+ listToPresentparecerList: any[] = [];
+ listToPresentdeferimentoList: any[] = [];
fulltask:any;
parecerListResult:customTask[] = [];
@@ -38,7 +44,8 @@ export class PedidosPage implements OnInit {
private modalController: ModalController,
private alertService: AlertService,
private activatedRoute: ActivatedRoute,
- private modalService: ModalService
+ private modalService: ModalService,
+ private sqliteservice: SqliteService
) {
//Inicializar segment
this.segment = 'parecer';
@@ -57,21 +64,7 @@ export class PedidosPage implements OnInit {
}
ngOnInit() {
-
- this.LoadList()
-
- this.router.events.forEach((event) => {
- if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
- event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
- ) {
-
- if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
- this.refreshing()
- } else {
- this.LoadList()
- }
- }
- });
+ this.getFromDb();
}
goBack() {
@@ -141,7 +134,8 @@ export class PedidosPage implements OnInit {
}
this.parecerList.push(task);
});
- this.pedidosstorage.resetparecer(this.parecerList);
+ this.sqliteservice.addProcess(this.parecerList);
+ this.listToPresentparecerList = this.parecerList
}
else if(this.segment == 'deferimento') {
@@ -181,7 +175,8 @@ export class PedidosPage implements OnInit {
});
- this.pedidosstorage.resetdeferimento(this.deferimentoList);
+ this.sqliteservice.addProcess(this.deferimentoList);
+ this.listToPresentdeferimentoList = this.deferimentoList
});
@@ -189,6 +184,83 @@ export class PedidosPage implements OnInit {
}
+ getFromDb() {
+ if(synchro.connected === true) {
+ this.LoadList()
+
+ this.router.events.forEach((event) => {
+ if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
+ event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
+ ) {
+
+ if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
+ this.refreshing()
+ } else {
+ this.LoadList()
+ }
+ }
+ });
+ }
+
+ if(synchro.connected === false) {
+ let parecerlist = [];
+ let deferimentolist = []
+ this.sqliteservice.getprocessByworkflowpedido("Pedido de Parecer", "Pedido de Parecer do Presidente").then((process: any[]) => {
+
+ process.forEach((element) => {
+ if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
+ let date = new Date(element.taskStartDate);
+ date.setMonth(date.getMonth() + 1);
+ let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+
+ let task = {
+ "SerialNumber": element.serialNumber,
+ "Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
+ "Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
+ "CreateDate": taskDate,
+ "DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
+ "Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
+ "DocumentsQty": element.totalDocuments,
+ "DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
+ "WorkflowName": element.workflowDisplayName,
+ "activityInstanceName": element.activityInstanceName,
+ }
+ parecerlist.push(task)
+ }
+ })
+ this.listToPresentparecerList = parecerlist;
+ console.log('parecer',process)
+ })
+
+ this.sqliteservice.getprocessByworkflow("Pedido de Deferimento").then((process: any[]) => {
+ process.forEach((element) => {
+ if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
+ let date = new Date(element.taskStartDate);
+ date.setMonth(date.getMonth() + 1);
+ let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+
+ let task = {
+ "SerialNumber": element.serialNumber,
+ "Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
+ "Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
+ "CreateDate": taskDate,
+ "DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
+ "Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
+ "DocumentsQty": element.totalDocuments,
+ "DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
+ "WorkflowName": element.workflowDisplayName,
+ "activityInstanceName": element.activityInstanceName,
+ }
+ deferimentolist.push(task)
+ }
+ })
+ this.listToPresentdeferimentoList = deferimentolist;
+ console.log('deferimento',process)
+ })
+
+ }
+ }
+
segmentChanged(ev: any) {
this.LoadList();
}
diff --git a/src/app/pages/gabinete-digital/pendentes/pendentes.page.html b/src/app/pages/gabinete-digital/pendentes/pendentes.page.html
index dc2d3daa4..43af02c1b 100644
--- a/src/app/pages/gabinete-digital/pendentes/pendentes.page.html
+++ b/src/app/pages/gabinete-digital/pendentes/pendentes.page.html
@@ -27,7 +27,7 @@
diff --git a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts
index fc629d6c9..fcd1f61df 100644
--- a/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts
+++ b/src/app/pages/gabinete-digital/pendentes/pendentes.page.ts
@@ -10,6 +10,10 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
+import { SqliteService } from 'src/app/services/sqlite.service';
+import { synchro } from 'src/app/services/socket/synchro.service';
+import { Platform } from '@ionic/angular';
+
@Component({
selector: 'app-pendentes',
@@ -20,46 +24,37 @@ export class PendentesPage implements OnInit {
@ViewChild(CalendarComponent) myCal: CalendarComponent;
taskType: string;
- serialNumber:string;
- totalDocs:any;
+ serialNumber: string;
+ totalDocs: any;
showLoader: boolean;
loggeduser: LoginUserRespose;
- @Input() profile:string;
- segment:string;
+ @Input() profile: string;
+ segment: string;
skeletonLoader = true
pendentesstore = PendentesStore;
customTaskPipe = new CustomTaskPipe()
+ listToPresent = [];
+
+ synch = synchro
constructor(
- private processes:ProcessesService,
+ private processes: ProcessesService,
private alertService: AlertService,
private router: Router,
private authService: AuthService,
private activatedRoute: ActivatedRoute,
- ) {
- this.loggeduser = authService.ValidatedUser;
- this.profile = 'mdgpr';
- }
+ private sqliteservice: SqliteService,
+ private platform: Platform
+ ) {
+ this.loggeduser = authService.ValidatedUser;
+ this.profile = 'mdgpr';
+ }
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
-
- const location = window.location
- const pathname = location.pathname + location.search
-
- this.LoadList()
-
- this.router.events.forEach((event) => {
- if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
- if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
- this.refreshing()
- } else {
- this.LoadList()
- }
- }
- });
+ this.getFromDb();
}
@@ -87,20 +82,69 @@ export class PendentesPage implements OnInit {
pendentesList.push(task);
});
- pendentesList = removeDuplicate( pendentesList)
+ pendentesList = removeDuplicate(pendentesList)
pendentesList = this.sortArrayISODate(pendentesList);
-
- this.pendentesstore.reset(pendentesList);
+ this.listToPresent = pendentesList;
this.skeletonLoader = false;
}
sortArrayISODate(myArray: any) {
- return myArray.sort(function(a, b) {
+ return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
});
}
+ getFromDb() {
+
+ if (synchro.connected === true) {
+ const location = window.location
+ const pathname = location.pathname + location.search
+
+ this.LoadList()
+
+ this.router.events.forEach((event) => {
+ if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
+ if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
+ this.refreshing()
+ } else {
+ this.LoadList()
+ }
+ }
+ });
+ }
+
+ synchro.registerCallback('Offline', () => {
+ this.platform.ready().then(() => {
+ this.sqliteservice.getAllProcess().then((process: any[]) => {
+ var pendingList = []
+ process.forEach(element => {
+ var workflow = JSON.parse(element.workflowInstanceDataFields);
+ if (workflow.Status === "Pending") {
+ let task = {
+ "CreateDate": element.taskStartDate,
+ "DocumentsQty": element.totalDocuments,
+ "FolderID": workflow.FolderID,
+ "Folio": workflow.Subject,
+ "Senders": workflow.Sender,
+ "SerialNumber": element.serialNumber,
+ "Status": workflow.Status,
+ "WorkflowName": element.workflowDisplayName
+
+ }
+ pendingList.push(task)
+ }
+ });
+
+ pendingList = this.sortArrayISODate(pendingList);
+ this.listToPresent = pendingList;
+ console.log('pendentes', pendingList)
+
+ })
+ })
+ })
+ }
+
async refreshing() {
setTimeout(() => {
this.LoadList();
@@ -115,24 +159,24 @@ export class PendentesPage implements OnInit {
}, 2000);
}
- async viewTaskDetails({ SerialNumber, WorkflowName, activityInstanceName }:customTask) {
- if(WorkflowName == 'Despacho') {
- this.router.navigate(['/home/gabinete-digital/despachos',SerialNumber,'gabinete-digital']);
+ async viewTaskDetails({ SerialNumber, WorkflowName, activityInstanceName }: customTask) {
+ if (WorkflowName == 'Despacho') {
+ 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']);
+ 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']);
}
- else if(WorkflowName == 'Expediente') {
- this.router.navigate(['/home/gabinete-digital/expediente',SerialNumber,'gabinete-digital']);
+ else if (WorkflowName == 'Expediente') {
+ this.router.navigate(['/home/gabinete-digital/expediente', SerialNumber, 'gabinete-digital']);
}
- else if(WorkflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
- this.router.navigate(['/home/gabinete-digital/expedientes-pr',SerialNumber,'gabinete-digital']);
+ else if (WorkflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
+ this.router.navigate(['/home/gabinete-digital/expedientes-pr', SerialNumber, 'gabinete-digital']);
}
else if (activityInstanceName == "Tarefa de Parecer") {
- this.router.navigate(['/home/gabinete-digital/pedidos',SerialNumber,'gabinete-digital']);
+ this.router.navigate(['/home/gabinete-digital/pedidos', SerialNumber, 'gabinete-digital']);
}
- else if(activityInstanceName == "Tarefa de Despacho") {
- this.router.navigate(['/home/gabinete-digital/despachos',SerialNumber,'gabinete-digital']);
+ else if (activityInstanceName == "Tarefa de Despacho") {
+ this.router.navigate(['/home/gabinete-digital/despachos', SerialNumber, 'gabinete-digital']);
}
else {
console.log('cant find page for this task', WorkflowName, activityInstanceName)
@@ -144,4 +188,4 @@ export class PendentesPage implements OnInit {
return new Date(e).toDateString()
}
- }
+}
diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts
index 6d0b76d7a..3ff16263e 100644
--- a/src/app/pages/login/login.page.ts
+++ b/src/app/pages/login/login.page.ts
@@ -39,7 +39,9 @@ export class LoginPage implements OnInit {
) {
}
- ngOnInit() {}
+ ngOnInit() {
+
+ }
//Function to validade the login inputs
validateUsername() {
@@ -93,7 +95,7 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat(this.userattempt);
this.getToken();
- SessionStore.setInativity(true)
+ SessionStore.setInativity(true);
this.goback()
} else {
diff --git a/src/app/pages/publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/publication-detail/publication-detail.page.ts
index 4661354f9..90d2efc93 100644
--- a/src/app/pages/publications/publication-detail/publication-detail.page.ts
+++ b/src/app/pages/publications/publication-detail/publication-detail.page.ts
@@ -6,6 +6,8 @@ import { ToastService } from 'src/app/services/toast.service';
import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
import { NewPublicationPage } from '../new-publication/new-publication.page';
import { Location } from '@angular/common';
+import { SqliteService } from 'src/app/services/sqlite.service';
+import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
@@ -25,7 +27,8 @@ export class PublicationDetailPage implements OnInit {
private publications:PublicationsService,
private animationController: AnimationController,
private toastService: ToastService,
- private location: Location ) {
+ private location: Location,
+ private sqliteservice: SqliteService ) {
this.publicationId = this.navParams.get('publicationId');
/* this.folderId = this.navParams.get('folderIdId'); */
@@ -77,6 +80,14 @@ export class PublicationDetailPage implements OnInit {
});
}
+ getFromDB() {
+ if(synchro.connected === true) {
+
+ } else {
+
+ }
+ }
+
close() {
this.location.back()
diff --git a/src/app/pages/publications/publications.page.html b/src/app/pages/publications/publications.page.html
index 2d76756ae..d1ae5d28b 100644
--- a/src/app/pages/publications/publications.page.html
+++ b/src/app/pages/publications/publications.page.html
@@ -40,7 +40,7 @@
+ *ngFor="let viagem of publicationsTravelFolderList">
+ *ngFor="let evento of publicationsEventFolderList">
{
- if(event instanceof NavigationEnd && event.url == pathname) {
- this.getActions();
- }
- });
-
- this.hideRefreshButton();
+ private toastService: ToastService,
+ private sqliteservice: SqliteService
+ ) {
+ this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
+ this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
}
- hideRefreshButton(){
+ ngOnInit() {
+ this.getFromDB();
+ }
+
+ hideRefreshButton() {
window.onresize = (event) => {
- if( window.innerWidth < 801) {
+ if (window.innerWidth < 801) {
this.hideRefreshBtn = false;
this.showSlidingOptions = false;
}
- else{
+ else {
this.hideRefreshBtn = true;
this.showSlidingOptions = true;
}
}
- if(window.innerWidth < 801){
+ if (window.innerWidth < 801) {
this.hideRefreshBtn = false;
this.showSlidingOptions = false;
}
- else{
+ else {
this.hideRefreshBtn = true;
this.showSlidingOptions = true;
}
@@ -120,12 +114,14 @@ export class PublicationsPage implements OnInit {
getDate(date) {
this.theDate = new Date(date);
- return this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear()
+ return this.theDate.getDate() + " de " + (this.months[this.theDate.getMonth()]) + " de " + this.theDate.getFullYear()
}
getActions() {
this.showLoader = true;
- this.publications.GetPublicationFolderList().subscribe(res=>{
+ this.publications.GetPublicationFolderList().subscribe(res => {
+
+ console.log('accoes', res)
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
@@ -140,46 +136,93 @@ export class PublicationsPage implements OnInit {
ActionType: data.ActionType,
}
- if(data.ActionType == "Evento") {
+ this.sqliteservice.addactions(folder);
+
+ if (data.ActionType == "Evento") {
+ console.log('Evento', folder)
this.publicationsEventFolderList.push(folder);
}
- else{
+ else {
+ console.log('Viagem', folder)
this.publicationsTravelFolderList.push(folder);
}
this.showLoader = false;
- this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
- this.publicationTravelFolderService.reset(this.publicationsTravelFolderList)
+ /* this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
+ this.publicationTravelFolderService.reset(this.publicationsTravelFolderList) */
});
});
}
- async editAction(folderId?: string){
+ getFromDB() {
+
+ if (synchro.connected === true) {
+ const pathname = window.location.pathname
+
+ this.router.events.forEach((event) => {
+ if (event instanceof NavigationEnd && event.url == pathname) {
+ this.getActions();
+ }
+ });
+
+ this.hideRefreshButton();
+ } else {
+ this.sqliteservice.getAllActions().then((actions: any[]) => {
+
+ console.log('offline publi', actions)
+
+ this.publicationsEventFolderList = new Array();
+ this.publicationsTravelFolderList = new Array();
+
+ actions.forEach(data => {
+ let folder: PublicationFolder = {
+ ProcessId: data.ProcessId,
+ Description: data.Description,
+ Detail: data.Detail,
+ DateBegin: data.DateBegin,
+ DateEnd: data.DateEnd,
+ ActionType: data.ActionType,
+ }
+
+ if (data.ActionType == "Evento") {
+ this.publicationsEventFolderList.push(folder);
+ }
+ else {
+ this.publicationsTravelFolderList.push(folder);
+ }
+ this.showLoader = false;
+ });
+
+ })
+ }
+ }
+
+ async editAction(folderId?: string) {
const modal = await this.modalController.create({
component: EditActionPage,
- componentProps:{
+ componentProps: {
folderId: folderId,
},
cssClass: 'new-action modal modal-desktop',
backdropDismiss: true
});
await modal.present();
- modal.onDidDismiss().then(()=>{
+ modal.onDidDismiss().then(() => {
this.getActions();
});
//this.refreshing()
}
- async deleteAction(id?: string){
+ async deleteAction(id?: string) {
const loader = this.toastService.loading();
try {
await this.publications.DeletePresidentialAction(id).toPromise();
this.toastService.successMessage()
- } catch(e) {
+ } catch (e) {
this.toastService.badRequest()
}
finally {
@@ -189,21 +232,21 @@ export class PublicationsPage implements OnInit {
this.refreshing()
}
- async AddPublicationFolder(item?:any) {
+ async AddPublicationFolder(item?: any) {
this.closeDesktopComponent();
- if(window.innerWidth <= 1024) {
+ if (window.innerWidth <= 1024) {
const modal = await this.modalController.create({
component: NewActionPage,
- componentProps:{
+ componentProps: {
item: item,
},
cssClass: 'new-action modal modal-desktop',
backdropDismiss: false
});
await modal.present();
- modal.onDidDismiss().then(()=>{
+ modal.onDidDismiss().then(() => {
this.getActions();
});
} else {
@@ -212,12 +255,12 @@ export class PublicationsPage implements OnInit {
}
- goToPublicationsList(folderId: string){
+ goToPublicationsList(folderId: string) {
this.folderId = folderId
this.idSelected = folderId;
- if( window.innerWidth <= 800){
- this.router.navigate(['/home/publications',folderId]);
+ if (window.innerWidth <= 800) {
+ this.router.navigate(['/home/publications', folderId]);
} else {
this.closeDesktopComponent();
this.folderId = folderId
@@ -256,14 +299,14 @@ export class PublicationsPage implements OnInit {
this.closeDesktopComponent();
// OpenModal
- if( window.innerWidth <= 800){
+ if (window.innerWidth <= 800) {
/* let item = this.publicationFolderList; */
const modal = await this.modalController.create({
component: ViewPublicationsPage,
//enterAnimation,
//leaveAnimation,
- componentProps:{
- folderId:folderId,
+ componentProps: {
+ folderId: folderId,
},
cssClass: 'new-action modal modal-desktop',
backdropDismiss: false
@@ -281,7 +324,7 @@ export class PublicationsPage implements OnInit {
// called from publications details
// Emittter
- goBackToViewPublications(){
+ goBackToViewPublications() {
this.closeDesktopComponent();
this.desktopComponent.showViewPublication = true;
@@ -289,21 +332,21 @@ export class PublicationsPage implements OnInit {
// called from publications details
// Emitters
- goBackToPubications(){
+ goBackToPubications() {
this.closeDesktopComponent();
this.desktopComponent.showViewPublication = true;
}
// called from edit publication (Emitters only)
// Emitters
- async goBacktoPublicationDetails(){
+ async goBacktoPublicationDetails() {
this.closeDesktopComponent();
this.desktopComponent.showPublicationDetail = true;
}
// add new publication or edit publicaton
- async addNewPublication({publicationType, folderId, publication}){
+ async addNewPublication({ publicationType, folderId, publication }) {
this.closeDesktopComponent();
@@ -319,7 +362,7 @@ export class PublicationsPage implements OnInit {
this.desktopComponent.showAddNewPublication = true;
}
- async openPublicationDetails(publicationId: string){
+ async openPublicationDetails(publicationId: string) {
this.publicationId = publicationId;
@@ -328,11 +371,11 @@ export class PublicationsPage implements OnInit {
}
- async updateDesktopComponent(e?:any){
+ async updateDesktopComponent(e?: any) {
this.getActions();
}
- async closeDesktopComponent (xx?: any){
+ async closeDesktopComponent(xx?: any) {
this.desktopComponent = {
showViewPublication: false,
@@ -380,10 +423,10 @@ export class PublicationsPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(res => {
- if(res['data']=='edit') {
+ if (res['data'] == 'edit') {
this.closeDesktopComponent();
this.desktopComponent.showEditActions = true;
- } else if (res['data']=='delete') {
+ } else if (res['data'] == 'delete') {
setTimeout(() => {
this.getActions();
}, 1000)
diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html
index 1c55832b5..508f6e140 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.html
+++ b/src/app/pages/publications/view-publications/view-publications.page.html
@@ -33,7 +33,7 @@
30" class="post-img">
diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts
index 776316e26..3fb9a9676 100644
--- a/src/app/pages/publications/view-publications/view-publications.page.ts
+++ b/src/app/pages/publications/view-publications/view-publications.page.ts
@@ -10,6 +10,8 @@ import { PublicationListStorage } from 'src/app/store/publication-list.service';
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
import { NewPublicationPage } from '../new-publication/new-publication.page';
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
+import { SqliteService } from 'src/app/services/sqlite.service';
+import { synchro } from 'src/app/services/socket/synchro.service';
@Component({
selector: 'app-view-publications',
@@ -22,7 +24,7 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[] = new Array();
item: PublicationFolder;
- folderId:string;
+ folderId: string;
error: any;
publicationListStorage = PublicationListStorage
@@ -31,18 +33,22 @@ export class ViewPublicationsPage implements OnInit {
publicationTravelFolderService = PublicationTravelFolderStore
publicationPipe = new PublicationPipe()
+ publicationDitails: any;
+ getpublication = [];
+
constructor(
private modalController: ModalController,
private publications: PublicationsService,
private activatedRoute: ActivatedRoute,
- private router: Router) {
+ private router: Router,
+ private sqliteservice: SqliteService) {
this.item = new PublicationFolder();
this.activatedRoute.paramMap.subscribe(params => {
console.log(params);
- if(params["params"]) {
+ if (params["params"]) {
this.folderId = params["params"].folderId;
// console.log(params["params"]);
}
@@ -53,20 +59,17 @@ export class ViewPublicationsPage implements OnInit {
ngOnInit() {
- if(typeof(this.folderId) == 'object') {
+ if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId']
}
- this.getPublicationDetail();
- setTimeout(() => {
- this.getPublications();
- }, 5000);
+ this.getFromDB();
}
ngOnChanges() {
- if(typeof(this.folderId) == 'object') {
+ if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId']
}
@@ -74,7 +77,7 @@ export class ViewPublicationsPage implements OnInit {
this.getPublications();
}
- doRefresh =(event) => {
+ doRefresh = (event) => {
setTimeout(() => {
this.getPublicationDetail();
this.getPublications();
@@ -96,7 +99,9 @@ export class ViewPublicationsPage implements OnInit {
setTimeout(() => {
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
- this.item = allActions.find((e)=> e.ProcessId == this.folderId);
+ this.item = allActions.find((e) => e.ProcessId == this.folderId);
+ this.publicationDitails = this.item
+ console.log('item', this.item)
}, 100);
}
@@ -104,37 +109,86 @@ export class ViewPublicationsPage implements OnInit {
getPublications() {
this.showLoader = true;
const folderId = this.folderId
- this.publications.GetPublications(this.folderId).subscribe(res=>{
-
+ this.publications.GetPublications(this.folderId).subscribe(res => {
+ console.log(this.folderId)
this.publicationList = new Array();
+
res.forEach(element => {
+ console.log('getPublications', element)
let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item);
});
+ this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
+
this.publicationListStorage.add(folderId, this.publicationList)
+ this.getpublication = this.publicationList;
this.showLoader = false;
},
- (error)=>{
- if(error.status == '404'){
- this.error = 'Sem publicações disponíveis!';
- this.publicationList= [];
- this.publicationListStorage.add(folderId, this.publicationList)
- }
+ (error) => {
+ if (error.status == '404') {
+ this.error = 'Sem publicações disponíveis!';
+ this.publicationList = [];
+ this.publicationListStorage.add(folderId, this.publicationList)
+ }
- this.showLoader = false;
+ this.showLoader = false;
- });
+ });
}
- async AddPublication(publicationType:any, folderId:any) {
+ getFromDB() {
+ if (synchro.connected === true) {
+ this.getPublicationDetail();
+ setTimeout(() => {
+ this.getPublications();
+ }, 5000);
+
+ } else {
+
+ this.sqliteservice.getActionById(this.folderId).then((publications) => {
+ console.log('publications', publications)
+ let item = {
+ ActionType: publications[0].ActionType,
+ DateBegin: publications[0].DateBegin,
+ DateEnd: publications[0].DateEnd,
+ Description: publications[0].Description,
+ Detail: publications[0].Detail,
+ ProcessId: publications[0].ProcessId
+ }
+ this.publicationDitails = item;
+
+ let publicationArray = [];
+ JSON.parse(publications[0].publications).forEach(element => {
+ let publicationlis = {
+ DateIndex: element.DateIndex,
+ DatePublication: element.DatePublication,
+ DocumentId: element.DocumentId,
+ FileBase64: element.FileBase64,
+ FileExtension: element.FileExtension,
+ Message: element.Message,
+ OrganicEntityId: element.OrganicEntityId,
+ OriginalFileName: element.OriginalFileName,
+ ProcessId: element.ProcessId
+ }
+ publicationArray.push(publicationlis);
+
+ });
+
+ this.getpublication = publicationArray;
+ })
+
+ }
+ }
+
+ async AddPublication(publicationType: any, folderId: any) {
const modal = await this.modalController.create({
component: NewPublicationPage,
- componentProps:{
+ componentProps: {
publicationType: publicationType,
folderId: folderId,
},
@@ -142,19 +196,19 @@ export class ViewPublicationsPage implements OnInit {
backdropDismiss: false
});
await modal.present();
- modal.onDidDismiss().then(()=>{
+ modal.onDidDismiss().then(() => {
this.doRefresh(event);
});
}
- goToPublicationDetail(publicationId:string){
+ goToPublicationDetail(publicationId: string) {
this.router.navigate(['/home/publications/view-publications', this.folderId, publicationId]);
}
- async viewPublicationDetail(publicationId:string) {
+ async viewPublicationDetail(publicationId: string) {
const modal = await this.modalController.create({
component: PublicationDetailPage,
- componentProps:{
+ componentProps: {
publicationId: publicationId,
folderId: this.folderId,
},
@@ -162,7 +216,7 @@ export class ViewPublicationsPage implements OnInit {
// backdropDismiss: false
});
await modal.present();
- modal.onDidDismiss().then(()=>{
+ modal.onDidDismiss().then(() => {
this.getPublications();
});
}
diff --git a/src/app/services/eventTrigger.service.spec.ts b/src/app/services/eventTrigger.service.spec.ts
new file mode 100644
index 000000000..332ea2205
--- /dev/null
+++ b/src/app/services/eventTrigger.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { EventTrigger } from './eventTrigger.service';
+
+describe('EventsService', () => {
+ let service: EventTrigger;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(EventTrigger);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/eventTrigger.service.ts b/src/app/services/eventTrigger.service.ts
new file mode 100644
index 000000000..e44f104d7
--- /dev/null
+++ b/src/app/services/eventTrigger.service.ts
@@ -0,0 +1,21 @@
+import { Injectable } from '@angular/core';
+import { Subject } from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+
+
+export class EventTrigger {
+
+ private eventSubject = new Subject
()
+
+ publishSomeData(data: any){
+ this.eventSubject.next(data)
+ }
+
+ getObservable(): Subject{
+ return this.eventSubject
+ }
+
+}
\ No newline at end of file
diff --git a/src/app/services/events/attachments/attachments-routing.module.ts b/src/app/services/events/attachments/attachments-routing.module.ts
new file mode 100644
index 000000000..4ea13a050
--- /dev/null
+++ b/src/app/services/events/attachments/attachments-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { AttachmentsPage } from './attachments.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: AttachmentsPage
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class AttachmentsPageRoutingModule {}
diff --git a/src/app/services/events/attachments/attachments.module.ts b/src/app/services/events/attachments/attachments.module.ts
new file mode 100644
index 000000000..95c52664a
--- /dev/null
+++ b/src/app/services/events/attachments/attachments.module.ts
@@ -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 { AttachmentsPageRoutingModule } from './attachments-routing.module';
+
+import { AttachmentsPage } from './attachments.page';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ AttachmentsPageRoutingModule
+ ],
+ declarations: [AttachmentsPage]
+})
+export class AttachmentsPageModule {}
diff --git a/src/app/services/events/attachments/attachments.page.html b/src/app/services/events/attachments/attachments.page.html
new file mode 100644
index 000000000..93a33398e
--- /dev/null
+++ b/src/app/services/events/attachments/attachments.page.html
@@ -0,0 +1,62 @@
+
+
+
+
+
+ Anexos do evento
+
+
+
+
+
+
+
+
+
+ {{ att.SourceName }}
+ {{ att.Description }}
+ {{ att.CreateDate }}
+ {{ att.Stakeholders }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/services/events/attachments/attachments.page.scss b/src/app/services/events/attachments/attachments.page.scss
new file mode 100644
index 000000000..a37695678
--- /dev/null
+++ b/src/app/services/events/attachments/attachments.page.scss
@@ -0,0 +1,57 @@
+ion-back-button {
+ display: block;
+}
+
+/* CONTENT */
+ion-content{
+ --background: #f2f2f2;
+}
+.div-attach-results{
+ background: none;
+}
+ion-list, ion-item-sliding{
+ background: none;
+
+}
+.item-list-small{
+ font-size: 14px;
+ overflow: auto;
+ }
+ .ion-item-class{
+ padding: 0;
+
+ }
+ .label-text{
+ width: 100%;
+ padding: 0;
+ margin: 0;
+ }
+
+//DIV
+.main-item{
+ margin: 15px;
+ /* border: 1px solid #ccc; */
+ border-radius: 5px;
+ box-shadow: 0 4px 8px 0 #ccc, 0 6px 20px 0 #f2f2f2;
+}
+ .div-content-attachment{
+ margin:0;
+ padding: 10px;
+ }
+ .div-content-attachment h3{
+ font-size: 18px;
+ font-weight: 700;
+ padding-bottom: 5px;
+ }
+ ion-item ion-icon{
+ --border-color: red;
+ }
+
+ /* Custom Skeleton Line Height and Margin */
+.custom-skeleton ion-skeleton-text {
+ line-height: 13px;
+}
+
+.custom-skeleton ion-skeleton-text:last-child {
+ margin-bottom: 5px;
+}
\ No newline at end of file
diff --git a/src/app/services/events/attachments/attachments.page.spec.ts b/src/app/services/events/attachments/attachments.page.spec.ts
new file mode 100644
index 000000000..881e11b1a
--- /dev/null
+++ b/src/app/services/events/attachments/attachments.page.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { AttachmentsPage } from './attachments.page';
+
+describe('AttachmentsPage', () => {
+ let component: AttachmentsPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ AttachmentsPage ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(AttachmentsPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/events/attachments/attachments.page.ts b/src/app/services/events/attachments/attachments.page.ts
new file mode 100644
index 000000000..27bf95b81
--- /dev/null
+++ b/src/app/services/events/attachments/attachments.page.ts
@@ -0,0 +1,47 @@
+import { Component, OnInit } from '@angular/core';
+import { AttachmentsService } from 'src/app/services/attachments.service';
+import { Attachment } from 'src/app/models/attachment.model';
+import { ActivatedRoute, Router } from '@angular/router';
+import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
+import { ModalController, NavParams } from '@ionic/angular';
+
+@Component({
+ selector: 'app-attachments',
+ templateUrl: './attachments.page.html',
+ styleUrls: ['./attachments.page.scss'],
+})
+export class AttachmentsPage implements OnInit {
+
+ loadedEventAttachments: Attachment[];
+ pageId: string;
+
+ constructor(
+ private attachamentsService: AttachmentsService,
+ private iab: InAppBrowser,
+ private modalCtrl: ModalController,
+ private navParams: NavParams) { }
+
+ ngOnInit() {
+ this.loadAttachments(this.navParams.get('eventId'));
+ }
+
+ loadAttachments(eventid:string)
+ {
+ this.attachamentsService.getAttachmentsById(eventid).subscribe(attachments => {
+ this.loadedEventAttachments = attachments;
+ this.pageId = eventid;
+ });
+ }
+
+ async viewDocument(documenturl:string)
+ {
+ const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
+ const browser = this.iab.create(url,"_blank");
+ browser.show();
+ }
+ close(){
+ this.modalCtrl.dismiss(null);
+ }
+
+
+}
diff --git a/src/app/services/events/attendees/attendees-routing.module.ts b/src/app/services/events/attendees/attendees-routing.module.ts
new file mode 100644
index 000000000..00f6f262b
--- /dev/null
+++ b/src/app/services/events/attendees/attendees-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { AttendeesPageModal } from './attendees.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: AttendeesPageModal
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class AttendeesPageRoutingModule {}
diff --git a/src/app/services/events/attendees/attendees.module.ts b/src/app/services/events/attendees/attendees.module.ts
new file mode 100644
index 000000000..f21feadb2
--- /dev/null
+++ b/src/app/services/events/attendees/attendees.module.ts
@@ -0,0 +1,21 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { AttendeesPageRoutingModule } from './attendees-routing.module';
+
+import { AttendeesPageModal } from './attendees.page';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ AttendeesPageRoutingModule
+ ],
+ declarations: [AttendeesPageModal],
+ exports: [AttendeesPageModal]
+})
+export class AttendeesPageModule {}
diff --git a/src/app/services/events/attendees/attendees.page.html b/src/app/services/events/attendees/attendees.page.html
new file mode 100644
index 000000000..9f63cff4d
--- /dev/null
+++ b/src/app/services/events/attendees/attendees.page.html
@@ -0,0 +1,87 @@
+
+
+ Adicionar intervenientes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ attendee.Name }}
+ {{ attendee.EmailAddress }}
+
+
+
+
+
+
+
+
+
+
+
+ = 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
+ = 1 || taskParticipantsCc.length >= 1" > Destinatário
+
+
+
+
+
+
+ {{ attendee.Name }}
+ {{ attendee.EmailAddress }}
+
+
+
+
+
+
+
+ = 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
+ = 1 || taskParticipantsCc.length >= 1" > Destinatário
+
+
+
+
+
+
+
+ {{ attendee.Name }}
+ {{ attendee.EmailAddress }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/services/events/attendees/attendees.page.scss b/src/app/services/events/attendees/attendees.page.scss
new file mode 100644
index 000000000..7cb035cfa
--- /dev/null
+++ b/src/app/services/events/attendees/attendees.page.scss
@@ -0,0 +1,3 @@
+ion-item{
+ border-bottom:1px solid #ccc;
+}
diff --git a/src/app/services/events/attendees/attendees.page.spec.ts b/src/app/services/events/attendees/attendees.page.spec.ts
new file mode 100644
index 000000000..f8fb83e19
--- /dev/null
+++ b/src/app/services/events/attendees/attendees.page.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { AttendeesPageModal } from './attendees.page';
+
+describe('AttendeesPage', () => {
+ let component: AttendeesPageModal;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ AttendeesPageModal ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(AttendeesPageModal);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/events/attendees/attendees.page.ts b/src/app/services/events/attendees/attendees.page.ts
new file mode 100644
index 000000000..5dfaeae0c
--- /dev/null
+++ b/src/app/services/events/attendees/attendees.page.ts
@@ -0,0 +1,142 @@
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { EventPerson } from 'src/app/models/eventperson.model';
+import { ModalController, NavParams } from '@ionic/angular';
+import { ContactsService } from 'src/app/services/contacts.service';
+
+@Component({
+ selector: 'app-attendees',
+ templateUrl: './attendees.page.html',
+ styleUrls: ['./attendees.page.scss'],
+})
+export class AttendeesPageModal implements OnInit {
+
+ // Defined by the API
+ contacts: EventPerson[];
+ showLoader: boolean = false;
+ selectedContact: EventPerson[] =[];
+ eventPersons: EventPerson[];
+ adding: "intervenient" | "CC";
+ currentPath = window.location.pathname;
+
+ taskParticipants:EventPerson[] = [];
+ taskParticipantsCc:EventPerson[] = [];
+
+ constructor(
+ private modalCtrl: ModalController,
+ private contactsService: ContactsService,
+ private navParams: NavParams,
+ private modalController: ModalController) {
+
+ this.adding = this.navParams.get('adding');
+ this.taskParticipants = this.navParams.get('taskParticipants');
+ this.taskParticipantsCc = this.navParams.get('taskParticipantsCc');
+
+ }
+
+ ngOnInit() {
+ this.fetchContacts("");
+
+ if(this.taskParticipants == null || this.taskParticipants == undefined){
+ this.taskParticipants = [];
+ }
+
+ if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined){
+ this.taskParticipantsCc = [];
+ }
+
+ }
+
+ ngOnChanges(event) {}
+
+ save(){
+
+ this.modalController.dismiss({
+ 'taskParticipants': this.taskParticipants,
+ 'taskParticipantsCc': this.taskParticipantsCc
+ });
+ }
+
+ close() {
+ this.modalController.dismiss(false);
+ }
+
+ onChange(evt: any) {
+ this.fetchContacts(evt.detail.value);
+ }
+
+ filterSearchList(itm: EventPerson): boolean {
+
+ const result = this.taskParticipants.concat( this.taskParticipantsCc).find((contact, index)=>{
+
+ if(contact.Name.toLocaleLowerCase() == itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() == itm.EmailAddress.toLocaleLowerCase()){
+ index = index;
+ return contact;
+ }
+
+ })
+
+ return undefined == result;
+
+ }
+
+ remove(itm: EventPerson){
+
+ if(this.adding == "intervenient"){
+
+ this.taskParticipants = this.taskParticipants.filter((contact, index) =>{
+
+ if(contact.Name.toLocaleLowerCase() != itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() != itm.EmailAddress.toLocaleLowerCase()){
+ return contact;
+ }
+ return false;
+
+ });
+
+ } else if (this.adding == "CC") {
+
+ this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{
+
+ if(contact.Name.toLocaleLowerCase() != itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() != itm.EmailAddress.toLocaleLowerCase()){
+ return contact;
+ }
+ return false;
+
+ });
+ }
+
+ }
+
+ async selectContact(itm: EventPerson){
+ if(this.adding == "intervenient"){
+ itm.IsRequired = true;
+ this.taskParticipants.push(itm);
+
+ } else if (this.adding == "CC") {
+ itm.IsRequired = false;
+ this.taskParticipantsCc.push(itm);
+ }
+ }
+
+ async fetchContacts(filter: string) {
+ this.showLoader = true;
+
+ this.contactsService.getContacts(filter).subscribe(result =>
+ {
+ if (this.eventPersons != null)
+ {
+ this.eventPersons.forEach(attendee => {
+ const index: number = result.findIndex((cont) => {
+ return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
+ });
+
+ result.splice(index, 1);
+ });
+ }
+
+ this.contacts = result;
+ this.showLoader = false;
+ }
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/src/app/services/events/edit-event/edit-event-routing.module.ts b/src/app/services/events/edit-event/edit-event-routing.module.ts
new file mode 100644
index 000000000..3616b2106
--- /dev/null
+++ b/src/app/services/events/edit-event/edit-event-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { EditEventPage } from './edit-event.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: EditEventPage
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class EditEventPageRoutingModule {}
diff --git a/src/app/services/events/edit-event/edit-event.module.ts b/src/app/services/events/edit-event/edit-event.module.ts
new file mode 100644
index 000000000..bcd1dc3e4
--- /dev/null
+++ b/src/app/services/events/edit-event/edit-event.module.ts
@@ -0,0 +1,21 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { EditEventPageRoutingModule } from './edit-event-routing.module';
+
+import { EditEventPage } from './edit-event.page';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ EditEventPageRoutingModule
+ ],
+ declarations: [EditEventPage],
+ exports: [EditEventPage]
+})
+export class EditEventPageModule {}
diff --git a/src/app/services/events/edit-event/edit-event.page.html b/src/app/services/events/edit-event/edit-event.page.html
new file mode 100644
index 000000000..401201dbc
--- /dev/null
+++ b/src/app/services/events/edit-event/edit-event.page.html
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assunto
+
+
+
+
+ Campo obrigatório
+
+
+ Descrição
+
+
+
+ Localização
+
+
+
+ Calendário
+
+ Pessoal
+ Oficial
+
+
+
+ Tipo do evento
+
+ Reunião
+ Viagem
+ Conferência
+ Encontro
+
+
+
+ Data Início
+
+
+
+ Data Fim
+
+
+
+
+
+
+ Editar
+
+ Participantes
+
+
+
+
+
+
+
+ {{attendee.Name}}
+
+
+
+
+
+
1">
+
+
+
+
+
+
+
+ Editar
+
+ Anexos
+
+
+
+
+
+
+
+
+
+ {{ att.Description }}
+ {{ att.CreateDate }}
+
+
+
+
+
+
1">
+
+
+
+
+
+
+ Sem anexos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/services/events/edit-event/edit-event.page.scss b/src/app/services/events/edit-event/edit-event.page.scss
new file mode 100644
index 000000000..0224ee793
--- /dev/null
+++ b/src/app/services/events/edit-event/edit-event.page.scss
@@ -0,0 +1,165 @@
+
+.content{
+ padding: 30px 20px 0 20px !important;
+ margin: 0;
+ float: left;
+ border-left: 1px solid #d8d8d8 !important;
+ }
+ .main-header{
+ font-family: Roboto;
+ background-color: #fff;
+ overflow:hidden;
+ color:#000;
+ transform: translate3d(0, 1px, 0);
+
+ .title-content{
+ margin: 0px auto;
+ overflow: auto;
+ padding: 0 !important;
+ background: #fff;
+ .middle{
+ padding: 0!important;
+ float: left;
+ }
+ }
+
+ .title{
+ font-size: 25px;
+ }
+
+ }
+ .ion-item-container{
+ margin: 15px auto;
+ border: 1px solid #ebebeb;
+ border-radius: 5px;
+ padding-left: 10px;
+ }
+ .ion-item-container-no-border{
+ width: 100%;
+ margin: 0px auto;
+ padding: 0 !important;
+ overflow: auto;
+ }
+ .container-div{
+ margin-bottom: 15px;
+ float: left;
+ overflow: auto;
+ }
+ .ion-item-class-2{
+ margin: 0px auto;
+ }
+ .ion-icon-class{
+ width: 45px;
+ height: 45px;
+ float: left;
+ padding: 10px;
+ font-size: 25px;
+ }
+ ion-select{
+ padding-left: 5px;
+ margin-left: 0;
+ }
+ .ion-input-class{
+ width: calc(100% - 45px);
+ height: 45px;
+ border: 1px solid #ebebeb;
+ border-radius: 5px;
+ padding-left: 5px;
+ padding-right: 10px;
+ float: left;
+ }
+ .ion-input-class-no-height{
+ border: 1px solid #ebebeb;
+ border-radius: 5px;
+ overflow: auto;
+ }
+ .list-people{
+ //width: 256px;
+ float: left;
+
+ }
+ .add-people{
+ width: 45px;
+ float: right;
+ overflow: auto;
+ font-size: 25px;
+ padding: 10px;
+ }
+ .list-people-title{
+ /* font-size: 13px; */
+ color: #797979;
+ }
+ .attach-document{
+ font-size: 15px;
+ color: #0d89d1;
+ 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:#0d89d1;
+ }
+ /* SPAN */
+ .span-left{
+ float: left;
+ font-size: 15x;
+ }
+ .span-right{
+ text-align: right;
+ float: right;
+ font-size: 13px;
+ }
+ .container-footer{
+ margin:0 auto;
+ overflow: auto;
+ }
+ .button-cancel {
+ width: 170px;
+ height: 44px;
+ border-radius: 22.5px;
+ --background: #e0e9ee;
+ --color: #061b52;
+ margin:10px;
+ }
+ .button-save {
+ width: 170px;
+ height: 44px;
+ border-radius: 22.5px;
+ --background: #42b9fe;
+ --color:#ffffff;
+ margin:10px;
+ }
+
+ .text-input{
+ width: 100%;
+ border: 1px solid #ebebeb;
+ margin: 0px 15px 15px 0px;
+ padding: 0 !important;
+ border-radius: 5px;
+ }
+
+ /* Error Messages */
+ .error{
+ color:red;
+ font-size: 12px;
+ font-weight: bold;
+ padding-bottom: 20px;
+ }
+ .span-color{
+ color:red;
+ }
+
+
+ .buttons{
+ display: flex;
+ justify-content: space-between;
+ padding: 20px;
+ overflow: auto;
+ }
\ No newline at end of file
diff --git a/src/app/services/events/edit-event/edit-event.page.spec.ts b/src/app/services/events/edit-event/edit-event.page.spec.ts
new file mode 100644
index 000000000..f63e92e8d
--- /dev/null
+++ b/src/app/services/events/edit-event/edit-event.page.spec.ts
@@ -0,0 +1,28 @@
+import { HttpClientModule } from '@angular/common/http';
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { EditEventPage } from './edit-event.page';
+
+describe('EditEventPage', () => {
+ let component: EditEventPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EditEventPage ],
+ imports: [
+ IonicModule.forRoot(),
+ HttpClientModule
+ ]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EditEventPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/events/edit-event/edit-event.page.ts b/src/app/services/events/edit-event/edit-event.page.ts
new file mode 100644
index 000000000..3a987dea9
--- /dev/null
+++ b/src/app/services/events/edit-event/edit-event.page.ts
@@ -0,0 +1,245 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { EventsService } from 'src/app/services/events.service';
+import { Router } from '@angular/router';
+import { Event } from '../../../models/event.model';
+import { EventBody } from 'src/app/models/eventbody.model';
+import { AlertController, ModalController } from '@ionic/angular';
+import { EventPerson } from 'src/app/models/eventperson.model';
+import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
+import { AlertService } from 'src/app/services/alert.service';
+import { Attachment } from 'src/app/models/attachment.model';
+import { AttachmentsService } from 'src/app/services/attachments.service';
+import { FormGroup, FormBuilder, Validators } from "@angular/forms";
+import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
+import { AttachmentsPage } from '../attachments/attachments.page';
+
+@Component({
+ selector: 'app-edit-event',
+ templateUrl: './edit-event.page.html',
+ styleUrls: ['./edit-event.page.scss'],
+})
+
+export class EditEventPage implements OnInit {
+
+ loadedEvent: Event;
+ loadedEventAttachments: Attachment[];
+ pageId: string;
+ showLoader: boolean;
+ backURL: string;
+ ionicForm: FormGroup;
+ isSubmitted = false;
+
+ minDate: Date;
+
+ profile:string;
+
+ constructor(
+ public formBuilder: FormBuilder,
+ public alertController: AlertController,
+ private router: Router,
+ private activatedRoute: ActivatedRoute,
+ private eventsService: EventsService,
+ private modalCtrl: ModalController,
+ private alertService: AlertService,
+ private attachamentsService: AttachmentsService,
+ private route: Router,
+ private iab: InAppBrowser) {
+ this.loadedEvent = new Event();
+ this.loadedEvent.Body = new EventBody();
+
+ }
+
+ ngOnInit() {
+ this.loadEvent();
+ this.loadAttachments();
+ this.ionicForm = this.formBuilder.group({
+ subject: ['', [Validators.required]]
+ })
+ }
+
+ get errorControl() {
+ return this.ionicForm.controls;
+ }
+
+ loadEvent(){
+ let eventid: string;
+ this.activatedRoute.paramMap.subscribe(paramMap =>
+ {
+ if (!paramMap.has("eventId")){
+ return;
+ }
+ else{
+ this.pageId = paramMap.get('eventId');
+ eventid = paramMap.get('eventId');
+ console.log(eventid);
+
+ }
+ if (paramMap.has("caller")){
+ this.backURL = "/home/" + paramMap.get('caller');
+ }
+ }
+ );
+ this.eventsService.getEvent(eventid).subscribe(response => {
+ this.loadedEvent = response;
+ });
+ }
+
+ async openAttendees(){
+ const modal = await this.modalCtrl.create({
+ component: AttendeesPageModal,
+ componentProps: {
+ eventAttendees: this.loadedEvent.Attendees
+ },
+ cssClass: 'attendee modal-desktop',
+ backdropDismiss: false
+ });
+
+ await modal.present();
+
+ modal.onDidDismiss().then((data) => {
+ if (data['data'] != null)
+ {
+ let newattendees: EventPerson[] = data['data'];
+ this.loadedEvent.Attendees = newattendees;
+ }
+ });
+ }
+
+ getEventAttendees(): EventPerson[]
+ {
+ return this.loadedEvent.Attendees;
+ }
+
+ setEventAttendees(newattendes: EventPerson[])
+ {
+ this.loadedEvent.Attendees = newattendes;
+ }
+
+ async deleteConfirm()
+ {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Apagar evento!',
+ message: 'Deseja apagar o evento da agenda ' + this.loadedEvent.CalendarName + '?',
+ buttons: [
+ {
+ text: 'Não',
+ role: 'cancel',
+ cssClass: 'secondary',
+ handler: () => { }
+ }, {
+ text: 'Sim',
+ handler: () => {
+ this.Delete();
+ }
+ }
+ ]
+ });
+
+ await alert.present();
+ }
+
+ Delete()
+ {
+ 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.router.navigate(['/home/events']);
+ });
+ }
+
+ Save()
+ {
+ if (this.ionicForm.valid){
+
+ this.activatedRoute.paramMap.subscribe(paramMap =>{
+ if (paramMap.has("profile")){
+ console.log(paramMap.get('profile'));
+
+ }
+ });
+
+ this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () =>
+ {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Evento actualizado',
+ buttons: ['OK']
+ });
+
+ setTimeout(()=>{
+ alert.dismiss();
+ }, 1500);
+ });
+ }
+ }
+
+ showAlert(){
+ this.alertService.presentAlert("Funcionalidade em desenvolvimento");
+ }
+
+ loadAttachments()
+ {
+ /* console.log(this.pageId); */
+
+ this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
+ this.loadedEventAttachments = res;
+ console.log(res);
+
+ });
+ }
+ async viewDocument(documenturl:string)
+ {
+ const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
+ const browser = this.iab.create(url,"_blank");
+ browser.show();
+ }
+
+ back()
+ {
+ //this.back();
+ }
+ doRefresh(event){
+ /* this.RefreshEvents(); */
+ event.target.complete();
+ setTimeout(() => {
+ event.target.complete();
+ }, 2000);
+
+ }
+ navigateTo(ev){
+ this.route.navigate(['/home/events',ev]);
+ }
+ async openAttachments(){
+ const modal = await this.modalCtrl.create({
+ component: AttachmentsPage,
+ componentProps: {
+ eventId: this.pageId,
+ attachments: this.loadedEventAttachments
+ },
+ cssClass: 'attachments',
+ backdropDismiss: false
+ });
+
+ await modal.present();
+
+ modal.onDidDismiss().then((data) => {
+ if (data['data'] != null)
+ {
+ let newattendees: EventPerson[] = data['data'];
+ this.loadedEvent.Attendees = newattendees;
+ }
+ });
+
+ }
+}
diff --git a/src/app/services/events/event-detail-modal/event-detail-modal-routing.module.ts b/src/app/services/events/event-detail-modal/event-detail-modal-routing.module.ts
new file mode 100644
index 000000000..bebfe4ea1
--- /dev/null
+++ b/src/app/services/events/event-detail-modal/event-detail-modal-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { EventDetailModalPage } from './event-detail-modal.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: EventDetailModalPage
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class EventDetailModalPageRoutingModule {}
diff --git a/src/app/services/events/event-detail-modal/event-detail-modal.module.ts b/src/app/services/events/event-detail-modal/event-detail-modal.module.ts
new file mode 100644
index 000000000..5472c8c36
--- /dev/null
+++ b/src/app/services/events/event-detail-modal/event-detail-modal.module.ts
@@ -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 { EventDetailModalPageRoutingModule } from './event-detail-modal-routing.module';
+
+import { EventDetailModalPage } from './event-detail-modal.page';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ EventDetailModalPageRoutingModule
+ ],
+ declarations: [EventDetailModalPage]
+})
+export class EventDetailModalPageModule {}
diff --git a/src/app/services/events/event-detail-modal/event-detail-modal.page.html b/src/app/services/events/event-detail-modal/event-detail-modal.page.html
new file mode 100644
index 000000000..35866cd52
--- /dev/null
+++ b/src/app/services/events/event-detail-modal/event-detail-modal.page.html
@@ -0,0 +1,215 @@
+
+
+
+
+
+ Visualizar Evento
+
+
+
+
+
+
+
+
+
+
+
+
+ Descrição
+
+
+
+ Localização
+
+
+
+ Calendário
+
+ Pessoal
+ Oficial
+
+
+
+ Tipo do evento
+
+ Reunião
+ Viagem
+ Conferência
+ Encontro
+
+
+
+ Data Início
+
+
+
+ Data Fim
+
+
+
+
+
+
+ Editar
+
+ Participantes
+
+
+
+
+
+
+
+ {{attendee.Name}}
+
+
+
+
+
+
1">
+
+
+
+
+
+
+
+ Editar
+
+ Anexos
+
+
+
+
+
+
+
+
+
+ {{ att.Description }}
+ {{ att.CreateDate }}
+
+
+
+
+
+
1">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sem anexos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gravar
+
+
+
+
diff --git a/src/app/services/events/event-detail-modal/event-detail-modal.page.scss b/src/app/services/events/event-detail-modal/event-detail-modal.page.scss
new file mode 100644
index 000000000..b94403c90
--- /dev/null
+++ b/src/app/services/events/event-detail-modal/event-detail-modal.page.scss
@@ -0,0 +1,95 @@
+ion-item-group{
+ margin: 15px;
+}
+.div-item{
+ width: 100%;
+ overflow: auto;
+ border-bottom: 1px solid #ccc;
+ margin: 10px 0 5px 0;
+}
+.div-up{
+ width: 100%;
+ overflow: auto;
+}
+.div-up h3{
+ margin: 0;
+ padding: 0;
+ font-size: 17px;
+ width: 100%;
+}
+.div-icon{
+ width: 10%;
+ font-size: 22px;
+ float: left;
+ color: #808080;
+}
+.div-icon ion-icon{
+ display: block;
+ margin: 0 auto;
+
+}
+.div-content-attachment{
+ width: 85%;
+ float: left;
+ padding: 0 0 0 12px;
+}
+.ion-icon-attach{
+ color: #666666;
+ font-size: 20px;
+}
+
+.btn-attach{
+ margin: 15px 0 0 0;
+ --color: #333;
+ --border-color:#333;
+}
+.div-card-button{
+ width: 100%;
+ overflow: auto;
+ padding: 0 !important;
+}
+ion-card{
+ margin: 2.5% !important;
+ width: 45%;
+ float: left;
+}
+.center{
+ text-align: center;
+ float: center;
+}
+
+/* FFOTER */
+.event-detail-buttons{
+ width: 90%;
+ margin: 10px auto;
+}
+.event-detail-buttons ion-button{
+ width: 90%;
+ margin: 0 auto;
+ display: block;
+ margin-bottom: 25px;
+}
+.ion-icon-delete{
+ font-size: 22px;
+ color: red;
+ background-color: white;
+ padding-right: 5px;
+}
+.error{
+ color:red;
+ font-size: 12px;
+ font-weight: bold;
+ padding-bottom: 20px;
+}
+/* .event-detail-buttons{
+ margin-bottom: 80px;
+ margin-top: 10px;
+} */
+.attendees-icon{
+ font-size: 14px;
+}
+.see-more-button{
+ text-transform: initial;
+ font-size: 16px;
+}
+
diff --git a/src/app/services/events/event-detail-modal/event-detail-modal.page.spec.ts b/src/app/services/events/event-detail-modal/event-detail-modal.page.spec.ts
new file mode 100644
index 000000000..76c8032a4
--- /dev/null
+++ b/src/app/services/events/event-detail-modal/event-detail-modal.page.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { EventDetailModalPage } from './event-detail-modal.page';
+
+describe('EventDetailModalPage', () => {
+ let component: EventDetailModalPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EventDetailModalPage ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EventDetailModalPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/events/event-detail-modal/event-detail-modal.page.ts b/src/app/services/events/event-detail-modal/event-detail-modal.page.ts
new file mode 100644
index 000000000..efbed2dee
--- /dev/null
+++ b/src/app/services/events/event-detail-modal/event-detail-modal.page.ts
@@ -0,0 +1,245 @@
+import { Component, OnInit } from '@angular/core';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { ActivatedRoute, Router } from '@angular/router';
+import { AlertController, ModalController, NavParams } from '@ionic/angular';
+import { Attachment } from 'src/app/models/attachment.model';
+import { Event } from 'src/app/models/event.model';
+import { EventBody } from 'src/app/models/eventbody.model';
+import { EventPerson } from 'src/app/models/eventperson.model';
+import { AlertService } from 'src/app/services/alert.service';
+import { AttachmentsService } from 'src/app/services/attachments.service';
+import { EventsService } from 'src/app/services/events.service';
+import { AttachmentsPage } from '../attachments/attachments.page';
+import { AttendeesPageModal } from '../attendees/attendees.page';
+
+@Component({
+ selector: 'app-event-detail-modal',
+ templateUrl: './event-detail-modal.page.html',
+ styleUrls: ['./event-detail-modal.page.scss'],
+})
+export class EventDetailModalPage implements OnInit {
+
+ loadedEvent: Event;
+ loadedEventAttachments: Attachment[];
+ pageId: string;
+ showLoader: boolean;
+ backURL: string;
+ ionicForm: FormGroup;
+ isSubmitted = false;
+
+ minDate: Date;
+
+ profile:string;
+
+ constructor(
+ public formBuilder: FormBuilder,
+ public alertController: AlertController,
+ private router: Router,
+ private activatedRoute: ActivatedRoute,
+ private eventsService: EventsService,
+ private modalCtrl: ModalController,
+ private alertService: AlertService,
+ private attachamentsService: AttachmentsService,
+ private route: Router,) {
+ this.loadedEvent = new Event();
+ this.loadedEvent.Body = new EventBody();
+ }
+
+ ngOnInit() {
+ this.loadEvent();
+ this.loadAttachments();
+ this.ionicForm = this.formBuilder.group({
+ subject: ['', [Validators.required]]
+ })
+
+ // this.setDefaultTime()
+ }
+
+ // setDefaultTime() {
+ // this.loadedEvent.StartDate = new Date()
+ // this.loadedEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000))
+ // }
+
+ get errorControl() {
+ return this.ionicForm.controls;
+ }
+
+ loadEvent(){
+ let eventid: string;
+ this.activatedRoute.paramMap.subscribe(paramMap =>
+ {
+ if (!paramMap.has("eventId")){
+ return;
+ }
+ else{
+ this.pageId = paramMap.get('eventId');
+ eventid = paramMap.get('eventId');
+ console.log(eventid);
+
+ }
+ if (paramMap.has("caller")){
+ this.backURL = "/home/" + paramMap.get('caller');
+ }
+ }
+ );
+ this.eventsService.getEvent(eventid).subscribe(response => {
+ this.loadedEvent = response;
+ });
+ }
+
+ async openAttendees(){
+ const modal = await this.modalCtrl.create({
+ component: AttendeesPageModal,
+ componentProps: {
+ eventAttendees: this.loadedEvent.Attendees
+ },
+ cssClass: 'attendee modal-desktop',
+ backdropDismiss: false
+ });
+
+ await modal.present();
+
+ modal.onDidDismiss().then((data) => {
+ if (data['data'] != null)
+ {
+ let newattendees: EventPerson[] = data['data'];
+ this.loadedEvent.Attendees = newattendees;
+ }
+ });
+}
+
+ getEventAttendees(): EventPerson[]
+ {
+ return this.loadedEvent.Attendees;
+ }
+
+ setEventAttendees(newattendes: EventPerson[])
+ {
+ this.loadedEvent.Attendees = newattendes;
+ }
+
+ async deleteConfirm()
+ {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Apagar evento!',
+ message: 'Deseja apagar o evento da agenda ' + this.loadedEvent.CalendarName + '?',
+ buttons: [
+ {
+ text: 'Não',
+ role: 'cancel',
+ cssClass: 'secondary',
+ handler: () => { }
+ }, {
+ text: 'Sim',
+ handler: () => {
+ this.Delete();
+ }
+ }
+ ]
+ });
+
+ await alert.present();
+ }
+
+ Delete()
+ {
+ 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.router.navigate(['/home/events']);
+ });
+ }
+
+ Save()
+ {
+ if (this.ionicForm.valid)
+ {
+
+ this.eventsService.putEvent(this.loadedEvent, 2, 3, "md").subscribe(async () =>
+ {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Evento actualizado',
+ buttons: ['OK']
+ });
+
+ setTimeout(()=>{
+ alert.dismiss();
+ }, 1500);
+ });
+ }
+ }
+
+ showAlert(){
+ this.alertService.presentAlert("Funcionalidade em desenvolvimento");
+ }
+
+ loadAttachments()
+ {
+ /* this.attachamentsService.getEventAttachments(this.pageId).subscribe(attachments => {
+ this.loadedEventAttachments = attachments;
+ }); */
+ this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
+ console.log(res);
+
+ },(error) => {
+ console.log(error);
+
+ });
+ }
+ async viewDocument(documenturl:string)
+ {
+ const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
+ /* const browser = this.iab.create(url,"_blank");
+ browser.show(); */
+ }
+
+ back()
+ {
+ //this.back();
+ }
+ doRefresh(event){
+ /* this.RefreshEvents(); */
+ event.target.complete();
+ setTimeout(() => {
+ event.target.complete();
+ }, 2000);
+
+ }
+ navigateTo(ev){
+ this.route.navigate(['/home/events',ev]);
+ }
+ async openAttachments() {
+ const modal = await this.modalCtrl.create({
+ component: AttachmentsPage,
+ componentProps: {
+ eventId: this.pageId,
+ attachments: this.loadedEventAttachments
+ },
+ cssClass: 'attachments',
+ backdropDismiss: false
+ });
+
+ await modal.present();
+
+ modal.onDidDismiss().then((data) => {
+ if (data['data'] != null)
+ {
+ let newattendees: EventPerson[] = data['data'];
+ this.loadedEvent.Attendees = newattendees;
+ }
+ });
+
+ }
+
+}
diff --git a/src/app/services/events/event-detail/event-detail-routing.module.ts b/src/app/services/events/event-detail/event-detail-routing.module.ts
new file mode 100644
index 000000000..a2b625fd8
--- /dev/null
+++ b/src/app/services/events/event-detail/event-detail-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { EventDetailPage } from './event-detail.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: EventDetailPage
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class EventDetailPageRoutingModule {}
diff --git a/src/app/services/events/event-detail/event-detail.module.ts b/src/app/services/events/event-detail/event-detail.module.ts
new file mode 100644
index 000000000..96baa24e9
--- /dev/null
+++ b/src/app/services/events/event-detail/event-detail.module.ts
@@ -0,0 +1,22 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { EventDetailPageRoutingModule } from './event-detail-routing.module';
+
+import { EventDetailPage } from './event-detail.page';
+
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ ReactiveFormsModule,
+ EventDetailPageRoutingModule
+ ],
+ declarations: [EventDetailPage]
+})
+export class EventDetailPageModule {}
diff --git a/src/app/services/events/event-detail/event-detail.page.html b/src/app/services/events/event-detail/event-detail.page.html
new file mode 100644
index 000000000..3f8023e69
--- /dev/null
+++ b/src/app/services/events/event-detail/event-detail.page.html
@@ -0,0 +1,215 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Descrição
+
+
+
+ Localização
+
+
+
+ Calendário
+
+ Pessoal
+ Oficial
+
+
+
+ Tipo do evento
+
+ Reunião
+ Viagem
+ Conferência
+ Encontro
+
+
+
+ Data Início
+
+
+
+ Data Fim
+
+
+
+
+
+
+ Editar
+
+ Participantes
+
+
+
+
+
+
+
+ {{attendee.Name}}
+
+
+
+
+
+
1">
+
+
+
+
+
+
+
+ Editar
+
+ Anexos
+
+
+
+
+
+
+
+
+
+ {{ att.Description }}
+ {{ att.CreateDate }}
+
+
+
+
+
+
1">
+
+
+
+
+
+
+
+
+
+ Sem anexos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/services/events/event-detail/event-detail.page.scss b/src/app/services/events/event-detail/event-detail.page.scss
new file mode 100644
index 000000000..8c8bf1543
--- /dev/null
+++ b/src/app/services/events/event-detail/event-detail.page.scss
@@ -0,0 +1,117 @@
+ion-item-group{
+ margin: 15px;
+}
+.div-item{
+ width: 100%;
+ overflow: auto;
+ border-bottom: 1px solid #ccc;
+ margin: 10px 0 5px 0;
+}
+.div-up{
+ width: 100%;
+ overflow: auto;
+}
+.div-up h3{
+ margin: 0;
+ padding: 0;
+ font-size: 17px;
+ width: 100%;
+}
+.div-icon{
+ width: 10%;
+ font-size: 22px;
+ float: left;
+ color: #808080;
+}
+.div-icon ion-icon{
+ display: block;
+ margin: 0 auto;
+
+}
+.div-content-attachment{
+ width: 85%;
+ float: left;
+ padding: 0 0 0 12px;
+}
+.ion-icon-attach{
+ color: #666666;
+ font-size: 20px;
+}
+
+.btn-attach{
+ margin: 15px 0 0 0;
+ --color: #333;
+ --border-color:#333;
+}
+.div-card-button{
+ width: 100%;
+ overflow: auto;
+ padding: 0 !important;
+}
+ion-card{
+ margin: 2.5% !important;
+ width: 45%;
+ float: left;
+}
+.center{
+ text-align: center;
+ float: center;
+}
+
+/* FFOTER */
+.event-detail-buttons{
+ width: 90%;
+ margin: 10px auto;
+}
+.event-detail-buttons ion-button{
+ width: 90%;
+ margin: 0 auto;
+ display: block;
+ margin-bottom: 25px;
+}
+.ion-icon-delete{
+ font-size: 22px;
+ color: red;
+ background-color: white;
+ padding-right: 5px;
+}
+.error{
+ color:red;
+ font-size: 12px;
+ font-weight: bold;
+ padding-bottom: 20px;
+}
+/* .event-detail-buttons{
+ margin-bottom: 80px;
+ margin-top: 10px;
+} */
+.attendees-icon{
+ font-size: 14px;
+}
+.see-more-button{
+ text-transform: initial;
+ font-size: 16px;
+}
+
+.header-content{
+ overflow: auto;
+ margin: 0 auto;
+ padding-top: 25px;
+}
+.header-icon-left{
+ width: 36px;
+ font-size: 33px;
+ color: #42b9fe;
+ float: left;
+ border: 1px solid red;
+}
+.header-title{
+ width: 300px;
+ font-family: Roboto;
+ font-size: 25px;
+ margin: 0 5px 0 5px;
+ padding: 0;
+ color:#000;
+ float: left;
+}
+
diff --git a/src/app/services/events/event-detail/event-detail.page.spec.ts b/src/app/services/events/event-detail/event-detail.page.spec.ts
new file mode 100644
index 000000000..a3f346841
--- /dev/null
+++ b/src/app/services/events/event-detail/event-detail.page.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { EventDetailPage } from './event-detail.page';
+
+describe('EventDetailPage', () => {
+ let component: EventDetailPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EventDetailPage ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EventDetailPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/events/event-detail/event-detail.page.ts b/src/app/services/events/event-detail/event-detail.page.ts
new file mode 100644
index 000000000..9429e9222
--- /dev/null
+++ b/src/app/services/events/event-detail/event-detail.page.ts
@@ -0,0 +1,244 @@
+import { Component, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { EventsService } from 'src/app/services/events.service';
+import { Router } from '@angular/router';
+import { Event } from '../../../models/event.model';
+import { EventBody } from 'src/app/models/eventbody.model';
+import { AlertController, ModalController } from '@ionic/angular';
+import { EventPerson } from 'src/app/models/eventperson.model';
+import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
+import { AlertService } from 'src/app/services/alert.service';
+import { Attachment } from 'src/app/models/attachment.model';
+import { AttachmentsService } from 'src/app/services/attachments.service';
+import { FormGroup, FormBuilder, Validators } from "@angular/forms";
+import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
+import { AttachmentsPage } from '../attachments/attachments.page';
+
+
+@Component({
+ selector: 'app-event-detail',
+ templateUrl: './event-detail.page.html',
+ styleUrls: ['./event-detail.page.scss'],
+})
+export class EventDetailPage implements OnInit {
+
+ loadedEvent: Event;
+ loadedEventAttachments: Attachment[];
+ pageId: string;
+ showLoader: boolean;
+ backURL: string;
+ ionicForm: FormGroup;
+ isSubmitted = false;
+
+ minDate: Date;
+
+ profile:string;
+
+
+ constructor(
+ public formBuilder: FormBuilder,
+ public alertController: AlertController,
+ private router: Router,
+ private activatedRoute: ActivatedRoute,
+ private eventsService: EventsService,
+ private modalCtrl: ModalController,
+ private alertService: AlertService,
+ private attachamentsService: AttachmentsService,
+ private route: Router,
+ private iab: InAppBrowser) {
+ this.loadedEvent = new Event();
+ this.loadedEvent.Body = new EventBody();
+ }
+
+ ngOnInit() {
+ this.loadEvent();
+ this.loadAttachments();
+ this.ionicForm = this.formBuilder.group({
+ subject: ['', [Validators.required]]
+ })
+ }
+
+ get errorControl() {
+ return this.ionicForm.controls;
+ }
+
+ loadEvent(){
+ let eventid: string;
+ this.activatedRoute.paramMap.subscribe(paramMap =>
+ {
+ if (!paramMap.has("eventId")){
+ return;
+ }
+ else{
+ this.pageId = paramMap.get('eventId');
+ eventid = paramMap.get('eventId');
+ console.log(eventid);
+
+ }
+ if (paramMap.has("caller")){
+ this.backURL = "/home/" + paramMap.get('caller');
+ }
+ }
+ );
+ this.eventsService.getEvent(eventid).subscribe(response => {
+ this.loadedEvent = response;
+ });
+ }
+
+ async openAttendees(){
+ const modal = await this.modalCtrl.create({
+ component: AttendeesPageModal,
+ componentProps: {
+ eventAttendees: this.loadedEvent.Attendees
+ },
+ cssClass: 'attendee modal-desktop',
+ backdropDismiss: false
+ });
+
+ await modal.present();
+
+ modal.onDidDismiss().then((data) => {
+ if (data['data'] != null)
+ {
+ let newattendees: EventPerson[] = data['data'];
+ this.loadedEvent.Attendees = newattendees;
+ }
+ });
+}
+
+ getEventAttendees(): EventPerson[]
+ {
+ return this.loadedEvent.Attendees;
+ }
+
+ setEventAttendees(newattendes: EventPerson[])
+ {
+ this.loadedEvent.Attendees = newattendes;
+ }
+
+ async deleteConfirm()
+ {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Apagar evento!',
+ message: 'Deseja apagar o evento da agenda ' + this.loadedEvent.CalendarName + '?',
+ buttons: [
+ {
+ text: 'Não',
+ role: 'cancel',
+ cssClass: 'secondary',
+ handler: () => { }
+ }, {
+ text: 'Sim',
+ handler: () => {
+ this.Delete();
+ }
+ }
+ ]
+ });
+
+ await alert.present();
+ }
+
+ Delete()
+ {
+ 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']
+ });
+
+ await alert.present(); */
+
+ this.router.navigate(['/home/events']);
+ });
+ }
+
+ Save()
+ {
+ if (this.ionicForm.valid){
+
+ this.activatedRoute.paramMap.subscribe(paramMap =>{
+ if (paramMap.has("profile")){
+ console.log(paramMap.get('profile'));
+
+ }
+ });
+
+ this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () =>
+ {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Evento actualizado',
+ buttons: ['OK']
+ });
+
+ setTimeout(()=>{
+ alert.dismiss();
+ }, 1500);
+ });
+ }
+ }
+
+ showAlert(){
+ this.alertService.presentAlert("Funcionalidade em desenvolvimento");
+ }
+
+ loadAttachments()
+ {
+ /* console.log(this.pageId); */
+
+ this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
+ this.loadedEventAttachments = res;
+ console.log(res);
+
+ });
+ }
+ async viewDocument(documenturl:string)
+ {
+ const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
+ const browser = this.iab.create(url,"_blank");
+ browser.show();
+ }
+
+ back()
+ {
+ //this.back();
+ }
+ doRefresh(event){
+ /* this.RefreshEvents(); */
+ event.target.complete();
+ setTimeout(() => {
+ event.target.complete();
+ }, 2000);
+
+ }
+ navigateTo(ev){
+ this.route.navigate(['/home/events',ev]);
+ }
+ async openAttachments(){
+ const modal = await this.modalCtrl.create({
+ component: AttachmentsPage,
+ componentProps: {
+ eventId: this.pageId,
+ attachments: this.loadedEventAttachments
+ },
+ cssClass: 'attachments',
+ backdropDismiss: false
+ });
+
+ await modal.present();
+
+ modal.onDidDismiss().then((data) => {
+ if (data['data'] != null)
+ {
+ let newattendees: EventPerson[] = data['data'];
+ this.loadedEvent.Attendees = newattendees;
+ }
+ });
+
+ }
+
+}
diff --git a/src/app/services/events/events-routing.module.ts b/src/app/services/events/events-routing.module.ts
new file mode 100644
index 000000000..5b2cbdb3c
--- /dev/null
+++ b/src/app/services/events/events-routing.module.ts
@@ -0,0 +1,39 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { EventsPage } from './events.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: EventsPage
+ },
+ {
+ path: 'event-detail',
+ loadChildren: () => import('./event-detail/event-detail.module').then( m => m.EventDetailPageModule)
+ },
+ {
+ path: 'attachments',
+ loadChildren: () => import('./attachments/attachments.module').then( m => m.AttachmentsPageModule)
+ },
+ {
+ path: 'attendees',
+ loadChildren: () => import('./attendees/attendees.module').then( m => m.AttendeesPageModule)
+ },
+ {
+ path: 'event-detail-modal',
+ loadChildren: () => import('./event-detail-modal/event-detail-modal.module').then( m => m.EventDetailModalPageModule)
+ },
+ {
+ path: 'edit-event',
+ loadChildren: () => import('./edit-event/edit-event.module').then( m => m.EditEventPageModule)
+ }
+
+
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class EventsPageRoutingModule {}
diff --git a/src/app/services/events/events.module.ts b/src/app/services/events/events.module.ts
new file mode 100644
index 000000000..811e816ca
--- /dev/null
+++ b/src/app/services/events/events.module.ts
@@ -0,0 +1,23 @@
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { IonicModule } from '@ionic/angular';
+import { EventsPageRoutingModule } from './events-routing.module';
+import { EventsPage } from './events.page';
+import { HeaderPageModule } from 'src/app/shared/header/header.module';
+import { PdfViewerModule } from 'ng2-pdf-viewer';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ EventsPageRoutingModule,
+ HeaderPageModule,
+ //
+ PdfViewerModule
+ ],
+ declarations: [EventsPage],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+})
+export class EventsPageModule {}
diff --git a/src/app/services/events/events.page.html b/src/app/services/events/events.page.html
new file mode 100644
index 000000000..5e192894f
--- /dev/null
+++ b/src/app/services/events/events.page.html
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+ {{customDate}}
+
+
+ {{totalEvent}} evento agendado para hoje
+ {{totalEvent}} eventos agendados para hoje
+
+
+
{{currentHoursMinutes | date: 'HH:mm'}}
+
"{{currentEvent}}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{event.StartDate | date: 'HH:mm'}}
+
{{event.EndDate | date: 'HH:mm'}}
+
+
Todo
+
o dia
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{task.taskStartDate | date: 'dd-MM-yyyy'}}
+
{{task.taskStartDate | date: 'HH:mm'}}
+
+
+
{{ task.Subject }}
+
{{ task.Senders }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/services/events/events.page.scss b/src/app/services/events/events.page.scss
new file mode 100644
index 000000000..7e8af5266
--- /dev/null
+++ b/src/app/services/events/events.page.scss
@@ -0,0 +1,526 @@
+@import '~src/function.scss';
+
+/* HEADER */
+.bg-blue{
+ --background:#0782c9;
+ background:#0782c9;
+ --background-color:#0782c9;
+ background-color:#0782c9;
+ color: #ffffff;
+ --color: #ffffff;
+}
+ion-toolbar{
+ --background: white;
+}
+.ion-text-header-top{
+ width: 100%;
+ --background: transparent;
+ text-align: center;
+ padding-top: 15px;
+ color: #ffffff;
+
+ /* border: 1px solid red; */
+ }
+ .div-top-header{
+ width: 400px;
+ margin: 0 auto;
+ background-color: #0782c9;
+ overflow: auto;
+ padding-top: 15px;
+ border: 0!important;
+
+ .div-search{
+ font-size: 45px;
+ float: left;
+ margin: 0 0 0 10px
+ }
+ .div-logo{
+ background: transparent;
+ width: 140px;
+ margin: 5px 0 0px 71px;
+ float: left;
+ }
+ .div-logo img{
+ width: 100%;
+ }
+ .div-profile{
+ font-size: 45px;
+ float: right;
+ margin-right: 10px;
+ }
+ }
+ .ion-text-header-top p{
+ --background: transparent;
+ color: #ffffff;
+ }
+ .ion-text-right{
+ --background: transparent;
+ color: #ffffff;
+ }
+ .header-large{
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 12.5pt;
+ /* font-weight: 600; */
+ background: transparent;
+ color: #ffffff;
+ }
+ .header-xsmall{
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9.7pt;
+ font-weight: bold;
+ padding-bottom: 3.5px;
+ margin-bottom: 3.5px;
+ border-bottom: 1px solid #ccc;
+ background: transparent;
+ }
+ .header-medium{
+ font-size: 12pt;
+ text-align: left;
+ font-family: roboto;
+ background: transparent;
+ margin-right: 5px;
+ line-height: 25px;
+ }
+
+ .p-small{
+ font-size: 13pt;
+ margin-top: 13px;
+ color:#000;
+ margin-right: 25px !important;
+ text-align: right;
+ /* color: #ffffff; */
+ }
+
+ /* CONTENT */
+ .item-list-small{
+ font-size: 14px;
+ overflow: auto;
+ }
+ .ion-item-class{
+ padding: 0;
+
+ }
+ .label-text{
+ width: 100%;
+ padding: 0;
+ margin: 0;
+ }
+
+ //DIV
+ .div-item-Oficial{
+ width: 100%;
+ overflow: auto;
+ /* border-bottom: 1px solid #ccc; */
+ margin: 10px 0 5px 0;
+ background: #cab0dc;
+ border-radius: 20px;
+ padding: 10px;
+ /* box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */
+ }
+ .div-item-Pessoal{
+ width: 100%;
+ overflow: auto;
+ /* border-bottom: 1px solid #ccc; */
+ margin: 10px 0 5px 0;
+ background: #cbeecb;
+ border-radius: 20px;
+ padding: 10px;
+ /* box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */
+ }
+ .div-up{
+ width: 100%;
+ overflow: auto;
+ }
+ .div-up h3{
+ margin: 0;
+ padding: 0;
+ font-size: 17px;
+ width: 100%;
+ }
+ .div-icon{
+ width: 10%;
+ font-size: 22px;
+ float: left;
+ color: #808080;
+ }
+ .div-icon ion-icon{
+ display: block;
+ margin: 0 auto;
+
+ }
+ .div-content-Oficial{
+ width: 85%;
+ float: left;
+ border-left: 4px solid #cab0dc;
+ padding: 0 0 0 12px;
+ }
+ .div-content-Pessoal{
+ width: 85%;
+ float: left;
+ border-left: 4px solid #cbeecb;
+ padding: 0 0 0 12px;
+ }
+ .div-content-Oficial h3, .div-content-Pessoal h3{
+ font-size: 14pt;
+ /* border: 1px solid red; */
+ }
+ .div-content-Oficial p, .div-content-Pessoal p{
+ font-size: 12pt;
+ color: rgb(94, 92, 92);
+ padding: 0 !important;
+ margin: 0 !important;
+ }
+ .div-botton{
+ width: 100%;
+ overflow: auto;
+ margin: 10px 0 5px 0;
+ }
+ .div-botton-left{
+ width: 10%;
+ float: left;
+ }
+ .ion-icon-location{
+ text-align: center;
+ display: block;
+ color: #000;
+ font-size: 16px;
+ margin: 0 auto;
+ }
+ .div-botton-middle{
+ width: 75%;
+ float: left;
+ margin-top: 0.5px;
+ }
+ .div-botton-middle p{
+ padding: 0;
+ margin: 0;
+ }
+ .div-botton-right{
+ width: 10%;
+ float: left;
+ margin: 0;
+ padding: 0;
+ }
+ .ion-icon-attach{
+ color: #666666;
+ font-size: 20px;
+ }
+ /* NEW CSS FOR TOGGLE BUTTON */
+ .toggleBox{
+ margin:20px 20px 0 0;
+ }
+ input[type="checkbox"]{
+ position: relative;
+ width: 96px;
+ height: 34px;
+ background: #ffffff;
+ -webkit-appearance: none;
+ border-radius: 20px;
+ outline: none;
+ transition: .4s;
+ /* box-shadow: inset 0 0 5px rgba(0,0,0,0.2); */
+ cursor: pointer;
+ border:1px solid #e16817;
+ }
+ input:checked[type="checkbox"]{
+ background: #e16817;
+ }
+ input[type="checkbox"]::before{
+ z-index: 2;
+ position: absolute;
+ content: "";
+ left: 0;
+ width: 30px;
+ height: 30px;
+ background: #fff;
+ border-radius: 50%;
+ /* transform: scale(1.1); */
+ box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
+ border:1px solid #e16817;
+ }
+ input:checked[type="checkbox"]::before{
+ left: 65px;
+
+ }
+ .toggle{
+ position: relative;
+ display: inline;
+ font-family: 'Montserrat', sans-serif;
+ display: grid;
+ text-align: center;
+ }
+ label{
+ position: absolute;
+ color: #fff;
+ font-weight: 600;
+ font-size: 12px;
+ pointer-events: none;
+ }
+ .onbtn{
+ top:10px;
+ bottom: 15px;
+ left: 15px;
+ /* padding-top: 10px;
+ border: 1px solid red; */
+ }
+ .ofbtn{
+ top:10px;
+ bottom: 15px;
+ right: 14px;
+ color: #e16817;
+ }
+
+
+
+// new
+.main{
+ padding: 0px em(20px);
+}
+
+.event-number{
+ color: white;
+ font-family: Roboto;
+ font-size: 15px;
+ color: var(--white);
+
+ bold{
+ font-family: Roboto;
+ font-size: 25px;
+ text-align: right;
+ color: var(--white);
+ }
+}
+.time{
+ font-family: Roboto;
+ font-size: 30px;
+ text-align: center;
+ color: var(--white);
+ line-height: unset;
+ margin-top: 10px;
+}
+
+.next-meeting{
+ display: flex;
+ justify-content: center;
+ margin: 0px 20px;
+ margin-top: 15px;
+
+ .meeting-time {
+ font-size: em(25px);
+ font-family: Roboto;
+ font-weight: 300;
+ color: var(--white);
+ margin-right: 7px;
+ }
+
+ .meeting-description {
+ margin-top: 2px;
+ font-family: Roboto;
+ font-size: 15px;
+ color: var(--white);
+ }
+}
+
+.conteiner-box {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ padding-bottom: 20px;
+}
+.schedule {
+ max-width: 400px;
+ font-family: Roboto;
+ background-color: white;
+ box-shadow: 0 0 10px 0 rgb(0 0 0 / 7%);
+ border: solid 1px #e9e9e9;
+ margin-bottom: 20px;
+ border-radius: 25px;
+ display: flex;
+ flex-direction: column;
+ max-height: 100%;
+ overflow: auto;
+ padding-bottom: 25px;
+
+ .schedule-header{
+ display: flex;
+ margin-bottom: 20px;
+ justify-content: space-between;
+ padding: 20px 20px 0px 20px;
+
+ .title {
+ display: flex;
+ align-items: center;
+
+ .icon{
+ color: #e8e8e8;
+ height: 35px;
+ width: 35px;
+ margin-right: 10px;
+ }
+ .text{
+ font-family: Roboto;
+ font-size: 20px;
+ color: black;
+ }
+ }
+ .icon-next {
+ color: #e8e8e8;
+ height: 35px;
+ width: 35px;
+ font-size: 35px;
+ font-size: 35px;
+ }
+ }
+ .content{
+ //padding: 0px 20px 20px 20px;
+ overflow: auto;
+
+ .item-exp{
+ overflow: auto;
+ //padding-top: 5px;
+ //padding-bottom: 5px;
+ padding: 5px 20px 5px 20px;
+ background-color: transparent !important;
+ }
+ ion-list{
+ padding: 0px;
+ margin: 0px;
+ .d-flex{
+ width: 100%;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ }
+ ion-item{
+ padding-bottom: 5px;
+ margin-top: 5px;
+ border-bottom: 1px solid #ebebeb;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ --background: transparent !important;
+
+ .schedule-time{
+ margin-right: 10px;
+ .time-start{
+ color: #797979 !important;
+ font-family: Roboto;
+ font-size: 13px;
+ }
+ .time-end{
+ color: #797979 !important;
+ font-family: Roboto;
+ font-size: 13px;
+ }
+ }
+ .schedule-date{
+ margin-right: 10px;
+ width: 22%;
+ color: #797979 !important;
+ font-size: 13px;
+ }
+ .schedule-details{
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ width: 78%;
+ .location{
+ font-family: Roboto;
+ font-size: 13px;
+ color: black;
+ width: 100%;
+
+ }
+ .description{
+ width: 100%;
+ font-family: Roboto;
+ font-size: 15px;
+ font-weight: bold;
+ color: #0d89d1;
+ }
+ .description p{
+ white-space: nowrap;
+ overflow: hidden !important;
+ text-overflow: ellipsis !important;
+ }
+ }
+ .color{
+ width: 5px;
+ height: 40px;
+ border-top-right-radius: 5px;
+ border-bottom-right-radius: 5px;
+ background-color: #f05d5e;
+ }
+ }
+ ion-item:last-child{
+ border-bottom: unset !important;
+ padding-bottom: unset !important;
+ }
+ }
+
+ }
+
+ .resume{
+ .title{
+ font-family: Roboto;
+ font-size: 15px;
+ font-weight: 500;
+ color: #797979;
+ margin-bottom: 5px;
+ margin-top: 10px;
+ }
+ .event-num, .first-event-time{
+ font-family: Roboto;
+ font-size: 15px;
+ display: block;
+ color: black;
+ }
+ }
+
+}
+
+.d-flex {
+ display: flex;
+}
+
+.pointer{
+ cursor: pointer;
+}
+
+
+
+
+@media only screen and (max-width: 856px) {
+
+ .content, .conteiner-box{
+ height: unset !important;
+ max-height: unset !important;
+ }
+
+}
+
+
+@media only screen and (min-width: 804px) {
+
+ .schedule:first-child {
+ margin-right: 2%;
+
+ }
+}
+
+@media only screen and (min-width: 478px) {
+ .schedule{
+ width: 400px;
+ }
+}
+
+
+@media only screen and (max-width: 478px) {
+ .schedule{
+ width: 360px;
+ }
+}
+ion-title{
+ border: 1px solid red;
+ text-overflow: ellipsis;
+}
diff --git a/src/app/services/events/events.page.spec.ts b/src/app/services/events/events.page.spec.ts
new file mode 100644
index 000000000..d9ee95a07
--- /dev/null
+++ b/src/app/services/events/events.page.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { EventsPage } from './events.page';
+
+describe('EventsPage', () => {
+ let component: EventsPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EventsPage ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EventsPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/services/events/events.page.ts b/src/app/services/events/events.page.ts
new file mode 100644
index 000000000..0ceb9b85d
--- /dev/null
+++ b/src/app/services/events/events.page.ts
@@ -0,0 +1,386 @@
+import { Component, OnInit, LOCALE_ID, EventEmitter, Output, Renderer2, ElementRef } from '@angular/core';
+
+import { Event } from '../../models/event.model';
+import { EventsService } from 'src/app/services/events.service';
+import { NavigationExtras, Router } from '@angular/router';
+import { ActivatedRoute, NavigationEnd } from '@angular/router';
+import { AlertService } from 'src/app/services/alert.service';
+import { AuthService } from 'src/app/services/auth.service';
+import { StorageService } from 'src/app/services/storage.service';
+import { ModalController, Platform } from '@ionic/angular';
+import { EventDetailPage } from './event-detail/event-detail.page';
+import { ProcessesService } from '../../services/processes.service';
+import { DailyWorkTask } from '../../models/dailyworktask.model';
+import { LoginUserRespose } from 'src/app/models/user.model';
+import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service';
+import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
+import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
+import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
+
+@Component({
+ selector: 'app-events',
+ templateUrl: './events.page.html',
+ styleUrls: ['./events.page.scss'],
+})
+export class EventsPage implements OnInit {
+ /* Get current system date */
+ today = new Date();
+
+ 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"];
+
+ customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
+
+ /* Setting appropriate greeting according to the time */
+ grettings = ["Bom dia", "Boa tarde", "Boa noite"];
+ greetting='';
+
+ timeDate = this.today.getHours() + ":" + this.today.getMinutes();
+ /* Set segment variable */
+ segment:string;
+ public profile:string;
+ currentEvent: any;
+
+ eventsList: Event[];
+ maxSubjectLength = 30;
+ officialeventsList: Event[];
+ personaleventsList: Event[];
+
+ prEventList: Event[];
+ mdEventList: Event[];
+
+ combinedEvents: Event[];
+
+ customText = false;
+ totalEvent=0;
+ currentHoursMinutes: Date | string;
+
+ showLoader: boolean;
+
+ taskslist:DailyWorkTask[] = [];
+ expedientList:any;
+ hideSearchBtn: boolean=false;
+
+ // shared data
+ toDayEventStorage = ToDayEventStorage
+ expedienteGdStore = ExpedienteGdStore
+
+ expedienteTaskPipe = new ExpedienteTaskPipe()
+
+ @Output() openExpedientListPage:EventEmitter = new EventEmitter();
+
+ loggeduser: LoginUserRespose;
+
+ existingScreenOrientation: string;
+
+ constructor(
+ private eventService: EventsService,
+ private router: Router,
+ private storageService:StorageService,
+ public activatedRoute: ActivatedRoute,
+ private alertController: AlertService,
+ private authService: AuthService,
+ private processes:ProcessesService,
+ /* private gabineteService: GabineteDigitalPage, */
+ private modalController:ModalController,
+ private screenOrientation: ScreenOrientation,
+ public platform: Platform,
+ ) {
+ this.existingScreenOrientation = this.screenOrientation.type;
+ console.log(this.existingScreenOrientation);
+
+ this.loggeduser = authService.ValidatedUser;
+
+ this.prEventList = null;
+
+ this.platform.resize.subscribe(async () => {
+ //console.log('Resize event detected');
+ // console.log('Resize event detected');
+
+ });
+
+ }
+
+ ngOnInit() {
+
+ this.segment = "Combinada";
+ this.profile = "mdgpr";
+
+ this.showGreeting();
+
+ this.router.events.forEach((event) => {
+ if(event instanceof NavigationEnd && event.url == '/home/events') {
+ this.RefreshEvents();
+ this.LoadList();
+ }
+ });
+ this.hideSearch();
+
+ //this.checkScreenOrientation();
+ }
+
+ hideSearch(){
+ if(this.router.url == '/home/events'){
+ this.hideSearchBtn = true;
+ }
+ }
+
+ doRefresh(event) {
+ this.RefreshEvents();
+ this.LoadList();
+ event.target.complete();
+ }
+
+ onSegmentChange() {
+ this.RefreshEvents();
+ }
+
+ // Lock to portrait
+ lockToPortrait(){
+ this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
+ console.log('set');
+ }
+
+ // Lock to landscape
+ lockToLandscape(){
+ this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
+ }
+
+ // Unlock screen orientation
+ unlockScreenOrientation(){
+ this.screenOrientation.unlock();
+ }
+
+ checkScreenOrientation(){
+ if( window.innerWidth < 701) {
+ this.lockToPortrait();
+ console.log('was here');
+
+ }
+ else{
+ this.unlockScreenOrientation();
+ }
+ }
+
+ async RefreshEvents() {
+ this.currentEvent = "";
+ this.showLoader = true;
+
+ let date = new Date();
+ date.setMonth(date.getMonth() + 1);
+ let start = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+ let end = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" 23:59:59";
+
+
+ if(this.loggeduser.Profile == 'MDGPR') {
+
+ let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise();
+ let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise();
+
+ const list = mdOficialEvents.concat(mdPessoalEvents);
+
+ this.toDayEventStorage.reset(list)
+
+ if(this.toDayEventStorage.eventsList.length > 0){
+ this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
+ this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
+ }
+
+ this.totalEvent = this.toDayEventStorage.eventsList.length;
+ this.showLoader = false;
+
+ }
+ else if (this.loggeduser.Profile == 'PR') {
+
+ let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise();
+ let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
+
+ const list = prOficialEvents.concat(prPessoalEvents);
+
+ this.toDayEventStorage.reset(list)
+
+ if(this.toDayEventStorage.eventsList.length > 0) {
+ this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
+ this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
+ }
+
+ this.totalEvent = this.toDayEventStorage.eventsList.length;
+ this.showLoader = false;
+
+ }
+
+
+ /* switch (this.segment)
+ {
+ case "Combinada":
+ if(this.loggeduser.Profile == 'MDGPR'){
+
+ let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise();
+ let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise();
+
+ this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
+
+ if(this.eventsList.length > 0){
+ this.currentEvent = this.eventsList[0].Subject;
+ this.currentHoursMinutes = this.eventsList[0].StartDate;
+ }
+
+ this.totalEvent = this.eventsList.length;
+ this.showLoader = false;
+
+ }
+ else{
+
+ let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise();
+ let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
+ this.eventsList = prOficialEvents.concat(prPessoalEvents);
+ console.log(this.eventsList);
+ console.log(this.eventsList);
+
+ if(this.eventsList.length > 0){
+ this.currentEvent = this.eventsList[0].Subject;
+ this.currentHoursMinutes = this.eventsList[0].StartDate;
+ }
+
+ this.totalEvent = this.eventsList.length;
+ this.showLoader = false;
+
+ }
+
+ break;
+ case "Pessoal":
+ if(this.loggeduser.Profile == 'MDGPR'){
+ this.eventService.getAllMdPessoalEvents(start, end).subscribe(res => {
+ this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal");
+ this.showLoader = false;
+ });
+ }
+ else{
+ this.eventService.getAllPrPessoalEvents(start, end).subscribe(res => {
+ this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal");
+ this.showLoader = false;
+ });
+ }
+
+ break;
+ case "Oficial":
+ if(this.loggeduser.Profile == 'MDGPR'){
+ this.eventService.getAllMdOficialEvents(start, end).subscribe(res => {
+ this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");;
+ this.showLoader = false;
+ });
+ }
+ else{
+ this.eventService.getAllPrOficialEvents(start, end).subscribe(res => {
+ this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");;
+ this.showLoader = false;
+ });
+ }
+ break;
+ } */
+ }
+
+ showGreeting(){
+ if(this.today.getHours() >= 6 && this.today.getHours() < 12){
+ this.greetting = this.grettings[0];
+ }
+ else if(this.today.getHours() >= 12 && this.today.getHours() < 18){
+ this.greetting = this.grettings[1];
+ }
+ else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */{
+ this.greetting = this.grettings[2];
+ }
+ }
+
+ gotTo(){
+ this.router.navigate(['/home/events']);
+ }
+
+ changeProfile(){
+ if(this.profile == "mdgpr"){
+ console.log('pr');
+ this.profile ="pr";
+ this.RefreshEvents();
+ }
+ else{
+ console.log('mdgpr');
+ this.profile ="mdgpr";
+ this.RefreshEvents();
+ }
+ }
+
+ logout()
+ {
+ this.authService.ValidatedUser.BasicAuthKey = "";
+ this.router.navigate(['/home/login']);
+ }
+
+ async openEventDetail1(id:any){
+ console.log(id);
+
+ const modal = await this.modalController.create({
+ component: EventDetailPage,
+ componentProps: {
+ eventId: id,
+ },
+ cssClass: 'event-detail',
+ backdropDismiss: false
+ });
+ await modal.present();
+ modal.onDidDismiss();
+
+ }
+
+ LoadList() {
+ this.processes.GetTaskListExpediente(false).subscribe(result => {
+ console.log("Expediente", result);
+
+ const ExpedienteTask = result.map( e=> this.expedienteTaskPipe.transform(e))
+
+ this.expedienteGdStore.reset(ExpedienteTask)
+ });
+ }
+
+ sortArrayISODate(myArray: any){
+ return myArray.sort(function(a, b) {
+ return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
+ });
+ }
+
+ goToEvent(eventId:any){
+ this.router.navigate(['/home/events', eventId, 'events']);
+ }
+
+ goToExpediente(SerialNumber:any) {
+ if(this.loggeduser.Profile == 'MDGPR'){
+ this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
+ }
+ else if(this.loggeduser.Profile == 'PR'){
+ this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']);
+ }
+ }
+
+ viewExpedientListPage(){
+ if(this.loggeduser.Profile == 'MDGPR'){
+ if( window.innerWidth < 801){
+ this.router.navigate(['/home/gabinete-digital/expediente']);
+ }
+ else{
+ let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,} };
+ this.router.navigate(['/home/gabinete-digital'], navigationExtras);
+ }
+ }
+ else if(this.loggeduser.Profile == 'PR'){
+ if( window.innerWidth < 801){
+ this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
+ }
+ else{
+ let navigationExtras: NavigationExtras = { queryParams: {"expedientes-pr": true,} };
+ this.router.navigate(['/home/gabinete-digital'], navigationExtras);
+ }
+ }
+ }
+
+
+}
+
diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts
index cec9a5adf..96ecd49dc 100644
--- a/src/app/services/notifications.service.ts
+++ b/src/app/services/notifications.service.ts
@@ -13,8 +13,10 @@ import { NavigationExtras,Router } from '@angular/router';
import { ToastService } from '../services/toast.service';
import { JsonStore } from './jsonStore.service';
import { synchro } from './socket/synchro.service';
-import { v4 as uuidv4 } from 'uuid'
+import { v4 as uuidv4 } from 'uuid';
+import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
+
@Injectable({
providedIn: 'root'
})
@@ -41,7 +43,8 @@ export class NotificationsService {
private toastService: ToastService,
private zone: NgZone,
private activeroute: ActivatedRoute,
- private jsonstore: JsonStore) {
+ private jsonstore: JsonStore,
+ private eventtrigger: EventTrigger) {
this.storageService.get("Notifications").then((value) => {
@@ -83,7 +86,7 @@ export class NotificationsService {
getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
- console.log('Notifications not supported')
+ //console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token';
@@ -102,11 +105,11 @@ export class NotificationsService {
}
);
- window['MFPPush'].registerDevice(null, (successResponse) => {
+ window['MFPPush'].registerDevice(null, async (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId)
- this.storageService.store(username, successResponse.deviceId);
- this.storageService.get(username).then(value => {
+ await this.storageService.store(username, successResponse.deviceId);
+ await this.storageService.get(username).then(value => {
console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res);
@@ -136,87 +139,10 @@ export class NotificationsService {
}
}
-
-
}
}
- getAndpostToken2() {
-
- if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
- console.log('Notifications not supported')
- } else {
-
- const geturl = environment.apiURL + 'notifications/token';
- if(window['WLAuthorizationManager']) {
- if(window['WLAuthorizationManager'].obtainAccessToken) {
- window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
- (token) => {
- console.log('Push Notification: Success ' + token);
-
- window['MFPPush'].initialize(
- function (successResponse) {
- console.log("Push notification Successfully Service intialized: " + successResponse);
- },
- function (failureResponse) {
- console.log("Push notification failure Service intialized: " + failureResponse);
- }
- );
-
- window['MFPPush'].registerDevice(null, (successResponse) => {
- console.log("Successfully registered: " + JSON.stringify(successResponse));
- console.log('token: ', successResponse.deviceId)
- /* this.storageService.store(username, successResponse.deviceId);
- this.storageService.get(username).then(value => {
- console.log('STORAGE TOKEN', value)
- this.storageService.get(AuthConnstants.USER).then(res => {
- console.log('USERID', res);
- const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
- const body = {
- UserId: res.UserId,
- TokenId: successResponse.deviceId,
- Status: 1,
- Service: 1
- };
- this.http.post(`${geturl}`, body, { headers }).subscribe(data => {
- console.log('TOKEN USER MIDLE', data);
- })
- });
-
- }); */
- },
- function (failureResponse) {
- console.log("Successfully failue: " + JSON.stringify(failureResponse));
- }
- );
- }, (error) => {
- console.log('Push notification recived: failure ' + error.responseText);
- console.log(JSON.stringify(error));
- }
- )
- } else {
- console.log('not called')
- }
- } else {
- console.log('not called')
- }
-
-
- }
-
- }
-
- removeDepartment(index): void {
- /* this.DataArray[this.DataArray.findIndex(item => item.index == index)];
- this.DataArray.splice( this.DataArray.findIndex(item => item.indexOf(index.to) === 'William'),1); */
- const indexx = this.DataArray.indexOf(index, 0);
- if (indexx > -1) {
- this.DataArray.splice(index, 1);
- console.log('This notificatio', this.DataArray);
- }
- }
-
tempClearArray(){
this.DataArray = [];
}
@@ -245,6 +171,9 @@ export class NotificationsService {
this.storageService.store("Notifications",this.DataArray)
console.log(message);
+ this.eventtrigger.publishSomeData({
+ notification: "recive"
+ })
var data = JSON.parse(message.payload);
synchro.$send(data)
diff --git a/src/app/services/socket/synchro.service.ts b/src/app/services/socket/synchro.service.ts
index f6c68ff1b..e562513ab 100644
--- a/src/app/services/socket/synchro.service.ts
+++ b/src/app/services/socket/synchro.service.ts
@@ -3,8 +3,9 @@ import { SessionStore } from 'src/app/store/session.service';
import { v4 as uuidv4 } from 'uuid'
import { BackgroundService } from '../background.service';
import { environment } from 'src/environments/environment';
+import { EventTrigger } from '../eventTrigger.service'
-export interface wss{
+export interface wss {
url: string,
type: 'reflect' | 'emit'
@@ -20,23 +21,24 @@ export interface wss{
providedIn: 'root'
})
class SynchroService {
- [x: string]: any;
+ [x: string]: any;
- private connection!: WebSocket;
+ private connection!: WebSocket;
private id: string = uuidv4();
public conected = false
private url: string = ''
- callback = function(){}
+ callback = function () { }
private _connected = false;
+ private eventtrigger: EventTrigger;
private BackgroundService = new BackgroundService()
callBacks: {
- type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notification' | 'Notifications' | '',
+ type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notification' | 'Notifications' | '',
object?: string
funx: Function
}[] = []
private msgQueue = []
- constructor() {
+ constructor() {
// alert(SessionStore.user.FullName)
}
@@ -46,13 +48,13 @@ class SynchroService {
setUrl() {
- let header ={
- id:'1234',
+ let header = {
+ id: '1234',
bluePrint: '12312123',
jwt: uuidv4()
}
- let wss: wss ={
+ let wss: wss = {
header,
url: 'wss://sychro-offline.herokuapp.com/ws/some_url/',
type: 'reflect'
@@ -61,7 +63,7 @@ class SynchroService {
this.url = `${wss.url}${wss.header.id}/${wss.header.jwt}/${wss.header.bluePrint}/${this.id}/`
}
- registerCallback(type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notifications' | 'Notification', funx: Function, object='') {
+ registerCallback(type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notifications' | 'Notification', funx: Function, object = '') {
this.callBacks.push({
type,
funx,
@@ -69,32 +71,32 @@ class SynchroService {
})
}
- connect() {
+ connect() {
- this.connection = new WebSocket(this.url);
- // bind function
- this.connection.onopen = this.onopen;
- this.connection.onmessage = this.onmessage;
- this.connection.onclose = this.onclose;
- this.connection.onerror = this.onerror;
- }
+ this.connection = new WebSocket(this.url);
+ // bind function
+ this.connection.onopen = this.onopen;
+ this.connection.onmessage = this.onmessage;
+ this.connection.onclose = this.onclose;
+ this.connection.onerror = this.onerror;
+ }
- private onopen = () =>{
-
-
-
- if(!this.conected) {
-
+ private onopen = () => {
+
+
+
+ //if (this._connected === true) {
this.BackgroundService.online()
- this.callBacks.forEach((e)=>{
- if(e.type == 'Online') {
+ console.log('Online', this._connected)
+ this.callBacks.forEach((e) => {
+ if (e.type == 'Online') {
e.funx()
}
})
-
- }
+ //}
console.log('open ======================= welcome to socket server')
+
this._connected = true
// send all saved data due to internet connection
@@ -103,20 +105,20 @@ class SynchroService {
object.splice(index, 1);
})
- }
+ }
public $send(object: any) {
- if(!this._connected) { // save data to send when back online
+ if (!this._connected) { // save data to send when back online
this.msgQueue.push(object)
}
- let payload = {
+ let payload = {
message: JSON.stringify(object) || '{"person.adress.country":"1Angola"}',
username: SessionStore.user.FullName,
idConnection: this.id
}
-
+
let sendData = JSON.stringify(payload);
console.log(sendData)
@@ -124,7 +126,7 @@ class SynchroService {
this.connection.send(sendData);
}
- private onmessage = async (event: any)=> {
+ private onmessage = async (event: any) => {
let data = JSON.parse(event.data)
@@ -133,30 +135,30 @@ class SynchroService {
const idConnection = payload.idConnection
const username = payload.username
- if(idConnection != this.id ) {
-
- if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {}
+ if (idConnection != this.id) {
+
+ if (window['platform'].is('desktop') || this.platform.is('mobileweb')) { }
else return false
- if(environment.production) return false
+ if (environment.production) return false
- this.callBacks.forEach((e)=> {
+ this.callBacks.forEach((e) => {
- if(payload.message[0]) {
- if(payload.message[0].Service && payload.message[0].Object && payload.message[0].IdObject) {
- if(e.type == '' && !e.object) {
- if(username == SessionStore.user.FullName) {
+ if (payload.message[0]) {
+ if (payload.message[0].Service && payload.message[0].Object && payload.message[0].IdObject) {
+ if (e.type == '' && !e.object) {
+ if (username == SessionStore.user.FullName) {
e.funx(payload.message, data)
}
}
-
- if(e.type == 'Notifications' ) {
+
+ if (e.type == 'Notifications') {
e.funx(payload.message, data)
}
-
+
}
- } else if(payload.message.Service && payload.message.Object && payload.message.IdObject) {
- if(e.type == 'Notification' && e.object == payload.message.Object || e.type == 'Notification' && e.object == 'any' ) {
+ } else if (payload.message.Service && payload.message.Object && payload.message.IdObject) {
+ if (e.type == 'Notification' && e.object == payload.message.Object || e.type == 'Notification' && e.object == 'any') {
e.funx(payload.message, data)
}
}
@@ -165,41 +167,44 @@ class SynchroService {
}
this.callback()
- }
+ }
- private onclose=(event:any)=> {
- setTimeout(() => {
- if (event.wasClean) {
- console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
- } else {
- // e.g. server process killed or network down
- // event.code is usually 1006 in this case
- console.log('[close] Connection died');
+ private onclose = (event: any) => {
+ console.log('Websocket close')
+ setTimeout(() => {
+ if (event.wasClean) {
+ console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
+ } else {
+ // e.g. server process killed or network down
+ // event.code is usually 1006 in this case
+ console.log('[close] Connection died');
console.log('Reconnect')
-
- if(this._connected) {
+
+ // if (this._connected === false) {
this.BackgroundService.offline();
- this.callBacks.forEach((e)=>{
- if(e.type == 'Offline') {
+ console.log('Offline', this._connected)
+ this.callBacks.forEach((e) => {
+ if (e.type == 'Offline') {
e.funx()
}
})
- }
+ //}
+
// status
this._connected = false
// reconnect
this.connect()
-
- }
- }, 100);
- }
- private onerror=(event: any)=>{
- console.log(`[error] ${event.message}`);
- }
+ }
+ }, 100);
+ }
+
+ private onerror = (event: any) => {
+ console.log(`[error] ${event.message}`);
+ }
}
diff --git a/src/app/services/sqlite.service.spec.ts b/src/app/services/sqlite.service.spec.ts
new file mode 100644
index 000000000..033257edb
--- /dev/null
+++ b/src/app/services/sqlite.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { SqliteService } from './sqlite.service';
+
+describe('SqliteService', () => {
+ let service: SqliteService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(SqliteService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/services/sqlite.service.ts b/src/app/services/sqlite.service.ts
new file mode 100644
index 000000000..8dc23a568
--- /dev/null
+++ b/src/app/services/sqlite.service.ts
@@ -0,0 +1,491 @@
+import { Injectable } from '@angular/core';
+import { Platform } from '@ionic/angular';
+import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class SqliteService {
+
+ private dbInstance: SQLiteObject;
+ readonly db_name: string = "gabinetedigital.db";
+ readonly events: string = "Events";
+ readonly expedientes: string = "Expedientes";
+ readonly allprocess: string = "ALLPROCESS";
+ readonly actions: string = "ACTIONS";
+ readonly publications: string = "PUBLICATIONS";
+ EVENTS: Array;
+ EXPEDIENTES: Array;
+ ALLPROCESS: Array;
+ PROCESS: Array;
+ ALLACTIONS: Array;
+
+ constructor(private platform: Platform,
+ private sqlite: SQLite) {
+ this.databaseConn();
+ }
+
+ databaseConn() {
+ this.platform.ready().then(async () => {
+ await this.sqlite.create({
+ name: this.db_name,
+ location: 'default'
+ }).then(async (sqLite: SQLiteObject) => {
+ this.dbInstance = sqLite;
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.events} (
+ EventId varchar(255) PRIMARY KEY,
+ Subject varchar(255),
+ HasAttachments BIT,
+ Location varchar(255),
+ CalendarId varchar(255),
+ CalendarName varchar(255),
+ StartDate varchar(255),
+ EndDate varchar(255),
+ EventType varchar(255),
+ Attendees Text,
+ IsMeeting BIT,
+ IsRecurring BIT,
+ IsAllDayEvent BIT,
+ AppointmentState INTERGER,
+ TimeZone varchar(255),
+ Organizer Text,
+ Category varchar(255),
+ EventRecurrence Text,
+ Attachments Text,
+ Body Text,
+ Profile varchar(255),
+ HumanDate varchar(255)
+ )`, [])
+ .then((res) => {
+ console.log("Sucess Events Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.expedientes} (
+ serialNumber varchar(255) PRIMARY KEY,
+ workflowInstanceFolio varchar(255),
+ Documents Text,
+ actions Text,
+ activityInstanceName varchar(255),
+ formURL varchar(255),
+ originator Text,
+ taskStartDate varchar(255),
+ totalDocuments INTERGER,
+ workflowDisplayName varchar(255),
+ workflowID INTERGER,
+ workflowInstanceDataFields Text,
+ workflowInstanceID INTERGER,
+ workflowName varchar(255)
+ )`, [])
+ .then((res) => {
+ console.log("Sucess Espedientes Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.allprocess} (
+ serialNumber varchar(255) PRIMARY KEY,
+ workflowInstanceFolio varchar(255),
+ Documents Text,
+ actions Text,
+ activityInstanceName varchar(255),
+ formURL varchar(255),
+ originator Text,
+ taskStartDate varchar(255),
+ totalDocuments INTERGER,
+ workflowDisplayName varchar(255),
+ workflowID INTERGER,
+ workflowInstanceDataFields Text,
+ workflowInstanceID INTERGER,
+ workflowName varchar(255),
+ interveners Text
+ )`, [])
+ .then((res) => {
+ console.log("Sucess AllProcess Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+
+ await sqLite.executeSql(`
+ CREATE TABLE IF NOT EXISTS ${this.actions} (
+ ProcessId INTERGER PRIMARY KEY,
+ ActionType varchar(255),
+ DateBegin varchar(255),
+ DateEnd varchar(255),
+ Detail varchar(255),
+ Description varchar(255),
+ publications Text
+ )`, [])
+ .then((res) => {
+ console.log("Sucess action Table created: ", res)
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+ })
+ .catch((error) => console.log(JSON.stringify(error)));
+ });
+ }
+
+ //addactions
+ public addactions(data) {
+ console.log('Action insert', data)
+ this.dbInstance.executeSql(`
+ INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications)
+ VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}')`, [])
+ .then(() => {
+ console.log("action add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+ //addEvent
+ public addEvent(data) {
+ this.dbInstance.executeSql(`
+ INSERT OR IGNORE INTO ${this.events} (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile,HumanDate )
+ VALUES ('${data.EventId}','${data.Subject}','${data.HasAttachments}','${data.Location}','${data.CalendarId}','${data.CalendarName}','${data.StartDate}','${data.EndDate}','${data.EventType}','${data.Attendees}','${data.IsMeeting}','${data.IsRecurring}',
+ '${data.IsAllDayEvent}','${data.AppointmentState}','${data.TimeZone}','${data.Organizer}','${data.Category}','${data.EventRecurrence}','${data.Attachments}','${data.Body}','${data.Profile}','${data.HumanDate}')`, [])
+ .then(() => {
+ console.log("event add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e));
+ });
+ }
+
+ //addExpediente
+ public addExpediente(data) {
+ this.dbInstance.executeSql(`
+ INSERT OR REPLACE INTO ${this.expedientes} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
+ VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${data.Documents}','${data.actions}','${data.activityInstanceName}','${data.formURL}','${data.originator}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
+ '${data.workflowInstanceDataFields}','${data.workflowInstanceID}','${data.workflowName}')`, [])
+ .then(() => {
+ console.log("expediente add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+ //addprocess
+ public addProcess(data) {
+ this.dbInstance.executeSql(`
+ INSERT OR IGNORE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
+ VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
+ '${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
+ .then(() => {
+ console.log("process add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+ //updateActions
+ public updateactions(id,data) {
+ console.log("update action data", data )
+ this.dbInstance.executeSql(`
+ UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`,[data])
+ .then(() => {
+ console.log("action update with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+
+ //updateprocess
+ public updateProcess(data) {
+ this.dbInstance.executeSql(`
+ INSERT OR REPLACE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
+ VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
+ '${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
+ .then(() => {
+ console.log("process add with Success");
+
+ }, (e) => {
+ console.log(JSON.stringify(e.err));
+ });
+ }
+
+ //updateAttachment
+ updateUser(id, document,) {
+ let data = [document];
+ return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET Documents = ? WHERE serialNumber = ${id}`, [document]).then(() => {
+ console.log("process attachment updated")
+ })
+ }
+ //updateAttachment
+ updateProcessInterveners(id, interveners,) {
+ let data = [document];
+ return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET interveners = ? WHERE serialNumber = ${id}`, [interveners]).then(() => {
+ console.log("process interveners updated")
+ })
+ }
+ //getAllEvents
+ getAllEvents() {
+ var hashattachment = false;
+ var ismeeting = false;
+ var isrecurring = false;
+ var isallday = false;
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.events}`, []).then((res) => {
+ this.EVENTS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ if (res.rows.item(i).HasAttachments === "true") {
+ hashattachment = true
+ }
+ if (res.rows.item(i).IsMeeting === "true") {
+ ismeeting = true
+ }
+ if (res.rows.item(i).IsRecurring === "true") {
+ isrecurring = true
+ }
+ if (res.rows.item(i).IsAllDayEvent === "true") {
+ isallday = true
+ }
+ let event = {
+ EventId: res.rows.item(i).EventId,
+ HasAttachments: hashattachment,
+ Subject: res.rows.item(i).Subject,
+ Location: res.rows.item(i).Location,
+ CalendarId: res.rows.item(i).CalendarId,
+ CalendarName: res.rows.item(i).CalendarName,
+ StartDate: res.rows.item(i).StartDate,
+ EndDate: res.rows.item(i).EndDate,
+ EventType: res.rows.item(i).EventType,
+ Attendees: res.rows.item(i).Attendees,
+ IsMeeting: ismeeting,
+ IsRecurring: isrecurring,
+ IsAllDayEvent: isallday,
+ AppointmentState: res.rows.item(i).AppointmentState,
+ TimeZone: res.rows.item(i).TimeZone,
+ Organizer: res.rows.item(i).Organizer,
+ Category: res.rows.item(i).Category,
+ EventRecurrence: res.rows.item(i).EventRecurrence,
+ Attachments: res.rows.item(i).Attachments,
+ Profile: res.rows.item(i).Profile,
+ HumanDate: res.rows.item(i).HumanDate
+
+ }
+ this.EVENTS.push(event);
+ }
+
+ return this.EVENTS;
+ }
+ }, (e) => {
+ console.log(" Get all events error", JSON.stringify(e));
+ });
+ }
+
+ getAllExpedientes() {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.expedientes}`, []).then((res) => {
+ this.EXPEDIENTES = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.EXPEDIENTES.push(res.rows.item(i));
+ }
+ return this.EXPEDIENTES;
+ }
+ }, (e) => {
+ console.log(" Get all expedientes error", JSON.stringify(e));
+ });
+ }
+
+ getAllProcess() {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess}`, []).then((res) => {
+ this.ALLPROCESS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLPROCESS.push(res.rows.item(i));
+ }
+ return this.ALLPROCESS;
+ }
+ }, (e) => {
+ console.log(" Get all process error", JSON.stringify(e));
+ });
+ }
+
+ //getAllAtions
+ getAllActions() {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.actions}`, []).then((res) => {
+ this.ALLACTIONS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLACTIONS.push(res.rows.item(i));
+ }
+ return this.ALLACTIONS;
+ }
+ }, (e) => {
+ console.log(" Get all actions error", JSON.stringify(e));
+ });
+ }
+ //getlistOfEventAprove
+ getListOfEventAprove(process, type) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, type]).then((res) => {
+ this.ALLPROCESS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLPROCESS.push(res.rows.item(i));
+ }
+ return this.ALLPROCESS;
+ }
+ }, (e) => {
+ console.log(" Get all process error", JSON.stringify(e));
+ });
+ }
+
+ //getDespachosProcess
+ getDespachosProcess(process) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE activityInstanceName = ?`, [process]).then((res) => {
+ this.ALLPROCESS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLPROCESS.push(res.rows.item(i));
+ }
+ return this.ALLPROCESS;
+ }
+ }, (e) => {
+ console.log(" Get all process error", JSON.stringify(e));
+ });
+ }
+
+ //getprocessByworkflow
+ getprocessByworkflow(process) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? `, [process]).then((res) => {
+ this.ALLPROCESS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLPROCESS.push(res.rows.item(i));
+ }
+ return this.ALLPROCESS;
+ }
+ }, (e) => {
+ console.log(" Get all process error", JSON.stringify(e));
+ });
+ }
+
+ //getprocessByworkflowpedido
+ getprocessByworkflowpedido(process, process2) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, process2]).then((res) => {
+ this.ALLPROCESS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLPROCESS.push(res.rows.item(i));
+ }
+ return this.ALLPROCESS;
+ }
+ }, (e) => {
+ console.log(" Get all process error", JSON.stringify(e));
+ });
+ }
+
+ getProcessById(serial) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE serialNumber = ? `, [serial]).then((res) => {
+ this.PROCESS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.PROCESS.push(res.rows.item(i))
+ }
+ return this.PROCESS;
+ }
+ }, (e) => {
+ console.log(" Get process by serial error", JSON.stringify(e));
+ });
+ }
+
+ //getActionById
+ getActionById(id) {
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.actions} WHERE ProcessId = ? `, [id]).then((res) => {
+ this.ALLACTIONS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ this.ALLACTIONS.push(res.rows.item(i))
+ }
+ return this.ALLACTIONS;
+ }
+ }, (e) => {
+ console.log(" Get actions by processId error", JSON.stringify(e));
+ });
+ }
+
+ //getEventBy id
+ getEventById(id) {
+
+ var hashattachment = false;
+ var ismeeting = false;
+ var isrecurring = false;
+ var isallday = false;
+ var body;
+ var attendes;
+ var organizer;
+ var eventrecurrence;
+ var attachment;
+
+ return this.dbInstance.executeSql(`SELECT * FROM ${this.events} WHERE EventId = ? `, [id]).then((res) => {
+ this.EVENTS = [];
+ if (res.rows.length > 0) {
+ for (var i = 0; i < res.rows.length; i++) {
+ if (res.rows.item(i).HasAttachments === "true") {
+ hashattachment = true
+ }
+ if (res.rows.item(i).IsMeeting === "true") {
+ ismeeting = true
+ }
+ if (res.rows.item(i).IsRecurring === "true") {
+ isrecurring = true
+ }
+ if (res.rows.item(i).IsAllDayEvent === "true") {
+ isallday = true
+ }
+ /* if (res.rows.item(i).Body != "") {
+ body = JSON.parse(res.rows.item(i).Body);
+ }
+ if (res.rows.item(i).Attendees !="") {
+ attendes = JSON.parse(res.rows.item(i).Attendees);
+ }
+ if(res.rows.item(i).Organizer !=""){
+ organizer = JSON.parse(res.rows.item(i).Organizer);
+ }
+ if(res.row.item(i).EventRecurrence != ""){
+ eventrecurrence = JSON.parse(res.row.item(i).EventRecurrence);
+ }
+ if(res.row.item(i).Attachments != ""){
+ attachment = JSON.parse(res.row.item(i).Attachments);
+ }
+ */
+
+ let event = {
+ EventId: res.rows.item(i).EventId,
+ HasAttachments: hashattachment,
+ Subject: res.rows.item(i).Subject,
+ Location: res.rows.item(i).Location,
+ CalendarId: res.rows.item(i).CalendarId,
+ CalendarName: res.rows.item(i).CalendarName,
+ StartDate: res.rows.item(i).StartDate,
+ EndDate: res.rows.item(i).EndDate,
+ EventType: res.rows.item(i).EventType,
+ Attendees: res.rows.item(i).Attendees,
+ IsMeeting: ismeeting,
+ IsRecurring: isrecurring,
+ IsAllDayEvent: isallday,
+ Body: res.rows.item(i).Body,
+ AppointmentState: res.rows.item(i).AppointmentState,
+ TimeZone: res.rows.item(i).TimeZone,
+ Organizer: res.rows.item(i).Organizer,
+ Category: res.rows.item(i).Category,
+ EventRecurrence: res.rows.item(i).EventRecurrence,
+ Attachments: res.rows.item(i).Attachments
+ }
+ this.EVENTS.push(event);
+ }
+
+ return this.EVENTS;
+ }
+ }, (e) => {
+ console.log(" Get events by id error", JSON.stringify(e));
+ });
+ }
+}
diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts
index 01b132504..f5d8321b8 100644
--- a/src/app/services/webnotifications.service.ts
+++ b/src/app/services/webnotifications.service.ts
@@ -5,7 +5,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
-import { NavigationExtras,Router } from '@angular/router';
+import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from './toast.service';
import MFPPush from 'ibm-mfp-web-push';
@@ -31,13 +31,27 @@ export class WebNotificationsService {
webconnection() {
+ var inicializeObj = {
+ appId: "com.gpr.gabinetedigital",
+ mfpContextRoot: "/mfp",
+ /* serverUrl: "http://gpr-dev-10.gabinetedigital.local:9080",
+ safariWebsitePushId: "http://gpr-dev-10.gabinetedigital.local:9080", */
+ }
+
+
+ MFPPush.initialize({
+ appId: "com.gpr.gabinetedigital",
+ mfpContextRoot: "/mfp",
+ });
+
+
/* MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
}); */
- MFPPush.registerDevice()
+ /* MFPPush.registerDevice()
.then((res) => {
console.log("WEB Successfully Registered Device...");
@@ -55,17 +69,129 @@ export class WebNotificationsService {
})
.catch((err) => {
console.log("WEB Registration Failed" + err);
- });
+ }); */
}
-async onReceviNotificationWeb() {
+ register(){
+ MFPPush.registerDevice()
+ .then((res) => {
+ console.log("WEB Successfully Registered Device...", res);
+ })
+ .catch((err) => {
+ console.log("WEB Registration Failed" + err);
+ });
+ }
+
+ async onReceviNotificationWeb() {
+
+ if (window['WLAuthorizationManager']) {
+ if (window['WLAuthorizationManager'].obtainAccessToken) {
+ window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
+ (token) => {
+ console.log('Push Notification: Success ' + token);
+
+ MFPPush.initialize(
+ function (successResponse) {
+ console.log("Push notification Successfully intialized: " + successResponse);
+ MFPPush.registerNotificationsCallback(notificationReceived);
+ },
+ function (failureResponse) {
+ console.log("Push notification failure intialized: " + failureResponse);
+ }
+ );
+ var notificationReceived = (message) => {
+ console.log(message);
+ var data = JSON.parse(message.payload);
+ console.log(data.Service);
+ console.log(data.IdObject);
+ console.log(data.Object);
+
+ if (message.actionName) {
+ //this.notificatinsRoutes(data);
+ console.log("Web notification")
+ } else {
+ console.log("Web notification")
+ //this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
+ }
+
+ }
+ }, (error) => {
+ console.log('Push notification recived: failure ' + error.responseText);
+ console.log(JSON.stringify(error));
+ }
+ );
+ }
+ }
+
+
+ }
+
+ /* getTokenByUserIdAndId(user, userID) {
+ const geturl = environment.apiURL + 'notifications/user/' + userID;
+
+ return this.http.get(`${geturl}`);
+ } */
+
+ /* getAndpostToken(username) {
+ if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
+ console.log('Notifications not supported')
+ } else {
+
+ const geturl = environment.apiURL + 'notifications/token'; */
+ /*
+ window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
+ (token) => {
+ console.log('Push Notification: Success ' + token);
- if(window['WLAuthorizationManager']) {
- if(window['WLAuthorizationManager'].obtainAccessToken) {
+ MFPPush.initialize(
+ function (successResponse) {
+ console.log("Push notification Successfully Service intialized: " + successResponse);
+ },
+ function (failureResponse) {
+ console.log("Push notification failure Service intialized: " + failureResponse);
+ }
+ );
+
+ MFPPush.registerDevice(null, (successResponse) => {
+ console.log("Successfully registered: " + JSON.stringify(successResponse));
+ console.log('token: ', successResponse.deviceId)
+ this.storageService.store(username, successResponse.deviceId);
+ this.storageService.get(username).then(value => {
+ console.log('STORAGE TOKEN', value)
+ this.storageService.get(AuthConnstants.USER).then(res => {
+ console.log('USERID', res);
+ const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
+ const body = {
+ UserId: res.UserId,
+ TokenId: successResponse.deviceId,
+ Status: 1,
+ Service: 1
+ };
+ this.http.post(`${geturl}`, body, { headers }).subscribe(data => {
+ console.log('TOKEN USER MIDLE', data);
+ })
+ });
+
+ });
+ },
+ function (failureResponse) {
+ console.log("Successfully failue: " + JSON.stringify(failureResponse));
+ }
+ );
+ }, (error) => {
+ console.log('Push notification recived: failure ' + error.responseText);
+ console.log(JSON.stringify(error));
+ }
+ );
+ }
+
+ } */
+ /*
+ async onReceviNotification() {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
-
+
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
@@ -81,122 +207,20 @@ async onReceviNotificationWeb() {
console.log(data.Service);
console.log(data.IdObject);
console.log(data.Object);
-
+
if(message.actionName){
- //this.notificatinsRoutes(data);
- console.log("Web notification")
+ this.notificatinsRoutes(data);
} else {
- console.log("Web notification")
- //this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
+ this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
-
+
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
- }
- }
-
-
-}
-
- /* getTokenByUserIdAndId(user, userID) {
- const geturl = environment.apiURL + 'notifications/user/' + userID;
-
- return this.http.get(`${geturl}`);
- } */
-
- /* getAndpostToken(username) {
- if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
- console.log('Notifications not supported')
- } else {
-
- const geturl = environment.apiURL + 'notifications/token'; */
-/*
- window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
- (token) => {
- console.log('Push Notification: Success ' + token);
-
- MFPPush.initialize(
- function (successResponse) {
- console.log("Push notification Successfully Service intialized: " + successResponse);
- },
- function (failureResponse) {
- console.log("Push notification failure Service intialized: " + failureResponse);
- }
- );
-
- MFPPush.registerDevice(null, (successResponse) => {
- console.log("Successfully registered: " + JSON.stringify(successResponse));
- console.log('token: ', successResponse.deviceId)
- this.storageService.store(username, successResponse.deviceId);
- this.storageService.get(username).then(value => {
- console.log('STORAGE TOKEN', value)
- this.storageService.get(AuthConnstants.USER).then(res => {
- console.log('USERID', res);
- const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
- const body = {
- UserId: res.UserId,
- TokenId: successResponse.deviceId,
- Status: 1,
- Service: 1
- };
- this.http.post(`${geturl}`, body, { headers }).subscribe(data => {
- console.log('TOKEN USER MIDLE', data);
- })
- });
-
- });
- },
- function (failureResponse) {
- console.log("Successfully failue: " + JSON.stringify(failureResponse));
- }
- );
- }, (error) => {
- console.log('Push notification recived: failure ' + error.responseText);
- console.log(JSON.stringify(error));
- }
- );
- }
-
- } */
-/*
- async onReceviNotification() {
- window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
- (token) => {
- console.log('Push Notification: Success ' + token);
-
- MFPPush.initialize(
- function (successResponse) {
- console.log("Push notification Successfully intialized: " + successResponse);
- MFPPush.registerNotificationsCallback(notificationReceived);
- },
- function (failureResponse) {
- console.log("Push notification failure intialized: " + failureResponse);
- }
- );
- var notificationReceived = (message) => {
- console.log(message);
- var data = JSON.parse(message.payload);
- console.log(data.Service);
- console.log(data.IdObject);
- console.log(data.Object);
-
- if(message.actionName){
- this.notificatinsRoutes(data);
- } else {
- this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
- }
-
- }
- }, (error) => {
- console.log('Push notification recived: failure ' + error.responseText);
- console.log(JSON.stringify(error));
- }
- );
- } */
+ } */
/* notificatinsRoutes = (data) => {
if (data.Service === "agenda") {
diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts
index 9d98fdbd3..5192c9e93 100644
--- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts
+++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts
@@ -4,6 +4,9 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
+import { SqliteService } from '../../../services/sqlite.service';
+import { synchro } from '../../../services/socket/synchro.service';
+import { Platform } from '@ionic/angular';
@Component({
selector: 'app-all-processes',
@@ -13,29 +16,24 @@ import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
export class AllProcessesPage implements OnInit {
skeletonLoader = true;
- allProcessesList:any[] = [];
+ allProcessesList: any[] = [];
loggeduser: LoginUserRespose;
+ synch = synchro;
+
constructor(
private processesService: ProcessesService,
private router: Router,
private authService: AuthService,
+ private sqliteservice: SqliteService,
+ private platform: Platform
) {
this.loggeduser = authService.ValidatedUser;
- }
+ }
ngOnInit() {
- this.loadAllProcesses();
- this.router.events.forEach((event) => {
- if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
- if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
- this.refreshing();
- } else {
- this.loadAllProcesses();
- }
- }
- });
+ this.getAllProcessFromDB()
}
doRefresh() {
@@ -52,9 +50,10 @@ export class AllProcessesPage implements OnInit {
}, 1000);
}
- async loadAllProcesses(){
- let allProcessesList = await this.processesService.GetTasksList("", false).toPromise();
+ async loadAllProcesses() {
+ let allProcessesList = await this.processesService.GetTasksList("", false).toPromise();
console.log(allProcessesList);
+ this.addProcessToDB(allProcessesList)
this.skeletonLoader = true;
@@ -63,7 +62,8 @@ export class AllProcessesPage implements OnInit {
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
- let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
+
let task = {
"SerialNumber": element.serialNumber,
@@ -82,104 +82,185 @@ export class AllProcessesPage implements OnInit {
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
- this.allProcessesList.push(task);
- this.allProcessesList = removeDuplicate( this.allProcessesList)
- this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
+ this.allProcessesList.push(task);
+ this.allProcessesList = removeDuplicate(this.allProcessesList)
+ this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
+
});
this.skeletonLoader = false;
}
- sortArrayISODate(myArray: any){
- return myArray.sort(function(a, b) {
+
+ addProcessToDB(data) {
+
+ data.forEach(element => {
+
+ let process = {
+ "serialNumber": element.serialNumber,
+ "workflowInstanceFolio": element.workflowInstanceFolio,
+ "Documents": element.Documents,
+ "actions": element.actions,
+ "activityInstanceName": element.activityInstanceName,
+ "formURL": element.formURL,
+ "originator": element.originator,
+ "taskStartDate": element.taskStartDate,
+ "totalDocuments": element.totalDocuments,
+ "workflowDisplayName": element.workflowDisplayName,
+ "workflowID": element.workflowID,
+ "workflowInstanceDataFields": element.workflowInstanceDataFields,
+ "workflowInstanceID": element.workflowInstanceID,
+ "workflowName": element.workflowName
+ }
+
+ this.sqliteservice.addProcess(process);
+ });
+
+ }
+
+ getAllProcessFromDB() {
+
+ if(synchro.connected === true) {
+ this.loadAllProcesses();
+
+ this.router.events.forEach((event) => {
+ if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital')) {
+ if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
+ this.refreshing();
+ } else {
+ this.loadAllProcesses();
+ }
+ }
+ });
+ } else {
+ this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
+ allprocess.forEach(element => {
+ let date = new Date(element.taskStartDate);
+ date.setMonth(date.getMonth() + 1);
+ let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
+
+ var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
+
+ let task = {
+ "SerialNumber": element.serialNumber,
+ "Folio": workflowInstanceDataFields.Subject,
+ "Senders": workflowInstanceDataFields.Sender,
+ "CreateDate": taskDate,
+ "DocumentURL": workflowInstanceDataFields.ViewerRequest,
+ "Remetente": workflowInstanceDataFields.Remetente,
+ "DocumentsQty": element.totalDocuments,
+ "DocId": workflowInstanceDataFields.DispatchDocId,
+ "FolderID": workflowInstanceDataFields.FolderID,
+ "WorkflowName": element.workflowDisplayName,
+ "activityInstanceName": element.activityInstanceName,
+ "Status": workflowInstanceDataFields.Status,
+ "Agenda": workflowInstanceDataFields.Agenda,
+ "customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
+ }
+
+ this.allProcessesList.push(task);
+ this.allProcessesList = removeDuplicate(this.allProcessesList)
+ this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
+
+ });
+
+
+
+ this.allProcessesList = allprocess;
+ console.log("All process from db ", allprocess)
+ })
+ }
+ }
+
+ sortArrayISODate(myArray: any) {
+ return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
});
}
- setFormatDate(start:any, end:any, allday:boolean){
+ setFormatDate(start: any, end: any, allday: boolean) {
let customDate;
/* start = new Date();
end= new Date("2021-08-04T18:01:04.753Z"); */
//end = new Date("2021-09-04T18:01:04.753Z");
- 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);
let diffDays = totalDays;
let diffMinutes = minutes;
- if(totalDays == 0) {
- if(allday) {
- customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" (todo dia)";
+ if (totalDays == 0) {
+ if (allday) {
+ customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
console.log(customDate);
return customDate;
}
- else
- {
+ else {
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
- customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" | "+this.getCustomHours(end);
+ customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
return customDate;
}
}
- else{
- customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+
- " (termina:"+ this.getCustomDate(end)+","+this.getCustomHours(end)+")";
+ else {
+ customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
+ " (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
return customDate;
}
}
- getCustomDate(thedate: Date){
- return (thedate.getDay()+1) + "/" +
- (thedate.getMonth()+1) + "/" +
- thedate.getFullYear();
+ getCustomDate(thedate: Date) {
+ return (thedate.getDay() + 1) + "/" +
+ (thedate.getMonth() + 1) + "/" +
+ thedate.getFullYear();
}
- getCustomHours(thedate: Date){
+ getCustomHours(thedate: Date) {
return thedate.getHours() + ":" +
- thedate.getMinutes();
+ thedate.getMinutes();
}
- goToProcess(serialNumber:string, workflowName:string, activityName:string){
- if(workflowName == 'Despacho') {
- if(activityName == 'Tarefa de Despacho'|| activityName == 'Concluir Despacho'){
- this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
+ goToProcess(serialNumber: string, workflowName: string, activityName: string) {
+ if (workflowName == 'Despacho') {
+ if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
+ this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
}
}
- else if(workflowName == 'Despacho do Presidente da República') {
- if(activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho'){
- this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Despacho do Presidente da República') {
+ if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
+ this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
}
- else if(activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma'){
- this.router.navigate(['/home/gabinete-digital/diplomas',serialNumber,'gabinete-digital']);
+ else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
+ this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
}
- else if(activityName == 'Diploma Assinado'){
- this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']);
+ else if (activityName == 'Diploma Assinado') {
+ this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
}
}
- else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
- this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
+ this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
}
- else if(workflowName == 'Expediente') {
- this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Expediente') {
+ this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
}
- else if(workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
- this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']);
+ else if (workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
+ this.router.navigate(['/home/gabinete-digital/expedientes-pr', serialNumber, 'gabinete-digital']);
}
else if (workflowName == "Pedido de Parecer do Presidente") {
- this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
+ this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
}
/* else if (workflowName == "Expediente") {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
} */
- else if(workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
- this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital']);
+ else if (workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
+ this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
}
- else {
+ else {
console.log('cant find page for this task')
}
}
diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts
index a0e0c561e..31ccac939 100644
--- a/src/app/shared/header/header.page.ts
+++ b/src/app/shared/header/header.page.ts
@@ -8,6 +8,7 @@ import { StorageService } from '../../services/storage.service';
import { SessionStore } from 'src/app/store/session.service';
import { NotificationsService } from '../../services/notifications.service';
import { environment } from 'src/environments/environment';
+import { EventTrigger } from '../../services/eventTrigger.service';
@Component({
selector: 'app-header',
@@ -33,7 +34,8 @@ export class HeaderPage implements OnInit {
private animationController: AnimationController,
private storageservice: StorageService,
private platform: Platform,
- private notificationsService: NotificationsService,
+ private notificationsService: NotificationsService,
+ private eventrigger: EventTrigger
) {
this.loggeduser = SessionStore.user;
router.events.subscribe((val) => {
@@ -46,12 +48,20 @@ export class HeaderPage implements OnInit {
this.hideSearch();
this.notificationLengthData();
- if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
+ /* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
this.UpdateNotificationCount();
} else {
this.UpdateNotificationCount();
- }
+ } */
+
+ this.eventrigger.getObservable().subscribe((data)=>{
+ if(data.notification == "delete" || "recive"){
+ this.notificationLengthData();
+ console.log('Deleted notification',data )
+ }
+
+ })
}
diff --git a/src/assets/js/MFPPushServiceWorker.js b/src/assets/MFPPushServiceWorker.js
similarity index 100%
rename from src/assets/js/MFPPushServiceWorker.js
rename to src/assets/MFPPushServiceWorker.js
diff --git a/src/assets/json/manifest.json b/src/assets/manifest.json
similarity index 100%
rename from src/assets/json/manifest.json
rename to src/assets/manifest.json
diff --git a/src/index.html b/src/index.html
index 2cc52887a..7ec5e3daf 100644
--- a/src/index.html
+++ b/src/index.html
@@ -10,12 +10,16 @@
+
+
+