This commit is contained in:
tiago.kayaya
2021-12-01 15:15:32 +01:00
212 changed files with 3517 additions and 1657 deletions
+3 -3
View File
@@ -216,9 +216,9 @@
<!-- List -->
<ul *ngIf="showTimelineFilterState">
<li [class.active]="segment == 'Combinado' " (click)="changeSegment('Combinado')" class="cursor-pointer">Todos</li>
<li [class.active]="segment == 'Oficial' " (click)="changeSegment('Oficial')" class="cursor-pointer">Oficial</li>
<li [class.active]="segment == 'Pessoal' " (click)="changeSegment('Pessoal')" class="cursor-pointer">Pessoal</li>
<li class="changeText" [class.active]="segment == 'Combinado' " (click)="changeSegment('Combinado')" class="cursor-pointer">Todos</li>
<li class="changeText" [class.active]="segment == 'Oficial' " (click)="changeSegment('Oficial')" class="cursor-pointer">Oficial</li>
<li class="changeText" [class.active]="segment == 'Pessoal' " (click)="changeSegment('Pessoal')" class="cursor-pointer">Pessoal</li>
</ul>
</ion-row>
+19 -1
View File
@@ -292,6 +292,11 @@ td.monthview-primary-with-event {
.segment {
}
div ion-raw > ul > li{
font-size: 11pt;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
/* Timeline */
@@ -794,4 +799,17 @@ app-approve-event{
border-top-right-radius: 25px;
}
}
}
$font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
$font-size: 11pt;
.changeText{
font-family: $font-family;
font-size: $font-size;
}
+33 -12
View File
@@ -161,6 +161,7 @@ export class AgendaPage implements OnInit {
dropdownScrollWeal = false
CalendarStore = CalendarStore
listToPresent
array = []
constructor(
private alertCtrl: AlertController,
@@ -232,6 +233,8 @@ export class AgendaPage implements OnInit {
ngOnInit() {
this.getFromDB();
const pathname = window.location.pathname
let realoadCounter = 0
this.router.events.forEach((event) => {
@@ -240,14 +243,14 @@ export class AgendaPage implements OnInit {
this.segment = "Combinado";
}
if (realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
realoadCounter++;
}
});
this.backgroundservice.registerBackService('Online', () => {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
});
window.onresize = (event) => {
@@ -487,6 +490,7 @@ export class AgendaPage implements OnInit {
}
loadRangeEvents(startTime: Date, endTime: Date) {
this.array = [];
this.rangeStartDate = startTime
this.rangeEndDate = endTime
@@ -514,6 +518,7 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -540,13 +545,17 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
this.showLoader = false;
this.showTimeline = true;
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
this.showLoader = false;
})
@@ -567,6 +576,7 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -603,6 +613,7 @@ export class AgendaPage implements OnInit {
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -614,7 +625,10 @@ export class AgendaPage implements OnInit {
}
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
@@ -633,6 +647,8 @@ export class AgendaPage implements OnInit {
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -644,7 +660,10 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
}
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
counter++;
if (counter == 2) {
this.showLoader = false;
@@ -674,6 +693,7 @@ export class AgendaPage implements OnInit {
this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
console.log('check list to present data', this.listToPresent);
this.myCal.update();
this.myCal.loadEvents();
@@ -685,7 +705,10 @@ export class AgendaPage implements OnInit {
this.showLoader = false;
}
}).finally(() => {
}).catch((error) => {
this.getFromDB()
})
.finally(() => {
if (counter == 1 || this.loggeduser.Profile == 'PR') {
this.showLoader = false;
}
@@ -697,7 +720,6 @@ export class AgendaPage implements OnInit {
}
trasnformData(response,profile) {
let array = []
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
@@ -708,10 +730,9 @@ export class AgendaPage implements OnInit {
profile: profile,
id: element.EventId,
}
array.push(event)
this.array.push(event)
});
this.listToPresent = array;
this.listToPresent = this.array;
console.log('LIST TO PRESET', this.listToPresent)
}
@@ -952,7 +973,7 @@ export class AgendaPage implements OnInit {
// });
this.myCal.update();
this.myCal.loadEvents();
// this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
this.cloneAllmobileComponent();
@@ -992,7 +1013,6 @@ export class AgendaPage implements OnInit {
this.postEvent = data.event;
this.mobileComponent.showEditEvent = true;
}
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
@@ -1147,6 +1167,7 @@ export class AgendaPage implements OnInit {
async closeComponentEditEventOrAdd() {
if (this.IsEvent = 'edit') {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.eventClicked(this.viewingEventObject);
} else if (this.IsEvent = 'add') {
this.cloneAllmobileComponent();
@@ -281,12 +281,12 @@ export class NewEventPage implements OnInit {
});
this.toastService.successMessage()
this.toastService._successMessage()
this.modalController.dismiss(this.postEvent);
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -171,9 +171,9 @@ export class ViewEventPage implements OnInit {
loader.remove()
}, (error) => {
console.log('errorstatus',error.status)
console.log('errorstatus ss',error.status)
if (error.status == 0) {
if (error.status === 0) {
this.getFromDb();
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
@@ -205,6 +205,8 @@ export class ViewEventPage implements OnInit {
() => {
loader.remove();
});
loader.remove();
}
@@ -421,8 +423,9 @@ export class ViewEventPage implements OnInit {
const loader = this.toastService.loading();
this.sqliteservice.getEventById(this.eventId).then((event) => {
let arrayevent = [];
console.log('EVENT ATTENDEES',event[0].Attendees)
let elemet = {
Attendees: JSON.parse(event[0].Attendees) || "",
Attendees: (typeof JSON.parse(event[0].Attendees) === 'undefined') ? "" : JSON.parse(event[0].Attendees),
Body: JSON.parse(event[0].Body) || "",
CalendarId: event[0].CalendarId,
CalendarName: event[0].CalendarName,
+2
View File
@@ -29,6 +29,7 @@ import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { NewEventPageModule } from 'src/app/shared/agenda/new-event/new-event.module';
import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { ImageCropperModule } from 'ngx-image-cropper';
@NgModule({
imports: [
@@ -48,6 +49,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
GroupContactsPageModule,
EmptyChatPageModule,
NewEventPageModule,
ImageCropperModule,
AttendeeModalPageModule,
],
declarations: [
+1 -2
View File
@@ -97,8 +97,6 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon" slot="start" src="assets/images/icons-chat-group-chat-40.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && group._id != idSelected " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-group-chat-40.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && group._id == idSelected " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-group-chat-40-hover.svg"></ion-icon>
</div>
<div
(click)="openGroupMessagesPage(group._id)" class="item-content flex-grow-1 cursor-pointer">
@@ -125,6 +123,7 @@
</div>
</div>
</ion-item-sliding>
</ion-list>
</div>
<!-- <button (click)="sendMsg()" style="height: 41px;">Send message</button> -->
+9 -1
View File
@@ -32,6 +32,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
@Component({
selector: 'app-chat',
templateUrl: './chat.page.html',
@@ -119,6 +120,7 @@ export class ChatPage implements OnInit {
public ThemeService: ThemeService,
private dataService:DataService,
private router: Router,
){
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.headers = new HttpHeaders();
@@ -549,4 +551,10 @@ hideRefreshButton(){
modal.onDidDismiss();
}
}
// this.crop.crop('path/to/image.jpg', {quality: 75})
// .then(
// newImage => console.log('new image path is: ' + newImage),
// error => console.error('Error cropping image', error)
// );
}
@@ -29,9 +29,6 @@
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<div *ngIf="members">
<ion-label class="members-label">Contactos selecção:</ion-label>
@@ -13,6 +13,8 @@ import { ChatPopoverPageModule } from 'src/app/shared/popover/chat-popover/chat-
import { BtnModalDismissPageModule } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { ImageCropperModule } from 'ngx-image-cropper';
import { AngularCropperjsModule } from 'angular-cropperjs';
@NgModule({
imports: [
@@ -24,6 +26,9 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
GroupMessagesPageRoutingModule,
ChatPopoverPageModule,
BtnModalDismissPageModule,
ImageCropperModule,
AngularCropperjsModule
],
declarations: [GroupMessagesPage]
})
@@ -57,7 +57,7 @@
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'>
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)">
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
@@ -66,7 +66,7 @@
<ion-label>{{msg.msg}}</ion-label>
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" >
<div>
<div>
<div class="file">
@@ -90,7 +90,9 @@
</div>
</div>
</div>
</div>
</div>
{{last ? scrollToBottom() : ''}}
</div>
@@ -152,4 +154,5 @@
</button>
</div>
</div>
</ion-footer>
@@ -278,3 +278,36 @@
}
}
.preview-slides {
margin-top: 20%;
background: #e6e6e6;
img {
padding-top: 20px;
padding-bottom: 20px;
}
}
.transparent-modal {
.modal-wrapper {
--background: rgba(44, 39, 45, 0.2);
}
}
.image-slide,
.image-card {
overflow: visible;
}
.image-card {
z-index: 9;
}
.backdrop {
height: 200%;
width: 100%;
background: black;
position: absolute;
z-index: 10;
}
@@ -1,5 +1,5 @@
import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, } from '@angular/core';
import { ActionSheetController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, ChangeDetectorRef, } from '@angular/core';
import { ActionSheetController, IonSlides, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
@@ -20,6 +20,7 @@ import { NewEventPage } from '../../agenda/new-event/new-event.page';
import { EventPerson } from 'src/app/models/eventperson.model';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
@Component({
selector: 'app-group-messages',
@@ -27,6 +28,9 @@ import { ThemeService } from 'src/app/services/theme.service'
styleUrls: ['./group-messages.page.scss'],
})
export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
showLoader: boolean;
isGroupCreated:boolean;
loggedUser: any;
@@ -75,7 +79,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private fileToBase64Service: FileToBase64Service,
private fileService: FileService,
private toastService: ToastService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true;
@@ -464,7 +469,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//this.loadPicture();
}
else if(res['data'] == 'add-picture'){
this.fileService.addPictureToChat(this.roomId);
this.fileService.addPictureToChatMobile(this.roomId);
//this.loadPicture();
}
else if(res['data'] == 'add-document'){
@@ -580,4 +585,59 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
sliderOpts = {
zoom: false,
slidesPerView: 1.5,
spaceBetween: 20,
centeredSlides: true
};
zoomActive = false;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale/5;
this.changeDetectorRef.detectChanges();
}
}
}
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
// Card back to normal
card.el.style['z-index'] = 9;
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
async openPreview(img) {
const modal = await this.modalController.create({
component: PreviewCameraPage,
cssClass: 'transparent-modal',
componentProps: {
image: img.attachments[0].image_url,
username: img.u.username,
_updatedAt: img._updatedAt
}
});
modal.present();
}
}
@@ -50,8 +50,8 @@
</ion-refresher> -->
<div (click)="handleClick()" class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of chatMessageStore.message[roomId]; let last = last"
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'>
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId" >
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)">
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
@@ -60,7 +60,7 @@
<ion-label>{{msg.msg}}</ion-label>
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments let i = index">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" (click)="imageSize(file.image_url)">
<div>
<div>
<div class="file">
@@ -138,6 +138,7 @@
<button (click)="stopRecording()">Stop Recording</button> -->
<div class="container width-100 d-flex">
<div>
<button class="btn-no-color" (click)="openChatOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-options" src="assets/images/icons-add.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-options" src="assets/images/theme/gov/icons-add.svg"></ion-icon>
@@ -163,4 +164,5 @@
</button>
</div>
</div>
</ion-footer>
+105 -5
View File
@@ -1,6 +1,6 @@
import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'
import { GestureController, Gesture, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { GestureController, Gesture, ModalController, NavParams, PopoverController, IonSlides } from '@ionic/angular';
import { map } from 'rxjs/operators';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { EventPerson } from 'src/app/models/eventperson.model';
@@ -23,6 +23,11 @@ import { ThemeService } from 'src/app/services/theme.service'
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
// import { SocialSharing } from '@ionic-native/social-sharing/ngx';
//import { Share } from '@capacitor/share';
const IMAGE_DIR = 'stored-images';
@Component({
selector: 'app-messages',
@@ -36,8 +41,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
@ViewChild('rectangle') private rectangle: ElementRef;
canvas: any
ctx: any
loggedUser: any;
message = '';
messages:any;
userPresence='';
@@ -83,7 +89,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private fileService: FileService,
private gestureController: GestureController,
private processes: ProcessesService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef,
// private socialSharing: SocialSharing
) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId');
@@ -101,6 +109,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.loadFiles();
VoiceRecorder.requestAudioRecordingPermission();
Filesystem.mkdir({
path: IMAGE_DIR,
directory: Directory.Data,
recursive: true
});
}
ngAfterViewInit() {
@@ -583,8 +596,95 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
openPreview(){
sliderOpts = {
zoom: false,
slidesPerView: 1.5,
spaceBetween: 20,
centeredSlides: true
};
zoomActive = false;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale/5;
this.changeDetectorRef.detectChanges();
}
}
}
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
// Card back to normal
card.el.style['z-index'] = 9;
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
async openPreview(msg) {
const modal = await this.modalController.create({
component: PreviewCameraPage,
cssClass: 'transparent-modal',
componentProps: {
image: msg.attachments[0].image_url,
username: msg.u.username,
_updatedAt: msg._updatedAt,
}
});
modal.present();
}
imageSize(img){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
getPicture(img){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
// async ShareEmail(msg){
// // Check if sharing via email is supported
// await Share.share({
// title: msg.u.username,
// text: msg._updatedAt,
// url: msg.attachments[0].image_url,
// dialogTitle: 'Share with buddies',
// });
// }
}
+2 -2
View File
@@ -1,8 +1,8 @@
<ion-header class="ion-no-border ">
<ion-header class="ion-no-border">
<app-header></app-header>
</ion-header>
<ion-header class="ion-no-border text-white">
<ion-header class="ion-no-border init-event-header">
<ion-label>
<p class="time ion-text-center">{{customDate}}</p>
</ion-label>
+3 -2
View File
@@ -275,6 +275,7 @@ ion-toolbar{
// new
.main{
padding: 0px em(20px);
background: linear-gradient(270deg, var(--color2) 100%, var(--color3) 100%, var(--color4) 100%, var(--color5) 100%) !important;
}
.event-number{
@@ -402,8 +403,8 @@ ion-toolbar{
display: flex;
justify-content: space-between;
align-items: center;
background-color: transparent !important;
--background: transparent !important;
background-color: transparent;
--background: transparent;
.schedule-time{
margin-right: 10px;
.time-start{
+30
View File
@@ -318,6 +318,36 @@ export class EventsPage implements OnInit {
if (list.length > 0) {
list.forEach(element => {
this.sqliteservice.addEvent(element)
this.sqliteservice.getAllEvents().then((event: any[]) => {
let todayEvents = new Array()
event.forEach((element) => {
let eventObject = {
AppointmentState: element.AppointmentState,
Attachments: element.Attachments,
Attendees: element.Attendees,
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
Category: element.Category,
EndDate: element.EndDate,
EventId: element.EventId,
EventRecurrence: element.EventRecurrence,
EventType: element.EventType,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
IsMeeting: element.IsMeeting,
IsRecurring: element.IsRecurring,
Location: element.Location,
Organizer: element.Organizer,
Profile: element.Profile,
StartDate: element.StartDate,
Subject: element.Subject
}
todayEvents.push(eventObject);
})
console.log('JIFJSOSDJSDONS',todayEvents)
})
});
}
}
@@ -1,4 +1,4 @@
<ion-header class="ion-no-border px-20">
<ion-header class="ion-no-border">
<app-header></app-header>
</ion-header>
<ion-content>
@@ -157,7 +157,7 @@ export class DespachoPrPage implements OnInit {
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -272,9 +272,9 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
this.toastService._successMessage()
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -297,10 +297,10 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado')
this.toastService._successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest('Processo não arquivado')
this.toastService._badRequest('Processo não arquivado')
}
finally {
loader.remove()
@@ -320,10 +320,10 @@ export class DespachoPrPage implements OnInit {
documents
}).toPromise()
this.toastService.successMessage('Processo criado')
this.toastService._successMessage('Processo criado')
this.close();
} catch (error) {
this.toastService.badRequest('Processo não criado')
this.toastService._badRequest('Processo não criado')
}
finally {
loader.remove()
@@ -346,10 +346,10 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('')
this.toastService._successMessage('')
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -373,10 +373,10 @@ export class DespachoPrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.toastService._successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -391,11 +391,11 @@ export class DespachoPrPage implements OnInit {
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.popoverController.dismiss('close')
this.toastService.successMessage('Processo enviado para pendentes')
this.toastService._successMessage('Processo enviado para pendentes')
this.goBack()
}, () => {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
});
}
@@ -448,6 +448,7 @@ export class DespachoPrPage implements OnInit {
else if (actionName == 'Reexecução') {
await this.reexecutar(res.data.note, docs);
}
this.goBack();
}
});
@@ -535,7 +536,15 @@ export class DespachoPrPage implements OnInit {
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
modal.onDidDismiss().then(res => {
if(res){
const data = res.data;
if(data == 'close') {
this.goBack();
}
}
});
}
async distartExpedientModal() {
@@ -157,8 +157,9 @@ export class DespachosPrPage implements OnInit {
}
this.despachoList.push(task);
console.log(this.despachoList);
});
this.despachoList = this.sortService.sortDate(this.despachoList, 'CreateDate')
this.listToPresent = this.despachoList
}, (error) => {
@@ -117,15 +117,15 @@ export class DiplomaAssinarPage implements OnInit {
}, (error)=>{
try {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
this.goBack()
} catch (e) {
window.history.back();
} finally {
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
}
});
@@ -179,11 +179,11 @@ export class DiplomaAssinarPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage(false, ()=>{
this.toastService._successMessage(false, ()=>{
this.goBack();
})
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -80,13 +80,14 @@ export class DiplomasAssinarPage implements OnInit {
let diplomas = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
this.diplomasList = [];
let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma");
diplomasAssinar = this.sortService.sortArrayISODate(diplomasAssinar);
let diplomasAssinar = diplomas.filter(data => data.activityInstanceName == "Assinar Diploma");
diplomasAssinar.forEach(element => {
let task: customTask = this.customTaskPipe.transform(element)
this.diplomasList.push(task);
});
this.diplomasList = this.sortService.sortDate(this.diplomasList, 'CreateDate')
this.skeletonLoader = false
this.showLoader = false;
@@ -163,7 +163,7 @@ export class DiplomaPage implements OnInit {
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -282,12 +282,12 @@ export class DiplomaPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage(false, () => {
this.toastService._successMessage(false, () => {
this.close();
})
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -308,9 +308,9 @@ export class DiplomaPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.toastService._successMessage()
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -334,9 +334,9 @@ export class DiplomaPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo concluído')
this.toastService._successMessage('Processo concluído')
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -16,10 +16,10 @@
<ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button value="validar">
Por validar
Por validar ...
</ion-segment-button>
<ion-segment-button value="assinados">
Assinados PR
Assinados PR ...
</ion-segment-button>
</ion-segment>
</ion-toolbar>
@@ -182,7 +182,6 @@ export class DiplomasPage implements OnInit, OnDestroy {
this.skeletonLoader = false
this.showLoader = false;
let diplomasValidar = diplomas.filter(data => data.activityInstanceName == "Revisar Diploma");
let diplomasList = [];
diplomasValidar.forEach(async element => {
@@ -191,18 +190,19 @@ export class DiplomasPage implements OnInit, OnDestroy {
diplomasList.push(task);
});
this.diplomasList = this.sortService.sortArrayISODate(diplomasList.reverse());
this.diplomasList = this.sortService.sortDate(diplomasList, 'CreateDate');
let diplomasAssinados = diplomas.filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = [];
let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = []
diplomasAssinados.forEach(async element => {
let task = this.pipeTask(element);
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortService.sortArrayISODate(diplomasAssinadoList).reverse();
this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'CreateDate')
}, (error) => {
this.getFromDb()
@@ -220,21 +220,21 @@ export class DiplomasPage implements OnInit, OnDestroy {
let task = this.pipeTaskOffline(element)
diplomasList.push(task);
});
});
console.log(diplomasList);
console.log(diplomasList);
this.diplomasList = this.sortService.sortDate(diplomasList, 'taskStartDate');
this.diplomasList = this.sortService.sortArrayISODate(diplomasList).reverse();
let diplomasAssinados = process.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinados = process.filter(data => data.activityInstanceName == "Diploma Assinado");
let diplomasAssinadoList = []
diplomasAssinados.forEach(async element => {
let task = this.pipeTaskOffline(element)
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortService.sortArrayISODate(diplomasAssinadoList).reverse();
let task = this.pipeTaskOffline(element)
diplomasAssinadoList.push(task);
});
console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortService.sortDate(diplomasAssinadoList, 'taskStartDate')
})
}
@@ -110,13 +110,13 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage('Evento aprovado', ()=>{
this.toastService._successMessage('Evento aprovado', ()=>{
this.router.navigate(['/home/gabinete-digital/event-list']);
this.modalController.dismiss(null);
})
} catch (error) {
this.toastService.badRequest('Evento não aprovado')
this.toastService._badRequest('Evento não aprovado')
}
finally {
loader.remove()
@@ -141,11 +141,11 @@ export class ApproveEventModalPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage('Evento rejeitado', () =>{
this.toastService._successMessage('Evento rejeitado', () =>{
this.router.navigate(['/home/gabinete-digital/event-list']);
})
} catch (error) {
this.toastService.badRequest('Evento não rejeitado')
this.toastService._badRequest('Evento não rejeitado')
}
finally {
loader.remove()
@@ -17,6 +17,7 @@ import { SqliteService } from '../../../../services/sqlite.service';
import { BackgroundService } from '../../../../services/background.service';
import { Platform } from '@ionic/angular';
import { ThemeService } from 'src/app/services/theme.service'
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
@Component({
@@ -62,6 +63,7 @@ export class ApproveEventPage implements OnInit {
private platform: Platform,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService,
private offlineManager: OfflineManagerService
) {
this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]);
@@ -203,11 +205,11 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -255,11 +257,15 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
console.log('Send event to approve for revition')
this.offlineManager.storeRequestData('event-listRever', body);
});
this.toastService._successMessage('Pedido enviado');
this.goBack();
} catch (error) {
this.toastService.badRequest();
this.toastService._badRequest();
} finally {
loader.remove()
}
@@ -280,10 +286,10 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
await this.toastService.successMessage('Processo rejeitado');
await this.toastService._successMessage('Processo rejeitado');
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -358,10 +364,10 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest();
this.toastService._badRequest();
} finally {
loader.remove()
}
@@ -84,14 +84,13 @@ export class EventListPage implements OnInit {
this.platform.ready().then(() => {
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR', 'Agenda Pessoal MDGPR').then((event: any[]) => {
this.eventsMDGPRList = this.sortService.sortArrayByDate(event).reverse()
this.eventsMDGPRList = this.sortService.sortDate(event, 'taskStartDate')
console.log("All evento to aprove from db ", event)
})
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR', 'Agenda Pessoal PR').then((event: any[]) => {
this.eventsPRList = this.sortService.sortArrayByDate(event).reverse()
console.log("All evento to aprove from db ", event)
this.eventsPRList = this.sortService.sortDate(event, 'taskStartDate')
})
})
console.log('Offlineee')
@@ -111,14 +110,14 @@ export class EventListPage implements OnInit {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse()
this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate')
this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
}
else if (this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList).reverse();
this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate')
this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
}
this.showLoader = false;
@@ -275,10 +275,10 @@ export class BookMeetingModalPage implements OnInit {
this.modalController.dismiss();
// this.distartExpedientModal();
this.toastService.successMessage('Reunião criada');
this.toastService._successMessage('Reunião criada');
} catch (error) {
this.toastService.badRequest('Reunião não criada')
this.toastService._badRequest('Reunião não criada')
}
finally {
loader.remove()
@@ -300,10 +300,10 @@ export class BookMeetingModalPage implements OnInit {
break;
}
this.close();
this.toastService.successMessage('Reunião criada');
this.toastService._successMessage('Reunião criada');
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -328,11 +328,11 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado');
await this.toastService._successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -362,11 +362,11 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postParecer(this.postData).toPromise();
await this.toastService.successMessage('Pedido enviado');
await this.toastService._successMessage('Pedido enviado');
this.modalController.dismiss(action_parecer);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -394,10 +394,10 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
this.toastService.successMessage('Processo efetuado');
this.toastService._successMessage('Processo efetuado');
this.modalController.dismiss(action_deferimento);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -436,18 +436,18 @@ export class ExpedientTaskModalPage implements OnInit {
if(this.postData.DispatchFolder.Message){
try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.toastService.successMessage('Processo efetuado');
await this.toastService._successMessage('Processo efetuado');
this.modalController.dismiss(action_despacho_pr);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
//loader.remove()
}
}
else{
this.validateField = true;
this.toastService.badRequest('Por favor adicione uma descrição');
this.toastService._badRequest('Por favor adicione uma descrição');
}
loader.remove();
break;
@@ -474,11 +474,11 @@ export class ExpedientTaskModalPage implements OnInit {
try {
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService.successMessage('Pedido enviado');
await this.toastService._successMessage('Pedido enviado');
this.modalController.dismiss(action_parecer_pr);
} catch (error) {
await this.toastService.badRequest('Processo não efetuado')
await this.toastService._badRequest('Processo não efetuado')
} finally {
loader.remove()
}
@@ -111,7 +111,7 @@
<div *ngIf="task && p.userRole(['PR'])" class="aside-right flex-column height-100 overflow-y-auto">
<div class="buttons">
<!-- <div class="buttons">
<button (click)="openExpedientActionsModal('0', fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button (click)="distartExpedientModal('descartar')" class="btn-cancel" shape="round" >Descartar</button>
<div class="solid"></div>
@@ -121,8 +121,7 @@
<button (click)="openNewGroupPage(task)" class="btn-cancel" shape="round" >Iniciar Conversa</button>
<div hidden class="solid"></div>
<button hidden class="btn-cancel" shape="round" >Delegar</button>
</div>
</div> -->
</div>
@@ -171,9 +171,9 @@ export class ExpedienteDetailPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
this.close();
this.toastService.successMessage('Processo aprovado')
this.toastService._successMessage('Processo aprovado')
} catch (error) {
this.toastService.badRequest('Processo não aprovado')
this.toastService._badRequest('Processo não aprovado')
} finally {
loader.remove()
}
@@ -196,9 +196,9 @@ export class ExpedienteDetailPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
this.toastService._successMessage()
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -293,11 +293,11 @@ export class ExpedienteDetailPage implements OnInit {
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
console.log(res);
this.toastService.successMessage('Processo enviado para pendentes')
this.toastService._successMessage('Processo enviado para pendentes')
this.goBack();
},
(error) => {
this.toastService.badRequest('Processo não enviado para pendentes')
this.toastService._badRequest('Processo não enviado para pendentes')
});
}
@@ -349,12 +349,12 @@ export class ExpedienteDetailPage implements OnInit {
this.getFromDB();
} else {
try {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
this.goBack()
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -441,9 +441,9 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
this.attachmentsService.AddAttachment(body).subscribe((res) => {
this.toastService.successMessage()
this.toastService._successMessage()
}, () => {
this.toastService.badRequest()
this.toastService._badRequest()
}, () => {
loader.remove()
});
@@ -479,7 +479,7 @@ export class ExpedienteDetailPage implements OnInit {
await this.processes.CompleteTask(body).toPromise();
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -510,10 +510,10 @@ export class ExpedienteDetailPage implements OnInit {
try {
await this.expedienteService.discard({ SerialNumber: this.task.SerialNumber }).toPromise()
this.toastService.successMessage('Processo descartado');
this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -529,10 +529,10 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.expedienteService.CompleteTask(body).toPromise();
//this.toastService.successMessage('Processo descartado');
//this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -543,10 +543,10 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -8,7 +8,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { Platform } from '@ionic/angular';
import { BackgroundService } from '../../../services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
@Component({
selector: 'app-expediente',
@@ -38,7 +38,8 @@ export class ExpedientePage implements OnInit {
public platform: Platform,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private sortService: SortService,
) { }
ngOnInit() {
@@ -70,7 +71,7 @@ export class ExpedientePage implements OnInit {
const result = res
this.taskslist = new Array();
let ress = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
let ress = result.filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
ress.forEach((element: any) => {
@@ -78,7 +79,7 @@ export class ExpedientePage implements OnInit {
this.taskslist.push(task);
this.addProcessTODb(task);
});
this.listToPresent = this.taskslist
this.listToPresent = this.sortService.sortDate(this.taskslist, 'taskStartDate')
console.log('expediente list', this.listToPresent)
this.skeletonLoader = false;
@@ -135,11 +135,11 @@ export class ExpedientePrPage implements OnInit {
sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
console.log(res);
this.toastService.successMessage('Processo enviado para pendentes')
this.toastService._successMessage('Processo enviado para pendentes')
this.goBack();
},
(error)=>{
this.toastService.badRequest('Processo não enviado para pendentes')
this.toastService._badRequest('Processo não enviado para pendentes')
});
}
@@ -184,15 +184,15 @@ export class ExpedientePrPage implements OnInit {
}, (error)=>{
try {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
this.goBack()
} catch (e) {
window.history.back();
} finally {
if(error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
}
});
@@ -303,9 +303,9 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
this.close();
this.toastService.successMessage('Processo aprovado')
this.toastService._successMessage('Processo aprovado')
} catch(error) {
this.toastService.badRequest('Processo não aprovado')
this.toastService._badRequest('Processo não aprovado')
} finally {
loader.remove()
}
@@ -328,9 +328,9 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.close();
this.toastService.successMessage()
this.toastService._successMessage()
} catch(error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -448,10 +448,10 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(otherbody).toPromise()
this.toastService.successMessage('Processo descartado');
this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -468,10 +468,10 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise();
// this.toastService.successMessage('Processo descartado');
// this.toastService._successMessage('Processo descartado');
this.goBack();
} catch (error) {
// this.toastService.badRequest('Processo não descartado')
// this.toastService._badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -485,10 +485,10 @@ export class ExpedientePrPage implements OnInit {
try {
await this.processes.UpdateTaskStatus(this.task.FolderId).toPromise();
this.toastService.successMessage();
this.toastService._successMessage();
this.goBack();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -12,7 +12,7 @@ import { Location } from '@angular/common'
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
@Component({
selector: 'app-expedientes-pr',
@@ -41,7 +41,8 @@ export class ExpedientesPrPage implements OnInit {
private authService: AuthService,
private router: Router,
private location: Location,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private sortService: SortService,
) {
this.loggeduser = authService.ValidatedUser;
}
@@ -80,6 +81,8 @@ export class ExpedientesPrPage implements OnInit {
this.taskslist.push(task);
});
console.log(this.taskslist);
this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate')
this.expedienteGdStore.reset(this.taskslist);
this.skeletonLoader = false
})
@@ -181,7 +181,7 @@
<!-- <div *ngIf="p.userRole(['MDGPR'])" (click)="openExpedientesPrPage(); selectedElement='ExpedientesPr'" [class.active]="selectedElement == 'ExpedientesPr'" class="exp-card-long justify-center width-100 white-background">
<div class="center-div">
<div class="center-div">F
<div class="exp-card-icon">
<ion-icon src="assets/images/icons-expediente-presidente.svg"></ion-icon>
</div>
@@ -29,6 +29,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { SqliteService } from '../../services/sqlite.service';
import { Platform } from '@ionic/angular';
import { BackgroundService } from 'src/app/services/background.service';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({
selector: 'app-gabinete-digital',
@@ -130,7 +131,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
private platform: Platform,
private changeProfileService: ChangeProfileService,
private backgroundservice: BackgroundService,
public ThemeService: ThemeService
public ThemeService: ThemeService,
private sortService: SortService,
) {
this.loggeduser = authService.ValidatedUser;
@@ -146,10 +148,6 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
};
this.checkRoutes();
// this.eventoaprovacaostore.resetmd([])
// this.eventoaprovacaostore.resetpr([])
}
ngDoCheck(): void {
@@ -209,63 +207,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
}
async loadAllProcesses() {
this.processesbackend.GetTasksList("", false).subscribe(async res => {
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
if (!this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
} else if (this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
}
console.log('allProcessesList', allProcessesList);
this.addProcessToDB(allProcessesList)
this.skeletonLoader = true;
this.allProcessesList = [];
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender,
//"CreateDate": taskDate,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId,
"FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status,
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
});
}, (error) => {
console.log('gabinete digital offline', error)
this.getAllProcessFromDB();
})
this.skeletonLoader = false;
this.LoadCounts();
}
addProcessToDB(data) {
@@ -329,7 +271,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
console.log("All process from db ", allprocess)
@@ -344,21 +286,18 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
setFormatDate(start: any, end: any, allday: boolean) {
let customDate;
/* start = new Date();
end= new Date("2021-08-04T18:01:04.753Z"); */
//end = new Date("2021-09-04T18:01:04.753Z");
const totalSeconds = Math.floor((end - (start)) / 1000);;
const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - (totalDays * 24);
const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
//const hours = totalHours - (totalDays * 24);
//const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
// const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
let diffDays = totalDays;
let diffMinutes = minutes;
// let diffDays = totalDays;
// let diffMinutes = minutes;
if (totalDays == 0) {
if (allday) {
@@ -384,6 +323,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
(thedate.getMonth() + 1) + "/" +
thedate.getFullYear();
}
getCustomHours(thedate: Date) {
return thedate.getHours() + ":" +
thedate.getMinutes();
@@ -550,8 +490,49 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.showLoader = true;
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
let count_all_processes = Object.keys(allPreocesses_).length;
let allProcessesList = allPreocesses_;
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento')
if (!this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
} else if (this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
}
this.addProcessToDB(allProcessesList)
this.skeletonLoader = true;
this.allProcessesList = [];
allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = {
"SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender,
//"CreateDate": taskDate,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DispatchDocId,
"FolderID": element.workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": element.workflowInstanceDataFields.Status,
"Agenda": element.workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList);
this.allProcessesList = this.sortService.sortDate(this.allProcessesList, 'CreateDate')
});
let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise();
expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")
@@ -581,6 +562,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let despachospr = await this.processesbackend.GetTasksList("Despacho do Presidente da República", false).toPromise();
let despachosPr;
switch (this.loggeduser.Profile) {
case 'MDGPR':
despachosPr = despachospr.filter(data => data.activityInstanceName == "Tarefa de Despacho").filter(data => data.workflowInstanceDataFields.Status == "Active");
@@ -594,23 +576,18 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
break;
}
let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
const eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventoaprovacaostore.countMd = eventsMDGPRList.length
this.eventoaprovacaostore.resetmd(eventsMDGPRList);
let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processesbackend.GetTasksList('Agenda Pessoal PR', false).toPromise();
const eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventoaprovacaostore.countPr = eventsPRList.length
this.eventoaprovacaostore.resetpr(eventsPRList);
let diplomasValidar = despachospr.filter(data => data.activityInstanceName == "Revisar Diploma");
this.count_dip_pv = Object.keys(diplomasValidar).length;
this.deplomasStore.resetDiplomasReview(diplomasValidar)
@@ -618,8 +595,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let diplomasAssinar = despachospr.filter(data => data.activityInstanceName == "Assinar Diploma");
this.count_dip_as = Object.keys(diplomasAssinar).length;
this.deplomasStore.resetDiplomasList(diplomasAssinar)
this.deplomasStore.resetDiplomasList(diplomasAssinar)
let diplomasAssinados = despachospr.filter(data => data.activityInstanceName == "Diploma Assinado");
this.count_dip_as_pr = Object.keys(diplomasAssinados).length;
@@ -639,22 +616,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
doRefresh(event) {
console.log(event);
// this.closeAllDesktopComponents();
/* switch(this.loggeduser.Profile){
case 'MDGPR':
this.selectedElement='Correspondence';
this.showExpedients = true;
this.expedientesPage.doRefresh();
break;
case 'PR':
this.selectedElement='ExpedientesPr';
this.showExpedientesPr = true;
break;
} */
this.LoadCounts();
this.loadAllProcesses();
//this.refreshExpedientes();
this.LoadCounts();
if (event) {
setTimeout(() => {
@@ -185,7 +185,7 @@ export class PedidoPage implements OnInit {
} catch (e) {
window.history.back();
}
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
}
});
@@ -373,10 +373,10 @@ export class PedidoPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage()
this.toastService._successMessage()
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -393,10 +393,10 @@ export class PedidoPage implements OnInit {
note
}).toPromise()
this.toastService.successMessage('Processo arquivado')
this.toastService._successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -418,10 +418,10 @@ export class PedidoPage implements OnInit {
try {
await this.processes.CompleteTask(body).toPromise()
this.toastService.successMessage('Processo arquivado')
this.toastService._successMessage('Processo arquivado')
this.close();
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
@@ -433,7 +433,7 @@ export class PedidoPage implements OnInit {
this.goBack();
}, () => {
this.toastService.badRequest('Processo não encontrado')
this.toastService._badRequest('Processo não encontrado')
});
}
@@ -567,7 +567,15 @@ export class PedidoPage implements OnInit {
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
modal.onDidDismiss().then(res => {
if(res){
const data = res.data;
if(data == 'close') {
this.goBack();
}
}
});
}
async openForwardModal(task: any) {
@@ -120,7 +120,7 @@
<div [ngSwitch]="segment">
<div *ngSwitchCase="'parecer'" class="centered-div d-flex height-100 align-center justify-content-center" >
<div
*ngIf="!skeletonLoader && pedidosstorage.listparecer.length == 0"
*ngIf="pedidosstorage.listparecer.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
@@ -129,7 +129,7 @@
<div *ngSwitchCase="'deferimento'" class="centered-div d-flex height-100 align-center justify-content-center">
<div
*ngIf="!skeletonLoader && pedidosstorage.listdeferimento.length == 0"
*ngIf="pedidosstorage.listdeferimento.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
@@ -163,7 +163,9 @@ export class PedidosPage implements OnInit {
this.parecerList.push(task);
});
this.addPedidoToDb(this.parecerList);
this.listToPresentparecerList = this.sortService.sortArrayISODate(this.parecerList);
this.listToPresentparecerList = this.sortService.sortDate(this.parecerList, 'CreateDate')
this.pedidosstorage.resetparecer(this.listToPresentparecerList);
}
else if (this.segment == 'deferimento') {
@@ -203,7 +205,9 @@ export class PedidosPage implements OnInit {
});
});
this.addPedidoToDb(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortDate(this.deferimentoList, 'CreateDate')
this.pedidosstorage.resetdeferimento(this.listToPresentdeferimentoList);
}
@@ -102,7 +102,7 @@ export class PendentesPage implements OnInit {
});
pendentesList = removeDuplicate(pendentesList)
pendentesList = this.sortService.sortArrayISODate(pendentesList);
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate');
this.listToPresent = pendentesList;
this.skeletonLoader = false;
@@ -138,7 +138,7 @@ export class PendentesPage implements OnInit {
}
});
pendingList = pendingList;
pendingList = this.sortService.sortDate(pendingList, 'CreateDate');
this.listToPresent = pendingList;
console.log('pendentes', pendingList)
@@ -7,7 +7,9 @@
<div class="div-top-header">
<div class="div-logo">
<img src='assets/images/logo-bg-removebg-preview.png' alt='logo'>
<img style="max-width: 90px;" *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/logo-bg-removebg-preview.png' alt='logo'>
<img style="max-width: 80px;" *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img style="max-width: 90px;" *ngIf="ThemeService.currentTheme == 'tribunal'" src='assets/images/theme/tribunal/tribunal-constitucional-logo-removebg-preview.png' alt='logo'>
</div>
</div>
@@ -42,11 +44,11 @@
</div>
<div *ngIf="SessionStore.hasPin" class="voltar d-flex align-center justify-center pt-25 clear" (click)="enterWithPasswordButton()" >
<div *ngIf="SessionStore.hasPin" class="voltar cursor-pointer d-flex align-center justify-center pt-25 clear" (click)="enterWithPasswordButton()" >
Entrar com senha
</div>
<div id="clear" class="cy-clear voltar d-flex align-center justify-center pt-25 clear" (click)="clearCode()">
<div id="clear" class="cy-clear voltar cursor-pointer d-flex align-center justify-center pt-25 clear" (click)="clearCode()">
Limpar
</div>
@@ -9,12 +9,11 @@ ion-content{
}
.main-wrapper{
background: var(--login-background);
background: var(--PinBackground);
display: flex;
width: 100vw;
height: 100vh;
overflow: auto;
background: white !important;
display: flex;
align-items: center;
justify-content: center;
@@ -142,7 +141,7 @@ ion-item{
align-items: center;
justify-content: center;
font-size: 19pt;
background: #44b5ea;
background: var(--PinDots);;
border-radius: 56px;
margin-bottom: 15px;
user-select: none;
@@ -163,7 +162,7 @@ ion-item{
justify-content: center;
display: flex;
flex-direction: column;
background-image: url(/assets/background/auth.svg);
background-image: var(--PinCircleBackground);
background-position: center;
background-repeat: no-repeat;
width: 100%;
@@ -172,19 +171,20 @@ ion-item{
}
.clear{
color: #44b5ea;
color: var(--PinTextColor);
font-size: 12pt;
z-index: 1000;
}
.dot-active{
background: #44b5ea;
background: var(--PinDots);
}
.dot{
width: 25px;
height: 25px;
margin: 0 10px 0 0;
border: 3px solid #44b5ea;
border: 3px solid var(--PinDots);
box-sizing: border-box;
border-radius: 50px;
-webkit-border-radius: 50px;
+8 -7
View File
@@ -7,7 +7,7 @@ import { environment } from 'src/environments/environment';
import { AlertController } from '@ionic/angular';
import { NotificationsService } from 'src/app/services/notifications.service';
import { SessionStore } from 'src/app/store/session.service';
import { ThemeService } from 'src/app/services/theme.service';
@Component({
selector: 'app-inactivity',
@@ -29,7 +29,8 @@ export class InactivityPage implements OnInit {
private router: Router,
private authService: AuthService,
private toastService: ToastService,
public alertController: AlertController
public alertController: AlertController,
public ThemeService: ThemeService,
) {}
loop = false
@@ -132,11 +133,11 @@ export class InactivityPage implements OnInit {
}
}
else {
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
this.toastService._badRequest('Por favor, insira a sua palavra-passe');
}
}
else {
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
this.toastService._badRequest('Por favor, insira o seu nome de utilizador');
}
}
@@ -182,7 +183,7 @@ export class InactivityPage implements OnInit {
}, 1000)
} else {
this.toastService.badRequest('Pin incorreto')
this.toastService._badRequest('Pin incorreto')
this.code = []
}
@@ -191,9 +192,9 @@ export class InactivityPage implements OnInit {
goback() {
const pathName = this.SessionStore.user.UrlBeforeInactivity
if(pathName) {
this.router.navigate([pathName]);
this.router.navigate([pathName],{replaceUrl: true});
} else {
this.router.navigate(['/home/events']);
this.router.navigate(['/home/events'], {replaceUrl: true});
}
}
+4 -5
View File
@@ -10,7 +10,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { ClearStoreService } from 'src/app/services/clear-store.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { ThemeService } from 'src/app/services/theme.service';
import { StorageService } from 'src/app/services/storage.service'
import { StorageService } from 'src/app/services/storage.service';
@Component({
selector: 'app-login',
@@ -39,7 +39,7 @@ export class LoginPage implements OnInit {
private clearStoreService: ClearStoreService,
private changeProfileService: ChangeProfileService,
public ThemeService: ThemeService,
private storageservice: StorageService
private storageservice: StorageService,
) {}
ngOnInit() {
@@ -123,15 +123,14 @@ export class LoginPage implements OnInit {
}
}
else {
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
this.toastService._badRequest('Por favor, insira a sua palavra-passe');
}
}
else {
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
this.toastService._badRequest('Por favor, insira o seu nome de utilizador');
}
}
goback() {
const pathName = SessionStore.user.UrlBeforeInactivity
if(pathName) {
@@ -104,9 +104,9 @@ export class EditActionPage implements OnInit {
await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close();
this.updateDesktopComponent.emit();
this.toastService.successMessage('Acção presidencial atualizada')
this.toastService._successMessage('Acção presidencial atualizada')
} catch (error) {
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
this.toastService._badRequest('Não foi possivel atualizar a acção presidencial')
} finally {
loader.remove()
}
@@ -1,5 +1,4 @@
<ion-content>
<div class="content-container d-flex flex-column">
<div class="title-content width-100">
@@ -23,12 +22,19 @@
</div>
</div>
</div>
<div *ngIf="capturedImage != '' " class="ion-item-container-no-border">
<ion-label class="attached-title">Fotografia Anexada </ion-label>
<ion-item lines="none">
<ion-thumbnail slot="start">
<ion-img [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage"></ion-img>
<ion-img [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" (click)="imageSize(capturedImage)" ></ion-img>
<ion-row>
<ion-col>
<img src="" #imageElement/>
</ion-col>
</ion-row>
</ion-thumbnail>
<ion-label>
<p>{{capturedImageTitle}}</p>
@@ -68,8 +74,8 @@
</ion-label>
</div>
<div class="ion-item-container-no-border">
<ion-label (click)="laodPicture()" class="cursor-pointer">
<!-- <div class="ion-item-container-no-border">
<ion-label (click)="selectImage()" class="cursor-pointer">
<div class="attach-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-add-photos.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-add-photos.svg"></ion-icon>
@@ -77,15 +83,14 @@
<div class="attach-document cursor-pointer">
<ion-label>Anexar Fotografia</ion-label>
</div>
</ion-label>
</div>
</ion-label>
</div> -->
</div>
</div>
</ion-content>
<ion-footer class="ion-no-border">
<ion-toolbar class="footer-toolbar">
<ion-buttons slot="start">
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import { ModalController, NavParams, Platform, LoadingController } from '@ionic/angular';
/* import {Plugins, CameraResultType, CameraSource} from '@capacitor/core'; */
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
@@ -16,14 +16,25 @@ import { formatDate } from 'src/plugin/momentG.js'
import { FileLoaderService } from 'src/app/services/file/file-loader.service';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { ThemeService } from 'src/app/services/theme.service';
import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress";
import { SocialSharing } from '@ionic-native/social-sharing/ngx';
const IMAGE_DIR = 'stored-images';
interface LocalFile {
name: string;
path: string;
data: string;
}
@Component({
selector: 'app-new-publication',
templateUrl: './new-publication.page.html',
styleUrls: ['./new-publication.page.scss'],
})
export class NewPublicationPage implements OnInit {
images: LocalFile[] = [];
// date picker
public date: any;
@@ -32,7 +43,7 @@ export class NewPublicationPage implements OnInit {
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public minDate = new Date().toISOString().slice(0,10)
public minDate = new Date().toISOString().slice(0, 10)
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
public stepHour = 1;
public stepMinute = 5;
@@ -48,20 +59,23 @@ export class NewPublicationPage implements OnInit {
folderId: string;
image: Image = new Image();
publicationType:string;
publicationTitle:string;
imgUrl:any;
publicationType: string;
publicationTitle: string;
imgUrl: any;
Defaultimage:any = '';
Defaultimage: any = '';
photo: SafeResourceUrl;
guestPicture:any;
guestPicture: any;
capturedImage:any = '';
capturedImageTitle:any;
capturedImage: any = '';
capturedImageTitle: any;
public photos: any[] = [];
imgResultBeforeCompress: string;
imgResultAfterCompress: string;
constructor(
private modalController: ModalController,
public photoService: PhotoService,
@@ -70,49 +84,64 @@ export class NewPublicationPage implements OnInit {
private toastService: ToastService,
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service,
public ThemeService: ThemeService
) {
public ThemeService: ThemeService,
private platform: Platform,
private loadingCtrl: LoadingController,
public imageCompress: NgxImageCompressService,
private socialSharing: SocialSharing
) {
this.publicationType = this.navParams.get('publicationType');
this.folderId = this.navParams.get('folderId');
this.publicationTitle = 'Nova Publicação';
}
this.publicationType = this.navParams.get('publicationType');
this.folderId = this.navParams.get('folderId');
this.publicationTitle = 'Nova Publicação';
}
ngOnInit() {
this.setTitle();
console.log(this.folderId);
Filesystem.mkdir({
path: IMAGE_DIR,
directory: Directory.Data,
recursive: true
});
// this.takePicture();
}
async takePicture() {
const capturedImage = await Camera.getPhoto({
quality: 90,
// allowEditing: true,
resultType: CameraResultType.Uri,
source: CameraSource.Camera
async takePicture() {
const image = await Camera.getPhoto({
quality: 20,
allowEditing: false,
width:50,
height: 50,
resultType: CameraResultType.Uri,
source: CameraSource.Camera // Camera, Photos or Prompt!
});
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';
if (image) {
this.saveImage(image)
}
//console.log(this.capturedImage);
}
imageSize(image) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width = 100
canvas.height = 34
ctx.drawImage(image, 0, 0, 100, 34);
document.body.appendChild(canvas);
}
convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
resolve(reader.result);
};
reader.readAsDataURL(blob);
});
@@ -121,7 +150,7 @@ async takePicture() {
async laodPicture() {
const capturedImage = await Camera.getPhoto({
resultType: CameraResultType.Uri,
source: CameraSource.Photos,
source: CameraSource.Camera,
quality: 90,
width: 1080,
height: 720,
@@ -159,7 +188,7 @@ async takePicture() {
runValidation() {
this.validateFrom = true
this.validateFrom = true
}
injectValidation() {
@@ -185,18 +214,18 @@ async takePicture() {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if (this.Form.invalid) return false
if(this.publicationType == '3') {
if (this.publicationType == '3') {
console.log(this.navParams.get('publication'));
if(this.capturedImage != ''){
if (this.capturedImage != '') {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
DocumentId: this.publication.DocumentId,
ProcessId: this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
@@ -225,8 +254,8 @@ async takePicture() {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
DocumentId: this.publication.DocumentId,
ProcessId: this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
@@ -247,15 +276,15 @@ async takePicture() {
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
} finally {
loader.remove()
}
} else {
} else {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
DocumentId: this.publication.DocumentId,
ProcessId: this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
@@ -275,7 +304,7 @@ async takePicture() {
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
} finally {
loader.remove()
}
@@ -283,15 +312,15 @@ async takePicture() {
}
else {
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
const date = formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
console.log(date);
console.log(this.folderId);
this.publication = {
DateIndex: date,
DocumentId:null,
ProcessId:this.folderId,
DocumentId: null,
ProcessId: this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: date,
@@ -312,7 +341,7 @@ async takePicture() {
this.close();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
} finally {
loader.remove()
}
@@ -321,8 +350,8 @@ async takePicture() {
close() {
this.modalController.dismiss().then(()=>{
this.showLoader=true;
this.modalController.dismiss().then(() => {
this.showLoader = true;
});
}
@@ -331,13 +360,13 @@ async takePicture() {
}
setTitle() {
if(this.publicationType == '1') {
if (this.publicationType == '1') {
this.publicationTitle = 'Nova Publicação Rápida';
}
else if(this.publicationType == '2') {
else if (this.publicationType == '2') {
this.publicationTitle = 'Nova Publicação';
}
else if(this.publicationType == '3') {
else if (this.publicationType == '3') {
this.publicationTitle = 'Editar Publicação';
this.pub = this.navParams.get('publication');
@@ -357,16 +386,156 @@ async takePicture() {
modal.onDidDismiss();
} */
/* async takePicture(){
const image = await Plugins.Camera.getPhoto({
quality: 100,
allowEditing: false,
resultType: CameraResultType.DataUrl,
source: CameraSource.Camera
});
console.log(image);
/* async takePicture(){
const image = await Plugins.Camera.getPhoto({
quality: 100,
allowEditing: false,
resultType: CameraResultType.DataUrl,
source: CameraSource.Camera
});
console.log(image);
this.photo = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl));
} */
async selectImage() {
const image = await Camera.getPhoto({
quality: 20,
allowEditing: false,
resultType: CameraResultType.Uri,
source: CameraSource.Camera // Camera, Photos or Prompt!
});
if (image) {
this.saveImage(image)
}
}
// Create a new file from a capture image
async saveImage(photo: Photo) {
const base64Data = await this.readAsBase64(photo);
const fileName = new Date().getTime() + '.jpeg';
const savedFile = await Filesystem.writeFile({
path: `${IMAGE_DIR}/${fileName}`,
data: base64Data,
directory: Directory.Data
});
//this.loadFiles(fileName);
this.loadFileData(fileName);
}
private async readAsBase64(photo: Photo) {
if (this.platform.is('hybrid')) {
const file = await Filesystem.readFile({
path: photo.path
});
return file.data;
}
else {
// Fetch the photo, read as a blob, then convert to base64 format
const response = await fetch(photo.webPath);
const blob = await response.blob();
return await this.convertBlobToBase64(blob) as string;
}
}
async loadFiles(fileName) {
this.images = [];
const loading = await this.loadingCtrl.create({
message: 'Loading data...',
});
await loading.present();
/* Filesystem.readdir({
path: `${IMAGE_DIR}/${fileName}`,
directory: Directory.Data,
}).then(result => {
console.log('ALL RESULTS', result.files)
let lastphoto = result.files[result.files.length - 1]
this.loadFileData(lastphoto);
},
async (err) => {
console.log('ERROR FILE DOSENT EXIST', err)
// Folder does not yet exists!
await Filesystem.mkdir({
path: IMAGE_DIR,
directory: Directory.Data,
recursive: true
});
}
).then(_ => {
loading.dismiss();
}); */
}
async loadFileData(fileName: string) {
console.log('ALL PHOTOT FILE', fileName)
const loading = await this.loadingCtrl.create({
message: 'Loading data...',
});
await loading.present();
const filePath = `${IMAGE_DIR}/${fileName}`;
const readFile = await Filesystem.readFile({
path: filePath,
directory: Directory.Data,
});
this.images.push({
name: fileName,
path: filePath,
data: `data:image/jpeg;base64,${readFile.data}`,
});
console.log('ALL IMAGE', this.images)
this.capturedImage = this.images[0].data
this.compressFile();
loading.dismiss();
}
/* compressImage() {
let image = this.capturedImage;
this.imageCompress.compressFile(image, orientation, 50, 50,).then(() => {
this.imgResultBeforeCompress = image;
console.log('Size in bytes was:', this.imageCompress.byteCount(image));
this.imageCompress.compressFile(image, orientation, 50, 50).then(
result => {
this.imgResultAfterCompress = result;
console.log('Size in bytes is now:', this.imageCompress.byteCount(result));
}
);
})
} */
compressFile() {
//this.imgResultBeforeCompress = image;
this.imageCompress.getOrientation(this.capturedImage).then((orientation) => {
console.log('Size in bytes was:', this.imageCompress.byteCount(this.capturedImage));
this.imageCompress.compressFile(this.capturedImage, orientation, 20, 20).then(
result => {
this.capturedImage = result;
console.log('Size in bytes is now:', this.imageCompress.byteCount(result));
}
);
});
}
this.photo = this.sanitizer.bypassSecurityTrustResourceUrl(image && (image.dataUrl));
} */
}
@@ -0,0 +1,4 @@
export interface Photos {
filepath: string;
webviewPath: string;
}
@@ -15,6 +15,7 @@ import { PublicationDetailPageModule } from 'src/app/shared/publication/view-pub
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { EditActionPageModule } from 'src/app/shared/publication/edit-action/edit-action.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it
@NgModule({
imports: [
@@ -29,6 +30,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
PublicationDetailPageModule,
NewActionPageModule,
EditActionPageModule,
LazyLoadImageModule
],
declarations: [
PublicationsPage,
@@ -66,7 +66,7 @@
<ion-item-option class="edit-option" (click)="editAction(viagem.ProcessId)">
<button class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="edit" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/cons-edit.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="edit" slot="end" src="assets/images/theme/gov/icons-edit.svg" ></ion-icon>
</button>
</ion-item-option>
@@ -77,7 +77,6 @@
</ion-item-option>
</ion-item-options>
</ion-item-sliding>
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100"
*ngFor="let evento of publicationsEventFolderList">
<ion-item lines="none"
@@ -17,6 +17,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
@Component({
selector: 'app-publications',
templateUrl: './publications.page.html',
@@ -68,7 +69,8 @@ export class PublicationsPage implements OnInit {
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService,
private platform: Platform,
public ThemeService: ThemeService
public ThemeService: ThemeService,
) {
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"];
@@ -91,6 +93,8 @@ export class PublicationsPage implements OnInit {
}
hideRefreshButton() {
window.onresize = (event) => {
if (window.innerWidth < 801) {
@@ -238,9 +242,9 @@ export class PublicationsPage implements OnInit {
try {
await this.publications.DeletePresidentialAction(id).toPromise();
this.toastService.successMessage()
this.toastService._successMessage()
} catch (e) {
this.toastService.badRequest()
this.toastService._badRequest()
}
finally {
loader.remove()
@@ -452,4 +456,10 @@ export class PublicationsPage implements OnInit {
});
}
// this.crop.crop('path/to/image.jpg', {quality: 75})
// .then(
// newImage => console.log('new image path is: ' + newImage),
// error => console.error('Error cropping image', error)
// );
}
@@ -24,7 +24,7 @@
<div class="post-item overflow-y-auto">
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img src="{{publication.FileBase64}}" alt="image" tappable (click)="openPreview(publication.FileBase64)">
<img src="{{publication.FileBase64}}" alt="image" >
</div>
<div *ngIf="publication.FileBase64.length < 30" class="post-img">
<img src="/assets/icon/icon-no-image.svg" alt="image">
@@ -10,6 +10,9 @@ import { ViewPublicationsPage } from './view-publications.page';
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { LazyLoadImageModule } from 'ng-lazyload-image'; // <-- import it
@NgModule({
imports: [
CommonModule,
@@ -18,6 +21,7 @@ import { HeaderPageModule } from 'src/app/shared/header/header.module';
ViewPublicationsPageRoutingModule,
HeaderPageModule,
LazyLoadImageModule
],
exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage]
@@ -34,12 +34,12 @@
<div class="main-container background-white height-100 overflow-y-auto">
<ion-list>
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" -->
<div class="post-item"
<div class="post-item cursor-pointer"
*ngFor="let publication of getpublication"
(click)="goToPublicationDetail(publication.DocumentId)"
>
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img src="{{publication.FileBase64}}" alt="image">
<ion-img src="{{publication.FileBase64}}" alt="image"></ion-img>
</div>
<div *ngIf="publication.FileBase64.length < 30" class="post-img">
<img src="/assets/icon/icon-no-image.svg" alt="image">
@@ -126,7 +126,7 @@
}
.post-img{
width: 100%;
//height: 400px;
height: 400px;
margin: 0 auto;
border-radius: 0px!important;
overflow: hidden;
@@ -13,6 +13,7 @@ import { PublicationDetailPage } from './publication-detail/publication-detail.p
import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'
import { forkJoin } from 'rxjs';
@Component({
selector: 'app-view-publications',
@@ -25,7 +26,9 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[] = new Array();
item: PublicationFolder;
defaultImage = "https://governo.gov.ao/ao/noticias/presidente-joao-lourenco-ouviu-a-voz-da-igreja/"
folderId: string;
id: string;
error: any;
publicationListStorage = PublicationListStorage
@@ -65,15 +68,15 @@ export class ViewPublicationsPage implements OnInit {
if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId']
}
this.testForkJoin()
this.getPublicationDetail();
setTimeout(() => {
this.getPublications();
}, 5000);
this.getPublicationsIds();
}, 1000);
this.backgroundservice.registerBackService('Online',() => {
this.backgroundservice.registerBackService('Online', () => {
this.getPublicationDetail();
this.getPublications();
this.testForkJoin()
})
@@ -85,14 +88,19 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId']
}
// if (typeof (this.id == 'object') {
// this.id = this.id['ProcessId']
// }
this.testForkJoin()
this.getPublicationDetail();
this.getPublications();
// this.getPublicationsIds();
}
doRefresh = (event) => {
setTimeout(() => {
this.testForkJoin()
this.getPublicationDetail();
this.getPublications();
// this.getPublicationsIds();
event.target.complete();
}, 3000);
@@ -110,50 +118,125 @@ export class ViewPublicationsPage implements OnInit {
getPublicationDetail() {
setTimeout(() => {
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
this.item = allActions.find((e) => e.ProcessId == this.folderId);
this.publicationDitails = this.item
console.log('item', this.item)
}, 100);
}
// goes to fork
// getPublicationsIds() {
// this.showLoader = true;
// const folderId = this.folderId
// this.publications.GetIdsPublicationsImages(this.id).subscribe(res => {
// console.log(this.id)
// this.publicationList = new Array();
getPublicationsIds() {
getPublications() {
this.showLoader = true;
const folderId = this.folderId
this.publications.GetPublications(this.folderId).subscribe(res => {
console.log(this.folderId)
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
console.log('publications ids', res)
this.publicationList = new Array();
for(let i of res) {
this.publications.GetPublicationById(i).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(item);
})
}
/* res.forEach(element => {
console.log('publications elements', element)
this.publications.GetPublicationById(element).subscribe(ress => {
console.log('publications by ids', ress)
let item: Publication = this.publicationPipe.itemList(ress)
console.log('publications by ids 2', item)
this.publicationList.push(ress);
})
}); */
res.forEach(element => {
console.log('getPublications', element)
let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item);
});
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList;
this.showLoader = false;
},
(error) => {
if(error.status == '0') {
this.getFromDB();
}
if (error.status == '404') {
this.error = 'Sem publicações disponíveis!';
this.publicationList = [];
this.publicationListStorage.add(folderId, this.publicationList)
}
this.showLoader = false;
/* this.publicationList = new Array();
res.forEach(element => {
console.log('getPublications', element)
let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item);
});
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList; */
});
}
getPublications() {
this.showLoader = true;
const folderId = this.folderId
this.publications.GetPublications(this.folderId).subscribe(res => {
console.log(this.folderId)
this.publicationList = new Array();
res.forEach(element => {
console.log('getPublications', element)
let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item);
console.log('getPublications 222', item)
});
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList;
this.showLoader = false;
}, (error) => {
if (error.status == '0') {
this.getFromDB();
}
if (error.status == '404') {
this.error = 'Sem publicações disponíveis!';
this.publicationList = [];
this.publicationListStorage.add(folderId, this.publicationList)
}
this.showLoader = false;
});
}
testForkJoin(){
forkJoin([
this.getPublicationsIds(),
this.getPublications(),
]).subscribe(allResults =>{
this.publicationList = allResults[2]
})
}
getFromDB() {
@@ -223,7 +306,7 @@ export class ViewPublicationsPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(() => {
this.getPublications();
this.getPublicationsIds();
});
}