This commit is contained in:
2023-09-18 00:25:09 +03:00
parent 9b7fbe8fd3
commit 96c1b23362
7 changed files with 64 additions and 9 deletions

View File

@@ -461,6 +461,21 @@
margin-left: 5px;
}
.loader_show_message.show{
width: 40px;
height: 40px;
margin-left: 5px;
display: inline-block;
}
.loader_show_message{
display: none;
}
.send-message.hide{
display: none;
}
.errors{
color: red;
font-size: 11px;
@@ -676,22 +691,24 @@
.file_border_cont{
padding: 5%;
width: 95%;
height: 100%;
width: 90%;
height: 90%;
}
.left_part_file_w{
width: 20%;
width: 10%;
height: 100%;
float: left;
}
.right_part_file_w{
width: 80%;
width: 85%;
height: 100%;
color: #FFFFFF;
font-size: 14px;
float: right;
overflow-wrap: break-word;
padding-left: 5%;
}
.right_part_file_w.left{
color: #000000;

View File

@@ -13,4 +13,22 @@ function update_count_unread_messages (data) {
function play_required_beep (data,beep) {
beep.play()
}
function loader_show_message (data) {
let loader = document.querySelector(".loader_show_message");
let send_btn = document.querySelector(".send-message")
if (loader){
if (loader.classList.contains("show")){
send_btn.classList.remove("hide")
loader.classList.remove("show")
} else {
send_btn.classList.add("hide")
loader.classList.add("show")
}
} else {
console.log("cannot find loader")
}
}

View File

@@ -4,7 +4,7 @@ function sendMessageSocket (data) {
if (chatSocket.readyState !== 1 && chatSocket.readyState !== 0){
init_ws()
}
loader_show_message(data)
chatSocket.send(JSON.stringify(data));
if (!data.ticket_id){
let el_tab = document.querySelector(".tab_user_messanger.select")
@@ -105,6 +105,7 @@ function wsReceiveData (e) {
if (data.required_beep === true) {
play_required_beep(data,beep)
}
loader_show_message(data)
}

View File

@@ -218,7 +218,6 @@ async function attachFilemeassge (el,id_ticket=null,sender,receiver){
}

View File

@@ -229,12 +229,31 @@ function confirmRemove(el) {
}
}
function loader_place_ins_boris (el,type=null){
if (el){
let loader_place = document.querySelector(".abbreviation_airport_in_search")
let cur_loader_place = el.nextElementSibling
if (type){
cur_loader_place.innerHTML = ""
} else {
if (loader_place){
if (cur_loader_place.innerHTML === '<img src="/static/img/svg/loader.svg" style="height: 30px;padding-top: 17px;padding-left: 15px;">'){
cur_loader_place.innerHTML = ""
} else {
cur_loader_place.innerHTML = "<img src='/static/img/svg/loader.svg' style='height: 30px;padding-top: 17px;padding-left: 15px;'>"
}
}
}
}
}
function searchTown(el){
if (el.value.length > 0){
el.style.background = 'white url("/static/img/svg/loader.svg") no-repeat calc(100% - 15px) center';
loader_place_ins_boris(el)
}else {
el.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center';
}
@@ -269,7 +288,7 @@ function searchTown(el){
data: JSON.stringify(get_address_point),
success: function(data){
el.style.background = 'white url("/static/img/png/icon-arrow.svg") no-repeat calc(100% - 15px) center';
loader_place_ins_boris(el,"el")
return insertSearchList(data, el.name + '_list');

View File

@@ -65,6 +65,7 @@
<input style="display: none;" type="file" onchange="attachFilemeassge(this,null,{{ user.id }},{{ cur_receiver.id }})" id="id_choce_file" multiple>
<label for="id_choce_file" class="attach-file-btn-message"></label>
<button class="send-message" onclick="sendMessage(null,{{ user.id }},{{ cur_receiver.id }})"></button>
<img src="{% static "/img/svg/loader.svg" %}" class="loader_show_message">
{# <button class="send-message" onclick="send_ws_msg('message')"></button>#}
</div>
</div>

View File

@@ -32,7 +32,7 @@
id="id_from_address_point_txt"
{% if route_form.initial.from_address_point_txt %}value="{{ route_form.initial.from_address_point_txt }}"{% endif %}
/>
<div class="abbreviation_airport_in_search"><text>MSQ</text></div>
<div class="abbreviation_airport_in_search"></div>
<div class="input_list find_route" name="from_address_point_txt_list">
</div>