mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Merge branch 'feature/viewer-attachment' of https://bitbucket.org/equilibriumito/gabinete-digital-fo into feature/viewer-attachment
This commit is contained in:
@@ -146,7 +146,6 @@
|
||||
[eventSource]="listToPresent"
|
||||
[calendarMode]="calendar.mode"
|
||||
[currentDate]="calendar.currentDate"
|
||||
(onEventSelected)="onEventSelected($event)"
|
||||
(onTitleChanged)="onViewTitleChanged($event)"
|
||||
(onRangeChanged)="onRangeChanged($event)"
|
||||
(onCurrentDateChanged)="onCurrentChanged($event)"
|
||||
@@ -217,7 +216,6 @@
|
||||
<div class="height-100">
|
||||
<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">
|
||||
<span >Hoje, </span> {{ todayDateFormat() }}
|
||||
</div>
|
||||
@@ -232,7 +230,7 @@
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -285,6 +285,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
|
||||
this.calendar.currentDate = new Date();
|
||||
//this.onCurrentChanged(new Date())
|
||||
|
||||
try {
|
||||
this.myCal.update();
|
||||
@@ -292,6 +293,7 @@ export class AgendaPage implements OnInit {
|
||||
this.onDropDownScrollWeal()
|
||||
} catch (e) { }
|
||||
|
||||
//this.reloadCalendar();
|
||||
this.updateEventListBox()
|
||||
|
||||
realoadCounter++;
|
||||
@@ -450,11 +452,6 @@ export class AgendaPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
onTimeSelected = (ev: { selectedTime: Date, events: any[] }) => {
|
||||
this.eventSelectedDate2 = ev.selectedTime;
|
||||
}
|
||||
|
||||
|
||||
currentMoth = {
|
||||
rangeStartDate: null,
|
||||
rangeEndDate: null
|
||||
@@ -614,7 +611,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.loadRangeEventRun(startTime, endTime)
|
||||
} else {
|
||||
|
||||
// alert('other')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,6 +678,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
this.myCal.update();
|
||||
this.myCal.loadEvents();
|
||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||
this.updateEventListBox()
|
||||
})
|
||||
}
|
||||
@@ -1140,6 +1138,8 @@ export class AgendaPage implements OnInit {
|
||||
reloadCalendar() {
|
||||
//
|
||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||
|
||||
this.onCurrentChanged(new Date(this.timelineDate))
|
||||
}
|
||||
|
||||
async EventToApproveGoBack() {
|
||||
|
||||
@@ -32,7 +32,6 @@ import { EventTrigger } from 'src/app/services/eventTrigger.service';
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { Plugins } from '@capacitor/core';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
|
||||
const { App } = Plugins;
|
||||
@@ -129,8 +128,7 @@ export class ChatPage implements OnInit {
|
||||
private eventTriger: EventTrigger,
|
||||
private RochetChatConnectorService: RochetChatConnectorService,
|
||||
private zone: NgZone,
|
||||
public RouteService: RouteService,
|
||||
private ChangeDetectorRef: ChangeDetectorRef
|
||||
public RouteService: RouteService
|
||||
) {
|
||||
|
||||
this.headers = new HttpHeaders();;
|
||||
@@ -178,15 +176,6 @@ export class ChatPage implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
this.ChatSystemService.setMainChangeDetector(()=> {
|
||||
this.changeDetector()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
changeDetector = () => {
|
||||
console.log('run detection')
|
||||
this.ChangeDetectorRef.detectChanges()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private fileOpener: FileOpener,
|
||||
public RouteService: RouteService,
|
||||
private FileValidatorService: FileValidatorService,
|
||||
private ChangeDetectorRef: ChangeDetectorRef
|
||||
) {
|
||||
this.ChatSystemService.getUser()
|
||||
|
||||
@@ -147,10 +146,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked;
|
||||
this.ChatSystemService.openRoom(this.roomId)
|
||||
this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ')
|
||||
|
||||
this.ChatSystemService.getGroupRoom(this.roomId).setChangeDetector(()=> {
|
||||
this.changeDetector()
|
||||
})
|
||||
} catch (error) {
|
||||
setTimeout(() => {
|
||||
this.open()
|
||||
@@ -159,11 +154,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
|
||||
changeDetector = () => {
|
||||
console.log('run detection page')
|
||||
this.ChangeDetectorRef.detectChanges()
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.loggedUser = this.loggedUserChat;
|
||||
@@ -841,7 +831,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
async addFileToChat(types: typeof FileType[]) {
|
||||
|
||||
|
||||
|
||||
|
||||
const roomId = this.roomId
|
||||
|
||||
@@ -879,7 +869,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
})
|
||||
return
|
||||
|
||||
|
||||
}
|
||||
|
||||
const file: any = await this.fileService.getFileFromDevice(types);
|
||||
|
||||
@@ -37,7 +37,6 @@ import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-co
|
||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||
import { sanitize } from "sanitize-filename-ts";
|
||||
import { FilePicker } from '@capawesome/capacitor-file-picker';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
|
||||
|
||||
@@ -125,7 +124,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private router: Router,
|
||||
public RochetChatConnectorService: RochetChatConnectorService,
|
||||
private FileValidatorService: FileValidatorService,
|
||||
private ChangeDetectorRef: ChangeDetectorRef
|
||||
) {
|
||||
|
||||
try {
|
||||
@@ -144,10 +142,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({})
|
||||
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||
this.ChatSystemService.openRoom(this.roomId)
|
||||
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => {
|
||||
|
||||
this.changeDetector()
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
this.scrollToBottomClicked()
|
||||
@@ -157,10 +151,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
changeDetector = () => {
|
||||
console.log('run detection page')
|
||||
this.ChangeDetectorRef.detectChanges()
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
try {
|
||||
@@ -1128,6 +1119,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
await modal.present();
|
||||
/*
|
||||
await modal.present(); */
|
||||
|
||||
var blob = new Blob([pdfString], { type: 'application/pdf' });
|
||||
|
||||
@@ -23,26 +23,26 @@
|
||||
|
||||
|
||||
<div class="conteiner-box pt-20 height-100">
|
||||
|
||||
<div class="main-content justify-center d-flex height-100">
|
||||
|
||||
<div class="main-content justify-center d-flex height-100">
|
||||
<div class="box-container width-100 d-flex mx-20 overflow-hidden" style="padding: 0px;overflow: hidden;">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="loadingAllTask || TaskService.showLoaderNum != 0"></ion-progress-bar>
|
||||
<div class="px-20 pb-20 container-filters">
|
||||
<p class="time ion-text-left font-18-em">{{customDate}}</p>
|
||||
<div class="filters-box wrap d-flex float-left">
|
||||
|
||||
|
||||
<div class="event-box mr-20 pointer hideMobile font-14-em" (click)="goToAllTaskFilter('ForToDay')">
|
||||
<!-- <p>correspondencia com prazo para hoje</p> -->
|
||||
<p>Correspondências com prazo para hoje</p>
|
||||
<span>{{ TaskService.deadline }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="event-box mr-20 pointer hideMobile font-14-em" (click)="goToAllTaskFilter('OverdueTasks')">
|
||||
<!-- <p>correspondencia em atraso</p> -->
|
||||
<p>Correspondências em atraso</p>
|
||||
<span>{{ TaskService.overdueTasks }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="event-box mr-20 pointer hideMobile font-14-em" (click)="goToAllTaskFilter('unread')">
|
||||
<!-- <p>correspondencia não lidas</p> -->
|
||||
<p>Correspondências não lidas</p>
|
||||
@@ -56,12 +56,12 @@
|
||||
<!-- <p>correspondencia com prazo para hoje</p> -->
|
||||
<p>Correspondências com prazo para hoje <b>{{ TaskService.deadline }}</b></p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="event-box pointer d-none showMobile font-14-em" (click)="goToAllTaskFilter('OverdueTasks')">
|
||||
<!-- <p>correspondencia em atraso</p> -->
|
||||
<p>Correspondências em atraso <b>{{ TaskService.overdueTasks }}</b></p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="event-box pointer d-none showMobile font-14-em" (click)="goToAllTaskFilter('unread')">
|
||||
<!-- <p>correspondencia não lidas</p> -->
|
||||
<p>Correspondências não lidas <b>{{ TaskService.unread }}</b></p>
|
||||
@@ -69,10 +69,10 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex width-100 schedule-container">
|
||||
<div class="flex-1">
|
||||
|
||||
|
||||
<div *ngIf="p.userPermission([p.permissionList.Agenda.access])" class="schedule height-100 schedule-1">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showAgendaLoader"></ion-progress-bar>
|
||||
<div class="schedule-header">
|
||||
@@ -87,35 +87,35 @@
|
||||
slot="end"
|
||||
src="assets/images/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'gov' "
|
||||
class="icon-next font-35-rem"
|
||||
slot="end"
|
||||
src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'doneIt' "
|
||||
class="icon-next font-35-em"
|
||||
slot="end"
|
||||
src="assets/images/theme/doneIt/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
</button>
|
||||
</div>
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
|
||||
|
||||
<ion-list>
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of listToPresent"
|
||||
(click)="goToEvent(event)"
|
||||
>
|
||||
<div class="d-flex event-box-content content-{{agendaColor}}-{{event.CalendarName}}">
|
||||
|
||||
|
||||
<div class="schedule-time">
|
||||
<div *ngIf="!event.IsAllDayEvent" class="time-start">{{event.StartDate | date: 'HH:mm'}}</div>
|
||||
<div *ngIf="!event.IsAllDayEvent" class="time-end">{{event.EndDate | date: 'HH:mm'}}</div>
|
||||
|
||||
|
||||
<div *ngIf="event.IsAllDayEvent" class="time-start"> Todo </div>
|
||||
<div *ngIf="event.IsAllDayEvent" class="time-end text-center"> o dia </div>
|
||||
<div></div>
|
||||
@@ -128,12 +128,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
|
||||
|
||||
</ion-list>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.access])" class="schedule schedule-1 height-100">
|
||||
@@ -150,21 +150,21 @@
|
||||
slot="end"
|
||||
src="assets/images/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'gov' "
|
||||
class="icon-next"
|
||||
slot="end"
|
||||
src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'doneIt' "
|
||||
class="icon-next"
|
||||
slot="end"
|
||||
src="assets/images/theme/doneIt/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
</button>
|
||||
</div>
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
@@ -184,15 +184,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
|
||||
|
||||
</ion-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -211,21 +211,21 @@
|
||||
slot="end"
|
||||
src="assets/images/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'gov' "
|
||||
class="icon-next-color font-35-em"
|
||||
slot="end"
|
||||
src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'doneIt' "
|
||||
class="icon-next-color font-35-em"
|
||||
slot="end"
|
||||
src="assets/images/theme/doneIt/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
</button>
|
||||
</div>
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
@@ -233,13 +233,13 @@
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of listToPresent"
|
||||
(click)="goToEvent(event)"
|
||||
>
|
||||
|
||||
|
||||
<div class="d-flex content-{{agendaColor}}-{{event.CalendarName}}">
|
||||
|
||||
|
||||
<div class="schedule-time">
|
||||
<div *ngIf="!event.IsAllDayEvent" class="time-start">{{event.StartDate | date: 'HH:mm'}}</div>
|
||||
<div *ngIf="!event.IsAllDayEvent" class="time-end">{{event.EndDate | date: 'HH:mm'}}</div>
|
||||
|
||||
|
||||
<div *ngIf="event.IsAllDayEvent" class="time-start"> Todo </div>
|
||||
<div *ngIf="event.IsAllDayEvent" class="time-end text-center"> o dia </div>
|
||||
<div></div>
|
||||
@@ -252,12 +252,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
|
||||
|
||||
</ion-list>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.access])" class="schedule schedule-1 height-100">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showCorrespondenciasLoader"></ion-progress-bar>
|
||||
<div class="schedule-header">
|
||||
@@ -272,21 +272,21 @@
|
||||
slot="end"
|
||||
src="assets/images/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'gov' "
|
||||
class="icon-next"
|
||||
slot="end"
|
||||
src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
<ion-icon
|
||||
*ngIf="ThemeService.currentTheme == 'doneIt' "
|
||||
class="icon-next"
|
||||
slot="end"
|
||||
src="assets/images/theme/doneIt/icons-arrow-circle-arrow-right.svg"
|
||||
></ion-icon>
|
||||
|
||||
|
||||
</button>
|
||||
</div>
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
@@ -304,7 +304,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</ion-item>
|
||||
|
||||
|
||||
</ion-list>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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> -->
|
||||
</ion-content>
|
||||
|
||||
|
||||
@@ -94,6 +94,10 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
|
||||
window['attachments-expediente-update'] = () => {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -249,6 +253,8 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
this.TaskService.loadExpedientes();
|
||||
|
||||
console.log("res========", res)
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": res.serialNumber,
|
||||
"Folio": res.workflowInstanceDataFields.Subject,
|
||||
|
||||
@@ -9,6 +9,9 @@ import { NewPublicationPageRoutingModule } from './new-publication-routing.modul
|
||||
import { NewPublicationPage } from './new-publication.page';
|
||||
import '@teamhive/capacitor-video-recorder';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
@@ -16,6 +19,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
IonicModule,
|
||||
NewPublicationPageRoutingModule,
|
||||
FontAwesomeModule,
|
||||
MatProgressBarModule,
|
||||
],
|
||||
exports: [NewPublicationPage],
|
||||
declarations: [NewPublicationPage]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="overflow-y-auto padding">
|
||||
<div *ngIf="publicationType!='1'" class="ion-item-container"
|
||||
[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>
|
||||
</div>
|
||||
|
||||
@@ -21,41 +21,50 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
||||
</div>
|
||||
<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>
|
||||
</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>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<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; text-align-last: right;">
|
||||
X
|
||||
</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"
|
||||
name="image" ngDefaultControl [src]="seleted.FileBase64"
|
||||
(click)="imageSize(capturedImage)" style="height: 69px; width: 69px"></ion-img>
|
||||
name="image" ngDefaultControl [src]="seleted.url"
|
||||
(click)="imageSize(capturedImage)" style="height: 69px;"></ion-img>
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
||||
controls="controls" preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="seleted.FileBase64">
|
||||
<source type="video/mp4" [src]="seleted.url">
|
||||
</video>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- Display the blurred image and count if there are more images -->
|
||||
<ion-thumbnail *ngIf="seletedContent.length > displayLimit" lot="start">
|
||||
<ion-img [src]="'data:image/jpg;base64,' + seletedContent[displayLimit - 1].base64"
|
||||
<ion-thumbnail *ngIf="PublicationFromMvService.form.Files.length > displayLimit" lot="start">
|
||||
<ion-img [src]="'data:image/jpg;base64,' + PublicationFromMvService.form.Files[displayLimit - 1].Base64"
|
||||
style="filter: blur(5px);"></ion-img>
|
||||
|
||||
<p>mais {{ seletedContent.length - displayLimit }}</p>
|
||||
<p>mais {{ PublicationFromMvService.form.Files.length - displayLimit }}</p>
|
||||
</ion-thumbnail>
|
||||
<ion-label class="pl-10">
|
||||
<p>{{capturedImageTitle}}</p>
|
||||
@@ -66,22 +75,6 @@
|
||||
</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">
|
||||
<ion-label (click)="takePicture()">
|
||||
<div class="attach-icon">
|
||||
@@ -111,51 +104,7 @@
|
||||
</div>
|
||||
</ion-label>
|
||||
</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">
|
||||
<ion-label (click)="loadVideo()" class="cursor-pointer">
|
||||
<div class="attach-icon">
|
||||
|
||||
@@ -27,14 +27,16 @@ import { FilePicker } from '@capawesome/capacitor-file-picker';
|
||||
import { CapacitorVideoPlayer } from 'capacitor-video-player';
|
||||
import { CaptureError, CaptureImageOptions, MediaCapture, MediaFile } from '@awesome-cordova-plugins/media-capture/ngx';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { File } from '@ionic-native/file/ngx';
|
||||
import { File as IonicFile } from '@ionic-native/file/ngx';
|
||||
import { Media } from '@ionic-native/media/ngx';
|
||||
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||
import { App } from '@capacitor/app';
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { VideoconvertService } from 'src/app/services/videoconvert.service'
|
||||
|
||||
import { PublicationAttachmentEntity } from 'src/app/shared/publication/upload/upload-streaming.service';
|
||||
import { PublicationFromMvService } from "src/app/shared/publication/upload/publication-from-mv.service"
|
||||
import { File } from '../../../models/chatMethod';
|
||||
|
||||
const config = {
|
||||
quality: 0.5,
|
||||
@@ -88,8 +90,6 @@ export class NewPublicationPage implements OnInit {
|
||||
validateFrom = false
|
||||
|
||||
showLoader: boolean;
|
||||
publication: Publication;
|
||||
pub: Publication = new Publication();
|
||||
folderId: string;
|
||||
image: Image = new Image();
|
||||
|
||||
@@ -117,7 +117,6 @@ export class NewPublicationPage implements OnInit {
|
||||
photoOrVideo: boolean = false;
|
||||
fileType = "";
|
||||
filecontent: boolean;
|
||||
seletedContent: any[] = []
|
||||
// Set a limit for the number of images to display
|
||||
displayLimit = 4;
|
||||
filesSizeSum = 0;
|
||||
@@ -140,22 +139,38 @@ export class NewPublicationPage implements OnInit {
|
||||
public checkFileType: checkFileTypeService,
|
||||
private FileValidatorService: FileValidatorService,
|
||||
private router: Router,
|
||||
private videoconvertService: VideoconvertService
|
||||
private videoconvertService: VideoconvertService,
|
||||
public PublicationFromMvService: PublicationFromMvService,
|
||||
) {
|
||||
|
||||
this.publicationType = this.navParams.get('publicationType');
|
||||
this.folderId = this.navParams.get('folderId');
|
||||
this.publication = this.navParams.get('publication');
|
||||
if (this.publication) {
|
||||
this.seletedContent = this.publication.Files;
|
||||
const publication = this.navParams.get('publication');
|
||||
if (publication && typeof publication?.Files == 'object') {
|
||||
this.filecontent = true;
|
||||
|
||||
const newFiles: PublicationAttachmentEntity[] = publication.Files.map(e => {
|
||||
return new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: e.FileBase64,
|
||||
extension: e.FileExtension,
|
||||
OriginalFileName: e.OriginalFileName,
|
||||
FileType: this.checkFileType.checkFileType(e.FileExtension) as any
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
for(const files of newFiles) {
|
||||
this.PublicationFromMvService.form.Files.push(files)
|
||||
}
|
||||
}
|
||||
console.log('Edit', this.publication)
|
||||
|
||||
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
this.intent = this.navParams.get('intent');
|
||||
|
||||
this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));
|
||||
|
||||
this.PublicationFromMvService.clear()
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -194,32 +209,31 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
||||
this.capturedImageTitle = 'foto';
|
||||
if (this.canAddFile(this.fileSizeToMB(capturedImage.base64String.length))) {
|
||||
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',
|
||||
FileSize: this.fileSizeToMB(capturedImage.base64String.length)
|
||||
|
||||
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;
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: this.removeTextBeforeSlash(picture, ','),
|
||||
extension: capturedImage.format,
|
||||
OriginalFileName: "image",
|
||||
FileType: 'image'
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
)
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
|
||||
|
||||
});
|
||||
} else {
|
||||
if (this.seletedContent.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
});
|
||||
|
||||
this.httpErrorHandle.validationMessagge('filessize');
|
||||
}
|
||||
}
|
||||
|
||||
async laodPicture() {
|
||||
@@ -252,26 +266,19 @@ export class NewPublicationPage implements OnInit {
|
||||
console.log('video record', data)
|
||||
data.forEach(async element => {
|
||||
this.filesSizeSum = this.filesSizeSum + element.size
|
||||
if (this.canAddFile(this.fileSizeToMB(element.size))) {
|
||||
|
||||
try {
|
||||
if (this.platform.is('ios')) {
|
||||
this.recordevideoIos(element.fullPath,element.size)
|
||||
} else {
|
||||
this.recordVideoAndroid(element.fullPath,element.size)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Unable to write file', e);
|
||||
}
|
||||
|
||||
// element.size
|
||||
try {
|
||||
if (this.platform.is('ios')) {
|
||||
this.recordevideoIos(element.fullPath, element)
|
||||
} else {
|
||||
if (this.seletedContent.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
|
||||
this.httpErrorHandle.validationMessagge('filessize')
|
||||
this.recordVideoAndroid(element.fullPath, element)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Unable to write file', e);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
} catch (error) {
|
||||
console.log('record video error: ', error)
|
||||
@@ -279,36 +286,36 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
async loadVideo() {
|
||||
const result = await FilePicker.pickMedia({ multiple: true, });
|
||||
const result = await FilePicker.pickMedia ({ multiple: true, });
|
||||
console.log(result.files)
|
||||
result.files.forEach(async element => {
|
||||
this.filesSizeSum = this.filesSizeSum + element.size
|
||||
if (this.canAddFile( this.fileSizeToMB(element.size))) {
|
||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
||||
console.log('pass size verificartion')
|
||||
if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) {
|
||||
let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl)
|
||||
try {
|
||||
this.recordevideoIos(resultUrl,element.size)
|
||||
let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl)
|
||||
try {
|
||||
this.recordevideoIos(resultUrl, element)
|
||||
} catch (error) {
|
||||
console.log('upload video error: ', error)
|
||||
}
|
||||
} else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') {
|
||||
let resultUrl = decodeURIComponent(element.path);
|
||||
console.log('pass type verification ', resultUrl)
|
||||
try {
|
||||
this.loadVideoAndroid(resultUrl, element)
|
||||
} catch (error) {
|
||||
console.log('upload video error: ', error)
|
||||
console.log('pass type verification ', resultUrl)
|
||||
try {
|
||||
this.loadVideoAndroid(resultUrl,element)
|
||||
} catch (error) {
|
||||
console.log('upload video error: ', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.seletedContent.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
} else {
|
||||
if (this.PublicationFromMvService.form.Files.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
|
||||
this.httpErrorHandle.validationMessagge('filessize')
|
||||
}
|
||||
});
|
||||
};
|
||||
this.httpErrorHandle.validationMessagge('filessize')
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
chossePhotoOrVideo() {
|
||||
@@ -368,14 +375,14 @@ export class NewPublicationPage implements OnInit {
|
||||
injectValidation() {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.pub.Title, [
|
||||
Subject: new FormControl(this.PublicationFromMvService.form.Title, [
|
||||
Validators.required,
|
||||
// Validators.minLength(4)
|
||||
]),
|
||||
capturedImage: new FormControl(this.capturedImage, [
|
||||
|
||||
]),
|
||||
Message: new FormControl(this.pub.Message, [
|
||||
Message: new FormControl(this.PublicationFromMvService.form.Message, [
|
||||
Validators.required,
|
||||
Validators.maxLength(1000)
|
||||
|
||||
@@ -391,172 +398,26 @@ export class NewPublicationPage implements OnInit {
|
||||
if (this.Form.invalid) return false
|
||||
|
||||
|
||||
if (this.seletedContent.length != 0) {
|
||||
if (this.PublicationFromMvService.form.Files.length != 0) {
|
||||
|
||||
if (this.publicationType == '3') {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
// has file
|
||||
if (this.PublicationFolderService.PublicationHasImage(this.publication)) {
|
||||
this.publication = {
|
||||
DateIndex: this.publication.DateIndex,
|
||||
DocumentId: this.publication.DocumentId,
|
||||
ProcessId: this.publication.ProcessId,
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: this.publication.DatePublication,
|
||||
OriginalFileName: this.publication.OriginalFileName,
|
||||
Files: this.seletedContent,
|
||||
}
|
||||
|
||||
/* } else if (this.capturedVideo != '' && this.capturedImage == '') {
|
||||
this.publication = {
|
||||
DateIndex: this.publication.DateIndex,
|
||||
DocumentId: this.publication.DocumentId,
|
||||
ProcessId: this.publication.ProcessId,
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: this.publication.DatePublication,
|
||||
OriginalFileName: this.publication.OriginalFileName || 'video',
|
||||
Files: this.seletedContent,
|
||||
FileExtension: 'mp4',
|
||||
}
|
||||
} */
|
||||
// no names
|
||||
} else if (!this.PublicationFolderService.PublicationHasImage(this.publication)) {
|
||||
this.publication = {
|
||||
DateIndex: this.publication.DateIndex,
|
||||
DocumentId: this.publication.DocumentId,
|
||||
ProcessId: this.publication.ProcessId,
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: this.publication.DatePublication,
|
||||
OriginalFileName: this.publication.OriginalFileName,
|
||||
Files: this.seletedContent,
|
||||
}
|
||||
|
||||
|
||||
} /* else {
|
||||
this.publication = {
|
||||
DateIndex: this.publication.DateIndex,
|
||||
DocumentId: this.publication.DocumentId,
|
||||
ProcessId: this.publication.ProcessId,
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: this.publication.DatePublication,
|
||||
OriginalFileName: this.publication.OriginalFileName,
|
||||
FileBase64: this.publication.FileBase64,
|
||||
FileExtension: this.publication.FileExtension || 'jpeg',
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
|
||||
try {
|
||||
|
||||
const response = await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
|
||||
|
||||
this.httpErrorHandle.httpsSucessMessagge('Editar publicação')
|
||||
console.log({ response })
|
||||
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
if (error.status == 404) {
|
||||
this.PublicationFolderService.deletePost(this.publication.ProcessId, this.publication.DocumentId)
|
||||
this.close();
|
||||
}
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
|
||||
|
||||
/* this.seletedContent = this.seletedContent.map((e) => {
|
||||
if(e.FileExtension == "mp4") {
|
||||
return {
|
||||
FileBase64: e.FileBase64,
|
||||
FileExtension: 'data:video/mp4;base64,'+e.FileExtension,
|
||||
OriginalFileName: "video",
|
||||
}
|
||||
}
|
||||
|
||||
return e
|
||||
}) */
|
||||
|
||||
/* if (this.capturedImage != '') { */
|
||||
this.publication = {
|
||||
DateIndex: date,
|
||||
DocumentId: null,
|
||||
ProcessId: JSON.stringify(this.folderId),
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: date,
|
||||
OriginalFileName: this.capturedImageTitle || 'foto',
|
||||
Files: this.seletedContent,
|
||||
/* FileExtension: 'jpeg', */
|
||||
}
|
||||
|
||||
/* } else if (this.capturedVideo != '') {
|
||||
this.publication = {
|
||||
DateIndex: date,
|
||||
DocumentId: null,
|
||||
ProcessId: this.folderId,
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: date,
|
||||
OriginalFileName: this.capturedImageTitle || 'video',
|
||||
Files: this.seletedContent,
|
||||
FileExtension: 'mp4',
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
|
||||
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
|
||||
if (window["sharedContent"]) {
|
||||
|
||||
window["sharedContent"] = null
|
||||
window["openFolder"] = true
|
||||
|
||||
if (window.innerWidth <= 700) {
|
||||
this.router.navigate(['/home/publications', this.folderId]);
|
||||
} else if (window.innerWidth >= 701) {
|
||||
let navigationExtras: NavigationExtras = { queryParams: { "folderId": this.folderId, } };
|
||||
this.router.navigate(['/home/publications']);
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.PublicationFolderService.getPublicationsIds(this.folderId)
|
||||
this.close();
|
||||
this.PublicationFromMvService.setFolderId(this.folderId)
|
||||
await this.PublicationFromMvService.save()
|
||||
|
||||
} else {
|
||||
this.httpErrorHandle.validationMessagge("noFileSelected")
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
// if(!this.PublicationFromMvService.form.send) {
|
||||
// this.PublicationFromMvService.cancel()
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
close() {
|
||||
this.modalController.dismiss(this.publication).then(() => {
|
||||
this.modalController.dismiss(this.PublicationFromMvService.form).then(() => {
|
||||
this.showLoader = true;
|
||||
});
|
||||
|
||||
@@ -567,7 +428,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
clear() {
|
||||
this.capturedImageTitle = null;
|
||||
this.seletedContent = [];
|
||||
this.PublicationFromMvService.form.Files = [];
|
||||
}
|
||||
|
||||
setTitle() {
|
||||
@@ -579,8 +440,6 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
else if (this.publicationType == '3') {
|
||||
this.publicationTitle = 'Editar Publicação';
|
||||
this.pub = this.navParams.get('publication');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -604,7 +463,7 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
|
||||
deletePublicationImage() {
|
||||
this.seletedContent = []
|
||||
this.PublicationFromMvService.form.Files = []
|
||||
}
|
||||
|
||||
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
|
||||
@@ -763,22 +622,22 @@ export class NewPublicationPage implements OnInit {
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
|
||||
} else if (this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
console.log('shared base', content.data)
|
||||
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
} catch (error) {
|
||||
console.log('error shared filesystem', error)
|
||||
}
|
||||
|
||||
|
||||
}) */
|
||||
} else {
|
||||
this.httpErrorHandle.validationMessagge('filetype');
|
||||
@@ -795,7 +654,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
|
||||
deleteFromSeletedContent(index) {
|
||||
this.seletedContent.splice(index, 1)
|
||||
this.PublicationFromMvService.form.Files.splice(index, 1)
|
||||
}
|
||||
|
||||
closeApp() {
|
||||
@@ -807,8 +666,8 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async recordevideoIos(fullPath,size) {
|
||||
console.log('fullpath', fullPath)
|
||||
async recordevideoIos(fullPath, element) {
|
||||
|
||||
try {
|
||||
const directory = await Filesystem.getUri({
|
||||
directory: Directory.Cache,
|
||||
@@ -816,38 +675,38 @@ export class NewPublicationPage implements OnInit {
|
||||
});
|
||||
|
||||
const stringGerada = this.gerarStringAleatoria();
|
||||
console.log(stringGerada);
|
||||
let fileObject = {};
|
||||
this.videoconvertService.convertVideo(fullPath, directory.uri, stringGerada, 'mp4').then(async () => {
|
||||
await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4` })
|
||||
|
||||
.then(async (content) => {
|
||||
this.filecontent = true;
|
||||
fileObject = {}
|
||||
console.log('First clean', fileObject)
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||
FileExtension: 'mp4',
|
||||
OriginalFileName: stringGerada,
|
||||
FileSize: this.fileSizeToMB(size)
|
||||
this.videoconvertService.convertVideo(fullPath,directory.uri,stringGerada,'mp4').then(async () => {
|
||||
await Filesystem.readFile({ path: `${directory.uri}${stringGerada}.mp4`})
|
||||
|
||||
.then(async (content) => {
|
||||
this.filecontent = true;
|
||||
|
||||
const file = new File([element.blob], element.name);
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: 'data:video/mp4;base64,' + content.data,
|
||||
extension: 'mp4',
|
||||
blobFile: file,
|
||||
FileType: this.checkFileType.checkFileType('mp4') as any,
|
||||
OriginalFileName: 'load video'
|
||||
}
|
||||
console.log('what do we have', fileObject)
|
||||
this.seletedContent.push(fileObject)
|
||||
console.log('file object 1', fileObject)
|
||||
fileObject = {};
|
||||
const deleteSecretFile = async () => {
|
||||
await Filesystem.deleteFile({
|
||||
path: `${stringGerada}.mp4`,
|
||||
directory: Directory.Cache,
|
||||
});
|
||||
};
|
||||
await deleteSecretFile().then((value) => {
|
||||
console.log('delete file', value)
|
||||
fileObject = {};
|
||||
console.log('file object 2', fileObject)
|
||||
})
|
||||
)
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
|
||||
const deleteSecretFile = async () => {
|
||||
await Filesystem.deleteFile({
|
||||
path: `${stringGerada}.mp4`,
|
||||
directory: Directory.Cache,
|
||||
});
|
||||
};
|
||||
await deleteSecretFile().then((value) => {
|
||||
console.log('delete file',value)
|
||||
})
|
||||
.catch((erro) => console.error('read converted video erro ', erro));
|
||||
})
|
||||
.catch((erro) => console.error('read converted video erro ', erro));
|
||||
});
|
||||
|
||||
|
||||
@@ -856,7 +715,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async recordVideoAndroid(fullPath,size) {
|
||||
async recordVideoAndroid(fullPath, element) {
|
||||
|
||||
try {
|
||||
const savedFile = await Filesystem.copy({
|
||||
@@ -867,17 +726,26 @@ export class NewPublicationPage implements OnInit {
|
||||
console.log(savedFile.uri)
|
||||
Filesystem.readFile({ path: savedFile.uri })
|
||||
|
||||
.then(async (content) => {
|
||||
this.filecontent = true;
|
||||
let fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||
FileExtension: 'mp4',
|
||||
OriginalFileName: 'video',
|
||||
FileSize: this.fileSizeToMB(size)
|
||||
.then(async (content) => {
|
||||
|
||||
this.filecontent = true;
|
||||
|
||||
const file = new File([element.blob], element.name);
|
||||
window['a'] = element
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: 'data:video/mp4;base64,' + content.data,
|
||||
extension: 'mp4',
|
||||
blobFile: file,
|
||||
FileType: this.checkFileType.checkFileType( 'mp4') as any,
|
||||
OriginalFileName: 'load video'
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
.catch((error) => console.error('reade converted video erro ', error));
|
||||
)
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
|
||||
|
||||
})
|
||||
.catch((error) => console.error('reade converted video erro ',error));
|
||||
|
||||
} catch (error) {
|
||||
console.log('record video android erro ', error)
|
||||
@@ -891,29 +759,41 @@ export class NewPublicationPage implements OnInit {
|
||||
loadVideoAndroid(resultUrl, element) {
|
||||
Filesystem.readFile({ path: resultUrl })
|
||||
|
||||
.then(async (content) => {
|
||||
console.log(content)
|
||||
this.filecontent = true;
|
||||
let fileObject;
|
||||
if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'video',
|
||||
FileSize:element.size
|
||||
}
|
||||
} else {
|
||||
fileObject = {
|
||||
FileBase64: 'data:image/jpeg;base64,' + content.data,
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'image',
|
||||
FileSize: this.fileSizeToMB(element.size)
|
||||
}
|
||||
}
|
||||
.then(async (content) => {
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
this.filecontent = true;
|
||||
|
||||
if (this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: content.data,
|
||||
extension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any,
|
||||
OriginalFileName: 'load video'
|
||||
}
|
||||
)
|
||||
|
||||
newAttachment.needUpload()
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
|
||||
} else {
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: 'data:image/jpeg;base64,' + content.data,
|
||||
extension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any,
|
||||
OriginalFileName: 'image'
|
||||
}
|
||||
)
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
|
||||
}
|
||||
|
||||
@@ -944,7 +824,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
console.log('shared base', content.data)
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||
} catch (error) {
|
||||
console.log('error shared filesystem', error)
|
||||
}
|
||||
@@ -968,35 +848,42 @@ export class NewPublicationPage implements OnInit {
|
||||
FileExtension: 'mp4',
|
||||
OriginalFileName: 'shared',
|
||||
} */
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: 'mp4',
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
fileObject = {};
|
||||
const deleteSecretFile = async () => {
|
||||
await Filesystem.deleteFile({
|
||||
path: `${filename}.mp4`,
|
||||
directory: Directory.Cache,
|
||||
});
|
||||
};
|
||||
deleteSecretFile().then((value) => {
|
||||
console.log('delete file', value)
|
||||
fileObject = {};
|
||||
})
|
||||
|
||||
const newAttachment = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
|
||||
extension: 'mp4',
|
||||
FileType: this.checkFileType.checkFileType('mp4') as any,
|
||||
OriginalFileName: 'shared'
|
||||
}
|
||||
)
|
||||
newAttachment.needUpload()
|
||||
|
||||
this.PublicationFromMvService.form.Files.push(newAttachment)
|
||||
fileObject ={};
|
||||
const deleteSecretFile = async () => {
|
||||
await Filesystem.deleteFile({
|
||||
path: `${filename}.mp4`,
|
||||
directory: Directory.Cache,
|
||||
});
|
||||
};
|
||||
deleteSecretFile().then((value) => {
|
||||
console.log('delete file',value)
|
||||
fileObject ={};
|
||||
})
|
||||
.catch((erro) => console.error('read converted video erro ', erro));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log('record video ios erro, ', error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
shareContentAndroid(resultUrl, FileExtension) {
|
||||
|
||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||
@@ -1019,7 +906,7 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
console.log('shared base', content.data)
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
this.PublicationFromMvService.form.Files.push(fileObject)
|
||||
} catch (error) {
|
||||
console.log('error shared filesystem', error)
|
||||
}
|
||||
@@ -1028,28 +915,5 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
canAddFile(fileToAddsize) {
|
||||
console.log('File size to add', fileToAddsize)
|
||||
console.log(this.seletedContent)
|
||||
// Calculate the total size of files in the list
|
||||
var totalSize = this.seletedContent.reduce((total, {FileSize}) => total + FileSize, 0);
|
||||
console.log('Totoal size',totalSize)
|
||||
console.log('fileAddsize',fileToAddsize)
|
||||
// Check if adding the file would exceed the individual file size limit (20 MB)
|
||||
if (fileToAddsize >= 20) {
|
||||
console.log("File size exceeds individual file size limit (20 MB)");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if adding the file would exceed the total size limit (20 MB)
|
||||
|
||||
if (totalSize + fileToAddsize >= 20) {
|
||||
console.log("Total file size exceeds total size limit (20 MB)");
|
||||
return false;
|
||||
}
|
||||
// If neither condition is met, it's safe to add the file
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import { StopvideoService } from "src/app/services/stopvideo.service"
|
||||
import { Result } from 'neverthrow';
|
||||
import { App } from '@capacitor/app';
|
||||
import { ActiveTabService } from 'src/app/services/active-tab.service';
|
||||
import { PublicationHolderService } from 'src/app/services/publication/publication-holder.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-publications',
|
||||
templateUrl: './view-publications.page.html',
|
||||
@@ -71,7 +73,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
private publicationVideoManagerService: PublicationVideoManagerService,
|
||||
public stopvideoService: StopvideoService,
|
||||
private platform: Platform,
|
||||
public activeTabService: ActiveTabService) {
|
||||
public activeTabService: ActiveTabService,
|
||||
public PublicationHolderService: PublicationHolderService) {
|
||||
|
||||
|
||||
/* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */
|
||||
@@ -311,20 +314,26 @@ export class ViewPublicationsPage implements OnInit {
|
||||
}
|
||||
|
||||
async AddPublication(publicationType: any, folderId: any) {
|
||||
const modal = await this.modalController.create({
|
||||
component: NewPublicationPage,
|
||||
componentProps: {
|
||||
publicationType: publicationType,
|
||||
folderId: this.folderId,
|
||||
},
|
||||
cssClass: 'new-publication modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.doRefresh(event);
|
||||
});
|
||||
await modal.present();
|
||||
if(this.PublicationHolderService.PublicationFormMV.length == 0) {
|
||||
const modal = await this.modalController.create({
|
||||
component: NewPublicationPage,
|
||||
componentProps: {
|
||||
publicationType: publicationType,
|
||||
folderId: this.folderId,
|
||||
},
|
||||
cssClass: 'new-publication modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
modal.onDidDismiss().then(() => {
|
||||
this.doRefresh(event);
|
||||
});
|
||||
await modal.present();
|
||||
} else {
|
||||
this.toastService._successMessage('já existe uma publicação a ser processado');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goToPublicationDetail(DocumentId: string, ProcessId: string) {
|
||||
|
||||
Reference in New Issue
Block a user