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) {
let body = {
"serialNumber": serialnumber,
"action": "Arquivo",
+1 -1
View File
@@ -13,7 +13,7 @@ export class DocumentService {
setUpMeeting(data: DocumentSetUpMeeting) {
this.processes.documentSetUpMeeting(data)
return this.processes.documentSetUpMeeting(data)
}
}
@@ -38,7 +38,6 @@ export class DocumentDetailPage implements OnInit {
ngOnInit() {
this.LoadDocumentDetails();
}
async LoadDocumentDetails() {
@@ -167,6 +166,7 @@ export class DocumentDetailPage implements OnInit {
component: DocumentSetUpMeetingPage,
componentProps: {
task: task,
document: this.LoadedDocument
},
cssClass: classs,
backdropDismiss: false
@@ -309,7 +309,7 @@
</ion-label>
</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-item>
<ion-label>
@@ -1,12 +1,9 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { AnimationController, ModalController, NavParams } from '@ionic/angular';
import { Router } from '@angular/router';
import { 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 { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from 'src/app/models/search-document';
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 { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { DocumentService } from 'src/app/Rules/document.service';
import { DocumentSetUpMeeting, Attachments } from 'src/app/models/CallMeeting';
const moment = _rollupMoment || _moment;
@@ -95,49 +93,47 @@ export class DocumentSetUpMeetingPage implements OnInit {
taskDocId:string;
loadedAttachments:any;
documents:SearchDocument[] = [];
documents: SearchDocument[] = [];
attachments:SearchDocument[] = [];
adding: "intervenient" | "CC" = "intervenient";
postData: Event;
eventBody: EventBody;
formLocationSatus: boolean = false;
showAttendees= false;
loggeduser: User;
emptyTextDescription = "Sem intervenientes selecionados";
document: any;
constructor(
private modalController: ModalController,
private router:Router,
private navParams: NavParams,
private processes:ProcessesService,
private attachmentsService: AttachmentsService,
private calendarService: EventsService,
authService: AuthService,
private animationController: AnimationController,
private toastService: ToastService,
private activatedRoute: ActivatedRoute,
private documentService: DocumentService
) {
this.loggeduser = authService.ValidatedUser;
this.task = this.navParams.get('task');
this.postData = new Event();
this.eventBody = { BodyType : "1", Text : ""};
this.postData.Body = this.eventBody;
this.document = this.navParams.get('document')
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.CalendarName = "Oficial";
this.postData.Category = 'Reunião'
}
}
ngOnInit() {
this.adding = "intervenient";
console.log(this.task);
this.getAttachments();
this.setDefaultTime()
}
@@ -146,12 +142,6 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.postData.EndDate = (new Date(new Date().getTime() + 15 * 60000))
}
getAttachments() {
this.attachmentsService.getAttachmentsBySerial(this.task.SerialNumber).subscribe(res=>{
this.loadedAttachments = res;
});
}
close() {
this.modalController.dismiss(null);
}
@@ -198,7 +188,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
})
}
async saveTask(){
async saveTask() {
if(this.loggeduser.Profile == 'MDGPR') {
this.injectValidation()
@@ -207,33 +197,65 @@ export class DocumentSetUpMeetingPage implements OnInit {
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.eventBody={
BodyType: '1',
Text: this.postData.Body.Text,
let data: DocumentSetUpMeeting = {
EventProcess: {
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 = {
EventId: '',
Subject: this.postData.Subject,
Body: this.eventBody,
Location: this.postData.Location,
CalendarId: '',
CalendarName: this.postData.CalendarName,
StartDate: this.dateStart,
EndDate: this.dateEnd,
EventType: 'Reunião',
Attendees: Attendees,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: 'UTC',
Organizer: null,
Category: 'Reunião',
HasAttachments: true,
EventRecurrence: null,
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() {
@@ -310,7 +332,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
async getDoc() {
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'modal-width-100-width-background modal',
cssClass: 'modal modal-desktop modal-width-100-width-background',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
showSearchInput: true,
@@ -321,13 +343,13 @@ export class DocumentSetUpMeetingPage implements OnInit {
modal.onDidDismiss().then((res)=> {
if(res){
const data = res.data;
this.documents.push(data.selected);
this.attachments.push(data.selected);
}
});
}
removeAttachment(index: number) {
this.documents = this.documents.filter( (e, i) => index != i);
this.attachments = this.attachments.filter( (e, i) => index != i);
}
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 {
"EventProcess": {
"SerialNumber": "sample string 1",
"Body": "sample string 2",
"Location": "sample string 3",
"Subject": "sample string 4",
"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": 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",
EventProcess: {
"SerialNumber"?: "sample string 1",
"Body": string,
"Location": string,
"Subject": string,
"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"
},
"Participants": "sample string 15",
"CC": "sample string 16"
"Day"?: 1,
"DayOfWeek"?: 0,
"Month"?: 1,
"LastOccurrence"?: "2021-07-28T13:22:55.031857+01:00"
}
}
"Attachment": {
"Id": 1,
"ParentId": "sample string 2",
"Source": 0,
"SourceId": "sample string 3",
"SourceName": "sample string 4",
"ApplicationId": 1
}
}
Attachments: Attachments[]
}
+1 -1
View File
@@ -1,6 +1,6 @@
export class SearchDocument {
ApplicationType: number;
ApplicationType: number | string;
Assunto: string;
Data: string;
DocTypeDesc: string;
+1 -1
View File
@@ -1055,7 +1055,7 @@ export class AgendaPage implements OnInit {
async viewEventsToApprove() {
await this.cloneAllmobileComponent();
if( window.innerWidth <= 801){
if( window.innerWidth <= 801) {
this.router.navigate(['/home/agenda/event-list']);
} else {
// hide all components
@@ -58,14 +58,14 @@ export class DespachoPage implements OnInit {
private location: Location
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber;
}
if(params["params"].caller) {
this.caller = params["params"].caller;
}
});
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber;
}
if(params["params"].caller) {
this.caller = params["params"].caller;
}
});
}
ngOnInit() {
@@ -82,7 +82,7 @@ export class DespachoPage implements OnInit {
this.LoadRelatedEvents(this.serialnumber);
}
close(){
close() {
this.modalController.dismiss();
}
+18 -6
View File
@@ -112,7 +112,9 @@ export class EventsService {
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();
params = params.set("Start", startdate);
@@ -126,7 +128,9 @@ export class EventsService {
}
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();
params = params.set("Start", startdate);
@@ -149,7 +153,9 @@ export class EventsService {
}
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();
params = params.set("Start", startdate);
@@ -163,7 +169,9 @@ export class EventsService {
}
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();
params = params.set("Start", startdate);
@@ -198,7 +206,9 @@ export class EventsService {
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();
params = params.set("Start", startdate);
@@ -214,7 +224,9 @@ export class EventsService {
}
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();
params = params.set("Start", startdate);
@@ -147,7 +147,6 @@ export class DespachosPage implements OnInit {
doRefresh() {
setTimeout(() => {
this.LoadList();
}, 1000);
@@ -155,7 +154,7 @@ export class DespachosPage implements OnInit {
// old
async openExpedientActionsModal(taskAction: any, task: any) {
//this.modalController.dismiss();
let classs;
if( window.innerWidth <= 800){
classs = 'modal modal-desktop'
@@ -174,7 +173,7 @@ export class DespachosPage implements OnInit {
FolderID: null,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
}
const modal = await this.modalController.create({