@ -24,7 +24,7 @@
< / div >
< / div >
< div class = "tab-content" >
<!-- Tab1 (contacts block) -->
<!-- Tab1 (contacts block) -->
< div class = "chatBlock disTab tab-pane fade in active" id = "tab1" >
< div class = "col-lg-3 wrMessages" >
< div class = "messageBlock box-sizing disTab" >
@ -79,9 +79,9 @@
< / div >
< / div >
< / div >
<!-- End block Tab1(contacts block) -->
<!-- End block Tab1(contacts block) -->
<!-- Tab2 (chat order block) -->
<!-- Tab2 (chat order block) -->
< div class = "chatBlock disTab tab-pane fade" id = "tab2" >
< div class = "col-lg-3 wrMessages" >
< div class = "messageBlock box-sizing disTab" >
@ -136,79 +136,51 @@
< / p >
< / div >
{# < div class = "stepssBlock box-sizing disTab" > #}
{# < p class = "textStepss" > #}
{# Какое кол-во этапов подразумевает работа? < input type = "text" id = "countStage" size = "3" / > #}
{# < / p > #}
{# < div id = "formsetStage" class = "numberStepp box-sizing" style = "display: none;" > #}
{# < div class = "insetNumStepp" id = "stage1" > #}
{# < p class = "titleNumStepp" > #}
{# < span > Этап < / span > #}
{# < / p > #}
{# < div class = "textAreaBlock2 box-sizing disTab" > #}
{# < form class = "new-stages-form" > #}
{# < label > Название< / label > #}
{# < input type = "text" name = "name" / > #}
{# < label > Результат< / label > #}
{# < input type = "text" name = "result" / > #}
{# < label > Стоимость< / label > #}
{# < input type = "text" name = "cost" / > #}
{# < input type = "hidden" name = "order" class = "orderStagesInput" / > #}
{# < / form > #}
{# < / div > #}
{# < / div > #}
{##}
{# < / div > #}
{##}
{# < / div > #}
{# < div class = "textAreaBlock2 FFD box-sizing disTab" > #}
{# < a href = "javascript:void()" > согласовать< / a > #}
{# < / div > #}
< div id = "order-stages" > < / div >
< div class = "stepssBlock box-sizing disTab" >
< p class = "titleStepss" > 2 / Резервирование< / p >
< p class = "textStepss" >
Резервирование заказчиком суммы оплаты по заказ. Деньги перечисляются и хранятся на сайте.
< / p >
< p class = "titleStepss" > 2 / Резервирование< / p >
< p class = "textStepss" >
Резервирование заказчиком суммы оплаты по заказ. Деньги перечисляются и хранятся на
сайте.
< / p >
< div class = "textAreaBlock2 FFD box-sizing disTab" >
< a href = "#" data-toggle = "modal" data-target = "#reserve-stage-modal" > Зарезирвировать< / a >
< / div >
< a href = "#" data-toggle = "modal" data-target = "#reserve-stage-modal" > Зарезирвировать< / a >
< / div >
< / div >
< / div >
<!-- Зарезервировать средства (модальное окно) -->
< div id = "reserve-stage-modal" class = "modal fade" >
< div class = "modal-dialog" style = "width:900px;" >
< div class = "modal-content" >
< div class = "modal-header" >
< button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > ×< / button >
< h4 class = "modal-title" > Зарезервировать средства< / h4 >
< / div >
< div id = "reserve-stage-modal" class = "modal fade" >
< div class = "modal-dialog" style = "width:900px;" >
< div class = "modal-content" >
< div class = "modal-header" >
< button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > ×
< / button >
< h4 class = "modal-title" > Зарезервировать средства< / h4 >
< / div >
< div class = "modal-body" >
< div class = "textAreaBlock2 text-nn box-sizing disTab" >
< / div >
< div class = "modal-body" >
< div class = "textAreaBlock2 text-nn box-sizing disTab" >
< / div >
< div class = "searchF1 polsF1 polsFF links-filter" >
< input class = "btn-submit-link" type = "submit" value = "Сохранить" >
< / div >
< / div >
< div class = "modal-footer" > < / div >
< div class = "searchF1 polsF1 polsFF links-filter" >
< input class = "btn-submit-link" type = "submit" value = "Сохранить" >
< / div >
< / div >
< div class = "modal-footer" > < / div >
< / div >
<!-- Конец блока -->
< / div >
< / div >
<!-- Конец блока -->
< div class = "stepssBlock box-sizing disTab" >
< p class = "titleStepss" > 3 / Выполнение работы< / p >
< p class = "textStepss" >
Процесс выполнения задания в заказе до получения заказчиком итогового результата работы.
< / p >
< / div >
< div class = "stepssBlock box-sizing disTab" >
< p class = "titleStepss" > 3 / Выполнение работы< / p >
< p class = "textStepss" >
Процесс выполнения задания в заказе до получения заказчиком итогового результата работы.
< / p >
< / div >
< div class = "textAreaBlock2 box-sizing disTab" >
@ -216,13 +188,71 @@
< textarea id = "chat2" > < / textarea >
< a href = "javascript:void()" > сохранить< / a >
< / div >
< div class = "linkChatB box-sizing disTab" >
< a href = "javascript:void(0)" > предложить проект< / a >
< div class = "closeChat closeChat1" >
< a href = "#" data-toggle = "modal" data-target = "#review-add" >
Закрыть проект< br > и оставить отзыв
< / a >
< / div >
<!-- Review add -->
< div id = "review-add" class = "modal fade" role = "dialog" >
< div class = "modal-dialog" role = "document" style = "width:900px;" >
< div class = "modal-content" >
< div class = "modal-header" >
< button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true" > ×
< / button >
< h4 class = "modal-title" > Оставить отзыв< / h4 >
< / div >
< form id = "review-adds-form" method = "POST" > {% csrf_token %}
< div class = "modal-body" >
< div style = "height: 250px;" >
< div class = "text-nn box-sizing disTab" >
< input type = "radio" value = "positive"
name="type">Положительный
< input type = "radio" value = "negative"
name="type">Отрицательный
< input type = "radio" value = "neutral"
name="type">Нейтральный
< / div >
< div class = "textAreaBlock2 text-nn box-sizing disTab" >
< textarea cols = "40" name = "text" rows = "10" > < / textarea >
< input type = "hidden" name = "from_customer" value = "{{ request.user.pk }}" / >
< input type = "hidden" name = "target_contractor" id = "targetContractorId" / >
< input type = "hidden" name = "project" id = "projectReviewId" / >
< / div >
< / div >
< / div >
< div class = "modal-footer" >
< button type = "button" class = "btn btn-default" data-dismiss = "modal" > Закрыть
< / button >
< button type = "submit" id = "order-review-add" class = "btn btn-primary" > Оставить отзыв< / button >
< / div >
< / form >
< / div >
< / div >
< / div >
<!-- -->
< / div >
< / div >
<!-- End block (chat order block) -->
<!-- End block (chat order block) -->
< / div >
{% include 'partials/footer.html' %}
< / div >
< / div >
@ -238,46 +268,46 @@
var form = document.getElementById('message_form');
var csrftoken = getCookie('csrftoken');
function getStages(orderId){
function getStages(orderId) {
$.ajax({
$.ajax({
url: '/api/stages/',
type: 'GET',
data: {csrfmiddlewaretoken: csrftoken, 'order': orderId},
dataType: 'json',
success: function (json) {
var stageCount = json.results.length;
if (stageCount == 0){
if (stageCount == 0) {
stageCountVal = 1;
}else{
} else {
stageCountVal = stageCount;
}
var htmlInbox = "";
var htmlInboxStage = '< p class = "textStepss" > Какое кол-во этапов подразумевает работа? ' +
'< input type = "text" id = "countStage" value = "'+ stageCountVal +'" size = "3" / > < / p > ';
if (stageCount == 0){
htmlInboxStage += '< div class = "numberStepp box-sizing" id = "stage1" > ' +
'< p > Этап < span class = "stage-span-id" > 1< / span > < / p > < form class = "new-stages-form" id = "stage-form" > ' +
'< label for = "" > Название< / label > < input class = "form-control" name = "name" type = "text" / > ' +
'< label for = "" > Цена< / label > < input class = "form-control" name = "cost" type = "text" / > ' +
'< input class = "form-control" name = "order" type = "text" value = "'+ orderId +'" class = "orderStagesInput" / > />' +
'< label for = "" > Срок< / label > < input class = "form-control" name = "term" type = "text" / > ' +
'< label for = "" > Результат< / label > < input class = "form-control" name = "result" type = "text" / > ' +
'< / form > < / div > ';
'< input type = "text" id = "countStage" value = "' + stageCountVal + '" size = "3" / > < / p > ';
if (stageCount == 0) {
htmlInboxStage += '< div class = "numberStepp box-sizing" id = "stage1" > ' +
'< p > Этап < span class = "stage-span-id" > 1< / span > < / p > < form class = "new-stages-form" id = "stage-form" > ' +
'< label for = "" > Название< / label > < input class = "form-control" name = "name" type = "text" / > ' +
'< label for = "" > Цена< / label > < input class = "form-control" name = "cost" type = "text" / > ' +
'< input class = "form-control" name = "order" type = "text" value = "' + orderId + '" class = "orderStagesInput" / > />' +
'< label for = "" > Срок< / label > < input class = "form-control" name = "term" type = "text" / > ' +
'< label for = "" > Результат< / label > < input class = "form-control" name = "result" type = "text" / > ' +
'< / form > < / div > ';
}
var statusNotAgreed = true;
$.each(json.results, function (i, v) {
if (v.status == "not_agreed") {
htmlInbox += '< div class = "numberStepp box-sizing" > ' +
'< p > Этап< / p > < form class = "update-stages-form" data-order-id = "'+ v.order + '" id = "stage-form-'+ v.pos +'" > ' +
'< 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 +'" / > ' +
'< input class = "form-control" 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 = "form-control" type = "text" name = "result" value = "'+ v.result +'" / > ' +
'< p > Этап< / p > < form class = "update-stages-form" data-stage-id = "' + v.id + '" id = "stage-form-' + v.pos + '" > ' +
'< 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 + '" / > ' +
'< input class = "form-control" 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 = "form-control" type = "text" name = "result" value = "' + v.result + '" / > ' +
'< / form > < / div > ';
} else {
statusNotAgreed = false;
@ -299,55 +329,55 @@
$("#order-stages").html(htmlInbox);
}
});
}
setTimeout(function(){
$(".user-block").first().trigger('click');
}
setTimeout(function () {
$(".user-block").first().trigger('click');
}, 10);
setTimeout(function(){
$(".order-block").first().trigger('click');
setTimeout(function () {
$(".order-block").first().trigger('click');
}, 100);
$("#order-stages").on('click', "#addStagesForm", function(e){
$("#order-stages").on('click', "#addStagesForm", function (e) {
e.preventDefault();
$(".new-stages-form").each(function(i,v){
console.log($(this).serialize());
$(".new-stages-form").each(function (i, v) {
console.log($(this).serialize());
$.ajax({
$.ajax({
url: '/api/stages/',
type: 'POST',
beforeSend: function (xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'))
},
data:$(this).serialize(),
data: $(this).serialize(),
dataType: 'json',
success: function (json) {
console.log(json);
},
error: function(e){
error: function (e) {
console.log('error');
console.log(e);
}
});
});
});
$(".update-stages-form").each(function(i,v){
var currentStageId = parseInt($(this).attr('data-order-id'));
alert(currentStageId);
$(".update-stages-form").each(function (i, v) {
var currentStageId = parseInt($(this).attr('data-stage-id'));
$.ajax({
url: '/api/stages/' + currentStageId + '/',
type: 'PUT',
beforeSend: function(xhr){
beforeSend: function (xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'))
},
data: $(this).serialize(),
dataType:'json',
success: function(json){
dataType: 'json',
success: function (json) {
console.log(json);
},
error: function(e){
error: function (e) {
console.log('error');
console.log(e);
}
@ -355,8 +385,6 @@
});
var currentOrderId = $(this).attr('data-order-id');
currentOrderId = parseInt(currentOrderId);
getStages(currentOrderId);
@ -364,7 +392,7 @@
});
$('#order-stages-tab').on('change', '#countStage', function(){
$('#order-stages-tab').on('change', '#countStage', function () {
var countStage = parseInt($(this).val());
var updateFormStages = $(".update-stages-form");
var limitCount = countStage + 1;
@ -376,7 +404,7 @@
$('.order-block').on('click', function () {
$("#chat-order-add").css("display", "block");
$("#formsetStage").css("display","block");
$("#formsetStage").css("display", "block");
$('.order-block').each(function () {
$(this).removeClass('orAct');
@ -386,6 +414,8 @@
var orderId = $(this).attr('data-id');
var recipentId = $(this).attr('data-recipent-id');
$("#chat-order-add #orderId").val(orderId);
$("#projectReviewId").val(orderId);
$("#targetContractorId").val(recipentId);
$("#chat-order-add #recipentId").val(recipentId);
$(".orderStagesInput").val(orderId);
var inbox = document.getElementById('message-chat-order-space');
@ -411,70 +441,7 @@
});
}
});
getStages(orderId);
{# $.ajax({#}
{# url: '/api/stages/',#}
{# type: 'GET',#}
{# data: {csrfmiddlewaretoken: csrftoken, 'order': orderId},#}
{# dataType: 'json',#}
{# success: function (json) {#}
{# var stageCount = json.results.length;#}
{# if (stageCount == 0){#}
{# stageCountVal = 1;#}
{# }else{#}
{# stageCountVal = stageCount;#}
{# }#}
{##}
{# var htmlInbox = "";#}
{##}
{# var htmlInboxStage = '< p class = "textStepss" > Какое кол-во этапов подразумевает работа? ' +#}
{# '< input type = "text" id = "countStage" value = "'+ stageCountVal +'" size = "3" / > < / p > ';#}
{##}
{# if (stageCount == 0){#}
{# htmlInboxStage += '< div class = "numberStepp box-sizing" id = "stage1" > ' +#}
{# '< p > Этап < span class = "stage-span-id" > 1< / span > < / p > < form class = "new-stages-form" id = "stage-form" > ' +#}
{# '< label for = "" > Название< / label > < input class = "form-control" name = "name" type = "text" / > ' +#}
{# '< label for = "" > Цена< / label > < input class = "form-control" name = "cost" type = "text" / > ' +#}
{# '< input class = "form-control" name = "order" type = "hidden" value = "'+ orderId +'" class = "orderStagesInput" / > />' +#}
{# '< label for = "" > Срок< / label > < input class = "form-control" name = "term" type = "text" / > ' +#}
{# '< label for = "" > Результат< / label > < input class = "form-control" name = "result" type = "text" / > ' +#}
{# '< / form > < / div > ';#}
{# }#}
{# var statusNotAgreed = true;#}
{# $.each(json.results, function (i, v) {#}
{# if (v.status == "not_agreed") {#}
{# htmlInbox += '< div class = "numberStepp box-sizing" > ' +#}
{# '< p > Этап< / p > < form class = "update-stages-form" id = "stage-form-'+ v.pos +'" > ' +#}
{# '< label for = "" > Название< / label > < input class = "form-control" type = "text" value = "'+ v.name +'" / > ' +#}
{# '< label for = "" > Цена< / label > < input class = "form-control" type = "text" value = "'+ v.cost +'" / > ' +#}
{# '< input class = "form-control" type = "hidden" value = "'+ v.order +'" / > ' +#}
{# '< label for = "" > Срок< / label > < input class = "form-control" type = "text" value = "'+ v.term +'" / > ' +#}
{# '< label for = "" > Результат< / label > < input class = "form-control" type = "text" value = "'+ v.result +'" / > ' +#}
{# '< / form > < / div > ';#}
{# } else {#}
{# statusNotAgreed = false;#}
{# htmlInboxStage = "";#}
{# htmlInbox += '< div class = "numberStepp box-sizing" > < div class = "insetNumStepp" > ' +#}
{# '< p class = "titleNumStepp" > < span > Этап ' + v.pos + '< / span > ' + v.name + '< / p > ' +#}
{# '< p class = "textNumStepp" > Результаты этапа:' + v.result + '< / p > < div > ' +#}
{# '< p > до 16.03.2015< / p > < span > ' + v.cost + '< i class = "fa fa-rub" > < / i > < / span > < / div > < / div > < / div > ';#}
{##}
{# }#}
{# });#}
{##}
{# if (statusNotAgreed) {#}
{# htmlInbox += '< div class = "box-sizing disTab" style = "text-align:center;" > < div class = "checkbox" > < input type = "checkbox" style = "opacity:1" > Перейти в режим безопасной сделки' +#}
{# '< / div > < / div > < div class = "textAreaBlock2 box-sizing disTab" > ' +#}
{# '< a href = "javascript:void()" data-order-id = "'+ orderId +'" id = "addStagesForm" > отправить на согласование< / a > < / div > ';#}
{# }#}
{# htmlInbox = htmlInboxStage + htmlInbox;#}
{# $("#order-stages").html(htmlInbox);#}
{# }#}
{# });#}
});
// Вытащить сообщения для конактов
@ -527,6 +494,10 @@
$("#chat").val("");
});
$('#order-review-add').on('click', function(){
alert('add review');
});
$('#order-chat-add-message').on('click', function () {
var chatMessage = $("#chat-order-add #chat").val();
var recipentId = $("#chat-order-add #recipentId").val();
@ -550,9 +521,6 @@
});
var userId = '{{ request.user.pk }}';
var SocketHandler = function () {
var url = 'ws://127.0.0.1:8888/chat/' + userId + '/';