corretion on interceptor

This commit is contained in:
Eudes Inácio
2023-12-07 07:01:05 +01:00
39 changed files with 760 additions and 568 deletions
+295 -289
View File
@@ -1,271 +1,272 @@
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes = [
{
path: '',
loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule)
},
{
path: '',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: 'empty-chat',
loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule)
},
{
path: 'empty-container',
loadChildren: () => import('./shared/empty-container/empty-container.module').then( m => m.EmptyContainerPageModule)
},
{
path: 'events-to-approve',
loadChildren: () => import('./shared/gabinete-digital/events-to-approve/events-to-approve.module').then( m => m.EventsToApprovePageModule)
},
{
path: 'expedients',
loadChildren: () => import('./shared/gabinete-digital/expedients/expedients.module').then( m => m.ExpedientsPageModule)
},
{
path: 'document-detail',
loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule)
},
{
path: 'edit-group',
loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule)
},
{
path: 'pedidos',
loadChildren: () => import('./shared/gabinete-digital/pedidos/pedidos.module').then( m => m.PedidosPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./pages/gabinete-digital/event-list/event-list.module').then(m =>m.EventListPageModule)
},
{
path: 'despachos',
loadChildren: () => import('./shared/gabinete-digital/despachos/despachos.module').then( m => m.DespachosPageModule)
},
{
path: 'create-process',
loadChildren: () => import('./modals/create-process/create-process.module').then( m => m.CreateProcessPageModule)
},
{
path: 'pendentes',
loadChildren: () => import('./shared/gabinete-digital/pendentes/pendentes.module').then( m => m.PendentesPageModule)
},
{
path: 'delegar',
loadChildren: () => import('./modals/delegar/delegar.module').then( m => m.DelegarPageModule)
},
{
path: 'add-note',
loadChildren: () => import('./modals/add-note/add-note.module').then( m => m.AddNotePageModule)
},
{
path: 'dar-parecer',
loadChildren: () => import('./modals/dar-parecer/dar-parecer.module').then( m => m.DarParecerPageModule)
},
{
path: 'opts-expediente',
loadChildren: () => import('./shared/popover/opts-expediente/opts-expediente.module').then( m => m.OptsExpedientePageModule)
},
{
path: 'despachos-pr',
loadChildren: () => import('./shared/gabinete-digital/despachos-pr/despachos-pr.module').then( m => m.DespachosPrPageModule)
},
{
path: 'diplomas',
loadChildren: () => import('./shared/gabinete-digital/diplomas/diplomas.module').then( m => m.DiplomasPageModule)
},
{
path: 'expedientes-pr',
loadChildren: () => import('./shared/gabinete-digital/expedientes-pr/expedientes-pr.module').then( m => m.ExpedientesPrPageModule)
},
{
path: 'diplomas-assinar',
loadChildren: () => import('./shared/gabinete-digital/diplomas-assinar/diplomas-assinar.module').then( m => m.DiplomasAssinarPageModule)
},
{
path: 'opts-expediente-pr',
loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule)
},
{
path: 'despachos-options',
loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule)
},
{
path: 'despachos-pr-options',
loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule)
},
{
path: 'deploma-options',
loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule)
},
{
path: 'pin',
loadChildren: () => import('./shared/pin/pin.module').then( m => m.PinPageModule)
},
{
path: 'fingerprint',
loadChildren: () => import('./shared/fingerprint/fingerprint.module').then( m => m.FingerprintPageModule)
},
{
path: 'new-event',
loadChildren: () => import('./shared/agenda/new-event/new-event.module').then( m => m.NewEventPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./shared/agenda/event-list/event-list.module').then( m => m.EventListPageModule)
},
{
path: 'approve-event',
loadChildren: () => import('./shared/agenda/approve-event/approve-event.module').then( m => m.ApproveEventPageModule)
},
{
path: 'bad-request',
loadChildren: () => import('./shared/popover/bad-request/bad-request.module').then( m => m.BadRequestPageModule)
},
{
path: 'success-message',
loadChildren: () => import('./shared/popover/success-message/success-message.module').then( m => m.SuccessMessagePageModule)
},
{
path: 'forward',
loadChildren: () => import('./modals/forward/forward.module').then( m => m.ForwardPageModule)
},
{
path: 'edit-event-to-approve',
loadChildren: () => import('./shared/agenda/edit-event-to-approve/edit-event-to-approve.module').then( m => m.EditEventToApprovePageModule)
},
{
path: 'actions-options',
loadChildren: () => import('./shared/popover/actions-options/actions-options.module').then( m => m.ActionsOptionsPageModule)
},
{
path: 'edit-action',
loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule)
},
{
path: 'eliminate-event',
loadChildren: () => import('./modals/eliminate-event/eliminate-event.module').then( m => m.EliminateEventPageModule)
},
{
path: 'inactivity',
loadChildren: () => import('./pages/inactivity/inactivity.module').then( m => m.InactivityPageModule)
},
{
path: 'document-set-up-meeting',
loadChildren: () => import('./modals/document-set-up-meeting/document-set-up-meeting.module').then( m => m.DocumentSetUpMeetingPageModule)
},
{
path: 'profile',
loadChildren: () => import('./modals/profile/profile.module').then( m => m.ProfilePageModule)
},
{
path: 'all-processes',
loadChildren: () => import('./shared/gabinete-digital/all-processes/all-processes.module').then( m => m.AllProcessesPageModule)
},
{
path: 'searched-document-options',
loadChildren: () => import('./shared/popover/searched-document-options/searched-document-options.module').then( m => m.SearchedDocumentOptionsPageModule)
},
{
path: 'task-list',
loadChildren: () => import('./shared/gabinete-digital/generic/task-list/task-list.module').then( m => m.TaskListPageModule)
},
{
path: 'task-list',
loadChildren: () => import('./shared/gabinete-digital/generic/task-list/task-list.module').then( m => m.TaskListPageModule)
},
{
path: 'task-detailde',
loadChildren: () => import('./shared/gabinete-digital/generic/task-detailde/task-detailde.module').then( m => m.TaskDetaildePageModule)
},
{
path: 'task-details',
loadChildren: () => import('./shared/gabinete-digital/generic/task-details/task-details.module').then( m => m.TaskDetailsPageModule)
},
{
path: 'chat-options-features',
loadChildren: () => import('./modals/chat-options-features/chat-options-features.module').then( m => m.ChatOptionsFeaturesPageModule)
},
{
path: 'document-viewer',
loadChildren: () => import('./modals/document-viewer/document-viewer.module').then( m => m.DocumentViewerPageModule)
},
{
path: 'view-document',
loadChildren: () => import('./modals/view-document/view-document.module').then( m => m.ViewDocumentPageModule)
},
{
path: 'event-details-documents-options',
loadChildren: () => import('./shared/popover/event-details-documents-options/event-details-documents-options.module').then( m => m.EventDetailsDocumentsOptionsPageModule)
},
{
path: 'preview-camera',
loadChildren: () => import('./modals/preview-camera/preview-camera.module').then( m => m.PreviewCameraPageModule)
},
{
path: 'group-icons',
loadChildren: () => import('./modals/group-icons/group-icons.module').then( m => m.GroupIconsPageModule)
},
{
path: 'video-allowed',
loadChildren: () => import('./modals/video-allowed/video-allowed.module').then( m => m.VideoAllowedPageModule)
},
{
path: 'preview-photo',
loadChildren: () => import('./modals/preview-photo/preview-photo.module').then( m => m.PreviewPhotoPageModule)
},
{
path: 'custom-image-cache',
loadChildren: () => import('./services/file/custom-image-cache/custom-image-cache.module').then( m => m.CustomImageCachePageModule)
},
{
path: 'view-media',
loadChildren: () => import('./modals/view-media/view-media.module').then( m => m.ViewMediaPageModule)
},
{
path: 'view-event',
loadChildren: () => import('./modals/view-event/view-event.module').then( m => m.ViewEventPageModule)
},
{
path: 'previewer',
loadChildren: () => import('./modals/previewer/previewer.module').then( m => m.PreviewerPageModule)
},
{
path: 'set-room-owner',
loadChildren: () => import('./modals/set-room-owner/set-room-owner.module').then( m => m.SetRoomOwnerPageModule)
},
{
path: 'diplomas-gerar',
loadChildren: () => import('./shared/gabinete-digital/diplomas-gerar/diplomas-gerar.module').then( m => m.DiplomasGerarPageModule)
},
{
path: 'diplomas-gerar-options',
loadChildren: () => import('./shared/popover/diplomas-gerar-options/diplomas-gerar-options.module').then( m => m.DiplomasGerarOptionsPageModule)
},
{
path: 'chat-debugging',
loadChildren: () => import('./shared/popover/chat-debugging/chat-debugging.module').then( m => m.ChatDebuggingPageModule)
},
{
path: 'chat-message-debugging',
loadChildren: () => import('./shared/popover/chat-message-debugging/chat-message-debugging.module').then( m => m.ChatMessageDebuggingPageModule)
},
{
path: 'add-user',
loadChildren: () => import('./shared/chat/add-user/add-user.module').then( m => m.AddUserPageModule)
},
{
path: 'information',
loadChildren: () => import('./modals/information/information.module').then( m => m.InformationPageModule)
},
{
path: 'chat-options-popover',
loadChildren:() => import('./shared/popover/chat-options-popover/chat-options-popover.module').then( m => m.ChatOptionsPopoverPageModule)
},
import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
const routes = [
{
path: '',
loadChildren: () => import('./index/index.module').then(m => m.IndexPageModule)
},
{
path: '',
loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
},
{
path: 'empty-chat',
loadChildren: () => import('./shared/chat/empty-chat/empty-chat.module').then( m => m.EmptyChatPageModule)
},
{
path: 'empty-container',
loadChildren: () => import('./shared/empty-container/empty-container.module').then( m => m.EmptyContainerPageModule)
},
{
path: 'events-to-approve',
loadChildren: () => import('./shared/gabinete-digital/events-to-approve/events-to-approve.module').then( m => m.EventsToApprovePageModule)
},
{
path: 'expedients',
loadChildren: () => import('./shared/gabinete-digital/expedients/expedients.module').then( m => m.ExpedientsPageModule)
},
{
path: 'document-detail',
loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule)
},
{
path: 'edit-group',
loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule)
},
{
path: 'pedidos',
loadChildren: () => import('./shared/gabinete-digital/pedidos/pedidos.module').then( m => m.PedidosPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./pages/gabinete-digital/event-list/event-list.module').then(m =>m.EventListPageModule)
},
{
path: 'despachos',
loadChildren: () => import('./shared/gabinete-digital/despachos/despachos.module').then( m => m.DespachosPageModule)
},
{
path: 'create-process',
loadChildren: () => import('./modals/create-process/create-process.module').then( m => m.CreateProcessPageModule)
},
{
path: 'pendentes',
loadChildren: () => import('./shared/gabinete-digital/pendentes/pendentes.module').then( m => m.PendentesPageModule)
},
{
path: 'delegar',
loadChildren: () => import('./modals/delegar/delegar.module').then( m => m.DelegarPageModule)
},
{
path: 'add-note',
loadChildren: () => import('./modals/add-note/add-note.module').then( m => m.AddNotePageModule)
},
{
path: 'dar-parecer',
loadChildren: () => import('./modals/dar-parecer/dar-parecer.module').then( m => m.DarParecerPageModule)
},
{
path: 'opts-expediente',
loadChildren: () => import('./shared/popover/opts-expediente/opts-expediente.module').then( m => m.OptsExpedientePageModule)
},
{
path: 'despachos-pr',
loadChildren: () => import('./shared/gabinete-digital/despachos-pr/despachos-pr.module').then( m => m.DespachosPrPageModule)
},
{
path: 'diplomas',
loadChildren: () => import('./shared/gabinete-digital/diplomas/diplomas.module').then( m => m.DiplomasPageModule)
},
{
path: 'expedientes-pr',
loadChildren: () => import('./shared/gabinete-digital/expedientes-pr/expedientes-pr.module').then( m => m.ExpedientesPrPageModule)
},
{
path: 'diplomas-assinar',
loadChildren: () => import('./shared/gabinete-digital/diplomas-assinar/diplomas-assinar.module').then( m => m.DiplomasAssinarPageModule)
},
{
path: 'opts-expediente-pr',
loadChildren: () => import('./shared/popover/opts-expediente-pr/opts-expediente-pr.module').then( m => m.OptsExpedientePrPageModule)
},
{
path: 'despachos-options',
loadChildren: () => import('./shared/popover/despachos-options/despachos-options.module').then( m => m.DespachosOptionsPageModule)
},
{
path: 'despachos-pr-options',
loadChildren: () => import('./shared/popover/despachos-pr-options/despachos-pr-options.module').then( m => m.DespachosPrOptionsPageModule)
},
{
path: 'deploma-options',
loadChildren: () => import('./shared/popover/deploma-options/deploma-options.module').then( m => m.DeplomaOptionsPageModule)
},
{
path: 'pin',
loadChildren: () => import('./shared/pin/pin.module').then( m => m.PinPageModule)
},
{
path: 'fingerprint',
loadChildren: () => import('./shared/fingerprint/fingerprint.module').then( m => m.FingerprintPageModule)
},
{
path: 'new-event',
loadChildren: () => import('./shared/agenda/new-event/new-event.module').then( m => m.NewEventPageModule)
},
{
path: 'event-list',
loadChildren: () => import('./shared/agenda/event-list/event-list.module').then( m => m.EventListPageModule)
},
{
path: 'approve-event',
loadChildren: () => import('./shared/agenda/approve-event/approve-event.module').then( m => m.ApproveEventPageModule)
},
{
path: 'bad-request',
loadChildren: () => import('./shared/popover/bad-request/bad-request.module').then( m => m.BadRequestPageModule)
},
{
path: 'success-message',
loadChildren: () => import('./shared/popover/success-message/success-message.module').then( m => m.SuccessMessagePageModule)
},
{
path: 'forward',
loadChildren: () => import('./modals/forward/forward.module').then( m => m.ForwardPageModule)
},
{
path: 'edit-event-to-approve',
loadChildren: () => import('./shared/agenda/edit-event-to-approve/edit-event-to-approve.module').then( m => m.EditEventToApprovePageModule)
},
{
path: 'actions-options',
loadChildren: () => import('./shared/popover/actions-options/actions-options.module').then( m => m.ActionsOptionsPageModule)
},
{
path: 'edit-action',
loadChildren: () => import('./shared/publication/edit-action/edit-action.module').then( m => m.EditActionPageModule)
},
{
path: 'eliminate-event',
loadChildren: () => import('./modals/eliminate-event/eliminate-event.module').then( m => m.EliminateEventPageModule)
},
{
path: 'inactivity',
loadChildren: () => import('./pages/inactivity/inactivity.module').then( m => m.InactivityPageModule)
},
{
path: 'document-set-up-meeting',
loadChildren: () => import('./modals/document-set-up-meeting/document-set-up-meeting.module').then( m => m.DocumentSetUpMeetingPageModule)
},
{
path: 'profile',
loadChildren: () => import('./modals/profile/profile.module').then( m => m.ProfilePageModule)
},
{
path: 'all-processes',
loadChildren: () => import('./shared/gabinete-digital/all-processes/all-processes.module').then( m => m.AllProcessesPageModule)
},
{
path: 'searched-document-options',
loadChildren: () => import('./shared/popover/searched-document-options/searched-document-options.module').then( m => m.SearchedDocumentOptionsPageModule)
},
{
path: 'task-list',
loadChildren: () => import('./shared/gabinete-digital/generic/task-list/task-list.module').then( m => m.TaskListPageModule)
},
{
path: 'task-list',
loadChildren: () => import('./shared/gabinete-digital/generic/task-list/task-list.module').then( m => m.TaskListPageModule)
},
{
path: 'task-detailde',
loadChildren: () => import('./shared/gabinete-digital/generic/task-detailde/task-detailde.module').then( m => m.TaskDetaildePageModule)
},
{
path: 'task-details',
loadChildren: () => import('./shared/gabinete-digital/generic/task-details/task-details.module').then( m => m.TaskDetailsPageModule)
},
{
path: 'chat-options-features',
loadChildren: () => import('./modals/chat-options-features/chat-options-features.module').then( m => m.ChatOptionsFeaturesPageModule)
},
{
path: 'document-viewer',
loadChildren: () => import('./modals/document-viewer/document-viewer.module').then( m => m.DocumentViewerPageModule)
},
{
path: 'view-document',
loadChildren: () => import('./modals/view-document/view-document.module').then( m => m.ViewDocumentPageModule)
},
{
path: 'event-details-documents-options',
loadChildren: () => import('./shared/popover/event-details-documents-options/event-details-documents-options.module').then( m => m.EventDetailsDocumentsOptionsPageModule)
},
{
path: 'preview-camera',
loadChildren: () => import('./modals/preview-camera/preview-camera.module').then( m => m.PreviewCameraPageModule)
},
{
path: 'group-icons',
loadChildren: () => import('./modals/group-icons/group-icons.module').then( m => m.GroupIconsPageModule)
},
{
path: 'video-allowed',
loadChildren: () => import('./modals/video-allowed/video-allowed.module').then( m => m.VideoAllowedPageModule)
},
{
path: 'preview-photo',
loadChildren: () => import('./modals/preview-photo/preview-photo.module').then( m => m.PreviewPhotoPageModule)
},
{
path: 'custom-image-cache',
loadChildren: () => import('./services/file/custom-image-cache/custom-image-cache.module').then( m => m.CustomImageCachePageModule)
},
{
path: 'view-media',
loadChildren: () => import('./modals/view-media/view-media.module').then( m => m.ViewMediaPageModule)
},
{
path: 'view-event',
loadChildren: () => import('./modals/view-event/view-event.module').then( m => m.ViewEventPageModule)
},
{
path: 'previewer',
loadChildren: () => import('./modals/previewer/previewer.module').then( m => m.PreviewerPageModule)
},
{
path: 'set-room-owner',
loadChildren: () => import('./modals/set-room-owner/set-room-owner.module').then( m => m.SetRoomOwnerPageModule)
},
{
path: 'diplomas-gerar',
loadChildren: () => import('./shared/gabinete-digital/diplomas-gerar/diplomas-gerar.module').then( m => m.DiplomasGerarPageModule)
},
{
path: 'diplomas-gerar-options',
loadChildren: () => import('./shared/popover/diplomas-gerar-options/diplomas-gerar-options.module').then( m => m.DiplomasGerarOptionsPageModule)
},
{
path: 'chat-debugging',
loadChildren: () => import('./shared/popover/chat-debugging/chat-debugging.module').then( m => m.ChatDebuggingPageModule)
},
{
path: 'chat-message-debugging',
loadChildren: () => import('./shared/popover/chat-message-debugging/chat-message-debugging.module').then( m => m.ChatMessageDebuggingPageModule)
},
{
path: 'add-user',
loadChildren: () => import('./shared/chat/add-user/add-user.module').then( m => m.AddUserPageModule)
},
{
path: 'information',
loadChildren: () => import('./modals/information/information.module').then( m => m.InformationPageModule)
},
{
path: 'chat-options-popover',
loadChildren:() => import('./shared/popover/chat-options-popover/chat-options-popover.module').then( m => m.ChatOptionsPopoverPageModule)
},
{
path: 'task-listt-header',
loadChildren: () => import('./shared/gabinete-digital/generic/task-listt-header/task-listt-header.module').then( m => m.TaskListtHeaderPageModule)
},
@@ -292,26 +293,31 @@ const routes = [
{
path: 'popup-question',
loadChildren: () => import('./modals/popup-question/popup-question.module').then( m => m.PopupQuestionPageModule)
},
{
path: 'swiper',
loadChildren: () => import('./shared/swiper/swiper.module').then( m => m.SwiperPageModule)
},
{
path: 'not-found',
loadChildren: () => import('./pages/not-found/not-found.module').then( m => m.NotFoundPageModule)
}
/*
path: 'chat',
component: ChatPage
} */
/*
path: 'chat',
component: ChatPage
} */
/*
path: 'chat',
component: ChatPage
} */
];
@NgModule({
imports: [
RouterModule.forRoot(routes,
{ preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
/*
path: 'chat',
component: ChatPage
} */
];
@NgModule({
imports: [
RouterModule.forRoot(routes,
{ preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule {}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { MiddlewareRemoteDatasourcecService } from './middleware-remote-datasourcec.service';
describe('MiddlewareRemoteDatasourcecService', () => {
let service: MiddlewareRemoteDatasourcecService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MiddlewareRemoteDatasourcecService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,17 +0,0 @@
import { Injectable } from '@angular/core';
import { SessionStore } from "src/app/store/session.service"
import { MiddlewareServiceService } from "src/app/shared/API/middleware/middleware-service.service"
@Injectable({
providedIn: 'root'
})
export class MiddlewareRemoteDatasourcecService {
constructor(
private MiddlewareServiceService: MiddlewareServiceService,
) {}
refreshToken() {
const refreshToken = SessionStore.user.Authorization
return this.MiddlewareServiceService.refreshToken(refreshToken)
}
}
+4 -1
View File
@@ -414,7 +414,10 @@ const routes: Routes = [
},
{ path: '**', redirectTo: '/', pathMatch: 'full' },
{
path: '**',
loadChildren: ()=> import('../pages/not-found/not-found.module').then(m => m.NotFoundPageModule),
},
];
@NgModule({
+3 -3
View File
@@ -59,10 +59,9 @@ export class TokenInterceptor implements HttpInterceptor {
return this.refreshToken().pipe(
switchMap((token: any) => {
console.log(token)
this.isRefreshing = false;
this.refreshTokenSubject.next(token['result'].accessToken);
return next.handle(this.addToken(request, token['result'].accessToken));
this.refreshTokenSubject.next(token.Authorization);
return next.handle(this.addToken(request, token.Authorization));
})
);
} else {
@@ -92,6 +91,7 @@ export class TokenInterceptor implements HttpInterceptor {
}),
catchError((error) => {
console.log(error)
SessionStore.user.Authorization = "";
SessionStore.user.RefreshToken = "";
SessionStore.setInativity(false)
-2
View File
@@ -508,7 +508,6 @@ div ion-raw > ul > li {
font-family: Roboto;
font-weight: bold;
color: var(--title-text-color);
max-width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -519,7 +518,6 @@ div ion-raw > ul > li {
overflow: hidden !important;
text-overflow: ellipsis !important;
font-size: rem(17);
max-width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+21 -21
View File
@@ -92,7 +92,7 @@ export class EventsPage implements OnInit {
private changeProfileService: ChangeProfileService,
public TaskService: TaskService
) {
window['zipPhoneCallback'] = function (zipphone) {
var frame = document.getElementById('home-iframe');
if(frame) {
@@ -113,7 +113,7 @@ export class EventsPage implements OnInit {
}
ngAfterViewInit(): void {
this.loadAllTask();
@@ -123,9 +123,9 @@ export class EventsPage implements OnInit {
this.dynamicSearch()
}
})
this.dynamicSearch()
}
ngOnDestroy() {
@@ -161,20 +161,20 @@ export class EventsPage implements OnInit {
const ordinance = this.ordinance
if(this.showSearch && this.searchSubject) {
const AllProcess = this.TaskService.AllProcess.filter((task) => {
let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject
subject = subject.toLowerCase();
return subject.includes(this.searchSubject.toLowerCase())
}).filter( task => this.TaskService.filter(task, this.filterName))
if(ordinance == this.ordinance) {
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
}
} else {
const AllProcess = this.TaskService.AllProcess
if(ordinance == this.ordinance) {
this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess)
.filter( task => this.TaskService.filter(task, this.filterName))
@@ -205,7 +205,7 @@ export class EventsPage implements OnInit {
} catch(error) {}
}, 2000);
}
this.RefreshEvents();
this.LoadList();
this.loadAllTask();
@@ -218,7 +218,7 @@ export class EventsPage implements OnInit {
async RefreshEvents() {
this.currentEvent = "";
this.showLoader = true;
this.showAgendaLoader = true;
@@ -256,7 +256,7 @@ export class EventsPage implements OnInit {
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
this.storage.get('events').then((events: any[] = []) => {
//
//
if(Array.isArray(events)) {
this.listToPresent = events
@@ -271,7 +271,7 @@ export class EventsPage implements OnInit {
} catch (error) {}
}
//
//
})
@@ -299,19 +299,19 @@ export class EventsPage implements OnInit {
changeProfile() {
if (this.profile == "mdgpr") {
//
//
this.profile = "pr";
this.RefreshEvents();
}
else {
//
//
this.profile = "mdgpr";
this.RefreshEvents();
}
}
async openEventDetail1(id: any) {
//
//
const modal = await this.modalController.create({
component: EventDetailPage,
@@ -328,7 +328,7 @@ export class EventsPage implements OnInit {
}
async openEventDetail(id: any) {
//
//
const modal = await this.modalController.create({
component: ViewEventPage,
@@ -338,7 +338,7 @@ export class EventsPage implements OnInit {
cssClass: 'view-event',
backdropDismiss: false
});
modal.onDidDismiss();
await modal.present();
@@ -358,7 +358,7 @@ export class EventsPage implements OnInit {
window['all-process-gabinete']()
}
}
sortArrayISODate(myArray: any) {
@@ -375,9 +375,9 @@ export class EventsPage implements OnInit {
}
goToAllTaskFilter(event: any) {
let navigationExtras: NavigationExtras = { queryParams: {
let navigationExtras: NavigationExtras = { queryParams: {
filter: event,
processes: true
processes: true
} }
@@ -407,4 +407,4 @@ export class EventsPage implements OnInit {
}
}
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NotFoundPage } from './not-found.page';
const routes: Routes = [
{
path: '',
component: NotFoundPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class NotFoundPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { NotFoundPageRoutingModule } from './not-found-routing.module';
import { NotFoundPage } from './not-found.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
NotFoundPageRoutingModule
],
declarations: [NotFoundPage]
})
export class NotFoundPageModule {}
@@ -0,0 +1,9 @@
<ion-content class="d-flex justity-center align-center">
<div class="ion-justify-content-center justify-content-center align-center d-flex height-100 width-100">
<h4>
A Reencaminhar a página
</h4>
</div>
</ion-content>
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { NotFoundPage } from './not-found.page';
describe('NotFoundPage', () => {
let component: NotFoundPage;
let fixture: ComponentFixture<NotFoundPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ NotFoundPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(NotFoundPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+22
View File
@@ -0,0 +1,22 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-not-found',
templateUrl: './not-found.page.html',
styleUrls: ['./not-found.page.scss'],
})
export class NotFoundPage implements OnInit {
constructor(
private router: Router,
private toastService: ToastService,
) { }
ngOnInit() {
this.router.navigate(['/home/events']);
this.toastService._badRequest("Página não encontrada. Contacte o suporte técnico")
}
}
@@ -10,6 +10,7 @@ import { ViewPublicationsPage } from './view-publications.page';
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image';
import { ShowMorePageModule } from 'src/app/shared/publication/view-publications/show-more/show-more.module'
import { VisibilityDirective } from 'src/app/services/directives/visibility1.directive';
export class LazyLoadImageHooks extends IntersectionObserverHooks {
setup(attributes: Attributes) {
attributes.offset = 10;
@@ -31,7 +32,7 @@ setup(attributes: Attributes) {
ShowMorePageModule,
],
exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage],
declarations: [ViewPublicationsPage, VisibilityDirective],
providers: [{provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageHooks}]
})
export class ViewPublicationsPageModule {}
@@ -51,13 +51,30 @@
<img *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'image'" class="post-img"
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
<video *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
<video [appVisibility]="onVisibilityChange" *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
webkit-playsinline="webkit-playsinline">
<source src="{{'data:video/mp4;base64,' + files.FileBase64}}" type="video/mp4">
</video>
</div>
</swiper-slide>
<div class="swiper-button-next"
style="
position: absolute;
background: red;
top: 50%;
">
<div>arrow-left</div>
</div>
<div class="slides-per-view"
style="
position: absolute;
background: red;
top: 50%;
">
<div>arrow-rights</div>
</div>
</swiper-container>
<!-- <div *ngIf="publication.FileExtension == 'mp4'"
(click)="goToPublicationDetail(publication.DocumentId, publication.ProcessId)" class="post-video">
@@ -291,3 +291,11 @@ swiper-slide video {
justify-content: center;
background: black;
}
.swiper-container::part(button-next) {
display: none !important;
.swiper-button-next {
display: none !important;
}
}
@@ -70,6 +70,12 @@ export class ViewPublicationsPage implements OnInit {
/* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */
setTimeout(() => {
console.log(this.VideoManager.nativeElement)
}, 2000)
this.createPublicationList()
this.getFromDB();
@@ -111,6 +117,15 @@ export class ViewPublicationsPage implements OnInit {
console.log(this.publicationFolderService.publicationList[this.folderId])
}
onVisibilityChange = (e: boolean) => {
console.log("nice to have", e)
if(!e) {
/* this.stopVideo() */
}
}
ngOnChanges() {
if (typeof (this.folderId) == 'object') {
@@ -233,10 +248,28 @@ export class ViewPublicationsPage implements OnInit {
const findIndex = this.publicationFindIndex(publicationId, folderId)
const found = this.publicationIsPresent(publicationId, folderId)
if (!found) {
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
} else {
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex])
let b: any = Object.assign({}, publicationDetails)
a.Files = a.Files.length
b.Files = b.Files.length
if(JSON.stringify(a) != JSON.stringify(b)) {
// console.log({a, b})
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
} else {
// console.log({publicationDetails})
}
}
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { MiddlewareRepositoryService } from './middleware-repository.service';
describe('MiddlewareRepositoryService', () => {
let service: MiddlewareRepositoryService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MiddlewareRepositoryService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,16 +0,0 @@
import { Injectable } from '@angular/core';
import { MiddlewareRemoteDatasourcecService } from "src/app/datasource/middleware/remote/middleware-remote-datasourcec.service";
@Injectable({
providedIn: 'root'
})
export class MiddlewareRepositoryService {
constructor(
private MiddlewareRemoteDatasourcecService: MiddlewareRemoteDatasourcecService,
) {}
refreshToken() {
return this.MiddlewareRemoteDatasourcecService.refreshToken()
}
}
@@ -15,6 +15,9 @@ export class VisibilityDirective {
threshold: 0.5 // Adjust as needed
};
console.log(this.elementRef.nativeElement.parentElement, "=1=")
this.intersectionObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
@@ -0,0 +1,8 @@
import { VisibilityDirective } from './visibility.directive';
describe('VisibilityDirective', () => {
it('should create an instance', () => {
const directive = new VisibilityDirective();
expect(directive).toBeTruthy();
});
});
@@ -0,0 +1,36 @@
import { Directive, ElementRef, Input } from '@angular/core';
@Directive({
selector: '[appVisibility]'
})
export class VisibilityDirective {
intersectionObserver: IntersectionObserver;
@Input() appVisibility: (arg: any) => void;
constructor(private elementRef: ElementRef) {
const options = {
root: null,
rootMargin: '0px',
threshold: 0.5 // Adjust as needed
};
console.log(this.elementRef.nativeElement.parentElement, "=1=")
this.intersectionObserver = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
this.appVisibility(true);
} else {
this.elementRef.nativeElement.pause()
// Pause video when not visible
this.appVisibility(false); // You can implement pause logic here
}
});
}, options);
this.intersectionObserver.observe(this.elementRef.nativeElement);
}
}
@@ -1,16 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { TokenInterceptorService } from './token-interceptor.service';
describe('TokenInterceptorService', () => {
let service: TokenInterceptorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(TokenInterceptorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -1,81 +0,0 @@
import { Injectable } from "@angular/core";
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor,
HttpErrorResponse,
HTTP_INTERCEPTORS,
} from "@angular/common/http";
import { Observable, throwError, BehaviorSubject } from "rxjs";
import { catchError, filter, take, switchMap } from "rxjs/operators";
import { SessionStore } from "src/app/store/session.service";
import { MiddlewareRepositoryService } from "src/app/repository/middleWare/middleware-repository.service"
@Injectable({
providedIn: 'root'
})
export class TokenInterceptorService {
private isRefreshing = false;
private refreshTokenSubject: BehaviorSubject<any> = new BehaviorSubject<any>(
null
);
constructor(private middlewareRepositoryService: MiddlewareRepositoryService) {
this.middlewareRepositoryService = middlewareRepositoryService
}
intercept(
request: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
if (SessionStore.user.Authorization) {
request = this.addToken(request, SessionStore.user.Authorization);
}
return next.handle(request).pipe(
catchError((error) => {
if (error instanceof HttpErrorResponse && error.status === 401) {
return this.handle401Error(request, next);
} else {
return throwError(error);
}
})
) as any
}
private addToken(request: HttpRequest<any>, token: string) {
return request.clone({
setHeaders: {
Authorization: `Bearer ${token}`,
},
});
}
private handle401Error(request: HttpRequest<any>, next: HttpHandler) {
if (!this.isRefreshing) {
this.isRefreshing = true;
this.refreshTokenSubject.next(null);
return this.middlewareRepositoryService.refreshToken().pipe(
switchMap((token: any) => {
this.isRefreshing = false;
this.refreshTokenSubject.next(token['result'].accessToken);
return next.handle(this.addToken(request, token['result'].accessToken));
})
);
} else {
return this.refreshTokenSubject.pipe(
filter((token) => token != null),
take(1),
switchMap((jwt) => {
return next.handle(this.addToken(request, jwt));
})
);
}
}
}
@@ -23,7 +23,6 @@ export class PublicationVideoManagerService {
}
class SelectedPublication {
position: number
video: HTMLVideoElement
@@ -36,6 +36,8 @@ import { Subject } from 'rxjs';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
dateInput: "YYYY-MMMM-DD HH:mm"
@@ -102,8 +104,6 @@ export class NewEventPage implements OnInit {
documents: SearchList[] = [];
// minDate: string;
loggeduser: LoginUserRespose;
@ViewChild('picker') picker: any;
@ViewChild('fim') fim: any;
@@ -148,7 +148,8 @@ export class NewEventPage implements OnInit {
private processeService: ProcessesService,
public TaskService: TaskService,
private contactsService: ContactsService,
private domSanitazerService: DomSanitizerService
private domSanitazerService: DomSanitizerService,
private changeProfileService: ChangeProfileService,
) {
this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user;
@@ -159,6 +160,9 @@ export class NewEventPage implements OnInit {
ngOnInit() {
console.log(' INTERVENIENTES',this.taskParticipants)
this.changeProfileService.registerCallback(() => {
this.initializeData()
})
if (!this.CalendarName) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
@@ -174,50 +178,7 @@ export class NewEventPage implements OnInit {
this.eventBody = { BodyType: "1", Text: "" };
this.postEvent.Body = this.eventBody;
if (this.selectedSegment != "Combinada") {
this.postEvent = {
EventId: '',
Subject: '',
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: 'Oficial',
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
};
}
else {
this.postEvent = {
EventId: '',
Subject: '',
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: 'Oficial',
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
}
}
this.initializeData()
if (this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e => {
@@ -247,6 +208,53 @@ export class NewEventPage implements OnInit {
}
initializeData() {
if (this.selectedSegment != "Combinada") {
this.postEvent = {
EventId: '',
Subject: '',
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: 'Oficial',
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
};
}
else {
this.postEvent = {
EventId: '',
Subject: '',
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: 'Oficial',
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { Type: '-1', LastOccurrence: this.autoEndTime },
}
}
}
setDefaultTime() {
this.postEvent.StartDate = this.roundTimeQuarterHour(this.CalendarDate);
this.postEvent.EndDate = this.roundTimeQuarterHourPlus15(this.postEvent.StartDate);
@@ -510,7 +518,7 @@ export class NewEventPage implements OnInit {
this.postEvent.Subject = this.domSanitazerService.sanitizeInput(this.postEvent.Subject);
this.postEvent.Location = this.domSanitazerService.sanitizeInput(this.postEvent.Location);
this.postEvent.Body.Text = this.domSanitazerService.sanitizeInput(this.postEvent.Body.Text);
if (this.documents.length > 0) {
@@ -688,7 +696,7 @@ export class NewEventPage implements OnInit {
}
});
});
if (DocumentToSave.length == 0) {
this.afterSave();
} */
@@ -732,7 +740,7 @@ export class NewEventPage implements OnInit {
}
});
});
if (DocumentToSave.length == 0) {
this.afterSave();
} */
@@ -745,7 +753,7 @@ export class NewEventPage implements OnInit {
}
}
@@ -39,7 +39,7 @@
<p class="item-content-detail">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index">
<ion-card-content>
@@ -56,6 +56,24 @@
</div>
</swiper-slide>
<!--
<div class="swiper-button-next"
style="
position: absolute;
background: red;
top: 50%;
">
<div>arrow-left</div>
</div>
<div class="slides-per-view"
style="
position: absolute;
background: red;
top: 50%;
right: 0px;
">
<div>arrow-rights</div>
</div>s -->
</swiper-container>
<div class="post-content">
@@ -60,10 +60,13 @@ export class ViewPublicationsPage implements OnInit {
private publicationVideoManagerService: PublicationVideoManagerService
) {
setTimeout(()=> {
setTimeout(() => {
// document.querySelector("swiper-container").shadowRoot.querySelector(".swiper-button-next").innerHTML = "ok"
// alert("ok")
// console.log("this.VideoManager", this.VideoManager, document.querySelector('.VideoManager'))
/* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */
}, 2000)
}, 15000)
// this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement)
this.createPublicationList()
@@ -217,10 +220,27 @@ export class ViewPublicationsPage implements OnInit {
const findIndex = this.publicationFindIndex(publicationId, folderId)
const found = this.publicationIsPresent(publicationId, folderId)
if (!found) {
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
} else {
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
// console.log("names");
let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex])
let b: any = Object.assign({}, publicationDetails)
a.Files = a.Files.length
b.Files = b.Files.length
if(JSON.stringify(a) != JSON.stringify(b)) {
// console.log({a, b})
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
} else {
// console.log({publicationDetails})
}
}
}
+2 -2
View File
@@ -29,7 +29,7 @@ import { TaskDetailsPage } from './gabinete-digital/generic/task-details/task-de
// HeaderPrPage,
// BtnSeguintePage,
// BtnModalDismissPage,
// HeaderNoSearchPage,
// HeaderNoSearchPage,
// EmptyChatPage,
// BtnCriarPage,
// BtnAdicionarPage,
@@ -47,4 +47,4 @@ import { TaskDetailsPage } from './gabinete-digital/generic/task-details/task-de
// BtnAdicionarPage,
]
})
export class SharedModule {}
export class SharedModule {}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SwiperPage } from './swiper.page';
const routes: Routes = [
{
path: '',
component: SwiperPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SwiperPageRoutingModule {}
+20
View File
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { SwiperPageRoutingModule } from './swiper-routing.module';
import { SwiperPage } from './swiper.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SwiperPageRoutingModule
],
declarations: [SwiperPage]
})
export class SwiperPageModule {}
+9
View File
@@ -0,0 +1,9 @@
<ion-header>
<ion-toolbar>
<ion-title>swiper</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
</ion-content>
+24
View File
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { SwiperPage } from './swiper.page';
describe('SwiperPage', () => {
let component: SwiperPage;
let fixture: ComponentFixture<SwiperPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ SwiperPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(SwiperPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+15
View File
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-swiper',
templateUrl: './swiper.page.html',
styleUrls: ['./swiper.page.scss'],
})
export class SwiperPage implements OnInit {
constructor() { }
ngOnInit() {
}
}
+38 -24
View File
@@ -21,12 +21,12 @@ export class PublicationFolderService {
publicationPipe = new PublicationPipe()
getpublication = [];
constructor(
private storage: Storage,
private publications: PublicationsService,
) {}
createPublicationList(folderId) {
if(!this.publicationList[folderId]) {
@@ -38,10 +38,10 @@ export class PublicationFolderService {
}
getFromDB(folderId: any) {
if(!this.restoreFolder[folderId]) {
this.storage.get(folderId).then((viewPublications) => {
this.publicationList[folderId] = viewPublications
})
@@ -50,7 +50,7 @@ export class PublicationFolderService {
this.FolderDetails[folderId] = viewPublications
})
}
this.restoreFolder[folderId] = true
}
@@ -85,19 +85,19 @@ export class PublicationFolderService {
}
deletePost(folderId: any, DocumentId: any) {
if(this.publicationList[folderId]) {
if(this.publicationList[folderId]) {
this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != DocumentId)
this.save(folderId)
}
}
}
getPublicationDetail(folderId) {
this.publications.GetPresidentialAction(folderId).subscribe(res => {
this.publications.GetPresidentialAction(folderId).subscribe(res => {
this.FolderDetails[folderId] = res
this.storage.set(folderId+"name", res)
}, (error) => {
@@ -113,7 +113,7 @@ export class PublicationFolderService {
try {
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
this.createPublicationList(folderId)
let loadLater = []
for (let publicationId of publicationIds) {
@@ -129,9 +129,9 @@ export class PublicationFolderService {
for( let publicationId of loadLater) {
await this.loadPublication(publicationId, folderId)
}
this.showLoader = false;
this.storage.set(folderId, this.publicationList[folderId]);
this.getpublication = this.publicationList[folderId];
} catch(error) {
@@ -144,15 +144,29 @@ export class PublicationFolderService {
async loadPublication(publicationId, folderId) {
let Publication = await this.publications.GetPublicationWithArrayOfFilesById(publicationId).toPromise();
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
const findIndex = this.publicationFindIndex(publicationId, folderId)
const found = this.publicationIsPresent(publicationId, folderId)
if(!found) {
this.publicationList[folderId].push(publicationDetails)
} else {
this.publicationList[folderId][findIndex] = publicationDetails
let a: any = Object.assign({},this.publicationList[folderId][findIndex])
let b: any = Object.assign({}, publicationDetails)
a.Files = a.Files.length
b.Files = b.Files.length
if(JSON.stringify(a) != JSON.stringify(b)) {
// console.log({a, b})
this.publicationList[folderId][findIndex] = publicationDetails
} else {
// console.log({publicationDetails})
}
}
}
@@ -165,7 +179,7 @@ export class PublicationFolderService {
async setPublication(publicationId, folderId, publicationDetails: Publication) {
const findIndex = this.publicationFindIndex(publicationId, folderId)
const found = this.publicationIsPresent(publicationId, folderId)
if(!found) {
@@ -173,13 +187,13 @@ export class PublicationFolderService {
} else {
this.publicationList[folderId][findIndex] = publicationDetails
}
}
async getPublication(publicationId, folderId, publicationDetails: Publication) {
const findIndex = this.publicationFindIndex(publicationId, folderId)
const found = this.publicationIsPresent(publicationId, folderId)
if(!found) {
@@ -187,7 +201,7 @@ export class PublicationFolderService {
} else {
return this.publicationList[folderId][findIndex]
}
}
@@ -198,7 +212,7 @@ export class PublicationFolderService {
} else {
}
}