mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Removed synchro services
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<name>gabinete digital</name>
|
<name>gabinete digital</name>
|
||||||
<description>An awesome Ionic/Cordova app.</description>
|
<description>An awesome Ionic/Cordova app.</description>
|
||||||
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
||||||
<content original-src="index.html" src="http://localhost:8100" />
|
<content src="index.html" />
|
||||||
<access origin="*" />
|
<access origin="*" />
|
||||||
<allow-navigation href="*" />
|
<allow-navigation href="*" />
|
||||||
<allow-navigation href="*" />
|
<allow-navigation href="*" />
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { AuthService } from 'src/app/services/auth.service';
|
|||||||
import { ChatService } from 'src/app/services/chat.service';
|
import { ChatService } from 'src/app/services/chat.service';
|
||||||
import { FileService } from 'src/app/services/functions/file.service';
|
import { FileService } from 'src/app/services/functions/file.service';
|
||||||
import { ProcessesService } from 'src/app/services/processes.service';
|
import { ProcessesService } from 'src/app/services/processes.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
import { NewEventPage } from 'src/app/shared/agenda/new-event/new-event.page';
|
import { NewEventPage } from 'src/app/shared/agenda/new-event/new-event.page';
|
||||||
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
|
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
|
||||||
@@ -45,7 +44,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
members:any;
|
members:any;
|
||||||
scrollingOnce:boolean = true;
|
scrollingOnce:boolean = true;
|
||||||
|
|
||||||
synchro = synchro;
|
|
||||||
chatMessageStore = ChatMessageStore
|
chatMessageStore = ChatMessageStore
|
||||||
chatUserStorage = ChatUserStorage
|
chatUserStorage = ChatUserStorage
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
|
|||||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from '../../services/socket/synchro.service';
|
|
||||||
import { NetworkConnectionService } from 'src/app/services/network-connection.service'
|
import { NetworkConnectionService } from 'src/app/services/network-connection.service'
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
@@ -79,7 +78,6 @@ export class EventsPage implements OnInit {
|
|||||||
loggeduser: LoginUserRespose;
|
loggeduser: LoginUserRespose;
|
||||||
|
|
||||||
existingScreenOrientation: string;
|
existingScreenOrientation: string;
|
||||||
synch = synchro
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private eventService: EventsService,
|
private eventService: EventsService,
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { DespachoService } from 'src/app/Rules/despacho.service';
|
|||||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||||
|
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import { AttachmentList } from 'src/app/models/Excludetask';
|
|||||||
import { PermissionService } from 'src/app/services/worker/permission.service';
|
import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||||
|
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
@@ -47,8 +46,6 @@ export class DespachoPage implements OnInit {
|
|||||||
intervenientes: any;
|
intervenientes: any;
|
||||||
cc: any = [];
|
cc: any = [];
|
||||||
|
|
||||||
synch = synchro;
|
|
||||||
|
|
||||||
constructor(private activateRoute: ActivatedRoute,
|
constructor(private activateRoute: ActivatedRoute,
|
||||||
private processes: ProcessesService,
|
private processes: ProcessesService,
|
||||||
private iab: InAppBrowser,
|
private iab: InAppBrowser,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { DespachoService } from 'src/app/Rules/despacho.service';
|
|||||||
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
import { DespachoStore } from 'src/app/store/despacho-store.service';
|
||||||
|
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
import { isThisHour } from 'date-fns';
|
import { isThisHour } from 'date-fns';
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
@@ -18,7 +17,6 @@ import { BackgroundService } from 'src/app/services/background.service';
|
|||||||
export class DespachosPage implements OnInit {
|
export class DespachosPage implements OnInit {
|
||||||
|
|
||||||
despachoStore = DespachoStore;
|
despachoStore = DespachoStore;
|
||||||
synch = synchro;
|
|
||||||
listToPresent = [];
|
listToPresent = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { Location } from '@angular/common';
|
|||||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||||
|
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import { PermissionService } from 'src/app/services/worker/permission.service';
|
|||||||
|
|
||||||
|
|
||||||
import { SqliteService } from '../../services/sqlite.service';
|
import { SqliteService } from '../../services/sqlite.service';
|
||||||
import { synchro } from '../../services/socket/synchro.service';
|
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
import { BackgroundService } from 'src/app/services/background.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
@@ -110,9 +109,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
|
|||||||
//
|
//
|
||||||
// pipe
|
// pipe
|
||||||
|
|
||||||
synch = synchro;
|
|
||||||
|
|
||||||
|
|
||||||
customTaskPipe = new CustomTaskPipe()
|
customTaskPipe = new CustomTaskPipe()
|
||||||
|
|
||||||
@ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage;
|
@ViewChild(ExpedientsPage) expedientesPage: ExpedientsPage;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
|
|||||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -28,7 +28,8 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
private animationController: AnimationController,
|
private animationController: AnimationController,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private sqliteservice: SqliteService ) {
|
private sqliteservice: SqliteService,
|
||||||
|
private backgroundservice: BackgroundService ) {
|
||||||
|
|
||||||
this.publicationId = this.navParams.get('publicationId');
|
this.publicationId = this.navParams.get('publicationId');
|
||||||
/* this.folderId = this.navParams.get('folderIdId'); */
|
/* this.folderId = this.navParams.get('folderIdId'); */
|
||||||
@@ -81,11 +82,7 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
if(synchro.connected === true) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
|||||||
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
|
||||||
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-publications',
|
selector: 'app-publications',
|
||||||
@@ -64,14 +64,28 @@ export class PublicationsPage implements OnInit {
|
|||||||
private animationController: AnimationController,
|
private animationController: AnimationController,
|
||||||
private publications: PublicationsService,
|
private publications: PublicationsService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
private sqliteservice: SqliteService
|
private sqliteservice: SqliteService,
|
||||||
|
private backgroundservice: BackgroundService
|
||||||
) {
|
) {
|
||||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getFromDB();
|
|
||||||
|
const pathname = window.location.pathname
|
||||||
|
|
||||||
|
this.router.events.forEach((event) => {
|
||||||
|
if (event instanceof NavigationEnd && event.url == pathname) {
|
||||||
|
this.getActions();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.hideRefreshButton();
|
||||||
|
|
||||||
|
this.backgroundservice.registerBackService('Online', () => {
|
||||||
|
this.getActions();
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hideRefreshButton() {
|
hideRefreshButton() {
|
||||||
@@ -153,50 +167,40 @@ export class PublicationsPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}, (error) => {
|
||||||
|
this.getFromDB();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
|
|
||||||
if (synchro.connected === true) {
|
this.sqliteservice.getAllActions().then((actions: any[]) => {
|
||||||
const pathname = window.location.pathname
|
|
||||||
|
|
||||||
this.router.events.forEach((event) => {
|
console.log('offline publi', actions)
|
||||||
if (event instanceof NavigationEnd && event.url == pathname) {
|
|
||||||
this.getActions();
|
this.publicationsEventFolderList = new Array();
|
||||||
|
this.publicationsTravelFolderList = new Array();
|
||||||
|
|
||||||
|
actions.forEach(data => {
|
||||||
|
let folder: PublicationFolder = {
|
||||||
|
ProcessId: data.ProcessId,
|
||||||
|
Description: data.Description,
|
||||||
|
Detail: data.Detail,
|
||||||
|
DateBegin: data.DateBegin,
|
||||||
|
DateEnd: data.DateEnd,
|
||||||
|
ActionType: data.ActionType,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.ActionType == "Evento") {
|
||||||
|
this.publicationsEventFolderList.push(folder);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.publicationsTravelFolderList.push(folder);
|
||||||
|
}
|
||||||
|
this.showLoader = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.hideRefreshButton();
|
})
|
||||||
} else {
|
|
||||||
this.sqliteservice.getAllActions().then((actions: any[]) => {
|
|
||||||
|
|
||||||
console.log('offline publi', actions)
|
|
||||||
|
|
||||||
this.publicationsEventFolderList = new Array();
|
|
||||||
this.publicationsTravelFolderList = new Array();
|
|
||||||
|
|
||||||
actions.forEach(data => {
|
|
||||||
let folder: PublicationFolder = {
|
|
||||||
ProcessId: data.ProcessId,
|
|
||||||
Description: data.Description,
|
|
||||||
Detail: data.Detail,
|
|
||||||
DateBegin: data.DateBegin,
|
|
||||||
DateEnd: data.DateEnd,
|
|
||||||
ActionType: data.ActionType,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.ActionType == "Evento") {
|
|
||||||
this.publicationsEventFolderList.push(folder);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.publicationsTravelFolderList.push(folder);
|
|
||||||
}
|
|
||||||
this.showLoader = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async editAction(folderId?: string) {
|
async editAction(folderId?: string) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-f
|
|||||||
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
||||||
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
|
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
|
||||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-view-publications',
|
selector: 'app-view-publications',
|
||||||
@@ -42,7 +42,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
private publications: PublicationsService,
|
private publications: PublicationsService,
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private sqliteservice: SqliteService) {
|
private sqliteservice: SqliteService,
|
||||||
|
private backgroundservice: BackgroundService) {
|
||||||
|
|
||||||
this.item = new PublicationFolder();
|
this.item = new PublicationFolder();
|
||||||
this.activatedRoute.paramMap.subscribe(params => {
|
this.activatedRoute.paramMap.subscribe(params => {
|
||||||
@@ -63,7 +64,16 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.folderId = this.folderId['ProcessId']
|
this.folderId = this.folderId['ProcessId']
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getFromDB();
|
this.getPublicationDetail();
|
||||||
|
setTimeout(() => {
|
||||||
|
this.getPublications();
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
this.backgroundservice.registerBackService('Online',() => {
|
||||||
|
this.getPublicationDetail();
|
||||||
|
this.getPublications();
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +139,9 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
if(error.status == '0') {
|
||||||
|
this.getFromDB();
|
||||||
|
}
|
||||||
if (error.status == '404') {
|
if (error.status == '404') {
|
||||||
this.error = 'Sem publicações disponíveis!';
|
this.error = 'Sem publicações disponíveis!';
|
||||||
this.publicationList = [];
|
this.publicationList = [];
|
||||||
@@ -142,47 +155,38 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
if (synchro.connected === true) {
|
|
||||||
this.getPublicationDetail();
|
|
||||||
setTimeout(() => {
|
|
||||||
this.getPublications();
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
} else {
|
this.sqliteservice.getActionById(this.folderId).then((publications) => {
|
||||||
|
console.log('publications', publications)
|
||||||
|
let item = {
|
||||||
|
ActionType: publications[0].ActionType,
|
||||||
|
DateBegin: publications[0].DateBegin,
|
||||||
|
DateEnd: publications[0].DateEnd,
|
||||||
|
Description: publications[0].Description,
|
||||||
|
Detail: publications[0].Detail,
|
||||||
|
ProcessId: publications[0].ProcessId
|
||||||
|
}
|
||||||
|
this.publicationDitails = item;
|
||||||
|
|
||||||
this.sqliteservice.getActionById(this.folderId).then((publications) => {
|
let publicationArray = [];
|
||||||
console.log('publications', publications)
|
JSON.parse(publications[0].publications).forEach(element => {
|
||||||
let item = {
|
let publicationlis = {
|
||||||
ActionType: publications[0].ActionType,
|
DateIndex: element.DateIndex,
|
||||||
DateBegin: publications[0].DateBegin,
|
DatePublication: element.DatePublication,
|
||||||
DateEnd: publications[0].DateEnd,
|
DocumentId: element.DocumentId,
|
||||||
Description: publications[0].Description,
|
FileBase64: element.FileBase64,
|
||||||
Detail: publications[0].Detail,
|
FileExtension: element.FileExtension,
|
||||||
ProcessId: publications[0].ProcessId
|
Message: element.Message,
|
||||||
|
OrganicEntityId: element.OrganicEntityId,
|
||||||
|
OriginalFileName: element.OriginalFileName,
|
||||||
|
ProcessId: element.ProcessId
|
||||||
}
|
}
|
||||||
this.publicationDitails = item;
|
publicationArray.push(publicationlis);
|
||||||
|
|
||||||
let publicationArray = [];
|
});
|
||||||
JSON.parse(publications[0].publications).forEach(element => {
|
|
||||||
let publicationlis = {
|
|
||||||
DateIndex: element.DateIndex,
|
|
||||||
DatePublication: element.DatePublication,
|
|
||||||
DocumentId: element.DocumentId,
|
|
||||||
FileBase64: element.FileBase64,
|
|
||||||
FileExtension: element.FileExtension,
|
|
||||||
Message: element.Message,
|
|
||||||
OrganicEntityId: element.OrganicEntityId,
|
|
||||||
OriginalFileName: element.OriginalFileName,
|
|
||||||
ProcessId: element.ProcessId
|
|
||||||
}
|
|
||||||
publicationArray.push(publicationlis);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.getpublication = publicationArray;
|
this.getpublication = publicationArray;
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async AddPublication(publicationType: any, folderId: any) {
|
async AddPublication(publicationType: any, folderId: any) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core';
|
|||||||
export class BackgroundService {
|
export class BackgroundService {
|
||||||
|
|
||||||
callBacks: {
|
callBacks: {
|
||||||
type: 'Offline' | 'Online',
|
type: 'Offline' | 'Online' | 'Notification',
|
||||||
object?: string
|
object?: string
|
||||||
funx: Function
|
funx: Function
|
||||||
}[] = []
|
}[] = []
|
||||||
@@ -39,7 +39,7 @@ export class BackgroundService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
registerBackService(type: 'Offline' | 'Online', funx: Function, object = '') {
|
registerBackService(type: 'Offline' | 'Online' | 'Notification', funx: Function, object = '') {
|
||||||
this.callBacks.push({
|
this.callBacks.push({
|
||||||
type,
|
type,
|
||||||
funx,
|
funx,
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Event, EventToApproveEdit } from '../models/event.model';
|
import { Event, EventToApproveEdit } from '../models/event.model';
|
||||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||||
import { Observable, from} from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { AuthService } from '../services/auth.service';
|
import { AuthService } from '../services/auth.service';
|
||||||
import { UserSession } from '../models/user.model';
|
import { UserSession } from '../models/user.model';
|
||||||
import { EventList } from '../models/agenda/AgendaEventList';
|
import { EventList } from '../models/agenda/AgendaEventList';
|
||||||
import { ChangeProfileService } from './change-profile.service';
|
import { ChangeProfileService } from './change-profile.service';
|
||||||
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
|
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { catchError } from "rxjs/operators";
|
import { catchError } from "rxjs/operators";
|
||||||
import { Storage } from '@ionic/storage';
|
import { Storage } from '@ionic/storage';
|
||||||
|
import { BackgroundService } from 'src/app/services/background.service';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -32,12 +32,12 @@ export class EventsService {
|
|||||||
headersSharedPessoal: HttpHeaders;
|
headersSharedPessoal: HttpHeaders;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
public user: AuthService,
|
public user: AuthService,
|
||||||
private changeProfileService: ChangeProfileService,
|
private changeProfileService: ChangeProfileService,
|
||||||
private offlinemanager: OfflineManagerService,
|
private offlinemanager: OfflineManagerService,
|
||||||
private storage: Storage)
|
private storage: Storage,
|
||||||
{
|
private backgroundservice: BackgroundService) {
|
||||||
|
|
||||||
this.loggeduser = this.user.ValidatedUser;
|
this.loggeduser = this.user.ValidatedUser;
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ export class EventsService {
|
|||||||
this.headersSharedOficial = new HttpHeaders();
|
this.headersSharedOficial = new HttpHeaders();
|
||||||
this.headersSharedPessoal = new HttpHeaders();
|
this.headersSharedPessoal = new HttpHeaders();
|
||||||
|
|
||||||
|
|
||||||
this.setHeader()
|
this.setHeader()
|
||||||
this.changeProfileService.registerCallback(()=>{
|
this.changeProfileService.registerCallback(() => {
|
||||||
this.loggeduser = this.user.ValidatedUser;
|
this.loggeduser = this.user.ValidatedUser;
|
||||||
this.setHeader()
|
this.setHeader()
|
||||||
})
|
})
|
||||||
@@ -61,16 +61,16 @@ export class EventsService {
|
|||||||
|
|
||||||
setHeader() {
|
setHeader() {
|
||||||
|
|
||||||
if(this.loggeduser){
|
if (this.loggeduser) {
|
||||||
if(this.loggeduser.Profile == 'MDGPR') {
|
if (this.loggeduser.Profile == 'MDGPR') {
|
||||||
|
|
||||||
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||||
if(calendar.CalendarName == 'Oficial') {
|
if (calendar.CalendarName == 'Oficial') {
|
||||||
this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
this.headersMdOficial = this.headersMdOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||||
this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId);
|
this.headersMdOficial = this.headersMdOficial.set('CalendarId', calendar.CalendarId);
|
||||||
this.headersMdOficial = this.headersMdOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
this.headersMdOficial = this.headersMdOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||||
}
|
}
|
||||||
else if(calendar.CalendarName == 'Pessoal') {
|
else if (calendar.CalendarName == 'Pessoal') {
|
||||||
this.headersMdPessoal = this.headersMdPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
this.headersMdPessoal = this.headersMdPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||||
this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId);
|
this.headersMdPessoal = this.headersMdPessoal.set('CalendarId', calendar.CalendarId);
|
||||||
this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
this.headersMdPessoal = this.headersMdPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||||
@@ -79,27 +79,27 @@ export class EventsService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.loggeduser.SharedCalendars.forEach(sharedCalendar => {
|
this.loggeduser.SharedCalendars.forEach(sharedCalendar => {
|
||||||
if(sharedCalendar.CalendarName == 'Oficial') {
|
if (sharedCalendar.CalendarName == 'Oficial') {
|
||||||
this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
this.headersSharedOficial = this.headersSharedOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||||
this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
this.headersSharedOficial = this.headersSharedOficial.set('CalendarId', sharedCalendar.CalendarId);
|
||||||
this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
this.headersSharedOficial = this.headersSharedOficial.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||||
}
|
}
|
||||||
else if(sharedCalendar.CalendarName == 'Pessoal') {
|
else if (sharedCalendar.CalendarName == 'Pessoal') {
|
||||||
this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
this.headersSharedPessoal = this.headersSharedPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||||
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
|
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarId', sharedCalendar.CalendarId);
|
||||||
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
this.headersSharedPessoal = this.headersSharedPessoal.set('CalendarRoleId', sharedCalendar.CalendarRoleId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if(this.loggeduser.Profile == 'PR') {
|
else if (this.loggeduser.Profile == 'PR') {
|
||||||
|
|
||||||
this.loggeduser.OwnerCalendars.forEach(calendar =>{
|
this.loggeduser.OwnerCalendars.forEach(calendar => {
|
||||||
if(calendar.CalendarName == 'Oficial'){
|
if (calendar.CalendarName == 'Oficial') {
|
||||||
this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
this.headersPrOficial = this.headersPrOficial.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||||
this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId);
|
this.headersPrOficial = this.headersPrOficial.set('CalendarId', calendar.CalendarId);
|
||||||
this.headersPrOficial = this.headersPrOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
this.headersPrOficial = this.headersPrOficial.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||||
}
|
}
|
||||||
else if(calendar.CalendarName == 'Pessoal') {
|
else if (calendar.CalendarName == 'Pessoal') {
|
||||||
this.headersPrPessoal = this.headersPrPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
this.headersPrPessoal = this.headersPrPessoal.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||||
this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId);
|
this.headersPrPessoal = this.headersPrPessoal.set('CalendarId', calendar.CalendarId);
|
||||||
this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
this.headersPrPessoal = this.headersPrPessoal.set('CalendarRoleId', calendar.CalendarRoleId);
|
||||||
@@ -128,9 +128,9 @@ export class EventsService {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
|
|
||||||
getAllPrOficialEvents(startdate:string, enddate:string): Observable<EventList[]>{
|
getAllPrOficialEvents(startdate: string, enddate: string): Observable<EventList[]> {
|
||||||
let geturl = environment.apiURL + 'calendar/pr';
|
let geturl = environment.apiURL + 'calendar/pr';
|
||||||
geturl = geturl.replace('/V4/','/V5/')
|
geturl = geturl.replace('/V4/', '/V5/')
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -144,9 +144,9 @@ export class EventsService {
|
|||||||
return this.http.get<EventList[]>(`${geturl}`, options);
|
return this.http.get<EventList[]>(`${geturl}`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllPrPessoalEvents(startdate:string, enddate:string): Observable<EventList[]>{
|
getAllPrPessoalEvents(startdate: string, enddate: string): Observable<EventList[]> {
|
||||||
let geturl = environment.apiURL + 'calendar/pr';
|
let geturl = environment.apiURL + 'calendar/pr';
|
||||||
geturl = geturl.replace('/V4/','/V5/')
|
geturl = geturl.replace('/V4/', '/V5/')
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -160,17 +160,17 @@ export class EventsService {
|
|||||||
return this.http.get<EventList[]>(`${geturl}`, options);
|
return this.http.get<EventList[]>(`${geturl}`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllPrEvents(startdate:string, enddate:string): Promise<EventList[]>{
|
async getAllPrEvents(startdate: string, enddate: string): Promise<EventList[]> {
|
||||||
let prO = await this.getAllPrOficialEvents(startdate, enddate).toPromise();
|
let prO = await this.getAllPrOficialEvents(startdate, enddate).toPromise();
|
||||||
let prP = await this.getAllPrPessoalEvents(startdate, enddate).toPromise();
|
let prP = await this.getAllPrPessoalEvents(startdate, enddate).toPromise();
|
||||||
const resFinal = prO.concat(prP);
|
const resFinal = prO.concat(prP);
|
||||||
return new Promise(resolve =>{
|
return new Promise(resolve => {
|
||||||
return resolve(resFinal)
|
return resolve(resFinal)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllMdOficialEvents(startdate:string, enddate:string): Observable<EventList[]>{
|
getAllMdOficialEvents(startdate: string, enddate: string): Observable<EventList[]> {
|
||||||
let geturl = environment.apiURL + 'calendar/md';
|
let geturl = environment.apiURL + 'calendar/md';
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ export class EventsService {
|
|||||||
return this.http.get<EventList[]>(`${geturl}`, options);
|
return this.http.get<EventList[]>(`${geturl}`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllMdPessoalEvents(startdate:string, enddate:string): any{
|
getAllMdPessoalEvents(startdate: string, enddate: string): any {
|
||||||
let geturl = environment.apiURL + 'calendar/md';
|
let geturl = environment.apiURL + 'calendar/md';
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
@@ -199,30 +199,30 @@ export class EventsService {
|
|||||||
return this.http.get<any>(`${geturl}`, options)
|
return this.http.get<any>(`${geturl}`, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllMdEvents(startdate:string, enddate:string) {
|
async getAllMdEvents(startdate: string, enddate: string) {
|
||||||
let prO = await this.getAllMdOficialEvents(startdate, enddate).toPromise();
|
let prO = await this.getAllMdOficialEvents(startdate, enddate).toPromise();
|
||||||
let prP = await this.getAllMdPessoalEvents(startdate, enddate).toPromise();
|
let prP = await this.getAllMdPessoalEvents(startdate, enddate).toPromise();
|
||||||
const resFinal = prO.concat(prP);
|
const resFinal = prO.concat(prP);
|
||||||
return new Promise(resolve =>{
|
return new Promise(resolve => {
|
||||||
return resolve(resFinal)
|
return resolve(resFinal)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllSharedEvents(startdate:string, enddate:string) {
|
async getAllSharedEvents(startdate: string, enddate: string) {
|
||||||
let prO = await this.getAllSharedOficialEvents(startdate, enddate).toPromise();
|
let prO = await this.getAllSharedOficialEvents(startdate, enddate).toPromise();
|
||||||
let prP = await this.getAllSharedPessoalEvents(startdate, enddate).toPromise();
|
let prP = await this.getAllSharedPessoalEvents(startdate, enddate).toPromise();
|
||||||
const resFinal = prO.concat(prP);
|
const resFinal = prO.concat(prP);
|
||||||
|
|
||||||
return new Promise(resolve =>{
|
return new Promise(resolve => {
|
||||||
return resolve(resFinal)
|
return resolve(resFinal)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getAllSharedOficialEvents(startdate:string, enddate:string): Observable<Event[]>{
|
getAllSharedOficialEvents(startdate: string, enddate: string): Observable<Event[]> {
|
||||||
let geturl = environment.apiURL + 'calendar/pr';
|
let geturl = environment.apiURL + 'calendar/pr';
|
||||||
geturl = geturl.replace('/V4/','/V5/')
|
geturl = geturl.replace('/V4/', '/V5/')
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -238,9 +238,9 @@ export class EventsService {
|
|||||||
return this.http.get<Event[]>(`${geturl}`, options);
|
return this.http.get<Event[]>(`${geturl}`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllSharedPessoalEvents(startdate:string, enddate:string): Observable<Event[]>{
|
getAllSharedPessoalEvents(startdate: string, enddate: string): Observable<Event[]> {
|
||||||
let geturl = environment.apiURL + 'calendar/pr';
|
let geturl = environment.apiURL + 'calendar/pr';
|
||||||
geturl = geturl.replace('/V4/','/V5/')
|
geturl = geturl.replace('/V4/', '/V5/')
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ export class EventsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getRecurrenceTypes(): any{
|
getRecurrenceTypes(): any {
|
||||||
const geturl = environment.apiURL + 'Calendar/RecurrenceTypes';
|
const geturl = environment.apiURL + 'Calendar/RecurrenceTypes';
|
||||||
let options = {
|
let options = {
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
@@ -264,7 +264,7 @@ export class EventsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getEvents(calendarname:string, startdate:string, enddate:string): Observable<Event[]>{
|
getEvents(calendarname: string, startdate: string, enddate: string): Observable<Event[]> {
|
||||||
const geturl = environment.apiURL + 'calendar/GetEvents';
|
const geturl = environment.apiURL + 'calendar/GetEvents';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ export class EventsService {
|
|||||||
return this.http.get<Event[]>(`${geturl}`, options);
|
return this.http.get<Event[]>(`${geturl}`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getEvent(eventid: string): Observable<Event>{
|
getEvent(eventid: string): Observable<Event> {
|
||||||
let geturl = environment.apiURL + 'calendar/GetEvent';
|
let geturl = environment.apiURL + 'calendar/GetEvent';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -293,8 +293,7 @@ export class EventsService {
|
|||||||
return this.http.get<Event>(`${geturl}`, options);
|
return this.http.get<Event>(`${geturl}`, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
putEvent(event: Event, conflictResolutionMode:number, sendInvitationsOrCancellationsMode:number, sharedagenda:string): Observable<Event>
|
putEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number, sharedagenda: string): Observable<Event> {
|
||||||
{
|
|
||||||
const puturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'PutEvent');
|
const puturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'PutEvent');
|
||||||
|
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
@@ -310,55 +309,50 @@ export class EventsService {
|
|||||||
return this.http.put<Event>(`${puturl}`, event, options)
|
return this.http.put<Event>(`${puturl}`, event, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
editEvent(event: Event, conflictResolutionMode:number, sendInvitationsOrCancellationsMode:number): Observable<Event>
|
editEvent(event: Event, conflictResolutionMode: number, sendInvitationsOrCancellationsMode: number): Observable<Event> {
|
||||||
{
|
|
||||||
let arrayReq = [];
|
let arrayReq = [];
|
||||||
|
arrayReq.push(event);
|
||||||
const puturl = environment.apiURL + 'calendar/PutEvent';
|
const puturl = environment.apiURL + 'calendar/PutEvent';
|
||||||
if(synchro.connected === false) {
|
let params = new HttpParams();
|
||||||
arrayReq.push(event)
|
|
||||||
return from(this.storage.set('storedreq', arrayReq))
|
|
||||||
} else {
|
|
||||||
let params = new HttpParams();
|
|
||||||
|
|
||||||
params = params.set("conflictResolutionMode", conflictResolutionMode.toString());
|
params = params.set("conflictResolutionMode", conflictResolutionMode.toString());
|
||||||
params = params.set("sendInvitationsOrCancellationsMode", sendInvitationsOrCancellationsMode.toString());
|
params = params.set("sendInvitationsOrCancellationsMode", sendInvitationsOrCancellationsMode.toString());
|
||||||
params.set('CalendarId', event.CalendarId)
|
params.set('CalendarId', event.CalendarId)
|
||||||
params.set('CalendarName', event.CalendarName)
|
params.set('CalendarName', event.CalendarName)
|
||||||
this.headers['CalendarId'] = event.CalendarId
|
this.headers['CalendarId'] = event.CalendarId
|
||||||
this.headers['CalendarName'] = event.CalendarName
|
this.headers['CalendarName'] = event.CalendarName
|
||||||
|
|
||||||
if(event.CalendarName == 'Oficial'){
|
if (event.CalendarName == 'Oficial') {
|
||||||
if(this.loggeduser.Profile == 'MDGPR'){
|
if (this.loggeduser.Profile == 'MDGPR') {
|
||||||
this.headers = this.headersMdOficial;
|
this.headers = this.headersMdOficial;
|
||||||
}
|
|
||||||
else if(this.loggeduser.Profile == 'PR'){
|
|
||||||
this.headers = this.headersPrOficial;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
else if (this.loggeduser.Profile == 'PR') {
|
||||||
if(this.loggeduser.Profile == 'MDGPR'){
|
this.headers = this.headersPrOficial;
|
||||||
this.headers = this.headersMdPessoal;
|
|
||||||
}
|
|
||||||
else if(this.loggeduser.Profile == 'PR'){
|
|
||||||
this.headers = this.headersPrPessoal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let options = {
|
|
||||||
headers: this.headers,
|
|
||||||
params: params
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.http.put<Event>(`${puturl}`, event, options).pipe(
|
|
||||||
catchError(err => {
|
|
||||||
this.offlinemanager.storeRequest(puturl, 'PUT', event);
|
|
||||||
throw new Error(err);
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (this.loggeduser.Profile == 'MDGPR') {
|
||||||
|
this.headers = this.headersMdPessoal;
|
||||||
|
}
|
||||||
|
else if (this.loggeduser.Profile == 'PR') {
|
||||||
|
this.headers = this.headersPrPessoal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = {
|
||||||
|
headers: this.headers,
|
||||||
|
params: params
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.http.put<Event>(`${puturl}`, event, options).pipe(
|
||||||
|
catchError(err => {
|
||||||
|
this.offlinemanager.storeRequest(puturl, 'PUT', arrayReq);
|
||||||
|
throw new Error(err);
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
changeAgenda(body:any){
|
changeAgenda(body: any) {
|
||||||
const puturl = environment.apiURL + 'Calendar/MoveEvent';
|
const puturl = environment.apiURL + 'Calendar/MoveEvent';
|
||||||
let options = {
|
let options = {
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
@@ -381,14 +375,13 @@ export class EventsService {
|
|||||||
return this.http.post<Event>(`${puturl}`, event, options)
|
return this.http.post<Event>(`${puturl}`, event, options)
|
||||||
} */
|
} */
|
||||||
|
|
||||||
postEventMd(event:Event, calendarName:string)
|
postEventMd(event: Event, calendarName: string) {
|
||||||
{
|
|
||||||
const puturl = environment.apiURL + 'calendar/md';
|
const puturl = environment.apiURL + 'calendar/md';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
params = params.set("CalendarName", calendarName);
|
params = params.set("CalendarName", calendarName);
|
||||||
|
|
||||||
let options:any;
|
let options: any;
|
||||||
switch (calendarName) {
|
switch (calendarName) {
|
||||||
case 'Oficial':
|
case 'Oficial':
|
||||||
console.log(calendarName);
|
console.log(calendarName);
|
||||||
@@ -410,14 +403,13 @@ export class EventsService {
|
|||||||
return this.http.post<string>(`${puturl}`, event, options)
|
return this.http.post<string>(`${puturl}`, event, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
postEventPr(event:Event, calendarName:string)
|
postEventPr(event: Event, calendarName: string) {
|
||||||
{
|
|
||||||
const puturl = environment.apiURL + 'calendar/pr';
|
const puturl = environment.apiURL + 'calendar/pr';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
params = params.set("CalendarName", calendarName);
|
params = params.set("CalendarName", calendarName);
|
||||||
|
|
||||||
let options:any;
|
let options: any;
|
||||||
switch (calendarName) {
|
switch (calendarName) {
|
||||||
case 'Oficial':
|
case 'Oficial':
|
||||||
console.log(calendarName);
|
console.log(calendarName);
|
||||||
@@ -439,8 +431,7 @@ export class EventsService {
|
|||||||
return this.http.post<string>(`${puturl}`, event, options)
|
return this.http.post<string>(`${puturl}`, event, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteEvent(eventid:string, eventDeleteType:number, calendarName:string)
|
deleteEvent(eventid: string, eventDeleteType: number, calendarName: string) {
|
||||||
{
|
|
||||||
const puturl = environment.apiURL + 'calendar/DeleteEvent';
|
const puturl = environment.apiURL + 'calendar/DeleteEvent';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
|
|
||||||
@@ -452,13 +443,13 @@ export class EventsService {
|
|||||||
|
|
||||||
switch (this.loggeduser.Profile) {
|
switch (this.loggeduser.Profile) {
|
||||||
case 'MDGPR':
|
case 'MDGPR':
|
||||||
if(calendarName == 'Pessoal'){
|
if (calendarName == 'Pessoal') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersMdPessoal,
|
headers: this.headersMdPessoal,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(calendarName == 'Oficial'){
|
else if (calendarName == 'Oficial') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersMdOficial,
|
headers: this.headersMdOficial,
|
||||||
params: params
|
params: params
|
||||||
@@ -466,13 +457,13 @@ export class EventsService {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'PR':
|
case 'PR':
|
||||||
if(calendarName == 'Pessoal'){
|
if (calendarName == 'Pessoal') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersPrPessoal,
|
headers: this.headersPrPessoal,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(calendarName == 'Oficial'){
|
else if (calendarName == 'Oficial') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersPrOficial,
|
headers: this.headersPrOficial,
|
||||||
params: params
|
params: params
|
||||||
@@ -483,8 +474,8 @@ export class EventsService {
|
|||||||
|
|
||||||
return this.http.delete(`${puturl}`, options)
|
return this.http.delete(`${puturl}`, options)
|
||||||
}
|
}
|
||||||
postExpedientEvent(docId:any, body:any, sharedagenda:string, serialNumber:any, applicationID:any){
|
postExpedientEvent(docId: any, body: any, sharedagenda: string, serialNumber: any, applicationID: any) {
|
||||||
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente')+'/event';
|
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente') + '/event';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
let options;
|
let options;
|
||||||
|
|
||||||
@@ -494,13 +485,13 @@ export class EventsService {
|
|||||||
|
|
||||||
switch (this.loggeduser.Profile) {
|
switch (this.loggeduser.Profile) {
|
||||||
case 'MDGPR':
|
case 'MDGPR':
|
||||||
if(body.CalendarName == 'Pessoal'){
|
if (body.CalendarName == 'Pessoal') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersMdPessoal,
|
headers: this.headersMdPessoal,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(body.CalendarName == 'Oficial'){
|
else if (body.CalendarName == 'Oficial') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersMdOficial,
|
headers: this.headersMdOficial,
|
||||||
params: params
|
params: params
|
||||||
@@ -508,13 +499,13 @@ export class EventsService {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'PR':
|
case 'PR':
|
||||||
if(body.CalendarName == 'Pessoal'){
|
if (body.CalendarName == 'Pessoal') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersPrPessoal,
|
headers: this.headersPrPessoal,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(body.CalendarName == 'Oficial'){
|
else if (body.CalendarName == 'Oficial') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersPrOficial,
|
headers: this.headersPrOficial,
|
||||||
params: params
|
params: params
|
||||||
@@ -524,8 +515,8 @@ export class EventsService {
|
|||||||
}
|
}
|
||||||
return this.http.post<any>(`${geturl}`, body, options)
|
return this.http.post<any>(`${geturl}`, body, options)
|
||||||
}
|
}
|
||||||
createTaskEvent(folderId:any, body:any, sharedagenda:string, serialNumber:any, applicationID:any){
|
createTaskEvent(folderId: any, body: any, sharedagenda: string, serialNumber: any, applicationID: any) {
|
||||||
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente')+'/dispatch';
|
const geturl = environment.apiURL + 'calendar/' + ((sharedagenda != '') ? sharedagenda : 'CreateEventExpediente') + '/dispatch';
|
||||||
let params = new HttpParams();
|
let params = new HttpParams();
|
||||||
let options;
|
let options;
|
||||||
|
|
||||||
@@ -535,13 +526,13 @@ export class EventsService {
|
|||||||
|
|
||||||
switch (this.loggeduser.Profile) {
|
switch (this.loggeduser.Profile) {
|
||||||
case 'MDGPR':
|
case 'MDGPR':
|
||||||
if(body.CalendarName == 'Pessoal'){
|
if (body.CalendarName == 'Pessoal') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersMdPessoal,
|
headers: this.headersMdPessoal,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(body.CalendarName == 'Oficial'){
|
else if (body.CalendarName == 'Oficial') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersMdOficial,
|
headers: this.headersMdOficial,
|
||||||
params: params
|
params: params
|
||||||
@@ -549,20 +540,20 @@ export class EventsService {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'PR':
|
case 'PR':
|
||||||
if(body.CalendarName == 'Pessoal'){
|
if (body.CalendarName == 'Pessoal') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersPrPessoal,
|
headers: this.headersPrPessoal,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if(body.CalendarName == 'Oficial'){
|
else if (body.CalendarName == 'Oficial') {
|
||||||
options = {
|
options = {
|
||||||
headers: this.headersPrOficial,
|
headers: this.headersPrOficial,
|
||||||
params: params
|
params: params
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return this.http.post<any>(`${geturl}`, body, options)
|
return this.http.post<any>(`${geturl}`, body, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { ModalController, AlertController, AnimationController, Platform } from
|
|||||||
import { NavigationExtras,Router } from '@angular/router';
|
import { NavigationExtras,Router } from '@angular/router';
|
||||||
import { ToastService } from '../services/toast.service';
|
import { ToastService } from '../services/toast.service';
|
||||||
import { JsonStore } from './jsonStore.service';
|
import { JsonStore } from './jsonStore.service';
|
||||||
import { synchro } from './socket/synchro.service';
|
import { BackgroundService } from './background.service';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { EventTrigger } from '../services/eventTrigger.service';
|
import { EventTrigger } from '../services/eventTrigger.service';
|
||||||
import { SessionStore } from '../store/session.service';
|
import { SessionStore } from '../store/session.service';
|
||||||
@@ -44,7 +44,8 @@ export class NotificationsService {
|
|||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
private activeroute: ActivatedRoute,
|
private activeroute: ActivatedRoute,
|
||||||
private jsonstore: JsonStore,
|
private jsonstore: JsonStore,
|
||||||
private eventtrigger: EventTrigger) {
|
private eventtrigger: EventTrigger,
|
||||||
|
private backgroundservice: BackgroundService) {
|
||||||
|
|
||||||
this.storageService.get("Notifications").then((value) => {
|
this.storageService.get("Notifications").then((value) => {
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ export class NotificationsService {
|
|||||||
const id = uuidv4()
|
const id = uuidv4()
|
||||||
this.callbacks.push({type, funx, id})
|
this.callbacks.push({type, funx, id})
|
||||||
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
|
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
|
||||||
synchro.registerCallback('Notification',funx, type)
|
this.backgroundservice.registerBackService('Notification',funx, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
@@ -178,7 +179,7 @@ export class NotificationsService {
|
|||||||
})
|
})
|
||||||
var data = JSON.parse(message.payload);
|
var data = JSON.parse(message.payload);
|
||||||
|
|
||||||
synchro.$send(data)
|
//synchro.$send(data)
|
||||||
|
|
||||||
console.log('data.Service', data.Service); // module
|
console.log('data.Service', data.Service); // module
|
||||||
console.log('data.IdObject', data.IdObject); // Object id
|
console.log('data.IdObject', data.IdObject); // Object id
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export interface wss {
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
class SynchroService {
|
class SynchroService {
|
||||||
[x: string]: any;
|
/* [x: string]: any;
|
||||||
|
|
||||||
private connection!: WebSocket;
|
private connection!: WebSocket;
|
||||||
private id: string = uuidv4();
|
private id: string = uuidv4();
|
||||||
@@ -204,12 +204,12 @@ class SynchroService {
|
|||||||
|
|
||||||
private onerror = (event: any) => {
|
private onerror = (event: any) => {
|
||||||
console.log(`[error] ${event.message}`);
|
console.log(`[error] ${event.message}`);
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const synchro = new SynchroService()
|
/* export const synchro = new SynchroService()
|
||||||
synchro.setUrl()
|
synchro.setUrl()
|
||||||
synchro.connect()
|
synchro.connect()
|
||||||
|
|
||||||
window['synchro'] = synchro
|
window['synchro'] = synchro */
|
||||||
@@ -8,7 +8,6 @@ import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popo
|
|||||||
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
|
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
|
||||||
import { ContactsPage } from '../new-group/contacts/contacts.page';
|
import { ContactsPage } from '../new-group/contacts/contacts.page';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
|
||||||
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
|
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
|
||||||
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
||||||
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||||
@@ -45,7 +44,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
@Output() getDirectMessages:EventEmitter<any> = new EventEmitter<any>();
|
@Output() getDirectMessages:EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
|
|
||||||
synchro = synchro;
|
|
||||||
chatMessageStore = ChatMessageStore
|
chatMessageStore = ChatMessageStore
|
||||||
chatUserStorage = ChatUserStorage
|
chatUserStorage = ChatUserStorage
|
||||||
|
|
||||||
@@ -198,7 +196,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
|
|
||||||
sendMessage() {
|
sendMessage() {
|
||||||
|
|
||||||
this.synchro.$send({})
|
//this.synchro.$send({})
|
||||||
|
|
||||||
let body = {
|
let body = {
|
||||||
"message":
|
"message":
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { AuthService } from 'src/app/services/auth.service';
|
|||||||
import { ProcessesService } from 'src/app/services/processes.service';
|
import { ProcessesService } from 'src/app/services/processes.service';
|
||||||
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
import { removeDuplicate } from 'src/plugin/removeDuplicate.js';
|
||||||
import { SqliteService } from '../../../services/sqlite.service';
|
import { SqliteService } from '../../../services/sqlite.service';
|
||||||
import { synchro } from '../../../services/socket/synchro.service';
|
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
import { SortService } from 'src/app/services/functions/sort.service';
|
import { SortService } from 'src/app/services/functions/sort.service';
|
||||||
|
|
||||||
@@ -20,8 +19,6 @@ export class AllProcessesPage implements OnInit {
|
|||||||
allProcessesList: any[] = [];
|
allProcessesList: any[] = [];
|
||||||
loggeduser: LoginUserRespose;
|
loggeduser: LoginUserRespose;
|
||||||
|
|
||||||
synch = synchro;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private processesService: ProcessesService,
|
private processesService: ProcessesService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
|||||||
Reference in New Issue
Block a user