mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -138,7 +138,7 @@
|
||||
|
||||
<calendar
|
||||
class="calendar-component"
|
||||
[eventSource]="CalendarStore.eventSource"
|
||||
[eventSource]="listToPresent"
|
||||
[calendarMode]="calendar.mode"
|
||||
[currentDate]="calendar.currentDate"
|
||||
(onEventSelected)="onEventSelected($event)"
|
||||
|
||||
+292
-201
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AlertController, ModalController, PopoverController } from '@ionic/angular';
|
||||
import { AlertController, ModalController, PopoverController, Platform } from '@ionic/angular';
|
||||
import { EventBody } from 'src/app/models/eventbody.model';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
@@ -12,6 +12,8 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
|
||||
import { Location } from '@angular/common'
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
|
||||
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
|
||||
import { ExpedientTaskModalPage } from '../../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
|
||||
@@ -46,6 +48,7 @@ export class ViewEventPage implements OnInit {
|
||||
dicIndex = 0;
|
||||
isModal = false
|
||||
header = true
|
||||
synch = synchro;
|
||||
task: ExpedientTaskModalPageNavParamsTask;
|
||||
LoadedDocument:any = null;
|
||||
|
||||
@@ -61,7 +64,11 @@ export class ViewEventPage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
private toastService: ToastService,
|
||||
private location: Location
|
||||
private location: Location,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService
|
||||
|
||||
|
||||
)
|
||||
{
|
||||
this.isEventEdited = false;
|
||||
@@ -93,9 +100,23 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(synchro.connected === true) {
|
||||
this.loadEvent();
|
||||
console.log('Onlineee view-event')
|
||||
} else {
|
||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
this.loadedEvent = event[0];
|
||||
console.log("Event ditails local,", event[0])
|
||||
})
|
||||
console.log('Offlineee')
|
||||
}
|
||||
|
||||
this.loadEvent();
|
||||
|
||||
/* this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
this.loadedEvent = event[0];
|
||||
console.log("Event ditails local,", event[0])
|
||||
})
|
||||
this.loadEvent(); */
|
||||
|
||||
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
@@ -137,6 +158,8 @@ export class ViewEventPage implements OnInit {
|
||||
const loader = this.toastService.loading();
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
this.loadedEvent = res;
|
||||
this.sqliteservice.addEvent(res);
|
||||
console.log('Loaded one event', res)
|
||||
/* this.today = new Date(res.StartDate);
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
|
||||
loader.remove()
|
||||
@@ -356,4 +379,26 @@ export class ViewEventPage implements OnInit {
|
||||
modal.onDidDismiss().then( async(res)=>{});
|
||||
|
||||
}
|
||||
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
console.log("event id details ", this.eventId)
|
||||
|
||||
synchro.registerCallback('Online', () => {
|
||||
this.loadEvent();
|
||||
console.log('Onlineee view-event')
|
||||
|
||||
})
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getEventById(this.eventId).then((event) => {
|
||||
this.loadedEvent = event[0];
|
||||
console.log("Event ditails local,", event[0])
|
||||
})
|
||||
console.log('Offlineee')
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,6 +504,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
|
||||
this.chatService.getRoomMessages(roomId).subscribe(async res => {
|
||||
console.log("Chat message",res)
|
||||
|
||||
|
||||
if (res == 502) {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
|
||||
<ion-list>
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of toDayEventStorage.eventsList"
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of listToPresent"
|
||||
(click)="goToEvent(event.EventId)"
|
||||
>
|
||||
<div class="d-flex content-{{loggeduser.Profile}}-{{event.CalendarName}}">
|
||||
@@ -90,7 +90,7 @@
|
||||
</div>
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
<ion-list>
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of expedienteGdStore.list"
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of listToPresentexpediente"
|
||||
(click)="goToExpediente(task.SerialNumber)">
|
||||
<div class="item-exp d-flex">
|
||||
<div class="schedule-date">
|
||||
|
||||
@@ -12,10 +12,13 @@ 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 { 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';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from '../../services/socket/synchro.service';
|
||||
import { BackgroundService } from 'src/app/services/background.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-events',
|
||||
@@ -29,16 +32,16 @@ export class EventsPage 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 = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||
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='';
|
||||
greetting = '';
|
||||
|
||||
timeDate = this.today.getHours() + ":" + this.today.getMinutes();
|
||||
/* Set segment variable */
|
||||
segment:string;
|
||||
public profile:string;
|
||||
segment: string;
|
||||
public profile: string;
|
||||
currentEvent: any;
|
||||
|
||||
eventsList: Event[];
|
||||
@@ -52,81 +55,97 @@ export class EventsPage implements OnInit {
|
||||
combinedEvents: Event[];
|
||||
|
||||
customText = false;
|
||||
totalEvent=0;
|
||||
totalEvent = 0;
|
||||
currentHoursMinutes: Date | string;
|
||||
|
||||
showLoader: boolean;
|
||||
|
||||
taskslist:DailyWorkTask[] = [];
|
||||
expedientList:any;
|
||||
hideSearchBtn: boolean=false;
|
||||
taskslist: DailyWorkTask[] = [];
|
||||
expedientList: any;
|
||||
hideSearchBtn: boolean = false;
|
||||
|
||||
// shared data
|
||||
toDayEventStorage = ToDayEventStorage
|
||||
expedienteGdStore = ExpedienteGdStore
|
||||
|
||||
|
||||
pdfSrc = "https://www.tabularium.pt/file-upload/FSovLiyEa8Hqy2iDA/TK-Justificativo.pdf";
|
||||
listToPresent = [];
|
||||
listToPresentexpediente =[]
|
||||
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
|
||||
@Output() openExpedientListPage:EventEmitter<any> = new EventEmitter<any>();
|
||||
@Output() openExpedientListPage: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
loggeduser: LoginUserRespose;
|
||||
|
||||
existingScreenOrientation: string;
|
||||
synch = synchro
|
||||
|
||||
constructor(
|
||||
private eventService: EventsService,
|
||||
private router: Router,
|
||||
private storageService:StorageService,
|
||||
private storageService: StorageService,
|
||||
public activatedRoute: ActivatedRoute,
|
||||
private alertController: AlertService,
|
||||
private authService: AuthService,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
/* private gabineteService: GabineteDigitalPage, */
|
||||
private modalController:ModalController,
|
||||
private modalController: ModalController,
|
||||
private screenOrientation: ScreenOrientation,
|
||||
public platform: Platform,
|
||||
) {
|
||||
this.existingScreenOrientation = this.screenOrientation.type;
|
||||
console.log(this.existingScreenOrientation);
|
||||
private sqliteservice: SqliteService,
|
||||
private backgroundservice: BackgroundService
|
||||
) {
|
||||
this.existingScreenOrientation = this.screenOrientation.type;
|
||||
console.log(this.existingScreenOrientation);
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
|
||||
this.prEventList = null;
|
||||
this.prEventList = null;
|
||||
|
||||
this.platform.resize.subscribe(async () => {
|
||||
//console.log('Resize event detected');
|
||||
// console.log('Resize event detected');
|
||||
this.platform.resize.subscribe(async () => {
|
||||
//console.log('Resize event detected');
|
||||
// console.log('Resize event detected');
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
try {
|
||||
this.sqliteservice.databaseConn();
|
||||
} catch (error) {
|
||||
console.log("Error creating local database: ", error)
|
||||
}
|
||||
} */
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.segment = "Combinada";
|
||||
this.profile = "mdgpr";
|
||||
|
||||
this.showGreeting();
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationEnd && event.url == '/home/events') {
|
||||
this.RefreshEvents();
|
||||
setTimeout(()=>{
|
||||
this.LoadList();
|
||||
}, 1500)
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == '/home/events') {
|
||||
this.RefreshEvents();
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1500)
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
}
|
||||
|
||||
this.getEventsFromLocalDb();
|
||||
|
||||
//this.checkScreenOrientation();
|
||||
|
||||
}
|
||||
|
||||
hideSearch(){
|
||||
if(this.router.url == '/home/events'){
|
||||
hideSearch() {
|
||||
if (this.router.url == '/home/events') {
|
||||
this.hideSearchBtn = true;
|
||||
}
|
||||
}
|
||||
@@ -142,28 +161,28 @@ export class EventsPage implements OnInit {
|
||||
}
|
||||
|
||||
// Lock to portrait
|
||||
lockToPortrait(){
|
||||
lockToPortrait() {
|
||||
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
|
||||
console.log('set');
|
||||
}
|
||||
|
||||
// Lock to landscape
|
||||
lockToLandscape(){
|
||||
// Lock to landscape
|
||||
lockToLandscape() {
|
||||
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
|
||||
}
|
||||
|
||||
// Unlock screen orientation
|
||||
unlockScreenOrientation(){
|
||||
// Unlock screen orientation
|
||||
unlockScreenOrientation() {
|
||||
this.screenOrientation.unlock();
|
||||
}
|
||||
|
||||
checkScreenOrientation(){
|
||||
if( window.innerWidth < 701) {
|
||||
checkScreenOrientation() {
|
||||
if (window.innerWidth < 701) {
|
||||
this.lockToPortrait();
|
||||
console.log('was here');
|
||||
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.unlockScreenOrientation();
|
||||
}
|
||||
}
|
||||
@@ -174,43 +193,60 @@ export class EventsPage implements OnInit {
|
||||
|
||||
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";
|
||||
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') {
|
||||
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);
|
||||
console.log("getAllMdOficialPessoalEvents", list)
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
if(list.length > 0) {
|
||||
list.forEach(element => {
|
||||
this.sqliteservice.addEvent(element)
|
||||
});
|
||||
}
|
||||
}
|
||||
this.listToPresent = list
|
||||
|
||||
this.toDayEventStorage.reset(list)
|
||||
|
||||
if(this.toDayEventStorage.eventsList.length > 0){
|
||||
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
|
||||
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
|
||||
|
||||
if (list.length > 0) {
|
||||
this.currentEvent = list[0].Subject;
|
||||
this.currentHoursMinutes = list[0].StartDate;
|
||||
}
|
||||
|
||||
this.totalEvent = this.toDayEventStorage.eventsList.length;
|
||||
this.totalEvent = list.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();
|
||||
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;
|
||||
console.log("getAllPrOficialPessoalEvents", list)
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
} else {
|
||||
if(list.length > 0) {
|
||||
list.forEach(element => {
|
||||
this.sqliteservice.addEvent(element)
|
||||
});
|
||||
}
|
||||
}
|
||||
if (list.length > 0) {
|
||||
this.currentEvent = list[0].Subject;
|
||||
this.currentHoursMinutes = list[0].StartDate;
|
||||
}
|
||||
|
||||
this.totalEvent = this.toDayEventStorage.eventsList.length;
|
||||
this.listToPresent = list;
|
||||
this.totalEvent = list.length;
|
||||
this.showLoader = false;
|
||||
|
||||
}
|
||||
@@ -286,47 +322,97 @@ export class EventsPage implements OnInit {
|
||||
} */
|
||||
}
|
||||
|
||||
showGreeting(){
|
||||
if(this.today.getHours() >= 6 && this.today.getHours() < 12){
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && event.url == '/home/events') {
|
||||
this.RefreshEvents();
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1500)
|
||||
}
|
||||
});
|
||||
this.hideSearch();
|
||||
} else {
|
||||
this.platform.ready().then(async () => {
|
||||
this.sqliteservice.getAllEvents().then((event:any[]) => {
|
||||
this.listToPresent = event
|
||||
this.totalEvent = this.listToPresent.length
|
||||
this.currentEvent = this.listToPresent[0].Subject
|
||||
this.currentHoursMinutes = this.listToPresent[0].StartDate
|
||||
console.log("All events from local,", event)
|
||||
})
|
||||
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[]) => {
|
||||
var expedientlist = [];
|
||||
process.forEach((element) => {
|
||||
let task = {
|
||||
CreateDate: element.taskStartDate,
|
||||
DocumentsQty: element.totalDocuments,
|
||||
Senders: JSON.parse(element.workflowInstanceDataFields).Sender,
|
||||
SerialNumber: element.serialNumber,
|
||||
Status: JSON.parse(element.workflowInstanceDataFields).Status,
|
||||
Subject: JSON.parse(element.workflowInstanceDataFields).Subject,
|
||||
WorkflowName: element.workflowDisplayName,
|
||||
activityInstanceName: element.activityInstanceName,
|
||||
taskStartDate: element.taskStartDate,
|
||||
}
|
||||
expedientlist.push(task);
|
||||
})
|
||||
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
|
||||
this.listToPresentexpediente = ExpedienteTask;
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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){
|
||||
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) */{
|
||||
else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */ {
|
||||
this.greetting = this.grettings[2];
|
||||
}
|
||||
}
|
||||
|
||||
gotTo(){
|
||||
gotTo() {
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
changeProfile(){
|
||||
if(this.profile == "mdgpr"){
|
||||
changeProfile() {
|
||||
if (this.profile == "mdgpr") {
|
||||
console.log('pr');
|
||||
this.profile ="pr";
|
||||
this.profile = "pr";
|
||||
this.RefreshEvents();
|
||||
}
|
||||
else{
|
||||
else {
|
||||
console.log('mdgpr');
|
||||
this.profile ="mdgpr";
|
||||
this.profile = "mdgpr";
|
||||
this.RefreshEvents();
|
||||
}
|
||||
}
|
||||
|
||||
logout()
|
||||
{
|
||||
logout() {
|
||||
this.authService.ValidatedUser.BasicAuthKey = "";
|
||||
this.router.navigate(['/home/login']);
|
||||
}
|
||||
|
||||
async openEventDetail1(id:any){
|
||||
async openEventDetail1(id: any) {
|
||||
console.log(id);
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EventDetailPage,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
eventId: id,
|
||||
},
|
||||
cssClass: 'event-detail',
|
||||
@@ -340,53 +426,63 @@ export class EventsPage implements OnInit {
|
||||
LoadList() {
|
||||
this.processes.GetTaskListExpediente(false).subscribe(result => {
|
||||
console.log("Expediente", result);
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
} else {
|
||||
this.sqliteservice.addProcess(result)
|
||||
}
|
||||
|
||||
const ExpedienteTask = result.map( e=> this.expedienteTaskPipe.transform(e))
|
||||
const ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e))
|
||||
|
||||
this.expedienteGdStore.reset(ExpedienteTask)
|
||||
console.log("Expediente 2", ExpedienteTask);
|
||||
|
||||
this.listToPresentexpediente = ExpedienteTask;
|
||||
});
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any){
|
||||
return myArray.sort(function(a, b) {
|
||||
sortArrayISODate(myArray: any) {
|
||||
return myArray.sort(function (a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
goToEvent(eventId:any){
|
||||
goToEvent(eventId: any) {
|
||||
this.router.navigate(['/home/events', eventId, 'events']);
|
||||
}
|
||||
|
||||
goToExpediente(SerialNumber:any) {
|
||||
if(this.loggeduser.Profile == 'MDGPR'){
|
||||
goToExpediente(SerialNumber: any) {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
|
||||
}
|
||||
else if(this.loggeduser.Profile == 'PR'){
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']);
|
||||
}
|
||||
}
|
||||
|
||||
viewExpedientListPage(){
|
||||
if(this.loggeduser.Profile == 'MDGPR'){
|
||||
if( window.innerWidth < 701){
|
||||
viewExpedientListPage() {
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/expediente']);
|
||||
}
|
||||
else{
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,} };
|
||||
else {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
}
|
||||
}
|
||||
else if(this.loggeduser.Profile == 'PR'){
|
||||
if( window.innerWidth < 701){
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
if (window.innerWidth < 701) {
|
||||
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
|
||||
}
|
||||
else{
|
||||
let navigationExtras: NavigationExtras = { queryParams: {"expedientes-pr": true,} };
|
||||
else {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "expedientes-pr": true, } };
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { Event } from '../../../../models/event.model';
|
||||
import { MenuController, ModalController, PopoverController } from '@ionic/angular';
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page';
|
||||
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
|
||||
@@ -20,6 +20,9 @@ import { Location } from '@angular/common'
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho-pr',
|
||||
templateUrl: './despacho-pr.page.html',
|
||||
@@ -29,7 +32,7 @@ export class DespachoPrPage 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;
|
||||
fulltask: any;
|
||||
@@ -52,34 +55,25 @@ export class DespachoPrPage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private despachoService: DespachoService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
this.serialNumber = params["params"].SerialNumber;
|
||||
}
|
||||
if(params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
private despachoService: DespachoService,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if (params["params"].SerialNumber) {
|
||||
this.serialNumber = params["params"].SerialNumber;
|
||||
}
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('DespachoPrPage SerialNumber', this.serialNumber)
|
||||
}
|
||||
console.log('DespachoPrPage SerialNumber', this.serialNumber)
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.profile = "mdgpr";
|
||||
console.log(this.serialNumber);
|
||||
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')) {
|
||||
return;
|
||||
}
|
||||
/* this.serialNumber = paramMap.get('SerialNumber'); */
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
});
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
this.getFromDB();
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -92,12 +86,12 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
|
||||
async LoadTaskDetail(serial: string) {
|
||||
this.processes.GetTask(serial).subscribe((res:fullTask) => {
|
||||
this.processes.GetTask(serial).subscribe((res: fullTask) => {
|
||||
this.task = {
|
||||
"SerialNumber": res.serialNumber,
|
||||
"Folio": res.workflowInstanceDataFields.Subject,
|
||||
"Senders": res.originator.email,
|
||||
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": res.workflowInstanceDataFields.Sender,
|
||||
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
|
||||
@@ -112,16 +106,20 @@ export class DespachoPrPage implements OnInit {
|
||||
console.log(this.task);
|
||||
|
||||
console.log('GetTask', res);
|
||||
this.sqliteservice.updateProcess(res)
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
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(this.task.FolderId).subscribe(users=>{
|
||||
this.intervenientes = users.filter(user=>{
|
||||
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
|
||||
console.log('internen despacho pr ')
|
||||
})
|
||||
this.intervenientes = users.filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
return user.Type == 'CC';
|
||||
}) || []
|
||||
|
||||
@@ -131,13 +129,13 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
});
|
||||
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if(error.status == 0) {
|
||||
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')
|
||||
@@ -146,6 +144,71 @@ export class DespachoPrPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if (synchro.connected === true) {
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')) {
|
||||
return;
|
||||
}
|
||||
/* this.serialNumber = paramMap.get('SerialNumber'); */
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
});
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
|
||||
} else {
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
|
||||
console.log('OFFLINE', process)
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
console.log("OFFLINE TASK", this.task)
|
||||
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(this.task);
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
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';
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
@@ -174,7 +237,7 @@ export class DespachoPrPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async executado(note:string, documents:any) {
|
||||
async executado(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Conhecimento",
|
||||
@@ -182,7 +245,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -191,7 +254,7 @@ export class DespachoPrPage implements OnInit {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
finally {
|
||||
@@ -200,7 +263,7 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async arquivar(note:string, documents:any){
|
||||
async arquivar(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Arquivo",
|
||||
@@ -208,7 +271,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -227,7 +290,7 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async generateDiploma(note:string, documents:any){
|
||||
async generateDiploma(note: string, documents: any) {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
@@ -249,7 +312,7 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async concluir(note:string, documents:any){
|
||||
async concluir(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Executado",
|
||||
@@ -257,7 +320,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -276,7 +339,7 @@ export class DespachoPrPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
async reexecutar(note:string, documents:any) {
|
||||
async reexecutar(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Reexecutar",
|
||||
@@ -284,7 +347,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -306,27 +369,27 @@ export class DespachoPrPage implements OnInit {
|
||||
return new Date(e).toDateString()
|
||||
}
|
||||
|
||||
sendExpedienteToPending(){
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
|
||||
sendExpedienteToPending() {
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
|
||||
this.popoverController.dismiss('close')
|
||||
this.toastService.successMessage('Processo enviado para pendentes')
|
||||
this.goBack()
|
||||
},()=>{
|
||||
}, () => {
|
||||
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
});
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -335,9 +398,9 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then( async (res) => {
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res);
|
||||
if(res.data) {
|
||||
if (res.data) {
|
||||
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
@@ -351,19 +414,19 @@ export class DespachoPrPage implements OnInit {
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Executado'){
|
||||
if (actionName == 'Executado') {
|
||||
await this.executado(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Arquivar'){
|
||||
else if (actionName == 'Arquivar') {
|
||||
await this.arquivar(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Gerar Diploma'){
|
||||
else if (actionName == 'Gerar Diploma') {
|
||||
await this.generateDiploma(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Concluido'){
|
||||
else if (actionName == 'Concluido') {
|
||||
await this.concluir(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Reexecução'){
|
||||
else if (actionName == 'Reexecução') {
|
||||
await this.reexecutar(res.data.note, docs);
|
||||
}
|
||||
this.goBack();
|
||||
@@ -374,9 +437,9 @@ export class DespachoPrPage implements OnInit {
|
||||
async openExpedientActionsModal(taskAction: any, task: any) {
|
||||
//this.modalController.dismiss();
|
||||
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({
|
||||
@@ -390,9 +453,9 @@ export class DespachoPrPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
console.log(res['data']);
|
||||
if(res['data']=='openDiscart'){
|
||||
if (res['data'] == 'openDiscart') {
|
||||
console.log('open discart');
|
||||
this.distartExpedientModal();
|
||||
}
|
||||
@@ -402,10 +465,10 @@ export class DespachoPrPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
async distartExpedientModal2(task: any){
|
||||
async distartExpedientModal2(task: any) {
|
||||
const modal = await this.modalController.create({
|
||||
component: DiscartExpedientModalPage,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
serialNumber: task.serialNumber,
|
||||
folderId: task.workflowInstanceDataFields.FolderID,
|
||||
action: 'discart',
|
||||
@@ -420,9 +483,9 @@ export class DespachoPrPage 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({
|
||||
@@ -439,9 +502,9 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
async openDelegarModal(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({
|
||||
@@ -456,11 +519,11 @@ export class DespachoPrPage implements OnInit {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async distartExpedientModal(){
|
||||
async distartExpedientModal() {
|
||||
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',
|
||||
@@ -470,8 +533,8 @@ export class DespachoPrPage 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();
|
||||
@@ -487,7 +550,7 @@ export class DespachoPrPage implements OnInit {
|
||||
componentProps: {
|
||||
task: this.task,
|
||||
fulltask: this.fulltask,
|
||||
taskAction:taskAction,
|
||||
taskAction: taskAction,
|
||||
showEnviarPendentes: false
|
||||
},
|
||||
translucent: true
|
||||
@@ -495,9 +558,9 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
await popover.present();
|
||||
|
||||
popover.onDidDismiss().then(( res =>{
|
||||
popover.onDidDismiss().then((res => {
|
||||
|
||||
if( res['data'] == 'close') {
|
||||
if (res['data'] == 'close') {
|
||||
this.goBack()
|
||||
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
<div >
|
||||
<ion-list>
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of despachoprstore.list; let i = index"
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of listToPresent; let i = index"
|
||||
(click)="goToDespachoPr(task.SerialNumber)"
|
||||
>
|
||||
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
|
||||
@@ -68,14 +68,14 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div
|
||||
*ngIf="!skeletonLoader && despachoprstore.list.length == 0"
|
||||
<div
|
||||
*ngIf="!skeletonLoader && listToPresent.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<!-- <div *ngIf="skeletonLoader && despachoprstore.list.length == 0">
|
||||
<!-- <div *ngIf="skeletonLoader && listToPresent.length == 0">
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-thumbnail slot="end">
|
||||
|
||||
@@ -17,6 +17,9 @@ import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angul
|
||||
import { __awaiter } from 'tslib';
|
||||
import { DespachosprStore } from 'src/app/store/despachospr-store.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos-pr',
|
||||
templateUrl: './despachos-pr.page.html',
|
||||
@@ -26,61 +29,48 @@ export class DespachosPrPage implements OnInit {
|
||||
|
||||
@ViewChild(CalendarComponent) myCal: CalendarComponent;
|
||||
|
||||
taskslist:DailyWorkTask[] = [];
|
||||
despachoList:any[] = [];
|
||||
deferimentoList:DailyWorkTask[] = [];
|
||||
taskslist: DailyWorkTask[] = [];
|
||||
despachoList: any[] = [];
|
||||
deferimentoList: DailyWorkTask[] = [];
|
||||
|
||||
taskList: customTask[] = [];
|
||||
|
||||
taskType: string;
|
||||
serialNumber:string;
|
||||
totalDocs:any;
|
||||
serialNumber: string;
|
||||
totalDocs: any;
|
||||
|
||||
profile:string;
|
||||
segment:string;
|
||||
profile: string;
|
||||
segment: string;
|
||||
|
||||
// @Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
loadedAttachments:any;
|
||||
loadedAttachments: any;
|
||||
dicIndex = 0;
|
||||
inicial = false
|
||||
|
||||
loggeduser: LoginUserRespose;
|
||||
skeletonLoader = true
|
||||
despachoprstore = DespachosprStore
|
||||
listToPresent = [];
|
||||
|
||||
constructor (
|
||||
private processes:ProcessesService,
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private alertService: AlertService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
) {
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
|
||||
this.loggeduser = authService.ValidatedUser;
|
||||
this.profile = 'mdgpr';
|
||||
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 NavigationStart && event.url.startsWith(pathname)) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.getFromDB();
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
@@ -88,15 +78,15 @@ export class DespachosPrPage implements OnInit {
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
goToDespachoPr(serialNumber:any){
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
|
||||
goToDespachoPr(serialNumber: any) {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
notImplemented(){
|
||||
notImplemented() {
|
||||
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
|
||||
}
|
||||
|
||||
openExpedientDetailPage(data){
|
||||
openExpedientDetailPage(data) {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
@@ -124,59 +114,123 @@ export class DespachosPrPage implements OnInit {
|
||||
console.log(despachosPr);
|
||||
despachosPr = despachosPr.filter(data => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
despachosPr.forEach( (element, index) => {
|
||||
despachosPr.forEach((element, index) => {
|
||||
|
||||
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();
|
||||
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": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
let task = {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
"Senders": element.workflowInstanceDataFields.Sender,
|
||||
"CreateDate": taskDate,
|
||||
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": element.workflowInstanceDataFields.Remetente,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"DocId": element.workflowInstanceDataFields.DocIdDiferimento,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName,
|
||||
}
|
||||
|
||||
this.despachoList.push(task);
|
||||
console.log(this.despachoList);
|
||||
});
|
||||
this.despachoprstore.reset(this.despachoList);
|
||||
this.listToPresent = this.despachoList
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
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 NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.doRefresh()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.sqliteservice.getAllProcess().then((all) => {
|
||||
console.log('DESPACHO PR ALL', all)
|
||||
})
|
||||
this.sqliteservice.getprocessByworkflow('Despacho do Presidente da República').then(async (process: any[]) => {
|
||||
console.log('DESPACHO PR', process)
|
||||
|
||||
let despachosPr;
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
break;
|
||||
case 'PR':
|
||||
console.log(process);
|
||||
|
||||
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
|
||||
break;
|
||||
}
|
||||
|
||||
despachosPr = despachosPr.filter(data => JSON.parse(data.workflowInstanceDataFields).Status == "Active");
|
||||
despachosPr.forEach((element, index) => {
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
this.despachoList.push(task);
|
||||
console.log(this.despachoList);
|
||||
});
|
||||
this.listToPresent = this.despachoList;
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any) {
|
||||
return myArray.sort(function (a, b) {
|
||||
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
||||
});
|
||||
}
|
||||
|
||||
doRefresh() {
|
||||
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
this.LoadList();
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
async viewExpedientDetail(serialNumber:any) {
|
||||
async viewExpedientDetail(serialNumber: any) {
|
||||
console.log(this.profile);
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop'
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: DespachoPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
enterAnimation: "",
|
||||
serialNumber: serialNumber,
|
||||
profile: this.profile,
|
||||
@@ -184,7 +238,7 @@ export class DespachosPrPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res)=>{
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log('refresh list');
|
||||
this.LoadList();
|
||||
});
|
||||
@@ -193,7 +247,7 @@ export class DespachosPrPage implements OnInit {
|
||||
|
||||
async openBookMeetingModal(task: customFullTask) {
|
||||
|
||||
const doc = this.loadedAttachments[ this.dicIndex];
|
||||
const doc = this.loadedAttachments[this.dicIndex];
|
||||
|
||||
task = {
|
||||
serialNumber: doc.SourceId,
|
||||
@@ -208,9 +262,9 @@ export class DespachosPrPage implements OnInit {
|
||||
}
|
||||
|
||||
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({
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
<h5 *ngIf="intervenientes">Intervenientes</h5>
|
||||
<ion-item class="ion-no-margin ion-no-padding">
|
||||
<ion-label>
|
||||
<div *ngFor="let interveniente of intervenientes">
|
||||
<p>{{interveniente.Name}}</p>
|
||||
<div *ngFor="let task of intervenientes">
|
||||
<p>{{task.Name}}</p>
|
||||
</div>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Event } from '../../../../models/event.model';
|
||||
import { MenuController, ModalController, PopoverController } from '@ionic/angular';
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page';
|
||||
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
|
||||
@@ -19,6 +19,10 @@ import { AttachmentList } from 'src/app/models/Excludetask';
|
||||
import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho',
|
||||
templateUrl: './despacho.page.html',
|
||||
@@ -28,20 +32,22 @@ export class DespachoPage 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: customTask;
|
||||
task;
|
||||
|
||||
attachments:any;
|
||||
attachments: any;
|
||||
fulltask: any;
|
||||
eventsList: Event[] = [];
|
||||
serialnumber: string;
|
||||
caller:string;
|
||||
caller: string;
|
||||
profile: string;
|
||||
intervenientes: any;
|
||||
cc: any = [];
|
||||
|
||||
synch = synchro;
|
||||
|
||||
constructor(private activateRoute: ActivatedRoute,
|
||||
private processes: ProcessesService,
|
||||
private iab: InAppBrowser,
|
||||
@@ -52,13 +58,17 @@ export class DespachoPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private despachoService: DespachoService,
|
||||
private location: Location,
|
||||
public p: PermissionService) {
|
||||
public p: PermissionService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
|
||||
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
if (params["params"].SerialNumber) {
|
||||
this.serialnumber = params["params"].SerialNumber;
|
||||
}
|
||||
if(params["params"].caller) {
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
@@ -71,8 +81,8 @@ export class DespachoPage implements OnInit {
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.getFromDb()
|
||||
|
||||
this.LoadTaskDetail(this.serialnumber)
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -112,13 +122,13 @@ export class DespachoPage implements OnInit {
|
||||
}
|
||||
|
||||
async LoadTaskDetail(serial: string) {
|
||||
this.processes.GetTask(serial).subscribe( (res: fullTask) => {
|
||||
|
||||
this.processes.GetTask(serial).subscribe((res: fullTask) => {
|
||||
console.log('despacho detail', res)
|
||||
this.task = {
|
||||
"SerialNumber": res.serialNumber,
|
||||
"Folio": res.workflowInstanceDataFields.Subject,
|
||||
"Senders": res.originator.email,
|
||||
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": res.workflowInstanceDataFields.Sender,
|
||||
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
|
||||
@@ -131,27 +141,33 @@ export class DespachoPage implements OnInit {
|
||||
"activityInstanceName": res.activityInstanceName,
|
||||
"Status": res.workflowInstanceDataFields.Status,
|
||||
}
|
||||
|
||||
this.sqliteservice.updateProcess(res);
|
||||
this.fulltask = res;
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
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(this.task.FolderID).subscribe(users=>{
|
||||
this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => {
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users))
|
||||
console.log('interveniers online', users)
|
||||
|
||||
this.intervenientes = users.filter(user=>{
|
||||
this.intervenientes = users.filter(user => {
|
||||
console.log('interveniers online 2', users)
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
console.log('interveniers online 3', users)
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
});
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
this.location.back();
|
||||
} finally {
|
||||
if(error.status == 0) {
|
||||
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')
|
||||
@@ -160,6 +176,80 @@ export class DespachoPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if (synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialnumber)
|
||||
}
|
||||
|
||||
if (synchro.connected === false) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var intervine = JSON.parse(process[0].interveners)
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
console.log('sqlite', process)
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"DocumentsQty": process[0].DocumentsQty,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": workflow.DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": workflow.Status,
|
||||
}
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
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('interveniers offline', intervine)
|
||||
this.intervenientes = intervine.filter(user => {
|
||||
console.log('interveniers offline 2', user)
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = intervine.filter(user => {
|
||||
console.log('interveniers offline 3', user)
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async viewDocument(docId:string, Document) {
|
||||
|
||||
|
||||
@@ -191,7 +281,7 @@ export class DespachoPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async executado(note:string, documents:any) {
|
||||
async executado(note: string, documents: any) {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
@@ -199,7 +289,7 @@ export class DespachoPage implements OnInit {
|
||||
await this.despachoService.executado(note, documents, this.serialnumber).toPromise();
|
||||
this.toastService.successMessage('Processo criado')
|
||||
this.close();
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Processo não criado")
|
||||
}
|
||||
finally {
|
||||
@@ -207,12 +297,12 @@ export class DespachoPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async arquivar(note:string, documents: AttachmentList) {
|
||||
async arquivar(note: string, documents: AttachmentList) {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.despachoService.arquivar(note, documents,this.serialnumber).toPromise()
|
||||
await this.despachoService.arquivar(note, documents, this.serialnumber).toPromise()
|
||||
this.toastService.successMessage('Processo descartado')
|
||||
this.close();
|
||||
} catch (error) {
|
||||
@@ -224,7 +314,7 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async reexecute(note:string, documents:any) {
|
||||
async reexecute(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialnumber,
|
||||
"action": "Reexecução",
|
||||
@@ -232,7 +322,7 @@ export class DespachoPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -257,26 +347,26 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
async sendExpedienteToPending() {
|
||||
|
||||
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res=>{
|
||||
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => {
|
||||
this.goBack();
|
||||
this.toastService.successMessage()
|
||||
},
|
||||
error => {
|
||||
this.toastService.badRequest("Processo não enviado para despacho")
|
||||
});
|
||||
error => {
|
||||
this.toastService.badRequest("Processo não enviado para despacho")
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -285,8 +375,8 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then( async (res) => {
|
||||
if(res.data){
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if (res.data) {
|
||||
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
@@ -300,16 +390,16 @@ export class DespachoPage implements OnInit {
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Executado'){
|
||||
if (actionName == 'Executado') {
|
||||
|
||||
await this.executado(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 == 'Reexecução'){
|
||||
else if (actionName == 'Reexecução') {
|
||||
await this.reexecute(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
@@ -320,9 +410,9 @@ export class DespachoPage 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({
|
||||
@@ -336,10 +426,10 @@ export class DespachoPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res['data']);
|
||||
|
||||
if(res['data']=='openDiscart'){
|
||||
if (res['data'] == 'openDiscart') {
|
||||
await this.distartExpedientModal();
|
||||
}
|
||||
|
||||
@@ -349,9 +439,9 @@ export class DespachoPage 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({
|
||||
@@ -368,9 +458,9 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
async openDelegarModal(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({
|
||||
@@ -382,7 +472,7 @@ export class DespachoPage implements OnInit {
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
@@ -391,7 +481,7 @@ export class DespachoPage 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',
|
||||
@@ -401,8 +491,8 @@ export class DespachoPage 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();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<ion-list>
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of despachoStore.list; let i = index"
|
||||
*ngFor = "let task of listToPresent; let i = index"
|
||||
(click)="GoToDespacho(task.SerialNumber)"
|
||||
>
|
||||
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
|
||||
@@ -68,13 +68,13 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
*ngIf="!skeletonLoader && despachoStore.list.length == 0"
|
||||
*ngIf="!skeletonLoader && listToPresent.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="skeletonLoader && despachoStore.list.length == 0">
|
||||
<div *ngIf="skeletonLoader && listToPresent.length == 0">
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
|
||||
@@ -3,6 +3,11 @@ import { NavigationStart, Router } from '@angular/router';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { isThisHour } from 'date-fns';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despachos',
|
||||
templateUrl: './despachos.page.html',
|
||||
@@ -12,29 +17,21 @@ import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||
export class DespachosPage implements OnInit {
|
||||
|
||||
despachoStore = DespachoStore;
|
||||
synch = synchro;
|
||||
listToPresent = [];
|
||||
|
||||
constructor (
|
||||
constructor(
|
||||
private router: Router,
|
||||
private despachoRule: DespachoService
|
||||
) {}
|
||||
private despachoRule: DespachoService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && 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()
|
||||
}
|
||||
|
||||
async refreshing() {
|
||||
@@ -49,7 +46,60 @@ export class DespachosPage implements OnInit {
|
||||
|
||||
async LoadList() {
|
||||
|
||||
await this.despachoRule.getList({updateStore: true})
|
||||
await this.despachoRule.getList({ updateStore: true }).then((pre) => {
|
||||
this.listToPresent = pre;
|
||||
console.log('despachooo', pre)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
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 NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (synchro.connected === false) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getDespachosProcess('Tarefa de Despacho').then((process: any[]) => {
|
||||
var listtopresent = [];
|
||||
process.forEach(element => {
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
let task = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocId": workflow.DispatchDocID,
|
||||
"DocumentURL": undefined,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"FolderID": workflow.FolderID,
|
||||
"Folio": workflow.Subject,
|
||||
"Remetente": undefined,
|
||||
"Senders": workflow.Sender,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"WorkflowName": element.workflowDisplayName
|
||||
}
|
||||
|
||||
listtopresent.push(task);
|
||||
|
||||
});
|
||||
|
||||
this.listToPresent = listtopresent;
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
get skeletonLoader(): boolean {
|
||||
@@ -64,9 +114,8 @@ export class DespachosPage implements OnInit {
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
async GoToDespacho(serialNumber:any) {
|
||||
console.log('Despachos serial',serialNumber)
|
||||
this.router.navigate(['/home/gabinete-digital/despachos',serialNumber,'gabinete-digital']);
|
||||
async GoToDespacho(serialNumber: any) {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { Location } from '@angular/common';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diploma',
|
||||
templateUrl: './diploma.page.html',
|
||||
@@ -43,6 +46,7 @@ export class DiplomaPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
// console.log(params["params"]);
|
||||
@@ -60,7 +64,7 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.profile = "mdgpr";
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
this.getFromDb();
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@@ -126,11 +130,15 @@ export class DiplomaPage implements OnInit {
|
||||
"activityInstanceName": res.activityInstanceName,
|
||||
}
|
||||
this.fulltask = res;
|
||||
this.sqliteservice.updateProcess(res)
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
|
||||
|
||||
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
|
||||
console.log('internen diploma ')
|
||||
})
|
||||
this.intervenientes = users.filter(user=>{
|
||||
return user.Type == 'I';
|
||||
});
|
||||
@@ -156,6 +164,62 @@ export class DiplomaPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getFromDb() {
|
||||
if(synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
} else {
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
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.attachments = JSON.parse(process[0].Documents)
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
|
||||
@@ -3,34 +3,38 @@ import { ActivatedRoute, NavigationEnd, NavigationError, NavigationExtras, Navig
|
||||
import { DailyWorkTask } from '../../../models/dailyworktask.model';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-diplomas',
|
||||
templateUrl: './diplomas.page.html',
|
||||
styleUrls: ['./diplomas.page.scss'],
|
||||
})
|
||||
export class DiplomasPage implements OnInit, OnDestroy {
|
||||
list:DailyWorkTask[] = [];
|
||||
diplomasList:DailyWorkTask[] = [];
|
||||
diplomasAssinadoList:DailyWorkTask[] = [];
|
||||
list: DailyWorkTask[] = [];
|
||||
diplomasList: DailyWorkTask[] = [];
|
||||
diplomasAssinadoList: DailyWorkTask[] = [];
|
||||
showLoader: boolean;
|
||||
totalDocs:any;
|
||||
serialNumber:string;
|
||||
totalDocs: any;
|
||||
serialNumber: string;
|
||||
|
||||
segment:string;
|
||||
segment: string;
|
||||
|
||||
skeletonLoader = true
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
this.diplomasList = [];
|
||||
//Inicializar segment
|
||||
this.segment = 'validar';
|
||||
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
if(params['validar'] == 'true') {
|
||||
if (params['validar'] == 'true') {
|
||||
this.segment = 'validar';
|
||||
} else if (params['assinados'] == 'true') {
|
||||
this.segment = 'assinados';
|
||||
@@ -43,27 +47,14 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
//this.segment = 'validar';
|
||||
this.activatedRoute.queryParams.subscribe(params => {
|
||||
|
||||
if(params['segment'] == 'validar') {
|
||||
if (params['segment'] == 'validar') {
|
||||
this.segment = 'validar';
|
||||
} else if (params['segment'] == 'assinados') {
|
||||
this.segment = 'assinados';
|
||||
}
|
||||
});
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && 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()
|
||||
|
||||
}
|
||||
|
||||
@@ -141,7 +132,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
});
|
||||
} */
|
||||
|
||||
async getTotalDocs(DocId:any) {
|
||||
async getTotalDocs(DocId: any) {
|
||||
let res = await this.processes.GetDocumentDetails(DocId, '361').toPromise();
|
||||
console.log(res.DocumentsTotal);
|
||||
return res.DocumentsTotal;
|
||||
@@ -155,7 +146,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
this.LoadList();
|
||||
}
|
||||
|
||||
goToDiploma(serialNumber:any) {
|
||||
goToDiploma(serialNumber: any) {
|
||||
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
@@ -192,11 +183,54 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
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 NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.sqliteservice.getprocessByworkflow("Despacho do Presidente da República").then((process: any[]) => {
|
||||
|
||||
let diplomasValidar = process.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
let diplomasList = [];
|
||||
diplomasValidar.forEach(async element => {
|
||||
|
||||
let task = this.pipeTaskOffline(element)
|
||||
diplomasList.push(task);
|
||||
|
||||
});
|
||||
this.diplomasList = this.sortArrayISODate(diplomasList.reverse());
|
||||
|
||||
let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinadoList = []
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTaskOffline(element)
|
||||
diplomasAssinadoList.push(task);
|
||||
});
|
||||
console.log('diplomasAssinados', diplomasAssinados)
|
||||
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse();
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pipeTask(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();
|
||||
return {
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Folio": element.workflowInstanceDataFields.Subject,
|
||||
@@ -212,8 +246,28 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
pipeTaskOffline(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();
|
||||
return {
|
||||
"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,
|
||||
"Status": JSON.parse(element.workflowInstanceDataFields).Status,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edi
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { SqliteService } from '../../../../services/sqlite.service';
|
||||
import { synchro } from '../../../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-approve-event',
|
||||
templateUrl: './approve-event.page.html',
|
||||
@@ -19,28 +23,30 @@ import { Location } from '@angular/common';
|
||||
})
|
||||
export class ApproveEventPage implements OnInit {
|
||||
event: Event;
|
||||
loadedEvent:any = false
|
||||
loadedAttachments:any;
|
||||
customDate:any;
|
||||
today:any;
|
||||
loadedEvent: any = false
|
||||
loadedAttachments: any;
|
||||
customDate: any;
|
||||
today: any;
|
||||
show: boolean = false;
|
||||
|
||||
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"];
|
||||
|
||||
serialNumber:string;
|
||||
caller:string;
|
||||
@Input() InstanceId:string;
|
||||
serialNumber: string;
|
||||
caller: string;
|
||||
@Input() InstanceId: string;
|
||||
|
||||
@Output() approveEventDismiss = new EventEmitter<any>();
|
||||
@Output() closeEventToApprove = new EventEmitter<any>();
|
||||
@Output() AproveEventEditEvent = new EventEmitter<any>();
|
||||
|
||||
synch = synchro;
|
||||
|
||||
constructor(
|
||||
private router:Router,
|
||||
private router: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private modalController: ModalController,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private popoverController: PopoverController,
|
||||
private menu: MenuController,
|
||||
@@ -49,14 +55,16 @@ export class ApproveEventPage implements OnInit {
|
||||
private animationController: AnimationController,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
// console.log(params["params"]);
|
||||
|
||||
if(params["params"].serialNumber) {
|
||||
if (params["params"].serialNumber) {
|
||||
this.serialNumber = params["params"].serialNumber;
|
||||
}
|
||||
if(params["params"].caller){
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
@@ -70,8 +78,8 @@ export class ApproveEventPage implements OnInit {
|
||||
ngOnInit() {
|
||||
console.log(this.serialNumber);
|
||||
console.log(this.caller);
|
||||
|
||||
this.getTask();
|
||||
this.getProcessFromDB();
|
||||
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@@ -89,19 +97,101 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
addProcessToDB(data) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.updateProcess(data);
|
||||
});
|
||||
}
|
||||
|
||||
getProcessFromDB() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
this.getTask();
|
||||
}
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log('event aprove serial', process)
|
||||
|
||||
var doc;
|
||||
var action = [];
|
||||
var origi = [];
|
||||
var wordafi = {};
|
||||
if (process[0].Documents === "null" || process[0].Documents === "undefined") {
|
||||
doc = []
|
||||
} else {
|
||||
doc = JSON.parse(process[0].Documents)
|
||||
}
|
||||
|
||||
if (process[0].actions === "null" || process[0].actions === "undefined") {
|
||||
action = []
|
||||
} else {
|
||||
action = JSON.parse(process[0].Documents)
|
||||
}
|
||||
|
||||
if (process[0].originator === "null" || process[0].originator === "undefined") {
|
||||
origi = []
|
||||
} else {
|
||||
origi = JSON.parse(process[0].Documents)
|
||||
}
|
||||
if (process[0].workflowInstanceDataFields === "null" || process[0].workflowInstanceDataFields === "undefined") {
|
||||
wordafi = []
|
||||
} else {
|
||||
wordafi = JSON.parse(process[0].workflowInstanceDataFields)
|
||||
}
|
||||
|
||||
let task = {
|
||||
"Documents": doc,
|
||||
"actions": action,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"formURL": process[0].formURL,
|
||||
"originator": origi,
|
||||
"serialNumber": process[0].serialNumber,
|
||||
"taskStartDate": process[0].taskStartDate,
|
||||
"totalDocuments": process[0].totalDocuments,
|
||||
"workflowDisplayName": process[0].workflowDisplayName,
|
||||
"workflowID": process[0].workflowID,
|
||||
"workflowInstanceDataFields": wordafi,
|
||||
"workflowInstanceFolio": process[0].workflowInstanceFolio,
|
||||
"workflowInstanceID": process[0].workflowInstanceID,
|
||||
"workflowName": process[0].workflowInstanceID
|
||||
|
||||
}
|
||||
|
||||
this.loadedEvent = task
|
||||
console.log('offline event',this.loadedEvent);
|
||||
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.loadedAttachments = this.loadedEvent.Documents;
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
})
|
||||
})
|
||||
console.log('Offlineee')
|
||||
})
|
||||
}
|
||||
|
||||
async getTask() {
|
||||
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
console.log(this.loadedEvent);
|
||||
|
||||
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
|
||||
|
||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
|
||||
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
|
||||
this.getAttachments(instanceId);
|
||||
|
||||
this.addProcessToDB(this.loadedEvent)
|
||||
}
|
||||
|
||||
async approveTask(serialNumber:string) {
|
||||
async approveTask(serialNumber: string) {
|
||||
let body = { "serialNumber": serialNumber, "action": "Aprovar" }
|
||||
console.log(body);
|
||||
|
||||
@@ -131,12 +221,12 @@ export class ApproveEventPage implements OnInit {
|
||||
}); */
|
||||
}
|
||||
|
||||
async emendTask(serialNumber:string){
|
||||
async emendTask(serialNumber: string) {
|
||||
console.log('Desktop');
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EmendMessageModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'emend-message-modal',
|
||||
backdropDismiss: false
|
||||
@@ -145,41 +235,42 @@ export class ApproveEventPage implements OnInit {
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss()
|
||||
.then( async (res) => {
|
||||
console.log(res.data);
|
||||
.then(async (res) => {
|
||||
console.log(res.data);
|
||||
|
||||
if(res.data !== ''){
|
||||
let body = { "serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
if (res.data !== '') {
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
"ReviewUserComment": res.data,
|
||||
"ReviewUserComment": res.data,
|
||||
}
|
||||
}
|
||||
console.log(body);
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.toastService.successMessage('Pedido enviado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest();
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
console.log(body);
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise();
|
||||
this.toastService.successMessage('Pedido enviado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest();
|
||||
} finally {
|
||||
loader.remove()
|
||||
else {
|
||||
//this.alertService.presentAlert('Operação cancelada!');
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
//this.alertService.presentAlert('Operação cancelada!');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//this.openEmendMessageModal(serialNumber);
|
||||
//this.goBack();
|
||||
}
|
||||
|
||||
async rejeitar(serialNumber:string){
|
||||
async rejeitar(serialNumber: string) {
|
||||
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
|
||||
console.log(body);
|
||||
const loader = this.toastService.loading()
|
||||
@@ -195,10 +286,12 @@ export class ApproveEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async getAttachments(instanceId:string) {
|
||||
async getAttachments(instanceId: string) {
|
||||
|
||||
try {
|
||||
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
|
||||
this.sqliteservice.updateUser(JSON.stringify(this.serialNumber),JSON.stringify(this.loadedAttachments))
|
||||
console.log('Attatara', this.loadedAttachments)
|
||||
|
||||
} catch (error) {
|
||||
|
||||
@@ -206,23 +299,23 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
viewDocument(sourceId){
|
||||
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
|
||||
viewDocument(sourceId) {
|
||||
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res => {
|
||||
/* console.log(res); */
|
||||
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
const browser = this.iab.create(url,"_blank");
|
||||
const url: string = res.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
|
||||
const browser = this.iab.create(url, "_blank");
|
||||
browser.show();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async openOptions(ev:any) {
|
||||
async openOptions(ev: any) {
|
||||
const popover = await this.popoverController.create({
|
||||
component: EventActionsPopoverPage,
|
||||
cssClass: 'events-options',
|
||||
event: ev,
|
||||
translucent: true,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
serialNumber: ev.serialNumber,
|
||||
InstanceId: ev.workflowInstanceDataFields.InstanceId,
|
||||
},
|
||||
@@ -233,10 +326,10 @@ export class ApproveEventPage implements OnInit {
|
||||
openMenu() {
|
||||
this.menu.open();
|
||||
}
|
||||
async openEmendMessageModal(serialNumber:string) {
|
||||
async openEmendMessageModal(serialNumber: string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: EmendMessageModalPage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'emend-message-modal',
|
||||
backdropDismiss: false
|
||||
@@ -244,13 +337,14 @@ export class ApproveEventPage implements OnInit {
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then( async (res) => {
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res.data);
|
||||
|
||||
if(res.data !== ''){
|
||||
let body = { "serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
if (res.data !== '') {
|
||||
let body = {
|
||||
"serialNumber": serialNumber,
|
||||
"action": "Emendar",
|
||||
"dataFields": {
|
||||
"ReviewUserComment": res.data,
|
||||
}
|
||||
}
|
||||
@@ -264,18 +358,18 @@ export class ApproveEventPage implements OnInit {
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest();
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
else {
|
||||
//this.alertService.presentAlert('Operação cancelada!');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
goToEventsToApprove(){
|
||||
goToEventsToApprove() {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
"eventos": true,
|
||||
@@ -290,7 +384,7 @@ export class ApproveEventPage implements OnInit {
|
||||
component: EditEventToApproveComponent,
|
||||
componentProps: {
|
||||
serialNumber: serialNumber,
|
||||
InstanceId:this.InstanceId
|
||||
InstanceId: this.InstanceId
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
// backdropDismiss: false
|
||||
|
||||
@@ -8,6 +8,10 @@ import { NavigationStart, Router } from '@angular/router';
|
||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { SqliteService } from '../../../services/sqlite.service';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-list',
|
||||
templateUrl: './event-list.page.html',
|
||||
@@ -29,32 +33,22 @@ export class EventListPage implements OnInit {
|
||||
skeletonLoader = true
|
||||
eventaprovacaostore = EventoAprovacaoStore;
|
||||
|
||||
synch = synchro;
|
||||
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
private location: Location
|
||||
private location: Location,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.segment = 'MDGPR';
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadToApproveEvents()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.getEventToAproveFromDB();
|
||||
|
||||
window.onresize = (event) => {
|
||||
// if not mobile remove all component
|
||||
@@ -65,6 +59,42 @@ export class EventListPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
getEventToAproveFromDB() {
|
||||
|
||||
if( synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadToApproveEvents()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadToApproveEvents()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR','Agenda Pessoal MDGPR' ).then((event: any[]) => {
|
||||
this.eventsMDGPRList = event
|
||||
console.log("All evento to aprove from db ", event)
|
||||
})
|
||||
|
||||
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR','Agenda Pessoal PR' ).then((event: any[]) => {
|
||||
this.eventsPRList = event
|
||||
console.log("All evento to aprove from db ", event)
|
||||
})
|
||||
})
|
||||
console.log('Offlineee')
|
||||
})
|
||||
}
|
||||
|
||||
segmentChanged(ev: any) {
|
||||
this.LoadToApproveEvents();
|
||||
}
|
||||
@@ -78,7 +108,8 @@ export class EventListPage implements OnInit {
|
||||
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
|
||||
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
|
||||
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
|
||||
console.log(this.eventsMDGPRList);
|
||||
console.log('Event aprove',this.eventsMDGPRList);
|
||||
|
||||
|
||||
this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
|
||||
}
|
||||
@@ -92,6 +123,10 @@ export class EventListPage implements OnInit {
|
||||
this.skeletonLoader = false
|
||||
}
|
||||
|
||||
getEventToaproveFromDB() {
|
||||
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber, event){
|
||||
const modal = await this.modalController.create({
|
||||
component: ApproveEventModalPage,
|
||||
|
||||
+136
-82
@@ -9,7 +9,7 @@ import { ModalController, PopoverController } from '@ionic/angular';
|
||||
import { ExpedientTaskModalPage } from '../expedient-task-modal/expedient-task-modal.page';
|
||||
import { BookMeetingModalPage } from '../book-meeting-modal/book-meeting-modal.page';
|
||||
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
@@ -26,6 +26,10 @@ import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
templateUrl: './expediente-detail.page.html',
|
||||
@@ -36,22 +40,25 @@ export class ExpedienteDetailPage 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: expedienteTask;
|
||||
fulltask: any;
|
||||
eventsList: Event[];
|
||||
serialNumber: string;
|
||||
caller:string;
|
||||
caller: string;
|
||||
profile: string;
|
||||
intervenientes: any;
|
||||
cc: any = [];
|
||||
documents:SearchList[] = [];
|
||||
attachments:any;
|
||||
documents: SearchList[] = [];
|
||||
attachments: any;
|
||||
|
||||
hideSendToPendentes = true
|
||||
searchDocumentPipe = new SearchDocumentPipe()
|
||||
|
||||
synch = synchro
|
||||
onlinecheck: boolean;
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private iab: InAppBrowser,
|
||||
@@ -66,20 +73,22 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
private attachmentsService: AttachmentsService,
|
||||
public p: PermissionService,
|
||||
private taskService: TaskService,
|
||||
private expedienteService: ExpedienteService
|
||||
private expedienteService: ExpedienteService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
if (params["params"].SerialNumber) {
|
||||
this.serialNumber = params["params"].SerialNumber;
|
||||
}
|
||||
if(params["params"].caller) {
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
this.getFromDB();
|
||||
|
||||
}
|
||||
|
||||
@@ -91,16 +100,60 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
this.toastService.presentToast('Não foi possível fazer login');
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
|
||||
async approve(note:string, documents:any) {
|
||||
if(synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
}
|
||||
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.onlinecheck = false;
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log("expedient ditail", process)
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"Status": workflow.Status,
|
||||
"DispatchNumber": workflow.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": workflow.InstanceID
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async approve(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Aprovar",
|
||||
"ActionTypeId": 100000004 ,
|
||||
"ActionTypeId": 100000004,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
console.log(body);
|
||||
@@ -111,15 +164,15 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.close();
|
||||
this.toastService.successMessage('Processo aprovado')
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não aprovado')
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async sendToReview(note:string, documents:any) {
|
||||
async sendToReview(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Retificar",
|
||||
@@ -127,7 +180,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -136,7 +189,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
@@ -144,16 +197,16 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
async openAddNoteModal(actionName:string) {
|
||||
async openAddNoteModal(actionName: string) {
|
||||
let classs;
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'add-note-modal'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: AddNotePage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
showAttachmentBtn: false,
|
||||
},
|
||||
cssClass: classs,
|
||||
@@ -164,7 +217,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then(res => {
|
||||
console.log(res);
|
||||
if(res.data){
|
||||
if (res.data) {
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
ApplicationId: e.ApplicationType,
|
||||
@@ -177,10 +230,10 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Aprovar'){
|
||||
if (actionName == 'Aprovar') {
|
||||
this.approve(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Revisão'){
|
||||
else if (actionName == 'Revisão') {
|
||||
this.sendToReview(res.data.note, docs);
|
||||
}
|
||||
this.goBack();
|
||||
@@ -230,14 +283,14 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
sendExpedienteToPending() {
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
|
||||
console.log(res);
|
||||
this.toastService.successMessage('Processo enviado para pendentes')
|
||||
this.goBack();
|
||||
},
|
||||
(error)=>{
|
||||
this.toastService.badRequest('Processo não enviado para pendentes')
|
||||
});
|
||||
(error) => {
|
||||
this.toastService.badRequest('Processo não enviado para pendentes')
|
||||
});
|
||||
}
|
||||
|
||||
async LoadTaskDetail(serial: string) {
|
||||
@@ -249,7 +302,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
"SerialNumber": res.serialNumber,
|
||||
"Folio": res.workflowInstanceDataFields.Subject,
|
||||
"Senders": res.originator.email,
|
||||
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": res.workflowInstanceDataFields.Sender,
|
||||
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
|
||||
@@ -264,16 +317,17 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
this.fulltask = res;
|
||||
this.sqliteservice.updateProcess(res)
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
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(this.task.FolderId).subscribe(users=>{
|
||||
this.intervenientes = users.filter(user=>{
|
||||
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
|
||||
this.intervenientes = users.filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
})
|
||||
@@ -281,14 +335,14 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
console.log('this.task', this.task.InstanceID)
|
||||
console.log('this.task.DocumentURL', this.task.DocumentURL)
|
||||
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
try {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if(error.status == 0) {
|
||||
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')
|
||||
@@ -337,7 +391,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
getAttachments(serialNumber) {
|
||||
console.log(serialNumber);
|
||||
|
||||
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{
|
||||
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res => {
|
||||
this.attachments = res;
|
||||
console.log('res', res);
|
||||
});
|
||||
@@ -358,45 +412,45 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=> {
|
||||
if(res){
|
||||
const data = res.data;
|
||||
this.documents.push(data.selected);
|
||||
this.documents.forEach((element: any) => {
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if (res) {
|
||||
const data = res.data;
|
||||
this.documents.push(data.selected);
|
||||
this.documents.forEach((element: any) => {
|
||||
|
||||
let body = {
|
||||
"InstanceID": this.task.InstanceID,
|
||||
"WorkflowDisplayName": this.task.WorkflowName,
|
||||
"FolderID": this.task.FolderId,
|
||||
"DispatchNumber": this.task.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
|
||||
"Attachments": []
|
||||
}
|
||||
let body = {
|
||||
"InstanceID": this.task.InstanceID,
|
||||
"WorkflowDisplayName": this.task.WorkflowName,
|
||||
"FolderID": this.task.FolderId,
|
||||
"DispatchNumber": this.task.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
|
||||
"Attachments": []
|
||||
}
|
||||
|
||||
const Attachments = this.searchDocumentPipe.transformToAttachment(element)
|
||||
body.Attachments = Attachments;
|
||||
const Attachments = this.searchDocumentPipe.transformToAttachment(element)
|
||||
body.Attachments = Attachments;
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
this.attachmentsService.AddAttachment(body).subscribe((res)=> {
|
||||
this.toastService.successMessage()
|
||||
}, ()=> {
|
||||
this.toastService.badRequest()
|
||||
}, ()=> {
|
||||
loader.remove()
|
||||
});
|
||||
this.attachmentsService.AddAttachment(body).subscribe((res) => {
|
||||
this.toastService.successMessage()
|
||||
}, () => {
|
||||
this.toastService.badRequest()
|
||||
}, () => {
|
||||
loader.remove()
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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({
|
||||
@@ -409,9 +463,9 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async(res)=>{
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
let body = res['data'];
|
||||
if(res['data']) {
|
||||
if (res['data']) {
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
@@ -422,47 +476,47 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async distartExpedientModal(body:any) {
|
||||
async distartExpedientModal(body: any) {
|
||||
const modal = await this.modalController.create({
|
||||
component: DiscartExpedientModalPage,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'discart-expedient-modal',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res['data']);
|
||||
|
||||
if(body == 'descartar') {
|
||||
if(res['data']== 'Yes') {
|
||||
if (body == 'descartar') {
|
||||
if (res['data'] == 'Yes') {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.expedienteService.discard({SerialNumber: this.task.SerialNumber}).toPromise()
|
||||
await this.expedienteService.discard({ SerialNumber: this.task.SerialNumber }).toPromise()
|
||||
this.toastService.successMessage('Processo descartado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não descartado')
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
else if(res['data'] == 'No'){
|
||||
else if (res['data'] == 'No') {
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(res['data']== 'Yes') {
|
||||
else {
|
||||
if (res['data'] == 'Yes') {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
@@ -476,7 +530,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
else if(res['data'] == 'No') {
|
||||
else if (res['data'] == 'No') {
|
||||
console.log('Update');
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
@@ -485,7 +539,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
@@ -497,9 +551,9 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
console.log(task);
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'book-meeting-modal modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -511,12 +565,12 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
|
||||
goToEvent(eventId:any) {
|
||||
goToEvent(eventId: any) {
|
||||
this.router.navigate(['/home/events', eventId, 'expediente']);
|
||||
}
|
||||
|
||||
@@ -546,7 +600,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
componentProps: {
|
||||
task: this.task,
|
||||
fulltask: this.fulltask,
|
||||
taskAction:taskAction,
|
||||
taskAction: taskAction,
|
||||
},
|
||||
translucent: true
|
||||
});
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
<ion-list>
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of expedienteGdStore.list"
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of listToPresent"
|
||||
(click)="goToExpediente(task.SerialNumber)"
|
||||
>
|
||||
<div class="item width-100">
|
||||
@@ -65,13 +65,13 @@
|
||||
</ion-list>
|
||||
|
||||
<div
|
||||
*ngIf="!skeletonLoader && expedienteGdStore.list.length == 0 && expedienteGdStore.list.length == 0"
|
||||
*ngIf="!skeletonLoader && listToPresent.length == 0 && listToPresent.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="skeletonLoader && expedienteGdStore.list.length == 0">
|
||||
<div *ngIf="skeletonLoader && listToPresent.length == 0">
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
|
||||
@@ -4,6 +4,9 @@ import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente',
|
||||
@@ -12,40 +15,33 @@ import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
})
|
||||
export class ExpedientePage implements OnInit {
|
||||
|
||||
segment:string;
|
||||
segment: string;
|
||||
skeletonLoader = true
|
||||
//profile:string;
|
||||
showLoader:boolean;
|
||||
showLoader: boolean;
|
||||
|
||||
taskslist = [];
|
||||
serialNumber:string;
|
||||
serialNumber: string;
|
||||
|
||||
expedienteGdStore = ExpedienteGdStore
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
|
||||
onlinecheck: boolean;
|
||||
|
||||
listToPresent;
|
||||
synch = synchro
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private toastService: ToastService
|
||||
) {}
|
||||
private toastService: ToastService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
this.getEventsFromLocalDb();
|
||||
console.log("segrsgre")
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async LoadList() {
|
||||
@@ -54,17 +50,19 @@ export class ExpedientePage implements OnInit {
|
||||
try {
|
||||
const expediente: object[] = await this.processes.GetTaskListExpediente(false).toPromise()
|
||||
const result = expediente
|
||||
|
||||
|
||||
this.taskslist = new Array();
|
||||
let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
res.forEach((element: any) => {
|
||||
|
||||
let task = this.expedienteTaskPipe.transform(element)
|
||||
let task = this.expedienteTaskPipe.transform(element)
|
||||
this.taskslist.push(task);
|
||||
this.sqliteservice.addProcess(task);
|
||||
});
|
||||
|
||||
this.expedienteGdStore.reset(this.taskslist);
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
console.log('expediente list', this.listToPresent)
|
||||
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
@@ -92,9 +90,80 @@ export class ExpedientePage implements OnInit {
|
||||
this.router.navigate(['/home/gabinete-digital']);
|
||||
}
|
||||
|
||||
goToExpediente(serialNumber:any){
|
||||
goToExpediente(serialNumber: any) {
|
||||
//console.log('ABRE');
|
||||
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
|
||||
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
SqliteAddExpediente(list) {
|
||||
list.forEach((expediente) => {
|
||||
let data = {
|
||||
serialNumber: expediente.serialNumber,
|
||||
workflowInstanceFolio: expediente.workflowInstanceFolio,
|
||||
Documents: expediente.Documents,
|
||||
actions: expediente.actions,
|
||||
activityInstanceName: expediente.activityInstanceName,
|
||||
formURL: expediente.formURL,
|
||||
originator: expediente.originator,
|
||||
taskStartDate: expediente.taskStartDate,
|
||||
totalDocuments: expediente.totalDocuments,
|
||||
workflowDisplayName: expediente.workflowDisplayName,
|
||||
workflowID: expediente.workflowID,
|
||||
workflowInstanceDataFields: expediente.workflowInstanceDataFields,
|
||||
workflowInstanceID: expediente.workflowInstanceID,
|
||||
workflowName: expediente.workflowName
|
||||
}
|
||||
|
||||
this.sqliteservice.addExpediente(data);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
console.log("All expedientes from local,", expediente)
|
||||
|
||||
expediente.forEach((element) => {
|
||||
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
|
||||
let exped = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"Senders": workflow.Senders,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"Subject": workflow.Subject,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName
|
||||
}
|
||||
|
||||
this.taskslist.push(exped)
|
||||
|
||||
});
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<fa-icon class="icon-selected" icon="align-justify"></fa-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Todas as tarefas</p>
|
||||
<p class="text-center exp-card-content">{{ totalDocumentStore.count }} <span class="title1">Documentos</span></p>
|
||||
<p class="text-center exp-card-content">{{ allProcessesList.length }} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="box-hover exp-card d-flex flex-column" *ngIf="loggeduser.Profile == 'MDGPR'" >
|
||||
|
||||
@@ -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,
|
||||
@@ -237,69 +221,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){
|
||||
@@ -312,42 +385,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':
|
||||
@@ -359,77 +432,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')
|
||||
@@ -437,7 +510,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
||||
else if (this.router.url == '/home/gabinete-digital?deferimento=true') {
|
||||
this.openPedidosPage('deferimento')
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.checkUser();
|
||||
}
|
||||
}
|
||||
@@ -464,15 +537,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)
|
||||
}
|
||||
|
||||
@@ -488,7 +561,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;
|
||||
|
||||
@@ -538,7 +611,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;
|
||||
});
|
||||
|
||||
@@ -554,56 +627,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']);
|
||||
}
|
||||
@@ -616,26 +689,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;
|
||||
}
|
||||
@@ -644,20 +717,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 {
|
||||
@@ -667,78 +740,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;
|
||||
}
|
||||
@@ -746,14 +819,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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,10 +183,104 @@ 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']);
|
||||
console.log('Attachment',this.attachments);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
|
||||
<div class="width-100" [ngSwitch]="segment">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
|
||||
<div *ngIf="pedidosstorage.listparecer">
|
||||
<div *ngIf="listToPresentparecerList">
|
||||
<ion-list *ngSwitchCase="'parecer'">
|
||||
<!-- *ngFor = "let task of pedidosstorage.listparecer; let i = index"
|
||||
(click)="viewExpedientDetail(task.SerialNumber)" -->
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of pedidosstorage.listparecer"
|
||||
*ngFor = "let task of listToPresentparecerList"
|
||||
(click)="goToPedido(task.SerialNumber)"
|
||||
>
|
||||
<!-- (click)="viewExpedientDetail(task.SerialNumber)" -->
|
||||
@@ -77,11 +77,11 @@
|
||||
</ion-list>
|
||||
|
||||
</div>
|
||||
<div *ngIf="pedidosstorage.listdeferimento">
|
||||
<div *ngIf="listToPresentdeferimentoList">
|
||||
<ion-list *ngSwitchCase="'deferimento'">
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of pedidosstorage.listdeferimento"
|
||||
*ngFor = "let task of listToPresentdeferimentoList"
|
||||
(click)="goToPedido(task.SerialNumber)"
|
||||
>
|
||||
<!-- (click)="viewExpedientDetail(task.SerialNumber)" -->
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</ion-refresher>
|
||||
|
||||
<app-task-list class="height-100"
|
||||
[taskList] = pendentesstore.list
|
||||
[taskList] = listToPresent
|
||||
[skeletonLoader] = skeletonLoader
|
||||
(viewTaskDetail)="viewTaskDetails($event)"
|
||||
> </app-task-list>
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="aside overflow-y-auto d-flex flex-wrap width-100">
|
||||
<!-- <ion-list class="width-100"> -->
|
||||
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100 cursor-pointer"
|
||||
*ngFor="let viagem of publicationTravelFolderService.list">
|
||||
*ngFor="let viagem of publicationsTravelFolderList">
|
||||
<ion-item lines="none"
|
||||
class="item width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
|
||||
[class.item-active]="viagem.ProcessId == idSelected"
|
||||
@@ -73,7 +73,7 @@
|
||||
</ion-item-sliding>
|
||||
|
||||
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100"
|
||||
*ngFor="let evento of publicationEventFolderStorage.list">
|
||||
*ngFor="let evento of publicationsEventFolderList">
|
||||
<ion-item lines="none"
|
||||
class="item cursor-pointer width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
|
||||
[class.item-active]="evento.ProcessId == idSelected"
|
||||
|
||||
@@ -13,6 +13,8 @@ import { EditActionPage } from './edit-action/edit-action.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publications',
|
||||
@@ -28,11 +30,11 @@ export class PublicationsPage implements OnInit {
|
||||
actionsListStorage: PublicationFolder[] = new Array();
|
||||
publicationsTravelFolderList: PublicationFolder[];
|
||||
|
||||
theDate:any;
|
||||
theEndDate:any;
|
||||
customDate:any;
|
||||
theDate: any;
|
||||
theEndDate: any;
|
||||
customDate: any;
|
||||
months: string[];
|
||||
days:string[];
|
||||
days: string[];
|
||||
|
||||
publicationEventFolderStorage = PublicationEventFolderStorage
|
||||
publicationTravelFolderService = PublicationTravelFolderStore
|
||||
@@ -61,41 +63,33 @@ export class PublicationsPage implements OnInit {
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
private publications: PublicationsService,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
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"];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const pathname = window.location.pathname
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
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)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<ion-list>
|
||||
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" -->
|
||||
<div class="post-item"
|
||||
*ngFor="let publication of publicationListStorage.documents[folderId]"
|
||||
*ngFor="let publication of getpublication"
|
||||
(click)="goToPublicationDetail(publication.DocumentId)"
|
||||
>
|
||||
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user