Improve page

This commit is contained in:
Peter Maquiran
2021-07-29 15:40:24 +01:00
parent eb474ca53c
commit 39a3863106
11 changed files with 140 additions and 119 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export class DocumentService {
setUpMeeting(data: DocumentSetUpMeeting) { setUpMeeting(data: DocumentSetUpMeeting) {
this.processes.documentSetUpMeeting(data) return this.processes.documentSetUpMeeting(data)
} }
} }
@@ -38,7 +38,6 @@ export class DocumentDetailPage implements OnInit {
ngOnInit() { ngOnInit() {
this.LoadDocumentDetails(); this.LoadDocumentDetails();
} }
async LoadDocumentDetails() { async LoadDocumentDetails() {
@@ -167,6 +166,7 @@ export class DocumentDetailPage implements OnInit {
component: DocumentSetUpMeetingPage, component: DocumentSetUpMeetingPage,
componentProps: { componentProps: {
task: task, task: task,
document: this.LoadedDocument
}, },
cssClass: classs, cssClass: classs,
backdropDismiss: false backdropDismiss: false
@@ -309,7 +309,7 @@
</ion-label> </ion-label>
</div> </div>
<div class="list " *ngFor="let document of documents; let i = index" > <div class="list " *ngFor="let document of attachments; let i = index" >
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-label> <ion-label>
@@ -1,12 +1,9 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { Router } from '@angular/router';
import { AnimationController, ModalController, NavParams } from '@ionic/angular'; import { ModalController, NavParams } from '@ionic/angular';
import { Event } from 'src/app/models/event.model' 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 { ProcessesService } from 'src/app/services/processes.service';
import { EventPerson } from 'src/app/models/eventperson.model'; 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 { SearchPage } from 'src/app/pages/search/search.page'; import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from 'src/app/models/search-document'; import { SearchDocument } from 'src/app/models/search-document';
import { User } from 'src/app/models/user.model'; import { User } from 'src/app/models/user.model';
@@ -21,6 +18,7 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
import { MAT_DATE_LOCALE } from '@angular/material/core'; import { MAT_DATE_LOCALE } from '@angular/material/core';
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { DocumentService } from 'src/app/Rules/document.service'; import { DocumentService } from 'src/app/Rules/document.service';
import { DocumentSetUpMeeting, Attachments } from 'src/app/models/CallMeeting';
const moment = _rollupMoment || _moment; const moment = _rollupMoment || _moment;
@@ -97,37 +95,36 @@ export class DocumentSetUpMeetingPage implements OnInit {
loadedAttachments:any; loadedAttachments:any;
documents: SearchDocument[] = []; documents: SearchDocument[] = [];
attachments:SearchDocument[] = [];
adding: "intervenient" | "CC" = "intervenient"; adding: "intervenient" | "CC" = "intervenient";
postData: Event; postData: Event;
eventBody: EventBody;
formLocationSatus: boolean = false; formLocationSatus: boolean = false;
showAttendees= false; showAttendees= false;
loggeduser: User; loggeduser: User;
emptyTextDescription = "Sem intervenientes selecionados"; emptyTextDescription = "Sem intervenientes selecionados";
document: any;
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private router:Router, private router:Router,
private navParams: NavParams, private navParams: NavParams,
private processes:ProcessesService, private processes:ProcessesService,
private attachmentsService: AttachmentsService,
private calendarService: EventsService,
authService: AuthService, authService: AuthService,
private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
private activatedRoute: ActivatedRoute,
private documentService: DocumentService private documentService: DocumentService
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.postData = new Event(); this.document = this.navParams.get('document')
this.eventBody = { BodyType : "1", Text : ""};
this.postData.Body = this.eventBody; this.postData = new Event();
this.postData.Body ={ BodyType : "1", Text : ""};
/* Initialize 'Subject' with the title of the expedient */
this.postData.Subject = this.task.Folio; this.postData.Subject = this.task.Folio;
this.postData.CalendarName = "Oficial"; this.postData.CalendarName = "Oficial";
@@ -137,7 +134,6 @@ export class DocumentSetUpMeetingPage implements OnInit {
ngOnInit() { ngOnInit() {
this.adding = "intervenient"; this.adding = "intervenient";
console.log(this.task); console.log(this.task);
this.getAttachments();
this.setDefaultTime() this.setDefaultTime()
} }
@@ -146,12 +142,6 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.postData.EndDate = (new Date(new Date().getTime() + 15 * 60000)) this.postData.EndDate = (new Date(new Date().getTime() + 15 * 60000))
} }
getAttachments() {
this.attachmentsService.getAttachmentsBySerial(this.task.SerialNumber).subscribe(res=>{
this.loadedAttachments = res;
});
}
close() { close() {
this.modalController.dismiss(null); this.modalController.dismiss(null);
} }
@@ -207,33 +197,65 @@ export class DocumentSetUpMeetingPage implements OnInit {
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc); let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.eventBody={ let data: DocumentSetUpMeeting = {
BodyType: '1', EventProcess: {
Text: this.postData.Body.Text, Body: this.postData.Body.Text,
}
this.postData = {
EventId: '',
Subject: this.postData.Subject,
Body: this.eventBody,
Location: this.postData.Location, Location: this.postData.Location,
CalendarId: '',
CalendarName: this.postData.CalendarName,
StartDate: this.dateStart, StartDate: this.dateStart,
EndDate: this.dateEnd, EndDate: this.dateEnd,
EventType: 'Reunião', EventType: 'Reunião',
Attendees: Attendees, ParticipantsList: Attendees,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: 'UTC',
Organizer: null,
Category: 'Reunião',
HasAttachments: true,
EventRecurrence: null, EventRecurrence: null,
Subject: this.postData.Subject,
IsRecurring: this.postData.IsRecurring,
Message: this.postData.Subject,
IsAllDayEvent: this.postData.IsRecurring,
},
Attachments: []
}
if(this.document.Documents) {
this.document.Documents.forEach( (ele) => {
console.log(ele)
data.Attachments.push({
ApplicationId: 361,
Source: 1,
SourceId: ele.docID || ele.docId || ele.DocId,
SourceName: ele.Assunto
})
});
} else {
data.Attachments.push({
ApplicationId: 8,
Source: 1,
SourceId: this.document.docID || this.document.docId || this.document.DocId,
SourceName: this.document.Assunto
})
}
this.attachments.forEach((e)=> {
console.log('e', e)
data.Attachments.push({
ApplicationId: e.ApplicationType,
Source: 1,
SourceId: e.Id,
SourceName: e.Assunto
})
})
const loader = this.toastService.loading()
try {
await this.documentService.setUpMeeting(data).toPromise()
this.toastService.successMessage('Processo criado')
this.close()
} catch(e) {
this.toastService.badRequest("Processo não criado")
} finally {
loader.remove()
} }
// this.documentService.setUpMeeting()
} }
async addParticipants() { async addParticipants() {
@@ -310,7 +332,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
async getDoc() { async getDoc() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: SearchPage, component: SearchPage,
cssClass: 'modal-width-100-width-background modal', cssClass: 'modal modal-desktop modal-width-100-width-background',
componentProps: { componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect', type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true, showSearchInput: true,
@@ -321,13 +343,13 @@ export class DocumentSetUpMeetingPage implements OnInit {
modal.onDidDismiss().then((res)=> { modal.onDidDismiss().then((res)=> {
if(res){ if(res){
const data = res.data; const data = res.data;
this.documents.push(data.selected); this.attachments.push(data.selected);
} }
}); });
} }
removeAttachment(index: number) { removeAttachment(index: number) {
this.documents = this.documents.filter( (e, i) => index != i); this.attachments = this.attachments.filter( (e, i) => index != i);
} }
validateFormInputs(){ validateFormInputs(){
+34 -46
View File
@@ -1,50 +1,38 @@
export class DocumentSetUpMeeting { import { EventPerson } from "./eventperson.model"
"EventProcess": {
"SerialNumber": "sample string 1", export class Attachments {
"Body": "sample string 2", Id?: number
"Location": "sample string 3", Source: number
"Subject": "sample string 4", SourceId: any
"StartDate": "2021-07-28T13:22:55.031857+01:00", SourceName: any
"EndDate": "2021-07-28T13:22:55.031857+01:00", ApplicationId: number | string
"ReviewUserComment": "sample string 7",
"MDName": "sample string 8",
"MDEmail": "sample string 9",
"IsAllDayEvent": true,
"Status": "sample string 11",
"EventType": "sample string 12",
"IsRecurring": true,
"ParticipantsList": [
{
"Id": 1,
"EmailAddress": "sample string 2",
"Name": "sample string 3",
"IsRequired": true
},
{
"Id": 1,
"EmailAddress": "sample string 2",
"Name": "sample string 3",
"IsRequired": true
}
],
"Message": "sample string 14",
"EventRecurrence": {
"Type": 0,
"Day": 1,
"DayOfWeek": 0,
"Month": 1,
"LastOccurrence": "2021-07-28T13:22:55.031857+01:00"
},
"Participants": "sample string 15",
"CC": "sample string 16"
} }
"Attachment": { export class DocumentSetUpMeeting {
"Id": 1, EventProcess: {
"ParentId": "sample string 2", "SerialNumber"?: "sample string 1",
"Source": 0, "Body": string,
"SourceId": "sample string 3", "Location": string,
"SourceName": "sample string 4", "Subject": string,
"ApplicationId": 1 "StartDate"?: "2021-07-28T13:22:55.031857+01:00",
"EndDate"?: "2021-07-28T13:22:55.031857+01:00",
"ReviewUserComment"?: "sample string 7",
"MDName"?: "sample string 8",
"MDEmail"?: "sample string 9",
"IsAllDayEvent"?: boolean,
"Status"?: "sample string 11",
"EventType"?: string,
"IsRecurring": boolean,
"ParticipantsList"?: EventPerson[],
"Message": string,
"EventRecurrence": {
"Type": 0,
"Day"?: 1,
"DayOfWeek"?: 0,
"Month"?: 1,
"LastOccurrence"?: "2021-07-28T13:22:55.031857+01:00"
} }
} }
Attachments: Attachments[]
}
+1 -1
View File
@@ -1,6 +1,6 @@
export class SearchDocument { export class SearchDocument {
ApplicationType: number; ApplicationType: number | string;
Assunto: string; Assunto: string;
Data: string; Data: string;
DocTypeDesc: string; DocTypeDesc: string;
+18 -6
View File
@@ -112,7 +112,9 @@ export class EventsService {
getAllPrOficialEvents(startdate:string, enddate:string): Observable<Event[]>{ getAllPrOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr'; let geturl = environment.apiURL + 'calendar/pr';
geturl = geturl.replace('/V4/','/V5/')
let params = new HttpParams(); let params = new HttpParams();
params = params.set("Start", startdate); params = params.set("Start", startdate);
@@ -126,7 +128,9 @@ export class EventsService {
} }
getAllPrPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{ getAllPrPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr'; let geturl = environment.apiURL + 'calendar/pr';
geturl = geturl.replace('/V4/','/V5/')
let params = new HttpParams(); let params = new HttpParams();
params = params.set("Start", startdate); params = params.set("Start", startdate);
@@ -149,7 +153,9 @@ export class EventsService {
} }
getAllMdOficialEvents(startdate:string, enddate:string): any{ getAllMdOficialEvents(startdate:string, enddate:string): any{
const geturl = environment.apiURL + 'calendar/md'; let geturl = environment.apiURL + 'calendar/md';
geturl = geturl.replace('/V4/','/V5/')
let params = new HttpParams(); let params = new HttpParams();
params = params.set("Start", startdate); params = params.set("Start", startdate);
@@ -163,7 +169,9 @@ export class EventsService {
} }
getAllMdPessoalEvents(startdate:string, enddate:string): any{ getAllMdPessoalEvents(startdate:string, enddate:string): any{
const geturl = environment.apiURL + 'calendar/md'; let geturl = environment.apiURL + 'calendar/md';
geturl = geturl.replace('/V4/','/V5/')
let params = new HttpParams(); let params = new HttpParams();
params = params.set("Start", startdate); params = params.set("Start", startdate);
@@ -198,7 +206,9 @@ export class EventsService {
getAllSharedOficialEvents(startdate:string, enddate:string): Observable<Event[]>{ getAllSharedOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr'; let geturl = environment.apiURL + 'calendar/pr';
geturl = geturl.replace('/V4/','/V5/')
let params = new HttpParams(); let params = new HttpParams();
params = params.set("Start", startdate); params = params.set("Start", startdate);
@@ -214,7 +224,9 @@ export class EventsService {
} }
getAllSharedPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{ getAllSharedPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
const geturl = environment.apiURL + 'calendar/pr'; let geturl = environment.apiURL + 'calendar/pr';
geturl = geturl.replace('/V4/','/V5/')
let params = new HttpParams(); let params = new HttpParams();
params = params.set("Start", startdate); params = params.set("Start", startdate);
@@ -147,7 +147,6 @@ export class DespachosPage implements OnInit {
doRefresh() { doRefresh() {
setTimeout(() => { setTimeout(() => {
this.LoadList(); this.LoadList();
}, 1000); }, 1000);
@@ -155,7 +154,7 @@ export class DespachosPage implements OnInit {
// old // old
async openExpedientActionsModal(taskAction: any, task: any) { async openExpedientActionsModal(taskAction: any, task: any) {
//this.modalController.dismiss();
let classs; let classs;
if( window.innerWidth <= 800){ if( window.innerWidth <= 800){
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
@@ -174,7 +173,7 @@ export class DespachosPage implements OnInit {
FolderID: null, FolderID: null,
DocId: doc.SourceId, DocId: doc.SourceId,
Subject: doc.SourceName Subject: doc.SourceName
}, }
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({