From 0ea84c3db43670d692b538c5408b485847a75f6c Mon Sep 17 00:00:00 2001 From: borissedw Date: Thu, 17 Aug 2023 16:21:00 +0300 Subject: [PATCH] 0.0.151 --- static/css/styles(boris).css | 34 +++- .../etc_operations_for_chat_socket.js | 12 ++ .../chat_socket_functions/inital_old_tab.js | 9 + .../chat_socket_functions/update_messenger.js | 30 ++++ .../update_tickets_operations_manager.js | 79 +++++++++ static/js/chat_sockets.js | 166 +++++++----------- static/js/range_slider_double.js | 99 ++++++----- templates/blocks/profile/b_subscribe.html | 6 +- templates/pages/p_results_find_route.html | 17 +- 9 files changed, 299 insertions(+), 153 deletions(-) create mode 100644 static/js/chat_socket_functions/etc_operations_for_chat_socket.js create mode 100644 static/js/chat_socket_functions/inital_old_tab.js create mode 100644 static/js/chat_socket_functions/update_messenger.js create mode 100644 static/js/chat_socket_functions/update_tickets_operations_manager.js diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index 2a49325..2a37cb6 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -1234,10 +1234,17 @@ .options_subscribe_title{ font-weight: 600; font-size: 18px; - color: #272424; padding-bottom: 10px; } +.options_subscribe_title.light{ + color: #272424; +} + +.options_subscribe_title.dark{ + color: #FFFFFF; +} + .text_option_item{ font-size: 16px; color: #272424; @@ -1319,7 +1326,7 @@ .arrange_subscribe{ background: #FF613A; height: 60px; - padding: 20px 35px 20px 35px; + padding: 20px 33px 20px 33px; color: #FFFFFF; border-radius: 10px; margin-top: 20px; @@ -1356,6 +1363,29 @@ margin-bottom: 20px; } +.inputs_for_slider_cont{ + width: 100%; + margin-top: 20px; +} + +.input_f_slider_start{ + float: left; + height: 30px; + width: 40%; + border: 1px solid #E6E6E6; + border-radius: 10px; + padding: 2%; +} + +.input_f_slider_end{ + float: right; + height: 30px; + width: 40%; + border: 1px solid #E6E6E6; + border-radius: 10px; + padding: 2%; +} + .title_el_methods_transportation{ font-size: 16px; color: #272424; 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 new file mode 100644 index 0000000..0195425 --- /dev/null +++ b/static/js/chat_socket_functions/etc_operations_for_chat_socket.js @@ -0,0 +1,12 @@ +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() +} \ 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 new file mode 100644 index 0000000..6bc6614 --- /dev/null +++ b/static/js/chat_socket_functions/inital_old_tab.js @@ -0,0 +1,9 @@ +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 +} \ No newline at end of file diff --git a/static/js/chat_socket_functions/update_messenger.js b/static/js/chat_socket_functions/update_messenger.js new file mode 100644 index 0000000..44f52bb --- /dev/null +++ b/static/js/chat_socket_functions/update_messenger.js @@ -0,0 +1,30 @@ +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") + } + } + + } +} diff --git a/static/js/chat_socket_functions/update_tickets_operations_manager.js b/static/js/chat_socket_functions/update_tickets_operations_manager.js new file mode 100644 index 0000000..4c5cfdf --- /dev/null +++ b/static/js/chat_socket_functions/update_tickets_operations_manager.js @@ -0,0 +1,79 @@ +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 + } + } +} + diff --git a/static/js/chat_sockets.js b/static/js/chat_sockets.js index cd82ce9..94b128a 100644 --- a/static/js/chat_sockets.js +++ b/static/js/chat_sockets.js @@ -55,12 +55,7 @@ function sendMessageSocket (data) { chatSocket.onmessage = function (e) { - 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']; - } + let old_item_tab_user = inital_old_tab() let data = JSON.parse(e.data); console.log('Data:', data); console.log("return") @@ -72,114 +67,89 @@ chatSocket.onmessage = function (e) { console.log(data) } else if (data.type === "update_chat") { let msg_cont = document.querySelector(".container-messages") - 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 - } - } - } - } - if (data.tickets_w_manager_html) { - if (document.querySelector(".list_linked_tickets") !== null || document.querySelector(".list_unlinked_tickets") !== null) { - document.querySelector(".list_linked_tickets").innerHTML = data.tickets_w_manager_html - 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"}); - } - } - 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){ - let chat = document.querySelector(".block-chat").innerHTML = "" - } - } - } - } - } + update_chat_html(data,msg_cont) - } - if (data.tickets_wo_manager_html) { - if (document.querySelector(".list_linked_tickets") !== null || document.querySelector(".list_unlinked_tickets") !== null) { - document.querySelector(".list_unlinked_tickets").innerHTML = data.tickets_wo_manager_html - 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"}); - } + // update_tickets_w_manager(data,old_item_tab_user) + // + // update_tickets_wo_manager(data,old_item_tab_user)л - } - 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){ - let chat = document.querySelector(".block-chat").innerHTML = "" - } - } - } - } - } + update_tickets_operations_manager(data,old_item_tab_user,'w') - } - else { - let list_of_users = document.querySelector(".block-list-of-users") - if (list_of_users !== null){ - 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") - } - } + update_tickets_operations_manager(data,old_item_tab_user,null,'wo') - } - } + update_list_w_users(data,old_item_tab_user) } else if (data.type === "update_support_chat"){ - if (msg_cont !== null){ - if (msg_cont.dataset['curReceiver'] === ""){ - document.querySelector(".info_profile").innerHTML = data.support_chat_html - } - } + update_support_chat_func(data) } if (data.unread_msgs_count > 0){ - 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() - } + update_count_unread_messages(data) } if (data.required_beep === true) { - const beep = new Audio('/static/sounds/beep_2.mp3') - beep.play() - + play_required_beep(data) } } + +// 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) { +// document.querySelector(".list_linked_tickets").innerHTML = data.tickets_w_manager_html +// +// select_and_scroll_to_ticket(data,old_item_tab_user) +// +// clear_messenger(data) +// +// } +// +// } +// } +// + + +// function update_tickets_wo_manager (data,old_item_tab_user) { +// if (data.tickets_wo_manager_html) { +// if (document.querySelector(".list_linked_tickets") !== null || document.querySelector(".list_unlinked_tickets") !== null) { +// document.querySelector(".list_unlinked_tickets").innerHTML = data.tickets_wo_manager_html +// 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 = "" +// } +// } +// } +// } +// } +// +// } +// } +// +// +// +// + + + // let url = `ws://localhost:8000/ws/socket-server/`; // // const chatSocket = new WebSocket(url); diff --git a/static/js/range_slider_double.js b/static/js/range_slider_double.js index 505d721..6e59686 100644 --- a/static/js/range_slider_double.js +++ b/static/js/range_slider_double.js @@ -1,58 +1,65 @@ -var $range = $(".js-range-slider"), - $inputFrom = $(".js-input-from"), - $inputTo = $(".js-input-to"), - instance, - min = 0, - max = 1000, - from = 0, - to = 0; -$range.ionRangeSlider({ - skin: "round", - type: "double", - min: min, - max: max, - from: 200, - to: 800, - onStart: updateInputs, - onChange: updateInputs -}); -instance = $range.data("ionRangeSlider"); -function updateInputs (data) { - from = data.from; - to = data.to; - - $inputFrom.prop("value", from); - $inputTo.prop("value", to); +window.onload = function () { + inital_slider() } -$inputFrom.on("input", function () { - var val = $(this).prop("value"); +function inital_slider (){ + var $range = $(".range_slider_form_filters"), + $inputFrom = $(".input_f_slider_start"), + $inputTo = $(".input_f_slider_end"), + instance, + min = 0, + max = 1000, + from = 0, + to = 0; + $range.ionRangeSlider({ + skin: "round", + type: "double", + min: min, + max: max, + from: 100, + to: 900, + onStart: updateInputs, + onChange: updateInputs + }); + instance = $range.data("ionRangeSlider"); - // validate - if (val < min) { - val = min; - } else if (val > to) { - val = to; + function updateInputs (data) { + from = data.from; + to = data.to; + + $inputFrom.prop("value", from); + $inputTo.prop("value", to); } - instance.update({ - from: val + $inputFrom.on("input", function () { + var val = $(this).prop("value"); + + // validate + if (val < min) { + val = min; + } else if (val > to) { + val = to; + } + + instance.update({ + from: val + }); }); -}); -$inputTo.on("input", function () { - var val = $(this).prop("value"); + $inputTo.on("input", function () { + var val = $(this).prop("value"); - // validate - if (val < from) { - val = from; - } else if (val > max) { - val = max; - } + // validate + if (val < from) { + val = from; + } else if (val > max) { + val = max; + } - instance.update({ - to: val + instance.update({ + to: val + }); }); -}); \ No newline at end of file +} \ No newline at end of file diff --git a/templates/blocks/profile/b_subscribe.html b/templates/blocks/profile/b_subscribe.html index 56d81dc..b0501ca 100644 --- a/templates/blocks/profile/b_subscribe.html +++ b/templates/blocks/profile/b_subscribe.html @@ -31,7 +31,7 @@
-
+
Опции:
@@ -63,7 +63,7 @@
-
+
Опции:
@@ -94,7 +94,7 @@
-
+
Опции:
diff --git a/templates/pages/p_results_find_route.html b/templates/pages/p_results_find_route.html index bc7bb44..3294ba6 100644 --- a/templates/pages/p_results_find_route.html +++ b/templates/pages/p_results_find_route.html @@ -170,15 +170,24 @@
- +
-
- - +
+ + +
+
+
Сортировать по:
+ +
+
+
{% for route in routes %} {% include "widgets/w_carrier_card.html" %}