|
|
|
@ -46,6 +46,12 @@ $(function () { |
|
|
|
|
|
|
|
|
|
|
|
$("#choiceWayOrder").attr('data-stages-ids', stagesIds); |
|
|
|
$("#choiceWayOrder").attr('data-stages-ids', stagesIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#stagesSelect").selectpicker({ |
|
|
|
|
|
|
|
style: 'btn-info', |
|
|
|
|
|
|
|
size: 4 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -213,7 +219,7 @@ $(function () { |
|
|
|
'</div></div>'; |
|
|
|
'</div></div>'; |
|
|
|
|
|
|
|
|
|
|
|
if (stage.close_contractor) { |
|
|
|
if (stage.close_contractor) { |
|
|
|
stageWork += '<div class="textAreaBlock2 FFD box-sizing disTab"><a href="#" class="closeStage" data-order-id="' + orderId + '" data-sender-id="{{ request.user.pk }}"' + |
|
|
|
stageWork += '<div class="textAreaBlock2 FFD box-sizing disTab"><a href="#" class="closeStage" data-order-id="' + orderId + '" data-sender-id="'+ userId +'"' + |
|
|
|
' data-recipent-id="' + recipentId + '" data-stage-id="' + stage.id + '">Закрыть этап ' + stage.pos + '</a></div>'; |
|
|
|
' data-recipent-id="' + recipentId + '" data-stage-id="' + stage.id + '">Закрыть этап ' + stage.pos + '</a></div>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -286,6 +292,7 @@ $(function () { |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/api/orders/' + currentOrderId + '/', |
|
|
|
url: '/api/orders/' + currentOrderId + '/', |
|
|
|
type: 'PATCH', |
|
|
|
type: 'PATCH', |
|
|
|
|
|
|
|
|
|
|
|
beforeSend: function (xhr) { |
|
|
|
beforeSend: function (xhr) { |
|
|
|
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')) |
|
|
|
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')) |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -305,6 +312,7 @@ $(function () { |
|
|
|
var _this = $(this); |
|
|
|
var _this = $(this); |
|
|
|
console.log($(this).serialize()); |
|
|
|
console.log($(this).serialize()); |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
async: false, |
|
|
|
url: '/api/stages/', |
|
|
|
url: '/api/stages/', |
|
|
|
type: 'POST', |
|
|
|
type: 'POST', |
|
|
|
beforeSend: function (xhr) { |
|
|
|
beforeSend: function (xhr) { |
|
|
|
@ -335,6 +343,7 @@ $(function () { |
|
|
|
var currentStageId = parseInt($(this).attr('data-stage-id')); |
|
|
|
var currentStageId = parseInt($(this).attr('data-stage-id')); |
|
|
|
console.log($(this).serialize()); |
|
|
|
console.log($(this).serialize()); |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
async: false, |
|
|
|
url: '/api/stages/' + currentStageId + '/', |
|
|
|
url: '/api/stages/' + currentStageId + '/', |
|
|
|
type: 'PUT', |
|
|
|
type: 'PUT', |
|
|
|
beforeSend: function (xhr) { |
|
|
|
beforeSend: function (xhr) { |
|
|
|
@ -367,7 +376,17 @@ $(function () { |
|
|
|
"msg": "Этапы для заказа " + currentOrderId + " изменены", |
|
|
|
"msg": "Этапы для заказа " + currentOrderId + " изменены", |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
$.jGrowl("Этапы для заказа изменены и отправлены исполнителю", { life: 15000}); |
|
|
|
$('body').append('<div class="modal" id="popupOk" role="dialog" aria-labelledby="myModalLabel">' + |
|
|
|
|
|
|
|
'<div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header">' + |
|
|
|
|
|
|
|
'<button type="button" class="close" data-dismiss="modal" aria-label="Close">' + |
|
|
|
|
|
|
|
'<span aria-hidden="true">×</span></button>' + |
|
|
|
|
|
|
|
'<h4 class="modal-title" id="myModalLabel">Уведомление</h4>' + |
|
|
|
|
|
|
|
'</div><div class="modal-body">Этапы отправлены исполнителю для согласования</div>' + |
|
|
|
|
|
|
|
'<div class="modal-footer">' + |
|
|
|
|
|
|
|
'<button type="button" class="btn btn-default" data-dismiss="modal">ОК</button>' + |
|
|
|
|
|
|
|
'</div></div></div></div>'); |
|
|
|
|
|
|
|
$('#popupOk').modal('show'); |
|
|
|
|
|
|
|
//$.jGrowl("Этапы для заказа изменены и отправлены исполнителю", { life: 15000});
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -410,97 +429,10 @@ $(function () { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Нажимаем на кнопку архивные сообщения
|
|
|
|
|
|
|
|
$("#trashed-button").on('click',function(e){ |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var state = $(this).attr('data-show'); |
|
|
|
|
|
|
|
var trashedOrderHtml = ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (state == 'true') { |
|
|
|
|
|
|
|
$(this).attr('data-show','false'); |
|
|
|
|
|
|
|
$(this).text("Скрыть архивные заказы"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
url: '/api/orders/', |
|
|
|
|
|
|
|
type: 'GET', |
|
|
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
|
|
success: function (json) { |
|
|
|
|
|
|
|
console.log(json.results); |
|
|
|
|
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var temp = '<div data-id="'+ v.id +'" class="trashedOrderBlock box-sizing"><span class="dimovChat"></span>' + |
|
|
|
|
|
|
|
'<p class="titleOB">' + v.project.name + '</p><div class="hideOBB"><p class="pOB">' + |
|
|
|
|
|
|
|
'<span>Исполнитель:</span>'+ v.contractor_name +' </p>' + |
|
|
|
|
|
|
|
'<a href="#" class="linkChat11 full-order-info">' + |
|
|
|
|
|
|
|
'<span class="glyphicon glyphicon-info-sign" aria-hidden="true">' + |
|
|
|
|
|
|
|
'</span>Полное описание заказа </a></div></div>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trashedOrderHtml += temp; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$("#trashed-orders").html(trashedOrderHtml); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error: function (e, jqxhr) { |
|
|
|
|
|
|
|
console.log(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$(this).attr('data-show','true'); |
|
|
|
|
|
|
|
$(this).text("Показать архивные заказы"); |
|
|
|
|
|
|
|
$("#trashed-orders").html(""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Нажимаем на заказ в архмвных заказах
|
|
|
|
|
|
|
|
$(".messageBlock").on('click','.trashedOrderBlock',function(){ |
|
|
|
|
|
|
|
$("#chat-order-add").css("display", "none"); |
|
|
|
|
|
|
|
$('.order-block, .trashedOrderBlock').each(function () { |
|
|
|
|
|
|
|
$(this).removeClass('orAct'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$(this).addClass('orAct'); |
|
|
|
|
|
|
|
var inbox = document.getElementById('message-chat-order-space'); |
|
|
|
|
|
|
|
var docList = document.getElementById('documentOrderSpace'); |
|
|
|
|
|
|
|
inbox.innerHTML = ''; |
|
|
|
|
|
|
|
docList.innerHTML = ''; |
|
|
|
|
|
|
|
var orderId = $(this).attr('data-id'); |
|
|
|
|
|
|
|
location.hash = '#order' + orderId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
|
|
url: '/api/message', |
|
|
|
|
|
|
|
type: 'GET', |
|
|
|
|
|
|
|
data: {csrfmiddlewaretoken: csrftoken, 'order': orderId, 'team__isnull': 'true'}, |
|
|
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
|
|
success: function (json) { |
|
|
|
|
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
|
|
|
|
var senderName = 'Вы'; |
|
|
|
|
|
|
|
var className = 'youChat'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (v.sender.id !== userId) { |
|
|
|
|
|
|
|
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>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var height = inbox.scrollHeight; |
|
|
|
|
|
|
|
inbox.scrollTop = height; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#order-stages").html(""); |
|
|
|
|
|
|
|
$("#completeWork").hide(); |
|
|
|
|
|
|
|
$("#add-form-order-note").hide(); |
|
|
|
|
|
|
|
$("#reserveSpace").hide(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Для заказов все вытащить
|
|
|
|
// Для заказов все вытащить
|
|
|
|
$('.order-block').on('click', function () { |
|
|
|
$('.order-block').on('click', function () { |
|
|
|
|
|
|
|
var newCount = parseInt($("#count-tab-order").text()); |
|
|
|
$("#chat-order-add").css("display", "block"); |
|
|
|
$("#chat-order-add").css("display", "block"); |
|
|
|
$("#add-form-order-note").css("display", "block"); |
|
|
|
$("#add-form-order-note").css("display", "block"); |
|
|
|
$("#formsetStage").css("display", "block"); |
|
|
|
$("#formsetStage").css("display", "block"); |
|
|
|
@ -516,12 +448,22 @@ $(function () { |
|
|
|
var recipentId = $(this).attr('data-recipent-id'); |
|
|
|
var recipentId = $(this).attr('data-recipent-id'); |
|
|
|
var secureOrder = $(this).attr('data-secure-deal'); |
|
|
|
var secureOrder = $(this).attr('data-secure-deal'); |
|
|
|
secureOrder = Boolean(secureOrder); |
|
|
|
secureOrder = Boolean(secureOrder); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var teamCurrentId = parseInt($(this).attr('data-team-id')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (teamCurrentId>0){ |
|
|
|
|
|
|
|
$("#targetTeamId").val(teamCurrentId); |
|
|
|
|
|
|
|
$("#targetContractorId").val(""); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$("#targetTeamId").val("") |
|
|
|
|
|
|
|
$("#targetContractorId").val(recipentId); |
|
|
|
|
|
|
|
} |
|
|
|
$("#chat-order-add #orderId").val(orderId); |
|
|
|
$("#chat-order-add #orderId").val(orderId); |
|
|
|
$("#add-form-order-note #orderNote").val(orderId); |
|
|
|
$("#add-form-order-note #orderNote").val(orderId); |
|
|
|
$("#orderArbitrationId").val(orderId); |
|
|
|
$("#orderArbitrationId").val(orderId); |
|
|
|
$("#projectReviewId").val(projectId); |
|
|
|
$("#projectReviewId").val(projectId); |
|
|
|
$("#reserve-button").attr('data-order-id', orderId); |
|
|
|
$("#reserve-button").attr('data-order-id', orderId); |
|
|
|
$("#targetContractorId").val(recipentId); |
|
|
|
|
|
|
|
$("#chat-order-add #recipentId").val(recipentId); |
|
|
|
$("#chat-order-add #recipentId").val(recipentId); |
|
|
|
$("#add-form-order-note #recipentNote").val(recipentId); |
|
|
|
$("#add-form-order-note #recipentNote").val(recipentId); |
|
|
|
$(".orderStagesInput").val(orderId); |
|
|
|
$(".orderStagesInput").val(orderId); |
|
|
|
|