add popup message

This commit is contained in:
Peter Maquiran
2023-09-22 15:17:25 +01:00
parent 97d33370fc
commit 1df6c308b2
23 changed files with 360 additions and 101 deletions
+14
View File
@@ -171,6 +171,7 @@
"uuidv4": "^6.2.11", "uuidv4": "^6.2.11",
"wordcloud": "^1.1.2", "wordcloud": "^1.1.2",
"ws": "^7.4.6", "ws": "^7.4.6",
"zod": "^3.22.2",
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
"devDependencies": { "devDependencies": {
@@ -40799,6 +40800,14 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/zod": {
"version": "3.22.2",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.22.2.tgz",
"integrity": "sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg==",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
},
"node_modules/zone.js": { "node_modules/zone.js": {
"version": "0.11.4", "version": "0.11.4",
"license": "MIT", "license": "MIT",
@@ -68502,6 +68511,11 @@
"yocto-queue": { "yocto-queue": {
"version": "0.1.0" "version": "0.1.0"
}, },
"zod": {
"version": "3.22.2",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.22.2.tgz",
"integrity": "sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg=="
},
"zone.js": { "zone.js": {
"version": "0.11.4", "version": "0.11.4",
"requires": { "requires": {
+2 -1
View File
@@ -185,6 +185,7 @@
"uuidv4": "^6.2.11", "uuidv4": "^6.2.11",
"wordcloud": "^1.1.2", "wordcloud": "^1.1.2",
"ws": "^7.4.6", "ws": "^7.4.6",
"zod": "^3.22.2",
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
"devDependencies": { "devDependencies": {
@@ -293,4 +294,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"
} }
+4
View File
@@ -288,6 +288,10 @@ const routes = [
}, },
{ {
path: 'ask-modal', path: 'ask-modal',
loadChildren: () => import('./modals/ask-modal/ask-modal.module').then( m => m.AskModalPageModule)
},
{
path: 'popup-question',
loadChildren: () => import('./modals/popup-question/popup-question.module').then( m => m.PopupQuestionPageModule) loadChildren: () => import('./modals/popup-question/popup-question.module').then( m => m.PopupQuestionPageModule)
} }
+2 -1
View File
@@ -86,6 +86,7 @@ import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-opt
import { CreateProcessPageModule } from './modals/create-process/create-process.module'; import { CreateProcessPageModule } from './modals/create-process/create-process.module';
import { CreateProcessPage } from './modals/create-process/create-process.page'; import { CreateProcessPage } from './modals/create-process/create-process.page';
import { LoggingInterceptorService } from './services/logging-interceptor.service'; import { LoggingInterceptorService } from './services/logging-interceptor.service';
import { PopupQuestionPipe } from './modals/popup-question.pipe';
// import { ServiceWorkerModule } from '@angular/service-worker'; // import { ServiceWorkerModule } from '@angular/service-worker';
@@ -116,7 +117,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
SentrySibling.init SentrySibling.init
); );
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent, PopupQuestionPipe],
imports: [BrowserModule, imports: [BrowserModule,
CommonModule, CommonModule,
FormsModule, FormsModule,
+1 -1
View File
@@ -37,7 +37,7 @@
<ion-tab-button *ngIf="p.userPermission([permissionList.Chat.access])" tab="chat" [class.active]="ActiveTabService.pages.chat"> <ion-tab-button *ngIf="p.userPermission([permissionList.Chat.access])" tab="chat" [class.active]="ActiveTabService.pages.chat">
<ion-icon *ngIf="!ActiveTabService.pages.chat" class="nav-icon font-30-em" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon> <ion-icon *ngIf="!ActiveTabService.pages.chat" class="nav-icon font-30-em" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
<ion-icon *ngIf="ActiveTabService.pages.chat" class="nav-icon font-30-em" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon> <ion-icon *ngIf="ActiveTabService.pages.chat" class="nav-icon font-30-em" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
<ion-label class="font-12-em">Chat</ion-label> <ion-label class="font-12-em">Chat ...</ion-label>
</ion-tab-button> </ion-tab-button>
</ion-tab-bar> </ion-tab-bar>
+2 -2
View File
@@ -138,7 +138,7 @@ export class HomePage implements OnInit {
} }
goto(url) { goto(url) {
this.router.navigate([url], { replaceUrl: true }) this.router.navigateByUrl(url)
} }
refreshing() { } refreshing() { }
@@ -352,4 +352,4 @@ export class HomePage implements OnInit {
}) })
} }
} }
@@ -0,0 +1,8 @@
import { PopupQuestionPipe } from './popup-question.pipe';
describe('PopupQuestionPipe', () => {
it('create an instance', () => {
const pipe = new PopupQuestionPipe();
expect(pipe).toBeTruthy();
});
});
+12
View File
@@ -0,0 +1,12 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'popupQuestion'
})
export class PopupQuestionPipe implements PipeTransform {
transform(value: unknown, ...args: unknown[]): unknown {
return null;
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PopupQuestionPage } from './popup-question.page';
const routes: Routes = [
{
path: '',
component: PopupQuestionPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PopupQuestionPageRoutingModule {}
@@ -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 { PopupQuestionPageRoutingModule } from './popup-question-routing.module';
import { PopupQuestionPage } from './popup-question.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PopupQuestionPageRoutingModule
],
declarations: [PopupQuestionPage]
})
export class PopupQuestionPageModule {}
@@ -0,0 +1,20 @@
<ion-header class="ion-no-border">
</ion-header>
<ion-content>
<div class="header-content width-100">
<div class="header-title d-flex width-100">
<h3>{{ title }}</h3>
</div>
</div>
<div class="header-body width-100">
<p>{{ message }}</p>
</div>
</ion-content>
<ion-footer>
<div class="buttons width-100">
<button class="btn-ok-medium" shape="round" (click)="close()">Não</button>
<button class="btn-ok-medium" shape="round" (click)="save()">Sim</button>
</div>
</ion-footer>
@@ -0,0 +1,27 @@
@import '~src/function.scss';
ion-content{
--padding-top:15px;
--padding-start: 15px;
--padding-end: 15px;
}
.header-content{
overflow: hidden;
margin: 0 auto;
align-items: center;
justify-content: center;
}
.header-title{
font-family: Roboto;
font-size: rem(20);
color:#000;
margin: 0 5px 0 5px;
}
.header-body{
margin: 0 5px 0 5px;
}
.buttons{
display: flex;
justify-content: space-between;
padding: 15px 0 15px 0;
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { PopupQuestionPage } from './popup-question.page';
describe('PopupQuestionPage', () => {
let component: PopupQuestionPage;
let fixture: ComponentFixture<PopupQuestionPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ PopupQuestionPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(PopupQuestionPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,50 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
// import { z } from "zod";
@Component({
selector: 'app-popup-question',
templateUrl: './popup-question.page.html',
styleUrls: ['./popup-question.page.scss'],
})
export class PopupQuestionPage implements OnInit {
title = 'Deseja arquivar este expediente?'
message = 'Nota: Ao Efetuar esta operação, o tratamento deste expediente não poderá ser realizado a partir da caixa de correspondência'
constructor(
private modalController: ModalController,
private navParams: NavParams,
) {
const parameters: any = this.navParams.data
// const parametersValidation = PopUpQuestionParametersSchema.safeParse(parameters)
// if(parametersValidation.success) {
this.title = parameters.title
this.message = parameters.message
// } else {
// throw('parameters error')
// }
}
ngOnInit() {}
close() {
this.modalController.dismiss('No');
}
save() {
this.modalController.dismiss('Yes');
}
}
// const PopUpQuestionParametersSchema = z.object({
// title: z.string(),
// message: z.string(),
// });
// export type PopUpQuestionParameters = z.infer<typeof PopUpQuestionParametersSchema>;
@@ -1,7 +1,7 @@
<ion-content class="container-wrapper"> <ion-content class="container-wrapper">
<div class="main-content d-flex height-100 overflow-hidden"> <div class="main-content d-flex height-100 overflow-hidden">
<app-task-details <app-task-details
*ngIf="task" *ngIf="task"
[task]=task [task]=task
[intervenientes]=intervenientes [intervenientes]=intervenientes
@@ -12,7 +12,7 @@
(goBack)= goBack() (goBack)= goBack()
(viewDocument)=viewDocument($event) (viewDocument)=viewDocument($event)
class="content d-flex flex-column" class="content d-flex flex-column"
></app-task-details> ></app-task-details>
<div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto"> <div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto">
@@ -21,7 +21,7 @@
<div class="solid"></div> <div class="solid"></div>
</div> </div>
<div class="buttons"> <div class="buttons">
<button (click)="openAddNoteModal('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button> <button class="btn-cancel" shape="round" >Arquivar</button>
<!-- <div class="solid"></div> --> <!-- <div class="solid"></div> -->
</div> </div>
<div class="buttons"> <div class="buttons">
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ModalController, PopoverController } from '@ionic/angular'; import { ModalController, PopoverController, ToastController } from '@ionic/angular';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { momentG } from 'src/plugin/momentG'; import { momentG } from 'src/plugin/momentG';
@@ -17,6 +17,7 @@ import { CreateProcessPage } from 'src/app/modals/create-process/create-process.
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page'; import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page'; import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page';
import { PopupQuestionPage } from 'src/app/modals/popup-question/popup-question.page';
@Component({ @Component({
selector: 'app-diploma-assinar', selector: 'app-diploma-assinar',
@@ -50,7 +51,8 @@ export class DiplomaAssinarPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle, private httpErroHandle: HttpErrorHandle,
private despachoService: DespachoService, private despachoService: DespachoService,
public TaskService: TaskService public TaskService: TaskService,
private toastController: ToastController
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) { if(params["params"].SerialNumber) {
@@ -103,7 +105,7 @@ export class DiplomaAssinarPage implements OnInit {
this.processes.GetTask(serial).subscribe(res => { this.processes.GetTask(serial).subscribe(res => {
this.TaskService.loadDiplomas(); this.TaskService.loadDiplomas();
this.task = { this.task = {
"SerialNumber": res.serialNumber, "SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject, "Folio": res.workflowInstanceDataFields.Subject,
@@ -149,7 +151,7 @@ export class DiplomaAssinarPage implements OnInit {
this.cc = users.filter(user=>{ this.cc = users.filter(user=>{
return user.Type == 'CC'; return user.Type == 'CC';
}); });
}); });
this.getDocumentDetails(this.task.FolderId, '361'); this.getDocumentDetails(this.task.FolderId, '361');
@@ -207,8 +209,8 @@ export class DiplomaAssinarPage implements OnInit {
getDocumentDetails(forlderId:string, applicationId:string) { getDocumentDetails(forlderId:string, applicationId:string) {
this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{ this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{
this.attachments = res.Documents; this.attachments = res.Documents;
}) })
} }
@@ -242,32 +244,53 @@ export class DiplomaAssinarPage implements OnInit {
} }
async AssinarDraft() { async AssinarDraft() {
let body = {
"InstanceId": this.task.InstanceID,
"FolderId": this.task.FolderID,
"DraftIds": this.DraftIds,
"OriginalFileName": this.DraftNames
}
const loader = this.toastService.loading()
try { const modal = await this.modalController.create({
await this.processes.presidentialActionsSignature(body).toPromise() component: PopupQuestionPage,
componentProps: {
title: 'Deseja assinar este Diploma?',
message: 'Nota: Ao Efetuar esta operação, o tratamento deste diploma não poderá ser realizado a partir da caixa de correspondência'
},
cssClass: "popup-question discart-expedient-modal",
backdropDismiss: true
});
await this.Assinar(); modal.onDidDismiss().then(async (res) => {
this.TaskService.loadDiplomas(); const data = res.data
this.goBack(); if(data == "Yes") {
} catch (error) { let body = {
this.httpErroHandle.httpStatusHandle(error) "InstanceId": this.task.InstanceID,
} "FolderId": this.task.FolderID,
finally { "DraftIds": this.DraftIds,
loader.remove() "OriginalFileName": this.DraftNames
} }
const loader = this.toastService.loading()
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.Assinar();
this.TaskService.loadDiplomas();
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
}, (error) => {
console.log(error)
});
await modal.present();
} }
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'
@@ -363,7 +386,7 @@ export class DiplomaAssinarPage implements OnInit {
}); });
await modal.present(); await modal.present();
modal.onDidDismiss().then(async (res) => { modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') { if (res['data'] == 'openDiscart') {
await this.distartExpedientModal(); await this.distartExpedientModal();
@@ -376,7 +399,7 @@ export class DiplomaAssinarPage implements OnInit {
} }
async distartExpedientModal() { async distartExpedientModal() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
@@ -392,7 +415,7 @@ export class DiplomaAssinarPage implements OnInit {
modal.onDidDismiss().then(res => { modal.onDidDismiss().then(res => {
if (res['data'] == 'close') { if (res['data'] == 'close') {
this.close(); this.close();
/* /*
this.close(); this.close();
this.openMenu(); */ this.openMenu(); */
} }
+8 -7
View File
@@ -74,13 +74,14 @@ export class ChatSystemService {
* when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish. * when the connection is lost the subscribe is also lost, so we have to subscribe again when reconnection is establish.
*/ */
await this.chatService.refreshtoken(); this.RochetChatConnectorService.setStatus('online')
await this.getUser(); this.getUserStatus();
this.RochetChatConnectorService.setStatus('online') await this.chatService.refreshtoken();
await this.getAllRooms(); this.getUser();
this.subscribeToRoom(); this.getAllRooms();
// this.subscribeToRoom();
this.getUserStatus(); //
if(this.currentRoom) { if(this.currentRoom) {
this.currentRoom.loadHistory({forceUpdate: true}) this.currentRoom.loadHistory({forceUpdate: true})
@@ -19,7 +19,7 @@ export class RochetChatConnectorService {
} }
reConnect() { reConnect() {
} }
connect() { connect() {
@@ -67,7 +67,7 @@ export class RochetChatConnectorService {
} }
const requestId = uuidv4() const requestId = uuidv4()
// //
const message = { const message = {
msg: "method", msg: "method",
method: "login", method: "login",
@@ -83,12 +83,12 @@ export class RochetChatConnectorService {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// //
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
// //
if(message.id == requestId ) { // same request send if(message.id == requestId ) { // same request send
// //
// //
if(message.result) { if(message.result) {
if(message.result.token) { if(message.result.token) {
this.isLogin = true this.isLogin = true
@@ -99,11 +99,11 @@ export class RochetChatConnectorService {
}, 10) }, 10)
resolve(message) resolve(message)
// //
} }
} else { } else {
this.isLogin = false this.isLogin = false
// //
reject(message) reject(message)
} }
@@ -118,7 +118,7 @@ export class RochetChatConnectorService {
getRooms(roomOlder = 1480377601) { getRooms(roomOlder = 1480377601) {
//const requestId = uuidv4() //const requestId = uuidv4()
const requestId = uuidv4() const requestId = uuidv4()
const message = { const message = {
@@ -219,7 +219,7 @@ export class RochetChatConnectorService {
}] }]
} }
// //
this.ws.send({message, requestId}); this.ws.send({message, requestId});
@@ -325,7 +325,7 @@ export class RochetChatConnectorService {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId ) { // same request send if(message.id == requestId ) { // same request send
resolve(message) resolve(message)
// //
return true return true
} }
@@ -548,7 +548,7 @@ export class RochetChatConnectorService {
return new Promise<chatHistory>((resolve, reject) => { return new Promise<chatHistory>((resolve, reject) => {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
// //
if(message.id == requestId ) { // same request send if(message.id == requestId ) { // same request send
resolve(message) resolve(message)
return true return true
@@ -746,7 +746,7 @@ export class RochetChatConnectorService {
registerCallback:(params: wsCallbacksParams) => { registerCallback:(params: wsCallbacksParams) => {
let id = params.requestId || params.key || uuidv4() let id = params.requestId || params.key || uuidv4()
// //
this.wsCallbacks[id] = params this.wsCallbacks[id] = params
this.n++ this.n++
return id return id
@@ -758,8 +758,13 @@ export class RochetChatConnectorService {
this.socket.onmessage = this.ws.onmessage; this.socket.onmessage = this.ws.onmessage;
this.socket.onclose = this.ws.onclose; this.socket.onclose = this.ws.onclose;
this.socket.onerror = this.ws.onerror; this.socket.onerror = this.ws.onerror;
console.log(' === on open connection ===')
}, },
onopen: async ()=> { onopen: async ()=> {
console.log('===socket on connection open===')
this.ws.connected = true this.ws.connected = true
this.backgroundservice.online(); this.backgroundservice.online();
@@ -802,7 +807,7 @@ export class RochetChatConnectorService {
send: ({message, requestId = uuidv4(), loginRequired = true}:send) => { send: ({message, requestId = uuidv4(), loginRequired = true}:send) => {
if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online
// //
// //
this.wsMsgQueue[requestId] = {message, requestId, loginRequired} this.wsMsgQueue[requestId] = {message, requestId, loginRequired}
@@ -814,7 +819,7 @@ export class RochetChatConnectorService {
}, },
onmessage: async (event: any)=> { onmessage: async (event: any)=> {
this.backgroundservice.online(); this.backgroundservice.online();
const data = JSON.parse(event.data) const data = JSON.parse(event.data)
@@ -837,6 +842,7 @@ export class RochetChatConnectorService {
onclose: async (event: any)=> { onclose: async (event: any)=> {
this.ws.connected = false this.ws.connected = false
this.isLogin = false this.isLogin = false
console.error('===close socket connection===')
this.connect() this.connect()
this.login() this.login()
@@ -854,13 +860,14 @@ export class RochetChatConnectorService {
} }
}, },
onerror: (event: any) => { onerror: (event: any) => {
console.log(' ==== error ====')
}, },
disconnect:() => { disconnect:() => {
console.log('==== desconnect ====')
if(this.socket) { if(this.socket) {
this.socket.onopen = (event: any) => {} this.socket.onopen = (event: any) => {}
this.socket.onmessage = (event: any) => {} this.socket.onmessage = (event: any) => {}
+10 -10
View File
@@ -15,38 +15,40 @@ export enum ConnectionStatus {
}) })
export class NetworkServiceService { export class NetworkServiceService {
private status: BehaviorSubject<ConnectionStatus> = new BehaviorSubject(ConnectionStatus.Offline); private status: BehaviorSubject<ConnectionStatus> = new BehaviorSubject(ConnectionStatus.Offline);
private wsCallbacks: {[key: string]: {
function: Function,
event: ConnectionStatus
}} = {}
constructor(private network: Network, private toastController: ToastController, private plt: Platform) { constructor(private network: Network, private toastController: ToastController, private plt: Platform) {
this.plt.ready().then(() => { this.plt.ready().then(() => {
this.initializeNetworkEvents(); this.initializeNetworkEvents();
let status = this.network.type !== 'none' ? ConnectionStatus.Online : ConnectionStatus.Offline; let status = this.network.type !== 'none' ? ConnectionStatus.Online : ConnectionStatus.Offline;
this.status.next(status); this.status.next(status);
}); });
this.onNetworkChange().subscribe((status) => { this.onNetworkChange().subscribe((status) => {
}) })
} }
public initializeNetworkEvents() { public initializeNetworkEvents() {
this.network.onDisconnect().subscribe(() => { this.network.onDisconnect().subscribe(() => {
if (this.status.getValue() === ConnectionStatus.Online) { if (this.status.getValue() === ConnectionStatus.Online) {
this.updateNetworkStatus(ConnectionStatus.Offline); this.updateNetworkStatus(ConnectionStatus.Offline);
} }
}); });
this.network.onConnect().subscribe(() => { this.network.onConnect().subscribe(() => {
if (this.status.getValue() === ConnectionStatus.Offline) { if (this.status.getValue() === ConnectionStatus.Offline) {
this.updateNetworkStatus(ConnectionStatus.Online); this.updateNetworkStatus(ConnectionStatus.Online);
} }
}); });
} }
private async updateNetworkStatus(status: ConnectionStatus) { private async updateNetworkStatus(status: ConnectionStatus) {
this.status.next(status); this.status.next(status);
let connection = status == ConnectionStatus.Offline ? 'Offline' : 'Online'; let connection = status == ConnectionStatus.Offline ? 'Offline' : 'Online';
let toast = this.toastController.create({ let toast = this.toastController.create({
message: `You are now ${connection}`, message: `You are now ${connection}`,
@@ -55,11 +57,9 @@ export class NetworkServiceService {
}); });
toast.then(toast => toast.present()); toast.then(toast => toast.present());
} }
public onNetworkChange(): Observable<ConnectionStatus> { public onNetworkChange(): Observable<ConnectionStatus> {
return this.status.asObservable(); return this.status.asObservable();
} }
public getCurrentNetworkStatus(): ConnectionStatus { public getCurrentNetworkStatus(): ConnectionStatus {
return this.status.getValue(); return this.status.getValue();
} }
+2 -1
View File
@@ -264,7 +264,7 @@ export class ToastService {
</div> </div>
`; `;
// //
document.body.append(loader) document.body.append(loader)
loader.addEventListener('click', ()=>{ loader.addEventListener('click', ()=>{
@@ -278,3 +278,4 @@ export class ToastService {
export const ToastsService = new ToastService(new ToastController(), new ThemeService()) export const ToastsService = new ToastService(new ToastController(), new ThemeService())
@@ -14,15 +14,15 @@
<button (click)="openAddNoteModal('Solicitar alteração')" class="btn-cancel" shape="round" >Solicitar alteração</button> <button (click)="openAddNoteModal('Solicitar alteração')" class="btn-cancel" shape="round" >Solicitar alteração</button>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar despacho</button> <button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar despacho</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button> <button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<div class="solid"></div> <div class="solid"></div>
</div> </div>
<div class="buttons width-100" *ngIf="task.activityInstanceName == 'Diploma Assinado'"> <div class="buttons width-100" *ngIf="task.activityInstanceName == 'Diploma Assinado'">
<button (click)="openAddNoteModal('Concluir diploma')" class="btn-cancel" shape="round" >Concluir</button> <button (click)="openAddNoteModal('Concluir diploma')" class="btn-cancel" shape="round" >Concluir</button>
</div> </div>
<div class="buttons width-100" *ngIf="task.activityInstanceName == 'Assinar Diploma'"> <div class="buttons width-100" *ngIf="task.activityInstanceName == 'Assinar Diploma'">
<button (click)="openAddNoteModal('AssinarNew')" class="btn-cancel" shape="round" >Assinar</button> <button (click)="AssinarNew()" class="btn-cancel" shape="round" >Assinar</button>
</div> </div>
<div class="buttons width-100"> <div class="buttons width-100">
<button (click)="openAddNoteModal('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button> <button (click)="openAddNoteModal('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button>
@@ -12,6 +12,7 @@ import { AttachmentList } from 'src/app/models/Excludetask';
import { DespachoService } from 'src/app/Rules/despacho.service'; import { DespachoService } from 'src/app/Rules/despacho.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service' import { TaskService } from 'src/app/services/task.service'
import { PopupQuestionPage } from 'src/app/modals/popup-question/popup-question.page';
@Component({ @Component({
selector: 'app-deploma-options', selector: 'app-deploma-options',
@@ -137,7 +138,7 @@ export class DiplomaOptionsPage implements OnInit {
if(error.status == 0) { if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão') this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else { } else {
this.toastService._badRequest() this.toastService._badRequest()
} }
} finally { } finally {
@@ -195,7 +196,7 @@ export class DiplomaOptionsPage implements OnInit {
if(error.status == 0) { if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão') this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else { } else {
this.toastService._badRequest() this.toastService._badRequest()
} }
} finally { } finally {
@@ -205,7 +206,7 @@ export class DiplomaOptionsPage implements OnInit {
} }
async sign(note:string, documents:any) { async sign(note?:string, documents?:any) {
let body = { let body = {
"serialNumber": this.serialNumber, "serialNumber": this.serialNumber,
"action": "Assinado", "action": "Assinado",
@@ -236,26 +237,48 @@ export class DiplomaOptionsPage implements OnInit {
} finally {} } finally {}
} }
async AssinarNew(note, doc) { async AssinarNew(note?, doc?) {
let body = {
"InstanceId": this.task.InstanceID,
"FolderId": this.task.FolderID,
"DraftIds": this.DraftIds,
"OriginalFileName": this.DraftNames
}
const loader = this.toastService.loading()
try { const modal = await this.modalController.create({
await this.processes.presidentialActionsSignature(body).toPromise() component: PopupQuestionPage,
await this.sign(note, doc) componentProps: {
this.TaskService.loadDiplomas() title: 'Deseja assinar este Diploma?',
this.goBack(); message: 'Nota: Ao Efetuar esta operação, o tratamento deste diploma não poderá ser realizado a partir da caixa de correspondência'
} catch (error) {
this.httpErroHandle.httpStatusHandle(error) },
} cssClass: "popup-question discart-expedient-modal",
finally { backdropDismiss: true
loader.remove() });
}
modal.onDidDismiss().then(async (res) => {
const data = res.data
if(data == "Yes") {
let body = {
"InstanceId": this.task.InstanceID,
"FolderId": this.task.FolderID,
"DraftIds": this.DraftIds,
"OriginalFileName": this.DraftNames
}
const loader = this.toastService.loading()
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.sign()
this.TaskService.loadDiplomas()
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
}
}, (error) => {
console.log(error)
});
await modal.present();
} }
@@ -281,7 +304,7 @@ export class DiplomaOptionsPage implements OnInit {
if(error.status == 0) { if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão') this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else { } else {
this.toastService._badRequest() this.toastService._badRequest()
} }
} }
@@ -329,7 +352,7 @@ export class DiplomaOptionsPage implements OnInit {
cssClass: classs, cssClass: classs,
}); });
modal.onDidDismiss().then(async (res) => { modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') { if (res['data'] == 'openDiscart') {
await this.distartExpedientModal(); await this.distartExpedientModal();
@@ -346,7 +369,7 @@ export class DiplomaOptionsPage implements OnInit {
} }
async distartExpedientModal() { async distartExpedientModal() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: DiscartExpedientModalPage, component: DiscartExpedientModalPage,
componentProps: { componentProps: {
@@ -361,7 +384,7 @@ export class DiplomaOptionsPage implements OnInit {
modal.onDidDismiss().then(res => { modal.onDidDismiss().then(res => {
if (res['data'] == 'close') { if (res['data'] == 'close') {
this.close(); this.close();
/* /*
this.close(); this.close();
this.openMenu(); */ this.openMenu(); */
} }
+6
View File
@@ -1673,3 +1673,9 @@ h5, .buttons{
-o-object-fit: cover; -o-object-fit: cover;
object-fit: cover; object-fit: cover;
} }
.popup-question::part(content) {
width: 450px;
height: 350px;
}