mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
186 lines
4.9 KiB
TypeScript
186 lines
4.9 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { localstoreService } from './localstore.service'
|
|
import { AES, enc, SHA1 } from 'crypto-js'
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class DeplomasService {
|
|
|
|
private _diplomasAssinadoList = []
|
|
private _diplomasReviewList = []
|
|
private _diplomasGerarList = []
|
|
private _diplomasParaAssinar = []
|
|
|
|
private keyNameDiplomasAssinado: string;
|
|
private keyNameDiplomasParaAssinar: string;
|
|
private keyNameDiplomasGerar: string;
|
|
private keyNameDiplomasReview: string;
|
|
|
|
private _diplomasAssinadoListCount = 0
|
|
private _diplomasReviewCount = 0
|
|
private _diplomasGerarListCount = 0;
|
|
private _diplomasListCount = 0;
|
|
|
|
constructor() {
|
|
this.keyNameDiplomasAssinado = (SHA1("DeplomasService"+"diplomasAssinado")).toString()
|
|
this.keyNameDiplomasReview = (SHA1("DeplomasService"+"diplomasReview")).toString()
|
|
this.keyNameDiplomasGerar = (SHA1("DeplomasService"+"diplomasGerar")).toString()
|
|
this.keyNameDiplomasParaAssinar = (SHA1("DeplomasService"+"diplomasParaAsinar")).toString()
|
|
|
|
setTimeout(() => {
|
|
|
|
let restoreDiplomasAssinado = localstoreService.get(this.keyNameDiplomasAssinado, {})
|
|
let restoreDiplomasParaAssinar = localstoreService.get(this.keyNameDiplomasParaAssinar, {})
|
|
let restoreDiplomasReviewList = localstoreService.get(this.keyNameDiplomasReview, {})
|
|
let restoreDiplomasGerarList = localstoreService.get(this.keyNameDiplomasGerar, {})
|
|
|
|
this._diplomasAssinadoList = restoreDiplomasAssinado.list || []
|
|
this._diplomasAssinadoListCount = parseInt(restoreDiplomasAssinado.count) || 0
|
|
|
|
this._diplomasParaAssinar = restoreDiplomasParaAssinar.list || []
|
|
this._diplomasListCount = parseInt(restoreDiplomasParaAssinar.count) || 0
|
|
|
|
this._diplomasReviewList = restoreDiplomasReviewList.list || []
|
|
this._diplomasReviewCount = parseInt(restoreDiplomasReviewList.count) || 0
|
|
|
|
this._diplomasGerarList = restoreDiplomasGerarList.list || []
|
|
this._diplomasGerarListCount = parseInt(restoreDiplomasGerarList.count) || 0
|
|
|
|
}, 10)
|
|
|
|
}
|
|
|
|
|
|
get deplomasReviewCount() {
|
|
return this._diplomasReviewCount
|
|
}
|
|
set deplomasReviewCount(arg: number) {
|
|
this._diplomasReviewCount = arg
|
|
this.saveDiplomasReviewList()
|
|
}
|
|
|
|
get countDiplomasAssinadoListCount() {
|
|
return this._diplomasAssinadoListCount || 0
|
|
}
|
|
|
|
set countDiplomasListCount(value) {
|
|
this._diplomasAssinadoListCount = value
|
|
this.saveDiplomasAssinadoList()
|
|
}
|
|
|
|
get diplomasParaAssinartCount() {
|
|
return this._diplomasListCount || 0
|
|
}
|
|
|
|
set diplomasParaAssinarCount(value) {
|
|
this._diplomasParaAssinar = value
|
|
this.saveDiplomasParaAssinar()
|
|
}
|
|
|
|
// get list
|
|
get diplomasParaAssinarList() {
|
|
return this._diplomasParaAssinar
|
|
}
|
|
|
|
// get list
|
|
get diplomasAssinadoList() {
|
|
return this._diplomasAssinadoList
|
|
}
|
|
|
|
// get list
|
|
get diplomasReviewList() {
|
|
return this._diplomasReviewList
|
|
}
|
|
|
|
// get list
|
|
|
|
|
|
get DiplomaGerarList() {
|
|
return this._diplomasGerarList
|
|
}
|
|
|
|
resetDiplomasAssinadoList(value: any[]) {
|
|
|
|
this._diplomasAssinadoListCount = value.length
|
|
this._diplomasAssinadoList = value
|
|
this.saveDiplomasAssinadoList()
|
|
if(window['all-process-gabinete']) {
|
|
window['all-process-gabinete']()
|
|
}
|
|
}
|
|
|
|
resetDiplomasParaAssinar(value: any[]) {
|
|
|
|
this._diplomasListCount = value.length
|
|
this._diplomasParaAssinar = value
|
|
this.saveDiplomasParaAssinar()
|
|
|
|
if(window['all-process-gabinete']) {
|
|
window['all-process-gabinete']()
|
|
}
|
|
}
|
|
|
|
resetDiplomasReview(value: any[]) {
|
|
this._diplomasReviewList =value
|
|
this._diplomasReviewCount = value.length
|
|
this.saveDiplomasReviewList()
|
|
|
|
if(window['all-process-gabinete']) {
|
|
window['all-process-gabinete']()
|
|
}
|
|
}
|
|
|
|
resetDiplomaGerar(value: any[]) {
|
|
|
|
this._diplomasGerarListCount = value.length
|
|
this._diplomasGerarList = value
|
|
|
|
this.savetDiplomaGerar()
|
|
if(window['all-process-gabinete']) {
|
|
window['all-process-gabinete']()
|
|
}
|
|
}
|
|
|
|
|
|
private saveDiplomasReviewList () {
|
|
setTimeout(()=>{
|
|
localstoreService.set(this.keyNameDiplomasReview,{
|
|
list: this._diplomasReviewList,
|
|
count: this._diplomasReviewCount,
|
|
})
|
|
}, 10)
|
|
}
|
|
|
|
private saveDiplomasAssinadoList() {
|
|
|
|
setTimeout(()=>{
|
|
localstoreService.set(this.keyNameDiplomasAssinado,{
|
|
list: this._diplomasAssinadoList,
|
|
count: this._diplomasAssinadoListCount,
|
|
})
|
|
}, 10)
|
|
}
|
|
|
|
private saveDiplomasParaAssinar () {
|
|
setTimeout(()=>{
|
|
localstoreService.set(this.keyNameDiplomasParaAssinar,{
|
|
list: this._diplomasParaAssinar,
|
|
count: this._diplomasListCount,
|
|
})
|
|
}, 10)
|
|
}
|
|
|
|
private savetDiplomaGerar() {
|
|
setTimeout(()=>{
|
|
localstoreService.set(this.keyNameDiplomasGerar,{
|
|
list: this._diplomasGerarList,
|
|
count: this._diplomasGerarListCount,
|
|
})
|
|
}, 10)
|
|
}
|
|
|
|
}
|
|
|
|
export let DeplomasStore = new DeplomasService()
|