mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Add options for diploma
This commit is contained in:
@@ -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 {}
|
||||
@@ -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 {}
|
||||
@@ -0,0 +1,15 @@
|
||||
<ion-content class="container">
|
||||
<div class="arrow-right" (click)="close()">
|
||||
<button class="btn-no-color">
|
||||
<ion-icon slot="end" class="arrow-right-icon" src='assets/images/icons-arrow-arrow-right.svg'></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<button (click)="openAddNoteModal('Solicitar assinatura')" class="btn-cancel" shape="round" >Solicitar assinatura</button>
|
||||
<button (click)="openAddNoteModal('Solicitar alteração')" class="btn-cancel" shape="round" >Solicitar alteração</button>
|
||||
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
|
||||
<div class="solid"></div>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
@@ -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;
|
||||
} */
|
||||
}
|
||||
@@ -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<DeplomaOptionsPage>;
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -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(){}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user