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",
"wordcloud": "^1.1.2",
"ws": "^7.4.6",
"zod": "^3.22.2",
"zone.js": "~0.11.4"
},
"devDependencies": {
@@ -40799,6 +40800,14 @@
"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": {
"version": "0.11.4",
"license": "MIT",
@@ -68502,6 +68511,11 @@
"yocto-queue": {
"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": {
"version": "0.11.4",
"requires": {
+1
View File
@@ -185,6 +185,7 @@
"uuidv4": "^6.2.11",
"wordcloud": "^1.1.2",
"ws": "^7.4.6",
"zod": "^3.22.2",
"zone.js": "~0.11.4"
},
"devDependencies": {
+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>
+1 -1
View File
@@ -138,7 +138,7 @@ export class HomePage implements OnInit {
}
goto(url) {
this.router.navigate([url], { replaceUrl: true })
this.router.navigateByUrl(url)
}
refreshing() { }
@@ -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>;
@@ -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) {
@@ -242,6 +244,21 @@ export class DiplomaAssinarPage implements OnInit {
}
async AssinarDraft() {
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,
@@ -266,8 +283,14 @@ export class DiplomaAssinarPage implements OnInit {
}
}
async openAddNoteModal(actionName: string) {
}, (error) => {
console.log(error)
});
await modal.present();
}
async openAddNoteModal(actionName: string) {
let classs;
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
+5 -4
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.getUserStatus();
await this.chatService.refreshtoken();
this.getUser();
this.getAllRooms();
this.subscribeToRoom();
//
this.getUserStatus();
if(this.currentRoom) {
this.currentRoom.loadHistory({forceUpdate: true})
@@ -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();
@@ -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()
@@ -858,9 +864,10 @@ 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) => {}
+5 -5
View File
@@ -16,6 +16,11 @@ 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();
@@ -28,15 +33,12 @@ export class NetworkServiceService {
})
}
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);
@@ -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();
}
+1
View File
@@ -278,3 +278,4 @@ export class ToastService {
export const ToastsService = new ToastService(new ToastController(), new ThemeService())
@@ -22,7 +22,7 @@
<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',
@@ -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,7 +237,22 @@ export class DiplomaOptionsPage implements OnInit {
} finally {}
}
async AssinarNew(note, doc) {
async AssinarNew(note?, doc?) {
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,
@@ -247,7 +263,7 @@ export class DiplomaOptionsPage implements OnInit {
try {
await this.processes.presidentialActionsSignature(body).toPromise()
await this.sign(note, doc)
await this.sign()
this.TaskService.loadDiplomas()
this.goBack();
} catch (error) {
@@ -256,6 +272,13 @@ export class DiplomaOptionsPage implements OnInit {
finally {
loader.remove()
}
}
}, (error) => {
console.log(error)
});
await modal.present();
}
+6
View File
@@ -1673,3 +1673,9 @@ h5, .buttons{
-o-object-fit: cover;
object-fit: cover;
}
.popup-question::part(content) {
width: 450px;
height: 350px;
}