This commit is contained in:
tiago.kayaya
2021-06-17 12:24:31 +01:00
parent ba8abd077e
commit e0e6c35678
15 changed files with 693 additions and 161 deletions
+1 -3
View File
@@ -63,8 +63,6 @@ export class DelegarPage implements OnInit {
/* Set + 30minutes to seleted datetime */
let selectedEndDate = new Date();
/* this.postData.EndDate = new Date(selectedEndDate.setMinutes(new Date().getMinutes() + 30)); */
}
@@ -85,7 +83,7 @@ export class DelegarPage implements OnInit {
async saveTask() {
if(this.taskParticipants.length > 1){
this.alertService.presentErrorMessage("Selecione apenas um destinatário");
this.toastService.badRequest("Selecione apenas um destinatário");
}
else {
let body = {
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ForwardPage } from './forward.page';
const routes: Routes = [
{
path: '',
component: ForwardPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ForwardPageRoutingModule {}
+22
View File
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ForwardPageRoutingModule } from './forward-routing.module';
import { ForwardPage } from './forward.page';
import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ForwardPageRoutingModule,
AttendeeModalPageModule
],
declarations: [ForwardPage]
})
export class ForwardPageModule {}
+91
View File
@@ -0,0 +1,91 @@
<ion-content>
<div class="main-content d-flex height-100">
<div class="content d-flex flex-column width-100">
<div class="header-content pb-20">
<div class="header-title">
<label>Delegar</label>
</div>
</div>
<div class="overflow-y-auto">
<div class="container-div">
<div class="ion-item-class-2">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
</div>
<div class="ion-input-class-no-height">
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="taskParticipants.length == 0" class="list-people-title">Adicionar intervenientes</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
</div>
<div class="add-people" (click)="addParticipants()">
<ion-icon slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
</div>
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class-no-height width-100">
<ion-textarea [(ngModel)]="note" placeholder="Detalhes" rows="6" cols="20"></ion-textarea>
</div>
</div>
</div>
<div hidden class="ion-item-container-no-border">
<ion-label>
<div class="attach-icon">
<ion-icon src="assets/images/icons-attach-doc.svg"></ion-icon>
</div>
<div class="attach-document">
<ion-label>Anexar Documentos</ion-label>
</div>
</ion-label>
</div>
<div *ngIf="loadedAttachments">
<ion-item>
<ion-label>Documentos Anexados</ion-label>
</ion-item>
<ion-list>
<ion-item *ngFor="let attachment of loadedAttachments">
<ion-label>
<h4 class="attach-title-item">{{attachment.Description}}</h4>
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right"> {{ attachment.CreateDate | date: 'dd/MM/yyyy' }}</span></p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
</div>
<div class="aside-righ flex-grow-1">
<app-attendee-modal class=" d-flex flex-column height-100"
[footer]="false"
*ngIf="showAttendees"
[taskParticipants]="taskParticipants"
[taskParticipantsCc]="taskParticipantsCc"
[adding]="adding"
(dynamicSetIntervenient)="dynamicSetIntervenient($event)"
>
</app-attendee-modal>
</div>
</div>
</ion-content>
<ion-footer>
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="cancelTask()">Cancelar</button>
<button class="btn-ok" shape="round" (click)="notImplemented()">Gravar</button>
</div>
</ion-footer>
+150
View File
@@ -0,0 +1,150 @@
.content{
padding: 30px 20px 0 20px !important;
margin: 0;
float: left;
.header-content{
margin-bottom: 20px !important;
}
.header-title{
font-family: Roboto;
font-size: 25px;
padding: 0;
color:#000;
float: left;
}
.ion-item-container{
margin: 15px auto;
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 10px;
}
.ion-item-container-no-border{
margin: 0px auto;
padding: 0 !important;
overflow: auto;
}
.container-div{
margin-bottom: 15px;
overflow: hidden;
}
.ion-item-class-2{
margin: 0px auto;
}
.ion-icon-class{
width: 45px;
height: 45px;
float: left;
padding: 10px;
font-size: 25px;
}
ion-select{
padding-left: 5px;
margin-left: 0;
}
.ion-input-class{
width: calc(100% - 45px);
height: 45px;
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 5px;
padding-right: 10px;
float: left;
}
.ion-input-class-no-height{
border: 1px solid #ebebeb;
border-radius: 5px;
overflow: auto;
}
.list-people{
width: 256px;
float: left;
}
.add-people{
width: 45px;
float: right;
overflow: auto;
font-size: 25px;
padding: 10px;
}
.list-people-title{
/* font-size: 13px; */
color: #797979;
}
.attach-document{
font-size: 15px;
color: #0d89d1;
margin: 5px 5px 5px 10px;
padding: 5px;
float: left;
}
.attach-icon{
width: 37px;
font-size: 35px;
float: left;
}
.attach-title-item{
width: 100%;
font-size: 15px;
color:#0d89d1;
}
/* SPAN */
.span-left{
float: left;
font-size: 15x;
}
.span-right{
text-align: right;
float: right;
font-size: 13px;
}
}
.container-footer{
margin:0 auto;
overflow: auto;
}
.button-cancel {
width: 170px;
height: 44px;
border-radius: 22.5px;
--background: #e0e9ee;
--color: #061b52;
margin:10px;
}
.button-save {
width: 170px;
height: 44px;
border-radius: 22.5px;
--background: #42b9fe;
--color:#ffffff;
margin:10px;
}
.text-input{
width: 100%;
border: 1px solid #ebebeb;
margin: 0px 15px 15px 0px;
padding: 0 !important;
border-radius: 5px;
}
/* Error Messages */
.error{
color:red;
font-size: 12px;
font-weight: bold;
padding-bottom: 20px;
}
.span-color{
color:red;
}
.buttons{
display: flex;
justify-content: space-between;
padding: 20px;
overflow: auto;
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ForwardPage } from './forward.page';
describe('ForwardPage', () => {
let component: ForwardPage;
let fixture: ComponentFixture<ForwardPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ForwardPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ForwardPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+204
View File
@@ -0,0 +1,204 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AlertController, AnimationController, ModalController, NavParams } from '@ionic/angular';
import { Event } from 'src/app/models/event.model'
import { EventBody } from 'src/app/models/eventbody.model';
import { ProcessesService } from 'src/app/services/processes.service';
import { EventPerson } from 'src/app/models/eventperson.model';
import { EventsService } from 'src/app/services/events.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { AddParticipantsModalPage } from 'src/app/pages/gabinete-digital/expediente/add-participants-modal/add-participants-modal.page';
import { AddParticipantsCcModalPage } from 'src/app/pages/gabinete-digital/expediente/add-participants-cc-modal/add-participants-cc-modal.page';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { AlertService } from 'src/app/services/alert.service';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { ToastService } from 'src/app/services/toast.service';
import { SearchDocument } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.page';
@Component({
selector: 'app-forward',
templateUrl: './forward.page.html',
styleUrls: ['./forward.page.scss'],
})
export class ForwardPage implements OnInit {
task: any;
note:string;
taskParticipants: EventPerson[] = [];
taskParticipantsCc: EventPerson[] = [];
taskDocId:string;
loadedAttachments:any;
adding: "intervenient" | "CC" = "intervenient";
postData: Event;
eventBody: EventBody;
eventAttendees: EventPerson;
formLocationSatus: boolean = false;
showAttendees= false;
documents:SearchDocument[] = [];
constructor(
private modalController: ModalController,
private router:Router,
private navParams: NavParams,
private processes:ProcessesService,
private attachmentsService: AttachmentsService,
private calendarService: EventsService,
public alertController: AlertController,
private alertService: AlertService,
private animationController: AnimationController,
private toastService: ToastService,
) {
this.task = this.navParams.get('task');
this.postData = new Event();
this.eventBody = { BodyType : "1", Text : ""};
this.postData.Body = this.eventBody;
this.postData.Subject = this.task.Folio;
this.postData.CalendarName = "Oficial";
let selectedEndDate = new Date();
}
ngOnInit() {
this.adding = "intervenient";
console.log(this.task);
}
close() {
this.router.navigate(['/home/gabinete-digital/expediente']);
this.modalController.dismiss(null);
}
cancelTask() {
this.modalController.dismiss(null);
}
async assignar(note:string, documents:any) {
let body = {
"serialNumber": this.task.SerialNumber,
"action": "Reencaminhar",
"ActionTypeId": 98,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
}
notImplemented(){
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
async saveTask() {
const DocumentToSave = this.documents.map((e) => {
return {
ApplicationId: e.ApplicationType,
SourceId: e.Id,
}
});
let docs = {
ProcessInstanceID: "",
Attachments: DocumentToSave,
}
if(this.taskParticipants.length > 1){
this.toastService.badRequest("Selecione apenas um destinatário");
}
else {
let body = {
"usersSelected": this.taskParticipants,
"distributionType": "paralelo",
"priority": 0,
"countryCode": "string",
"serialNumber": this.task.SerialNumber,
"action": "Reencaminhar",
"actionTypeId": 98,
"dataFields": {
"ReviewUserComment": this.note,
},
"FolderId": this.task.FolderId,
"AttachmentList" :docs,
}
console.log(body);
this.processes.DelegateTask(body).subscribe(res=>{
console.log(res);
this.toastService.successMessage('Processo delegado')
},
(error)=>{
this.toastService.badRequest("Processo não delegado")
});
}
}
async addParticipants(){
console.log('HERE');
this.adding = "intervenient";
if(window.innerWidth <= 800){
const modal = await this.modalController.create({
component: AddParticipantsModalPage,
componentProps: {
eventPersons: this.eventAttendees
},
cssClass: 'book-meeting-modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((res) => {
});
} else {
this.showAttendees = true;
}
}
validateFormInputs(){
let formLocation = this.postData.Location.trim();
if(!this.postData.Location && formLocation.length <= 0){
this.formLocationSatus=true;
}
}
dynamicSetIntervenient({taskParticipants}){
this.taskParticipants = taskParticipants;
}
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);
}
});
}
removeAttachment(index: number){
this.documents = this.documents.filter( (e, i) => index != i);
}
}