Files
doneit-web/.angular/cache/14.2.12/babel-webpack/0594703d0c79fe42f2bd1d6c4d6e9c3f.json
T

1 line
17 KiB
JSON
Raw Normal View History

2023-06-30 09:54:21 +01:00
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./group-contacts.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./group-contacts.page.scss?ngResource\";\nimport { HttpClient } from '@angular/common/http';\nimport { Component } from '@angular/core';\nimport { ModalController, NavParams } from '@ionic/angular';\nimport { AuthService } from 'src/app/services/auth.service';\nimport { ChatService } from 'src/app/services/chat.service';\nimport { GroupMessagesPage } from '../group-messages.page';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { SessionStore } from 'src/app/store/session.service';\nimport { ChatSystemService } from 'src/app/services/chat/chat-system.service';\nlet GroupContactsPage = class GroupContactsPage {\n constructor(modalController, http, chatService, authService, navParams, ThemeService, ChatSystemService) {\n this.modalController = modalController;\n this.http = http;\n this.chatService = chatService;\n this.authService = authService;\n this.navParams = navParams;\n this.ThemeService = ThemeService;\n this.ChatSystemService = ChatSystemService;\n this.users = [];\n this.contact = [\" Ana M.\", \"Andre F.\", \"Bruno G.\", \"Catarina T\", \"Tiago\"];\n this.sessionStore = SessionStore;\n this.textSearch = \"\";\n this.dm = null;\n this.room = null;\n this.isGroupCreated = this.navParams.get('isCreated');\n this.groupName = this.navParams.get('name');\n this.room = this.navParams.get('room');\n this.members = this.navParams.get('members');\n }\n ngOnInit() {\n // this.chatService.refreshtoken();\n this.loadUsers();\n this.getMembers();\n }\n loadUsers() {\n this.options = {\n headers: this.headers\n };\n this.chatService.getAllUsers().subscribe(res => {\n if (this.members) {\n this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));\n } else {\n this.contacts = res.users.filter(data => data.username != this.sessionStore.user.UserName);\n }\n this.users = this.contacts.sort((a, b) => {\n if (a.name < b.name) {\n return -1;\n }\n if (a.name > b.name) {\n return 1;\n }\n return 0;\n });\n this.showLoader = false;\n });\n }\n getMembers() {\n if (this.room.t == \"p\") {\n this.chatService.getGroupMembers(this.room._id).subscribe(res => {\n this.members = res['members'];\n this.loadUsers();\n });\n } else if (this.room.t == \"c\") {\n this.chatService.getChannelMembers(this.room._id).subscribe(res => {\n this.members = res['members'];\n this.loadUsers();\n });\n }\n }\n separateLetter(record, recordIndex, records) {\n if (recordIndex == 0) {\n return record.name[0];\n }\n let first_prev = records[recordIndex - 1].name[0];\n let first_current = record.name[0];\n if (first_prev != first_current) {\n return first_current;\n }\n return null;\n }\n deleteMember(data) {\n let body = {\n \"roomId\": this.room._id,\n \"userId\": data._id\n };\n if (this.room.t == \"p\") {\n this.chatService.removeGroupMember(body).subscribe(res => {\n this.getMembers();\n });\n } else if (this.room.t == \"c\") {\n this.chatService.removeChannelMember(body).subscribe(res => {\n this.getMembers();\n });\n }\n }\n doRefresh(ev) {\n this.loadUsers();\n this.getMembers();\n ev.target.complete();\n }\n close() {\n var _this = this;\n return _asyncToGenerator(function* () {\n _this.modalController.dismiss();\n })();\n }\n onChange(event) {\n this.textSearch = event.detail.value;\n }\n clicked() {}\n selectedContact(user) {\n /* this.groupName = this.room.name; */\n user.isChecked = !user.isChecked;\n }\n add