mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix
This commit is contained in:
@@ -36,7 +36,6 @@
|
||||
"output": "./svg"
|
||||
},
|
||||
"src/manifest.webmanifest",
|
||||
"src/combined-sw.js",
|
||||
"src/firebase-messaging-sw.js"
|
||||
],
|
||||
"styles": [
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
// if ("serviceWorker" in navigator) {
|
||||
// navigator.serviceWorker
|
||||
// .register("./firebase-messaging-sw.js")
|
||||
// .then(function(registration) {
|
||||
// console.log("Registration successful, scope is:", registration.scope);
|
||||
// messaging.getToken({vapidKey: 'BEuyzkUKcx4FSs-6GaIz_si2oV5Ut7e5ZEtcrVvr5L_tMVWZtS1NTqdtQkih5QCt2FZKuRUxZIaLm5GaxI6nJEw', serviceWorkerRegistration : registration })
|
||||
// .then((currentToken) => {
|
||||
// if (currentToken) {
|
||||
// console.log('current token for client: ', currentToken);
|
||||
|
||||
// // Track the token -> client mapping, by sending to backend server
|
||||
// // show on the UI that permission is secured
|
||||
// } else {
|
||||
// console.log('No registration token available. Request permission to generate one.');
|
||||
|
||||
// // shows on the UI that permission is required
|
||||
// }
|
||||
// }).catch((err) => {
|
||||
// console.log('An error occurred while retrieving token. ', err);
|
||||
// // catch error while creating client token
|
||||
// });
|
||||
// })
|
||||
// .catch(function(err) {
|
||||
// console.log("Service worker registration failed, error:" , err );
|
||||
// });
|
||||
// }
|
||||
// Scripts for firebase and firebase messaging
|
||||
|
||||
|
||||
/* importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js');
|
||||
importScripts('https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js');
|
||||
|
||||
// Initialize the Firebase app in the service worker by passing the generated config
|
||||
var firebaseConfig = {
|
||||
apiKey: "AIzaSyAAdHmTFznCMerdT99nrewJgISRvtxPqoY",
|
||||
authDomain: "gabinete-digital-2020.firebaseapp.com",
|
||||
databaseURL: "https://gabinete-digital-2020.firebaseio.com",
|
||||
projectId: "gabinete-digital-2020",
|
||||
storageBucket: "gabinete-digital-2020.appspot.com",
|
||||
messagingSenderId: "800733765231",
|
||||
appId: "1:800733765231:web:28e7792ab150006513779a",
|
||||
measurementId: "G-8QN4BLZ8XK"
|
||||
};
|
||||
|
||||
firebase.initializeApp(firebaseConfig);
|
||||
|
||||
// Retrieve firebase messaging
|
||||
const messaging = firebase.messaging();
|
||||
|
||||
messaging.onBackgroundMessage(function(payload) {
|
||||
console.log('Received background message ', payload);
|
||||
|
||||
const notificationTitle = payload.notification.title;
|
||||
const notificationOptions = {
|
||||
body: payload.notification.body,
|
||||
};
|
||||
|
||||
self.registration.showNotification(notificationTitle,
|
||||
notificationOptions);
|
||||
}); */
|
||||
@@ -123,6 +123,14 @@ export class HomePage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
console.log('yes please')
|
||||
registration.active.postMessage(
|
||||
"Test message sent immediately after creation",
|
||||
);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
goto(url) {
|
||||
|
||||
+42
-45
@@ -54,61 +54,58 @@ models.register({
|
||||
|
||||
|
||||
// // acçoes
|
||||
// export class ActionModel extends models.Model{
|
||||
// static $tableName = ''
|
||||
export class ActionModel extends models.Model{
|
||||
static $tableName = 'ActionModel11'
|
||||
|
||||
// ProcessId = models.IntegerField({unique: true})
|
||||
// Description = models.CharField()
|
||||
// Detail = models.CharField()
|
||||
// DateBegin = models.CharField()
|
||||
// DateEnd = models.CharField()
|
||||
// ActionType = models.CharField()
|
||||
ProcessId = models.IntegerField({unique: true})
|
||||
Description = models.CharField()
|
||||
Detail = models.CharField()
|
||||
DateBegin = models.CharField()
|
||||
DateEnd = models.CharField()
|
||||
ActionType = models.CharField()
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// export class PublicationFolderModel extends models.Model{
|
||||
// static $tableName = ''
|
||||
export class PublicationFolderModel extends models.Model{
|
||||
|
||||
// DateBegin = models.CharField()
|
||||
// Description = models.CharField()
|
||||
// Detail = models.CharField()
|
||||
// }
|
||||
DateBegin = models.CharField()
|
||||
Description = models.CharField()
|
||||
Detail = models.CharField()
|
||||
}
|
||||
|
||||
// export class PublicationDetailsModel extends models.Model{
|
||||
// static $tableName = ''
|
||||
export class PublicationDetailsModel extends models.Model{
|
||||
|
||||
// DateIndex = models.CharField()
|
||||
// DocumentId = models.IntegerField({unique: true})
|
||||
// ProcessId = models.CharField()
|
||||
// Title = models.CharField()
|
||||
// Message = models.CharField()
|
||||
// DatePublication = models.CharField()
|
||||
// OriginalFileName = models.CharField()
|
||||
// FileBase64 = models.CharField()
|
||||
// FileExtension = models.CharField()
|
||||
// OrganicEntityId = models.IntegerField()
|
||||
// }
|
||||
DateIndex = models.CharField()
|
||||
DocumentId = models.IntegerField({unique: true})
|
||||
ProcessId = models.CharField()
|
||||
Title = models.CharField()
|
||||
Message = models.CharField()
|
||||
DatePublication = models.CharField()
|
||||
OriginalFileName = models.CharField()
|
||||
FileBase64 = models.CharField()
|
||||
FileExtension = models.CharField()
|
||||
OrganicEntityId = models.IntegerField()
|
||||
}
|
||||
|
||||
|
||||
// export class WebtrixUserModel extends models.Model {
|
||||
// static $tableName = ''
|
||||
export class WebtrixUserModel extends models.Model {
|
||||
|
||||
// FullName = models.CharField()
|
||||
// Role = models.CharField()
|
||||
// }
|
||||
FullName = models.CharField()
|
||||
Role = models.CharField()
|
||||
}
|
||||
|
||||
// models.register({
|
||||
// databaseName: 'webtrix'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
|
||||
// type: 'indexedDB',
|
||||
// version: 1,
|
||||
// models: [WebtrixUserModel]
|
||||
// })
|
||||
models.register({
|
||||
databaseName: 'webtrix'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
|
||||
type: 'indexedDB',
|
||||
version: 1,
|
||||
models: [WebtrixUserModel]
|
||||
})
|
||||
|
||||
|
||||
// models.register({
|
||||
// databaseName: 'actions'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
|
||||
// type: 'indexedDB',
|
||||
// version: 14,
|
||||
// models: [PublicationDetailsModel, ActionModel, PublicationFolderModel]
|
||||
// })
|
||||
models.register({
|
||||
databaseName: 'actions'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
|
||||
type: 'indexedDB',
|
||||
version: 14,
|
||||
models: [PublicationDetailsModel, ActionModel, PublicationFolderModel]
|
||||
})
|
||||
|
||||
@@ -148,9 +148,9 @@ ion-content {
|
||||
font-size: rem(13);
|
||||
color: #797979;
|
||||
padding: 10px;
|
||||
margin: 0 auto;
|
||||
line-height: 1.2rrem;
|
||||
margin: 20px 39px 25px;
|
||||
margin: 0 auto !important;
|
||||
line-height: 1.2rem;
|
||||
// margin: 20px 39px 25px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<div class="main-content justify-center d-flex height-100">
|
||||
<div class="box-container width-100 d-flex mx-20 overflow-hidden" style="padding: 0px;overflow: hidden;">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="loadingAllTask || TaskService.showLoader"></ion-progress-bar>
|
||||
<ion-progress-bar type="indeterminate" *ngIf="loadingAllTask || TaskService.showLoaderNum != 0"></ion-progress-bar>
|
||||
<div class="px-20 pb-20 container-filters">
|
||||
<p class="time ion-text-left font-18-em">{{customDate}}</p>
|
||||
<div class="filters-box wrap d-flex float-left">
|
||||
@@ -137,7 +137,7 @@
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<div *ngIf="p.userPermission([p.permissionList.Gabinete.access])" class="schedule schedule-1 height-100">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showCorrespondenciasLoader"></ion-progress-bar>
|
||||
<ion-progress-bar type="indeterminate" *ngIf="loadingAllTask || TaskService.showLoaderNum != 0"></ion-progress-bar>
|
||||
<div class="schedule-header">
|
||||
<div class="title">
|
||||
<ion-icon class="icon" slot="end" src="assets/images/icons-correspondencias.svg"></ion-icon>
|
||||
@@ -292,7 +292,7 @@
|
||||
<div class="content overflow-y-auto flex-grow-1 height-100">
|
||||
<ion-list>
|
||||
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of AllProcess"
|
||||
(click)="goToExpediente(task.SerialNumber)">
|
||||
(click)="TaskService.goToProcess(task.SerialNumber || task.serialNumber, task.WorkflowName || task.workflowName || task.workflowDisplayName || task.workflowName, task.activityInstanceName)">
|
||||
<div class="item-exp d-flex">
|
||||
<div class="schedule-date">
|
||||
<div class="time-end">{{task.TaskStartDate | date: 'dd-MM-yy'}}</div>
|
||||
|
||||
@@ -54,7 +54,6 @@ export class EventsPage implements OnInit {
|
||||
expedienteGdStore = ExpedienteGdStore
|
||||
|
||||
listToPresent = [];
|
||||
listToPresentexpediente = []
|
||||
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
|
||||
@@ -103,7 +102,6 @@ export class EventsPage implements OnInit {
|
||||
|
||||
this.changeProfileService.registerCallback(() => {
|
||||
this.listToPresent = [];
|
||||
this.listToPresentexpediente = []
|
||||
})
|
||||
|
||||
|
||||
@@ -275,12 +273,6 @@ export class EventsPage implements OnInit {
|
||||
//
|
||||
})
|
||||
|
||||
this.storage.get('process').then((process: any[] = []) => {
|
||||
//
|
||||
if(Array.isArray(process)) {
|
||||
this.listToPresentexpediente = process;
|
||||
}
|
||||
})
|
||||
|
||||
this.showLoader = false;
|
||||
|
||||
@@ -355,21 +347,8 @@ export class EventsPage implements OnInit {
|
||||
LoadList() {
|
||||
if(this.firstEnter) {
|
||||
this.showCorrespondenciasLoader = true
|
||||
this.processes.GetTaskListExpediente(false).subscribe(result => {
|
||||
|
||||
let ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e))
|
||||
|
||||
this.listToPresentexpediente = ExpedienteTask;
|
||||
|
||||
this.storage.set('process', ExpedienteTask)
|
||||
|
||||
this.showCorrespondenciasLoader = false
|
||||
}, ((error) => {
|
||||
|
||||
this.showCorrespondenciasLoader = false
|
||||
//
|
||||
this.getEventsFromLocalDb();
|
||||
}));
|
||||
this.getEventsFromLocalDb();
|
||||
}
|
||||
|
||||
this.firstEnter = true
|
||||
@@ -404,9 +383,6 @@ export class EventsPage implements OnInit {
|
||||
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
|
||||
}
|
||||
|
||||
goToExpediente(SerialNumber: any) {
|
||||
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
|
||||
}
|
||||
|
||||
viewExpedientListPage() {
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
<!-- Aside left -->
|
||||
<div class="aside-wrapper d-flex flex-column width-md-40 flex-grow-1">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="TaskService.showLoader"></ion-progress-bar>
|
||||
{{ TaskService.showLoaderNum }}
|
||||
<ion-progress-bar type="indeterminate" *ngIf="TaskService.showLoaderNum != 0"></ion-progress-bar>
|
||||
<div class="title-container">
|
||||
<div class="title d-flex justify-center">
|
||||
<ion-label *ngIf="hideRefreshBtn">Gabinete Digital</ion-label>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import {NavigationEnd, NavigationExtras, Router } from '@angular/router';
|
||||
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
@@ -221,6 +220,7 @@ export class GabineteDigitalPage implements OnInit {
|
||||
this.waitForDomService.selector({
|
||||
selector: 'app-gabinete-digital ion-content .aside-wrapper',
|
||||
callback: () => {
|
||||
this.loadAllProcesses()
|
||||
if(this.NotificationsService.active === false) {
|
||||
this.checkRoutes();
|
||||
// this.LoadCounts();
|
||||
@@ -302,9 +302,8 @@ export class GabineteDigitalPage implements OnInit {
|
||||
goToProcess(serialNumber: string, workflowName: string, activityName: string) {
|
||||
|
||||
|
||||
|
||||
if (workflowName == 'Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho' || activityName == 'Reexecutar Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,8 @@ export class LoginPage implements OnInit {
|
||||
|
||||
loader.remove()
|
||||
|
||||
console.log('attempt', attempt)
|
||||
|
||||
if (attempt) {
|
||||
if (attempt.UserId == SessionStore.user.UserId) {
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
.container-div{
|
||||
margin-bottom: rem(15);
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
.ion-item-container{
|
||||
margin: rem(15) auto;
|
||||
|
||||
@@ -202,7 +202,6 @@ export class MessageService {
|
||||
|
||||
} else {
|
||||
|
||||
console.log('send', this)
|
||||
let uploadSuccessfully = await this.sendRequestAttachment()
|
||||
|
||||
if(uploadSuccessfully) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
import { EventEmitter, Injectable, NgZone } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { AuthConnstants } from 'src/app/config/auth-constants';
|
||||
import { Tokenn } from '../models/token.model';
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
@@ -12,10 +11,8 @@ import { EventTrigger } from '../services/eventTrigger.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
|
||||
import { notificationObject } from '../models/notifications';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { AngularFireMessaging } from '@angular/fire/messaging';
|
||||
import { Subject } from 'rxjs';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
@@ -44,6 +44,7 @@ export class TaskService {
|
||||
|
||||
AllProcess = []
|
||||
showLoader: boolean = false
|
||||
showLoaderNum = 0
|
||||
loadCount = false
|
||||
loadNum = 0
|
||||
|
||||
@@ -213,14 +214,20 @@ export class TaskService {
|
||||
}
|
||||
|
||||
async loadDespachos() {
|
||||
this.showLoaderNum++
|
||||
|
||||
let despachos = await this.despachoRule.getList({ updateStore: true })
|
||||
if (despachos) {
|
||||
this.despachoStore.reset(despachos)
|
||||
}
|
||||
|
||||
this.showLoaderNum--
|
||||
}
|
||||
|
||||
async loadExpedientes() {
|
||||
|
||||
this.showLoaderNum++
|
||||
|
||||
try {
|
||||
let expedientes;
|
||||
expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise()
|
||||
@@ -240,10 +247,13 @@ export class TaskService {
|
||||
|
||||
}
|
||||
|
||||
this.showLoaderNum--
|
||||
|
||||
}
|
||||
|
||||
async loadPedidos() {
|
||||
this.showLoader = true
|
||||
this.showLoaderNum++
|
||||
|
||||
try {
|
||||
let pareceres = await this.processesbackend.GetTasksList("Pedido de Parecer", false).toPromise();
|
||||
@@ -264,11 +274,13 @@ export class TaskService {
|
||||
}));
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
this.showLoaderNum--
|
||||
}
|
||||
|
||||
|
||||
async loadPendestes() {
|
||||
this.showLoaderNum++
|
||||
|
||||
try {
|
||||
|
||||
let pendentes = await this.processesbackend.GetPendingTasks(false).toPromise();
|
||||
@@ -281,10 +293,13 @@ export class TaskService {
|
||||
|
||||
}
|
||||
|
||||
this.showLoaderNum--
|
||||
|
||||
}
|
||||
|
||||
|
||||
async loadEventosParaAprovacao() {
|
||||
this.showLoaderNum++
|
||||
|
||||
// PR dont have event to approve
|
||||
if(this.SessionStore.user.Profile != 'PR') {
|
||||
@@ -319,11 +334,14 @@ export class TaskService {
|
||||
}
|
||||
}
|
||||
|
||||
this.showLoaderNum--
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
async loadDiplomas() {
|
||||
this.showLoaderNum++
|
||||
|
||||
try {
|
||||
|
||||
@@ -384,6 +402,7 @@ export class TaskService {
|
||||
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
|
||||
} catch (error) {}
|
||||
|
||||
this.showLoaderNum--
|
||||
}
|
||||
|
||||
|
||||
@@ -391,9 +410,10 @@ export class TaskService {
|
||||
goToProcess(serialNumber: string, workflowName: string, activityName: string) {
|
||||
|
||||
|
||||
console.log({workflowName, serialNumber, activityName})
|
||||
|
||||
if (workflowName == 'Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho' || activityName == 'Reexecutar Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ export class EditEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: any): void {
|
||||
this.loadedEventAttachments = this._postEvent.Attachments
|
||||
this.loadedEventAttachments = this._postEvent?.Attachments
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
@@ -336,7 +336,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
this.chatService.getAllUsers().subscribe(res => {
|
||||
//
|
||||
|
||||
this.allUsers = res['users'].filter(data => data.username != SessionStore.user.UserName);
|
||||
this.allUsers = res['users']
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ export class AttendeePage implements OnInit {
|
||||
|
||||
@Input() footer: boolean;
|
||||
|
||||
@Input() selectLogUser: boolean = true;
|
||||
|
||||
@ViewChild('Searchbar') searchbar: Searchbar;
|
||||
|
||||
LtaskParticipants: EventPerson[] = [];
|
||||
|
||||
@@ -180,12 +180,12 @@
|
||||
</ion-item-sliding>
|
||||
</div>
|
||||
|
||||
<div *ngIf="!TaskService.showLoader && AllProcess.length == 0"
|
||||
<div *ngIf="!TaskService.showLoaderNum != 0 && AllProcess.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center">
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="TaskService.showLoader && AllProcess.length == 0">
|
||||
<div *ngIf="TaskService.showLoaderNum != 0 && AllProcess.length == 0">
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
|
||||
@@ -140,7 +140,7 @@ export class AllProcessesPage implements OnInit {
|
||||
|
||||
|
||||
if (workflowName == 'Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho') {
|
||||
if (activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho' || activityName == 'Reexecutar Despacho') {
|
||||
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { customTask } from '../../../models/dailyworktask.model';
|
||||
import { NavigationEnd, NavigationStart, Router } from '@angular/router';
|
||||
import { NavigationStart, Router } from '@angular/router';
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { TaskService } from 'src/app/services/task.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
.container-div{
|
||||
margin-bottom: rem(15);
|
||||
overflow: auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
.ion-item-container{
|
||||
margin: rem(15) auto;
|
||||
|
||||
+12
@@ -79,6 +79,9 @@ export class PublicationDetailPage implements OnInit {
|
||||
}
|
||||
this.showLoader = false;
|
||||
},(error) => {
|
||||
if(window['_deletePublication']) {
|
||||
window['_deletePublication'](this.folderId, this.publicationId)
|
||||
}
|
||||
this.goBack();
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
});
|
||||
@@ -95,6 +98,15 @@ export class PublicationDetailPage implements OnInit {
|
||||
try {
|
||||
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Eliminar publicação')
|
||||
|
||||
if(window['_deletePublication']) {
|
||||
window['_deletePublication'](this.folderId, this.publicationId)
|
||||
}
|
||||
|
||||
if(window['app-view-publications-page-doRefresh']) {
|
||||
window['app-view-publications-page-doRefresh']()
|
||||
}
|
||||
|
||||
this.goBackToViewPublications.emit();
|
||||
} catch (error) {
|
||||
this.httpErrorHandle.httpStatusHandle(error)
|
||||
|
||||
@@ -25,8 +25,8 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
publicationList: {[key: string]: Publication[] } = {};
|
||||
publicationItem: {[key: string]: PublicationFolder } = {};
|
||||
getpublication = [];
|
||||
error: any;
|
||||
oldpublicationIds = []
|
||||
|
||||
@Input() folderId: any;
|
||||
@Output() addNewPublication = new EventEmitter<any>();
|
||||
@@ -59,6 +59,9 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.createPublicationList()
|
||||
|
||||
window['app-view-publications-page-doRefresh'] = this.doRefresh
|
||||
window['_deletePublication'] = (a, b) => {
|
||||
this._deletePublication(a, b)
|
||||
}
|
||||
|
||||
this.getFromDB();
|
||||
}
|
||||
@@ -124,6 +127,7 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
try {
|
||||
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
|
||||
this.publicationList[folderId] = []
|
||||
|
||||
this.createPublicationList(folderId)
|
||||
let loadLater = []
|
||||
@@ -144,13 +148,22 @@ export class ViewPublicationsPage implements OnInit {
|
||||
this.showLoader = false;
|
||||
|
||||
this.storage.set(folderId, this.publicationList[folderId]);
|
||||
this.getpublication = this.publicationList[folderId];
|
||||
|
||||
this.oldpublicationIds = publicationIds
|
||||
} catch(error) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_deletePublication = (folderId, publicationId) => {
|
||||
|
||||
this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != publicationId)
|
||||
|
||||
console.log('this.publicationList[folderId]', this.publicationList[folderId].length)
|
||||
|
||||
}
|
||||
|
||||
publicationIsPresent(publicationId, folderId) {
|
||||
return this.publicationList[folderId].find( e => e.DocumentId == publicationId )
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PublicationFolderService } from './publication-folder.service';
|
||||
|
||||
describe('PublicationFolderService', () => {
|
||||
let service: PublicationFolderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(PublicationFolderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { PublicationFolder } from '../models/publicationfolder';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { Publication } from '../models/publication';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PublicationFolderService {
|
||||
|
||||
publicationList: {[key: string]: Publication[] } = {};
|
||||
FolderDetails: {[key: string]: PublicationFolder } = {};
|
||||
|
||||
keyName: string
|
||||
|
||||
constructor(
|
||||
private storage: Storage,
|
||||
) {}
|
||||
|
||||
|
||||
getFromDB(folderId: any) {
|
||||
|
||||
if(!this.publicationList[folderId]) {
|
||||
this.publicationList[folderId] = []
|
||||
}
|
||||
if(!this.FolderDetails[folderId]) {
|
||||
this.FolderDetails[folderId] = new PublicationFolder();
|
||||
}
|
||||
|
||||
this.storage.get(folderId).then((viewPublications) => {
|
||||
this.publicationList[folderId] = viewPublications
|
||||
})
|
||||
this.storage.get(folderId+"name").then((viewPublications) => {
|
||||
this.FolderDetails[folderId] = viewPublications
|
||||
})
|
||||
}
|
||||
|
||||
updateFolderDetails(folderId, res) {
|
||||
this.FolderDetails[folderId] = res
|
||||
this.storage.set(folderId+"name", res)
|
||||
}
|
||||
|
||||
save(folderId) {
|
||||
this.storage.set(folderId+"name", this.FolderDetails)
|
||||
this.storage.set(folderId, this.publicationList[folderId]);
|
||||
}
|
||||
|
||||
publicationIsPresent(publicationId, folderId) {
|
||||
return this.publicationList[folderId].find( e => e.DocumentId == publicationId )
|
||||
}
|
||||
publicationFind(publicationId, folderId) {
|
||||
return this.publicationList[folderId].find( e => e.DocumentId == publicationId )
|
||||
}
|
||||
publicationFindIndex(publicationId, folderId) {
|
||||
return this.publicationList[folderId].findIndex( e => e.DocumentId == publicationId )
|
||||
}
|
||||
|
||||
PublicationAddOrUpdate(folderId, publicationId, Publication: Publication) {
|
||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||
const found = this.publicationIsPresent(publicationId, folderId)
|
||||
if(!found) {
|
||||
console.log('push',folderId, Publication)
|
||||
this.publicationList[folderId].push(Publication)
|
||||
} else {
|
||||
|
||||
console.log('update',folderId, Publication)
|
||||
this.publicationList[folderId][findIndex] = Publication
|
||||
}
|
||||
}
|
||||
|
||||
deletePost(publicationId: any, folderId) {
|
||||
|
||||
for (let i = 0; i <= this.publicationList[folderId].length; i++) {
|
||||
if(this.publicationList[folderId][i].DocumentId == publicationId) {
|
||||
this.publicationList[folderId].splice(i, 1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
importScripts('ngsw-worker.js');
|
||||
importScripts('firebase-messaging-sw.js');
|
||||
Vendored
+1
-1
@@ -30,7 +30,7 @@ export declare class Model {
|
||||
static get(arg: getParams): Promise<any>;
|
||||
static getOrCreate(arg: getParams): Promise<any>;
|
||||
private static getId;
|
||||
static getModelName(): string;
|
||||
static getModelName(): any;
|
||||
static filter(...arg: any[]): {
|
||||
filter: (...args: any[]) => void;
|
||||
execute: () => Promise<any[]>;
|
||||
|
||||
@@ -173,7 +173,7 @@ export class Model {
|
||||
return hashCode(this.toString());
|
||||
}
|
||||
static getModelName() {
|
||||
return this.toString().split('(' || /s+/)[0].split(' ' || /s+/)[1];
|
||||
return this['$tableName'] || this.toString().split('(' || /s+/)[0].split(' ' || /s+/)[1];
|
||||
}
|
||||
static filter(...arg) {
|
||||
const queryId = uniqueGenerator();
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { FieldsMap, AttributesMap } from './field/fields.interface.js';
|
||||
export declare class ModelReader {
|
||||
static read(modelClassRepresentation: any): {
|
||||
modelName: string;
|
||||
modelName: any;
|
||||
fields: {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
+1
-10
@@ -1,5 +1,5 @@
|
||||
import { Model, LocalStorage } from './model.js';
|
||||
import { DatabaseSchema, DatabaseSchemaLocalStorage, TableSchema, TableSchemaLocalStorage } from './register-modal.interface.js';
|
||||
import { DatabaseSchema, DatabaseSchemaLocalStorage, TableSchemaLocalStorage } from './register-modal.interface.js';
|
||||
import { OneToOneField, ForeignKey, ManyToManyField } from './field/allFields.js';
|
||||
interface register {
|
||||
databaseName: string;
|
||||
@@ -13,15 +13,6 @@ interface register {
|
||||
ignoreFieldsStartWidth?: string[];
|
||||
}
|
||||
export declare const objModels: {};
|
||||
export declare const modelsConfig: {
|
||||
[key: string]: {
|
||||
DatabaseSchema: DatabaseSchema;
|
||||
TableSchema: TableSchema;
|
||||
OneToOneField?: {
|
||||
[key: string]: {};
|
||||
};
|
||||
};
|
||||
};
|
||||
export declare function migrate(register: register): void;
|
||||
export declare class registerModel {
|
||||
static ModalName(): void;
|
||||
|
||||
@@ -9,9 +9,7 @@ import { transactionOnCommit } from '../triggers/transaction.js';
|
||||
import { DatabaseManagerSchema } from './schema/databae-manager-schema.js';
|
||||
const models = {};
|
||||
export const objModels = {};
|
||||
export const modelsConfig = {};
|
||||
const modelsLocalStorage = {};
|
||||
const modelsConfigLocalStorage = {};
|
||||
export function migrate(register) {
|
||||
if (register.type == 'indexedDB') {
|
||||
registerModel.register(register);
|
||||
@@ -30,15 +28,19 @@ export class registerModel {
|
||||
type: entries.type,
|
||||
stores: []
|
||||
};
|
||||
const storeNames = [];
|
||||
let index = 0;
|
||||
for (const modelClassRepresentations of entries.models) {
|
||||
const ModelName = modelClassRepresentations.getModelName();
|
||||
let ModelName = modelClassRepresentations.getModelName();
|
||||
if (storeNames.includes(ModelName)) {
|
||||
ModelName = uniqueGenerator();
|
||||
}
|
||||
models[ModelName] = modelClassRepresentations;
|
||||
const { fields, modelName, attributes, fieldTypes } = ModelReader.read(modelClassRepresentations);
|
||||
const { fields, attributes, fieldTypes } = ModelReader.read(modelClassRepresentations);
|
||||
const idFieldName = (_a = attributes === null || attributes === void 0 ? void 0 : attributes.primaryKey) === null || _a === void 0 ? void 0 : _a.shift();
|
||||
databaseSchema.stores.push({
|
||||
databaseName: databaseSchema.databaseName,
|
||||
name: modelName,
|
||||
name: ModelName,
|
||||
id: {
|
||||
keyPath: idFieldName || 'id',
|
||||
autoIncrement: fields[idFieldName] ? ((_b = fields[idFieldName]) === null || _b === void 0 ? void 0 : _b.primaryKey) == true : true,
|
||||
@@ -67,28 +69,24 @@ export class registerModel {
|
||||
});
|
||||
}
|
||||
if (Field instanceof OneToOneField) {
|
||||
await ModelEditor.addMethodOneToOneField(Field, fieldName, modelName, databaseSchema);
|
||||
await ModelEditor.addMethodOneToOneField(Field, fieldName, ModelName, databaseSchema);
|
||||
}
|
||||
else if (Field instanceof ForeignKey) {
|
||||
await ModelEditor.addMethodForeignKey(Field, fieldName, modelName, databaseSchema);
|
||||
await ModelEditor.addMethodForeignKey(Field, fieldName, ModelName, databaseSchema);
|
||||
}
|
||||
else if (Field instanceof ManyToManyField) {
|
||||
await ModelEditor.addMethodManyToManyField(Field, fieldName, modelName, databaseSchema);
|
||||
await ModelEditor.addMethodManyToManyField(Field, fieldName, ModelName, databaseSchema);
|
||||
}
|
||||
}
|
||||
models[ModelName] = modelClassRepresentations;
|
||||
const tableSchema = databaseSchema.stores.find((e) => e.name == ModelName);
|
||||
modelsConfig[ModelName] = {
|
||||
DatabaseSchema: databaseSchema,
|
||||
TableSchema: tableSchema
|
||||
};
|
||||
index++;
|
||||
}
|
||||
DatabaseManagerSchema.prepare(databaseSchema);
|
||||
for (const stores of databaseSchema.stores) {
|
||||
const model = models[stores.name];
|
||||
const DbName = databaseSchema.databaseName;
|
||||
ModelEditor.setTableSchema(model, DbName, stores, databaseSchema, entries);
|
||||
ModelEditor.setTableSchema(model, DbName);
|
||||
ModelEditor.getDBSchema(model, DbName);
|
||||
// ModelEditor.setModel(model, DbName)
|
||||
DatabaseManagerSchema.getDb(DbName).getTable(stores.name).setModel(model);
|
||||
@@ -213,10 +211,6 @@ export class registerLocalStorage {
|
||||
modelClassRepresentations.getModelName = () => {
|
||||
return ModelName;
|
||||
};
|
||||
modelsConfigLocalStorage[ModelName] = {
|
||||
DatabaseSchema: databaseSchema,
|
||||
TableSchema: tableSchema
|
||||
};
|
||||
modelsLocalStorage[ModelName] = modelClassRepresentations;
|
||||
if (entries === null || entries === void 0 ? void 0 : entries.restore) {
|
||||
modelClassRepresentations.get(null);
|
||||
@@ -241,28 +235,16 @@ export class ModelEditor {
|
||||
return DatabaseSchema;
|
||||
};
|
||||
}
|
||||
static setTableSchema(ModelToEdit, DbName, store, databaseSchema, entries) {
|
||||
try {
|
||||
|
||||
const ModelName = ModelToEdit.getModelName();
|
||||
const DBSchema = DatabaseManagerSchema.getDb(DbName);
|
||||
const TableSchemaClass = DBSchema.getTable(ModelName);
|
||||
ModelToEdit.prototype.getTableSchema = () => {
|
||||
return TableSchemaClass.config;
|
||||
};
|
||||
ModelToEdit.getTableSchema = () => {
|
||||
return TableSchemaClass.config;
|
||||
};
|
||||
} catch (error) {
|
||||
console.log('databaseSchema', databaseSchema)
|
||||
console.log('error', error)
|
||||
console.log('ModelToEdit', ModelToEdit)
|
||||
console.log(DbName, 'DbName')
|
||||
console.log('store', store)
|
||||
console.log('models', models)
|
||||
console.log('entries', entries)
|
||||
}
|
||||
|
||||
static setTableSchema(ModelToEdit, DbName) {
|
||||
const ModelName = ModelToEdit.getModelName();
|
||||
const DBSchema = DatabaseManagerSchema.getDb(DbName);
|
||||
const TableSchemaClass = DBSchema.getTable(ModelName);
|
||||
ModelToEdit.prototype.getTableSchema = () => {
|
||||
return TableSchemaClass.config;
|
||||
};
|
||||
ModelToEdit.getTableSchema = () => {
|
||||
return TableSchemaClass.config;
|
||||
};
|
||||
}
|
||||
static getDBSchema(ModelToEdit, DbName) {
|
||||
const ModelName = ModelToEdit.getModelName();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,12 +1,12 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "a2dd41393",
|
||||
"SHA": "a2dd41393b51e274d2627fa68375cda77266e2c2",
|
||||
"branch": "developer",
|
||||
"shortSHA": "8b3989de3",
|
||||
"SHA": "8b3989de3beea56ec3168c107af73145f41aba8b",
|
||||
"branch": "developer-bug",
|
||||
"lastCommitAuthor": "'Peter Maquiran'",
|
||||
"lastCommitTime": "'Tue Aug 8 16:32:57 2023 +0100'",
|
||||
"lastCommitMessage": "update",
|
||||
"lastCommitNumber": "5141",
|
||||
"lastCommitTime": "'Wed Aug 9 10:00:39 2023 +0100'",
|
||||
"lastCommitMessage": "fix",
|
||||
"lastCommitNumber": "5144",
|
||||
"change": "",
|
||||
"changeStatus": "On branch developer\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.scss\n\tmodified: src/app/services/chat/room.service.ts\n\tmodified: src/app/services/native-notification.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/shared/chat/group-messages/group-messages.page.scss\n\tmodified: src/app/shared/chat/messages/messages.page.scss\n\tmodified: src/app/tiny-mce/tiny-mce.page.html\n\tmodified: src/app/tiny-mce/tiny-mce.page.ts\n\tmodified: src/firebase-messaging-sw.js\n\tmodified: src/main.ts",
|
||||
"changeStatus": "On branch developer-bug\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: angular.json\n\tdeleted: firebase-messaging-sw.js\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/models/beast-orm.ts\n\tmodified: src/app/pages/chat/messages/messages.page.scss\n\tmodified: src/app/pages/events/events.page.html\n\tmodified: src/app/pages/events/events.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/pages/publications/edit-action/edit-action.page.scss\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/shared/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/shared/event/attendee-modal/attendee-modal.page.ts\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.html\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.ts\n\tmodified: src/app/shared/gabinete-digital/despachos/despachos.page.ts\n\tmodified: src/app/shared/publication/edit-action/edit-action.page.scss\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts\n\tnew file: src/app/store/publication-folder.service.spec.ts\n\tnew file: src/app/store/publication-folder.service.ts\n\tmodified: src/combined-sw.js\n\tmodified: src/plugin/src/models/model.d.ts\n\tmodified: src/plugin/src/models/model.js\n\tmodified: src/plugin/src/models/model.reader.d.ts\n\tmodified: src/plugin/src/models/register-model.d.ts\n\tmodified: src/plugin/src/models/register-model.js\n\tmodified: src/plugin/src/tsconfig.tsbuildinfo",
|
||||
"changeAuthor": "peter.maquiran"
|
||||
}
|
||||
Reference in New Issue
Block a user