This commit is contained in:
2023-08-01 16:55:41 +03:00
parent e4d4813909
commit 8ffcbfb888
7 changed files with 142 additions and 69 deletions

View File

@@ -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;
}

View File

@@ -0,0 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="filled/editor/attach-file">
<path id="Vector" d="M16.5 6V17.5C16.5 19.71 14.71 21.5 12.5 21.5C10.29 21.5 8.5 19.71 8.5 17.5V5C8.5 3.62 9.62 2.5 11 2.5C12.38 2.5 13.5 3.62 13.5 5V15.5C13.5 16.05 13.05 16.5 12.5 16.5C11.95 16.5 11.5 16.05 11.5 15.5V6H10V15.5C10 16.88 11.12 18 12.5 18C13.88 18 15 16.88 15 15.5V5C15 2.79 13.21 1 11 1C8.79 1 7 2.79 7 5V17.5C7 20.54 9.46 23 12.5 23C15.54 23 18 20.54 18 17.5V6H16.5Z" fill="#272424" fill-opacity="0.6"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 565 B

View File

@@ -0,0 +1,4 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="10" fill="#FF613A"/>
<path d="M10.01 29L31 20L10.01 11L10 18L25 20L10 22L10.01 29Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 235 B

View File

@@ -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)]
// });
//
//
// }
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;
},
});
}

View File

@@ -1,26 +1,37 @@
{% load static %}
<form class="form-create-ticket" name="create-ticket">
{% if errors.all__ %}<div class="errors_all" style="margin-bottom: 12px;width: 100%;font-size: 16px;">{{ errors.all__ }}</div>{% endif %}
{% csrf_token %}
<select name="department"
id="id_department"
class="el-form-create-ticket">
</select>
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
<input type="text"
class="el-form-create-ticket"
name="name"
id="id_name"
placeholder="Тема запроса"
value="{% if form.adding_machine.name %}{{ form.adding_machine.name }}{% endif %}"
>
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
<div class="letrs-count" style="color: #27242499;position: relative;top: 20px;left: 780px;display: inline-block;"><span class="letrs-count-span">0</span><span>/500</span></div>
<textarea name="text"
id="id_text"
class="el-form-create-ticket-textarea"
placeholder="Введите сообщение..."
value="{% if form.adding_machine.name %}{{ form.adding_machine.name }}{% endif %}"
onkeyup="countLetters()"></textarea>
{% if form.errors.name %}<div class="errors">{{ form.errors.name }}</div>{% endif %}
<div class="form-create-tickets-btns">
<button class="create-ticket-btn">Создать тикет</button>
<button class="create-ticket-btn" onclick="createTicket()">Создать тикет</button>
<button class="attach-file-btn" onclick="attachFileCreateTicket()"></button>
<input class="create-ticket-file" type="file" value="">
{# <input class="create-ticket-file" type="file" value="">#}
</div>
</form>

View File

@@ -20,12 +20,12 @@
{% include "widgets/w_message.html" %}
</div>
<div class="footer-chat">
<div>
<div class="left-part-block-enter-message">
<input class="enter-message-inp" placeholder="Отправить сообщение">
</div>
<div>
<img>
<button></button>
<div class="right-part-block-enter-message">
<button class="attach-file-btn-message" onclick="attachFilemeassge()"></button>
<button class="send-message"></button>
</div>
</div>
</div>
@@ -34,5 +34,6 @@
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
{% load static %}