|
|
|
|
@ -47,8 +47,7 @@ |
|
|
|
|
{% endthumbnail %} |
|
|
|
|
</div> |
|
|
|
|
<p class="nameMess"> |
|
|
|
|
<a href="#"> |
|
|
|
|
{{ contact.username }}{{ contact.username }}{{ contact.first_name }} {{ contact.last_name }}</a> |
|
|
|
|
<div><a href="#" style="color:black;">{{ contact.username }}</a></div> |
|
|
|
|
</p> |
|
|
|
|
<a href="javascript:void(0)" class="conMess">Контакты</a> |
|
|
|
|
|
|
|
|
|
@ -172,7 +171,7 @@ |
|
|
|
|
<div class="messageBlock box-sizing disTab"> |
|
|
|
|
<p>Заказы</p> |
|
|
|
|
{% for torder in team_orders %} |
|
|
|
|
<div class="team-order-block orderBlock box-sizing orAct" data-team-id="{{ torder.team.pk }}" data-order-id="{{ torder.pk}}"> |
|
|
|
|
<div class="team-order-block orderBlock box-sizing" data-team-id="{{ torder.team.pk }}" data-order-id="{{ torder.pk}}"> |
|
|
|
|
<span class="dimovChat"></span> |
|
|
|
|
<p class="titleOB"> |
|
|
|
|
{{ torder }} |
|
|
|
|
@ -184,14 +183,16 @@ |
|
|
|
|
</p> |
|
|
|
|
<ul class="listChat1"> |
|
|
|
|
{% for tuser in torder.team.users.all %} |
|
|
|
|
<li>{{ tuser }}</li> |
|
|
|
|
<li>{{ tuser }}</li> |
|
|
|
|
{% endfor %} |
|
|
|
|
</ul> |
|
|
|
|
|
|
|
|
|
<p class="pOB"> |
|
|
|
|
<span>Чаты:</span> |
|
|
|
|
{% for tuser in torder.team.users.all %} |
|
|
|
|
{% if request.user.pk != tuser.pk %} |
|
|
|
|
<span class="team-chat-user" data-id="{{ tuser.pk }}">{{ tuser.username }},</span> |
|
|
|
|
{% endif %} |
|
|
|
|
{% endfor %} |
|
|
|
|
</p> |
|
|
|
|
<a href="javascript:void(0)" class="linkChat11"> |
|
|
|
|
@ -204,19 +205,21 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="col-lg-6 commChat"> |
|
|
|
|
<div id="message-chat-team-space"></div> |
|
|
|
|
<form id="team-chat-form"> |
|
|
|
|
<input type="text" name="sender" id="senderId" value="{{ request.user.pk }}" /> |
|
|
|
|
<input type="text" name="recipent" id="recipentId" value="" /> |
|
|
|
|
<input type="text" name="order" id="orderId" value="" /> |
|
|
|
|
<input type="text" name="team" id="teamId" value="" /> |
|
|
|
|
<textarea id="chatText" class="box-sizing"></textarea> |
|
|
|
|
<textarea id="chatText" class="chat-textarea box-sizing"></textarea> |
|
|
|
|
<div class="bunChat"> |
|
|
|
|
<div class="setChat box-sizing"> |
|
|
|
|
<div class="setChat box-sizing upload"> |
|
|
|
|
<input type="file" name="file" id="upload-document-team"/> |
|
|
|
|
<p>Прикрепить файл</p> |
|
|
|
|
<span> |
|
|
|
|
Не более 10 файлов с общим объемом 500мб |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
<div id="progress" class="progress"> |
|
|
|
|
<div class="progress-bar progress-bar-success"></div> |
|
|
|
|
</div> |
|
|
|
|
<a href="javascript:void(0)" id="add-team-chat-message">отправить</a> |
|
|
|
|
</div> |
|
|
|
|
</form> |
|
|
|
|
@ -238,6 +241,11 @@ |
|
|
|
|
{# <script type="text/javascript" src="{% static 'js/chat.js' %}"></script>#} |
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
|
|
function csrfSafeMethod(method) { |
|
|
|
|
// these HTTP methods do not require CSRF protection |
|
|
|
|
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var SocketHandler = function () { |
|
|
|
|
var userId = {{ request.user.pk }}; |
|
|
|
|
var url = 'ws://127.0.0.1:8888/chat/' + userId + '/'; |
|
|
|
|
@ -258,7 +266,12 @@ |
|
|
|
|
inbox = document.getElementById('message-chat-space'); |
|
|
|
|
} else if (message.answer_type == 'order' || message.answer_type == 'add_message_order') { |
|
|
|
|
inbox = document.getElementById('message-chat-order-space'); |
|
|
|
|
} else if(message.answer_type == 'add_message_team'){ |
|
|
|
|
inbox = document.getElementById('message-chat-team-space'); |
|
|
|
|
} |
|
|
|
|
console.log(message.answer_type); |
|
|
|
|
console.log(message.msg); |
|
|
|
|
|
|
|
|
|
inbox.innerHTML += '<div class="col-lg-12 insetCommChat"><div class="topCommChat">' + |
|
|
|
|
'<p class="nameCommChat">ВЫ</p> <span>13.0.2016</span></div>' + |
|
|
|
|
'<p class="textCommChat">' + message.msg + '</p></div>'; |
|
|
|
|
@ -274,6 +287,7 @@ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
this.add_team_message = function(messageData){ |
|
|
|
|
|
|
|
|
|
console.log(messageData); |
|
|
|
|
sock.send(JSON.stringify(messageData)); |
|
|
|
|
} |
|
|
|
|
@ -305,23 +319,106 @@ |
|
|
|
|
var form = document.getElementById('message_form'); |
|
|
|
|
var csrftoken = getCookie('csrftoken'); |
|
|
|
|
|
|
|
|
|
setTimeout(function(){ |
|
|
|
|
$(".user-block").first().trigger('click'); |
|
|
|
|
}, 10); |
|
|
|
|
|
|
|
|
|
setTimeout(function(){ |
|
|
|
|
$(".order-block").first().trigger('click'); |
|
|
|
|
}, 100); |
|
|
|
|
|
|
|
|
|
setTimeout(function(){ |
|
|
|
|
$(".team-order-block").first().trigger('click'); |
|
|
|
|
}, 1000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var url = '/work_sell/basic/'; |
|
|
|
|
$('#upload-document-team').fileupload({ |
|
|
|
|
url: url, |
|
|
|
|
crossDomain: false, |
|
|
|
|
beforeSend: function (xhr, settings) { |
|
|
|
|
$('#progress .progress-bar').css( |
|
|
|
|
'width', |
|
|
|
|
'0%' |
|
|
|
|
); |
|
|
|
|
if (!csrfSafeMethod(settings.type)) { |
|
|
|
|
xhr.setRequestHeader("X-CSRFToken", csrftoken); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
dataType: 'json', |
|
|
|
|
done: function (e, data) {; |
|
|
|
|
$.each(data.result.files, function (index, file) { |
|
|
|
|
alert(file.url); |
|
|
|
|
{# var htmlImg = '<div class="col-lg-4"><div class="insetCol box-sizing disTab"><div class="imgGal" style="background: url(+ file.url +) no-repeat center;"><div class="imgFigure"></div></div></div> ' +#} |
|
|
|
|
{# '<div class="insetCol2 box-sizing disTab"><p>Название</p><div class="buttonsImg" distab="">' +#} |
|
|
|
|
{# '<div class="insetBI insetBI2"><i class="fa fa-times"></i></div></div></div></div>';#} |
|
|
|
|
{##} |
|
|
|
|
{# var img = $(htmlImg).appendTo("#diplom-gallery");#} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
progressall: function (e, data) { |
|
|
|
|
|
|
|
|
|
var progress = parseInt(data.loaded / data.total * 100, 10); |
|
|
|
|
alert(progress); |
|
|
|
|
$('#progress .progress-bar').css( |
|
|
|
|
'width', |
|
|
|
|
progress + '%' |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}).prop('disabled', !$.support.fileInput) |
|
|
|
|
.parent().addClass($.support.fileInput ? undefined : 'disabled'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#approve-stages").on('click', function(){ |
|
|
|
|
$(".stage-block-approve").each(function(){ |
|
|
|
|
var stageId = $(this).attr('data-id'); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(".team-chat-user").on('click',function(){ |
|
|
|
|
var recipentId = $(this).attr('data-id'); |
|
|
|
|
$("#team-chat-form #recipentId").val(recipentId); |
|
|
|
|
$(".team-chat-user").on('click',function(e){ |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
var recipentId = $(this).attr('data-id'); |
|
|
|
|
$("#team-chat-form #recipentId").val(recipentId); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(".team-order-block").on('click', function(){ |
|
|
|
|
|
|
|
|
|
$('.team-order-block').each(function () { |
|
|
|
|
$(this).removeClass('orAct'); |
|
|
|
|
}); |
|
|
|
|
$(this).addClass('orAct'); |
|
|
|
|
|
|
|
|
|
var teamId = $(this).attr('data-team-id'); |
|
|
|
|
var orderId = $(this).attr('data-order-id'); |
|
|
|
|
$("#team-chat-form #teamId").val(teamId); |
|
|
|
|
$("#team-chat-form #orderId").val(orderId); |
|
|
|
|
|
|
|
|
|
var inbox = document.getElementById('message-chat-team-space'); |
|
|
|
|
inbox.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
url: '/api/message', |
|
|
|
|
type: 'GET', |
|
|
|
|
data: {csrfmiddlewaretoken: csrftoken, 'team': teamId,'order': orderId}, |
|
|
|
|
dataType: 'json', |
|
|
|
|
success: function (json) { |
|
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
|
var senderName = 'Вы'; |
|
|
|
|
var className = 'youChat'; |
|
|
|
|
if (v.sender.id !== currentChatUser) { |
|
|
|
|
senderName = v.sender.username; |
|
|
|
|
className = ''; |
|
|
|
|
} |
|
|
|
|
inbox.innerHTML += '<div class="col-lg-12 insetCommChat"><div class="topCommChat">' + |
|
|
|
|
'<p class="nameCommChat">' + senderName + '</p> <span>' + v.created + '</span></div>' + |
|
|
|
|
'<p class="textCommChat">' + v.text + '</p></div>'; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// Вытащить сообщения для чата заказа |
|
|
|
|
@ -474,6 +571,7 @@ |
|
|
|
|
var recipentId = $("#team-chat-form #recipentId").val(); |
|
|
|
|
var senderId = $("#team-chat-form #senderId").val(); |
|
|
|
|
var teamId = $("#team-chat-form #teamId").val(); |
|
|
|
|
var orderId = $("#team-chat-form #orderId").val(); |
|
|
|
|
|
|
|
|
|
socket.add_team_message({ |
|
|
|
|
"format_type": "add_message_team", |
|
|
|
|
@ -482,8 +580,11 @@ |
|
|
|
|
"recipent_id": recipentId, |
|
|
|
|
"chat_message": chatMessage, |
|
|
|
|
"team_id": teamId, |
|
|
|
|
"order_id": orderId, |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$("#team-chat-form #chatText").val(""); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// Добавить сообщение для контакта |
|
|
|
|
|