From 8ffcbfb88861141847ba5b324b2b496e38385e37 Mon Sep 17 00:00:00 2001 From: borissedw Date: Tue, 1 Aug 2023 16:55:41 +0300 Subject: [PATCH] 0.0.9 --- static/css/styles(boris).css | 54 +++++++- static/img/svg/attach-file.svg | 5 + static/img/svg/send_btn.svg | 4 + static/js/user_profile(boris).js | 121 +++++++++--------- templates/blocks/profile/b_create_ticket.html | 15 ++- .../blocks/profile/b_new_msg_to_user.html | 11 +- templates/blocks/profile/b_support_chat.html | 1 + 7 files changed, 142 insertions(+), 69 deletions(-) create mode 100644 static/img/svg/attach-file.svg create mode 100644 static/img/svg/send_btn.svg create mode 100644 templates/blocks/profile/b_support_chat.html diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index 87d34d0..054a738 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -141,8 +141,8 @@ } .create-ticket-file{ - display: block; - opacity: 0; + display: none; + /*opacity: 0;*/ } .form-create-tickets-btns{ @@ -263,9 +263,55 @@ } .footer-chat{ - width: 100%; - height: 60px; + width: calc(100% - 40px); + height: 20px; background: #FFFFFF; border-radius: 10px; border: 1px solid #E6E6E6; + padding: 20px; +} + +.left-part-block-enter-message{ + width: 90%; + float: left; +} + +.enter-message-inp{ + color: #000000; + width: 100%; + height: 100%; + background: none; + outline: none; + border: none; +} + + +.attach-file-btn-message{ + width: 24px; + height: 24px; + background: url("/static/img/svg/attach-file.svg"); + background-size: 24px; + background-repeat: no-repeat; + background-position: center; +} + +.send-message{ + width: 40px; + height: 40px; + background: url("/static/img/svg/send_btn.svg"); + background-size: 40px; + background-position: center; + background-repeat: no-repeat; + margin-left: 5px; +} + +.errors{ + color: red; + font-size: 11px; +} + +.errors_all{ + font-size: 11px; + color: #ffb3b3; + float: left; } \ No newline at end of file diff --git a/static/img/svg/attach-file.svg b/static/img/svg/attach-file.svg new file mode 100644 index 0000000..3091237 --- /dev/null +++ b/static/img/svg/attach-file.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/static/img/svg/send_btn.svg b/static/img/svg/send_btn.svg new file mode 100644 index 0000000..8fba1fc --- /dev/null +++ b/static/img/svg/send_btn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/js/user_profile(boris).js b/static/js/user_profile(boris).js index 3758647..fa332db 100644 --- a/static/js/user_profile(boris).js +++ b/static/js/user_profile(boris).js @@ -1,7 +1,7 @@ function createTicketShow () { $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, - url: '/ru/user_account/support_create_ticket_ajax/', + url: '/ru/messages/support_create_ticket_form/', type: "POST", // async: true, cache: false, @@ -29,6 +29,22 @@ function countLetters () { } } +// var input; + + +function inputQuest (){ + event.preventDefault() + // let input = document.querySelector(".create-ticket-file") + let input = document.createElement("input"); + input.setAttribute("type", "file") + input.style.display = "none" + input.click() + // console.log("asd") + + return input +} + + function attachFileCreateTicket () { event.preventDefault() let input = document.querySelector(".create-ticket-file") @@ -54,61 +70,50 @@ function attachFileCreateTicket () { } +function attachFilemeassge () { + let input = inputQuest() + let file = input.files[0] + // let file_url = URL.createObjectURL(file) -// $( "#slider-range" ).slider({ -// range: true, -// min: 0, -// max: 1000, -// values: [ 0, 1000 ], -// step: 1, -// slide: function( event, ui ) { -// $( "#control-price-1" ).val(ui.values[ 0 ]); -// $( "#control-price-2" ).val( ui.values[ 1 ] ); -// } -// }); -// $( "#control-price-1" ).val($( "#slider-range" ).slider( "values", 0 )); -// $( "#control-price-2" ).val($( "#slider-range" ).slider( "values", 1 )); -// -// -// -// function set_range(obj) { -// let parent = $(obj).parents('.input-control-price')[0]; -// let min_obj = $(parent).find('#control-price-1')[0]; -// let max_obj = $(parent).find('#control-price-2')[0]; -// var valmin = min_obj.value; -// var valmax = max_obj.value; -// -// if (min_obj === obj) { -// if (valmin < 0){ -// valmin = 0 -// } -// else if (valmin > 1000){ -// valmin = 1000 -// } -// else if (valmin > valmax){ -// valmin = valmax -// } -// $(parent).find('#control-price-1')[0].value = valmin; -// } else if (max_obj === obj) { -// if (valmax > 1000) { -// valmax = 1000 -// } -// else if (valmax < 1) { -// valmax = 1 -// } -// else if (valmax < valmin) { -// valmax = valmin -// } -// $(parent).find('#control-price-2')[0].value = valmax; -// } -// -// -// -// -// -// $("#slider-range" ).slider({ -// values: [parseInt(valmin), parseInt(valmax)] -// }); -// -// -// } \ No newline at end of file + + + let data = file + $.ajax({ + headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, + url: '/ru/user_account/support_create_ticket_ajax/', + type: "POST", + // async: true, + cache: false, + processData: false, + contentType: false, + // enctype: 'json', + data: data, + success: function(data){ + + document.querySelector(".insert-tech-place").innerHTML = data.html; + + }, + }); + input.remove() +} + +function createTicket (el) { + let form = el.form + let formData = new formData (form) + $.ajax({ + headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, + url: '/ru/user_account/support_create_ticket_ajax/', + type: "POST", + // async: true, + cache: false, + processData: false, + contentType: false, + // enctype: 'json', + data: formData, + success: function(data){ + + document.querySelector(".insert-tech-place").innerHTML = data.html; + + }, + }); +} diff --git a/templates/blocks/profile/b_create_ticket.html b/templates/blocks/profile/b_create_ticket.html index 0fdbcc3..38c4560 100644 --- a/templates/blocks/profile/b_create_ticket.html +++ b/templates/blocks/profile/b_create_ticket.html @@ -1,26 +1,37 @@ {% load static %}
+ + {% if errors.all__ %}
{{ errors.all__ }}
{% endif %} + {% csrf_token %} + {% if form.errors.name %}
{{ form.errors.name }}
{% endif %} + {% if form.errors.name %}
{{ form.errors.name }}
{% endif %} +
0/500
+ {% if form.errors.name %}
{{ form.errors.name }}
{% endif %} +
- + - +{# #}
\ No newline at end of file diff --git a/templates/blocks/profile/b_new_msg_to_user.html b/templates/blocks/profile/b_new_msg_to_user.html index 06032ed..3b4492a 100644 --- a/templates/blocks/profile/b_new_msg_to_user.html +++ b/templates/blocks/profile/b_new_msg_to_user.html @@ -20,12 +20,12 @@ {% include "widgets/w_message.html" %} + \ No newline at end of file diff --git a/templates/blocks/profile/b_support_chat.html b/templates/blocks/profile/b_support_chat.html new file mode 100644 index 0000000..b0797a4 --- /dev/null +++ b/templates/blocks/profile/b_support_chat.html @@ -0,0 +1 @@ +{% load static %} \ No newline at end of file