Hi, we want using chat in this way: user can write to another user by clicking on his profile name( or any another link), so first qyestion would be how to open chat modal on custom click from any page? and follow question would be, how to start writing to the particular user on this click?
Angular + Core
7 Answer(s)
-
0
Hi @mirzanas
I assume the clicked link will contain the information of target user. If so, when the link is clicked, you can add the target user as friend (if not added before), and then open the chat bar component.
You can check the script of chatbar, it has a sample to open chat bar when a new message arrives and user clicks the new message notification on the UI.
-
0
Now I found how to add friend and open chatbar on click, but still have trouble to open the selected user(new friend) chat on same click, could you help?
-
0
Hi @mirzanas
Sorry for my late response. Are you using Angular or JQuery version ?
-
0
Angular
-
0
If you want to change the selectedUser of chat bar component, you need to make it an Output field and set it externally where you need to.
Then, the user must be selected on the chat panel automatically.
-
0
hm.. but I don't directly calling the chat-bar component from my custom component, I am using the 'document', I thought you suggest this in your first answer ''You can check the script of chatbar, it has a sample to open chat bar"
showChatPanel(): void { document.body.className += ' m-quick-sidebar--on'; document.getElementById('m_quick_sidebar').className += ' m-quick-sidebar--on'; }
-
0
@mirzanas
Yes, this is unfortunately Metronic's way of showing the chat panel. For selecting the user, you can follow my second suggestion. Otherwise, you might need to deal with more staff.