diff --git a/src/app/Rules/expedientes.service.ts b/src/app/Rules/expedientes.service.ts index 3a5d4c474..16af6d7e5 100644 --- a/src/app/Rules/expedientes.service.ts +++ b/src/app/Rules/expedientes.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; +import { ProcessesService } from '../services/processes.service'; import { ProcessDocumentService } from './process-document.service'; @Injectable({ @@ -9,11 +10,21 @@ export class ExpedientesService { constructor( private iab: InAppBrowser, - private processDocumentService: ProcessDocumentService + private processDocumentService: ProcessDocumentService, + private processes: ProcessesService, ) { } viewDocument({DocId, ApplicationId}) { this.processDocumentService.viewDocument({DocId, ApplicationId}) } + CompleteTask({body}) { + return this.processes.CompleteTask(body) + } + + + UpdateTaskStatus({FolderId}){ + return this.processes.UpdateTaskStatus(FolderId) + } + } diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index 7c4bb7607..fd9400e86 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -50,6 +50,7 @@ export class CreateProcessPage implements OnInit { ]; taskType:string; task: any; + fulltask: any taskParticipants: any = []; taskParticipantsCc: any = []; @@ -117,7 +118,7 @@ export class CreateProcessPage implements OnInit { SourceId: this.task.workflowInstanceDataFields.SourceID, //FolderId DeadlineType: '', SubjectTypes: this.selectedTypes, - NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber, + NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber || this.fulltask.workflowInstanceDataFields.DispatchNumber, }; this.postData.DispatchFolder = this.dispatchFolder; diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index 70afc1726..325c266b7 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -403,6 +403,7 @@ export class DespachoPrPage implements OnInit { taskAction: taskAction, task: task, profile: this.profile, + fulltak: this.fulltask }, cssClass: classs, }); diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index e62d88b1e..a1f203bfb 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -343,6 +343,7 @@ export class DespachoPage implements OnInit { taskAction: taskAction, task: task, profile: this.profile, + fulltask: this.fulltask }, cssClass: classs, }); diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index adb7063d5..30e702383 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -399,7 +399,7 @@ export class ExpedienteDetailPage implements OnInit { }); } - async distartExpedientModal(body:any){ + async distartExpedientModal(body:any) { const modal = await this.modalController.create({ component: DiscartExpedientModalPage, componentProps: { @@ -441,11 +441,11 @@ export class ExpedienteDetailPage implements OnInit { } } else{ - if(res['data']== 'Yes'){ + if(res['data']== 'Yes') { const loader = this.toastService.loading() try { - await this.processes.CompleteTask(body).toPromise(); + await this.expedientesService.CompleteTask(body).toPromise(); //this.toastService.successMessage('Processo descartado'); this.goBack(); } catch (error) { @@ -455,7 +455,7 @@ export class ExpedienteDetailPage implements OnInit { } } - else if(res['data'] == 'No'){ + else if(res['data'] == 'No') { console.log('Update'); const loader = this.toastService.loading() try { diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts index 570bef65f..b6b1dbc3c 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts @@ -310,6 +310,7 @@ export class PedidoPage implements OnInit { componentProps: { taskAction: taskAction, task: this.fulltask, + fulltask: this.fulltask }, cssClass: classs, }); diff --git a/src/app/pipes/search-document.pipe.ts b/src/app/pipes/search-document.pipe.ts index da6e5da27..e2cf442a8 100644 --- a/src/app/pipes/search-document.pipe.ts +++ b/src/app/pipes/search-document.pipe.ts @@ -15,7 +15,6 @@ export class SearchDocumentPipe implements PipeTransform { transformToAttachment(document: SearchDocument): Attachments[] { const attachments = [] - console.log('document', document) if(document.ApplicationType == 361) { attachments.push({ ApplicationId: 361, diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index a08e0a10f..35274bd9c 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -50,50 +50,54 @@ export class NotificationsService { const geturl = environment.apiURL + 'notifications/token'; - 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(`${geturl}`, body, { headers }).subscribe(data => { - console.log('TOKEN USER MIDLE', data); - }) + 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(`${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)); + } + ); + } + - }); - }, - function (failureResponse) { - console.log("Successfully failue: " + JSON.stringify(failureResponse)); - } - ); - }, (error) => { - console.log('Push notification recived: failure ' + error.responseText); - console.log(JSON.stringify(error)); - } - ); } } @@ -105,46 +109,90 @@ export class NotificationsService { } else { const geturl = environment.apiURL + 'notifications/token'; + 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(`${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() { + 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); + console.log("Push notification Successfully intialized: " + successResponse); + window['MFPPush'].registerNotificationsCallback(notificationReceived); }, function (failureResponse) { - console.log("Push notification failure Service intialized: " + failureResponse); + console.log("Push notification failure 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(`${geturl}`, body, { headers }).subscribe(data => { - console.log('TOKEN USER MIDLE', data); - }) - }); - - }); */ - }, - function (failureResponse) { - console.log("Successfully failue: " + JSON.stringify(failureResponse)); + var notificationReceived = (message) => { + //this.jsonstore.createCollection('Notifications',message); + this.DataArray.push(message) + this.storageService.store("Notifications",JSON.stringify(this.DataArray)) + + 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)); @@ -154,45 +202,6 @@ export class NotificationsService { } - async onReceviNotification() { - window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then( - (token) => { - console.log('Push Notification: Success ' + token); - - window['MFPPush'].initialize( - function (successResponse) { - console.log("Push notification Successfully intialized: " + successResponse); - window['MFPPush'].registerNotificationsCallback(notificationReceived); - }, - function (failureResponse) { - console.log("Push notification failure intialized: " + failureResponse); - } - ); - var notificationReceived = (message) => { - //this.jsonstore.createCollection('Notifications',message); - this.DataArray.push(message) - this.storageService.store("Notifications",JSON.stringify(this.DataArray)) - - 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) => { if (data.Service === "agenda") { this.zone.run(() => this.router.navigate(['/home/agenda', data.IdObject, 'agenda'])); diff --git a/src/app/services/webnotifications.service.ts b/src/app/services/webnotifications.service.ts index 62b85d74d..87de75dd7 100644 --- a/src/app/services/webnotifications.service.ts +++ b/src/app/services/webnotifications.service.ts @@ -47,38 +47,41 @@ export class WebNotificationsService { } async onReceviNotificationWeb() { - 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); + 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); + } else { + //this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data); + } + } - ); - 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)); } - }, (error) => { - console.log('Push notification recived: failure ' + error.responseText); - console.log(JSON.stringify(error)); - } - ); + ); + } + } /* getTokenByUserIdAndId(user, userID) { diff --git a/src/app/shared/popover/despachos-options/despachos-options.page.ts b/src/app/shared/popover/despachos-options/despachos-options.page.ts index c91f5d4bc..0f0a504fe 100644 --- a/src/app/shared/popover/despachos-options/despachos-options.page.ts +++ b/src/app/shared/popover/despachos-options/despachos-options.page.ts @@ -53,6 +53,7 @@ export class DespachosOptionsPage implements OnInit { componentProps: { taskAction: taskAction, task: task, + fulltask: this.fulltask }, cssClass: classs, }); diff --git a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts index 03e3b311d..4301cab84 100644 --- a/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts +++ b/src/app/shared/popover/despachos-pr-options/despachos-pr-options.page.ts @@ -78,6 +78,7 @@ export class DespachosPrOptionsPage implements OnInit { taskAction: taskAction, task: task, profile: this.profile, + fulltask: this.fulltask }, cssClass: classs, }); diff --git a/src/assets/js/index.js b/src/assets/js/index.js index d99341323..ab6332424 100644 --- a/src/assets/js/index.js +++ b/src/assets/js/index.js @@ -1,33 +1,37 @@ function wlCommonInit() { + + if(window['WLAuthorizationManager'].obtainAccessToken) { + window['WLAuthorizationManager'].obtainAccessToken("").then( + (token) => { + console.log('MobileFirst Server connect: Success ' + token); + + var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/", + WLResourceRequest.GET + ); + + resourceRequest.setQueryParameter("name", "world"); + resourceRequest.send().then( + (response) => { + // Will display "Hello world" in an alert dialog. + console.log("Connect with JavaAdapter Success: " + response.responseText); + //this.MFPushNotification(); + }, + (error) => { + alert("Connect with JavaAdapter Failure: " + JSON.stringify(error)); + } + ); + }, (error) => { + console.log('MobileFirst Server connect: failure ' + error.responseText); + console.log(JSON.stringify(error)) + /* this.zone.run(() => { + alert("Bummer..."); + alert("Failed to connect to MobileFirst Server"); + }); */ + } + ); + } - window['WLAuthorizationManager'].obtainAccessToken("").then( - (token) => { - console.log('MobileFirst Server connect: Success ' + token); - var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/", - WLResourceRequest.GET - ); - - resourceRequest.setQueryParameter("name", "world"); - resourceRequest.send().then( - (response) => { - // Will display "Hello world" in an alert dialog. - console.log("Connect with JavaAdapter Success: " + response.responseText); - //this.MFPushNotification(); - }, - (error) => { - alert("Connect with JavaAdapter Failure: " + JSON.stringify(error)); - } - ); - }, (error) => { - console.log('MobileFirst Server connect: failure ' + error.responseText); - console.log(JSON.stringify(error)) - /* this.zone.run(() => { - alert("Bummer..."); - alert("Failed to connect to MobileFirst Server"); - }); */ - } - );