mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
teste mobile done!
This commit is contained in:
@@ -129,9 +129,14 @@ export class ApproveEventPage implements OnInit {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.PostTaskAction(body).toPromise()
|
||||
/* await this.processes.PostTaskAction(body).toPromise() */
|
||||
this.agendaDataRepository.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
|
||||
this.httpErroHandle.httpsSucessMessagge('Rejeitar');
|
||||
this.TaskService.loadEventosParaAprovacao();
|
||||
}, ((error) => {
|
||||
console.log('reject event error: ', error)
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
}))
|
||||
} catch (error) {
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.log('here!!!')
|
||||
if (this.restoreTemporaryData()) {
|
||||
this.setOtherData()
|
||||
} else {
|
||||
@@ -384,7 +384,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}));
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, { attachments: this.loadedAttachments }).subscribe((value) => {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
@@ -393,13 +393,13 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: [] }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
this.close()
|
||||
|
||||
@@ -578,10 +578,12 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
deleteAttachment(attachment: Attachment, index) {
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
console.log(attachment)
|
||||
this.loadedAttachments[index]['action'] = 'delete'
|
||||
this.deletedAttachmentsList.push(id)
|
||||
if (this.loadedEventAttachments[index].Id) {
|
||||
const id: any = this.loadedEventAttachments[index].Id
|
||||
console.log(attachment)
|
||||
this.loadedAttachments[index]['action'] = 'delete'
|
||||
this.deletedAttachmentsList.push(id)
|
||||
}
|
||||
}
|
||||
|
||||
async getDoc() {
|
||||
|
||||
@@ -374,7 +374,7 @@ export class EditEventPage implements OnInit {
|
||||
await this.saveDocument()
|
||||
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, { "attachments": this._postEvent.Attachments }).subscribe((value) => {
|
||||
this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, this._postEvent.Attachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
|
||||
@@ -288,9 +288,9 @@
|
||||
<div class="d-flex container-div width-100" >
|
||||
<ion-list class="width-100 ">
|
||||
<ion-item class="width-100" *ngFor="let document of loadedAttachments; let i = index">
|
||||
<ion-label class="width-100 d-block list" *ngIf="document.action != 'delete' ">
|
||||
<ion-label class="width-100 d-block list">
|
||||
<p class="d-flex ion-justify-content-between">
|
||||
<span class="attach-title-item">{{document.SourceName}}</span>
|
||||
<span class="attach-title-item">{{document.subject || document.Description || 'Sem título'}}</span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
|
||||
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
||||
@@ -298,7 +298,7 @@
|
||||
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
|
||||
</span>
|
||||
</p>
|
||||
<p><span class="span-left" *ngIf="document.Stakeholders != false">{{document.Stakeholders}}</span><span class="span-right" *ngIf="document.CreateDate != false"> {{document.CreateDate }} </span></p>
|
||||
<p><span class="span-left" *ngIf="document.Stakeholders != false">{{document.Stakeholders}}</span><span class="span-right" *ngIf="document.dateEntry != false"> {{document.dateEntry }} </span></p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-compo
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -44,7 +45,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
public showSeconds = false;
|
||||
public touchUi = false;
|
||||
public enableMeridian = false;
|
||||
public minDate = new Date().toISOString().slice(0,10)
|
||||
public minDate = new Date().toISOString().slice(0, 10)
|
||||
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
||||
public maxDate: any;
|
||||
public stepHour = 1;
|
||||
@@ -62,12 +63,14 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
@ViewChild('picker1') picker1: any;
|
||||
|
||||
serialNumber: string
|
||||
loadedAttachments: Attachment[]= []
|
||||
loadedAttachments: any[] = []
|
||||
addedAttachmentsList: any[] = []
|
||||
deletedAttachmentsList: any[] = []
|
||||
|
||||
eventProcess = {
|
||||
serialNumber: "",
|
||||
taskStartDate: "",
|
||||
workflowInstanceDataFields:{
|
||||
workflowInstanceDataFields: {
|
||||
Body: "",
|
||||
OccurrenceType: '',
|
||||
Category: '',
|
||||
@@ -91,10 +94,10 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
show = false
|
||||
|
||||
postEvent: Event;
|
||||
isRecurring:string;
|
||||
isRecurring: string;
|
||||
isEventEdited: boolean;
|
||||
segment:string = "true";
|
||||
profile:string;
|
||||
segment: string = "true";
|
||||
profile: string;
|
||||
eventAttendees: EventPerson[];
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
@@ -115,11 +118,12 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
private eventsService: EventsService,
|
||||
public alertController: AlertController,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private toastService: ToastService,
|
||||
private router:Router,
|
||||
private router: Router,
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHalde: HttpErrorHandle
|
||||
private httpErroHalde: HttpErrorHandle,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
// Edit event to approve
|
||||
this.serialNumber = this.navParams.get('serialNumber');
|
||||
@@ -129,6 +133,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
console.log('Here you ares')
|
||||
this.getTask()
|
||||
this.getRecurrenceTypes();
|
||||
}
|
||||
@@ -138,8 +143,8 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
myInterval = setInterval(() => {
|
||||
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
|
||||
if(e) {
|
||||
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
|
||||
if (e) {
|
||||
e.disabled = true;
|
||||
}
|
||||
})
|
||||
@@ -147,80 +152,86 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
async getTask() {
|
||||
|
||||
const result = await this.processes.GetTask(this.serialNumber).toPromise();
|
||||
/* const result = await this.processes.GetTask(this.serialNumber).toPromise(); */
|
||||
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
|
||||
|
||||
if (res.isOk()) {
|
||||
console.log('Loaded Event', res.value)
|
||||
|
||||
this.eventProcess = result
|
||||
this.eventProcess.workflowInstanceDataFields.Category = result.workflowInstanceDataFields.EventType
|
||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
||||
this.eventProcess = res.value as any
|
||||
this.eventProcess.workflowInstanceDataFields.Category = res.value.workflowInstanceDataFields.EventType
|
||||
this.eventProcess.workflowInstanceDataFields.LastOccurrence = new Date(this.eventProcess.workflowInstanceDataFields.LastOccurrence)
|
||||
|
||||
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
|
||||
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
|
||||
this.startDate = new Date(this.eventProcess.workflowInstanceDataFields.StartDate);
|
||||
this.endDate = new Date(this.eventProcess.workflowInstanceDataFields.EndDate);
|
||||
|
||||
// description
|
||||
let body : any =this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
// description
|
||||
let body: any = this.eventProcess.workflowInstanceDataFields.Body.replace(/<[^>]+>/g, '')
|
||||
this.eventProcess.workflowInstanceDataFields.Body = body
|
||||
this.Location = this.eventProcess.workflowInstanceDataFields.Location
|
||||
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
try {
|
||||
this.getAttachments()
|
||||
this.InstanceId = this.eventProcess.workflowInstanceDataFields.InstanceId
|
||||
|
||||
} catch (error) {
|
||||
this.httpErroHalde.httpStatusHandle(error)
|
||||
}
|
||||
|
||||
|
||||
if(this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
if(e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
this.loadedAttachments = res.value.Attachments
|
||||
/* this.getAttachments()
|
||||
*/
|
||||
if (this.eventProcess.workflowInstanceDataFields.IsRecurring == false) {
|
||||
this.isRecurring = "Não se repete";
|
||||
}
|
||||
})
|
||||
else {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
if (e.IsRequired) {
|
||||
this.taskParticipants.push(e);
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
this.httpErroHalde.httpStatusHandle(res.error)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* }) */
|
||||
}
|
||||
|
||||
getRecurrenceTypes() {
|
||||
this.eventsService.getRecurrenceTypes().subscribe(res=>{
|
||||
this.eventsService.getRecurrenceTypes().subscribe(res => {
|
||||
|
||||
this.recurringTypes = res;
|
||||
});
|
||||
}
|
||||
|
||||
onSelectedRecurringChanged(ev:any){
|
||||
onSelectedRecurringChanged(ev: any) {
|
||||
|
||||
this.calculetedLastOccurrence(ev);
|
||||
|
||||
if(ev.length > 1){
|
||||
if (ev.length > 1) {
|
||||
|
||||
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
|
||||
}
|
||||
if(ev.length == 0){
|
||||
if (ev.length == 0) {
|
||||
this.postEvent.EventRecurrence.Type = "-1";
|
||||
}
|
||||
}
|
||||
|
||||
calculetedLastOccurrence(type:number){
|
||||
calculetedLastOccurrence(type: number) {
|
||||
var valor;
|
||||
var opcao: boolean;
|
||||
if (type == 0) {
|
||||
valor = 7;
|
||||
opcao = true;
|
||||
} else if(type == 1){
|
||||
} else if (type == 1) {
|
||||
valor = 30;
|
||||
opcao = true;
|
||||
} else if(type == 2){
|
||||
} else if (type == 2) {
|
||||
valor = 1;
|
||||
opcao = false;
|
||||
}else if(type == 3){
|
||||
} else if (type == 3) {
|
||||
valor = 5;
|
||||
opcao = false;
|
||||
}
|
||||
@@ -228,7 +239,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
defineLastOccurrence(valor:number, opcao:boolean){
|
||||
defineLastOccurrence(valor: number, opcao: boolean) {
|
||||
var time = new Date(this.endDate);
|
||||
if (opcao == true) {
|
||||
time.setDate(time.getDate() + valor);
|
||||
@@ -248,7 +259,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
openLastOccurrence() {
|
||||
let input: any = document.querySelector('#last-occurrence')
|
||||
if(input) {
|
||||
if (input) {
|
||||
input.click()
|
||||
}
|
||||
}
|
||||
@@ -262,15 +273,15 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
save() {
|
||||
// set dates to eventProcess object
|
||||
|
||||
this.taskParticipantsCc.forEach(e=>{
|
||||
this.taskParticipantsCc.forEach(e => {
|
||||
e.IsRequired = false
|
||||
})
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc)
|
||||
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e=>{
|
||||
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e => {
|
||||
|
||||
if(e.hasOwnProperty('$type')) {
|
||||
if (e.hasOwnProperty('$type')) {
|
||||
delete e.$type
|
||||
}
|
||||
})
|
||||
@@ -306,15 +317,47 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
|
||||
/* this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
|
||||
this.httpErroHalde.httpsSucessMessagge('Editar evento')
|
||||
window['approve-event-getTask']()
|
||||
}, error =>{
|
||||
this.httpErroHalde.httpStatusHandle(error)
|
||||
})
|
||||
}) */
|
||||
|
||||
this.agendaDataRepository.updateEvent(this.eventProcess.serialNumber, event).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('edit event error: ', error)
|
||||
}));
|
||||
|
||||
this.agendaDataRepository.addEventAttendee(this.eventProcess.serialNumber, this.eventProcess.workflowInstanceDataFields.ParticipantsList).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
console.log('add Attendee error: ', error)
|
||||
}));
|
||||
|
||||
|
||||
this.loadedAttachments.forEach((document:any)=>{
|
||||
if (this.addedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.addEventAttachment(this.eventProcess.serialNumber, this.loadedAttachments).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('add attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.deletedAttachmentsList.length > 0) {
|
||||
this.agendaDataRepository.removeEventAttachment(this.eventProcess.serialNumber, { attachments: this.deletedAttachmentsList }).subscribe((value) => {
|
||||
console.log(value)
|
||||
}, ((error) => {
|
||||
this.showLoader = false
|
||||
console.log('remove attachment error: ', error)
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* this.loadedAttachments.forEach((document:any)=>{
|
||||
if(document['action'] == 'add') {
|
||||
delete document.action
|
||||
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
|
||||
@@ -343,17 +386,17 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}) */
|
||||
|
||||
this.close();
|
||||
}
|
||||
|
||||
async openAttendees() {
|
||||
|
||||
if(window.innerWidth <= 1024) {
|
||||
if (window.innerWidth <= 1024) {
|
||||
const modal = await this.modalController.create({
|
||||
component: AttendeesPageModal,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
adding: this.adding,
|
||||
taskParticipants: this.taskParticipants,
|
||||
taskParticipantsCc: this.taskParticipantsCc
|
||||
@@ -366,7 +409,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then((data) => {
|
||||
|
||||
if(data) {
|
||||
if (data) {
|
||||
data = data['data'];
|
||||
|
||||
const newAttendees: EventPerson[] = data['taskParticipants'];
|
||||
@@ -402,7 +445,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
this.openAttendees();
|
||||
}
|
||||
|
||||
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) {
|
||||
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
|
||||
this.taskParticipants = taskParticipants;
|
||||
this.taskParticipantsCc = taskParticipantsCc;
|
||||
}
|
||||
@@ -416,7 +459,7 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
console.error('getAttachments', error)
|
||||
}
|
||||
|
||||
result.forEach((e)=>{
|
||||
result.forEach((e) => {
|
||||
e.action = false
|
||||
})
|
||||
|
||||
@@ -426,8 +469,16 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
}
|
||||
|
||||
deleteAttachment(attachment: Attachment, index) {
|
||||
console.log( this.loadedAttachments)
|
||||
const id: any = this.loadedAttachments[index].id
|
||||
let update = this.removeItemById(this.loadedAttachments, id)
|
||||
this.loadedAttachments = update
|
||||
console.log( update)
|
||||
this.deletedAttachmentsList.push(id)
|
||||
}
|
||||
|
||||
this.loadedAttachments[index]['action'] = 'delete'
|
||||
removeItemById(array, id) {
|
||||
return array.filter(item => item.id !== id);
|
||||
}
|
||||
|
||||
async getDoc() {
|
||||
@@ -437,34 +488,36 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
showSearchInput: true,
|
||||
eventAgenda: true,
|
||||
select: true,
|
||||
}
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
if(res){
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if (res) {
|
||||
|
||||
const data: SearchList = res.data.selected;
|
||||
|
||||
const DocumentToSave: any = {
|
||||
SourceTitle: data.Assunto,
|
||||
ParentId: this.InstanceId,
|
||||
Source: '1',
|
||||
SourceId: data.Id,
|
||||
ApplicationId: data.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
action: 'add',
|
||||
CreateDate: data.Data,
|
||||
Data: data.Data,
|
||||
Description: data.DocTypeDesc,
|
||||
SourceName: data.Assunto,
|
||||
Stakeholders: data.EntidadeOrganicaNome,
|
||||
};
|
||||
console.log(data)
|
||||
/* const DocumentToSave: any = {
|
||||
SourceTitle: data.Assunto,
|
||||
ParentId: this.InstanceId,
|
||||
Source: '1',
|
||||
SourceId: data.Id,
|
||||
ApplicationId: data.ApplicationType.toString(),
|
||||
Id: '',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
action: 'add',
|
||||
CreateDate: data.Data,
|
||||
Data: data.Data,
|
||||
Description: data.DocTypeDesc,
|
||||
SourceName: data.Assunto,
|
||||
Stakeholders: data.EntidadeOrganicaNome,
|
||||
}; */
|
||||
|
||||
|
||||
this.loadedAttachments.push(DocumentToSave)
|
||||
this.loadedAttachments.push(data)
|
||||
this.addedAttachmentsList.push(data)
|
||||
|
||||
|
||||
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
||||
|
||||
Reference in New Issue
Block a user