' +
@@ -509,9 +522,14 @@
}
}
-
$("#order-stages").html(htmlInbox);
$(".stages-paid").html(stagesReservedHtml);
+ if(data.secure) {
+ $("#reserveSpace").show();
+
+ } else {
+ $("#reserveSpace").hide();
+ }
if (stagesInWork.length > 0){
$("#completeWork").show();
@@ -531,6 +549,10 @@
}else{
$("#completeWork").hide();
}
+
+ if(stagesCompleted.length == stagesResults.length){
+ $("#leaveReview").show();
+ }
});
@@ -592,8 +614,6 @@
});
});
-
-
// Вытащить сообщения для конактов
$('.user-block').on('click', function () {
var userId = $(this).attr('data-id');
diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html
index 460d3c5..9f0bd98 100644
--- a/chat/templates/chat_customer.html
+++ b/chat/templates/chat_customer.html
@@ -105,7 +105,7 @@
Заказы
{% for order in orders %}
-
{{ order }}
@@ -183,7 +183,11 @@
-
+
Для заметок
@@ -192,13 +196,6 @@
-
-
-
{% include 'review_add_modal.html' %}
@@ -230,10 +227,9 @@
var csrftoken = getCookie('csrftoken');
$("#reserve-button").on("click",function(e) {
- e.preventDefault();
+ e.preventDefault();
$("#reserve-stage-modal").modal('show');
var orderId = $(this).attr('data-order-id');
-
$.ajax({
url: '/api/stages/',
type: 'GET',
@@ -244,11 +240,13 @@
var totalSum = 0;
var stagesIds = '';
$.each(json.results, function (i, v) {
- console.log(v.cost);
- totalSum += parseInt(v.cost);
- outputValues += '
';
- stagesIds += v.id + ';'
+ if((v.status == 'in_process') && (!v.is_paid)) {
+ totalSum += parseInt(v.cost);
+ outputValues += '
';
+ stagesIds += v.id + ';'
+ }
});
+
$("#stagesSelect").html(outputValues);
$(".totalSum").text(totalSum);
$("#choiceWayOrder").val(totalSum)
@@ -293,7 +291,6 @@
type: 'GET',
data:{csrfmiddlewaretoken: csrftoken},
dataType: 'json',
-
}).then(function(data){
var stagesResults = data.stages;
var stageCount = stagesResults.length;
@@ -321,8 +318,12 @@
var statusNotAgreed = true;
var stagesInWork = [];
var stagesPaidProcess = [];
+ var stagesCompleted = [];
$.each(stagesResults, function (i, v) {
+ if (v.status == "completed"){
+ stagesCompleted.push(v);
+ }
if(!data.secure){
if(v.status == "in_process") {
stagesInWork.push(v);
@@ -347,7 +348,7 @@
htmlInbox += '
' +
'
Этап ' + v.pos + '' + v.name + '
' +
'
Результаты этапа:' + v.result + '
' +
- '
до Дата
' + v.cost + '' +
+ '
до '+ v.term +'
' + v.cost + '' +
'
';
}
@@ -377,7 +378,7 @@
var stage = stagesInWork[0];
var stageWork = '
В работе '+ stage.name +'
' +
'
Результат этапа : '+ stage.result +'
' +
- '
Срок сдачи 25.08.2016 ' + stage.cost + 'р.
';
+ '
Срок сдачи '+ stage.term +'' + stage.cost + 'р.
';
if (stage.close_contractor){
stageWork += '
-
Кол-во денег {{ transaction.pk }}
-
+
-
+
+
diff --git a/chat/templates/review_add_modal.html b/chat/templates/review_add_modal.html
index 21a2b19..762266d 100644
--- a/chat/templates/review_add_modal.html
+++ b/chat/templates/review_add_modal.html
@@ -24,13 +24,22 @@
Ваш отзыв
-
-
-
+ {% if request.user.is_customer %}
+
+
+
+
+
+ {% else %}
+
+
+
+
+ {% endif %}
+
-
-
-
+
+