diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index faf9dee0e..48f48bcb9 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -96,6 +96,18 @@ const routes: Routes = [ path: 'opts-expediente-pr', loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule) }, + { + path: 'despachos-options', + loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule) + }, + { + path: 'despachos-pr-options', + loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule) + }, + { + path: 'deploma-options', + loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule) + }, /* { path: 'chat', diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index 854f66dba..5613370f7 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -20,6 +20,7 @@ import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component'; import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component'; +import { DespachosPrOptionsPage } from 'src/app/shared/popover/despachos-pr-options/despachos-pr-options.page'; @Component({ selector: 'app-despacho-pr', @@ -447,7 +448,7 @@ export class DespachoPrPage implements OnInit { async openOptions(taskAction?: any) { const popover = await this.popoverController.create({ - component: OptsExpedientePage, + component: DespachosPrOptionsPage, cssClass: 'exp-options', componentProps: { task: this.task, diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts index d7a6d1c6c..fbffb4b50 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts @@ -10,6 +10,7 @@ import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page'; import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component'; import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component'; +import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page'; @Component({ selector: 'app-diploma-assinar', @@ -57,7 +58,7 @@ export class DiplomaAssinarPage implements OnInit { async openOptions(taskAction?: any) { const popover = await this.popoverController.create({ - component: OptsExpedientePage, + component: DeplomaOptionsPage, cssClass: 'exp-options', componentProps: { task: this.task, diff --git a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts index 2f97821ba..7d31a1914 100644 --- a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts @@ -10,6 +10,7 @@ import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page'; import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component'; import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component'; +import { DeplomaOptionsPage } from 'src/app/shared/popover/deploma-options/deploma-options.page'; @Component({ selector: 'app-diploma', @@ -52,7 +53,7 @@ export class DiplomaPage implements OnInit { this.LoadTaskDetail(this.serialnumber); } - goBack(){ + goBack() { // let navigationExtras: NavigationExtras = { // queryParams: { // "diplomas": true, @@ -65,7 +66,7 @@ export class DiplomaPage implements OnInit { async openOptions(taskAction?: any) { const popover = await this.popoverController.create({ - component: OptsExpedientePage, + component: DeplomaOptionsPage, cssClass: 'exp-options', componentProps: { task: this.task, diff --git a/src/app/shared/popover/deploma-options/deploma-options-routing.module.ts b/src/app/shared/popover/deploma-options/deploma-options-routing.module.ts new file mode 100644 index 000000000..5d39a5173 --- /dev/null +++ b/src/app/shared/popover/deploma-options/deploma-options-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { DeplomaOptionsPage } from './deploma-options.page'; + +const routes: Routes = [ + { + path: '', + component: DeplomaOptionsPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class DeplomaOptionsPageRoutingModule {} diff --git a/src/app/shared/popover/deploma-options/deploma-options.module.ts b/src/app/shared/popover/deploma-options/deploma-options.module.ts new file mode 100644 index 000000000..320df16a2 --- /dev/null +++ b/src/app/shared/popover/deploma-options/deploma-options.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { DeplomaOptionsPageRoutingModule } from './deploma-options-routing.module'; + +import { DeplomaOptionsPage } from './deploma-options.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + DeplomaOptionsPageRoutingModule + ], + declarations: [DeplomaOptionsPage] +}) +export class DeplomaOptionsPageModule {} diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.html b/src/app/shared/popover/deploma-options/deploma-options.page.html new file mode 100644 index 000000000..314ef58db --- /dev/null +++ b/src/app/shared/popover/deploma-options/deploma-options.page.html @@ -0,0 +1,15 @@ + +
+ +
+ +
+ + + +
+
+ +
diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.scss b/src/app/shared/popover/deploma-options/deploma-options.page.scss new file mode 100644 index 000000000..009bb2ba4 --- /dev/null +++ b/src/app/shared/popover/deploma-options/deploma-options.page.scss @@ -0,0 +1,56 @@ +.container{ + --padding-top:20px !important; + --padding-bottom:20px !important; + --padding-start:20px !important; + --padding-end:20px !important; +} +.arrow-right { + display: none; + margin-bottom: 20px; + .arrow-right-icon { + width: 37px; + float: right; + font-size: 35px; + overflow: hidden; + } +} +.buttons { + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +.solid { + display: none; + width: 90%; + border-top: 1px solid #bbb; + margin: 0 auto !important; + } + .btn-ok, .btn-cancel{ + //width: 50% !important; + margin-bottom: 5px !important; + margin-top: 5px !important; +} +@media only screen and (max-width: 800px) { + .btn-ok, .btn-cancel, .btn-delete{ + width: 47% !important; + } +} +@media only screen and (min-width: 1024px) { + .arrow-right{ + display: flex; + justify-content: flex-end; + } + .btn-cancel{ + display: none; + width: 100% !important; + margin-bottom: 10px !important; + } + .btn-delete, .btn-ok{ + width: 100% !important; + margin-bottom: 10px !important; + margin-top: 10px !important; + } + /* .solid{ + display: block; + } */ +} \ No newline at end of file diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.spec.ts b/src/app/shared/popover/deploma-options/deploma-options.page.spec.ts new file mode 100644 index 000000000..46b0d3958 --- /dev/null +++ b/src/app/shared/popover/deploma-options/deploma-options.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { DeplomaOptionsPage } from './deploma-options.page'; + +describe('DeplomaOptionsPage', () => { + let component: DeplomaOptionsPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ DeplomaOptionsPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(DeplomaOptionsPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.ts b/src/app/shared/popover/deploma-options/deploma-options.page.ts new file mode 100644 index 000000000..e86360b19 --- /dev/null +++ b/src/app/shared/popover/deploma-options/deploma-options.page.ts @@ -0,0 +1,188 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { ModalController, PopoverController } from '@ionic/angular'; +import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; +import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; +import { ProcessesService } from 'src/app/services/processes.service'; +import { BadRequestComponent } from '../bad-request/bad-request.component'; +import { SuccessMessageComponent } from '../success-message/success-message.component'; + +@Component({ + selector: 'app-deploma-options', + templateUrl: './deploma-options.page.html', + styleUrls: ['./deploma-options.page.scss'], +}) +export class DeplomaOptionsPage implements OnInit { + + + serialnumber: string; + profile: string; + task: any + fulltask: any + + + constructor(public popoverController: PopoverController, + private modalController: ModalController, + private activatedRoute: ActivatedRoute, + private processes: ProcessesService,) { + this.activatedRoute.queryParams.subscribe(params => { + if(params["serialNumber"]) { + this.serialnumber = params["serialNumber"]; + console.log(params["serialNumber"]); + } + }); + + } + + ngOnInit() { + } + + + async openAddNoteModal(actionName:string) { + let classs; + if( window.innerWidth <= 800){ + classs = 'modal modal-desktop' + } else { + classs = 'modal modal-desktop' + } + const modal = await this.modalController.create({ + component: AddNotePage, + componentProps:{ + }, + cssClass: classs, + backdropDismiss: true + }); + + await modal.present(); + + modal.onDidDismiss().then(res => { + if(res.data){ + + + const DocumentToSave = res.data.documents.map((e) => { + return { + ApplicationId: e.ApplicationType, + SourceId: e.Id, + } + }); + + let docs = { + ProcessInstanceID: "", + Attachments: DocumentToSave, + } + + + if(actionName == 'Solicitar assinatura'){ + this.askSignature(res.data.note, docs); + this.goBack(); + } + else if(actionName == 'Solicitar alteração'){ + this.askToChange(res.data.note, docs); + this.goBack(); + } + } + }); + } + + async askToChange(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Retificar", + "ActionTypeId": 99999841, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + try { + await this.processes.CompleteTask(body); + this.close(); + this.successMessage() + } catch (error) { + this.badRequest() + } + } + + + async openBookMeetingModal(task: any) { + let classs; + if( window.innerWidth <= 800){ + classs = 'book-meeting-modal modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: BookMeetingModalPage, + componentProps: { + task: this.task, + }, + cssClass: classs, + backdropDismiss: false + }); + await modal.present(); + modal.onDidDismiss(); + } + + async askSignature(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Aprovar", + "ActionTypeId": 99999840, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + try { + await this.processes.CompleteTask(body); + this.close(); + this.successMessage() + } catch (error) { + this.badRequest() + } + } + + + async successMessage(message?: string) { + + const modal = await this.modalController.create({ + component: SuccessMessageComponent, + componentProps: { + message: message || 'Processo efetuado' , + }, + cssClass: 'modal modal-desktop' + }); + + modal.present() + + setTimeout(()=>{ + modal.dismiss() + },3000) + + } + + async badRequest(message?: string) { + const modal = await this.modalController.create({ + component: BadRequestComponent, + componentProps: { + message: message || 'Processo não efetuado' , + }, + cssClass: 'modal modal-desktop' + }); + + modal.present() + + setTimeout(()=>{ + modal.dismiss() + },3000) + } + + goBack() { + this.close() + } + + + close(){} + +} diff --git a/src/app/shared/popover/despachos-options/despachos-options-routing.module.ts b/src/app/shared/popover/despachos-options/despachos-options-routing.module.ts new file mode 100644 index 000000000..247b1696e --- /dev/null +++ b/src/app/shared/popover/despachos-options/despachos-options-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { DespachosOptionsPage } from './despachos-options.page'; + +const routes: Routes = [ + { + path: '', + component: DespachosOptionsPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class DespachosOptionsPageRoutingModule {} diff --git a/src/app/shared/popover/despachos-options/despachos-options.module.ts b/src/app/shared/popover/despachos-options/despachos-options.module.ts new file mode 100644 index 000000000..1819906f6 --- /dev/null +++ b/src/app/shared/popover/despachos-options/despachos-options.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { DespachosOptionsPageRoutingModule } from './despachos-options-routing.module'; + +import { DespachosOptionsPage } from './despachos-options.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + DespachosOptionsPageRoutingModule + ], + declarations: [DespachosOptionsPage] +}) +export class DespachosOptionsPageModule {} diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.html b/src/app/shared/popover/despachos-options/despachos-options.page.html new file mode 100644 index 000000000..5158a629c --- /dev/null +++ b/src/app/shared/popover/despachos-options/despachos-options.page.html @@ -0,0 +1,26 @@ + +
+ +
+ +
+ + + +
+ + + +
+ +
+
+ + + + +
+ +
diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.scss b/src/app/shared/popover/despachos-options/despachos-options.page.scss new file mode 100644 index 000000000..009bb2ba4 --- /dev/null +++ b/src/app/shared/popover/despachos-options/despachos-options.page.scss @@ -0,0 +1,56 @@ +.container{ + --padding-top:20px !important; + --padding-bottom:20px !important; + --padding-start:20px !important; + --padding-end:20px !important; +} +.arrow-right { + display: none; + margin-bottom: 20px; + .arrow-right-icon { + width: 37px; + float: right; + font-size: 35px; + overflow: hidden; + } +} +.buttons { + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +.solid { + display: none; + width: 90%; + border-top: 1px solid #bbb; + margin: 0 auto !important; + } + .btn-ok, .btn-cancel{ + //width: 50% !important; + margin-bottom: 5px !important; + margin-top: 5px !important; +} +@media only screen and (max-width: 800px) { + .btn-ok, .btn-cancel, .btn-delete{ + width: 47% !important; + } +} +@media only screen and (min-width: 1024px) { + .arrow-right{ + display: flex; + justify-content: flex-end; + } + .btn-cancel{ + display: none; + width: 100% !important; + margin-bottom: 10px !important; + } + .btn-delete, .btn-ok{ + width: 100% !important; + margin-bottom: 10px !important; + margin-top: 10px !important; + } + /* .solid{ + display: block; + } */ +} \ No newline at end of file diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.spec.ts b/src/app/shared/popover/despachos-options/despachos-options.page.spec.ts new file mode 100644 index 000000000..80e0e3a7f --- /dev/null +++ b/src/app/shared/popover/despachos-options/despachos-options.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { DespachosOptionsPage } from './despachos-options.page'; + +describe('DespachosOptionsPage', () => { + let component: DespachosOptionsPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ DespachosOptionsPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(DespachosOptionsPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.ts b/src/app/shared/popover/despachos-options/despachos-options.page.ts new file mode 100644 index 000000000..33a2a135b --- /dev/null +++ b/src/app/shared/popover/despachos-options/despachos-options.page.ts @@ -0,0 +1,351 @@ +import { Component, OnInit } from '@angular/core'; +import { ProcessesService } from 'src/app/services/processes.service'; +import { AttachmentsService } from 'src/app/services/attachments.service'; +import { EventsService } from 'src/app/services/events.service'; +import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; +import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; +import { formatDate } from '@angular/common'; +import { MenuController, ModalController, PopoverController } from '@ionic/angular'; +import { AlertService } from 'src/app/services/alert.service'; +import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page'; +import { momentG } from 'src/plugin/momentG' +import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page'; +import { DelegarPage } from 'src/app/modals/delegar/delegar.page'; +import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; +import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; +import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component'; +import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component'; +import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; +import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; + + +@Component({ + selector: 'app-despachos-options', + templateUrl: './despachos-options.page.html', + styleUrls: ['./despachos-options.page.scss'], +}) +export class DespachosOptionsPage implements OnInit { + + task: any; + fulltask: any; + serialnumber: string; + profile: string + + constructor(private activateRoute: ActivatedRoute, + private processes: ProcessesService, + private iab: InAppBrowser, + private attachmentsService: AttachmentsService, + private events: EventsService, + private menu: MenuController, + private router: Router, + private modalController: ModalController, + private alertService: AlertService, + public popoverController: PopoverController, + private activatedRoute: ActivatedRoute) { } + + ngOnInit() { + + this.profile = "mdgpr"; + + this.activatedRoute.queryParams.subscribe(params => { + if(params["serialNumber"]) { + this.serialnumber = params["serialNumber"]; + console.log(params["serialNumber"]); + } + }); + } + + close () { + this.goBack() + } + + + async openExpedientActionsModal(taskAction: any, task: any) { + //this.modalController.dismiss(); + let classs; + if( window.innerWidth <= 800){ + classs = 'modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: CreateProcessPage, + componentProps: { + taskAction: taskAction, + task: task, + profile: this.profile, + }, + cssClass: classs, + }); + await modal.present(); + modal.onDidDismiss().then(res=>{ + console.log(res['data']); + if(res['data']=='openDiscart'){ + console.log('open discart'); + + this.distartExpedientModal(); + + } + + }); + } + + sendExpedienteToPending(){ + this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ + console.log(res); + this.close(); + }); + } + + async distartExpedientModal(){ + console.log(this.fulltask); + const modal = await this.modalController.create({ + component: DiscartExpedientModalPage, + componentProps: { + serialNumber: this.fulltask.serialNumber, + folderId: this.fulltask.workflowInstanceDataFields.FolderID, + action: 'complete', + }, + cssClass: 'discart-expedient-modal', + backdropDismiss: false + }); + + await modal.present(); + modal.onDidDismiss().then(res=>{ + if(res['data']=='close'){ + this.close(); + /* console.log('2Expedient Discard closed2'); + this.close(); + this.openMenu(); */ + } + + }); + } + + + async openBookMeetingModal(task: any) { + let classs; + if( window.innerWidth <= 800){ + classs = 'book-meeting-modal modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: BookMeetingModalPage, + componentProps: { + task: this.task, + }, + cssClass: classs, + backdropDismiss: false + }); + await modal.present(); + modal.onDidDismiss(); + } + + async openDelegarModal(task: any) { + let classs; + if( window.innerWidth <= 800){ + classs = 'book-meeting-modal modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: DelegarPage, + componentProps: { + task: this.task, + }, + cssClass: classs, + backdropDismiss: false + }); + await modal.present(); + modal.onDidDismiss(); + } + + async generateDiploma(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Reencaminhar", + "ActionTypeId": 99999839, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + try { + await this.processes.CompleteTask(body); + this.successMessage() + this.close(); + } catch (error) { + this.badRequest() + } + + } + + async openAddNoteModal(actionName:string) { + let classs; + if( window.innerWidth <= 800){ + classs = 'modal modal-desktop' + } else { + classs = 'modal modal-desktop' + } + const modal = await this.modalController.create({ + component: AddNotePage, + componentProps:{ + }, + cssClass: classs, + backdropDismiss: true + }); + + await modal.present(); + + modal.onDidDismiss().then(res => { + console.log(res); + if(res.data){ + + + + const DocumentToSave = res.data.documents.map((e) => { + return { + ApplicationId: e.ApplicationType, + SourceId: e.Id, + } + }); + + let docs = { + ProcessInstanceID: "", + Attachments: DocumentToSave, + } + + if(actionName == 'Executado'){ + this.executado(res.data.note, docs); + } + else if(actionName == 'Arquivar'){ + this.arquivar(res.data.note, docs); + } + else if(actionName == 'Gerar Diploma'){ + this.generateDiploma(res.data.note, docs); + } + else if(actionName == 'Concluido'){ + //this.concluir(res.data.note, docs); + } + else if(actionName == 'Reexecução'){ + this.reexecutar(res.data.note, docs); + } + this.goBack(); + } + }); + } + + async arquivar(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Arquivo", + "ActionTypeId": 95, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + try { + await this.processes.CompleteTask(body); + this.successMessage() + this.close(); + } catch (error) { + this.badRequest() + } + + } + + + async executado(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Conhecimento", + "ActionTypeId": 104, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + try { + await this.processes.CompleteTask(body); + this.close(); + this.successMessage() + } catch(error) { + this.badRequest() + } + } + + + + async successMessage(message?: string) { + + const modal = await this.modalController.create({ + component: SuccessMessageComponent, + componentProps: { + message: message || 'Processo efetuado' , + }, + cssClass: 'modal modal-desktop' + }); + + modal.present() + + setTimeout(()=>{ + modal.dismiss() + },3000) + + } + + async badRequest(message?: string) { + const modal = await this.modalController.create({ + component: BadRequestComponent, + componentProps: { + message: message || 'Processo não efetuado' , + }, + cssClass: 'modal modal-desktop' + }); + + modal.present() + + setTimeout(()=>{ + modal.dismiss() + },3000) + } + + + + async reexecutar(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Reexecutar", + "ActionTypeId": 100000010, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + try { + await this.processes.CompleteTask(body); + this.successMessage() + this.close(); + } catch (error) { + this.badRequest() + } + + } + + + goBack() { + // let navigationExtras: NavigationExtras = { + // queryParams: { + // "despachospr": true, + // } + // }; + // this.router.navigate(['/home/gabinete-digital'], navigationExtras); + + window.history.back() + } + +} diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options-routing.module.ts b/src/app/shared/popover/despachos-pr-options/despachos-pr-options-routing.module.ts new file mode 100644 index 000000000..ad795c4a1 --- /dev/null +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { DespachosPrOptionsPage } from './despachos-pr-options.page'; + +const routes: Routes = [ + { + path: '', + component: DespachosPrOptionsPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class DespachosPrOptionsPageRoutingModule {} diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.module.ts b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.module.ts new file mode 100644 index 000000000..9d9d93f52 --- /dev/null +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { DespachosPrOptionsPageRoutingModule } from './despachos-pr-options-routing.module'; + +import { DespachosPrOptionsPage } from './despachos-pr-options.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + DespachosPrOptionsPageRoutingModule + ], + declarations: [DespachosPrOptionsPage] +}) +export class DespachosPrOptionsPageModule {} diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html new file mode 100644 index 000000000..5158a629c --- /dev/null +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.html @@ -0,0 +1,26 @@ + +
+ +
+ +
+ + + +
+ + + +
+ +
+
+ + + + +
+ +
diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss new file mode 100644 index 000000000..009bb2ba4 --- /dev/null +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.scss @@ -0,0 +1,56 @@ +.container{ + --padding-top:20px !important; + --padding-bottom:20px !important; + --padding-start:20px !important; + --padding-end:20px !important; +} +.arrow-right { + display: none; + margin-bottom: 20px; + .arrow-right-icon { + width: 37px; + float: right; + font-size: 35px; + overflow: hidden; + } +} +.buttons { + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +.solid { + display: none; + width: 90%; + border-top: 1px solid #bbb; + margin: 0 auto !important; + } + .btn-ok, .btn-cancel{ + //width: 50% !important; + margin-bottom: 5px !important; + margin-top: 5px !important; +} +@media only screen and (max-width: 800px) { + .btn-ok, .btn-cancel, .btn-delete{ + width: 47% !important; + } +} +@media only screen and (min-width: 1024px) { + .arrow-right{ + display: flex; + justify-content: flex-end; + } + .btn-cancel{ + display: none; + width: 100% !important; + margin-bottom: 10px !important; + } + .btn-delete, .btn-ok{ + width: 100% !important; + margin-bottom: 10px !important; + margin-top: 10px !important; + } + /* .solid{ + display: block; + } */ +} \ No newline at end of file diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.spec.ts b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.spec.ts new file mode 100644 index 000000000..4d505a9c7 --- /dev/null +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { DespachosPrOptionsPage } from './despachos-pr-options.page'; + +describe('DespachosPrOptionsPage', () => { + let component: DespachosPrOptionsPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ DespachosPrOptionsPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(DespachosPrOptionsPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts new file mode 100644 index 000000000..c2120f171 --- /dev/null +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts @@ -0,0 +1,353 @@ +import { Component, OnInit } from '@angular/core'; +import { ProcessesService } from 'src/app/services/processes.service'; +import { AttachmentsService } from 'src/app/services/attachments.service'; +import { EventsService } from 'src/app/services/events.service'; +import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; +import { ActivatedRoute, NavigationExtras, Router } from '@angular/router'; +import { formatDate } from '@angular/common'; +import { MenuController, ModalController, PopoverController } from '@ionic/angular'; +import { AlertService } from 'src/app/services/alert.service'; +import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page'; +import { momentG } from 'src/plugin/momentG' +import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page'; +import { DelegarPage } from 'src/app/modals/delegar/delegar.page'; +import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; +import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; +import { BadRequestComponent } from 'src/app/shared/popover/bad-request/bad-request.component'; +import { SuccessMessageComponent } from 'src/app/shared/popover/success-message/success-message.component'; +import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page'; +import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; + + +@Component({ + selector: 'app-despachos-pr-options', + templateUrl: './despachos-pr-options.page.html', + styleUrls: ['./despachos-pr-options.page.scss'], +}) +export class DespachosPrOptionsPage implements OnInit { + + + task: any; + fulltask: any; + serialnumber: string; + profile: string + + constructor(private activateRoute: ActivatedRoute, + private processes: ProcessesService, + private iab: InAppBrowser, + private attachmentsService: AttachmentsService, + private events: EventsService, + private menu: MenuController, + private router: Router, + private modalController: ModalController, + private alertService: AlertService, + public popoverController: PopoverController, + private activatedRoute: ActivatedRoute) { } + + ngOnInit() { + + this.profile = "mdgpr"; + + this.activatedRoute.queryParams.subscribe(params => { + if(params["serialNumber"]) { + this.serialnumber = params["serialNumber"]; + console.log(params["serialNumber"]); + } + }); + } + + close () { + this.goBack() + } + + + async openExpedientActionsModal(taskAction: any, task: any) { + //this.modalController.dismiss(); + let classs; + if( window.innerWidth <= 800){ + classs = 'modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: CreateProcessPage, + componentProps: { + taskAction: taskAction, + task: task, + profile: this.profile, + }, + cssClass: classs, + }); + await modal.present(); + modal.onDidDismiss().then(res=>{ + console.log(res['data']); + if(res['data']=='openDiscart'){ + console.log('open discart'); + + this.distartExpedientModal(); + + } + + }); + } + + sendExpedienteToPending(){ + this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ + console.log(res); + this.close(); + }); + } + + async distartExpedientModal(){ + console.log(this.fulltask); + const modal = await this.modalController.create({ + component: DiscartExpedientModalPage, + componentProps: { + serialNumber: this.fulltask.serialNumber, + folderId: this.fulltask.workflowInstanceDataFields.FolderID, + action: 'complete', + }, + cssClass: 'discart-expedient-modal', + backdropDismiss: false + }); + + await modal.present(); + modal.onDidDismiss().then(res=>{ + if(res['data']=='close'){ + this.close(); + /* console.log('2Expedient Discard closed2'); + this.close(); + this.openMenu(); */ + } + + }); + } + + + async openBookMeetingModal(task: any) { + let classs; + if( window.innerWidth <= 800){ + classs = 'book-meeting-modal modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: BookMeetingModalPage, + componentProps: { + task: this.task, + }, + cssClass: classs, + backdropDismiss: false + }); + await modal.present(); + modal.onDidDismiss(); + } + + async openDelegarModal(task: any) { + let classs; + if( window.innerWidth <= 800){ + classs = 'book-meeting-modal modal modal-desktop' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + const modal = await this.modalController.create({ + component: DelegarPage, + componentProps: { + task: this.task, + }, + cssClass: classs, + backdropDismiss: false + }); + await modal.present(); + modal.onDidDismiss(); + } + + async generateDiploma(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Reencaminhar", + "ActionTypeId": 99999839, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + try { + await this.processes.CompleteTask(body); + this.successMessage() + this.close(); + } catch (error) { + this.badRequest() + } + + } + + async openAddNoteModal(actionName:string) { + let classs; + if( window.innerWidth <= 800){ + classs = 'modal modal-desktop' + } else { + classs = 'modal modal-desktop' + } + const modal = await this.modalController.create({ + component: AddNotePage, + componentProps:{ + }, + cssClass: classs, + backdropDismiss: true + }); + + await modal.present(); + + modal.onDidDismiss().then(res => { + console.log(res); + if(res.data){ + + + + const DocumentToSave = res.data.documents.map((e) => { + return { + ApplicationId: e.ApplicationType, + SourceId: e.Id, + } + }); + + let docs = { + ProcessInstanceID: "", + Attachments: DocumentToSave, + } + + if(actionName == 'Executado'){ + this.executado(res.data.note, docs); + } + else if(actionName == 'Arquivar'){ + this.arquivar(res.data.note, docs); + } + else if(actionName == 'Gerar Diploma'){ + this.generateDiploma(res.data.note, docs); + } + else if(actionName == 'Concluido'){ + //this.concluir(res.data.note, docs); + } + else if(actionName == 'Reexecução'){ + this.reexecutar(res.data.note, docs); + } + this.goBack(); + } + }); + } + + async arquivar(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Arquivo", + "ActionTypeId": 95, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + try { + await this.processes.CompleteTask(body); + this.successMessage() + this.close(); + } catch (error) { + this.badRequest() + } + + } + + + async executado(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Conhecimento", + "ActionTypeId": 104, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + + try { + await this.processes.CompleteTask(body); + this.close(); + this.successMessage() + } catch(error) { + this.badRequest() + } + } + + + + async successMessage(message?: string) { + + const modal = await this.modalController.create({ + component: SuccessMessageComponent, + componentProps: { + message: message || 'Processo efetuado' , + }, + cssClass: 'modal modal-desktop' + }); + + modal.present() + + setTimeout(()=>{ + modal.dismiss() + },3000) + + } + + async badRequest(message?: string) { + const modal = await this.modalController.create({ + component: BadRequestComponent, + componentProps: { + message: message || 'Processo não efetuado' , + }, + cssClass: 'modal modal-desktop' + }); + + modal.present() + + setTimeout(()=>{ + modal.dismiss() + },3000) + } + + + + async reexecutar(note:string, documents:any){ + let body = { + "serialNumber": this.serialnumber, + "action": "Reexecutar", + "ActionTypeId": 100000010, + "dataFields": { + "ReviewUserComment": note, + }, + "AttachmentList" :documents, + } + try { + await this.processes.CompleteTask(body); + this.successMessage() + this.close(); + } catch (error) { + this.badRequest() + } + + } + + + goBack() { + // let navigationExtras: NavigationExtras = { + // queryParams: { + // "despachospr": true, + // } + // }; + // this.router.navigate(['/home/gabinete-digital'], navigationExtras); + + window.history.back() + } + + +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index b01cd1341..3bc92ac8a 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,8 +4,8 @@ export const environment = { production: false, - apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/', - /* apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V4/api/', */ + //apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/', + apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V4/api/', apiChatUrl: 'https://www.tabularium.pt/api/v1/', /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ domain: 'gabinetedigital.local',