mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix
This commit is contained in:
@@ -19,6 +19,8 @@ import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera
|
|||||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||||
import { NgxImageCompressService } from "ngx-image-compress";
|
import { NgxImageCompressService } from "ngx-image-compress";
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
|
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
|
||||||
|
|
||||||
|
|
||||||
const IMAGE_DIR = 'stored-images';
|
const IMAGE_DIR = 'stored-images';
|
||||||
|
|
||||||
@@ -87,14 +89,15 @@ export class NewPublicationPage implements OnInit {
|
|||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
private loadingCtrl: LoadingController,
|
private loadingCtrl: LoadingController,
|
||||||
public imageCompress: NgxImageCompressService,
|
public imageCompress: NgxImageCompressService,
|
||||||
private httpErrorHandle: HttpErrorHandle
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
|
public PublicationFolderService: PublicationFolderService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
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');
|
||||||
this.publicationTitle = 'Nova Publicação';
|
this.publicationTitle = 'Nova Publicação';
|
||||||
|
|
||||||
|
|
||||||
this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url));
|
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() {
|
async laodPicture() {
|
||||||
|
|
||||||
const capturedImage = await Camera.getPhoto({
|
const capturedImage = await Camera.getPhoto({
|
||||||
@@ -296,8 +278,6 @@ export class NewPublicationPage implements OnInit {
|
|||||||
FileExtension: 'jpeg',
|
FileExtension: 'jpeg',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -312,6 +292,8 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|||||||
+42
-26
@@ -76,33 +76,54 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPublicationDetail() {
|
getPublicationDetail() {
|
||||||
this.showLoader = true;
|
const folderId = this.folderId
|
||||||
|
const localPublication = this.publicationFolderService.getLocalPublication(folderId, this.publicationId);
|
||||||
|
|
||||||
this.publications.GetPublicationById(this.publicationId).subscribe(res => {
|
if(localPublication?.DocumentId) {
|
||||||
|
|
||||||
/* this.publication = res; */
|
|
||||||
this.publication = {
|
this.publication = {
|
||||||
DateIndex: res.DateIndex,
|
DateIndex: localPublication.DateIndex,
|
||||||
DocumentId: res.DocumentId,
|
DocumentId: localPublication.DocumentId,
|
||||||
ProcessId:res.ProcessId,
|
ProcessId:localPublication.ProcessId,
|
||||||
Title:res.Title,
|
Title:localPublication.Title,
|
||||||
Message: res.Message,
|
Message: localPublication.Message,
|
||||||
DatePublication: res.DatePublication,
|
DatePublication: localPublication.DatePublication,
|
||||||
FileBase64: "data:image/jpg;base64," + res.FileBase64,
|
FileBase64: localPublication.FileBase64,
|
||||||
OriginalFileName: res.OriginalFileName,
|
OriginalFileName: localPublication.OriginalFileName,
|
||||||
FileExtension: 'jpeg',
|
FileExtension: 'jpeg',
|
||||||
}
|
}
|
||||||
console.log('PUBLICATIO ImG',this.publication.FileBase64)
|
} else {
|
||||||
this.showLoader = false;
|
|
||||||
}, (error) => {
|
|
||||||
|
|
||||||
if(error.status == 404) {
|
this.showLoader = true;
|
||||||
this.publicationFolderService.deletePost(this.folderId, this.publicationId)
|
|
||||||
}
|
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() {
|
close() {
|
||||||
@@ -110,7 +131,7 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
if(!window.location.href.includes('/home/publications/view-publications')) {
|
if(this.isModal) {
|
||||||
this.close()
|
this.close()
|
||||||
} else {
|
} else {
|
||||||
this.RouteService.goBack();
|
this.RouteService.goBack();
|
||||||
@@ -179,9 +200,4 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
modal.present();
|
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 == '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>
|
<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>
|
||||||
<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="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>
|
<p class="item-content-date font-13-em" >{{publicationFolderService.FolderDetails[folderId].DateBegin | date: 'dd-MM-yyyy HH:mm'}}</p>
|
||||||
</div>
|
</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)">
|
<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>
|
</ion-refresher>
|
||||||
<div class="main-container background-white height-100 overflow-y-auto viewport-font-size">
|
<div class="main-container background-white height-100 overflow-y-auto viewport-font-size">
|
||||||
<ion-content *ngIf="publicationFolderService.FolderDetails[folderId]">
|
<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"
|
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index"
|
||||||
(click)="goToPublicationDetail(publication.DocumentId)"
|
(click)="goToPublicationDetail(publication.DocumentId)"
|
||||||
>
|
>
|
||||||
@@ -51,65 +53,6 @@
|
|||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</ion-content>
|
</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>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
createPublicationList(folderId = this.folderId) {
|
createPublicationList(folderId = this.folderId) {
|
||||||
|
console.log('create')
|
||||||
if(!this.publicationFolderService.publicationList[folderId]) {
|
if(!this.publicationFolderService.publicationList[folderId]) {
|
||||||
this.publicationFolderService.publicationList[folderId] = []
|
this.publicationFolderService.publicationList[folderId] = []
|
||||||
}
|
}
|
||||||
@@ -132,7 +133,6 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
getPublicationDetail() {
|
getPublicationDetail() {
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
this.publications.GetPresidentialAction(folderId).subscribe(res =>{
|
this.publications.GetPresidentialAction(folderId).subscribe(res =>{
|
||||||
|
|
||||||
this.publicationFolderService.FolderDetails[folderId] = res
|
this.publicationFolderService.FolderDetails[folderId] = res
|
||||||
this.storage.set(folderId+"name", res)
|
this.storage.set(folderId+"name", res)
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { SortService } from './functions/sort.service';
|
|||||||
import { customTask } from '../models/dailyworktask.model';
|
import { customTask } from '../models/dailyworktask.model';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import { ChangeProfileService } from './change-profile.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -64,8 +65,14 @@ export class TaskService {
|
|||||||
private despachoRule: DespachoService,
|
private despachoRule: DespachoService,
|
||||||
public eventService: EventsService,
|
public eventService: EventsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
private changeProfileService: ChangeProfileService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
this.changeProfileService.registerCallback(() => {
|
||||||
|
this.updateCount()
|
||||||
|
this.runCallback();
|
||||||
|
})
|
||||||
|
|
||||||
window['all-process-gabinete'] = () => {
|
window['all-process-gabinete'] = () => {
|
||||||
this.updateAllProcess();
|
this.updateAllProcess();
|
||||||
this.updateCount();
|
this.updateCount();
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
|
|||||||
import { ThemeService } from 'src/app/services/theme.service';
|
import { ThemeService } from 'src/app/services/theme.service';
|
||||||
import { Camera, CameraResultType, CameraSource} from '@capacitor/camera';
|
import { Camera, CameraResultType, CameraSource} from '@capacitor/camera';
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
|
import { PublicationFolderService } from 'src/app/store/publication-folder.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-new-publication',
|
selector: 'app-new-publication',
|
||||||
templateUrl: './new-publication.page.html',
|
templateUrl: './new-publication.page.html',
|
||||||
@@ -50,7 +52,8 @@ export class NewPublicationPage implements OnInit {
|
|||||||
private publications: PublicationsService,
|
private publications: PublicationsService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private httpErroHandle: HttpErrorHandle
|
private httpErroHandle: HttpErrorHandle,
|
||||||
|
public PublicationFolderService: PublicationFolderService
|
||||||
) {
|
) {
|
||||||
this.publicationTitle = 'Nova Publicação';
|
this.publicationTitle = 'Nova Publicação';
|
||||||
}
|
}
|
||||||
@@ -65,22 +68,43 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPublicationDetail() {
|
getPublicationDetail() {
|
||||||
this.showLoader = true;
|
|
||||||
this.publications.GetPublicationById(this.publicationId).subscribe( res => {
|
|
||||||
|
const folderId = this.folderId
|
||||||
|
const localPublication = this.PublicationFolderService.getLocalPublication(folderId, this.publicationId);
|
||||||
|
|
||||||
|
if(localPublication?.DocumentId) {
|
||||||
|
|
||||||
this.publication = {
|
this.publication = {
|
||||||
DateIndex: res.DateIndex,
|
DateIndex: localPublication.DateIndex,
|
||||||
DocumentId: res.DocumentId,
|
DocumentId: localPublication.DocumentId,
|
||||||
ProcessId:res.ProcessId,
|
ProcessId:localPublication.ProcessId,
|
||||||
Title:res.Title,
|
Title:localPublication.Title,
|
||||||
Message: res.Message,
|
Message: localPublication.Message,
|
||||||
DatePublication: res.DatePublication,
|
DatePublication: localPublication.DatePublication,
|
||||||
FileBase64: "data:image/jpg;base64," + res.FileBase64,
|
FileBase64: localPublication.FileBase64,
|
||||||
OriginalFileName: res.OriginalFileName,
|
OriginalFileName: localPublication.OriginalFileName,
|
||||||
FileExtension: 'jpeg',
|
FileExtension: 'jpeg',
|
||||||
}
|
}
|
||||||
this.pub = this.publication;
|
} else {
|
||||||
this.showLoader = false;
|
this.showLoader = true;
|
||||||
});
|
this.publications.GetPublicationById(this.publicationId).subscribe( 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.pub = this.publication;
|
||||||
|
this.showLoader = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -228,6 +252,9 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|||||||
+1
@@ -19,6 +19,7 @@
|
|||||||
<p class="post-data"><ion-skeleton-text animated style="width: 20%;"></ion-skeleton-text></p>
|
<p class="post-data"><ion-skeleton-text animated style="width: 20%;"></ion-skeleton-text></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
|
|||||||
+40
-19
@@ -18,7 +18,6 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
showLoader: boolean;
|
showLoader: boolean;
|
||||||
/* folderId: string; */
|
/* folderId: string; */
|
||||||
publication: Publication;
|
publication: Publication;
|
||||||
|
|
||||||
@Input() publicationId: string;
|
@Input() publicationId: string;
|
||||||
@Input() folderId: string;
|
@Input() folderId: string;
|
||||||
@Output() addNewPublication = new EventEmitter<any>();
|
@Output() addNewPublication = new EventEmitter<any>();
|
||||||
@@ -64,30 +63,52 @@ export class PublicationDetailPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPublicationDetail() {
|
getPublicationDetail() {
|
||||||
this.showLoader = true;
|
|
||||||
this.publications.GetPublicationById(this.publicationId).subscribe(res => {
|
const folderId = this.folderId
|
||||||
|
const localPublication = this.publicationFolderService.getLocalPublication(folderId, this.publicationId);
|
||||||
|
|
||||||
|
if(localPublication?.DocumentId) {
|
||||||
|
|
||||||
this.publication = {
|
this.publication = {
|
||||||
DateIndex: res.DateIndex,
|
DateIndex: localPublication.DateIndex,
|
||||||
DocumentId: res.DocumentId,
|
DocumentId: localPublication.DocumentId,
|
||||||
ProcessId:res.ProcessId,
|
ProcessId:localPublication.ProcessId,
|
||||||
Title:res.Title,
|
Title:localPublication.Title,
|
||||||
Message: res.Message,
|
Message: localPublication.Message,
|
||||||
DatePublication: res.DatePublication,
|
DatePublication: localPublication.DatePublication,
|
||||||
FileBase64: "data:image/jpg;base64," + res.FileBase64,
|
FileBase64: localPublication.FileBase64,
|
||||||
OriginalFileName: res.OriginalFileName,
|
OriginalFileName: localPublication.OriginalFileName,
|
||||||
FileExtension: 'jpeg',
|
FileExtension: 'jpeg',
|
||||||
}
|
}
|
||||||
this.showLoader = false;
|
} else {
|
||||||
}, (error) => {
|
|
||||||
|
|
||||||
if(error.status == 404) {
|
this.showLoader = true;
|
||||||
this.publicationFolderService.deletePost(this.folderId, this.publicationId)
|
this.publications.GetPublicationById(this.publicationId).subscribe(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() {
|
close() {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<ion-header class="ion-no-border">
|
<ion-header class="ion-no-border">
|
||||||
<div class="main-header">
|
<div class="main-header">
|
||||||
<div class="title-content">
|
<div class="title-content">
|
||||||
<div *ngIf="publicationFolderService.FolderDetails[folderId]" class="div-title width-100 flex-grow-1">
|
<div *ngIf="publicationFolderService.FolderDetails[folderId]" class="div-title d-flex width-100 flex-grow-1 justify-content-between">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<ion-label>{{publicationFolderService.FolderDetails[folderId].Description}}</ion-label>
|
<ion-label>{{publicationFolderService.FolderDetails[folderId].Description}}</ion-label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions-icon">
|
<div class="actions-icon align-baseline">
|
||||||
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
|
<!-- <ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon> -->
|
||||||
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(publicationFolderService.FolderDetails[folderId].ProcessId)">
|
<button *ngIf="p.userPermission([p.permissionList.Actions.editPost])" class="btn-no-color" (click)="openEditPublication(publicationFolderService.FolderDetails[folderId].ProcessId)">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="div-body width-100" *ngIf="publicationFolderService.FolderDetails[folderId]?.DateBegin != null">
|
<div class="div-body width-100" *ngIf="publicationFolderService.FolderDetails[folderId]?.DateBegin != null">
|
||||||
<p class="item-content-detail">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
|
|
||||||
<p class="item-content-date">{{ publicationFolderService.FolderDetails[folderId].DateBegin | date: 'dd-MM-yyyy HH:mm'}}</p>
|
<p class="item-content-date">{{ publicationFolderService.FolderDetails[folderId].DateBegin | date: 'dd-MM-yyyy HH:mm'}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -36,6 +35,8 @@
|
|||||||
</ion-refresher-content>
|
</ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<div class="main-container px-20" *ngIf="publicationFolderService.FolderDetails[folderId]">
|
<div class="main-container px-20" *ngIf="publicationFolderService.FolderDetails[folderId]">
|
||||||
|
<p class="item-content-detail">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
|
||||||
|
|
||||||
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index"
|
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index"
|
||||||
(click)="viewPublicationDetail(publication.DocumentId)">
|
(click)="viewPublicationDetail(publication.DocumentId)">
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { Injectable } from '@angular/core';
|
|||||||
import { PublicationFolder } from '../models/publicationfolder';
|
import { PublicationFolder } from '../models/publicationfolder';
|
||||||
import { Storage } from '@ionic/storage';
|
import { Storage } from '@ionic/storage';
|
||||||
import { Publication } from '../models/publication';
|
import { Publication } from '../models/publication';
|
||||||
|
import { PublicationsService } from '../services/publications.service';
|
||||||
|
import { PublicationPipe } from 'src/app/pipes/publication.pipe';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -15,8 +17,14 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
keyName: string
|
keyName: string
|
||||||
|
|
||||||
|
showLoader = true
|
||||||
|
publicationPipe = new PublicationPipe()
|
||||||
|
getpublication = [];
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private storage: Storage,
|
private storage: Storage,
|
||||||
|
private publications: PublicationsService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +39,7 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
getFromDB(folderId: any) {
|
getFromDB(folderId: any) {
|
||||||
|
|
||||||
|
|
||||||
if(!this.restoreFolder[folderId]) {
|
if(!this.restoreFolder[folderId]) {
|
||||||
|
|
||||||
this.storage.get(folderId).then((viewPublications) => {
|
this.storage.get(folderId).then((viewPublications) => {
|
||||||
@@ -69,11 +78,8 @@ export class PublicationFolderService {
|
|||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
if(!found) {
|
if(!found) {
|
||||||
console.log('push',folderId, Publication)
|
|
||||||
this.publicationList[folderId].push(Publication)
|
this.publicationList[folderId].push(Publication)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
console.log('update',folderId, Publication)
|
|
||||||
this.publicationList[folderId][findIndex] = Publication
|
this.publicationList[folderId][findIndex] = Publication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,6 +94,108 @@ export class PublicationFolderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getPublicationDetail(folderId) {
|
||||||
|
|
||||||
|
this.publications.GetPresidentialAction(folderId).subscribe(res => {
|
||||||
|
this.FolderDetails[folderId] = res
|
||||||
|
this.storage.set(folderId+"name", res)
|
||||||
|
}, (error) => {
|
||||||
|
this.showLoader = false;
|
||||||
|
// this.httpErroHandle.httpStatusHandle(error)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async getPublicationsIds(folderId) {
|
||||||
|
|
||||||
|
this.showLoader = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showLoader = false;
|
||||||
|
|
||||||
|
this.storage.set(folderId, this.publicationList[folderId]);
|
||||||
|
this.getpublication = this.publicationList[folderId];
|
||||||
|
} catch(error) {
|
||||||
|
this.showLoader = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async loadPublication(publicationId, folderId) {
|
||||||
|
let Publication = await this.publications.GetPublicationById(publicationId).toPromise();
|
||||||
|
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
||||||
|
|
||||||
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
|
if(!found) {
|
||||||
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
} else {
|
||||||
|
this.publicationList[folderId][findIndex] = publicationDetails
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async setPublication(publicationId, folderId, publicationDetails: Publication) {
|
||||||
|
|
||||||
|
|
||||||
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
|
if(!found) {
|
||||||
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
} else {
|
||||||
|
this.publicationList[folderId][findIndex] = publicationDetails
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async getPublication(publicationId, folderId, publicationDetails: Publication) {
|
||||||
|
|
||||||
|
|
||||||
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
|
if(!found) {
|
||||||
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
} else {
|
||||||
|
return this.publicationList[folderId][findIndex]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getLocalPublication (folderId, publicationId) {
|
||||||
|
|
||||||
|
if(this.publicationList[folderId]) {
|
||||||
|
|
||||||
|
this.publicationList[folderId].filter( e=> e.ProcessId == publicationId || e.DocumentId == publicationId);
|
||||||
|
|
||||||
|
return this.publicationList[folderId].filter( e => e.ProcessId == publicationId || e.DocumentId == publicationId)?.[0]
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -779,7 +779,7 @@ body {
|
|||||||
--login-background: linear-gradient(180deg, #c63527 60%, #000 100%) !important;
|
--login-background: linear-gradient(180deg, #c63527 60%, #000 100%) !important;
|
||||||
--button-hover: #c63527;
|
--button-hover: #c63527;
|
||||||
--button-color: #ffb81c;
|
--button-color: #ffb81c;
|
||||||
--button-text-color: white;
|
--button-text-color: black;
|
||||||
--inicio-open-page-from-box: #c63527;
|
--inicio-open-page-from-box: #c63527;
|
||||||
--PinBackground: #e1e7eb;
|
--PinBackground: #e1e7eb;
|
||||||
--background-mobile: var(--color);
|
--background-mobile: var(--color);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user