add headers to options

This commit is contained in:
Peter Maquiran
2021-08-24 14:07:27 +01:00
parent 567209ed4b
commit 019b85d209
16 changed files with 184 additions and 32 deletions
@@ -36,7 +36,7 @@
</ion-refresher-content>
</ion-refresher>
<div class="messages" #scrollMe>
<div *ngFor="let msg of messages; let last = last" class='incoming-{{msg.u.username!=loggedUser.me.username}}'>
<div *ngFor="let msg of chatMessageStore.message[roomId] ; let last = last" class='incoming-{{msg.u.username!=loggedUser.me.username}}'>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
+12 -1
View File
@@ -9,6 +9,8 @@ import { connection } from 'src/app/services/socket/synchro.service';
import { ToastService } from 'src/app/services/toast.service';
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
@Component({
selector: 'app-messages',
@@ -32,6 +34,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
scrollingOnce:boolean = true;
connection = connection;
chatMessageStore = ChatMessageStore
chatUserStorage = ChatUserStorage
private scrollChangeCallback: () => void;
currentPosition: any;
@@ -146,9 +150,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
loadMessages() {
this.showLoader = true;
const roomId = this.roomId
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
/* console.log(res); */
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
console.log(this.messages);
this.showLoader = false;
})
@@ -245,7 +252,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async serverLongPull() {
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
const roomId = this.roomId
this.chatService.getRoomMessages(roomId).subscribe(async res => {
if (res == 502) {
// Connection timeout
@@ -257,6 +266,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//showMessage(response.statusText);
//this.loadMessages()
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
console.log(this.messages);
// Reconnect in one second
if(this.route.url != "/home/chat"){
@@ -98,7 +98,6 @@
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
</div>
<div *ngIf="!task" class="px-20">
@@ -85,7 +85,11 @@
<div *ngIf="task" class="aside-right flex-column height-100">
<div class="buttons" *ngIf="task.activityInstanceName == 'Tarefa de Despacho'">
<div class="option-desc"> <div>Responder ao PR</div> </div>
<button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<div class="option-desc">Reencaminhar para Área jurídica</div>
<button (click)="openAddNoteModal('Gerar Diploma')" class="btn-cancel" style="margin-bottom: 0px !important;" shape="round" >Gerar Diploma </button>
<div class="option-desc">Outras opções</div>
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
<div class="solid"></div>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
@@ -195,3 +195,19 @@ ion-button{
width: 25%;
}
}
.option-desc {
display: flex;
color: #828282;
width: 100%;
justify-content: space-between;
align-items: center;
font-size: 11pt;
.option-desc-line {
height: 1px;
flex-grow: 1;
background-color: #e0e0e0;
padding-left: 4px;
}
}
@@ -6,6 +6,7 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { PedidosStore } from 'src/app/store/pedidos-store.service';
import { ModalService } from 'src/app/services/modal.service';
@Component({
selector: 'app-pedidos',
templateUrl: './pedidos.page.html',
@@ -37,6 +38,7 @@ export class PedidosPage implements OnInit {
private modalController: ModalController,
private alertService: AlertService,
private activatedRoute: ActivatedRoute,
private modalService: ModalService
) {
//Inicializar segment
this.segment = 'parecer';
@@ -49,6 +51,9 @@ export class PedidosPage implements OnInit {
}
});
const modal = this.modalService.BookMeetingModalPage({task: ''},{})
}
ngOnInit() {
@@ -31,7 +31,7 @@
</ion-refresher-content>
</ion-refresher>
<div class="messages" #scrollMe>
<div class="container-width-100" *ngFor="let msg of messages; let last = last">
<div class="container-width-100" *ngFor="let msg of chatMessageStore.message[roomId]; let last = last">
<div class='incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45'>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
+13 -2
View File
@@ -10,6 +10,8 @@ import { ContactsPage } from '../new-group/contacts/contacts.page';
import { Router } from '@angular/router';
import { connection } from 'src/app/services/socket/synchro.service';
import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/chat-options-features.page';
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
@Component({
selector: 'app-messages',
@@ -38,6 +40,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
connection = connection;
chatMessageStore = ChatMessageStore
chatUserStorage = ChatUserStorage
scrollingOnce:boolean = true;
private scrollChangeCallback: () => void;
currentPosition: any;
@@ -164,9 +169,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
loadMessages(){
//this.showLoader = true;
const roomId = this.roomId
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
console.log(res);
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
console.log(this.messages);
//this.serverLongPull(res)
/* this.chatService.subscribe(this.roomId).then(res => {
@@ -176,7 +184,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
})
}
getChatMembers(){
getChatMembers() {
console.log(this.roomId);
//this.showLoader = true;
@@ -339,7 +347,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
});
}
async serverLongPull(){
async serverLongPull() {
const roomId = this.roomId
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
if (res == 502) {
@@ -352,6 +362,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//showMessage(response.statusText);
//this.loadMessages()
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
console.log(this.messages);
// Reconnect in one second
if(this.route.url != "/home/chat"){
@@ -5,7 +5,38 @@
</button>
</div>
<div class="buttons" *ngIf="task.activityInstanceName == 'Tarefa de Despacho'">
<div class="width-100 pr-options" *ngIf="task.activityInstanceName == 'Tarefa de Despacho' && task.WorkflowName == 'Despacho do Presidente da República' ">
<div *ngIf="task && !p.userRole(['PR'])" class="d-flex width-100">
<div class="flex-grow-1 width-50 pr-10">
<button class="btn-cancel desk" shape="round" > Responder ao PR </button>
<button (click)="openAddNoteModal('Executado')" class="btn-cancel width-100" shape="round" >Executado</button>
<button class="btn-cancel desk" shape="round"> Reencaminhar para Área jurídica </button>
<button (click)="openAddNoteModal('Gerar Diploma')" class="btn-cancel width-100" shape="round" >Gerar Diploma</button>
<button class="btn-cancel desk" shape="round"> Outras opções </button>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel width-100" shape="round" >Efetuar Despacho</button>
</div>
<div class="flex-grow-1 width-50 pl-10">
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel width-100" shape="round" >Solicitar Parecer</button>
<button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel width-100" shape="round" >Pedido de Deferimento</button>
<button (click)="openDelegarModal(task)" class="btn-cancel width-100" shape="round" >Delegar</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" full class="btn-cancel width-100" shape="round" >Enviar para pendentes</button>
</div>
</div>
<div *ngIf="task && p.userRole(['PR'])" class="d-flex width-100">
<div class="flex-grow-1">
<button (click)="openAddNoteModal('Concluido')" class="btn-cancel" shape="round" >Marcar como Concluído</button>
<button (click)="openAddNoteModal('Reexecução')" class="btn-cancel" shape="round" >Enviar para Reexecução</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
</div>
<div class="solid"></div>
<button (click)="cancle()" full class="btn-cancel" shape="round" >Cancelar</button>
</div>
<div class="buttons" *ngIf="task.activityInstanceName == 'Tarefa de Despacho' && && task.WorkflowName != 'Despacho do Presidente da República' ">
<button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
<div class="solid"></div>
@@ -15,6 +46,7 @@
<div class="solid"></div>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
<div class="buttons" *ngIf="task.activityInstanceName == 'Reexecutar Despacho'">
<button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<button (click)="openDelegarModal(task)" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Delegar</button>
@@ -30,27 +30,33 @@
margin-bottom: 5px !important;
margin-top: 5px !important;
}
@media only screen and (max-width: 800px) {
.btn-ok, .btn-cancel, .btn-delete{
width: 47% !important;
.pr-options {
.btn-ok, .btn-cancel{
width: 100% !important;
}
}
@media only screen and (min-width: 1024px) {
.arrow-right{
display: flex;
justify-content: flex-end;
@media only screen and (min-width: 1024px){
.content{
width: 70%;
}
.btn-cancel{
display: none;
width: 100% !important;
margin-bottom: 10px !important;
.aside-right{
width: 30%;
}
.btn-delete, .btn-ok{
width: 100% !important;
margin-bottom: 10px !important;
margin-top: 10px !important;
}
@media only screen and (min-width: 1140px){
.content{
width: 75%;
}
/* .solid{
display: block;
} */
.aside-right{
width: 25%;
}
}
.desk{
text-align: left;
background-color: white;
}
@@ -9,6 +9,7 @@ import { BookMeetingModalPage } from 'src/app/pages/gabinete-digital/expediente/
import { DiscartExpedientModalPage } from 'src/app/pages/gabinete-digital/discart-expedient-modal/discart-expedient-modal.page';
import { ToastService } from 'src/app/services/toast.service';
import { customTask, fullTask } from 'src/app/models/dailyworktask.model';
import { PermissionService } from 'src/app/OtherService/permission.service';
@Component({
@@ -29,6 +30,7 @@ export class DespachosOptionsPage implements OnInit {
public popoverController: PopoverController,
private navParams: NavParams,
private toastService: ToastService,
public p: PermissionService,
) {
this.task = this.navParams.get('task')
this.fulltask = this.navParams.get('fulltask')
@@ -12,7 +12,7 @@
<div class="solid"></div>
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button *ngIf="p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
@@ -22,7 +22,7 @@
<div class="solid"></div>
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button *ngIf="p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
@@ -51,7 +51,7 @@
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button *ngIf="p.userRole(['PR'])" (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
<button (click)="openExpedientActionsModal('1',fulltask)" class="btn-cancel" shape="round" >Solicitar Parecer</button>
<button (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button *ngIf="!p.userRole(['PR'])" (click)="openExpedientActionsModal('2',fulltask)" class="btn-cancel" shape="round" >Pedido de Deferimento</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { localstoreService } from './localstore.service'
import { localstoreService } from '../localstore.service'
import { SHA1 } from 'crypto-js'
@Injectable({
@@ -13,7 +13,7 @@ export class ChatMessageService {
constructor() {
this.keyName = (SHA1(this.constructor.name)).toString()
this.keyName = ('chat'+SHA1(this.constructor.name)).toString()
setTimeout(()=> {
let restore = localstoreService.get(this.keyName, {})
@@ -22,18 +22,22 @@ export class ChatMessageService {
}
get message() {
return this._message
}
getMessages(roomId) {
return this._message[roomId] || []
}
add(roomId, message) {
add(roomId:string, message: any[]) {
this._message[roomId] = message
setTimeout(()=> {
localstoreService.set(this.keyName, {
message: this._message
})
}, 5000)
}, 10)
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ChatUserService } from './chat-user.service';
describe('ChatUserService', () => {
let service: ChatUserService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChatUserService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+46
View File
@@ -0,0 +1,46 @@
import { Injectable } from '@angular/core';
import { localstoreService } from '../localstore.service'
import { SHA1 } from 'crypto-js'
@Injectable({
providedIn: 'root'
})
export class ChatUserService {
// main data
private _userList = []
// local storage keyName
private keyName: string;
constructor() {
this.keyName = ('chat'+SHA1(this.constructor.name)).toString()
setTimeout(()=>{
let restore = localstoreService.get(this.keyName, [])
this._userList = restore.userList
}, 10)
}
get userList() {
return this._userList
}
reset(userList: any[]) {
this._userList = userList
this.save()
}
private save() {
setTimeout(()=> {
localstoreService.set(this.keyName, {
userList: this._userList
})
}, 10)
}
}
export const ChatUserStorage = new ChatUserService()