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"
}
]
} }
+7377 -12815
View File
File diff suppressed because it is too large Load Diff
+16 -11
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",
@@ -193,4 +198,4 @@
"url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git" "url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git"
}, },
"license": "ISC" "license": "ISC"
} }
+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]
+33 -18
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()
@@ -85,7 +93,7 @@ export class HomePage implements OnInit {
window['platform'] = platform window['platform'] = platform
window['inactivity/function'] = () => { window['inactivity/function'] = () => {
if(window.location.pathname != '/inactivity') { if (window.location.pathname != '/inactivity') {
const pathname = window.location.pathname const pathname = window.location.pathname
SessionStore.setUrlBeforeInactivity(pathname) SessionStore.setUrlBeforeInactivity(pathname)
@@ -100,27 +108,31 @@ export class HomePage implements OnInit {
this.router.navigate([url]) this.router.navigate([url])
} }
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();
} }
this.updateList() this.updateList()
var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url) ); var myWorker = new Worker(new URL('./nice.worker.js', import.meta.url));
myWorker.onmessage = function(oEvent) { myWorker.onmessage = function (oEvent) {
console.log('Worker said : ' + oEvent.data); console.log('Worker said : ' + oEvent.data);
} }
@@ -129,8 +141,10 @@ export class HomePage implements OnInit {
mobilefirstConnect() { mobilefirstConnect() {
if(window['WLAuthorizationManager']) { console.log("Mobileconecct");
if(window['WLAuthorizationManager'].obtainAccessToken) {
if (window['WLAuthorizationManager']) {
if (window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("").then((token) => { window['WLAuthorizationManager'].obtainAccessToken("").then((token) => {
console.log('MobileFirst Server connect: Success ' + token); console.log('MobileFirst Server connect: Success ' + token);
@@ -167,12 +181,13 @@ export class HomePage implements OnInit {
this.notificationsService.registerCallback( this.notificationsService.registerCallback(
'despachos', 'despachos',
() => { () => {
this.despachoRule.getList({updateStore: true}) this.despachoRule.getList({ updateStore: true })
} }
) )
synchro.registerCallback('Online',()=>{ synchro.registerCallback('Online', () => {
console.log('Onlineee')
}) })
@@ -183,18 +198,18 @@ export class HomePage implements OnInit {
synchro.conected synchro.conected
synchro.registerCallback('Notification', (DataArray)=> { synchro.registerCallback('Notification', (DataArray) => {
this.webNotificationPopupService.sendNotification(DataArray) this.webNotificationPopupService.sendNotification(DataArray)
this.storageService.get('Notifications').then((data:any)=>{ this.storageService.get('Notifications').then((data:any)=>{
data.push(DataArray) data.push(DataArray)
this.storageService.store("Notifications", data) this.storageService.store("Notifications", data)
}).catch(()=>{ }).catch(() => {
const a = [] const a = []
a.push(DataArray) a.push(DataArray)
this.storageService.store("Notifications",a) this.storageService.store("Notifications", a)
}) })
}, 'any') }, 'any')
@@ -13,15 +13,15 @@
<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>
</div> </div>
<!-- Add scrolls --> <!-- Add scrolls -->
<div class="d-flex flex-column height-100 overflow-y-auto"> <div class="d-flex flex-column height-100 overflow-y-auto">
<div class="container-div width-100"> <div class="container-div width-100">
<div class="ion-item-class-2 width-100"> <div class="ion-item-class-2 width-100">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -29,11 +29,11 @@
</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" >
<ion-select <ion-select
placeholder="Prazo*" placeholder="Prazo*"
[(ngModel)]="postData.Priority" [(ngModel)]="postData.Priority"
interface="action-sheet" interface="action-sheet"
Cancel-text="Cancelar" Cancel-text="Cancelar"
required required
class="d-block d-md-none" class="d-block d-md-none"
> >
@@ -62,19 +62,19 @@
<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" [class.input-error]="Form?.get('selectedTypes')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('selectedTypes')?.invalid && validateFrom ">
<!-- <ion-item <!-- <ion-item
class="ion-no-border ion-no-padding ion-no-margin d-block d-md-none"> class="ion-no-border ion-no-padding ion-no-margin d-block d-md-none">
<ion-select <ion-select
[(ngModel)]="selectedTypes" [(ngModel)]="selectedTypes"
(ngModelChange)="onSelectedTypesChanged($event)" (ngModelChange)="onSelectedTypesChanged($event)"
multiple="true" interface="alert" Cancel-text="Cancelar" required> multiple="true" interface="alert" Cancel-text="Cancelar" required>
<ion-select-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</ion-select-option> <ion-select-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</ion-select-option>
</ion-select> </ion-select>
</ion-item> --> </ion-item> -->
<mat-form-field <mat-form-field
floatLabel="never" floatLabel="never"
appearance="fill" appearance="fill"
class="width-100 d-block" class="width-100 d-block"
appearance="none"> appearance="none">
<mat-select [(ngModel)]="selectedTypes" multiple placeholder="Selecione o tipo de evento*"> <mat-select [(ngModel)]="selectedTypes" multiple placeholder="Selecione o tipo de evento*">
@@ -135,21 +135,21 @@
</div> </div>
<div class="attach-document pl-10"> <div class="attach-document pl-10">
<ion-label>Anexar Documentos</ion-label> <ion-label>Anexar Documentos</ion-label>
</div> </div>
</ion-label> </ion-label>
</div> </div>
<div class="list " *ngFor="let document of documents; let i = index" > <div class="list " *ngFor="let document of documents; let i = index" >
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-label> <ion-label>
<p class="d-flex ion-justify-content-between"> <p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Assunto}}</span> <span class="attach-title-item">{{document.Assunto}}</span>
<span class="app-name">{{document.appName}}</span> <span class="app-name">{{document.appName}}</span>
<span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" > <span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </p>
<p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yyyy HH:mm'}} </span></p> <p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yyyy HH:mm'}} </span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
@@ -158,11 +158,11 @@
</div> </div>
</div> </div>
<div *ngIf="postData" class="aside-right flex-column height-100"> <div *ngIf="postData" class="aside-right flex-column height-100">
<app-empty-container <app-empty-container
[texto]="emptyTextDescription" [texto]="emptyTextDescription"
*ngIf="!showAttendees" *ngIf="!showAttendees"
class="d-flex height-100 flex-column"> class="d-flex height-100 flex-column">
</app-empty-container> </app-empty-container>
<app-attendee-modal <app-attendee-modal
@@ -187,4 +187,4 @@
<button class="btn-cancel" shape="round" (click)="cancelTask()">Cancelar</button> <button class="btn-cancel" shape="round" (click)="cancelTask()">Cancelar</button>
<button class="btn-ok" shape="round" (click)="saveTask()">Gravar</button> <button class="btn-ok" shape="round" (click)="saveTask()">Gravar</button>
</div> </div>
</ion-footer> </ion-footer>
@@ -2,7 +2,7 @@
padding: 30px 20px 0 20px !important; padding: 30px 20px 0 20px !important;
margin: 0; margin: 0;
float: left; float: left;
.title{ .title{
font-family: Roboto; font-family: Roboto;
font-size: 25px; font-size: 25px;
@@ -61,7 +61,7 @@
.list-people{ .list-people{
width: 256px; width: 256px;
float: left; float: left;
} }
.add-people{ .add-people{
width: 45px; width: 45px;
@@ -78,7 +78,7 @@
font-size: 15px; font-size: 15px;
color: #0d89d1; color: #0d89d1;
} }
.attach-title-item{ .attach-title-item{
width: 100%; width: 100%;
font-size: 15px; font-size: 15px;
@@ -127,7 +127,7 @@
} }
} }
.close-button { .close-button {
@@ -140,13 +140,13 @@
.app-name { .app-name {
display: none; display: none;
} }
.close-button { .close-button {
display: block !important; display: block !important;
} }
} }
.app-name{ .app-name{
background: #42b9f2; background: #42b9f2;
border-radius: 18px; border-radius: 18px;
@@ -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,18 +367,24 @@ export class CreateProcessPage implements OnInit {
} }
console.log('this.postData', this.postData, this.taskType); console.log('this.postData', this.postData, this.taskType);
try { if(this.postData.DispatchFolder.Message){
await this.despachoService.createDespacho(this.postData).toPromise(); try {
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise(); await this.despachoService.createDespacho(this.postData).toPromise();
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber}).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService.successMessage('Despacho criado'); this.toastService.successMessage('Despacho criado');
} 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>
@@ -41,7 +41,9 @@ export class ViewDocumentPage implements OnInit {
if(!this.file.title) { if(!this.file.title) {
this.file.title = 'Sem Título' this.file.title = 'Sem Título'
} }
console.log(this.task)
} }
ngOnInit() { ngOnInit() {
@@ -72,13 +74,17 @@ export class ViewDocumentPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then((res)=>{ modal.onDidDismiss().then((res)=>{
if(res.data.component == 'openBookMeetingModal') {
this.openBookMeetingModal() if(res.data) {
} else if(res.data.component == 'openExpedientActionsModal') { if(res.data.component == 'openBookMeetingModal') {
this.openExpedientActionsModal(res.data.taskAction) this.openBookMeetingModal()
} else { } else if(res.data.component == 'openExpedientActionsModal') {
console.log('component not found') this.openExpedientActionsModal(res.data.taskAction)
} else {
console.log('component not found')
}
} }
}) })
} }
@@ -106,7 +112,7 @@ export class ViewDocumentPage implements OnInit {
} }
// efetuar despacho // efetuar despacho
async openExpedientActionsModal( taskAction: any) { async openExpedientActionsModal( taskAction: any) {
let classs; let classs;
+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)"
File diff suppressed because it is too large Load Diff
@@ -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,9 +100,23 @@ export class ViewEventPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
if(synchro.connected === true) {
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.loadEvent(); /* 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) => {
// if not mobile remove all component // if not mobile remove all component
@@ -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">
+189 -93
View File
@@ -12,10 +12,13 @@ import { EventDetailPage } from './event-detail/event-detail.page';
import { ProcessesService } from '../../services/processes.service'; import { ProcessesService } from '../../services/processes.service';
import { DailyWorkTask } from '../../models/dailyworktask.model'; import { DailyWorkTask } from '../../models/dailyworktask.model';
import { LoginUserRespose } from 'src/app/models/user.model'; import { LoginUserRespose } from 'src/app/models/user.model';
import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service'; 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',
@@ -29,16 +32,16 @@ export class EventsPage implements OnInit {
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; 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()]); customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
/* Setting appropriate greeting according to the time */ /* Setting appropriate greeting according to the time */
grettings = ["Bom dia", "Boa tarde", "Boa noite"]; grettings = ["Bom dia", "Boa tarde", "Boa noite"];
greetting=''; greetting = '';
timeDate = this.today.getHours() + ":" + this.today.getMinutes(); timeDate = this.today.getHours() + ":" + this.today.getMinutes();
/* Set segment variable */ /* Set segment variable */
segment:string; segment: string;
public profile:string; public profile: string;
currentEvent: any; currentEvent: any;
eventsList: Event[]; eventsList: Event[];
@@ -52,81 +55,97 @@ export class EventsPage implements OnInit {
combinedEvents: Event[]; combinedEvents: Event[];
customText = false; customText = false;
totalEvent=0; totalEvent = 0;
currentHoursMinutes: Date | string; currentHoursMinutes: Date | string;
showLoader: boolean; showLoader: boolean;
taskslist:DailyWorkTask[] = []; taskslist: DailyWorkTask[] = [];
expedientList:any; expedientList: any;
hideSearchBtn: boolean=false; hideSearchBtn: boolean = false;
// shared data // shared data
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()
@Output() openExpedientListPage:EventEmitter<any> = new EventEmitter<any>(); @Output() openExpedientListPage: EventEmitter<any> = new EventEmitter<any>();
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
existingScreenOrientation: string; existingScreenOrientation: string;
synch = synchro
constructor( constructor(
private eventService: EventsService, private eventService: EventsService,
private router: Router, private router: Router,
private storageService:StorageService, private storageService: StorageService,
public activatedRoute: ActivatedRoute, public activatedRoute: ActivatedRoute,
private alertController: AlertService, private alertController: AlertService,
private authService: AuthService, private authService: AuthService,
private processes:ProcessesService, private processes: ProcessesService,
/* private gabineteService: GabineteDigitalPage, */ /* private gabineteService: GabineteDigitalPage, */
private modalController:ModalController, private modalController: ModalController,
private screenOrientation: ScreenOrientation, private screenOrientation: ScreenOrientation,
public platform: Platform, public platform: Platform,
) { private sqliteservice: SqliteService,
this.existingScreenOrientation = this.screenOrientation.type; private backgroundservice: BackgroundService
console.log(this.existingScreenOrientation); ) {
this.existingScreenOrientation = this.screenOrientation.type;
console.log(this.existingScreenOrientation);
this.loggeduser = authService.ValidatedUser; this.loggeduser = authService.ValidatedUser;
this.prEventList = null; this.prEventList = null;
this.platform.resize.subscribe(async () => { this.platform.resize.subscribe(async () => {
//console.log('Resize event detected'); //console.log('Resize event detected');
// console.log('Resize event detected'); // console.log('Resize event detected');
}); });
} /* 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() {
this.segment = "Combinada"; this.segment = "Combinada";
this.profile = "mdgpr"; this.profile = "mdgpr";
this.showGreeting(); if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.showGreeting();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == '/home/events') { if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents(); this.RefreshEvents();
setTimeout(()=>{ setTimeout(() => {
this.LoadList(); this.LoadList();
}, 1500) }, 1500)
} }
}); });
this.hideSearch(); this.hideSearch();
}
this.getEventsFromLocalDb();
//this.checkScreenOrientation(); //this.checkScreenOrientation();
} }
hideSearch(){ hideSearch() {
if(this.router.url == '/home/events'){ if (this.router.url == '/home/events') {
this.hideSearchBtn = true; this.hideSearchBtn = true;
} }
} }
@@ -142,28 +161,28 @@ export class EventsPage implements OnInit {
} }
// Lock to portrait // Lock to portrait
lockToPortrait(){ lockToPortrait() {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT); this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT);
console.log('set'); console.log('set');
} }
// Lock to landscape // Lock to landscape
lockToLandscape(){ lockToLandscape() {
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE); this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.LANDSCAPE);
} }
// Unlock screen orientation // Unlock screen orientation
unlockScreenOrientation(){ unlockScreenOrientation() {
this.screenOrientation.unlock(); this.screenOrientation.unlock();
} }
checkScreenOrientation(){ checkScreenOrientation() {
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.lockToPortrait(); this.lockToPortrait();
console.log('was here'); console.log('was here');
} }
else{ else {
this.unlockScreenOrientation(); this.unlockScreenOrientation();
} }
} }
@@ -174,43 +193,60 @@ export class EventsPage implements OnInit {
let date = new Date(); let date = new Date();
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
let start = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds(); 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"; let end = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " 23:59:59";
if(this.loggeduser.Profile == 'MDGPR') { if (this.loggeduser.Profile == 'MDGPR') {
let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise(); let mdOficialEvents = await this.eventService.getAllMdOficialEvents(start, end).toPromise();
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;
} }
else if (this.loggeduser.Profile == 'PR') { else if (this.loggeduser.Profile == 'PR') {
let prOficialEvents= await this.eventService.getAllPrOficialEvents(start, end).toPromise(); let prOficialEvents = await this.eventService.getAllPrOficialEvents(start, end).toPromise();
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,47 +322,97 @@ export class EventsPage implements OnInit {
} */ } */
} }
showGreeting(){ getEventsFromLocalDb() {
if(this.today.getHours() >= 6 && this.today.getHours() < 12){
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() {
if (this.today.getHours() >= 6 && this.today.getHours() < 12) {
this.greetting = this.grettings[0]; this.greetting = this.grettings[0];
} }
else if(this.today.getHours() >= 12 && this.today.getHours() < 18){ else if (this.today.getHours() >= 12 && this.today.getHours() < 18) {
this.greetting = this.grettings[1]; this.greetting = this.grettings[1];
} }
else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */{ else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */ {
this.greetting = this.grettings[2]; this.greetting = this.grettings[2];
} }
} }
gotTo(){ gotTo() {
this.router.navigate(['/home/events']); this.router.navigate(['/home/events']);
} }
changeProfile(){ changeProfile() {
if(this.profile == "mdgpr"){ if (this.profile == "mdgpr") {
console.log('pr'); console.log('pr');
this.profile ="pr"; this.profile = "pr";
this.RefreshEvents(); this.RefreshEvents();
} }
else{ else {
console.log('mdgpr'); console.log('mdgpr');
this.profile ="mdgpr"; this.profile = "mdgpr";
this.RefreshEvents(); this.RefreshEvents();
} }
} }
logout() logout() {
{
this.authService.ValidatedUser.BasicAuthKey = ""; this.authService.ValidatedUser.BasicAuthKey = "";
this.router.navigate(['/home/login']); this.router.navigate(['/home/login']);
} }
async openEventDetail1(id:any){ async openEventDetail1(id: any) {
console.log(id); console.log(id);
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: EventDetailPage, component: EventDetailPage,
componentProps: { componentProps: {
eventId: id, eventId: id,
}, },
cssClass: 'event-detail', cssClass: 'event-detail',
@@ -340,53 +426,63 @@ 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;
}); });
} }
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);
}); });
} }
goToEvent(eventId:any){ goToEvent(eventId: any) {
this.router.navigate(['/home/events', eventId, 'events']); this.router.navigate(['/home/events', eventId, 'events']);
} }
goToExpediente(SerialNumber:any) { goToExpediente(SerialNumber: any) {
if(this.loggeduser.Profile == 'MDGPR'){ if (this.loggeduser.Profile == 'MDGPR') {
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']); this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
} }
else if(this.loggeduser.Profile == 'PR'){ else if (this.loggeduser.Profile == 'PR') {
this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']); this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']);
} }
} }
viewExpedientListPage(){ viewExpedientListPage() {
if(this.loggeduser.Profile == 'MDGPR'){ if (this.loggeduser.Profile == 'MDGPR') {
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expediente']); this.router.navigate(['/home/gabinete-digital/expediente']);
} }
else{ else {
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,} }; let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
} }
} }
else if(this.loggeduser.Profile == 'PR'){ else if (this.loggeduser.Profile == 'PR') {
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expedientes-pr']); this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
} }
else{ else {
let navigationExtras: NavigationExtras = { queryParams: {"expedientes-pr": true,} }; let navigationExtras: NavigationExtras = { queryParams: { "expedientes-pr": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
} }
} }
} }
} }
@@ -8,7 +8,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Event } from '../../../../models/event.model'; import { Event } from '../../../../models/event.model';
import { MenuController, ModalController, PopoverController } from '@ionic/angular'; import { MenuController, ModalController, PopoverController } from '@ionic/angular';
import { momentG } from 'src/plugin/momentG' import { momentG } from 'src/plugin/momentG'
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page';
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page'; import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
@@ -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',
@@ -29,7 +32,7 @@ export class DespachoPrPage implements OnInit {
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate:any; customDate: any;
task: any; task: any;
fulltask: any; fulltask: any;
@@ -52,34 +55,25 @@ 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 => { ) {
if(params["params"].SerialNumber) { this.activatedRoute.paramMap.subscribe(params => {
this.serialNumber = params["params"].SerialNumber; if (params["params"].SerialNumber) {
} this.serialNumber = params["params"].SerialNumber;
if(params["params"].caller) { }
this.caller = params["params"].caller; if (params["params"].caller) {
} this.caller = params["params"].caller;
}); }
});
console.log('DespachoPrPage SerialNumber', this.serialNumber) console.log('DespachoPrPage SerialNumber', this.serialNumber)
} }
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() {
@@ -92,12 +86,12 @@ export class DespachoPrPage implements OnInit {
async LoadTaskDetail(serial: string) { async LoadTaskDetail(serial: string) {
this.processes.GetTask(serial).subscribe((res:fullTask) => { this.processes.GetTask(serial).subscribe((res: fullTask) => {
this.task = { this.task = {
"SerialNumber": res.serialNumber, "SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject, "Folio": res.workflowInstanceDataFields.Subject,
"Senders": res.originator.email, "Senders": res.originator.email,
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'), "CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest, "DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
"Remetente": res.workflowInstanceDataFields.Sender, "Remetente": res.workflowInstanceDataFields.Sender,
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note, "Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
@@ -114,32 +108,36 @@ 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.intervenientes = users.filter(user=>{ this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
console.log('internen despacho pr ')
})
this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
this.cc = users.filter(user=>{ this.cc = users.filter(user => {
return user.Type == 'CC'; return user.Type == 'CC';
}) || [] }) || []
if(!this.cc) { if(!this.cc) {
this.cc = [] this.cc = []
} }
}); });
}, (error)=>{ }, (error) => {
try { try {
this.goBack() this.goBack()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} finally { } finally {
if(error.status == 0) { if (error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline') this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
} else { } else {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
@@ -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,12 +225,13 @@ 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'
}); });
await modal.present(); await modal.present();
} }
openMenu() { openMenu() {
@@ -175,7 +239,7 @@ export class DespachoPrPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
async executado(note:string, documents:any) { async executado(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Conhecimento", "action": "Conhecimento",
@@ -183,7 +247,7 @@ export class DespachoPrPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -192,7 +256,7 @@ export class DespachoPrPage implements OnInit {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally { finally {
@@ -201,7 +265,7 @@ export class DespachoPrPage implements OnInit {
} }
async arquivar(note:string, documents:any){ async arquivar(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Arquivo", "action": "Arquivo",
@@ -209,7 +273,7 @@ export class DespachoPrPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -228,7 +292,7 @@ export class DespachoPrPage implements OnInit {
} }
async generateDiploma(note:string, documents:any){ async generateDiploma(note: string, documents: any) {
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -250,7 +314,7 @@ export class DespachoPrPage implements OnInit {
} }
async concluir(note:string, documents:any){ async concluir(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Executado", "action": "Executado",
@@ -258,7 +322,7 @@ export class DespachoPrPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -277,7 +341,7 @@ export class DespachoPrPage implements OnInit {
} }
async reexecutar(note:string, documents:any) { async reexecutar(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Reexecutar", "action": "Reexecutar",
@@ -285,7 +349,7 @@ export class DespachoPrPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -307,27 +371,27 @@ export class DespachoPrPage implements OnInit {
return new Date(e).toDateString() return new Date(e).toDateString()
} }
sendExpedienteToPending(){ sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.popoverController.dismiss('close') this.popoverController.dismiss('close')
this.toastService.successMessage('Processo enviado para pendentes') this.toastService.successMessage('Processo enviado para pendentes')
this.goBack() this.goBack()
},()=>{ }, () => {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
}); });
} }
async openAddNoteModal(actionName:string) { async openAddNoteModal(actionName: string) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'add-note-modal-no-height' classs = 'add-note-modal-no-height'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AddNotePage, component: AddNotePage,
componentProps:{ componentProps: {
showAttachmentBtn: true, showAttachmentBtn: true,
}, },
cssClass: classs, cssClass: classs,
@@ -336,9 +400,9 @@ export class DespachoPrPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res) => { modal.onDidDismiss().then(async (res) => {
console.log(res); console.log(res);
if(res.data) { if (res.data) {
const DocumentToSave = res.data.documents.map((e) => { const DocumentToSave = res.data.documents.map((e) => {
return { return {
@@ -352,19 +416,19 @@ export class DespachoPrPage implements OnInit {
Attachments: DocumentToSave, Attachments: DocumentToSave,
} }
if(actionName == 'Executado'){ if (actionName == 'Executado') {
await this.executado(res.data.note, docs); await this.executado(res.data.note, docs);
} }
else if(actionName == 'Arquivar'){ else if (actionName == 'Arquivar') {
await this.arquivar(res.data.note, docs); await this.arquivar(res.data.note, docs);
} }
else if(actionName == 'Gerar Diploma'){ else if (actionName == 'Gerar Diploma') {
await this.generateDiploma(res.data.note, docs); await this.generateDiploma(res.data.note, docs);
} }
else if(actionName == 'Concluido'){ else if (actionName == 'Concluido') {
await this.concluir(res.data.note, docs); await this.concluir(res.data.note, docs);
} }
else if(actionName == 'Reexecução'){ else if (actionName == 'Reexecução') {
await this.reexecutar(res.data.note, docs); await this.reexecutar(res.data.note, docs);
} }
this.goBack(); this.goBack();
@@ -375,9 +439,9 @@ export class DespachoPrPage implements OnInit {
async openExpedientActionsModal(taskAction: any, task: any) { async openExpedientActionsModal(taskAction: any, task: any) {
//this.modalController.dismiss(); //this.modalController.dismiss();
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -391,9 +455,9 @@ export class DespachoPrPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
console.log(res['data']); console.log(res['data']);
if(res['data']=='openDiscart'){ if (res['data'] == 'openDiscart') {
console.log('open discart'); console.log('open discart');
this.distartExpedientModal(); this.distartExpedientModal();
} }
@@ -403,10 +467,10 @@ export class DespachoPrPage implements OnInit {
}); });
} }
async distartExpedientModal2(task: any){ async distartExpedientModal2(task: any) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
serialNumber: task.serialNumber, serialNumber: task.serialNumber,
folderId: task.workflowInstanceDataFields.FolderID, folderId: task.workflowInstanceDataFields.FolderID,
action: 'discart', action: 'discart',
@@ -421,9 +485,9 @@ export class DespachoPrPage implements OnInit {
async openBookMeetingModal(task: any) { async openBookMeetingModal(task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -440,9 +504,9 @@ export class DespachoPrPage implements OnInit {
async openDelegarModal(task: any) { async openDelegarModal(task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -457,11 +521,11 @@ export class DespachoPrPage implements OnInit {
modal.onDidDismiss(); modal.onDidDismiss();
} }
async distartExpedientModal(){ async distartExpedientModal() {
console.log(this.fulltask); console.log(this.fulltask);
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
serialNumber: this.fulltask.serialNumber, serialNumber: this.fulltask.serialNumber,
folderId: this.fulltask.workflowInstanceDataFields.FolderID, folderId: this.fulltask.workflowInstanceDataFields.FolderID,
action: 'complete', action: 'complete',
@@ -471,8 +535,8 @@ export class DespachoPrPage implements OnInit {
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
if(res['data']=='close'){ if (res['data'] == 'close') {
this.close(); this.close();
/* console.log('2Expedient Discard closed2'); /* console.log('2Expedient Discard closed2');
this.close(); this.close();
@@ -488,7 +552,7 @@ export class DespachoPrPage implements OnInit {
componentProps: { componentProps: {
task: this.task, task: this.task,
fulltask: this.fulltask, fulltask: this.fulltask,
taskAction:taskAction, taskAction: taskAction,
showEnviarPendentes: false showEnviarPendentes: false
}, },
translucent: true translucent: true
@@ -496,11 +560,11 @@ export class DespachoPrPage implements OnInit {
await popover.present(); await popover.present();
popover.onDidDismiss().then(( res =>{ popover.onDidDismiss().then((res => {
if (res['data'] == 'close') {
this.goBack()
if( res['data'] == 'close') {
this.goBack()
} }
})) }))
@@ -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()">
@@ -32,8 +34,8 @@
<div > <div >
<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]" -->
@@ -66,14 +68,14 @@
</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',
@@ -26,61 +30,49 @@ export class DespachosPrPage implements OnInit {
@ViewChild(CalendarComponent) myCal: CalendarComponent; @ViewChild(CalendarComponent) myCal: CalendarComponent;
taskslist:DailyWorkTask[] = []; taskslist: DailyWorkTask[] = [];
despachoList:any[] = []; despachoList: any[] = [];
deferimentoList:DailyWorkTask[] = []; deferimentoList: DailyWorkTask[] = [];
taskList: customTask[] = []; taskList: customTask[] = [];
taskType: string; taskType: string;
serialNumber:string; serialNumber: string;
totalDocs:any; totalDocs: any;
profile:string; profile: string;
segment:string; segment: string;
// @Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>(); // @Output() openExpedientDetail:EventEmitter<any> = new EventEmitter<any>();
loadedAttachments:any; loadedAttachments: any;
dicIndex = 0; dicIndex = 0;
inicial = false inicial = false
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
skeletonLoader = true skeletonLoader = true
despachoprstore = DespachosprStore despachoprstore = DespachosprStore
listToPresent = [];
constructor ( constructor(
private processes:ProcessesService, private processes: ProcessesService,
private modalController: ModalController, private modalController: ModalController,
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;
this.profile = 'mdgpr'; this.profile = 'mdgpr';
} }
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) {
@@ -88,15 +80,15 @@ export class DespachosPrPage implements OnInit {
this.LoadList(); this.LoadList();
} }
goToDespachoPr(serialNumber:any){ goToDespachoPr(serialNumber: any) {
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/despachos-pr', serialNumber, 'gabinete-digital']);
} }
notImplemented(){ notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento'); this.alertService.presentAlert('Funcionalidade em desenvolvimento');
} }
openExpedientDetailPage(data){ openExpedientDetailPage(data) {
console.log(data); console.log(data);
} }
@@ -110,73 +102,130 @@ 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;
} }
console.log(despachosPr); console.log(despachosPr);
despachosPr = despachosPr.filter(data => data.workflowInstanceDataFields.Status == "Active"); despachosPr = despachosPr.filter(data => data.workflowInstanceDataFields.Status == "Active");
despachosPr.forEach( (element, index) => { despachosPr.forEach((element, index) => {
let date = new Date(element.taskStartDate); let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds(); let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = { let task = {
"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,
"DocumentURL": element.workflowInstanceDataFields.ViewerRequest, "DocumentURL": element.workflowInstanceDataFields.ViewerRequest,
"Remetente": element.workflowInstanceDataFields.Remetente, "Remetente": element.workflowInstanceDataFields.Remetente,
"DocumentsQty": element.totalDocuments, "DocumentsQty": element.totalDocuments,
"DocId": element.workflowInstanceDataFields.DocIdDiferimento, "DocId": element.workflowInstanceDataFields.DocIdDiferimento,
"WorkflowName": element.workflowDisplayName, "WorkflowName": element.workflowDisplayName,
"activityInstanceName": element.activityInstanceName, "activityInstanceName": element.activityInstanceName,
} }
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() {
setTimeout(()=>{ setTimeout(() => {
this.LoadList(); this.LoadList();
}, 1000) }, 1000)
} }
async viewExpedientDetail(serialNumber:any) { async viewExpedientDetail(serialNumber: any) {
console.log(this.profile); console.log(this.profile);
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DespachoPage, component: DespachoPage,
componentProps:{ componentProps: {
enterAnimation: "", enterAnimation: "",
serialNumber: serialNumber, serialNumber: serialNumber,
profile: this.profile, profile: this.profile,
@@ -184,7 +233,7 @@ export class DespachosPrPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then((res)=>{ modal.onDidDismiss().then((res) => {
console.log('refresh list'); console.log('refresh list');
this.LoadList(); this.LoadList();
}); });
@@ -193,7 +242,7 @@ export class DespachosPrPage implements OnInit {
async openBookMeetingModal(task: customFullTask) { async openBookMeetingModal(task: customFullTask) {
const doc = this.loadedAttachments[ this.dicIndex]; const doc = this.loadedAttachments[this.dicIndex];
task = { task = {
serialNumber: doc.SourceId, serialNumber: doc.SourceId,
@@ -208,9 +257,9 @@ export class DespachosPrPage implements OnInit {
} }
let classs; let classs;
if( window.innerWidth <= 800) { if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -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>
@@ -4,7 +4,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Event } from '../../../../models/event.model'; import { Event } from '../../../../models/event.model';
import { MenuController, ModalController, PopoverController } from '@ionic/angular'; import { MenuController, ModalController, PopoverController } from '@ionic/angular';
import { momentG } from 'src/plugin/momentG' import { momentG } from 'src/plugin/momentG'
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page';
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page'; import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
@@ -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',
@@ -28,20 +32,22 @@ export class DespachoPage implements OnInit {
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate:any; customDate: any;
// task: customTask; // task: customTask;
task; task;
attachments:any; attachments: any;
fulltask: any; fulltask: any;
eventsList: Event[] = []; eventsList: Event[] = [];
serialnumber: string; serialnumber: string;
caller:string; caller: string;
profile: string; profile: string;
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,13 +58,17 @@ 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;
} }
if(params["params"].caller) { if (params["params"].caller) {
this.caller = params["params"].caller; this.caller = params["params"].caller;
} }
}); });
@@ -71,8 +81,8 @@ export class DespachoPage implements OnInit {
return; return;
} }
}); });
this.getFromDb()
this.LoadTaskDetail(this.serialnumber)
} }
close() { close() {
@@ -112,13 +122,13 @@ 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,
"Senders": res.originator.email, "Senders": res.originator.email,
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'), "CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest, "DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
"Remetente": res.workflowInstanceDataFields.Sender, "Remetente": res.workflowInstanceDataFields.Sender,
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note, "Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
@@ -131,27 +141,33 @@ 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';
}); });
}); });
}, (error)=>{ }, (error) => {
try { try {
this.goBack() this.goBack()
} catch (e) { } catch (e) {
this.location.back(); this.location.back();
} finally { } finally {
if(error.status == 0) { if (error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline') this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
} else { } else {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
@@ -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: {
@@ -188,7 +281,7 @@ export class DespachoPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
async executado(note:string, documents:any) { async executado(note: string, documents: any) {
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -196,7 +289,7 @@ export class DespachoPage implements OnInit {
await this.despachoService.executado(note, documents, this.serialnumber).toPromise(); await this.despachoService.executado(note, documents, this.serialnumber).toPromise();
this.toastService.successMessage('Processo criado') this.toastService.successMessage('Processo criado')
this.close(); this.close();
} catch(error) { } catch (error) {
this.toastService.badRequest("Processo não criado") this.toastService.badRequest("Processo não criado")
} }
finally { finally {
@@ -204,12 +297,12 @@ export class DespachoPage implements OnInit {
} }
} }
async arquivar(note:string, documents: AttachmentList) { async arquivar(note: string, documents: AttachmentList) {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.despachoService.arquivar(note, documents,this.serialnumber).toPromise() await this.despachoService.arquivar(note, documents, this.serialnumber).toPromise()
this.toastService.successMessage('Processo descartado') this.toastService.successMessage('Processo descartado')
this.close(); this.close();
} catch (error) { } catch (error) {
@@ -221,7 +314,7 @@ export class DespachoPage implements OnInit {
} }
async reexecute(note:string, documents:any) { async reexecute(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialnumber,
"action": "Reexecução", "action": "Reexecução",
@@ -229,7 +322,7 @@ export class DespachoPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -254,26 +347,26 @@ export class DespachoPage implements OnInit {
async sendExpedienteToPending() { async sendExpedienteToPending() {
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res=>{ this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => {
this.goBack(); this.goBack();
this.toastService.successMessage() this.toastService.successMessage()
}, },
error => { error => {
this.toastService.badRequest("Processo não enviado para despacho") this.toastService.badRequest("Processo não enviado para despacho")
}); });
} }
async openAddNoteModal(actionName:string) { async openAddNoteModal(actionName: string) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'add-note-modal-no-height' classs = 'add-note-modal-no-height'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AddNotePage, component: AddNotePage,
componentProps:{ componentProps: {
showAttachmentBtn: true, showAttachmentBtn: true,
}, },
cssClass: classs, cssClass: classs,
@@ -282,8 +375,8 @@ export class DespachoPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res) => { modal.onDidDismiss().then(async (res) => {
if(res.data){ if (res.data) {
const DocumentToSave = res.data.documents.map((e) => { const DocumentToSave = res.data.documents.map((e) => {
return { return {
@@ -297,16 +390,16 @@ export class DespachoPage implements OnInit {
Attachments: DocumentToSave, Attachments: DocumentToSave,
} }
if(actionName == 'Executado'){ if (actionName == 'Executado') {
await this.executado(res.data.note, docs); await this.executado(res.data.note, docs);
this.goBack(); this.goBack();
} }
else if(actionName == 'Arquivar'){ else if (actionName == 'Arquivar') {
await this.arquivar(res.data.note, docs); await this.arquivar(res.data.note, docs);
this.goBack(); this.goBack();
} }
else if(actionName == 'Reexecução'){ else if (actionName == 'Reexecução') {
await this.reexecute(res.data.note, docs); await this.reexecute(res.data.note, docs);
this.goBack(); this.goBack();
} }
@@ -317,9 +410,9 @@ export class DespachoPage implements OnInit {
async openExpedientActionsModal(taskAction: any, task: any) { async openExpedientActionsModal(taskAction: any, task: any) {
let classs; let classs;
if( window.innerWidth <= 800) { if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -333,10 +426,10 @@ export class DespachoPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then(async (res) => {
console.log(res['data']); console.log(res['data']);
if(res['data']=='openDiscart'){ if (res['data'] == 'openDiscart') {
await this.distartExpedientModal(); await this.distartExpedientModal();
} }
@@ -346,9 +439,9 @@ export class DespachoPage implements OnInit {
async openBookMeetingModal(task: any) { async openBookMeetingModal(task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -365,9 +458,9 @@ export class DespachoPage implements OnInit {
async openDelegarModal(task: any) { async openDelegarModal(task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -379,7 +472,7 @@ export class DespachoPage implements OnInit {
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
this.goBack(); this.goBack();
}); });
} }
@@ -388,7 +481,7 @@ export class DespachoPage implements OnInit {
console.log(this.fulltask); console.log(this.fulltask);
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
serialNumber: this.fulltask.serialNumber, serialNumber: this.fulltask.serialNumber,
folderId: this.fulltask.workflowInstanceDataFields.FolderID, folderId: this.fulltask.workflowInstanceDataFields.FolderID,
action: 'complete', action: 'complete',
@@ -398,8 +491,8 @@ export class DespachoPage implements OnInit {
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
if(res['data']=='close'){ if (res['data'] == 'close') {
this.close(); this.close();
/* console.log('2Expedient Discard closed2'); /* console.log('2Expedient Discard closed2');
this.close(); this.close();
@@ -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 {
@@ -64,9 +114,8 @@ export class DespachosPage implements OnInit {
}, 2000); }, 2000);
} }
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,12 +149,13 @@ 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'
}); });
await modal.present(); await modal.present();
} }
getDocumentDetails(forlderId:string, applicationId:string) { getDocumentDetails(forlderId:string, applicationId:string) {
@@ -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,
) { ) {
} }
@@ -39,7 +41,7 @@ export class DiplomasAssinarPage implements OnInit {
const pathname = location.pathname + location.search const pathname = location.pathname + location.search
this.LoadList() this.LoadList()
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url.startsWith(pathname)) { if (event instanceof NavigationEnd && event.url.startsWith(pathname)) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) { if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
@@ -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,12 +234,13 @@ 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'
}); });
await modal.present(); await modal.present();
} }
getDocumentDetails(forlderId:string, applicationId:string) { getDocumentDetails(forlderId:string, applicationId:string) {
@@ -3,34 +3,40 @@ 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',
styleUrls: ['./diplomas.page.scss'], styleUrls: ['./diplomas.page.scss'],
}) })
export class DiplomasPage implements OnInit, OnDestroy { export class DiplomasPage implements OnInit, OnDestroy {
list:DailyWorkTask[] = []; list: DailyWorkTask[] = [];
diplomasList:DailyWorkTask[] = []; diplomasList: DailyWorkTask[] = [];
diplomasAssinadoList:DailyWorkTask[] = []; diplomasAssinadoList: DailyWorkTask[] = [];
showLoader: boolean; showLoader: boolean;
totalDocs:any; totalDocs: any;
serialNumber:string; serialNumber: string;
segment:string; segment: string;
skeletonLoader = true skeletonLoader = true
constructor( constructor(
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
this.segment = 'validar'; this.segment = 'validar';
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params['validar'] == 'true') { if (params['validar'] == 'true') {
this.segment = 'validar'; this.segment = 'validar';
} else if (params['assinados'] == 'true') { } else if (params['assinados'] == 'true') {
this.segment = 'assinados'; this.segment = 'assinados';
@@ -43,27 +49,14 @@ export class DiplomasPage implements OnInit, OnDestroy {
//this.segment = 'validar'; //this.segment = 'validar';
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params['segment'] == 'validar') { if (params['segment'] == 'validar') {
this.segment = 'validar'; this.segment = 'validar';
} else if (params['segment'] == 'assinados') { } else if (params['segment'] == 'assinados') {
this.segment = 'assinados'; this.segment = 'assinados';
} }
}); });
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()
}
}
});
} }
@@ -141,7 +134,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
}); });
} */ } */
async getTotalDocs(DocId:any) { async getTotalDocs(DocId: any) {
let res = await this.processes.GetDocumentDetails(DocId, '361').toPromise(); let res = await this.processes.GetDocumentDetails(DocId, '361').toPromise();
console.log(res.DocumentsTotal); console.log(res.DocumentsTotal);
return res.DocumentsTotal; return res.DocumentsTotal;
@@ -155,7 +148,7 @@ export class DiplomasPage implements OnInit, OnDestroy {
this.LoadList(); this.LoadList();
} }
goToDiploma(serialNumber:any) { goToDiploma(serialNumber: any) {
this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
} }
@@ -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,20 +181,63 @@ 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);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds(); let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
return { return {
"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,12 +248,28 @@ 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(() => {
this.LoadList(); this.LoadList();
@@ -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',
@@ -19,10 +24,10 @@ import { Location } from '@angular/common';
}) })
export class ApproveEventPage implements OnInit { export class ApproveEventPage implements OnInit {
event: Event; event: Event;
loadedEvent:any = false loadedEvent: any = false
loadedAttachments:any; loadedAttachments: any;
customDate:any; customDate: any;
today:any; today: any;
show: boolean = false; show: boolean = false;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
@@ -30,17 +35,21 @@ 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,
private modalController: ModalController, private modalController: ModalController,
private processes:ProcessesService, private processes: ProcessesService,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private popoverController: PopoverController, private popoverController: PopoverController,
private menu: MenuController, private menu: MenuController,
@@ -49,14 +58,16 @@ 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"]);
if(params["params"].serialNumber) { if (params["params"].serialNumber) {
this.serialNumber = params["params"].serialNumber; this.serialNumber = params["params"].serialNumber;
} }
if(params["params"].caller){ if (params["params"].caller) {
this.caller = params["params"].caller; this.caller = params["params"].caller;
} }
}); });
@@ -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,12 +187,9 @@ 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) {
let body = { "serialNumber": serialNumber, "action": "Aprovar" } let body = { "serialNumber": serialNumber, "action": "Aprovar" }
console.log(body); console.log(body);
@@ -131,12 +219,12 @@ export class ApproveEventPage implements OnInit {
}); */ }); */
} }
async emendTask(serialNumber:string){ async emendTask(serialNumber: string) {
console.log('Desktop'); console.log('Desktop');
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: EmendMessageModalPage, component: EmendMessageModalPage,
componentProps:{ componentProps: {
}, },
cssClass: 'emend-message-modal', cssClass: 'emend-message-modal',
backdropDismiss: false backdropDismiss: false
@@ -145,41 +233,42 @@ export class ApproveEventPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss() modal.onDidDismiss()
.then( async (res) => { .then(async (res) => {
console.log(res.data); console.log(res.data);
if(res.data !== ''){ if (res.data !== '') {
let body = { "serialNumber": serialNumber, let body = {
"action": "Emendar", "serialNumber": serialNumber,
"action": "Emendar",
"dataFields": { "dataFields": {
"ReviewUserComment": res.data, "ReviewUserComment": res.data,
}
} }
console.log(body);
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
this.goBack();
} catch (error) {
this.toastService.badRequest();
} finally {
loader.remove()
}
} }
console.log(body); else {
//this.alertService.presentAlert('Operação cancelada!');
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService.successMessage('Pedido enviado');
this.goBack();
} catch (error) {
this.toastService.badRequest();
} finally {
loader.remove()
} }
});
}
else{
//this.alertService.presentAlert('Operação cancelada!');
}
});
//this.openEmendMessageModal(serialNumber); //this.openEmendMessageModal(serialNumber);
//this.goBack(); //this.goBack();
} }
async rejeitar(serialNumber:string){ async rejeitar(serialNumber: string) {
let body = { "serialNumber": serialNumber, "action": "Rejeitar" } let body = { "serialNumber": serialNumber, "action": "Rejeitar" }
console.log(body); console.log(body);
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -195,34 +284,36 @@ 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) {
const popover = await this.popoverController.create({ const popover = await this.popoverController.create({
component: EventActionsPopoverPage, component: EventActionsPopoverPage,
cssClass: 'events-options', cssClass: 'events-options',
event: ev, event: ev,
translucent: true, translucent: true,
componentProps:{ componentProps: {
serialNumber: ev.serialNumber, serialNumber: ev.serialNumber,
InstanceId: ev.workflowInstanceDataFields.InstanceId, InstanceId: ev.workflowInstanceDataFields.InstanceId,
}, },
@@ -233,10 +324,10 @@ export class ApproveEventPage implements OnInit {
openMenu() { openMenu() {
this.menu.open(); this.menu.open();
} }
async openEmendMessageModal(serialNumber:string) { async openEmendMessageModal(serialNumber: string) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: EmendMessageModalPage, component: EmendMessageModalPage,
componentProps:{ componentProps: {
}, },
cssClass: 'emend-message-modal', cssClass: 'emend-message-modal',
backdropDismiss: false backdropDismiss: false
@@ -244,13 +335,14 @@ export class ApproveEventPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res) => { modal.onDidDismiss().then(async (res) => {
console.log(res.data); console.log(res.data);
if(res.data !== ''){ if (res.data !== '') {
let body = { "serialNumber": serialNumber, let body = {
"action": "Emendar", "serialNumber": serialNumber,
"dataFields": { "action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data, "ReviewUserComment": res.data,
} }
} }
@@ -264,18 +356,18 @@ export class ApproveEventPage implements OnInit {
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest(); this.toastService.badRequest();
} finally { } finally {
loader.remove() loader.remove()
} }
} }
else{ else {
//this.alertService.presentAlert('Operação cancelada!'); //this.alertService.presentAlert('Operação cancelada!');
} }
}); });
} }
goToEventsToApprove(){ goToEventsToApprove() {
let navigationExtras: NavigationExtras = { let navigationExtras: NavigationExtras = {
queryParams: { queryParams: {
"eventos": true, "eventos": true,
@@ -290,7 +382,7 @@ export class ApproveEventPage implements OnInit {
component: EditEventToApproveComponent, component: EditEventToApproveComponent,
componentProps: { componentProps: {
serialNumber: serialNumber, serialNumber: serialNumber,
InstanceId:this.InstanceId InstanceId: this.InstanceId
}, },
cssClass: 'modal modal-desktop', cssClass: 'modal modal-desktop',
// backdropDismiss: false // backdropDismiss: false
@@ -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,32 +34,23 @@ 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();
const location = window.location
const pathname = location.pathname + location.search
this.LoadToApproveEvents()
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.LoadToApproveEvents()
}
}
});
window.onresize = (event) => { window.onresize = (event) => {
// if not mobile remove all component // if not mobile remove all component
@@ -65,6 +61,42 @@ export class EventListPage implements OnInit {
} }
getEventToAproveFromDB() {
if( synchro.connected === true) {
const location = window.location
const pathname = location.pathname + location.search
this.LoadToApproveEvents()
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.LoadToApproveEvents()
}
}
});
}
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) {
this.LoadToApproveEvents(); this.LoadToApproveEvents();
} }
@@ -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;
@@ -133,7 +134,7 @@ export class ExpedientTaskModalPage implements OnInit {
SubjectTypes: this.selectedTypes, SubjectTypes: this.selectedTypes,
NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber, NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber,
}; };
this.postData.DispatchFolder = this.dispatchFolder; this.postData.DispatchFolder = this.dispatchFolder;
this.postData.UsersSelected = this.participants; this.postData.UsersSelected = this.participants;
/* By Default TypeDeadline should be 'Normal' */ /* By Default TypeDeadline should be 'Normal' */
@@ -187,7 +188,7 @@ export class ExpedientTaskModalPage implements OnInit {
} }
runValidation() { runValidation() {
this.validateFrom = true this.validateFrom = true;
} }
injectValidation() { injectValidation() {
@@ -277,7 +278,7 @@ export class ExpedientTaskModalPage implements OnInit {
}) })
}); });
} else { // 8 } else { // 8
docs.Attachments.push({ docs.Attachments.push({
ApplicationId: 8, ApplicationId: 8,
@@ -429,17 +430,23 @@ export class ExpedientTaskModalPage implements OnInit {
} }
} }
try { if(this.postData.DispatchFolder.Message){
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise(); try {
await this.toastService.successMessage('Processo efetuado'); this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
this.modalController.dismiss(action_despacho_pr); await this.toastService.successMessage('Processo efetuado');
} catch (error) { this.modalController.dismiss(action_despacho_pr);
await this.toastService.badRequest('Processo não efetuado') } catch (error) {
} finally {
loader.remove()
}
console.log('this.taskResult', this.taskResult); await this.toastService.badRequest('Processo não efetuado')
} finally {
//loader.remove()
}
}
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);
@@ -471,8 +477,9 @@ export class ExpedientTaskModalPage implements OnInit {
await this.toastService.badRequest('Processo não efetuado') await this.toastService.badRequest('Processo não efetuado')
} finally { } finally {
loader.remove() loader.remove()
} }
break; break;
} }
break; break;
@@ -9,7 +9,7 @@ import { ModalController, PopoverController } from '@ionic/angular';
import { ExpedientTaskModalPage } from '../expedient-task-modal/expedient-task-modal.page'; import { ExpedientTaskModalPage } from '../expedient-task-modal/expedient-task-modal.page';
import { BookMeetingModalPage } from '../book-meeting-modal/book-meeting-modal.page'; import { BookMeetingModalPage } from '../book-meeting-modal/book-meeting-modal.page';
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page'; import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
import { momentG } from 'src/plugin/momentG' import { momentG } from 'src/plugin/momentG'
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page'; import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
@@ -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',
@@ -36,22 +40,25 @@ export class ExpedienteDetailPage implements OnInit {
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate:any; customDate: any;
task: expedienteTask; task: expedienteTask;
fulltask: any; fulltask: any;
eventsList: Event[]; eventsList: Event[];
serialNumber: string; serialNumber: string;
caller:string; caller: string;
profile: string; profile: string;
intervenientes: any; intervenientes: any;
cc: any = []; cc: any = [];
documents:SearchList[] = []; documents: SearchList[] = [];
attachments:any; attachments: any;
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,20 +73,22 @@ 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) {
this.serialNumber = params["params"].SerialNumber; this.serialNumber = params["params"].SerialNumber;
} }
if(params["params"].caller) { if (params["params"].caller) {
this.caller = params["params"].caller; this.caller = params["params"].caller;
} }
}); });
} }
ngOnInit() { ngOnInit() {
this.LoadTaskDetail(this.serialNumber); this.getFromDB();
} }
@@ -91,16 +100,60 @@ 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() {
async approve(note:string, documents:any) { 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) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Aprovar", "action": "Aprovar",
"ActionTypeId": 100000004 , "ActionTypeId": 100000004,
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
console.log(body); console.log(body);
@@ -111,15 +164,15 @@ export class ExpedienteDetailPage implements OnInit {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.close(); this.close();
this.toastService.successMessage('Processo aprovado') this.toastService.successMessage('Processo aprovado')
} catch(error) { } catch (error) {
this.toastService.badRequest('Processo não aprovado') this.toastService.badRequest('Processo não aprovado')
} finally { } finally {
loader.remove() loader.remove()
} }
} }
async sendToReview(note:string, documents:any) { async sendToReview(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Retificar", "action": "Retificar",
@@ -127,7 +180,7 @@ export class ExpedienteDetailPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -136,7 +189,7 @@ export class ExpedienteDetailPage implements OnInit {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService.successMessage() this.toastService.successMessage()
} catch(error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally { } finally {
loader.remove() loader.remove()
@@ -144,16 +197,16 @@ export class ExpedienteDetailPage implements OnInit {
} }
async openAddNoteModal(actionName:string) { async openAddNoteModal(actionName: string) {
let classs; let classs;
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'add-note-modal' classs = 'add-note-modal'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AddNotePage, component: AddNotePage,
componentProps:{ componentProps: {
showAttachmentBtn: false, showAttachmentBtn: false,
}, },
cssClass: classs, cssClass: classs,
@@ -164,7 +217,7 @@ export class ExpedienteDetailPage implements OnInit {
modal.onDidDismiss().then(res => { modal.onDidDismiss().then(res => {
console.log(res); console.log(res);
if(res.data){ if (res.data) {
const DocumentToSave = res.data.documents.map((e) => { const DocumentToSave = res.data.documents.map((e) => {
return { return {
ApplicationId: e.ApplicationType, ApplicationId: e.ApplicationType,
@@ -177,10 +230,10 @@ export class ExpedienteDetailPage implements OnInit {
Attachments: DocumentToSave, Attachments: DocumentToSave,
} }
if(actionName == 'Aprovar'){ if (actionName == 'Aprovar') {
this.approve(res.data.note, docs); this.approve(res.data.note, docs);
} }
else if(actionName == 'Revisão'){ else if (actionName == 'Revisão') {
this.sendToReview(res.data.note, docs); this.sendToReview(res.data.note, docs);
} }
this.goBack(); this.goBack();
@@ -230,14 +283,14 @@ export class ExpedienteDetailPage implements OnInit {
} }
sendExpedienteToPending() { sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
console.log(res); console.log(res);
this.toastService.successMessage('Processo enviado para pendentes') this.toastService.successMessage('Processo enviado para pendentes')
this.goBack(); this.goBack();
}, },
(error)=>{ (error) => {
this.toastService.badRequest('Processo não enviado para pendentes') this.toastService.badRequest('Processo não enviado para pendentes')
}); });
} }
async LoadTaskDetail(serial: string) { async LoadTaskDetail(serial: string) {
@@ -249,7 +302,7 @@ export class ExpedienteDetailPage implements OnInit {
"SerialNumber": res.serialNumber, "SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject, "Folio": res.workflowInstanceDataFields.Subject,
"Senders": res.originator.email, "Senders": res.originator.email,
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'), "CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest, "DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
"Remetente": res.workflowInstanceDataFields.Sender, "Remetente": res.workflowInstanceDataFields.Sender,
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note, "Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
@@ -264,16 +317,17 @@ 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()]);
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{ this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
this.intervenientes = users.filter(user=>{ this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
this.cc = users.filter(user=>{ this.cc = users.filter(user => {
return user.Type == 'CC'; return user.Type == 'CC';
}); });
}) })
@@ -281,14 +335,14 @@ export class ExpedienteDetailPage implements OnInit {
console.log('this.task', this.task.InstanceID) console.log('this.task', this.task.InstanceID)
console.log('this.task.DocumentURL', this.task.DocumentURL) console.log('this.task.DocumentURL', this.task.DocumentURL)
}, (error)=>{ }, (error) => {
try { try {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
this.goBack() this.goBack()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} finally { } finally {
if(error.status == 0) { if (error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline') this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
} else { } else {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
@@ -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'
}); });
@@ -336,7 +391,7 @@ export class ExpedienteDetailPage implements OnInit {
getAttachments(serialNumber) { getAttachments(serialNumber) {
console.log(serialNumber); console.log(serialNumber);
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{ this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res => {
this.attachments = res; this.attachments = res;
console.log('res', res); console.log('res', res);
}); });
@@ -357,45 +412,45 @@ export class ExpedienteDetailPage implements OnInit {
} }
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=> { modal.onDidDismiss().then(async (res) => {
if(res){ if (res) {
const data = res.data; const data = res.data;
this.documents.push(data.selected); this.documents.push(data.selected);
this.documents.forEach((element: any) => { this.documents.forEach((element: any) => {
let body = { let body = {
"InstanceID": this.task.InstanceID, "InstanceID": this.task.InstanceID,
"WorkflowDisplayName": this.task.WorkflowName, "WorkflowDisplayName": this.task.WorkflowName,
"FolderID": this.task.FolderId, "FolderID": this.task.FolderId,
"DispatchNumber": this.task.DispatchNumber, "DispatchNumber": this.task.DispatchNumber,
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID, "AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
"Attachments": [] "Attachments": []
} }
const Attachments = this.searchDocumentPipe.transformToAttachment(element) const Attachments = this.searchDocumentPipe.transformToAttachment(element)
body.Attachments = Attachments; body.Attachments = Attachments;
const loader = this.toastService.loading() const loader = this.toastService.loading()
this.attachmentsService.AddAttachment(body).subscribe((res)=> { this.attachmentsService.AddAttachment(body).subscribe((res) => {
this.toastService.successMessage() this.toastService.successMessage()
}, ()=> { }, () => {
this.toastService.badRequest() this.toastService.badRequest()
}, ()=> { }, () => {
loader.remove() loader.remove()
}); });
}); });
} }
}); });
} }
async openExpedientActionsModal(taskAction: any, task: any) { async openExpedientActionsModal(taskAction: any, task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -408,9 +463,9 @@ export class ExpedienteDetailPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async(res)=>{ modal.onDidDismiss().then(async (res) => {
let body = res['data']; let body = res['data'];
if(res['data']) { if (res['data']) {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
@@ -421,47 +476,47 @@ export class ExpedienteDetailPage implements OnInit {
loader.remove() loader.remove()
} }
} }
else{ else {
this.close(); this.close();
} }
}); });
} }
async distartExpedientModal(body:any) { async distartExpedientModal(body: any) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
}, },
cssClass: 'discart-expedient-modal', cssClass: 'discart-expedient-modal',
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res)=>{ modal.onDidDismiss().then(async (res) => {
console.log(res['data']); console.log(res['data']);
if(body == 'descartar') { if (body == 'descartar') {
if(res['data']== 'Yes') { if (res['data'] == 'Yes') {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.expedienteService.discard({SerialNumber: this.task.SerialNumber}).toPromise() await this.expedienteService.discard({ SerialNumber: this.task.SerialNumber }).toPromise()
this.toastService.successMessage('Processo descartado'); this.toastService.successMessage('Processo descartado');
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest('Processo não descartado') this.toastService.badRequest('Processo não descartado')
} finally { } finally {
loader.remove() loader.remove()
} }
} }
else if(res['data'] == 'No'){ else if (res['data'] == 'No') {
//Do nothing //Do nothing
} }
} }
else{ else {
if(res['data']== 'Yes') { if (res['data'] == 'Yes') {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
@@ -475,7 +530,7 @@ export class ExpedienteDetailPage implements OnInit {
} }
} }
else if(res['data'] == 'No') { else if (res['data'] == 'No') {
console.log('Update'); console.log('Update');
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
@@ -484,7 +539,7 @@ export class ExpedienteDetailPage implements OnInit {
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally { } finally {
loader.remove() loader.remove()
} }
} }
@@ -496,9 +551,9 @@ export class ExpedienteDetailPage implements OnInit {
console.log(task); console.log(task);
let classs; let classs;
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -510,12 +565,12 @@ export class ExpedienteDetailPage implements OnInit {
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
this.goBack(); this.goBack();
}); });
} }
goToEvent(eventId:any) { goToEvent(eventId: any) {
this.router.navigate(['/home/events', eventId, 'expediente']); this.router.navigate(['/home/events', eventId, 'expediente']);
} }
@@ -545,7 +600,7 @@ export class ExpedienteDetailPage implements OnInit {
componentProps: { componentProps: {
task: this.task, task: this.task,
fulltask: this.fulltask, fulltask: this.fulltask,
taskAction:taskAction, taskAction: taskAction,
}, },
translucent: true translucent: true
}); });
@@ -33,8 +33,8 @@
<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',
@@ -12,40 +15,33 @@ import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
}) })
export class ExpedientePage implements OnInit { export class ExpedientePage implements OnInit {
segment:string; segment: string;
skeletonLoader = true skeletonLoader = true
//profile:string; //profile:string;
showLoader:boolean; showLoader: boolean;
taskslist = []; taskslist = [];
serialNumber:string; serialNumber: string;
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()
}
}
});
} }
async LoadList() { async LoadList() {
@@ -54,17 +50,19 @@ export class ExpedientePage implements OnInit {
try { try {
const expediente: object[] = await this.processes.GetTaskListExpediente(false).toPromise() const expediente: object[] = await this.processes.GetTaskListExpediente(false).toPromise()
const result = expediente const result = expediente
this.taskslist = new Array(); this.taskslist = new Array();
let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active"); let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
res.forEach((element: any) => { res.forEach((element: any) => {
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')
@@ -92,9 +90,80 @@ export class ExpedientePage implements OnInit {
this.router.navigate(['/home/gabinete-digital']); this.router.navigate(['/home/gabinete-digital']);
} }
goToExpediente(serialNumber:any){ goToExpediente(serialNumber: any) {
//console.log('ABRE'); //console.log('ABRE');
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,12 +210,13 @@ 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'
}); });
await modal.present(); await modal.present();
} }
attachDocument() { attachDocument() {
@@ -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,39 +25,43 @@ 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',
styleUrls: ['./gabinete-digital.page.scss'], styleUrls: ['./gabinete-digital.page.scss'],
}) })
export class GabineteDigitalPage implements OnInit, DoCheck { export class GabineteDigitalPage implements OnInit, DoCheck {
segment:string; segment: string;
segmentVista:string; segmentVista: string;
showLoader: boolean; showLoader: boolean;
public profile:string; public profile: string;
allProcessesList: any = new Array(); allProcessesList: any = new Array();
skeletonLoader: boolean; skeletonLoader: boolean;
count_exp_dailywork=0; count_exp_dailywork = 0;
count_exp_pr =0 count_exp_pr = 0
count_desp_dailywork=0; count_desp_dailywork = 0;
count_desp_pending=0; count_desp_pending = 0;
count_par_dailywork=0; count_par_dailywork = 0;
count_par_pending=0; count_par_pending = 0;
count_def_dailywork=0; count_def_dailywork = 0;
count_def_pending=0; count_def_pending = 0;
count_exp_pp : string; count_exp_pp: string;
count_exp_pd : string; count_exp_pd: string;
count_dip_apr : string; count_dip_apr: string;
count_dip_as_pr =0 count_dip_as_pr = 0
count_dip_pv=0; count_dip_pv = 0;
count_dip_as = 0; count_dip_as = 0;
count_de_pr = 0; count_de_pr = 0;
count_ev_apr=0; count_ev_apr = 0;
count_ev_md=0; count_ev_md = 0;
count_total_pending = 0; count_total_pending = 0;
count_desp_pr_active = 0; count_desp_pr_active = 0;
count_all_processes = 0; count_all_processes = 0;
@@ -66,7 +70,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
desktopComponent: any = { desktopComponent: any = {
showEventList: false, showEventList: false,
showExpediente : false, showExpediente: false,
} }
showAllProcesses = false; showAllProcesses = false;
@@ -84,7 +88,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
showSignedDiploma = false; showSignedDiploma = false;
emptyTextDescription = 'Sem opção selecionada'; emptyTextDescription = 'Sem opção selecionada';
serialNumber:string; serialNumber: string;
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
mdgpr = "MDGPR"; mdgpr = "MDGPR";
@@ -105,6 +109,8 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
// //
// pipe // pipe
synch = synchro;
customTaskPipe = new CustomTaskPipe() customTaskPipe = new CustomTaskPipe()
@@ -113,7 +119,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
@ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage; @ViewChild(EventsToApprovePage) eventsToApprove: EventsToApprovePage;
constructor( constructor(
private processesbackend:ProcessesService, private processesbackend: ProcessesService,
private modalController: ModalController, private modalController: ModalController,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router, private router: Router,
@@ -122,27 +128,27 @@ 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) => {
// if not mobile remove all component
if (window.innerWidth < 701) {
this.modalController.dismiss();
this.segmentVista = "listview";
}
else {
this.segmentVista = "boxview";
}
};
this.checkRoutes();
window.onresize = (event) => { // this.eventoaprovacaostore.resetmd([])
// if not mobile remove all component // this.eventoaprovacaostore.resetpr([])
if( window.innerWidth < 701){
this.modalController.dismiss();
this.segmentVista = "listview";
}
else{
this.segmentVista = "boxview";
}
};
this.checkRoutes();
// this.eventoaprovacaostore.resetmd([])
// this.eventoaprovacaostore.resetpr([])
} }
@@ -165,52 +171,30 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
ngOnInit() { ngOnInit() {
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.segmentVista = "listview"; this.segmentVista = "listview";
} }
else{ else {
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() {
let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise(); let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise();
if(!this.p.userRole(['PR'])) { if (!this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Assinar Diplomas') allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas')
} else if (this.p.userRole(['PR'])) { } else if (this.p.userRole(['PR'])) {
allProcessesList = allProcessesList.filter( element => element.activityInstanceName != 'Diploma Assinado') allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Diploma Assinado')
} }
console.log('allProcessesList', allProcessesList); console.log('allProcessesList', allProcessesList);
this.addProcessToDB(allProcessesList)
this.skeletonLoader = true; this.skeletonLoader = true;
this.allProcessesList = []; this.allProcessesList = [];
@@ -218,13 +202,14 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
allProcessesList.forEach(element => { allProcessesList.forEach(element => {
let date = new Date(element.taskStartDate); let date = new Date(element.taskStartDate);
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds(); let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let task = { let task = {
"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,
@@ -237,69 +222,158 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
"customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent), "customDate": this.setFormatDate(new Date(element.workflowInstanceDataFields.StartDate), new Date(element.workflowInstanceDataFields.EndDate), element.workflowInstanceDataFields.IsAllDayEvent),
} }
this.allProcessesList.push(task); this.allProcessesList.push(task);
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;
} }
sortArrayISODate(myArray: any){ addProcessToDB(data) {
return myArray.sort(function(a, b) { 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) {
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);
}); });
} }
setFormatDate(start:any, end:any, allday:boolean){ setFormatDate(start: any, end: any, allday: boolean) {
let customDate; let customDate;
/* start = new Date(); /* start = new Date();
end= new Date("2021-08-04T18:01:04.753Z"); */ end= new Date("2021-08-04T18:01:04.753Z"); */
//end = new Date("2021-09-04T18:01:04.753Z"); //end = new Date("2021-09-04T18:01:04.753Z");
const totalSeconds = Math.floor((end - (start))/1000);; const totalSeconds = Math.floor((end - (start)) / 1000);;
const totalMinutes = Math.floor(totalSeconds/60); const totalMinutes = Math.floor(totalSeconds / 60);
const totalHours = Math.floor(totalMinutes/60); const totalHours = Math.floor(totalMinutes / 60);
const totalDays = Math.floor(totalHours/24); const totalDays = Math.floor(totalHours / 24);
const hours = totalHours - ( totalDays * 24 ); const hours = totalHours - (totalDays * 24);
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 ); const minutes = totalMinutes - (totalDays * 24 * 60) - (hours * 60);
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 ); const seconds = totalSeconds - (totalDays * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
let diffDays = totalDays; let diffDays = totalDays;
let diffMinutes = minutes; let diffMinutes = minutes;
if(totalDays == 0){ if (totalDays == 0) {
if(allday){ if (allday) {
customDate = this.getCustomDate(start)+", "+this.getCustomHours(start)+" (todo dia)"; customDate = this.getCustomDate(start) + ", " + this.getCustomHours(start) + " (todo dia)";
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;
} }
} }
else{ else {
customDate = this.getCustomDate(start)+","+this.getCustomHours(start)+ customDate = this.getCustomDate(start) + "," + this.getCustomHours(start) +
" (termina:"+ this.getCustomDate(end)+","+this.getCustomHours(end)+")"; " (termina:" + this.getCustomDate(end) + "," + this.getCustomHours(end) + ")";
return customDate; return customDate;
} }
} }
getCustomDate(thedate: Date){ getCustomDate(thedate: Date) {
return thedate.getDate() + "/" + return thedate.getDate() + "/" +
(thedate.getMonth()+1) + "/" + (thedate.getMonth() + 1) + "/" +
thedate.getFullYear(); thedate.getFullYear();
} }
getCustomHours(thedate: Date){ getCustomHours(thedate: Date) {
return thedate.getHours() + ":" + return thedate.getHours() + ":" +
thedate.getMinutes(); thedate.getMinutes();
} }
goToProcess(serialNumber:string, workflowName:string, activityName:string){ goToProcess(serialNumber:string, workflowName:string, activityName:string){
@@ -312,42 +386,42 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
if(activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho'){ if(activityName == 'Tarefa de Despacho' || activityName == 'Concluir Despacho'){
this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/despachos-pr',serialNumber,'gabinete-digital']);
} }
else if(activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma'){ else if (activityName == 'Revisar Diploma' || activityName == 'Assinar Diploma') {
this.router.navigate(['/home/gabinete-digital/diplomas',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/diplomas', serialNumber, 'gabinete-digital']);
} }
else if(activityName == 'Diploma Assinado'){ else if (activityName == 'Diploma Assinado') {
this.router.navigate(['/home/gabinete-digital/diplomas-assinar',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
} }
} }
else if(workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') { else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
} }
else if(workflowName == 'Expediente') { else if (workflowName == 'Expediente') {
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
} }
else if(workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') { else if (workflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
this.router.navigate(['/home/gabinete-digital/expedientes-pr',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/expedientes-pr', serialNumber, 'gabinete-digital']);
} }
else if (workflowName == "Pedido de Parecer do Presidente") { else if (workflowName == "Pedido de Parecer do Presidente") {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/pedidos', serialNumber, 'gabinete-digital']);
} }
/* else if (workflowName == "Expediente") { /* else if (workflowName == "Expediente") {
this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/pedidos',serialNumber,'gabinete-digital']);
} */ } */
else if(workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') { else if (workflowName == 'Agenda Pessoal PR' || workflowName == 'Agenda Oficial PR' || workflowName == 'Agenda Oficial MDGPR' || workflowName == 'Agenda Pessoal MDGPR') {
this.router.navigate(['/home/gabinete-digital/event-list/approve-event',serialNumber, 'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/event-list/approve-event', serialNumber, 'gabinete-digital']);
} }
else { else {
console.log('cant find page for this task') console.log('cant find page for this task')
} }
} }
onSegmentVistaChange(){ onSegmentVistaChange() {
} }
checkUser(){ checkUser() {
this.selectedElement='allProcessesTag'; this.selectedElement = 'allProcessesTag';
this.showAllProcesses = true; this.showAllProcesses = true;
/* switch(this.loggeduser.Profile){ /* switch(this.loggeduser.Profile){
case 'MDGPR': case 'MDGPR':
@@ -359,77 +433,77 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
} */ } */
} }
hideRefreshButton(){ hideRefreshButton() {
window.onresize = (event) => { window.onresize = (event) => {
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.hideRefreshBtn = false; this.hideRefreshBtn = false;
this.hideInMobile = false; this.hideInMobile = false;
this.segmentVista = "listview"; this.segmentVista = "listview";
} }
else{ else {
this.hideRefreshBtn = true; this.hideRefreshBtn = true;
this.hideInMobile = true; this.hideInMobile = true;
this.segmentVista = "boxview"; this.segmentVista = "boxview";
} }
} }
if(window.innerWidth < 701){ if (window.innerWidth < 701) {
this.hideRefreshBtn = false; this.hideRefreshBtn = false;
this.hideInMobile = false; this.hideInMobile = false;
this.segmentVista = "listview"; this.segmentVista = "listview";
} }
else{ else {
this.hideRefreshBtn = true; this.hideRefreshBtn = true;
this.hideInMobile = true; this.hideInMobile = true;
this.segmentVista = "boxview"; this.segmentVista = "boxview";
} }
} }
checkRoutes(){ checkRoutes() {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if(this.router.url == '/home/gabinete-digital?processes=true'){ if (this.router.url == '/home/gabinete-digital?processes=true') {
this.openAllProcessesPage(); this.openAllProcessesPage();
this.selectedElement='allProcessesTag'; this.selectedElement = 'allProcessesTag';
} }
if(this.router.url == '/home/gabinete-digital?eventos=true'){ if (this.router.url == '/home/gabinete-digital?eventos=true') {
this.openEventsToApprovePage(); this.openEventsToApprovePage();
this.selectedElement='approval'; this.selectedElement = 'approval';
} }
else if(this.router.url == '/home/gabinete-digital?expedientes=true'){ else if (this.router.url == '/home/gabinete-digital?expedientes=true') {
this.openExpedientListPage(); this.openExpedientListPage();
if(this.loggeduser.Profile == 'MDGPR'){ if (this.loggeduser.Profile == 'MDGPR') {
this.selectedElement='Correspondence'; this.selectedElement = 'Correspondence';
} }
else{ else {
this.selectedElement='Expediente Presidente' this.selectedElement = 'Expediente Presidente'
} }
} }
else if(this.router.url == '/home/gabinete-digital?pendentes=true'){ else if (this.router.url == '/home/gabinete-digital?pendentes=true') {
this.openPendentesPage(''); this.openPendentesPage('');
this.selectedElement='Pending'; this.selectedElement = 'Pending';
} }
else if(this.router.url == '/home/gabinete-digital?despachos=true'){ else if (this.router.url == '/home/gabinete-digital?despachos=true') {
this.openDespachosPage(''); this.openDespachosPage('');
this.selectedElement='Dispatches'; this.selectedElement = 'Dispatches';
} }
else if(this.router.url == '/home/gabinete-digital?pedidos=true'){ else if (this.router.url == '/home/gabinete-digital?pedidos=true') {
this.openPedidosPage('parecer'); this.openPedidosPage('parecer');
this.selectedElement='RequestsForOpinion'; this.selectedElement = 'RequestsForOpinion';
} }
else if(this.router.url == '/home/gabinete-digital?expedientespr=true'){ else if (this.router.url == '/home/gabinete-digital?expedientespr=true') {
this.openExpedientesPrPage(); this.openExpedientesPrPage();
this.selectedElement='Expediente Presidente' this.selectedElement = 'Expediente Presidente'
} }
else if(this.router.url == '/home/gabinete-digital?despachospr=true'){ else if (this.router.url == '/home/gabinete-digital?despachospr=true') {
this.openDespachosPrPage(''); this.openDespachosPrPage('');
this.selectedElement='DispatchesPr' this.selectedElement = 'DispatchesPr'
} }
else if(this.router.url == '/home/gabinete-digital?diplomas=true'){ else if (this.router.url == '/home/gabinete-digital?diplomas=true') {
this.openDiplomasPage('validar'); this.openDiplomasPage('validar');
this.selectedElement='DiplomasPorValidar'; this.selectedElement = 'DiplomasPorValidar';
} }
else if(this.router.url == '/home/gabinete-digital?diplomasassinar=true'){ else if (this.router.url == '/home/gabinete-digital?diplomasassinar=true') {
this. openDiplomasAssinarPage(); this.openDiplomasAssinarPage();
this.selectedElement='DiplomasAssinar'; this.selectedElement = 'DiplomasAssinar';
} }
else if (this.router.url == '/home/gabinete-digital?parecer=true') { else if (this.router.url == '/home/gabinete-digital?parecer=true') {
this.openPedidosPage('parecer') this.openPedidosPage('parecer')
@@ -437,7 +511,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
else if (this.router.url == '/home/gabinete-digital?deferimento=true') { else if (this.router.url == '/home/gabinete-digital?deferimento=true') {
this.openPedidosPage('deferimento') this.openPedidosPage('deferimento')
} }
else{ else {
this.checkUser(); this.checkUser();
} }
} }
@@ -464,15 +538,15 @@ 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")
this.expedientegbstore.count = expedientes.length this.expedientegbstore.count = expedientes.length
let despachos = await this.despachoRule.getList({updateStore: true}) let despachos = await this.despachoRule.getList({ updateStore: true })
if(despachos) { if (despachos) {
this.despachoStore.reset(despachos) this.despachoStore.reset(despachos)
} }
@@ -488,7 +562,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.count_def_dailywork = Object.keys(deferimentos.filter(data => data.workflowInstanceDataFields.Status == "Active")).length; this.count_def_dailywork = Object.keys(deferimentos.filter(data => data.workflowInstanceDataFields.Status == "Active")).length;
this.pedidosstore.countdeferimento = this.count_def_dailywork; this.pedidosstore.countdeferimento = this.count_def_dailywork;
let pendentes =await this.processesbackend.GetPendingTasks(false).toPromise(); let pendentes = await this.processesbackend.GetPendingTasks(false).toPromise();
this.count_total_pending = Object.keys(pendentes).length; this.count_total_pending = Object.keys(pendentes).length;
this.pendentesstore.count = this.count_total_pending; this.pendentesstore.count = this.count_total_pending;
@@ -538,7 +612,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
this.count_dip_as_pr = Object.keys(diplomasAssinados).length; this.count_dip_as_pr = Object.keys(diplomasAssinados).length;
this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados) this.deplomasStore.resetDiplomasAssinadoList(diplomasAssinados)
this.processesbackend.GetToApprovedEvents('Agenda','true').subscribe(res=>{ this.processesbackend.GetToApprovedEvents('Agenda', 'true').subscribe(res => {
this.count_ev_apr = res; this.count_ev_apr = res;
}); });
@@ -554,56 +628,56 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
console.log(event); console.log(event);
// this.closeAllDesktopComponents(); // this.closeAllDesktopComponents();
/* switch(this.loggeduser.Profile){ /* switch(this.loggeduser.Profile){
case 'MDGPR': case 'MDGPR':
this.selectedElement='Correspondence'; this.selectedElement='Correspondence';
this.showExpedients = true; this.showExpedients = true;
this.expedientesPage.doRefresh(); this.expedientesPage.doRefresh();
break; break;
case 'PR': case 'PR':
this.selectedElement='ExpedientesPr'; this.selectedElement='ExpedientesPr';
this.showExpedientesPr = true; this.showExpedientesPr = true;
break; break;
} */ } */
this.LoadCounts(); this.LoadCounts();
this.loadAllProcesses(); this.loadAllProcesses();
//this.refreshExpedientes(); //this.refreshExpedientes();
if(event){ if (event) {
setTimeout(() => { setTimeout(() => {
event.target.complete(); event.target.complete();
}, 2000); }, 2000);
} }
else{ else {
console.log('null'); console.log('null');
} }
} }
selectedElementF(element:string) { selectedElementF(element: string) {
if (window.innerWidth > 701) { if (window.innerWidth > 701) {
return element == this.selectedElement return element == this.selectedElement
} }
return false; return false;
} }
openAllProcessesPage() { openAllProcessesPage() {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
let navigationExtras: NavigationExtras = { queryParams: {"processes": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "processes": true, } };
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital']); this.router.navigate(['/home/gabinete-digital']);
} }
else { else {
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showAllProcesses = true; this.showAllProcesses = true;
this.selectedElement="allProcessesTag"; this.selectedElement = "allProcessesTag";
} }
} }
openEventsToApprovePage() { openEventsToApprovePage() {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
let navigationExtras: NavigationExtras = { queryParams: {"eventos": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "eventos": true, } };
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
//this.openEventsToApproveList(profile); //this.openEventsToApproveList(profile);
this.router.navigate(['/home/gabinete-digital/event-list']); this.router.navigate(['/home/gabinete-digital/event-list']);
} }
@@ -616,26 +690,26 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
openExpedientListPage() { openExpedientListPage() {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
switch(this.loggeduser.Profile){ switch (this.loggeduser.Profile) {
case 'MDGPR': case 'MDGPR':
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
//this.openExpedientList(); //this.openExpedientList();
this.router.navigate(['/home/gabinete-digital/expediente']); this.router.navigate(['/home/gabinete-digital/expediente']);
} }
else { else {
this.selectedElement='Correspondence' this.selectedElement = 'Correspondence'
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showExpedients = true; this.showExpedients = true;
} }
break; break;
case 'PR': case 'PR':
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expedientes-pr']); this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
} }
else { else {
this.selectedElement='ExpedientesPr' this.selectedElement = 'ExpedientesPr'
let navigationExtras: NavigationExtras = { queryParams: {"expedientes": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "expedientes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showExpedientesPr = true; this.showExpedientesPr = true;
} }
@@ -644,20 +718,20 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
} }
openPedidosPage(segment:string) { openPedidosPage(segment: string) {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
let navigationExtras: NavigationExtras; let navigationExtras: NavigationExtras;
if (segment == 'deferimento') { if (segment == 'deferimento') {
navigationExtras= { queryParams: {"deferimento": true,}}; navigationExtras = { queryParams: { "deferimento": true, } };
this.segment = 'deferimento' this.segment = 'deferimento'
} else if (segment == 'parecer') { } else if (segment == 'parecer') {
navigationExtras = { queryParams: {"parecer": true,}}; navigationExtras = { queryParams: { "parecer": true, } };
this.segment = 'parecer' this.segment = 'parecer'
} }
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras); this.router.navigate(['/home/gabinete-digital/pedidos'], navigationExtras);
} }
else { else {
@@ -667,78 +741,78 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
if (segment == 'deferimento') { if (segment == 'deferimento') {
this.selectedElement = 'RequestForApproval' this.selectedElement = 'RequestForApproval'
} else if (segment == 'parecer') { } else if (segment == 'parecer') {
this.selectedElement='RequestsForOpinion' this.selectedElement = 'RequestsForOpinion'
} }
} }
} }
openDespachosPage(segment?:string) { openDespachosPage(segment?: string) {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/despachos']); this.router.navigate(['/home/gabinete-digital/despachos']);
} }
else{ else {
let navigationExtras: NavigationExtras = {queryParams: {"despachos": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "despachos": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDespachos = true; this.showDespachos = true;
} }
} }
openDespachosPrPage(segment?:string) { openDespachosPrPage(segment?: string) {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/despachos-pr']); this.router.navigate(['/home/gabinete-digital/despachos-pr']);
} }
else{ else {
let navigationExtras: NavigationExtras = {queryParams: {"despachospr": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "despachospr": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDespachosPr = true; this.showDespachosPr = true;
} }
} }
openPendentesPage(segment?:string){ openPendentesPage(segment?: string) {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/pendentes']); this.router.navigate(['/home/gabinete-digital/pendentes']);
} }
else{ else {
let navigationExtras: NavigationExtras = { queryParams: {"pendentes": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "pendentes": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showPendentes = true; this.showPendentes = true;
} }
} }
openExpedientesPrPage(segment?:string){ openExpedientesPrPage(segment?: string) {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if( window.innerWidth < 701) { if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expedientes-pr']); this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
} }
else { else {
this.selectedElement='ExpedientesPr' this.selectedElement = 'ExpedientesPr'
let navigationExtras: NavigationExtras = { queryParams: {"expedientespr": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "expedientespr": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showExpedientesPr = true; this.showExpedientesPr = true;
} }
} }
openDiplomasPage(segment:string) { openDiplomasPage(segment: string) {
let navigationExtras: NavigationExtras; let navigationExtras: NavigationExtras;
if (segment == 'validar') { if (segment == 'validar') {
navigationExtras= { queryParams: {"validar": true,}}; navigationExtras = { queryParams: { "validar": true, } };
} else if (segment == 'assinados') { } else if (segment == 'assinados') {
navigationExtras = { queryParams: {"assinados": true,}}; navigationExtras = { queryParams: { "assinados": true, } };
} }
this.segment = segment; this.segment = segment;
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/diplomas'], navigationExtras); this.router.navigate(['/home/gabinete-digital/diplomas'], navigationExtras);
} }
else{ else {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
this.segment = segment; this.segment = segment;
let navigationExtras: NavigationExtras = { queryParams: {"diplomas": true,}}; let navigationExtras: NavigationExtras = { queryParams: { "diplomas": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras); this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDiplomas = true; this.showDiplomas = true;
} }
@@ -746,14 +820,14 @@ export class GabineteDigitalPage implements OnInit, DoCheck {
openDiplomasAssinarPage() { openDiplomasAssinarPage() {
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if( window.innerWidth < 701){ if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/diplomas-assinar']); this.router.navigate(['/home/gabinete-digital/diplomas-assinar']);
}
else{
let navigationExtras: NavigationExtras = { queryParams: {"diplomasassinar": true,}};
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDiplomasAssinar = true;
}
} }
else {
let navigationExtras: NavigationExtras = { queryParams: { "diplomasassinar": true, } };
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
this.showDiplomasAssinar = true;
}
}
} }
@@ -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';
@@ -31,10 +35,10 @@ export class PedidoPage implements OnInit {
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; 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"]; days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate:any; customDate: any;
task: any; task: any;
attachments:any; attachments: any;
fulltask: any; fulltask: any;
eventsList: Event[]; eventsList: Event[];
serialnumber: string; serialnumber: string;
@@ -56,31 +60,32 @@ 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;
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
// console.log(params["params"]); // console.log(params["params"]);
if(params["params"].SerialNumber) { if (params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber; this.serialnumber = params["params"].SerialNumber;
} }
if(params["params"].caller) { if (params["params"].caller) {
this.caller = params["params"].caller; this.caller = params["params"].caller;
} }
}); });
} }
ngOnInit() { ngOnInit() {
this.LoadTaskDetail(this.serialnumber); this.getfromDb()
} }
close() { close() {
this.modalController.dismiss(); this.modalController.dismiss();
} }
notImplemented(){ notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento'); this.alertService.presentAlert('Funcionalidade em desenvolvimento');
} }
@@ -92,12 +97,13 @@ 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') {
let date = new Date(res.taskStartDate); let date = new Date(res.taskStartDate);
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds(); let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = { this.task = {
"SerialNumber": res.serialNumber, "SerialNumber": res.serialNumber,
@@ -117,12 +123,13 @@ 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') {
let date = new Date(res.taskStartDate); let date = new Date(res.taskStartDate);
date.setMonth(date.getMonth() + 1); date.setMonth(date.getMonth() + 1);
let taskDate = date.getFullYear()+"-"+ date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+ ":"+date.getSeconds(); let taskDate = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
this.task = { this.task = {
"SerialNumber": res.serialNumber, "SerialNumber": res.serialNumber,
@@ -141,28 +148,32 @@ 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.intervenientes = users.filter(user=>{ this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users)).then(() =>{
console.log('Pedido ')
})
this.intervenientes = users.filter(user => {
return user.Type == 'I'; return user.Type == 'I';
}); });
this.cc = users.filter(user=>{ this.cc = users.filter(user => {
return user.Type == 'CC'; return user.Type == 'CC';
}); });
}); });
this.getDocumentDetails(res.workflowInstanceDataFields.FolderID, '361'); this.getDocumentDetails(res.workflowInstanceDataFields.FolderID, '361');
}, (error)=>{ }, (error) => {
try { try {
this.goBack() this.goBack()
this.close() this.close()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} finally { } finally {
if(error.status == 0) { if (error.status == 0) {
this.toastService.badRequest('Não é possível visualizar este processo no modo offline') this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
} else { } else {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
@@ -172,10 +183,104 @@ export class PedidoPage implements OnInit {
}); });
} }
getDocumentDetails(forlderId:string, applicationId:string){ getfromDb() {
this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{ 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) {
this.processes.GetDocumentDetails(forlderId, applicationId).subscribe(res => {
this.attachments = res.Documents; this.attachments = res.Documents;
// console.log(res['Documents']); console.log(res['Documents']);
}) })
} }
@@ -193,12 +298,13 @@ 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'
}); });
await modal.present(); await modal.present();
} }
openMenu() { openMenu() {
@@ -214,17 +320,17 @@ export class PedidoPage implements OnInit {
task: this.task, task: this.task,
serialNumber: this.task.SerialNumber, serialNumber: this.task.SerialNumber,
fulltask: this.fulltask, fulltask: this.fulltask,
taskAction:taskAction, taskAction: taskAction,
showEnviarPendentes: false showEnviarPendentes: false
}, },
translucent: true translucent: true
}); });
await popover.present(); await popover.present();
popover.onDidDismiss().then(( res =>{ popover.onDidDismiss().then((res => {
if( res['data'] == 'close') { if( res['data'] == 'close') {
this.goBack() this.goBack()
} }
// alert(JSON.stringify(res)+' nada') // alert(JSON.stringify(res)+' nada')
@@ -232,7 +338,7 @@ export class PedidoPage implements OnInit {
})) }))
} }
async repreciar(note:string, documents:any) { async repreciar(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialnumber,
"action": "Reapreciação", "action": "Reapreciação",
@@ -240,7 +346,7 @@ export class PedidoPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -252,17 +358,18 @@ export class PedidoPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally { } finally {
loader.remove() loader.remove()
} }
} }
async arquivar(note:string, documents:any) { async arquivar(note: string, documents: any) {
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()
@@ -277,7 +384,7 @@ export class PedidoPage implements OnInit {
} }
async assignar(note:string, documents:any) { async assignar(note: string, documents: any) {
let body = { let body = {
"serialNumber": this.serialnumber, "serialNumber": this.serialnumber,
"action": "Reencaminhar", "action": "Reencaminhar",
@@ -285,7 +392,7 @@ export class PedidoPage implements OnInit {
"dataFields": { "dataFields": {
"ReviewUserComment": note, "ReviewUserComment": note,
}, },
"AttachmentList" :documents, "AttachmentList": documents,
} }
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -296,16 +403,16 @@ export class PedidoPage implements OnInit {
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} finally { } finally {
loader.remove() loader.remove()
} }
} }
sendExpedienteToPending() { sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res => {
this.goBack(); this.goBack();
},()=>{ }, () => {
this.toastService.badRequest('Processo não encontrado') this.toastService.badRequest('Processo não encontrado')
}); });
@@ -314,9 +421,9 @@ export class PedidoPage implements OnInit {
async openExpedientActionsModal(taskAction: any, task: any) { async openExpedientActionsModal(taskAction: any, task: any) {
let classs; let classs;
if( window.innerWidth <= 800) { if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -329,7 +436,7 @@ export class PedidoPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
console.log('Modal closed'); console.log('Modal closed');
this.goBack(); this.goBack();
}); });
@@ -337,9 +444,9 @@ export class PedidoPage implements OnInit {
async openBookMeetingModal(task: any) { async openBookMeetingModal(task: any) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -370,12 +477,12 @@ export class PedidoPage implements OnInit {
// } // }
// }); // });
// } // }
async distartExpedientModal(){ async distartExpedientModal(){
console.log(this.fulltask); console.log(this.fulltask);
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
serialNumber: this.fulltask.SerialNumber, serialNumber: this.fulltask.SerialNumber,
folderId: this.fulltask.workflowInstanceDataFields.FolderID, folderId: this.fulltask.workflowInstanceDataFields.FolderID,
action: 'complete', action: 'complete',
@@ -385,8 +492,8 @@ export class PedidoPage implements OnInit {
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
if(res['data']=='close'){ if (res['data'] == 'close') {
this.close(); this.close();
/* console.log('2Expedient Discard closed2'); /* console.log('2Expedient Discard closed2');
this.close(); this.close();
@@ -400,9 +507,9 @@ export class PedidoPage implements OnInit {
console.log(task); console.log(task);
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -420,9 +527,9 @@ export class PedidoPage implements OnInit {
async openForwardModal(task: any) { async openForwardModal(task: any) {
let classs; let classs;
if( window.innerWidth <= 800) { if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'modal modal-desktop showAsideOptions' classs = 'modal modal-desktop showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -441,9 +548,9 @@ export class PedidoPage implements OnInit {
console.log(task); console.log(task);
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'book-meeting-modal modal modal-desktop' classs = 'book-meeting-modal modal modal-desktop'
} else { } else {
classs = 'add-note-modal-no-height showAsideOptions' classs = 'add-note-modal-no-height showAsideOptions'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -456,21 +563,21 @@ export class PedidoPage implements OnInit {
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res=>{ modal.onDidDismiss().then(res => {
this.goBack(); this.goBack();
}); });
} }
async openAddNoteModal(actionName:string) { async openAddNoteModal(actionName: string) {
let classs; let classs;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
classs = 'modal modal-desktop' classs = 'modal modal-desktop'
} else { } else {
classs = 'add-note-modal-no-height' classs = 'add-note-modal-no-height'
} }
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AddNotePage, component: AddNotePage,
componentProps:{ componentProps: {
showAttachmentBtn: true, showAttachmentBtn: true,
}, },
cssClass: classs, cssClass: classs,
@@ -480,8 +587,8 @@ export class PedidoPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then( async (res) => { modal.onDidDismiss().then(async (res) => {
const DocumentToSave = await res.data.documents.map( async (e) => { const DocumentToSave = await res.data.documents.map(async (e) => {
return { return {
ApplicationId: e.ApplicationType, ApplicationId: e.ApplicationType,
SourceId: e.Id, SourceId: e.Id,
@@ -492,16 +599,16 @@ export class PedidoPage implements OnInit {
Attachments: DocumentToSave, Attachments: DocumentToSave,
} }
if(res.data){ if (res.data) {
if(actionName == 'Solicitar Reapreciação') { if (actionName == 'Solicitar Reapreciação') {
await this.repreciar(res.data.note, docs); await this.repreciar(res.data.note, docs);
this.goBack(); this.goBack();
} }
else if(actionName == 'Arquivar') { else if (actionName == 'Arquivar') {
await this.arquivar(res.data.note, docs); await this.arquivar(res.data.note, docs);
this.goBack(); this.goBack();
} }
else if(actionName == 'Assignar') { else if (actionName == 'Assignar') {
await this.assignar(res.data.note, docs); await this.assignar(res.data.note, docs);
} }
} }
@@ -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,14 +177,92 @@ export class PedidosPage implements OnInit {
}); });
this.pedidosstorage.resetdeferimento(this.deferimentoList); this.sqliteservice.addProcess(this.deferimentoList);
this.listToPresentdeferimentoList = this.sortService.sortArrayISODate(this.deferimentoList);
}); });
} }
} }
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',
@@ -20,46 +25,38 @@ export class PendentesPage implements OnInit {
@ViewChild(CalendarComponent) myCal: CalendarComponent; @ViewChild(CalendarComponent) myCal: CalendarComponent;
taskType: string; taskType: string;
serialNumber:string; serialNumber: string;
totalDocs:any; totalDocs: any;
showLoader: boolean; showLoader: boolean;
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
@Input() profile:string; @Input() profile: string;
segment:string; segment: string;
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,
private alertService: AlertService, private alertService: AlertService,
private router: Router, private router: Router,
private authService: AuthService, private authService: AuthService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
) { private sqliteservice: SqliteService,
this.loggeduser = authService.ValidatedUser; private platform: Platform,
this.profile = 'mdgpr'; private sortService: SortService,
} ) {
this.loggeduser = authService.ValidatedUser;
this.profile = 'mdgpr';
}
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()
}
}
});
} }
@@ -87,18 +84,61 @@ export class PendentesPage implements OnInit {
pendentesList.push(task); pendentesList.push(task);
}); });
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() {
@@ -115,24 +155,24 @@ export class PendentesPage implements OnInit {
}, 2000); }, 2000);
} }
async viewTaskDetails({ SerialNumber, WorkflowName, activityInstanceName }:customTask) { async viewTaskDetails({ SerialNumber, WorkflowName, activityInstanceName }: customTask) {
if(WorkflowName == 'Despacho') { if (WorkflowName == 'Despacho') {
this.router.navigate(['/home/gabinete-digital/despachos',SerialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/despachos', SerialNumber, 'gabinete-digital']);
} }
else if(WorkflowName == 'Pedido de Parecer' || WorkflowName == 'Pedido de Deferimento' || WorkflowName == 'Pedido de Parecer do Presidente') { else if (WorkflowName == 'Pedido de Parecer' || WorkflowName == 'Pedido de Deferimento' || WorkflowName == 'Pedido de Parecer do Presidente') {
this.router.navigate(['/home/gabinete-digital/pedidos',SerialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/pedidos', SerialNumber, 'gabinete-digital']);
} }
else if(WorkflowName == 'Expediente') { else if (WorkflowName == 'Expediente') {
this.router.navigate(['/home/gabinete-digital/expediente',SerialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/expediente', SerialNumber, 'gabinete-digital']);
} }
else if(WorkflowName == 'Expediente' && this.loggeduser.Profile == 'PR') { else if (WorkflowName == 'Expediente' && this.loggeduser.Profile == 'PR') {
this.router.navigate(['/home/gabinete-digital/expedientes-pr',SerialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/expedientes-pr', SerialNumber, 'gabinete-digital']);
} }
else if (activityInstanceName == "Tarefa de Parecer") { else if (activityInstanceName == "Tarefa de Parecer") {
this.router.navigate(['/home/gabinete-digital/pedidos',SerialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/pedidos', SerialNumber, 'gabinete-digital']);
} }
else if(activityInstanceName == "Tarefa de Despacho") { else if (activityInstanceName == "Tarefa de Despacho") {
this.router.navigate(['/home/gabinete-digital/despachos',SerialNumber,'gabinete-digital']); this.router.navigate(['/home/gabinete-digital/despachos', SerialNumber, 'gabinete-digital']);
} }
else { else {
console.log('cant find page for this task', WorkflowName, activityInstanceName) console.log('cant find page for this task', WorkflowName, activityInstanceName)
@@ -144,4 +184,4 @@ export class PendentesPage implements OnInit {
return new Date(e).toDateString() return new Date(e).toDateString()
} }
} }
+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"
+99 -56
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',
@@ -28,11 +30,11 @@ export class PublicationsPage implements OnInit {
actionsListStorage: PublicationFolder[] = new Array(); actionsListStorage: PublicationFolder[] = new Array();
publicationsTravelFolderList: PublicationFolder[]; publicationsTravelFolderList: PublicationFolder[];
theDate:any; theDate: any;
theEndDate:any; theEndDate: any;
customDate:any; customDate: any;
months: string[]; months: string[];
days:string[]; days: string[];
publicationEventFolderStorage = PublicationEventFolderStorage publicationEventFolderStorage = PublicationEventFolderStorage
publicationTravelFolderService = PublicationTravelFolderStore publicationTravelFolderService = PublicationTravelFolderStore
@@ -61,41 +63,33 @@ 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.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"]; this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
} this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
ngOnInit() {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.getActions();
}
});
this.hideRefreshButton();
} }
hideRefreshButton(){ ngOnInit() {
this.getFromDB();
}
hideRefreshButton() {
window.onresize = (event) => { window.onresize = (event) => {
if( window.innerWidth < 801) { if (window.innerWidth < 801) {
this.hideRefreshBtn = false; this.hideRefreshBtn = false;
this.showSlidingOptions = false; this.showSlidingOptions = false;
} }
else{ else {
this.hideRefreshBtn = true; this.hideRefreshBtn = true;
this.showSlidingOptions = true; this.showSlidingOptions = true;
} }
} }
if(window.innerWidth < 801){ if (window.innerWidth < 801) {
this.hideRefreshBtn = false; this.hideRefreshBtn = false;
this.showSlidingOptions = false; this.showSlidingOptions = false;
} }
else{ else {
this.hideRefreshBtn = true; this.hideRefreshBtn = true;
this.showSlidingOptions = true; this.showSlidingOptions = true;
} }
@@ -120,12 +114,14 @@ export class PublicationsPage implements OnInit {
getDate(date) { getDate(date) {
this.theDate = new Date(date); this.theDate = new Date(date);
return this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear() return this.theDate.getDate() + " de " + (this.months[this.theDate.getMonth()]) + " de " + this.theDate.getFullYear()
} }
getActions() { getActions() {
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,46 +136,93 @@ export class PublicationsPage implements OnInit {
ActionType: data.ActionType, ActionType: data.ActionType,
} }
if(data.ActionType == "Evento") { this.sqliteservice.addactions(folder);
if (data.ActionType == "Evento") {
console.log('Evento', folder)
this.publicationsEventFolderList.push(folder); this.publicationsEventFolderList.push(folder);
} }
else{ else {
console.log('Viagem', folder)
this.publicationsTravelFolderList.push(folder); this.publicationsTravelFolderList.push(folder);
} }
this.showLoader = false; this.showLoader = false;
this.publicationEventFolderStorage.reset(this.publicationsEventFolderList) /* this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList) this.publicationTravelFolderService.reset(this.publicationsTravelFolderList) */
}); });
}); });
} }
async editAction(folderId?: string){ 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") {
this.publicationsEventFolderList.push(folder);
}
else {
this.publicationsTravelFolderList.push(folder);
}
this.showLoader = false;
});
})
}
}
async editAction(folderId?: string) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: EditActionPage, component: EditActionPage,
componentProps:{ componentProps: {
folderId: folderId, folderId: folderId,
}, },
cssClass: 'new-action modal modal-desktop', cssClass: 'new-action modal modal-desktop',
backdropDismiss: true backdropDismiss: true
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(()=>{ modal.onDidDismiss().then(() => {
this.getActions(); this.getActions();
}); });
//this.refreshing() //this.refreshing()
} }
async deleteAction(id?: string){ async deleteAction(id?: string) {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
try { try {
await this.publications.DeletePresidentialAction(id).toPromise(); await this.publications.DeletePresidentialAction(id).toPromise();
this.toastService.successMessage() this.toastService.successMessage()
} catch(e) { } catch (e) {
this.toastService.badRequest() this.toastService.badRequest()
} }
finally { finally {
@@ -189,21 +232,21 @@ export class PublicationsPage implements OnInit {
this.refreshing() this.refreshing()
} }
async AddPublicationFolder(item?:any) { async AddPublicationFolder(item?: any) {
this.closeDesktopComponent(); this.closeDesktopComponent();
if(window.innerWidth <= 1024) { if (window.innerWidth <= 1024) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: NewActionPage, component: NewActionPage,
componentProps:{ componentProps: {
item: item, item: item,
}, },
cssClass: 'new-action modal modal-desktop', cssClass: 'new-action modal modal-desktop',
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(()=>{ modal.onDidDismiss().then(() => {
this.getActions(); this.getActions();
}); });
} else { } else {
@@ -212,12 +255,12 @@ export class PublicationsPage implements OnInit {
} }
goToPublicationsList(folderId: string){ goToPublicationsList(folderId: string) {
this.folderId = folderId this.folderId = folderId
this.idSelected = folderId; this.idSelected = folderId;
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
this.router.navigate(['/home/publications',folderId]); this.router.navigate(['/home/publications', folderId]);
} else { } else {
this.closeDesktopComponent(); this.closeDesktopComponent();
this.folderId = folderId this.folderId = folderId
@@ -256,14 +299,14 @@ export class PublicationsPage implements OnInit {
this.closeDesktopComponent(); this.closeDesktopComponent();
// OpenModal // OpenModal
if( window.innerWidth <= 800){ if (window.innerWidth <= 800) {
/* let item = this.publicationFolderList; */ /* let item = this.publicationFolderList; */
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: ViewPublicationsPage, component: ViewPublicationsPage,
//enterAnimation, //enterAnimation,
//leaveAnimation, //leaveAnimation,
componentProps:{ componentProps: {
folderId:folderId, folderId: folderId,
}, },
cssClass: 'new-action modal modal-desktop', cssClass: 'new-action modal modal-desktop',
backdropDismiss: false backdropDismiss: false
@@ -281,7 +324,7 @@ export class PublicationsPage implements OnInit {
// called from publications details // called from publications details
// Emittter // Emittter
goBackToViewPublications(){ goBackToViewPublications() {
this.closeDesktopComponent(); this.closeDesktopComponent();
this.desktopComponent.showViewPublication = true; this.desktopComponent.showViewPublication = true;
@@ -289,21 +332,21 @@ export class PublicationsPage implements OnInit {
// called from publications details // called from publications details
// Emitters // Emitters
goBackToPubications(){ goBackToPubications() {
this.closeDesktopComponent(); this.closeDesktopComponent();
this.desktopComponent.showViewPublication = true; this.desktopComponent.showViewPublication = true;
} }
// called from edit publication (Emitters only) // called from edit publication (Emitters only)
// Emitters // Emitters
async goBacktoPublicationDetails(){ async goBacktoPublicationDetails() {
this.closeDesktopComponent(); this.closeDesktopComponent();
this.desktopComponent.showPublicationDetail = true; this.desktopComponent.showPublicationDetail = true;
} }
// add new publication or edit publicaton // add new publication or edit publicaton
async addNewPublication({publicationType, folderId, publication}){ async addNewPublication({ publicationType, folderId, publication }) {
this.closeDesktopComponent(); this.closeDesktopComponent();
@@ -319,7 +362,7 @@ export class PublicationsPage implements OnInit {
this.desktopComponent.showAddNewPublication = true; this.desktopComponent.showAddNewPublication = true;
} }
async openPublicationDetails(publicationId: string){ async openPublicationDetails(publicationId: string) {
this.publicationId = publicationId; this.publicationId = publicationId;
@@ -328,11 +371,11 @@ export class PublicationsPage implements OnInit {
} }
async updateDesktopComponent(e?:any){ async updateDesktopComponent(e?: any) {
this.getActions(); this.getActions();
} }
async closeDesktopComponent (xx?: any){ async closeDesktopComponent(xx?: any) {
this.desktopComponent = { this.desktopComponent = {
showViewPublication: false, showViewPublication: false,
@@ -380,10 +423,10 @@ export class PublicationsPage implements OnInit {
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(res => { modal.onDidDismiss().then(res => {
if(res['data']=='edit') { if (res['data'] == 'edit') {
this.closeDesktopComponent(); this.closeDesktopComponent();
this.desktopComponent.showEditActions = true; this.desktopComponent.showEditActions = true;
} else if (res['data']=='delete') { } else if (res['data'] == 'delete') {
setTimeout(() => { setTimeout(() => {
this.getActions(); this.getActions();
}, 1000) }, 1000)
@@ -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',
@@ -22,7 +24,7 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[] = new Array(); publicationList: Publication[] = new Array();
item: PublicationFolder; item: PublicationFolder;
folderId:string; folderId: string;
error: any; error: any;
publicationListStorage = PublicationListStorage publicationListStorage = PublicationListStorage
@@ -31,18 +33,22 @@ 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 => {
console.log(params); console.log(params);
if(params["params"]) { if (params["params"]) {
this.folderId = params["params"].folderId; this.folderId = params["params"].folderId;
// console.log(params["params"]); // console.log(params["params"]);
} }
@@ -53,20 +59,17 @@ export class ViewPublicationsPage implements OnInit {
ngOnInit() { ngOnInit() {
if(typeof(this.folderId) == 'object') { if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId'] this.folderId = this.folderId['ProcessId']
} }
this.getPublicationDetail(); this.getFromDB();
setTimeout(() => {
this.getPublications();
}, 5000);
} }
ngOnChanges() { ngOnChanges() {
if(typeof(this.folderId) == 'object') { if (typeof (this.folderId) == 'object') {
this.folderId = this.folderId['ProcessId'] this.folderId = this.folderId['ProcessId']
} }
@@ -74,7 +77,7 @@ export class ViewPublicationsPage implements OnInit {
this.getPublications(); this.getPublications();
} }
doRefresh =(event) => { doRefresh = (event) => {
setTimeout(() => { setTimeout(() => {
this.getPublicationDetail(); this.getPublicationDetail();
this.getPublications(); this.getPublications();
@@ -96,7 +99,9 @@ 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);
} }
@@ -104,37 +109,86 @@ export class ViewPublicationsPage implements OnInit {
getPublications() { getPublications() {
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;
}, },
(error)=>{ (error) => {
if(error.status == '404'){ if (error.status == '404') {
this.error = 'Sem publicações disponíveis!'; this.error = 'Sem publicações disponíveis!';
this.publicationList= []; this.publicationList = [];
this.publicationListStorage.add(folderId, this.publicationList) this.publicationListStorage.add(folderId, this.publicationList)
} }
this.showLoader = false; this.showLoader = false;
}); });
} }
async AddPublication(publicationType:any, folderId:any) { 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) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: NewPublicationPage, component: NewPublicationPage,
componentProps:{ componentProps: {
publicationType: publicationType, publicationType: publicationType,
folderId: folderId, folderId: folderId,
}, },
@@ -142,19 +196,19 @@ export class ViewPublicationsPage implements OnInit {
backdropDismiss: false backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(()=>{ modal.onDidDismiss().then(() => {
this.doRefresh(event); this.doRefresh(event);
}); });
} }
goToPublicationDetail(publicationId:string){ goToPublicationDetail(publicationId: string) {
this.router.navigate(['/home/publications/view-publications', this.folderId, publicationId]); this.router.navigate(['/home/publications/view-publications', this.folderId, publicationId]);
} }
async viewPublicationDetail(publicationId:string) { async viewPublicationDetail(publicationId: string) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: PublicationDetailPage, component: PublicationDetailPage,
componentProps:{ componentProps: {
publicationId: publicationId, publicationId: publicationId,
folderId: this.folderId, folderId: this.folderId,
}, },
@@ -162,7 +216,7 @@ export class ViewPublicationsPage implements OnInit {
// backdropDismiss: false // backdropDismiss: false
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(()=>{ modal.onDidDismiss().then(() => {
this.getPublications(); this.getPublications();
}); });
} }
+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)
+73 -68
View File
@@ -3,8 +3,9 @@ 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 {
url: string, url: string,
type: 'reflect' | 'emit' type: 'reflect' | 'emit'
@@ -20,23 +21,24 @@ export interface wss{
providedIn: 'root' providedIn: 'root'
}) })
class SynchroService { class SynchroService {
[x: string]: any; [x: string]: any;
private connection!: WebSocket; private connection!: WebSocket;
private id: string = uuidv4(); private id: string = uuidv4();
public conected = false public conected = false
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' | '',
object?: string object?: string
funx: Function funx: Function
}[] = [] }[] = []
private msgQueue = [] private msgQueue = []
constructor() { constructor() {
// alert(SessionStore.user.FullName) // alert(SessionStore.user.FullName)
} }
@@ -46,13 +48,13 @@ class SynchroService {
setUrl() { setUrl() {
let header ={ let header = {
id:'1234', id: '1234',
bluePrint: '12312123', bluePrint: '12312123',
jwt: uuidv4() jwt: uuidv4()
} }
let wss: wss ={ let wss: wss = {
header, header,
url: 'wss://sychro-offline.herokuapp.com/ws/some_url/', url: 'wss://sychro-offline.herokuapp.com/ws/some_url/',
type: 'reflect' type: 'reflect'
@@ -61,7 +63,7 @@ class SynchroService {
this.url = `${wss.url}${wss.header.id}/${wss.header.jwt}/${wss.header.bluePrint}/${this.id}/` this.url = `${wss.url}${wss.header.id}/${wss.header.jwt}/${wss.header.bluePrint}/${this.id}/`
} }
registerCallback(type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notifications' | 'Notification', funx: Function, object='') { registerCallback(type: 'Offline' | 'Online' | 'Onmessage' | 'Chat' | 'Notifications' | 'Notification', funx: Function, object = '') {
this.callBacks.push({ this.callBacks.push({
type, type,
funx, funx,
@@ -69,32 +71,32 @@ class SynchroService {
}) })
} }
connect() { connect() {
this.connection = new WebSocket(this.url); this.connection = new WebSocket(this.url);
// bind function // bind function
this.connection.onopen = this.onopen; this.connection.onopen = this.onopen;
this.connection.onmessage = this.onmessage; this.connection.onmessage = this.onmessage;
this.connection.onclose = this.onclose; this.connection.onclose = this.onclose;
this.connection.onerror = this.onerror; this.connection.onerror = this.onerror;
} }
private onopen = () =>{ private onopen = () => {
if(!this.conected) { //if (this._connected === true) {
this.BackgroundService.online() this.BackgroundService.online()
this.callBacks.forEach((e)=>{ console.log('Online', this._connected)
if(e.type == 'Online') { this.callBacks.forEach((e) => {
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
@@ -103,20 +105,20 @@ class SynchroService {
object.splice(index, 1); object.splice(index, 1);
}) })
} }
public $send(object: any) { public $send(object: any) {
if(!this._connected) { // save data to send when back online if (!this._connected) { // save data to send when back online
this.msgQueue.push(object) this.msgQueue.push(object)
} }
let payload = { let payload = {
message: JSON.stringify(object) || '{"person.adress.country":"1Angola"}', message: JSON.stringify(object) || '{"person.adress.country":"1Angola"}',
username: SessionStore.user.FullName, username: SessionStore.user.FullName,
idConnection: this.id idConnection: this.id
} }
let sendData = JSON.stringify(payload); let sendData = JSON.stringify(payload);
console.log(sendData) console.log(sendData)
@@ -124,7 +126,7 @@ class SynchroService {
this.connection.send(sendData); this.connection.send(sendData);
} }
private onmessage = async (event: any)=> { private onmessage = async (event: any) => {
let data = JSON.parse(event.data) let data = JSON.parse(event.data)
@@ -133,30 +135,30 @@ class SynchroService {
const idConnection = payload.idConnection const idConnection = payload.idConnection
const username = payload.username const username = payload.username
if(idConnection != this.id ) { if (idConnection != this.id) {
if(window['platform'].is('desktop') || this.platform.is('mobileweb')) {} if (window['platform'].is('desktop') || this.platform.is('mobileweb')) { }
else return false else return false
if(environment.production) return false if (environment.production) return false
this.callBacks.forEach((e)=> { this.callBacks.forEach((e) => {
if(payload.message[0]) { if (payload.message[0]) {
if(payload.message[0].Service && payload.message[0].Object && payload.message[0].IdObject) { if (payload.message[0].Service && payload.message[0].Object && payload.message[0].IdObject) {
if(e.type == '' && !e.object) { if (e.type == '' && !e.object) {
if(username == SessionStore.user.FullName) { if (username == SessionStore.user.FullName) {
e.funx(payload.message, data) e.funx(payload.message, data)
} }
} }
if(e.type == 'Notifications' ) { if (e.type == 'Notifications') {
e.funx(payload.message, data) e.funx(payload.message, data)
} }
} }
} else if(payload.message.Service && payload.message.Object && payload.message.IdObject) { } else if (payload.message.Service && payload.message.Object && payload.message.IdObject) {
if(e.type == 'Notification' && e.object == payload.message.Object || e.type == 'Notification' && e.object == 'any' ) { if (e.type == 'Notification' && e.object == payload.message.Object || e.type == 'Notification' && e.object == 'any') {
e.funx(payload.message, data) e.funx(payload.message, data)
} }
} }
@@ -165,41 +167,44 @@ class SynchroService {
} }
this.callback() this.callback()
} }
private onclose=(event:any)=> { private onclose = (event: any) => {
setTimeout(() => { console.log('Websocket close')
if (event.wasClean) { setTimeout(() => {
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`); if (event.wasClean) {
} else { console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
// e.g. server process killed or network down } else {
// event.code is usually 1006 in this case // e.g. server process killed or network down
console.log('[close] Connection died'); // event.code is usually 1006 in this case
console.log('[close] Connection died');
console.log('Reconnect') console.log('Reconnect')
if(this._connected) {
// if (this._connected === false) {
this.BackgroundService.offline(); this.BackgroundService.offline();
this.callBacks.forEach((e)=>{ console.log('Offline', this._connected)
if(e.type == 'Offline') { this.callBacks.forEach((e) => {
if (e.type == 'Offline') {
e.funx() e.funx()
} }
}) })
} //}
// status // status
this._connected = false this._connected = false
// reconnect // reconnect
this.connect() this.connect()
}
}, 100);
}
private onerror=(event: any)=>{ }
console.log(`[error] ${event.message}`); }, 100);
} }
private onerror = (event: any) => {
console.log(`[error] ${event.message}`);
}
} }
+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));
});
}
}
+138 -114
View File
@@ -5,7 +5,7 @@ import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants'; import { AuthConnstants } from 'src/app/config/auth-constants';
import { Token } from '../models/token.model'; import { Token } from '../models/token.model';
import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular'; import { ModalController, AlertController, AnimationController, Platform } from '@ionic/angular';
import { NavigationExtras,Router } from '@angular/router'; import { NavigationExtras, Router } from '@angular/router';
import { ToastService } from './toast.service'; import { ToastService } from './toast.service';
import MFPPush from 'ibm-mfp-web-push'; import MFPPush from 'ibm-mfp-web-push';
@@ -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...");
@@ -55,17 +69,129 @@ export class WebNotificationsService {
}) })
.catch((err) => { .catch((err) => {
console.log("WEB Registration Failed" + err); console.log("WEB Registration Failed" + err);
}); }); */
} }
async onReceviNotificationWeb() { register(){
MFPPush.registerDevice()
.then((res) => {
console.log("WEB Successfully Registered Device...", res);
})
.catch((err) => {
console.log("WEB Registration Failed" + err);
});
}
async onReceviNotificationWeb() {
if (window['WLAuthorizationManager']) {
if (window['WLAuthorizationManager'].obtainAccessToken) {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
MFPPush.registerNotificationsCallback(notificationReceived);
},
function (failureResponse) {
console.log("Push notification failure intialized: " + failureResponse);
}
);
var notificationReceived = (message) => {
console.log(message);
var data = JSON.parse(message.payload);
console.log(data.Service);
console.log(data.IdObject);
console.log(data.Object);
if (message.actionName) {
//this.notificatinsRoutes(data);
console.log("Web notification")
} else {
console.log("Web notification")
//this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
}
}
}
/* getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
return this.http.get<Token[]>(`${geturl}`);
} */
/* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token'; */
/*
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
if(window['WLAuthorizationManager']) { MFPPush.initialize(
if(window['WLAuthorizationManager'].obtainAccessToken) { function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
},
function (failureResponse) {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
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));
}
);
}
} */
/*
async onReceviNotification() {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => { (token) => {
console.log('Push Notification: Success ' + token); console.log('Push Notification: Success ' + token);
MFPPush.initialize( MFPPush.initialize(
function (successResponse) { function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse); console.log("Push notification Successfully intialized: " + successResponse);
@@ -81,122 +207,20 @@ async onReceviNotificationWeb() {
console.log(data.Service); console.log(data.Service);
console.log(data.IdObject); console.log(data.IdObject);
console.log(data.Object); console.log(data.Object);
if(message.actionName){ if(message.actionName){
//this.notificatinsRoutes(data); this.notificatinsRoutes(data);
console.log("Web notification")
} else { } else {
console.log("Web notification") this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
//this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
} }
} }
}, (error) => { }, (error) => {
console.log('Push notification recived: failure ' + error.responseText); console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
} }
); );
} } */
}
}
/* getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
return this.http.get<Token[]>(`${geturl}`);
} */
/* getAndpostToken(username) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
console.log('Notifications not supported')
} else {
const geturl = environment.apiURL + 'notifications/token'; */
/*
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully Service intialized: " + successResponse);
},
function (failureResponse) {
console.log("Push notification failure Service intialized: " + failureResponse);
}
);
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));
}
);
}
} */
/*
async onReceviNotification() {
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
(token) => {
console.log('Push Notification: Success ' + token);
MFPPush.initialize(
function (successResponse) {
console.log("Push notification Successfully intialized: " + successResponse);
MFPPush.registerNotificationsCallback(notificationReceived);
},
function (failureResponse) {
console.log("Push notification failure intialized: " + failureResponse);
}
);
var notificationReceived = (message) => {
console.log(message);
var data = JSON.parse(message.payload);
console.log(data.Service);
console.log(data.IdObject);
console.log(data.Object);
if(message.actionName){
this.notificatinsRoutes(data);
} else {
this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
}
}
}, (error) => {
console.log('Push notification recived: failure ' + error.responseText);
console.log(JSON.stringify(error));
}
);
} */
/* notificatinsRoutes = (data) => { /* notificatinsRoutes = (data) => {
if (data.Service === "agenda") { if (data.Service === "agenda") {
@@ -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>

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