remotes/origin/PR-39
Mukhtar 9 years ago
parent cb33f9bd2a
commit 1f3abd0204
  1. 9
      chat/templates/chat_contractor.html
  2. 20
      common/middleware.py
  3. 89
      projects/templates/project_detail.html
  4. 2
      users/models.py
  5. 4
      users/templates/contractor_filter.html
  6. 2
      users/templates/contractor_office.html
  7. 8
      users/templates/contractor_profile.html

@ -177,14 +177,7 @@
</div>
<div class="col-lg-6 commChat">
<div id="message-chat-order-space"></div>
<div class="col-lg-12 insetCommChat">
<div class="topCommChat">
<p class="nameCommChat">ArturBaybulatov</p>
<span>2016-09-07 17:09:52</span>
</div>
<p class="textCommChat">Приглашаю в группу http://proekton.com/users/teams/128/</p>
<a href="#" class="message_connect">присоединиться</a>
</div>
<form id="chat-order-add">
<input type="hidden" id="orderId" name="orderId">
<input type="hidden" id="senderId" name="senderId" value="{{ request.user.pk }}">

@ -1,12 +1,30 @@
import datetime
from django.utils.timezone import now
from users.models import User
from ratings.models import HistoryRating
class SetLastVisitMiddleware(object):
def process_response(self, request, response):
if hasattr(request,'user'):
if hasattr(request, 'user'):
if request.user.is_authenticated():
User.objects.filter(pk=request.user.pk).update(last_time_visit=now())
return response
class SetRatingToUserEveryDay(object):
def process_response(self, request, response):
if hasattr(request, 'user'):
today_date = datetime.datetime.now().date()
hs_last = HistoryRating.objects.filter(user=request.user, type='visit_site').order_by('-created').first()
if not hs_last or hs_last.created.date() != today_date:
hs_new = HistoryRating()
hs_new.type = 'visit_site'
hs_new.rating = 1
hs_new.user = request.user
hs_new.description = 'Балл за вход на сайт'
hs_new.save()
return response

@ -291,7 +291,7 @@
<form action="{% url 'projects:reject-project-answer' pk=answer.pk %}" method="POST" novalidate>
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.path }}">
<a href="#" onclick="$(this).closest('form').submit(); return false" class="candLink candLink3" title="{{ answer.pk }}">отказ</a>
<a href="#" class="candLink candLink3 reject-project-link-contractor" title="{{ answer.pk }}">отказ</a>
</form>
{% if project.order.contractor and project.order.contractor == answer.author %}
@ -673,7 +673,13 @@
<form action="{% url 'projects:customer-offer-order' answer_id=answer.pk project_id=project.pk %}" method="POST" novalidate>
{% csrf_token %}
<a href="#" onclick="$(this).closest('form').submit(); return false" class="candLink candLink2">
<a href="#"
data-sender-id="{{ request.user.pk }}"
data-recipent-id="{% if answer.author|class_name == 'User' %}{{ answer.author.pk }}{% elif answer.author|class_name == 'Team'%}{{ answer.author.owner.pk }}{% endif %}"
data-order-id="{{ project.order.id }}"
data-order-name="{{ project.name }}"
class="candLink candLink2 offer-order-contractor">
предложить проект
</a>
</form>
@ -688,7 +694,11 @@
<form action="{% url 'projects:reject-project-answer' pk=answer.pk %}" method="POST" novalidate>
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.path }}">
<a href="#" onclick="$(this).closest('form').submit(); return false" class="candLink candLink3" title="{{ answer.pk }}">отказ</a>
<a href="#" data-sender-id="{{ request.user.pk }}"
data-recipent-id="{% if answer.author|class_name == 'User' %}{{ answer.author.pk }}{% elif answer.author|class_name == 'Team'%}{{ answer.author.owner.pk }}{% endif %}"
data-order-name="{{ project.name }}"
data-project-id="{{ project.pk }}"
class="candLink candLink3 reject-project-link" title="{{ answer.pk }}">отказ</a>
</form>
</div>
@ -867,7 +877,12 @@
<form action="{% url 'projects:customer-offer-order' answer_id=answer.pk project_id=project.pk %}" method="POST" novalidate>
{% csrf_token %}
<a href="#" onclick="$(this).closest('form').submit(); return false" class="candLink candLink2">
<a href="#"
data-sender-id="{{ request.user.pk }}"
data-recipent-id="{% if answer.author|class_name == 'User' %}{{ answer.author.pk }}{% elif answer.author|class_name == 'Team'%}{{ answer.author.owner.pk }}{% endif %}"
data-order-id="{{ project.order.id }}"
data-order-name="{{ project.name }}"
class="candLink candLink2 offer-order-contractor">
предложить проект
</a>
</form>
@ -882,7 +897,13 @@
<form action="{% url 'projects:reject-project-answer' pk=answer.pk %}" method="POST" novalidate>
{% csrf_token %}
<input type="hidden" name="next" value="{{ request.path }}">
<a href="#" onclick="$(this).closest('form').submit(); return false" class="candLink candLink3" title="{{ answer.pk }}">отказ</a>
<a href="#"
data-sender-id="{{ request.user.pk }}"
data-recipent-id="{% if answer.author|class_name == 'User' %}{{ answer.author.pk }}{% elif answer.author|class_name == 'Team'%}{{ answer.author.owner.pk }}{% endif %}"
data-order-name="{{ project.name }}"
data-project-id="{{ project.pk }}"
class="candLink candLink3 reject-project-link" title="{{ answer.pk }}">отказ
</a>
</form>
</div>
@ -1011,7 +1032,12 @@
</div>
<div class="col-lg-3 retts">
{% ratings_widget answer.author.pk 'restList2' %}
{% if answer.author|class_name == 'User' %}
{% ratings_widget answer.author.pk 'restList2' %}
{% elif answer.author|class_name == 'Team'%}
{% ratings_team_widget answer.author.pk 'restList2' %}
{% endif %}
{% if answer.author|class_name == 'User' and answer.author.cro %}
<div class="sroUser sroExecutor">
@ -1168,6 +1194,57 @@
$.cookie('projectAnswerFormVisible', 'true', {expires: new Date(new Date().getTime() + 300000)})
}
}
$('.offer-order-contractor').on('click', function(e){
e.preventDefault()
var senderId = $(this).attr('data-sender-id')
var recipentId = $(this).attr('data-recipent-id')
var orderId = $(this).attr('data-order-id')
var msg = 'Вас выбрали исполнителем для заказа '
socketMain.add_message({
format_type: 'add_message_contact',
message_type: 'offer_order',
data: {
sender_id: String(senderId),
recipent_id: String(recipentId),
order_id: String(orderId),
chat_message: msg,
},
})
$(this).closest('form').submit()
})
$('.reject-project-link').on('click', function(e){
e.preventDefault();
var projectId = $(this).attr('data-project-id')
var msg = 'Вам отказано по проекту " ' + $(this).attr("data-order-name") + '" <a class="message_connect" href="http://{{ request.get_host }}/projects/'+ projectId +'/" >Перейти</a>'
var customerId = $(this).attr('data-sender-id')
var contractorId = $(this).attr('data-recipent-id')
socketMain.add_message({
format_type: 'add_message_contact',
message_type: 'reject_order',
data: {
sender_id: String(customerId),
recipent_id: String(contractorId),
chat_message: msg,
},
})
$(this).closest('form').submit();
})
$('.reject-project-link-contractor').on('click', function(e){
e.preventDefault();
$(this).closest('form').submit();
})
window.toggleProjectAnswerForm = toggleProjectAnswerForm
}())

@ -169,7 +169,7 @@ class User(AbstractBaseUser, PermissionsMixin):
return self.email
def get_full_name(self):
full_name = self.first_name + ' ' + self.last_name
full_name = self.first_name + ' ' + self.last_name + ' ' + self.patronym
return full_name or self.username
def get_profile_image(self):

@ -459,7 +459,7 @@
if (project.order.team && project.order.team.id === teamId) {
window.location.href = projectOrderChatUrl
} else {
var msg = 'Вашей команде предлагается проект <a href="http://{{ request.get_host }}' + projectUrl + '">http://{{ request.get_host }}' + projectUrl +'</a>'
var msg = 'Вашей команде предлагается проект <a class="message_connect" href="http://{{ request.get_host }}' + projectUrl + '">Перейти к проекту</a>'
socketMain.add_message({
format_type: 'add_message_contact',
@ -480,7 +480,7 @@
if (project.order.contractor && project.order.contractor.id === contractorId) {
window.location.href = projectOrderChatUrl
} else {
var msg = 'Вам предлагается проект <a href="http://{{ request.get_host }}' + projectUrl + '">http://{{ request.get_host }}' + projectUrl +'</a>'
var msg = 'Вам предлагается проект <a class="message_connect" href="http://{{ request.get_host }}' + projectUrl + '">Перейти к проекту</a>'
socketMain.add_message({
format_type: 'add_message_contact',

@ -389,7 +389,7 @@
data: {
sender_id: '{{ contractor.pk }}',
recipent_id: String(contractor2Id),
chat_message: 'Приглашаю в группу <a href="http://{{ request.get_host }}{% url 'users:accept-team-invitation' owner_id=contractor.pk %}">http://{{ request.get_host }}{% url 'users:accept-team-invitation' owner_id=contractor.pk %}</a>',
chat_message: 'Приглашаю в группу "{{ contractor.team.name }}" <a href="http://{{ request.get_host }}{% url 'users:accept-team-invitation' owner_id=contractor.pk %}" class="message_connect">Присоединиться</a>',
},
})

@ -738,11 +738,11 @@
if (res.status === 'success') {
socketMain.add_message({
format_type: 'add_message_contact',
message_type: 'invite_team',
data: {
sender_id: '{{ request.user.pk }}',
recipent_id: '{{ contractor.pk }}',
chat_message: 'Приглашаю в группу http://{{ request.get_host }}{% url 'users:accept-team-invitation' owner_id=request.user.pk %}',
chat_message: 'Приглашаю в группу "{{ request.user.team.name }}" <a href="http://{{ request.get_host }}{% url 'users:accept-team-invitation' owner_id=request.user.pk %}" class="message_connect">Присоединиться</a>',
},
})
@ -794,11 +794,11 @@
if (project.order.contractor && project.order.contractor.id === contractorId) {
window.location.href = projectOrderChatUrl
} else {
var msg = 'Вам предлагается проект http://{{ request.get_host }}' + projectUrl
var msg = 'Вам предлагается проект <a class="message_connect" href="http://{{ request.get_host }}' + projectUrl +'">Перейти к проекту</a>'
socketMain.add_message({
format_type: 'add_message_contact',
message_type: 'invite_order',
data: {
sender_id: String(customerId),
recipent_id: String(contractorId),

Loading…
Cancel
Save