|
|
|
@ -101,7 +101,7 @@ |
|
|
|
<p>Заказы</p> |
|
|
|
<p>Заказы</p> |
|
|
|
{% for order in orders %} |
|
|
|
{% for order in orders %} |
|
|
|
<div class="orderBlock box-sizing order-block" |
|
|
|
<div class="orderBlock box-sizing order-block" |
|
|
|
data-recipent-id="{{ order.order.contractor.pk }}" data-id="{{ order.order.id }}"> |
|
|
|
id="orderBlock{{ order.order.id }}" data-secure-deal="{% if order.order.secure %}true{% else %}false{% endif %}" data-recipent-id="{{ order.order.contractor.pk }}" data-id="{{ order.order.id }}"> |
|
|
|
<span class="dimovChat"></span> |
|
|
|
<span class="dimovChat"></span> |
|
|
|
<p class="titleOB">{{ order }}</p> |
|
|
|
<p class="titleOB">{{ order }}</p> |
|
|
|
<div class="hideOBB"> |
|
|
|
<div class="hideOBB"> |
|
|
|
@ -151,7 +151,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
<div id="order-stages" class="stepssBlock"></div> |
|
|
|
<div id="order-stages" class="stepssBlock"></div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="stepssBlock box-sizing disTab"> |
|
|
|
<div class="stepssBlock box-sizing disTab" id="reserveSpace" style="display:none;"> |
|
|
|
<p class="titleStepss">2 / Резервирование</p> |
|
|
|
<p class="titleStepss">2 / Резервирование</p> |
|
|
|
<p class="textStepss"> |
|
|
|
<p class="textStepss"> |
|
|
|
Резервирование заказчиком суммы оплаты по заказ. Деньги перечисляются и хранятся на |
|
|
|
Резервирование заказчиком суммы оплаты по заказ. Деньги перечисляются и хранятся на |
|
|
|
@ -187,7 +187,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="closeChat closeChat1"> |
|
|
|
<div class="closeChat closeChat1" id="leaveReview" style="display: none;"> |
|
|
|
<a href="#" data-toggle="modal" data-target="#review-add"> |
|
|
|
<a href="#" data-toggle="modal" data-target="#review-add"> |
|
|
|
Закрыть проект<br>и оставить отзыв |
|
|
|
Закрыть проект<br>и оставить отзыв |
|
|
|
</a> |
|
|
|
</a> |
|
|
|
@ -235,24 +235,54 @@ |
|
|
|
data: {csrfmiddlewaretoken: csrftoken, 'order': orderId}, |
|
|
|
data: {csrfmiddlewaretoken: csrftoken, 'order': orderId}, |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
success: function (json) { |
|
|
|
success: function (json) { |
|
|
|
var outputValues = ""; |
|
|
|
var outputValues = ''; |
|
|
|
var totalSum = 0; |
|
|
|
var totalSum = 0; |
|
|
|
|
|
|
|
var stagesIds = ''; |
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
$.each(json.results, function (i, v) { |
|
|
|
console.log(v.cost); |
|
|
|
console.log(v.cost); |
|
|
|
totalSum += parseInt(v.cost); |
|
|
|
totalSum += parseInt(v.cost); |
|
|
|
outputValues += "<option value='"+ v.id +"'>" + v.name + "</option>"; |
|
|
|
outputValues += '<option data-stage-sum="' + v.cost + '" value="'+ v.id +'">' + v.name + '</option>'; |
|
|
|
|
|
|
|
stagesIds += v.id + ';' |
|
|
|
}); |
|
|
|
}); |
|
|
|
$("#stagesSelect").html(outputValues); |
|
|
|
$("#stagesSelect").html(outputValues); |
|
|
|
$(".totalSum").text(totalSum); |
|
|
|
$(".totalSum").text(totalSum); |
|
|
|
|
|
|
|
$("#choiceWayOrder").val(totalSum) |
|
|
|
|
|
|
|
$("#stages-pay-form #stageSumPay").val(totalSum); |
|
|
|
|
|
|
|
$("#stages-pay-form #stagesIds").val(stagesIds); |
|
|
|
|
|
|
|
$("#choiceWayOrder").attr('data-stages-ids',stagesIds); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#tab2").on("change","input[name=choice_way]:radio", function(e){ |
|
|
|
|
|
|
|
var sumStage = $("#stagesSelect").find('option:selected').attr('data-stage-sum'); |
|
|
|
|
|
|
|
var currIdStage = $("#stagesSelect").find('option:selected').val(); |
|
|
|
|
|
|
|
$("#choiceWayStage").val(sumStage); |
|
|
|
|
|
|
|
var currValue = $(this).val(); |
|
|
|
|
|
|
|
$("#stages-pay-form #stageSumPay").val(currValue); |
|
|
|
|
|
|
|
var selectId = ($(this).attr('id')); |
|
|
|
|
|
|
|
if (selectId == 'choiceWayOrder'){ |
|
|
|
|
|
|
|
$("#stages-pay-form #stagesIds").val($(this).attr('data-stages-ids')); |
|
|
|
|
|
|
|
$("#stagesSelect").prop('disabled', 'disabled'); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$("#stages-pay-form #stagesIds").val(currIdStage); |
|
|
|
|
|
|
|
$("#stagesSelect").prop('disabled', false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#tab2").on("change","#stagesSelect", function(e){ |
|
|
|
|
|
|
|
var sumStage = $(this).find('option:selected').attr("data-stage-sum"); |
|
|
|
|
|
|
|
$("#choiceWayStage").val(sumStage); |
|
|
|
|
|
|
|
$("#stages-pay-form #stageSumPay").val(sumStage); |
|
|
|
|
|
|
|
$("#stages-pay-form #stagesIds").val($(this).val()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//Получить заказы |
|
|
|
//Получить заказы |
|
|
|
function getStages(orderId, senderId, recipentId) { |
|
|
|
function getStages(orderId, senderId, recipentId, secureOrder) { |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: '/api/stages/', |
|
|
|
url: '/api/stages/', |
|
|
|
@ -262,6 +292,7 @@ |
|
|
|
success: function (json) { |
|
|
|
success: function (json) { |
|
|
|
var stageCount = json.results.length; |
|
|
|
var stageCount = json.results.length; |
|
|
|
if (stageCount == 0) { |
|
|
|
if (stageCount == 0) { |
|
|
|
|
|
|
|
$("#reserveSpace").hide(); |
|
|
|
stageCountVal = 1; |
|
|
|
stageCountVal = 1; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
stageCountVal = stageCount; |
|
|
|
stageCountVal = stageCount; |
|
|
|
@ -280,7 +311,7 @@ |
|
|
|
'<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="form-control" 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" />' + |
|
|
|
'<label for="">Позиция</label><input class="form-control" name="pos" value="1" type="text" />' + |
|
|
|
'<input class="form-control" name="pos" value="1" type="hidden" />' + |
|
|
|
'</form></div>'; |
|
|
|
'</form></div>'; |
|
|
|
} |
|
|
|
} |
|
|
|
var statusNotAgreed = true; |
|
|
|
var statusNotAgreed = true; |
|
|
|
@ -313,13 +344,19 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (statusNotAgreed) { |
|
|
|
if (statusNotAgreed) { |
|
|
|
htmlInbox += '<div class="box-sizing disTab" style="text-align:center;">' + |
|
|
|
if(secureOrder) { |
|
|
|
'<div class="checkbox"><input type="checkbox" style="opacity:1">' + |
|
|
|
var orderSecureCheckbox = 'checked="checked"'; |
|
|
|
'Перейти в режим безопасной сделки</div></div>' + |
|
|
|
htmlInbox += '<div class="box-sizing disTab">' + |
|
|
|
'<div class="textAreaBlock2 box-sizing disTab">' + |
|
|
|
'<div class="checkbox"><input name="secure" id="secureOrder"'+ orderSecureCheckbox +'type="checkbox" style="opacity:1">' + |
|
|
|
|
|
|
|
'Перейти в режим безопасной сделки</div></div>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
htmlInbox +='<div class="textAreaBlock2 box-sizing disTab">' + |
|
|
|
'<a href="#" data-sender-id="' + senderId +'" ' + |
|
|
|
'<a href="#" data-sender-id="' + senderId +'" ' + |
|
|
|
'data-recipent-id="' + recipentId +'" data-order-id="' + orderId + '" ' + |
|
|
|
'data-recipent-id="' + recipentId +'" data-order-id="' + orderId + '" ' + |
|
|
|
'id="addStagesForm">отправить на согласование</a> </div>'; |
|
|
|
'id="addStagesForm">отправить на согласование</a> </div>'; |
|
|
|
|
|
|
|
}else if(json.results.length>0){ |
|
|
|
|
|
|
|
$("#reserveSpace").show(); |
|
|
|
} |
|
|
|
} |
|
|
|
htmlInbox = htmlInboxStage + htmlInbox; |
|
|
|
htmlInbox = htmlInboxStage + htmlInbox; |
|
|
|
$("#order-stages").html(htmlInbox); |
|
|
|
$("#order-stages").html(htmlInbox); |
|
|
|
@ -414,8 +451,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
var currentOrderId = $(this).attr('data-order-id'); |
|
|
|
var currentOrderId = $(this).attr('data-order-id'); |
|
|
|
var currentRecipentId = $(this).attr('data-recipent-id'); |
|
|
|
var currentRecipentId = $(this).attr('data-recipent-id'); |
|
|
|
|
|
|
|
var secureOrder = true |
|
|
|
getStages(currentOrderId,userId,currentRecipentId); |
|
|
|
getStages(currentOrderId,userId,currentRecipentId,secureOrder); |
|
|
|
|
|
|
|
|
|
|
|
socket.send_stages_approve({ |
|
|
|
socket.send_stages_approve({ |
|
|
|
"format_type": "approve_stages", |
|
|
|
"format_type": "approve_stages", |
|
|
|
@ -446,11 +483,9 @@ |
|
|
|
'<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="form-control" 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" />' + |
|
|
|
'<label for="">Позиция</label><input class="form-control" name="pos" value="'+ pos +'" type="text" />' |
|
|
|
'<input class="form-control" name="pos" value="'+ pos +'" type="hidden" />' |
|
|
|
'</form></div>'; |
|
|
|
'</form></div>'; |
|
|
|
|
|
|
|
|
|
|
|
lastFormStage.after(addFormTemplate); |
|
|
|
lastFormStage.after(addFormTemplate); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}else if (countStage < currentCountStage) { |
|
|
|
}else if (countStage < currentCountStage) { |
|
|
|
@ -477,6 +512,8 @@ |
|
|
|
$(this).addClass('orAct'); |
|
|
|
$(this).addClass('orAct'); |
|
|
|
var orderId = $(this).attr('data-id'); |
|
|
|
var orderId = $(this).attr('data-id'); |
|
|
|
var recipentId = $(this).attr('data-recipent-id'); |
|
|
|
var recipentId = $(this).attr('data-recipent-id'); |
|
|
|
|
|
|
|
var secureOrder = $(this).attr('data-secure-deal'); |
|
|
|
|
|
|
|
secureOrder = Boolean(secureOrder); |
|
|
|
$("#chat-order-add #orderId").val(orderId); |
|
|
|
$("#chat-order-add #orderId").val(orderId); |
|
|
|
$("#projectReviewId").val(orderId); |
|
|
|
$("#projectReviewId").val(orderId); |
|
|
|
$("#reserve-button").attr('data-order-id', orderId); |
|
|
|
$("#reserve-button").attr('data-order-id', orderId); |
|
|
|
@ -506,7 +543,7 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
getStages(orderId,userId,recipentId); |
|
|
|
getStages(orderId,userId,recipentId, secureOrder); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Вытащить сообщения для конактов |
|
|
|
// Вытащить сообщения для конактов |
|
|
|
|