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
+4
View File
@@ -288,6 +288,10 @@ const routes = [
},
{
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)
}
+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 { CreateProcessPage } from './modals/create-process/create-process.page';
import { LoggingInterceptorService } from './services/logging-interceptor.service';
import { PopupQuestionPipe } from './modals/popup-question.pipe';
// import { ServiceWorkerModule } from '@angular/service-worker';
@@ -116,7 +117,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
SentrySibling.init
);
@NgModule({
declarations: [AppComponent],
declarations: [AppComponent, PopupQuestionPipe],
imports: [BrowserModule,
CommonModule,
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-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-label class="font-12-em">Chat</ion-label>
<ion-label class="font-12-em">Chat ...</ion-label>
</ion-tab-button>
</ion-tab-bar>
+2 -2
View File
@@ -138,7 +138,7 @@ export class HomePage implements OnInit {
}
goto(url) {
this.router.navigate([url], { replaceUrl: true })
this.router.navigateByUrl(url)
}
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">
<div class="main-content d-flex height-100 overflow-hidden">
<app-task-details
<app-task-details
*ngIf="task"
[task]=task
[intervenientes]=intervenientes
@@ -12,7 +12,7 @@
(goBack)= goBack()
(viewDocument)=viewDocument($event)
class="content d-flex flex-column"
></app-task-details>
<div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto">
@@ -21,7 +21,7 @@
<div class="solid"></div>
</div>
<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>
<div class="buttons">
@@ -1,5 +1,5 @@
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 { 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 { TaskService } from 'src/app/services/task.service'
import { TinyMCEPage } from 'src/app/tiny-mce/tiny-mce.page';
import { PopupQuestionPage } from 'src/app/modals/popup-question/popup-question.page';
@Component({
selector: 'app-diploma-assinar',
@@ -50,7 +51,8 @@ export class DiplomaAssinarPage implements OnInit {
public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle,
private despachoService: DespachoService,
public TaskService: TaskService
public TaskService: TaskService,
private toastController: ToastController
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
@@ -103,7 +105,7 @@ export class DiplomaAssinarPage implements OnInit {
this.processes.GetTask(serial).subscribe(res => {
this.TaskService.loadDiplomas();
this.task = {
"SerialNumber": res.serialNumber,
"Folio": res.workflowInstanceDataFields.Subject,
@@ -149,7 +151,7 @@ export class DiplomaAssinarPage implements OnInit {
this.cc = users.filter(user=>{
return user.Type == 'CC';
});
});
this.getDocumentDetails(this.task.FolderId, '361');
@@ -207,8 +209,8 @@ export class DiplomaAssinarPage implements OnInit {
getDocumentDetails(forlderId:string, applicationId:string) {
this.processes.GetDocumentDetails(forlderId,applicationId).subscribe(res=>{
this.attachments = res.Documents;
})
}
@@ -242,32 +244,53 @@ export class DiplomaAssinarPage implements OnInit {
}
async AssinarDraft() {
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()
const modal = await this.modalController.create({
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();
this.TaskService.loadDiplomas();
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
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.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) {
let classs;
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
@@ -363,7 +386,7 @@ export class DiplomaAssinarPage implements OnInit {
});
await modal.present();
modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') {
await this.distartExpedientModal();
@@ -376,7 +399,7 @@ export class DiplomaAssinarPage implements OnInit {
}
async distartExpedientModal() {
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
componentProps: {
@@ -392,7 +415,7 @@ export class DiplomaAssinarPage implements OnInit {
modal.onDidDismiss().then(res => {
if (res['data'] == 'close') {
this.close();
/*
/*
this.close();
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.
*/
await this.chatService.refreshtoken();
await this.getUser();
this.RochetChatConnectorService.setStatus('online')
await this.getAllRooms();
this.subscribeToRoom();
//
this.getUserStatus();
this.RochetChatConnectorService.setStatus('online')
this.getUserStatus();
await this.chatService.refreshtoken();
this.getUser();
this.getAllRooms();
this.subscribeToRoom();
//
if(this.currentRoom) {
this.currentRoom.loadHistory({forceUpdate: true})
@@ -19,7 +19,7 @@ export class RochetChatConnectorService {
}
reConnect() {
}
connect() {
@@ -67,7 +67,7 @@ export class RochetChatConnectorService {
}
const requestId = uuidv4()
//
//
const message = {
msg: "method",
method: "login",
@@ -83,12 +83,12 @@ export class RochetChatConnectorService {
return new Promise((resolve, reject) => {
//
//
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
//
//
if(message.id == requestId ) { // same request send
//
//
//
//
if(message.result) {
if(message.result.token) {
this.isLogin = true
@@ -99,11 +99,11 @@ export class RochetChatConnectorService {
}, 10)
resolve(message)
//
//
}
} else {
this.isLogin = false
//
//
reject(message)
}
@@ -118,7 +118,7 @@ export class RochetChatConnectorService {
getRooms(roomOlder = 1480377601) {
//const requestId = uuidv4()
const requestId = uuidv4()
const message = {
@@ -219,7 +219,7 @@ export class RochetChatConnectorService {
}]
}
//
//
this.ws.send({message, requestId});
@@ -325,7 +325,7 @@ export class RochetChatConnectorService {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId ) { // same request send
resolve(message)
//
//
return true
}
@@ -548,7 +548,7 @@ export class RochetChatConnectorService {
return new Promise<chatHistory>((resolve, reject) => {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
//
//
if(message.id == requestId ) { // same request send
resolve(message)
return true
@@ -746,7 +746,7 @@ export class RochetChatConnectorService {
registerCallback:(params: wsCallbacksParams) => {
let id = params.requestId || params.key || uuidv4()
//
//
this.wsCallbacks[id] = params
this.n++
return id
@@ -758,8 +758,13 @@ export class RochetChatConnectorService {
this.socket.onmessage = this.ws.onmessage;
this.socket.onclose = this.ws.onclose;
this.socket.onerror = this.ws.onerror;
console.log(' === on open connection ===')
},
onopen: async ()=> {
console.log('===socket on connection open===')
this.ws.connected = true
this.backgroundservice.online();
@@ -802,7 +807,7 @@ export class RochetChatConnectorService {
send: ({message, requestId = uuidv4(), loginRequired = true}:send) => {
if (this.ws.connected == false || loginRequired == true && this.isLogin == false) { // save data to send when back online
//
//
//
this.wsMsgQueue[requestId] = {message, requestId, loginRequired}
@@ -814,7 +819,7 @@ export class RochetChatConnectorService {
},
onmessage: async (event: any)=> {
this.backgroundservice.online();
const data = JSON.parse(event.data)
@@ -837,6 +842,7 @@ export class RochetChatConnectorService {
onclose: async (event: any)=> {
this.ws.connected = false
this.isLogin = false
console.error('===close socket connection===')
this.connect()
this.login()
@@ -854,13 +860,14 @@ export class RochetChatConnectorService {
}
},
onerror: (event: any) => {
console.log(' ==== error ====')
},
disconnect:() => {
console.log('==== desconnect ====')
if(this.socket) {
this.socket.onopen = (event: any) => {}
this.socket.onmessage = (event: any) => {}
+10 -10
View File
@@ -15,38 +15,40 @@ export enum ConnectionStatus {
})
export class NetworkServiceService {
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) {
this.plt.ready().then(() => {
this.initializeNetworkEvents();
let status = this.network.type !== 'none' ? ConnectionStatus.Online : ConnectionStatus.Offline;
this.status.next(status);
});
});
this.onNetworkChange().subscribe((status) => {
})
}
public initializeNetworkEvents() {
this.network.onDisconnect().subscribe(() => {
if (this.status.getValue() === ConnectionStatus.Online) {
this.updateNetworkStatus(ConnectionStatus.Offline);
}
});
this.network.onConnect().subscribe(() => {
if (this.status.getValue() === ConnectionStatus.Offline) {
this.updateNetworkStatus(ConnectionStatus.Online);
}
});
}
private async updateNetworkStatus(status: ConnectionStatus) {
this.status.next(status);
let connection = status == ConnectionStatus.Offline ? 'Offline' : 'Online';
let toast = this.toastController.create({
message: `You are now ${connection}`,
@@ -55,11 +57,9 @@ export class NetworkServiceService {
});
toast.then(toast => toast.present());
}
public onNetworkChange(): Observable<ConnectionStatus> {
return this.status.asObservable();
}
public getCurrentNetworkStatus(): ConnectionStatus {
return this.status.getValue();
}
+2 -1
View File
@@ -264,7 +264,7 @@ export class ToastService {
</div>
`;
//
//
document.body.append(loader)
loader.addEventListener('click', ()=>{
@@ -278,3 +278,4 @@ export class ToastService {
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)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar despacho</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<div class="solid"></div>
</div>
<div class="buttons width-100" *ngIf="task.activityInstanceName == 'Diploma Assinado'">
<button (click)="openAddNoteModal('Concluir diploma')" class="btn-cancel" shape="round" >Concluir</button>
</div>
<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 class="buttons width-100">
<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 { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service'
import { PopupQuestionPage } from 'src/app/modals/popup-question/popup-question.page';
@Component({
selector: 'app-deploma-options',
@@ -137,7 +138,7 @@ export class DiplomaOptionsPage implements OnInit {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally {
@@ -195,7 +196,7 @@ export class DiplomaOptionsPage implements OnInit {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally {
@@ -205,7 +206,7 @@ export class DiplomaOptionsPage implements OnInit {
}
async sign(note:string, documents:any) {
async sign(note?:string, documents?:any) {
let body = {
"serialNumber": this.serialNumber,
"action": "Assinado",
@@ -236,26 +237,48 @@ export class DiplomaOptionsPage implements OnInit {
} finally {}
}
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()
async AssinarNew(note?, doc?) {
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.sign(note, doc)
this.TaskService.loadDiplomas()
this.goBack();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
}
const modal = await this.modalController.create({
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
});
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) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
}
@@ -329,7 +352,7 @@ export class DiplomaOptionsPage implements OnInit {
cssClass: classs,
});
modal.onDidDismiss().then(async (res) => {
if (res['data'] == 'openDiscart') {
await this.distartExpedientModal();
@@ -346,7 +369,7 @@ export class DiplomaOptionsPage implements OnInit {
}
async distartExpedientModal() {
const modal = await this.modalController.create({
component: DiscartExpedientModalPage,
componentProps: {
@@ -361,7 +384,7 @@ export class DiplomaOptionsPage implements OnInit {
modal.onDidDismiss().then(res => {
if (res['data'] == 'close') {
this.close();
/*
/*
this.close();
this.openMenu(); */
}