mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
change publication like instagram and add time zone to agenda
This commit is contained in:
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<div class="content-details">
|
<div class="content-details">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p>{{customDate}}</p>
|
<p>{{customDate}}, {{ TimeZoneString }}</p>
|
||||||
<p *ngIf="toDateString(loadedEvent.StartDate) == toDateString(loadedEvent.EndDate)">das {{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
|
<p *ngIf="toDateString(loadedEvent.StartDate) == toDateString(loadedEvent.EndDate)">das {{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
|
||||||
<p *ngIf="toDateString(loadedEvent.StartDate) != toDateString(loadedEvent.EndDate)">{{loadedEvent.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.EndDate | date: 'dd/M/yy'}} </p>
|
<p *ngIf="toDateString(loadedEvent.StartDate) != toDateString(loadedEvent.EndDate)">{{loadedEvent.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.EndDate | date: 'dd/M/yy'}} </p>
|
||||||
<p *ngIf="loadedEvent.EventRecurrence">
|
<p *ngIf="loadedEvent.EventRecurrence">
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ export class ViewEventPage implements OnInit {
|
|||||||
LoadedDocument: any = null;
|
LoadedDocument: any = null;
|
||||||
sesseionStora = SessionStore
|
sesseionStora = SessionStore
|
||||||
|
|
||||||
|
TimeZoneString = ''
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
/* private navParams: NavParams, */
|
/* private navParams: NavParams, */
|
||||||
@@ -70,7 +72,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
private attachmentsService: AttachmentsService,
|
private attachmentsService: AttachmentsService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
this.isEventEdited = false;
|
this.isEventEdited = false;
|
||||||
this.loadedEvent = new Event();
|
this.loadedEvent = new Event();
|
||||||
this.eventBody = { BodyType: "1", Text: "" };
|
this.eventBody = { BodyType: "1", Text: "" };
|
||||||
@@ -107,7 +109,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
JSON.parse(req).forEach(element => {
|
JSON.parse(req).forEach(element => {
|
||||||
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
|
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
|
||||||
this.storage.remove('eventEdit')
|
this.storage.remove('eventEdit')
|
||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -115,7 +117,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
JSON.parse(req).forEach(element => {
|
JSON.parse(req).forEach(element => {
|
||||||
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
|
this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
|
||||||
this.storage.remove('eventDelete')
|
this.storage.remove('eventDelete')
|
||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@@ -141,7 +143,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
// } else {
|
// } else {
|
||||||
// this.sqliteservice.getAllEvents().then((events: any[] = []) => {
|
// this.sqliteservice.getAllEvents().then((events: any[] = []) => {
|
||||||
// resolve(events)
|
// resolve(events)
|
||||||
|
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
// }).catch ((error) => {
|
// }).catch ((error) => {
|
||||||
@@ -167,7 +169,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
else {
|
else {
|
||||||
// this.router.navigate(['/home', params["params"].caller]);
|
// this.router.navigate(['/home', params["params"].caller]);
|
||||||
this.RouteService.goBack();
|
this.RouteService.goBack();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -179,19 +181,24 @@ export class ViewEventPage implements OnInit {
|
|||||||
ev.target.complete();
|
ev.target.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeZone() {
|
||||||
|
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
||||||
|
}
|
||||||
|
|
||||||
loadEvent() {
|
loadEvent() {
|
||||||
const loader = this.toastService.loading();
|
const loader = this.toastService.loading();
|
||||||
|
|
||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||||
|
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
|
this.setTimeZone()
|
||||||
// this.addEventToDb(res);
|
// this.addEventToDb(res);
|
||||||
|
|
||||||
loader.remove()
|
loader.remove()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|
||||||
|
|
||||||
if (error.status === 0) {
|
if (error.status === 0) {
|
||||||
this.getFromDb();
|
this.getFromDb();
|
||||||
} else {
|
} else {
|
||||||
@@ -204,20 +211,21 @@ export class ViewEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
if(this.CalendarId) {
|
if(this.CalendarId) {
|
||||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
||||||
|
|
||||||
const div = document.createElement("div")
|
const div = document.createElement("div")
|
||||||
div.innerHTML = res.Body.Text
|
div.innerHTML = res.Body.Text
|
||||||
res.Body.Text = div.innerText
|
res.Body.Text = div.innerText
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
|
this.setTimeZone()
|
||||||
|
|
||||||
// this.addEventToDb(res);
|
// this.addEventToDb(res);
|
||||||
|
|
||||||
loader.remove()
|
loader.remove()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|
||||||
if (error.status === 0) {
|
if (error.status === 0) {
|
||||||
this.getFromDb();
|
this.getFromDb();
|
||||||
} else {
|
} else {
|
||||||
@@ -261,14 +269,14 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
const loader = this.toastService.loading()
|
const loader = this.toastService.loading()
|
||||||
|
|
||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
|
||||||
const alert = await this.alertController.create({
|
const alert = await this.alertController.create({
|
||||||
cssClass: 'my-custom-class',
|
cssClass: 'my-custom-class',
|
||||||
header: 'Evento removido',
|
header: 'Evento removido',
|
||||||
buttons: ['OK']
|
buttons: ['OK']
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
alert.dismiss();
|
alert.dismiss();
|
||||||
}, 1500);
|
}, 1500);
|
||||||
@@ -278,29 +286,29 @@ export class ViewEventPage implements OnInit {
|
|||||||
() => {
|
() => {
|
||||||
loader.remove();
|
loader.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
|
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
|
||||||
const alert = await this.alertController.create({
|
const alert = await this.alertController.create({
|
||||||
cssClass: 'my-custom-class',
|
cssClass: 'my-custom-class',
|
||||||
header: 'Evento removido',
|
header: 'Evento removido',
|
||||||
buttons: ['OK']
|
buttons: ['OK']
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
alert.dismiss();
|
alert.dismiss();
|
||||||
}, 1500);
|
}, 1500);
|
||||||
this.goBack();
|
this.goBack();
|
||||||
this.httpErrorHandle.httpsSucessMessagge('delete event')
|
this.httpErrorHandle.httpsSucessMessagge('delete event')
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.httpErrorHandle.httpStatusHandle(error)
|
this.httpErrorHandle.httpStatusHandle(error)
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
loader.remove();
|
loader.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +326,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
modal.onDidDismiss().then((res) => {
|
modal.onDidDismiss().then((res) => {
|
||||||
|
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -350,7 +358,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
modal.onDidDismiss().then((res) => {
|
modal.onDidDismiss().then((res) => {
|
||||||
|
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -365,7 +373,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async editEvent() {
|
async editEvent() {
|
||||||
|
|
||||||
|
|
||||||
let classs;
|
let classs;
|
||||||
if (window.innerWidth <= 800) {
|
if (window.innerWidth <= 800) {
|
||||||
@@ -384,19 +392,19 @@ export class ViewEventPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
modal.onDidDismiss().then((res) => {
|
modal.onDidDismiss().then((res) => {
|
||||||
|
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
/* this.loadEvent(); */
|
/* this.loadEvent(); */
|
||||||
this.loadEvent()
|
this.loadEvent()
|
||||||
|
|
||||||
}, 250);
|
}, 250);
|
||||||
this.isEventEdited = true;
|
this.isEventEdited = true;
|
||||||
|
|
||||||
if(res.data.Attendees?.length >= 1) {
|
if(res.data.Attendees?.length >= 1) {
|
||||||
this.loadedEvent.HasAttachments = true
|
this.loadedEvent.HasAttachments = true
|
||||||
this.getAttachments()
|
this.getAttachments()
|
||||||
}
|
}
|
||||||
console.log('res', res)
|
console.log('res', res)
|
||||||
}
|
}
|
||||||
@@ -416,10 +424,10 @@ export class ViewEventPage implements OnInit {
|
|||||||
if(this.loadedEvent.HasAttachments) {
|
if(this.loadedEvent.HasAttachments) {
|
||||||
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res=>{
|
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res=>{
|
||||||
this.loadedEvent.Attachments = res;
|
this.loadedEvent.Attachments = res;
|
||||||
|
|
||||||
},((erro) => {
|
},((erro) => {
|
||||||
console.error('editgetAttchament', erro)
|
console.error('editgetAttchament', erro)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +437,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
const applicationId: any = this.loadedEvent.Attachments[this.dicIndex].ApplicationId
|
const applicationId: any = this.loadedEvent.Attachments[this.dicIndex].ApplicationId
|
||||||
const selectedDoc = this.loadedEvent.Attachments[this.dicIndex]
|
const selectedDoc = this.loadedEvent.Attachments[this.dicIndex]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.task = {
|
this.task = {
|
||||||
serialNumber: '',
|
serialNumber: '',
|
||||||
@@ -515,37 +523,6 @@ export class ViewEventPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// addEventToDb(data) {
|
|
||||||
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
|
||||||
// this.ionicStorage.set('eventDetails', data).then(() => {
|
|
||||||
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// let event = {
|
|
||||||
// Attendees: JSON.stringify(data.Attendees) || JSON.stringify(''),
|
|
||||||
// Body: JSON.stringify(data.Body) || JSON.stringify(''),
|
|
||||||
// CalendarId: data.CalendarId,
|
|
||||||
// CalendarName: data.CalendarName,
|
|
||||||
// Category: data.Category,
|
|
||||||
// EndDate: data.EndDate,
|
|
||||||
// EventId: data.EventId,
|
|
||||||
// EventRecurrence: JSON.stringify(data.EventRecurrence) || JSON.stringify(''),
|
|
||||||
// EventType: data.EventType,
|
|
||||||
// HasAttachments: data.HasAttachments,
|
|
||||||
// IsAllDayEvent: data.IsAllDayEvent,
|
|
||||||
// IsMeeting: data.IsMeeting,
|
|
||||||
// IsRecurring: data.IsRecurring,
|
|
||||||
// Location: data.Location,
|
|
||||||
// Organizer: JSON.stringify(data.Organizer) || JSON.stringify(''),
|
|
||||||
// StartDate: data.StartDate,
|
|
||||||
// Subject: data.Subject,
|
|
||||||
// TimeZone: data.TimeZone
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.sqliteservice.updateEvent(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
getFromDb() {
|
getFromDb() {
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div *ngIf="room.lastMessage" class="item-description" [class.item-description-active]="room.id == idSelected">
|
<div *ngIf="room.lastMessage" class="item-description" [class.item-description-active]="room.id == idSelected">
|
||||||
|
|
||||||
<p class="font-13-em mb-0 add-ellipsis white-space-nowrap" *ngIf="room.lastMessage && room.otherUserType == false">{{room.lastMessage.msg}}</p>
|
<p class="font-13-em mb-0 white-space-nowrap" *ngIf="room.lastMessage && room.otherUserType == false">{{room.lastMessage.msg}}</p>
|
||||||
<p class="font-13-em" *ngIf="room.otherUserType == true">está escrever...</p>
|
<p class="font-13-em" *ngIf="room.otherUserType == true">está escrever...</p>
|
||||||
<!-- <ion-label *ngIf="room.lastMessage.file">
|
<!-- <ion-label *ngIf="room.lastMessage.file">
|
||||||
<fa-icon *ngIf="room.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="room.id == idSelected"></fa-icon>
|
<fa-icon *ngIf="room.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="room.id == idSelected"></fa-icon>
|
||||||
|
|||||||
@@ -529,6 +529,8 @@ export class ChatSystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.getUser()
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content-details">
|
<div class="content-details">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<p>{{customDate}}</p>
|
<p>{{customDate}}, {{ TimeZoneString }}</p>
|
||||||
<p *ngIf="toDateString(loadedEvent.StartDate) == toDateString(loadedEvent.EndDate)">das
|
<p *ngIf="toDateString(loadedEvent.StartDate) == toDateString(loadedEvent.EndDate)">das
|
||||||
{{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
|
{{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
|
||||||
<p *ngIf="toDateString(loadedEvent.StartDate) != toDateString(loadedEvent.EndDate)">{{loadedEvent.StartDate |
|
<p *ngIf="toDateString(loadedEvent.StartDate) != toDateString(loadedEvent.EndDate)">{{loadedEvent.StartDate |
|
||||||
|
|||||||
@@ -114,12 +114,18 @@ export class ViewEventPage implements OnInit {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimeZoneString = ''
|
||||||
|
|
||||||
|
setTimeZone() {
|
||||||
|
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
||||||
|
}
|
||||||
loadEvent() {
|
loadEvent() {
|
||||||
|
|
||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||||
|
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
|
this.setTimeZone()
|
||||||
|
|
||||||
this.today = new Date(res.StartDate);
|
this.today = new Date(res.StartDate);
|
||||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||||
@@ -142,6 +148,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
div.innerHTML = res.Body.Text
|
div.innerHTML = res.Body.Text
|
||||||
res.Body.Text = div.innerText
|
res.Body.Text = div.innerText
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
|
this.setTimeZone()
|
||||||
|
|
||||||
this.today = new Date(res.StartDate);
|
this.today = new Date(res.StartDate);
|
||||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
||||||
|
|||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { PublicationCardPage } from './publication-card.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: PublicationCardPage
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class PublicationCardPageRoutingModule {}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { PublicationCardPageRoutingModule } from './publication-card-routing.module';
|
||||||
|
|
||||||
|
import { PublicationCardPage } from './publication-card.page';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
PublicationCardPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [PublicationCardPage],
|
||||||
|
exports: [PublicationCardPage]
|
||||||
|
})
|
||||||
|
export class PublicationCardPageModule {}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
<ion-header>
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title>publicationCard</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
<ion-content>
|
||||||
|
|
||||||
|
</ion-content>
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { PublicationCardPage } from './publication-card.page';
|
||||||
|
|
||||||
|
describe('PublicationCardPage', () => {
|
||||||
|
let component: PublicationCardPage;
|
||||||
|
let fixture: ComponentFixture<PublicationCardPage>;
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ PublicationCardPage ],
|
||||||
|
imports: [IonicModule.forRoot()]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(PublicationCardPage);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-publication-card',
|
||||||
|
templateUrl: './publication-card.page.html',
|
||||||
|
styleUrls: ['./publication-card.page.scss'],
|
||||||
|
})
|
||||||
|
export class PublicationCardPage implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { ShowMorePage } from './show-more.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: ShowMorePage
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class ShowMorePageRoutingModule {}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { ShowMorePageRoutingModule } from './show-more-routing.module';
|
||||||
|
|
||||||
|
import { ShowMorePage } from './show-more.page';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
ShowMorePageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [ShowMorePage],
|
||||||
|
exports: [ShowMorePage]
|
||||||
|
})
|
||||||
|
export class ShowMorePageModule {}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<div>
|
||||||
|
<pre #text class="text ma-0 add-ellipsis white-space-nowrap" *ngIf="showShortText">{{shortText}}</pre>
|
||||||
|
<pre class="text ma-0" *ngIf="!showShortText">{{text}}</pre>
|
||||||
|
<div class="cursor-pointer" *ngIf="showMoreButton" (click)="showShortText=false;showMoreButton=false">
|
||||||
|
<span>...</span>
|
||||||
|
<span>Mais</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
|
||||||
|
import { ShowMorePage } from './show-more.page';
|
||||||
|
|
||||||
|
describe('ShowMorePage', () => {
|
||||||
|
let component: ShowMorePage;
|
||||||
|
let fixture: ComponentFixture<ShowMorePage>;
|
||||||
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ShowMorePage ],
|
||||||
|
imports: [IonicModule.forRoot()]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ShowMorePage);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-show-more',
|
||||||
|
templateUrl: './show-more.page.html',
|
||||||
|
styleUrls: ['./show-more.page.scss'],
|
||||||
|
})
|
||||||
|
export class ShowMorePage implements OnInit {
|
||||||
|
|
||||||
|
@ViewChild('text') HTMLElement: any;
|
||||||
|
@Input() text = ''
|
||||||
|
shortText = ''
|
||||||
|
showShortText = true
|
||||||
|
showMoreButton = false
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
run() {
|
||||||
|
let split = this.text.split(/\r?\n|\r|\n/g)
|
||||||
|
let text = split[0]
|
||||||
|
this.shortText = text.slice(0, 100)
|
||||||
|
|
||||||
|
if(split.length >= 2) {
|
||||||
|
this.showShortText = true
|
||||||
|
this.showMoreButton = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(()=> {
|
||||||
|
if (this.isEllipsisActive(this.HTMLElement.nativeElement)) {
|
||||||
|
this.showShortText = true
|
||||||
|
this.showMoreButton = true
|
||||||
|
} else {
|
||||||
|
this.showShortText = false
|
||||||
|
}
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
isEllipsisActive(element) {
|
||||||
|
if (element.clientWidth < element.scrollWidth) {
|
||||||
|
var style = element.currentStyle || window.getComputedStyle(element);
|
||||||
|
console.log('add ellopsiss')
|
||||||
|
return style.textOverflow === 'ellipsis'
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: any): void {}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,8 @@ import { IonicModule } from '@ionic/angular';
|
|||||||
import { ViewPublicationsPageRoutingModule } from './view-publications-routing.module';
|
import { ViewPublicationsPageRoutingModule } from './view-publications-routing.module';
|
||||||
import { ViewPublicationsPage } from './view-publications.page';
|
import { ViewPublicationsPage } from './view-publications.page';
|
||||||
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image';
|
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image';
|
||||||
|
import { PublicationCardPageModule } from './publication-card/publication-card.module'
|
||||||
|
import { ShowMorePageModule } from './show-more/show-more.module';
|
||||||
export class LazyLoadImageHooks extends IntersectionObserverHooks {
|
export class LazyLoadImageHooks extends IntersectionObserverHooks {
|
||||||
setup(attributes: Attributes) {
|
setup(attributes: Attributes) {
|
||||||
attributes.offset = 10;
|
attributes.offset = 10;
|
||||||
@@ -23,7 +24,10 @@ setup(attributes: Attributes) {
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
IonicModule,
|
IonicModule,
|
||||||
ViewPublicationsPageRoutingModule,
|
ViewPublicationsPageRoutingModule,
|
||||||
LazyLoadImageModule
|
LazyLoadImageModule,
|
||||||
|
// page
|
||||||
|
ShowMorePageModule,
|
||||||
|
PublicationCardPageModule
|
||||||
],
|
],
|
||||||
exports: [ViewPublicationsPage],
|
exports: [ViewPublicationsPage],
|
||||||
declarations: [ViewPublicationsPage],
|
declarations: [ViewPublicationsPage],
|
||||||
|
|||||||
@@ -37,10 +37,9 @@
|
|||||||
<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>
|
<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, publication.ProcessId)">
|
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<div class="post-img">
|
<div class="post-img cursor-pointer" (click)="viewPublicationDetail(publication.DocumentId, publication.ProcessId)">
|
||||||
<img [lazyLoad]="publication.FileBase64">
|
<img [lazyLoad]="publication.FileBase64">
|
||||||
</div>
|
</div>
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
@@ -51,38 +50,13 @@
|
|||||||
<div class="post-data">{{publication.DatePublication | date: 'dd-MM-yyyy HH:mm'}}</div>
|
<div class="post-data">{{publication.DatePublication | date: 'dd-MM-yyyy HH:mm'}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-description">
|
<div class="post-description">
|
||||||
<pre class="text">{{publication.Message}}</pre>
|
<app-show-more
|
||||||
|
[text]=publication.Message
|
||||||
|
></app-show-more>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
<!-- <ion-list>
|
|
||||||
<div class="post-item d-md-block mb-10 cursor-pointer"
|
|
||||||
*ngFor="let publication of publicationFolderService.publicationList"
|
|
||||||
(click)="viewPublicationDetail(publication.DocumentId)">
|
|
||||||
<div *ngIf="publication.FileBase64.length > 30" class="mb-10 post-img width-md-100">
|
|
||||||
<img src="{{publication.FileBase64}}" alt="image">
|
|
||||||
</div>
|
|
||||||
<div *ngIf="publication.FileBase64.length < 30" class="mb-10 post-img">
|
|
||||||
<img src="/assets/icon/icon-no-image.svg" alt="image">
|
|
||||||
</div>
|
|
||||||
<div class="post-content px-20 width-md-100 ">
|
|
||||||
<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 class="center height-100" *ngIf="!publicationFolderService.publicationList">
|
|
||||||
<p>{{error}}</p>
|
|
||||||
</div>
|
|
||||||
</ion-list> -->
|
|
||||||
</div>
|
</div>
|
||||||
<!-- fab placed to the bottom end -->
|
<!-- fab placed to the bottom end -->
|
||||||
<ion-fab *ngIf="p.userPermission([p.permissionList.Actions.create]) && publicationFolderService.FolderDetails[folderId]" vertical="bottom" horizontal="end">
|
<ion-fab *ngIf="p.userPermission([p.permissionList.Actions.create]) && publicationFolderService.FolderDetails[folderId]" vertical="bottom" horizontal="end">
|
||||||
|
|||||||
@@ -135,12 +135,23 @@
|
|||||||
}
|
}
|
||||||
.post-img{
|
.post-img{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 56.25vh !important;
|
height: 100%;
|
||||||
border-radius: 0px!important;
|
|
||||||
|
max-height: 500px;
|
||||||
|
max-width: 468px;
|
||||||
|
|
||||||
|
min-height: 350px;
|
||||||
|
min-width: 468px;
|
||||||
|
|
||||||
|
margin: 5px auto;
|
||||||
|
|
||||||
|
border-radius: 0px !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: black;
|
||||||
|
|
||||||
}
|
}
|
||||||
.post-img img{
|
.post-img img{
|
||||||
@@ -191,4 +202,11 @@ ion-fab-button:hover{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ion-card{
|
||||||
|
width: fit-content;
|
||||||
|
max-width: calc(468px + 16px + 16px);
|
||||||
|
margin: 0px auto;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -125,10 +125,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
|
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
|
||||||
|
|
||||||
this.createPublicationList(folderId)
|
this.createPublicationList(folderId)
|
||||||
let loadLater = []
|
let loadLater = []
|
||||||
for (let publicationId of publicationIds) {
|
for (let publicationId of publicationIds) {
|
||||||
@@ -147,17 +147,17 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
for(let localPublication of this.publicationFolderService.publicationList[folderId]) {
|
for(let localPublication of this.publicationFolderService.publicationList[folderId]) {
|
||||||
|
|
||||||
const apiPublication = publicationIds.includes(localPublication.DocumentId)
|
const apiPublication = publicationIds.includes(localPublication.DocumentId)
|
||||||
if(!apiPublication) {
|
if(!apiPublication) {
|
||||||
this.publicationFolderService.deletePost(folderId, localPublication.DocumentId)
|
this.publicationFolderService.deletePost(folderId, localPublication.DocumentId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
|
|
||||||
this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]);
|
this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]);
|
||||||
|
|
||||||
this.oldpublicationIds = publicationIds
|
this.oldpublicationIds = publicationIds
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
@@ -166,10 +166,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_deletePublication = (folderId, publicationId) => {
|
_deletePublication = (folderId, publicationId) => {
|
||||||
|
|
||||||
this.publicationFolderService.publicationList[folderId] = this.publicationFolderService.publicationList[folderId].filter( e => e.DocumentId != publicationId)
|
this.publicationFolderService.publicationList[folderId] = this.publicationFolderService.publicationList[folderId].filter( e => e.DocumentId != publicationId)
|
||||||
|
|
||||||
console.log('this.publicationFolderService.publicationList[folderId]', this.publicationFolderService.publicationList[folderId].length)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +184,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
async loadPublication(publicationId, folderId) {
|
async loadPublication(publicationId, folderId) {
|
||||||
let Publication = await this.publications.GetPublicationById(publicationId).toPromise();
|
let Publication = await this.publications.GetPublicationById(publicationId).toPromise();
|
||||||
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
||||||
|
|
||||||
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) {
|
||||||
@@ -194,7 +192,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
|
this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getFromDB() {
|
getFromDB() {
|
||||||
@@ -242,7 +240,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
cssClass: 'new-action modal modal-desktop',
|
cssClass: 'new-action modal modal-desktop',
|
||||||
backdropDismiss: true
|
backdropDismiss: true
|
||||||
});
|
});
|
||||||
|
|
||||||
modal.onDidDismiss().then(() => {
|
modal.onDidDismiss().then(() => {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user