This commit is contained in:
tiago.kayaya
2021-09-15 13:38:14 +01:00
parent f0e6a8a32d
commit db851e95dd
5 changed files with 128 additions and 80 deletions
@@ -9,6 +9,8 @@ import { SearchDocumentDetails, SearchFolderDetails } from 'src/app/models/searc
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
import { PermissionService } from 'src/app/OtherService/permission.service';
import { SearchedDocumentOptionsPage } from 'src/app/shared/popover/searched-document-options/searched-document-options.page';
import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page';
import { Location } from '@angular/common';
@Component({
selector: 'app-document-detail',
@@ -39,7 +41,8 @@ export class DocumentDetailPage implements OnInit {
private menu: MenuController,
private iab: InAppBrowser,
public p: PermissionService,
private popoverController: PopoverController
private popoverController: PopoverController,
private location: Location,
) {
this.docId = this.navParams.get('docId');
this.applicationId = this.navParams.get('applicationId');
@@ -51,6 +54,8 @@ export class DocumentDetailPage implements OnInit {
async LoadDocumentDetails() {
this.processes.GetDocumentDetails(this.docId, this.applicationId).subscribe(res=>{
console.log(res);
this.LoadedDocument = res;
this.LoadedDocument.Subject = this.LoadedDocument.Assunto
@@ -63,7 +68,7 @@ export class DocumentDetailPage implements OnInit {
let task: ExpedientTaskModalPageNavParamsTask
let document: SearchDocumentDetails = this.LoadedDocument
let folder: SearchFolderDetails = this.LoadedDocument
if(this.LoadedDocument.ApplicationID == 361 || this.LoadedDocument.ApplicationId == 361) {
task = {
serialNumber: folder.DispatchNumber,
@@ -95,7 +100,7 @@ export class DocumentDetailPage implements OnInit {
} else {
console.log('unexpected ApplicationID')
}
this.task = task
console.log('this.task = task', this.task)
@@ -120,16 +125,16 @@ export class DocumentDetailPage implements OnInit {
close() {
this.modalController.dismiss();
}
notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
// efetuar despacho
// efetuar despacho
async openExpedientActionsModal( taskAction: any) {
let classs;
if( window.innerWidth <= 800) {
if( window.innerWidth < 701) {
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
@@ -150,9 +155,10 @@ export class DocumentDetailPage implements OnInit {
}
async openBookMeetingModal() {
console.log(this.LoadedDocument);
let classs;
if( window.innerWidth <= 800) {
if( window.innerWidth < 701) {
classs = 'book-meeting-modal modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
@@ -170,6 +176,29 @@ export class DocumentDetailPage implements OnInit {
modal.onDidDismiss();
}
/* async openBookMeetingModal() {
//console.log(task);
let classs;
if( window.innerWidth < 701){
classs = 'book-meeting-modal modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: BookMeetingModalPage,
componentProps: {
task: this.task,
},
cssClass: classs,
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(res=>{
this.location.back();
});
} */
async openOptions() {
const popover = await this.popoverController.create({
component: SearchedDocumentOptionsPage,
@@ -193,5 +222,5 @@ export class DocumentDetailPage implements OnInit {
}
});
}
}
}
@@ -86,8 +86,9 @@ export class DocumentSetUpMeetingPage implements OnInit {
emptyTextDescription = "Sem intervenientes selecionados";
document: SearchFolderDetails | SearchDocumentDetails | any;
subject: string
subject: string;
docs:any[] = [];
eventPipe = new EventPipe()
constructor(
@@ -178,8 +179,8 @@ export class DocumentSetUpMeetingPage implements OnInit {
var Attachments: addAttachment[] = []
let folder: SearchFolderDetails = this.document
let document: SearchDocumentDetails = this.document
if(folder.Documents) {
/* if(folder.Documents) {
this.document.Documents.forEach( (_folder: SearchFolderDetailsDocuments) => {
Attachments.push({
ApplicationId: 361,
@@ -204,8 +205,18 @@ export class DocumentSetUpMeetingPage implements OnInit {
SourceId: e.Id,
SourceTitle: e.Assunto
})
}) */
this.document.Documents.forEach((e)=> {
this.docs.push({
ApplicationId: e.ApplicationId || e.ApplicationType,
Source: 1,
SourceId: e.DocId || e.docID || e.docId,
SourceName: e.Assunto
})
})
console.log(this.docs);
let postEvent = {
EventId: '',
@@ -229,25 +240,32 @@ export class DocumentSetUpMeetingPage implements OnInit {
Type: this.EventRecurrenceType,
LastOccurrence: this.Occurrence
},
Attachments: this.docs, /* [
{
"Source": 1,
"SourceId": 121367,
"SourceName": "sample string 5",
"ApplicationId": 8
}
], */
}
console.log(postEvent);
const laoder = this.toastService.loading()
this.eventService.create({
body: postEvent,
calendar: this.postData.CalendarName
}).subscribe(async (respose) => {
this.eventService.create({ body: postEvent, calendar: this.postData.CalendarName }).subscribe(async (respose) => {
const res: any = respose;
const eventId: string = res
const DocumentToSave = this.attachments.map((e) => {
/* const DocumentToSave = this.attachments.map((e) => {
return this.eventPipe.AttactSearchResult(e, eventId, {})
});
await DocumentToSave.forEach(async (attachments, i) => {
await this.eventService.addAttachment(attachments).toPromise();
});
}); */
laoder.remove()
this.modalController.dismiss()