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
@@ -21,7 +21,7 @@ export class DespachoMdService {
) { } ) { }
arquivar(note:string, documents:any, serialnumber) { arquivar(note:string, documents:any, serialnumber) {
let body = { let body = {
"serialNumber": serialnumber, "serialNumber": serialnumber,
"action": "Arquivo", "action": "Arquivo",
+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;
@@ -95,49 +93,47 @@ export class DocumentSetUpMeetingPage implements OnInit {
taskDocId:string; taskDocId:string;
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";
this.postData.Category = 'Reunião' this.postData.Category = 'Reunião'
} }
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);
} }
@@ -198,7 +188,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
}) })
} }
async saveTask(){ async saveTask() {
if(this.loggeduser.Profile == 'MDGPR') { if(this.loggeduser.Profile == 'MDGPR') {
this.injectValidation() this.injectValidation()
@@ -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,
Location: this.postData.Location,
StartDate: this.dateStart,
EndDate: this.dateEnd,
EventType: 'Reunião',
ParticipantsList: Attendees,
EventRecurrence: null,
Subject: this.postData.Subject,
IsRecurring: this.postData.IsRecurring,
Message: this.postData.Subject,
IsAllDayEvent: this.postData.IsRecurring,
},
Attachments: []
} }
this.postData = { if(this.document.Documents) {
EventId: '', this.document.Documents.forEach( (ele) => {
Subject: this.postData.Subject, console.log(ele)
Body: this.eventBody, data.Attachments.push({
Location: this.postData.Location, ApplicationId: 361,
CalendarId: '', Source: 1,
CalendarName: this.postData.CalendarName, SourceId: ele.docID || ele.docId || ele.DocId,
StartDate: this.dateStart, SourceName: ele.Assunto
EndDate: this.dateEnd, })
EventType: 'Reunião', });
Attendees: Attendees, } else {
IsMeeting: false, data.Attachments.push({
IsRecurring: false, ApplicationId: 8,
AppointmentState: 0, Source: 1,
TimeZone: 'UTC', SourceId: this.document.docID || this.document.docId || this.document.DocId,
Organizer: null, SourceName: this.document.Assunto
Category: 'Reunião', })
HasAttachments: true, }
EventRecurrence: null,
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(){
+33 -45
View File
@@ -1,50 +1,38 @@
import { EventPerson } from "./eventperson.model"
export class Attachments {
Id?: number
Source: number
SourceId: any
SourceName: any
ApplicationId: number | string
}
export class DocumentSetUpMeeting { export class DocumentSetUpMeeting {
"EventProcess": { EventProcess: {
"SerialNumber": "sample string 1", "SerialNumber"?: "sample string 1",
"Body": "sample string 2", "Body": string,
"Location": "sample string 3", "Location": string,
"Subject": "sample string 4", "Subject": string,
"StartDate": "2021-07-28T13:22:55.031857+01:00", "StartDate"?: "2021-07-28T13:22:55.031857+01:00",
"EndDate": "2021-07-28T13:22:55.031857+01:00", "EndDate"?: "2021-07-28T13:22:55.031857+01:00",
"ReviewUserComment": "sample string 7", "ReviewUserComment"?: "sample string 7",
"MDName": "sample string 8", "MDName"?: "sample string 8",
"MDEmail": "sample string 9", "MDEmail"?: "sample string 9",
"IsAllDayEvent": true, "IsAllDayEvent"?: boolean,
"Status": "sample string 11", "Status"?: "sample string 11",
"EventType": "sample string 12", "EventType"?: string,
"IsRecurring": true, "IsRecurring": boolean,
"ParticipantsList": [ "ParticipantsList"?: EventPerson[],
{ "Message": string,
"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": { "EventRecurrence": {
"Type": 0, "Type": 0,
"Day": 1, "Day"?: 1,
"DayOfWeek": 0, "DayOfWeek"?: 0,
"Month": 1, "Month"?: 1,
"LastOccurrence": "2021-07-28T13:22:55.031857+01:00" "LastOccurrence"?: "2021-07-28T13:22:55.031857+01:00"
}, }
"Participants": "sample string 15",
"CC": "sample string 16"
} }
"Attachment": { Attachments: Attachments[]
"Id": 1, }
"ParentId": "sample string 2",
"Source": 0,
"SourceId": "sample string 3",
"SourceName": "sample string 4",
"ApplicationId": 1
}
}
+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;
+1 -1
View File
@@ -1055,7 +1055,7 @@ export class AgendaPage implements OnInit {
async viewEventsToApprove() { async viewEventsToApprove() {
await this.cloneAllmobileComponent(); await this.cloneAllmobileComponent();
if( window.innerWidth <= 801){ if( window.innerWidth <= 801) {
this.router.navigate(['/home/agenda/event-list']); this.router.navigate(['/home/agenda/event-list']);
} else { } else {
// hide all components // hide all components
@@ -58,14 +58,14 @@ export class DespachoPage implements OnInit {
private location: Location private location: Location
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) { if(params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber; this.serialnumber = params["params"].SerialNumber;
} }
if(params["params"].caller) { if(params["params"].caller) {
this.caller = params["params"].caller; this.caller = params["params"].caller;
} }
}); });
} }
ngOnInit() { ngOnInit() {
@@ -82,7 +82,7 @@ export class DespachoPage implements OnInit {
this.LoadRelatedEvents(this.serialnumber); this.LoadRelatedEvents(this.serialnumber);
} }
close(){ close() {
this.modalController.dismiss(); this.modalController.dismiss();
} }
+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({