add metods to update room name

This commit is contained in:
Peter Maquiran
2024-06-11 13:48:44 +01:00
parent 4c1ad6d648
commit 540cbbc911
7 changed files with 44 additions and 14 deletions
@@ -12,7 +12,7 @@
<div class="middle">
<ion-label class="title">Alterar assunto</ion-label>
</div>
<app-btn-seguinte *ngIf="groupName" (click)="changeGroupName()"></app-btn-seguinte>
<app-btn-seguinte (click)="changeGroupName()"></app-btn-seguinte>..1
</div>
</div>
</ion-toolbar>
@@ -38,7 +38,7 @@
</div>
</div>
</div>
</div>
</div>
</ion-content>
@@ -40,24 +40,24 @@ export class EditGroupPage implements OnInit {
getRoomInfo(){
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.room = room['room'];
try {
this.groupName = this.room.name.split('-').join(' ');
} catch (error) {
this.groupName = this.room.name;
}
});
}
close(){
close() {
//this.modalController.dismiss();
this.closeAllDesktopComponents.emit();
this.openGroupMessage.emit(this.roomId);
}
changeGroupName(){
if(this.groupName.trim().length > 1){
changeGroupName() {
if(this.groupName.trim().length > 1) {
let name = this.groupName.split(' ').join('-');
let body = {
"roomId": this.room._id,
@@ -68,7 +68,7 @@ export class EditGroupPage implements OnInit {
});
}
else{
}
this.updateGroup();
}
@@ -96,13 +96,13 @@ export class EditGroupPage implements OnInit {
text: 'Ok',
cssClass: 'btn-cancel',
handler:(value:any)=>{
this.selectedDuration = [
value.days.value,
value.hours.value,
value.minutes.value,
]
if(value.days.value != null && value.hours.value != null && value.minutes.value != null){
if(value.days.value > 0){
if(value.days.value == 1){
@@ -10,6 +10,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { HttpRequest } from '@angular/common/http';
import { ZodError } from 'zod';
import { HttpResponse } from '@microsoft/signalr';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-group-contacts',
@@ -39,6 +40,7 @@ export class GroupContactsPage implements OnInit {
private contactsRepositoryService: ContactRepositoryService,
private RoomRepositoryService: RoomRepositoryService,
private httpErrorHandle: HttpErrorHandle,
private toastService: ToastService,
)
{}
ngOnInit(): void {
@@ -107,7 +109,7 @@ export class GroupContactsPage implements OnInit {
} else if (getallChatUsers.isErr() && getallChatUsers.error instanceof HttpResponse) {
this.httpErrorHandle.httpStatusHandle(getallChatUsers.error)
} else {
alert('else')
this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.")
}
const currentMemberIds = this.currentMembers.map(e => e.wxUserId)