mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -148,10 +148,13 @@ const routes = [
|
||||
path: 'edit-action',
|
||||
loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule)
|
||||
},
|
||||
{
|
||||
path: 'eliminate-event',
|
||||
loadChildren: () => import('./modals/eliminate-event/eliminate-event.module').then( m => m.EliminateEventPageModule)
|
||||
},
|
||||
|
||||
|
||||
|
||||
/* {
|
||||
/*
|
||||
path: 'chat',
|
||||
component: ChatPage
|
||||
} */
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { AuthGuard } from '../guards/auth.guard';
|
||||
import { HomeGuard } from '../guards/home.guard';
|
||||
import { LoginGuard } from '../guards/login.guard';
|
||||
import { GroupMessagesPage } from '../pages/chat/group-messages/group-messages.page';
|
||||
import { MessagesPage } from '../pages/chat/messages/messages.page';
|
||||
import { PendentesResolverService } from '../resolvers/pendentes-resolver.service';
|
||||
import { ProcessesResolverService } from '../resolvers/processes-resolver.service';
|
||||
import { UserDataResolver } from '../resolvers/userData.resolver';
|
||||
import { DiplomasPage } from '../shared/gabinete-digital/diplomas/diplomas.page';
|
||||
|
||||
import { HomePage } from './home.page';
|
||||
|
||||
const routes: Routes = [
|
||||
@@ -267,8 +259,6 @@ const routes: Routes = [
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
path: 'search',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ion-tab-button tab="events">
|
||||
<!-- <ion-icon name="home"></ion-icon> -->
|
||||
<ion-icon class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
|
||||
<ion-badge color="danger">{{totalEvent}}</ion-badge>
|
||||
<ion-badge color="danger">{{toDayEventStorage.eventsList.length}}</ion-badge>
|
||||
<ion-label>Início</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { NotificationsService } from '../services/notifications.service';
|
||||
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
|
||||
import { NavigationExtras,Router,ActivatedRoute } from '@angular/router';
|
||||
import { ToastService } from '../services/toast.service';
|
||||
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -25,6 +26,9 @@ export class HomePage implements OnInit {
|
||||
totalExpediente = 0;
|
||||
profile: string;
|
||||
|
||||
|
||||
toDayEventStorage = ToDayEventStorage
|
||||
|
||||
adding: "intervenient" | "CC" = "intervenient";
|
||||
mobileComponent = {
|
||||
showAddNewEvent: false,
|
||||
@@ -47,13 +51,8 @@ export class HomePage implements OnInit {
|
||||
folderId: string;
|
||||
|
||||
constructor(private zone: NgZone,
|
||||
private eventService: EventsService,
|
||||
private processesbackend: ProcessesService,
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
public modalCtrl: AlertController,
|
||||
private toastService: ToastService,
|
||||
private animationController: AnimationController,
|
||||
private notificatinsservice: NotificationsService,
|
||||
private platform: Platform,
|
||||
private activeroute: ActivatedRoute) {
|
||||
@@ -76,33 +75,6 @@ export class HomePage implements OnInit {
|
||||
this.mobilefirstConnect();
|
||||
this.notificatinsservice.onReceviNotification();
|
||||
}
|
||||
this.count();
|
||||
|
||||
}
|
||||
|
||||
async count() {
|
||||
|
||||
// let date = new Date();
|
||||
// date.setMonth(date.getMonth() + 1);
|
||||
// let start = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
|
||||
// let end = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " 23:59:59";
|
||||
|
||||
// this.profile = "mdgpr";
|
||||
// if (this.profile == "mdgpr") {
|
||||
|
||||
// let mdOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
|
||||
// let mdPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
|
||||
// this.eventsList = mdOficialEvents.concat(mdPessoalEvents)
|
||||
// this.totalEvent = this.eventsList.length;
|
||||
|
||||
// }
|
||||
// else {
|
||||
// let prOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
|
||||
// let prPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
|
||||
// this.eventsList = prOficialEvents.concat(prPessoalEvents)
|
||||
// this.totalEvent = this.eventsList.length;
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { EliminateEventPage } from './eliminate-event.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: EliminateEventPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class EliminateEventPageRoutingModule {}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { EliminateEventPageRoutingModule } from './eliminate-event-routing.module';
|
||||
|
||||
import { EliminateEventPage } from './eliminate-event.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
EliminateEventPageRoutingModule
|
||||
],
|
||||
declarations: [EliminateEventPage]
|
||||
})
|
||||
export class EliminateEventPageModule {}
|
||||
@@ -0,0 +1,19 @@
|
||||
<ion-header class="ion-no-border">
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<div class="header-content width-100">
|
||||
<div class="header-title d-flex width-100">
|
||||
<h3>Deseja retirar este expediente da sua caixa de correspondência?</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-body width-100">
|
||||
<p>Nota: Ao efectuar esta operação, o tratamento deste expediente não poderá ser realizado a partir da caixa de correspondência</p>
|
||||
</div>
|
||||
</ion-content>
|
||||
<ion-footer>
|
||||
<div class="buttons width-100">
|
||||
<button class="btn-ok-medium" shape="round" (click)="close()">Não</button>
|
||||
<button class="btn-delete-medium" shape="round" (click)="save()">Sim</button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@@ -0,0 +1,27 @@
|
||||
ion-content{
|
||||
--padding-top:15px;
|
||||
--padding-start: 15px;
|
||||
--padding-end: 15px;
|
||||
}
|
||||
.header-content{
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.header-title{
|
||||
font-family: Roboto;
|
||||
font-size: 20px;
|
||||
color:#000;
|
||||
margin: 0 5px 0 5px;
|
||||
}
|
||||
.header-body{
|
||||
margin: 0 5px 0 5px;
|
||||
}
|
||||
|
||||
.buttons{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 15px 0 15px 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { EliminateEventPage } from './eliminate-event.page';
|
||||
|
||||
describe('EliminateEventPage', () => {
|
||||
let component: EliminateEventPage;
|
||||
let fixture: ComponentFixture<EliminateEventPage>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EliminateEventPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(EliminateEventPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-eliminate-event',
|
||||
templateUrl: './eliminate-event.page.html',
|
||||
styleUrls: ['./eliminate-event.page.scss'],
|
||||
})
|
||||
export class EliminateEventPage implements OnInit {
|
||||
|
||||
constructor(private modalController: ModalController,) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
close(){
|
||||
this.modalController.dismiss('No');
|
||||
}
|
||||
|
||||
save(){
|
||||
this.modalController.dismiss('Yes');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export class EventRecurrence{
|
||||
Type: string;
|
||||
export class EventRecurrence {
|
||||
Type: string | number;
|
||||
Day?: number;
|
||||
DayOfWeek?:number;
|
||||
Month?: number;
|
||||
|
||||
@@ -454,8 +454,6 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
loadRangeEvents(startTime: Date, endTime: Date) {
|
||||
|
||||
this.eventSelectedDate = new Date(startTime);
|
||||
|
||||
this.showLoader = true;
|
||||
|
||||
if(window.innerWidth < 800){
|
||||
|
||||
@@ -14,6 +14,7 @@ import { BookMeetingModalPage } from '../../gabinete-digital/expediente/book-mee
|
||||
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
|
||||
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-event',
|
||||
@@ -143,6 +144,34 @@ export class ViewEventPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async OpenDeleteEventModal() {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EliminateEventPage,
|
||||
componentProps: {
|
||||
eventId: this.loadedEvent.EventId,
|
||||
caller: this.caller,
|
||||
},
|
||||
cssClass: 'discart-expedient-modal',
|
||||
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if(res){
|
||||
setTimeout(() => {
|
||||
/* this.loadEvent(); */
|
||||
this.loadEvent()
|
||||
this.getAttachments();
|
||||
}, 250);
|
||||
this.isEventEdited = true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getAttachments() {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<div class="content">
|
||||
<ion-list>
|
||||
<ion-item class="cursor-pointer" lines="none" *ngFor="let event of eventsList"
|
||||
<ion-item class="cursor-pointer" lines="none" *ngFor="let event of toDayEventStorage.eventsList"
|
||||
(click)="goToEvent(event.EventId)"
|
||||
>
|
||||
<div class="d-flex content-{{profile}}-{{event.CalendarName}}">
|
||||
@@ -87,7 +87,7 @@
|
||||
</div>
|
||||
<div class="content">
|
||||
<ion-list>
|
||||
<ion-item class="cursor-pointer" lines="none" *ngFor = "let task of expedientList"
|
||||
<ion-item class="cursor-pointer" lines="none" *ngFor = "let task of expedienteStorage.list"
|
||||
(click)="goToExpediente(task.serialNumber)">
|
||||
<div class="item-exp d-flex">
|
||||
<div class="schedule-date">
|
||||
|
||||
@@ -18,7 +18,8 @@ import { ExpedienteDetailPage } from '../gabinete-digital/expediente/expediente-
|
||||
import { EditEventPage as EventEditPage } from './edit-event/edit-event.page';
|
||||
import { GabineteDigitalPage } from '../gabinete-digital/gabinete-digital.page';
|
||||
import { User } from 'src/app/models/user.model';
|
||||
|
||||
import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service';
|
||||
import { ExpedienteStorage } from 'src/app/store/expediente-storage-service.service'
|
||||
@Component({
|
||||
selector: 'app-events',
|
||||
templateUrl: './events.page.html',
|
||||
@@ -62,6 +63,10 @@ export class EventsPage implements OnInit {
|
||||
taskslist:DailyWorkTask[] = [];
|
||||
expedientList:any;
|
||||
|
||||
// shared data
|
||||
toDayEventStorage = ToDayEventStorage
|
||||
expedienteStorage = ExpedienteStorage
|
||||
|
||||
@Output() openExpedientListPage:EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
loggeduser: User;
|
||||
@@ -85,10 +90,9 @@ export class EventsPage implements OnInit {
|
||||
// list
|
||||
this.LoadList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(data => console.log(data));
|
||||
//Inicializar segment
|
||||
this.segment = "Combinada";
|
||||
//Initialize profile as mdgpr
|
||||
@@ -107,18 +111,17 @@ export class EventsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
doRefresh(event) {
|
||||
this.RefreshEvents();
|
||||
this.LoadList();
|
||||
event.target.complete();
|
||||
}
|
||||
|
||||
onSegmentChange(){
|
||||
onSegmentChange() {
|
||||
this.RefreshEvents();
|
||||
}
|
||||
|
||||
async RefreshEvents(){
|
||||
async RefreshEvents() {
|
||||
this.currentEvent = "";
|
||||
this.showLoader = true;
|
||||
|
||||
@@ -127,38 +130,42 @@ export class EventsPage implements OnInit {
|
||||
let start = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
|
||||
let end = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" 23:59:59";
|
||||
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR'){
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise();
|
||||
let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise();
|
||||
|
||||
const list = mdOficialEvents.concat(mdPessoalEvents);
|
||||
|
||||
this.toDayEventStorage.reset(list)
|
||||
|
||||
if(this.toDayEventStorage.eventsList.length > 0){
|
||||
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
|
||||
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
|
||||
}
|
||||
|
||||
this.totalEvent = this.toDayEventStorage.eventsList.length;
|
||||
this.showLoader = false;
|
||||
|
||||
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
|
||||
|
||||
if(this.eventsList.length > 0){
|
||||
this.currentEvent = this.eventsList[0].Subject;
|
||||
this.currentHoursMinutes = this.eventsList[0].StartDate;
|
||||
}
|
||||
|
||||
this.totalEvent = this.eventsList.length;
|
||||
this.showLoader = false;
|
||||
|
||||
}
|
||||
else if (this.loggeduser.Profile == 'PR'){
|
||||
else if (this.loggeduser.Profile == 'PR') {
|
||||
|
||||
let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise();
|
||||
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
|
||||
this.eventsList = prOficialEvents.concat(prPessoalEvents);
|
||||
console.log(this.eventsList);
|
||||
|
||||
const list = prOficialEvents.concat(prPessoalEvents);
|
||||
|
||||
if(this.eventsList.length > 0){
|
||||
this.currentEvent = this.eventsList[0].Subject;
|
||||
this.currentHoursMinutes = this.eventsList[0].StartDate;
|
||||
}
|
||||
this.toDayEventStorage.reset(list)
|
||||
|
||||
this.totalEvent = this.eventsList.length;
|
||||
this.showLoader = false;
|
||||
|
||||
if(this.toDayEventStorage.eventsList.length > 0) {
|
||||
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
|
||||
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
|
||||
}
|
||||
|
||||
this.totalEvent = this.toDayEventStorage.eventsList.length;
|
||||
this.showLoader = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -283,16 +290,18 @@ export class EventsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
LoadList(){
|
||||
LoadList() {
|
||||
switch (this.loggeduser.Profile) {
|
||||
case 'MDGPR':
|
||||
this.processes.GetTasksList("Expediente", false).subscribe(result => {
|
||||
this.expedientList = result.reverse();
|
||||
const data = result.reverse();
|
||||
this.expedienteStorage.reset(data)
|
||||
});
|
||||
break;
|
||||
case 'PR':
|
||||
this.processes.GetTasksList("Expediente do Presidente", false).subscribe(result => {
|
||||
this.expedientList = result.reverse();
|
||||
const data = result.reverse();
|
||||
this.expedienteStorage.reset(data)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -74,7 +74,6 @@ ion-item{
|
||||
//box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07);
|
||||
//Sborder: solid 1px #e9e9e9;
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -57,7 +57,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -68,7 +68,6 @@ ion-item{
|
||||
.item {
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -56,7 +56,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -52,7 +52,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ExpedienteStorage } from 'src/app/store/expediente-storage-service.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente',
|
||||
@@ -21,6 +22,8 @@ export class ExpedientePage implements OnInit {
|
||||
taskslist:DailyWorkTask[] = [];
|
||||
serialNumber:string;
|
||||
|
||||
expedienteStorage = ExpedienteStorage
|
||||
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private modalController: ModalController,
|
||||
|
||||
@@ -56,7 +56,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="aside overflow-y-auto d-flex flex-wrap width-100">
|
||||
<!-- <ion-list class="width-100"> -->
|
||||
<ion-item-sliding disabled="{{showSlidingOptions}}" class="item width-100 cursor-pointer"
|
||||
*ngFor="let viagem of publicationsTravelFolderList">
|
||||
*ngFor="let viagem of publicationTravelFolderService.list">
|
||||
<ion-item lines="none"
|
||||
class="width-100 d-flex ion-no-border ion-no-margin ion-no-padding">
|
||||
<div (click)="goToPublicationsList(viagem.ProcessId)" class="item-icon cursor-pointer">
|
||||
@@ -82,7 +82,8 @@
|
||||
</div>
|
||||
</div> -->
|
||||
<ion-item-sliding disabled="{{showSlidingOptions}}" class="item width-100"
|
||||
*ngFor="let evento of publicationsEventFolderList">
|
||||
*ngFor="let evento of publicationEventFolderStorage.list"
|
||||
>
|
||||
<ion-item lines="none"
|
||||
class="width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
|
||||
(click)="viewPublications(evento)">
|
||||
@@ -200,10 +201,8 @@
|
||||
>
|
||||
</app-edit-action>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</ion-content>
|
||||
</ion-content>
|
||||
@@ -6,13 +6,13 @@ import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { NewActionPage } from './new-action/new-action.page';
|
||||
import { ViewPublicationsPage } from './view-publications/view-publications.page';
|
||||
|
||||
import { Animation, AnimationController } from '@ionic/angular';
|
||||
import { LoadingController } from '@ionic/angular';
|
||||
import { LoadingService } from 'src/app/services/loading.service';
|
||||
import { AnimationController } from '@ionic/angular';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { ActionsOptionsPage } from 'src/app/shared/popover/actions-options/actions-options.page';
|
||||
import { EditActionPage } from './edit-action/edit-action.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publications',
|
||||
@@ -24,7 +24,6 @@ export class PublicationsPage implements OnInit {
|
||||
publicationFolder: PublicationFolder;
|
||||
publication: Publication;
|
||||
|
||||
publicationFolderList: PublicationFolder[];
|
||||
publicationsEventFolderList: PublicationFolder[];
|
||||
publicationsTravelFolderList: PublicationFolder[];
|
||||
|
||||
@@ -34,7 +33,9 @@ export class PublicationsPage implements OnInit {
|
||||
months: string[];
|
||||
days:string[];
|
||||
|
||||
|
||||
publicationEventFolderStorage = PublicationEventFolderStorage
|
||||
publicationTravelFolderService = PublicationTravelFolderStore
|
||||
|
||||
desktopComponent: any = {
|
||||
showViewPublication: false,
|
||||
showAddNewPublication: false,
|
||||
@@ -57,9 +58,7 @@ export class PublicationsPage implements OnInit {
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
private loading: LoadingService,
|
||||
private publications: PublicationsService,
|
||||
private popoverController:PopoverController,
|
||||
private toastService: ToastService
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
@@ -121,10 +120,10 @@ export class PublicationsPage implements OnInit {
|
||||
getActions() {
|
||||
this.showLoader = true;
|
||||
this.publications.GetPublicationFolderList().subscribe(res=>{
|
||||
this.publicationFolderList = res;
|
||||
console.log(res);
|
||||
|
||||
this.publicationsEventFolderList = new Array();
|
||||
this.publicationsTravelFolderList = new Array();
|
||||
|
||||
res.forEach(data => {
|
||||
this.theDate = new Date(data.DateBegin);
|
||||
this.theEndDate = new Date(data.DateEnd);
|
||||
@@ -136,6 +135,7 @@ export class PublicationsPage implements OnInit {
|
||||
DateEnd: this.theEndDate.getDate() +" de " + ( this.months[this.theEndDate.getMonth()])+" de " +this.theEndDate.getFullYear(),
|
||||
ActionType: data.ActionType,
|
||||
}
|
||||
|
||||
if(data.ActionType == "Evento") {
|
||||
this.publicationsEventFolderList.push(folder);
|
||||
}
|
||||
@@ -143,7 +143,12 @@ export class PublicationsPage implements OnInit {
|
||||
this.publicationsTravelFolderList.push(folder);
|
||||
}
|
||||
this.showLoader = false;
|
||||
|
||||
this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
|
||||
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList)
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -204,6 +209,8 @@ export class PublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
goToPublicationsList(folderId: string){
|
||||
this.folderId = folderId
|
||||
|
||||
if( window.innerWidth <= 800){
|
||||
this.router.navigate(['/home/publications',folderId]);
|
||||
} else {
|
||||
@@ -215,6 +222,7 @@ export class PublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
async viewPublications(folderId: string) {
|
||||
this.folderId = folderId
|
||||
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
const backdropAnimation = this.animationController.create()
|
||||
@@ -319,7 +327,6 @@ export class PublicationsPage implements OnInit {
|
||||
this.getActions();
|
||||
}
|
||||
|
||||
|
||||
async closeDesktopComponent (xx?: any){
|
||||
|
||||
this.desktopComponent = {
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
<ion-list>
|
||||
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" -->
|
||||
<div class="post-item"
|
||||
*ngFor="let publication of publicationList"
|
||||
(click)="goToPublicationDetail(publication.DocumentId)">
|
||||
*ngFor="let publication of publicationListStorage.documents[folderId]"
|
||||
(click)="goToPublicationDetail(publication.DocumentId)"
|
||||
>
|
||||
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
|
||||
<img src="{{publication.FileBase64}}" alt="image">
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,9 @@ import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { LoadingService } from 'src/app/services/loading.service';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
import { PublicationListStorage } from 'src/app/store/publication-list.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
|
||||
|
||||
@@ -22,24 +25,29 @@ export class ViewPublicationsPage implements OnInit {
|
||||
folderId:string;
|
||||
error: any;
|
||||
|
||||
publicationListStorage = PublicationListStorage
|
||||
//
|
||||
publicationEventFolderStorage = PublicationEventFolderStorage
|
||||
publicationTravelFolderService = PublicationTravelFolderStore
|
||||
|
||||
constructor( private loadingController: LoadingService,
|
||||
private modalController: ModalController,
|
||||
private publications: PublicationsService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router )
|
||||
{
|
||||
this.item = new PublicationFolder();
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
console.log(params);
|
||||
|
||||
if(params["params"]) {
|
||||
this.folderId = params["params"].folderId;
|
||||
console.log(params["params"]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
this.item = new PublicationFolder();
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
console.log(params);
|
||||
|
||||
if(params["params"]) {
|
||||
this.folderId = params["params"].folderId;
|
||||
console.log(params["params"]);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -66,7 +74,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.getPublications();
|
||||
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
this.getPublicationDetail();
|
||||
event.target.complete();
|
||||
}, 3000);
|
||||
@@ -84,18 +91,18 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
getPublicationDetail() {
|
||||
this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.item = res;
|
||||
});
|
||||
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
|
||||
this.item = allActions.find((e)=> e.ProcessId == this.folderId)
|
||||
}
|
||||
|
||||
getPublications() {
|
||||
this.showLoader = true;
|
||||
|
||||
const folderId = this.folderId
|
||||
this.publications.GetPublications(this.folderId).subscribe(res=>{
|
||||
this.publicationList = new Array();
|
||||
console.log(res);
|
||||
|
||||
let data = [];
|
||||
|
||||
res.forEach(element => {
|
||||
let itemImage = {
|
||||
title: 'Title',
|
||||
@@ -114,15 +121,20 @@ export class ViewPublicationsPage implements OnInit {
|
||||
"OriginalFileName": '',
|
||||
"FileExtension": '',
|
||||
}
|
||||
this.publicationList.push(item);
|
||||
|
||||
// this.publicationList.push(item);
|
||||
data.push(item)
|
||||
|
||||
});
|
||||
console.log(this.publicationList);
|
||||
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
|
||||
this.showLoader = false;
|
||||
},
|
||||
(error)=>{
|
||||
if(error.status == '404'){
|
||||
this.error = 'Sem publicações disponíveis!';
|
||||
this.publicationList=null;
|
||||
this.publicationList= [];
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
@@ -87,7 +87,6 @@ export class PublicationsService {
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options)
|
||||
.pipe(catchError(this.handleError));
|
||||
}
|
||||
|
||||
GetPublicationById( publicationId:any){
|
||||
|
||||
@@ -182,6 +182,11 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
injectValidation() {
|
||||
|
||||
if (typeof(this.postEvent.EventRecurrence.Type) == 'number') {
|
||||
const str: any = this.postEvent.EventRecurrence.Type.toString()
|
||||
this.postEvent.EventRecurrence.Type = str
|
||||
}
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.postEvent.Subject, [
|
||||
Validators.required,
|
||||
|
||||
@@ -24,6 +24,7 @@ import { ThemePalette } from '@angular/material/core';
|
||||
import { NgZone, ViewChild } from '@angular/core';
|
||||
import { FormGroup, Validators } from '@angular/forms';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
|
||||
|
||||
const moment = _rollupMoment || _moment;
|
||||
|
||||
@@ -227,6 +228,11 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
injectValidation() {
|
||||
|
||||
if (typeof(this.postEvent.EventRecurrence.Type) == 'number') {
|
||||
const str: any = this.postEvent.EventRecurrence.Type.toString()
|
||||
this.postEvent.EventRecurrence.Type = str
|
||||
}
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.postEvent.Subject, [
|
||||
Validators.required,
|
||||
@@ -340,6 +346,8 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
async save() {
|
||||
|
||||
this.injectValidation()
|
||||
|
||||
@@ -13,6 +13,7 @@ import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/
|
||||
import { ChatPopoverPage } from '../../popover/chat-popover/chat-popover.page';
|
||||
import { OptsExpedientePage } from '../../popover/opts-expediente/opts-expediente.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-event',
|
||||
@@ -109,12 +110,32 @@ export class ViewEventPage implements OnInit {
|
||||
;
|
||||
}
|
||||
|
||||
deleteEvent(){
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () =>
|
||||
{
|
||||
async deleteEvent(){
|
||||
|
||||
if (this.loadedEvent.IsRecurring) {
|
||||
|
||||
} else {
|
||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () => {
|
||||
this.toastService.successMessage('Evento apagado');
|
||||
this.close();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async deleteRecurringEvent() {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EliminateEventPage,
|
||||
componentProps: {},
|
||||
cssClass: 'discart-expedient-modal',
|
||||
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res) => {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getAttachments(eventId){
|
||||
|
||||
@@ -60,7 +60,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -44,7 +44,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -54,7 +54,6 @@ ion-item{
|
||||
.item {
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -43,7 +43,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -43,7 +43,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -43,7 +43,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -43,7 +43,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -43,7 +43,6 @@ ion-item{
|
||||
background-color: var(--white);
|
||||
margin: 0 auto;
|
||||
//padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.div-content-expediente{
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<ion-list>
|
||||
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" -->
|
||||
<div class="post-item d-md-block mb-10"
|
||||
*ngFor="let publication of publicationList"
|
||||
*ngFor="let publication of publicationListStorage.documents[folderId]"
|
||||
(click)="viewPublicationDetail(publication.DocumentId)">
|
||||
<div *ngIf="publication.FileBase64.length > 30" class="mb-10 post-img width-md-100">
|
||||
<img src="{{publication.FileBase64}}" alt="image">
|
||||
|
||||
@@ -6,7 +6,9 @@ import { LoadingService } from 'src/app/services/loading.service';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { PublicationDetailPage } from 'src/app/pages/publications/publication-detail/publication-detail.page';
|
||||
import { NewPublicationPage } from 'src/app/pages/publications/new-publication/new-publication.page';
|
||||
|
||||
import { PublicationListStorage } from 'src/app/store/publication-list.service'
|
||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||
@Component({
|
||||
selector: 'app-view-publications',
|
||||
templateUrl: './view-publications.page.html',
|
||||
@@ -28,13 +30,19 @@ export class ViewPublicationsPage implements OnInit {
|
||||
@Output() closeDesktopComponent = new EventEmitter<any>();
|
||||
@Output() goBacktoPublicationDetails = new EventEmitter<any>();
|
||||
|
||||
|
||||
|
||||
publicationListStorage = PublicationListStorage
|
||||
//
|
||||
publicationEventFolderStorage = PublicationEventFolderStorage
|
||||
publicationTravelFolderService = PublicationTravelFolderStore
|
||||
|
||||
constructor(
|
||||
private loadingController: LoadingService,
|
||||
private modalController: ModalController,
|
||||
private publications: PublicationsService,
|
||||
) {
|
||||
this.item = new PublicationFolder();
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -49,42 +57,47 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: any): void {
|
||||
console.log(this.folderId)
|
||||
|
||||
if(typeof(this.folderId) == 'object') {
|
||||
this.folderId = this.folderId['ProcessId']
|
||||
}
|
||||
|
||||
this.getPublications();
|
||||
this.getPublicationDetail();
|
||||
setTimeout(()=>{
|
||||
this.getPublications();
|
||||
this.getPublicationDetail();
|
||||
}, 100)
|
||||
|
||||
|
||||
}
|
||||
|
||||
doRefresh(event) {
|
||||
this.getPublications();
|
||||
|
||||
setTimeout(() => {
|
||||
this.getPublications();
|
||||
this.getPublicationDetail();
|
||||
event.target.complete();
|
||||
}, 3000);
|
||||
}
|
||||
close(){
|
||||
|
||||
close() {
|
||||
this.closeDesktopComponent.emit();
|
||||
}
|
||||
|
||||
getPublicationDetail() {
|
||||
this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.item = res;
|
||||
});
|
||||
|
||||
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
|
||||
this.item = allActions.find((e)=> e.ProcessId == this.folderId)
|
||||
|
||||
}
|
||||
|
||||
getPublications(){
|
||||
getPublications() {
|
||||
this.showLoader = true;
|
||||
|
||||
this.publications.GetPublications(this.folderId).subscribe(res=>{
|
||||
const folderId = this.folderId
|
||||
|
||||
this.publications.GetPublications(folderId).subscribe(res=> {
|
||||
this.publicationList = new Array();
|
||||
console.log(res);
|
||||
|
||||
res.forEach(element => {
|
||||
let itemImage = {
|
||||
title: 'Title',
|
||||
@@ -105,19 +118,21 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
this.publicationList.push(item);
|
||||
});
|
||||
console.log(this.publicationList);
|
||||
|
||||
this.publicationListStorage.add(folderId, this.publicationList)
|
||||
|
||||
this.showLoader = false;
|
||||
},
|
||||
(error)=>{
|
||||
if(error.status == '404'){
|
||||
if(error.status == '404') {
|
||||
this.error = 'Sem publicações disponíveis!';
|
||||
this.publicationList=null;
|
||||
// this.publicationList = null;
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async AddPublication(publicationType:any, folderId:any) {
|
||||
@@ -145,7 +160,6 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
async viewPublicationDetail(publicationId:string) {
|
||||
|
||||
console.log(publicationId);
|
||||
@@ -170,5 +184,4 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,13 +37,20 @@ export class CalendarService {
|
||||
}
|
||||
|
||||
ResetList(eventSource: eventSource[]) {
|
||||
this._eventSource = eventSource
|
||||
this._eventSource = eventSource
|
||||
|
||||
setTimeout(() => {
|
||||
this.localstoreService.set(this.keyName, this._eventSource)
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get eventSource() {
|
||||
return this._eventSource
|
||||
}
|
||||
|
||||
|
||||
|
||||
removeRange(rangeStartDate, rangeEndDate, profile) {
|
||||
this._eventSource = this._eventSource.filter((e)=> {
|
||||
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExpedienteStorageServiceService } from './expediente-storage-service.service';
|
||||
|
||||
describe('ExpedienteStorageServiceService', () => {
|
||||
let service: ExpedienteStorageServiceService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ExpedienteStorageServiceService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Event } from '../models/event.model';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
// shared data used in home and gabinete
|
||||
class ExpedienteStorageServiceService {
|
||||
|
||||
// main data
|
||||
private _list: Event[]
|
||||
private _count = 0
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'ExpedienteStorage/forAll')).toString()
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, [])
|
||||
this._list = restore.list || []
|
||||
this._count = restore.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
}
|
||||
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
set count(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
reset(list: any) {
|
||||
this._list = list
|
||||
|
||||
this.count = this._list.length
|
||||
this.save(this._list)
|
||||
}
|
||||
|
||||
private save(list: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyName, {
|
||||
list: list,
|
||||
count: this.count
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const ExpedienteStorage = new ExpedienteStorageServiceService()
|
||||
@@ -56,3 +56,5 @@ export class LocalstoreService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const localstoreService = new LocalstoreService()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PresidentialActionsStoreService } from './presidential-actions-store.service';
|
||||
|
||||
describe('PresidentialActionsStoreService', () => {
|
||||
let service: PresidentialActionsStoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PresidentialActionsStoreService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PresidentialActionsStoreService {
|
||||
|
||||
// main data
|
||||
private _list: Publication[] = []
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'presidentialActions/local')).toString()
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, [])
|
||||
this._list = restore
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
}
|
||||
|
||||
reset(list: Publication[]) {
|
||||
this._list = list
|
||||
|
||||
this.save(this._list)
|
||||
}
|
||||
|
||||
private save(list: Publication[]) {
|
||||
setTimeout(()=> {
|
||||
localstoreService.set(this.keyName, list)
|
||||
}, 10)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const PresidentialActionsStore = new PresidentialActionsStoreService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PublicationEventFolderService } from './publication-event-folder.service';
|
||||
|
||||
describe('PublicationEventFolderService', () => {
|
||||
let service: PublicationEventFolderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PublicationEventFolderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { SHA1 } from 'crypto-js'
|
||||
import { PublicationFolder } from '../models/publicationfolder';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PublicationEventFolderService {
|
||||
// main data
|
||||
private _list: PublicationFolder[] = []
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'PublicationEventFolder/local')).toString()
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, [])
|
||||
this._list = restore
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
}
|
||||
|
||||
reset(list: PublicationFolder[]) {
|
||||
this._list = list
|
||||
|
||||
this.save(this._list)
|
||||
}
|
||||
|
||||
private save(list: PublicationFolder[]) {
|
||||
setTimeout(()=> {
|
||||
localstoreService.set(this.keyName, list)
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
export const PublicationEventFolderStorage = new PublicationEventFolderService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PublicationListService } from './publication-list.service';
|
||||
|
||||
describe('PublicationListService', () => {
|
||||
let service: PublicationListService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PublicationListService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Publication } from 'src/app/models/publication'
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PublicationListService {
|
||||
|
||||
// main data
|
||||
private _document: Publication[] = []
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'view-publication-list/local')).toString()
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, [])
|
||||
this._document = restore
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get documents() {
|
||||
return this._document
|
||||
}
|
||||
|
||||
getDocument(folderId: string) {
|
||||
return this._document[folderId]
|
||||
}
|
||||
|
||||
add(folderId, document) {
|
||||
this._document[folderId] = document
|
||||
|
||||
setTimeout(()=> {
|
||||
localstoreService.set(this.keyName, this._document)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export const PublicationListStorage = new PublicationListService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PublicationTravelFolderService } from './publication-travel-folder.service';
|
||||
|
||||
describe('PublicationTravelFolderService', () => {
|
||||
let service: PublicationTravelFolderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PublicationTravelFolderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { SHA1 } from 'crypto-js'
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { PublicationFolder } from '../models/publicationfolder';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PublicationTravelFolderService {
|
||||
|
||||
// main data
|
||||
private _list: PublicationFolder[] = []
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ ' PublicationTravelFolder/local')).toString()
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, [])
|
||||
this._list = restore
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
}
|
||||
|
||||
reset(list: PublicationFolder[]) {
|
||||
this._list = list
|
||||
|
||||
this.save(this._list)
|
||||
}
|
||||
|
||||
private save(list: PublicationFolder[]) {
|
||||
setTimeout(()=> {
|
||||
localstoreService.set(this.keyName, list)
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const PublicationTravelFolderStore = new PublicationTravelFolderService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ToDayEventStorageService } from './to-day-event-storage.service';
|
||||
|
||||
describe('ToDayEventStorageService', () => {
|
||||
let service: ToDayEventStorageService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ToDayEventStorageService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Event } from '../models/event.model';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class ToDayEventStorageService {
|
||||
|
||||
// main data
|
||||
private _eventsList: Event[]
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
private _count = 0
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name+ 'home/eventSource')).toString()
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, {})
|
||||
this._eventsList = restore.eventsList || []
|
||||
this._count = restore.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get eventsList() {
|
||||
return this._eventsList
|
||||
}
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
set count(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
reset(eventsList: Event[]) {
|
||||
this._eventsList = eventsList
|
||||
|
||||
this.count = this._eventsList.length
|
||||
this.save(this._eventsList)
|
||||
}
|
||||
|
||||
private save(eventsList: Event[]) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyName,{
|
||||
eventsList,
|
||||
count: this._eventsList
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const ToDayEventStorage = new ToDayEventStorageService()
|
||||
Reference in New Issue
Block a user