diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index caa8a1cd1..f23b660af 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 679a074f2..86b9b1828 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -489,7 +489,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App/App.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 95; + CURRENT_PROJECT_VERSION = 96; DEVELOPMENT_TEAM = 94BRNM2LSS; ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = App/Info.plist; @@ -498,7 +498,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.5; + MARKETING_VERSION = 4.6; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -516,7 +516,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App/App.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 95; + CURRENT_PROJECT_VERSION = 96; DEVELOPMENT_TEAM = 94BRNM2LSS; ENABLE_USER_SCRIPT_SANDBOXING = NO; INFOPLIST_FILE = App/Info.plist; @@ -525,7 +525,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.5; + MARKETING_VERSION = 4.6; PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 2c173ea0c..614b5ce22 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -305,6 +305,10 @@ const routes = [ { path: 'view-document-second-options', loadChildren: () => import('./modals/view-document-second-options/view-document-second-options.module').then( m => m.ViewDocumentSecondOptionsPageModule) + }, + { + path: 'crop-image', + loadChildren: () => import('./modals/crop-image/crop-image.module').then( m => m.CropImagePageModule) } /* diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9b80a69cc..d21866bf4 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -93,6 +93,7 @@ import { InputFilterDirective } from './services/directives/input-filter.directi import { VisibilityDirective } from './services/directives/visibility.directive'; import { DeplomaOptionsPageModule } from './shared/popover/deploma-options/deploma-options.module'; import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-options.page'; +import { ImageCropperModule } from 'ngx-image-cropper'; // import { ServiceWorkerModule } from '@angular/service-worker'; // import { AngularFireModule } from '@angular/fire'; // import { AngularFireMessagingModule } from '@angular/fire/messaging'; @@ -176,6 +177,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ // options DeplomaOptionsPageModule, CreateProcessPageModule, + ImageCropperModule ], entryComponents: [ DiplomaOptionsPage, diff --git a/src/app/interceptors/chatToken.interceptor.ts b/src/app/interceptors/chatToken.interceptor.ts index 974b7d783..66f27b7e4 100644 --- a/src/app/interceptors/chatToken.interceptor.ts +++ b/src/app/interceptors/chatToken.interceptor.ts @@ -103,9 +103,6 @@ export class ChatTokenInterceptor implements HttpInterceptor { private addToken(request: HttpRequest, token: string) { let headers = new HttpHeaders(); - - console.log('X-User-Id', SessionStore.user.ChatData.data.userId) - console.log('X-Auth-Token', SessionStore.user.ChatData.data.authToken) headers = headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); headers = headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); diff --git a/src/app/modals/crop-image/crop-image-routing.module.ts b/src/app/modals/crop-image/crop-image-routing.module.ts new file mode 100644 index 000000000..44fc8145d --- /dev/null +++ b/src/app/modals/crop-image/crop-image-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { CropImagePage } from './crop-image.page'; + +const routes: Routes = [ + { + path: '', + component: CropImagePage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class CropImagePageRoutingModule {} diff --git a/src/app/modals/crop-image/crop-image.module.ts b/src/app/modals/crop-image/crop-image.module.ts new file mode 100644 index 000000000..bc7549919 --- /dev/null +++ b/src/app/modals/crop-image/crop-image.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { CropImagePageRoutingModule } from './crop-image-routing.module'; + +import { CropImagePage } from './crop-image.page'; +import { ImageCropperModule } from 'ngx-image-cropper'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + CropImagePageRoutingModule, + ImageCropperModule + ], + declarations: [CropImagePage] +}) +export class CropImagePageModule {} diff --git a/src/app/modals/crop-image/crop-image.page.html b/src/app/modals/crop-image/crop-image.page.html new file mode 100644 index 000000000..bf56cd320 --- /dev/null +++ b/src/app/modals/crop-image/crop-image.page.html @@ -0,0 +1,43 @@ + + + cropImage + + + + + +
+ +
+ + + + + + + + + + + + + + + +
diff --git a/src/app/modals/crop-image/crop-image.page.scss b/src/app/modals/crop-image/crop-image.page.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/modals/crop-image/crop-image.page.spec.ts b/src/app/modals/crop-image/crop-image.page.spec.ts new file mode 100644 index 000000000..e1ad274d2 --- /dev/null +++ b/src/app/modals/crop-image/crop-image.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { CropImagePage } from './crop-image.page'; + +describe('CropImagePage', () => { + let component: CropImagePage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ CropImagePage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(CropImagePage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modals/crop-image/crop-image.page.ts b/src/app/modals/crop-image/crop-image.page.ts new file mode 100644 index 000000000..e748cadaa --- /dev/null +++ b/src/app/modals/crop-image/crop-image.page.ts @@ -0,0 +1,60 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { NavParams } from '@ionic/angular'; +import { ImageCroppedEvent, ImageCropperComponent } from 'ngx-image-cropper'; + +@Component({ + selector: 'app-crop-image', + templateUrl: './crop-image.page.html', + styleUrls: ['./crop-image.page.scss'], +}) +export class CropImagePage implements OnInit { + + imageChangedEvent: any = ''; + croppedImage: any = ''; + @ViewChild('cropper') cropper: ImageCropperComponent; + capturedImage: any = ""; + base64ToCroppe = ""; + + constructor( + private navParams: NavParams, + private modalController: ModalController, + ) { + this.base64ToCroppe = this.navParams.get('base64ToCroppe') + console.log('To cropp',this.base64ToCroppe) + } + + ngOnInit() { + console.log('To cropp',this.base64ToCroppe) + } + + fileChangeEvent(event: any): void { + this.imageChangedEvent = event; + } + imageCropped(event: ImageCroppedEvent) { + this.croppedImage = event.base64; + + console.log('Croped image',event) + console.log('Croped image 22',this.croppedImage) + // event.blob can be used to upload the cropped image + } + + imageLoaded($event){ + + } + + loadImageFailed() { + console.log('cropp iage faile') + } + + save() { + this.modalController.dismiss({ + base64ToCroppe: this.croppedImage + }); + } + + cancel() { + this.modalController.dismiss() + } + +} diff --git a/src/app/modals/document-detail/document-detail.page.html b/src/app/modals/document-detail/document-detail.page.html index 533cd81da..4e0a48e46 100644 --- a/src/app/modals/document-detail/document-detail.page.html +++ b/src/app/modals/document-detail/document-detail.page.html @@ -51,7 +51,7 @@ >
- {{LoadedDocument.Assunto}} + {{LoadedDocument.Assunto || 'Sem título'}}
{{ LoadedDocument.Sender }} diff --git a/src/app/modals/forward/forward.page.html b/src/app/modals/forward/forward.page.html index a9add5085..e29b40dee 100644 --- a/src/app/modals/forward/forward.page.html +++ b/src/app/modals/forward/forward.page.html @@ -52,7 +52,7 @@ -

{{attachment.Description}}

+

{{attachment.Description || 'Sem título'}}

{{attachment.Stakeholders}} {{ attachment.CreateDate | date: 'dd-MM-yyyy' }}

diff --git a/src/app/modals/view-event/view-event.page.html b/src/app/modals/view-event/view-event.page.html index 5c570a082..17b346bd7 100644 --- a/src/app/modals/view-event/view-event.page.html +++ b/src/app/modals/view-event/view-event.page.html @@ -98,7 +98,7 @@

- {{attach.SourceName}} + {{attach.SourceName || 'Sem título'}} {{attach.Stakeholders}}

diff --git a/src/app/models/envarioment.ts b/src/app/models/envarioment.ts index ca3be5384..db5f6efac 100644 --- a/src/app/models/envarioment.ts +++ b/src/app/models/envarioment.ts @@ -22,7 +22,7 @@ export interface Environment { dispatchPR: string storageProduction: boolean rejectUnauthorized: string - + fileHub: string } @@ -37,4 +37,4 @@ export interface version { change: string; changeStatus: string; changeAuthor: string; -} \ No newline at end of file +} diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 5e11c7fc5..fe7a17da5 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -146,7 +146,6 @@ [eventSource]="listToPresent" [calendarMode]="calendar.mode" [currentDate]="calendar.currentDate" - (onEventSelected)="onEventSelected($event)" (onTitleChanged)="onViewTitleChanged($event)" (onRangeChanged)="onRangeChanged($event)" (onCurrentDateChanged)="onCurrentChanged($event)" @@ -217,9 +216,8 @@
-
- Hoje,  {{ timelineDate }} + Hoje,  {{ todayDateFormat() }}
@@ -232,7 +230,7 @@
-
+
{{ day.daysInfo.dayName }}
{{month.monthInfo.monthName}}
diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 8f1ffd575..b0d2f5f23 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -62,6 +62,8 @@ export class AgendaPage implements OnInit { contacts: EventPerson[] + todayDateFormated: string; + setView(view: CalendarView) { this.view = view; } @@ -283,6 +285,7 @@ export class AgendaPage implements OnInit { this.calendar.currentDate = new Date(); + //this.onCurrentChanged(new Date()) try { this.myCal.update(); @@ -290,6 +293,7 @@ export class AgendaPage implements OnInit { this.onDropDownScrollWeal() } catch (e) { } + //this.reloadCalendar(); this.updateEventListBox() realoadCounter++; @@ -448,11 +452,6 @@ export class AgendaPage implements OnInit { } - onTimeSelected = (ev: { selectedTime: Date, events: any[] }) => { - this.eventSelectedDate2 = ev.selectedTime; - } - - currentMoth = { rangeStartDate: null, rangeEndDate: null @@ -612,7 +611,7 @@ export class AgendaPage implements OnInit { this.loadRangeEventRun(startTime, endTime) } else { - + // alert('other') } } @@ -679,6 +678,7 @@ export class AgendaPage implements OnInit { this.myCal.update(); this.myCal.loadEvents(); + this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds) this.updateEventListBox() }) } @@ -1138,6 +1138,8 @@ export class AgendaPage implements OnInit { reloadCalendar() { // this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); + + this.onCurrentChanged(new Date(this.timelineDate)) } async EventToApproveGoBack() { @@ -1206,6 +1208,11 @@ export class AgendaPage implements OnInit { return true } + todayDateFormat() { + this.todayDateFormated = momentG(new Date(), 'dd MMMM'); + return this.todayDateFormated; + } + } function endOfMonth(myDate) { diff --git a/src/app/pages/agenda/view-event/view-event.page.html b/src/app/pages/agenda/view-event/view-event.page.html index 37c45cba9..6f3fc63e3 100644 --- a/src/app/pages/agenda/view-event/view-event.page.html +++ b/src/app/pages/agenda/view-event/view-event.page.html @@ -95,7 +95,8 @@

- {{attach.SourceName}} + {{attach.SourceName || 'Sem título'}} + {{attach.Stakeholders}}

diff --git a/src/app/pages/agenda/view-event/view-event.page.ts b/src/app/pages/agenda/view-event/view-event.page.ts index 2daf1ba65..d598893ec 100644 --- a/src/app/pages/agenda/view-event/view-event.page.ts +++ b/src/app/pages/agenda/view-event/view-event.page.ts @@ -193,6 +193,7 @@ export class ViewEventPage implements OnInit { if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { this.eventsService.getEvent(this.eventId).subscribe(res => { + console.log('Loaded Event', res) res = this.dateService.fixDate(res as any) this.loadedEvent = res; this.setTimeZone() @@ -217,7 +218,7 @@ export class ViewEventPage implements OnInit { if(this.CalendarId) { this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => { - + console.log('Loaded Event', res) /* const div = document.createElement("div") div.innerHTML = res.Body.Text res.Body.Text = div.innerText */ diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index e0e210b80..a2a7ea13b 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -32,7 +32,6 @@ import { EventTrigger } from 'src/app/services/eventTrigger.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; import { RouteService } from 'src/app/services/route.service'; import { Plugins } from '@capacitor/core'; -import { ChangeDetectorRef } from '@angular/core'; const { App } = Plugins; @@ -129,8 +128,7 @@ export class ChatPage implements OnInit { private eventTriger: EventTrigger, private RochetChatConnectorService: RochetChatConnectorService, private zone: NgZone, - public RouteService: RouteService, - private ChangeDetectorRef: ChangeDetectorRef + public RouteService: RouteService ) { this.headers = new HttpHeaders();; @@ -178,15 +176,6 @@ export class ChatPage implements OnInit { } }); - this.ChatSystemService.setMainChangeDetector(()=> { - this.changeDetector() - }) - - } - - changeDetector = () => { - console.log('run detection') - this.ChangeDetectorRef.detectChanges() } diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 579d32637..76ef54e0a 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -110,7 +110,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { private fileOpener: FileOpener, public RouteService: RouteService, private FileValidatorService: FileValidatorService, - private ChangeDetectorRef: ChangeDetectorRef ) { this.ChatSystemService.getUser() @@ -147,10 +146,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked; this.ChatSystemService.openRoom(this.roomId) this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ') - - this.ChatSystemService.getGroupRoom(this.roomId).setChangeDetector(()=> { - this.changeDetector() - }) } catch (error) { setTimeout(() => { this.open() @@ -159,11 +154,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } - changeDetector = () => { - console.log('run detection page') - this.ChangeDetectorRef.detectChanges() - } - ngOnInit() { this.loggedUser = this.loggedUserChat; @@ -841,7 +831,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { async addFileToChat(types: typeof FileType[]) { - + const roomId = this.roomId @@ -879,7 +869,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } }) return - + } const file: any = await this.fileService.getFileFromDevice(types); diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index e8b1dda24..623b6dd3f 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -37,7 +37,6 @@ import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-co import { FileValidatorService } from "src/app/services/file/file-validator.service" import { sanitize } from "sanitize-filename-ts"; import { FilePicker } from '@capawesome/capacitor-file-picker'; -import { ChangeDetectorRef } from '@angular/core'; @@ -125,7 +124,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { private router: Router, public RochetChatConnectorService: RochetChatConnectorService, private FileValidatorService: FileValidatorService, - private ChangeDetectorRef: ChangeDetectorRef ) { try { @@ -144,10 +142,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.ChatSystemService.getDmRoom(this.roomId).loadHistory({}) this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked this.ChatSystemService.openRoom(this.roomId) - this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => { - - this.changeDetector() - }) setTimeout(() => { this.scrollToBottomClicked() @@ -157,10 +151,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } } - changeDetector = () => { - console.log('run detection page') - this.ChangeDetectorRef.detectChanges() - } + ngOnInit() { try { @@ -1128,6 +1119,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { }, cssClass: 'modal modal-desktop' }); + await modal.present(); +/* await modal.present(); */ var blob = new Blob([pdfString], { type: 'application/pdf' }); diff --git a/src/app/pages/events/events.page.html b/src/app/pages/events/events.page.html index af111bdc6..b8356548b 100644 --- a/src/app/pages/events/events.page.html +++ b/src/app/pages/events/events.page.html @@ -23,26 +23,26 @@
- -
+ +

{{customDate}}

- +

Correspondências com prazo para hoje

{{ TaskService.deadline }}
- +

Correspondências em atraso

{{ TaskService.overdueTasks }}
- +

Correspondências não lidas

@@ -56,12 +56,12 @@

Correspondências com prazo para hoje {{ TaskService.deadline }}

- +

Correspondências em atraso {{ TaskService.overdueTasks }}

- +

Correspondências não lidas {{ TaskService.unread }}

@@ -69,10 +69,10 @@
- +
- +
@@ -87,35 +87,35 @@ slot="end" src="assets/images/icons-arrow-circle-arrow-right.svg" > - + - + - +
- +
- +
{{event.StartDate | date: 'HH:mm'}}
{{event.EndDate | date: 'HH:mm'}}
- +
Todo
o dia
@@ -128,12 +128,12 @@
- +
- +
- +
@@ -150,21 +150,21 @@ slot="end" src="assets/images/icons-arrow-circle-arrow-right.svg" > - + - + - +
@@ -184,15 +184,15 @@
- +
- +
- +
@@ -211,21 +211,21 @@ slot="end" src="assets/images/icons-arrow-circle-arrow-right.svg" > - + - + - +
@@ -233,13 +233,13 @@ - +
- +
{{event.StartDate | date: 'HH:mm'}}
{{event.EndDate | date: 'HH:mm'}}
- +
Todo
o dia
@@ -252,12 +252,12 @@
- + - +
- +
@@ -272,21 +272,21 @@ slot="end" src="assets/images/icons-arrow-circle-arrow-right.svg" > - + - + - +
@@ -304,7 +304,7 @@
- +
@@ -314,4 +314,3 @@ - diff --git a/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html b/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html index 5f02fa00a..a5565b59a 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html +++ b/src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html @@ -96,7 +96,7 @@ (click)="viewDocument(document.SourceId, document.ApplicationId)" class="width-100 d-block list">

- {{document.SourceName}} + {{document.SourceName || 'Sem título'}} Correspondencia AccoesPresidenciais ArquivoDespachoElect diff --git a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html index 0d2d354a3..a94cdaab3 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html +++ b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html @@ -95,7 +95,7 @@ *ngFor="let attachment of loadedAttachments" (click)="viewDocument(attachment.DocId, attachment)"> -

{{attachment.Description}}

+

{{attachment.Description || 'Sem título'}}

{{attachment.Stakeholders}}{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}

diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index bfcbd1e79..338a21563 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -94,6 +94,10 @@ export class ExpedienteDetailPage implements OnInit { this.caller = params["params"].caller; } }); + + window['attachments-expediente-update'] = () => { + this.LoadTaskDetail(this.serialNumber); + } } ngOnInit() { @@ -249,6 +253,8 @@ export class ExpedienteDetailPage implements OnInit { this.TaskService.loadExpedientes(); + console.log("res========", res) + this.task = { "SerialNumber": res.serialNumber, "Folio": res.workflowInstanceDataFields.Subject, diff --git a/src/app/pages/publications/new-publication/new-publication.module.ts b/src/app/pages/publications/new-publication/new-publication.module.ts index aeaa9cc9c..48f26efaa 100644 --- a/src/app/pages/publications/new-publication/new-publication.module.ts +++ b/src/app/pages/publications/new-publication/new-publication.module.ts @@ -9,6 +9,9 @@ import { NewPublicationPageRoutingModule } from './new-publication-routing.modul import { NewPublicationPage } from './new-publication.page'; import '@teamhive/capacitor-video-recorder'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; + + @NgModule({ imports: [ CommonModule, @@ -16,6 +19,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; IonicModule, NewPublicationPageRoutingModule, FontAwesomeModule, + MatProgressBarModule, ], exports: [NewPublicationPage], declarations: [NewPublicationPage] diff --git a/src/app/pages/publications/new-publication/new-publication.page.html b/src/app/pages/publications/new-publication/new-publication.page.html index 9ea946437..b03414b28 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.html +++ b/src/app/pages/publications/new-publication/new-publication.page.html @@ -11,7 +11,7 @@
-
@@ -21,41 +21,50 @@
-
-
+
Fotografia Anexada
-
+
-
+
X
+
+ + + +
+ name="image" ngDefaultControl [src]="seleted.url" + (click)="imageSize(capturedImage)" style="height: 69px; width: 69px;">
- - + -

mais {{ seletedContent.length - displayLimit }}

+

mais {{ PublicationFromMvService.form.Files.length - displayLimit }}

{{capturedImageTitle}}

@@ -66,22 +75,6 @@
- - -
@@ -111,51 +104,7 @@
- - - -
diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 230b452ac..bc823ac54 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -27,14 +27,17 @@ import { FilePicker } from '@capawesome/capacitor-file-picker'; import { CapacitorVideoPlayer } from 'capacitor-video-player'; import { CaptureError, CaptureImageOptions, MediaCapture, MediaFile } from '@awesome-cordova-plugins/media-capture/ngx'; import { Capacitor } from '@capacitor/core'; -import { File } from '@ionic-native/file/ngx'; +import { File as IonicFile } from '@ionic-native/file/ngx'; import { Media } from '@ionic-native/media/ngx'; import { checkFileTypeService } from 'src/app/services/checkFileType.service'; import { FileValidatorService } from "src/app/services/file/file-validator.service" import { App } from '@capacitor/app'; import { NavigationExtras, Router } from '@angular/router'; import { VideoconvertService } from 'src/app/services/videoconvert.service' - +import { PublicationAttachmentEntity } from 'src/app/shared/publication/upload/upload-streaming.service'; +import { PublicationFromMvService } from "src/app/shared/publication/upload/publication-from-mv.service" +import { File } from '../../../models/chatMethod'; +import { CropImagePage } from 'src/app/modals/crop-image/crop-image.page'; const config = { quality: 0.5, @@ -88,8 +91,6 @@ export class NewPublicationPage implements OnInit { validateFrom = false showLoader: boolean; - publication: Publication; - pub: Publication = new Publication(); folderId: string; image: Image = new Image(); @@ -117,7 +118,6 @@ export class NewPublicationPage implements OnInit { photoOrVideo: boolean = false; fileType = ""; filecontent: boolean; - seletedContent: any[] = [] // Set a limit for the number of images to display displayLimit = 4; filesSizeSum = 0; @@ -140,22 +140,38 @@ export class NewPublicationPage implements OnInit { public checkFileType: checkFileTypeService, private FileValidatorService: FileValidatorService, private router: Router, - private videoconvertService: VideoconvertService + private videoconvertService: VideoconvertService, + public PublicationFromMvService: PublicationFromMvService, ) { this.publicationType = this.navParams.get('publicationType'); this.folderId = this.navParams.get('folderId'); - this.publication = this.navParams.get('publication'); - if (this.publication) { - this.seletedContent = this.publication.Files; + const publication = this.navParams.get('publication'); + if (publication && typeof publication?.Files == 'object') { this.filecontent = true; + + const newFiles: PublicationAttachmentEntity[] = publication.Files.map(e => { + return new PublicationAttachmentEntity( + { + base64: e.FileBase64, + extension: e.FileExtension, + OriginalFileName: e.OriginalFileName, + FileType: this.checkFileType.checkFileType(e.FileExtension) as any + } + ) + }) + + for (const files of newFiles) { + this.PublicationFromMvService.form.Files.push(files) + } } - console.log('Edit', this.publication) + + this.publicationTitle = 'Nova Publicação'; this.intent = this.navParams.get('intent'); this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url)); - + this.PublicationFromMvService.clear() } ngOnInit() { @@ -188,37 +204,10 @@ export class NewPublicationPage implements OnInit { resultType: CameraResultType.Base64, source: CameraSource.Camera }); - - console.log(capturedImage) - - this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String; this.capturedImageTitle = 'foto'; - if (this.fileSizeToMB(capturedImage.base64String.length) <= 20) { - const compressedImage = await this.compressImageBase64( - this.capturedImage, - 800, // maxWidth - 800, // maxHeight - 0.9 // quality - ).then((picture) => { - console.log('take picture', this.removeTextBeforeSlash(picture, ','),) - this.filecontent = true; - this.photoOrVideo = false; - let fileObject = { - FileBase64: this.removeTextBeforeSlash(picture, ','), - FileExtension: capturedImage.format, - OriginalFileName: 'image' - } - this.seletedContent.push(fileObject) + this.showCroppModal(); - - }); - } else { - if (this.seletedContent.length === 0) - this.filesSizeSum = 0 - - this.httpErrorHandle.validationMessagge('filessize'); - } } async laodPicture() { @@ -251,63 +240,56 @@ export class NewPublicationPage implements OnInit { console.log('video record', data) data.forEach(async element => { this.filesSizeSum = this.filesSizeSum + element.size - if (this.fileSizeToMB(this.filesSizeSum) <= 20) { - - try { - if (this.platform.is('ios')) { - this.recordevideoIos(element.fullPath) - } else { - this.recordVideoAndroid(element.fullPath) - } - - } catch (e) { - console.error('Unable to write file', e); + // element.size + try { + if (this.platform.is('ios')) { + this.recordevideoIos(element.fullPath, element) + } else { + this.recordVideoAndroid(element.fullPath, element) } - } else { - if (this.seletedContent.length === 0) - this.filesSizeSum = 0 - - this.httpErrorHandle.validationMessagge('filessize') + } catch (e) { + console.error('Unable to write file', e); } + }); } catch (error) { console.log('record video error: ', error) } } - async loadVideo() { - const result = await FilePicker.pickMedia ({ multiple: true, }); - console.log(result.files) - result.files.forEach(async element => { - this.filesSizeSum = this.filesSizeSum + element.size - if (this.fileSizeToMB(this.filesSizeSum) <= 20) { - console.log('pass size verificartion') + async loadVideo() { + const result = await FilePicker.pickMedia({ multiple: true, }); + console.log(result.files) + result.files.forEach(async element => { + this.filesSizeSum = this.filesSizeSum + element.size + if (this.fileSizeToMB(this.filesSizeSum) <= 20) { + console.log('pass size verificartion') if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) { - let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl) - try { - this.recordevideoIos(resultUrl) - } catch (error) { - console.log('upload video error: ', error) - } - } else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { + let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl) + try { + this.recordevideoIos(resultUrl, element) + } catch (error) { + console.log('upload video error: ', error) + } + } else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { let resultUrl = decodeURIComponent(element.path); - console.log('pass type verification ', resultUrl) - try { - this.loadVideoAndroid(resultUrl,element) - } catch (error) { - console.log('upload video error: ', error) - } - } - } else { - if (this.seletedContent.length === 0) - this.filesSizeSum = 0 + console.log('pass type verification ', resultUrl) + try { + this.loadVideoAndroid(resultUrl, element) + } catch (error) { + console.log('upload video error: ', error) + } + } + } else { + if (this.PublicationFromMvService.form.Files.length === 0) + this.filesSizeSum = 0 - this.httpErrorHandle.validationMessagge('filessize') - } - }); - }; + this.httpErrorHandle.validationMessagge('filessize') + } + }); + }; chossePhotoOrVideo() { @@ -367,14 +349,14 @@ export class NewPublicationPage implements OnInit { injectValidation() { this.Form = new FormGroup({ - Subject: new FormControl(this.pub.Title, [ + Subject: new FormControl(this.PublicationFromMvService.form.Title, [ Validators.required, // Validators.minLength(4) ]), capturedImage: new FormControl(this.capturedImage, [ ]), - Message: new FormControl(this.pub.Message, [ + Message: new FormControl(this.PublicationFromMvService.form.Message, [ Validators.required, Validators.maxLength(1000) @@ -390,172 +372,26 @@ export class NewPublicationPage implements OnInit { if (this.Form.invalid) return false - if (this.seletedContent.length != 0) { + if (this.PublicationFromMvService.form.Files.length != 0) { - if (this.publicationType == '3') { - const loader = this.toastService.loading() - - // has file - if (this.PublicationFolderService.PublicationHasImage(this.publication)) { - this.publication = { - DateIndex: this.publication.DateIndex, - DocumentId: this.publication.DocumentId, - ProcessId: this.publication.ProcessId, - Title: this.pub.Title, - Message: this.pub.Message, - DatePublication: this.publication.DatePublication, - OriginalFileName: this.publication.OriginalFileName, - Files: this.seletedContent, - } - - /* } else if (this.capturedVideo != '' && this.capturedImage == '') { - this.publication = { - DateIndex: this.publication.DateIndex, - DocumentId: this.publication.DocumentId, - ProcessId: this.publication.ProcessId, - Title: this.pub.Title, - Message: this.pub.Message, - DatePublication: this.publication.DatePublication, - OriginalFileName: this.publication.OriginalFileName || 'video', - Files: this.seletedContent, - FileExtension: 'mp4', - } - } */ - // no names - } else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) { - this.publication = { - DateIndex: this.publication.DateIndex, - DocumentId: this.publication.DocumentId, - ProcessId: this.publication.ProcessId, - Title: this.pub.Title, - Message: this.pub.Message, - DatePublication: this.publication.DatePublication, - OriginalFileName: this.publication.OriginalFileName, - Files: this.seletedContent, - } - - - } /* else { - this.publication = { - DateIndex: this.publication.DateIndex, - DocumentId: this.publication.DocumentId, - ProcessId: this.publication.ProcessId, - Title: this.pub.Title, - Message: this.pub.Message, - DatePublication: this.publication.DatePublication, - OriginalFileName: this.publication.OriginalFileName, - FileBase64: this.publication.FileBase64, - FileExtension: this.publication.FileExtension || 'jpeg', - } - - } */ - - - try { - - const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() - - this.httpErrorHandle.httpsSucessMessagge('Editar publicação') - console.log({ response }) - - - this.close(); - } catch (error) { - if (error.status == 404) { - this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId) - this.close(); - } - this.httpErrorHandle.httpStatusHandle(error) - } finally { - loader.remove() - } - - } - else { - - const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss') - - /* this.seletedContent = this.seletedContent.map((e) => { - if(e.FileExtension == "mp4") { - return { - FileBase64: e.FileBase64, - FileExtension: 'data:video/mp4;base64,'+e.FileExtension, - OriginalFileName: "video", - } - } - - return e - }) */ - - /* if (this.capturedImage != '') { */ - this.publication = { - DateIndex: date, - DocumentId: null, - ProcessId: JSON.stringify(this.folderId), - Title: this.pub.Title, - Message: this.pub.Message, - DatePublication: date, - OriginalFileName: this.capturedImageTitle || 'foto', - Files: this.seletedContent, - /* FileExtension: 'jpeg', */ - } - - /* } else if (this.capturedVideo != '') { - this.publication = { - DateIndex: date, - DocumentId: null, - ProcessId: this.folderId, - Title: this.pub.Title, - Message: this.pub.Message, - DatePublication: date, - OriginalFileName: this.capturedImageTitle || 'video', - Files: this.seletedContent, - FileExtension: 'mp4', - } - } */ - - - const loader = this.toastService.loading() - - try { - - - await this.publications.CreatePublication(this.folderId, this.publication).toPromise(); - this.httpErrorHandle.httpsSucessMessagge('Criar publicação') - if (window["sharedContent"]) { - - window["sharedContent"] = null - window["openFolder"] = true - - if(window.innerWidth <= 700) { - this.router.navigate(['/home/publications', this.folderId]); - } else if(window.innerWidth >= 701){ - let navigationExtras: NavigationExtras = { queryParams: { "folderId": this.folderId, } }; - this.router.navigate(['/home/publications']); - } - - return - } - - this.close(); - } catch (error) { - this.httpErrorHandle.httpStatusHandle(error) - } finally { - loader.remove() - } - - } - - this.PublicationFolderService.getPublicationsIds(this.folderId) + this.close(); + this.PublicationFromMvService.setFolderId(this.folderId) + await this.PublicationFromMvService.save() } else { this.httpErrorHandle.validationMessagge("noFileSelected") } } + ngOnDestroy() { + // if(!this.PublicationFromMvService.form.send) { + // this.PublicationFromMvService.cancel() + // } + } + close() { - this.modalController.dismiss(this.publication).then(() => { + this.modalController.dismiss(this.PublicationFromMvService.form).then(() => { this.showLoader = true; }); @@ -566,7 +402,7 @@ export class NewPublicationPage implements OnInit { clear() { this.capturedImageTitle = null; - this.seletedContent = []; + this.PublicationFromMvService.form.Files = []; } setTitle() { @@ -578,8 +414,6 @@ export class NewPublicationPage implements OnInit { } else if (this.publicationType == '3') { this.publicationTitle = 'Editar Publicação'; - this.pub = this.navParams.get('publication'); - } } @@ -603,7 +437,7 @@ export class NewPublicationPage implements OnInit { deletePublicationImage() { - this.seletedContent = [] + this.PublicationFromMvService.form.Files = [] } async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise { @@ -744,41 +578,41 @@ export class NewPublicationPage implements OnInit { if (this.checkFileType.checkFileType(FileExtension) == 'image' || this.checkFileType.checkFileType(FileExtension) == 'video') { let resultUrl = decodeURIComponent(element.url); - if(this.platform.is('ios')) { + if (this.platform.is('ios')) { const stringGerada = this.gerarStringAleatoria(); -console.log(stringGerada); - this.shareContentIso(resultUrl,FileExtension,stringGerada) + console.log(stringGerada); + this.shareContentIso(resultUrl, FileExtension, stringGerada) } else { - this.shareContentAndroid(resultUrl,FileExtension) + this.shareContentAndroid(resultUrl, FileExtension) } -/* - Filesystem.readFile({ path: resultUrl }).then(async (content) => { - let fileObject; - try { - if (this.checkFileType.checkFileType(FileExtension) == 'image') { - fileObject = { - FileBase64: this.removeTextBeforeSlash(content.data, ','), - FileExtension: FileExtension, - OriginalFileName: 'shared', - } + /* + Filesystem.readFile({ path: resultUrl }).then(async (content) => { + let fileObject; + try { + if (this.checkFileType.checkFileType(FileExtension) == 'image') { + fileObject = { + FileBase64: this.removeTextBeforeSlash(content.data, ','), + FileExtension: FileExtension, + OriginalFileName: 'shared', + } - } else if (this.checkFileType.checkFileType(FileExtension) == 'video') { - fileObject = { - FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), - FileExtension: FileExtension, - OriginalFileName: 'shared', - } + } else if (this.checkFileType.checkFileType(FileExtension) == 'video') { + fileObject = { + FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), + FileExtension: FileExtension, + OriginalFileName: 'shared', + } - } - console.log('shared base', content.data) + } + console.log('shared base', content.data) - this.seletedContent.push(fileObject) - } catch (error) { - console.log('error shared filesystem', error) - } + this.seletedContent.push(fileObject) + } catch (error) { + console.log('error shared filesystem', error) + } - }) */ + }) */ } else { this.httpErrorHandle.validationMessagge('filetype'); } @@ -794,7 +628,7 @@ console.log(stringGerada); } deleteFromSeletedContent(index) { - this.seletedContent.splice(index, 1) + this.PublicationFromMvService.form.Files.splice(index, 1) } closeApp() { @@ -806,75 +640,86 @@ console.log(stringGerada); } - async recordevideoIos(fullPath) { - console.log('fullpath', fullPath) + async recordevideoIos(fullPath, element) { + try { - const directory = await Filesystem.getUri({ - directory: Directory.Cache, - path: '', - }); + const directory = await Filesystem.getUri({ + directory: Directory.Cache, + path: '', + }); - const stringGerada = this.gerarStringAleatoria(); -console.log(stringGerada); - let fileObject ={}; - this.videoconvertService.convertVideo(fullPath,directory.uri,stringGerada,'mp4').then(async () => { - await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4`}) + const stringGerada = this.gerarStringAleatoria(); - .then(async (content) => { - this.filecontent = true; - fileObject = {} - console.log('First clean',fileObject) - fileObject = { - FileBase64: 'data:video/mp4;base64,' + content.data, - FileExtension: 'mp4', - OriginalFileName: stringGerada - } - console.log('what do we have',fileObject) - this.seletedContent.push(fileObject) - console.log('file object 1',fileObject) - fileObject ={}; - const deleteSecretFile = async () => { - await Filesystem.deleteFile({ - path: `${stringGerada}.mp4`, - directory: Directory.Cache, - }); - }; - await deleteSecretFile().then((value) => { - console.log('delete file',value) - fileObject ={}; - console.log('file object 2',fileObject) - }) - }) - .catch((erro) => console.error('read converted video erro ', erro)); - }); + this.videoconvertService.convertVideo(fullPath, directory.uri, stringGerada, 'mp4').then(async () => { + await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4` }) + + .then(async (content) => { + this.filecontent = true; + + const file = new File([element.blob], element.name); + + const newAttachment = new PublicationAttachmentEntity( + { + base64: 'data:video/mp4;base64,' + content.data, + extension: 'mp4', + blobFile: file, + FileType: this.checkFileType.checkFileType('mp4') as any, + OriginalFileName: 'load video' + } + ) + + this.PublicationFromMvService.form.Files.push(newAttachment) + + const deleteSecretFile = async () => { + await Filesystem.deleteFile({ + path: `${stringGerada}.mp4`, + directory: Directory.Cache, + }); + }; + await deleteSecretFile().then((value) => { + console.log('delete file', value) + }) + }) + .catch((erro) => console.error('read converted video erro ', erro)); + }); - } catch (error) { + } catch (error) { console.log('record video ios erro, ', error) - } + } } - async recordVideoAndroid(fullPath) { + async recordVideoAndroid(fullPath, element) { try { - const savedFile = await Filesystem.copy({ - from: fullPath, - to: "video.mp4", - toDirectory: FilesystemDirectory.Data - }); - console.log(savedFile.uri) - Filesystem.readFile({ path: savedFile.uri }) + const savedFile = await Filesystem.copy({ + from: fullPath, + to: "video.mp4", + toDirectory: FilesystemDirectory.Data + }); + console.log(savedFile.uri) + Filesystem.readFile({ path: savedFile.uri }) - .then(async (content) => { - this.filecontent = true; - let fileObject = { - FileBase64: 'data:video/mp4;base64,' + content.data, - FileExtension: 'mp4', - OriginalFileName: 'video' - } - this.seletedContent.push(fileObject) - }) - .catch((error) => console.error('reade converted video erro ',error)); + .then(async (content) => { + + this.filecontent = true; + + const file = new File([element.blob], element.name); + window['a'] = element + const newAttachment = new PublicationAttachmentEntity( + { + base64: 'data:video/mp4;base64,' + content.data, + extension: 'mp4', + blobFile: file, + FileType: this.checkFileType.checkFileType('mp4') as any, + OriginalFileName: 'load video' + } + ) + this.PublicationFromMvService.form.Files.push(newAttachment) + + + }) + .catch((error) => console.error('reade converted video erro ', error)); } catch (error) { console.log('record video android erro ', error) @@ -885,34 +730,49 @@ console.log(stringGerada); } - loadVideoAndroid(resultUrl,element) { + loadVideoAndroid(resultUrl, element) { Filesystem.readFile({ path: resultUrl }) - .then(async (content) => { - console.log(content) - this.filecontent = true; - let fileObject; - if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") { - fileObject = { - FileBase64: 'data:video/mp4;base64,' + content.data, - FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'), - OriginalFileName: 'video' - } - } else { - fileObject = { - FileBase64: 'data:image/jpeg;base64,' + content.data, - FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'), - OriginalFileName: 'image' - } - } + .then(async (content) => { - this.seletedContent.push(fileObject) - }) - .catch((err) => console.error(err)); + this.filecontent = true; + + if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") { + + const newAttachment = new PublicationAttachmentEntity( + { + base64: content.data, + extension: this.removeTextBeforeSlash(element.mimeType, '/'), + FileType: this.checkFileType.checkFileType(this.removeTextBeforeSlash(element.mimeType, '/')) as any, + OriginalFileName: 'load video' + } + ) + + newAttachment.needUpload() + this.PublicationFromMvService.form.Files.push(newAttachment) + + } else { + this.capturedImage = 'data:image/jpeg;base64,' + content.data; + this.showCroppModal() + /* const newAttachment = new PublicationAttachmentEntity( + { + base64: 'data:image/jpeg;base64,' + content.data, + extension: this.removeTextBeforeSlash(element.mimeType, '/'), + FileType: this.checkFileType.checkFileType(this.removeTextBeforeSlash(element.mimeType, '/')) as any, + OriginalFileName: 'image' + } + ) + + this.PublicationFromMvService.form.Files.push(newAttachment) */ + } + + + }) + .catch((err) => console.error(err)); } - gerarStringAleatoria() { + gerarStringAleatoria() { const caracteres = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; let stringAleatoria = ''; @@ -924,7 +784,7 @@ console.log(stringGerada); return stringAleatoria; } - async shareContentIso(fullPath,FileExtension,filename) { + async shareContentIso(fullPath, FileExtension, filename) { try { if (this.checkFileType.checkFileType(FileExtension) == 'image') { @@ -932,14 +792,14 @@ console.log(stringGerada); Filesystem.readFile({ path: fullPath }).then(async (content) => { let fileObject; try { - fileObject = { - FileBase64: this.removeTextBeforeSlash(content.data, ','), - FileExtension: FileExtension, - OriginalFileName: 'shared', - } + fileObject = { + FileBase64: this.removeTextBeforeSlash(content.data, ','), + FileExtension: FileExtension, + OriginalFileName: 'shared', + } console.log('shared base', content.data) - this.seletedContent.push(fileObject) + this.PublicationFromMvService.form.Files.push(fileObject) } catch (error) { console.log('error shared filesystem', error) } @@ -951,55 +811,62 @@ console.log(stringGerada); path: '', }); - let fileObject ={}; - this.videoconvertService.convertVideo(fullPath,directory.uri,filename,'mp4').then(async () => { - await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4`}) + let fileObject = {}; + this.videoconvertService.convertVideo(fullPath, directory.uri, filename, 'mp4').then(async () => { + await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4` }) - .then(async (content) => { - console.log(content.data) - this.filecontent = true; + .then(async (content) => { + console.log(content.data) + this.filecontent = true; /* fileObject = { FileBase64: this.removeTextBeforeSlash(content.data, ','), FileExtension: 'mp4', OriginalFileName: 'shared', } */ - fileObject = { - FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), - FileExtension: 'mp4', - OriginalFileName: 'shared', - } - this.seletedContent.push(fileObject) - fileObject ={}; - const deleteSecretFile = async () => { - await Filesystem.deleteFile({ - path: `${filename}.mp4`, - directory: Directory.Cache, - }); - }; - deleteSecretFile().then((value) => { - console.log('delete file',value) - fileObject ={}; - }) - }) - .catch((erro) => console.error('read converted video erro ', erro)); + + const newAttachment = new PublicationAttachmentEntity( + { + base64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), + extension: 'mp4', + FileType: this.checkFileType.checkFileType('mp4') as any, + OriginalFileName: 'shared' + } + ) + newAttachment.needUpload() + + this.PublicationFromMvService.form.Files.push(newAttachment) + fileObject = {}; + const deleteSecretFile = async () => { + await Filesystem.deleteFile({ + path: `${filename}.mp4`, + directory: Directory.Cache, + }); + }; + deleteSecretFile().then((value) => { + console.log('delete file', value) + fileObject = {}; + }) + .catch((erro) => console.error('read converted video erro ', erro)); + }); + }); } - - } catch (error) { - console.log('record video ios erro, ', error) + console.log('record video ios erro, ', error) } + } - shareContentAndroid(resultUrl,FileExtension) { + + shareContentAndroid(resultUrl, FileExtension) { Filesystem.readFile({ path: resultUrl }).then(async (content) => { let fileObject; try { if (this.checkFileType.checkFileType(FileExtension) == 'image') { fileObject = { - FileBase64: 'data:image/jpeg;base64,' +this.removeTextBeforeSlash(content.data, ','), + FileBase64: 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ','), FileExtension: FileExtension, OriginalFileName: 'shared', } @@ -1014,7 +881,7 @@ console.log(stringGerada); } console.log('shared base', content.data) - this.seletedContent.push(fileObject) + this.PublicationFromMvService.form.Files.push(fileObject) } catch (error) { console.log('error shared filesystem', error) } @@ -1023,5 +890,38 @@ console.log(stringGerada); } + async showCroppModal() { + const modal = await this.modalController.create({ + component: CropImagePage, + componentProps: { + base64ToCroppe: this.capturedImage + }, + cssClass: 'modal modal-desktop' + }); + + modal.onDidDismiss().then((res) => { + if (res) { + this.capturedImage = res.data + this.filecontent = true; + this.photoOrVideo = false; + + const newAttachment = new PublicationAttachmentEntity( + { + base64: res.data.base64ToCroppe, + extension: 'jpeg', + OriginalFileName: "image", + FileType: 'image' + } + ) + + this.PublicationFromMvService.form.Files.push(newAttachment) + } + }, (error) => { + console.log(error) + }); + + await modal.present(); + } + } diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html index e3341a10a..cc2ec7062 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.html @@ -30,7 +30,7 @@ src="{{'data:image/jpg;base64,' + files.FileBase64}}"> diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.scss b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.scss index d64009620..accc7ad41 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.scss +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.scss @@ -56,14 +56,32 @@ ion-toolbar { .post-img { width: 100%; - height: 400px; + height: 100%; + + max-height: 400px; + min-height: 350px; + min-width: 350px; + margin: 0 auto; + border-radius: 0px !important; + overflow: hidden; + + display: flex; + justify-content: center; +} + +.post-video { + width: 100%; + height: 100%; + + max-height: 400px; + min-height: 350px; + min-width: 350px; margin: 0 auto; border-radius: 0px !important; overflow: hidden; display: flex; justify-content: center; - height: 420px; } .post-img img { height: 100%; diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index eeb82b286..241bbb7d8 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -52,8 +52,8 @@ [lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 306b947b2..490ba8fe2 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -21,6 +21,8 @@ import { StopvideoService } from "src/app/services/stopvideo.service" import { Result } from 'neverthrow'; import { App } from '@capacitor/app'; import { ActiveTabService } from 'src/app/services/active-tab.service'; +import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service' + @Component({ selector: 'app-view-publications', templateUrl: './view-publications.page.html', @@ -71,7 +73,8 @@ export class ViewPublicationsPage implements OnInit { private publicationVideoManagerService: PublicationVideoManagerService, public stopvideoService: StopvideoService, private platform: Platform, - public activeTabService: ActiveTabService) { + public activeTabService: ActiveTabService, + public PublicationHolderService: PublicationHolderService) { /* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */ @@ -311,20 +314,26 @@ export class ViewPublicationsPage implements OnInit { } async AddPublication(publicationType: any, folderId: any) { - const modal = await this.modalController.create({ - component: NewPublicationPage, - componentProps: { - publicationType: publicationType, - folderId: this.folderId, - }, - cssClass: 'new-publication modal modal-desktop', - backdropDismiss: false - }); - modal.onDidDismiss().then(() => { - this.doRefresh(event); - }); - await modal.present(); + if(this.PublicationHolderService.PublicationFormMV.length == 0) { + const modal = await this.modalController.create({ + component: NewPublicationPage, + componentProps: { + publicationType: publicationType, + folderId: this.folderId, + }, + cssClass: 'new-publication modal modal-desktop', + backdropDismiss: false + }); + + modal.onDidDismiss().then(() => { + this.doRefresh(event); + }); + await modal.present(); + } else { + this.toastService._successMessage('já existe uma publicação a ser processado'); + } + } goToPublicationDetail(DocumentId: string, ProcessId: string) { diff --git a/src/app/services/agenda/list-box.service.ts b/src/app/services/agenda/list-box.service.ts index 192498ec2..afbd53d31 100644 --- a/src/app/services/agenda/list-box.service.ts +++ b/src/app/services/agenda/list-box.service.ts @@ -99,7 +99,6 @@ export class ListBoxService { display(list: CustomCalendarEvent[], selectedDate) { - let days = {}; const year: Year[] = [] @@ -174,6 +173,14 @@ export class ListBoxService { const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true}) if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) { days[otherDays].push(EndEvent) ; this.push(EndEvent, year) + } else { + if( cloneEvent.start.getFullYear() == cloneSelectedDate.getFullYear() && cloneEvent.start.getDate() == cloneSelectedDate.getDate() && cloneEvent.start.getMonth() == cloneSelectedDate.getMonth()) { + // console.log("00_00") + days[otherDays].push(EndEvent) ; this.push(EndEvent, year) + } else { + // console.log('0000000000000000000000000',cloneEvent.start.getTime(), cloneSelectedDate.getTime()) + // console.log('0000000000000000000000000',cloneEvent.start, cloneSelectedDate) + } } } diff --git a/src/app/services/chat/chat-system.service.ts b/src/app/services/chat/chat-system.service.ts index 8ac80a56c..f7b2089d0 100644 --- a/src/app/services/chat/chat-system.service.ts +++ b/src/app/services/chat/chat-system.service.ts @@ -151,15 +151,6 @@ export class ChatSystemService { } catch(error) {} } - setMainChangeDetector(x:Function) { - this.mainChangeDetector = x - } - - runMainChangeDetector() { - console.log("change") - // this.mainChangeDetector() - } - loadChat() { if (SessionStore.user?.ChatData?.data) { this.ReLoadChat() diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 857a802f0..3767b9518 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -25,7 +25,6 @@ import { ChatSystemService } from './chat-system.service'; import { ViewedMessageService } from './viewed-message.service' import * as FIFOProcessQueue from 'fifo-process-queue'; import { NotificationsService } from '../notifications.service'; -import { ChangeDetectorRef } from '@angular/core'; @Injectable({ providedIn: 'root' @@ -85,7 +84,6 @@ export class RoomService { sortRoomList = () => { } chatServiceDeleteRoom = (roomId) => { } - private changeDetector: Function = () => {} constructor( public RochetChatConnectorService: RochetChatConnectorService, @@ -192,11 +190,6 @@ export class RoomService { } - setChangeDetector(x:Function) { - console.log("set change detector") - this.changeDetector = x - } - get online() { if (!this.isGroup) { @@ -391,6 +384,7 @@ export class RoomService { this.name = ChatMessage.msg } + this.sortRoomList() // this.changeDetector() setTimeout(() => { done() diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index 1011c14d8..e4dc8f6b0 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -1206,11 +1206,23 @@ export class EventsService { }) ) } else { + const calendar = this.DetectCalendars(calendarId) + const header = this.makeHeader(calendar) + options = { + headers: header, + params: params + }; + + return this.http.delete(`${puturl}`, options).pipe( + catchError(err => { + + this.offlinemanager.storeRequestData('eventDelete', arrayReq); + throw new Error(err); + }) + ) } - throw('header not found') - } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 750711340..8a26feedf 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -202,9 +202,6 @@ export class NotificationsService { this.active = true console.log('NOtification Listener', notification) this.storenotification(notification) - this.chatNotification(notification) - - } ); @@ -216,7 +213,6 @@ export class NotificationsService { this.eventtrigger.publishSomeData({ notification: "recive" }) - this.chatNotification(notification) // Handle the received message, e.g., show a notification }); } @@ -400,12 +396,4 @@ export class NotificationsService { } - chatNotification(_notification) { - const notification = this.NotificationHolderService.stractureNotificationObject(_notification) - - if (notification?.notification?.data?.Service === "chat" || notification?.Service === "chat") { - this.ChatController.ChatSystemService.runMainChangeDetector() - } - } - } diff --git a/src/app/services/publication/holder.service.spec.ts b/src/app/services/publication/holder.service.spec.ts new file mode 100644 index 000000000..6faab2556 --- /dev/null +++ b/src/app/services/publication/holder.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { HolderService } from './holder.service'; + +describe('HolderService', () => { + let service: HolderService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(HolderService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/shared/publication/upload/publication-form-mv.service.ts b/src/app/services/publication/holder.service.ts similarity index 72% rename from src/app/shared/publication/upload/publication-form-mv.service.ts rename to src/app/services/publication/holder.service.ts index 7fbeee014..302c7873d 100644 --- a/src/app/shared/publication/upload/publication-form-mv.service.ts +++ b/src/app/services/publication/holder.service.ts @@ -3,7 +3,7 @@ import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) -export class PublicationFormMVService { +export class HolderService { constructor() { } } diff --git a/src/app/services/publication/publication-holder.service.spec.ts b/src/app/services/publication/publication-holder.service.spec.ts new file mode 100644 index 000000000..e89d9e0ec --- /dev/null +++ b/src/app/services/publication/publication-holder.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { PublicationHolderService } from './publication-holder.service'; + +describe('PublicationHolderService', () => { + let service: PublicationHolderService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(PublicationHolderService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/publication/publication-holder.service.ts b/src/app/services/publication/publication-holder.service.ts new file mode 100644 index 000000000..beda76b73 --- /dev/null +++ b/src/app/services/publication/publication-holder.service.ts @@ -0,0 +1,99 @@ +import { Injectable } from '@angular/core'; +import { PublicationFormMV } from 'src/app/shared/publication/upload/upload-streaming.service'; + +@Injectable({ + providedIn: 'root' +}) +export class PublicationHolderService { + + count = 0 + PublicationFormMV: { + id: string, + percentage: number, + retry: boolean, + retryFunction: Function + }[] = [] + + constructor() { + + window['upload-header-set-percentage'] = (id: string, percentage: number) => { + this.PublicationFormMV = this.PublicationFormMV.map((e)=> { + if(e.id == id) { + console.log("percentage", percentage) + e.percentage = percentage + } + return e + }) + + + this.uploadPercentage() + } + + window['upload-header-set-add'] = (id: string, percentage: number, save: Function) => { + this.remove(id) + this.PublicationFormMV.push({id, percentage, retry: false, retryFunction: save}) + this.uploadPercentage() + } + + + window['upload-header-set-remove'] = (id: string) => { + this.remove(id) + } + + + window['upload-header-set-retry'] = (id: string) => { + + this.PublicationFormMV = this.PublicationFormMV.map((e)=> { + if(e.id == id) { + e.retry = true + } + return e + }) + + this.uploadPercentage() + } + + window['upload-header-remove-retry'] = (id: string) => { + this.uploadPercentage() + + this.PublicationFormMV = this.PublicationFormMV.map((e)=> { + if(e.id == id) { + e.retry = false + } + return e + }) + + + this.uploadPercentage() + + } + + } + + remove(id: string) { + this.PublicationFormMV = this.PublicationFormMV.filter((e)=> e.id != id) + this.uploadPercentage() + } + + hasPublication() { + return this.PublicationFormMV.length >= 1 + } + + + uploadPercentage = () => { + + const percentageArray = this.PublicationFormMV.map((e) => e.percentage) + + // Check if the array is not empty + if (percentageArray.length === 0) { + this.count = 0 + } else { + let sum = percentageArray.reduce((acc, percentage) => acc + percentage, 0); + + // Calculate the average percentage + let averagePercentage = sum / percentageArray.length; + + this.count = Math.ceil(averagePercentage) + } + } +} diff --git a/src/app/services/socket-connection-mcr.service.ts b/src/app/services/socket-connection-mcr.service.ts index 3340a6872..e4fd89dd7 100644 --- a/src/app/services/socket-connection-mcr.service.ts +++ b/src/app/services/socket-connection-mcr.service.ts @@ -5,7 +5,8 @@ import { v4 as uuidv4 } from 'uuid' import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http'; import { CMAPIService } from '../shared/repository/CMAPI/cmapi.service'; import { HubConnectionBuilder } from '@microsoft/signalr'; -import { ok, err, Result } from 'neverthrow'; +import { ok, err as Err, Result } from 'neverthrow'; +import { environment } from 'src/environments/environment'; @Injectable({ providedIn: 'root' }) @@ -90,7 +91,7 @@ class ReconnectingWebSocketSignalR { } this.connection = new signalR.HubConnectionBuilder() - .withUrl('https://gdcmapi-dev.dyndns.info/FileHub', { + .withUrl( environment.fileHub, { transport: signalR.HttpTransportType.LongPolling, accessTokenFactory: () => SessionStore.user.Authorization }) @@ -139,7 +140,7 @@ class ReconnectingWebSocketSignalR { if (!this.stop && (!error || error.message !== "Connection stopped by client.")) { setTimeout(() => { this.connect(); - }, 1000); // Ajuste o atraso conforme necessário + }, 3000); // Ajuste o atraso conforme necessário } @@ -147,14 +148,30 @@ class ReconnectingWebSocketSignalR { } commit(path): Promise> { + console.log('committing') return new Promise((resolve, reject) => { - this.connection.invoke("CommitUpload", path).then((e) => { - console.log("commit message", e) - resolve(ok(true)) - }).catch(err => { - resolve(err(false)) - console.error(err.toString()) - }); + if(this.isOpen) { + try { + console.log('this.connection.invoke', this.connection) + this.connection.invoke("CommitUpload", path).then((e) => { + console.log("commit message", e) + resolve(ok(true)) + }).catch(err => { + console.error('upload catch commit error') + resolve(Err(false)) + console.error(err.toString()) + }); + } catch(error) { + resolve(Err(false)) + console.error('upload commit error') + console.error(error) + } + + } else { + this.onConnect.push(()=> { + resolve(this.commit(path)) + }) + } }) } @@ -390,32 +407,17 @@ export class ObjectMergeNotification{ watchCount = 0 constructor() { - // this.socket.onDisconnectCallback(()=> { - // console.log("run watch") - // this.runWatch = true - // this.watch() - // }) + this.socket.onDisconnectCallback(()=> { + //console.log("run watch") + this.runWatch = true + //this.watch() + }) - // this.socket.onConnectCallback(()=> { + this.socket.onConnectCallback(() => { + console.log("open trigger") + this.runWatch = false + }) - // console.log("open trigger") - // this.runWatch = false - // }) - - // this.socket.subscribe((data: socketResponse) => { - // if(data.IsCompleted == true) { - // console.log("==================!!!====================") - // try { - // this.callbacks[data.Guid](data) - // delete this.callbacks[data.Guid] - // } catch (error) {} - // } else { - // console.log("else", data) - // } - // }) - - // this.socket.connect(); - // this.watch() } connect() { @@ -430,33 +432,33 @@ export class ObjectMergeNotification{ async watch() { - // this.watchCount = 0; + this.watchCount = 0; - // if(this.runWatch) { - // setTimeout(async () => { - // for(const [key, funx] of Object.entries(this.callbacks)) { + if(this.runWatch) { + setTimeout(async () => { + for(const [key, funx] of Object.entries(this.callbacks)) { - // const request = await this.CMAPIService.getVideoHeader(key) + const request = await this.CMAPIService.getVideoHeader(key) - // if(request.isOk()) { - // funx() - // delete this.callbacks[key] - // } - // } + if(request.isOk()) { + funx() + delete this.callbacks[key] + } + } - // this.watchCount++ - // if(this.watchCount <= 15) { - // this.watch() - // } else { - // this.runWatch = false - // } + this.watchCount++ + if(this.watchCount <= 15) { + this.watch() + } else { + this.runWatch = false + } - // }, 1000) + }, 1000) - // } else { - // console.log("end loop============================") - // } + } else { + console.log("end loop============================") + } } subscribe(GUID, callback:Function) { diff --git a/src/app/shared/agenda/approve-event/approve-event.page.html b/src/app/shared/agenda/approve-event/approve-event.page.html index f235afeb1..f9f560d32 100644 --- a/src/app/shared/agenda/approve-event/approve-event.page.html +++ b/src/app/shared/agenda/approve-event/approve-event.page.html @@ -106,7 +106,7 @@ *ngFor="let attachment of loadedAttachments" (click)="viewDocument(attachment.DocId, attachment)"> -

{{attachment.Description}}

+

{{attachment.Description || 'Sem título'}}

{{attachment.Stakeholders}}{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}

diff --git a/src/app/shared/agenda/view-event/view-event.page.html b/src/app/shared/agenda/view-event/view-event.page.html index 3cd10fa57..32b7bff21 100644 --- a/src/app/shared/agenda/view-event/view-event.page.html +++ b/src/app/shared/agenda/view-event/view-event.page.html @@ -121,7 +121,7 @@ class="ion-no-margin ion-no-padding pa-0">

- {{attach.SourceName}} + {{attach.SourceName || 'Sem título'}} {{attach.Stakeholders}}

diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index f9defb299..edfb6d7c2 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -30,7 +30,6 @@ import { SessionStore } from 'src/app/store/session.service'; import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { PermissionService } from 'src/app/services/permission.service'; import { FileValidatorService } from "src/app/services/file/file-validator.service" -import { ChangeDetectorRef } from '@angular/core'; @Component({ selector: 'app-group-messages', templateUrl: './group-messages.page.html', @@ -103,8 +102,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe private platform: Platform, private fileOpener: FileOpener, public p: PermissionService, - private FileValidatorService: FileValidatorService, - private ChangeDetectorRef: ChangeDetectorRef + private FileValidatorService: FileValidatorService ) { this.ChatSystemService.getUser() @@ -120,9 +118,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe this.ChatSystemService.openRoom(this.roomId) this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ') - this.ChatSystemService.getGroupRoom(this.roomId).setChangeDetector(()=> { - this.changeDetector() - }) this.showAvatar = false setTimeout(() => { @@ -134,12 +129,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } - changeDetector = () => { - console.log('run detection shared') - this.ChangeDetectorRef.detectChanges() - } - - ngOnInit() { this.loggedUser = this.loggedUserChat; //setTimeout(() => { diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 5930eaded..41dd07c59 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -35,7 +35,6 @@ import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-de import { PermissionService } from 'src/app/services/permission.service'; import { FileValidatorService } from "src/app/services/file/file-validator.service" import { ChangeDetectorRef } from '@angular/core'; -import { saveAs } from 'file-saver'; const IMAGE_DIR = 'stored-images'; @@ -125,8 +124,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private platform: Platform, private fileOpener: FileOpener, public p: PermissionService, - private FileValidatorService: FileValidatorService, - private ChangeDetectorRef: ChangeDetectorRef + private FileValidatorService: FileValidatorService ) { // update this.checkAudioPermission() @@ -142,9 +140,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.ChatSystemService.openRoom(this.roomId) this.ChatSystemService.getDmRoom(this.roomId) - this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => { - this.changeDetector() - }) this.showAvatar = false @@ -162,11 +157,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } - changeDetector = () => { - console.log('run detection shared') - this.ChangeDetectorRef.detectChanges() - } - async ChatMessageDebuggingPage() { diff --git a/src/app/shared/gabinete-digital/expedients/expedients.page.ts b/src/app/shared/gabinete-digital/expedients/expedients.page.ts index fc4d482c4..819825c23 100644 --- a/src/app/shared/gabinete-digital/expedients/expedients.page.ts +++ b/src/app/shared/gabinete-digital/expedients/expedients.page.ts @@ -33,7 +33,7 @@ export class ExpedientsPage implements OnInit { listSubscription : { delete(): void; } - + routerSubscription; @@ -69,7 +69,7 @@ export class ExpedientsPage implements OnInit { } }) - + this.routerSubscription = this.router.events.subscribe((event) => { if (event instanceof NavigationStart && event.url.startsWith('/home/gabinete-digital?expedientes=true')) { @@ -81,8 +81,8 @@ export class ExpedientsPage implements OnInit { this.LoadList() } - - + + this.dynamicSearch(); } @@ -91,7 +91,7 @@ export class ExpedientsPage implements OnInit { this.listSubscription.delete() this.routerSubscription?.unsubscribe(); } - + reorderList(orderBy: string) { this.ordinance = orderBy; @@ -103,7 +103,7 @@ export class ExpedientsPage implements OnInit { async dynamicSearch() { if(this.showSearch && this.searchSubject) { - + const list = this.expedientegbstore.list.filter((task) => { let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject subject = subject.toLowerCase(); @@ -143,7 +143,7 @@ export class ExpedientsPage implements OnInit { this.skeletonLoader = true this.processes.GetTaskListExpediente(false).subscribe(result => { - + let taskslist = []; this.skeletonLoader = false @@ -152,7 +152,7 @@ export class ExpedientsPage implements OnInit { taskslist = res.map((e) => this.expedienteTaskPipe.transform(e)) taskslist = this.sortService.sortDate(taskslist, 'CreateDate') // this.addProcessTODb(taskslist); - + taskslist = taskslist.filter(function(item) { return item.activityInstanceName != 'Retificar Expediente' }) diff --git a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.ts b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.ts index e98204a27..166130b28 100644 --- a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.ts +++ b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.ts @@ -8,6 +8,10 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient import { ModalController } from '@ionic/angular'; import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page'; import { HeaderSettingsService } from "src/app/services/header-settings.service" +import { SessionStore } from 'src/app/store/session.service'; +import { LoginUserRespose } from 'src/app/models/user.model'; +import { object } from 'zod'; +import { element } from 'protractor'; @Component({ selector: 'app-task-details', @@ -28,7 +32,8 @@ export class TaskDetailsPage implements OnInit { @Output() viewDocument = new EventEmitter(); selectedIndex = 0 - dropButton = true + dropButton = true + loggeduser: LoginUserRespose; constructor( public ThemeService: ThemeService, public DeviceService: DeviceService, @@ -38,14 +43,19 @@ export class TaskDetailsPage implements OnInit { private HeaderSettingsService: HeaderSettingsService ) { this.DeviceService.isDesktop(); + this.loggeduser = SessionStore.user + } ngOnInit() { - window['TaskDetailsPage-openExpedientActionsModal']= (taskAction, Document) => { + + this.filterCoverPage(); + + window['TaskDetailsPage-openExpedientActionsModal'] = (taskAction, Document) => { this.openExpedientActionsModal(taskAction, Document) } - window['TaskDetailsPage-openBookMeetingModal']= (Document) => { + window['TaskDetailsPage-openBookMeetingModal'] = (Document) => { this.openBookMeetingModal(Document) } } @@ -67,12 +77,12 @@ export class TaskDetailsPage implements OnInit { } - async openExpedientActionsModal( taskAction: any, Document) { + async openExpedientActionsModal(taskAction: any, Document) { let classs; - if( window.innerWidth < 701) { + if (window.innerWidth < 701) { classs = 'modal modal-desktop' - } else { + } else { classs = 'modal modal-desktop showAsideOptions' } // check passing @@ -84,7 +94,7 @@ export class TaskDetailsPage implements OnInit { task: this.fulltask, // check document: Document, // nope aplicationId: Document.ApplicationId || Document.ApplicationID, // check - applicationId: Document.ApplicationId || Document.ApplicationID, + applicationId: Document.ApplicationId || Document.ApplicationID, docId: Document.docId || Document.DocId, createProcessFromFile: true, }, @@ -92,7 +102,7 @@ export class TaskDetailsPage implements OnInit { }); modal.onDidDismiss().then( - async(res) => {} + async (res) => { } , (error) => { console.log(error) } @@ -105,9 +115,9 @@ export class TaskDetailsPage implements OnInit { async openBookMeetingModal(Document) { //console.log('this.Document----------', this.Document) let classs; - if( window.innerWidth < 701) { + if (window.innerWidth < 701) { classs = 'book-meeting-modal modal modal-desktop' - } else { + } else { classs = 'modal modal-desktop showAsideOptions' } @@ -139,4 +149,17 @@ export class TaskDetailsPage implements OnInit { onOndestroy() { this.HeaderSettingsService.hideHeader == false } + + filterCoverPage() { + /* Method that filter the cover page of PR expediente */ + if (this.loggeduser.Profile == 'PR' && this.task.WorkflowName == "Expediente") { + try { + console.log('Merge array 1', this.mergedArray) + this.mergedArray = this.mergedArray.filter(element => element!.DocTypeId != 99999992); + console.log('Merge array 2', this.mergedArray) + } catch (error) { + console.info('error filtering cover page', error) + } + } + } } diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 29569306c..03d189300 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -40,14 +40,23 @@
-
+
+
+ {{ PublicationHolderService.count }}% + + X +
-
+
-
+
Anexos
-
+
-
+
X
@@ -64,7 +64,7 @@
+ name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px; width: 69px;">