mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
Merge branch 'feature/viewer-attachment' of https://bitbucket.org/equilibriumito/gabinete-digital-fo into feature/viewer-attachment
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest package="com.gpr.gabinetedigital" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|||||||
@@ -489,7 +489,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 95;
|
CURRENT_PROJECT_VERSION = 96;
|
||||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 4.5;
|
MARKETING_VERSION = 4.6;
|
||||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 95;
|
CURRENT_PROJECT_VERSION = 96;
|
||||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 4.5;
|
MARKETING_VERSION = 4.6;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||||
|
|||||||
@@ -305,6 +305,10 @@ const routes = [
|
|||||||
{
|
{
|
||||||
path: 'view-document-second-options',
|
path: 'view-document-second-options',
|
||||||
loadChildren: () => import('./modals/view-document-second-options/view-document-second-options.module').then( m => m.ViewDocumentSecondOptionsPageModule)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ import { InputFilterDirective } from './services/directives/input-filter.directi
|
|||||||
import { VisibilityDirective } from './services/directives/visibility.directive';
|
import { VisibilityDirective } from './services/directives/visibility.directive';
|
||||||
import { DeplomaOptionsPageModule } from './shared/popover/deploma-options/deploma-options.module';
|
import { DeplomaOptionsPageModule } from './shared/popover/deploma-options/deploma-options.module';
|
||||||
import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-options.page';
|
import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-options.page';
|
||||||
|
import { ImageCropperModule } from 'ngx-image-cropper';
|
||||||
// import { ServiceWorkerModule } from '@angular/service-worker';
|
// import { ServiceWorkerModule } from '@angular/service-worker';
|
||||||
// import { AngularFireModule } from '@angular/fire';
|
// import { AngularFireModule } from '@angular/fire';
|
||||||
// import { AngularFireMessagingModule } from '@angular/fire/messaging';
|
// import { AngularFireMessagingModule } from '@angular/fire/messaging';
|
||||||
@@ -176,6 +177,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
|
|||||||
// options
|
// options
|
||||||
DeplomaOptionsPageModule,
|
DeplomaOptionsPageModule,
|
||||||
CreateProcessPageModule,
|
CreateProcessPageModule,
|
||||||
|
ImageCropperModule
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
DiplomaOptionsPage,
|
DiplomaOptionsPage,
|
||||||
|
|||||||
@@ -103,9 +103,6 @@ export class ChatTokenInterceptor implements HttpInterceptor {
|
|||||||
private addToken(request: HttpRequest<any>, token: string) {
|
private addToken(request: HttpRequest<any>, token: string) {
|
||||||
let headers = new HttpHeaders();
|
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-User-Id', SessionStore.user.ChatData.data.userId);
|
||||||
headers = headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken);
|
headers = headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken);
|
||||||
|
|
||||||
|
|||||||
@@ -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 {}
|
||||||
@@ -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 {}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<ion-header>
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title>cropImage</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
<ion-content>
|
||||||
|
|
||||||
|
<div style="height: 100%; width: 100%;">
|
||||||
|
<image-cropper
|
||||||
|
[imageBase64]="this.base64ToCroppe"
|
||||||
|
[maintainAspectRatio]="true"
|
||||||
|
[aspectRatio]="1 / 1"
|
||||||
|
format="jpeg"
|
||||||
|
allowMoveImage="true"
|
||||||
|
(imageCropped)="imageCropped($event)"
|
||||||
|
(imageLoaded)="imageLoaded($event)"
|
||||||
|
(loadImageFailed)="loadImageFailed()"
|
||||||
|
></image-cropper>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div>
|
||||||
|
<button (click)="save()">Salvar</button>
|
||||||
|
<button (click)="cancel()">Cancelar</button>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<ion-footer class="ion-no-border">
|
||||||
|
<ion-toolbar class="footer-toolbar">
|
||||||
|
<ion-buttons slot="start">
|
||||||
|
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
|
||||||
|
<ion-label>Gravar</ion-label>
|
||||||
|
</button>
|
||||||
|
</ion-buttons>
|
||||||
|
<ion-buttons slot="end">
|
||||||
|
<button class="btn-cancel" fill="clear" color="#061b52" (click)="cancel()">
|
||||||
|
<ion-label>Cancelar</ion-label>
|
||||||
|
</button>
|
||||||
|
</ion-buttons>
|
||||||
|
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-footer>
|
||||||
|
|
||||||
|
</ion-content>
|
||||||
@@ -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<CropImagePage>;
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -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()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<div class="attach-title-item">
|
<div class="attach-title-item">
|
||||||
{{LoadedDocument.Assunto}}
|
{{LoadedDocument.Assunto || 'Sem título'}}
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-between" style="justify-content: space-between">
|
<div class="d-flex justify-between" style="justify-content: space-between">
|
||||||
<span class="span-left">{{ LoadedDocument.Sender }}</span>
|
<span class="span-left">{{ LoadedDocument.Sender }}</span>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<ion-list>
|
<ion-list>
|
||||||
<ion-item *ngFor="let attachment of loadedAttachments">
|
<ion-item *ngFor="let attachment of loadedAttachments">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<h4 class="attach-title-item">{{attachment.Description}}</h4>
|
<h4 class="attach-title-item">{{attachment.Description || 'Sem título'}}</h4>
|
||||||
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right"> {{ attachment.CreateDate | date: 'dd-MM-yyyy' }}</span></p>
|
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right"> {{ attachment.CreateDate | date: 'dd-MM-yyyy' }}</span></p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@
|
|||||||
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
|
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
|
||||||
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
||||||
<p class="flex-grow-1" >
|
<p class="flex-grow-1" >
|
||||||
<span class="attach-title-item d-block">{{attach.SourceName}}</span>
|
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span>
|
||||||
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export interface Environment {
|
|||||||
dispatchPR: string
|
dispatchPR: string
|
||||||
storageProduction: boolean
|
storageProduction: boolean
|
||||||
rejectUnauthorized: string
|
rejectUnauthorized: string
|
||||||
|
fileHub: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,6 @@
|
|||||||
[eventSource]="listToPresent"
|
[eventSource]="listToPresent"
|
||||||
[calendarMode]="calendar.mode"
|
[calendarMode]="calendar.mode"
|
||||||
[currentDate]="calendar.currentDate"
|
[currentDate]="calendar.currentDate"
|
||||||
(onEventSelected)="onEventSelected($event)"
|
|
||||||
(onTitleChanged)="onViewTitleChanged($event)"
|
(onTitleChanged)="onViewTitleChanged($event)"
|
||||||
(onRangeChanged)="onRangeChanged($event)"
|
(onRangeChanged)="onRangeChanged($event)"
|
||||||
(onCurrentDateChanged)="onCurrentChanged($event)"
|
(onCurrentDateChanged)="onCurrentChanged($event)"
|
||||||
@@ -217,9 +216,8 @@
|
|||||||
<div class="height-100">
|
<div class="height-100">
|
||||||
<div class="timeline-container height-100 d-flex pt-10 pl-20 filter-{{segment}} flex-column" >
|
<div class="timeline-container height-100 d-flex pt-10 pl-20 filter-{{segment}} flex-column" >
|
||||||
|
|
||||||
|
|
||||||
<div class="timeline-date align-center" *ngIf="isSelectedDayHasEvent && hasEventToday">
|
<div class="timeline-date align-center" *ngIf="isSelectedDayHasEvent && hasEventToday">
|
||||||
<span >Hoje, </span> {{ timelineDate }}
|
<span >Hoje, </span> {{ todayDateFormat() }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" >
|
<div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" >
|
||||||
@@ -232,7 +230,7 @@
|
|||||||
|
|
||||||
<div *ngFor="let day of month.days; let i = index " class="EventListBox-container" >
|
<div *ngFor="let day of month.days; let i = index " class="EventListBox-container" >
|
||||||
|
|
||||||
<div class="day" *ngIf="!(i == 0 && isSelectedDayHasEvent)" >
|
<div class="day" *ngIf="!(i == 0 && isSelectedDayHasEvent) || !hasEventToday" >
|
||||||
|
|
||||||
{{ day.daysInfo.dayName }} <div style="text-transform: capitalize; display: inline;">{{month.monthInfo.monthName}}</div>
|
{{ day.daysInfo.dayName }} <div style="text-transform: capitalize; display: inline;">{{month.monthInfo.monthName}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
contacts: EventPerson[]
|
contacts: EventPerson[]
|
||||||
|
|
||||||
|
todayDateFormated: string;
|
||||||
|
|
||||||
setView(view: CalendarView) {
|
setView(view: CalendarView) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
}
|
}
|
||||||
@@ -283,6 +285,7 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
this.calendar.currentDate = new Date();
|
this.calendar.currentDate = new Date();
|
||||||
|
//this.onCurrentChanged(new Date())
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.myCal.update();
|
this.myCal.update();
|
||||||
@@ -290,6 +293,7 @@ export class AgendaPage implements OnInit {
|
|||||||
this.onDropDownScrollWeal()
|
this.onDropDownScrollWeal()
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
|
|
||||||
|
//this.reloadCalendar();
|
||||||
this.updateEventListBox()
|
this.updateEventListBox()
|
||||||
|
|
||||||
realoadCounter++;
|
realoadCounter++;
|
||||||
@@ -448,11 +452,6 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onTimeSelected = (ev: { selectedTime: Date, events: any[] }) => {
|
|
||||||
this.eventSelectedDate2 = ev.selectedTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
currentMoth = {
|
currentMoth = {
|
||||||
rangeStartDate: null,
|
rangeStartDate: null,
|
||||||
rangeEndDate: null
|
rangeEndDate: null
|
||||||
@@ -612,7 +611,7 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
this.loadRangeEventRun(startTime, endTime)
|
this.loadRangeEventRun(startTime, endTime)
|
||||||
} else {
|
} else {
|
||||||
|
// alert('other')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,6 +678,7 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
this.myCal.update();
|
this.myCal.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
this.updateEventListBox()
|
this.updateEventListBox()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1138,6 +1138,8 @@ export class AgendaPage implements OnInit {
|
|||||||
reloadCalendar() {
|
reloadCalendar() {
|
||||||
//
|
//
|
||||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||||
|
|
||||||
|
this.onCurrentChanged(new Date(this.timelineDate))
|
||||||
}
|
}
|
||||||
|
|
||||||
async EventToApproveGoBack() {
|
async EventToApproveGoBack() {
|
||||||
@@ -1206,6 +1208,11 @@ export class AgendaPage implements OnInit {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
todayDateFormat() {
|
||||||
|
this.todayDateFormated = momentG(new Date(), 'dd MMMM');
|
||||||
|
return this.todayDateFormated;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function endOfMonth(myDate) {
|
function endOfMonth(myDate) {
|
||||||
|
|||||||
@@ -95,7 +95,8 @@
|
|||||||
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
|
<ion-item *ngFor="let attach of loadedEvent.Attachments; let i = index" class="width-100" class="ion-no-margin ion-no-padding">
|
||||||
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
||||||
<p class="flex-grow-1" >
|
<p class="flex-grow-1" >
|
||||||
<span class="attach-title-item d-block">{{attach.SourceName}}</span>
|
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span>
|
||||||
|
|
||||||
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||||
|
|
||||||
|
console.log('Loaded Event', res)
|
||||||
res = this.dateService.fixDate(res as any)
|
res = this.dateService.fixDate(res as any)
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
this.setTimeZone()
|
this.setTimeZone()
|
||||||
@@ -217,7 +218,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
if(this.CalendarId) {
|
if(this.CalendarId) {
|
||||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
||||||
|
console.log('Loaded Event', res)
|
||||||
/* const div = document.createElement("div")
|
/* const div = document.createElement("div")
|
||||||
div.innerHTML = res.Body.Text
|
div.innerHTML = res.Body.Text
|
||||||
res.Body.Text = div.innerText */
|
res.Body.Text = div.innerText */
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import { EventTrigger } from 'src/app/services/eventTrigger.service';
|
|||||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||||
import { RouteService } from 'src/app/services/route.service';
|
import { RouteService } from 'src/app/services/route.service';
|
||||||
import { Plugins } from '@capacitor/core';
|
import { Plugins } from '@capacitor/core';
|
||||||
import { ChangeDetectorRef } from '@angular/core';
|
|
||||||
|
|
||||||
|
|
||||||
const { App } = Plugins;
|
const { App } = Plugins;
|
||||||
@@ -129,8 +128,7 @@ export class ChatPage implements OnInit {
|
|||||||
private eventTriger: EventTrigger,
|
private eventTriger: EventTrigger,
|
||||||
private RochetChatConnectorService: RochetChatConnectorService,
|
private RochetChatConnectorService: RochetChatConnectorService,
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
public RouteService: RouteService,
|
public RouteService: RouteService
|
||||||
private ChangeDetectorRef: ChangeDetectorRef
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.headers = new HttpHeaders();;
|
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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
private fileOpener: FileOpener,
|
private fileOpener: FileOpener,
|
||||||
public RouteService: RouteService,
|
public RouteService: RouteService,
|
||||||
private FileValidatorService: FileValidatorService,
|
private FileValidatorService: FileValidatorService,
|
||||||
private ChangeDetectorRef: ChangeDetectorRef
|
|
||||||
) {
|
) {
|
||||||
this.ChatSystemService.getUser()
|
this.ChatSystemService.getUser()
|
||||||
|
|
||||||
@@ -147,10 +146,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked;
|
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked;
|
||||||
this.ChatSystemService.openRoom(this.roomId)
|
this.ChatSystemService.openRoom(this.roomId)
|
||||||
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
|
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
|
||||||
|
|
||||||
this.ChatSystemService.getGroupRoom(this.roomId).setChangeDetector(()=> {
|
|
||||||
this.changeDetector()
|
|
||||||
})
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.open()
|
this.open()
|
||||||
@@ -159,11 +154,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
changeDetector = () => {
|
|
||||||
console.log('run detection page')
|
|
||||||
this.ChangeDetectorRef.detectChanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.loggedUser = this.loggedUserChat;
|
this.loggedUser = this.loggedUserChat;
|
||||||
|
|||||||
@@ -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 { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { sanitize } from "sanitize-filename-ts";
|
import { sanitize } from "sanitize-filename-ts";
|
||||||
import { FilePicker } from '@capawesome/capacitor-file-picker';
|
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,
|
private router: Router,
|
||||||
public RochetChatConnectorService: RochetChatConnectorService,
|
public RochetChatConnectorService: RochetChatConnectorService,
|
||||||
private FileValidatorService: FileValidatorService,
|
private FileValidatorService: FileValidatorService,
|
||||||
private ChangeDetectorRef: ChangeDetectorRef
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -144,10 +142,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({})
|
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({})
|
||||||
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||||
this.ChatSystemService.openRoom(this.roomId)
|
this.ChatSystemService.openRoom(this.roomId)
|
||||||
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => {
|
|
||||||
|
|
||||||
this.changeDetector()
|
|
||||||
})
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
@@ -157,10 +151,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDetector = () => {
|
|
||||||
console.log('run detection page')
|
|
||||||
this.ChangeDetectorRef.detectChanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
try {
|
try {
|
||||||
@@ -1128,6 +1119,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
},
|
},
|
||||||
cssClass: 'modal modal-desktop'
|
cssClass: 'modal modal-desktop'
|
||||||
});
|
});
|
||||||
|
await modal.present();
|
||||||
|
/*
|
||||||
await modal.present(); */
|
await modal.present(); */
|
||||||
|
|
||||||
var blob = new Blob([pdfString], { type: 'application/pdf' });
|
var blob = new Blob([pdfString], { type: 'application/pdf' });
|
||||||
|
|||||||
@@ -314,4 +314,3 @@
|
|||||||
|
|
||||||
<!-- <iframe id="home-iframe" style="width: 100%;" src="/assets/www/pdfjs/web/viewer.html?file=/assets/www/pdfjs/web/compressed.tracemonkey-pldi-09.pdf.pdf"></iframe> -->
|
<!-- <iframe id="home-iframe" style="width: 100%;" src="/assets/www/pdfjs/web/viewer.html?file=/assets/www/pdfjs/web/compressed.tracemonkey-pldi-09.pdf.pdf"></iframe> -->
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@
|
|||||||
(click)="viewDocument(document.SourceId, document.ApplicationId)"
|
(click)="viewDocument(document.SourceId, document.ApplicationId)"
|
||||||
class="width-100 d-block list">
|
class="width-100 d-block list">
|
||||||
<p class="d-flex ion-justify-content-between">
|
<p class="d-flex ion-justify-content-between">
|
||||||
<span class="attach-title-item">{{document.SourceName}}</span>
|
<span class="attach-title-item">{{document.SourceName || 'Sem título'}}</span>
|
||||||
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
|
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
|
||||||
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
|
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
|
||||||
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
*ngFor="let attachment of loadedAttachments"
|
*ngFor="let attachment of loadedAttachments"
|
||||||
(click)="viewDocument(attachment.DocId, attachment)">
|
(click)="viewDocument(attachment.DocId, attachment)">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p class="attach-title-item d-block">{{attachment.Description}}</p>
|
<p class="attach-title-item d-block">{{attachment.Description || 'Sem título'}}</p>
|
||||||
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
|
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ export class ExpedienteDetailPage implements OnInit {
|
|||||||
this.caller = params["params"].caller;
|
this.caller = params["params"].caller;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window['attachments-expediente-update'] = () => {
|
||||||
|
this.LoadTaskDetail(this.serialNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -249,6 +253,8 @@ export class ExpedienteDetailPage implements OnInit {
|
|||||||
|
|
||||||
this.TaskService.loadExpedientes();
|
this.TaskService.loadExpedientes();
|
||||||
|
|
||||||
|
console.log("res========", res)
|
||||||
|
|
||||||
this.task = {
|
this.task = {
|
||||||
"SerialNumber": res.serialNumber,
|
"SerialNumber": res.serialNumber,
|
||||||
"Folio": res.workflowInstanceDataFields.Subject,
|
"Folio": res.workflowInstanceDataFields.Subject,
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import { NewPublicationPageRoutingModule } from './new-publication-routing.modul
|
|||||||
import { NewPublicationPage } from './new-publication.page';
|
import { NewPublicationPage } from './new-publication.page';
|
||||||
import '@teamhive/capacitor-video-recorder';
|
import '@teamhive/capacitor-video-recorder';
|
||||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
@@ -16,6 +19,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|||||||
IonicModule,
|
IonicModule,
|
||||||
NewPublicationPageRoutingModule,
|
NewPublicationPageRoutingModule,
|
||||||
FontAwesomeModule,
|
FontAwesomeModule,
|
||||||
|
MatProgressBarModule,
|
||||||
],
|
],
|
||||||
exports: [NewPublicationPage],
|
exports: [NewPublicationPage],
|
||||||
declarations: [NewPublicationPage]
|
declarations: [NewPublicationPage]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="overflow-y-auto padding">
|
<div class="overflow-y-auto padding">
|
||||||
<div *ngIf="publicationType!='1'" class="ion-item-container"
|
<div *ngIf="publicationType!='1'" class="ion-item-container"
|
||||||
[class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
|
[class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
|
||||||
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Title" name="title"
|
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="PublicationFromMvService.form.Title" name="title"
|
||||||
ngDefaultControl placeholder="Título*"></ion-input>
|
ngDefaultControl placeholder="Título*"></ion-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -21,41 +21,50 @@
|
|||||||
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="ion-textarea-class" [class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
|
<div class="ion-textarea-class" [class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
|
||||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Message"
|
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="PublicationFromMvService.form.Message"
|
||||||
name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
|
name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="seletedContent.length > 0" class="ion-item-container-no-border mb-20">
|
<div *ngIf="PublicationFromMvService.form.Files.length > 0" class="ion-item-container-no-border mb-20">
|
||||||
<ion-label class="attached-title pb-10">Fotografia Anexada</ion-label>
|
<ion-label class="attached-title pb-10">Fotografia Anexada</ion-label>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div *ngFor="let seleted of seletedContent.slice(0, displayLimit), let i = index" lot="start" class="mr-10">
|
<div *ngFor="let seleted of PublicationFromMvService.form.Files.slice(0, displayLimit), let i = index" lot="start" class="mr-10">
|
||||||
|
|
||||||
<div class="text-center cursor-pointer" (click)="deleteFromSeletedContent(i)" style="font-weight: 700;color: #c63527;">
|
<div class="text-center cursor-pointer" (click)="deleteFromSeletedContent(i)" style="font-weight: 700;color: #c63527; text-align-last: right;">
|
||||||
X
|
X
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && seleted.chucksManager">
|
||||||
|
|
||||||
|
<mat-progress-bar
|
||||||
|
|
||||||
|
mode="determinate"
|
||||||
|
[style.width]="seleted.chucksManager.uploadPercentage"
|
||||||
|
></mat-progress-bar>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'" [(ngModel)]="capturedImage"
|
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'" [(ngModel)]="capturedImage"
|
||||||
name="image" ngDefaultControl [src]="seleted.FileBase64"
|
name="image" ngDefaultControl [src]="seleted.url"
|
||||||
(click)="imageSize(capturedImage)" style="height: 69px;"></ion-img>
|
(click)="imageSize(capturedImage)" style="height: 69px; width: 69px;"></ion-img>
|
||||||
|
|
||||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
||||||
controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline">
|
controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||||
<source type="video/mp4" [src]="seleted.FileBase64">
|
<source type="video/mp4" [src]="seleted.url">
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Display the blurred image and count if there are more images -->
|
<!-- Display the blurred image and count if there are more images -->
|
||||||
<ion-thumbnail *ngIf="seletedContent.length > displayLimit" lot="start">
|
<ion-thumbnail *ngIf="PublicationFromMvService.form.Files.length > displayLimit" lot="start">
|
||||||
<ion-img [src]="'data:image/jpg;base64,' + seletedContent[displayLimit - 1].base64"
|
<ion-img [src]="'data:image/jpg;base64,' + PublicationFromMvService.form.Files[displayLimit - 1].Base64"
|
||||||
style="filter: blur(5px);"></ion-img>
|
style="filter: blur(5px);"></ion-img>
|
||||||
|
|
||||||
<p>mais {{ seletedContent.length - displayLimit }}</p>
|
<p>mais {{ PublicationFromMvService.form.Files.length - displayLimit }}</p>
|
||||||
</ion-thumbnail>
|
</ion-thumbnail>
|
||||||
<ion-label class="pl-10">
|
<ion-label class="pl-10">
|
||||||
<p>{{capturedImageTitle}}</p>
|
<p>{{capturedImageTitle}}</p>
|
||||||
@@ -66,22 +75,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- <div class="picture d-flex pb-5 hide-desktop"
|
|
||||||
*ngIf="publication && !( publication.Files[0].FileBase64 == 'data:image/jpg;base64,null' || publication.Files[0].FileBase64 == '' )">
|
|
||||||
<div class="post-img" *ngIf="publication.Files[0].FileBase64 ">
|
|
||||||
<img src="{{publication.Files[0].FileBase64 }}" alt="image">
|
|
||||||
</div>
|
|
||||||
<div class="d-flex flex-column pl-10" *ngIf="publication.Files[0].FileBase64 ">
|
|
||||||
<div class="picture-file-name">{{publication.OriginalFileName}}.{{publication.FileExtension}}</div>
|
|
||||||
<div class="size">75 Kb</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex-grow-1 d-flex align-center justify-end font-25" *ngIf="publication.Files[0].FileBase64 "
|
|
||||||
(click)="deletePublicationImage()">
|
|
||||||
<ion-icon name="close"></ion-icon>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="ion-item-container-no-border pt-10">
|
<div class="ion-item-container-no-border pt-10">
|
||||||
<ion-label (click)="takePicture()">
|
<ion-label (click)="takePicture()">
|
||||||
<div class="attach-icon">
|
<div class="attach-icon">
|
||||||
@@ -111,51 +104,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div *ngIf="photoOrVideo" class="container-multiselect pt-10">
|
|
||||||
<button id="container-multiselect" class="multiselect-button" (click)="takePicture()">Fotografia</button>
|
|
||||||
<button id="container-multiselect" class="multiselect-button" (click)="startVideoRecording()">Video</button>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <div *ngIf="photoOrVideo" class="ion-item-container-no-border">
|
|
||||||
<ion-label (click)="takePicture()">
|
|
||||||
<div class="attach-icon">
|
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' "
|
|
||||||
src="assets/images/icons-add-photo.svg"></ion-icon>
|
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' "
|
|
||||||
src="assets/images/theme/gov/icons-add-photo.svg"></ion-icon>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="attach-document">
|
|
||||||
<ion-label>Foto</ion-label>
|
|
||||||
</div>
|
|
||||||
</ion-label>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="photoOrVideo" class="ion-item-container-no-border">
|
|
||||||
<ion-label (click)="startVideoRecording()">
|
|
||||||
<div class="attach-icon">
|
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' "
|
|
||||||
src="assets/images/icons-add-photo.svg"></ion-icon>
|
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' "
|
|
||||||
src="assets/images/theme/gov/icons-add-photo.svg"></ion-icon>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="attach-document">
|
|
||||||
<ion-label>Video</ion-label>
|
|
||||||
</div>
|
|
||||||
</ion-label>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <div class="ion-item-container-no-border">
|
|
||||||
<ion-label (click)="laodPicture()" class="cursor-pointer">
|
|
||||||
<div class="attach-icon">
|
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-add-photos.svg"></ion-icon>
|
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-add-photos.svg"></ion-icon>
|
|
||||||
</div>
|
|
||||||
<div class="attach-document cursor-pointer">
|
|
||||||
<ion-label>Galeria</ion-label>
|
|
||||||
</div>
|
|
||||||
</ion-label>
|
|
||||||
</div> -->
|
|
||||||
<div class="ion-item-container-no-border">
|
<div class="ion-item-container-no-border">
|
||||||
<ion-label (click)="loadVideo()" class="cursor-pointer">
|
<ion-label (click)="loadVideo()" class="cursor-pointer">
|
||||||
<div class="attach-icon">
|
<div class="attach-icon">
|
||||||
|
|||||||
@@ -27,14 +27,17 @@ import { FilePicker } from '@capawesome/capacitor-file-picker';
|
|||||||
import { CapacitorVideoPlayer } from 'capacitor-video-player';
|
import { CapacitorVideoPlayer } from 'capacitor-video-player';
|
||||||
import { CaptureError, CaptureImageOptions, MediaCapture, MediaFile } from '@awesome-cordova-plugins/media-capture/ngx';
|
import { CaptureError, CaptureImageOptions, MediaCapture, MediaFile } from '@awesome-cordova-plugins/media-capture/ngx';
|
||||||
import { Capacitor } from '@capacitor/core';
|
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 { Media } from '@ionic-native/media/ngx';
|
||||||
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
||||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { App } from '@capacitor/app';
|
import { App } from '@capacitor/app';
|
||||||
import { NavigationExtras, Router } from '@angular/router';
|
import { NavigationExtras, Router } from '@angular/router';
|
||||||
import { VideoconvertService } from 'src/app/services/videoconvert.service'
|
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 = {
|
const config = {
|
||||||
quality: 0.5,
|
quality: 0.5,
|
||||||
@@ -88,8 +91,6 @@ export class NewPublicationPage implements OnInit {
|
|||||||
validateFrom = false
|
validateFrom = false
|
||||||
|
|
||||||
showLoader: boolean;
|
showLoader: boolean;
|
||||||
publication: Publication;
|
|
||||||
pub: Publication = new Publication();
|
|
||||||
folderId: string;
|
folderId: string;
|
||||||
image: Image = new Image();
|
image: Image = new Image();
|
||||||
|
|
||||||
@@ -117,7 +118,6 @@ export class NewPublicationPage implements OnInit {
|
|||||||
photoOrVideo: boolean = false;
|
photoOrVideo: boolean = false;
|
||||||
fileType = "";
|
fileType = "";
|
||||||
filecontent: boolean;
|
filecontent: boolean;
|
||||||
seletedContent: any[] = []
|
|
||||||
// Set a limit for the number of images to display
|
// Set a limit for the number of images to display
|
||||||
displayLimit = 4;
|
displayLimit = 4;
|
||||||
filesSizeSum = 0;
|
filesSizeSum = 0;
|
||||||
@@ -140,22 +140,38 @@ export class NewPublicationPage implements OnInit {
|
|||||||
public checkFileType: checkFileTypeService,
|
public checkFileType: checkFileTypeService,
|
||||||
private FileValidatorService: FileValidatorService,
|
private FileValidatorService: FileValidatorService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private videoconvertService: VideoconvertService
|
private videoconvertService: VideoconvertService,
|
||||||
|
public PublicationFromMvService: PublicationFromMvService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.publicationType = this.navParams.get('publicationType');
|
this.publicationType = this.navParams.get('publicationType');
|
||||||
this.folderId = this.navParams.get('folderId');
|
this.folderId = this.navParams.get('folderId');
|
||||||
this.publication = this.navParams.get('publication');
|
const publication = this.navParams.get('publication');
|
||||||
if (this.publication) {
|
if (publication && typeof publication?.Files == 'object') {
|
||||||
this.seletedContent = this.publication.Files;
|
|
||||||
this.filecontent = true;
|
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
|
||||||
}
|
}
|
||||||
console.log('Edit', this.publication)
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const files of newFiles) {
|
||||||
|
this.PublicationFromMvService.form.Files.push(files)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.publicationTitle = 'Nova Publicação';
|
this.publicationTitle = 'Nova Publicação';
|
||||||
this.intent = this.navParams.get('intent');
|
this.intent = this.navParams.get('intent');
|
||||||
|
|
||||||
this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));
|
this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));
|
||||||
|
this.PublicationFromMvService.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -188,37 +204,10 @@ export class NewPublicationPage implements OnInit {
|
|||||||
resultType: CameraResultType.Base64,
|
resultType: CameraResultType.Base64,
|
||||||
source: CameraSource.Camera
|
source: CameraSource.Camera
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(capturedImage)
|
|
||||||
|
|
||||||
|
|
||||||
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
||||||
this.capturedImageTitle = 'foto';
|
this.capturedImageTitle = 'foto';
|
||||||
if (this.fileSizeToMB(capturedImage.base64String.length) <= 20) {
|
this.showCroppModal();
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (this.seletedContent.length === 0)
|
|
||||||
this.filesSizeSum = 0
|
|
||||||
|
|
||||||
this.httpErrorHandle.validationMessagge('filessize');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async laodPicture() {
|
async laodPicture() {
|
||||||
@@ -251,25 +240,18 @@ export class NewPublicationPage implements OnInit {
|
|||||||
console.log('video record', data)
|
console.log('video record', data)
|
||||||
data.forEach(async element => {
|
data.forEach(async element => {
|
||||||
this.filesSizeSum = this.filesSizeSum + element.size
|
this.filesSizeSum = this.filesSizeSum + element.size
|
||||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
// element.size
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (this.platform.is('ios')) {
|
if (this.platform.is('ios')) {
|
||||||
this.recordevideoIos(element.fullPath)
|
this.recordevideoIos(element.fullPath, element)
|
||||||
} else {
|
} else {
|
||||||
this.recordVideoAndroid(element.fullPath)
|
this.recordVideoAndroid(element.fullPath, element)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Unable to write file', e);
|
console.error('Unable to write file', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
if (this.seletedContent.length === 0)
|
|
||||||
this.filesSizeSum = 0
|
|
||||||
|
|
||||||
this.httpErrorHandle.validationMessagge('filessize')
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -278,7 +260,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadVideo() {
|
async loadVideo() {
|
||||||
const result = await FilePicker.pickMedia ({ multiple: true, });
|
const result = await FilePicker.pickMedia({ multiple: true, });
|
||||||
console.log(result.files)
|
console.log(result.files)
|
||||||
result.files.forEach(async element => {
|
result.files.forEach(async element => {
|
||||||
this.filesSizeSum = this.filesSizeSum + element.size
|
this.filesSizeSum = this.filesSizeSum + element.size
|
||||||
@@ -287,7 +269,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) {
|
if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) {
|
||||||
let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl)
|
let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl)
|
||||||
try {
|
try {
|
||||||
this.recordevideoIos(resultUrl)
|
this.recordevideoIos(resultUrl, element)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('upload video error: ', error)
|
console.log('upload video error: ', error)
|
||||||
}
|
}
|
||||||
@@ -295,13 +277,13 @@ export class NewPublicationPage implements OnInit {
|
|||||||
let resultUrl = decodeURIComponent(element.path);
|
let resultUrl = decodeURIComponent(element.path);
|
||||||
console.log('pass type verification ', resultUrl)
|
console.log('pass type verification ', resultUrl)
|
||||||
try {
|
try {
|
||||||
this.loadVideoAndroid(resultUrl,element)
|
this.loadVideoAndroid(resultUrl, element)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('upload video error: ', error)
|
console.log('upload video error: ', error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.seletedContent.length === 0)
|
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||||
this.filesSizeSum = 0
|
this.filesSizeSum = 0
|
||||||
|
|
||||||
this.httpErrorHandle.validationMessagge('filessize')
|
this.httpErrorHandle.validationMessagge('filessize')
|
||||||
@@ -367,14 +349,14 @@ export class NewPublicationPage implements OnInit {
|
|||||||
injectValidation() {
|
injectValidation() {
|
||||||
|
|
||||||
this.Form = new FormGroup({
|
this.Form = new FormGroup({
|
||||||
Subject: new FormControl(this.pub.Title, [
|
Subject: new FormControl(this.PublicationFromMvService.form.Title, [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
// Validators.minLength(4)
|
// Validators.minLength(4)
|
||||||
]),
|
]),
|
||||||
capturedImage: new FormControl(this.capturedImage, [
|
capturedImage: new FormControl(this.capturedImage, [
|
||||||
|
|
||||||
]),
|
]),
|
||||||
Message: new FormControl(this.pub.Message, [
|
Message: new FormControl(this.PublicationFromMvService.form.Message, [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.maxLength(1000)
|
Validators.maxLength(1000)
|
||||||
|
|
||||||
@@ -390,172 +372,26 @@ export class NewPublicationPage implements OnInit {
|
|||||||
if (this.Form.invalid) return false
|
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();
|
this.close();
|
||||||
} catch (error) {
|
this.PublicationFromMvService.setFolderId(this.folderId)
|
||||||
if (error.status == 404) {
|
await this.PublicationFromMvService.save()
|
||||||
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)
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.httpErrorHandle.validationMessagge("noFileSelected")
|
this.httpErrorHandle.validationMessagge("noFileSelected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
// if(!this.PublicationFromMvService.form.send) {
|
||||||
|
// this.PublicationFromMvService.cancel()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.modalController.dismiss(this.publication).then(() => {
|
this.modalController.dismiss(this.PublicationFromMvService.form).then(() => {
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -566,7 +402,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this.capturedImageTitle = null;
|
this.capturedImageTitle = null;
|
||||||
this.seletedContent = [];
|
this.PublicationFromMvService.form.Files = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle() {
|
setTitle() {
|
||||||
@@ -578,8 +414,6 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
else if (this.publicationType == '3') {
|
else if (this.publicationType == '3') {
|
||||||
this.publicationTitle = 'Editar Publicação';
|
this.publicationTitle = 'Editar Publicação';
|
||||||
this.pub = this.navParams.get('publication');
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,7 +437,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
deletePublicationImage() {
|
deletePublicationImage() {
|
||||||
this.seletedContent = []
|
this.PublicationFromMvService.form.Files = []
|
||||||
}
|
}
|
||||||
|
|
||||||
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
|
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
|
||||||
@@ -744,15 +578,15 @@ export class NewPublicationPage implements OnInit {
|
|||||||
if (this.checkFileType.checkFileType(FileExtension) == 'image' || this.checkFileType.checkFileType(FileExtension) == 'video') {
|
if (this.checkFileType.checkFileType(FileExtension) == 'image' || this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||||
let resultUrl = decodeURIComponent(element.url);
|
let resultUrl = decodeURIComponent(element.url);
|
||||||
|
|
||||||
if(this.platform.is('ios')) {
|
if (this.platform.is('ios')) {
|
||||||
const stringGerada = this.gerarStringAleatoria();
|
const stringGerada = this.gerarStringAleatoria();
|
||||||
console.log(stringGerada);
|
console.log(stringGerada);
|
||||||
this.shareContentIso(resultUrl,FileExtension,stringGerada)
|
this.shareContentIso(resultUrl, FileExtension, stringGerada)
|
||||||
} else {
|
} else {
|
||||||
this.shareContentAndroid(resultUrl,FileExtension)
|
this.shareContentAndroid(resultUrl, FileExtension)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||||
let fileObject;
|
let fileObject;
|
||||||
try {
|
try {
|
||||||
@@ -794,7 +628,7 @@ console.log(stringGerada);
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteFromSeletedContent(index) {
|
deleteFromSeletedContent(index) {
|
||||||
this.seletedContent.splice(index, 1)
|
this.PublicationFromMvService.form.Files.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
closeApp() {
|
closeApp() {
|
||||||
@@ -806,8 +640,8 @@ console.log(stringGerada);
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async recordevideoIos(fullPath) {
|
async recordevideoIos(fullPath, element) {
|
||||||
console.log('fullpath', fullPath)
|
|
||||||
try {
|
try {
|
||||||
const directory = await Filesystem.getUri({
|
const directory = await Filesystem.getUri({
|
||||||
directory: Directory.Cache,
|
directory: Directory.Cache,
|
||||||
@@ -815,24 +649,27 @@ console.log(stringGerada);
|
|||||||
});
|
});
|
||||||
|
|
||||||
const stringGerada = this.gerarStringAleatoria();
|
const stringGerada = this.gerarStringAleatoria();
|
||||||
console.log(stringGerada);
|
|
||||||
let fileObject ={};
|
this.videoconvertService.convertVideo(fullPath, directory.uri, stringGerada, 'mp4').then(async () => {
|
||||||
this.videoconvertService.convertVideo(fullPath,directory.uri,stringGerada,'mp4').then(async () => {
|
await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4` })
|
||||||
await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4`})
|
|
||||||
|
|
||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
fileObject = {}
|
|
||||||
console.log('First clean',fileObject)
|
const file = new File([element.blob], element.name);
|
||||||
fileObject = {
|
|
||||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
const newAttachment = new PublicationAttachmentEntity(
|
||||||
FileExtension: 'mp4',
|
{
|
||||||
OriginalFileName: stringGerada
|
base64: 'data:video/mp4;base64,' + content.data,
|
||||||
|
extension: 'mp4',
|
||||||
|
blobFile: file,
|
||||||
|
FileType: this.checkFileType.checkFileType('mp4') as any,
|
||||||
|
OriginalFileName: 'load video'
|
||||||
}
|
}
|
||||||
console.log('what do we have',fileObject)
|
)
|
||||||
this.seletedContent.push(fileObject)
|
|
||||||
console.log('file object 1',fileObject)
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
fileObject ={};
|
|
||||||
const deleteSecretFile = async () => {
|
const deleteSecretFile = async () => {
|
||||||
await Filesystem.deleteFile({
|
await Filesystem.deleteFile({
|
||||||
path: `${stringGerada}.mp4`,
|
path: `${stringGerada}.mp4`,
|
||||||
@@ -840,9 +677,7 @@ console.log(stringGerada);
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
await deleteSecretFile().then((value) => {
|
await deleteSecretFile().then((value) => {
|
||||||
console.log('delete file',value)
|
console.log('delete file', value)
|
||||||
fileObject ={};
|
|
||||||
console.log('file object 2',fileObject)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((erro) => console.error('read converted video erro ', erro));
|
.catch((erro) => console.error('read converted video erro ', erro));
|
||||||
@@ -854,7 +689,7 @@ console.log(stringGerada);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async recordVideoAndroid(fullPath) {
|
async recordVideoAndroid(fullPath, element) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const savedFile = await Filesystem.copy({
|
const savedFile = await Filesystem.copy({
|
||||||
@@ -866,15 +701,25 @@ console.log(stringGerada);
|
|||||||
Filesystem.readFile({ path: savedFile.uri })
|
Filesystem.readFile({ path: savedFile.uri })
|
||||||
|
|
||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
|
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
let fileObject = {
|
|
||||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
const file = new File([element.blob], element.name);
|
||||||
FileExtension: 'mp4',
|
window['a'] = element
|
||||||
OriginalFileName: 'video'
|
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.seletedContent.push(fileObject)
|
)
|
||||||
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((error) => console.error('reade converted video erro ',error));
|
.catch((error) => console.error('reade converted video erro ', error));
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('record video android erro ', error)
|
console.log('record video android erro ', error)
|
||||||
@@ -885,28 +730,43 @@ console.log(stringGerada);
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadVideoAndroid(resultUrl,element) {
|
loadVideoAndroid(resultUrl, element) {
|
||||||
Filesystem.readFile({ path: resultUrl })
|
Filesystem.readFile({ path: resultUrl })
|
||||||
|
|
||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
console.log(content)
|
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
let fileObject;
|
|
||||||
if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
||||||
fileObject = {
|
|
||||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
const newAttachment = new PublicationAttachmentEntity(
|
||||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
{
|
||||||
OriginalFileName: 'video'
|
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 {
|
} else {
|
||||||
fileObject = {
|
this.capturedImage = 'data:image/jpeg;base64,' + content.data;
|
||||||
FileBase64: 'data:image/jpeg;base64,' + content.data,
|
this.showCroppModal()
|
||||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
/* 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'
|
OriginalFileName: 'image'
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
this.PublicationFromMvService.form.Files.push(newAttachment) */
|
||||||
}
|
}
|
||||||
|
|
||||||
this.seletedContent.push(fileObject)
|
|
||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
|
|
||||||
@@ -924,7 +784,7 @@ console.log(stringGerada);
|
|||||||
return stringAleatoria;
|
return stringAleatoria;
|
||||||
}
|
}
|
||||||
|
|
||||||
async shareContentIso(fullPath,FileExtension,filename) {
|
async shareContentIso(fullPath, FileExtension, filename) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||||
@@ -939,7 +799,7 @@ console.log(stringGerada);
|
|||||||
}
|
}
|
||||||
console.log('shared base', content.data)
|
console.log('shared base', content.data)
|
||||||
|
|
||||||
this.seletedContent.push(fileObject)
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error shared filesystem', error)
|
console.log('error shared filesystem', error)
|
||||||
}
|
}
|
||||||
@@ -951,9 +811,9 @@ console.log(stringGerada);
|
|||||||
path: '',
|
path: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
let fileObject ={};
|
let fileObject = {};
|
||||||
this.videoconvertService.convertVideo(fullPath,directory.uri,filename,'mp4').then(async () => {
|
this.videoconvertService.convertVideo(fullPath, directory.uri, filename, 'mp4').then(async () => {
|
||||||
await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4`})
|
await Filesystem.readFile({ path: `${directory.uri}${filename}.mp4` })
|
||||||
|
|
||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
console.log(content.data)
|
console.log(content.data)
|
||||||
@@ -963,13 +823,19 @@ console.log(stringGerada);
|
|||||||
FileExtension: 'mp4',
|
FileExtension: 'mp4',
|
||||||
OriginalFileName: 'shared',
|
OriginalFileName: 'shared',
|
||||||
} */
|
} */
|
||||||
fileObject = {
|
|
||||||
FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
const newAttachment = new PublicationAttachmentEntity(
|
||||||
FileExtension: 'mp4',
|
{
|
||||||
OriginalFileName: 'shared',
|
base64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||||
|
extension: 'mp4',
|
||||||
|
FileType: this.checkFileType.checkFileType('mp4') as any,
|
||||||
|
OriginalFileName: 'shared'
|
||||||
}
|
}
|
||||||
this.seletedContent.push(fileObject)
|
)
|
||||||
fileObject ={};
|
newAttachment.needUpload()
|
||||||
|
|
||||||
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
|
fileObject = {};
|
||||||
const deleteSecretFile = async () => {
|
const deleteSecretFile = async () => {
|
||||||
await Filesystem.deleteFile({
|
await Filesystem.deleteFile({
|
||||||
path: `${filename}.mp4`,
|
path: `${filename}.mp4`,
|
||||||
@@ -977,29 +843,30 @@ console.log(stringGerada);
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
deleteSecretFile().then((value) => {
|
deleteSecretFile().then((value) => {
|
||||||
console.log('delete file',value)
|
console.log('delete file', value)
|
||||||
fileObject ={};
|
fileObject = {};
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.catch((erro) => console.error('read converted video erro ', erro));
|
.catch((erro) => console.error('read converted video erro ', erro));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} 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) => {
|
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||||
let fileObject;
|
let fileObject;
|
||||||
try {
|
try {
|
||||||
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
|
||||||
fileObject = {
|
fileObject = {
|
||||||
FileBase64: 'data:image/jpeg;base64,' +this.removeTextBeforeSlash(content.data, ','),
|
FileBase64: 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||||
FileExtension: FileExtension,
|
FileExtension: FileExtension,
|
||||||
OriginalFileName: 'shared',
|
OriginalFileName: 'shared',
|
||||||
}
|
}
|
||||||
@@ -1014,7 +881,7 @@ console.log(stringGerada);
|
|||||||
}
|
}
|
||||||
console.log('shared base', content.data)
|
console.log('shared base', content.data)
|
||||||
|
|
||||||
this.seletedContent.push(fileObject)
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('error shared filesystem', 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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
src="{{'data:image/jpg;base64,' + files.FileBase64}}">
|
src="{{'data:image/jpg;base64,' + files.FileBase64}}">
|
||||||
|
|
||||||
<video *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
|
<video *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
|
||||||
webkit-playsinline="webkit-playsinline" (play)="StopvideoService.registerVideoWithEvent($event)" >
|
playsinline webkit-playsinline="webkit-playsinline" (play)="StopvideoService.registerVideoWithEvent($event)" >
|
||||||
<source [src]="files.FileBase64" type="video/mp4">
|
<source [src]="files.FileBase64" type="video/mp4">
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
|
|||||||
+20
-2
@@ -56,14 +56,32 @@ ion-toolbar {
|
|||||||
|
|
||||||
.post-img {
|
.post-img {
|
||||||
width: 100%;
|
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;
|
margin: 0 auto;
|
||||||
border-radius: 0px !important;
|
border-radius: 0px !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 420px;
|
|
||||||
}
|
}
|
||||||
.post-img img {
|
.post-img img {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@@ -52,8 +52,8 @@
|
|||||||
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
|
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
|
||||||
|
|
||||||
<video #videoElement [appVisibility]="onVisibilityChange" *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
|
<video #videoElement [appVisibility]="onVisibilityChange" *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'video'" class="post-video" controls="controls" preload="metadata"
|
||||||
webkit-playsinline="webkit-playsinline" (play)="stopvideoService.registerVideoWithEvent($event)" (click)="preventVideoPlay($event)">
|
playsinline webkit-playsinline="webkit-playsinline" (play)="stopvideoService.registerVideoWithEvent($event)" (click)="preventVideoPlay($event)">
|
||||||
<source [src]="files.FileBase64" type="video/mp4">
|
<source [src]="files.FileBase64" type="video/mp4" >
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import { StopvideoService } from "src/app/services/stopvideo.service"
|
|||||||
import { Result } from 'neverthrow';
|
import { Result } from 'neverthrow';
|
||||||
import { App } from '@capacitor/app';
|
import { App } from '@capacitor/app';
|
||||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||||
|
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-view-publications',
|
selector: 'app-view-publications',
|
||||||
templateUrl: './view-publications.page.html',
|
templateUrl: './view-publications.page.html',
|
||||||
@@ -71,7 +73,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
private publicationVideoManagerService: PublicationVideoManagerService,
|
private publicationVideoManagerService: PublicationVideoManagerService,
|
||||||
public stopvideoService: StopvideoService,
|
public stopvideoService: StopvideoService,
|
||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
public activeTabService: ActiveTabService) {
|
public activeTabService: ActiveTabService,
|
||||||
|
public PublicationHolderService: PublicationHolderService) {
|
||||||
|
|
||||||
|
|
||||||
/* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */
|
/* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */
|
||||||
@@ -311,6 +314,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async AddPublication(publicationType: any, folderId: any) {
|
async AddPublication(publicationType: any, folderId: any) {
|
||||||
|
|
||||||
|
if(this.PublicationHolderService.PublicationFormMV.length == 0) {
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: NewPublicationPage,
|
component: NewPublicationPage,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -325,6 +330,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.doRefresh(event);
|
this.doRefresh(event);
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
|
} else {
|
||||||
|
this.toastService._successMessage('já existe uma publicação a ser processado');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goToPublicationDetail(DocumentId: string, ProcessId: string) {
|
goToPublicationDetail(DocumentId: string, ProcessId: string) {
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ export class ListBoxService {
|
|||||||
|
|
||||||
display(list: CustomCalendarEvent[], selectedDate) {
|
display(list: CustomCalendarEvent[], selectedDate) {
|
||||||
|
|
||||||
|
|
||||||
let days = {};
|
let days = {};
|
||||||
const year: Year[] = []
|
const year: Year[] = []
|
||||||
|
|
||||||
@@ -174,6 +173,14 @@ export class ListBoxService {
|
|||||||
const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true})
|
const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true})
|
||||||
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
||||||
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,15 +151,6 @@ export class ChatSystemService {
|
|||||||
} catch(error) {}
|
} catch(error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
setMainChangeDetector(x:Function) {
|
|
||||||
this.mainChangeDetector = x
|
|
||||||
}
|
|
||||||
|
|
||||||
runMainChangeDetector() {
|
|
||||||
console.log("change")
|
|
||||||
// this.mainChangeDetector()
|
|
||||||
}
|
|
||||||
|
|
||||||
loadChat() {
|
loadChat() {
|
||||||
if (SessionStore.user?.ChatData?.data) {
|
if (SessionStore.user?.ChatData?.data) {
|
||||||
this.ReLoadChat()
|
this.ReLoadChat()
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import { ChatSystemService } from './chat-system.service';
|
|||||||
import { ViewedMessageService } from './viewed-message.service'
|
import { ViewedMessageService } from './viewed-message.service'
|
||||||
import * as FIFOProcessQueue from 'fifo-process-queue';
|
import * as FIFOProcessQueue from 'fifo-process-queue';
|
||||||
import { NotificationsService } from '../notifications.service';
|
import { NotificationsService } from '../notifications.service';
|
||||||
import { ChangeDetectorRef } from '@angular/core';
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -85,7 +84,6 @@ export class RoomService {
|
|||||||
|
|
||||||
sortRoomList = () => { }
|
sortRoomList = () => { }
|
||||||
chatServiceDeleteRoom = (roomId) => { }
|
chatServiceDeleteRoom = (roomId) => { }
|
||||||
private changeDetector: Function = () => {}
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public RochetChatConnectorService: RochetChatConnectorService,
|
public RochetChatConnectorService: RochetChatConnectorService,
|
||||||
@@ -192,11 +190,6 @@ export class RoomService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setChangeDetector(x:Function) {
|
|
||||||
console.log("set change detector")
|
|
||||||
this.changeDetector = x
|
|
||||||
}
|
|
||||||
|
|
||||||
get online() {
|
get online() {
|
||||||
|
|
||||||
if (!this.isGroup) {
|
if (!this.isGroup) {
|
||||||
@@ -391,6 +384,7 @@ export class RoomService {
|
|||||||
this.name = ChatMessage.msg
|
this.name = ChatMessage.msg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sortRoomList()
|
||||||
// this.changeDetector()
|
// this.changeDetector()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
done()
|
done()
|
||||||
|
|||||||
@@ -1206,11 +1206,23 @@ export class EventsService {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
} else {
|
} 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')
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -202,9 +202,6 @@ export class NotificationsService {
|
|||||||
this.active = true
|
this.active = true
|
||||||
console.log('NOtification Listener', notification)
|
console.log('NOtification Listener', notification)
|
||||||
this.storenotification(notification)
|
this.storenotification(notification)
|
||||||
this.chatNotification(notification)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -216,7 +213,6 @@ export class NotificationsService {
|
|||||||
this.eventtrigger.publishSomeData({
|
this.eventtrigger.publishSomeData({
|
||||||
notification: "recive"
|
notification: "recive"
|
||||||
})
|
})
|
||||||
this.chatNotification(notification)
|
|
||||||
// Handle the received message, e.g., show a 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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
+1
-1
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class PublicationFormMVService {
|
export class HolderService {
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
}
|
}
|
||||||
@@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ import { v4 as uuidv4 } from 'uuid'
|
|||||||
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
|
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
|
||||||
import { CMAPIService } from '../shared/repository/CMAPI/cmapi.service';
|
import { CMAPIService } from '../shared/repository/CMAPI/cmapi.service';
|
||||||
import { HubConnectionBuilder } from '@microsoft/signalr';
|
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({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@@ -90,7 +91,7 @@ class ReconnectingWebSocketSignalR {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.connection = new signalR.HubConnectionBuilder()
|
this.connection = new signalR.HubConnectionBuilder()
|
||||||
.withUrl('https://gdcmapi-dev.dyndns.info/FileHub', {
|
.withUrl( environment.fileHub, {
|
||||||
transport: signalR.HttpTransportType.LongPolling,
|
transport: signalR.HttpTransportType.LongPolling,
|
||||||
accessTokenFactory: () => SessionStore.user.Authorization
|
accessTokenFactory: () => SessionStore.user.Authorization
|
||||||
})
|
})
|
||||||
@@ -139,7 +140,7 @@ class ReconnectingWebSocketSignalR {
|
|||||||
if (!this.stop && (!error || error.message !== "Connection stopped by client.")) {
|
if (!this.stop && (!error || error.message !== "Connection stopped by client.")) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.connect();
|
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<Result<true, false>> {
|
commit(path): Promise<Result<true, false>> {
|
||||||
|
console.log('committing')
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if(this.isOpen) {
|
||||||
|
try {
|
||||||
|
console.log('this.connection.invoke', this.connection)
|
||||||
this.connection.invoke("CommitUpload", path).then((e) => {
|
this.connection.invoke("CommitUpload", path).then((e) => {
|
||||||
console.log("commit message", e)
|
console.log("commit message", e)
|
||||||
resolve(ok(true))
|
resolve(ok(true))
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
resolve(err(false))
|
console.error('upload catch commit error')
|
||||||
|
resolve(Err(false))
|
||||||
console.error(err.toString())
|
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
|
watchCount = 0
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// this.socket.onDisconnectCallback(()=> {
|
this.socket.onDisconnectCallback(()=> {
|
||||||
// console.log("run watch")
|
//console.log("run watch")
|
||||||
// this.runWatch = true
|
this.runWatch = true
|
||||||
// this.watch()
|
//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() {
|
connect() {
|
||||||
@@ -430,33 +432,33 @@ export class ObjectMergeNotification{
|
|||||||
|
|
||||||
async watch() {
|
async watch() {
|
||||||
|
|
||||||
// this.watchCount = 0;
|
this.watchCount = 0;
|
||||||
|
|
||||||
// if(this.runWatch) {
|
if(this.runWatch) {
|
||||||
// setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
// for(const [key, funx] of Object.entries(this.callbacks)) {
|
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()) {
|
if(request.isOk()) {
|
||||||
// funx()
|
funx()
|
||||||
// delete this.callbacks[key]
|
delete this.callbacks[key]
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// this.watchCount++
|
this.watchCount++
|
||||||
// if(this.watchCount <= 15) {
|
if(this.watchCount <= 15) {
|
||||||
// this.watch()
|
this.watch()
|
||||||
// } else {
|
} else {
|
||||||
// this.runWatch = false
|
this.runWatch = false
|
||||||
// }
|
}
|
||||||
|
|
||||||
// }, 1000)
|
}, 1000)
|
||||||
|
|
||||||
|
|
||||||
// } else {
|
} else {
|
||||||
// console.log("end loop============================")
|
console.log("end loop============================")
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribe(GUID, callback:Function) {
|
subscribe(GUID, callback:Function) {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
*ngFor="let attachment of loadedAttachments"
|
*ngFor="let attachment of loadedAttachments"
|
||||||
(click)="viewDocument(attachment.DocId, attachment)">
|
(click)="viewDocument(attachment.DocId, attachment)">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p class="attach-title-item d-block">{{attachment.Description}}</p>
|
<p class="attach-title-item d-block">{{attachment.Description || 'Sem título'}}</p>
|
||||||
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
|
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
class="ion-no-margin ion-no-padding pa-0">
|
class="ion-no-margin ion-no-padding pa-0">
|
||||||
<ion-label class="width-100 d-flex align-center">
|
<ion-label class="width-100 d-flex align-center">
|
||||||
<p class="flex-grow-1 cursor-pointer" (click)="docIndex(i);LoadDocumentDetails()">
|
<p class="flex-grow-1 cursor-pointer" (click)="docIndex(i);LoadDocumentDetails()">
|
||||||
<span class="attach-title-item d-block">{{attach.SourceName}}</span>
|
<span class="attach-title-item d-block">{{attach.SourceName || 'Sem título'}}</span>
|
||||||
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import { SessionStore } from 'src/app/store/session.service';
|
|||||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||||
import { PermissionService } from 'src/app/services/permission.service';
|
import { PermissionService } from 'src/app/services/permission.service';
|
||||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { ChangeDetectorRef } from '@angular/core';
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-messages',
|
selector: 'app-group-messages',
|
||||||
templateUrl: './group-messages.page.html',
|
templateUrl: './group-messages.page.html',
|
||||||
@@ -103,8 +102,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
|||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
private fileOpener: FileOpener,
|
private fileOpener: FileOpener,
|
||||||
public p: PermissionService,
|
public p: PermissionService,
|
||||||
private FileValidatorService: FileValidatorService,
|
private FileValidatorService: FileValidatorService
|
||||||
private ChangeDetectorRef: ChangeDetectorRef
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.ChatSystemService.getUser()
|
this.ChatSystemService.getUser()
|
||||||
@@ -120,9 +118,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
|||||||
this.ChatSystemService.openRoom(this.roomId)
|
this.ChatSystemService.openRoom(this.roomId)
|
||||||
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||||
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
|
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
|
||||||
this.ChatSystemService.getGroupRoom(this.roomId).setChangeDetector(()=> {
|
|
||||||
this.changeDetector()
|
|
||||||
})
|
|
||||||
this.showAvatar = false
|
this.showAvatar = false
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -134,12 +129,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeDetector = () => {
|
|
||||||
console.log('run detection shared')
|
|
||||||
this.ChangeDetectorRef.detectChanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.loggedUser = this.loggedUserChat;
|
this.loggedUser = this.loggedUserChat;
|
||||||
//setTimeout(() => {
|
//setTimeout(() => {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-de
|
|||||||
import { PermissionService } from 'src/app/services/permission.service';
|
import { PermissionService } from 'src/app/services/permission.service';
|
||||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||||
import { ChangeDetectorRef } from '@angular/core';
|
import { ChangeDetectorRef } from '@angular/core';
|
||||||
import { saveAs } from 'file-saver';
|
|
||||||
|
|
||||||
|
|
||||||
const IMAGE_DIR = 'stored-images';
|
const IMAGE_DIR = 'stored-images';
|
||||||
@@ -125,8 +124,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
private fileOpener: FileOpener,
|
private fileOpener: FileOpener,
|
||||||
public p: PermissionService,
|
public p: PermissionService,
|
||||||
private FileValidatorService: FileValidatorService,
|
private FileValidatorService: FileValidatorService
|
||||||
private ChangeDetectorRef: ChangeDetectorRef
|
|
||||||
) {
|
) {
|
||||||
// update
|
// update
|
||||||
this.checkAudioPermission()
|
this.checkAudioPermission()
|
||||||
@@ -142,9 +140,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
this.ChatSystemService.openRoom(this.roomId)
|
this.ChatSystemService.openRoom(this.roomId)
|
||||||
|
|
||||||
this.ChatSystemService.getDmRoom(this.roomId)
|
this.ChatSystemService.getDmRoom(this.roomId)
|
||||||
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => {
|
|
||||||
this.changeDetector()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.showAvatar = false
|
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() {
|
async ChatMessageDebuggingPage() {
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient
|
|||||||
import { ModalController } from '@ionic/angular';
|
import { ModalController } from '@ionic/angular';
|
||||||
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
|
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 { 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({
|
@Component({
|
||||||
selector: 'app-task-details',
|
selector: 'app-task-details',
|
||||||
@@ -29,6 +33,7 @@ export class TaskDetailsPage implements OnInit {
|
|||||||
|
|
||||||
selectedIndex = 0
|
selectedIndex = 0
|
||||||
dropButton = true
|
dropButton = true
|
||||||
|
loggeduser: LoginUserRespose;
|
||||||
constructor(
|
constructor(
|
||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
public DeviceService: DeviceService,
|
public DeviceService: DeviceService,
|
||||||
@@ -38,14 +43,19 @@ export class TaskDetailsPage implements OnInit {
|
|||||||
private HeaderSettingsService: HeaderSettingsService
|
private HeaderSettingsService: HeaderSettingsService
|
||||||
) {
|
) {
|
||||||
this.DeviceService.isDesktop();
|
this.DeviceService.isDesktop();
|
||||||
|
this.loggeduser = SessionStore.user
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
window['TaskDetailsPage-openExpedientActionsModal']= (taskAction, Document) => {
|
|
||||||
|
this.filterCoverPage();
|
||||||
|
|
||||||
|
window['TaskDetailsPage-openExpedientActionsModal'] = (taskAction, Document) => {
|
||||||
this.openExpedientActionsModal(taskAction, Document)
|
this.openExpedientActionsModal(taskAction, Document)
|
||||||
}
|
}
|
||||||
|
|
||||||
window['TaskDetailsPage-openBookMeetingModal']= (Document) => {
|
window['TaskDetailsPage-openBookMeetingModal'] = (Document) => {
|
||||||
this.openBookMeetingModal(Document)
|
this.openBookMeetingModal(Document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,10 +77,10 @@ export class TaskDetailsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async openExpedientActionsModal( taskAction: any, Document) {
|
async openExpedientActionsModal(taskAction: any, Document) {
|
||||||
|
|
||||||
let classs;
|
let classs;
|
||||||
if( window.innerWidth < 701) {
|
if (window.innerWidth < 701) {
|
||||||
classs = 'modal modal-desktop'
|
classs = 'modal modal-desktop'
|
||||||
} else {
|
} else {
|
||||||
classs = 'modal modal-desktop showAsideOptions'
|
classs = 'modal modal-desktop showAsideOptions'
|
||||||
@@ -92,7 +102,7 @@ export class TaskDetailsPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
modal.onDidDismiss().then(
|
modal.onDidDismiss().then(
|
||||||
async(res) => {}
|
async (res) => { }
|
||||||
, (error) => {
|
, (error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
@@ -105,7 +115,7 @@ export class TaskDetailsPage implements OnInit {
|
|||||||
async openBookMeetingModal(Document) {
|
async openBookMeetingModal(Document) {
|
||||||
//console.log('this.Document----------', this.Document)
|
//console.log('this.Document----------', this.Document)
|
||||||
let classs;
|
let classs;
|
||||||
if( window.innerWidth < 701) {
|
if (window.innerWidth < 701) {
|
||||||
classs = 'book-meeting-modal modal modal-desktop'
|
classs = 'book-meeting-modal modal modal-desktop'
|
||||||
} else {
|
} else {
|
||||||
classs = 'modal modal-desktop showAsideOptions'
|
classs = 'modal modal-desktop showAsideOptions'
|
||||||
@@ -139,4 +149,17 @@ export class TaskDetailsPage implements OnInit {
|
|||||||
onOndestroy() {
|
onOndestroy() {
|
||||||
this.HeaderSettingsService.hideHeader == false
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div title="Perfil" class="div-profile cursor-pointer viewport-font-size " (click)="openProfile()">
|
<div title="Perfil" class="div-profile cursor-pointer viewport-font-size " >
|
||||||
|
|
||||||
|
<div *ngIf="PublicationHolderService.count != 0" style="color: black" style="display: flex;
|
||||||
|
color: black;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
" >
|
||||||
|
<span *ngIf="!PublicationHolderService.PublicationFormMV?.[0]?.retry">{{ PublicationHolderService.count }}%</span>
|
||||||
|
<span style="padding-right: 12px" *ngIf="PublicationHolderService.PublicationFormMV?.[0]?.retry" (click)="PublicationHolderService.PublicationFormMV?.[0]?.retryFunction()" ><ion-icon src="assets/images/retry-svgrepo-com.svg" > </ion-icon></span>
|
||||||
|
<span style="padding-right: 7px" *ngIf="PublicationHolderService.PublicationFormMV?.[0]?.retry" (click)="PublicationHolderService.remove(PublicationHolderService.PublicationFormMV?.[0]?.id)">X</span>
|
||||||
|
</div>
|
||||||
<!-- <div *ngIf="this.NotificationHolderService.notificationList.length > 0" class="icon-badge">{{NotificationHolderService.notificationList.length}}</div> -->
|
<!-- <div *ngIf="this.NotificationHolderService.notificationList.length > 0" class="icon-badge">{{NotificationHolderService.notificationList.length}}</div> -->
|
||||||
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="icon font-45-em" src='assets/images/theme/doneIt/icons-profile.svg'></ion-icon>
|
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="icon font-45-em" src='assets/images/theme/doneIt/icons-profile.svg'></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon font-45-em" src='assets/images/icons-profile.svg'></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon font-45-em" src='assets/images/icons-profile.svg'></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> -->
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> -->
|
||||||
|
|
||||||
<div *ngIf="profilePicture == ''" class="profile-image">
|
<div (click)="openProfile()" *ngIf="profilePicture == ''" class="profile-image" >
|
||||||
<!-- <img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
|
<!-- <img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
|
||||||
src='assets/images/presidente.png'>
|
src='assets/images/presidente.png'>
|
||||||
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image"
|
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image"
|
||||||
@@ -60,7 +69,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div *ngIf="profilePicture != ''" class="profile-image">
|
<div (click)="openProfile()" *ngIf="profilePicture != ''" class="profile-image">
|
||||||
<img class="profile-image image-prety" src={{profilePicture}}>
|
<img class="profile-image image-prety" src={{profilePicture}}>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -164,6 +173,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header-btns d-flex">
|
<div class="header-btns d-flex">
|
||||||
|
|
||||||
|
<div *ngIf="PublicationHolderService.count != 0" style="color: black" >
|
||||||
|
<span *ngIf="!PublicationHolderService.PublicationFormMV?.[0]?.retry">{{ PublicationHolderService.count }}%</span>
|
||||||
|
<span style="padding-right: 12px" *ngIf="PublicationHolderService.PublicationFormMV?.[0]?.retry" (click)="PublicationHolderService.PublicationFormMV?.[0]?.retryFunction()" ><ion-icon src="assets/images/retry-svgrepo-com.svg" > </ion-icon></span>
|
||||||
|
<span style="padding-right: 7px" *ngIf="PublicationHolderService.PublicationFormMV?.[0]?.retry" (click)="PublicationHolderService.remove(PublicationHolderService.PublicationFormMV?.[0]?.id)">X</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div title="Pesquisa" *ngIf="!hideSearchBtn" class="mr-20 d-flex align-center cursor-pointer">
|
<div title="Pesquisa" *ngIf="!hideSearchBtn" class="mr-20 d-flex align-center cursor-pointer">
|
||||||
<div style="padding-top: 5px;" (click)="openSearch();showSearch=true" *ngIf="!showSearch">
|
<div style="padding-top: 5px;" (click)="openSearch();showSearch=true" *ngIf="!showSearch">
|
||||||
<ion-icon title="Perfil" *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-45-rem"
|
<ion-icon title="Perfil" *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-45-rem"
|
||||||
@@ -241,3 +257,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<div [class.header-bottom-line]="ThemeService.currentTheme == 'gov'" style="height: 5px;"></div>
|
<div [class.header-bottom-line]="ThemeService.currentTheme == 'gov'" style="height: 5px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.div-profile {
|
.div-profile {
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { NotificationsService } from 'src/app/services/notifications.service';
|
|||||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||||
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
||||||
import { HeaderSettingsService } from "src/app/services/header-settings.service"
|
import { HeaderSettingsService } from "src/app/services/header-settings.service"
|
||||||
|
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-header',
|
selector: 'app-header',
|
||||||
templateUrl: './header.page.html',
|
templateUrl: './header.page.html',
|
||||||
@@ -53,7 +53,6 @@ export class HeaderPage implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
@@ -72,6 +71,7 @@ export class HeaderPage implements OnInit {
|
|||||||
private attachmentService: AttachmentsService,
|
private attachmentService: AttachmentsService,
|
||||||
public NotificationHolderService: NotificationHolderService,
|
public NotificationHolderService: NotificationHolderService,
|
||||||
public HeaderSettingsService: HeaderSettingsService,
|
public HeaderSettingsService: HeaderSettingsService,
|
||||||
|
public PublicationHolderService: PublicationHolderService
|
||||||
) {
|
) {
|
||||||
this.loggeduser = SessionStore.user;
|
this.loggeduser = SessionStore.user;
|
||||||
router.events.subscribe((val) => {
|
router.events.subscribe((val) => {
|
||||||
@@ -89,6 +89,12 @@ export class HeaderPage implements OnInit {
|
|||||||
this.notificationLengthData()
|
this.notificationLengthData()
|
||||||
}); */
|
}); */
|
||||||
|
|
||||||
|
window['header-updateCount'] = () => {
|
||||||
|
this.updateCount()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCount = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ export class OptsExpedientePage implements OnInit {
|
|||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
this.attachmentsService.AddAttachment(body).subscribe((res)=> {
|
this.attachmentsService.AddAttachment(body).subscribe((res)=> {
|
||||||
|
window['attachments-expediente-update']();
|
||||||
this.toastService._successMessage()
|
this.toastService._successMessage()
|
||||||
this.popoverController.dismiss()
|
this.popoverController.dismiss()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<div *ngIf="publicationType!='1'" class="ion-item-container"
|
<div *ngIf="publicationType!='1'" class="ion-item-container"
|
||||||
[class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
|
[class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
|
||||||
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="publicationFormMV.form.Title" name="title"
|
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="PublicationFromMvService.form.Title" name="title"
|
||||||
placeholder="Título*"></ion-input>
|
placeholder="Título*"></ion-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ion-textarea-class flex-grow-1"
|
<div class="ion-textarea-class flex-grow-1"
|
||||||
[class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
|
[class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
|
||||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="publicationFormMV.form.Message"
|
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="PublicationFromMvService.form.Message"
|
||||||
name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
|
name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,16 +40,16 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Captured -->
|
<!-- Captured -->
|
||||||
<div *ngIf="publicationFormMV.form.Files.length > 0">
|
<div *ngIf="PublicationFromMvService.form.Files.length > 0">
|
||||||
<ion-label class="attached-title pb-10">Anexos</ion-label>
|
<ion-label class="attached-title pb-10">Anexos</ion-label>
|
||||||
<div>
|
<div>
|
||||||
<div class="d-flex" >
|
<div class="d-flex" >
|
||||||
|
|
||||||
<div *ngFor="let seleted of publicationFormMV.form.Files.slice(0, displayLimit), let i = index" lot="start" class="mr-10">
|
<div *ngFor="let seleted of PublicationFromMvService.form.Files.slice(0, displayLimit), let i = index" lot="start" class="mr-10">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div class="text-center cursor-pointer" (click)="deleteFromSeletedContent(i)" style="font-weight: 700;color: #c63527;">
|
<div class="text-center cursor-pointer" (click)="deleteFromSeletedContent(i)" style="font-weight: 700;color: #c63527; text-align-last: right;">
|
||||||
X
|
X
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'"
|
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'"
|
||||||
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px;"></ion-img>
|
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px; width: 69px;"></ion-img>
|
||||||
|
|
||||||
<video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkDesktop() == true" width="70" height="70"
|
<video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkDesktop() == true" width="70" height="70"
|
||||||
preload="metadata" webkit-playsinline="webkit-playsinline">
|
preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ import { environment } from 'src/environments/environment';
|
|||||||
import { CaptureImageOptions, MediaCapture } from '@awesome-cordova-plugins/media-capture/ngx';
|
import { CaptureImageOptions, MediaCapture } from '@awesome-cordova-plugins/media-capture/ngx';
|
||||||
import { Directory, Filesystem, FilesystemDirectory } from '@capacitor/filesystem';
|
import { Directory, Filesystem, FilesystemDirectory } from '@capacitor/filesystem';
|
||||||
import { Platform } from '@ionic/angular';
|
import { Platform } from '@ionic/angular';
|
||||||
import { PublicationAttachmentEntity, PublicationFormMV } from '../upload/upload-streaming.service';
|
import { PublicationAttachmentEntity } from '../upload/upload-streaming.service';
|
||||||
import { PublicationFormMVService } from "src/app/shared/publication/upload/publication-form-mv.service"
|
|
||||||
import { VideoconvertService } from 'src/app/services/videoconvert.service';
|
import { VideoconvertService } from 'src/app/services/videoconvert.service';
|
||||||
|
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||||
|
import { PublicationFromMvService } from "src/app/shared/publication/upload/publication-from-mv.service"
|
||||||
|
import { UploadStreamingService } from "src/app/shared/publication/upload/upload-streaming.service"
|
||||||
enum ActionType {
|
enum ActionType {
|
||||||
newRapid = "1",
|
newRapid = "1",
|
||||||
new = "2",
|
new = "2",
|
||||||
@@ -68,11 +69,8 @@ export class NewPublicationPage implements OnInit {
|
|||||||
photoOrVideo: boolean = false;
|
photoOrVideo: boolean = false;
|
||||||
video: any;
|
video: any;
|
||||||
|
|
||||||
publicationFormMV = new PublicationFormMV()
|
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
PublicationFormMVService: PublicationFormMVService,
|
public PublicationFromMvService: PublicationFromMvService,
|
||||||
public photoService: PhotoService,
|
public photoService: PhotoService,
|
||||||
private publications: PublicationsService,
|
private publications: PublicationsService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
@@ -87,9 +85,12 @@ export class NewPublicationPage implements OnInit {
|
|||||||
private MiddlewareServiceService: MiddlewareServiceService,
|
private MiddlewareServiceService: MiddlewareServiceService,
|
||||||
private LakefsRepositoryService: LakefsRepositoryService,
|
private LakefsRepositoryService: LakefsRepositoryService,
|
||||||
private SocketConnectionMCRService: SocketConnectionMCRService,
|
private SocketConnectionMCRService: SocketConnectionMCRService,
|
||||||
private videoconvertService: VideoconvertService
|
private videoconvertService: VideoconvertService,
|
||||||
|
public UploadStreamingService: UploadStreamingService
|
||||||
) {
|
) {
|
||||||
this.publicationTitle = 'Nova Publicação';
|
this.publicationTitle = 'Nova Publicação';
|
||||||
|
this.PublicationFromMvService.clear()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -124,8 +125,8 @@ export class NewPublicationPage implements OnInit {
|
|||||||
processData(res) {
|
processData(res) {
|
||||||
|
|
||||||
console.log("res process", res)
|
console.log("res process", res)
|
||||||
this.publicationFormMV.form.Files = []
|
this.PublicationFromMvService.form.Files = []
|
||||||
this.publicationFormMV.form.setData({
|
this.PublicationFromMvService.form.setData({
|
||||||
DateIndex: res.DateIndex,
|
DateIndex: res.DateIndex,
|
||||||
DocumentId: res.DocumentId,
|
DocumentId: res.DocumentId,
|
||||||
ProcessId: res.ProcessId,
|
ProcessId: res.ProcessId,
|
||||||
@@ -146,7 +147,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
})
|
})
|
||||||
|
|
||||||
for(const files of newFiles) {
|
for(const files of newFiles) {
|
||||||
this.publicationFormMV.form.Files.push(files)
|
this.PublicationFromMvService.form.Files.push(files)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -181,7 +182,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
FileType: 'image'
|
FileType: 'image'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
this.publicationFormMV.form.Files.push(newAttachment)
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +216,8 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
//newAttachment.needUpload();
|
//newAttachment.needUpload();
|
||||||
this.publicationFormMV.form.Files.push(newAttachment)
|
|
||||||
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -252,12 +254,14 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// newAttachment.needUpload()
|
|
||||||
this.publicationFormMV.form.Files.push(newAttachment)
|
|
||||||
|
newAttachment.needUpload()
|
||||||
|
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this.publicationFormMV.form.Files.length === 0)
|
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||||
this.filesSizeSum = 0
|
this.filesSizeSum = 0
|
||||||
|
|
||||||
this.httpErroHandle.validationMessagge('filessize');
|
this.httpErroHandle.validationMessagge('filessize');
|
||||||
@@ -300,7 +304,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/* fileObject.needUpload() */
|
/* fileObject.needUpload() */
|
||||||
this.publicationFormMV.form.Files.push(fileObject)
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -309,7 +313,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.publicationFormMV.form.Files.length === 0)
|
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||||
this.filesSizeSum = 0
|
this.filesSizeSum = 0
|
||||||
|
|
||||||
this.httpErrorHandle.validationMessagge('filessize')
|
this.httpErrorHandle.validationMessagge('filessize')
|
||||||
@@ -325,11 +329,11 @@ export class NewPublicationPage implements OnInit {
|
|||||||
injectValidation() {
|
injectValidation() {
|
||||||
|
|
||||||
this.Form = new FormGroup({
|
this.Form = new FormGroup({
|
||||||
Subject: new FormControl(this.publicationFormMV.form.Title, [
|
Subject: new FormControl(this.PublicationFromMvService.form.Title, [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
// Validators.minLength(4)
|
// Validators.minLength(4)
|
||||||
]),
|
]),
|
||||||
Message: new FormControl(this.publicationFormMV.form.Message, [
|
Message: new FormControl(this.PublicationFromMvService.form.Message, [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.maxLength(1000)
|
Validators.maxLength(1000)
|
||||||
])
|
])
|
||||||
@@ -346,143 +350,32 @@ export class NewPublicationPage implements OnInit {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.PublicationFromMvService.setFolderId(this.folderId)
|
||||||
if (this.publicationType == ActionType.edit) {
|
|
||||||
|
|
||||||
if (this.publicationFormMV.form.Files.length >= 1) {
|
|
||||||
const loader = this.toastService.loading()
|
|
||||||
|
|
||||||
const upload = await this.publicationFormMV.uploadVideosFiles()
|
|
||||||
|
|
||||||
if(upload) {
|
|
||||||
this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity)=> {
|
|
||||||
if(e.FileType == 'video' && e.blobFile && e.toUpload) {
|
|
||||||
e.OriginalFileName = e?.chucksManager?.path?.replace(".mp4", "") || e.OriginalFileName
|
|
||||||
e.FileExtension = "mp4"
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const publication: any = Object.assign({}, this.publicationFormMV.form)
|
|
||||||
|
|
||||||
publication.Files = publication.Files.map( (e:PublicationAttachmentEntity) => ({
|
|
||||||
FileBase64: e.url,
|
|
||||||
FileExtension: e.FileExtension,
|
|
||||||
OriginalFileName: e.OriginalFileName || 'foto'
|
|
||||||
}))
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
const response = await this.publications.UpdatePublication(publication.ProcessId, publication).toPromise()
|
|
||||||
|
|
||||||
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
|
||||||
|
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
await this.PublicationFromMvService.save()
|
||||||
|
|
||||||
} catch (error) {
|
// this.PublicationHolderService.setPublication(this.PublicationFromMvService)
|
||||||
this.httpErroHandle.httpStatusHandle(error)
|
|
||||||
if (error.status == 404) {
|
|
||||||
this.PublicationFolderService.deletePost(this.publicationFormMV.form.ProcessId, this.publicationFormMV.form.DocumentId)
|
|
||||||
this.goBack();
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
loader.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let time = new Date()
|
|
||||||
if (this.publicationFormMV.form.Files.length >= 1) {
|
|
||||||
|
|
||||||
const loader = this.toastService.loading()
|
|
||||||
|
|
||||||
const upload = await this.publicationFormMV.uploadVideosFiles()
|
|
||||||
|
|
||||||
if(upload) {
|
|
||||||
this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity) => {
|
|
||||||
if(e.FileType == 'video' && e.blobFile && e.toUpload) {
|
|
||||||
e.OriginalFileName = e.chucksManager.path.replace(".mp4", "")
|
|
||||||
e.FileExtension = "mp4"
|
|
||||||
}
|
|
||||||
|
|
||||||
if(e.FileType == 'video' ) {
|
|
||||||
e.Base64 = e.url
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return e
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const publication: any = Object.assign({}, this.publicationFormMV.form)
|
|
||||||
|
|
||||||
publication.Files = publication.Files.map( (e:PublicationAttachmentEntity) => ({
|
|
||||||
FileBase64: e.Base64,
|
|
||||||
FileExtension: e.FileExtension,
|
|
||||||
OriginalFileName: e.OriginalFileName || 'foto'
|
|
||||||
}))
|
|
||||||
|
|
||||||
publication.DocumentId = null;
|
|
||||||
publication.ProcessId = this.folderId
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
await this.publications.CreatePublication(publication.ProcessId, publication).toPromise()
|
|
||||||
if (this.publicationTitle == '1') {
|
|
||||||
|
|
||||||
} else if (this.publicationTitle == '2') {
|
|
||||||
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
|
||||||
} else if (this.publicationTitle == '3') {
|
|
||||||
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
|
||||||
}
|
|
||||||
|
|
||||||
this.goBackToViewPublications.emit();
|
|
||||||
} catch (error) {
|
|
||||||
this.httpErroHandle.httpStatusHandle(error)
|
|
||||||
} finally {
|
|
||||||
loader.remove()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.publicationFormMV.ObjectMergeNotification.close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.publicationFormMV.ObjectMergeNotification.close()
|
if(!this.PublicationFromMvService.form.send) {
|
||||||
|
this.PublicationFromMvService.cancel()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.goBack();
|
this.goBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this.publicationFormMV.form.Files = [];
|
this.PublicationFromMvService.form.Files = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePublicationImage() {
|
deletePublicationImage() {
|
||||||
|
|
||||||
this.publicationFormMV.form.Files = []
|
this.PublicationFromMvService.form.Files = []
|
||||||
}
|
}
|
||||||
|
|
||||||
setAction() {
|
setAction() {
|
||||||
@@ -722,7 +615,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteFromSeletedContent(index) {
|
deleteFromSeletedContent(index) {
|
||||||
this.publicationFormMV.form.Files.splice(index, 1)
|
this.PublicationFromMvService.form.Files.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
chossePhotoOrVideo() {
|
chossePhotoOrVideo() {
|
||||||
@@ -744,7 +637,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
this.recordVideoPc(element.fullPath)
|
this.recordVideoPc(element.fullPath)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.publicationFormMV.form.Files.length === 0)
|
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||||
this.filesSizeSum = 0
|
this.filesSizeSum = 0
|
||||||
|
|
||||||
this.httpErrorHandle.validationMessagge('filessize')
|
this.httpErrorHandle.validationMessagge('filessize')
|
||||||
@@ -792,7 +685,7 @@ console.log(stringGerada);
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
/* fileObject.needUpload() */
|
/* fileObject.needUpload() */
|
||||||
this.publicationFormMV.form.Files.push(fileObject)
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
})
|
})
|
||||||
.catch((erro) => console.error('read converted video erro ', erro));
|
.catch((erro) => console.error('read converted video erro ', erro));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -834,7 +727,7 @@ console.log(stringGerada);
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* fileObject.needUpload() */
|
/* fileObject.needUpload() */
|
||||||
this.publicationFormMV.form.Files.push(fileObject)
|
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
+4
-4
@@ -1,13 +1,13 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { PublicationFormMVService } from './publication-form-mv.service';
|
import { PublicationFromMvService } from './publication-from-mv.service';
|
||||||
|
|
||||||
describe('PublicationFormMVService', () => {
|
describe('PublicationFromMvService', () => {
|
||||||
let service: PublicationFormMVService;
|
let service: PublicationFromMvService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({});
|
TestBed.configureTestingModule({});
|
||||||
service = TestBed.inject(PublicationFormMVService);
|
service = TestBed.inject(PublicationFromMvService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
@@ -0,0 +1,382 @@
|
|||||||
|
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
|
import { PublicationsService } from 'src/app/services/publications.service';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
|
||||||
|
import { Chunks, ChunksBase64, IOUploadError, PublicationAttachmentEntity, PublicationFormModel, UploadFileUseCase } from './upload-streaming.service';
|
||||||
|
import { ObjectMergeNotification } from 'src/app/services/socket-connection-mcr.service';
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import { Result } from 'neverthrow';
|
||||||
|
import { IPublicationFormModelEntity } from '../new-publication/interface/interface';
|
||||||
|
import { CMAPIService } from "src/app/shared/repository/CMAPI/cmapi.service"
|
||||||
|
|
||||||
|
enum ActionType {
|
||||||
|
newRapid = "1",
|
||||||
|
new = "2",
|
||||||
|
edit = "3"
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'any'
|
||||||
|
})
|
||||||
|
export class PublicationFromMvService {
|
||||||
|
|
||||||
|
id: string = uuidv4()
|
||||||
|
private UploadFileUseCase = new UploadFileUseCase()
|
||||||
|
form = new PublicationFormModel()
|
||||||
|
ObjectMergeNotification = new ObjectMergeNotification()
|
||||||
|
totalPercentage = 0
|
||||||
|
publicationType: ActionType
|
||||||
|
folderId: string
|
||||||
|
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private publications: PublicationsService,
|
||||||
|
private toastService: ToastService,
|
||||||
|
private httpErroHandle: HttpErrorHandle,
|
||||||
|
public PublicationFolderService: PublicationFolderService,
|
||||||
|
private CMAPIService: CMAPIService,
|
||||||
|
public publicationFolderService: PublicationFolderService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
|
||||||
|
this.id = uuidv4()
|
||||||
|
this.UploadFileUseCase = new UploadFileUseCase()
|
||||||
|
this.form = new PublicationFormModel()
|
||||||
|
this.ObjectMergeNotification = new ObjectMergeNotification()
|
||||||
|
this.totalPercentage = 0
|
||||||
|
|
||||||
|
this.ObjectMergeNotification.connect();
|
||||||
|
|
||||||
|
window['upload-header-set-add'](this.id, this.totalPercentage, this.save)
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
window['upload-header-set-remove'](this.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setFolderId(folderId) {
|
||||||
|
this.folderId = folderId
|
||||||
|
}
|
||||||
|
|
||||||
|
save = async() => {
|
||||||
|
|
||||||
|
const needChunk = this.needToUploadChunk()
|
||||||
|
|
||||||
|
if (this.publicationType == ActionType.edit) {
|
||||||
|
|
||||||
|
if (this.form.Files.length >= 1) {
|
||||||
|
// const loader = this.toastService.loading()
|
||||||
|
|
||||||
|
this.form.send = true
|
||||||
|
const upload = await this.uploadVideosFiles()
|
||||||
|
|
||||||
|
|
||||||
|
const needChunk = this.needToUploadChunk()
|
||||||
|
if(needChunk.length == 0 ) {
|
||||||
|
window['upload-header-set-percentage'](this.id, 50)
|
||||||
|
} else {
|
||||||
|
window['upload-header-set-percentage'](this.id, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(upload) {
|
||||||
|
this.form.Files = this.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||||
|
if(e.FileType == 'video' && e.toUpload) {
|
||||||
|
e.OriginalFileName = e?.chucksManager?.path?.replace(".mp4", "") || e.OriginalFileName
|
||||||
|
e.FileExtension = e.FileExtension || "mp4"
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const publication: any = Object.assign({}, this.form)
|
||||||
|
|
||||||
|
publication.Files = publication.Files.map( (e:PublicationAttachmentEntity) => ({
|
||||||
|
FileBase64: e.url,
|
||||||
|
FileExtension: e.FileExtension,
|
||||||
|
OriginalFileName: e.OriginalFileName || 'foto'
|
||||||
|
}))
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
const response = await this.publications.UpdatePublication(publication.ProcessId, publication).toPromise()
|
||||||
|
|
||||||
|
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
||||||
|
this.publicationFolderService.getPublicationsIds(this.folderId)
|
||||||
|
window['upload-header-set-remove'](this.id);
|
||||||
|
|
||||||
|
// this.goBack();
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
this.httpErroHandle.httpStatusHandle(error)
|
||||||
|
if (error.status == 404) {
|
||||||
|
this.PublicationFolderService.deletePost(this.form.ProcessId, this.form.DocumentId)
|
||||||
|
// this.goBack();
|
||||||
|
} else {
|
||||||
|
window['upload-header-set-retry'](this.id)
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// loader.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
window['upload-header-set-retry'](this.id)
|
||||||
|
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let time = new Date()
|
||||||
|
if (this.form.Files.length >= 1) {
|
||||||
|
|
||||||
|
// const loader = this.toastService.loading()
|
||||||
|
|
||||||
|
this.form.send = true
|
||||||
|
const upload = await this.uploadVideosFiles()
|
||||||
|
|
||||||
|
const needChunk = this.needToUploadChunk()
|
||||||
|
if(needChunk.length ==0 ) {
|
||||||
|
window['upload-header-set-percentage'](this.id, 50)
|
||||||
|
} else {
|
||||||
|
window['upload-header-set-percentage'](this.id, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(upload) {
|
||||||
|
this.form.Files = this.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||||
|
if(e.FileType == 'video' && e.toUpload) {
|
||||||
|
e.OriginalFileName = e.chucksManager.path.replace(".mp4", "")
|
||||||
|
e.FileExtension = e.FileExtension || "mp4"
|
||||||
|
e.Base64 = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
if(e.FileType == 'video' && !e.toUpload) {
|
||||||
|
e.Base64 = e.url
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return e
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const publication: any = Object.assign({}, this.form)
|
||||||
|
|
||||||
|
publication.Files = publication.Files.map( (e:PublicationAttachmentEntity) => ({
|
||||||
|
FileBase64: e.Base64,
|
||||||
|
FileExtension: e.FileExtension,
|
||||||
|
OriginalFileName: e.OriginalFileName || 'foto'
|
||||||
|
}))
|
||||||
|
|
||||||
|
publication.DocumentId = null;
|
||||||
|
publication.ProcessId = this.folderId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
await this.publications.CreatePublication(publication.ProcessId, publication).toPromise()
|
||||||
|
|
||||||
|
if (this.publicationType == '1') {
|
||||||
|
|
||||||
|
} else if (this.publicationType == '2') {
|
||||||
|
this.httpErroHandle.httpsSucessMessagge('Criar publicação')
|
||||||
|
} else if (this.publicationType == '3') {
|
||||||
|
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.goBackToViewPublications.emit();
|
||||||
|
window['upload-header-set-remove'](this.id);
|
||||||
|
this.publicationFolderService.getPublicationsIds(this.folderId)
|
||||||
|
} catch (error) {
|
||||||
|
window['upload-header-set-retry'](this.id)
|
||||||
|
this.httpErroHandle.httpStatusHandle(error)
|
||||||
|
} finally {
|
||||||
|
// loader.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
window['upload-header-set-retry'](this.id)
|
||||||
|
this.toastService._badRequest("ocorreu um erro ao enviar o ficheiro")
|
||||||
|
// loader.remove()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// this.PublicationHolderService.setPublication(this.publicationFormMV)
|
||||||
|
this.ObjectMergeNotification.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
needToUploadChunk() {
|
||||||
|
return this.form.Files.filter( e => e.FileType == "video" && e.toUpload)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setDataToFrom(data: IPublicationFormModelEntity) {
|
||||||
|
this.form.setData(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
private getVideoFiles() {
|
||||||
|
return this.form.Files.filter( x => x.FileType == 'video')
|
||||||
|
}
|
||||||
|
|
||||||
|
async commit(PublicationAttachmentEntity: PublicationAttachmentEntity) {
|
||||||
|
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
|
||||||
|
const mergeRequest = await this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
|
||||||
|
|
||||||
|
if(mergeRequest.isOk()) {
|
||||||
|
console.log("commit")
|
||||||
|
PublicationAttachmentEntity.chucksManager.contentSetReady()
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
console.log('no commit')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private upload(PublicationAttachmentEntity: PublicationAttachmentEntity) {
|
||||||
|
|
||||||
|
return new Promise(async (resolve, reject)=> {
|
||||||
|
|
||||||
|
if(!PublicationAttachmentEntity.hasChunkManger) {
|
||||||
|
if(PublicationAttachmentEntity.hasBlob) {
|
||||||
|
|
||||||
|
const fileBlob = PublicationAttachmentEntity.blobFile;
|
||||||
|
const fileChunks = new Chunks({chunkSize: 1000 })
|
||||||
|
fileChunks.setFile(fileBlob)
|
||||||
|
PublicationAttachmentEntity.setChunkManger(fileChunks)
|
||||||
|
} else {
|
||||||
|
const Base64 = PublicationAttachmentEntity.Base64;
|
||||||
|
const fileChunks = new ChunksBase64({chunkSize: 1000 })
|
||||||
|
fileChunks.setFile(Base64)
|
||||||
|
PublicationAttachmentEntity.setChunkManger(fileChunks)
|
||||||
|
}
|
||||||
|
|
||||||
|
PublicationAttachmentEntity.chucksManager.updateTotalPercentageTrigger = () => {
|
||||||
|
this.uploadPercentage()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let attemp = 0;
|
||||||
|
let result: Result<true, IOUploadError>
|
||||||
|
|
||||||
|
if( PublicationAttachmentEntity.chucksManager.isUploading == false && PublicationAttachmentEntity.chucksManager.doneUpload == false) {
|
||||||
|
|
||||||
|
do {
|
||||||
|
attemp++
|
||||||
|
|
||||||
|
PublicationAttachmentEntity.chucksManager.clearManualRetry()
|
||||||
|
PublicationAttachmentEntity.chucksManager.setUploading()
|
||||||
|
result = await this.UploadFileUseCase.execute(PublicationAttachmentEntity)
|
||||||
|
PublicationAttachmentEntity.chucksManager.clearUploading()
|
||||||
|
|
||||||
|
} while (attemp<3 && result.isErr() && result.error == 'slow')
|
||||||
|
|
||||||
|
|
||||||
|
if(result.isErr()) {
|
||||||
|
PublicationAttachmentEntity.chucksManager.setManualRetry()
|
||||||
|
resolve(false)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return await resolve(this.commit(PublicationAttachmentEntity))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ( PublicationAttachmentEntity.chucksManager.contentReady == false) {
|
||||||
|
console.log("try to send again")
|
||||||
|
return await resolve(this.commit(PublicationAttachmentEntity))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('already uploading')
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadVideosFiles(): Promise<Boolean> {
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
// this.ObjectMergeNotification.socket.registerWhenConnected(() => {
|
||||||
|
const videosFiles = this.getVideoFiles()
|
||||||
|
|
||||||
|
window['upload-header-set-percentage'](this.id, 1)
|
||||||
|
window['upload-header-remove-retry'](this.id);
|
||||||
|
|
||||||
|
const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video" && e.toUpload)
|
||||||
|
|
||||||
|
const Promises: Promise<any>[] = []
|
||||||
|
|
||||||
|
for(const file of videosFilesToUploads) {
|
||||||
|
const promise = this.upload(file)
|
||||||
|
Promises.push(promise)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use Promise.all to wait for all promises to resolve
|
||||||
|
Promise.all(Promises)
|
||||||
|
.then((results) => {
|
||||||
|
// Check if every promise resolved successfully
|
||||||
|
const allPromisesResolvedSuccessfully = results.every((result) => result == true);
|
||||||
|
|
||||||
|
if (allPromisesResolvedSuccessfully) {
|
||||||
|
console.log('All promises resolved successfully.');
|
||||||
|
|
||||||
|
resolve(true)
|
||||||
|
} else {
|
||||||
|
window['upload-header-set-retry'](this.id);
|
||||||
|
resolve(false)
|
||||||
|
console.log('Some promises failed to resolve successfully.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
resolve(false)
|
||||||
|
console.error('An error occurred while resolving promises:', error);
|
||||||
|
});
|
||||||
|
//})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadPercentage() {
|
||||||
|
|
||||||
|
const videosFiles = this.getVideoFiles()
|
||||||
|
const percentageArray = videosFiles.map((e) => e.chucksManager.calculatePercentage())
|
||||||
|
|
||||||
|
|
||||||
|
// Check if the array is not empty
|
||||||
|
if (percentageArray.length === 0) {
|
||||||
|
window['upload-header-set-percentage'](this.id, this.totalPercentage)
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
console.log("===============!!==========================================")
|
||||||
|
let sum = percentageArray.reduce((acc, percentage) => acc + percentage, 0);
|
||||||
|
|
||||||
|
// Calculate the average percentage
|
||||||
|
let averagePercentage = sum / percentageArray.length;
|
||||||
|
|
||||||
|
this.totalPercentage = averagePercentage
|
||||||
|
window['upload-header-set-percentage'](this.id, this.totalPercentage)
|
||||||
|
return averagePercentage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import { ok, err, Result } from 'neverthrow';
|
|||||||
import { ObjectMergeNotification } from 'src/app/services/socket-connection-mcr.service';
|
import { ObjectMergeNotification } from 'src/app/services/socket-connection-mcr.service';
|
||||||
import { CMAPIService } from "src/app/shared/repository/CMAPI/cmapi.service"
|
import { CMAPIService } from "src/app/shared/repository/CMAPI/cmapi.service"
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
|
|
||||||
export enum UploadError {
|
export enum UploadError {
|
||||||
@@ -26,7 +26,7 @@ export class UploadStreamingService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UploadFileUseCase {
|
export class UploadFileUseCase {
|
||||||
CMAPIService: CMAPIService = window["CMAPIAPIRepository"]
|
CMAPIService: CMAPIService = window["CMAPIAPIRepository"]
|
||||||
constructor() {}
|
constructor() {}
|
||||||
async execute(PublicationAttachmentEntity: PublicationAttachmentEntity): Promise<Result<true, IOUploadError >> {
|
async execute(PublicationAttachmentEntity: PublicationAttachmentEntity): Promise<Result<true, IOUploadError >> {
|
||||||
@@ -168,7 +168,7 @@ export class PublicationAttachmentEntity {
|
|||||||
this.toUpload = true
|
this.toUpload = true
|
||||||
}
|
}
|
||||||
|
|
||||||
setChunkManger (chunks: Chunks) {
|
setChunkManger (chunks: Chunks | ChunksBase64) {
|
||||||
this.chucksManager = new ChucksManager({chunks})
|
this.chucksManager = new ChucksManager({chunks})
|
||||||
}
|
}
|
||||||
get hasChunkManger() {
|
get hasChunkManger() {
|
||||||
@@ -178,6 +178,10 @@ export class PublicationAttachmentEntity {
|
|||||||
get hasChunkManager() {
|
get hasChunkManager() {
|
||||||
return this.chucksManager != null
|
return this.chucksManager != null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasBlob() {
|
||||||
|
return this.blobFile
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPublicationFormModelEntity {
|
interface IPublicationFormModelEntity {
|
||||||
@@ -210,6 +214,7 @@ export class PublicationFormModel implements IPublicationFormModelEntity {
|
|||||||
Files: PublicationAttachmentEntity[] = []
|
Files: PublicationAttachmentEntity[] = []
|
||||||
|
|
||||||
hasSet = false
|
hasSet = false
|
||||||
|
send = false
|
||||||
|
|
||||||
setData(data: IPublicationFormModelEntity) {
|
setData(data: IPublicationFormModelEntity) {
|
||||||
if(data.Files) {
|
if(data.Files) {
|
||||||
@@ -224,12 +229,15 @@ export class PublicationFormModel implements IPublicationFormModelEntity {
|
|||||||
|
|
||||||
export class PublicationFormMV {
|
export class PublicationFormMV {
|
||||||
|
|
||||||
|
readonly id = uuidv4()
|
||||||
private UploadFileUseCase = new UploadFileUseCase()
|
private UploadFileUseCase = new UploadFileUseCase()
|
||||||
form = new PublicationFormModel()
|
form = new PublicationFormModel()
|
||||||
ObjectMergeNotification = new ObjectMergeNotification()
|
ObjectMergeNotification = new ObjectMergeNotification()
|
||||||
|
totalPercentage = 0
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// this.ObjectMergeNotification.connect();
|
this.ObjectMergeNotification.connect();
|
||||||
|
window['upload-header-set-add'](this.id, this.totalPercentage)
|
||||||
}
|
}
|
||||||
|
|
||||||
setDataToFrom(data: IPublicationFormModelEntity) {
|
setDataToFrom(data: IPublicationFormModelEntity) {
|
||||||
@@ -240,25 +248,50 @@ export class PublicationFormMV {
|
|||||||
return this.form.Files.filter( x => x.FileType == 'video')
|
return this.form.Files.filter( x => x.FileType == 'video')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async commit(PublicationAttachmentEntity: PublicationAttachmentEntity) {
|
||||||
|
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
|
||||||
|
const mergeRequest = await this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
|
||||||
|
|
||||||
|
if(mergeRequest.isOk()) {
|
||||||
|
console.log("commit")
|
||||||
|
PublicationAttachmentEntity.chucksManager.contentSetReady()
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
console.log('no commit')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private upload(PublicationAttachmentEntity: PublicationAttachmentEntity) {
|
private upload(PublicationAttachmentEntity: PublicationAttachmentEntity) {
|
||||||
|
|
||||||
return new Promise(async (resolve, reject)=> {
|
return new Promise(async (resolve, reject)=> {
|
||||||
|
|
||||||
if(!PublicationAttachmentEntity.hasChunkManger) {
|
if(!PublicationAttachmentEntity.hasChunkManger) {
|
||||||
|
|
||||||
|
if(PublicationAttachmentEntity.hasBlob) {
|
||||||
|
|
||||||
const fileBlob = PublicationAttachmentEntity.blobFile;
|
const fileBlob = PublicationAttachmentEntity.blobFile;
|
||||||
const fileChunks = new Chunks({chunkSize: 400 })
|
const fileChunks = new Chunks({chunkSize: 50 })
|
||||||
fileChunks.setFile(fileBlob)
|
fileChunks.setFile(fileBlob)
|
||||||
|
|
||||||
PublicationAttachmentEntity.setChunkManger(fileChunks)
|
PublicationAttachmentEntity.setChunkManger(fileChunks)
|
||||||
|
} else {
|
||||||
|
const Base64 = PublicationAttachmentEntity.Base64;
|
||||||
|
const fileChunks = new ChunksBase64({chunkSize: 50 })
|
||||||
|
fileChunks.setFile(Base64)
|
||||||
|
PublicationAttachmentEntity.setChunkManger(fileChunks)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PublicationAttachmentEntity.chucksManager.updateTotalPercentageTrigger = () => {
|
||||||
|
this.uploadPercentage()
|
||||||
|
}
|
||||||
|
|
||||||
} else if(PublicationAttachmentEntity.chucksManager.doneUpload) {
|
|
||||||
return resolve(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let attemp = 0;
|
let attemp = 0;
|
||||||
let result: Result<true, IOUploadError>
|
let result: Result<true, IOUploadError>
|
||||||
|
|
||||||
if( PublicationAttachmentEntity.chucksManager.isUploading == false) {
|
if( PublicationAttachmentEntity.chucksManager.isUploading == false && PublicationAttachmentEntity.chucksManager.doneUpload == false) {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
attemp++
|
attemp++
|
||||||
@@ -276,20 +309,16 @@ export class PublicationFormMV {
|
|||||||
resolve(false)
|
resolve(false)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
|
return await resolve(this.commit(PublicationAttachmentEntity))
|
||||||
const mergeRequest = await this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
|
|
||||||
|
|
||||||
if(mergeRequest.isOk()) {
|
|
||||||
PublicationAttachmentEntity.chucksManager.contentSetReady()
|
|
||||||
resolve(true)
|
|
||||||
} else {
|
|
||||||
resolve(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if ( PublicationAttachmentEntity.chucksManager.contentReady == false) {
|
||||||
|
console.log("try to send again")
|
||||||
|
return await resolve(this.commit(PublicationAttachmentEntity))
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('already uploading')
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -303,6 +332,8 @@ export class PublicationFormMV {
|
|||||||
// this.ObjectMergeNotification.socket.registerWhenConnected(() => {
|
// this.ObjectMergeNotification.socket.registerWhenConnected(() => {
|
||||||
const videosFiles = this.getVideoFiles()
|
const videosFiles = this.getVideoFiles()
|
||||||
|
|
||||||
|
window['upload-header-set-percentage'](this.id, 1)
|
||||||
|
|
||||||
const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video" && e.toUpload && e.blobFile)
|
const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video" && e.toUpload && e.blobFile)
|
||||||
|
|
||||||
const Promises: Promise<any>[] = []
|
const Promises: Promise<any>[] = []
|
||||||
@@ -320,8 +351,10 @@ export class PublicationFormMV {
|
|||||||
|
|
||||||
if (allPromisesResolvedSuccessfully) {
|
if (allPromisesResolvedSuccessfully) {
|
||||||
console.log('All promises resolved successfully.');
|
console.log('All promises resolved successfully.');
|
||||||
|
window['upload-header-set-remove'](this.id);
|
||||||
resolve(true)
|
resolve(true)
|
||||||
} else {
|
} else {
|
||||||
|
window['upload-header-set-remove'](this.id);
|
||||||
resolve(false)
|
resolve(false)
|
||||||
console.log('Some promises failed to resolve successfully.');
|
console.log('Some promises failed to resolve successfully.');
|
||||||
}
|
}
|
||||||
@@ -336,23 +369,27 @@ export class PublicationFormMV {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get uploadPercentage() {
|
uploadPercentage() {
|
||||||
|
|
||||||
const videosFiles = this.getVideoFiles()
|
const videosFiles = this.getVideoFiles()
|
||||||
const percentageArray = videosFiles.map((e) => e.chucksManager.calculatePercentage())
|
const percentageArray = videosFiles.map((e) => e.chucksManager.calculatePercentage())
|
||||||
|
|
||||||
// Check if the array is not empty
|
// Check if the array is not empty
|
||||||
if (percentageArray.length === 0) {
|
if (percentageArray.length === 0) {
|
||||||
return null;
|
window['upload-header-set-percentage'](this.id, this.totalPercentage)
|
||||||
}
|
return 0;
|
||||||
|
} else {
|
||||||
let sum = percentageArray.reduce((acc, percentage) => acc + percentage, 0);
|
let sum = percentageArray.reduce((acc, percentage) => acc + percentage, 0);
|
||||||
|
|
||||||
// Calculate the average percentage
|
// Calculate the average percentage
|
||||||
let averagePercentage = sum / percentageArray.length;
|
let averagePercentage = sum / percentageArray.length;
|
||||||
|
|
||||||
|
this.totalPercentage = averagePercentage
|
||||||
|
window['upload-header-set-percentage'](this.id, this.totalPercentage)
|
||||||
return averagePercentage;
|
return averagePercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -397,6 +434,51 @@ export class Chunks {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ChunksBase64 {
|
||||||
|
|
||||||
|
chunkSize: number
|
||||||
|
private base64: string
|
||||||
|
bytes: Uint8Array
|
||||||
|
|
||||||
|
constructor({chunkSize}) {
|
||||||
|
this.chunkSize = chunkSize * 1024
|
||||||
|
}
|
||||||
|
|
||||||
|
get totalChunks () {
|
||||||
|
return Math.ceil(this.bytes.length / this.chunkSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
setFile(base64: string) {
|
||||||
|
this.base64 = base64
|
||||||
|
let utf8Encoder = new TextEncoder();
|
||||||
|
this.bytes = utf8Encoder.encode(base64);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to read a chunk of the file
|
||||||
|
async readChunk(start: number, end: number) {
|
||||||
|
|
||||||
|
// Slice the last 1MB of bytes
|
||||||
|
let slicedBytes = this.bytes.slice(start, end);
|
||||||
|
|
||||||
|
// Convert the sliced bytes back to a string
|
||||||
|
let text = new TextDecoder().decode(slicedBytes);
|
||||||
|
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
|
||||||
|
async getChunks(i: number): Promise<string> {
|
||||||
|
i--
|
||||||
|
if(i < this.totalChunks) {
|
||||||
|
const start = i * this.chunkSize;
|
||||||
|
const end = Math.min(start + this.chunkSize, this.bytes.length);
|
||||||
|
const chunk = await this.readChunk(start, end);
|
||||||
|
|
||||||
|
return chunk
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
interface IUploadResponse {
|
interface IUploadResponse {
|
||||||
result: Result<any, Error>
|
result: Result<any, Error>
|
||||||
attemp: number
|
attemp: number
|
||||||
@@ -413,8 +495,11 @@ export class ChucksManager {
|
|||||||
contentReady = false
|
contentReady = false
|
||||||
manualRetry = false
|
manualRetry = false
|
||||||
isUploading = false
|
isUploading = false
|
||||||
|
needToCommit = true
|
||||||
subscribeToUseCaseResponse: Function[] = []
|
subscribeToUseCaseResponse: Function[] = []
|
||||||
|
|
||||||
|
updateTotalPercentageTrigger = () => {}
|
||||||
|
|
||||||
getUploadPercentage() {
|
getUploadPercentage() {
|
||||||
return this.uploadPercentage
|
return this.uploadPercentage
|
||||||
}
|
}
|
||||||
@@ -474,6 +559,7 @@ export class ChucksManager {
|
|||||||
setPercentage() {
|
setPercentage() {
|
||||||
const percentage: number = this.calculatePercentage()
|
const percentage: number = this.calculatePercentage()
|
||||||
console.log({percentage})
|
console.log({percentage})
|
||||||
|
this.updateTotalPercentageTrigger()
|
||||||
this.uploadPercentage = percentage.toString()+"%"
|
this.uploadPercentage = percentage.toString()+"%"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,6 +617,10 @@ export class ChucksManager {
|
|||||||
this.onSetLastChunk.forEach(callback => callback());
|
this.onSetLastChunk.forEach(callback => callback());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doneCommit() {
|
||||||
|
this.needToCommit = false
|
||||||
|
}
|
||||||
|
|
||||||
contentSetReady() {
|
contentSetReady() {
|
||||||
this.merging = false
|
this.merging = false
|
||||||
this.contentReady = true
|
this.contentReady = true
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
<ion-progress-bar type="indeterminate" *ngIf="showLoader || publicationFolderService.showLoader"></ion-progress-bar>
|
||||||
<ion-refresher-content>
|
<ion-refresher-content>
|
||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<swiper-container [config]="swiperThumbsConfig" [modules]="swiperModules" [speed]=400 navigation="true" [pagination]="{clickable: true, dynamicBullets: true }">
|
<swiper-container [config]="swiperThumbsConfig" [modules]="swiperModules" [speed]=400 navigation="true" [pagination]="{clickable: true, dynamicBullets: true }">
|
||||||
<swiper-slide *ngFor="let files of publication.Files let k = index" class="centered-slide">
|
<swiper-slide *ngFor="let files of publication.Files let k = index" class="centered-slide">
|
||||||
<div class="cool">
|
<div class="cool">
|
||||||
<div (click)="viewPublicationDetail(publication.DocumentId, publication.ProcessId)">
|
<div >
|
||||||
<img *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'image'" class="post-img cursor-pointer"
|
<img *ngIf="checkFileType.checkFileType(files.FileExtension ) == 'image'" class="post-img cursor-pointer"
|
||||||
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
|
[lazyLoad]="'data:image/jpg;base64,' + files.FileBase64">
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import { AskModalPage } from 'src/app/modals/ask-modal/ask-modal.page';
|
|||||||
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
||||||
import { PublicationVideoManagerService } from "src/app/services/publication/publication-video-manager.service";
|
import { PublicationVideoManagerService } from "src/app/services/publication/publication-video-manager.service";
|
||||||
import { StopvideoService } from "src/app/services/stopvideo.service";
|
import { StopvideoService } from "src/app/services/stopvideo.service";
|
||||||
|
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-view-publications',
|
selector: 'app-view-publications',
|
||||||
templateUrl: './view-publications.page.html',
|
templateUrl: './view-publications.page.html',
|
||||||
@@ -72,7 +74,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
public publicationFolderService: PublicationFolderService,
|
public publicationFolderService: PublicationFolderService,
|
||||||
public checkFileType: checkFileTypeService,
|
public checkFileType: checkFileTypeService,
|
||||||
private publicationVideoManagerService: PublicationVideoManagerService,
|
private publicationVideoManagerService: PublicationVideoManagerService,
|
||||||
public StopvideoService: StopvideoService
|
public StopvideoService: StopvideoService,
|
||||||
|
public PublicationHolderService: PublicationHolderService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
@@ -129,6 +132,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
this.stopVideo();
|
this.stopVideo();
|
||||||
|
|
||||||
|
setTimeout(()=> {
|
||||||
|
this.doRefresh({})
|
||||||
|
}, 1500)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,43 +178,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
|
|
||||||
try {
|
await this.publicationFolderService.getPublicationsIds(folderId)
|
||||||
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
|
|
||||||
|
|
||||||
this.createPublicationList(folderId)
|
|
||||||
let loadLater = []
|
|
||||||
for (let publicationId of publicationIds) {
|
|
||||||
|
|
||||||
if (!this.publicationIsPresent(publicationId, folderId)) {
|
|
||||||
await this.loadPublication(publicationId, folderId)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
loadLater.push(publicationId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let publicationId of loadLater) {
|
|
||||||
await this.loadPublication(publicationId, folderId)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (let localPublication of this.publicationFolderService.publicationList[folderId]) {
|
|
||||||
|
|
||||||
const apiPublication = publicationIds.includes(localPublication.DocumentId)
|
|
||||||
if (!apiPublication) {
|
|
||||||
this.publicationFolderService.deletePost(folderId, localPublication.DocumentId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
|
|
||||||
this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]);
|
|
||||||
|
|
||||||
this.oldpublicationIds = publicationIds
|
|
||||||
} catch (error) {
|
|
||||||
this.showLoader = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_deletePublication = (folderId, publicationId) => {
|
_deletePublication = (folderId, publicationId) => {
|
||||||
@@ -227,31 +201,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadPublication(publicationId, folderId) {
|
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)
|
await this.publicationFolderService.loadPublication(publicationId, folderId)
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
|
||||||
this.publicationFolderService.revertPublicationOrder(folderId)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
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)) {
|
|
||||||
|
|
||||||
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
|
|
||||||
} else {
|
|
||||||
// console.log({publicationDetails})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,6 +215,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
async AddPublication(publicationType: any, folderId: any) {
|
async AddPublication(publicationType: any, folderId: any) {
|
||||||
|
|
||||||
|
if(this.PublicationHolderService.PublicationFormMV.length == 0) {
|
||||||
|
|
||||||
if (window.innerWidth < 701) {
|
if (window.innerWidth < 701) {
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: NewPublicationPage,
|
component: NewPublicationPage,
|
||||||
@@ -286,6 +239,12 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
folderId: folderId
|
folderId: folderId
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.toastService._successMessage('já existe uma publicação a ser processado');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,6 +333,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
stopVideo() {
|
stopVideo() {
|
||||||
|
try {
|
||||||
var videos = document.querySelectorAll('video');
|
var videos = document.querySelectorAll('video');
|
||||||
|
|
||||||
// Pause each video
|
// Pause each video
|
||||||
@@ -395,6 +355,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onScroll(event): void {
|
public onScroll(event): void {
|
||||||
|
|||||||
@@ -4245,7 +4245,7 @@
|
|||||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||||
},
|
},
|
||||||
defaultUrl: {
|
defaultUrl: {
|
||||||
value: 'compressed.tracemonkey-pldi-09.pdf',
|
value: new URLSearchParams(window.location.search).get('file'),
|
||||||
kind: OptionKind.VIEWER
|
kind: OptionKind.VIEWER
|
||||||
},
|
},
|
||||||
defaultZoomValue: {
|
defaultZoomValue: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Environment } from './../app/models/envarioment'
|
import { Environment } from './../app/models/envarioment'
|
||||||
import { environment as oaprProd } from './suport/oapr'
|
import { environment as oaprProd } from './suport/oapr'
|
||||||
import { environment as doneITProd } from './suport/doneIt'
|
// import { environment as doneITProd } from './suport/doneIt'
|
||||||
import { DevDev } from './suport/dev'
|
import { DevDev } from './suport/dev'
|
||||||
|
|
||||||
|
|
||||||
export const environment: Environment = oaprProd;
|
export const environment: Environment = oaprProd;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Environment } from './../app/models/envarioment'
|
import { Environment } from './../app/models/envarioment'
|
||||||
import { environment as oaprDev } from './suport/oapr'
|
import { environment as oaprDev } from './suport/oapr'
|
||||||
import { doneITDev } from './suport/doneIt'
|
// import { doneITDev } from './suport/doneIt'
|
||||||
import { DevDev } from './suport/dev'
|
import { DevDev } from './suport/dev'
|
||||||
|
|
||||||
|
|
||||||
export const environment: Environment = DevDev
|
export const environment: Environment = oaprDev
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ export const environment: Environment = {
|
|||||||
dispatchPR: 'Despachos Presidênciais',
|
dispatchPR: 'Despachos Presidênciais',
|
||||||
sentryUrl: 'https://9920cc36f1d740b987426ee8d80cf588@o4504340905525248.ingest.sentry.io/4504340946419712',
|
sentryUrl: 'https://9920cc36f1d740b987426ee8d80cf588@o4504340905525248.ingest.sentry.io/4504340946419712',
|
||||||
storageProduction: true,
|
storageProduction: true,
|
||||||
rejectUnauthorized: "true"
|
rejectUnauthorized: "true",
|
||||||
|
fileHub: 'https://gdcmapi-dev.dyndns.info/FileHub'
|
||||||
/* production: true,
|
/* production: true,
|
||||||
domain: 'gabinetedigital.local',
|
domain: 'gabinetedigital.local',
|
||||||
defaultuser: '',
|
defaultuser: '',
|
||||||
@@ -87,5 +88,6 @@ export const DevDev: Environment = {
|
|||||||
PR: 'Titular',
|
PR: 'Titular',
|
||||||
VP: '',
|
VP: '',
|
||||||
dispatchPR: 'Despachos Titular',
|
dispatchPR: 'Despachos Titular',
|
||||||
storageProduction: false, */
|
storageProduction: false, */,
|
||||||
|
fileHub: 'https://gdcmapi-dev.dyndns.info/FileHub'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export const environment: Environment = {
|
|||||||
VP: '',
|
VP: '',
|
||||||
dispatchPR: 'Despachos Titular',
|
dispatchPR: 'Despachos Titular',
|
||||||
storageProduction: true,
|
storageProduction: true,
|
||||||
rejectUnauthorized: "true"
|
rejectUnauthorized: "true",
|
||||||
|
fileHub: 'https://gdcmapi-dev.dyndns.info/FileHub'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const doneITDev: Environment = {
|
export const doneITDev: Environment = {
|
||||||
@@ -58,5 +59,6 @@ export const doneITDev: Environment = {
|
|||||||
VP: '',
|
VP: '',
|
||||||
dispatchPR: 'Despachos Titular',
|
dispatchPR: 'Despachos Titular',
|
||||||
storageProduction: false,
|
storageProduction: false,
|
||||||
rejectUnauthorized: "true"
|
rejectUnauthorized: "true",
|
||||||
|
fileHub: 'https://gdcmapi-dev.dyndns.info/FileHub'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export const environment: Environment = {
|
|||||||
dispatchPR: 'Despachos Presidênciais',
|
dispatchPR: 'Despachos Presidênciais',
|
||||||
sentryUrl: 'https://9920cc36f1d740b987426ee8d80cf588@o4504340905525248.ingest.sentry.io/4504340946419712',
|
sentryUrl: 'https://9920cc36f1d740b987426ee8d80cf588@o4504340905525248.ingest.sentry.io/4504340946419712',
|
||||||
storageProduction: true,
|
storageProduction: true,
|
||||||
rejectUnauthorized: "false"
|
rejectUnauthorized: "false",
|
||||||
|
fileHub: 'https://gdqas-cmapi.oapr.gov.ao/FileHub'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const oaprDev: Environment = {
|
export const oaprDev: Environment = {
|
||||||
@@ -57,5 +58,6 @@ export const oaprDev: Environment = {
|
|||||||
dispatchPR: 'Despachos Presidênciais',
|
dispatchPR: 'Despachos Presidênciais',
|
||||||
sentryUrl: 'https://9920cc36f1d740b987426ee8d80cf588@o4504340905525248.ingest.sentry.io/4504340946419712',
|
sentryUrl: 'https://9920cc36f1d740b987426ee8d80cf588@o4504340905525248.ingest.sentry.io/4504340946419712',
|
||||||
storageProduction: false,
|
storageProduction: false,
|
||||||
rejectUnauthorized: "false"
|
rejectUnauthorized: "false",
|
||||||
|
fileHub: 'https://gdqas-cmapi.oapr.gov.ao/FileHub'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export let versionData = {
|
|||||||
"lastCommitAuthor": "'Peter Maquiran'",
|
"lastCommitAuthor": "'Peter Maquiran'",
|
||||||
"lastCommitTime": "'Thu Aug 31 12:00:52 2023 +0100'",
|
"lastCommitTime": "'Thu Aug 31 12:00:52 2023 +0100'",
|
||||||
"lastCommitMessage": "add attachments",
|
"lastCommitMessage": "add attachments",
|
||||||
"lastCommitNumber": "1513",
|
"lastCommitNumber": "1515",
|
||||||
"change": "",
|
"change": "",
|
||||||
"changeStatus": "On branch notification-header/feature\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/header/header.page.ts\n\tnew file: src/app/store/notification-holder.service.spec.ts\n\tnew file: src/app/store/notification-holder.service.ts\n\nChanges not staged for commit:\n (use \"git add <file>...\" to update what will be committed)\n (use \"git restore <file>...\" to discard changes in working directory)\n\tmodified: src/app/modals/create-process/create-process.page.ts\n\tmodified: src/app/modals/document-detail/document-detail.page.ts\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html",
|
"changeStatus": "On branch notification-header/feature\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/header/header.page.ts\n\tnew file: src/app/store/notification-holder.service.spec.ts\n\tnew file: src/app/store/notification-holder.service.ts\n\nChanges not staged for commit:\n (use \"git add <file>...\" to update what will be committed)\n (use \"git restore <file>...\" to discard changes in working directory)\n\tmodified: src/app/modals/create-process/create-process.page.ts\n\tmodified: src/app/modals/document-detail/document-detail.page.ts\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html",
|
||||||
"changeAuthor": "peter.maquiran"
|
"changeAuthor": "peter.maquiran"
|
||||||
|
|||||||
Reference in New Issue
Block a user