From 58dd3fcc9446b777869a95c81350206f726cecdb Mon Sep 17 00:00:00 2001 From: shishman Date: Tue, 16 Aug 2016 20:29:31 +0300 Subject: [PATCH 1/3] edited modal form(add portfolio), application form, specialization widget --- assets/css/main.css | 201 ++++- projects/templates/project_detail.html | 752 +++++++++++++----- .../templatetags/specializations_widget.html | 14 +- users/templates/portfolio_create_form.html | 88 +- 4 files changed, 800 insertions(+), 255 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index d113549..9161b2a 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -35,9 +35,9 @@ body, html { position: relative; } -input[type=checkbox], input[type=radio] { - opacity: 0; -} +/*input[type=checkbox], input[type=radio] { + opacity: 0; / * Блядь, какого ХУЯ????? * / +}*/ a, a:hover, a:focus, a:active { text-decoration: none !important; @@ -1314,7 +1314,7 @@ footer:after { margin: 30px 0 23px 0; } -.titleResF1 { +.titleResF1, div p.titleResF1 { font-size: 15px; font-family: 'Arial-MT-Regular', sans-serif; font-weight: bold; @@ -5483,3 +5483,196 @@ input[type="radio"]:checked + span { } } +/*my_new_style*/ +.proj_answ_form .textAreaBlock2 p { + font-size: 15px; + font-weight: bold; + display: table; + width: auto; + margin-top: 13px; +} +.polsF1 .dropdown-menu.open a{ + border: none; + border-radius: 0; + margin-bottom: 0; +} +.proj_answ_form .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn){ + width: 121px !important; + border: 1px solid #cdcdcd; +} +.proj_answ_form .bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) .btn{ + padding: 14px 30px 14px 18px; +} +.proj_answ_form .textAreaBlock2 input{ + width: 90px; + height: 51px; + padding: 0 15px; + font-size: 15px; + background-color: white; + color: #9c9c9c; + float: left; + margin-right: 26px; + font-family: 'Arial-MT-Regular', sans-serif; +} +.proj_answ_form .textAreaBlock2 input[type="text"] { + margin-left: 10px; + width: 216px; +} +.proj_answ_form .textAreaBlock2 input[name="term"]{ + width: 262px; +} +.proj_answ_form .textAreaBlock2 p span{ + position: absolute; + bottom: 13px; + font-size: 12px; + font-weight: normal; +} +.port_add_bl ul li{ + width: 20%; + display: table; + float: left; + padding-right: 10px; +} +.port_add_bl ul { + margin-top: 15px; + padding: 0 15px; +} +.port_add_bl label{ + margin-right: 5px; +} +.port_add_bl > p:first-child{ + font-size: 15px; + font-weight: bold; + padding: 0 15px; +} +#fileUploadContainer div button, .proj_answ_form .send_req_block button{ + border-radius: 40px; + font-family: 'pfdintextcomppro-regular', sans-serif; + letter-spacing: 2px; + color: #373737; + font-size: 15px; + border: 1px solid #BEBEBE; + padding: 17px 46px; + text-transform: uppercase; + outline: none; +} +#fileUploadContainer, .proj_answ_form .check_bs, .proj_answ_form .send_req_block{ + padding: 0 15px; +} +.proj_answ_form .check_bs label{ + margin-right: 5px; +} +.dashedCol4 { + width: 254px; + height: 239px; + position: absolute; + overflow: hidden; + display: block; + background-color: #fff; +} +.dashedCol4:after { + content: ""; + position: absolute; + height: 50px; + width: 100%; + background: #fff; + bottom: 0; + right: 0; +} +.dashedCol4:hover{ + box-shadow: 0 0 10px rgba(0,0,0,0.8); + z-index: 999; + display: table; +} +.insetSpec span:first-child{ + width: 75%; +} +.select2-container .select2-choice { + border-radius: 0 !important; + border: 1px solid #ccc; + background: #fff !important; + height: 50px; + font-size: 15px; + color: #2c2c2c; + position: relative; + font-family: 'Arial-MT-Regular', sans-serif; + background-color: white; +} +.select2-container .select2-choice .select2-arrow{ + display: none; +} +.select2-container .select2-choice > .select2-chosen { + margin-right: 6px; + line-height: 47px; +} +.select2-results .select2-result-label{ + font-size: 15px; + font-family: 'Arial-MT-Regular', sans-serif; + padding-top: 10px; + padding-bottom: 10px; + display: block; + padding: 9px 8px; + clear: both; + background: #fff; + font-weight: normal; + line-height: 1.42857143; + color: #333333; + white-space: nowrap; +} +.select2-results .select2-result-label:hover{ + background-color: #f2f2f2; +} +.select2-display-none{ + border: 1px solid #aaa; +} +.select2-container .select2-choice abbr{ + right: 3px; + top: 16px; +} +#portfolio-add-form .textAreaBlock2 p{ + font-size: 15px; + font-family: 'Arial-MT-Regular', sans-serif; + font-weight: bold; + color: #2c2c2c; +} +#portfolio-add-form #text-new{ + margin-top: 0; +} +.textAreaBlock2 input{ + width: 100%; + height: 51px; + padding: 0 15px; + font-size: 15px; + background-color: white; + color: #9c9c9c; + font-family: 'Arial-MT-Regular', sans-serif; +} +#portfolio-add-form .polsF1 .btn{ + border:1px solid #c2c2c2; +} +#modal_type_build .btn-group{ + width: 100% !important; +} +.textAreaBlock2 .add_file_to_port{ + border-radius: 40px; + font-family: 'pfdintextcomppro-regular', sans-serif; + letter-spacing: 2px; + color: #373737; + background-color: #fff; + font-size: 15px; + border: 1px solid #BEBEBE; + padding: 17px 46px; + text-transform: uppercase; + outline: none; + display: table; + float: left; + width: auto; +} +.textAreaBlock2 .add_file_to_port:hover{ + color: #373737; + background-color: #f2f2f2 !important; +} +.progress-bar-success { + background-color: #c2c2c2; +} +/*end_new*/ \ No newline at end of file diff --git a/projects/templates/project_detail.html b/projects/templates/project_detail.html index 5808868..7b9ed78 100644 --- a/projects/templates/project_detail.html +++ b/projects/templates/project_detail.html @@ -1,251 +1,597 @@ {% extends 'partials/base.html' %} {% load humanize %} - +{% load thumbnail %} +{% load specializtions_tags %} {% block content %} {% include 'partials/header.html' %} -
-
-
-

{{ project }}

-
-
-
-
-

{{ project.budget|intcomma }}

-
-
- +
+
+
+

{{ project.name }}

+
+ +
+
+ + {% if request.user.is_contractor %} +
+

{{ project.budget|intcomma }}

+
+ {% endif %} + +
+
- execitor-image -
-
-

- {{ project.customer.get_full_name }} [{{ project.customer }}] -

- -
-
- -
-
-
-

- Специализации: -

-
- Интерьеры -
-
- Визуализация/3D -
-
-
-
-
    -
  • - 13.0.2016 -
  • -
  • - Техническое сопровождение -
  • -
-
-
-

Есть допуск СРО

-
-
-
-
-
-
-
    -
  • - Местоположение: -
  • -
  • - Классификация здания: {{ project.realty.building_classification }} -
  • -
  • - Вид строительства: {{ project.realty.type_construction }} -
  • -
-
-
-

- {{ project.text }} + {% if project.customer.avatar %} + execitor-image + {% else %} + execitor-image + {% endif %} +

+ +

+ {{ project.customer.get_full_name }} [{{ project.customer.username }}]

-
-
- - Ответить на проект - -
-
- -
-
-
- - -
- {% csrf_token %} + - + {% if not request.user.is_contractor %} + + {% endif %} +
+ + {% if request.user.is_contractor %} +
+ +
+ {% endif %} + +
+
+

+ Специализации: +

+
+ Интерьеры +
+
+ Визуализация/3D +
+
+
+ +
+
    +
  • + {{ project.created }} +
  • +
  • + {{ project.get_work_type_display }} +
  • +
-
-
-
-

Стоимость

- + {% if project.cro %} +
+
+

Есть допуск СРО

+
+ {% endif %} +
+
+ +
+
+ + {% if project.realty %} +
+
    +
  • Местоположение: {{ project.realty.location.name }}
  • +
  • Классификация здания: {{ project.realty.building_classification.name }}
  • +
  • Вид строительства: {{ project.realty.type_construction.name }}
  • +
+
+ {% endif %} + +
+

+ {{ project.text }} +

+
+ +
+ {% if request.user.is_contractor %} + + Ответить на проект + +
+
+ + +
- -
-
-

Бюджет

- {{ form.currency }} + {% elif request.user.is_customer %} + + Редактировать + + +
+ {% csrf_token %} + + + + Снять с публикации + +
+ {% endif %} +
+
+ + + + + + + + + + + + {% if request.user.is_contractor %} + + + + + + + {% if answer %} +
+
+
+ +
+ {% if answer.author.avatar %} + execitor-image + {% else %} + execitor-image + {% endif %} +
+
+ +

+ {% if answer.author|class_name == 'User' %} + {{ answer.author.get_full_name }} [{{ answer.author.username }}] + {% elif answer.author|class_name == 'Team' %} + {{ answer.author.name }} + {% endif %} +

+ + + + {% if answer.author|class_name == 'User' %} + {% if answer.author.contractor_status == 'free' %} +
Свободен
+ {% endif %} + {% endif %} +
+
+ + + {% if answer.author|class_name == 'User' %} + {% if answer.author.cro %} +
+
+

Есть допуск СРО

+
+ {% endif %} + {% elif answer.author|class_name == 'Team' %} +{# {% if any of these motherfuckers "answer.author.contractors.all" got a cro, then... %}#} +
+
+

Есть допуск СРО

+
+{# {% endif %}#} + {% endif %}
+
+

+ Цена: + {{ answer.budget|intcomma }} + +

+

+ Срок: {{ answer.term }} {{ answer.get_term_type_display|decap }} +

+

Опубликован: {{ answer.created }}

+
+ + + + + + +
+ {% for portf in answer.portfolios.all %} +
+
+
+
+
+
+
+ {% endfor %} +
+ + + + + +
+
+
+

+ Иванов Петр Иванович +

+ + 13.01.2016 / 21:05 + +
+ + + + + +
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. +

+
+
+ + + + +
+
+

+ Иванов Петр Иванович +

+ + 13.01.2016 / 21:05 + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. +

+ + Ответить + +
+
+
+ + +
- -
-
-
-
-

Срок

- - + {% else %} +
+ {% csrf_token %} + + +
+
+
+

Стоимость {{ form.budget.errors.as_text }}

+ +
+
+ +
+
+ {{ form.currency }} +
+
+ +
+
+

Срок {{ form.term.errors.as_text }}

+ +
+
+ +
+
+ {{ form.term_type }} +
+
+ +
+
+

Текст {{ form.text.errors.as_text }}

+ +
+
- -
-
-

Тип срока

- {{ form.term_type }} + +
+
+

Портфолио {{ form.portfolios.errors.as_text }}

+ +
    + {% for p in form.portfolios.field.queryset.all %} +
  • + +

    {{ p.name }}

    +
  • + {% endfor %} +
- -
-
-
-
-
-

Текст

- + +
+
+
+
+ Не более 10 файлов общим объемом до 500 Мб +
+ +
    + +
+
-
-
- -
-
-
- {% for p in user.portfolio.all %} -

{{ p }}

- {% endfor %} + +
+
+
+ +

{{ form.secure_deal_only.label }}

+
+
+
+ +
+
+
+ +
-
+ +
+ + {% endif %} + + + + + + {% elif request.user.is_customer %} + + + + + +
+
+

Исполнители

- -
-
+
+
+ + + +
- -
-
- {% for answer in project.answers.all %} -
+
+ +
+
+

Сравнить кандидатов

+
+
+ +
+

Новые исполнители

+
+ + + + + + + + + + + + {% for answer_p in project.answers.all %} +
+
- - {% if answer.contractor.cro %} -
-
-

Есть допуск СРО

-
+ {% ratings_widget answer_p.author.pk 'restList2' %} + {% if answer_p.author.cro %} +
+
+

Есть допуск СРО

+
{% endif %}

Цена: - {{ answer.budget }} + {{ answer_p.budget }}

- Срок: {{ answer.term }} {{ answer.term_type }} + Срок: {{ answer_p.term }} of {{ answer_p.term_type }}

-

Опубликован: {{ answer.created }}

+

Опубликован: {{ answer_p.created | date:"M d, Y" }}

-
-{#
#} -{#
#} -{#

#} -{# Иванов Петр Иванович#} -{#

#} -{# #} -{# 13.0.2016 / 21:05#} -{# #} -{#
#} -{# #} -{# #} -{# #} -{# #} -{# #} -{#
#} -{#

#} -{# Text#} -{#

#} -{#
#} -{#
#} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ Иванов Петр Иванович +

+ + 13.01.2016 / 21:05 + +
+ + + + + +
+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. +

+
+
+
+
+

+ Иванов Петр Иванович +

+ + 13.01.2016 / 21:05 + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio. +

+ + Ответить + +
+
+
{% endfor %} -
- -
- {% include 'partials/pagination.html' %} -
- - {% include 'partials/footer.html' %} -
-
+ {% endif %} + + + + {% include 'partials/footer.html' %} +
+
{% endblock %} diff --git a/specializations/templates/templatetags/specializations_widget.html b/specializations/templates/templatetags/specializations_widget.html index 97aa3e2..d2aaed3 100644 --- a/specializations/templates/templatetags/specializations_widget.html +++ b/specializations/templates/templatetags/specializations_widget.html @@ -1,11 +1,13 @@

Специализации:

- {% for spec in specializations %} -
- {{ spec }} - 2-й -
- {% endfor %} +
+ {% for spec in specializations %} +
+ {{ spec }} + 2-й +
+ {% endfor %} +
{#
#} {#

#} diff --git a/users/templates/portfolio_create_form.html b/users/templates/portfolio_create_form.html index ab0a03f..a7d316d 100644 --- a/users/templates/portfolio_create_form.html +++ b/users/templates/portfolio_create_form.html @@ -3,13 +3,13 @@

{% csrf_token %}
-

Название{{ portfolio_form.name.errors.as_text }}

+

Название{{ portfolio_form.name.errors.as_text }}

-

Описание{{ portfolio_form.description.errors.as_text }}

+

Описание{{ portfolio_form.description.errors.as_text }}

@@ -32,77 +32,81 @@
- - + +
-
+

Бюджет{{ portfolio_form.budget.errors.as_text }}

-
+
{{ portfolio_form.currency}}
-
+
-
+

Срок выполнения{{ portfolio_form.budget.errors.as_text }}

-
+
{{ portfolio_form.term_type }}
-
+
-
-

Вид строительства

- {{ portfolio_form.construction_type}} -
- -
-

Классификация здания

- {{ portfolio_form.building_classification}} -
+ -
+
-
- +
+
-{# #} -{# #} -{# Выберите файлы#} -{# #} -{# #} -{# #} - - - -
-
- -
-
-
- -
-
- From af63f9022b0a9602a7a936bbb3f6069a1793b0ab Mon Sep 17 00:00:00 2001 From: shishman Date: Wed, 17 Aug 2016 00:02:31 +0300 Subject: [PATCH 2/3] edited modal form(add portfolio) --- assets/css/main.css | 9 +++++---- users/templates/portfolio_create_form.html | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index 9161b2a..209a229 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1204,11 +1204,12 @@ footer:after { color: #FF0029; } -.polsF1 .dropdown-menu { +.polsF1 .dropdown-menu.open { width: 100%; - margin-top: 2px; + margin:0 !important; + padding: 0 !important; border-radius: 0 !important; - outline: 1px solid #FF0029; + outline: 2px solid #FF0029; } .bootstrap-select.btn-group .dropdown-menu { @@ -5650,7 +5651,7 @@ input[type="radio"]:checked + span { #portfolio-add-form .polsF1 .btn{ border:1px solid #c2c2c2; } -#modal_type_build .btn-group{ +#portfolio-add-form .bootstrap-select{ width: 100% !important; } .textAreaBlock2 .add_file_to_port{ diff --git a/users/templates/portfolio_create_form.html b/users/templates/portfolio_create_form.html index a7d316d..fa16304 100644 --- a/users/templates/portfolio_create_form.html +++ b/users/templates/portfolio_create_form.html @@ -86,27 +86,27 @@ -
-
+ +
Выберите файлы
-
+
-
+
-
+
-
+
From ec96fb1894cb7651466c9542919730795197c0c3 Mon Sep 17 00:00:00 2001 From: shishman Date: Wed, 17 Aug 2016 09:22:21 +0300 Subject: [PATCH 3/3] edited chat_customer --- assets/css/bootstrap.css | 4 +- assets/css/main.css | 39 ++- chat/templates/chat_customer.html | 408 ++++++++++++++++++------------ 3 files changed, 287 insertions(+), 164 deletions(-) diff --git a/assets/css/bootstrap.css b/assets/css/bootstrap.css index b561aab..2dec3e0 100644 --- a/assets/css/bootstrap.css +++ b/assets/css/bootstrap.css @@ -3610,13 +3610,13 @@ tbody.collapse.in { right: 0; left: auto; } -.dropup .caret, +/*.dropup .caret, .navbar-fixed-bottom .dropdown .caret { border-top: 0; border-bottom: 4px dashed; border-bottom: 4px solid \9; content: ""; -} +}*/ .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; diff --git a/assets/css/main.css b/assets/css/main.css index 209a229..a7244a3 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1115,7 +1115,7 @@ footer:after { } .titleF1 { - margin: 0 0 23px 0; + margin: 23px 0 0 0; } .titleF1, .polsF1, .searchF1, .resSearchF1, .sro { @@ -1133,7 +1133,7 @@ footer:after { .polsF1 .btn-group .btn { width: 100% !important; - padding: 15px 105px 15px 18px; + padding: 15px 30px 15px 18px; border-radius: 0 !important; border: none; font-size: 15px; @@ -1220,9 +1220,9 @@ footer:after { margin-bottom: 0; } -.polsF1 .dropdown-menu li:first-child { +/*.polsF1 .dropdown-menu li:first-child { margin-top: -6px; -} +}*/ .polsF1 .dropdown-menu li:last-child { margin-bottom: 2px; @@ -5441,7 +5441,7 @@ input[type="radio"]:checked + span { position: absolute; font-family: 'Glyphicons Halflings'; right: -6.5px; - top: -21px; + top: -19px; font-size: 12px; } @@ -5600,7 +5600,12 @@ input[type="radio"]:checked + span { background-color: white; } .select2-container .select2-choice .select2-arrow{ - display: none; + background: #fff; + border: none; +} +.select2-container .select2-choice .select2-arrow b{ + position: relative; + top: 9px; } .select2-container .select2-choice > .select2-chosen { margin-right: 6px; @@ -5676,4 +5681,26 @@ input[type="radio"]:checked + span { .progress-bar-success { background-color: #c2c2c2; } +.bootstrap-select.btn-group .dropdown-menu li { + position: relative; + float: left; + width: 100%; +} +#order-stages label{ + margin-bottom: 0; + margin-top: 8px; +} +#order-stages .checkbox label{ + margin-top: 0; +} +#order-stages > div { + display: table; + width: 100%; + padding-bottom: 14px; + border-bottom: 1px solid #2c2c2c; + margin-bottom: 14px; +} +#order-stages > div:nth-last-child(2), #order-stages > div:last-child{ + border: none; +} /*end_new*/ \ No newline at end of file diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html index babae49..98980f0 100644 --- a/chat/templates/chat_customer.html +++ b/chat/templates/chat_customer.html @@ -24,7 +24,7 @@
- +
- + - +
@@ -117,9 +138,9 @@

Прикрепить файл

- - Не более 10 файлов с общим объемом 500мб - + + Не более 10 файлов с общим объемом 500мб +
отправить
@@ -136,79 +157,51 @@

-{#
#} -{#

#} -{# Какое кол-во этапов подразумевает работа? #} -{#

#} -{# #} -{##} -{#
#} -{# #} - -
+
-

2 / Резервирование

-

- Резервирование заказчиком суммы оплаты по заказ. Деньги перечисляются и хранятся на сайте. -

+

2 / Резервирование

+

+ Резервирование заказчиком суммы оплаты по заказ. Деньги перечисляются и хранятся на + сайте. +

+ Зарезирвировать +
-
+
-
@@ -238,38 +293,133 @@ var form = document.getElementById('message_form'); var csrftoken = getCookie('csrftoken'); + function 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 = '

Какое кол-во этапов подразумевает работа? ' + + '

'; + + if (stageCount == 0) { + htmlInboxStage += '
' + + '

Этап 1

' + + '' + + '' + + // ' />' + + '' + + '' + + '
'; + } + var statusNotAgreed = true; + $.each(json.results, function (i, v) { + if (v.status == "not_agreed") { + htmlInbox += '
' + + '

Этап

' + + '' + + '' + + '' + + '' + + '' + + '
'; + } else { + statusNotAgreed = false; + htmlInboxStage = ""; + htmlInbox += '
' + + '

Этап ' + v.pos + '' + v.name + '

' + + '

Результаты этапа:' + v.result + '

' + + '

до 16.03.2015

' + v.cost + '
'; + + } + }); + + if (statusNotAgreed) { + htmlInbox += '
Перейти в режим безопасной сделки' + + '
'; + } + htmlInbox = htmlInboxStage + htmlInbox; + $("#order-stages").html(htmlInbox); + } + }); + } + + setTimeout(function () { + $(".user-block").first().trigger('click'); + }, 10); + + setTimeout(function () { + $(".order-block").first().trigger('click'); + }, 100); - $("#order-stages").on('click', "#addStagesForm", function(){ - $(".new-stages-form").each(function(i,v){ - console.log($(this).serialize()); - alert($(this).serialize()); + $("#order-stages").on('click', "#addStagesForm", function (e) { + e.preventDefault(); + $(".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) { + console.log('error'); + console.log(e); + } + }); + + }); + + $(".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) { + xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')) + }, + data: $(this).serialize(), dataType: 'json', success: function (json) { console.log(json); }, - error: function(e){ + error: function (e) { console.log('error'); console.log(e); } }); + }); + + + var currentOrderId = $(this).attr('data-order-id'); + currentOrderId = parseInt(currentOrderId); + getStages(currentOrderId); + - }); }); - $('#order-stages-tab').on('change', '#countStage', function(){ + $('#order-stages-tab').on('change', '#countStage', function () { var countStage = parseInt($(this).val()); var updateFormStages = $(".update-stages-form"); - - alert(updateFormStages.length); - alert(typeof updateFormStages.length); var limitCount = countStage + 1; for (var i = 2; i < limitCount; i++) { var stageCopy = $("#stage1").clone().attr("id", "stage" + i).addClass("stages_form"); @@ -277,10 +427,9 @@ } }); - $('.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'); @@ -290,6 +439,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'); @@ -315,71 +466,9 @@ }); } }); - - $.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 = '

Какое кол-во этапов подразумевает работа? ' + - '

'; - - if (stageCount == 0){ - htmlInboxStage += '
' + - '

Этап 1

' + - '' + - '' + - ' />' + - '' + - '' + - '
'; - } - var statusNotAgreed = true; - $.each(json.results, function (i, v) { - if (v.status == "not_agreed") { - htmlInbox += '
' + - '

Этап

' + - '' + - '' + - '' + - '' + - '' + - '
'; - } else { - statusNotAgreed = false; - htmlInboxStage = ""; - htmlInbox += '
' + - '

Этап ' + v.pos + '' + v.name + '

' + - '

Результаты этапа:' + v.result + '

' + - '

до 16.03.2015

' + v.cost + '
'; - - } - }); - - if (statusNotAgreed) { - htmlInbox += '
Перейти в режим безопасной сделки' + - '
'; - } - htmlInbox = htmlInboxStage + htmlInbox; - $("#order-stages").html(htmlInbox); - } - }); - - + getStages(orderId); }); - // Вытащить сообщения для конактов $('.user-block').on('click', function () { var userId = $(this).attr('data-id'); @@ -430,6 +519,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(); @@ -452,10 +545,13 @@ }); - var userId = '{{ request.user.pk }}'; + var userId = '{{ request.user.pk }}'; var SocketHandler = function () { - var url = 'ws://127.0.0.1:8888/chat/' + userId + '/'; + var domain = '{{ request.META.HTTP_HOST }}'; + var port = '{{ request.META.SERVER_PORT }}'; + domain = domain.replace(':' + port, ''); + var url = 'ws://' + domain + ':8888/chat/' + userId + '/'; var sock = new WebSocket(url); var intervalId; sock.onopen = function () {