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
@@ -61,29 +61,35 @@
</div>
</div>
<div class="bottom-content width-100">
<h5>Documentos Anexados</h5>
<ion-list>
<h5>Documentos Anexados</h5>
<ion-item class="ion-no-margin ion-no-padding cursor-pointer">
<ion-item *ngFor="let attachment of attachments; let i = index"
class="ion-no-margin ion-no-padding cursor-pointer">
<ion-label
(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><span class="span-left">{{task.Remetente}}</span><span class="span-right">{{ task.CreateDate | date: 'dd/MM/yy' }}</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">{{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-item>
</ion-list>
</div>
<div *ngIf="eventsList">
<h3 class="h3-event-title">Eventos Associados</h3>
<ion-list>
<div *ngIf="eventsList">
<ion-item-sliding>
<ion-item
class="Rectangle" lines="none"
<ion-item
class="Rectangle" lines="none"
*ngFor="let event of eventsList"
(click)="viewEventDetail(event.EventId)"
>
<!-- [routerLink]="['/home/events', event.EventId, 'events']" -->
<div class="content-{{profile}}-{{event.CalendarName}} width-100 ">
<div class="approve-event-time">
<p>{{event.StartDate | date: 'HH:mm'}}</p>
@@ -100,6 +106,7 @@
</div>
</ion-list>
</div>
</div>
</div>
@@ -112,6 +119,7 @@
<div hidden class="solid"></div>
<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)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documento <br />(Gestão Documental)</button>
</div>
<div *ngIf="loggeduser.Profile =='PR' " class="buttons">
<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 { OptsExpedientePrPage } from 'src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page';
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({
selector: 'app-expediente-pr',
@@ -44,11 +47,12 @@ export class ExpedientePrPage implements OnInit {
cc: any = [];
loggeduser: User;
documents:SearchDocument[] = [];
attachments:any;
constructor(
private processes: ProcessesService,
private iab: InAppBrowser,
private attachments: AttachmentsService,
private events: EventsService,
private menu: MenuController,
private router: Router,
@@ -58,6 +62,7 @@ export class ExpedientePrPage implements OnInit {
private userAuth: AuthService,
private animationController: AnimationController,
private toastService: ToastService,
private attachmentsService: AttachmentsService,
) {
this.loggeduser = userAuth.ValidatedUser;
@@ -81,10 +86,14 @@ export class ExpedientePrPage implements OnInit {
}
/* this.serialnumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber);
//this.LoadRelatedEvents(this.serialnumber);
//this.getAttachments(this.serialnumber);
});
this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber);
this.getAttachments(this.serialnumber);
//this.LoadRelatedEvents(this.serialnumber);
}
toDateString(e) {
@@ -168,10 +177,7 @@ export class ExpedientePrPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status,
}
console.log('task', this.task);
this.fulltask = res;
console.log('GetTask', res);
let thedate = new Date(this.task.CreateDate);
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) {
if (this.eventsList == null) {
this.attachments.getAttachmentsBySerial(serial).subscribe(res => {
this.attachmentsService.getAttachmentsBySerial(serial).subscribe(res => {
console.log(res);
res.forEach(att => {
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() {
this.menu.open();
this.modalController.dismiss();