Fix go back

This commit is contained in:
Peter Maquiran
2021-08-25 09:38:13 +01:00
parent 7c2a2152e9
commit 54ee7701c8
3 changed files with 20 additions and 26 deletions
@@ -7,6 +7,7 @@ import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edi
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page'; import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page'; import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { EmendMessageModalPage } from '../emend-message-modal/emend-message-modal.page'; import { EmendMessageModalPage } from '../emend-message-modal/emend-message-modal.page';
import { Location } from '@angular/common';
@Component({ @Component({
selector: 'app-event-actions-popover', selector: 'app-event-actions-popover',
@@ -24,7 +25,8 @@ export class EventActionsPopoverPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private popoverController: PopoverController, private popoverController: PopoverController,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService,) { private toastService: ToastService,
private location: Location) {
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('InstanceId'); this.instanceId = this.navParams.get('InstanceId');
} }
@@ -37,22 +39,13 @@ export class EventActionsPopoverPage implements OnInit {
}; };
} }
goBack(){ goBack() {
this.closePopover(); this.closePopover();
if (window.innerWidth <= 801) { this.location.back()
this.router.navigate(['/home/gabinete-digital/event-list']);
} else {
let navigationExtras: NavigationExtras = {
queryParams: {
'eventos': true
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
} }
closePopover(){ closePopover() {
this.popoverController.dismiss(); this.popoverController.dismiss();
} }
@@ -104,13 +104,13 @@
</ion-content> </ion-content>
<ion-footer class="display-none-true"> <ion-footer class="display-none-true">
<div class="buttons"> <div class="buttons">
<button class="btn-cancel" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Rever</button> <button class="btn-cancel" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Rever</button>
<ion-menu-button (click)="openMenu()" autoHide="false"> <ion-menu-button (click)="openMenu()" autoHide="false">
<ion-icon name="ellipsis-vertical-outline"></ion-icon> <ion-icon name="ellipsis-vertical-outline"></ion-icon>
</ion-menu-button> </ion-menu-button>
<button class="btn-ok" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button> <button class="btn-ok" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button>
<button hidden class="btn-delete" shape="round" (click)="rejeitar(loadedEvent.serialNumber)">Rejeitar</button> <button hidden class="btn-delete" shape="round" (click)="rejeitar(loadedEvent.serialNumber)">Rejeitar</button>
</div> </div>
</ion-footer> </ion-footer>
+6 -5
View File
@@ -8,7 +8,7 @@ import { SHA1 } from 'crypto-js'
export class ChatUserService { export class ChatUserService {
// main data // main data
private _userList = [] private _userList = {}
// local storage keyName // local storage keyName
private keyName: string; private keyName: string;
@@ -17,8 +17,8 @@ export class ChatUserService {
this.keyName = ('chat'+SHA1(this.constructor.name)).toString() this.keyName = ('chat'+SHA1(this.constructor.name)).toString()
setTimeout(()=>{ setTimeout(()=>{
let restore = localstoreService.get(this.keyName, []) let restore = localstoreService.get(this.keyName, {})
this._userList = restore.userList this._userList = restore.userList || {}
}, 10) }, 10)
} }
@@ -27,8 +27,9 @@ export class ChatUserService {
return this._userList return this._userList
} }
reset(userList: any[]) { add(roomId:string, userList: any[] = []) {
this._userList = userList
this._userList[roomId] = userList
this.save() this.save()
} }