mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
changed xcalendario to agenda
This commit is contained in:
+15
-15
@@ -3,36 +3,36 @@
|
||||
|
||||
<ion-tab-bar *ngIf="p.userPermissionCount([permissionList.Agenda.access, permissionList.Gabinete.access, permissionList.Actions.access, permissionList.Chat.access]) >= 2 || (p.userPermission([permissionList.Agenda.access]) && SessionStore.user.OwnerCalendars.length != 0) || p.userPermission([permissionList.Gabinete.access])" class="bottoms" slot="bottom">
|
||||
|
||||
<ion-tab-button *ngIf="SessionStore.user.OwnerCalendars.length >= 1 || p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/events')" tab="events" [class.active]="pathname === '/home/events'">
|
||||
<ion-tab-button *ngIf="SessionStore.user.OwnerCalendars.length >= 1 || p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/events')" tab="events" [class.active]="ActiveTabService.pages.home">
|
||||
<!-- <ion-icon name="home"></ion-icon> -->
|
||||
<ion-icon *ngIf="pathname != '/home/events'" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
|
||||
<ion-icon *ngIf="pathname == '/home/events'" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
|
||||
<ion-icon *ngIf="!ActiveTabService.pages.home" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ActiveTabService.pages.home" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
|
||||
<ion-label>Início</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Agenda.access])" (click)="goto('/home/agenda')" tab="agenda" [class.active]="pathname === '/home/agenda' ">
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Agenda.access])" (click)="goto('/home/agenda')" tab="agenda" [class.active]="ActiveTabService.pages.agenda">
|
||||
<!-- <ion-icon name="calendar"></ion-icon> -->
|
||||
<ion-icon *ngIf="pathname != '/home/agenda'" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
|
||||
<ion-icon *ngIf="pathname == '/home/agenda'" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
|
||||
<ion-icon *ngIf="!ActiveTabService.pages.agenda" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ActiveTabService.pages.agenda" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
|
||||
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' ">
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/gabinete-digital')" [class.active]="ActiveTabService.pages.gabinete">
|
||||
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
|
||||
<ion-icon *ngIf="pathname != '/home/gabinete-digital'" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
|
||||
<ion-icon *ngIf="pathname == '/home/gabinete-digital'" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
|
||||
<ion-icon *ngIf="!ActiveTabService.pages.gabinete" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ActiveTabService.pages.gabinete" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
|
||||
<ion-label>Gabinete</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Actions.access])" tab="publications" [class.active]="pathname === '/home/publications' ">
|
||||
<ion-icon *ngIf="pathname != '/home/publications'" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
|
||||
<ion-icon *ngIf="pathname == '/home/publications'" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon>
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Actions.access])" tab="publications" [class.active]="ActiveTabService.pages.publication">
|
||||
<ion-icon *ngIf="!ActiveTabService.pages.publication" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ActiveTabService.pages.publication" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon>
|
||||
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Acções</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Chat.access])" tab="chat" [class.active]="pathname === '/home/chat' ">
|
||||
<ion-icon *ngIf="pathname != '/home/chat'" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
|
||||
<ion-icon *ngIf="pathname == '/home/chat'" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
|
||||
<ion-tab-button *ngIf="p.userPermission([permissionList.Chat.access])" tab="chat" [class.active]="ActiveTabService.pages.chat">
|
||||
<ion-icon *ngIf="!ActiveTabService.pages.chat" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ActiveTabService.pages.chat" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
|
||||
<ion-label>Chat</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import { EventsService } from 'src/app/services/events.service';
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||
import { Device } from '@capacitor/device';
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
|
||||
@@ -89,10 +90,11 @@ export class HomePage implements OnInit {
|
||||
private RochetChatConnectorService: RochetChatConnectorService,
|
||||
private NetworkServiceService: NetworkServiceService,
|
||||
public eventService: EventsService,
|
||||
) {
|
||||
if (SessionStore.exist) {
|
||||
this.user = SessionStore.user;
|
||||
}
|
||||
public ActiveTabService: ActiveTabService
|
||||
) {
|
||||
if (SessionStore.exist) {
|
||||
this.user = SessionStore.user;
|
||||
}
|
||||
|
||||
this.NativeNotificationService.askForPermission();
|
||||
this.NativeNotificationService.foregroundNotification();
|
||||
@@ -224,10 +226,6 @@ export class HomePage implements OnInit {
|
||||
const info = await Device.getInfo();
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
return window.location.pathname
|
||||
}
|
||||
|
||||
updateList() {
|
||||
|
||||
document.addEventListener('pause', function () {
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-div">
|
||||
<div *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
|
||||
@@ -104,7 +104,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-people-cc.svg"></ion-icon>
|
||||
|
||||
@@ -97,7 +97,7 @@ export class CreateProcessPage implements OnInit {
|
||||
public p: PermissionService,
|
||||
private despachoService: DespachoService,
|
||||
private pedidoService: PedidoService,
|
||||
public ThemeService: ThemeService
|
||||
public ThemeService: ThemeService,
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
this.task = this.navParams.get('task');
|
||||
@@ -199,6 +199,13 @@ export class CreateProcessPage implements OnInit {
|
||||
this.validateFrom = true
|
||||
}
|
||||
|
||||
defaultParticipants () {
|
||||
if(this.p.userPermission([this.p.permissionList.Gabinete.pr_tasks])) {
|
||||
return ['MDGPR']
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
injectValidation() {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
@@ -212,7 +219,7 @@ export class CreateProcessPage implements OnInit {
|
||||
Priority: new FormControl(this.postData.Priority, [
|
||||
Validators.required,
|
||||
]),
|
||||
participantes: new FormControl(this.taskParticipants, [
|
||||
participantes: new FormControl(this.defaultParticipants() || this.taskParticipants, [
|
||||
Validators.required
|
||||
]),
|
||||
selectedTypes: new FormControl(this.selectedTypes, [
|
||||
|
||||
@@ -67,9 +67,11 @@
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
|
||||
<mat-option *ngFor="let calendars of _eventService.calendarNamesAry" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' "> Agenda de {{calendars}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Agenda de {{loggeduser.FullName}} </div>
|
||||
<mat-option *ngFor="let calendars of _eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
|
||||
@@ -94,6 +94,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
CalendarName;
|
||||
CalendarNameShow = true
|
||||
CalendarNamesOptions
|
||||
testeFormDefaul = "Eudes"
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as internal from "stream";
|
||||
|
||||
export class DailyWorkTask{
|
||||
SerialNumber: string;
|
||||
Folio: string;
|
||||
@@ -67,11 +69,29 @@ export class fullTask {
|
||||
workflowName: string
|
||||
}
|
||||
|
||||
export const activityInstanceNameArray = [
|
||||
'Concluir Despacho',
|
||||
'Tarefa de Despacho','Reexecutar Despacho','Concluir Parecer',
|
||||
'Concluir Deferimento',
|
||||
'Reapreciar Deferimento',
|
||||
'Tarefa de Deferimento',
|
||||
'Assinar Diploma',
|
||||
'Diploma Assinado',
|
||||
'Retificar Diploma',
|
||||
'Gerar Diploma',
|
||||
'Editar Evento',
|
||||
'Revisar Diploma',
|
||||
'Tarefa de Parecer'
|
||||
] as const; // TS3.4 syntax
|
||||
|
||||
|
||||
export type activityInstanceName = typeof activityInstanceNameArray[number];
|
||||
|
||||
export interface fullTaskList {
|
||||
serialNumber: string;
|
||||
taskStartDate: string;
|
||||
workflowDisplayName: string;
|
||||
activityInstanceName: string;
|
||||
activityInstanceName: activityInstanceName;
|
||||
totalDocuments: number;
|
||||
workflowInstanceDataFields: {
|
||||
Subject: string;
|
||||
@@ -142,6 +162,7 @@ export interface expedienteTask {
|
||||
}
|
||||
|
||||
export interface ExpedienteTask {
|
||||
Folio: string
|
||||
SerialNumber: string
|
||||
Senders : string
|
||||
CreateDate : any
|
||||
@@ -151,4 +172,23 @@ export interface ExpedienteTask {
|
||||
Status : string
|
||||
taskStartDate: string
|
||||
Subject: string
|
||||
}
|
||||
|
||||
|
||||
export interface PedidoDeDeferimento {
|
||||
serialNumber: string;
|
||||
taskStartDate: Date;
|
||||
deadline: Date | null;
|
||||
workflowDisplayName: string;
|
||||
activityInstanceName: string;
|
||||
totalDocuments: number;
|
||||
workflowInstanceDataFields: PedidoDeDeferimentoWorkflowInstanceDataFields;
|
||||
}
|
||||
|
||||
export interface PedidoDeDeferimentoWorkflowInstanceDataFields {
|
||||
Sender: string;
|
||||
Subject: string;
|
||||
FolderID: number;
|
||||
Status: string;
|
||||
originator: string;
|
||||
}
|
||||
@@ -218,8 +218,8 @@
|
||||
<!-- List -->
|
||||
<ul *ngIf="showTimelineFilterState">
|
||||
<li class="changeText" [class.active]="segment == 'Combinado' " (click)="changeSegment('Combinado')" class="cursor-pointer">Todos</li>
|
||||
<li class="changeText" [class.active]="segment == 'Oficial' " (click)="changeSegment('Oficial')" class="cursor-pointer">Calendário Oficial</li>
|
||||
<li class="changeText" [class.active]="segment == 'Pessoal' " (click)="changeSegment('Pessoal')" class="cursor-pointer">Calendário Pessoal</li>
|
||||
<li class="changeText" [class.active]="segment == 'Oficial' " (click)="changeSegment('Oficial')" class="cursor-pointer">Agenda Oficial</li>
|
||||
<li class="changeText" [class.active]="segment == 'Pessoal' " (click)="changeSegment('Pessoal')" class="cursor-pointer">Agenda Pessoal</li>
|
||||
</ul>
|
||||
|
||||
</ion-row>
|
||||
@@ -233,10 +233,11 @@
|
||||
<div class="calendar-title-description text-black align-center" *ngIf="eventService.hasSharedCalendar">
|
||||
<div class="flex-grow-1 text-grey d-flex justify-center align-center">
|
||||
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry.slice(0, 2)" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && checkRoleInArray('Presidente da República')"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && checkRoleInArray('Ministro e Director do Gabinete do PR')"> Agenda do MDGPR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && checkRoleInArray('Presidente da República') && checkRoleInArray('Ministro e Director do Gabinete do PR')"> Agenda do {{calendars}} </div>
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
|
||||
</mat-option>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -202,6 +202,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.listToPresent = []
|
||||
|
||||
|
||||
})
|
||||
|
||||
if (this.loggeduser.Profile == 'MDGPR') {
|
||||
@@ -233,6 +234,9 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
window['year'] = this.changeYear
|
||||
|
||||
console.log('SessionStore.user', SessionStore.user)
|
||||
|
||||
|
||||
}
|
||||
|
||||
tigerUpdate() {
|
||||
|
||||
@@ -64,10 +64,10 @@
|
||||
<mat-form-field appearance="none" floatLabel="never" class="width-100 " >
|
||||
<mat-select placeholder="Selecione agenda*" [(ngModel)]="postEvent.CalendarName" >
|
||||
<mat-option value="Oficial">
|
||||
Calendário Oficial
|
||||
Agenda Oficial
|
||||
</mat-option>
|
||||
<mat-option value="Pessoal">
|
||||
Calendário Pessoal
|
||||
Agenda Pessoal
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -28,11 +28,18 @@
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
|
||||
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' "> Agenda de {{calendars}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Agenda de {{loggeduser.FullName}} </div>
|
||||
|
||||
|
||||
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
@@ -41,7 +48,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
@@ -63,7 +69,7 @@
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="postEvent.CalendarName" >
|
||||
<mat-option *ngFor="let calendars of CalendarNamesOptions" value="{{calendars}}">
|
||||
Calendário {{ calendars }}
|
||||
Agenda {{ calendars }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -117,6 +117,7 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
if(!this.CalendarName) {
|
||||
console.log('true', this.eventService.calendarNamesAry.includes('Meu calendario'))
|
||||
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
|
||||
this.CalendarName = 'Meu calendario';
|
||||
console.log(this.eventService.calendarNamesAry)
|
||||
|
||||
@@ -83,9 +83,12 @@ export class DiplomasAssinarPage implements OnInit {
|
||||
|
||||
let diplomasAssinar = diplomas.filter(data => data.activityInstanceName == "Assinar Diploma");
|
||||
|
||||
|
||||
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
|
||||
this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate')
|
||||
let format = diplomasAssinar.map(element => {
|
||||
return this.customTaskPipe.transform(element)
|
||||
});
|
||||
|
||||
this.deplomasStore.resetDiplomasParaAssinar(format)
|
||||
this.diplomasList = this.sortService.sortDate(format, 'CreateDate')
|
||||
} catch(error) {
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { DeplomasStore } from 'src/app/store/deplomas.service';
|
||||
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -28,6 +29,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
|
||||
skeletonLoader = true
|
||||
deplomasStore = DeplomasStore
|
||||
customTaskPipe = new CustomTaskPipe()
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
@@ -124,13 +126,10 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate');
|
||||
|
||||
let diplomasAssinados = diplomas.filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinadoList = [];
|
||||
|
||||
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTask(element);
|
||||
diplomasAssinadoList.push(task);
|
||||
// console.log('DIPLOMAS ASSINADOS', task)
|
||||
let diplomasAssinadoList = diplomasAssinados.map( element => {
|
||||
return this.pipeTask(element);
|
||||
});
|
||||
|
||||
this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate')
|
||||
@@ -138,7 +137,10 @@ export class DiplomasPage implements OnInit, OnDestroy {
|
||||
|
||||
|
||||
let diplomasAssinar = diplomas.filter(data => data.activityInstanceName == "Assinar Diploma");
|
||||
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
|
||||
|
||||
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar.map(element => {
|
||||
return this.customTaskPipe.transform(element)
|
||||
}))
|
||||
|
||||
// console.log('DIPLOMAS ASSINADOS', this.diplomasAssinadoList)
|
||||
|
||||
|
||||
@@ -17,14 +17,12 @@
|
||||
<ion-toolbar>
|
||||
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
|
||||
<ion-segment-button value="MDGPR">
|
||||
Meu Calendário
|
||||
Minha agenda
|
||||
</ion-segment-button>
|
||||
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry" value="PR">
|
||||
<!-- <ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry" value="PR">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div> -->
|
||||
Calendário Partilhado
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
|
||||
+15
-10
@@ -33,16 +33,21 @@
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="CalendarOwnerName" (selectionChange)="changeAgenda()">
|
||||
|
||||
<mat-option *ngFor="let calendars of calendarService.calendarNamesAry" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendar == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendar == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendar != 'Ministro e Director do Gabinete do PR' && calendar != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
|
||||
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
|
||||
|
||||
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
</mat-option>
|
||||
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -71,7 +76,7 @@
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="CalendarName" >
|
||||
<mat-option *ngFor="let calendars of CalendarNamesOptions" value="{{calendars}}">
|
||||
{{ calendars }}
|
||||
Calendário {{ calendars }}
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
|
||||
+2
-2
@@ -129,7 +129,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div" >
|
||||
<div class="container-div" *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
|
||||
@@ -152,7 +152,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div class="container-div" *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-people-cc.svg"></ion-icon>
|
||||
|
||||
+12
-3
@@ -23,7 +23,7 @@ import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { SearchDocumentPipe } from 'src/app/pipes/search-document.pipe';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -109,7 +109,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
private userAuth: AuthService,
|
||||
private toastService: ToastService,
|
||||
private despachoService: DespachoService,
|
||||
public ThemeService: ThemeService
|
||||
public ThemeService: ThemeService,
|
||||
public p: PermissionService,
|
||||
) {
|
||||
|
||||
this.loggeduser = SessionStore.user;
|
||||
@@ -194,6 +195,14 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
this.validateFrom = true;
|
||||
}
|
||||
|
||||
defaultParticipants () {
|
||||
if(this.p.userPermission([this.p.permissionList.Gabinete.pr_tasks])) {
|
||||
return ['MDGPR']
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
injectValidation() {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
@@ -210,7 +219,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
Priority: new FormControl(this.postData.Priority, [
|
||||
Validators.required,
|
||||
]),
|
||||
participantes: new FormControl(this.taskParticipants, [
|
||||
participantes: new FormControl(this.defaultParticipants() || this.taskParticipants, [
|
||||
Validators.required
|
||||
]),
|
||||
|
||||
|
||||
@@ -394,8 +394,6 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}, (error) => {
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@
|
||||
<!-- This is the box view -->
|
||||
<div *ngSwitchCase="'boxview'" class="aside overflow-y-auto d-flex flex-wrap width-100 height-100">
|
||||
<div *ngIf="loadCount">
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="hideInMobile" (click)="openAllProcessesPage()" [class.active]="selectedElement == 'allProcessesTag'" class="box-hover exp-card d-flex flex-column" >
|
||||
<div class="d-flex justify-center">
|
||||
<!-- <ion-icon src="assets/images/icons-agenda.svg"></ion-icon> -->
|
||||
@@ -149,77 +151,8 @@
|
||||
<p class="text-center exp-card-title ">Todas as tarefas</p>
|
||||
<p class="text-center exp-card-content"> {{ getAllProcessCount }} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])" (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="box-hover exp-card d-flex flex-column">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon src="assets/images/icons-agenda.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Eventos para Aprovação</p>
|
||||
<p class="text-center exp-card-content"> {{eventoaprovacaostore.countMd + eventoaprovacaostore.countPr}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div (click)="openExpedientListPage(); selectedElement='Correspondence'" [class.active]="selectedElement == 'Correspondence'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-correspondencia.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'Correspondence'" src="assets/images/theme/gov/icons-correspondencia.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'Correspondence'" src="assets/images/theme/gov/icons-correspondencia-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-correspondencia.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'Correspondence'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-correspondencia-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Expediente</p>
|
||||
<p class="text-center exp-card-content"> {{expedientegbstore.count}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div [class.active]="selectedElementF('Pending')" (click)="openPendentesPage(); selectedElement='Pending'" class="box-hover exp-card d-flex flex-column justify-center" >
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-pendente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'Pending'" src="assets/images/theme/gov/icons-expediente-pendente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'Pending'" src="assets/images/theme/gov/icons-expediente-pendente-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-pendente.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'Pending'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-pendente-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Pendentes</p>
|
||||
<p *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Meus Pendentes</p>
|
||||
<p class="text-center exp-card-content"> <span class="number">{{pendentesstore.count}} </span> <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" [class.active]="selectedElement == 'Dispatches'" class="box-hover exp-card d-flex flex-column justify-center" (click)="openDespachosPage(); selectedElement='Dispatches'">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-despachos-presidente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'Dispatches'" src="assets/images/theme/gov/icons-despachos-presidente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'Dispatches'" src="assets/images/theme/gov/icons-despachos-presidente-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-despachos-presidente.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'Dispatches'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-despachos-presidente-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Despachos</p>
|
||||
<p class="text-center exp-card-content"> {{despachoStore.count}} <span class="title1">Documentos</span> </p>
|
||||
</div>
|
||||
|
||||
<div (click)="openPedidosPage('parecer'); selectedElement='RequestsForOpinion'" [class.active]="selectedElement == 'RequestsForOpinion'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-parecer.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'RequestsForOpinion' " src="assets/images/theme/gov/icons-expediente-parecer.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'RequestsForOpinion'" src="assets/images/theme/gov/icons-expediente-parecer-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-parecer.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'RequestsForOpinion'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-parecer-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Pedidos de Parecer</p>
|
||||
<p *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Pedidos de Parecer solicitados por mim</p>
|
||||
<p class="text-center exp-card-content"> {{pedidosstore.countparecer}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div (click)="openPedidosPage('deferimento'); selectedElement = 'RequestForApproval'" [class.active]="selectedElement == 'RequestForApproval'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-deferimento.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'RequestForApproval'" src="assets/images/theme/gov/icons-expediente-deferimento.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'RequestForApproval'" src="assets/images/theme/gov/icons-expediente-deferimento-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-deferimento.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'RequestForApproval'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-deferimento-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Pedidos de Deferimento</p>
|
||||
<p class="text-center exp-card-content"> {{pedidosstore.countdeferimento}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks, p.permissionList.Gabinete.pr_tasks])" (click)="openDespachosPrPage(); selectedElement='showDespachosPr'" [class.active]="selectedElement == 'showDespachosPr'" class="box-hover exp-card-long width-100 d-flex flex-column justify-center">
|
||||
<div class="center-div">
|
||||
<div class="exp-card-icon">
|
||||
@@ -235,8 +168,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks])" (click)="openDiplomasAssinarPage(); selectedElement='DiplomasParaAssinar'" [class.active]="selectedElement == 'DiplomasParaAssinar'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title">Diplomas por Assinar </p>
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.diplomasParaAssinartCount }} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks])" (click)="openDiplomasPage('validar'); selectedElement='DiplomasPorValidar'" [class.active]="selectedElement == 'DiplomasPorValidar'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-diploma.svg"></ion-icon>
|
||||
@@ -248,6 +195,8 @@
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.deplomasReviewCount }} <span class="title1">Documentos</span> </p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks, p.permissionList.Gabinete.pr_tasks])" (click)="openDiplomasPage('assinados'); selectedElement='DiplomasAssinados'" [class.active]="selectedElement == 'DiplomasAssinados'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-diplomas-assinados-presidente.svg"></ion-icon>
|
||||
@@ -258,7 +207,21 @@
|
||||
<p class="text-center exp-card-title " *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" >Diplomas</p>
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.countDiplomasAssinadoListCount }} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" (click)="openDiplomasAssinarPage(); selectedElement='DiplomasParaAssinar'" [class.active]="selectedElement == 'DiplomasParaAssinar'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title">Diplomas para Assinar</p>
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.diplomasParaAssinartCount }} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="SessionStore.user.Profile == 'Consultant' && environment.presidencial" (click)="openDiplomaPorElaborar('gerarDiplomas'); selectedElement='gerarDiplomas'" [class.active]="selectedElement == 'gerarDiplomas'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-diplomas-assinados-presidente.svg"></ion-icon>
|
||||
@@ -272,31 +235,89 @@
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.DiplomaGerarList.length }} <span class="title1">Documentos</span></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" (click)="openDiplomasAssinarPage(); selectedElement='DiplomasParaAssinar'" [class.active]="selectedElement == 'DiplomasParaAssinar'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
|
||||
<!-- List -->
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])" (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="box-hover exp-card d-flex flex-column">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
<ion-icon src="assets/images/icons-agenda.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title">Diplomas para Assinar</p>
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.diplomasParaAssinartCount }} <span class="title1">Documentos</span></p>
|
||||
<p class="text-center exp-card-title ">Eventos para Aprovação</p>
|
||||
<p class="text-center exp-card-content"> {{eventoaprovacaostore.countMd + eventoaprovacaostore.countPr}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<!-- List -->
|
||||
<div (click)="openExpedientListPage(); selectedElement='Correspondence'" [class.active]="selectedElement == 'Correspondence'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-correspondencia.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'Correspondence'" src="assets/images/theme/gov/icons-correspondencia.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'Correspondence'" src="assets/images/theme/gov/icons-correspondencia-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-correspondencia.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'Correspondence'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-correspondencia-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Expediente</p>
|
||||
<p class="text-center exp-card-content"> {{expedientegbstore.count}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks])" (click)="openDiplomasAssinarPage(); selectedElement='DiplomasParaAssinar'" [class.active]="selectedElement == 'DiplomasParaAssinar'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<!-- List -->
|
||||
<div *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" [class.active]="selectedElement == 'Dispatches'" class="box-hover exp-card d-flex flex-column justify-center" (click)="openDespachosPage(); selectedElement='Dispatches'">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/gov/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'DiplomasParaAssinar' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-diploma-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-despachos-presidente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'Dispatches'" src="assets/images/theme/gov/icons-despachos-presidente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'Dispatches'" src="assets/images/theme/gov/icons-despachos-presidente-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-despachos-presidente.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'Dispatches'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-despachos-presidente-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title">Diplomas por Assinar </p>
|
||||
<p class="text-center exp-card-content"> {{ deplomasStore.diplomasParaAssinartCount }} <span class="title1">Documentos</span></p>
|
||||
<p class="text-center exp-card-title ">Despachos</p>
|
||||
<p class="text-center exp-card-content"> {{despachoStore.count}} <span class="title1">Documentos</span> </p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- List -->
|
||||
<div (click)="openPedidosPage('parecer'); selectedElement='RequestsForOpinion'" [class.active]="selectedElement == 'RequestsForOpinion'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-parecer.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'RequestsForOpinion' " src="assets/images/theme/gov/icons-expediente-parecer.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'RequestsForOpinion'" src="assets/images/theme/gov/icons-expediente-parecer-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-parecer.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'RequestsForOpinion'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-parecer-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Pedidos de Parecer</p>
|
||||
<p *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Pedidos de Parecer solicitados por mim</p>
|
||||
<p class="text-center exp-card-content"> {{pedidosstore.countparecer}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<!-- List -->
|
||||
<div (click)="openPedidosPage('deferimento'); selectedElement = 'RequestForApproval'" [class.active]="selectedElement == 'RequestForApproval'" class="box-hover exp-card d-flex flex-column justify-center">
|
||||
<div class="d-flex justify-center">
|
||||
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-deferimento.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'RequestForApproval'" src="assets/images/theme/gov/icons-expediente-deferimento.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'RequestForApproval'" src="assets/images/theme/gov/icons-expediente-deferimento-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-deferimento.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'RequestForApproval'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-deferimento-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p class="text-center exp-card-title ">Pedidos de Deferimento</p>
|
||||
<p class="text-center exp-card-content"> {{pedidosstore.countdeferimento}} <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
<!-- List -->
|
||||
<div [class.active]="selectedElementF('Pending')" (click)="openPendentesPage(); selectedElement='Pending'" class="box-hover exp-card d-flex flex-column justify-center" >
|
||||
<div class="d-flex justify-center">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-pendente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement != 'Pending'" src="assets/images/theme/gov/icons-expediente-pendente.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && selectedElement == 'Pending'" src="assets/images/theme/gov/icons-expediente-pendente-hover.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-pendente.svg"></ion-icon>
|
||||
<ion-icon hidden *ngIf="ThemeService.currentTheme == 'doneIt' && selectedElement == 'Pending'" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-expediente-pendente-hover.svg"></ion-icon>
|
||||
</div>
|
||||
<p *ngIf="!p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Pendentes</p>
|
||||
<p *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" class="text-center exp-card-title ">Meus Pendentes</p>
|
||||
<p class="text-center exp-card-content"> <span class="number">{{pendentesstore.count}} </span> <span class="title1">Documentos</span></p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loadCount" class="width-100">
|
||||
|
||||
@@ -705,12 +705,12 @@ export class GabineteDigitalPage implements OnInit {
|
||||
this.pendentesstore.reset(pendentes);
|
||||
this.updateAllProcess()
|
||||
|
||||
let depachoAPI: any = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
let depachoAPI = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
|
||||
|
||||
if(SessionStore.user.Profile != 'PR') {
|
||||
|
||||
let depacho = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
let depacho: any = depachoAPI.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
|
||||
depacho = depacho.filter(data => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
|
||||
@@ -719,7 +719,7 @@ export class GabineteDigitalPage implements OnInit {
|
||||
this.updateAllProcess()
|
||||
} else if(SessionStore.user.Profile == 'PR') {
|
||||
|
||||
let depacho = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
let depacho: any = depachoAPI.filter(data => data.activityInstanceName == "Concluir Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active")
|
||||
depacho = depacho.map((e)=> this.customTaskPipe.transform(e))
|
||||
this.despachoprstore.reset(depacho)
|
||||
this.updateAllProcess()
|
||||
@@ -771,12 +771,14 @@ export class GabineteDigitalPage implements OnInit {
|
||||
}))
|
||||
|
||||
|
||||
let diplomasAssinar = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
|
||||
|
||||
let diplomasAssinar: any = depachoAPI.filter(data => data.activityInstanceName == "Assinar Diploma");
|
||||
diplomasAssinar = diplomasAssinar.map((element) => this.expedienteTaskPipe.transform(element))
|
||||
this.deplomasStore.resetDiplomasParaAssinar(diplomasAssinar)
|
||||
|
||||
let diplomasAssinados = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
let diplomasAssinados: any = depachoAPI.filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
diplomasAssinados = diplomasAssinados.map((element) => this.expedienteTaskPipe.transform(element))
|
||||
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
|
||||
|
||||
|
||||
this.updateAllProcess()
|
||||
this.loadCount = true
|
||||
@@ -789,7 +791,10 @@ export class GabineteDigitalPage implements OnInit {
|
||||
|
||||
if (event) {
|
||||
setTimeout(() => {
|
||||
event?.target?.complete();
|
||||
try {
|
||||
event?.target?.complete();
|
||||
} catch(error) {}
|
||||
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -16,6 +16,7 @@ export class ExpedienteTaskPipe implements PipeTransform {
|
||||
"SerialNumber": fullTask.serialNumber,
|
||||
"taskStartDate": fullTask.taskStartDate,
|
||||
"Subject": fullTask.workflowInstanceDataFields.Subject,
|
||||
"Folio": fullTask.workflowInstanceDataFields.Subject,
|
||||
"Senders": fullTask.workflowInstanceDataFields.Sender,
|
||||
"CreateDate": date,
|
||||
"DocumentsQty": fullTask.totalDocuments,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ActiveTabService } from './active-tab.service';
|
||||
|
||||
describe('ActiveTabService', () => {
|
||||
let service: ActiveTabService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ActiveTabService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ActiveTabService {
|
||||
|
||||
pages = {
|
||||
chat: false,
|
||||
agenda: false,
|
||||
publication: false,
|
||||
home: false,
|
||||
gabinete: false
|
||||
}
|
||||
|
||||
constructor(private router: Router) {
|
||||
|
||||
this.detectActiveTab()
|
||||
|
||||
this.router.events.subscribe((val) => {
|
||||
this.detectActiveTab()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
detectActiveTab() {
|
||||
this.setFalseToAllPage();
|
||||
const pathName = window.location.pathname
|
||||
|
||||
if(pathName.startsWith('/home/agenda')) {
|
||||
this.pages.agenda = true
|
||||
} else if (pathName.startsWith('/home/events')) {
|
||||
this.pages.home = true
|
||||
} else if (pathName.startsWith('/home/gabinete-digital')) {
|
||||
this.pages.gabinete = true
|
||||
} else if (pathName.startsWith('/home/publications')) {
|
||||
this.pages.publication = true
|
||||
} else if (pathName.startsWith('/home/chat')) {
|
||||
this.pages.chat = true
|
||||
}
|
||||
}
|
||||
|
||||
setFalseToAllPage() {
|
||||
for( const page in this.pages) {
|
||||
this.pages[page] = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,13 @@ export class ChatSystemService {
|
||||
this.loadChat();
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('resume', function () {
|
||||
if(this._dm?.length == 0 && this._group?.length == 0) {
|
||||
this.getAllRooms();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
loadChat() {
|
||||
|
||||
@@ -480,7 +480,7 @@ export class MessageService {
|
||||
return SessionStore.user.ChatData.data.userId == this.u._id
|
||||
}
|
||||
|
||||
private getChatObj() {
|
||||
getChatObj() {
|
||||
return {
|
||||
channels: this.channels,
|
||||
mentions: this.mentions,
|
||||
|
||||
@@ -125,7 +125,7 @@ export class RoomService {
|
||||
this.hasLoadHistory = false
|
||||
this.subscribeAttempt = false
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -174,11 +174,7 @@ export class RoomService {
|
||||
|
||||
this.calDateDuration();
|
||||
|
||||
(async () => {
|
||||
await this.restoreMessageFromDB()
|
||||
await this.loadHistory({})
|
||||
})()
|
||||
|
||||
|
||||
if(this.customFields?.countDownDate) {
|
||||
this.countDownDate(this.customFields.countDownDate);
|
||||
}
|
||||
@@ -327,7 +323,7 @@ export class RoomService {
|
||||
if(!found) {
|
||||
|
||||
ChatMessage.origin = 'stream'
|
||||
const message = await this.prepareCreate({message: ChatMessage, save: true});
|
||||
const message = await this.prepareCreate({message: ChatMessage, save: false});
|
||||
this.registerSendMessage(message)
|
||||
|
||||
message.from = 'stream'
|
||||
@@ -348,7 +344,10 @@ export class RoomService {
|
||||
}
|
||||
|
||||
if(this.hasLoadHistory == true) {
|
||||
this.messages.push(message)
|
||||
await message.addMessageDB()
|
||||
} else {
|
||||
this.messagesBeforeOfflineAPI.push(message)
|
||||
}
|
||||
|
||||
if(this.chatOpen == false) {
|
||||
@@ -503,7 +502,6 @@ export class RoomService {
|
||||
|
||||
if(previousLastMessage) {
|
||||
this.lastMessage = previousLastMessage;
|
||||
// console.log("last message"+ previousLastMessage)
|
||||
this.calDateDuration(previousLastMessage._updatedAt)
|
||||
this.sortRoomList()
|
||||
}
|
||||
@@ -736,12 +734,11 @@ export class RoomService {
|
||||
setTimeout(() => {
|
||||
this.scrollDown()
|
||||
}, 50)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// runs onces only
|
||||
|
||||
loadHistoryCount = 0
|
||||
async loadHistory({limit = 1000, forceUpdate = false }) {
|
||||
|
||||
if(forceUpdate == false) {
|
||||
@@ -752,33 +749,37 @@ export class RoomService {
|
||||
|
||||
this.hasLoadHistory = true
|
||||
|
||||
await this.restoreMessageFromDB()
|
||||
const chatHistory: chatHistory = await this.RochetChatConnectorService.loadHistory(this.id, limit)
|
||||
|
||||
if(chatHistory?.result?.messages) {
|
||||
const messagesId = this.messages.map((message)=> message._id)
|
||||
|
||||
const users = this.getUsersByStatus('online')
|
||||
|
||||
for(let message of chatHistory.result.messages.reverse()) {
|
||||
if (!messagesId.includes(message._id)) {
|
||||
message.origin = 'history'
|
||||
message.from = 'History'
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
|
||||
if(messagesToSave != null) {
|
||||
|
||||
messagesToSave.received = users.map((user) => user._id)
|
||||
messagesToSave.addMessageDB()
|
||||
|
||||
// console.log('add history', message)
|
||||
} else {
|
||||
// console.log('exit')
|
||||
}
|
||||
} else {
|
||||
// console.log('exit')
|
||||
message.origin = 'history'
|
||||
message.from = 'History'
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
|
||||
if(messagesToSave != null) {
|
||||
|
||||
messagesToSave.received = users.map((user) => user._id)
|
||||
messagesToSave.addMessageDB()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
for( const message of this.messagesBeforeOfflineAPI) {
|
||||
const messagesToSave = await this.prepareMessageCreateIfNotExist({message: message});
|
||||
if(messagesToSave != null) {
|
||||
|
||||
messagesToSave.received = users.map((user) => user._id)
|
||||
messagesToSave.addMessageDB()
|
||||
}
|
||||
}
|
||||
this.messagesBeforeOfflineAPI = []
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollDown()
|
||||
}, 50)
|
||||
@@ -824,8 +825,10 @@ export class RoomService {
|
||||
wewMessage.setData(message)
|
||||
wewMessage.loadHistory = this.hasLoadHistory
|
||||
|
||||
this.messages.push(wewMessage)
|
||||
|
||||
if(save) {
|
||||
this.messages.push(wewMessage)
|
||||
}
|
||||
|
||||
return wewMessage
|
||||
}
|
||||
|
||||
@@ -842,17 +845,17 @@ export class RoomService {
|
||||
|
||||
private findMessageBy_id (id) {
|
||||
for( let m of this.messages) {
|
||||
if(m._id == id) {
|
||||
if(m?._id == id) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private findMessageBy_localReference (localReference) {
|
||||
for( let m of this.messages) {
|
||||
if(m.localReference == localReference) {
|
||||
if(m?.localReference == localReference) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -893,7 +896,7 @@ export class RoomService {
|
||||
async prepareMessageCreateIfNotExist({message}) {
|
||||
message = this.fix_updatedAt(message)
|
||||
|
||||
let found = await this.findMessageBy_id(message._id) || this.findMessageBy_localReference(message.localReference)
|
||||
let found = await this.findMessageBy_id(message._id) || await this.findMessageBy_localReference(message.localReference)
|
||||
// || await this.findMessageInDBByData({_id:message._id, localReference:message.localReference })
|
||||
|
||||
if (!found) {
|
||||
|
||||
@@ -259,7 +259,7 @@ export class EventsService {
|
||||
|
||||
console.log('ROLE',e.Role, e.FullName)
|
||||
|
||||
if(!this.calendarNamesAry.includes(e.FullName)) {
|
||||
if(!this.calendarNamesAry.find(x => x.Role == e.Role)) {
|
||||
/* if(e.Role == "Presidente da República") {
|
||||
this.calendarNamesAry.push(e.Role)
|
||||
console.log('PR ROLE',this.calendarNamesAry)
|
||||
@@ -271,13 +271,21 @@ export class EventsService {
|
||||
console.log('NORMAL ROLE',this.calendarNamesAry)
|
||||
} */
|
||||
//this.calendarRole.push(e.Role)
|
||||
let objectShared = {
|
||||
"Fullname": e.FullName,
|
||||
"Role": e.Role
|
||||
}
|
||||
|
||||
this.calendarNamesAry.push(objectShared)
|
||||
|
||||
|
||||
console.log('objectShared',this.calendarNamesAry)
|
||||
this.calendarNamesType[e.FullName] = {}
|
||||
}
|
||||
|
||||
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName] = true
|
||||
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
|
||||
|
||||
this.calendarNamesType[e.FullName]['RoleId'] = sharedCalendar.CalendarRoleId
|
||||
})
|
||||
}
|
||||
|
||||
@@ -290,11 +298,13 @@ export class EventsService {
|
||||
|
||||
if(!this.calendarNamesAry.includes('Meu calendario')) {
|
||||
this.calendarNamesAry.push('Meu calendario')
|
||||
console.log(this.calendarNamesAry)
|
||||
this.calendarNamesType['Meu calendario'] = {}
|
||||
}
|
||||
|
||||
this.calendarNamesType['Meu calendario'][sharedCalendar.CalendarName] = true
|
||||
this.calendarNamesType['Meu calendario'][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
|
||||
this.calendarNamesType['Meu calendario']['RoleId'] = sharedCalendar.CalendarRoleId
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ProcessesService {
|
||||
return this.http.get<ExpedienteFullTask[]>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
GetTask(serialnumber:string): Observable<any>{
|
||||
GetTask(serialnumber:string): Observable<any> {
|
||||
const geturl = environment.apiURL + 'Tasks/FindTask';
|
||||
let params = new HttpParams();
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
<ion-toolbar>
|
||||
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
|
||||
<ion-segment-button value="MDGPR">
|
||||
Meu Calendário
|
||||
Minha agenda
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="PR">
|
||||
Calendário Partilhado
|
||||
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry" value="PR">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
|
||||
@@ -6,6 +6,7 @@ import { NavigationEnd, Router } from '@angular/router';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-list',
|
||||
@@ -36,6 +37,7 @@ export class EventListPage implements OnInit {
|
||||
private processes:ProcessesService,
|
||||
private router: Router,
|
||||
private sortService: SortService,
|
||||
public eventService: EventsService,
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
}
|
||||
|
||||
@@ -40,11 +40,17 @@
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
|
||||
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendar == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendar == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendar != 'Ministro e Director do Gabinete do PR' && calendar != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
|
||||
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
|
||||
<div class="title">
|
||||
<div class="thetitle"><ion-label >Diplomas para assinar</ion-label></div>
|
||||
<!-- <div class="theicon">
|
||||
<div class="theicon">
|
||||
<button title="Atualizar" class="btn-no-color" (click)="doRefresh($event)">
|
||||
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
|
||||
</button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="item width-100">
|
||||
<div class="exp-top-detail">
|
||||
<div class="subject">
|
||||
<ion-label>{{ task.Folio }}</ion-label>
|
||||
<ion-label>{{ task.Folio || task.workflowInstanceDataFields.Subject }}</ion-label>
|
||||
</div>
|
||||
<div class="exp-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-expediente-attachment.svg"></ion-icon>
|
||||
|
||||
@@ -71,9 +71,8 @@ export class DiplomasAssinarPage implements OnInit {
|
||||
|
||||
let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma");
|
||||
|
||||
diplomasAssinar.forEach(element => {
|
||||
let task: customTask = this.customTaskPipe.transform(element)
|
||||
this.diplomasList.push(task);
|
||||
this.diplomasList = diplomasAssinar.map(element => {
|
||||
return this.customTaskPipe.transform(element)
|
||||
});
|
||||
|
||||
this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate')
|
||||
|
||||
@@ -66,29 +66,23 @@ export class DiplomasPage implements OnInit {
|
||||
let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
|
||||
|
||||
this.diplomasList = [];
|
||||
let diplomasList = [];
|
||||
|
||||
// let diplomasReview = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
|
||||
diplomas.forEach(element => {
|
||||
|
||||
let task = this.pipeTask(element)
|
||||
diplomasList.push(task);
|
||||
let diplomasList = diplomas.map(element => {
|
||||
return this.pipeTask(element)
|
||||
});
|
||||
|
||||
diplomasList = diplomasList.filter(data => data.activityInstanceName != "Tarefa de Despacho");
|
||||
diplomasList = diplomasList.filter(data => data.activityInstanceName == "Revisar Diploma");
|
||||
|
||||
this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate')
|
||||
|
||||
this.deplomasStore.resetDiplomasReview(this.diplomasList)
|
||||
|
||||
let diplomasAssinadoList = []
|
||||
let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
|
||||
|
||||
diplomasAssinados.forEach(async element => {
|
||||
|
||||
let task = this.pipeTask(element)
|
||||
diplomasAssinadoList.push(task);
|
||||
let diplomasAssinadoList = diplomasAssinados.map(element => {
|
||||
return this.pipeTask(element)
|
||||
});
|
||||
|
||||
this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate')
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
<ion-toolbar>
|
||||
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
|
||||
<ion-segment-button value="MDGPR">
|
||||
Meu Calendário
|
||||
Minha agenda
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="PR">
|
||||
Calendário Partilhado
|
||||
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry" value="PR">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.FullName}} </div>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
|
||||
@@ -10,6 +10,8 @@ import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.servic
|
||||
import { SortService } from 'src/app/services/functions/sort.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-events-to-approve',
|
||||
@@ -35,7 +37,8 @@ export class EventsToApprovePage implements OnInit {
|
||||
private router: Router,
|
||||
private userAuth: AuthService,
|
||||
private sortService: SortService,
|
||||
private storage: Storage
|
||||
private storage: Storage,
|
||||
public eventService: EventsService,
|
||||
)
|
||||
{
|
||||
this.loggeduser = SessionStore.user;
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<div class="d-flex flex-1 pr-20 pl-50" *ngIf="p.userPermissionCount([permissionList.Agenda.access, permissionList.Gabinete.access, permissionList.Actions.access, permissionList.Chat.access]) >= 2 || (p.userPermission([permissionList.Agenda.access]) && loggeduser.OwnerCalendars.length != 0) || p.userPermission([permissionList.Gabinete.access])">
|
||||
|
||||
<div *ngIf="p.userPermission([permissionList.Agenda.access]) || p.userPermission([permissionList.Gabinete.access])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/events')"
|
||||
[class.active]="locationPathname() == '/home/events'">
|
||||
[class.active]="ActiveTabService.pages.home">
|
||||
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' || ThemeService.currentTheme == 'doneIt' " class="font-40" src='assets/images/icons-nav-home-active-black.svg'></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-home-active-black.svg'></ion-icon>
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="p.userPermission([permissionList.Agenda.access])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/agenda')"
|
||||
[class.active]="locationPathname() == '/home/agenda'">
|
||||
[class.active]="ActiveTabService.pages.agenda">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' || ThemeService.currentTheme == 'doneIt' " class="font-40" src='assets/images/icons-nav-agenda-inactive.svg'></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-agenda-inactive.svg'></ion-icon>
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="p.userPermission([permissionList.Gabinete.access])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/gabinete-digital')"
|
||||
[class.active]="locationPathname() == '/home/gabinete-digital'">
|
||||
[class.active]="ActiveTabService.pages.gabinete">
|
||||
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' || ThemeService.currentTheme == 'doneIt' " class="font-40" src='assets/images/icons-nav-home-dk.svg'></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-home-dk.svg'></ion-icon>
|
||||
@@ -99,14 +99,14 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="p.userPermission([permissionList.Actions.access])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/publications')"
|
||||
[class.active]="locationPathname() == '/home/publications'">
|
||||
[class.active]="ActiveTabService.pages.publication">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' || ThemeService.currentTheme == 'doneIt' " class="font-40" src='assets/images/icons-nav-a-es-inactive.svg'></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-a-es-inactive.svg'></ion-icon>
|
||||
<span>Acções</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="p.userPermission([permissionList.Chat.access])" class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/chat')"
|
||||
[class.active]="locationPathname() == '/home/chat'">
|
||||
[class.active]="ActiveTabService.pages.chat">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' || ThemeService.currentTheme == 'doneIt' " class="font-40" src='assets/images/icons-nav-grupos-inactive-dk-white.svg'></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-40" src='assets/images/theme/gov/icons-nav-grupos-inactive-dk-white.svg'></ion-icon>
|
||||
<span>Chat</span>
|
||||
|
||||
@@ -12,7 +12,7 @@ import { RouteService } from 'src/app/services/route.service';
|
||||
import { PermissionList } from 'src/app/models/permission/permissionList';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
import { EventTrigger } from 'src/app/services/eventTrigger.service'
|
||||
/* import { Events } from 'ionic-angular' */
|
||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -48,6 +48,7 @@ export class HeaderPage implements OnInit {
|
||||
public RouteService: RouteService,
|
||||
public p: PermissionService,
|
||||
private eventTriger: EventTrigger,
|
||||
public ActiveTabService: ActiveTabService
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
router.events.subscribe((val) => {
|
||||
@@ -98,27 +99,6 @@ export class HeaderPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
locationPathname(): string {
|
||||
let path = window.location.pathname;
|
||||
if(path.includes('/home/events')){
|
||||
return '/home/events';
|
||||
}
|
||||
else if(path.includes('/home/agenda')){
|
||||
return '/home/agenda';
|
||||
}
|
||||
else if(path.includes('/home/gabinete-digital')){
|
||||
return '/home/gabinete-digital';
|
||||
}
|
||||
else if(path.includes('/home/publications')){
|
||||
return '/home/publications';
|
||||
}
|
||||
else if(path.includes('/home/chat')){
|
||||
return '/home/chat';
|
||||
}
|
||||
else{
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
async openSearch() {
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { DatabaseSchema } from '../../models/register-modal.interface.js';
|
||||
export declare class IndexedDBConnection {
|
||||
constructor();
|
||||
connect(config: DatabaseSchema): Promise<IDBDatabase>;
|
||||
migrate(config: DatabaseSchema): Promise<boolean>;
|
||||
static connect(config: DatabaseSchema): Promise<IDBDatabase>;
|
||||
static migrate(config: DatabaseSchema): Promise<boolean>;
|
||||
private runMigrations;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,13 @@ export class IndexedDBConnection {
|
||||
reject(e.target.error.name);
|
||||
};
|
||||
request.onupgradeneeded = async (e) => {
|
||||
throw ('need to migrate first');
|
||||
console.log('need to migrate first');
|
||||
await this.migrate(config);
|
||||
return await this.connect(config);
|
||||
};
|
||||
// request.onblocked = async (e: any) => {
|
||||
// reject(e.target.error.name);
|
||||
// }
|
||||
}
|
||||
else {
|
||||
reject("IDBDatabase not supported inside webworker");
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ declare class _indexedDB {
|
||||
getOneByIndex: (keyPath: string, value: string | number) => Promise<any>;
|
||||
getManyByIndex: (keyPath: string, value: string | number) => Promise<any[]>;
|
||||
getAll: () => Promise<any[]>;
|
||||
add: (value: Object, key?: any) => Promise<number>;
|
||||
add: (value: Object, key?: any) => Promise<number | Object>;
|
||||
update: (value: any, key?: any) => Promise<any>;
|
||||
deleteByID: (id: any) => Promise<any>;
|
||||
deleteAll: () => Promise<any>;
|
||||
|
||||
@@ -77,6 +77,13 @@ class _indexedDB {
|
||||
var _a, _b;
|
||||
(_b = (_a = tx) === null || _a === void 0 ? void 0 : _a.commit) === null || _b === void 0 ? void 0 : _b.call(_a);
|
||||
resolve(e.target.result);
|
||||
db.transaction;
|
||||
};
|
||||
request.onerror = (e) => {
|
||||
let data = {
|
||||
error: e.target['error']
|
||||
};
|
||||
resolve(data);
|
||||
};
|
||||
})
|
||||
.catch(reject);
|
||||
@@ -94,11 +101,6 @@ class _indexedDB {
|
||||
(_b = (_a = tx) === null || _a === void 0 ? void 0 : _a.commit) === null || _b === void 0 ? void 0 : _b.call(_a);
|
||||
resolve(e.target.result);
|
||||
};
|
||||
|
||||
request.onerror = (e) => {
|
||||
console.log(value, key)
|
||||
console.log(e)
|
||||
}
|
||||
})
|
||||
.catch(reject);
|
||||
});
|
||||
@@ -152,6 +154,7 @@ class _indexedDB {
|
||||
request.onsuccess = e => {
|
||||
cursorCallback(e);
|
||||
resolve();
|
||||
// db.close();
|
||||
};
|
||||
})
|
||||
.catch(reject);
|
||||
@@ -278,7 +281,6 @@ class _indexedDB {
|
||||
delete: async (methods) => {
|
||||
if (methods[methods.length - 1].methodName == 'delete' &&
|
||||
methods[methods.length - 1].arguments == null) {
|
||||
|
||||
const customMethods = Object.create(methods);
|
||||
customMethods[methods.length - 1].methodName = 'execute';
|
||||
const result = await this.requestHandler(TableSchema, config, queryId).select(customMethods);
|
||||
@@ -293,15 +295,11 @@ class _indexedDB {
|
||||
}
|
||||
else if (methods[methods.length - 1].methodName == 'delete' &&
|
||||
typeof methods[methods.length - 1].arguments == 'object') {
|
||||
|
||||
const IdInObject = methods[methods.length - 1].arguments;
|
||||
const idValue = IdInObject[TableSchema.id.keyPath];
|
||||
|
||||
const result = await this.getActions(TableSchema.name, config).deleteByID(idValue)
|
||||
console.log('delete7', IdInObject,idValue, result.type == 'success', result.type)
|
||||
return {
|
||||
queryId: queryId,
|
||||
value: result.type == 'success'
|
||||
value: await this.getActions(TableSchema.name, config).deleteByID(idValue)
|
||||
};
|
||||
}
|
||||
else if (methods[methods.length - 1].methodName == 'delete' &&
|
||||
@@ -310,8 +308,6 @@ class _indexedDB {
|
||||
queryId: queryId,
|
||||
value: await this.getActions(TableSchema.name, config).deleteAll()
|
||||
};
|
||||
} else {
|
||||
console.log('delete else')
|
||||
}
|
||||
},
|
||||
insert: async (methods) => {
|
||||
@@ -319,19 +315,19 @@ class _indexedDB {
|
||||
const rows = methods[0].arguments;
|
||||
for (let insert of rows) {
|
||||
const id = await this.getActions(TableSchema.name, config).add(insert);
|
||||
createdObjKeys.push(id);
|
||||
insert[TableSchema.id.keyPath] = id;
|
||||
}
|
||||
// return first element
|
||||
if (rows.length == 1) {
|
||||
return {
|
||||
queryId: queryId,
|
||||
value: await this.getActions(TableSchema.name, config).getByID(createdObjKeys[0])
|
||||
value: rows[0]
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
queryId: queryId,
|
||||
value: createdObjKeys
|
||||
value: rows
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
export declare type actionParam = 'insert' | 'update' | 'delete' | 'select';
|
||||
export declare type dbType = 'indexedDB';
|
||||
export declare type dbType = 'indexedDB' | 'localStorage';
|
||||
|
||||
@@ -1,17 +1,26 @@
|
||||
import { indexedDB } from './indexedDb/indexedb.js';
|
||||
onmessage = async (oEvent) => {
|
||||
const { TableSchema, DBconfig, queryId, action, arg } = oEvent.data;
|
||||
const result = await indexedDB.requestHandler(TableSchema, DBconfig, queryId)[action](arg);
|
||||
indexedDB.requestHandler(TableSchema, DBconfig, queryId)[action](arg).then((result) => {
|
||||
try {
|
||||
postMessage(result);
|
||||
}
|
||||
catch (error) {
|
||||
postMessage({
|
||||
queryId: result.queryId,
|
||||
value: undefined
|
||||
});
|
||||
}
|
||||
}).catch((result)=> {
|
||||
try {
|
||||
postMessage(result);
|
||||
}
|
||||
catch (error) {
|
||||
postMessage({
|
||||
queryId: result.queryId,
|
||||
value: undefined
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
console.log('return response', result)
|
||||
try {
|
||||
|
||||
postMessage(result);
|
||||
}
|
||||
catch (error) {
|
||||
postMessage({
|
||||
queryId: result.queryId,
|
||||
value: undefined
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+4
-2
@@ -1,6 +1,7 @@
|
||||
import { Model } from './models/model.js';
|
||||
import { LocalStorage } from './models/model.js';
|
||||
import { ModelReader } from './models/model.reader.js';
|
||||
import { registerModel } from './models/register-model.js';
|
||||
import { registerModel, migrate } from './models/register-model.js';
|
||||
export declare const models: {
|
||||
Value(arg: any): {};
|
||||
CharField(data?: import("./models/field/interface.js").CharFieldParams): import("./models/field/allFields.js").CharField;
|
||||
@@ -21,7 +22,8 @@ export declare const models: {
|
||||
};
|
||||
};
|
||||
Model: typeof Model;
|
||||
LocalStorage: typeof LocalStorage;
|
||||
read: typeof ModelReader.read;
|
||||
migrate: typeof migrate;
|
||||
register: typeof registerModel.register;
|
||||
migrate: typeof registerModel.register;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Model } from './models/model.js';
|
||||
import { LocalStorage } from './models/model.js';
|
||||
import * as Fields from './models/field/fields.js';
|
||||
import { ModelReader } from './models/model.reader.js';
|
||||
import { registerModel } from './models/register-model.js';
|
||||
export const models = Object.assign(Object.assign({ Model, read: ModelReader.read, register: registerModel.register, migrate: registerModel.register }, Fields), { Value(arg) {
|
||||
import { registerModel, migrate } from './models/register-model.js';
|
||||
export const models = Object.assign(Object.assign({ Model,
|
||||
LocalStorage, read: ModelReader.read, migrate: migrate, register: registerModel.register }, Fields), { Value(arg) {
|
||||
if (arg == 'null') {
|
||||
return {};
|
||||
}
|
||||
|
||||
Vendored
+16
-1
@@ -1,5 +1,5 @@
|
||||
import { getParams } from './model.interface.js';
|
||||
import { DatabaseSchema, TableSchema } from './register-modal.interface.js';
|
||||
import { DatabaseSchema, DatabaseSchemaLocalStorage, TableSchema } from './register-modal.interface.js';
|
||||
import { ModelManager } from './model-manager.js';
|
||||
export declare class Model extends ModelManager {
|
||||
constructor(obg?: any);
|
||||
@@ -47,3 +47,18 @@ export declare class Model extends ModelManager {
|
||||
all: () => Promise<any>;
|
||||
};
|
||||
}
|
||||
export declare class LocalStorage {
|
||||
constructor();
|
||||
static save(data?: Object): void;
|
||||
static get(): any;
|
||||
static getModelName(): string;
|
||||
static getDBSchema(): DatabaseSchemaLocalStorage;
|
||||
static getTableSchema(): TableSchema;
|
||||
private static getIgnoreAttributes;
|
||||
static ignoreAttributes(attributesStartWidth?: string[]): void;
|
||||
private static getFields;
|
||||
private static formValidation;
|
||||
static clear(): void;
|
||||
static clearComponent(): void;
|
||||
static clearStorage(): void;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var _a, _b;
|
||||
import { hashCode, uniqueGenerator } from '../utils.js';
|
||||
import { ModelManager } from './model-manager.js';
|
||||
import { models, modelsConfig } from './register-model.js';
|
||||
import { models, modelsConfig, modelsConfigLocalStorage } from './register-model.js';
|
||||
import { FieldType } from '../sql/query/interface.js';
|
||||
import * as Fields from './field/allFields.js';
|
||||
let methods = {} = {};
|
||||
@@ -134,6 +134,10 @@ export class Model extends (_b = ModelManager) {
|
||||
delete newInstance[fieldName];
|
||||
}
|
||||
}
|
||||
Object.defineProperty(newInstance, TableSchema.id.keyPath, {
|
||||
configurable: false,
|
||||
writable: false
|
||||
});
|
||||
delete newInstance.obj;
|
||||
return newInstance;
|
||||
}
|
||||
@@ -211,11 +215,16 @@ export class Model extends (_b = ModelManager) {
|
||||
const queryId = uniqueGenerator();
|
||||
const createObject = await super.obj(DBconfig, TableSchema).create(_methods, queryId);
|
||||
if (createObject) {
|
||||
const ModelName = this.getModelName();
|
||||
let newInstance = new models[ModelName]();
|
||||
Object.assign(newInstance, createObject);
|
||||
delete newInstance.obj;
|
||||
return newInstance;
|
||||
if (typeof createObject[TableSchema.id.keyPath] == 'object') {
|
||||
throw (createObject[TableSchema.id.keyPath].error);
|
||||
}
|
||||
else {
|
||||
const ModelName = this.getModelName();
|
||||
let newInstance = new models[ModelName]();
|
||||
Object.assign(newInstance, createObject);
|
||||
delete newInstance.obj;
|
||||
return newInstance;
|
||||
}
|
||||
}
|
||||
else {
|
||||
}
|
||||
@@ -303,3 +312,82 @@ Model.object = ({ queryId = uniqueGenerator(), DBconfig, TableSchema, some = nul
|
||||
}
|
||||
};
|
||||
};
|
||||
export class LocalStorage {
|
||||
constructor() { }
|
||||
static save(data = {}) {
|
||||
const dataToSave = this.getFields(Object.assign(this, Object.assign({}, data)));
|
||||
const key = this.getTableSchema().id;
|
||||
localStorage.setItem(key.keyPath, JSON.stringify(dataToSave));
|
||||
}
|
||||
static get() {
|
||||
const key = this.getTableSchema().id;
|
||||
const restedData = JSON.parse(localStorage.getItem(key.keyPath));
|
||||
Object.assign(this, Object.assign({}, restedData));
|
||||
return restedData;
|
||||
}
|
||||
static getModelName() {
|
||||
return this.toString().split('(' || /s+/)[0].split(' ' || /s+/)[1];
|
||||
}
|
||||
static getDBSchema() {
|
||||
const modalName = this.getModelName();
|
||||
return modelsConfigLocalStorage[modalName].DatabaseSchema;
|
||||
}
|
||||
static getTableSchema() {
|
||||
const modalName = this.getModelName();
|
||||
return modelsConfigLocalStorage[modalName].TableSchema;
|
||||
}
|
||||
static getIgnoreAttributes() {
|
||||
return false;
|
||||
}
|
||||
static ignoreAttributes(attributesStartWidth = []) {
|
||||
if (!this.getIgnoreAttributes()) {
|
||||
this.getIgnoreAttributes = () => {
|
||||
return attributesStartWidth;
|
||||
};
|
||||
}
|
||||
}
|
||||
static getFields(arg) {
|
||||
const TableSchema = this.getTableSchema();
|
||||
const filteredArgs = {};
|
||||
const fieldsName = TableSchema.fields.map((field) => field.name);
|
||||
const Attributes = this.getIgnoreAttributes();
|
||||
const fieldNameFilter = fieldsName.filter((fieldName) => {
|
||||
if (Attributes) {
|
||||
for (let Attribute of Attributes) {
|
||||
if (fieldName.startsWith(Attribute)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
for (let fieldName of fieldNameFilter) {
|
||||
if (arg.hasOwnProperty(fieldName)) {
|
||||
filteredArgs[fieldName] = arg[fieldName];
|
||||
}
|
||||
}
|
||||
return filteredArgs;
|
||||
}
|
||||
static formValidation(data) {
|
||||
const TableSchema = this.getTableSchema();
|
||||
for (let field of TableSchema.fields) {
|
||||
const Field = new Fields[field.className](field.fieldAttributes);
|
||||
const FieldValue = data[field.name];
|
||||
if (!Field.valid(FieldValue)) {
|
||||
throw ('invalid insert into ' + TableSchema.name + ', invalid value for field ' + field.name + ' = ' + JSON.stringify(FieldValue));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static clear() {
|
||||
this.clearComponent();
|
||||
this.clearStorage();
|
||||
}
|
||||
static clearComponent() {
|
||||
const key = this.getTableSchema().id;
|
||||
}
|
||||
static clearStorage() {
|
||||
const key = this.getTableSchema().id;
|
||||
localStorage.removeItem(key.keyPath);
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -9,3 +9,13 @@ export declare class ModelReader {
|
||||
attributes: AttributesMap<"maxLength" | "minLength" | "choices" | "primaryKey" | "unique" | "autoIncrement" | "type" | "model" | "blank" | "default" | "onDelete" | "foreignKey", string[]>;
|
||||
};
|
||||
}
|
||||
export declare class LocalStorageModelReader {
|
||||
static read(modelClassRepresentation: any): {
|
||||
modelName: string;
|
||||
fields: {
|
||||
[key: string]: any;
|
||||
};
|
||||
attributes: AttributesMap<"maxLength" | "minLength" | "choices" | "primaryKey" | "unique" | "autoIncrement" | "type" | "model" | "blank" | "default" | "onDelete" | "foreignKey", string[]>;
|
||||
fieldTypes: FieldsMap<"CharField" | "JsonField" | "AutoField" | "BigIntegerField" | "DateField" | "IntegerField" | "TextField" | "BooleanField" | "OneToOneField" | "ForeignKey" | "ManyToManyField" | "indexedDBJsonField" | "indexedDBArrayField" | "DateTimeField", string[]>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,3 +32,22 @@ export class ModelReader {
|
||||
};
|
||||
}
|
||||
}
|
||||
export class LocalStorageModelReader {
|
||||
static read(modelClassRepresentation) {
|
||||
const classInstance = modelClassRepresentation;
|
||||
const fieldTypes = {};
|
||||
const attributes = {};
|
||||
const modelName = classInstance.getModelName();
|
||||
const fields = {};
|
||||
for (const [fieldName, Field] of Object.entries(classInstance)) {
|
||||
// const type = Field?.fieldName
|
||||
fields[fieldName] = Field || null;
|
||||
}
|
||||
return {
|
||||
modelName,
|
||||
fields,
|
||||
attributes,
|
||||
fieldTypes
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+15
-4
@@ -1,11 +1,11 @@
|
||||
import { Model } from './model.js';
|
||||
import { DatabaseSchema, TableSchema } from './register-modal.interface.js';
|
||||
import { Model, LocalStorage } from './model.js';
|
||||
import { DatabaseSchema, DatabaseSchemaLocalStorage, TableSchema, TableSchemaLocalStorage } from './register-modal.interface.js';
|
||||
import { OneToOneField, ForeignKey, ManyToManyField } from './field/allFields.js';
|
||||
interface register {
|
||||
databaseName: string;
|
||||
version: number;
|
||||
type: 'indexedDB';
|
||||
models: typeof Model[];
|
||||
type: 'indexedDB' | 'localStorage';
|
||||
models: typeof Model[] | typeof LocalStorage[];
|
||||
}
|
||||
export declare const models: {};
|
||||
export declare const modelsConfig: {
|
||||
@@ -17,10 +17,21 @@ export declare const modelsConfig: {
|
||||
};
|
||||
};
|
||||
};
|
||||
export declare const modelsLocalStorage: {};
|
||||
export declare const modelsConfigLocalStorage: {
|
||||
[key: string]: {
|
||||
DatabaseSchema: DatabaseSchemaLocalStorage;
|
||||
TableSchema: TableSchemaLocalStorage;
|
||||
};
|
||||
};
|
||||
export declare function migrate(register: register): void;
|
||||
export declare class registerModel {
|
||||
static register(entries: register): Promise<void>;
|
||||
static manyToManyRelationShip(foreignKeyField: ManyToManyField, FieldName: string, modelName: string, databaseSchema: DatabaseSchema): Model;
|
||||
}
|
||||
export declare class registerLocalStorage {
|
||||
static register(entries: register): Promise<void>;
|
||||
}
|
||||
export declare class ModelEditor {
|
||||
static addMethodOneToOneField(foreignKeyField: OneToOneField, FieldName: string, modelName: string, databaseSchema: DatabaseSchema): void;
|
||||
static addMethodForeignKey(foreignKeyField: ForeignKey, FieldName: string, modelName: string, databaseSchema: DatabaseSchema): void;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Model } from './model.js';
|
||||
import { ModelReader } from './model.reader.js';
|
||||
import { LocalStorageModelReader, ModelReader } from './model.reader.js';
|
||||
import { indexedDB } from './../connection/indexedDb/indexedb.js';
|
||||
import { OneToOneField, ForeignKey, ManyToManyField } from './field/allFields.js';
|
||||
import { uncapitalize } from '../utils.js';
|
||||
@@ -7,6 +7,16 @@ import { FieldType } from '../sql/query/interface.js';
|
||||
import { ModelMigrations } from './mode-migrations.js';
|
||||
export const models = {};
|
||||
export const modelsConfig = {};
|
||||
export const modelsLocalStorage = {};
|
||||
export const modelsConfigLocalStorage = {};
|
||||
export function migrate(register) {
|
||||
if (register.type == 'indexedDB') {
|
||||
registerModel.register(register);
|
||||
}
|
||||
else if (register.type == 'localStorage') {
|
||||
registerLocalStorage.register(register);
|
||||
}
|
||||
}
|
||||
export class registerModel {
|
||||
static async register(entries) {
|
||||
var _a, _b, _c;
|
||||
@@ -122,6 +132,65 @@ export class registerModel {
|
||||
});
|
||||
}
|
||||
}
|
||||
export class registerLocalStorage {
|
||||
static async register(entries) {
|
||||
const databaseSchema = {
|
||||
databaseName: entries.databaseName,
|
||||
version: entries.version,
|
||||
type: 'localStorage',
|
||||
stores: []
|
||||
};
|
||||
for (const modelClassRepresentations of entries.models) {
|
||||
const ModelName = modelClassRepresentations.getModelName();
|
||||
modelsLocalStorage[ModelName] = modelClassRepresentations;
|
||||
}
|
||||
let index = 0;
|
||||
for (const modelClassRepresentations of entries.models) {
|
||||
const { fields, modelName, attributes, fieldTypes } = LocalStorageModelReader.read(modelClassRepresentations);
|
||||
// const idFieldName = attributes?.primaryKey?.shift()
|
||||
databaseSchema.stores.push({
|
||||
name: modelName,
|
||||
id: {
|
||||
keyPath: modelName,
|
||||
type: FieldType.VARCHAR,
|
||||
autoIncrement: false
|
||||
},
|
||||
attributes: attributes,
|
||||
fields: [],
|
||||
fieldTypes
|
||||
});
|
||||
for (const [fieldName, Field] of Object.entries(fields)) {
|
||||
databaseSchema.stores[index].fields.push({
|
||||
name: fieldName,
|
||||
keyPath: fieldName,
|
||||
options: {
|
||||
unique: false,
|
||||
type: null
|
||||
},
|
||||
className: Field === null || Field === void 0 ? void 0 : Field.fieldName,
|
||||
fieldAttributes: Object.assign({}, Field)
|
||||
});
|
||||
}
|
||||
index++;
|
||||
}
|
||||
for (const modelClassRepresentations of entries.models) {
|
||||
const ModelName = modelClassRepresentations.getModelName();
|
||||
const tableSchema = databaseSchema.stores.find((e) => e.name == ModelName);
|
||||
modelClassRepresentations.getDBSchema = () => {
|
||||
return databaseSchema;
|
||||
};
|
||||
modelClassRepresentations.getTableSchema = () => {
|
||||
return tableSchema;
|
||||
};
|
||||
modelsConfigLocalStorage[ModelName] = {
|
||||
DatabaseSchema: databaseSchema,
|
||||
TableSchema: tableSchema
|
||||
};
|
||||
modelsLocalStorage[ModelName] = modelClassRepresentations;
|
||||
}
|
||||
ModelMigrations.migrationsState(true);
|
||||
}
|
||||
}
|
||||
export class ModelEditor {
|
||||
static addMethodOneToOneField(foreignKeyField, FieldName, modelName, databaseSchema) {
|
||||
const foreignKeyFieldModel = foreignKeyField.model;
|
||||
|
||||
Reference in New Issue
Block a user