This commit is contained in:
tiago.kayaya
2021-08-03 12:24:34 +01:00
parent 2e2907a5b1
commit 5b8a9a24a1
6 changed files with 167 additions and 51 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ export enum Sources
export class EventAttachment { export class EventAttachment {
Id?: string; // id do evento Id?: string; // id do evento
ParentId: string; ParentId?: string;
Source: string; Source: string;
SourceId: string; SourceId: string;
Link?: string; Link?: string;
@@ -34,4 +34,4 @@ export class EventAttachment {
ApplicationId: string; ApplicationId: string;
SourceTitle: string; SourceTitle: string;
} }
@@ -61,29 +61,35 @@
</div> </div>
</div> </div>
<div class="bottom-content width-100"> <div class="bottom-content width-100">
<h5>Documentos Anexados</h5>
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <ion-item *ngFor="let attachment of attachments; let i = index"
<ion-item class="ion-no-margin ion-no-padding cursor-pointer"> class="ion-no-margin ion-no-padding cursor-pointer">
<ion-label <ion-label
(click)="viewDocument()"> (click)="viewDocument()">
<p class="attach-title-item">{{ task.Folio }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p> <p class="attach-title-item">{{attachment.Description}}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{task.Remetente}}</span><span class="span-right">{{ task.CreateDate | date: 'dd/MM/yy' }}</span></p> <p>
<span class="span-left">{{attachment.Stakeholders}}</span>
<span *ngIf="!attachment.Stakeholders" class="span-left">Rementente indefinido</span>
<span class="span-right">{{ attachment.CreateDate | date: 'dd/MM/yy' }}</span>
</p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
</div> </div>
<div *ngIf="eventsList"> <div *ngIf="eventsList">
<h3 class="h3-event-title">Eventos Associados</h3> <h3 class="h3-event-title">Eventos Associados</h3>
<ion-list> <ion-list>
<div *ngIf="eventsList"> <div *ngIf="eventsList">
<ion-item-sliding> <ion-item-sliding>
<ion-item <ion-item
class="Rectangle" lines="none" class="Rectangle" lines="none"
*ngFor="let event of eventsList" *ngFor="let event of eventsList"
(click)="viewEventDetail(event.EventId)" (click)="viewEventDetail(event.EventId)"
> >
<!-- [routerLink]="['/home/events', event.EventId, 'events']" -->
<div class="content-{{profile}}-{{event.CalendarName}} width-100 "> <div class="content-{{profile}}-{{event.CalendarName}} width-100 ">
<div class="approve-event-time"> <div class="approve-event-time">
<p>{{event.StartDate | date: 'HH:mm'}}</p> <p>{{event.StartDate | date: 'HH:mm'}}</p>
@@ -100,6 +106,7 @@
</div> </div>
</ion-list> </ion-list>
</div> </div>
</div> </div>
</div> </div>
@@ -112,6 +119,7 @@
<div hidden class="solid"></div> <div hidden class="solid"></div>
<button hidden class="btn-cancel" shape="round" >Delegar</button> <button hidden class="btn-cancel" shape="round" >Delegar</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button> <button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
<button (click)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documento <br />(Gestão Documental)</button>
</div> </div>
<div *ngIf="loggeduser.Profile =='PR' " class="buttons"> <div *ngIf="loggeduser.Profile =='PR' " class="buttons">
<button (click)="openExpedientActionsModal('0', fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button> <button (click)="openExpedientActionsModal('0', fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button>
@@ -22,6 +22,9 @@ import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.p
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { OptsExpedientePrPage } from 'src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page'; import { OptsExpedientePrPage } from 'src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Attachment } from 'src/app/models/attachment.model';
import { SearchDocument } from 'src/app/models/search-document';
@Component({ @Component({
selector: 'app-expediente-pr', selector: 'app-expediente-pr',
@@ -44,11 +47,12 @@ export class ExpedientePrPage implements OnInit {
cc: any = []; cc: any = [];
loggeduser: User; loggeduser: User;
documents:SearchDocument[] = [];
attachments:any;
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
private iab: InAppBrowser, private iab: InAppBrowser,
private attachments: AttachmentsService,
private events: EventsService, private events: EventsService,
private menu: MenuController, private menu: MenuController,
private router: Router, private router: Router,
@@ -58,6 +62,7 @@ export class ExpedientePrPage implements OnInit {
private userAuth: AuthService, private userAuth: AuthService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
private attachmentsService: AttachmentsService,
) { ) {
this.loggeduser = userAuth.ValidatedUser; this.loggeduser = userAuth.ValidatedUser;
@@ -81,10 +86,14 @@ export class ExpedientePrPage implements OnInit {
} }
/* this.serialnumber = paramMap.get('SerialNumber'); */ /* this.serialnumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber); //this.LoadRelatedEvents(this.serialnumber);
//this.getAttachments(this.serialnumber);
}); });
this.LoadTaskDetail(this.serialnumber); this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber); this.getAttachments(this.serialnumber);
//this.LoadRelatedEvents(this.serialnumber);
} }
toDateString(e) { toDateString(e) {
@@ -168,10 +177,7 @@ export class ExpedientePrPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
console.log('task', this.task);
this.fulltask = res; this.fulltask = res;
console.log('GetTask', res);
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
@@ -203,9 +209,18 @@ export class ExpedientePrPage implements OnInit {
}); });
} }
getAttachments(serialNumber){
console.log(serialNumber);
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{
this.attachments = res;
console.log('res', res);
});
}
async LoadRelatedEvents(serial: string) { async LoadRelatedEvents(serial: string) {
if (this.eventsList == null) { if (this.eventsList == null) {
this.attachments.getAttachmentsBySerial(serial).subscribe(res => { this.attachmentsService.getAttachmentsBySerial(serial).subscribe(res => {
console.log(res); console.log(res);
res.forEach(att => { res.forEach(att => {
if (this.eventsList == null) { if (this.eventsList == null) {
@@ -230,6 +245,48 @@ export class ExpedientePrPage implements OnInit {
}); });
} }
attachDocument(){
this.getDoc();
}
async getDoc() {
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'modal-width-100-width-background modal',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true,
select: true
}
});
await modal.present();
modal.onDidDismiss().then((res)=>{
if(res){
const data = res.data;
this.documents.push(data.selected);
console.log( this.documents);
this.documents.forEach(element =>{
let body = {
"Source": "1",
"SourceId": element.Id,
"SourceTitle": element.Assunto,
"SerialNumber": this.task.SerialNumber,
"ApplicationId": element.ApplicationType
}
this.attachmentsService.setEventAttachmentById(body).subscribe((res)=>{
this.getAttachments(this.task.SerialNumber);
});
})
}
});
}
removeAttachment(index: number){
this.documents = this.documents.filter( (e, i) => index != i);
}
openMenu() { openMenu() {
this.menu.open(); this.menu.open();
this.modalController.dismiss(); this.modalController.dismiss();
+19 -21
View File
@@ -14,7 +14,7 @@ export class AttachmentsService {
loggeduser: User; loggeduser: User;
headers: HttpHeaders; headers: HttpHeaders;
constructor(private http: HttpClient, user: AuthService) { constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser; this.loggeduser = user.ValidatedUser;
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey); this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
@@ -26,9 +26,9 @@ export class AttachmentsService {
params = params.set("SerialNumber", serialNumber); params = params.set("SerialNumber", serialNumber);
let options = { let options = {
headers: this.headers, headers: this.headers,
params: params params: params
}; };
return this.http.get<Attachment[]>(`${geturl}`, options); return this.http.get<Attachment[]>(`${geturl}`, options);
} }
@@ -39,10 +39,10 @@ export class AttachmentsService {
params = params.set("Source", source.toString()); params = params.set("Source", source.toString());
/* params = params.set("SourceId", sourceid); */ /* params = params.set("SourceId", sourceid); */
let options = { let options = {
headers: this.headers, headers: this.headers,
params: params params: params
}; };
return this.http.get<Attachment[]>(`${geturl}`, options); return this.http.get<Attachment[]>(`${geturl}`, options);
@@ -54,37 +54,35 @@ export class AttachmentsService {
params = params.set("ParentId", eventId); params = params.set("ParentId", eventId);
/* params = params.set("SourceId", sourceid); */ /* params = params.set("SourceId", sourceid); */
let options = { let options = {
headers: this.headers, headers: this.headers,
params: params params: params
}; };
return this.http.get<Attachment[]>(`${geturl}`, options); return this.http.get<Attachment[]>(`${geturl}`, options);
} }
setEventAttachmentById(body: EventAttachment) { setEventAttachmentById(body: any) {
let geturl = environment.apiURL + 'Attachments/Create'; let geturl = environment.apiURL + 'Attachments/Create';
let options = {
let options = { headers: this.headers,
headers: this.headers,
} }
return this.http.post(`${geturl}`, body, options); return this.http.post(`${geturl}`, body, options);
} }
deleteEventAttachmentById(attachmentId) { deleteEventAttachmentById(attachmentId) {
let geturl = environment.apiURL + `Attachments/Delete?attachmentId=${attachmentId}`; let geturl = environment.apiURL + `Attachments/Delete?attachmentId=${attachmentId}`;
let params = new HttpParams(); let params = new HttpParams();
params = params.set("attachmentId", attachmentId); params = params.set("attachmentId", attachmentId);
let options = { let options = {
headers: this.headers, headers: this.headers,
params: params params: params
} }
return this.http.delete(`${geturl}`, options); return this.http.delete(`${geturl}`, options);
@@ -14,6 +14,7 @@
<button (click)="distartExpedientModal('descartar')" full class="btn-ok" shape="round" >Descartar</button> <button (click)="distartExpedientModal('descartar')" full class="btn-ok" shape="round" >Descartar</button>
<div hidden class="solid"></div> <div hidden class="solid"></div>
<button hidden class="btn-cancel" shape="round" >Delegar</button> <button hidden class="btn-cancel" shape="round" >Delegar</button>
<button (click)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documento <br />(Gestão Documental)</button>
</div> </div>
<div *ngIf="loggeduser.Profile =='PR' " class="buttons"> <div *ngIf="loggeduser.Profile =='PR' " class="buttons">
<button (click)="openExpedientActionsModal('0', fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button> <button (click)="openExpedientActionsModal('0', fulltask)" class="btn-ok" shape="round" >Marcar para Despacho</button>
@@ -2,10 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { AnimationController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular'; import { AnimationController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { SearchDocument } from 'src/app/models/search-document';
import { User } from 'src/app/models/user.model'; import { User } from 'src/app/models/user.model';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page'; import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { SearchPage } from 'src/app/pages/search/search.page';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { AttachmentsService } from 'src/app/services/attachments.service'; import { AttachmentsService } from 'src/app/services/attachments.service';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
@@ -33,6 +35,9 @@ export class OptsExpedientePrPage implements OnInit {
serialnumber: string; serialnumber: string;
profile: string; profile: string;
documents:SearchDocument[] = [];
attachments:any;
showEnviarPendentes = false; showEnviarPendentes = false;
loggeduser: User; loggeduser: User;
@@ -41,14 +46,14 @@ export class OptsExpedientePrPage implements OnInit {
private popoverController: PopoverController, private popoverController: PopoverController,
private modalController: ModalController, private modalController: ModalController,
private processes: ProcessesService, private processes: ProcessesService,
private attachments: AttachmentsService, private attachmentsService: AttachmentsService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private userAuth: AuthService, private userAuth: AuthService,
private navParams: NavParams, private navParams: NavParams,
private animationController: AnimationController, private animationController: AnimationController,
private router: Router, private router: Router,
private toastService: ToastService private toastService: ToastService
) { ) {
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
@@ -87,9 +92,9 @@ export class OptsExpedientePrPage implements OnInit {
cssClass: classs, cssClass: classs,
backdropDismiss: true backdropDismiss: true
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(async (res) => { modal.onDidDismiss().then(async (res) => {
console.log(res); console.log(res);
if(res.data){ if(res.data){
@@ -99,7 +104,7 @@ export class OptsExpedientePrPage implements OnInit {
SourceId: e.Id, SourceId: e.Id,
} }
}); });
let docs = { let docs = {
ProcessInstanceID: "", ProcessInstanceID: "",
Attachments: DocumentToSave, Attachments: DocumentToSave,
@@ -118,8 +123,8 @@ export class OptsExpedientePrPage implements OnInit {
async approve(note:string, documents:any){ async approve(note:string, documents:any){
this.popoverController.dismiss(); this.popoverController.dismiss();
let body = { let body = {
"serialNumber": this.task.SerialNumber, "serialNumber": this.task.SerialNumber,
"action": "Aprovar", "action": "Aprovar",
"ActionTypeId": 100000004 , "ActionTypeId": 100000004 ,
"dataFields": { "dataFields": {
@@ -150,7 +155,7 @@ export class OptsExpedientePrPage implements OnInit {
cssClass: 'discart-expedient-modal', cssClass: 'discart-expedient-modal',
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then( async (res)=>{
console.log(res['data']); console.log(res['data']);
@@ -168,7 +173,7 @@ export class OptsExpedientePrPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
@@ -187,7 +192,7 @@ export class OptsExpedientePrPage implements OnInit {
if(res['data']== 'Yes'){ if(res['data']== 'Yes'){
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
@@ -218,8 +223,8 @@ export class OptsExpedientePrPage implements OnInit {
async sendToReview(note:string, documents:any){ async sendToReview(note:string, documents:any){
let body = { let body = {
"serialNumber": this.task.SerialNumber, "serialNumber": this.task.SerialNumber,
"action": "Retificar", "action": "Retificar",
"ActionTypeId": 99999877, "ActionTypeId": 99999877,
"dataFields": { "dataFields": {
@@ -277,7 +282,7 @@ export class OptsExpedientePrPage implements OnInit {
// alert('close '+ res['data']) // alert('close '+ res['data'])
if(res['data']){ if(res['data']){
console.log('open discart'); console.log('open discart');
this.distartExpedientModal(body); this.distartExpedientModal(body);
} }
@@ -320,4 +325,51 @@ export class OptsExpedientePrPage implements OnInit {
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
} }
} }
getAttachments(serialNumber){
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{
this.attachments = res;
});
}
attachDocument(){
this.getDoc();
}
async getDoc() {
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'modal-width-100-width-background modal',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true,
select: true
}
});
await modal.present();
modal.onDidDismiss().then((res)=>{
if(res){
const data = res.data;
this.documents.push(data.selected);
console.log( this.documents);
this.documents.forEach(element =>{
let body = {
"Source": "1",
"SourceId": element.Id,
"SourceTitle": element.Assunto,
"SerialNumber": this.task.SerialNumber,
"ApplicationId": element.ApplicationType
}
this.attachmentsService.setEventAttachmentById(body).subscribe((res)=>{
this.getAttachments(this.task.SerialNumber);
});
})
}
});
}
} }