update badge das notificações

This commit is contained in:
Eudes Inácio
2023-08-20 18:09:10 +01:00
31 changed files with 464 additions and 237 deletions
@@ -396,6 +396,7 @@ export class NewEventPage implements OnInit {
try {
const CalendarId = this.selectedCalendarId()
this.postEvent.CalendarId = CalendarId
if(this.loggeduser.Profile == 'MDGPR') {
@@ -406,12 +407,16 @@ export class NewEventPage implements OnInit {
else if(this.loggeduser.Profile == 'PR') {
const CalendarId = this.selectedCalendarId()
this.postEvent.CalendarId = CalendarId
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
this.hhtpErrorHandle.httpsSucessMessagge('new event')
} else {
const CalendarId = this.selectedCalendarId()
this.postEvent.CalendarId = CalendarId
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
this.hhtpErrorHandle.httpsSucessMessagge('new event')
@@ -47,19 +47,19 @@
</ion-list>
</div>
<ion-virtual-scroll [items]="users" approxItemHeight="70px" [headerFn]="separateLetter">
<div *ngFor="let userContainer of userContainer | keyvalue;" >
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
<div class="item-divider">
<ion-label>{{ userContainer.key }}</ion-label>
</div>
<div *virtualItem="let user" class="item-checkbox">
<ion-checkbox (ionChange)="selectedContact(user)" color="primary"></ion-checkbox>
<p>{{user.name}}</p>
<ion-icon class="{{user.status}}" name="ellipse"></ion-icon>
<div *ngFor="let user of userContainer.value" class="d-flex px-20 align-center">
<ion-checkbox [(ngModel)]="user.isChecked" color="primary" (click)="selectedContact(user)"></ion-checkbox>
<ion-label class="flex-grow-1 px-10">{{user.name}}</ion-label>
<div class="icon"><ion-icon class="{{user.status}}" name="ellipse"></ion-icon></div>
</div>
</ion-virtual-scroll>
</div>
</div>
</ion-content>
@@ -32,6 +32,10 @@ export class GroupContactsPage implements OnInit {
groupName:string;
selectedUserList:any;
sessionStore = SessionStore
objectUserSingleStone = []
userContainer = {}
constructor(
private modalController: ModalController,
@@ -81,6 +85,30 @@ export class GroupContactsPage implements OnInit {
}
return 0;
});
for( const user of this.users) {
const foundUser = this.objectUserSingleStone.find( e => e.name == user.name)
if(!foundUser) {
this.objectUserSingleStone.push(user)
}
}
for(const user of this.objectUserSingleStone) {
const firstLetter = user.name.charAt(0)
if(!this.userContainer[firstLetter]) {
this.userContainer[firstLetter] = [user]
} else {
this.userContainer[firstLetter].push(user)
}
}
this.showLoader = false;
@@ -178,6 +206,26 @@ export class GroupContactsPage implements OnInit {
})
this.users = users
let a = this.objectUserSingleStone.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase()))
let b = {}
for(const user of a) {
const firstLetter = user.name.charAt(0)
if(!b[firstLetter]) {
b[firstLetter] = [user]
} else {
b[firstLetter].push(user)
}
}
this.userContainer = b
}
@@ -185,9 +233,16 @@ export class GroupContactsPage implements OnInit {
}
selectedContact(user:any){
/* this.groupName = this.room.name; */
user.isChecked = !user.isChecked;
selectedContact(user:any) {
/* this.groupName = this.room.name; */
if(user.isChecked != true ) {
user.isChecked = false
} else {
user.isChecked = true
}
const userIndex = this.objectUserSingleStone.findIndex((e) => e._id == user._id)
this.objectUserSingleStone[userIndex].isChecked = user.isChecked
}
@@ -32,7 +32,7 @@
</ion-refresher>
<div class="main-content">
<ion-progress-bar class="position-absolute" type="indeterminate" *ngIf="loading"></ion-progress-bar>
<ion-virtual-scroll [items]="userList" approxItemHeight="70px" [headerFn]="separateLetter">
<ion-virtual-scroll [items]="ChatSystemService.users | filter:textSearch: 'name' " approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
+2 -1
View File
@@ -1003,6 +1003,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
console.log(blob)
let pathFile = ''
const fileName = filename
const contentFile = blob
@@ -1012,7 +1013,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
pathFile = this.file.externalRootDirectory
}
console.log(pathFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
@@ -7,7 +7,7 @@
<div class="content d-flex flex-column" *ngIf="task">
<div class="main-header" style="overflow: unset !important;">
<div class="title-content width-100 d-flex justify-between">
<div class="font-30-rem cursor-pointer d-flex align-center" (click)="goBack()" defaultHref="#">
<div class="font-30-rem cursor-pointer d-flex align-base" (click)="goBack()" defaultHref="#">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-arrow-left.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
@@ -19,6 +19,8 @@ import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera
import { Filesystem, Directory } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress";
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
const IMAGE_DIR = 'stored-images';
@@ -87,14 +89,15 @@ export class NewPublicationPage implements OnInit {
private platform: Platform,
private loadingCtrl: LoadingController,
public imageCompress: NgxImageCompressService,
private httpErrorHandle: HttpErrorHandle
private httpErrorHandle: HttpErrorHandle,
public PublicationFolderService: PublicationFolderService
) {
this.publicationType = this.navParams.get('publicationType');
this.folderId = this.navParams.get('folderId');
this.publication = this.navParams.get('publication');
this.publicationTitle = 'Nova Publicação';
this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));
}
@@ -151,27 +154,6 @@ export class NewPublicationPage implements OnInit {
});
/* async laodPicture() {
const capturedImage = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Photos,
quality: 90,
width: 1080,
height: 720,
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
this.photos.unshift({
filepath: "soon...",
webviewPath: capturedImage.webPath
});
this.capturedImage = await this.convertBlobToBase64(blob);
this.capturedImageTitle = new Date().getTime() + '.jpeg';
} */
async laodPicture() {
const capturedImage = await Camera.getPhoto({
@@ -295,8 +277,6 @@ export class NewPublicationPage implements OnInit {
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
const loader = this.toastService.loading()
@@ -312,6 +292,8 @@ export class NewPublicationPage implements OnInit {
}
}
this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId)
}
else {
@@ -76,33 +76,54 @@ export class PublicationDetailPage implements OnInit {
}
getPublicationDetail() {
this.showLoader = true;
this.publications.GetPublicationById(this.publicationId).subscribe(res => {
/* this.publication = res; */
const folderId = this.folderId
const localPublication = this.publicationFolderService.getLocalPublication(folderId, this.publicationId);
if(localPublication?.DocumentId) {
this.publication = {
DateIndex: res.DateIndex,
DocumentId: res.DocumentId,
ProcessId:res.ProcessId,
Title:res.Title,
Message: res.Message,
DatePublication: res.DatePublication,
FileBase64: "data:image/jpg;base64," + res.FileBase64,
OriginalFileName: res.OriginalFileName,
DateIndex: localPublication.DateIndex,
DocumentId: localPublication.DocumentId,
ProcessId:localPublication.ProcessId,
Title:localPublication.Title,
Message: localPublication.Message,
DatePublication: localPublication.DatePublication,
FileBase64: localPublication.FileBase64,
OriginalFileName: localPublication.OriginalFileName,
FileExtension: 'jpeg',
}
console.log('PUBLICATIO ImG',this.publication.FileBase64)
this.showLoader = false;
}, (error) => {
} else {
if(error.status == 404) {
this.publicationFolderService.deletePost(this.folderId, this.publicationId)
}
this.showLoader = true;
this.publications.GetPublicationById(this.publicationId).subscribe(res => {
/* this.publication = res; */
this.publication = {
DateIndex: res.DateIndex,
DocumentId: res.DocumentId,
ProcessId:res.ProcessId,
Title:res.Title,
Message: res.Message,
DatePublication: res.DatePublication,
FileBase64: "data:image/jpg;base64," + res.FileBase64,
OriginalFileName: res.OriginalFileName,
FileExtension: 'jpeg',
}
this.showLoader = false;
}, (error) => {
this.showLoader = false;
if(error.status == 404) {
this.publicationFolderService.deletePost(this.folderId, this.publicationId)
}
this.goBack();
this.httpErrorHandle.httpStatusHandle(error)
});
}
this.goBack();
this.httpErrorHandle.httpStatusHandle(error)
});
}
close() {
@@ -110,7 +131,7 @@ export class PublicationDetailPage implements OnInit {
}
goBack() {
if(!window.location.href.includes('/home/publications/view-publications')) {
if(this.isModal) {
this.close()
} else {
this.RouteService.goBack();
@@ -179,9 +200,4 @@ export class PublicationDetailPage implements OnInit {
modal.present();
}
}
@@ -7,9 +7,8 @@
<ion-icon class="font-35-em" *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-arrow-left.svg"></ion-icon>
<ion-icon class="font-35-em" *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</div>
<div *ngIf="publicationFolderService.FolderDetails[folderId]?.DateBegin != null" class="div-title flex-grow-1">
<div *ngIf="publicationFolderService.FolderDetails[folderId]?.DateBegin != null" class="div-title flex-grow-1">
<p class="title font-25-em mb-10-em">{{publicationFolderService.FolderDetails[folderId].Description}}</p>
<p class="item-content-detail font-14-em">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<p class="item-content-date font-13-em" >{{publicationFolderService.FolderDetails[folderId].DateBegin | date: 'dd-MM-yyyy HH:mm'}}</p>
</div>
<div *ngIf="p.userPermission([p.permissionList.Actions.createPost]) && publicationFolderService.FolderDetails[folderId]" class="cursor-pointer font-35-em" (click)="AddPublication('2',publicationFolderService.FolderDetails[folderId].ProcessId)">
@@ -30,6 +29,9 @@
</ion-refresher>
<div class="main-container background-white height-100 overflow-y-auto viewport-font-size">
<ion-content *ngIf="publicationFolderService.FolderDetails[folderId]">
<p class="px-20 item-content-detail font-14-em">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index"
(click)="goToPublicationDetail(publication.DocumentId)"
>
@@ -51,65 +53,6 @@
</ion-card-content>
</ion-card>
</ion-content>
<!-- <ion-list>
<div class="post-item cursor-pointer"
*ngFor="let publication of getpublication"
(click)="goToPublicationDetail(publication.DocumentId)"
>
<div class="post-img">
<img [defaultImage]=defaultImage [lazyLoad]="publication.FileBase64">
<ng-template #imageLoaded>
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img [defaultImage]=defaultImage [lazyLoad]="publication.FileBase64">
</div>
</ng-template>
</div>
<div class="post-content px-20">
<div class="post-title-time">
<div class="post-title">
<ion-label>{{publication.Title}}</ion-label>
</div>
<div class="post-data">{{publication.DatePublication | date: 'dd-MM-yyyy HH:mm'}}</div>
</div>
<div class="post-description">
<p>{{publication.Message}}</p>
</div>
</div>
</div>
<div *ngIf="showLoader" class="post-item">
<div class="post-img">
<img src="/assets/icon/icon-no-image.svg" alt="image">
</div>
<div class="post-content px-20">
<div class="post-title-time">
<div class="post-title">
<ion-label><ion-skeleton-text animated animated style="width: 60%;"></ion-skeleton-text></ion-label>
</div>
<div class="post-data"><ion-skeleton-text animated style="width: 25%; float: right;"></ion-skeleton-text></div>
</div>
<div class="post-description">
<p><ion-skeleton-text animated></ion-skeleton-text></p>
<p><ion-skeleton-text animated></ion-skeleton-text></p>
</div>
</div>
<div class="post-img">
<img src="/assets/icon/icon-no-image.svg" alt="image">
</div>
<div class="post-content px-20">
<div class="post-title-time">
<div class="post-title">
<ion-label><ion-skeleton-text animated animated style="width: 60%;"></ion-skeleton-text></ion-label>
</div>
<div class="post-data"><ion-skeleton-text animated style="width: 25%; float: right;"></ion-skeleton-text></div>
</div>
<div class="post-description">
<p><ion-skeleton-text animated></ion-skeleton-text></p>
<p><ion-skeleton-text animated></ion-skeleton-text></p>
</div>
</div>
</div>
</ion-list> -->
</div>
</ion-content>
@@ -100,6 +100,7 @@ export class ViewPublicationsPage implements OnInit {
createPublicationList(folderId = this.folderId) {
console.log('create')
if(!this.publicationFolderService.publicationList[folderId]) {
this.publicationFolderService.publicationList[folderId] = []
}
@@ -132,7 +133,6 @@ export class ViewPublicationsPage implements OnInit {
getPublicationDetail() {
const folderId = this.folderId
this.publications.GetPresidentialAction(folderId).subscribe(res =>{
this.publicationFolderService.FolderDetails[folderId] = res
this.storage.set(folderId+"name", res)
}, (error) => {