реализованы счетчики сообщений изменен дизайн header'а доработано изменение статуса Order на processremotes/origin/PR-46
parent
2aefad6a99
commit
ae875b576f
24 changed files with 545 additions and 334 deletions
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,56 @@ |
||||
{% load thumbnail %} |
||||
{% load static %} |
||||
{% load user_tags %} |
||||
<style> |
||||
div.icon_mm1 { |
||||
display: inline-block; |
||||
height: 20px; |
||||
width: 20px; |
||||
margin-right: 5px; |
||||
background-size: cover; |
||||
background: url('/static/img/menu2.png') no-repeat 0 0; |
||||
} |
||||
|
||||
div.icon_mm2 { |
||||
display: inline-block; |
||||
height: 20px; |
||||
width: 20px; |
||||
margin-right: 5px; |
||||
background-size: cover; |
||||
background: url('/static/img/menu2.png') no-repeat 0 -20px; |
||||
} |
||||
|
||||
</style> |
||||
<div class="message messd user-block" id="userBlock{{ contact.pk }}" data-id="{{ contact.pk }}"> |
||||
<div class="imgMess"> |
||||
{% if contact.avatar %} |
||||
{% thumbnail contact.avatar "60x60" crop="center" as im %} |
||||
<img src="{{ im.url }}" alt="mess-image"> |
||||
{% endthumbnail %} |
||||
{% else %} |
||||
<img src="{% static 'img/profile.jpg' %}" alt="mess-image"> |
||||
{% endif %} |
||||
</div> |
||||
<p class="nameMess"> |
||||
{% if contact.is_contractor %} |
||||
{% url "users:contractor-profile" pk=contact.pk as contact_url %} |
||||
{% else %} |
||||
{% url "users:customer-profile-open-projects" pk=contact.pk as contact_url %} |
||||
{% endif %} |
||||
<div style="display: flex; align-items: center"> |
||||
{% if request.user.is_contractor %} |
||||
<div class="icon_mm1"></div> |
||||
{% else %} |
||||
<div class="icon_mm2"></div> |
||||
{% endif %} |
||||
<a href="{{ contact_url }}" style="color:black;">{{ contact.username }}</a> |
||||
</div> |
||||
</p> |
||||
|
||||
<a href="#" data-id="{{ contact.id }}" class="conMess">Контакты</a> |
||||
<span class="contact-count-{{ contact.pk|add:request.user.pk }}"> |
||||
{% get_new_count_for_contact contact request.user %}</span> |
||||
<a href="#" class="deleteMess" data-recipent-id="{{ contact.pk }}"> |
||||
Удалить контакт |
||||
</a> |
||||
</div> |
||||
@ -0,0 +1,26 @@ |
||||
# from django.core.context_processors import request |
||||
from django.db.models import Sum |
||||
from wallets.models import InvoiceHistory |
||||
from chat.models import NewMessage |
||||
from projects.models import Order |
||||
|
||||
|
||||
def user_info(request): |
||||
if request.user.is_authenticated(): |
||||
current_sum_info = InvoiceHistory.objects.filter(user=request.user, type="score").aggregate(Sum('sum')) |
||||
user_balance = current_sum_info['sum__sum'] or 0 |
||||
|
||||
new_messages_count = NewMessage.objects.filter(user=request.user).count() |
||||
num_orders_in_work = request.user.orders.filter(status='process').count() |
||||
try: |
||||
fist_order_id = request.user.orders.all()[0].id |
||||
except IndexError: |
||||
fist_order_id = "" |
||||
return { |
||||
"user_balance": user_balance, |
||||
"new_messages_count": new_messages_count, |
||||
"num_orders_in_work": num_orders_in_work, |
||||
"fist_order_id": fist_order_id |
||||
} |
||||
|
||||
return {} |
||||
@ -1 +1 @@ |
||||
<span class="badge badge-count">{{ new_count }}</span> |
||||
<div class="circle">{{ new_count }}</div> |
||||
|
||||
@ -1 +1 @@ |
||||
<p>{{ new_count }}</p> |
||||
<div id="my_office" class="count">{{ new_count }}</div> |
||||
|
||||
Loading…
Reference in new issue