This commit is contained in:
Peter Maquiran
2021-12-06 15:15:34 +01:00
19 changed files with 388 additions and 206 deletions
+58 -26
View File
@@ -233,7 +233,7 @@ export class AgendaPage implements OnInit {
ngOnInit() {
this.getFromDB();
//this.getFromDB();
const pathname = window.location.pathname
let realoadCounter = 0
@@ -243,7 +243,7 @@ export class AgendaPage implements OnInit {
this.segment = "Combinado";
}
if (realoadCounter != 0) {
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
realoadCounter++;
}
@@ -515,6 +515,7 @@ export class AgendaPage implements OnInit {
console.log('CALENDAR STORE', this.CalendarStore.eventSource)
this.listToPresent = this.CalendarStore.eventSource
this.trasnformData(response, 'md');
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -537,12 +538,15 @@ export class AgendaPage implements OnInit {
else if (this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
this.addEventToDB(response, "pr");
this.CalendarStore.removeRange(startTime, endTime, 'pr')
// calendar
this.CalendarStore.pushEvent(response, 'pr');
this.listToPresent = this.CalendarStore.eventSource
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
@@ -555,9 +559,9 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
this.showLoader = false;
})
.finally(() => {
this.showLoader = false;
})
}
else if (this.loggeduser.Profile == 'PR') {
@@ -571,6 +575,7 @@ export class AgendaPage implements OnInit {
// startTime = 1, endTime = 31
this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(response, 'pr');
this.listToPresent = this.CalendarStore.eventSource
@@ -603,12 +608,14 @@ export class AgendaPage implements OnInit {
this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
this.addEventToDB(response, "md");
let eventsList = response;
this.CalendarStore.removeRange(startTime, endTime, 'md')
// loop
this.CalendarStore.pushEvent(eventsList, 'md');
this.listToPresent = this.CalendarStore.eventSource
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -628,23 +635,26 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
this.eventService.getAllSharedEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
this.addEventToDB(response, "pr");
let eventsList = response;
// clear the current month only
this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(eventsList, 'pr');
this.listToPresent = this.CalendarStore.eventSource
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
@@ -663,18 +673,19 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
}
})
} else {
// view PR calendar with PR profile
this.eventService.getAllPrEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then((response: any) => {
this.addEventToDB(response, "pr");
let eventsList;
if (this.segment == 'Oficial') {
eventsList = response.filter(data => data.CalendarName == "Oficial");
@@ -708,18 +719,19 @@ export class AgendaPage implements OnInit {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
if (counter == 1 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
}
})
.finally(() => {
if (counter == 1 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
}
})
}
}
}
trasnformData(response,profile) {
trasnformData(response, profile) {
console.log('Transform ', response)
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
@@ -736,6 +748,25 @@ export class AgendaPage implements OnInit {
console.log('LIST TO PRESET', this.listToPresent)
}
//Deve ser removido para ficar só um method transform
trasnformDataDB(response) {
console.log('Transform ', response)
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.Profile,
id: element.EventId,
}
this.array.push(event)
});
this.listToPresent = this.array;
console.log('LIST TO PRESET', this.listToPresent)
}
addEventToDB(response, profile) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
@@ -756,7 +787,7 @@ export class AgendaPage implements OnInit {
Profile: profile
}
this.sqliteservice.addEvent(event)
});
}
}
@@ -767,7 +798,8 @@ export class AgendaPage implements OnInit {
this.sqliteservice.getAllEvents().then((events: any[]) => {
console.log('ALL EVENTS FROM DB', events)
let eventArray = [];
this.trasnformData(events,this.profile)
this.trasnformDataDB(events)
this.updateEventListBox()
this.myCal.update();
@@ -816,7 +848,7 @@ export class AgendaPage implements OnInit {
case "Oficial":
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, {})
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, {segment: this.segment, selectedDate: this.eventSelectedDate})
} else {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
@@ -633,7 +633,7 @@ touchStart(card) {
cssClass: 'transparent-modal',
componentProps: {
image: img.attachments[0].image_url,
username: img.u.username,
username: img.u.name,
_updatedAt: img._updatedAt
}
});
+13 -13
View File
@@ -24,7 +24,7 @@ import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
import { SocialSharing } from '@ionic-native/social-sharing/ngx';
// import { SocialSharing } from '@ionic-native/social-sharing/ngx';
import { Share } from '@capacitor/share';
const IMAGE_DIR = 'stored-images';
@@ -91,7 +91,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processes: ProcessesService,
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef,
private socialSharing: SocialSharing
// private socialSharing: SocialSharing
) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId');
@@ -643,10 +643,10 @@ touchStart(card) {
async openPreview(msg) {
const modal = await this.modalController.create({
component: PreviewCameraPage,
cssClass: 'transparent-modal',
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
username: msg.u.username,
username: msg.u.name,
_updatedAt: msg._updatedAt,
}
@@ -675,15 +675,15 @@ getPicture(img){
}
async ShareEmail(msg){
// Check if sharing via email is supported
await Share.share({
title: msg.u.username,
text: msg._updatedAt,
url: msg.attachments[0].image_url,
dialogTitle: 'Share with buddies',
});
}
// async ShareEmail(msg){
// // Check if sharing via email is supported
// await Share.share({
// title: msg.u.username,
// text: msg._updatedAt,
// url: msg.attachments[0].image_url,
// dialogTitle: 'Share with buddies',
// });
// }
}
+22 -14
View File
@@ -197,10 +197,13 @@ export class EventsPage implements OnInit {
this.showLoader = true;
let date = new Date();
date.setMonth(date.getMonth() + 1);
let start = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let end = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " 23:59:59";
let month = date.getMonth() + 1;
//date.setMonth(date.getMonth() + 1);
let start = date.getFullYear() + "-" + month + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let end = date.getFullYear() + "-" + month + "-" + date.getDate() + " 23:59:59";
console.log('Data start yahaya', start)
console.log('Data end yahaya', end)
if (this.loggeduser.Profile == 'MDGPR') {
@@ -368,8 +371,9 @@ export class EventsPage implements OnInit {
getEventsFromLocalDb() {
let date = new Date();
date.setMonth(date.getMonth() + 1);
let dateToday = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate();
let month = date.getMonth() + 1;
//date.setMonth(date.getMonth() + 1);
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
console.log('dateeeeee', dateToday)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
@@ -420,16 +424,20 @@ export class EventsPage implements OnInit {
var expedientlist: any = new Array();
process.forEach((element) => {
let task = {
activityInstanceName: element.activityInstanceName,
deadline: null,
serialNumber: element.serialNumber,
taskStartDate: element.taskStartDate,
totalDocuments: element.totalDocuments,
workflowDisplayName: element.workflowDisplayName,
workflowInstanceDataFields: JSON.parse(element.workflowInstanceDataFields)
if(JSON.parse(element.workflowInstanceDataFields).TaskMessage || JSON.parse(element.workflowInstanceDataFields).Note) {
let task = {
activityInstanceName: element.activityInstanceName,
deadline: null,
serialNumber: element.serialNumber,
taskStartDate: element.taskStartDate,
totalDocuments: element.totalDocuments,
workflowDisplayName: element.workflowDisplayName,
workflowInstanceDataFields: JSON.parse(element.workflowInstanceDataFields)
}
expedientlist.push(task);
}
expedientlist.push(task);
})
console.log('OFOFOFOOF22222', expedientlist)
@@ -148,6 +148,24 @@ export class ExpedienteDetailPage implements OnInit {
"InstanceID": workflow.InstanceID
}
this.fulltask = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
interveners: process[0].interveners,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName,
}
})
})
}
@@ -341,7 +359,7 @@ export class ExpedienteDetailPage implements OnInit {
})
console.log('this.task', this.task.InstanceID)
console.log('this.task.DocumentURL', this.task.DocumentURL)
console.log('this.task.DocumentURL', this.fulltask)
}, (error) => {
@@ -615,21 +633,21 @@ export class ExpedienteDetailPage implements OnInit {
return await popover.present();
}
openNewGroupPage(){
openNewGroupPage() {
this.router.navigate(['/home/chat']);
this.dataService.set("newGroup", true);
if( window.innerWidth < 801){
if (window.innerWidth < 801) {
this.newGroup();
}
else{
else {
this.dataService.set("newGroup", true);
/* this.closeAllDesktopComponents();
this.showNewGroup=true; */
}
}
async newGroup(){
async newGroup() {
const modal = await this.modalController.create({
component: NewGroupPage,
cssClass: 'modal modal-desktop',
@@ -126,7 +126,6 @@ export class PublicationDetailPage implements OnInit {
}
async editPost(publicationType:any) {
console.log(this.publication);
const modal = await this.modalController.create({
@@ -68,8 +68,7 @@ export class ViewPublicationsPage implements OnInit {
if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId']
}
this.getPublicationsIds()
this.testForkJoin()
this.getPublicationDetail();
setTimeout(() => {
this.getPublicationsIds();
@@ -77,7 +76,7 @@ export class ViewPublicationsPage implements OnInit {
this.backgroundservice.registerBackService('Online', () => {
this.getPublicationDetail();
this.getPublicationsIds();
this.testForkJoin()
})
@@ -94,14 +93,14 @@ export class ViewPublicationsPage implements OnInit {
// }
this.testForkJoin()
this.getPublicationDetail();
this.getPublicationsIds();
// this.getPublicationsIds();
}
doRefresh = (event) => {
setTimeout(() => {
this.testForkJoin()
this.getPublicationDetail();
this.getPublicationsIds();
// this.getPublicationsIds();
event.target.complete();
}, 3000);
@@ -129,35 +128,35 @@ export class ViewPublicationsPage implements OnInit {
}
// goes to fork
getPublicationsIds() {
this.showLoader = true;
const folderId = this.folderId
this.publications.GetIdsPublicationsImages(this.id).subscribe(res => {
console.log(this.id)
this.publicationList = new Array();
// getPublicationsIds() {
// this.showLoader = true;
// const folderId = this.folderId
// this.publications.GetPublicationsID(this.folderId).subscribe(res => {
// this.publications.GetIdsPublicationsImages(this.id).subscribe(res => {
// console.log(this.id)
// console.log('publications ids', res)
// this.publicationList = new Array();
// for(let i of res) {
// this.publications.GetPublicationById(i).subscribe(ress => {
// console.log('publications by ids', ress)
// let item: Publication = this.publicationPipe.itemList(ress)
// console.log('publications by ids 2', item)
// this.publicationList.push(item);
// })
// }
getPublicationsIds() {
this.showLoader = true;
const folderId = this.folderId
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
console.log('publications ids', res)
this.publicationList = new Array();
for(let i of res) {
this.publications.GetPublicationById(i).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(item);
})
}
/* res.forEach(element => {
console.log('publications elements', element)