You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

158 lines
7.2 KiB

{% extends 'partials/base.html' %}
{% load staticfiles %}
{% load i18n %}
{% block content %}
{% include 'partials/header.html' %}
<div class="container mainScore">
<div class="row">
<div class="col-lg-12">
<p class="titleScore">Сравнение кандидатов по проекту</p>
</div>
<div class="titleBlockComparison disTab">
<div class="triangle1"></div>
<p>{{ object }}</p>
<table class="compTable" id="compTable">
<thead>
<tr>
<th></th>
<th>Кандидат</th>
<th>Цена</th>
<th>Срок</th>
<th>Описание</th>
<th>Рейтинги/отзывы</th>
<th>Безопасные сделки</th>
<th>Решение</th>
</tr>
</thead>
<tbody>
{% for cand in object.candidates.all %}
<tr style="cursor:move;" class="items[]_{{ cand.pk }}" data-class="items[]_{{ cand.pk }}">
<td>{{ cand.position }}</td>
<td>
{% if cand.answer.author|class_name == 'User' %}
{% firstof cand.answer.author.get_full_name.strip cand.answer.author.username %}
{% elif cand.answer.author|class_name == 'Team' %}
{% firstof cand.answer.author.name.strip cand.answer.author.username %}
{% endif %}
</td>
<td>{{ cand.answer.budget }} <i class="{% fa_currency_classes cand.answer.currency %}"></i></td>
<td>
{% if cand.answer.term_type == 'project' %}
За проект
{% elif cand.answer.term and cand.answer.term_type %}
{% morph cand.answer.term TERM_TYPE_MORPHS|get:cand.answer.term_type %}
{% endif %}
</td>
<td>
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" data-tooltip data-placement="right" title="{{ cand.answer.get_first_message }}"></span>
</td>
<td>
<ul>
<li><span>{{ cand.answer.author.rating }}</span></li>
<li>
<span>+0</span> 0 <small> - 0</small>
</li>
{% if cand.answer.author.cro %}
<li>
СРО
</li>
{% endif %}
</ul>
</td>
<td>
<span>0</span><br>
{% if cand.answer.secure_deal_only %}
Готов работать по безопасной сделке
{% endif %}
</td>
<td>
<div class="tableButtons disTab">
<form action="{% url 'projects:customer-offer-order' answer_id=cand.answer.pk project_id=cand.project.pk %}" method="POST" novalidate>
{% csrf_token %}
<a href="#" onclick="$(this).closest('form').submit(); return false">
<div class="btnTab btnTab1" title="Предложить проект"></div>
</a>
</form>
<a href="{% url 'chat:chat-user' %}?user_id={{ cand.answer.author.pk }}">
<div class="btnTab btnTab2" title="Перейти в чат"></div>
</a>
<form method="POST" action="{% url 'projects:delete-candidate' cand.pk %}">
{% csrf_token %}
<input class="btnTab btnTab3" type="submit" value="" title="Удалить из сравнения">
</form>
<a href="{% url 'users:contractor-profile' cand.answer.author.pk %}#open-contact">
<div class="btnTab btnTab4" title="Показать контакты"></div>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% include 'partials/footer.html' %}
</div>
</div>
{% endblock %}
{% block js_block %}
<script>
$(function () {
var fixHelper = function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
};
$("#compTable tbody").sortable({
forcePlaceholderSize: true,
forceHelperSize: true,
items: 'tr',
update: function () {
var serial = $('#compTable tbody').sortable('serialize', {key: 'items[]', attribute: 'data-class'});
console.log(serial);
$.ajax({
url: '/projects/candidate/comparison/sort/',
method: 'POST',
beforeSend: function (xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
},
data: serial,
dataType: 'json',
success: function (json) {
console.log(json);
},
error: function (jqXHR, e) {
console.log(jqXHR);
console.log(e);
}
});
},
helper: fixHelper,
}).disableSelection();
;
});
</script>
{% endblock %}