mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Add integration of publication
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="publicationType!='1'" class="ion-item-container">
|
||||
<ion-input [(ngModel)]="pub.title" placeholder="Título" ></ion-input>
|
||||
<ion-input [(ngModel)]="pub.title" name="title" ngDefaultControl placeholder="Título" ></ion-input>
|
||||
</div>
|
||||
|
||||
<div *ngIf="publicationType!='1'" class="container-div">
|
||||
@@ -32,7 +32,7 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-textarea-class">
|
||||
<ion-textarea [(ngModel)]="pub.description" rows="6" cols="20" placeholder="Corpo de texto..."></ion-textarea>
|
||||
<ion-textarea [(ngModel)]="pub.description" name="description" ngDefaultControl rows="6" cols="20" placeholder="Corpo de texto..."></ion-textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,7 +40,7 @@
|
||||
<ion-label class="attached-title">Fotografia Anexada</ion-label>
|
||||
<ion-item lines="none">
|
||||
<ion-thumbnail slot="start">
|
||||
<ion-img [(ngModel)]="pub.imageUrl" [src]="pub.imageUrl"></ion-img>
|
||||
<ion-img [(ngModel)]="pub.imageUrl" name="image" ngDefaultControl [src]="pub.imageUrl"></ion-img>
|
||||
</ion-thumbnail>
|
||||
<!-- <ion-thumbnail *ngIf="!publication" slot="start">
|
||||
<ion-img [(ngModel)]="publication.imageUrl" [src]="guestPicture"></ion-img>
|
||||
|
||||
@@ -7,6 +7,7 @@ import {Plugins, CameraResultType, CameraSource} from '@capacitor/core';
|
||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||
import { PublicationsService } from 'src/app/services/publications.service';
|
||||
import { Publication } from 'src/app/models/publication';
|
||||
import { Image } from 'src/app/models/image';
|
||||
/* import { Camera } from '@ionic-native/camera/ngx'; */
|
||||
|
||||
/* const { Camera } = Plugins; */
|
||||
@@ -19,11 +20,16 @@ import { Publication } from 'src/app/models/publication';
|
||||
export class NewPublicationPage implements OnInit {
|
||||
publication: Publication;
|
||||
pub: Publication = new Publication();
|
||||
folderId: string;
|
||||
image: Image = new Image();
|
||||
|
||||
publicationType:string;
|
||||
publicationTitle:string;
|
||||
imgUrl:any;
|
||||
|
||||
Defaultimage:any = '';
|
||||
|
||||
|
||||
photo: SafeResourceUrl;
|
||||
|
||||
guestPicture:any;
|
||||
@@ -36,6 +42,7 @@ export class NewPublicationPage implements OnInit {
|
||||
private publications: PublicationsService,
|
||||
) {
|
||||
this.publicationType = this.navParams.get('publicationType');
|
||||
this.folderId = this.navParams.get('folderId');
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
}
|
||||
|
||||
@@ -66,20 +73,48 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
|
||||
save(){
|
||||
if(this.publication.processId){
|
||||
if(this.publicationType == '3'){
|
||||
this.image = {
|
||||
title: this.image.title,
|
||||
url: this.image.url,
|
||||
format: 'png'
|
||||
}
|
||||
this.publication = {
|
||||
publicationId:this.publication.publicationId,
|
||||
processId:this.publication.processId,
|
||||
title: this.publication.title,
|
||||
description: this.publication.description,
|
||||
imageUrl:this.publication.imageUrl,
|
||||
date: this.publication.date,
|
||||
/* image: this.image, */
|
||||
imageTitle: '',
|
||||
imageUrl: this.publication.imageUrl,
|
||||
imageFormat: 'png',
|
||||
}
|
||||
console.log('Edit');
|
||||
console.log('Edit');
|
||||
console.log(this.publication);
|
||||
this.publications.UpdatePublication(this.publication.processId, this.publication);
|
||||
}
|
||||
else{
|
||||
console.log('Create');
|
||||
this.image = {
|
||||
title: this.image.title,
|
||||
url: this.image.url,
|
||||
format: 'png'
|
||||
}
|
||||
this.publication = {
|
||||
publicationId:null,
|
||||
processId:this.folderId,
|
||||
title: this.pub.title,
|
||||
description: this.pub.description,
|
||||
date: new Date(),
|
||||
/* image: this.image, */
|
||||
imageTitle: '',
|
||||
imageUrl: '',
|
||||
imageFormat: 'jpg',
|
||||
}
|
||||
|
||||
console.log('Create');
|
||||
console.log(this.publication);
|
||||
this.publications.CreatePublication(this.folderId, this.publication);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,16 +124,14 @@ export class NewPublicationPage implements OnInit {
|
||||
}
|
||||
setTitle(){
|
||||
if(this.publicationType == '1'){
|
||||
this.publicationTitle = 'Nova Publicação Rápida'
|
||||
this.publicationTitle = 'Nova Publicação Rápida';
|
||||
}
|
||||
else if(this.publicationType == '2'){
|
||||
this.publicationTitle = 'Nova Publicação'
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
}
|
||||
else if(this.publicationType == '3'){
|
||||
this.publicationTitle = 'Editar Publicação';
|
||||
this.pub = this.navParams.get('publication');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||
<ion-refresher-content>
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="title-content">
|
||||
<div class="div-title">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, NavigationEnd } from '@angular/router';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
@@ -12,18 +13,41 @@ import { ViewPublicationsPage } from './view-publications/view-publications.page
|
||||
styleUrls: ['./publications.page.scss'],
|
||||
})
|
||||
export class PublicationsPage implements OnInit {
|
||||
showLoader: boolean;
|
||||
|
||||
publicationFolderList: PublicationFolder[];
|
||||
publicationsEventFolderList: PublicationFolder[];
|
||||
publicationsTravelFolderList: PublicationFolder[];
|
||||
|
||||
theDate:any;
|
||||
customDate:any;
|
||||
months: string[];
|
||||
days:string[];
|
||||
|
||||
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private modalController: ModalController,
|
||||
private publications: PublicationsService,
|
||||
) { }
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.router.events.forEach((event) => {
|
||||
if(event instanceof NavigationEnd && event.url == this.router.url) {
|
||||
this.getActions();
|
||||
}
|
||||
});
|
||||
}
|
||||
doRefresh(event) {
|
||||
this.getActions();
|
||||
|
||||
setTimeout(() => {
|
||||
event.target.complete();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
getActions(){
|
||||
|
||||
+13
-2
@@ -28,8 +28,11 @@ export class PublicationDetailPage implements OnInit {
|
||||
processId:'',
|
||||
title:'',
|
||||
description: '',
|
||||
imageUrl: '',
|
||||
/* image: null, */
|
||||
date: null,
|
||||
imageUrl: '',
|
||||
imageTitle: '',
|
||||
imageFormat: '',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,13 +44,21 @@ export class PublicationDetailPage implements OnInit {
|
||||
|
||||
getPublicationDetail(){
|
||||
this.publications.GetPublicationById(this.folderId,this.publicationId).subscribe(res=>{
|
||||
let itemImage = {
|
||||
title: 'Title',
|
||||
url: "data:image/jpg;base64," + res.FileBase64,
|
||||
format: 'png'
|
||||
}
|
||||
this.publication = {
|
||||
publicationId: res.DocumentId,
|
||||
processId:res.ProcessId,
|
||||
title:res.Title,
|
||||
description: res.Message,
|
||||
imageUrl: "data:image/jpg;base64," + res.FileBase64,
|
||||
date: res.DatePublication,
|
||||
/* image: itemImage, */
|
||||
imageUrl: "data:image/jpg;base64," + res.FileBase64,
|
||||
imageTitle: '',
|
||||
imageFormat: '',
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
<p class="item-content-date">{{item.DateBegin}}</p>
|
||||
</div>
|
||||
<div class="actions-icon">
|
||||
<ion-icon (click)="AddPublication('1')" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon>
|
||||
<ion-icon (click)="AddPublication('2')" slot="end" src='assets/images/icons-add.svg'></ion-icon>
|
||||
<ion-icon (click)="AddPublication('1',item.ProcessId)" slot="end" src='assets/images/icons-add-photo.svg'></ion-icon>
|
||||
<ion-icon (click)="AddPublication('2',item.ProcessId)" slot="end" src='assets/images/icons-add.svg'></ion-icon>
|
||||
</div>
|
||||
</div>
|
||||
<ion-list>
|
||||
|
||||
@@ -37,13 +37,21 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.publicationList = new Array();
|
||||
console.log(res);
|
||||
res.forEach(element => {
|
||||
let itemImage = {
|
||||
title: 'Title',
|
||||
url: "data:image/jpg;base64," + element.FileBase64,
|
||||
format: 'png'
|
||||
}
|
||||
let item: Publication = {
|
||||
"publicationId":element.DocumentId,
|
||||
"processId":element.ProcessId,
|
||||
"title":element.Title,
|
||||
"description": element.Message,
|
||||
"imageUrl": "data:image/jpg;base64," + element.FileBase64,
|
||||
"date": element.DatePublication,
|
||||
/* image:itemImage, */
|
||||
"imageUrl": "data:image/jpg;base64," + element.FileBase64,
|
||||
"imageTitle": '',
|
||||
"imageFormat": '',
|
||||
}
|
||||
this.publicationList.push(item);
|
||||
});
|
||||
@@ -51,11 +59,12 @@ export class ViewPublicationsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
async AddPublication(publicationType:any) {
|
||||
async AddPublication(publicationType:any, folderId:string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: NewPublicationPage,
|
||||
componentProps:{
|
||||
publicationType: publicationType,
|
||||
folderId: folderId,
|
||||
},
|
||||
cssClass: 'new-publication',
|
||||
backdropDismiss: false
|
||||
|
||||
Reference in New Issue
Block a user