Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-10-18 16:21:07 +01:00
120 changed files with 14657 additions and 14653 deletions
+2 -1
View File
@@ -84,7 +84,8 @@
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": { "options": {
"browserTarget": "app:build" "browserTarget": "app:build",
"proxyConfig": "src/proxy.conf.json"
}, },
"configurations": { "configurations": {
"production": { "production": {
+4 -104
View File
@@ -3,7 +3,7 @@
<name>gabinete digital</name> <name>gabinete digital</name>
<description>An awesome Ionic/Cordova app.</description> <description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author> <author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" /> <content original-src="index.html" src="http://localhost:8100" />
<access origin="*" /> <access origin="*" />
<allow-navigation href="*" /> <allow-navigation href="*" />
<allow-navigation href="*" /> <allow-navigation href="*" />
@@ -46,115 +46,15 @@
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" /> <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" /> <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform> </platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
<icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
<icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
<icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
<icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" />
<icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" />
<icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" />
<icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
<icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" />
<icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" />
<icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" />
<icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" />
<icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" />
<icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" />
<icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" />
<icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" />
<icon height="216" src="resources/ios/icon/icon-108@2x.png" width="216" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2688" src="resources/ios/splash/Default-2688h~iphone.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-2688h~iphone.png" width="2688" />
<splash height="1792" src="resources/ios/splash/Default-1792h~iphone.png" width="828" />
<splash height="828" src="resources/ios/splash/Default-Landscape-1792h~iphone.png" width="1792" />
<splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
<splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<mfp:android> <mfp:android>
<mfp:sdkChecksum>1109370933</mfp:sdkChecksum> <mfp:sdkChecksum>3077110622</mfp:sdkChecksum>
<mfp:appChecksum>3619450036</mfp:appChecksum> <mfp:appChecksum>3619450036</mfp:appChecksum>
<mfp:security> <mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" /> <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
</mfp:security> </mfp:security>
</mfp:android> </mfp:android>
<mfp:ios> <mfp:ios>
<mfp:sdkChecksum>246097737</mfp:sdkChecksum> <mfp:sdkChecksum>1979143311</mfp:sdkChecksum>
<mfp:appChecksum>1328564293</mfp:appChecksum> <mfp:appChecksum>1328564293</mfp:appChecksum>
<mfp:security> <mfp:security>
<mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" /> <mfp:testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3" />
@@ -181,7 +81,7 @@
</mfp:windows10> </mfp:windows10>
<mfp:appChecksum>0</mfp:appChecksum> <mfp:appChecksum>0</mfp:appChecksum>
</mfp:windows> </mfp:windows>
<mfp:platformVersion>8.0.0.00-20210308-063916</mfp:platformVersion> <mfp:platformVersion>8.0.0.00-20210905-154328</mfp:platformVersion>
<mfp:clientCustomInit enabled="false" /> <mfp:clientCustomInit enabled="false" />
<mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" /> <mfp:server runtime="mfp" url="http://gpr-dev-10.gabinetedigital.local:9080" />
<mfp:serverUri url="" /> <mfp:serverUri url="" />
+11 -1
View File
@@ -3,5 +3,15 @@
"integrations": { "integrations": {
"cordova": {} "cordova": {}
}, },
"type": "angular" "type": "angular",
"proxies":[
{
"path": "/mfp/api/imfpush/",
"proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api/imfpush/"
},
{
"path": "/mfp/api",
"proxyUrl": "http://gpr-dev-10.gabinetedigital.local:9080/mfp/api"
}
]
} }
+7315 -12753
View File
File diff suppressed because it is too large Load Diff
+15 -10
View File
@@ -42,18 +42,19 @@
"@fullcalendar/interaction": "^5.3.0", "@fullcalendar/interaction": "^5.3.0",
"@ionic-native/camera": "^5.31.1", "@ionic-native/camera": "^5.31.1",
"@ionic-native/core": "^5.0.7", "@ionic-native/core": "^5.0.7",
"@ionic-native/file": "^5.30.0", "@ionic-native/file": "^5.36.0",
"@ionic-native/file-path": "^5.30.0", "@ionic-native/file-path": "^5.30.0",
"@ionic-native/fingerprint-aio": "^4.20.0", "@ionic-native/fingerprint-aio": "^4.20.0",
"@ionic-native/http": "^5.31.1", "@ionic-native/http": "^5.31.1",
"@ionic-native/in-app-browser": "^5.28.0", "@ionic-native/in-app-browser": "^5.28.0",
"@ionic-native/ionic-webview": "^5.35.0", "@ionic-native/ionic-webview": "^5.35.0",
"@ionic-native/local-notifications": "^4.20.0", "@ionic-native/local-notifications": "^4.20.0",
"@ionic-native/network": "^5.35.0", "@ionic-native/media": "^5.36.0",
"@ionic-native/network": "^5.36.0",
"@ionic-native/screen-orientation": "^5.35.0", "@ionic-native/screen-orientation": "^5.35.0",
"@ionic-native/splash-screen": "^5.31.1", "@ionic-native/splash-screen": "^5.31.1",
"@ionic-native/sqlite": "^5.31.1", "@ionic-native/sqlite": "^5.36.0",
"@ionic-native/sqlite-porter": "^5.31.1", "@ionic-native/sqlite-porter": "^4.20.0",
"@ionic-native/status-bar": "^5.0.0", "@ionic-native/status-bar": "^5.0.0",
"@ionic-native/wheel-selector": "^5.31.1", "@ionic-native/wheel-selector": "^5.31.1",
"@ionic/angular": "^5.5.4", "@ionic/angular": "^5.5.4",
@@ -92,18 +93,20 @@
"ionic-selectable": "^4.7.1", "ionic-selectable": "^4.7.1",
"ionic2-alpha-scroll": "^2.0.1", "ionic2-alpha-scroll": "^2.0.1",
"ionic2-calendar": "^0.6.6", "ionic2-calendar": "^0.6.6",
"ionicons": "^5.5.3",
"jest-puppeteer": "^5.0.4", "jest-puppeteer": "^5.0.4",
"jetifier": "^1.6.6", "jetifier": "^1.6.6",
"lite-server": "^2.6.1", "lite-server": "^2.6.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"ng2-pdf-viewer": "^7.0.1", "ng2-pdf-viewer": "^7.0.1",
"ngx-cookie-service": "^12.0.3",
"ngx-socket-io": "^3.2.0", "ngx-socket-io": "^3.2.0",
"pdfjs": "^2.4.6", "pdfjs": "^2.4.6",
"pdfjs-dist": "^2.9.359", "pdfjs-dist": "^2.9.359",
"puppeteer": "^10.1.0", "puppeteer": "^10.1.0",
"rxjs": "~6.6.3", "rxjs": "~6.6.3",
"rxjs-compat": "^6.6.7", "rxjs-compat": "^6.6.7",
"sharp": "^0.25.4", "sharp": "^0.29.1",
"socket.io-client": "^2.3.0", "socket.io-client": "^2.3.0",
"ts-jest": "^27.0.3", "ts-jest": "^27.0.3",
"tslib": "^2.0.0", "tslib": "^2.0.0",
@@ -118,19 +121,19 @@
"@angular/compiler": "^12.1.2", "@angular/compiler": "^12.1.2",
"@angular/compiler-cli": "^12.1.2", "@angular/compiler-cli": "^12.1.2",
"@angular/language-service": "^12.1.2", "@angular/language-service": "^12.1.2",
"@ionic/angular-toolkit": "^3.0.0", "@ionic/angular-toolkit": "^4.0.0",
"@ionic/lab": "3.1.7", "@ionic/lab": "3.1.7",
"@types/jasmine": "~3.6.0", "@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"@types/jest": "^26.0.24", "@types/jest": "^26.0.24",
"@types/node": "^12.11.1", "@types/node": "^12.11.1",
"codelyzer": "^6.0.0", "codelyzer": "^6.0.0",
"cordova-android": "^9.0.0", "cordova-android": "^9.1.0",
"cordova-browser": "^6.0.0", "cordova-browser": "^6.0.0",
"cordova-ios": "^6.2.0",
"cordova-plugin-androidx": "^3.0.0", "cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.3", "cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-compat": "^1.2.0", "cordova-plugin-compat": "^1.2.0",
"cordova-plugin-crosswalk-webview": "git+https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git",
"cordova-plugin-device": "^2.0.2", "cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.2", "cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-file": "^6.0.2", "cordova-plugin-file": "^6.0.2",
@@ -139,6 +142,7 @@
"cordova-plugin-inappbrowser": "^4.0.0", "cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0", "cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^5.0.0", "cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-media": "^5.0.3",
"cordova-plugin-mfp": "^8.0.2021031007", "cordova-plugin-mfp": "^8.0.2021031007",
"cordova-plugin-mfp-jsonstore": "^8.0.2021062408", "cordova-plugin-mfp-jsonstore": "^8.0.2021062408",
"cordova-plugin-mfp-push": "^8.0.2021062405", "cordova-plugin-mfp-push": "^8.0.2021062405",
@@ -160,7 +164,8 @@
"ts-jest-puppeteer": "0.0.5", "ts-jest-puppeteer": "0.0.5",
"ts-node": "~8.3.0", "ts-node": "~8.3.0",
"tslint": "~6.1.0", "tslint": "~6.1.0",
"typescript": "^4.3.5" "typescript": "^4.3.5",
"uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.1"
}, },
"description": "An Ionic project", "description": "An Ionic project",
"cordova": { "cordova": {
@@ -184,7 +189,7 @@
}, },
"platforms": [ "platforms": [
"browser", "browser",
"ios" "android"
] ]
}, },
"main": "karma.conf.js", "main": "karma.conf.js",
+9 -6
View File
@@ -7,6 +7,7 @@ import { DespachoStore } from '../store/despacho-store.service';
import { LoaderService } from 'src/app/store/loader.service' import { LoaderService } from 'src/app/store/loader.service'
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
import { PermissionService } from '../services/worker/permission.service'; import { PermissionService } from '../services/worker/permission.service';
import { SortService } from '../services/functions/sort.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -31,7 +32,8 @@ export class DespachoService {
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
public p: PermissionService, public p: PermissionService,
public LoaderService: LoaderService public LoaderService: LoaderService,
private sortService: SortService,
) { } ) { }
arquivar(note:string, documents:AttachmentList, serialnumber) { arquivar(note:string, documents:AttachmentList, serialnumber) {
@@ -251,7 +253,7 @@ export class DespachoService {
}); });
despachoList = this.sortArrayISODate(despachoList).reverse(); despachoList = this.sortService.sortArrayByDate(despachoList).reverse();
if(updateStore) { if(updateStore) {
this.despachoStore.reset(despachoList); this.despachoStore.reset(despachoList);
@@ -270,20 +272,21 @@ export class DespachoService {
let result = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise(); let result = await this.processes.GetTasksList("Despacho do Presidente da República", false).toPromise();
let despachosPr; let despachosPr;
let despachos = this.sortService.sortArrayByDate(result);
switch (SessionStore.user.Profile) { switch (SessionStore.user.Profile) {
case 'MDGPR': case 'MDGPR':
despachosPr = result.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho"); despachosPr = despachos.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
break; break;
case 'PR': case 'PR':
despachosPr = result.reverse().filter(data => data.activityInstanceName == "Concluir Despacho"); despachosPr = despachos.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
break; break;
} }
} }
sortArrayISODate(myArray: any) { /* sortArrayISODate(myArray: any) {
return myArray.sort(function(a, b) { return myArray.sort(function(a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
}); });
} } */
} }
+7 -2
View File
@@ -35,6 +35,7 @@ import {MatDatepickerModule} from '@angular/material/datepicker';
import {MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core'; import {MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { Network } from '@ionic-native/network/ngx'; import { Network } from '@ionic-native/network/ngx';
import { File } from '@ionic-native/file/ngx';
import { import {
@@ -55,7 +56,8 @@ import { fab } from '@fortawesome/free-brands-svg-icons'
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { PdfViewerModule } from 'ng2-pdf-viewer'; import { PdfViewerModule } from 'ng2-pdf-viewer';
import { SQLite } from '@ionic-native/sqlite/ngx';
import { CookieService } from 'ngx-cookie-service';
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent],
@@ -107,7 +109,10 @@ import { PdfViewerModule } from 'ng2-pdf-viewer';
WebsocketService, WebsocketService,
ChatService, ChatService,
ScreenOrientation, ScreenOrientation,
Network Network,
File,
SQLite,
CookieService
], ],
bootstrap: [AppComponent], bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
+22 -7
View File
@@ -16,9 +16,13 @@ import { ExpedienteGdStore } from '../store/expedientegd-store.service';
import { InativityService } from '../services/inativity.service'; import { InativityService } from '../services/inativity.service';
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
import { StorageService } from '../services/storage.service'; import { StorageService } from '../services/storage.service';
import { File } from '@ionic-native/file/ngx';
import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service'; import { WebNotificationPopupService } from '../services/notification/web-notification-popup.service';
import { DocumentCounterService } from '../services/worker/document-counter.service'; import { DocumentCounterService } from '../services/worker/document-counter.service';
import { PermissionService } from '../services/worker/permission.service'; import { PermissionService } from '../services/worker/permission.service';
import { Network } from '@ionic-native/network/ngx';
import { BackgroundService } from 'src/app/services/background.service';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@@ -61,6 +65,8 @@ export class HomePage implements OnInit {
synchro = synchro synchro = synchro
status: string = "";
audioName: string = "";
constructor( constructor(
private zone: NgZone, private zone: NgZone,
private router: Router, private router: Router,
@@ -74,7 +80,9 @@ export class HomePage implements OnInit {
private despachoRule: DespachoService, private despachoRule: DespachoService,
private inativityService: InativityService, private inativityService: InativityService,
private storageService: StorageService, private storageService: StorageService,
private webNotificationPopupService: WebNotificationPopupService) { private webNotificationPopupService: WebNotificationPopupService,
private network: Network,
private backgroundservice: BackgroundService) {
this.webNotificationPopupService.askNotificationPermission() this.webNotificationPopupService.askNotificationPermission()
@@ -103,16 +111,20 @@ export class HomePage implements OnInit {
refreshing() { } refreshing() { }
ngOnInit() { ngOnInit() {
/* this.network.checkNetworkConnection;
this.network.checkNetworkDisconnection; */
// console.log('Active route ', this.router.url)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
/* this.webnotification.webconnection(); window.addEventListener('online', () => {
this.webnotification.onReceviNotificationWeb(); */ console.log('Became online')
this.backgroundservice.online()
});
window.addEventListener('offline', () => {
console.log('Became offline')
this.backgroundservice.offline()
});
this.webnotification.webconnection();
this.webnotification.register();
} else { } else {
this.mobilefirstConnect(); this.mobilefirstConnect();
this.notificationsService.getAndpostToken2();
this.notificationsService.onReceviNotification(); this.notificationsService.onReceviNotification();
} }
@@ -129,6 +141,8 @@ export class HomePage implements OnInit {
mobilefirstConnect() { mobilefirstConnect() {
console.log("Mobileconecct");
if (window['WLAuthorizationManager']) { if (window['WLAuthorizationManager']) {
if (window['WLAuthorizationManager'].obtainAccessToken) { if (window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("").then((token) => { window['WLAuthorizationManager'].obtainAccessToken("").then((token) => {
@@ -173,6 +187,7 @@ export class HomePage implements OnInit {
synchro.registerCallback('Online', () => { synchro.registerCallback('Online', () => {
console.log('Onlineee')
}) })
@@ -13,7 +13,7 @@
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Message')?.invalid && validateFrom "> <div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Message')?.invalid && validateFrom || validateField ">
<ion-textarea class="add-border" placeholder="Descrição" [(ngModel)]="postData.DispatchFolder.Message"></ion-textarea> <ion-textarea class="add-border" placeholder="Descrição" [(ngModel)]="postData.DispatchFolder.Message"></ion-textarea>
</div> </div>
</div> </div>
@@ -73,7 +73,8 @@ export class CreateProcessPage implements OnInit {
profile: string; profile: string;
Form: FormGroup; Form: FormGroup;
validateFrom = false validateFrom = false;
validateField = false;
emptyTextDescription = "Sem intervenientes selecionados"; emptyTextDescription = "Sem intervenientes selecionados";
showEmptyContainer = true; showEmptyContainer = true;
@@ -366,6 +367,7 @@ export class CreateProcessPage implements OnInit {
} }
console.log('this.postData', this.postData, this.taskType); console.log('this.postData', this.postData, this.taskType);
if(this.postData.DispatchFolder.Message){
try { try {
await this.despachoService.createDespacho(this.postData).toPromise(); await this.despachoService.createDespacho(this.postData).toPromise();
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise(); await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise();
@@ -375,9 +377,14 @@ export class CreateProcessPage implements OnInit {
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não efectuado'); this.toastService.badRequest('Processo não efectuado');
} finally { } finally {
loader.remove() //loader.remove();
} }
}
else{
this.validateField = true;
this.toastService.badRequest('Por favor adicione uma nota');
}
loader.remove();
break; break;
case '1': // Pedido de Parecer case '1': // Pedido de Parecer
this.postData = { this.postData = {
+6
View File
@@ -11,6 +11,7 @@ import { JsonStore } from '../../services/jsonStore.service';
import { StorageService } from '../../services/storage.service'; import { StorageService } from '../../services/storage.service';
import { NotificationsService } from '../../services/notifications.service'; import { NotificationsService } from '../../services/notifications.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { EventTrigger } from '../../services/eventTrigger.service';
@Component({ @Component({
selector: 'app-profile', selector: 'app-profile',
@@ -43,6 +44,7 @@ export class ProfilePage implements OnInit {
private notificationservice: NotificationsService, private notificationservice: NotificationsService,
private platform: Platform, private platform: Platform,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private eventtrigger: EventTrigger
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
@@ -200,6 +202,10 @@ export class ProfilePage implements OnInit {
this.notificationservice.tempClearArray(); this.notificationservice.tempClearArray();
this.deleteNotification(index); this.deleteNotification(index);
this.eventtrigger.publishSomeData({
notification: "deleted"
})
} }
@@ -5,7 +5,7 @@
<fa-icon icon="chevron-left" class="menu-icon"></fa-icon> <fa-icon icon="chevron-left" class="menu-icon"></fa-icon>
</div> </div>
<div class="middle"> <div class="middle add-ellipsis">
{{file.title}} {{file.title}}
</div> </div>
@@ -42,6 +42,8 @@ export class ViewDocumentPage implements OnInit {
this.file.title = 'Sem Título' this.file.title = 'Sem Título'
} }
console.log(this.task)
} }
ngOnInit() { ngOnInit() {
@@ -72,6 +74,8 @@ export class ViewDocumentPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then((res)=>{ modal.onDidDismiss().then((res)=>{
if(res.data) {
if(res.data.component == 'openBookMeetingModal') { if(res.data.component == 'openBookMeetingModal') {
this.openBookMeetingModal() this.openBookMeetingModal()
} else if(res.data.component == 'openExpedientActionsModal') { } else if(res.data.component == 'openExpedientActionsModal') {
@@ -79,6 +83,8 @@ export class ViewDocumentPage implements OnInit {
} else { } else {
console.log('component not found') console.log('component not found')
} }
}
}) })
} }
+1 -1
View File
@@ -138,7 +138,7 @@
<calendar <calendar
class="calendar-component" class="calendar-component"
[eventSource]="CalendarStore.eventSource" [eventSource]="listToPresent"
[calendarMode]="calendar.mode" [calendarMode]="calendar.mode"
[currentDate]="calendar.currentDate" [currentDate]="calendar.currentDate"
(onEventSelected)="onEventSelected($event)" (onEventSelected)="onEventSelected($event)"
+138 -47
View File
@@ -1,6 +1,6 @@
import { Component, OnInit, ViewChild, Inject, LOCALE_ID } from '@angular/core'; import { Component, OnInit, ViewChild, Inject, LOCALE_ID } from '@angular/core';
import { CalendarComponent } from 'ionic2-calendar'; import { CalendarComponent } from 'ionic2-calendar';
import { AlertController, ModalController } from '@ionic/angular'; import { AlertController, ModalController, Platform } from '@ionic/angular';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { Event } from '../../models/event.model'; import { Event } from '../../models/event.model';
import { Router, NavigationEnd } from '@angular/router'; import { Router, NavigationEnd } from '@angular/router';
@@ -29,6 +29,9 @@ import { CalendarStore } from 'src/app/store/calendar.service';
import { ListBoxService } from 'src/app/services/agenda/list-box.service'; import { ListBoxService } from 'src/app/services/agenda/list-box.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service'; import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
selector: 'app-agenda', selector: 'app-agenda',
@@ -156,6 +159,7 @@ export class AgendaPage implements OnInit {
dropdownScrollWeal = false dropdownScrollWeal = false
CalendarStore = CalendarStore CalendarStore = CalendarStore
listToPresent
constructor( constructor(
private alertCtrl: AlertController, private alertCtrl: AlertController,
@@ -169,7 +173,9 @@ export class AgendaPage implements OnInit {
private dateAdapter: DateAdapter<any>, private dateAdapter: DateAdapter<any>,
private toastService: ToastService, private toastService: ToastService,
private listBoxService: ListBoxService, private listBoxService: ListBoxService,
private changeProfileService: ChangeProfileService private changeProfileService: ChangeProfileService,
private sqliteservice: SqliteService,
private platform: Platform
) { ) {
this.dateAdapter.setLocale('es'); this.dateAdapter.setLocale('es');
@@ -223,27 +229,7 @@ export class AgendaPage implements OnInit {
ngOnInit() { ngOnInit() {
this.getFromDB()
const pathname = window.location.pathname
let realoadCounter = 0
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname ) {
if (this.segment == null) {
this.segment = "Combinado";
}
if ( realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
realoadCounter++;
}
});
window.onresize = (event) => { window.onresize = (event) => {
// if not table remove all component // if not table remove all component
@@ -488,14 +474,15 @@ export class AgendaPage implements OnInit {
this.showLoader = true; this.showLoader = true;
// mobile only
if (window.innerWidth < 800) { if (window.innerWidth < 800) {
// view MDGPR calendar with MDGPR profile
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then( this.eventService.getAllMdEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then(
(response: any) => { (response: any) => {
console.log('ALL MD EVENTS', response);
this.addEventToDB(response, "md");
// calendar // calendar
this.CalendarStore.removeRange(startTime, endTime, 'md') this.CalendarStore.removeRange(startTime, endTime, 'md')
@@ -503,7 +490,26 @@ export class AgendaPage implements OnInit {
// loop // loop
this.CalendarStore.pushEvent(response, 'md'); this.CalendarStore.pushEvent(response, 'md');
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) console.log('CALENDAR STORE',this.CalendarStore.eventSource)
let array = []
response.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: "md",
id: element.EventId,
}
array.push(event)
});
this.listToPresent = array;
console.log('LIST TO PRESET',this.listToPresent)
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
@@ -524,8 +530,9 @@ export class AgendaPage implements OnInit {
this.CalendarStore.removeRange(startTime, endTime, 'pr') this.CalendarStore.removeRange(startTime, endTime, 'pr')
// calendar // calendar
this.CalendarStore.pushEvent(response, 'pr'); this.CalendarStore.pushEvent(response, 'pr');
this.listToPresent = response;
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
@@ -538,21 +545,37 @@ export class AgendaPage implements OnInit {
}) })
} }
// view PR calendar with PR profile
else if (this.loggeduser.Profile == 'PR') { else if (this.loggeduser.Profile == 'PR') {
this.eventService.getAllPrEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then( this.eventService.getAllPrEvents(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59')).then(
(response: any) => { (response: any) => {
console.log('ALL EVENT PR', response)
this.addEventToDB(response, "pr");
// clear the current month only // clear the current month only
// response == september // response == september
// startTime = 1, endTime = 31 // startTime = 1, endTime = 31
this.CalendarStore.removeRange(startTime, endTime, 'pr') this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(response, 'pr'); this.CalendarStore.pushEvent(response, 'pr');
let array = []
response.array.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.profile,
id: element.EventId,
}
array.push(event)
});
this.listToPresent = array;
// this.CalendarStore.eventSource // this.CalendarStore.eventSource
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update(); this.myCal.update();
@@ -583,8 +606,9 @@ export class AgendaPage implements OnInit {
// loop // loop
this.CalendarStore.pushEvent(eventsList, 'md'); this.CalendarStore.pushEvent(eventsList, 'md');
this.listToPresent = eventsList;
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
@@ -612,8 +636,9 @@ export class AgendaPage implements OnInit {
this.CalendarStore.removeRange(startTime, endTime, 'pr') this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(eventsList, 'pr'); this.CalendarStore.pushEvent(eventsList, 'pr');
this.listToPresent = eventsList;
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update(); this.myCal.update();
this.myCal.loadEvents(); this.myCal.loadEvents();
@@ -651,8 +676,9 @@ export class AgendaPage implements OnInit {
this.CalendarStore.removeRange(startTime, endTime, 'pr') this.CalendarStore.removeRange(startTime, endTime, 'pr')
this.CalendarStore.pushEvent(eventsList, 'pr'); this.CalendarStore.pushEvent(eventsList, 'pr');
this.listToPresent = eventsList;
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.myCal.update(); this.myCal.update();
@@ -677,6 +703,72 @@ export class AgendaPage implements OnInit {
} }
} }
addEventToDB(response, profile) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
if (response.length > 0) {
response.forEach(element => {
let event = {
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
EndDate: element.EndDate,
EventId: element.EventId,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
Location: element.Location,
StartDate: element.StartDate,
Subject: element.Subject,
Profile: profile
}
this.sqliteservice.addEvent(event)
});
}
}
}
getFromDB() {
if (synchro.connected === true) {
const pathname = window.location.pathname
let realoadCounter = 0
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
if (this.segment == null) {
this.segment = "Combinado";
}
if (realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
realoadCounter++;
}
});
console.log('LISTTOPRESENT', this.listToPresent)
} else {
console.log('ALL EVENTS FROM DB AGENDA OFFLINE')
this.sqliteservice.getAllEvents().then((events: any[]) => {
let eventArray = [];
events.forEach(element => {
let event = {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: element.profile,
id: element.EventId,
}
eventArray.push(event);
});
console.log('ALL EVENTS FROM DB', events)
this.listToPresent = eventArray
})
}
}
updateEventListBox() { updateEventListBox() {
if (window.innerWidth < 800) { if (window.innerWidth < 800) {
@@ -685,47 +777,47 @@ export class AgendaPage implements OnInit {
case "Combinado": case "Combinado":
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
else if (this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') { else if (this.profile == "pr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
else if (this.loggeduser.Profile == 'PR') { else if (this.loggeduser.Profile == 'PR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
break; break;
case "Pessoal": case "Pessoal":
//Inicializa o array eventSource //Inicializa o array eventSource
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
else { else {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
break; break;
case "Oficial": case "Oficial":
if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') { if (this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, {})
} else { } else {
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
break; break;
} }
} else { } else {
this.TimelinePRList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelinePRList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
@@ -810,13 +902,13 @@ export class AgendaPage implements OnInit {
if (this.profile == "mdgpr") { if (this.profile == "mdgpr") {
this.profile = "pr"; this.profile = "pr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'pr', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'pr', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
else { else {
this.profile = "mdgpr"; this.profile = "mdgpr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate); this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.TimelineMDList = this.listBoxService.list(this.CalendarStore.eventSource, 'md', this.rangeStartDate, this.rangeEndDate, {segment:this.segment, selectedDate: this.eventSelectedDate}) this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
} }
} }
@@ -860,8 +952,7 @@ export class AgendaPage implements OnInit {
openAddEventDismiss(data) { openAddEventDismiss(data) {
let postEvent: Event = data; let postEvent: Event = data;
if (postEvent.Subject != null) if (postEvent.Subject != null) {
{
// this.eventSource.push({ // this.eventSource.push({
// title: postEvent.Subject, // title: postEvent.Subject,
// startTime: new Date(postEvent.StartDate), // startTime: new Date(postEvent.StartDate),
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { AlertController, ModalController, PopoverController } from '@ionic/angular'; import { AlertController, ModalController, PopoverController, Platform } from '@ionic/angular';
import { EventBody } from 'src/app/models/eventbody.model'; import { EventBody } from 'src/app/models/eventbody.model';
import { AttachmentsService } from 'src/app/services/attachments.service'; import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
@@ -12,6 +12,8 @@ import { ActivatedRoute, Router } from '@angular/router';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page'; import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
import { Location } from '@angular/common' import { Location } from '@angular/common'
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from '../../../services/socket/synchro.service';
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage'; import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page'; import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
import { ExpedientTaskModalPage } from '../../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page'; import { ExpedientTaskModalPage } from '../../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
@@ -46,6 +48,7 @@ export class ViewEventPage implements OnInit {
dicIndex = 0; dicIndex = 0;
isModal = false isModal = false
header = true header = true
synch = synchro;
task: ExpedientTaskModalPageNavParamsTask; task: ExpedientTaskModalPageNavParamsTask;
LoadedDocument:any = null; LoadedDocument:any = null;
@@ -61,7 +64,11 @@ export class ViewEventPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
private toastService: ToastService, private toastService: ToastService,
private location: Location private location: Location,
public platform: Platform,
private sqliteservice: SqliteService
) )
{ {
this.isEventEdited = false; this.isEventEdited = false;
@@ -93,8 +100,22 @@ export class ViewEventPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
if(synchro.connected === true) {
this.loadEvent(); this.loadEvent();
console.log('Onlineee view-event')
} else {
this.sqliteservice.getEventById(this.eventId).then((event) => {
this.loadedEvent = event[0];
console.log("Event ditails local,", event[0])
})
console.log('Offlineee')
}
/* this.sqliteservice.getEventById(this.eventId).then((event) => {
this.loadedEvent = event[0];
console.log("Event ditails local,", event[0])
})
this.loadEvent(); */
window.onresize = (event) => { window.onresize = (event) => {
@@ -137,6 +158,8 @@ export class ViewEventPage implements OnInit {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
this.eventsService.getEvent(this.eventId).subscribe(res => { this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res; this.loadedEvent = res;
this.sqliteservice.addEvent(res);
console.log('Loaded one event', res)
/* this.today = new Date(res.StartDate); /* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */ this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove() loader.remove()
@@ -356,4 +379,26 @@ export class ViewEventPage implements OnInit {
modal.onDidDismiss().then( async(res)=>{}); modal.onDidDismiss().then( async(res)=>{});
} }
getEventsFromLocalDb() {
console.log("event id details ", this.eventId)
synchro.registerCallback('Online', () => {
this.loadEvent();
console.log('Onlineee view-event')
})
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getEventById(this.eventId).then((event) => {
this.loadedEvent = event[0];
console.log("Event ditails local,", event[0])
})
console.log('Offlineee')
})
})
}
} }
@@ -504,6 +504,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.chatService.getRoomMessages(roomId).subscribe(async res => { this.chatService.getRoomMessages(roomId).subscribe(async res => {
console.log("Chat message",res)
if (res == 502) { if (res == 502) {
+2 -2
View File
@@ -43,7 +43,7 @@
<div class="content overflow-y-auto flex-grow-1 height-100"> <div class="content overflow-y-auto flex-grow-1 height-100">
<ion-list> <ion-list>
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of toDayEventStorage.eventsList" <ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of listToPresent"
(click)="goToEvent(event.EventId)" (click)="goToEvent(event.EventId)"
> >
<div class="d-flex content-{{loggeduser.Profile}}-{{event.CalendarName}}"> <div class="d-flex content-{{loggeduser.Profile}}-{{event.CalendarName}}">
@@ -90,7 +90,7 @@
</div> </div>
<div class="content overflow-y-auto flex-grow-1 height-100"> <div class="content overflow-y-auto flex-grow-1 height-100">
<ion-list> <ion-list>
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of expedienteGdStore.list" <ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of listToPresentexpediente"
(click)="goToExpediente(task.SerialNumber)"> (click)="goToExpediente(task.SerialNumber)">
<div class="item-exp d-flex"> <div class="item-exp d-flex">
<div class="schedule-date"> <div class="schedule-date">
+113 -17
View File
@@ -16,6 +16,9 @@ import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe'; import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from '../../services/socket/synchro.service';
import { BackgroundService } from 'src/app/services/background.service'
@Component({ @Component({
selector: 'app-events', selector: 'app-events',
@@ -65,8 +68,8 @@ export class EventsPage implements OnInit {
toDayEventStorage = ToDayEventStorage toDayEventStorage = ToDayEventStorage
expedienteGdStore = ExpedienteGdStore expedienteGdStore = ExpedienteGdStore
listToPresent = [];
pdfSrc = "https://www.tabularium.pt/file-upload/FSovLiyEa8Hqy2iDA/TK-Justificativo.pdf"; listToPresentexpediente =[]
expedienteTaskPipe = new ExpedienteTaskPipe() expedienteTaskPipe = new ExpedienteTaskPipe()
@@ -75,6 +78,7 @@ export class EventsPage implements OnInit {
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
existingScreenOrientation: string; existingScreenOrientation: string;
synch = synchro
constructor( constructor(
private eventService: EventsService, private eventService: EventsService,
@@ -88,6 +92,8 @@ export class EventsPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private screenOrientation: ScreenOrientation, private screenOrientation: ScreenOrientation,
public platform: Platform, public platform: Platform,
private sqliteservice: SqliteService,
private backgroundservice: BackgroundService
) { ) {
this.existingScreenOrientation = this.screenOrientation.type; this.existingScreenOrientation = this.screenOrientation.type;
console.log(this.existingScreenOrientation); console.log(this.existingScreenOrientation);
@@ -102,6 +108,15 @@ export class EventsPage implements OnInit {
}); });
/* if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
try {
this.sqliteservice.databaseConn();
} catch (error) {
console.log("Error creating local database: ", error)
}
} */
} }
ngOnInit() { ngOnInit() {
@@ -109,6 +124,7 @@ export class EventsPage implements OnInit {
this.segment = "Combinada"; this.segment = "Combinada";
this.profile = "mdgpr"; this.profile = "mdgpr";
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.showGreeting(); this.showGreeting();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
@@ -120,6 +136,9 @@ export class EventsPage implements OnInit {
} }
}); });
this.hideSearch(); this.hideSearch();
}
this.getEventsFromLocalDb();
//this.checkScreenOrientation(); //this.checkScreenOrientation();
@@ -184,15 +203,25 @@ export class EventsPage implements OnInit {
let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise(); let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise();
const list = mdOficialEvents.concat(mdPessoalEvents); const list = mdOficialEvents.concat(mdPessoalEvents);
console.log("getAllMdOficialPessoalEvents", list)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
if(list.length > 0) {
list.forEach(element => {
this.sqliteservice.addEvent(element)
});
}
}
this.listToPresent = list
this.toDayEventStorage.reset(list)
if(this.toDayEventStorage.eventsList.length > 0){
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject; if (list.length > 0) {
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate; this.currentEvent = list[0].Subject;
this.currentHoursMinutes = list[0].StartDate;
} }
this.totalEvent = this.toDayEventStorage.eventsList.length; this.totalEvent = list.length;
this.showLoader = false; this.showLoader = false;
} }
@@ -202,15 +231,22 @@ export class EventsPage implements OnInit {
let prPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise(); let prPessoalEvents = await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
const list = prOficialEvents.concat(prPessoalEvents); const list = prOficialEvents.concat(prPessoalEvents);
console.log("getAllPrOficialPessoalEvents", list)
this.toDayEventStorage.reset(list) if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
if(this.toDayEventStorage.eventsList.length > 0) { if(list.length > 0) {
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject; list.forEach(element => {
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate; this.sqliteservice.addEvent(element)
});
}
}
if (list.length > 0) {
this.currentEvent = list[0].Subject;
this.currentHoursMinutes = list[0].StartDate;
} }
this.totalEvent = this.toDayEventStorage.eventsList.length; this.listToPresent = list;
this.totalEvent = list.length;
this.showLoader = false; this.showLoader = false;
} }
@@ -286,6 +322,57 @@ export class EventsPage implements OnInit {
} */ } */
} }
getEventsFromLocalDb() {
if (synchro.connected === true) {
this.showGreeting();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
setTimeout(() => {
this.LoadList();
}, 1500)
}
});
this.hideSearch();
} else {
this.platform.ready().then(async () => {
this.sqliteservice.getAllEvents().then((event:any[]) => {
this.listToPresent = event
this.totalEvent = this.listToPresent.length
this.currentEvent = this.listToPresent[0].Subject
this.currentHoursMinutes = this.listToPresent[0].StartDate
console.log("All events from local,", event)
})
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[]) => {
var expedientlist = [];
process.forEach((element) => {
let task = {
CreateDate: element.taskStartDate,
DocumentsQty: element.totalDocuments,
Senders: JSON.parse(element.workflowInstanceDataFields).Sender,
SerialNumber: element.serialNumber,
Status: JSON.parse(element.workflowInstanceDataFields).Status,
Subject: JSON.parse(element.workflowInstanceDataFields).Subject,
WorkflowName: element.workflowDisplayName,
activityInstanceName: element.activityInstanceName,
taskStartDate: element.taskStartDate,
}
expedientlist.push(task);
})
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
this.listToPresentexpediente = ExpedienteTask;
})
});
}
}
showGreeting() { showGreeting() {
if (this.today.getHours() >= 6 && this.today.getHours() < 12) { if (this.today.getHours() >= 6 && this.today.getHours() < 12) {
this.greetting = this.grettings[0]; this.greetting = this.grettings[0];
@@ -315,8 +402,7 @@ export class EventsPage implements OnInit {
} }
} }
logout() logout() {
{
this.authService.ValidatedUser.BasicAuthKey = ""; this.authService.ValidatedUser.BasicAuthKey = "";
this.router.navigate(['/home/login']); this.router.navigate(['/home/login']);
} }
@@ -340,10 +426,17 @@ export class EventsPage implements OnInit {
LoadList() { LoadList() {
this.processes.GetTaskListExpediente(false).subscribe(result => { this.processes.GetTaskListExpediente(false).subscribe(result => {
console.log("Expediente", result); console.log("Expediente", result);
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
} else {
this.sqliteservice.addProcess(result)
}
const ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e)) const ExpedienteTask = result.map(e => this.expedienteTaskPipe.transform(e))
this.expedienteGdStore.reset(ExpedienteTask) console.log("Expediente 2", ExpedienteTask);
this.listToPresentexpediente = ExpedienteTask;
}); });
} }
@@ -388,5 +481,8 @@ export class EventsPage implements OnInit {
} }
} }
@@ -20,6 +20,9 @@ import { Location } from '@angular/common'
import { DespachoService } from 'src/app/Rules/despacho.service'; import { DespachoService } from 'src/app/Rules/despacho.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
selector: 'app-despacho-pr', selector: 'app-despacho-pr',
templateUrl: './despacho-pr.page.html', templateUrl: './despacho-pr.page.html',
@@ -52,7 +55,8 @@ export class DespachoPrPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private toastService: ToastService, private toastService: ToastService,
private location: Location, private location: Location,
private despachoService: DespachoService private despachoService: DespachoService,
private sqliteservice: SqliteService
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) { if (params["params"].SerialNumber) {
@@ -69,17 +73,7 @@ export class DespachoPrPage implements OnInit {
ngOnInit() { ngOnInit() {
this.profile = "mdgpr"; this.profile = "mdgpr";
console.log(this.serialNumber); console.log(this.serialNumber);
this.getFromDB();
this.activateRoute.paramMap.subscribe(paramMap => {
if (!paramMap.has('SerialNumber')) {
return;
}
/* this.serialNumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
});
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
} }
close() { close() {
@@ -114,12 +108,16 @@ export class DespachoPrPage implements OnInit {
console.log(this.task); console.log(this.task);
console.log('GetTask', res); console.log('GetTask', res);
this.sqliteservice.updateProcess(res)
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => { this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
console.log('internen despacho pr ')
})
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
@@ -148,6 +146,71 @@ export class DespachoPrPage implements OnInit {
}); });
} }
getFromDB() {
if (synchro.connected === true) {
this.activateRoute.paramMap.subscribe(paramMap => {
if (!paramMap.has('SerialNumber')) {
return;
}
/* this.serialNumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
});
this.LoadTaskDetail(this.serialNumber);
// this.LoadRelatedEvents(this.serialNumber);
} else {
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
console.log('OFFLINE', process)
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].originator).email,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"activityInstanceName": process[0].activityInstanceName,
}
console.log("OFFLINE TASK", this.task)
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak;
console.log(this.task);
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'I';
});
this.cc = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'CC';
});
})
}
}
async viewDocument(DocId:string, Document) { async viewDocument(DocId:string, Document) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -162,7 +225,8 @@ export class DespachoPrPage implements OnInit {
Document, Document,
applicationId: Document.ApplicationId, applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId, docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId folderId: this.task.FolderId,
task: this.fulltask
}, },
cssClass: 'modal modal-desktop' cssClass: 'modal modal-desktop'
}); });
@@ -15,7 +15,9 @@
</button> </button>
</div> </div>
</div> </div>
<div *ngIf="loggeduser.Profile =='MDGPR'" class="bottom-title d-flex"><h3 class="bottom-text">Presidente da República</h3></div> <!-- <div *ngIf="loggeduser.Profile =='MDGPR'" class="bottom-title d-flex">
<h3 class="bottom-text">Presidente da República</h3>
</div> -->
</ion-header> </ion-header>
<ion-content> <ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()"> <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh()">
@@ -33,7 +35,7 @@
<ion-list> <ion-list>
<div <div
class="expediente ion-no-padding ion-no-margin cursor-pointer" class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of despachoprstore.list; let i = index" *ngFor = "let task of listToPresent; let i = index"
(click)="goToDespachoPr(task.SerialNumber)" (click)="goToDespachoPr(task.SerialNumber)"
> >
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" --> <!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
@@ -67,13 +69,13 @@
</div> </div>
<div <div
*ngIf="!skeletonLoader && despachoprstore.list.length == 0" *ngIf="!skeletonLoader && listToPresent.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center" class="empty-list d-flex height-100 align-center justify-content-center"
> >
<span>Lista vazia</span> <span>Lista vazia</span>
</div> </div>
<!-- <div *ngIf="skeletonLoader && despachoprstore.list.length == 0"> <!-- <div *ngIf="skeletonLoader && listToPresent.length == 0">
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-thumbnail slot="end"> <ion-thumbnail slot="end">
@@ -17,6 +17,10 @@ import { NavigationEnd, NavigationExtras, NavigationStart, Router } from '@angul
import { __awaiter } from 'tslib'; import { __awaiter } from 'tslib';
import { DespachosprStore } from 'src/app/store/despachospr-store.service'; import { DespachosprStore } from 'src/app/store/despachospr-store.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({ @Component({
selector: 'app-despachos-pr', selector: 'app-despachos-pr',
templateUrl: './despachos-pr.page.html', templateUrl: './despachos-pr.page.html',
@@ -48,6 +52,7 @@ export class DespachosPrPage implements OnInit {
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
skeletonLoader = true skeletonLoader = true
despachoprstore = DespachosprStore despachoprstore = DespachosprStore
listToPresent = [];
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
@@ -55,6 +60,8 @@ export class DespachosPrPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
private authService: AuthService, private authService: AuthService,
private router: Router, private router: Router,
private sqliteservice: SqliteService,
private sortService: SortService,
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
@@ -65,22 +72,7 @@ export class DespachosPrPage implements OnInit {
ngOnInit() { ngOnInit() {
//Inicializar segment //Inicializar segment
this.segment = "despachos"; this.segment = "despachos";
this.getFromDB();
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
}
});
} }
segmentChanged(ev: any) { segmentChanged(ev: any) {
@@ -110,14 +102,13 @@ export class DespachosPrPage implements OnInit {
console.log(result); console.log(result);
let despachosPr; let despachosPr;
let despachos = this.sortService.sortArrayByDate(result);
switch (this.loggeduser.Profile) { switch (this.loggeduser.Profile) {
case 'MDGPR': case 'MDGPR':
despachosPr = await result.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho"); despachosPr = await despachos.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
break; break;
case 'PR': case 'PR':
console.log(result); despachosPr = await despachos.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
despachosPr = await result.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
break; break;
} }
@@ -146,14 +137,72 @@ export class DespachosPrPage implements OnInit {
this.despachoList.push(task); this.despachoList.push(task);
console.log(this.despachoList); console.log(this.despachoList);
}); });
this.despachoprstore.reset(this.despachoList); this.listToPresent = this.despachoList
} }
sortArrayISODate(myArray: any) { getFromDB() {
return myArray.sort(function(a, b) { if (synchro.connected === true) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
}
}); });
} else {
this.sqliteservice.getAllProcess().then((all) => {
console.log('DESPACHO PR ALL', all)
})
this.sqliteservice.getprocessByworkflow('Despacho do Presidente da República').then(async (process: any[]) => {
console.log('DESPACHO PR', process)
let despachosPr;
switch (this.loggeduser.Profile) {
case 'MDGPR':
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Tarefa de Despacho");
break;
case 'PR':
console.log(process);
despachosPr = await process.reverse().filter(data => data.activityInstanceName == "Concluir Despacho");
break;
}
despachosPr = despachosPr.filter(data => JSON.parse(data.workflowInstanceDataFields).Status == "Active");
despachosPr.forEach((element, index) => {
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": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
}
this.despachoList.push(task);
console.log(this.despachoList);
});
this.listToPresent = this.despachoList;
})
}
} }
doRefresh() { doRefresh() {
@@ -33,8 +33,8 @@
<h5 *ngIf="intervenientes">Intervenientes</h5> <h5 *ngIf="intervenientes">Intervenientes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let task of intervenientes">
<p>{{interveniente.Name}}</p> <p>{{task.Name}}</p>
</div> </div>
</ion-label> </ion-label>
</ion-item> </ion-item>
@@ -19,6 +19,10 @@ import { AttachmentList } from 'src/app/models/Excludetask';
import { PermissionService } from 'src/app/services/worker/permission.service'; import { PermissionService } from 'src/app/services/worker/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { synchro } from 'src/app/services/socket/synchro.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { Platform } from '@ionic/angular';
@Component({ @Component({
selector: 'app-despacho', selector: 'app-despacho',
templateUrl: './despacho.page.html', templateUrl: './despacho.page.html',
@@ -42,6 +46,8 @@ export class DespachoPage implements OnInit {
intervenientes: any; intervenientes: any;
cc: any = []; cc: any = [];
synch = synchro;
constructor(private activateRoute: ActivatedRoute, constructor(private activateRoute: ActivatedRoute,
private processes: ProcessesService, private processes: ProcessesService,
private iab: InAppBrowser, private iab: InAppBrowser,
@@ -52,8 +58,12 @@ export class DespachoPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private despachoService: DespachoService, private despachoService: DespachoService,
private location: Location, private location: Location,
public p: PermissionService) { public p: PermissionService,
private sqliteservice: SqliteService,
private platform: Platform
) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) { if (params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber; this.serialnumber = params["params"].SerialNumber;
@@ -71,8 +81,8 @@ export class DespachoPage implements OnInit {
return; return;
} }
}); });
this.getFromDb()
this.LoadTaskDetail(this.serialnumber)
} }
close() { close() {
@@ -113,7 +123,7 @@ export class DespachoPage implements OnInit {
async LoadTaskDetail(serial: string) { async LoadTaskDetail(serial: string) {
this.processes.GetTask(serial).subscribe((res: fullTask) => { this.processes.GetTask(serial).subscribe((res: fullTask) => {
console.log('despacho detail', res)
this.task = { this.task = {
"SerialNumber": res.serialNumber, "SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject, "Folio": res.workflowInstanceDataFields.Subject,
@@ -131,17 +141,23 @@ export class DespachoPage implements OnInit {
"activityInstanceName": res.activityInstanceName, "activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
this.sqliteservice.updateProcess(res);
this.fulltask = res; this.fulltask = res;
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => { this.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users))
console.log('interveniers online', users)
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
console.log('interveniers online 2', users)
return user.Type == 'I'; return user.Type == 'I';
}); });
this.cc = users.filter(user => { this.cc = users.filter(user => {
console.log('interveniers online 3', users)
return user.Type == 'CC'; return user.Type == 'CC';
}); });
}); });
@@ -160,8 +176,85 @@ export class DespachoPage implements OnInit {
}); });
} }
getFromDb() {
if (synchro.connected === true) {
this.LoadTaskDetail(this.serialnumber)
}
if (synchro.connected === false) {
this.platform.ready().then(() => {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var intervine = JSON.parse(process[0].interveners)
var origina
if (process[0].originator === "undefined") {
origina = ""
} else {
origina = JSON.parse(process[0].originator)
}
console.log('sqlite', process)
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
"Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender,
"Note": workflow.TaskMessage || workflow.Note,
"FolderId": workflow.FolderID,
"FsId": workflow.FsId,
"DocId": workflow.DocID,
"DocumentsQty": process[0].DocumentsQty,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": workflow.DeadlineType,
"activityInstanceName": process[0].activityInstanceName,
"Status": workflow.Status,
}
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak;
console.log('interveniers offline', intervine)
this.intervenientes = intervine.filter(user => {
console.log('interveniers offline 2', user)
return user.Type == 'I';
});
this.cc = intervine.filter(user => {
console.log('interveniers offline 3', user)
return user.Type == 'CC';
});
})
})
}
}
async viewDocument(docId:string, Document) { async viewDocument(docId:string, Document) {
console.log(this.fulltask)
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: ViewDocumentPage, component: ViewDocumentPage,
componentProps: { componentProps: {
@@ -33,7 +33,7 @@
<ion-list> <ion-list>
<div <div
class="expediente ion-no-padding ion-no-margin cursor-pointer" class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of despachoStore.list; let i = index" *ngFor = "let task of listToPresent; let i = index"
(click)="GoToDespacho(task.SerialNumber)" (click)="GoToDespacho(task.SerialNumber)"
> >
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" --> <!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
@@ -68,13 +68,13 @@
</div> </div>
<div <div
*ngIf="!skeletonLoader && despachoStore.list.length == 0" *ngIf="!skeletonLoader && listToPresent.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center" class="empty-list d-flex height-100 align-center justify-content-center"
> >
<span>Lista vazia</span> <span>Lista vazia</span>
</div> </div>
<div *ngIf="skeletonLoader && despachoStore.list.length == 0"> <div *ngIf="skeletonLoader && listToPresent.length == 0">
<ion-list> <ion-list>
<ion-item> <ion-item>
@@ -3,6 +3,11 @@ import { NavigationStart, Router } from '@angular/router';
import { DespachoService } from 'src/app/Rules/despacho.service'; import { DespachoService } from 'src/app/Rules/despacho.service';
import { DespachoStore } from 'src/app/store/despacho-store.service'; import { DespachoStore } from 'src/app/store/despacho-store.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { Platform } from '@ionic/angular';
import { isThisHour } from 'date-fns';
@Component({ @Component({
selector: 'app-despachos', selector: 'app-despachos',
templateUrl: './despachos.page.html', templateUrl: './despachos.page.html',
@@ -12,29 +17,21 @@ import { DespachoStore } from 'src/app/store/despacho-store.service';
export class DespachosPage implements OnInit { export class DespachosPage implements OnInit {
despachoStore = DespachoStore; despachoStore = DespachoStore;
synch = synchro;
listToPresent = [];
constructor( constructor(
private router: Router, private router: Router,
private despachoRule: DespachoService private despachoRule: DespachoService,
) {} private sqliteservice: SqliteService,
private platform: Platform
) {
}
ngOnInit() { ngOnInit() {
const location = window.location this.getFromDb()
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} }
async refreshing() { async refreshing() {
@@ -49,7 +46,60 @@ export class DespachosPage implements OnInit {
async LoadList() { async LoadList() {
await this.despachoRule.getList({updateStore: true}) await this.despachoRule.getList({ updateStore: true }).then((pre) => {
this.listToPresent = pre;
console.log('despachooo', pre)
})
}
getFromDb() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
}
if (synchro.connected === false) {
this.platform.ready().then(() => {
this.sqliteservice.getDespachosProcess('Tarefa de Despacho').then((process: any[]) => {
var listtopresent = [];
process.forEach(element => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
let task = {
"CreateDate": element.taskStartDate,
"DocId": workflow.DispatchDocID,
"DocumentURL": undefined,
"DocumentsQty": element.totalDocuments,
"FolderID": workflow.FolderID,
"Folio": workflow.Subject,
"Remetente": undefined,
"Senders": workflow.Sender,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
listtopresent.push(task);
});
this.listToPresent = listtopresent;
})
})
}
} }
get skeletonLoader(): boolean { get skeletonLoader(): boolean {
@@ -65,7 +115,6 @@ export class DespachosPage implements OnInit {
} }
async GoToDespacho(serialNumber: any) { async GoToDespacho(serialNumber: any) {
console.log('Despachos serial',serialNumber)
this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/despachos', serialNumber, 'gabinete-digital']);
} }
@@ -149,7 +149,8 @@ export class DiplomaAssinarPage implements OnInit {
Document, Document,
applicationId: Document.ApplicationId, applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId, docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId folderId: this.task.FolderId,
task: this.fulltask
}, },
cssClass: 'modal modal-desktop' cssClass: 'modal modal-desktop'
}); });
@@ -7,6 +7,7 @@ import { ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { DiplomaPage } from 'src/app/pages/gabinete-digital/diplomas/diploma/diploma.page'; import { DiplomaPage } from 'src/app/pages/gabinete-digital/diplomas/diploma/diploma.page';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({ @Component({
selector: 'app-diplomas-assinar', selector: 'app-diplomas-assinar',
@@ -31,6 +32,7 @@ export class DiplomasAssinarPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private alertService: AlertService, private alertService: AlertService,
private router: Router, private router: Router,
private sortService: SortService,
) { ) {
} }
@@ -78,8 +80,7 @@ export class DiplomasAssinarPage implements OnInit {
this.diplomasList = []; this.diplomasList = [];
let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma"); let diplomasAssinar = diplomas.reverse().filter(data => data.activityInstanceName == "Assinar Diploma");
console.log(diplomasAssinar); diplomasAssinar = this.sortService.sortArrayByDate(diplomasAssinar);
diplomasAssinar.forEach(element => { diplomasAssinar.forEach(element => {
let task: customTask = this.customTaskPipe.transform(element) let task: customTask = this.customTaskPipe.transform(element)
this.diplomasList.push(task); this.diplomasList.push(task);
@@ -13,6 +13,9 @@ import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
selector: 'app-diploma', selector: 'app-diploma',
templateUrl: './diploma.page.html', templateUrl: './diploma.page.html',
@@ -43,6 +46,7 @@ export class DiplomaPage implements OnInit {
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
private location: Location, private location: Location,
private sqliteservice: SqliteService
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]); // console.log(params["params"]);
@@ -60,7 +64,7 @@ export class DiplomaPage implements OnInit {
ngOnInit() { ngOnInit() {
this.profile = "mdgpr"; this.profile = "mdgpr";
this.LoadTaskDetail(this.serialNumber); this.getFromDb();
} }
goBack() { goBack() {
@@ -126,11 +130,15 @@ export class DiplomaPage implements OnInit {
"activityInstanceName": res.activityInstanceName, "activityInstanceName": res.activityInstanceName,
} }
this.fulltask = res; this.fulltask = res;
this.sqliteservice.updateProcess(res)
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{ this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
console.log('internen diploma ')
})
this.intervenientes = users.filter(user=>{ this.intervenientes = users.filter(user=>{
return user.Type == 'I'; return user.Type == 'I';
}); });
@@ -156,6 +164,62 @@ export class DiplomaPage implements OnInit {
} }
getFromDb() {
if(synchro.connected === true) {
this.LoadTaskDetail(this.serialNumber);
} else {
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].originator).email,
"CreateDate": momentG(new Date(process[0].taskStartDate),'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"activityInstanceName": process[0].activityInstanceName,
}
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak
let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user=>{
return user.Type == 'I';
});
this.cc = JSON.parse(process[0].interveners).filter(user=>{
return user.Type == 'CC';
});
this.attachments = JSON.parse(process[0].Documents)
})
}
}
async viewDocument(DocId:string, Document) { async viewDocument(DocId:string, Document) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -170,7 +234,8 @@ export class DiplomaPage implements OnInit {
Document, Document,
applicationId: Document.ApplicationId, applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId, docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId folderId: this.task.FolderId,
task: this.fulltask
}, },
cssClass: 'modal modal-desktop' cssClass: 'modal modal-desktop'
}); });
@@ -3,6 +3,10 @@ import { ActivatedRoute, NavigationEnd, NavigationError, NavigationExtras, Navig
import { DailyWorkTask } from '../../../models/dailyworktask.model'; import { DailyWorkTask } from '../../../models/dailyworktask.model';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({ @Component({
selector: 'app-diplomas', selector: 'app-diplomas',
templateUrl: './diplomas.page.html', templateUrl: './diplomas.page.html',
@@ -24,6 +28,8 @@ export class DiplomasPage implements OnInit, OnDestroy {
private processes: ProcessesService, private processes: ProcessesService,
private router: Router, private router: Router,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private sqliteservice: SqliteService,
private sortService: SortService,
) { ) {
this.diplomasList = []; this.diplomasList = [];
//Inicializar segment //Inicializar segment
@@ -50,20 +56,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
} }
}); });
const location = window.location this.getFromDb()
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} }
@@ -177,7 +170,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
diplomasList.push(task); diplomasList.push(task);
}); });
this.diplomasList = this.sortArrayISODate(diplomasList.reverse()); this.diplomasList = this.sortService.sortArrayByDate(diplomasList).reverse();
let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado"); let diplomasAssinados = diplomas.reverse().filter(data => data.activityInstanceName == "Diploma Assinado");
@@ -188,10 +181,53 @@ export class DiplomasPage implements OnInit, OnDestroy {
diplomasAssinadoList.push(task); diplomasAssinadoList.push(task);
}); });
console.log('diplomasAssinados', diplomasAssinados) console.log('diplomasAssinados', diplomasAssinados)
this.diplomasAssinadoList = this.sortArrayISODate(diplomasAssinadoList).reverse(); this.diplomasAssinadoList = this.sortService.sortArrayByDate(diplomasAssinadoList).reverse();
} }
getFromDb() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} else {
this.sqliteservice.getprocessByworkflow("Despacho do Presidente da República").then((process: any[]) => {
let diplomasValidar = process.filter(data => data.activityInstanceName == "Revisar Diploma");
let diplomasList = [];
diplomasValidar.forEach(async element => {
let task = this.pipeTaskOffline(element)
diplomasList.push(task);
});
this.diplomasList = this.sortService.sortArrayByDate(diplomasList).reverse();
let diplomasAssinados = process.reverse().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.sortArrayByDate(diplomasAssinadoList).reverse();
})
}
}
pipeTask(element) { pipeTask(element) {
let date = new Date(element.taskStartDate); let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
@@ -201,7 +237,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
"SerialNumber": element.serialNumber, "SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject, "Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender, "Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate, "CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments, "DocumentsQty": element.totalDocuments,
@@ -212,11 +248,27 @@ export class DiplomasPage implements OnInit, OnDestroy {
} }
} }
sortArrayISODate(myArray: any) { pipeTaskOffline(element) {
return myArray.sort(function(a, b) { let date = new Date(element.taskStartDate);
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); date.setMonth(date.getMonth() + 1);
});
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
return {
"SerialNumber": element.serialNumber,
"Folio": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": JSON.parse(element.workflowInstanceDataFields).Status,
} }
}
async refreshing() { async refreshing() {
setTimeout(() => { setTimeout(() => {
@@ -73,15 +73,16 @@
</div> </div>
</div> </div>
<div *ngIf="loadedAttachments" class="bottom-content width-100"> <div *ngIf="loadedEvent.Documents" class="bottom-content width-100">
<ion-list> <ion-list>
<h5>Documentos Anexados</h5> <h5>Documentos Anexados</h5>
<ion-item class="ion-no-margin ion-no-padding cursor-pointer" <ion-item class="ion-no-margin ion-no-padding cursor-pointer"
*ngFor="let attach of loadedAttachments" *ngFor="let attachment of loadedEvent.Documents"
(click)="viewDocument(attach.SourceId)"> (click)="viewDocument(attachment.DocId, attachment)">
<ion-label> <ion-label>
<p class="attach-title-item d-block">{{attach.SourceName}}</p> <p *ngIf="attachment.Assunto" class="attach-title-item">{{ attachment.Assunto }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{attach.Stakeholders}}</span><span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p> <p *ngIf="!attachment.Assunto" class="attach-title-item">{{ attachment.DocNumber }}<span class="span-right color-red btn-size"><ion-icon hidden name="close"></ion-icon></span></p>
<p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd/MM/yy' }}</span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -11,6 +11,11 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page'; import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { SqliteService } from '../../../../services/sqlite.service';
import { synchro } from '../../../../services/socket/synchro.service';
import { Platform } from '@ionic/angular';
@Component({ @Component({
selector: 'app-approve-event', selector: 'app-approve-event',
@@ -30,12 +35,16 @@ export class ApproveEventPage implements OnInit {
serialNumber:string; serialNumber:string;
caller:string; caller:string;
attachments:any;
@Input() InstanceId:string; @Input() InstanceId:string;
@Output() approveEventDismiss = new EventEmitter<any>(); @Output() approveEventDismiss = new EventEmitter<any>();
@Output() closeEventToApprove = new EventEmitter<any>(); @Output() closeEventToApprove = new EventEmitter<any>();
@Output() AproveEventEditEvent = new EventEmitter<any>(); @Output() AproveEventEditEvent = new EventEmitter<any>();
synch = synchro;
constructor( constructor(
private router: Router, private router: Router,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
@@ -49,6 +58,8 @@ export class ApproveEventPage implements OnInit {
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
private location: Location, private location: Location,
private sqliteservice: SqliteService,
private platform: Platform
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]); // console.log(params["params"]);
@@ -70,8 +81,8 @@ export class ApproveEventPage implements OnInit {
ngOnInit() { ngOnInit() {
console.log(this.serialNumber); console.log(this.serialNumber);
console.log(this.caller); console.log(this.caller);
this.getProcessFromDB();
this.getTask();
} }
goBack() { goBack() {
@@ -89,6 +100,86 @@ export class ApproveEventPage implements OnInit {
} }
addProcessToDB(data) {
this.platform.ready().then(() => {
this.sqliteservice.updateProcess(data);
});
}
getProcessFromDB() {
if (synchro.connected === true) {
this.getTask();
}
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log('event aprove serial', process)
var doc;
var action = [];
var origi = [];
var wordafi = {};
if (process[0].Documents === "null" || process[0].Documents === "undefined") {
doc = []
} else {
doc = JSON.parse(process[0].Documents)
}
if (process[0].actions === "null" || process[0].actions === "undefined") {
action = []
} else {
action = JSON.parse(process[0].Documents)
}
if (process[0].originator === "null" || process[0].originator === "undefined") {
origi = []
} else {
origi = JSON.parse(process[0].Documents)
}
if (process[0].workflowInstanceDataFields === "null" || process[0].workflowInstanceDataFields === "undefined") {
wordafi = []
} else {
wordafi = JSON.parse(process[0].workflowInstanceDataFields)
}
let task = {
"Documents": doc,
"actions": action,
"activityInstanceName": process[0].activityInstanceName,
"formURL": process[0].formURL,
"originator": origi,
"serialNumber": process[0].serialNumber,
"taskStartDate": process[0].taskStartDate,
"totalDocuments": process[0].totalDocuments,
"workflowDisplayName": process[0].workflowDisplayName,
"workflowID": process[0].workflowID,
"workflowInstanceDataFields": wordafi,
"workflowInstanceFolio": process[0].workflowInstanceFolio,
"workflowInstanceID": process[0].workflowInstanceID,
"workflowName": process[0].workflowInstanceID
}
this.loadedEvent = task
console.log('offline event',this.loadedEvent);
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.loadedAttachments = this.loadedEvent.Documents;
console.log('Attatara', this.loadedAttachments)
})
})
console.log('Offlineee')
})
}
async getTask() { async getTask() {
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise(); this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
console.log(this.loadedEvent); console.log(this.loadedEvent);
@@ -96,9 +187,6 @@ export class ApproveEventPage implements OnInit {
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate); this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
let instanceId = this.loadedEvent.workflowInstanceDataFields.InstanceId;
this.getAttachments(instanceId);
} }
async approveTask(serialNumber: string) { async approveTask(serialNumber: string) {
@@ -149,7 +237,8 @@ export class ApproveEventPage implements OnInit {
console.log(res.data); console.log(res.data);
if (res.data !== '') { if (res.data !== '') {
let body = { "serialNumber": serialNumber, let body = {
"serialNumber": serialNumber,
"action": "Emendar", "action": "Emendar",
"dataFields": { "dataFields": {
"ReviewUserComment": res.data, "ReviewUserComment": res.data,
@@ -195,25 +284,27 @@ export class ApproveEventPage implements OnInit {
} }
} }
async getAttachments(instanceId:string) { async viewDocument(DocId:string, Document) {
try {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(instanceId).toPromise();
} catch (error) {
}
}
viewDocument(sourceId){
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
/* console.log(res); */
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: Document.Assunto,
url: '',
title_link: '',
},
Document,
applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId,
folderId: this.loadedEvent.FolderId,
task: this.loadedEvent
},
cssClass: 'modal modal-desktop'
}); });
await modal.present();
} }
async openOptions(ev: any) { async openOptions(ev: any) {
@@ -248,7 +339,8 @@ export class ApproveEventPage implements OnInit {
console.log(res.data); console.log(res.data);
if (res.data !== '') { if (res.data !== '') {
let body = { "serialNumber": serialNumber, let body = {
"serialNumber": serialNumber,
"action": "Emendar", "action": "Emendar",
"dataFields": { "dataFields": {
"ReviewUserComment": res.data, "ReviewUserComment": res.data,
@@ -8,6 +8,11 @@ import { NavigationStart, Router } from '@angular/router';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service'; import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { SqliteService } from '../../../services/sqlite.service';
import { synchro } from '../../../services/socket/synchro.service';
import { Platform } from '@ionic/angular';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({ @Component({
selector: 'app-event-list', selector: 'app-event-list',
templateUrl: './event-list.page.html', templateUrl: './event-list.page.html',
@@ -29,17 +34,36 @@ export class EventListPage implements OnInit {
skeletonLoader = true skeletonLoader = true
eventaprovacaostore = EventoAprovacaoStore; eventaprovacaostore = EventoAprovacaoStore;
synch = synchro;
constructor( constructor(
private processes:ProcessesService, private processes:ProcessesService,
private modalController: ModalController, private modalController: ModalController,
private router: Router, private router: Router,
private location: Location private location: Location,
private sqliteservice: SqliteService,
private platform: Platform,
private sortService: SortService,
) { } ) { }
ngOnInit() { ngOnInit() {
this.segment = 'MDGPR';
this.segment = 'MDGPR';
this.getEventToAproveFromDB();
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth <= 800){
this.modalController.dismiss();
}
};
}
getEventToAproveFromDB() {
if( synchro.connected === true) {
const location = window.location const location = window.location
const pathname = location.pathname + location.search const pathname = location.pathname + location.search
@@ -54,15 +78,23 @@ export class EventListPage implements OnInit {
} }
} }
}); });
window.onresize = (event) => {
// if not mobile remove all component
if( window.innerWidth <= 800){
this.modalController.dismiss();
} }
};
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getListOfEventAprove('Agenda Oficial MDGPR','Agenda Pessoal MDGPR' ).then((event: any[]) => {
this.eventsMDGPRList = event
console.log("All evento to aprove from db ", event)
})
this.sqliteservice.getListOfEventAprove('Agenda Oficial PR','Agenda Pessoal PR' ).then((event: any[]) => {
this.eventsPRList = event
console.log("All evento to aprove from db ", event)
})
})
console.log('Offlineee')
})
} }
segmentChanged(ev: any) { segmentChanged(ev: any) {
@@ -78,20 +110,22 @@ export class EventListPage implements OnInit {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise(); let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise(); let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal); this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
console.log(this.eventsMDGPRList); this.eventaprovacaostore.resetmd(this.sortService.sortArrayByDate(this.eventsMDGPRList).reverse());
this.eventaprovacaostore.resetmd(this.eventsMDGPRList);
} }
else if(this.segment == 'PR'){ else if(this.segment == 'PR'){
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise(); let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise(); let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal); this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventaprovacaostore.resetpr(this.eventsPRList); this.eventaprovacaostore.resetpr(this.sortService.sortArrayByDate(this.eventsPRList).reverse());
} }
this.showLoader = false; this.showLoader = false;
this.skeletonLoader = false this.skeletonLoader = false
} }
getEventToaproveFromDB() {
}
async openApproveModal(eventSerialNumber, event){ async openApproveModal(eventSerialNumber, event){
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: ApproveEventModalPage, component: ApproveEventModalPage,
@@ -50,7 +50,7 @@
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon class="icon-time" slot="start" name="time-outline"></ion-icon> <ion-icon class="icon-time" slot="start" name="time-outline"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Priority')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Priority')?.invalid && validateFrom || validateField ">
<ion-select <ion-select
placeholder="Prazo*" placeholder="Prazo*"
[(ngModel)]="postData.Priority" [(ngModel)]="postData.Priority"
@@ -88,7 +88,8 @@ export class ExpedientTaskModalPage implements OnInit {
toppings = new FormControl(); toppings = new FormControl();
Form: FormGroup; Form: FormGroup;
validateFrom = false validateFrom = false;
validateField = false;
get toppingsValues() { get toppingsValues() {
return this.toppings.value; return this.toppings.value;
@@ -187,7 +188,7 @@ export class ExpedientTaskModalPage implements OnInit {
} }
runValidation() { runValidation() {
this.validateFrom = true this.validateFrom = true;
} }
injectValidation() { injectValidation() {
@@ -429,17 +430,23 @@ export class ExpedientTaskModalPage implements OnInit {
} }
} }
if(this.postData.DispatchFolder.Message){
try { try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise(); 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); this.modalController.dismiss(action_despacho_pr);
} catch (error) { } catch (error) {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} finally { } finally {
loader.remove() //loader.remove()
} }
}
console.log('this.taskResult', this.taskResult); else{
this.validateField = true;
this.toastService.badRequest('Por favor adicione uma nota');
}
loader.remove();
break; break;
case '1': // parecer case '1': // parecer
@@ -463,7 +470,6 @@ export class ExpedientTaskModalPage implements OnInit {
} }
try { try {
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise(); 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); this.modalController.dismiss(action_parecer_pr);
@@ -473,6 +479,7 @@ export class ExpedientTaskModalPage implements OnInit {
} finally { } finally {
loader.remove() loader.remove()
} }
break; break;
} }
break; break;
@@ -26,6 +26,10 @@ import { PermissionService } from 'src/app/services/worker/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { SqliteService } from 'src/app/services/sqlite.service';
import { Platform } from '@ionic/angular';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
selector: 'app-expediente-detail', selector: 'app-expediente-detail',
templateUrl: './expediente-detail.page.html', templateUrl: './expediente-detail.page.html',
@@ -52,6 +56,9 @@ export class ExpedienteDetailPage implements OnInit {
hideSendToPendentes = true hideSendToPendentes = true
searchDocumentPipe = new SearchDocumentPipe() searchDocumentPipe = new SearchDocumentPipe()
synch = synchro
onlinecheck: boolean;
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
private iab: InAppBrowser, private iab: InAppBrowser,
@@ -66,7 +73,9 @@ export class ExpedienteDetailPage implements OnInit {
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
public p: PermissionService, public p: PermissionService,
private taskService: TaskService, private taskService: TaskService,
private expedienteService: ExpedienteService private expedienteService: ExpedienteService,
public platform: Platform,
private sqliteservice: SqliteService,
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) { if (params["params"].SerialNumber) {
@@ -79,7 +88,7 @@ export class ExpedienteDetailPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.LoadTaskDetail(this.serialNumber); this.getFromDB();
} }
@@ -91,6 +100,50 @@ export class ExpedienteDetailPage implements OnInit {
this.toastService.presentToast('Não foi possível fazer login'); this.toastService.presentToast('Não foi possível fazer login');
} }
getFromDB() {
if(synchro.connected === true) {
this.LoadTaskDetail(this.serialNumber);
}
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.onlinecheck = false;
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
console.log("expedient ditail", process)
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
var origina
if (process[0].originator === "undefined") {
origina = ""
} else {
origina = JSON.parse(process[0].originator)
}
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": workflow.Subject,
"Senders": origina.email || process[0].originator,
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": workflow.ViewerRequest,
"Remetente": workflow.Sender,
"Note": workflow.TaskMessage || workflow.Note,
"FolderId": workflow.FolderID,
"FsId": workflow.FsId,
"DocId": workflow.DocID,
"WorkflowName": process[0].workflowDisplayName,
"Status": workflow.Status,
"DispatchNumber": workflow.DispatchNumber,
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
"InstanceID": workflow.InstanceID
}
})
})
})
}
async approve(note: string, documents: any) { async approve(note: string, documents: any) {
let body = { let body = {
@@ -264,6 +317,7 @@ export class ExpedienteDetailPage implements OnInit {
} }
this.fulltask = res; this.fulltask = res;
this.sqliteservice.updateProcess(res)
let thedate = new Date(this.task.CreateDate); let thedate = new Date(this.task.CreateDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
@@ -320,7 +374,8 @@ export class ExpedienteDetailPage implements OnInit {
Document, Document,
applicationId: Document.ApplicationId, applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId, docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId folderId: this.task.FolderId,
task: this.fulltask
}, },
cssClass: 'modal modal-desktop' cssClass: 'modal modal-desktop'
}); });
@@ -34,7 +34,7 @@
<ion-list> <ion-list>
<div <div
class="expediente ion-no-padding ion-no-margin cursor-pointer" class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of expedienteGdStore.list" *ngFor = "let task of listToPresent"
(click)="goToExpediente(task.SerialNumber)" (click)="goToExpediente(task.SerialNumber)"
> >
<div class="item width-100"> <div class="item width-100">
@@ -65,13 +65,13 @@
</ion-list> </ion-list>
<div <div
*ngIf="!skeletonLoader && expedienteGdStore.list.length == 0 && expedienteGdStore.list.length == 0" *ngIf="!skeletonLoader && listToPresent.length == 0 && listToPresent.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center" class="empty-list d-flex height-100 align-center justify-content-center"
> >
<span>Lista vazia</span> <span>Lista vazia</span>
</div> </div>
<div *ngIf="skeletonLoader && expedienteGdStore.list.length == 0"> <div *ngIf="skeletonLoader && listToPresent.length == 0">
<ion-list> <ion-list>
<ion-item> <ion-item>
@@ -4,6 +4,9 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service'; import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe'; import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { SqliteService } from 'src/app/services/sqlite.service';
import { Platform } from '@ionic/angular';
import { synchro } from '../../../services/socket/synchro.service';
@Component({ @Component({
selector: 'app-expediente', selector: 'app-expediente',
@@ -22,29 +25,22 @@ export class ExpedientePage implements OnInit {
expedienteGdStore = ExpedienteGdStore expedienteGdStore = ExpedienteGdStore
expedienteTaskPipe = new ExpedienteTaskPipe() expedienteTaskPipe = new ExpedienteTaskPipe()
onlinecheck: boolean;
listToPresent;
synch = synchro
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
private router: Router, private router: Router,
private toastService: ToastService private toastService: ToastService,
public platform: Platform,
private sqliteservice: SqliteService,
) { } ) { }
ngOnInit() { ngOnInit() {
const location = window.location this.getEventsFromLocalDb();
const pathname = location.pathname + location.search console.log("segrsgre")
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} }
@@ -62,9 +58,11 @@ export class ExpedientePage implements OnInit {
let task = this.expedienteTaskPipe.transform(element) let task = this.expedienteTaskPipe.transform(element)
this.taskslist.push(task); this.taskslist.push(task);
this.sqliteservice.addProcess(task);
}); });
this.expedienteGdStore.reset(this.taskslist); this.listToPresent = this.taskslist
console.log('expediente list', this.listToPresent)
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
@@ -97,4 +95,75 @@ export class ExpedientePage implements OnInit {
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
} }
SqliteAddExpediente(list) {
list.forEach((expediente) => {
let data = {
serialNumber: expediente.serialNumber,
workflowInstanceFolio: expediente.workflowInstanceFolio,
Documents: expediente.Documents,
actions: expediente.actions,
activityInstanceName: expediente.activityInstanceName,
formURL: expediente.formURL,
originator: expediente.originator,
taskStartDate: expediente.taskStartDate,
totalDocuments: expediente.totalDocuments,
workflowDisplayName: expediente.workflowDisplayName,
workflowID: expediente.workflowID,
workflowInstanceDataFields: expediente.workflowInstanceDataFields,
workflowInstanceID: expediente.workflowInstanceID,
workflowName: expediente.workflowName
}
this.sqliteservice.addExpediente(data);
})
}
getEventsFromLocalDb() {
if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} else {
this.taskslist = new Array();
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
console.log("All expedientes from local,", expediente)
expediente.forEach((element) => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
let exped = {
"CreateDate": element.taskStartDate,
"DocumentsQty": element.totalDocuments,
"Senders": workflow.Senders,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"Subject": workflow.Subject,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName
}
this.taskslist.push(exped)
});
this.listToPresent = this.taskslist
})
}
}
} }
@@ -210,7 +210,8 @@ export class ExpedientePrPage implements OnInit {
Document, Document,
applicationId: Document.ApplicationId, applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId, docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId folderId: this.task.FolderId,
task: this.fulltask
}, },
cssClass: 'modal modal-desktop' cssClass: 'modal modal-desktop'
}); });
@@ -96,7 +96,7 @@
<fa-icon class="icon-selected" icon="align-justify"></fa-icon> <fa-icon class="icon-selected" icon="align-justify"></fa-icon>
</div> </div>
<p class="text-center exp-card-title ">Todas as tarefas</p> <p class="text-center exp-card-title ">Todas as tarefas</p>
<p class="text-center exp-card-content">{{ totalDocumentStore.count }} <span class="title1">Documentos</span></p> <p class="text-center exp-card-content">{{ allProcessesList.length }} <span class="title1">Documentos</span></p>
</div> </div>
<div (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="box-hover exp-card d-flex flex-column" *ngIf="loggeduser.Profile == 'MDGPR'" > <div (click)="openEventsToApprovePage();selectedElement='approval'" [class.active]="selectedElement == 'approval'" class="box-hover exp-card d-flex flex-column" *ngIf="loggeduser.Profile == 'MDGPR'" >
@@ -25,6 +25,10 @@ import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { PermissionService } from 'src/app/services/worker/permission.service'; import { PermissionService } from 'src/app/services/worker/permission.service';
import { SqliteService } from '../../services/sqlite.service';
import { synchro } from '../../services/socket/synchro.service';
import { Platform } from '@ionic/angular';
@Component({ @Component({
selector: 'app-gabinete-digital', selector: 'app-gabinete-digital',
templateUrl: './gabinete-digital.page.html', templateUrl: './gabinete-digital.page.html',
@@ -105,6 +109,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
// //
// pipe // pipe
synch = synchro;
customTaskPipe = new CustomTaskPipe() customTaskPipe = new CustomTaskPipe()
@@ -122,12 +128,12 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
public waitForDomService: WaitForDomService, public waitForDomService: WaitForDomService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private despachoRule: DespachoService, private despachoRule: DespachoService,
private sqliteservice: SqliteService,
private platform: Platform,
private changeProfileService: ChangeProfileService private changeProfileService: ChangeProfileService
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
window.onresize = (event) => { window.onresize = (event) => {
// if not mobile remove all component // if not mobile remove all component
if (window.innerWidth < 701) { if (window.innerWidth < 701) {
@@ -172,32 +178,9 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.segmentVista = "boxview" this.segmentVista = "boxview"
} }
const pathname = window.location.pathname this.getAllProcessFromDB()
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: ()=> {
this.checkRoutes();
this.LoadCounts();
this.loadAllProcesses();
}
})
}
});
this.hideRefreshButton();
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: ()=> {
this.loadAllProcesses();
}
})
} }
async loadAllProcesses() { async loadAllProcesses() {
@@ -211,6 +194,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
console.log('allProcessesList', allProcessesList); console.log('allProcessesList', allProcessesList);
this.addProcessToDB(allProcessesList)
this.skeletonLoader = true; this.skeletonLoader = true;
this.allProcessesList = []; this.allProcessesList = [];
@@ -224,7 +208,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
"SerialNumber": element.serialNumber, "SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject, "Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender, "Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate, //"CreateDate": taskDate,
"CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments, "DocumentsQty": element.totalDocuments,
@@ -241,13 +226,103 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.allProcessesList = removeDuplicate(this.allProcessesList) this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse(); this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
this.totalDocumentStore.resetCount( this.allProcessesList.length)
}); });
this.skeletonLoader = false; this.skeletonLoader = false;
} }
addProcessToDB(data) {
this.platform.ready().then(() => {
data.forEach(element => {
let process = {
"serialNumber": element.serialNumber,
"workflowInstanceFolio": element.workflowInstanceFolio,
"Documents": element.Documents,
"actions": element.actions,
"activityInstanceName": element.activityInstanceName,
"formURL": element.formURL,
"originator": element.originator,
"taskStartDate": element.taskStartDate,
"totalDocuments": element.totalDocuments,
"workflowDisplayName": element.workflowDisplayName,
"workflowID": element.workflowID,
"workflowInstanceDataFields": element.workflowInstanceDataFields,
"workflowInstanceID": element.workflowInstanceID,
"workflowName": element.workflowName
}
this.sqliteservice.addProcess(process);
});
});
}
getAllProcessFromDB() {
if (synchro.connected === true ) {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
this.checkRoutes();
this.LoadCounts();
}
})
}
});
this.hideRefreshButton();
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
this.loadAllProcesses();
}
})
} else {
this.hideRefreshButton();
this.sqliteservice.getAllProcess().then((allprocess: any[]) => {
allprocess.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();
var workflowInstanceDataFields = JSON.parse(element.workflowInstanceDataFields);
let task = {
"SerialNumber": element.serialNumber,
"Folio": workflowInstanceDataFields.Subject,
"Senders": workflowInstanceDataFields.Sender,
"CreateDate": taskDate,
"DocumentURL": workflowInstanceDataFields.ViewerRequest,
"Remetente": workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": workflowInstanceDataFields.DispatchDocId,
"FolderID": workflowInstanceDataFields.FolderID,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
"Status": workflowInstanceDataFields.Status,
"Agenda": workflowInstanceDataFields.Agenda,
"customDate": this.setFormatDate(new Date(workflowInstanceDataFields.StartDate), new Date(workflowInstanceDataFields.EndDate), workflowInstanceDataFields.IsAllDayEvent),
}
this.allProcessesList.push(task);
this.allProcessesList = removeDuplicate(this.allProcessesList)
this.allProcessesList = this.sortArrayISODate(this.allProcessesList).reverse();
});
console.log("All process from db ", allprocess)
})
}
}
sortArrayISODate(myArray: any) { sortArrayISODate(myArray: any) {
return myArray.sort(function (a, b) { return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
@@ -278,8 +353,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
console.log(customDate); console.log(customDate);
return customDate; return customDate;
} }
else else {
{
//customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)"; //customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+" ("+minutes+" mins)";
customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end); customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " | " + this.getCustomHours(end);
return customDate; return customDate;
@@ -464,7 +538,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise(); let allPreocesses_ = await this.processesbackend.GetTasksList("", false).toPromise();
let count_all_processes = Object.keys(allPreocesses_).length; let count_all_processes = Object.keys(allPreocesses_).length;
this.totalDocumentStore.resetCount(count_all_processes)
let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise(); let expedientes = await this.processesbackend.GetTaskListExpediente(false).toPromise();
expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active") expedientes = expedientes.filter(data => data.workflowInstanceDataFields.Status == "Active")
@@ -19,6 +19,10 @@ import { ForwardPage } from 'src/app/modals/forward/forward.page';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { PedidoService } from 'src/app/Rules/pedido.service'; import { PedidoService } from 'src/app/Rules/pedido.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { PermissionService } from 'src/app/services/worker/permission.service'; import { PermissionService } from 'src/app/services/worker/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@@ -56,7 +60,8 @@ export class PedidoPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
public p: PermissionService, public p: PermissionService,
private location: Location, private location: Location,
private pedidoService: PedidoService private pedidoService: PedidoService,
private sqliteservice: SqliteService,
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
@@ -74,7 +79,7 @@ export class PedidoPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.LoadTaskDetail(this.serialnumber); this.getfromDb()
} }
close() { close() {
@@ -92,6 +97,7 @@ export class PedidoPage implements OnInit {
this.processes.GetTask(this.serialnumber).subscribe(res => { this.processes.GetTask(this.serialnumber).subscribe(res => {
this.fulltask = res this.fulltask = res
console.log('FULLTAK ONLINe', this.fulltask);
if (res.workflowDisplayName == 'Pedido de Parecer' || res.workflowDisplayName == 'Pedido de Parecer do Presidente') { if (res.workflowDisplayName == 'Pedido de Parecer' || res.workflowDisplayName == 'Pedido de Parecer do Presidente') {
@@ -117,6 +123,7 @@ export class PedidoPage implements OnInit {
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
console.log(this.task); console.log(this.task);
this.sqliteservice.updateProcess(res);
} }
else if (res.workflowDisplayName == 'Pedido de Deferimento') { else if (res.workflowDisplayName == 'Pedido de Deferimento') {
@@ -141,12 +148,16 @@ export class PedidoPage implements OnInit {
"activityInstanceName": res.activityInstanceName, "activityInstanceName": res.activityInstanceName,
"Status": res.workflowInstanceDataFields.Status, "Status": res.workflowInstanceDataFields.Status,
} }
this.sqliteservice.updateProcess(res);
} }
let thedate = new Date(res.taskStartDate); let thedate = new Date(res.taskStartDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]); this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => { this.processes.GetTaskParticipants(res.workflowInstanceDataFields.FolderID).subscribe(users => {
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() =>{
console.log('Pedido ')
})
this.intervenientes = users.filter(user => { this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
@@ -172,10 +183,104 @@ export class PedidoPage implements OnInit {
}); });
} }
getfromDb() {
if (synchro.connected === true) {
this.LoadTaskDetail(this.serialnumber);
}
if (synchro.connected === false) {
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
console.log('PROCESS BY ID', process,this.serialnumber )
let fulltak = {
Documents: JSON.parse(process[0].Documents),
actions: JSON.parse(process[0].actions),
activityInstanceName: process[0].activityInstanceName,
formURL: process[0].formURL,
originator: JSON.parse(process[0].originator),
serialNumber: process[0].serialNumber,
taskStartDate: process[0].taskStartDate,
totalDocuments: process[0].totalDocuments,
workflowDisplayName: process[0].workflowDisplayName,
workflowID: process[0].workflowID,
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
workflowInstanceFolio: process[0].workflowInstanceFolio,
workflowInstanceID: process[0].workflowInstanceID,
workflowName: process[0].workflowName
}
this.fulltask = fulltak;
console.log('FULLTAK OFFLINE', this.fulltask);
if (process[0].workflowDisplayName == 'Pedido de Parecer' || process[0].workflowDisplayName == 'Pedido de Parecer do Presidente') {
let date = new Date(process[0].taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
"activityInstanceName": process[0].activityInstanceName,
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
}
this.attachments = JSON.parse(process[0].Documents);
} else if (process[0].workflowDisplayName == 'Pedido de Deferimento') {
let date = new Date(process[0].taskStartDate);
date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = {
"SerialNumber": process[0].serialNumber,
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
"Senders": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage,
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
"FsId": '361',
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DocIdDeferimento,
"WorkflowName": process[0].workflowDisplayName,
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
"ProcessInstanceID": JSON.parse(process[0].workflowInstanceDataFields).InstanceID,
"activityInstanceName": process[0].activityInstanceName,
"Status": JSON.parse(process[0].workflowInstanceDataFields).Status,
}
this.attachments = JSON.parse(process[0].Documents);
}
let thedate = new Date(process[0].taskStartDate);
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'I';
});
this.cc = JSON.parse(process[0].interveners).filter(user => {
return user.Type == 'CC';
});
this.getDocumentDetails(JSON.parse(process[0].workflowInstanceDataFields).FolderID, '361');
})
}
}
getDocumentDetails(forlderId: string, applicationId: string) { getDocumentDetails(forlderId: string, applicationId: string) {
this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => { this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
this.attachments = res.Documents; this.attachments = res.Documents;
// console.log(res['Documents']); console.log(res['Documents']);
}) })
} }
@@ -193,7 +298,8 @@ export class PedidoPage implements OnInit {
Document, Document,
applicationId: Document.ApplicationId, applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId, docId: Document.DocId || Document.SourceId,
folderId: this.task.FolderId folderId: this.task.FolderId,
task: this.fulltask
}, },
cssClass: 'modal modal-desktop' cssClass: 'modal modal-desktop'
}); });
@@ -262,7 +368,8 @@ export class PedidoPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.pedidoService.arquivar({serialNumber: this.serialnumber, await this.pedidoService.arquivar({
serialNumber: this.serialnumber,
documents, documents,
note note
}).toPromise() }).toPromise()
@@ -38,13 +38,13 @@
<div class="width-100" [ngSwitch]="segment"> <div class="width-100" [ngSwitch]="segment">
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar> <ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
<div *ngIf="pedidosstorage.listparecer"> <div *ngIf="listToPresentparecerList">
<ion-list *ngSwitchCase="'parecer'"> <ion-list *ngSwitchCase="'parecer'">
<!-- *ngFor = "let task of pedidosstorage.listparecer; let i = index" <!-- *ngFor = "let task of pedidosstorage.listparecer; let i = index"
(click)="viewExpedientDetail(task.SerialNumber)" --> (click)="viewExpedientDetail(task.SerialNumber)" -->
<div <div
class="expediente ion-no-padding ion-no-margin cursor-pointer" class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of pedidosstorage.listparecer" *ngFor = "let task of listToPresentparecerList"
(click)="goToPedido(task.SerialNumber)" (click)="goToPedido(task.SerialNumber)"
> >
<!-- (click)="viewExpedientDetail(task.SerialNumber)" --> <!-- (click)="viewExpedientDetail(task.SerialNumber)" -->
@@ -77,11 +77,11 @@
</ion-list> </ion-list>
</div> </div>
<div *ngIf="pedidosstorage.listdeferimento"> <div *ngIf="listToPresentdeferimentoList">
<ion-list *ngSwitchCase="'deferimento'"> <ion-list *ngSwitchCase="'deferimento'">
<div <div
class="expediente ion-no-padding ion-no-margin cursor-pointer" class="expediente ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of pedidosstorage.listdeferimento" *ngFor = "let task of listToPresentdeferimentoList"
(click)="goToPedido(task.SerialNumber)" (click)="goToPedido(task.SerialNumber)"
> >
<!-- (click)="viewExpedientDetail(task.SerialNumber)" --> <!-- (click)="viewExpedientDetail(task.SerialNumber)" -->
@@ -7,6 +7,11 @@ import { ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service'; import { AlertService } from 'src/app/services/alert.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service'; import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { ModalService } from 'src/app/services/modal.service'; import { ModalService } from 'src/app/services/modal.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({ @Component({
selector: 'app-pedidos', selector: 'app-pedidos',
templateUrl: './pedidos.page.html', templateUrl: './pedidos.page.html',
@@ -18,6 +23,8 @@ export class PedidosPage implements OnInit {
taskslist:DailyWorkTask[] = []; taskslist:DailyWorkTask[] = [];
parecerList:any[] = []; parecerList:any[] = [];
listToPresentparecerList: any[] = [];
listToPresentdeferimentoList: any[] = [];
fulltask:any; fulltask:any;
parecerListResult:customTask[] = []; parecerListResult:customTask[] = [];
@@ -38,7 +45,9 @@ export class PedidosPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private alertService: AlertService, private alertService: AlertService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private modalService: ModalService private modalService: ModalService,
private sqliteservice: SqliteService,
private sortService: SortService,
) { ) {
//Inicializar segment //Inicializar segment
this.segment = 'parecer'; this.segment = 'parecer';
@@ -57,21 +66,7 @@ export class PedidosPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.getFromDb();
this.LoadList()
this.router.events.forEach((event) => {
if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} }
goBack() { goBack() {
@@ -131,7 +126,7 @@ export class PedidosPage implements OnInit {
"SerialNumber": element.serialNumber, "SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject, "Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender, "Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate, "CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments, "DocumentsQty": element.totalDocuments,
@@ -141,7 +136,8 @@ export class PedidosPage implements OnInit {
} }
this.parecerList.push(task); this.parecerList.push(task);
}); });
this.pedidosstorage.resetparecer(this.parecerList); this.sqliteservice.addProcess(this.parecerList);
this.listToPresentparecerList = this.sortService.sortArrayISODate(this.parecerList);
} }
else if(this.segment == 'deferimento') { else if(this.segment == 'deferimento') {
@@ -166,7 +162,7 @@ export class PedidosPage implements OnInit {
"SerialNumber": element.serialNumber, "SerialNumber": element.serialNumber,
"Folio": element.workflowInstanceDataFields.Subject, "Folio": element.workflowInstanceDataFields.Subject,
"Senders": element.workflowInstanceDataFields.Sender, "Senders": element.workflowInstanceDataFields.Sender,
"CreateDate": taskDate, "CreateDate": new Date(element.taskStartDate),
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments, "DocumentsQty": element.totalDocuments,
@@ -181,7 +177,8 @@ export class PedidosPage implements OnInit {
}); });
this.pedidosstorage.resetdeferimento(this.deferimentoList); this.sqliteservice.addProcess(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(this.deferimentoList);
}); });
@@ -189,6 +186,83 @@ export class PedidosPage implements OnInit {
} }
getFromDb() {
if(synchro.connected === true) {
this.LoadList()
this.router.events.forEach((event) => {
if(event instanceof NavigationStart && '/home/gabinete-digital/pedidos?parecer=true'.startsWith(event.url) ||
event instanceof NavigationStart && '/home/gabinete-digital/pedidos?deferimento=true'.startsWith(event.url)
) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
}
if(synchro.connected === false) {
let parecerlist = [];
let deferimentolist = []
this.sqliteservice.getprocessByworkflowpedido("Pedido de Parecer", "Pedido de Parecer do Presidente").then((process: any[]) => {
process.forEach((element) => {
if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
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": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
}
parecerlist.push(task)
}
})
this.listToPresentparecerList = this.sortService.sortArrayISODate(parecerlist);
console.log('parecer',process)
})
this.sqliteservice.getprocessByworkflow("Pedido de Deferimento").then((process: any[]) => {
process.forEach((element) => {
if(JSON.parse(element.workflowInstanceDataFields).Status == "Active") {
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": JSON.parse(element.workflowInstanceDataFields).Subject,
"Senders": JSON.parse(element.workflowInstanceDataFields).Sender,
"CreateDate": taskDate,
"DocumentURL": JSON.parse(element.workflowInstanceDataFields).ViewerRequest,
"Remetente": JSON.parse(element.workflowInstanceDataFields).Remetente,
"DocumentsQty": element.totalDocuments,
"DocId": JSON.parse(element.workflowInstanceDataFields).DocIdDiferimento,
"WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName,
}
deferimentolist.push(task)
}
})
this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(deferimentolist);
console.log('deferimento',process)
})
}
}
segmentChanged(ev: any) { segmentChanged(ev: any) {
this.LoadList(); this.LoadList();
} }
@@ -27,7 +27,7 @@
</ion-refresher> </ion-refresher>
<app-task-list class="height-100" <app-task-list class="height-100"
[taskList] = pendentesstore.list [taskList] = listToPresent
[skeletonLoader] = skeletonLoader [skeletonLoader] = skeletonLoader
(viewTaskDetail)="viewTaskDetails($event)" (viewTaskDetail)="viewTaskDetails($event)"
> </app-task-list> > </app-task-list>
@@ -10,6 +10,11 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe'; import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
import { Platform } from '@ionic/angular';
import { SortService } from 'src/app/services/functions/sort.service';
@Component({ @Component({
selector: 'app-pendentes', selector: 'app-pendentes',
@@ -30,6 +35,9 @@ export class PendentesPage implements OnInit {
skeletonLoader = true skeletonLoader = true
pendentesstore = PendentesStore; pendentesstore = PendentesStore;
customTaskPipe = new CustomTaskPipe() customTaskPipe = new CustomTaskPipe()
listToPresent = [];
synch = synchro
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
@@ -37,6 +45,9 @@ export class PendentesPage implements OnInit {
private router: Router, private router: Router,
private authService: AuthService, private authService: AuthService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private sqliteservice: SqliteService,
private platform: Platform,
private sortService: SortService,
) { ) {
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
this.profile = 'mdgpr'; this.profile = 'mdgpr';
@@ -45,21 +56,7 @@ export class PendentesPage implements OnInit {
ngOnInit() { ngOnInit() {
//Inicializar segment //Inicializar segment
this.segment = "despachos"; this.segment = "despachos";
this.getFromDb();
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
});
} }
@@ -88,19 +85,62 @@ export class PendentesPage implements OnInit {
}); });
pendentesList = removeDuplicate(pendentesList) pendentesList = removeDuplicate(pendentesList)
pendentesList = this.sortArrayISODate(pendentesList); pendentesList = this.sortService.sortArrayByDate(pendentesList);
this.listToPresent = pendentesList;
this.pendentesstore.reset(pendentesList);
this.skeletonLoader = false; this.skeletonLoader = false;
} }
sortArrayISODate(myArray: any) { getFromDb() {
return myArray.sort(function(a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); if (synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadList()
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.refreshing()
} else {
this.LoadList()
}
}
}); });
} }
synchro.registerCallback('Offline', () => {
this.platform.ready().then(() => {
this.sqliteservice.getAllProcess().then((process: any[]) => {
var pendingList = []
process.forEach(element => {
var workflow = JSON.parse(element.workflowInstanceDataFields);
if (workflow.Status === "Pending") {
let task = {
"CreateDate": new Date(element.taskStartDate),
"DocumentsQty": element.totalDocuments,
"FolderID": workflow.FolderID,
"Folio": workflow.Subject,
"Senders": workflow.Sender,
"SerialNumber": element.serialNumber,
"Status": workflow.Status,
"WorkflowName": element.workflowDisplayName
}
pendingList.push(task)
}
});
pendingList = this.sortService.sortArrayISODate(pendingList);
this.listToPresent = pendingList;
console.log('pendentes', pendingList)
})
})
})
}
async refreshing() { async refreshing() {
setTimeout(() => { setTimeout(() => {
this.LoadList(); this.LoadList();
+4 -2
View File
@@ -39,7 +39,9 @@ export class LoginPage implements OnInit {
) { ) {
} }
ngOnInit() {} ngOnInit() {
}
//Function to validade the login inputs //Function to validade the login inputs
validateUsername() { validateUsername() {
@@ -93,7 +95,7 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt); await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat(this.userattempt); await this.authService.loginChat(this.userattempt);
this.getToken(); this.getToken();
SessionStore.setInativity(true) SessionStore.setInativity(true);
this.goback() this.goback()
} else { } else {
@@ -6,6 +6,8 @@ import { ToastService } from 'src/app/services/toast.service';
import { ImageModalPage } from '../gallery/image-modal/image-modal.page'; import { ImageModalPage } from '../gallery/image-modal/image-modal.page';
import { NewPublicationPage } from '../new-publication/new-publication.page'; import { NewPublicationPage } from '../new-publication/new-publication.page';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
@@ -25,7 +27,8 @@ export class PublicationDetailPage implements OnInit {
private publications:PublicationsService, private publications:PublicationsService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
private location: Location ) { private location: Location,
private sqliteservice: SqliteService ) {
this.publicationId = this.navParams.get('publicationId'); this.publicationId = this.navParams.get('publicationId');
/* this.folderId = this.navParams.get('folderIdId'); */ /* this.folderId = this.navParams.get('folderIdId'); */
@@ -77,6 +80,14 @@ export class PublicationDetailPage implements OnInit {
}); });
} }
getFromDB() {
if(synchro.connected === true) {
} else {
}
}
close() { close() {
this.location.back() this.location.back()
@@ -40,7 +40,7 @@
<div class="aside overflow-y-auto d-flex flex-wrap width-100"> <div class="aside overflow-y-auto d-flex flex-wrap width-100">
<!-- <ion-list class="width-100"> --> <!-- <ion-list class="width-100"> -->
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100 cursor-pointer" <ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100 cursor-pointer"
*ngFor="let viagem of publicationTravelFolderService.list"> *ngFor="let viagem of publicationsTravelFolderList">
<ion-item lines="none" <ion-item lines="none"
class="item width-100 d-flex ion-no-border ion-no-margin ion-no-padding" class="item width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
[class.item-active]="viagem.ProcessId == idSelected" [class.item-active]="viagem.ProcessId == idSelected"
@@ -73,7 +73,7 @@
</ion-item-sliding> </ion-item-sliding>
<ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100" <ion-item-sliding disabled="{{showSlidingOptions}}" class="width-100"
*ngFor="let evento of publicationEventFolderStorage.list"> *ngFor="let evento of publicationsEventFolderList">
<ion-item lines="none" <ion-item lines="none"
class="item cursor-pointer width-100 d-flex ion-no-border ion-no-margin ion-no-padding" class="item cursor-pointer width-100 d-flex ion-no-border ion-no-margin ion-no-padding"
[class.item-active]="evento.ProcessId == idSelected" [class.item-active]="evento.ProcessId == idSelected"
+59 -16
View File
@@ -13,6 +13,8 @@ import { EditActionPage } from './edit-action/edit-action.page';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service'; import { PublicationEventFolderStorage } from 'src/app/store/publication-event-folder.service';
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service'; import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
selector: 'app-publications', selector: 'app-publications',
@@ -61,23 +63,15 @@ export class PublicationsPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private animationController: AnimationController, private animationController: AnimationController,
private publications: PublicationsService, private publications: PublicationsService,
private toastService: ToastService private toastService: ToastService,
private sqliteservice: SqliteService
) { ) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
} }
ngOnInit() { ngOnInit() {
this.getFromDB();
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.getActions();
}
});
this.hideRefreshButton();
} }
hideRefreshButton() { hideRefreshButton() {
@@ -127,6 +121,8 @@ export class PublicationsPage implements OnInit {
this.showLoader = true; this.showLoader = true;
this.publications.GetPublicationFolderList().subscribe(res => { this.publications.GetPublicationFolderList().subscribe(res => {
console.log('accoes', res)
this.publicationsEventFolderList = new Array(); this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array(); this.publicationsTravelFolderList = new Array();
@@ -140,6 +136,56 @@ export class PublicationsPage implements OnInit {
ActionType: data.ActionType, ActionType: data.ActionType,
} }
this.sqliteservice.addactions(folder);
if (data.ActionType == "Evento") {
console.log('Evento', folder)
this.publicationsEventFolderList.push(folder);
}
else {
console.log('Viagem', folder)
this.publicationsTravelFolderList.push(folder);
}
this.showLoader = false;
/* this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList) */
});
});
}
getFromDB() {
if (synchro.connected === true) {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
this.getActions();
}
});
this.hideRefreshButton();
} else {
this.sqliteservice.getAllActions().then((actions: any[]) => {
console.log('offline publi', actions)
this.publicationsEventFolderList = new Array();
this.publicationsTravelFolderList = new Array();
actions.forEach(data => {
let folder: PublicationFolder = {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
if (data.ActionType == "Evento") { if (data.ActionType == "Evento") {
this.publicationsEventFolderList.push(folder); this.publicationsEventFolderList.push(folder);
} }
@@ -147,13 +193,10 @@ export class PublicationsPage implements OnInit {
this.publicationsTravelFolderList.push(folder); this.publicationsTravelFolderList.push(folder);
} }
this.showLoader = false; this.showLoader = false;
this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList)
}); });
})
}); }
} }
async editAction(folderId?: string) { async editAction(folderId?: string) {
@@ -33,7 +33,7 @@
<ion-list> <ion-list>
<!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" --> <!-- [routerLink]="['/home/publications/view-publications/publication-detail', publication.publicationId]" -->
<div class="post-item" <div class="post-item"
*ngFor="let publication of publicationListStorage.documents[folderId]" *ngFor="let publication of getpublication"
(click)="goToPublicationDetail(publication.DocumentId)" (click)="goToPublicationDetail(publication.DocumentId)"
> >
<div *ngIf="publication.FileBase64.length > 30" class="post-img"> <div *ngIf="publication.FileBase64.length > 30" class="post-img">
@@ -10,6 +10,8 @@ import { PublicationListStorage } from 'src/app/store/publication-list.service';
import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service'; import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-folder.service';
import { NewPublicationPage } from '../new-publication/new-publication.page'; import { NewPublicationPage } from '../new-publication/new-publication.page';
import { PublicationDetailPage } from './publication-detail/publication-detail.page'; import { PublicationDetailPage } from './publication-detail/publication-detail.page';
import { SqliteService } from 'src/app/services/sqlite.service';
import { synchro } from 'src/app/services/socket/synchro.service';
@Component({ @Component({
selector: 'app-view-publications', selector: 'app-view-publications',
@@ -31,12 +33,16 @@ export class ViewPublicationsPage implements OnInit {
publicationTravelFolderService = PublicationTravelFolderStore publicationTravelFolderService = PublicationTravelFolderStore
publicationPipe = new PublicationPipe() publicationPipe = new PublicationPipe()
publicationDitails: any;
getpublication = [];
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private publications: PublicationsService, private publications: PublicationsService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router) { private router: Router,
private sqliteservice: SqliteService) {
this.item = new PublicationFolder(); this.item = new PublicationFolder();
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
@@ -57,10 +63,7 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId'] this.folderId = this.folderId['ProcessId']
} }
this.getPublicationDetail(); this.getFromDB();
setTimeout(() => {
this.getPublications();
}, 5000);
} }
@@ -97,6 +100,8 @@ export class ViewPublicationsPage implements OnInit {
setTimeout(() => { setTimeout(() => {
let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list) let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list)
this.item = allActions.find((e) => e.ProcessId == this.folderId); this.item = allActions.find((e) => e.ProcessId == this.folderId);
this.publicationDitails = this.item
console.log('item', this.item)
}, 100); }, 100);
} }
@@ -105,16 +110,21 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true; this.showLoader = true;
const folderId = this.folderId const folderId = this.folderId
this.publications.GetPublications(this.folderId).subscribe(res => { this.publications.GetPublications(this.folderId).subscribe(res => {
console.log(this.folderId)
this.publicationList = new Array(); this.publicationList = new Array();
res.forEach(element => { res.forEach(element => {
console.log('getPublications', element)
let item: Publication = this.publicationPipe.itemList(element) let item: Publication = this.publicationPipe.itemList(element)
this.publicationList.push(item); this.publicationList.push(item);
}); });
this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList));
this.publicationListStorage.add(folderId, this.publicationList) this.publicationListStorage.add(folderId, this.publicationList)
this.getpublication = this.publicationList;
this.showLoader = false; this.showLoader = false;
}, },
@@ -131,6 +141,50 @@ export class ViewPublicationsPage implements OnInit {
} }
getFromDB() {
if (synchro.connected === true) {
this.getPublicationDetail();
setTimeout(() => {
this.getPublications();
}, 5000);
} else {
this.sqliteservice.getActionById(this.folderId).then((publications) => {
console.log('publications', publications)
let item = {
ActionType: publications[0].ActionType,
DateBegin: publications[0].DateBegin,
DateEnd: publications[0].DateEnd,
Description: publications[0].Description,
Detail: publications[0].Detail,
ProcessId: publications[0].ProcessId
}
this.publicationDitails = item;
let publicationArray = [];
JSON.parse(publications[0].publications).forEach(element => {
let publicationlis = {
DateIndex: element.DateIndex,
DatePublication: element.DatePublication,
DocumentId: element.DocumentId,
FileBase64: element.FileBase64,
FileExtension: element.FileExtension,
Message: element.Message,
OrganicEntityId: element.OrganicEntityId,
OriginalFileName: element.OriginalFileName,
ProcessId: element.ProcessId
}
publicationArray.push(publicationlis);
});
this.getpublication = publicationArray;
})
}
}
async AddPublication(publicationType: any, folderId: any) { async AddPublication(publicationType: any, folderId: any) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: NewPublicationPage, component: NewPublicationPage,
+6 -2
View File
@@ -9,6 +9,7 @@ import { AuthConnstants } from '../config/auth-constants';
import { AlertController } from '@ionic/angular'; import { AlertController } from '@ionic/angular';
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service'; import { AESEncrypt } from '../services/aesencrypt.service';
import { CookieService } from 'ngx-cookie-service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@@ -27,6 +28,7 @@ export class AuthService {
private storageService:StorageService, private storageService:StorageService,
public alertController: AlertController, public alertController: AlertController,
private aesencrypt: AESEncrypt, private aesencrypt: AESEncrypt,
private cookieService: CookieService,
) { ) {
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
@@ -102,8 +104,10 @@ export class AuthService {
console.log('Login to Rocket chat OK'); console.log('Login to Rocket chat OK');
this.ValidatedUserChat = responseChat; this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat)); localStorage.setItem('userChat', JSON.stringify(responseChat));
localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].userId)); localStorage.setItem('Meteor.loginToken', responseChat['data'].authToken);
localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].authToken)); localStorage.setItem('Meteor.userId',responseChat['data'].userId);
this.cookieService.set('rc_token', responseChat['data'].authToken);
this.cookieService.set('rc_uid', responseChat['data'].userId);
this.storageService.store(AuthConnstants.AUTH, responseChat); this.storageService.store(AuthConnstants.AUTH, responseChat);
return true; return true;
} }
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { EventTrigger } from './eventTrigger.service';
describe('EventsService', () => {
let service: EventTrigger;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(EventTrigger);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+21
View File
@@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class EventTrigger {
private eventSubject = new Subject<any>()
publishSomeData(data: any){
this.eventSubject.next(data)
}
getObservable(): Subject<any>{
return this.eventSubject
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AttachmentsPage } from './attachments.page';
const routes: Routes = [
{
path: '',
component: AttachmentsPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AttachmentsPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { AttachmentsPageRoutingModule } from './attachments-routing.module';
import { AttachmentsPage } from './attachments.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
AttachmentsPageRoutingModule
],
declarations: [AttachmentsPage]
})
export class AttachmentsPageModule {}
@@ -0,0 +1,62 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button (click)="close()" defaultHref="" icon="chevron-back"></ion-back-button>
</ion-buttons>
<ion-title>Anexos do evento</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<div *ngIf="loadedEventAttachments">
<ion-list>
<ion-item-sliding>
<ion-item class="main-item" lines="none" *ngFor="let att of loadedEventAttachments" (click)="viewDocument(att.Link)">
<ion-icon style="zoom:1.5" class="ion-icon-attach" name="attach"></ion-icon>
<ion-label class="div-content-attachment">
<h3 class="h3">{{ att.SourceName }}</h3>
<p>{{ att.Description }}</p>
<p>{{ att.CreateDate }}</p>
<p class="item-list-small">{{ att.Stakeholders }}</p>
</ion-label>
</ion-item>
</ion-item-sliding>
</ion-list>
</div>
<!-- Skeleton screen -->
<div *ngIf="!loadedEventAttachments">
<ion-list>
<ion-item>
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-avatar>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-avatar>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-content>
@@ -0,0 +1,57 @@
ion-back-button {
display: block;
}
/* CONTENT */
ion-content{
--background: #f2f2f2;
}
.div-attach-results{
background: none;
}
ion-list, ion-item-sliding{
background: none;
}
.item-list-small{
font-size: 14px;
overflow: auto;
}
.ion-item-class{
padding: 0;
}
.label-text{
width: 100%;
padding: 0;
margin: 0;
}
//DIV
.main-item{
margin: 15px;
/* border: 1px solid #ccc; */
border-radius: 5px;
box-shadow: 0 4px 8px 0 #ccc, 0 6px 20px 0 #f2f2f2;
}
.div-content-attachment{
margin:0;
padding: 10px;
}
.div-content-attachment h3{
font-size: 18px;
font-weight: 700;
padding-bottom: 5px;
}
ion-item ion-icon{
--border-color: red;
}
/* Custom Skeleton Line Height and Margin */
.custom-skeleton ion-skeleton-text {
line-height: 13px;
}
.custom-skeleton ion-skeleton-text:last-child {
margin-bottom: 5px;
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { AttachmentsPage } from './attachments.page';
describe('AttachmentsPage', () => {
let component: AttachmentsPage;
let fixture: ComponentFixture<AttachmentsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttachmentsPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(AttachmentsPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,47 @@
import { Component, OnInit } from '@angular/core';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
import { ActivatedRoute, Router } from '@angular/router';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ModalController, NavParams } from '@ionic/angular';
@Component({
selector: 'app-attachments',
templateUrl: './attachments.page.html',
styleUrls: ['./attachments.page.scss'],
})
export class AttachmentsPage implements OnInit {
loadedEventAttachments: Attachment[];
pageId: string;
constructor(
private attachamentsService: AttachmentsService,
private iab: InAppBrowser,
private modalCtrl: ModalController,
private navParams: NavParams) { }
ngOnInit() {
this.loadAttachments(this.navParams.get('eventId'));
}
loadAttachments(eventid:string)
{
this.attachamentsService.getAttachmentsById(eventid).subscribe(attachments => {
this.loadedEventAttachments = attachments;
this.pageId = eventid;
});
}
async viewDocument(documenturl:string)
{
const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
}
close(){
this.modalCtrl.dismiss(null);
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AttendeesPageModal } from './attendees.page';
const routes: Routes = [
{
path: '',
component: AttendeesPageModal
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AttendeesPageRoutingModule {}
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { AttendeesPageRoutingModule } from './attendees-routing.module';
import { AttendeesPageModal } from './attendees.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
AttendeesPageRoutingModule
],
declarations: [AttendeesPageModal],
exports: [AttendeesPageModal]
})
export class AttendeesPageModule {}
@@ -0,0 +1,87 @@
<ion-header class="ion-no-border px-20">
<ion-toolbar class="px-10">
<ion-title class="pa-0">Adicionar intervenientes</ion-title>
</ion-toolbar>
<ion-searchbar class="attendee-search-bar" (ionChange)="onChange($event)" placeholder="Insira email para adicionar destinatário"></ion-searchbar><!-- [(ngModel)]="searchCountryString" -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
</ion-header>
<ion-content class="height-100 overflow-y-auto">
<ion-item-group class="d-flex flex-column height-100 ">
<ion-list lines="none" class="flex-grow-1 overflow-y-auto height-100" >
<ion-item-sliding class="px-20">
<div *ngFor="let attendee of contacts;">
<ion-item (click)="selectContact(attendee)" class="cursor-pointer" lines="none" *ngIf="filterSearchList(attendee)" >
<div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div>
<ion-icon class="font-35" src="assets/images/icons-add-25.svg"></ion-icon>
</div>
</ion-item>
</div>
</ion-item-sliding>
</ion-list>
<hr/>
<ion-list lines="none" *ngIf="taskParticipants?.length >= 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="taskParticipants.length >= 1 || taskParticipantsCc.length >= 1" > Destinatário</div>
<ion-item-sliding class="px-20">
<ion-item lines="none" *ngFor="let attendee of taskParticipants;" class="d-flex">
<div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div class="cursor-pointer" (click)="remove(attendee)">
<ion-icon class="font-35" src="assets/images/icons-delete-25.svg"></ion-icon>
</div>
</ion-item>
</ion-item-sliding>
</ion-list>
<ion-list lines="none" *ngIf="taskParticipantsCc?.length >= 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" >
<div class="px-20 font-15 pt-20" style="border-top:1px solid #ebebeb;font-weight: 500;" *ngIf="taskParticipants.length >= 1 || taskParticipantsCc.length >= 1" > Destinatário</div>
<ion-item-sliding class="px-20">
<ion-item lines="none" *ngFor="let attendee of taskParticipantsCc;" class="d-flex">
<div class="pr-10">
<ion-icon class="font-35" src="assets/images/icons-userprofile.svg"></ion-icon>
</div>
<ion-label>
<h3>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</ion-label>
<div class="cursor-pointer" (click)="remove(attendee)">
<ion-icon class="font-35" src="assets/images/icons-delete-25.svg"></ion-icon>
</div>
</ion-item>
</ion-item-sliding>
</ion-list>
</ion-item-group>
</ion-content>
<ion-footer class="ion-no-border">
<ion-toolbar class="d-flex">
<ion-buttons class="flex-grow-1" slot="start">
<button class="btn-cancel" fill="clear" color="#061b52" (click)="close()">
<ion-label>Cancelar</ion-label>
<ion-icon name="close" slot="start"></ion-icon>
</button>
</ion-buttons>
<ion-buttons class="flex-grow-1" slot="end">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>Gravar</ion-label>
<ion-icon name="checkmark" slot="start"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
</ion-footer>
@@ -0,0 +1,3 @@
ion-item{
border-bottom:1px solid #ccc;
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { AttendeesPageModal } from './attendees.page';
describe('AttendeesPage', () => {
let component: AttendeesPageModal;
let fixture: ComponentFixture<AttendeesPageModal>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttendeesPageModal ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(AttendeesPageModal);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,142 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { EventPerson } from 'src/app/models/eventperson.model';
import { ModalController, NavParams } from '@ionic/angular';
import { ContactsService } from 'src/app/services/contacts.service';
@Component({
selector: 'app-attendees',
templateUrl: './attendees.page.html',
styleUrls: ['./attendees.page.scss'],
})
export class AttendeesPageModal implements OnInit {
// Defined by the API
contacts: EventPerson[];
showLoader: boolean = false;
selectedContact: EventPerson[] =[];
eventPersons: EventPerson[];
adding: "intervenient" | "CC";
currentPath = window.location.pathname;
taskParticipants:EventPerson[] = [];
taskParticipantsCc:EventPerson[] = [];
constructor(
private modalCtrl: ModalController,
private contactsService: ContactsService,
private navParams: NavParams,
private modalController: ModalController) {
this.adding = this.navParams.get('adding');
this.taskParticipants = this.navParams.get('taskParticipants');
this.taskParticipantsCc = this.navParams.get('taskParticipantsCc');
}
ngOnInit() {
this.fetchContacts("");
if(this.taskParticipants == null || this.taskParticipants == undefined){
this.taskParticipants = [];
}
if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined){
this.taskParticipantsCc = [];
}
}
ngOnChanges(event) {}
save(){
this.modalController.dismiss({
'taskParticipants': this.taskParticipants,
'taskParticipantsCc': this.taskParticipantsCc
});
}
close() {
this.modalController.dismiss(false);
}
onChange(evt: any) {
this.fetchContacts(evt.detail.value);
}
filterSearchList(itm: EventPerson): boolean {
const result = this.taskParticipants.concat( this.taskParticipantsCc).find((contact, index)=>{
if(contact.Name.toLocaleLowerCase() == itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() == itm.EmailAddress.toLocaleLowerCase()){
index = index;
return contact;
}
})
return undefined == result;
}
remove(itm: EventPerson){
if(this.adding == "intervenient"){
this.taskParticipants = this.taskParticipants.filter((contact, index) =>{
if(contact.Name.toLocaleLowerCase() != itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() != itm.EmailAddress.toLocaleLowerCase()){
return contact;
}
return false;
});
} else if (this.adding == "CC") {
this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{
if(contact.Name.toLocaleLowerCase() != itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() != itm.EmailAddress.toLocaleLowerCase()){
return contact;
}
return false;
});
}
}
async selectContact(itm: EventPerson){
if(this.adding == "intervenient"){
itm.IsRequired = true;
this.taskParticipants.push(itm);
} else if (this.adding == "CC") {
itm.IsRequired = false;
this.taskParticipantsCc.push(itm);
}
}
async fetchContacts(filter: string) {
this.showLoader = true;
this.contactsService.getContacts(filter).subscribe(result =>
{
if (this.eventPersons != null)
{
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
this.contacts = result;
this.showLoader = false;
}
);
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EditEventPage } from './edit-event.page';
const routes: Routes = [
{
path: '',
component: EditEventPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class EditEventPageRoutingModule {}
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { EditEventPageRoutingModule } from './edit-event-routing.module';
import { EditEventPage } from './edit-event.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
EditEventPageRoutingModule
],
declarations: [EditEventPage],
exports: [EditEventPage]
})
export class EditEventPageModule {}
@@ -0,0 +1,202 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="{{ backURL }}"></ion-back-button>
</ion-buttons>
<ion-title class="header-title">Visualizar Evento</ion-title>
<ion-buttons slot="end">
<button (click)="deleteConfirm()" class="ion-icon-delete">
<ion-icon name="trash"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div *ngIf="loadedEvent">
<ion-item-group>
<ion-item-sliding>
<ion-item>
<ion-label class="capitalizeText" position="stacked">Assunto</ion-label>
<ion-input class="capitalizeText" [(ngModel)]="loadedEvent.Subject" type="text" required></ion-input>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.subject.errors?.required">
Campo obrigatório
</span>
<ion-item>
<ion-label position="stacked">Descrição</ion-label>
<ion-input class="capitalizeText" [(ngModel)]='loadedEvent.Body.Text'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Localização</ion-label>
<ion-input class="capitalizeText" [(ngModel)]='loadedEvent.Location'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Calendário</ion-label>
<ion-select class="capitalizeText" placeholder="{{loadedEvent.CalendarName}}" [(ngModel)]="loadedEvent.CalendarName" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
<ion-select-option Pessoal="Reunião">Pessoal</ion-select-option>
<ion-select-option Oficial="Viagem">Oficial</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label position="stacked">Tipo do evento</ion-label>
<ion-select placeholder="{{loadedEvent.EventType}}" [(ngModel)]="loadedEvent.EventType" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
<ion-select-option value="Reunião">Reunião</ion-select-option>
<ion-select-option value="Viagem">Viagem</ion-select-option>
<ion-select-option value="Conferência">Conferência</ion-select-option>
<ion-select-option value="Encontro">Encontro</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label position="stacked">Data Início</ion-label>
<ion-datetime value="{{loadedEvent.StartDate}}" [(ngModel)]="loadedEvent.StartDate" min="2020" max="2100"
displayFormat="D MMM YYYY H:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"></ion-datetime>
</ion-item>
<ion-item>
<ion-label position="stacked">Data Fim</ion-label>
<ion-datetime value="{{loadedEvent.EndDate}}" [(ngModel)]="loadedEvent.EndDate" min="2020" max="2100"
displayFormat="D MMM YYYY HH:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"></ion-datetime>
</ion-item>
<div class="div-attach" >
<ion-item>
<ion-buttons slot="end" (click)="openAttendees()">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Participantes</ion-label>
</ion-item>
<div *ngIf="loadedEvent.Attendees">
<div *ngFor="let attendee of loadedEvent.Attendees; let i=index">
<div *ngIf="i<1">
<ion-list >
<ion-item class="attendees" lines="none" >
<ion-icon class="attendees-icon" name="person" slot="start"></ion-icon>
<ion-label class="capitalizeText" class="attendees-list">{{attendee.Name}}</ion-label>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="loadedEvent.Attendees.length > 1">
<button class="see-more-button" fill="none" shape="round" (click)="openAttendees()">
<ion-label color="secondary">Ver mais...</ion-label>
</button>
</div>
</div>
</div>
<div class="div-attach">
<ion-item>
<ion-buttons slot="end" (click)="showAlert()">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Anexos</ion-label>
</ion-item>
<div *ngIf="loadedEventAttachments">
<div *ngFor="let att of loadedEventAttachments; let j=index">
<div *ngIf="j<2">
<ion-list *ngIf="loadedEvent.HasAttachments">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-item lines="none" (click)="viewDocument(att.Link)">
<ion-icon name="attach" slot="start"></ion-icon>
<ion-label>
<p>{{ att.Description }}</p>
<p>{{ att.CreateDate }}</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="loadedEventAttachments.length > 1">
<button class="see-more-button" fill="none" shape="round" (click)="openAttachments()"><!-- [routerLink]="['/home/attachments', loadedEvent.EventId]" -->
<ion-label color="secondary">Ver mais...</ion-label>
</button>
</div>
</div>
<ion-list *ngIf="!loadedEvent.HasAttachments">
<ion-item lines="none" >
<ion-label>
Sem anexos
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-item-sliding>
</ion-item-group>
</div>
<!-- Skeleton screen -->
<div *ngIf="!loadedEvent">
<div class="ion-padding custom-skeleton">
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text animated style="width: 88%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 70%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</div>
<ion-list>
<ion-list-header>
<ion-label>
<ion-skeleton-text animated style="width: 20%"></ion-skeleton-text>
</ion-label>
</ion-list-header>
<ion-item>
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-avatar>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-thumbnail slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-thumbnail>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-skeleton-text animated style="width: 27px; height: 27px" slot="start"></ion-skeleton-text>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-content>
<ion-footer>
<ion-toolbar>
<div class="event-detail-buttons">
<button class="btn-ok" fill="clear" color="#fff" shape="round" (click)="Save()">Gravar</button>
</div>
</ion-toolbar>
</ion-footer>
@@ -0,0 +1,165 @@
.content{
padding: 30px 20px 0 20px !important;
margin: 0;
float: left;
border-left: 1px solid #d8d8d8 !important;
}
.main-header{
font-family: Roboto;
background-color: #fff;
overflow:hidden;
color:#000;
transform: translate3d(0, 1px, 0);
.title-content{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.middle{
padding: 0!important;
float: left;
}
}
.title{
font-size: 25px;
}
}
.ion-item-container{
margin: 15px auto;
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 10px;
}
.ion-item-container-no-border{
width: 100%;
margin: 0px auto;
padding: 0 !important;
overflow: auto;
}
.container-div{
margin-bottom: 15px;
float: left;
overflow: auto;
}
.ion-item-class-2{
margin: 0px auto;
}
.ion-icon-class{
width: 45px;
height: 45px;
float: left;
padding: 10px;
font-size: 25px;
}
ion-select{
padding-left: 5px;
margin-left: 0;
}
.ion-input-class{
width: calc(100% - 45px);
height: 45px;
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 5px;
padding-right: 10px;
float: left;
}
.ion-input-class-no-height{
border: 1px solid #ebebeb;
border-radius: 5px;
overflow: auto;
}
.list-people{
//width: 256px;
float: left;
}
.add-people{
width: 45px;
float: right;
overflow: auto;
font-size: 25px;
padding: 10px;
}
.list-people-title{
/* font-size: 13px; */
color: #797979;
}
.attach-document{
font-size: 15px;
color: #0d89d1;
margin: 5px 5px 5px 10px;
padding: 5px;
float: left;
}
.attach-icon{
width: 37px;
font-size: 35px;
float: left;
}
.attach-title-item{
width: 100%;
font-size: 15px;
color:#0d89d1;
}
/* SPAN */
.span-left{
float: left;
font-size: 15x;
}
.span-right{
text-align: right;
float: right;
font-size: 13px;
}
.container-footer{
margin:0 auto;
overflow: auto;
}
.button-cancel {
width: 170px;
height: 44px;
border-radius: 22.5px;
--background: #e0e9ee;
--color: #061b52;
margin:10px;
}
.button-save {
width: 170px;
height: 44px;
border-radius: 22.5px;
--background: #42b9fe;
--color:#ffffff;
margin:10px;
}
.text-input{
width: 100%;
border: 1px solid #ebebeb;
margin: 0px 15px 15px 0px;
padding: 0 !important;
border-radius: 5px;
}
/* Error Messages */
.error{
color:red;
font-size: 12px;
font-weight: bold;
padding-bottom: 20px;
}
.span-color{
color:red;
}
.buttons{
display: flex;
justify-content: space-between;
padding: 20px;
overflow: auto;
}
@@ -0,0 +1,28 @@
import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { EditEventPage } from './edit-event.page';
describe('EditEventPage', () => {
let component: EditEventPage;
let fixture: ComponentFixture<EditEventPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ EditEventPage ],
imports: [
IonicModule.forRoot(),
HttpClientModule
]
}).compileComponents();
fixture = TestBed.createComponent(EditEventPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,245 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EventsService } from 'src/app/services/events.service';
import { Router } from '@angular/router';
import { Event } from '../../../models/event.model';
import { EventBody } from 'src/app/models/eventbody.model';
import { AlertController, ModalController } from '@ionic/angular';
import { EventPerson } from 'src/app/models/eventperson.model';
import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
import { AlertService } from 'src/app/services/alert.service';
import { Attachment } from 'src/app/models/attachment.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AttachmentsPage } from '../attachments/attachments.page';
@Component({
selector: 'app-edit-event',
templateUrl: './edit-event.page.html',
styleUrls: ['./edit-event.page.scss'],
})
export class EditEventPage implements OnInit {
loadedEvent: Event;
loadedEventAttachments: Attachment[];
pageId: string;
showLoader: boolean;
backURL: string;
ionicForm: FormGroup;
isSubmitted = false;
minDate: Date;
profile:string;
constructor(
public formBuilder: FormBuilder,
public alertController: AlertController,
private router: Router,
private activatedRoute: ActivatedRoute,
private eventsService: EventsService,
private modalCtrl: ModalController,
private alertService: AlertService,
private attachamentsService: AttachmentsService,
private route: Router,
private iab: InAppBrowser) {
this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody();
}
ngOnInit() {
this.loadEvent();
this.loadAttachments();
this.ionicForm = this.formBuilder.group({
subject: ['', [Validators.required]]
})
}
get errorControl() {
return this.ionicForm.controls;
}
loadEvent(){
let eventid: string;
this.activatedRoute.paramMap.subscribe(paramMap =>
{
if (!paramMap.has("eventId")){
return;
}
else{
this.pageId = paramMap.get('eventId');
eventid = paramMap.get('eventId');
console.log(eventid);
}
if (paramMap.has("caller")){
this.backURL = "/home/" + paramMap.get('caller');
}
}
);
this.eventsService.getEvent(eventid).subscribe(response => {
this.loadedEvent = response;
});
}
async openAttendees(){
const modal = await this.modalCtrl.create({
component: AttendeesPageModal,
componentProps: {
eventAttendees: this.loadedEvent.Attendees
},
cssClass: 'attendee modal-desktop',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
getEventAttendees(): EventPerson[]
{
return this.loadedEvent.Attendees;
}
setEventAttendees(newattendes: EventPerson[])
{
this.loadedEvent.Attendees = newattendes;
}
async deleteConfirm()
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Apagar evento!',
message: 'Deseja <strong>apagar</strong> o evento da agenda ' + this.loadedEvent.CalendarName + '?',
buttons: [
{
text: 'Não',
role: 'cancel',
cssClass: 'secondary',
handler: () => { }
}, {
text: 'Sim',
handler: () => {
this.Delete();
}
}
]
});
await alert.present();
}
Delete()
{
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () =>
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(()=>{
alert.dismiss();
}, 1500);
this.router.navigate(['/home/events']);
});
}
Save()
{
if (this.ionicForm.valid){
this.activatedRoute.paramMap.subscribe(paramMap =>{
if (paramMap.has("profile")){
console.log(paramMap.get('profile'));
}
});
this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () =>
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento actualizado',
buttons: ['OK']
});
setTimeout(()=>{
alert.dismiss();
}, 1500);
});
}
}
showAlert(){
this.alertService.presentAlert("Funcionalidade em desenvolvimento");
}
loadAttachments()
{
/* console.log(this.pageId); */
this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
this.loadedEventAttachments = res;
console.log(res);
});
}
async viewDocument(documenturl:string)
{
const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
}
back()
{
//this.back();
}
doRefresh(event){
/* this.RefreshEvents(); */
event.target.complete();
setTimeout(() => {
event.target.complete();
}, 2000);
}
navigateTo(ev){
this.route.navigate(['/home/events',ev]);
}
async openAttachments(){
const modal = await this.modalCtrl.create({
component: AttachmentsPage,
componentProps: {
eventId: this.pageId,
attachments: this.loadedEventAttachments
},
cssClass: 'attachments',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EventDetailModalPage } from './event-detail-modal.page';
const routes: Routes = [
{
path: '',
component: EventDetailModalPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class EventDetailModalPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { EventDetailModalPageRoutingModule } from './event-detail-modal-routing.module';
import { EventDetailModalPage } from './event-detail-modal.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
EventDetailModalPageRoutingModule
],
declarations: [EventDetailModalPage]
})
export class EventDetailModalPageModule {}
@@ -0,0 +1,215 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="{{ backURL }}"></ion-back-button>
</ion-buttons>
<ion-title>Visualizar Evento</ion-title>
<ion-buttons slot="end">
<button (click)="deleteConfirm()" class="ion-icon-delete">
<ion-icon name="trash"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div *ngIf="loadedEvent">
<ion-item-group>
<ion-item-sliding>
<!-- <form [formGroup]="ionicForm" novalidate>
<ion-item>
<ion-label class="capitalizeText" position="stacked">Assunto</ion-label>
<ion-input class="capitalizeText" [(ngModel)]="loadedEvent.Subject" formControlName="subject" type="text" required></ion-input>
</ion-item>
//Error messages
<span class="error ion-padding" *ngIf="errorControl.subject.errors?.required">
Campo obrigatório
</span>
</form> -->
<ion-item>
<ion-label position="stacked">Descrição</ion-label>
<ion-input class="capitalizeText" [(ngModel)]='loadedEvent.Body.Text'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Localização</ion-label>
<ion-input class="capitalizeText" [(ngModel)]='loadedEvent.Location'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Calendário</ion-label>
<ion-select class="capitalizeText" placeholder="{{loadedEvent.CalendarName}}" [(ngModel)]="loadedEvent.CalendarName" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
<ion-select-option Pessoal="Reunião">Pessoal</ion-select-option>
<ion-select-option Oficial="Viagem">Oficial</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label position="stacked">Tipo do evento</ion-label>
<ion-select placeholder="{{loadedEvent.EventType}}" [(ngModel)]="loadedEvent.EventType" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
<ion-select-option value="Reunião">Reunião</ion-select-option>
<ion-select-option value="Viagem">Viagem</ion-select-option>
<ion-select-option value="Conferência">Conferência</ion-select-option>
<ion-select-option value="Encontro">Encontro</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label position="stacked">Data Início</ion-label>
<ion-datetime value="{{loadedEvent.StartDate}}" [(ngModel)]="loadedEvent.StartDate" min="2020" max="2100"
displayFormat="D MMM YYYY H:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"></ion-datetime>
</ion-item>
<ion-item>
<ion-label position="stacked">Data Fim</ion-label>
<ion-datetime value="{{loadedEvent.EndDate}}" [(ngModel)]="loadedEvent.EndDate" min="2020" max="2100"
displayFormat="D MMM YYYY HH:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"></ion-datetime>
</ion-item>
<div class="div-attach" >
<ion-item>
<ion-buttons slot="end" (click)="openAttendees()">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Participantes</ion-label>
</ion-item>
<div *ngIf="loadedEvent.Attendees">
<div *ngFor="let attendee of loadedEvent.Attendees; let i=index">
<div *ngIf="i<1">
<ion-list >
<ion-item class="attendees" lines="none" >
<ion-icon class="attendees-icon" name="person" slot="start"></ion-icon>
<ion-label class="capitalizeText" class="attendees-list">{{attendee.Name}}</ion-label>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="loadedEvent.Attendees.length > 1">
<button class="see-more-button" fill="none" shape="round" (click)="openAttendees()">
<ion-label color="secondary">Ver mais...</ion-label>
</button>
</div>
</div>
</div>
<div class="div-attach">
<ion-item>
<ion-buttons slot="end" (click)="showAlert()">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Anexos</ion-label>
</ion-item>
<div *ngIf="loadedEventAttachments">
<div *ngFor="let att of loadedEventAttachments; let j=index">
<div *ngIf="j<2">
<ion-list *ngIf="loadedEvent.HasAttachments">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-item lines="none" (click)="viewDocument(att.Link)">
<ion-icon name="attach" slot="start"></ion-icon>
<ion-label>
<p>{{ att.Description }}</p>
<p>{{ att.CreateDate }}</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="loadedEventAttachments.length > 1">
<button class="see-more-button" fill="none" shape="round" (click)="openAttachments()"><!-- [routerLink]="['/home/attachments', loadedEvent.EventId]" -->
<ion-label color="secondary">Ver mais...</ion-label>
</button>
</div>
</div>
<!-- Skeleton Attachment -->
<ion-list *ngIf="!loadedEventAttachments">
<ion-item lines="none" >
<ion-icon name="attach" slot="start"></ion-icon>
<ion-label>
<p> <ion-skeleton-text animated></ion-skeleton-text></p>
<p> <ion-skeleton-text animated></ion-skeleton-text></p>
</ion-label>
</ion-item>
</ion-list>
<!-- No attachment message -->
<ion-list *ngIf="!loadedEvent.HasAttachments">
<ion-item lines="none" >
<ion-label>
Sem anexos
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-item-sliding>
</ion-item-group>
</div>
<!-- Skeleton screen -->
<div *ngIf="!loadedEvent">
<div class="ion-padding custom-skeleton">
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text animated style="width: 88%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 70%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</div>
<ion-list>
<ion-list-header>
<ion-label>
<ion-skeleton-text animated style="width: 20%"></ion-skeleton-text>
</ion-label>
</ion-list-header>
<ion-item>
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-avatar>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-thumbnail slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-thumbnail>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-skeleton-text animated style="width: 27px; height: 27px" slot="start"></ion-skeleton-text>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-content>
<ion-footer>
<ion-toolbar>
<div class="event-detail-buttons">
<ion-button shape="round" (click)="Save()">Gravar</ion-button>
</div>
</ion-toolbar>
</ion-footer>
@@ -0,0 +1,95 @@
ion-item-group{
margin: 15px;
}
.div-item{
width: 100%;
overflow: auto;
border-bottom: 1px solid #ccc;
margin: 10px 0 5px 0;
}
.div-up{
width: 100%;
overflow: auto;
}
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
float: left;
color: #808080;
}
.div-icon ion-icon{
display: block;
margin: 0 auto;
}
.div-content-attachment{
width: 85%;
float: left;
padding: 0 0 0 12px;
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
}
.btn-attach{
margin: 15px 0 0 0;
--color: #333;
--border-color:#333;
}
.div-card-button{
width: 100%;
overflow: auto;
padding: 0 !important;
}
ion-card{
margin: 2.5% !important;
width: 45%;
float: left;
}
.center{
text-align: center;
float: center;
}
/* FFOTER */
.event-detail-buttons{
width: 90%;
margin: 10px auto;
}
.event-detail-buttons ion-button{
width: 90%;
margin: 0 auto;
display: block;
margin-bottom: 25px;
}
.ion-icon-delete{
font-size: 22px;
color: red;
background-color: white;
padding-right: 5px;
}
.error{
color:red;
font-size: 12px;
font-weight: bold;
padding-bottom: 20px;
}
/* .event-detail-buttons{
margin-bottom: 80px;
margin-top: 10px;
} */
.attendees-icon{
font-size: 14px;
}
.see-more-button{
text-transform: initial;
font-size: 16px;
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { EventDetailModalPage } from './event-detail-modal.page';
describe('EventDetailModalPage', () => {
let component: EventDetailModalPage;
let fixture: ComponentFixture<EventDetailModalPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EventDetailModalPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(EventDetailModalPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,245 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { AlertController, ModalController, NavParams } from '@ionic/angular';
import { Attachment } from 'src/app/models/attachment.model';
import { Event } from 'src/app/models/event.model';
import { EventBody } from 'src/app/models/eventbody.model';
import { EventPerson } from 'src/app/models/eventperson.model';
import { AlertService } from 'src/app/services/alert.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { AttachmentsPage } from '../attachments/attachments.page';
import { AttendeesPageModal } from '../attendees/attendees.page';
@Component({
selector: 'app-event-detail-modal',
templateUrl: './event-detail-modal.page.html',
styleUrls: ['./event-detail-modal.page.scss'],
})
export class EventDetailModalPage implements OnInit {
loadedEvent: Event;
loadedEventAttachments: Attachment[];
pageId: string;
showLoader: boolean;
backURL: string;
ionicForm: FormGroup;
isSubmitted = false;
minDate: Date;
profile:string;
constructor(
public formBuilder: FormBuilder,
public alertController: AlertController,
private router: Router,
private activatedRoute: ActivatedRoute,
private eventsService: EventsService,
private modalCtrl: ModalController,
private alertService: AlertService,
private attachamentsService: AttachmentsService,
private route: Router,) {
this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody();
}
ngOnInit() {
this.loadEvent();
this.loadAttachments();
this.ionicForm = this.formBuilder.group({
subject: ['', [Validators.required]]
})
// this.setDefaultTime()
}
// setDefaultTime() {
// this.loadedEvent.StartDate = new Date()
// this.loadedEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000))
// }
get errorControl() {
return this.ionicForm.controls;
}
loadEvent(){
let eventid: string;
this.activatedRoute.paramMap.subscribe(paramMap =>
{
if (!paramMap.has("eventId")){
return;
}
else{
this.pageId = paramMap.get('eventId');
eventid = paramMap.get('eventId');
console.log(eventid);
}
if (paramMap.has("caller")){
this.backURL = "/home/" + paramMap.get('caller');
}
}
);
this.eventsService.getEvent(eventid).subscribe(response => {
this.loadedEvent = response;
});
}
async openAttendees(){
const modal = await this.modalCtrl.create({
component: AttendeesPageModal,
componentProps: {
eventAttendees: this.loadedEvent.Attendees
},
cssClass: 'attendee modal-desktop',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
getEventAttendees(): EventPerson[]
{
return this.loadedEvent.Attendees;
}
setEventAttendees(newattendes: EventPerson[])
{
this.loadedEvent.Attendees = newattendes;
}
async deleteConfirm()
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Apagar evento!',
message: 'Deseja <strong>apagar</strong> o evento da agenda ' + this.loadedEvent.CalendarName + '?',
buttons: [
{
text: 'Não',
role: 'cancel',
cssClass: 'secondary',
handler: () => { }
}, {
text: 'Sim',
handler: () => {
this.Delete();
}
}
]
});
await alert.present();
}
Delete()
{
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () =>
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(()=>{
alert.dismiss();
}, 1500);
this.router.navigate(['/home/events']);
});
}
Save()
{
if (this.ionicForm.valid)
{
this.eventsService.putEvent(this.loadedEvent, 2, 3, "md").subscribe(async () =>
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento actualizado',
buttons: ['OK']
});
setTimeout(()=>{
alert.dismiss();
}, 1500);
});
}
}
showAlert(){
this.alertService.presentAlert("Funcionalidade em desenvolvimento");
}
loadAttachments()
{
/* this.attachamentsService.getEventAttachments(this.pageId).subscribe(attachments => {
this.loadedEventAttachments = attachments;
}); */
this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
console.log(res);
},(error) => {
console.log(error);
});
}
async viewDocument(documenturl:string)
{
const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
/* const browser = this.iab.create(url,"_blank");
browser.show(); */
}
back()
{
//this.back();
}
doRefresh(event){
/* this.RefreshEvents(); */
event.target.complete();
setTimeout(() => {
event.target.complete();
}, 2000);
}
navigateTo(ev){
this.route.navigate(['/home/events',ev]);
}
async openAttachments() {
const modal = await this.modalCtrl.create({
component: AttachmentsPage,
componentProps: {
eventId: this.pageId,
attachments: this.loadedEventAttachments
},
cssClass: 'attachments',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EventDetailPage } from './event-detail.page';
const routes: Routes = [
{
path: '',
component: EventDetailPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class EventDetailPageRoutingModule {}
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { EventDetailPageRoutingModule } from './event-detail-routing.module';
import { EventDetailPage } from './event-detail.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ReactiveFormsModule,
EventDetailPageRoutingModule
],
declarations: [EventDetailPage]
})
export class EventDetailPageModule {}
@@ -0,0 +1,215 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="{{ backURL }}"></ion-back-button>
</ion-buttons>
<ion-title class="header-title">Visualizar Evento</ion-title>
<ion-buttons slot="end">
<button (click)="deleteConfirm()" class="ion-icon-delete">
<ion-icon name="trash"></ion-icon>
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div *ngIf="loadedEvent">
<ion-item-group>
<ion-item-sliding>
<form [formGroup]="ionicForm" novalidate>
<ion-item>
<ion-label class="capitalizeText" position="stacked">Assunto</ion-label>
<ion-input class="capitalizeText" [(ngModel)]="loadedEvent.Subject" formControlName="subject" type="text" required></ion-input>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.subject.errors?.required">
Campo obrigatório
</span>
</form>
<ion-item>
<ion-label position="stacked">Descrição</ion-label>
<ion-input class="capitalizeText" [(ngModel)]='loadedEvent.Body.Text'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Localização</ion-label>
<ion-input class="capitalizeText" [(ngModel)]='loadedEvent.Location'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Calendário</ion-label>
<ion-select class="capitalizeText" placeholder="{{loadedEvent.CalendarName}}" [(ngModel)]="loadedEvent.CalendarName" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
<ion-select-option Pessoal="Reunião">Pessoal</ion-select-option>
<ion-select-option Oficial="Viagem">Oficial</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label position="stacked">Tipo do evento</ion-label>
<ion-select placeholder="{{loadedEvent.EventType}}" [(ngModel)]="loadedEvent.EventType" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
<ion-select-option value="Reunião">Reunião</ion-select-option>
<ion-select-option value="Viagem">Viagem</ion-select-option>
<ion-select-option value="Conferência">Conferência</ion-select-option>
<ion-select-option value="Encontro">Encontro</ion-select-option>
</ion-select>
</ion-item>
<ion-item>
<ion-label position="stacked">Data Início</ion-label>
<ion-datetime value="{{loadedEvent.StartDate}}" [(ngModel)]="loadedEvent.StartDate" min="2020" max="2100"
displayFormat="D MMM YYYY H:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"></ion-datetime>
</ion-item>
<ion-item>
<ion-label position="stacked">Data Fim</ion-label>
<ion-datetime value="{{loadedEvent.EndDate}}" [(ngModel)]="loadedEvent.EndDate" min="2020" max="2100"
displayFormat="D MMM YYYY HH:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"></ion-datetime>
</ion-item>
<div class="div-attach" >
<ion-item>
<ion-buttons slot="end" (click)="openAttendees()">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Participantes</ion-label>
</ion-item>
<div *ngIf="loadedEvent.Attendees">
<div *ngFor="let attendee of loadedEvent.Attendees; let i=index">
<div *ngIf="i<1">
<ion-list >
<ion-item class="attendees" lines="none" >
<ion-icon class="attendees-icon" name="person" slot="start"></ion-icon>
<ion-label class="capitalizeText" class="attendees-list">{{attendee.Name}}</ion-label>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="loadedEvent.Attendees.length > 1">
<button class="see-more-button" fill="none" shape="round" (click)="openAttendees()">
<ion-label color="secondary">Ver mais...</ion-label>
</button>
</div>
</div>
</div>
<div class="div-attach">
<ion-item>
<ion-buttons slot="end" (click)="showAlert()">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Anexos</ion-label>
</ion-item>
<div *ngIf="loadedEventAttachments">
<div *ngFor="let att of loadedEventAttachments; let j=index">
<div *ngIf="j<2">
<ion-list *ngIf="loadedEvent.HasAttachments">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-item lines="none" (click)="viewDocument(att.Link)">
<ion-icon name="attach" slot="start"></ion-icon>
<ion-label>
<p>{{ att.Description }}</p>
<p>{{ att.CreateDate }}</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="loadedEventAttachments.length > 1">
<button class="see-more-button" fill="none" shape="round" (click)="openAttachments()"><!-- [routerLink]="['/home/attachments', loadedEvent.EventId]" -->
<ion-label color="secondary">Ver mais...</ion-label>
</button>
</div>
</div>
<!-- Skeleton Attachment -->
<!-- <ion-list *ngIf="!loadedEventAttachments">
<ion-item lines="none" >
<ion-icon name="attach" slot="start"></ion-icon>
<ion-label>
<p> <ion-skeleton-text animated></ion-skeleton-text></p>
<p> <ion-skeleton-text animated></ion-skeleton-text></p>
</ion-label>
</ion-item>
</ion-list> -->
<!-- No attachment message -->
<ion-list *ngIf="!loadedEvent.HasAttachments">
<ion-item lines="none" >
<ion-label>
Sem anexos
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-item-sliding>
</ion-item-group>
</div>
<!-- Skeleton screen -->
<div *ngIf="!loadedEvent">
<div class="ion-padding custom-skeleton">
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text animated style="width: 88%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 70%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</div>
<ion-list>
<ion-list-header>
<ion-label>
<ion-skeleton-text animated style="width: 20%"></ion-skeleton-text>
</ion-label>
</ion-list-header>
<ion-item>
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-avatar>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-thumbnail slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-thumbnail>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-skeleton-text animated style="width: 27px; height: 27px" slot="start"></ion-skeleton-text>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-content>
<ion-footer>
<ion-toolbar>
<div class="event-detail-buttons">
<button class="btn-ok" fill="clear" color="#fff" shape="round" (click)="Save()">Gravar</button>
</div>
</ion-toolbar>
</ion-footer>
@@ -0,0 +1,117 @@
ion-item-group{
margin: 15px;
}
.div-item{
width: 100%;
overflow: auto;
border-bottom: 1px solid #ccc;
margin: 10px 0 5px 0;
}
.div-up{
width: 100%;
overflow: auto;
}
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
float: left;
color: #808080;
}
.div-icon ion-icon{
display: block;
margin: 0 auto;
}
.div-content-attachment{
width: 85%;
float: left;
padding: 0 0 0 12px;
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
}
.btn-attach{
margin: 15px 0 0 0;
--color: #333;
--border-color:#333;
}
.div-card-button{
width: 100%;
overflow: auto;
padding: 0 !important;
}
ion-card{
margin: 2.5% !important;
width: 45%;
float: left;
}
.center{
text-align: center;
float: center;
}
/* FFOTER */
.event-detail-buttons{
width: 90%;
margin: 10px auto;
}
.event-detail-buttons ion-button{
width: 90%;
margin: 0 auto;
display: block;
margin-bottom: 25px;
}
.ion-icon-delete{
font-size: 22px;
color: red;
background-color: white;
padding-right: 5px;
}
.error{
color:red;
font-size: 12px;
font-weight: bold;
padding-bottom: 20px;
}
/* .event-detail-buttons{
margin-bottom: 80px;
margin-top: 10px;
} */
.attendees-icon{
font-size: 14px;
}
.see-more-button{
text-transform: initial;
font-size: 16px;
}
.header-content{
overflow: auto;
margin: 0 auto;
padding-top: 25px;
}
.header-icon-left{
width: 36px;
font-size: 33px;
color: #42b9fe;
float: left;
border: 1px solid red;
}
.header-title{
width: 300px;
font-family: Roboto;
font-size: 25px;
margin: 0 5px 0 5px;
padding: 0;
color:#000;
float: left;
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { EventDetailPage } from './event-detail.page';
describe('EventDetailPage', () => {
let component: EventDetailPage;
let fixture: ComponentFixture<EventDetailPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EventDetailPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(EventDetailPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,244 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EventsService } from 'src/app/services/events.service';
import { Router } from '@angular/router';
import { Event } from '../../../models/event.model';
import { EventBody } from 'src/app/models/eventbody.model';
import { AlertController, ModalController } from '@ionic/angular';
import { EventPerson } from 'src/app/models/eventperson.model';
import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
import { AlertService } from 'src/app/services/alert.service';
import { Attachment } from 'src/app/models/attachment.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AttachmentsPage } from '../attachments/attachments.page';
@Component({
selector: 'app-event-detail',
templateUrl: './event-detail.page.html',
styleUrls: ['./event-detail.page.scss'],
})
export class EventDetailPage implements OnInit {
loadedEvent: Event;
loadedEventAttachments: Attachment[];
pageId: string;
showLoader: boolean;
backURL: string;
ionicForm: FormGroup;
isSubmitted = false;
minDate: Date;
profile:string;
constructor(
public formBuilder: FormBuilder,
public alertController: AlertController,
private router: Router,
private activatedRoute: ActivatedRoute,
private eventsService: EventsService,
private modalCtrl: ModalController,
private alertService: AlertService,
private attachamentsService: AttachmentsService,
private route: Router,
private iab: InAppBrowser) {
this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody();
}
ngOnInit() {
this.loadEvent();
this.loadAttachments();
this.ionicForm = this.formBuilder.group({
subject: ['', [Validators.required]]
})
}
get errorControl() {
return this.ionicForm.controls;
}
loadEvent(){
let eventid: string;
this.activatedRoute.paramMap.subscribe(paramMap =>
{
if (!paramMap.has("eventId")){
return;
}
else{
this.pageId = paramMap.get('eventId');
eventid = paramMap.get('eventId');
console.log(eventid);
}
if (paramMap.has("caller")){
this.backURL = "/home/" + paramMap.get('caller');
}
}
);
this.eventsService.getEvent(eventid).subscribe(response => {
this.loadedEvent = response;
});
}
async openAttendees(){
const modal = await this.modalCtrl.create({
component: AttendeesPageModal,
componentProps: {
eventAttendees: this.loadedEvent.Attendees
},
cssClass: 'attendee modal-desktop',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
getEventAttendees(): EventPerson[]
{
return this.loadedEvent.Attendees;
}
setEventAttendees(newattendes: EventPerson[])
{
this.loadedEvent.Attendees = newattendes;
}
async deleteConfirm()
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Apagar evento!',
message: 'Deseja <strong>apagar</strong> o evento da agenda ' + this.loadedEvent.CalendarName + '?',
buttons: [
{
text: 'Não',
role: 'cancel',
cssClass: 'secondary',
handler: () => { }
}, {
text: 'Sim',
handler: () => {
this.Delete();
}
}
]
});
await alert.present();
}
Delete()
{
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () =>
{
/* const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
await alert.present(); */
this.router.navigate(['/home/events']);
});
}
Save()
{
if (this.ionicForm.valid){
this.activatedRoute.paramMap.subscribe(paramMap =>{
if (paramMap.has("profile")){
console.log(paramMap.get('profile'));
}
});
this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () =>
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento actualizado',
buttons: ['OK']
});
setTimeout(()=>{
alert.dismiss();
}, 1500);
});
}
}
showAlert(){
this.alertService.presentAlert("Funcionalidade em desenvolvimento");
}
loadAttachments()
{
/* console.log(this.pageId); */
this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => {
this.loadedEventAttachments = res;
console.log(res);
});
}
async viewDocument(documenturl:string)
{
const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
}
back()
{
//this.back();
}
doRefresh(event){
/* this.RefreshEvents(); */
event.target.complete();
setTimeout(() => {
event.target.complete();
}, 2000);
}
navigateTo(ev){
this.route.navigate(['/home/events',ev]);
}
async openAttachments(){
const modal = await this.modalCtrl.create({
component: AttachmentsPage,
componentProps: {
eventId: this.pageId,
attachments: this.loadedEventAttachments
},
cssClass: 'attachments',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
}
@@ -0,0 +1,39 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EventsPage } from './events.page';
const routes: Routes = [
{
path: '',
component: EventsPage
},
{
path: 'event-detail',
loadChildren: () => import('./event-detail/event-detail.module').then( m => m.EventDetailPageModule)
},
{
path: 'attachments',
loadChildren: () => import('./attachments/attachments.module').then( m => m.AttachmentsPageModule)
},
{
path: 'attendees',
loadChildren: () => import('./attendees/attendees.module').then( m => m.AttendeesPageModule)
},
{
path: 'event-detail-modal',
loadChildren: () => import('./event-detail-modal/event-detail-modal.module').then( m => m.EventDetailModalPageModule)
},
{
path: 'edit-event',
loadChildren: () => import('./edit-event/edit-event.module').then( m => m.EditEventPageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class EventsPageRoutingModule {}
+23
View File
@@ -0,0 +1,23 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { EventsPageRoutingModule } from './events-routing.module';
import { EventsPage } from './events.page';
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { PdfViewerModule } from 'ng2-pdf-viewer';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
EventsPageRoutingModule,
HeaderPageModule,
//
PdfViewerModule
],
declarations: [EventsPage],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class EventsPageModule {}
+121
View File
@@ -0,0 +1,121 @@
<ion-header class="ion-no-border ">
<app-header></app-header>
</ion-header>
<ion-header class="ion-no-border text-white">
<ion-label>
<p class="time ion-text-center">{{customDate}}</p>
</ion-label>
<ion-label>
<p *ngIf="totalEvent==1" class="event-number p-small ion-text-center"> <strong>{{totalEvent}}</strong> evento agendado para hoje</p>
<p *ngIf="totalEvent!=1"class="event-number p-small ion-text-center"> <strong>{{totalEvent}}</strong> eventos agendados para hoje</p>
</ion-label>
<div class="next-meeting">
<div class="meeting-time" *ngIf="currentHoursMinutes">{{currentHoursMinutes | date: 'HH:mm'}}</div>
<div class="meeting-description" *ngIf="currentEvent"> "{{currentEvent}}"</div>
</div>
</ion-header>
<!-- Default Refresher -->
<ion-content class="main " ng-controller="AppController">
<ion-refresher slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<div class="conteiner-box px-20 height-100" ng-swipe-up="swipe($event)">
<div class="schedule height-100">
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-default-agenda.svg" ></ion-icon>
<div class="text">A sua Agenda</div>
</div>
<button class="btn-no-color" [routerLink]="['/home/agenda']">
<ion-icon
class="icon-next"
slot="end"
src="assets/images/icons-arrow-circle-arrow-right.svg"
></ion-icon>
</button>
</div>
<div class="content overflow-y-auto flex-grow-1 height-100">
<!-- {{ toDayEventStorage.eventsList | json}} -->
<ion-list>
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of toDayEventStorage.eventsList"
(click)="goToEvent(event.EventId)"
>
<div class="d-flex content-{{loggeduser.Profile}}-{{event.CalendarName}}">
<div class="schedule-time">
<div *ngIf="!event.IsAllDayEvent" class="time-start">{{event.StartDate | date: 'HH:mm'}}</div>
<div *ngIf="!event.IsAllDayEvent" class="time-end">{{event.EndDate | date: 'HH:mm'}}</div>
<div *ngIf="event.IsAllDayEvent" class="time-start"> Todo </div>
<div *ngIf="event.IsAllDayEvent" class="time-end text-center"> o dia </div>
<div></div>
</div>
<div class="schedule-details">
<div class="location">{{event.Location}}</div>
<div class="description">
<p>{{event.Subject}}</p>
</div>
</div>
</div>
</ion-item>
</ion-list>
<!--
<div class="resume">
<div class="title">
Resumo para Amnahã
</div>
<div class="event-num">4 eventos ageandados para amanhã</div>
<div class="first-event-time">08:30 "Reunião Staff" no Palácio Presidencial</div>
</div>
-->
</div>
</div>
<div class="schedule height-100">
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-correspondencias.svg"></ion-icon>
<div class="text">Correspondência por ler</div>
</div>
<button (click)="viewExpedientListPage()" class="btn-no-color cursor-pointer">
<ion-icon class="icon-next" slot="end" src="assets/images/icons-arrow-circle-arrow-right.svg"></ion-icon>
</button>
</div>
<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 expedienteGdStore.list"
(click)="goToExpediente(task.SerialNumber)">
<div class="item-exp d-flex">
<div class="schedule-date">
<div class="time-end">{{task.taskStartDate | date: 'dd-MM-yyyy'}}</div>
<div class="time-start">{{task.taskStartDate | date: 'HH:mm'}}</div>
</div>
<div class="schedule-details pointer">
<div class="description">{{ task.Subject }}</div>
<div class="location">{{ task.Senders }}</div>
</div>
</div>
</ion-item>
</ion-list>
</div>
</div>
</div>
<!-- <pdf-viewer [src]="pdfSrc"
[render-text]="true"
style="display: block;"
></pdf-viewer> -->
</ion-content>
+526
View File
@@ -0,0 +1,526 @@
@import '~src/function.scss';
/* HEADER */
.bg-blue{
--background:#0782c9;
background:#0782c9;
--background-color:#0782c9;
background-color:#0782c9;
color: #ffffff;
--color: #ffffff;
}
ion-toolbar{
--background: white;
}
.ion-text-header-top{
width: 100%;
--background: transparent;
text-align: center;
padding-top: 15px;
color: #ffffff;
/* border: 1px solid red; */
}
.div-top-header{
width: 400px;
margin: 0 auto;
background-color: #0782c9;
overflow: auto;
padding-top: 15px;
border: 0!important;
.div-search{
font-size: 45px;
float: left;
margin: 0 0 0 10px
}
.div-logo{
background: transparent;
width: 140px;
margin: 5px 0 0px 71px;
float: left;
}
.div-logo img{
width: 100%;
}
.div-profile{
font-size: 45px;
float: right;
margin-right: 10px;
}
}
.ion-text-header-top p{
--background: transparent;
color: #ffffff;
}
.ion-text-right{
--background: transparent;
color: #ffffff;
}
.header-large{
font-family: Arial, Helvetica, sans-serif;
font-size: 12.5pt;
/* font-weight: 600; */
background: transparent;
color: #ffffff;
}
.header-xsmall{
font-family: Arial, Helvetica, sans-serif;
font-size: 9.7pt;
font-weight: bold;
padding-bottom: 3.5px;
margin-bottom: 3.5px;
border-bottom: 1px solid #ccc;
background: transparent;
}
.header-medium{
font-size: 12pt;
text-align: left;
font-family: roboto;
background: transparent;
margin-right: 5px;
line-height: 25px;
}
.p-small{
font-size: 13pt;
margin-top: 13px;
color:#000;
margin-right: 25px !important;
text-align: right;
/* color: #ffffff; */
}
/* CONTENT */
.item-list-small{
font-size: 14px;
overflow: auto;
}
.ion-item-class{
padding: 0;
}
.label-text{
width: 100%;
padding: 0;
margin: 0;
}
//DIV
.div-item-Oficial{
width: 100%;
overflow: auto;
/* border-bottom: 1px solid #ccc; */
margin: 10px 0 5px 0;
background: #cab0dc;
border-radius: 20px;
padding: 10px;
/* box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */
}
.div-item-Pessoal{
width: 100%;
overflow: auto;
/* border-bottom: 1px solid #ccc; */
margin: 10px 0 5px 0;
background: #cbeecb;
border-radius: 20px;
padding: 10px;
/* box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); */
}
.div-up{
width: 100%;
overflow: auto;
}
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
float: left;
color: #808080;
}
.div-icon ion-icon{
display: block;
margin: 0 auto;
}
.div-content-Oficial{
width: 85%;
float: left;
border-left: 4px solid #cab0dc;
padding: 0 0 0 12px;
}
.div-content-Pessoal{
width: 85%;
float: left;
border-left: 4px solid #cbeecb;
padding: 0 0 0 12px;
}
.div-content-Oficial h3, .div-content-Pessoal h3{
font-size: 14pt;
/* border: 1px solid red; */
}
.div-content-Oficial p, .div-content-Pessoal p{
font-size: 12pt;
color: rgb(94, 92, 92);
padding: 0 !important;
margin: 0 !important;
}
.div-botton{
width: 100%;
overflow: auto;
margin: 10px 0 5px 0;
}
.div-botton-left{
width: 10%;
float: left;
}
.ion-icon-location{
text-align: center;
display: block;
color: #000;
font-size: 16px;
margin: 0 auto;
}
.div-botton-middle{
width: 75%;
float: left;
margin-top: 0.5px;
}
.div-botton-middle p{
padding: 0;
margin: 0;
}
.div-botton-right{
width: 10%;
float: left;
margin: 0;
padding: 0;
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
}
/* NEW CSS FOR TOGGLE BUTTON */
.toggleBox{
margin:20px 20px 0 0;
}
input[type="checkbox"]{
position: relative;
width: 96px;
height: 34px;
background: #ffffff;
-webkit-appearance: none;
border-radius: 20px;
outline: none;
transition: .4s;
/* box-shadow: inset 0 0 5px rgba(0,0,0,0.2); */
cursor: pointer;
border:1px solid #e16817;
}
input:checked[type="checkbox"]{
background: #e16817;
}
input[type="checkbox"]::before{
z-index: 2;
position: absolute;
content: "";
left: 0;
width: 30px;
height: 30px;
background: #fff;
border-radius: 50%;
/* transform: scale(1.1); */
box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
border:1px solid #e16817;
}
input:checked[type="checkbox"]::before{
left: 65px;
}
.toggle{
position: relative;
display: inline;
font-family: 'Montserrat', sans-serif;
display: grid;
text-align: center;
}
label{
position: absolute;
color: #fff;
font-weight: 600;
font-size: 12px;
pointer-events: none;
}
.onbtn{
top:10px;
bottom: 15px;
left: 15px;
/* padding-top: 10px;
border: 1px solid red; */
}
.ofbtn{
top:10px;
bottom: 15px;
right: 14px;
color: #e16817;
}
// new
.main{
padding: 0px em(20px);
}
.event-number{
color: white;
font-family: Roboto;
font-size: 15px;
color: var(--white);
bold{
font-family: Roboto;
font-size: 25px;
text-align: right;
color: var(--white);
}
}
.time{
font-family: Roboto;
font-size: 30px;
text-align: center;
color: var(--white);
line-height: unset;
margin-top: 10px;
}
.next-meeting{
display: flex;
justify-content: center;
margin: 0px 20px;
margin-top: 15px;
.meeting-time {
font-size: em(25px);
font-family: Roboto;
font-weight: 300;
color: var(--white);
margin-right: 7px;
}
.meeting-description {
margin-top: 2px;
font-family: Roboto;
font-size: 15px;
color: var(--white);
}
}
.conteiner-box {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding-bottom: 20px;
}
.schedule {
max-width: 400px;
font-family: Roboto;
background-color: white;
box-shadow: 0 0 10px 0 rgb(0 0 0 / 7%);
border: solid 1px #e9e9e9;
margin-bottom: 20px;
border-radius: 25px;
display: flex;
flex-direction: column;
max-height: 100%;
overflow: auto;
padding-bottom: 25px;
.schedule-header{
display: flex;
margin-bottom: 20px;
justify-content: space-between;
padding: 20px 20px 0px 20px;
.title {
display: flex;
align-items: center;
.icon{
color: #e8e8e8;
height: 35px;
width: 35px;
margin-right: 10px;
}
.text{
font-family: Roboto;
font-size: 20px;
color: black;
}
}
.icon-next {
color: #e8e8e8;
height: 35px;
width: 35px;
font-size: 35px;
font-size: 35px;
}
}
.content{
//padding: 0px 20px 20px 20px;
overflow: auto;
.item-exp{
overflow: auto;
//padding-top: 5px;
//padding-bottom: 5px;
padding: 5px 20px 5px 20px;
background-color: transparent !important;
}
ion-list{
padding: 0px;
margin: 0px;
.d-flex{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
ion-item{
padding-bottom: 5px;
margin-top: 5px;
border-bottom: 1px solid #ebebeb;
display: flex;
justify-content: space-between;
align-items: center;
--background: transparent !important;
.schedule-time{
margin-right: 10px;
.time-start{
color: #797979 !important;
font-family: Roboto;
font-size: 13px;
}
.time-end{
color: #797979 !important;
font-family: Roboto;
font-size: 13px;
}
}
.schedule-date{
margin-right: 10px;
width: 22%;
color: #797979 !important;
font-size: 13px;
}
.schedule-details{
display: flex;
flex-wrap: wrap;
align-items: center;
width: 78%;
.location{
font-family: Roboto;
font-size: 13px;
color: black;
width: 100%;
}
.description{
width: 100%;
font-family: Roboto;
font-size: 15px;
font-weight: bold;
color: #0d89d1;
}
.description p{
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis !important;
}
}
.color{
width: 5px;
height: 40px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
background-color: #f05d5e;
}
}
ion-item:last-child{
border-bottom: unset !important;
padding-bottom: unset !important;
}
}
}
.resume{
.title{
font-family: Roboto;
font-size: 15px;
font-weight: 500;
color: #797979;
margin-bottom: 5px;
margin-top: 10px;
}
.event-num, .first-event-time{
font-family: Roboto;
font-size: 15px;
display: block;
color: black;
}
}
}
.d-flex {
display: flex;
}
.pointer{
cursor: pointer;
}
@media only screen and (max-width: 856px) {
.content, .conteiner-box{
height: unset !important;
max-height: unset !important;
}
}
@media only screen and (min-width: 804px) {
.schedule:first-child {
margin-right: 2%;
}
}
@media only screen and (min-width: 478px) {
.schedule{
width: 400px;
}
}
@media only screen and (max-width: 478px) {
.schedule{
width: 360px;
}
}
ion-title{
border: 1px solid red;
text-overflow: ellipsis;
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { EventsPage } from './events.page';
describe('EventsPage', () => {
let component: EventsPage;
let fixture: ComponentFixture<EventsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EventsPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(EventsPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
+386
View File
@@ -0,0 +1,386 @@
import { Component, OnInit, LOCALE_ID, EventEmitter, Output, Renderer2, ElementRef } from '@angular/core';
import { Event } from '../../models/event.model';
import { EventsService } from 'src/app/services/events.service';
import { NavigationExtras, Router } from '@angular/router';
import { ActivatedRoute, NavigationEnd } from '@angular/router';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
import { StorageService } from 'src/app/services/storage.service';
import { ModalController, Platform } from '@ionic/angular';
import { EventDetailPage } from './event-detail/event-detail.page';
import { ProcessesService } from '../../services/processes.service';
import { DailyWorkTask } from '../../models/dailyworktask.model';
import { LoginUserRespose } from 'src/app/models/user.model';
import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service';
import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
@Component({
selector: 'app-events',
templateUrl: './events.page.html',
styleUrls: ['./events.page.scss'],
})
export class EventsPage implements OnInit {
/* Get current system date */
today = new Date();
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
/* Setting appropriate greeting according to the time */
grettings = ["Bom dia", "Boa tarde", "Boa noite"];
greetting='';
timeDate = this.today.getHours() + ":" + this.today.getMinutes();
/* Set segment variable */
segment:string;
public profile:string;
currentEvent: any;
eventsList: Event[];
maxSubjectLength = 30;
officialeventsList: Event[];
personaleventsList: Event[];
prEventList: Event[];
mdEventList: Event[];
combinedEvents: Event[];
customText = false;
totalEvent=0;
currentHoursMinutes: Date | string;
showLoader: boolean;
taskslist:DailyWorkTask[] = [];
expedientList:any;
hideSearchBtn: boolean=false;
// shared data
toDayEventStorage = ToDayEventStorage
expedienteGdStore = ExpedienteGdStore
expedienteTaskPipe = new ExpedienteTaskPipe()
@Output() openExpedientListPage:EventEmitter<any> = new EventEmitter<any>();
loggeduser: LoginUserRespose;
existingScreenOrientation: string;
constructor(
private eventService: EventsService,
private router: Router,
private storageService:StorageService,
public activatedRoute: ActivatedRoute,
private alertController: AlertService,
private authService: AuthService,
private processes:ProcessesService,
/* private gabineteService: GabineteDigitalPage, */
private modalController:ModalController,
private screenOrientation: ScreenOrientation,
public platform: Platform,
) {
this.existingScreenOrientation = this.screenOrientation.type;
console.log(this.existingScreenOrientation);
this.loggeduser = authService.ValidatedUser;
this.prEventList = null;
this.platform.resize.subscribe(async () => {
//console.log('Resize event detected');
// console.log('Resize event detected');
});
}
ngOnInit() {
this.segment = "Combinada";
this.profile = "mdgpr";
this.showGreeting();
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
this.LoadList();
}
});
this.hideSearch();
//this.checkScreenOrientation();
}
hideSearch(){
if(this.router.url == '/home/events'){
this.hideSearchBtn = true;
}
}
doRefresh(event) {
this.RefreshEvents();
this.LoadList();
event.target.complete();
}
onSegmentChange() {
this.RefreshEvents();
}
// Lock to portrait
lockToPortrait(){
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
console.log('set');
}
// Lock to landscape
lockToLandscape(){
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
}
// Unlock screen orientation
unlockScreenOrientation(){
this.screenOrientation.unlock();
}
checkScreenOrientation(){
if( window.innerWidth < 701) {
this.lockToPortrait();
console.log('was here');
}
else{
this.unlockScreenOrientation();
}
}
async RefreshEvents() {
this.currentEvent = "";
this.showLoader = true;
let date = new Date();
date.setMonth(date.getMonth() + 1);
let start = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds();
let end = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" 23:59:59";
if(this.loggeduser.Profile == 'MDGPR') {
let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise();
let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise();
const list = mdOficialEvents.concat(mdPessoalEvents);
this.toDayEventStorage.reset(list)
if(this.toDayEventStorage.eventsList.length > 0){
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
}
this.totalEvent = this.toDayEventStorage.eventsList.length;
this.showLoader = false;
}
else if (this.loggeduser.Profile == 'PR') {
let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise();
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
const list = prOficialEvents.concat(prPessoalEvents);
this.toDayEventStorage.reset(list)
if(this.toDayEventStorage.eventsList.length > 0) {
this.currentEvent = this.toDayEventStorage.eventsList[0].Subject;
this.currentHoursMinutes = this.toDayEventStorage.eventsList[0].StartDate;
}
this.totalEvent = this.toDayEventStorage.eventsList.length;
this.showLoader = false;
}
/* switch (this.segment)
{
case "Combinada":
if(this.loggeduser.Profile == 'MDGPR'){
let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise();
let mdPessoalEvents = await this.eventService.getAllMdPessoalEvents(start, end).toPromise();
this.eventsList = mdOficialEvents.concat(mdPessoalEvents);
if(this.eventsList.length > 0){
this.currentEvent = this.eventsList[0].Subject;
this.currentHoursMinutes = this.eventsList[0].StartDate;
}
this.totalEvent = this.eventsList.length;
this.showLoader = false;
}
else{
let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise();
let prPessoalEvents= await this.eventService.getAllPrPessoalEvents(start, end).toPromise();
this.eventsList = prOficialEvents.concat(prPessoalEvents);
console.log(this.eventsList);
console.log(this.eventsList);
if(this.eventsList.length > 0){
this.currentEvent = this.eventsList[0].Subject;
this.currentHoursMinutes = this.eventsList[0].StartDate;
}
this.totalEvent = this.eventsList.length;
this.showLoader = false;
}
break;
case "Pessoal":
if(this.loggeduser.Profile == 'MDGPR'){
this.eventService.getAllMdPessoalEvents(start, end).subscribe(res => {
this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal");
this.showLoader = false;
});
}
else{
this.eventService.getAllPrPessoalEvents(start, end).subscribe(res => {
this.personaleventsList = res.filter(data => data.CalendarName == "Pessoal");
this.showLoader = false;
});
}
break;
case "Oficial":
if(this.loggeduser.Profile == 'MDGPR'){
this.eventService.getAllMdOficialEvents(start, end).subscribe(res => {
this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");;
this.showLoader = false;
});
}
else{
this.eventService.getAllPrOficialEvents(start, end).subscribe(res => {
this.officialeventsList = res.filter(data => data.CalendarName == "Oficial");;
this.showLoader = false;
});
}
break;
} */
}
showGreeting(){
if(this.today.getHours() >= 6 && this.today.getHours() < 12){
this.greetting = this.grettings[0];
}
else if(this.today.getHours() >= 12 && this.today.getHours() < 18){
this.greetting = this.grettings[1];
}
else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */{
this.greetting = this.grettings[2];
}
}
gotTo(){
this.router.navigate(['/home/events']);
}
changeProfile(){
if(this.profile == "mdgpr"){
console.log('pr');
this.profile ="pr";
this.RefreshEvents();
}
else{
console.log('mdgpr');
this.profile ="mdgpr";
this.RefreshEvents();
}
}
logout()
{
this.authService.ValidatedUser.BasicAuthKey = "";
this.router.navigate(['/home/login']);
}
async openEventDetail1(id:any){
console.log(id);
const modal = await this.modalController.create({
component: EventDetailPage,
componentProps: {
eventId: id,
},
cssClass: 'event-detail',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
LoadList() {
this.processes.GetTaskListExpediente(false).subscribe(result => {
console.log("Expediente", result);
const ExpedienteTask = result.map( e=> this.expedienteTaskPipe.transform(e))
this.expedienteGdStore.reset(ExpedienteTask)
});
}
sortArrayISODate(myArray: any){
return myArray.sort(function(a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
});
}
goToEvent(eventId:any){
this.router.navigate(['/home/events', eventId, 'events']);
}
goToExpediente(SerialNumber:any) {
if(this.loggeduser.Profile == 'MDGPR'){
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
}
else if(this.loggeduser.Profile == 'PR'){
this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']);
}
}
viewExpedientListPage(){
if(this.loggeduser.Profile == 'MDGPR'){
if( window.innerWidth < 801){
this.router.navigate(['/home/gabinete-digital/expediente']);
}
else{
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,} };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
else if(this.loggeduser.Profile == 'PR'){
if( window.innerWidth < 801){
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
}
else{
let navigationExtras: NavigationExtras = { queryParams: {"expedientes-pr": true,} };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { SortService } from './sort.service';
describe('SortService', () => {
let service: SortService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(SortService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class SortService {
constructor() { }
sortArrayISODate(myArray: any) {
return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
});
}
sortArrayByDate(myArray: any) {
console.log(myArray[0].taskStartDate);
return myArray.sort(function (a, b) {
return (new Date(a.workflowInstanceDataFields.StartDate) < new Date(b.workflowInstanceDataFields.StartDate)) ? -1 : ((new Date(a.workflowInstanceDataFields.StartDate) > new Date(b.workflowInstanceDataFields.StartDate)) ? 1 : 0);
});
}
}
+12 -83
View File
@@ -13,8 +13,10 @@ import { NavigationExtras,Router } from '@angular/router';
import { ToastService } from '../services/toast.service'; import { ToastService } from '../services/toast.service';
import { JsonStore } from './jsonStore.service'; import { JsonStore } from './jsonStore.service';
import { synchro } from './socket/synchro.service'; import { synchro } from './socket/synchro.service';
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid';
import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@@ -41,7 +43,8 @@ export class NotificationsService {
private toastService: ToastService, private toastService: ToastService,
private zone: NgZone, private zone: NgZone,
private activeroute: ActivatedRoute, private activeroute: ActivatedRoute,
private jsonstore: JsonStore) { private jsonstore: JsonStore,
private eventtrigger: EventTrigger) {
this.storageService.get("Notifications").then((value) => { this.storageService.get("Notifications").then((value) => {
@@ -83,7 +86,7 @@ export class NotificationsService {
getAndpostToken(username) { getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported') //console.log('Notifications not supported')
} else { } else {
const geturl = environment.apiURL + 'notifications/token'; const geturl = environment.apiURL + 'notifications/token';
@@ -102,11 +105,11 @@ export class NotificationsService {
} }
); );
window['MFPPush'].registerDevice(null, (successResponse) => { window['MFPPush'].registerDevice(null, async (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse)); console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId) console.log('token: ', successResponse.deviceId)
this.storageService.store(username, successResponse.deviceId); await this.storageService.store(username, successResponse.deviceId);
this.storageService.get(username).then(value => { await this.storageService.get(username).then(value => {
console.log('STORAGE TOKEN', value) console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => { this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res); console.log('USERID', res);
@@ -136,87 +139,10 @@ export class NotificationsService {
} }
} }
} }
} }
getAndpostToken2() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token';
if(window['WLAuthorizationManager']) {
if(window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
window['MFPPush'].initialize(
function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
},
function (failureResponse) {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
window['MFPPush'].registerDevice(null, (successResponse) => {
console.log("Successfully registered: " + JSON.stringify(successResponse));
console.log('token: ', successResponse.deviceId)
/* this.storageService.store(username, successResponse.deviceId);
this.storageService.get(username).then(value => {
console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res);
const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
const body = {
UserId: res.UserId,
TokenId: successResponse.deviceId,
Status: 1,
Service: 1
};
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
console.log('TOKEN USER MIDLE', data);
})
});
}); */
},
function (failureResponse) {
console.log("Successfully failue: " + JSON.stringify(failureResponse));
}
);
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
)
} else {
console.log('not called')
}
} else {
console.log('not called')
}
}
}
removeDepartment(index): void {
/* this.DataArray[this.DataArray.findIndex(item => item.index == index)];
this.DataArray.splice( this.DataArray.findIndex(item => item.indexOf(index.to) === 'William'),1); */
const indexx = this.DataArray.indexOf(index, 0);
if (indexx > -1) {
this.DataArray.splice(index, 1);
console.log('This notificatio', this.DataArray);
}
}
tempClearArray(){ tempClearArray(){
this.DataArray = []; this.DataArray = [];
} }
@@ -245,6 +171,9 @@ export class NotificationsService {
this.storageService.store("Notifications",this.DataArray) this.storageService.store("Notifications",this.DataArray)
console.log(message); console.log(message);
this.eventtrigger.publishSomeData({
notification: "recive"
})
var data = JSON.parse(message.payload); var data = JSON.parse(message.payload);
synchro.$send(data) synchro.$send(data)
+11 -6
View File
@@ -3,6 +3,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { BackgroundService } from '../background.service'; import { BackgroundService } from '../background.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { EventTrigger } from '../eventTrigger.service'
export interface wss { export interface wss {
@@ -28,6 +29,7 @@ class SynchroService {
private url: string = '' private url: string = ''
callback = function () { } callback = function () { }
private _connected = false; private _connected = false;
private eventtrigger: EventTrigger;
private BackgroundService = new BackgroundService() private BackgroundService = new BackgroundService()
callBacks: { callBacks: {
type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notification' | 'Notifications' | '', type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notification' | 'Notifications' | '',
@@ -83,18 +85,18 @@ class SynchroService {
if(!this.conected) { //if (this._connected === true) {
this.BackgroundService.online() this.BackgroundService.online()
console.log('Online', this._connected)
this.callBacks.forEach((e) => { this.callBacks.forEach((e) => {
if (e.type == 'Online') { if (e.type == 'Online') {
e.funx() e.funx()
} }
}) })
//}
}
console.log('open ======================= welcome to socket server') console.log('open ======================= welcome to socket server')
this._connected = true this._connected = true
// send all saved data due to internet connection // send all saved data due to internet connection
@@ -168,6 +170,7 @@ class SynchroService {
} }
private onclose = (event: any) => { private onclose = (event: any) => {
console.log('Websocket close')
setTimeout(() => { setTimeout(() => {
if (event.wasClean) { if (event.wasClean) {
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`); console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
@@ -179,14 +182,16 @@ class SynchroService {
if(this._connected) { // if (this._connected === false) {
this.BackgroundService.offline(); this.BackgroundService.offline();
console.log('Offline', this._connected)
this.callBacks.forEach((e) => { this.callBacks.forEach((e) => {
if (e.type == 'Offline') { if (e.type == 'Offline') {
e.funx() e.funx()
} }
}) })
} //}
// status // status
this._connected = false this._connected = false
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { SqliteService } from './sqlite.service';
describe('SqliteService', () => {
let service: SqliteService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(SqliteService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+491
View File
@@ -0,0 +1,491 @@
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';
@Injectable({
providedIn: 'root'
})
export class SqliteService {
private dbInstance: SQLiteObject;
readonly db_name: string = "gabinetedigital.db";
readonly events: string = "Events";
readonly expedientes: string = "Expedientes";
readonly allprocess: string = "ALLPROCESS";
readonly actions: string = "ACTIONS";
readonly publications: string = "PUBLICATIONS";
EVENTS: Array<any>;
EXPEDIENTES: Array<any>;
ALLPROCESS: Array<any>;
PROCESS: Array<any>;
ALLACTIONS: Array<any>;
constructor(private platform: Platform,
private sqlite: SQLite) {
this.databaseConn();
}
databaseConn() {
this.platform.ready().then(async () => {
await this.sqlite.create({
name: this.db_name,
location: 'default'
}).then(async (sqLite: SQLiteObject) => {
this.dbInstance = sqLite;
await sqLite.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.events} (
EventId varchar(255) PRIMARY KEY,
Subject varchar(255),
HasAttachments BIT,
Location varchar(255),
CalendarId varchar(255),
CalendarName varchar(255),
StartDate varchar(255),
EndDate varchar(255),
EventType varchar(255),
Attendees Text,
IsMeeting BIT,
IsRecurring BIT,
IsAllDayEvent BIT,
AppointmentState INTERGER,
TimeZone varchar(255),
Organizer Text,
Category varchar(255),
EventRecurrence Text,
Attachments Text,
Body Text,
Profile varchar(255),
HumanDate varchar(255)
)`, [])
.then((res) => {
console.log("Sucess Events Table created: ", res)
})
.catch((error) => console.log(JSON.stringify(error)));
await sqLite.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.expedientes} (
serialNumber varchar(255) PRIMARY KEY,
workflowInstanceFolio varchar(255),
Documents Text,
actions Text,
activityInstanceName varchar(255),
formURL varchar(255),
originator Text,
taskStartDate varchar(255),
totalDocuments INTERGER,
workflowDisplayName varchar(255),
workflowID INTERGER,
workflowInstanceDataFields Text,
workflowInstanceID INTERGER,
workflowName varchar(255)
)`, [])
.then((res) => {
console.log("Sucess Espedientes Table created: ", res)
})
.catch((error) => console.log(JSON.stringify(error)));
await sqLite.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.allprocess} (
serialNumber varchar(255) PRIMARY KEY,
workflowInstanceFolio varchar(255),
Documents Text,
actions Text,
activityInstanceName varchar(255),
formURL varchar(255),
originator Text,
taskStartDate varchar(255),
totalDocuments INTERGER,
workflowDisplayName varchar(255),
workflowID INTERGER,
workflowInstanceDataFields Text,
workflowInstanceID INTERGER,
workflowName varchar(255),
interveners Text
)`, [])
.then((res) => {
console.log("Sucess AllProcess Table created: ", res)
})
.catch((error) => console.log(JSON.stringify(error)));
await sqLite.executeSql(`
CREATE TABLE IF NOT EXISTS ${this.actions} (
ProcessId INTERGER PRIMARY KEY,
ActionType varchar(255),
DateBegin varchar(255),
DateEnd varchar(255),
Detail varchar(255),
Description varchar(255),
publications Text
)`, [])
.then((res) => {
console.log("Sucess action Table created: ", res)
})
.catch((error) => console.log(JSON.stringify(error)));
})
.catch((error) => console.log(JSON.stringify(error)));
});
}
//addactions
public addactions(data) {
console.log('Action insert', data)
this.dbInstance.executeSql(`
INSERT OR IGNORE INTO ${this.actions} (ActionType,DateBegin,DateEnd,Description,Detail,ProcessId,publications)
VALUES ('${data.ActionType}','${data.DateBegin}', '${data.DateEnd}','${data.Description}','${data.Detail}','${data.ProcessId}','${data.publications}')`, [])
.then(() => {
console.log("action add with Success");
}, (e) => {
console.log(JSON.stringify(e.err));
});
}
//addEvent
public addEvent(data) {
this.dbInstance.executeSql(`
INSERT OR IGNORE INTO ${this.events} (EventId,Subject,HasAttachments,Location,CalendarId,CalendarName,StartDate,EndDate,EventType,Attendees,IsMeeting,IsRecurring,IsAllDayEvent,AppointmentState,TimeZone,Organizer,Category,EventRecurrence,Attachments,Body,Profile,HumanDate )
VALUES ('${data.EventId}','${data.Subject}','${data.HasAttachments}','${data.Location}','${data.CalendarId}','${data.CalendarName}','${data.StartDate}','${data.EndDate}','${data.EventType}','${data.Attendees}','${data.IsMeeting}','${data.IsRecurring}',
'${data.IsAllDayEvent}','${data.AppointmentState}','${data.TimeZone}','${data.Organizer}','${data.Category}','${data.EventRecurrence}','${data.Attachments}','${data.Body}','${data.Profile}','${data.HumanDate}')`, [])
.then(() => {
console.log("event add with Success");
}, (e) => {
console.log(JSON.stringify(e));
});
}
//addExpediente
public addExpediente(data) {
this.dbInstance.executeSql(`
INSERT OR REPLACE INTO ${this.expedientes} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${data.Documents}','${data.actions}','${data.activityInstanceName}','${data.formURL}','${data.originator}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
'${data.workflowInstanceDataFields}','${data.workflowInstanceID}','${data.workflowName}')`, [])
.then(() => {
console.log("expediente add with Success");
}, (e) => {
console.log(JSON.stringify(e.err));
});
}
//addprocess
public addProcess(data) {
this.dbInstance.executeSql(`
INSERT OR IGNORE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
'${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
.then(() => {
console.log("process add with Success");
}, (e) => {
console.log(JSON.stringify(e.err));
});
}
//updateActions
public updateactions(id,data) {
console.log("update action data", data )
this.dbInstance.executeSql(`
UPDATE ${this.actions} SET publications = ? WHERE ProcessId = ${id}`,[data])
.then(() => {
console.log("action update with Success");
}, (e) => {
console.log(JSON.stringify(e.err));
});
}
//updateprocess
public updateProcess(data) {
this.dbInstance.executeSql(`
INSERT OR REPLACE INTO ${this.allprocess} (serialNumber,workflowInstanceFolio,Documents,actions,activityInstanceName,formURL,originator,taskStartDate,totalDocuments,workflowDisplayName,workflowID,workflowInstanceDataFields,workflowInstanceID,workflowName)
VALUES ('${data.serialNumber}','${data.workflowInstanceFolio}', '${JSON.stringify(data.Documents)}','${JSON.stringify(data.actions)}','${data.activityInstanceName}','${data.formURL}','${JSON.stringify(data.originator)}','${data.taskStartDate}','${data.totalDocuments}','${data.workflowDisplayName}','${data.workflowID}',
'${JSON.stringify(data.workflowInstanceDataFields)}','${data.workflowInstanceID}','${data.workflowName}')`, [])
.then(() => {
console.log("process add with Success");
}, (e) => {
console.log(JSON.stringify(e.err));
});
}
//updateAttachment
updateUser(id, document,) {
let data = [document];
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET Documents = ? WHERE serialNumber = ${id}`, [document]).then(() => {
console.log("process attachment updated")
})
}
//updateAttachment
updateProcessInterveners(id, interveners,) {
let data = [document];
return this.dbInstance.executeSql(`UPDATE ${this.allprocess} SET interveners = ? WHERE serialNumber = ${id}`, [interveners]).then(() => {
console.log("process interveners updated")
})
}
//getAllEvents
getAllEvents() {
var hashattachment = false;
var ismeeting = false;
var isrecurring = false;
var isallday = false;
return this.dbInstance.executeSql(`SELECT * FROM ${this.events}`, []).then((res) => {
this.EVENTS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
if (res.rows.item(i).HasAttachments === "true") {
hashattachment = true
}
if (res.rows.item(i).IsMeeting === "true") {
ismeeting = true
}
if (res.rows.item(i).IsRecurring === "true") {
isrecurring = true
}
if (res.rows.item(i).IsAllDayEvent === "true") {
isallday = true
}
let event = {
EventId: res.rows.item(i).EventId,
HasAttachments: hashattachment,
Subject: res.rows.item(i).Subject,
Location: res.rows.item(i).Location,
CalendarId: res.rows.item(i).CalendarId,
CalendarName: res.rows.item(i).CalendarName,
StartDate: res.rows.item(i).StartDate,
EndDate: res.rows.item(i).EndDate,
EventType: res.rows.item(i).EventType,
Attendees: res.rows.item(i).Attendees,
IsMeeting: ismeeting,
IsRecurring: isrecurring,
IsAllDayEvent: isallday,
AppointmentState: res.rows.item(i).AppointmentState,
TimeZone: res.rows.item(i).TimeZone,
Organizer: res.rows.item(i).Organizer,
Category: res.rows.item(i).Category,
EventRecurrence: res.rows.item(i).EventRecurrence,
Attachments: res.rows.item(i).Attachments,
Profile: res.rows.item(i).Profile,
HumanDate: res.rows.item(i).HumanDate
}
this.EVENTS.push(event);
}
return this.EVENTS;
}
}, (e) => {
console.log(" Get all events error", JSON.stringify(e));
});
}
getAllExpedientes() {
return this.dbInstance.executeSql(`SELECT * FROM ${this.expedientes}`, []).then((res) => {
this.EXPEDIENTES = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.EXPEDIENTES.push(res.rows.item(i));
}
return this.EXPEDIENTES;
}
}, (e) => {
console.log(" Get all expedientes error", JSON.stringify(e));
});
}
getAllProcess() {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess}`, []).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
//getAllAtions
getAllActions() {
return this.dbInstance.executeSql(`SELECT * FROM ${this.actions}`, []).then((res) => {
this.ALLACTIONS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLACTIONS.push(res.rows.item(i));
}
return this.ALLACTIONS;
}
}, (e) => {
console.log(" Get all actions error", JSON.stringify(e));
});
}
//getlistOfEventAprove
getListOfEventAprove(process, type) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, type]).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
//getDespachosProcess
getDespachosProcess(process) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE activityInstanceName = ?`, [process]).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
//getprocessByworkflow
getprocessByworkflow(process) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? `, [process]).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
//getprocessByworkflowpedido
getprocessByworkflowpedido(process, process2) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE workflowDisplayName = ? OR workflowDisplayName = ? `, [process, process2]).then((res) => {
this.ALLPROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLPROCESS.push(res.rows.item(i));
}
return this.ALLPROCESS;
}
}, (e) => {
console.log(" Get all process error", JSON.stringify(e));
});
}
getProcessById(serial) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.allprocess} WHERE serialNumber = ? `, [serial]).then((res) => {
this.PROCESS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.PROCESS.push(res.rows.item(i))
}
return this.PROCESS;
}
}, (e) => {
console.log(" Get process by serial error", JSON.stringify(e));
});
}
//getActionById
getActionById(id) {
return this.dbInstance.executeSql(`SELECT * FROM ${this.actions} WHERE ProcessId = ? `, [id]).then((res) => {
this.ALLACTIONS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
this.ALLACTIONS.push(res.rows.item(i))
}
return this.ALLACTIONS;
}
}, (e) => {
console.log(" Get actions by processId error", JSON.stringify(e));
});
}
//getEventBy id
getEventById(id) {
var hashattachment = false;
var ismeeting = false;
var isrecurring = false;
var isallday = false;
var body;
var attendes;
var organizer;
var eventrecurrence;
var attachment;
return this.dbInstance.executeSql(`SELECT * FROM ${this.events} WHERE EventId = ? `, [id]).then((res) => {
this.EVENTS = [];
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
if (res.rows.item(i).HasAttachments === "true") {
hashattachment = true
}
if (res.rows.item(i).IsMeeting === "true") {
ismeeting = true
}
if (res.rows.item(i).IsRecurring === "true") {
isrecurring = true
}
if (res.rows.item(i).IsAllDayEvent === "true") {
isallday = true
}
/* if (res.rows.item(i).Body != "") {
body = JSON.parse(res.rows.item(i).Body);
}
if (res.rows.item(i).Attendees !="") {
attendes = JSON.parse(res.rows.item(i).Attendees);
}
if(res.rows.item(i).Organizer !=""){
organizer = JSON.parse(res.rows.item(i).Organizer);
}
if(res.row.item(i).EventRecurrence != ""){
eventrecurrence = JSON.parse(res.row.item(i).EventRecurrence);
}
if(res.row.item(i).Attachments != ""){
attachment = JSON.parse(res.row.item(i).Attachments);
}
*/
let event = {
EventId: res.rows.item(i).EventId,
HasAttachments: hashattachment,
Subject: res.rows.item(i).Subject,
Location: res.rows.item(i).Location,
CalendarId: res.rows.item(i).CalendarId,
CalendarName: res.rows.item(i).CalendarName,
StartDate: res.rows.item(i).StartDate,
EndDate: res.rows.item(i).EndDate,
EventType: res.rows.item(i).EventType,
Attendees: res.rows.item(i).Attendees,
IsMeeting: ismeeting,
IsRecurring: isrecurring,
IsAllDayEvent: isallday,
Body: res.rows.item(i).Body,
AppointmentState: res.rows.item(i).AppointmentState,
TimeZone: res.rows.item(i).TimeZone,
Organizer: res.rows.item(i).Organizer,
Category: res.rows.item(i).Category,
EventRecurrence: res.rows.item(i).EventRecurrence,
Attachments: res.rows.item(i).Attachments
}
this.EVENTS.push(event);
}
return this.EVENTS;
}
}, (e) => {
console.log(" Get events by id error", JSON.stringify(e));
});
}
}
+25 -1
View File
@@ -31,13 +31,27 @@ export class WebNotificationsService {
webconnection() { webconnection() {
var inicializeObj = {
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
/* serverUrl: "http://gpr-dev-10.gabinetedigital.local:9080",
safariWebsitePushId: "http://gpr-dev-10.gabinetedigital.local:9080", */
}
MFPPush.initialize({
appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp",
});
/* MFPPush.initialize({ /* MFPPush.initialize({
appId: "com.gpr.gabinetedigital", appId: "com.gpr.gabinetedigital",
mfpContextRoot: "/mfp", mfpContextRoot: "/mfp",
}); */ }); */
MFPPush.registerDevice() /* MFPPush.registerDevice()
.then((res) => { .then((res) => {
console.log("WEB Successfully Registered Device..."); console.log("WEB Successfully Registered Device...");
@@ -52,6 +66,16 @@ export class WebNotificationsService {
}, 1000) }, 1000)
})
.catch((err) => {
console.log("WEB Registration Failed" + err);
}); */
}
register(){
MFPPush.registerDevice()
.then((res) => {
console.log("WEB Successfully Registered Device...", res);
}) })
.catch((err) => { .catch((err) => {
console.log("WEB Registration Failed" + err); console.log("WEB Registration Failed" + err);
@@ -21,7 +21,7 @@
<ion-icon src="assets/images/icons-arrow-arrow-left.svg"></ion-icon> <ion-icon src="assets/images/icons-arrow-arrow-left.svg"></ion-icon>
</div> </div>
<div class="header-title flex-grow-1 cursor-pointer"> <div class="header-title flex-grow-1 cursor-pointer">
<label>{{loadedEvent.workflowInstanceDataFields.Subject}} </label> <label>{{loadedEvent.workflowInstanceDataFields.Subject}} 11</label>
</div> </div>
<div (click)="editar(loadedEvent.serialNumber)" class="header-icon-right display-none-{{showAside}}"> <div (click)="editar(loadedEvent.serialNumber)" class="header-icon-right display-none-{{showAside}}">
@@ -89,15 +89,15 @@
</div> </div>
</div> </div>
<div *ngIf="loadedAttachments" class="bottom-content width-100"> <div *ngIf="loadedEvent.Documents" class="bottom-content width-100">
<ion-list> <ion-list>
<h5>Documentos Anexados </h5> <h5>Documentos Anexados </h5>
<ion-item class="ion-no-margin ion-no-padding" <ion-item class="ion-no-margin ion-no-padding"
*ngFor="let attach of loadedAttachments" *ngFor="let attachment of loadedEvent.Documents"
(click)="viewDocument(attach.SourceId)"> (click)="viewDocument(attachment.DocId, attachment)">
<ion-label> <ion-label>
<p class="attach-title-item d-block">{{attach.SourceName}}</p> <p class="attach-title-item d-block">{{attachment.Assunto}}</p>
<p><span class="span-left">{{attach.Stakeholders}}</span><span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p> <p><span class="span-left">{{attachment.Sender}}</span><span class="span-right">{{ attachment.DocDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
@@ -9,6 +9,7 @@ import { EmendMessageModalPage } from 'src/app/pages/agenda/emend-message-modal/
import { EventActionsPopoverPage } from 'src/app/pages/agenda/event-actions-popover/event-actions-popover.page'; import { EventActionsPopoverPage } from 'src/app/pages/agenda/event-actions-popover/event-actions-popover.page';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@Component({ @Component({
selector: 'app-approve-event', selector: 'app-approve-event',
@@ -62,7 +63,7 @@ export class ApproveEventPage implements OnInit {
this.getAttachments(); this.getAttachments();
} }
ngOnChanges() { /* ngOnChanges() {
this.getTask(); this.getTask();
this.getAttachments(); this.getAttachments();
@@ -76,7 +77,7 @@ export class ApproveEventPage implements OnInit {
this.getAttachments(); this.getAttachments();
}, 10000) }, 10000)
} } */
notImplemented() { notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento'); this.alertService.presentAlert('Funcionalidade em desenvolvimento');
@@ -90,7 +91,7 @@ export class ApproveEventPage implements OnInit {
getTask() { getTask() {
this.processes.GetTask(this.serialNumber).subscribe(res => { this.processes.GetTask(this.serialNumber).subscribe(res => {
// console.log(res); console.log(res);
this.loadedEvent = res; this.loadedEvent = res;
this.today = new Date(res.workflowInstanceDataFields.StartDate); this.today = new Date(res.workflowInstanceDataFields.StartDate);
// console.log(new Date(this.today)); // console.log(new Date(this.today));
@@ -150,14 +151,27 @@ export class ApproveEventPage implements OnInit {
} }
viewDocument(sourceId) { async viewDocument(DocId:string, Document) {
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
/* console.log(res); */
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
trustedUrl: '',
file: {
title: Document.Assunto,
url: '',
title_link: '',
},
Document,
applicationId: Document.ApplicationId,
docId: Document.DocId || Document.SourceId,
folderId: this.loadedEvent.FolderId,
task: this.loadedEvent
},
cssClass: 'modal modal-desktop'
}); });
await modal.present();
} }
async openOptions(ev:any) { async openOptions(ev:any) {

Some files were not shown because too many files have changed in this diff Show More