|
|
|
@ -52,7 +52,7 @@ |
|
|
|
<a href="#" data-target="#userModal" data-toggle="modal" |
|
|
|
<a href="#" data-target="#userModal" data-toggle="modal" |
|
|
|
class="conMess">Контакты</a> |
|
|
|
class="conMess">Контакты</a> |
|
|
|
|
|
|
|
|
|
|
|
<span>0</span> |
|
|
|
<span class="contact-count-{{ contact.pk|add:request.user.pk }}">0</span> |
|
|
|
<a href="#" class="deleteMess" data-recipent-id="{{ contact.pk }}"> |
|
|
|
<a href="#" class="deleteMess" data-recipent-id="{{ contact.pk }}"> |
|
|
|
Удалить контакт |
|
|
|
Удалить контакт |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
@ -67,8 +67,8 @@ |
|
|
|
<form id="contact-chat-form"> |
|
|
|
<form id="contact-chat-form"> |
|
|
|
<input type="hidden" value="{{ request.user.pk }}" name="senderId" id="senderContactId"/> |
|
|
|
<input type="hidden" value="{{ request.user.pk }}" name="senderId" id="senderContactId"/> |
|
|
|
<input type="hidden" name="recipentId" id="recipentContactId"> |
|
|
|
<input type="hidden" name="recipentId" id="recipentContactId"> |
|
|
|
|
|
|
|
|
|
|
|
<textarea id="chat" name="chat_message" class="box-sizing"></textarea> |
|
|
|
<textarea id="chat" name="chat_message" class="box-sizing"></textarea> |
|
|
|
|
|
|
|
<p class="errorEmptyMessage" style="color: red;display:none;">Пустое сообщение нельзя отправить</p> |
|
|
|
|
|
|
|
|
|
|
|
<div class="bunChat"> |
|
|
|
<div class="bunChat"> |
|
|
|
<div class="setChat box-sizing upload"> |
|
|
|
<div class="setChat box-sizing upload"> |
|
|
|
@ -137,6 +137,7 @@ |
|
|
|
<input type="hidden" name="recipentId" id="recipentId"> |
|
|
|
<input type="hidden" name="recipentId" id="recipentId"> |
|
|
|
<input type="hidden" name="orderId" id="orderId"> |
|
|
|
<input type="hidden" name="orderId" id="orderId"> |
|
|
|
<textarea id="chat" class="box-sizing"></textarea> |
|
|
|
<textarea id="chat" class="box-sizing"></textarea> |
|
|
|
|
|
|
|
<p class="errorEmptyMessage" style="color: red;display:none;">Пустое сообщение нельзя отправить</p> |
|
|
|
<div class="bunChat"> |
|
|
|
<div class="bunChat"> |
|
|
|
<div class="setChat box-sizing upload"> |
|
|
|
<div class="setChat box-sizing upload"> |
|
|
|
<input type="file" name="file" id="upload-document-order"> |
|
|
|
<input type="file" name="file" id="upload-document-order"> |
|
|
|
@ -192,6 +193,14 @@ |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-lg-12 documentsChat"> |
|
|
|
|
|
|
|
<p>Входящие документы</p> |
|
|
|
|
|
|
|
<ul id="documentOrderSpace"></ul> |
|
|
|
|
|
|
|
{# <a href="javascript:void(0)">#} |
|
|
|
|
|
|
|
{# Распечатать с помощью ресурса#} |
|
|
|
|
|
|
|
{# </a>#} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="textAreaBlock2 box-sizing disTab"> |
|
|
|
<div class="textAreaBlock2 box-sizing disTab"> |
|
|
|
<p>Для заметок</p> |
|
|
|
<p>Для заметок</p> |
|
|
|
<textarea id="chat2"></textarea> |
|
|
|
<textarea id="chat2"></textarea> |
|
|
|
@ -229,6 +238,12 @@ |
|
|
|
var currentChatUser = {{ request.user.pk }}; |
|
|
|
var currentChatUser = {{ request.user.pk }}; |
|
|
|
var form = document.getElementById('message_form'); |
|
|
|
var form = document.getElementById('message_form'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('body').on('focus',".term-picker", function(){ |
|
|
|
|
|
|
|
$(this).datepicker({ |
|
|
|
|
|
|
|
minDate: 0, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
$("#reserve-button").on("click",function(e) { |
|
|
|
$("#reserve-button").on("click",function(e) { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
$("#reserve-stage-modal").modal('show'); |
|
|
|
$("#reserve-stage-modal").modal('show'); |
|
|
|
@ -279,7 +294,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#tab2").on("change","#stagesSelect", function(e){ |
|
|
|
$("#tab2").on("change","#stagesSelect", function(e){ |
|
|
|
var sumStage = $(this).find('option:selected').attr("data-stage-sum"); |
|
|
|
var sumStage = $(this).find('option:selected').attr("data-stage-sum"); |
|
|
|
$("#choiceWayStage").val(sumStage); |
|
|
|
$("#choiceWayStage").val(sumStage); |
|
|
|
@ -313,7 +327,7 @@ |
|
|
|
'<label for="">Название</label><input class="form-control" name="name" type="text" />' + |
|
|
|
'<label for="">Название</label><input class="form-control" name="name" type="text" />' + |
|
|
|
'<label for="">Цена</label><input class="form-control" name="cost" type="text" />' + |
|
|
|
'<label for="">Цена</label><input class="form-control" name="cost" type="text" />' + |
|
|
|
'<input class="form-control orderStagesInput" name="order" type="hidden" value="' + orderId + '"/>' + |
|
|
|
'<input class="form-control orderStagesInput" name="order" type="hidden" value="' + orderId + '"/>' + |
|
|
|
'<label for="">Срок</label><input class="form-control" name="term" type="text" />' + |
|
|
|
'<label for="">Срок</label><input class="term-picker form-control datepicker" name="term" type="text" />' + |
|
|
|
'<label for="">Результат</label><input class="form-control" name="result" type="text" />' + |
|
|
|
'<label for="">Результат</label><input class="form-control" name="result" type="text" />' + |
|
|
|
'<input class="form-control" name="pos" value="1" type="hidden" />' + |
|
|
|
'<input class="form-control" name="pos" value="1" type="hidden" />' + |
|
|
|
'</form></div>'; |
|
|
|
'</form></div>'; |
|
|
|
@ -342,7 +356,7 @@ |
|
|
|
'<label for="">Название</label><input class="form-control" type="text" name="name" value="' + v.name + '" />' + |
|
|
|
'<label for="">Название</label><input class="form-control" type="text" name="name" value="' + v.name + '" />' + |
|
|
|
'<label for="">Цена</label><input class="form-control" type="text" name="cost" value="' + v.cost + '" />' + |
|
|
|
'<label for="">Цена</label><input class="form-control" type="text" name="cost" value="' + v.cost + '" />' + |
|
|
|
'<input class="form-control orderStagesInput" type="hidden" name="order" value="' + v.order + '"/>' + |
|
|
|
'<input class="form-control orderStagesInput" type="hidden" name="order" value="' + v.order + '"/>' + |
|
|
|
'<label for="">Срок</label><input class="form-control" type="text" name="term" value="' + v.term + '" />' + |
|
|
|
'<label for="">Срок</label><input class="term-picker form-control datepicker" type="text" name="term" value="' + v.term + '" />' + |
|
|
|
'<label for="">Результат</label><input class="form-control" type="text" name="result" value="' + v.result + '" />' + |
|
|
|
'<label for="">Результат</label><input class="form-control" type="text" name="result" value="' + v.result + '" />' + |
|
|
|
'</form></div>'; |
|
|
|
'</form></div>'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -358,14 +372,11 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (statusNotAgreed) { |
|
|
|
if (statusNotAgreed) { |
|
|
|
var orderSecureCheckbox = ''; |
|
|
|
if(!data.secure) { |
|
|
|
if(data.secure) { |
|
|
|
htmlInbox += '<div class="box-sizing disTab">' + |
|
|
|
orderSecureCheckbox = "checked"; |
|
|
|
'<div class="checkbox"><input name="secure" id="secureOrder" type="checkbox" style="opacity:1">' + |
|
|
|
} |
|
|
|
|
|
|
|
htmlInbox += '<div class="box-sizing disTab">' + |
|
|
|
|
|
|
|
'<div class="checkbox"><input name="secure" id="secureOrder" '+ orderSecureCheckbox +' type="checkbox" style="opacity:1">' + |
|
|
|
|
|
|
|
'Перейти в режим безопасной сделки</div></div>'; |
|
|
|
'Перейти в режим безопасной сделки</div></div>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
htmlInbox +='<div class="textAreaBlock2 box-sizing disTab">' + |
|
|
|
htmlInbox +='<div class="textAreaBlock2 box-sizing disTab">' + |
|
|
|
'<a href="#" data-sender-id="' + senderId +'" ' + |
|
|
|
'<a href="#" data-sender-id="' + senderId +'" ' + |
|
|
|
@ -447,7 +458,6 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Добавление этапов |
|
|
|
// Добавление этапов |
|
|
|
$("#order-stages").on('click', "#addStagesForm", function (e) { |
|
|
|
$("#order-stages").on('click', "#addStagesForm", function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
@ -554,7 +564,7 @@ |
|
|
|
'<label for="">Название</label><input class="form-control" name="name" type="text" />' + |
|
|
|
'<label for="">Название</label><input class="form-control" name="name" type="text" />' + |
|
|
|
'<label for="">Цена</label><input class="form-control" name="cost" type="text" />' + |
|
|
|
'<label for="">Цена</label><input class="form-control" name="cost" type="text" />' + |
|
|
|
'<input class="form-control orderStagesInput" name="order" type="hidden" value="' + orderId + '" />' + |
|
|
|
'<input class="form-control orderStagesInput" name="order" type="hidden" value="' + orderId + '" />' + |
|
|
|
'<label for="">Срок</label><input class="form-control" name="term" type="text" />' + |
|
|
|
'<label for="">Срок</label><input class="term-picker form-control datepicker" name="term" type="text" />' + |
|
|
|
'<label for="">Результат</label><input class="form-control" name="result" type="text" />' + |
|
|
|
'<label for="">Результат</label><input class="form-control" name="result" type="text" />' + |
|
|
|
'<input class="form-control" name="pos" value="' + pos + '" type="hidden" />' |
|
|
|
'<input class="form-control" name="pos" value="' + pos + '" type="hidden" />' |
|
|
|
'</form></div>'; |
|
|
|
'</form></div>'; |
|
|
|
@ -598,44 +608,7 @@ |
|
|
|
$("#chat-order-add #recipentId").val(recipentId); |
|
|
|
$("#chat-order-add #recipentId").val(recipentId); |
|
|
|
$(".orderStagesInput").val(orderId); |
|
|
|
$(".orderStagesInput").val(orderId); |
|
|
|
var inbox = document.getElementById('message-chat-order-space'); |
|
|
|
var inbox = document.getElementById('message-chat-order-space'); |
|
|
|
inbox.innerHTML = ''; |
|
|
|
var docList = document.getElementById('documentOrderSpace'); |
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
url: '/api/message', |
|
|
|
|
|
|
|
type: 'GET', |
|
|
|
|
|
|
|
data: {csrfmiddlewaretoken: csrftoken, '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 ' + className + '"><div class="topCommChat">' + |
|
|
|
|
|
|
|
'<p class="nameCommChat">' + senderName + '</p><span>' + v.created + '</span></div>' + |
|
|
|
|
|
|
|
'<p class="textCommChat">' + v.text + '</p></div>'; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
getStages(orderId,userId,recipentId, secureOrder); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Вытащить сообщения для конактов |
|
|
|
|
|
|
|
$('.user-block').on('click', function () { |
|
|
|
|
|
|
|
var userId = $(this).attr('data-id'); |
|
|
|
|
|
|
|
$("#contact-chat-form #recipentContactId").val(userId); |
|
|
|
|
|
|
|
$("#add-form-contractor-note #recipentNoteContractor").val(userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.user-block').each(function () { |
|
|
|
|
|
|
|
$(this).removeClass('mesAct'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(this).addClass('mesAct'); |
|
|
|
|
|
|
|
var inbox = document.getElementById('message-chat-space'); |
|
|
|
|
|
|
|
var docList = document.getElementById('documentSpace'); |
|
|
|
|
|
|
|
inbox.innerHTML = ''; |
|
|
|
inbox.innerHTML = ''; |
|
|
|
docList.innerHTML = ''; |
|
|
|
docList.innerHTML = ''; |
|
|
|
|
|
|
|
|
|
|
|
@ -644,68 +617,42 @@ |
|
|
|
type: 'GET', |
|
|
|
type: 'GET', |
|
|
|
data:{ |
|
|
|
data:{ |
|
|
|
csrfmiddlewaretoken: csrftoken, |
|
|
|
csrfmiddlewaretoken: csrftoken, |
|
|
|
'operand': 'in', |
|
|
|
'order': orderId |
|
|
|
'sender_id': currentChatUser, |
|
|
|
|
|
|
|
'recipent_id': userId |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
|
|
|
|
|
|
|
|
success: function (json){ |
|
|
|
success: function (json){ |
|
|
|
console.log(json); |
|
|
|
console.log(json); |
|
|
|
|
|
|
|
|
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
docList.innerHTML += '<li style="word-break: break-all;">'+ v.file+'<div></div></li>'; |
|
|
|
docList.innerHTML += '<li style="word-break: break-all;">'+ v.file+'</li>'; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
error: function(e){ |
|
|
|
error: function(e){ |
|
|
|
console.log(e); |
|
|
|
console.log(e); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/api/message', |
|
|
|
url: '/api/message', |
|
|
|
type: 'GET', |
|
|
|
type: 'GET', |
|
|
|
data: { |
|
|
|
data: {csrfmiddlewaretoken: csrftoken, 'order': orderId,'team__isnull': 'true'}, |
|
|
|
csrfmiddlewaretoken: csrftoken, |
|
|
|
|
|
|
|
'operand': 'in', |
|
|
|
|
|
|
|
'sender_id': currentChatUser, |
|
|
|
|
|
|
|
'recipent_id': userId |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
success: function (json) { |
|
|
|
success: function (json) { |
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
var senderName = 'Вы'; |
|
|
|
var senderName = 'Вы'; |
|
|
|
var className = 'youChat'; |
|
|
|
var className = 'youChat'; |
|
|
|
if (v.sender.id == userId) { |
|
|
|
|
|
|
|
|
|
|
|
if (v.sender.id !== currentChatUser) { |
|
|
|
senderName = v.sender.username; |
|
|
|
senderName = v.sender.username; |
|
|
|
className = ''; |
|
|
|
className = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
inbox.innerHTML += '<div class="col-lg-12 insetCommChat ' + className + '"><div class="topCommChat">' + |
|
|
|
|
|
|
|
'<p class="nameCommChat">' + senderName + '</p> <span>' + v.created + '</span></div>' + |
|
|
|
inbox.innerHTML += '<div class="col-lg-12 insetCommChat ' + className + '"><div class="topCommChat">' + |
|
|
|
|
|
|
|
'<p class="nameCommChat">' + senderName + '</p><span>' + v.created + '</span></div>' + |
|
|
|
'<p class="textCommChat">' + v.text + '</p></div>'; |
|
|
|
'<p class="textCommChat">' + v.text + '</p></div>'; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
getStages(orderId,userId,recipentId, secureOrder); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#contact-chat-add-message').on('click', function (e) { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var chatMessage = $("#chat").val(); |
|
|
|
|
|
|
|
var recipentId = $("#recipentContactId").val(); |
|
|
|
|
|
|
|
var senderId = $("#senderContactId").val(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.add_contact_message({ |
|
|
|
|
|
|
|
"format_type": "add_message_contact", |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"sender_id": senderId, |
|
|
|
|
|
|
|
"recipent_id": recipentId, |
|
|
|
|
|
|
|
"chat_message": chatMessage, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#chat").val(""); |
|
|
|
|
|
|
|
$("#document-send-contact").html(""); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|