add document management store

This commit is contained in:
Peter Maquiran
2023-07-06 13:01:51 +01:00
1343 changed files with 5381 additions and 387 deletions
+4
View File
@@ -272,6 +272,10 @@ const routes = [
},
{
path: 'task-list-header',
loadChildren: () => import('./shared/gabinete-digital/generic/task-list-header/task-list-header.module').then( m => m.TaskListHeaderPageModule)
},
{
path: 'tiny-mce',
loadChildren: () => import('./tiny-mce/tiny-mce.module').then( m => m.TinyMCEPageModule)
}
+3 -1
View File
@@ -77,6 +77,7 @@ import * as Sentry from '@sentry/capacitor';
// For automatic instrumentation (highly recommended)
import { Integration } from '@sentry/types';
import { BrowserTracing } from '@sentry/tracing';
import { EditorModule } from '@tinymce/tinymce-angular';
// import { ServiceWorkerModule } from '@angular/service-worker';
// import { AngularFireModule } from '@angular/fire';
@@ -156,6 +157,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
NgxMatMomentModule,
MatSelectModule,
MatButtonModule,
EditorModule
],
providers: [
@@ -191,7 +193,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
MultipleDocumentsPicker,
NgxExtendedPdfViewerModule,
FileOpener,
DocumentViewer
DocumentViewer,
],
bootstrap: [AppComponent],
+1
View File
@@ -63,6 +63,7 @@ export class fullTask {
UserName: string,
WorkflowID: string,
wxUserID: number,
DraftIds: string
}
Documents: any[]
workflowInstanceFolio: string
+1
View File
@@ -3,6 +3,7 @@ export interface Environment {
apiURL: string;
apiChatUrl: string;
apiWsChatUrl: string;
apiPCURL: string;
logoLabel: string;
production: boolean;
domain: string;
@@ -63,8 +63,8 @@
<div class="bottom-content width-100">
<ion-list>
<h5>Documentos Anexados</h5>
<ion-item class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of fulltask.Documents">
<ion-label class="d-block" (click)="viewDocument(Document.DocId, Document)">
<ion-item class="ion-no-margin ion-no-padding cursor-pointer" *ngFor="let Document of mergedArray">
<ion-label class="d-block" (click)="viewDocument(Document.DocId, Document,Document.content)">
<p class="attach-title-item">{{ Document.Assunto || "Sem assunto" }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{ Document.Sender}}</span><span class="span-right">{{ Document.DocDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
</ion-label>
@@ -21,6 +21,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service'
import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page';
@Component({
@@ -39,6 +40,7 @@ export class DespachoPage implements OnInit {
attachments: any;
fulltask: any;
mergedArray: any = [];
eventsList: Event[] = [];
serialnumber: string;
caller: string;
@@ -47,6 +49,7 @@ export class DespachoPage implements OnInit {
cc: any = [];
executadoText: string = "Executado";
gerarText: string = "Gerar"
draftDocumentIds;
constructor(private activateRoute: ActivatedRoute,
@@ -106,7 +109,36 @@ export class DespachoPage implements OnInit {
async LoadTaskDetail(serial: string) {
this.processes.GetTask(serial).subscribe((res: fullTask) => {
this.TaskService.loadDiplomas();
let stringDraft = res.workflowInstanceDataFields.DraftIds;
console.log('sring to array', stringDraft)
let split_stringDraft = stringDraft.split(",");
let listDrafts = []
split_stringDraft.forEach(element => {
console.log('List of ids', element)
this.processes.GetDraftByID(element).subscribe((resd) => {
let object = {
"ApplicationId": "",
"Assunto": resd.data.description,
"DocDate": "",
"DocId": resd.data.id,
"DocNumber": "",
"FolderId": "",
"Sender": "",
"SourceDocId": "",
"content": resd.data.content,
}
this.mergedArray.push(object)
console.log('List of draff', resd)
})
});
this.task = {
"SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject,
@@ -129,19 +161,43 @@ export class DespachoPage implements OnInit {
// this.updateProcessOnDB(res);
this.fulltask = res;
console.log('Anexos', this.fulltask.Documents)
const mergedArray1 = [];
const mergedArray2 = [];
// Merge array1 with tag
this.fulltask.Documents.forEach(element => {
let docObject = {
"ApplicationId": element.ApplicationId,
"Assunto": element.Assunto,
"DocDate": element.DocDate,
"DocId": element.DocId,
"DocNumber": element.DocNumber,
"FolderId": element.FolderId,
"Sender": element.Sender,
"SourceDocId": element.SourceDocId,
"content": "",
}
this.mergedArray.push(docObject);
});
console.log('All',this.mergedArray)
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => {
// this.updateProcessInterveners(users)
this.intervenientes = users.filter(user => {
return user.Type == 'I';
});
this.cc = users.filter(user => {
return user.Type == 'CC';
});
});
@@ -177,26 +233,40 @@ export class DespachoPage implements OnInit {
// }
async viewDocument(docId: string, Document) {
async viewDocument(docId: string, Document, content) {
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: Document.Assunto,
url: '',
title_link: '',
if(Document.content == "") {
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: Document.Assunto,
url: '',
title_link: '',
},
Document,
applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId,
task: this.fulltask
},
Document,
applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId,
task: this.fulltask
},
cssClass: 'modal modal-desktop'
});
await modal.present();
cssClass: 'modal modal-desktop'
});
await modal.present();
} else {
const modal = await this.modalController.create({
component: TinyMCEPage,
componentProps: {
Document,
content
},
cssClass: 'modal modal-desktop'
});
await modal.present();
}
}
@@ -257,7 +327,7 @@ export class DespachoPage implements OnInit {
await this.processes.CompleteTask(body).toPromise()
this.httpErrorHandle.httpsSucessMessagge('Reexecução')
this.TaskService.loadDespachos();
//this.close();
//this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
@@ -268,7 +338,7 @@ export class DespachoPage implements OnInit {
}
async generateDiploma(note:string, documents:any) {
async generateDiploma(note: string, documents: any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Reencaminhar",
@@ -276,7 +346,7 @@ export class DespachoPage implements OnInit {
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
"AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -288,7 +358,7 @@ export class DespachoPage implements OnInit {
// this.close();
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error);
} finally {
} finally {
loader.remove()
}
@@ -311,7 +381,7 @@ export class DespachoPage implements OnInit {
loader.remove()
this.httpErrorHandle.httpStatusHandle(error)
});
// loader.remove()
// loader.remove()
}
tstemethod(value: string) {
@@ -319,7 +389,7 @@ export class DespachoPage implements OnInit {
}
async openAddNoteModal(actionName: string) {
let classs;
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
@@ -365,7 +435,7 @@ export class DespachoPage implements OnInit {
else if (actionName == 'Reexecução') {
await this.reexecute(res.data.note, docs);
this.goBack();
} else if(actionName == 'Gerar Diploma') {
} else if (actionName == 'Gerar Diploma') {
await this.generateDiploma(res.data.note, docs);
this.goBack();
}
@@ -393,7 +463,7 @@ export class DespachoPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') {
await this.distartExpedientModal();
@@ -439,9 +509,9 @@ export class DespachoPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(res => {
if(res){
if (res) {
const data = res.data;
if(data == 'close') {
if (data == 'close') {
this.goBack();
}
this.TaskService.loadDespachos();
@@ -451,7 +521,7 @@ export class DespachoPage implements OnInit {
}
async distartExpedientModal() {
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
componentProps: {
@@ -490,16 +560,22 @@ export class DespachoPage implements OnInit {
translucent: true
});
await popover.present();
popover.onDidDismiss().then((res)=> {
popover.onDidDismiss().then((res) => {
// console.log('res', res.data)
if(res.data == 'back') {
if (res.data == 'back') {
this.goBack();
}
})
}
}
function mergeArraysAndTag(array1, array2) {
console.log('second', array2)
}
+2
View File
@@ -117,6 +117,8 @@ export class LoginPage implements OnInit {
const loader = this.toastService.loading()
let attempt = await this.authService.login(this.userattempt, {saveSession: false})
await this.authService.loginContenteProduction(this.userattempt, {saveSession: false})
loader.remove()
+29
View File
@@ -100,6 +100,35 @@ export class AuthService {
}
async loginContenteProduction(user: UserForm, {saveSession = true}): Promise<LoginUserRespose> {
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + this.aesencrypt.encrypt(user.password,user.username ));
this.headers = this.headers.set('Authorization', user.BasicAuthKey);
this.opts = {
headers: this.headers,
}
let response: any;
try {
response = await this.http.post<LoginUserRespose>(environment.apiURL + "UserAuthentication/LoginJwt", '', this.opts).toPromise();
if(saveSession) {
/* this.SetSession(response, user) */
this.storageService.store('userContentProduction',response)
this.storageService.get('userContentProduction').then((value) =>{
console.log('JWW', value.AuthorizationJwt);
})
}
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
return response
}
}
// async UpdateLogin() {}
SetSession(response: LoginUserRespose, user:UserForm) {
+25 -1
View File
@@ -10,6 +10,7 @@ import { GetTasksListType } from '../models/GetTasksListType';
import { fullTaskList } from '../models/dailyworktask.model';
import { ChangeProfileService } from './change-profile.service';
import { SessionStore } from '../store/session.service';
import { StorageService } from './storage.service';
@Injectable({
providedIn: 'root'
})
@@ -18,10 +19,13 @@ export class ProcessesService {
authheader = {};
loggeduser: LoginUserRespose;
headers: HttpHeaders;
headers2: HttpHeaders;
constructor(
private http: HttpClient,
private changeProfileService: ChangeProfileService
private changeProfileService: ChangeProfileService,
private storageSevice: StorageService
) {
this.loggeduser = SessionStore.user;
@@ -32,6 +36,8 @@ export class ProcessesService {
this.setHeader()
})
}
@@ -39,6 +45,11 @@ export class ProcessesService {
this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
this.headers2 = new HttpHeaders();
this.headers2 = this.headers2.set('Authorization',"bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIyNjIiLCJ1bmlxdWVfbmFtZSI6IkdpbHNvbiBNYW51ZWwiLCJlbWFpbCI6ImdpbHNvbi5tYW51ZWxAZ2FiaW5ldGVkaWdpdGFsLmxvY2FsIiwicm9sZSI6IlNlY3JldMOhcmlvIEdlcmFsIiwiZ3JvdXBzaWQiOiJHYWJpbmV0ZSBkZSBUZWNub2xvZ2lhcyBkZSBJbmZvcm1hw6fDo28iLCJvcmdhbmljZW50aXR5aWREIjoiMTA2IiwibmJmIjoxNjg4NTg0NTYzLCJleHAiOjE3MjAxMjA1NjMsImlhdCI6MTY4ODU4NDU2MywiaXNzIjoiOGIxMzBhN2YwLWM3YjctNDdzMjMtOWE4ZC1kNTlhMDE5YWY3NDkiLCJhdWQiOiJkMjh3dzE0NTMtM2M2OC00MWFkLThiNmMtYTUzNDUzODNlMGMyIn0.QDCrQsCH59GQMoudZTHyCMwwHYVwz1mZkLTzvzAwh64"
);
}
uploadFile(formData:any){
@@ -107,6 +118,7 @@ export class ProcessesService {
}
GetTask(serialnumber:string): Observable<any> {
const geturl = environment.apiURL + 'Tasks/FindTask';
let params = new HttpParams();
@@ -119,6 +131,18 @@ export class ProcessesService {
return this.http.get<any>(`${geturl}`, options);
}
GetDraftByID(id:string): Observable<any> {
const geturl = environment.apiPCURL + `Documents/${id}`;
let params = new HttpParams();
/* params = params.set("serialNumber", serialnumber); */
let options = {
headers: this.headers2,
/* params: params */
};
return this.http.get<any>(`${geturl}`, options);
}
SetTaskToPending(serialNumber:string): Observable<any>{
const geturl = environment.apiURL + 'Tasks/SetTaskPending';
+1
View File
@@ -13,6 +13,7 @@ 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 { ActiveTabService } from 'src/app/services/active-tab.service';
import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page';
@Component({
selector: 'app-header',
+36
View File
@@ -0,0 +1,36 @@
import { SHA1 } from 'crypto-js'
import { localstoreService } from './localstore.service'
export class documentManagementStore {
session: {
UserId: number,
Email: string,
UserName: string
FullName: string
RoleID: number
RoleDescription: string
OrganicEntityID: number
OrganicEntityName: string
Status: string
Authorization: string
AuthorizationJwt: string
}
get keyName() {
return SHA1("documentManagement").toString()
}
setData(data) {
this.session = data
localstoreService.set(this.keyName, {
user: this.session
})
}
clear() {
delete this.session
localstoreService.delete(this.keyName)
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { TinyMCEPage } from './tiny-mce.page';
const routes: Routes = [
{
path: '',
component: TinyMCEPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class TinyMCEPageRoutingModule {}
+25
View File
@@ -0,0 +1,25 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { TinyMCEPageRoutingModule } from './tiny-mce-routing.module';
import { TinyMCEPage } from './tiny-mce.page';
import {Editor} from 'tinymce';
import { EditorModule } from '@tinymce/tinymce-angular';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
TinyMCEPageRoutingModule,
EditorModule,
FontAwesomeModule
],
declarations: [TinyMCEPage]
})
export class TinyMCEPageModule {}
+39
View File
@@ -0,0 +1,39 @@
<ion-header class="ion-no-border">
<ion-toolbar class="d-flex">
<div class="d-flex align-items-center px-20 pt-20 font-25">
<div class="left cursor-pointer" (click)="close()">
<fa-icon icon="chevron-left" class="menu-icon font-awesome-1"></fa-icon>
</div>
<div class="middle add-ellipsis">
{{Document.Assunto}}
</div>
<div class="right cursor-pointer" (click)="openOptions()">
<fa-icon icon="ellipsis-v" class="menu-icon font-awesome-1"></fa-icon>
</div>
</div>
</ion-toolbar>
</ion-header>
<editor
apiKey="wr5dk69kive0qr9ig6y5spqvlj3a0tsiwnzdsexnz241k69p"
[(ngModel)]="editorContent"
[init]="{
height: 500,
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount print'
],
toolbar:
'undo redo | formatselect | bold italic backcolor | \
alignleft aligncenter alignright alignjustify | \
bullist numlist outdent indent | removeformat | print | help' }"
initialValue='{{content}}'
[(ngModel)]="editorContent"
(onSaveContent)="somefunction()"
></editor>
<button (click)="somefunction()">Save Content</button>
+27
View File
@@ -0,0 +1,27 @@
.left{
float: left;
}
.middle{
float: left;
padding-left: 5px !important;
}
.right{
float: right;
margin-left: auto;
}
.container-img {
background-image: url(/assets/gif/theme/gov/Blocks-loader.svg);
background-repeat: no-repeat;
background-position-x: center;
background-position-y: center;
}
@media only screen and (max-width: 650px) {
.container-img {
background-size: 25%;
}
}
+24
View File
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { TinyMCEPage } from './tiny-mce.page';
describe('TinyMCEPage', () => {
let component: TinyMCEPage;
let fixture: ComponentFixture<TinyMCEPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ TinyMCEPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(TinyMCEPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+59
View File
@@ -0,0 +1,59 @@
import { Component, OnInit } from '@angular/core';
import { NavParams } from '@ionic/angular';
import { EventDetailsDocumentsOptionsPage } from '../shared/popover/event-details-documents-options/event-details-documents-options.page';
import { AlertController, ModalController } from '@ionic/angular';
@Component({
selector: 'app-tiny-mce',
templateUrl: './tiny-mce.page.html',
styleUrls: ['./tiny-mce.page.scss'],
})
export class TinyMCEPage implements OnInit {
title = '<h1>Hello, World!</h1><p>This is my HTML document.</p>';
Document: any
content: any
editorContent: string;
constructor(
private navParams: NavParams,
private modalController: ModalController,
) {
this.Document = this.navParams.get('Document')
this.content = this.navParams.get('content')
}
ngOnInit() {
}
close() {
throw new Error('Method not implemented.');
}
somefunction() {
console.log(this.title)
}
async openOptions() {
const modal = await this.modalController.create({
component: EventDetailsDocumentsOptionsPage,
cssClass: 'model aside-modal search-submodal',
componentProps: {
/* fulltask: this.task,
task: this.task */
}
});
await modal.present();
modal.onDidDismiss().then((res)=>{
})
}
}