mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
Expediente and pedidos store created and added to expediente and pedidos page
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EventoaprovacaoStoreService } from './eventoaprovacao-store.service';
|
||||
|
||||
describe('EventoaprovacaoStoreService', () => {
|
||||
let service: EventoaprovacaoStoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(EventoaprovacaoStoreService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class EventoaprovacaoStoreService {
|
||||
|
||||
// main data
|
||||
private _listpr: Event[]
|
||||
private _listmd: Event[]
|
||||
// local storage keyName
|
||||
private keyNamemd: string;
|
||||
private keyNamepr: string;
|
||||
private _count = 0
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyNamemd = (SHA1(this.constructor.name+"md")).toString()
|
||||
this.keyNamepr = (SHA1(this.constructor.name+"pr")).toString()
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
let restoremd = localstoreService.get(this.keyNamemd, {})
|
||||
let restorepr = localstoreService.get(this.keyNamepr, {})
|
||||
this._listpr = restorepr.eventsListpr || []
|
||||
this._listmd = restoremd.eventsListmd || []
|
||||
this._count = restorepr.count + restoremd.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get listpr() {
|
||||
return this._listpr
|
||||
}
|
||||
|
||||
get listmd() {
|
||||
return this._listmd
|
||||
}
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
set count(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
resetpr(eventsList: any) {
|
||||
this._listpr = eventsList
|
||||
|
||||
this.count = this._listpr.length
|
||||
this.savepr(this._listpr)
|
||||
}
|
||||
|
||||
resetmd(eventsList: any) {
|
||||
this._listmd = eventsList
|
||||
|
||||
this.count = this._listmd.length
|
||||
this.savemd(this._listmd)
|
||||
}
|
||||
private savemd(eventsListmd: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyNamemd,{
|
||||
eventsListmd,
|
||||
count: this._listmd,
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
private savepr(eventsListpr: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyNamepr,{
|
||||
eventsListpr,
|
||||
count: this._listpr,
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const EventoAprovacaoStore = new EventoaprovacaoStoreService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExpedientegdStoreService } from './expedientegd-store.service';
|
||||
|
||||
describe('ExpedientegdStoreService', () => {
|
||||
let service: ExpedientegdStoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ExpedientegdStoreService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ExpedientegdStoreService {
|
||||
|
||||
// main data
|
||||
private _list: Event[]
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
private _count = 0
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name)).toString()
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, {})
|
||||
this._list = restore.eventsList || []
|
||||
this._count = restore.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
}
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
set count(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
reset(eventsList: any) {
|
||||
this._list = eventsList
|
||||
|
||||
this.count = this._list.length
|
||||
this.save(this._list)
|
||||
}
|
||||
|
||||
private save(eventsList: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyName,{
|
||||
eventsList,
|
||||
count: this._list
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const ExpedienteGdStore = new ExpedientegdStoreService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PedidosStoreService } from './pedidos-store.service';
|
||||
|
||||
describe('PedidosStoreService', () => {
|
||||
let service: PedidosStoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PedidosStoreService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PedidosStoreService {
|
||||
|
||||
private _listparecer: Event[]
|
||||
private _listdeferimento: Event[]
|
||||
// local storage keyName
|
||||
private keyNameparecer: string;
|
||||
private keyNamedeferiemnto: string;
|
||||
private _count = 0
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyNameparecer = (SHA1(this.constructor.name+"parecer")).toString()
|
||||
this.keyNamedeferiemnto = (SHA1(this.constructor.name+"deferimneto")).toString()
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
let restoreparecer = localstoreService.get(this.keyNameparecer, {})
|
||||
let restoredeferimento = localstoreService.get(this.keyNamedeferiemnto, {})
|
||||
this._listparecer = restoredeferimento.eventsListdeferimento || []
|
||||
this._listdeferimento = restoreparecer.eventsListparecer || []
|
||||
this._count = restoredeferimento.count + restoreparecer.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get listparecer() {
|
||||
return this._listparecer
|
||||
}
|
||||
|
||||
get listdeferimento() {
|
||||
return this._listdeferimento
|
||||
}
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
set count(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
resetparecer(eventsList: any) {
|
||||
this._listparecer = eventsList
|
||||
|
||||
this.count = this._listparecer.length
|
||||
this.savedeferimento(this._listparecer)
|
||||
}
|
||||
|
||||
resetdeferimento(eventsList: any) {
|
||||
this._listdeferimento = eventsList
|
||||
|
||||
this.count = this._listdeferimento.length
|
||||
this.saveparecer(this._listdeferimento)
|
||||
}
|
||||
private saveparecer(eventsListparecer: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyNameparecer,{
|
||||
eventsListparecer,
|
||||
count: this._listdeferimento,
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
private savedeferimento(eventsListdeferimento: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyNamedeferiemnto,{
|
||||
eventsListdeferimento,
|
||||
count: this._listparecer,
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const PedidosStore = new PedidosStoreService()
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PendestesStoreService } from './pendestes-store.service';
|
||||
|
||||
describe('PendestesStoreService', () => {
|
||||
let service: PendestesStoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PendestesStoreService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PendestesStoreService {
|
||||
|
||||
// main data
|
||||
private _list: Event[]
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
private _count = 0
|
||||
|
||||
constructor() {
|
||||
|
||||
this.keyName = (SHA1(this.constructor.name)).toString()
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
let restore = localstoreService.get(this.keyName, {})
|
||||
this._list = restore.eventsList || []
|
||||
this._count = restore.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get list() {
|
||||
return this._list
|
||||
}
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
set count(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
reset(eventsList: any) {
|
||||
this._list = eventsList
|
||||
|
||||
this.count = this._list.length
|
||||
this.save(this._list)
|
||||
}
|
||||
|
||||
private save(eventsList: any) {
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyName,{
|
||||
eventsList,
|
||||
count: this._list
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const PendentesStore = new PendestesStoreService()
|
||||
|
||||
Reference in New Issue
Block a user