diff --git a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js
index 7031f4c..9ca6c63 100644
--- a/static/js/chat_socket_functions/etc_operations_for_chat_socket.js
+++ b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js
@@ -1,5 +1,5 @@
-export function update_count_unread_messages (data) {
+function update_count_unread_messages (data) {
let list_unrd = document.querySelectorAll(".qs")
let i = 0
for (i;i < list_unrd.length;i++){
@@ -7,7 +7,7 @@ export function update_count_unread_messages (data) {
}
}
-export function play_required_beep (data) {
+function play_required_beep (data) {
const beep = new Audio('/static/sounds/beep_2.mp3')
beep.play()
}
\ No newline at end of file
diff --git a/static/js/chat_socket_functions/inital_old_tab.js b/static/js/chat_socket_functions/inital_old_tab.js
index c3a89c0..b587650 100644
--- a/static/js/chat_socket_functions/inital_old_tab.js
+++ b/static/js/chat_socket_functions/inital_old_tab.js
@@ -1,5 +1,5 @@
-export function inital_old_tab (){
+function inital_old_tab (){
let el_tab = document.querySelector(".tab_user_messanger.select")
let old_item_tab_user = null;
if (el_tab !== null){
diff --git a/static/js/chat_socket_functions/update_messenger.js b/static/js/chat_socket_functions/update_messenger.js
index cce7a21..6505577 100644
--- a/static/js/chat_socket_functions/update_messenger.js
+++ b/static/js/chat_socket_functions/update_messenger.js
@@ -1,5 +1,5 @@
-export function update_chat_html (data,msg_cont) {
+function update_chat_html (data,msg_cont) {
if (data.chat_html){
if (msg_cont !== null){
if (msg_cont.dataset['curReceiver'] === ""){
@@ -16,7 +16,7 @@ export function update_chat_html (data,msg_cont) {
}
-export function update_list_w_users (data,old_item_tab_user) {
+function update_list_w_users (data,old_item_tab_user) {
let list_of_users = document.querySelector(".block-list-of-users")
if (list_of_users) {
diff --git a/static/js/chat_socket_functions/update_tickets_operations_manager.js b/static/js/chat_socket_functions/update_tickets_operations_manager.js
index 1560dc1..8614e39 100644
--- a/static/js/chat_socket_functions/update_tickets_operations_manager.js
+++ b/static/js/chat_socket_functions/update_tickets_operations_manager.js
@@ -1,5 +1,5 @@
-export function update_tickets_operations_manager (data,old_item_tab_user,w=null,wo=null) {
+function update_tickets_operations_manager (data,old_item_tab_user,w=null,wo=null) {
let insert_type = null
if (w !== null){
insert_type = 'data.tickets_w_manager_html'
@@ -70,7 +70,7 @@ function clear_messenger (data) {
}
}
-export function update_support_chat_func (data){
+function update_support_chat_func (data){
if (msg_cont !== null){
if (msg_cont.dataset['curReceiver'] === ""){
document.querySelector(".info_profile").innerHTML = data.support_chat_html
diff --git a/static/js/chat_sockets.js b/static/js/chat_sockets.js
index fc808cd..5682194 100644
--- a/static/js/chat_sockets.js
+++ b/static/js/chat_sockets.js
@@ -1,4 +1,4 @@
-//
+
// let senderName = localStorage.getItem('senderName');
// if (!senderName) {
// localStorage.setItem('senderName', senderName);
@@ -40,15 +40,24 @@
// }
// var i = 0
-$.import_js('/chat_socket_functions/inital_old_tab.js');
-// import "chat_socket_functions/inital_old_tab.js"
-import "chat_socket_functions/etc_operations_for_chat_socket.js"
-import "chat_socket_functions/update_messenger.js"
-import "chat_socket_functions/update_tickets_operations_manager.js"
-//
-const chatSocket = new WebSocket(ws_url);
+// $.import_js('/chat_socket_functions/inital_old_tab.js');
+// $.import_js('/chat_socket_functions/etc_operations_for_chat_socket.js');
+// $.import_js('/chat_socket_functions/update_messenger.js');
+// $.import_js('/chat_socket_functions/update_tickets_operations_manager.js');
+// import "chat_socket_functions/etc_operations_for_chat_socket.js"
+// import "chat_socket_functions/update_messenger.js"
+// import "chat_socket_functions/update_tickets_operations_manager.js"
+//
+
+// import { update_chat_html, update_list_w_users } from "./chat_socket_functions/update_messenger.js";
+// import { update_support_chat_func, update_tickets_operations_manager } from "./chat_socket_functions/update_tickets_operations_manager.js";
+// import { play_required_beep, update_count_unread_messages } from "./chat_socket_functions/etc_operations_for_chat_socket.js";
+// import { inital_old_tab } from "./chat_socket_functions/inital_old_tab.js";
+
+const chatSocket = new WebSocket(ws_url);
+
function sendMessageSocket (data) {
chatSocket.send(JSON.stringify(data));
if (!data.ticket_id){
@@ -60,8 +69,12 @@ function sendMessageSocket (data) {
}
+
+
+
chatSocket.onmessage = function (e) {
- inital_old_tab()
+
+ let old_item_tab_user = inital_old_tab()
let data = JSON.parse(e.data);
console.log('Data:', data);
console.log("return")
@@ -100,6 +113,150 @@ chatSocket.onmessage = function (e) {
+function update_tickets_operations_manager (data,old_item_tab_user,w=null,wo=null) {
+ let insert_type = null
+ if (w !== null){
+ insert_type = 'data.tickets_w_manager_html'
+ } else if (wo !== null){
+ insert_type = 'data.tickets_wo_manager_html'
+ }
+ if (insert_type) {
+ if (document.querySelector(".list_linked_tickets") !== null || document.querySelector(".list_unlinked_tickets") !== null) {
+ document.querySelector(".list_unlinked_tickets").innerHTML = insert_type
+ // if (el_tab !== null) {
+ // let select_tab = document.querySelector(".tab_user_messanger.select")
+ // if (select_tab) {
+ // select_tab.classList.remove("select")
+ // }
+ // let old_insert_tab = document.querySelector(`[data-cur-receiver-item="${old_item_tab_user}"]`)
+ // if (old_insert_tab) {
+ // old_insert_tab.classList.add("select")
+ // old_insert_tab.scrollIntoView({behavior: "smooth"});
+ // }
+ //
+ // }
+ // let container_messenger = document.querySelector(".container-messages")
+ // if (container_messenger){
+ // let dataset_cont_mes = container_messenger.dataset
+ // if (dataset_cont_mes){
+ // let ticket_id = dataset_cont_mes["ticketId"]
+ // if (ticket_id !== ""){
+ // let ticket = document.querySelector(`[data-cur-receiver-item="${ticket_id}"]`)
+ // if (ticket === null){
+ // let chat = document.querySelector(".block-chat").innerHTML = ""
+ // }
+ // }
+ // }
+ // }
+ select_and_scroll_to_ticket(data,old_item_tab_user)
+ clear_messenger(data)
+ }
+
+ }
+}
+
+
+// function select_and_scroll_to_ticket (data,old_item_tab_user){
+// if (el_tab !== null){
+// document.querySelector(".tab_user_messanger.select").classList.remove("select")
+// let old_insert_tab = document.querySelector(`[data-cur-receiver-item="${old_item_tab_user}"]`)
+// if (old_insert_tab) {
+// old_insert_tab.classList.add("select")
+// old_insert_tab.scrollIntoView({behavior: "smooth"});
+// }
+//
+// }
+// }
+//
+// function clear_messenger (data) {
+// let container_messenger = document.querySelector(".container-messages")
+// if (container_messenger){
+// let dataset_cont_mes = container_messenger.dataset
+// if (dataset_cont_mes){
+// let ticket_id = dataset_cont_mes["ticketId"]
+// if (ticket_id !== ""){
+// let ticket = document.querySelector(`[data-cur-receiver-item="${ticket_id}"]`)
+// if (ticket === null){
+// let chat = document.querySelector(".block-chat").innerHTML = ""
+// }
+// }
+// }
+// }
+// }
+//
+// function update_support_chat_func (data){
+// if (msg_cont !== null){
+// if (msg_cont.dataset['curReceiver'] === ""){
+// document.querySelector(".info_profile").innerHTML = data.support_chat_html
+// }
+// }
+// }
+//
+//
+// function update_chat_html (data,msg_cont) {
+// if (data.chat_html){
+// if (msg_cont !== null){
+// if (msg_cont.dataset['curReceiver'] === ""){
+// document.querySelector(".fotter-chat")
+// msg_cont.innerHTML = data.chat_html
+// } else {
+// // что бы не выводился левый чат
+// if (msg_cont.dataset['curReceiver'] === data['sender'].toString() || msg_cont.dataset['curReceiver'] === data['receiver'].toString()) {
+// msg_cont.innerHTML = data.chat_html
+// }
+// }
+// }
+// }
+// }
+//
+//
+// function update_list_w_users (data,old_item_tab_user) {
+// let list_of_users = document.querySelector(".block-list-of-users")
+// if (list_of_users) {
+//
+// if (data.users_list_html){
+// list_of_users.innerHTML = data.users_list_html
+// if (el_tab !== null){
+// document.querySelector(`[data-cur-receiver-item="${old_item_tab_user}"]` ).classList.add("select")
+// }
+// }
+//
+// }
+// }
+//
+// function inital_old_tab (){
+// let el_tab = document.querySelector(".tab_user_messanger.select")
+// let old_item_tab_user = null;
+// if (el_tab !== null){
+// let dataset = el_tab.dataset;
+// old_item_tab_user = dataset['curReceiverItem'];
+// }
+// return old_item_tab_user
+// }
+//
+//
+// function update_count_unread_messages (data) {
+// let list_unrd = document.querySelectorAll(".qs")
+// let i = 0
+// for (i;i < list_unrd.length;i++){
+// list_unrd[i].innerHTML = data.unread_msgs_count.toString()
+// }
+// }
+//
+// function play_required_beep (data) {
+// const beep = new Audio('/static/sounds/beep_2.mp3')
+// beep.play()
+// }
+
+
+
+
+//end
+
+
+
+
+
// function update_tickets_w_manager (data,old_item_tab_user){
// if (data.tickets_w_manager_html) {
// if (document.querySelector(".list_linked_tickets") !== null || document.querySelector(".list_unlinked_tickets") !== null) {
diff --git a/static/js/user_profile(boris).js b/static/js/user_profile(boris).js
index ab92a1d..17b6ef8 100644
--- a/static/js/user_profile(boris).js
+++ b/static/js/user_profile(boris).js
@@ -1,3 +1,5 @@
+
+
function createTicketShow () {
$.ajax({
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
@@ -199,12 +201,19 @@ function selectedUserMessenger (ticket_id=null,user_id=null){
});
}
+
function sendMessage(id_ticket=null,sender,receiver){
+ // import {sendMessageSocket} from "./chat_sockets";
+
event.preventDefault()
let text = document.querySelector(".enter-message-inp").value
document.querySelector(".enter-message-inp").value = null
+
+
+
+
if (text.length === 0){
//
}
@@ -250,6 +259,7 @@ function sendMessage(id_ticket=null,sender,receiver){
// document.querySelector(".enter-message-inp").focus()
// }
// });
+
sendMessageSocket(data)
}
}
diff --git a/templates/pages/profile/p_user_profile.html b/templates/pages/profile/p_user_profile.html
index e6b192a..e09e66b 100644
--- a/templates/pages/profile/p_user_profile.html
+++ b/templates/pages/profile/p_user_profile.html
@@ -7,14 +7,18 @@
-
+
{# #}
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/templates/tb_base.html b/templates/tb_base.html
index 81bd254..5d6c73a 100644
--- a/templates/tb_base.html
+++ b/templates/tb_base.html
@@ -16,7 +16,7 @@
-
+