mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
add document management store
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user