Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-08-06 14:35:24 +01:00
4 changed files with 79 additions and 20 deletions
@@ -208,7 +208,7 @@
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required> <mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
<mat-select placeholder="Selecione repetição*" <mat-select placeholder="Selecione repetição*"
[(ngModel)]="EventRecurrenceType" [(ngModel)]="EventRecurrenceType"
(ngModelChange)="onSelectedRecurringChanged($event)"> >
<mat-option <mat-option
*ngFor="let recurring of recurringTypes" value="{{recurring.Code}}" *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
> >
@@ -94,15 +94,15 @@
<div *ngIf="task" class="aside-right flex-column height-100"> <div *ngIf="task" class="aside-right flex-column height-100">
<div class="buttons"> <div class="buttons">
<div class="option-desc"> <div>Enviar para o PR</div> </div> <div class="option-desc"> <div>Enviar para o PR</div> </div>
<button (click)="openAddNoteModal('Aprovar')" class="btn-cancel" shape="round" >Avaliação Superior</button> <!-- <button (click)="openAddNoteModal('Aprovar')" class="btn-cancel" shape="round" >Avaliação Superior</button> -->
<div class="option-desc"> <div>Solicitar revisão</div> </div> <div class="option-desc"> <div>Solicitar revisão</div> </div>
<button (click)="openAddNoteModal('Revisão')" class="btn-cancel" shape="round" >Mandar para Revisão</button> <!-- <button (click)="openAddNoteModal('Revisão')" class="btn-cancel" shape="round" >Mandar para Revisão</button> -->
<div class="option-desc"> <div>Outras opções</div> </div> <div class="option-desc"> <div>Outras opções</div> </div>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button> <button (click)="openExpedientActionsModal('0',fulltask)" class="btn-ok" shape="round" >Efectuar Despacho</button>
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button> <button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button> <button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button> <button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documentos</button> <!-- <button (click)="attachDocument()" class="btn-cancel" shape="round" >Anexar Documentos</button> -->
<button (click)="distartExpedientModal('descartar')" class="btn-cancel" shape="round" >Descartar</button> <button (click)="distartExpedientModal('descartar')" class="btn-cancel" shape="round" >Descartar</button>
<div class="solid"></div> <div class="solid"></div>
</div> </div>
@@ -14,6 +14,8 @@ import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from 'src/app/models/search-document';
@Component({ @Component({
selector: 'app-expediente-detail', selector: 'app-expediente-detail',
@@ -36,13 +38,15 @@ export class ExpedienteDetailPage implements OnInit {
profile: string; profile: string;
intervenientes: any; intervenientes: any;
cc: any = []; cc: any = [];
documents:SearchDocument[] = [];
attachments:any;
hideSendToPendentes = true hideSendToPendentes = true
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
private iab: InAppBrowser, private iab: InAppBrowser,
private attachments: AttachmentsService, //private attachments: AttachmentsService,
private events: EventsService, private events: EventsService,
private router: Router, private router: Router,
private modalController: ModalController, private modalController: ModalController,
@@ -50,6 +54,7 @@ export class ExpedienteDetailPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private toastService: ToastService, private toastService: ToastService,
private location: Location, private location: Location,
private attachmentsService: AttachmentsService,
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) { if(params["params"].SerialNumber) {
@@ -207,6 +212,53 @@ export class ExpedienteDetailPage implements OnInit {
}); });
} }
getAttachments(serialNumber){
console.log(serialNumber);
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{
this.attachments = res;
console.log('res', 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);
});
})
}
});
}
async openExpedientActionsModal(taskAction: any, task: any) { async openExpedientActionsModal(taskAction: any, task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if( window.innerWidth <= 800){
@@ -409,17 +409,24 @@ export class ExpedientePrPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(async(res)=>{
console.log(res['data']);
let body = res['data']; let body = res['data'];
// alert('close '+ res['data']) if(res['data']) {
if(res['data']){
console.log('open discart');
this.distartExpedientModal(body); //await this.distartExpedientModal(body);
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
}
} }
else{ else{
console.log('Not open'); this.close();
} }
}); });
} }