mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
save
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user