Merge branch 'developer-prod' of bitbucket.org:equilibriumito/gabinete-digital-fo into chat/labels3

This commit is contained in:
Peter Maquiran
2023-09-12 21:16:42 +01:00
43 changed files with 1383 additions and 603 deletions
@@ -190,6 +190,10 @@ export class EditEventPage implements OnInit {
})
}, 1000);
ngOnChanges(changes: any): void {
this.loadedEventAttachments = this.postEvent?.Attachments
}
close() {
this.modalController.dismiss();
}
@@ -421,7 +425,7 @@ export class EditEventPage implements OnInit {
this.isEventEdited = true;
await this.saveDocument()
/* await this.saveDocument() */
this.goBack();
}
@@ -595,6 +599,7 @@ export class EditEventPage implements OnInit {
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
this.postEvent.Attachments = this.loadedEventAttachments;
}
})
+328 -115
View File
@@ -20,6 +20,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment';
import { ProcessesService } from 'src/app/services/processes.service';
import { TaskService } from 'src/app/services/task.service'
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -60,8 +61,8 @@ export class NewEventPage implements OnInit {
postEvent: Event;
eventBody: EventBody;
segment:string = "true";
profile:string;
segment: string = "true";
profile: string;
eventAttendees: EventPerson[];
selectedSegment: string;
selectedDate: Date;
@@ -74,10 +75,10 @@ export class NewEventPage implements OnInit {
taskParticipants: any = [];
taskParticipantsCc: any = [];
documents:SearchList[] = [];
documents: SearchList[] = [];
loggeduser: LoginUserRespose;
members:any;
members: any;
CalendarName;
SessionStore = SessionStore;
@@ -89,7 +90,7 @@ export class NewEventPage implements OnInit {
autoStartTime;
autoEndTime;
CalendarNamesOptions = ['Oficial', 'Pessoal']
roomId:string;
roomId: string;
globalEnd = new Date('1999')
environment = environment
@@ -103,12 +104,13 @@ export class NewEventPage implements OnInit {
private platform: Platform,
private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService
) {
this.loggeduser = SessionStore.user;
this.postEvent = new Event();
this.postEvent.EventRecurrence = {Type:'-1'};
this.eventBody = { BodyType : "1", Text : ""};
this.postEvent.EventRecurrence = { Type: '-1' };
this.eventBody = { BodyType: "1", Text: "" };
this.postEvent.Body = this.eventBody;
this.roomId = this.navParams.get('roomId');
@@ -123,9 +125,9 @@ export class NewEventPage implements OnInit {
// this.taskParticipants = [];
}
if(!this.CalendarName) {
if (!this.CalendarName) {
console.log('true', this.eventService.calendarNamesAry.includes('Meu calendario'))
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
console.log(this.eventService.calendarNamesAry)
} else {
@@ -138,7 +140,7 @@ export class NewEventPage implements OnInit {
this.getRecurrenceTypes();
if(this.selectedSegment != "Combinada"){
if (this.selectedSegment != "Combinada") {
this.postEvent = {
EventId: '',
Subject: '',
@@ -157,10 +159,10 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime},
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
};
}
else{
else {
this.postEvent = {
EventId: '',
Subject: '',
@@ -179,15 +181,15 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime},
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
};
}
window.onresize = (event) => {
if( window.innerWidth >= 1024) {
if (window.innerWidth >= 1024) {
this.modalController.dismiss();
}
};
};
this.setDefaultTime()
@@ -201,8 +203,8 @@ export class NewEventPage 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;
}
})
@@ -223,8 +225,8 @@ export class NewEventPage implements OnInit {
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
} else if (minutes > 30) {
@@ -235,65 +237,65 @@ export class NewEventPage implements OnInit {
date.setMinutes(15)
}
}
}
return date
}
roundTimeQuarterHourPlus15(date:Date) {
roundTimeQuarterHourPlus15(date: Date) {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
return _date
const minutes = _date.getMinutes();
_date.setMinutes(minutes + 15)
return _date
}
setStartDate() {
if(!this.postEvent.StartDate) {
if (!this.postEvent.StartDate) {
this.postEvent.StartDate = this.roundTimeQuarterHour();
}
}
setEndDate(){
if(!this.postEvent.EndDate) {
setEndDate() {
if (!this.postEvent.EndDate) {
this.postEvent.EndDate = this.postEvent.StartDate;
}
}
getRecurrenceTypes() {
this.eventService.getRecurrenceTypes().subscribe( res => {
this.eventService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res;
});
}
onSelectedRecurringChanged(ev:any) {
onSelectedRecurringChanged(ev: any) {
this.calculetedLastOccurrence(ev);
if(ev.length > 1) {
if (ev.length > 1) {
this.selectedRecurringType = ev.filter(data => data != '-1');
}
if(ev.length == 0) {
if (ev.length == 0) {
this.selectedRecurringType = "-1";
}
}
calculetedLastOccurrence(type:number){
calculetedLastOccurrence(type: number) {
// console.log(type);
var valor;
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;
}
@@ -301,28 +303,28 @@ export class NewEventPage implements OnInit {
}
defineLastOccurrence(valor:number, opcao:boolean){
defineLastOccurrence(valor: number, opcao: boolean) {
var time = new Date(this.postEvent.EndDate);
if (opcao == true) {
time.setDate(time.getDate() + valor);
this.postEvent.EventRecurrence.LastOccurrence = time;
} else {
time = new Date(
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getFullYear() + valor,
time.getMonth(),
time.getDate(),
time.getHours(),
time.getMinutes()
);
this.postEvent.EventRecurrence.LastOccurrence = time;
}
}
runValidation() {
this.validateFrom = true;
if(new Date(this.postEvent.StartDate).getTime() > new Date(this.postEvent.EndDate).getTime()){
this.validateFrom = true;
if (new Date(this.postEvent.StartDate).getTime() > new Date(this.postEvent.EndDate).getTime()) {
this.toastService._badRequest("A data de fim não pode ser inferior a data de início do evento")
}
}
@@ -330,7 +332,7 @@ export class NewEventPage implements OnInit {
get dateValid() {
if (window.innerWidth <= 800) {
return this.postEvent.StartDate < this.postEvent.EndDate? ['ok']: []
return this.postEvent.StartDate < this.postEvent.EndDate ? ['ok'] : []
} else {
return ['ok']
}
@@ -349,7 +351,7 @@ export class NewEventPage implements OnInit {
CalendarName: new FormControl(this.postEvent.CalendarName, [
Validators.required
]),
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime()? 'ok': null,[
Date: new FormControl(new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [
Validators.required
]),
Categories: new FormControl(this.postEvent.Category, [
@@ -358,76 +360,83 @@ export class NewEventPage implements OnInit {
participantes: new FormControl(this.taskParticipants, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [
Validators.required
]),
})
}
openInicio() {
let input: any = document.querySelector('#new-inicio')
if(input) {
if (input) {
input.click()
}
}
openFim() {
let input: any = document.querySelector('#new-fim')
if(input) {
if (input) {
input.click()
}
}
openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence')
if(input) {
if (input) {
input.click()
}
}
async save() {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) {
if (this.Form.invalid) {
return false
}
if(this.documents.length >= 0) {
if (this.documents.length >= 0) {
this.postEvent.HasAttachments = true;
}
if(this.selectedRecurringType != '-1') {
if (this.selectedRecurringType != '-1') {
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
let eventId: any;
let eventId: any;
const loader = this.toastService.loading()
const loader = this.toastService.loading()
try {
const CalendarId = this.selectedCalendarId()
this.postEvent.CalendarId = CalendarId
if(this.loggeduser.Profile == 'MDGPR') {
if (this.loggeduser.Profile == 'MDGPR') {
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
this.hhtpErrorHandle.httpsSucessMessagge('new event')
}
else if(this.loggeduser.Profile == 'PR') {
else if (this.loggeduser.Profile == 'PR') {
const CalendarId = this.selectedCalendarId()
this.postEvent.CalendarId = CalendarId
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
this.hhtpErrorHandle.httpsSucessMessagge('new event')
} else if (this.loggeduser.Profile == 'SGGPR') {
this.saveAproveEvent();
} else {
const CalendarId = this.selectedCalendarId()
@@ -435,50 +444,54 @@ export class NewEventPage implements OnInit {
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
this.hhtpErrorHandle.httpsSucessMessagge('new event')
}
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
//foi adicionado este if para não ter de fazer muitas alterações sobre a criação dos eventos. Deve ser refatorado
if (this.loggeduser.Profile != 'SGGPR') {
await DocumentToSave.forEach( async (attachments, i) => {
try {
await this.attachmentsService.setEventAttachmentById(attachments).toPromise();
} catch(error) {
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
await DocumentToSave.forEach(async (attachments, i) => {
try {
await this.attachmentsService.setEventAttachmentById(attachments).toPromise();
} catch (error) {
}
});
let data1 = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
"end": this.postEvent.EndDate,
"venue": this.postEvent.Location,
"id": eventId,
"calendarId": CalendarId
}
});
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data1);
}
let data1 = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
"end": this.postEvent.EndDate,
"venue": this.postEvent.Location,
"id": eventId,
"calendarId": CalendarId
this.hhtpErrorHandle.httpsSucessMessagge('new event');
let data = Object.assign(this.postEvent, { id: eventId })
this.modalController.dismiss(data);
}
if(this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data1);
}
this.hhtpErrorHandle.httpsSucessMessagge('new event');
let data = Object.assign(this.postEvent,{id:eventId})
this.modalController.dismiss(data);
} catch (error) {
this.hhtpErrorHandle.httpStatusHandle(error)
this.hhtpErrorHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
@@ -486,7 +499,7 @@ export class NewEventPage implements OnInit {
}
selectedCalendarId () {
selectedCalendarId() {
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postEvent.CalendarName == 'Oficial') {
return this.eventService.calendarNamesType[this.CalendarName]['OficialId']
@@ -504,18 +517,18 @@ export class NewEventPage implements OnInit {
setTimeout(() => {
if(this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
this.CalendarNamesOptions = ['Oficial']
this.postEvent.CalendarName = 'Oficial'
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Pessoal']
this.postEvent.CalendarName = 'Pessoal'
} else {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
}
@@ -527,7 +540,7 @@ export class NewEventPage implements OnInit {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
@@ -540,9 +553,9 @@ export class NewEventPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data) {
if (data) {
data = data['data'];
if(data) {
if (data) {
const newAttendees: EventPerson[] = data['taskParticipants'];
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
@@ -591,8 +604,8 @@ export class NewEventPage implements OnInit {
}
});
modal.onDidDismiss().then((res)=>{
if(res){
modal.onDidDismiss().then((res) => {
if (res) {
const data = res.data;
this.documents.push(data.selected);
}
@@ -603,19 +616,219 @@ export class NewEventPage implements OnInit {
removeAttachment(index: number) {
this.documents = this.documents.filter( (e, i) => index != i);
this.documents = this.documents.filter((e, i) => index != i);
}
checkRoleInArray() {
for (let index = 0; index < this.eventService.calendarNamesAry.length; index++) {
console.log('ROLE1', this.eventService.calendarNamesAry[index])
}
for (let index = 0; index < this.eventService.calendarRole.length; index++) {
console.log('ROLE2',this.eventService.calendarRole[index])
console.log('ROLE2', this.eventService.calendarRole[index])
}
}
//Deve ser removido posteriormente
async saveAproveEvent() {
console.log(this.postEvent)
console.log(this.postEvent.CalendarName)
console.log(this.CalendarName)
console.log(this.eventService.calendarNamesAry)
const CalendarId = this.selectedCalendarId()
let selectedCalendar
try {
selectedCalendar = this.eventService.calendarNamesAry.find(calendar => calendar.Fullname === this.CalendarName)
} catch (error) {
}
console.log('selectedCalendar', selectedCalendar)
if (selectedCalendar) {
if (selectedCalendar.Role = 'Presidente da República') {
let loader = this.toastService.loading();
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: "AGD_" + this.loggeduser.UserName + "_" + this.processeService.generateInstaceFormatDate(),
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
let body = this.eventToaproveBody(this.postEvent, CalendarId, this.loggeduser.RoleID, this.loggeduser.UserId, DocumentToSave);
await this.processeService.createEventToAprove(this.postEvent.CalendarName, 'pr', body).subscribe((id) => {
loader.remove()
this.modalController.dismiss();
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove')
/* DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
if (DocumentToSave.length == (i + 1)) {
this.afterSave();
}
});
});
if (DocumentToSave.length == 0) {
this.afterSave();
} */
}, (error) => {
loader.remove()
this.hhtpErrorHandle.httpStatusHandle(error)
});
} else if (selectedCalendar.Role = 'Ministro e Director do Gabinete do PR') {
let loader = this.toastService.loading();
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: "AGD_" + this.loggeduser.UserName + "_" + this.processeService.generateInstaceFormatDate(),
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
let body = this.eventToaproveBody(this.postEvent, CalendarId, this.loggeduser.RoleID, this.loggeduser.UserId, DocumentToSave);
await this.processeService.createEventToAprove(this.postEvent.CalendarName, 'md', body).subscribe((id) => {
loader.remove()
this.modalController.dismiss();
this.hhtpErrorHandle.httpsSucessMessagge('new event to aprove')
/* DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
if (DocumentToSave.length == (i + 1)) {
this.afterSave();
}
});
});
if (DocumentToSave.length == 0) {
this.afterSave();
} */
}, (error) => {
loader.remove()
this.hhtpErrorHandle.httpStatusHandle(error)
});
}
}
if (!selectedCalendar && this.CalendarName == "Meu calendario") {
console.log('SG generic')
this.postEvent.CalendarName
const CalendarId = this.selectedCalendarId()
let loader = this.toastService.loading();
this.postEvent.CalendarId = CalendarId
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
(id) => {
loader.remove();
const eventId: any = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) => {
if (DocumentToSave.length == (i + 1)) {
}
});
});
if (DocumentToSave.length == 0) {
}
this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = {
"subject": this.postEvent.Subject,
"start": this.postEvent.StartDate,
"end": this.postEvent.EndDate,
"venue": this.postEvent.Location,
"id": id,
"calendarId": CalendarId
}
if (this.roomId) {
this.chatMethodService.sendMessage(this.roomId, data);
}
let dataa = Object.assign(this.postEvent, { id: eventId })
this.modalController.dismiss(dataa);
}, (error) => {
loader.remove()
this.hhtpErrorHandle.httpStatusHandle(error)
});
}
}
// Deve ser removido posteriormente
eventToaproveBody(event, calendarId, role, userId, attachments) {
let toAproveObject = {
"EventProcess": {
"Body": event.Body,
"Location": event.Location,
"Subject": event.Subject,
"StartDate": event.StartDate,
"EndDate": event.EndDate,
"Status": "Active",
"IsAllDayEvent": event.IsRecurring,
"EventType": event.EventType,
"ParticipantsList": event.Attendees,
"EventRecurrence": event.EventRecurrence,
"HasAttachments": event.HasAttachments,
"CalendarId": calendarId,
"Role": role,
"wxUserID": userId,
"TimeZone": "W. Central Africa Standard Time"
},
"Attachments": attachments,
"InstanceID": "AGD_" + this.loggeduser.UserName + "_" + this.processeService.generateInstaceFormatDate()
}
return toAproveObject;
}
}
@@ -157,9 +157,8 @@ export class EditGroupPage implements OnInit {
{
name: 'minutes',
prefix: 'Minutos',
selectedIndex: 3,
selectedIndex: 0,
options: [
{ text: '0', value: 0 },
{ text: '5', value: 5 },
{ text: '10', value: 10 },
{ text: '15', value: 15 },
@@ -820,9 +820,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
console.error(error);
})));
const blob = this.fileService.base64toBlob(encodedData, file.type)
const fileBase64 = await this._getBase64(file)
const formData = new FormData();
formData.append('blobFile', blob);
@@ -841,7 +838,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: fileBase64
fileBase64: encodedData
}
});
@@ -1084,7 +1081,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, 'application/pdf')
const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
@@ -1097,7 +1094,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
await Filesystem.writeFile({
path: fileName,
data: pdfString,
directory: Directory.Documents,
directory: Directory.Data,
}).then((dir) => {
console.log('DIR ', dir)
this.fileOpener
+17 -9
View File
@@ -829,24 +829,32 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
console.log(file)
/* const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
console.error(error);
})));
const blob = this.fileService.base64toBlob(encodedData, file.type)
const fileBase64 = await this._getBase64(file)
const formData = new FormData();
formData.append('blobFile', blob);
console.log('add file', fileBase64) */
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
console.log('TYPE',file.type)
const encodedData = 'data:application/pdf;base64,'+btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
console.error(error);
})));
console.log(encodedData)
const blob = this.fileService.base64toBlob(encodedData, file.type)
console.log('BLOB BLOB',blob)
/* const fileBase64 = await this._getBase64(file)
console.log('BASE&$',fileBase64) */
/* const formData = new FormData();
console.log('add file', formData)
formData.append('blobFile', blob); */
let ob = {'blobFile': blob}
const formData = new FormData();
formData.append('blobFile', blob);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getDmRoom(roomId).send({
file: {
@@ -859,7 +867,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// "text": "description",
"title_link_download": false,
}],
temporaryData: ob,
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
@@ -287,9 +287,8 @@ export class NewGroupPage implements OnInit {
{
name: 'minutes',
prefix: 'Minutos',
selectedIndex: 3,
selectedIndex: 0,
options: [
{ text: '0', value: 0 },
{ text: '5', value: 5 },
{ text: '10', value: 10 },
{ text: '15', value: 15 },
+2 -2
View File
@@ -245,8 +245,8 @@
<div></div>
</div>
<div class="schedule-details">
<div class="location">{{event.Subject}}</div>
<div class="description">
<div class="description">{{event.Subject}}</div>
<div class="location">
<p>{{event.Location}}</p>
</div>
</div>
@@ -22,11 +22,11 @@
</div>
<div class="buttons">
<button (click)="openAddNoteModal('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button>
<div class="solid"></div>
<!-- <div class="solid"></div> -->
</div>
<div class="buttons">
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<div class="solid"></div>
<!-- <button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button> -->
<!-- <div class="solid"></div> -->
</div>
</div>
@@ -113,5 +113,6 @@
<button class="btn-cancel cursor-pointer" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Enviar para Revisão</button>
<button class="btn-no-color cursor-pointer" shape="round" (click)="openMenu()"> <ion-icon name="ellipsis-vertical-outline"></ion-icon></button>
<button class="btn-cancel cursor-pointer" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button>
<button class="btn-cancel cursor-pointer" shape="round" (click)="rejectTask(loadedEvent.serialNumber)">Eliminar</button>
</div>
</ion-footer>
@@ -127,14 +127,14 @@ export class ApproveEventModalPage implements OnInit {
async rejectTask(serialNumber:string) {
let body = { "serialNumber": serialNumber, "action": "Descartar" }
let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage('Evento rejeitado', () =>{
this.toastService._successMessage('Evento Eliminado!', () =>{
this.router.navigate(['/home/gabinete-digital/event-list']);
})
} catch (error) {
@@ -4,7 +4,7 @@
<div class="pl-20 pr-20 text-center d-flex justify-center align-center" style="width:100%; height: 30px; background-color: var(--Event-approve-header-color); border-top-right-radius: 25px;border-top-left-radius: 25px;">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons font-28" src="assets/images/icons-received-event.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov'" class="right-icons font-28" src="assets/images/theme/gov/icons-received-event.svg"></ion-icon>
<div style="color: white;">
<div style="color: black;">
Evento Pendente de Aprovação
</div>
</div>
@@ -62,7 +62,7 @@ export class ExpedienteDetailPage implements OnInit {
onlinecheck: boolean;
loggeduser: LoginUserRespose;
constructor(
private processes: ProcessesService,
private router: Router,
@@ -84,7 +84,7 @@ export class ExpedienteDetailPage implements OnInit {
) {
this.loggeduser = SessionStore.user
// console.log('SessionStore', SessionStore)
this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) {
this.serialNumber = params["params"].SerialNumber;
@@ -114,13 +114,13 @@ export class ExpedienteDetailPage implements OnInit {
// updateProcessDB(res) {
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.set('expediente_details',res).then(() =>{
// })
// } else {
// //this.sqliteservice.updateProcess(res)
// }
// }
// getFromDB() {
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.get('expediente_details').then((process) => {
@@ -165,7 +165,7 @@ export class ExpedienteDetailPage implements OnInit {
// this.platform.ready().then(() => {
// this.onlinecheck = false;
// this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
// var workflow = JSON.parse(process[0].workflowInstanceDataFields);
// var origina
@@ -229,7 +229,7 @@ export class ExpedienteDetailPage implements OnInit {
"AttachmentList": documents,
}
const loader = this.toastService.loading()
@@ -283,7 +283,7 @@ export class ExpedienteDetailPage implements OnInit {
component: AddNotePage,
componentProps: {
showAttachmentBtn: false,
actionName:actionName
actionName: actionName
},
cssClass: classs,
//backdropDismiss: true
@@ -292,7 +292,7 @@ export class ExpedienteDetailPage implements OnInit {
modal.onDidDismiss().then(res => {
if (res.data) {
const DocumentToSave = res.data.documents.map((e) => {
return {
@@ -337,7 +337,7 @@ export class ExpedienteDetailPage implements OnInit {
sendExpedienteToPending() {
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.httpErroHandle.httpsSucessMessagge('Enviar para Pendentes')
this.TaskService.loadExpedientes()
this.goBack();
@@ -352,7 +352,7 @@ export class ExpedienteDetailPage implements OnInit {
async LoadTaskDetail(serial: string) {
this.processes.GetTask(serial).subscribe(res => {
this.TaskService.loadExpedientes();
this.task = {
@@ -444,11 +444,11 @@ export class ExpedienteDetailPage implements OnInit {
// }
getAttachments(serialNumber) {
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res => {
this.attachments = res;
});
}
@@ -472,9 +472,10 @@ export class ExpedienteDetailPage implements OnInit {
if (res) {
const data = res.data;
this.documents.push(data.selected);
await this.documents.forEach( async (element: any) => {
let body
await this.documents.forEach(async (element: any) => {
let body = {
body = {
"InstanceID": this.task.InstanceID,
"WorkflowDisplayName": this.task.WorkflowName,
"FolderID": this.task.FolderId,
@@ -485,22 +486,22 @@ export class ExpedienteDetailPage implements OnInit {
const Attachments = this.searchDocumentPipe.transformToAttachment(element)
body.Attachments = Attachments;
const loader = this.toastService.loading()
try {
loader.remove()
await this.attachmentsService.AddAttachment(body).toPromise()
this.toastService._successMessage()
} catch(error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
}
});
const loader = this.toastService.loading()
try {
loader.remove()
await this.attachmentsService.AddAttachment(body).toPromise()
this.toastService._successMessage()
} catch (error) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
}
}
setTimeout(() => {
this.LoadTaskDetail(this.serialNumber);
@@ -563,8 +564,8 @@ export class ExpedienteDetailPage implements OnInit {
});
modal.onDidDismiss().then(async (res) => {
if (body == 'descartar') {
this.TaskService.loadExpedientes()
@@ -577,10 +578,10 @@ export class ExpedienteDetailPage implements OnInit {
this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não descartado')
}
} finally {
@@ -601,10 +602,10 @@ export class ExpedienteDetailPage implements OnInit {
//this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não descartado')
}
} finally {
@@ -613,17 +614,17 @@ export class ExpedienteDetailPage implements OnInit {
}
else if (res['data'] == 'No') {
const loader = this.toastService.loading()
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService._successMessage();
this.goBack();
} catch (error) {
if(error.status == 0) {
if (error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally {
@@ -639,7 +640,7 @@ export class ExpedienteDetailPage implements OnInit {
}
async openBookMeetingModal(task: any) {
let classs;
if (window.innerWidth < 701) {
@@ -651,7 +652,7 @@ export class ExpedienteDetailPage implements OnInit {
component: BookMeetingModalPage,
componentProps: {
task: this.task,
fulltask:this.fulltask
fulltask: this.fulltask
},
cssClass: classs,
backdropDismiss: false
@@ -671,7 +672,7 @@ export class ExpedienteDetailPage implements OnInit {
}
async viewEventDetail(eventId: any) {
const modal = await this.modalController.create({
component: ViewEventPage,
@@ -722,7 +723,7 @@ export class ExpedienteDetailPage implements OnInit {
this.dataService.set("newGroupName", this.task.Folio);
this.dataService.set("documents", this.fulltask.Documents);
this.dataService.set("link", window.location.pathname);
setTimeout(()=> {
setTimeout(() => {
this.router.navigate(['/home/chat']);
}, 100)
}
@@ -739,12 +740,12 @@ export class ExpedienteDetailPage implements OnInit {
});
modal.onDidDismiss().then(
()=>{},
() => { },
(error) => {
console.log(error)
})
await modal.present();
await modal.present();
}
}