From ae875b576fdd505fdd0a3fd1c7232e594207e6ae Mon Sep 17 00:00:00 2001 From: booblegum Date: Fri, 16 Dec 2016 20:04:25 +0300 Subject: [PATCH] =?UTF-8?q?PR-14=20=D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D1=86=D0=B8=D1=8F=20=D1=88=D0=B0=D0=BF=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B0=D0=BA=D0=BA=D0=B0=D1=83=D0=BD=D1=82=20=D0=98=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8F,=20?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D1=83=20=D0=B2=20=D0=BB=D0=B8?= =?UTF-8?q?=D1=87=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit реализованы счетчики сообщений изменен дизайн header'а доработано изменение статуса Order на process --- archilance/settings/base.py | 1 + assets/img/icons/icon_hands.png | Bin 0 -> 3642 bytes assets/img/icons/icon_hands_red.png | Bin 0 -> 3710 bytes assets/img/icons/icon_speach-ball.png | Bin 0 -> 3481 bytes assets/img/icons/icon_speach-ball_red.png | Bin 0 -> 3529 bytes assets/js/chat.js | 10 + chat/templates/chat_contractor.html | 387 +++++++++--------- chat/templates/chat_customer.html | 73 ++-- chat/templates/inc-contact-card.html | 56 +++ common/templatetags/__init__.py | 0 common/templatetags/common_tags.py | 6 + context_processors/user_info.py | 26 ++ projects/signals.py | 2 +- projects/views.py | 23 +- reviews/signals.py | 1 + templates/home.html | 1 + templates/partials/base.html | 41 +- templates/partials/header.html | 125 +++--- templates/partials/sass/header.sass | 80 +++- .../templatetags/user_new_count.html | 2 +- .../templatetags/user_new_count_orders.html | 2 +- users/templatetags/user_tags.py | 35 +- wallets/models.py | 2 +- wallets/views.py | 6 +- 24 files changed, 545 insertions(+), 334 deletions(-) create mode 100644 assets/img/icons/icon_hands.png create mode 100644 assets/img/icons/icon_hands_red.png create mode 100644 assets/img/icons/icon_speach-ball.png create mode 100644 assets/img/icons/icon_speach-ball_red.png create mode 100644 chat/templates/inc-contact-card.html create mode 100644 common/templatetags/__init__.py create mode 100644 context_processors/user_info.py diff --git a/archilance/settings/base.py b/archilance/settings/base.py index c00f3be..29ae6c6 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -118,6 +118,7 @@ TEMPLATES = [ 'django.core.context_processors.request', 'social.apps.django_app.context_processors.backends', 'social.apps.django_app.context_processors.login_redirect', + 'context_processors.user_info.user_info' ], # Load these templatetags by default: diff --git a/assets/img/icons/icon_hands.png b/assets/img/icons/icon_hands.png new file mode 100644 index 0000000000000000000000000000000000000000..2efeea04d4db88244c2c8391a48b32666cec0635 GIT binary patch literal 3642 zcmV-A4#n|_P)f6Xi@@54ZTQ_E-Enz5K6$1 z03tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUFWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il z#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|>%+C|c55>;RS}qbKr-&IQ zTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bf ze_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l90Z_aBhs|Iw0E)7{bq;-T z9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g z$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL1(`yIK=_}U_z%PWq}jQa ziQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{wo%_#%{(V=tO#a9gB!7-$ zM?^BX5>d|Vn*3S!?g~$*UQipUP zL&zMmg;!4Do9IA%up=Rh?=qPj=x&RGBx1dpI68aT- z2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?c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ue6Qh$I4DkG2C|KxL6sl{ORjZxe{2*Xz4c>#C}%JkrzC zt@QYDU0vOcnwlDitW+bO?%$1B{W3E$GR9Cj;u+xyo{-s&|Np1|1I#Ir;a&z)VgLXD M07*qoM6N<$f*X$ZPXGV_ literal 0 HcmV?d00001 diff --git a/assets/img/icons/icon_hands_red.png b/assets/img/icons/icon_hands_red.png new file mode 100644 index 0000000000000000000000000000000000000000..58ece0090316fcc214829ab38a64a949fc909fa1 GIT binary patch literal 3710 zcmV-^4uSEBP)f6Xi@@54ZTQ_E-Enz5K6$1 z03tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUFWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il z#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|>%+C|c55>;RS}qbKr-&IQ zTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bf ze_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l90Z_aBhs|Iw0E)7{bq;-T z9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g z$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL1(`yIK=_}U_z%PWq}jQa ziQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{wo%_#%{(V=tO#a9gB!7-$ zM?^BX5>d|Vn*3S!?g~$*UQipUP zL&zMmg;!4Do9IA%up=Rh?=qPj=x&RGBx1dpI68aT- z2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?cd`V|I)p<|3O zju?MT93~aB0<#&j8`F+Cg&D?-VWzQItUA^l>xvDRIYI4MQ`g1<+DyrL=EogS06Xii({|v`U^zjmmKqDIK93(F5q| z^fLNk`gQs{RV`IdRle#b)i%{Ds;|}NsClUI)k@Ub)kf6bsWa4l)YH_rsduU0(?DsM zX@qO!YV6TCtMPOWZH~(v?wpc2hv(eZ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Wf_v}A;-u3*k3(gmgUSwVD zy5w-FbHIL};|Kd6ItCpEJBJ*Hx-UCj?irppeBz4xmD5+fub#UWaP88_{E^}7QP*$Y zNVp-r$-DXJR{E{yw{vdK+*xxMeYfPE(!GlNn)e%iH2tw%>L5Kn>ODH}V8MesW8ASP zKV|>)e!S=*`C-L`&P4Mg+egPHeJ3wJUif(YN!F8@r^P=j|6Kdbc>FRj6+1Ql zT=e|YubW?}zu5oM?q%{|4xSIMK;4&oJRVmL@;AhM-rRU^UDZftfKC z6)UN#E(Uo;jA?;$M;f?Ps>$<(Yg1qy6Ye3wX=3fI(bVWTf+|>#(_lt!`gK~I*%r*~ z>{L9i)ony<8T)BLYE%-x@Y_MaE*IEmL%#K$;`($Si{rL2f`el01~_X7luZ@9%{B~; zq>j^B)J`pqhPvDN^$C6Xfh3PvKr_ced5M_Y8`aBPC76rar2@IrA1idPtvyFMJbG59 zM{dRBUvHFu0?rh8KHR>G4tbaw$ovU6?m_ngUr9Lpe>rTRUJ`;Y6&tzf`_TDCwM36G6dg1T}>L= z{CD8jCGcCho)}=a@I5isLx}Y;$6p*mYWD$Nrd*^5To2$z1o^f^J-)_R>pvrnIr*pU c|Nqnf6Lub76yz|SJOBUy07*qoM6N<$f~5{99RL6T literal 0 HcmV?d00001 diff --git a/assets/img/icons/icon_speach-ball.png b/assets/img/icons/icon_speach-ball.png new file mode 100644 index 0000000000000000000000000000000000000000..9768a3c72919fd9c012d29008e4f613752a5a107 GIT binary patch literal 3481 zcmV;K4QBF*P)f6Xi@@54ZTQ_E-Enz5K6$1 z03tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUFWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il z#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|>%+C|c55>;RS}qbKr-&IQ zTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bf ze_i~WlJ|C&UW9+{8AKoW!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TCOquvC@h5XM z$Zc(HTMG*dhfr^#lGpzOk3=HXK)Y!U!fY2OLP9|N=A0!b5wTOrAnHysk+oXw#B#v1 zv$GqRiB=Lj#kV(s+mlDfzr!xsag8i`87T9?ID=o|-H4`b0QwY+J;7o&F?K&)Z>WAZ zfANRKXIa{Pz<~FJS{A5^b}NAE1t~j>3uY~_`!o;WT?m<(-Vw&9RhQnAG(H$*@!uj) zvACb9+gMs!>Y}M)Q|uI#GBz6~yMQp@)r5ER&tzT0B0ixxIN literal 0 HcmV?d00001 diff --git a/assets/img/icons/icon_speach-ball_red.png b/assets/img/icons/icon_speach-ball_red.png new file mode 100644 index 0000000000000000000000000000000000000000..2c3bbfd3e9b2b507d3f011d05d4ce7ffaaef5af8 GIT binary patch literal 3529 zcmV;)4L0(LP)f6Xi@@54ZTQ_E-Enz5K6$1 z03tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUFWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il z#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|>%+C|c55>;RS}qbKr-&IQ zTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bf ze_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l90Z_aBhs|Iw0E)7{bq;-T z9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g z$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL1(`yIK=_}U_z%PWq}jQa ziQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{wo%_#%{(V=tO#a9gB!7-$ zM?^BX5>d|Vn*3S!?g~$*UQipUP zL&zMmg;!4Do9IA%up=Rh?=qPj=x&RGBx1dpI68aT- z2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?cd`V|I)p<|3O zju?MT93~aB0<#&j8`F+Cg&D?-VWzQItUA^l>xvD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64`ccn z719V_|DD219n#u426lXb0Sl?$5u!p}n(jEpN*=IZdm1hc;TV0;00000NkvXXu0mjf DV92VC literal 0 HcmV?d00001 diff --git a/assets/js/chat.js b/assets/js/chat.js index 8e6dc18..4e83512 100644 --- a/assets/js/chat.js +++ b/assets/js/chat.js @@ -113,6 +113,13 @@ var socket = new SocketHandler(); var csrftoken = getCookie('csrftoken'); +function updateCounts() { + var my_office = $('#my_office'); + var all_messages = $('.js-all-messages'); + my_office.html('0'); + all_messages.html('0'); +} + $(function () { function dialog (message, yesCallback, notCallback) { $("#dialog_delete .modal-title").html(message); @@ -147,6 +154,9 @@ function dialog (message, yesCallback, notCallback) { break; case 'tab2': + console.log("tab2"); + // /api/message?recipent__id=5 + updateCounts(); setTimeout(function () { if (liveHash.indexOf("#order") == 0) { var ordHashId = liveHash.replace("#order", ""); diff --git a/chat/templates/chat_contractor.html b/chat/templates/chat_contractor.html index 60de835..85860e3 100644 --- a/chat/templates/chat_contractor.html +++ b/chat/templates/chat_contractor.html @@ -17,15 +17,18 @@ @@ -40,29 +43,7 @@

Контакты

{% for contact in contacts_users %} -
-
- {% thumbnail contact.avatar "60x60" crop="center" as im %} - mess-image - {% endthumbnail %} -
-

- {% 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 %} - -

-

- - Контакты - - {% get_new_count_for_contact contact request.user %} - - Удалить контакт - -
+ {% include 'inc-contact-card.html' %} {% endfor %}
@@ -74,12 +55,13 @@ - +
- -

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

+ +

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

отправить @@ -89,29 +71,30 @@
-

Прикрепленные документы

-
    -
- - Распечатать с помощью ресурса - -
+

Прикрепленные документы

+
    +
+ + Распечатать с помощью ресурса + +
-

Для заметок

- - +

Для заметок

+ + - - сохранить + + сохранить
- + {% include 'contact-info.html' %} - +
@@ -123,12 +106,15 @@

Заказы

{% for order in orders %}
+ id="orderBlock{{ order.id }}" + data-team-id="{% if order.team %}{{ order.team.pk }}{% else %}0{% endif %}" + data-recipent-id="{{ order.project.customer.pk }}" data-id="{{ order.id }}">

{{ order }}

- + Исполнитель: {{ request.user.get_full_name }}

@@ -143,17 +129,17 @@ {% if archive_orders %} @@ -183,11 +170,12 @@ - +
- -

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

+ +

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

@@ -218,28 +206,28 @@
-

3 / Выполнение работы

-

- Процесс выполнения задания в заказе до получения +

3 / Выполнение работы

+

+ Процесс выполнения задания в заказе до получения заказчиком итогового результата работы. -

+

-
+
@@ -250,12 +238,12 @@
-

Прикрепленные документы

-
    - - Распечатать с помощью ресурса - -
    +

    Прикрепленные документы

    +
      + + Распечатать с помощью ресурса + +
        @@ -273,118 +261,125 @@
      - -
      -
      -
      -

      Заказы

      - {% for torder in team_orders %} -
      - -

      - {{ torder }} + +

      +
      +
      +

      Заказы

      + {% for torder in team_orders %} +
      + +

      + {{ torder }} +

      +
      +

      + + + Исполнитель: {{ torder.team.name }}

      -
      -

      - - - Исполнитель: {{ torder.team.name }} -

      -
        - {% for tuser in torder.team.users.all %} -
      • {{ tuser }}
      • - {% endfor %} -
      -

      - Чаты: - {% if request.user.pk != torder.team.owner.pk %} - {{ torder.team.owner.username }} - {% endif %} - {% for tuser in torder.team.contractors.all %} - {% if request.user.pk != tuser.pk %} - {{ tuser.username }} - {% endif %} - {% endfor %} -

      - - - Полное описание заказа - -
      +
        + {% for tuser in torder.team.users.all %} +
      • {{ tuser }}
      • + {% endfor %} +
      +

      + Чаты: + {% if request.user.pk != torder.team.owner.pk %} + {{ torder.team.owner.username }} + {% endif %} + {% for tuser in torder.team.contractors.all %} + {% if request.user.pk != tuser.pk %} + {{ tuser.username }} + {% endif %} + {% endfor %} +

      + + + Полное описание заказа +
      - {% endfor %} +
      + {% endfor %} - {% for yteam in your_teams %} -
      - -

      - {{ yteam }} + {% for yteam in your_teams %} +

      + +

      + {{ yteam }} +

      +
      +

      + + Владелец группы: {{ yteam.owner }} +

      +
        + {% for tuser in yteam.contractors.all %} +
      • {{ tuser }}
      • + {% endfor %} +
      +

      + Чаты: + {% if request.user.pk != torder.team.owner.pk %} + {{ yteam.owner.username }} + {% endif %} + {% for tuser in yteam.contractors.all %} + {% if request.user.pk != tuser.pk %} + {{ tuser.username }} + {% endif %} + {% endfor %}

      -
      -

      - - Владелец группы: {{ yteam.owner }} -

      -
        - {% for tuser in yteam.contractors.all %} -
      • {{ tuser }}
      • - {% endfor %} -
      -

      - Чаты: - {% if request.user.pk != torder.team.owner.pk %} - {{ yteam.owner.username }} - {% endif %} - {% for tuser in yteam.contractors.all %} - {% if request.user.pk != tuser.pk %} - {{ tuser.username }} - {% endif %} - {% endfor %} -

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

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

      -
      -
      -
      -
      - -
      - отправить +
      +
      +
      + + + + + + + + + +
      +
      + +

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

      +
      +
      +
      - -
      - + +
      +
      -

      Прикрепленные документы

      -
        - - Распечатать с помощью ресурса - -
        +

        Прикрепленные документы

        +
          + + Распечатать с помощью ресурса + +
            @@ -400,12 +395,12 @@
          -
          - - - {% include 'order_info.html' %} - +
          + + + {% include 'order_info.html' %} +
          {% include 'partials/footer.html' %}
          @@ -414,12 +409,12 @@ {% endblock %} {% block js_block %} - - - + + {% endblock %} diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html index 9755e5a..0f65f65 100644 --- a/chat/templates/chat_customer.html +++ b/chat/templates/chat_customer.html @@ -35,35 +35,7 @@

          Контакты

          {% for contact in contacts_users %} -
          -
          - {% if contact.avatar %} - {% thumbnail contact.avatar "60x60" crop="center" as im %} - mess-image - {% endthumbnail %} - {% else %} - mess-image - {% endif %} -
          -

          - {% 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 %} -

          -

          - - Контакты - - - {% get_new_count_for_contact contact request.user %} - - - Удалить контакт - -
          + {% include 'inc-contact-card.html' %} {% endfor %}
          @@ -127,7 +99,8 @@

          Заказы

          {% for order in orders %}
          {{ order }}

          - + Исполнитель: {% if order.order.contractor %} {{ order.order.contractor.get_full_name }} @@ -152,9 +126,9 @@ Полное описание заказа -{# #} -{# Удалить заказ#} -{# #} + {# #} + {# Удалить заказ#} + {# #}

          @@ -164,17 +138,17 @@ {% if archive_projects %} diff --git a/chat/templates/inc-contact-card.html b/chat/templates/inc-contact-card.html new file mode 100644 index 0000000..fc3abbe --- /dev/null +++ b/chat/templates/inc-contact-card.html @@ -0,0 +1,56 @@ +{% load thumbnail %} +{% load static %} +{% load user_tags %} + +
          +
          + {% if contact.avatar %} + {% thumbnail contact.avatar "60x60" crop="center" as im %} + mess-image + {% endthumbnail %} + {% else %} + mess-image + {% endif %} +
          +

          + {% 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 %} +

          + {% if request.user.is_contractor %} +
          + {% else %} +
          + {% endif %} + {{ contact.username }} +
          +

          + + Контакты + + {% get_new_count_for_contact contact request.user %} + + Удалить контакт + +
          \ No newline at end of file diff --git a/common/templatetags/__init__.py b/common/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/common/templatetags/common_tags.py b/common/templatetags/common_tags.py index 28e7f56..add294a 100644 --- a/common/templatetags/common_tags.py +++ b/common/templatetags/common_tags.py @@ -148,4 +148,10 @@ def get(dic, key): return dic.get(key) +@register.filter +def max_count(value, max_value): + if value > max_value: + return '99+' + return str(value) + # import code; code.interact(local=dict(globals(), **locals())) diff --git a/context_processors/user_info.py b/context_processors/user_info.py new file mode 100644 index 0000000..089fb6a --- /dev/null +++ b/context_processors/user_info.py @@ -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 {} diff --git a/projects/signals.py b/projects/signals.py index f03f9bc..6a68700 100644 --- a/projects/signals.py +++ b/projects/signals.py @@ -2,7 +2,7 @@ from django.db.models.signals import post_save from django.dispatch import receiver from django.utils import timezone -from .models import Stage +from .models import Stage, Order @receiver(post_save, sender=Stage) diff --git a/projects/views.py b/projects/views.py index 626eaa0..3ba92be 100644 --- a/projects/views.py +++ b/projects/views.py @@ -116,6 +116,7 @@ class ProjectDetailWithAnswerView(BaseMixin, View): return render(request, self.template_name, context) def post(self, request, *args, **kwargs): + # @Отклик на Проект(Project) if request.user.is_authenticated() and request.user.is_contractor(): context = self.get_context_data(**kwargs) answer_as_team = None @@ -138,6 +139,7 @@ class ProjectDetailWithAnswerView(BaseMixin, View): else: form = self.form_class(request.POST, request=request, project=project) + # FIXME: еще раз находим проект? project = get_object_or_404(Project, pk=kwargs.get('pk')) context.update({'project': project}) @@ -521,13 +523,15 @@ class CustomerProjectCreateView(BaseMixin, View): def post(self, request, *args, **kwargs): form = self.form_class(request.POST, request=request) # Passing `request.FILES` seems unnecessary here. Files are added manually below - # print('POST = ', request.POST) + print('POST = ', request.POST) form.is_valid() realty = form.cleaned_data.get('realty') if realty: + print("Has Realty") realty_form = self.realty_form(request.POST, instance=realty, request=request, prefix='realty_form') else: + print("Create new Realty") realty_form = self.realty_form(request.POST, request=request, prefix='realty_form') if form.is_valid() and realty_form.is_valid(): @@ -546,13 +550,13 @@ class CustomerProjectCreateView(BaseMixin, View): for file in request.FILES.getlist('new_files'): ProjectFile.objects.create(file=file, project=project) - if realty: - realty_form.save() - else: + if not realty: realty = realty_form.save(commit=False) realty.user = user if not request.POST.get('new_realty_name'): + print("Virtual!") realty.is_virtual = True + print("Set realty name -->", request.POST.get('new_realty_name')) realty.name = request.POST.get('new_realty_name') realty.save() realty_form.save_m2m() @@ -848,6 +852,7 @@ class CustomerOfferOrderView(View): template_name = 'chattest.html' def post(self, request, *args, **kwargs): + # @ Утверждение Исполнителя project_id = kwargs.get('project_id') answer_id = kwargs.get('answer_id') try: @@ -864,12 +869,14 @@ class CustomerOfferOrderView(View): if not order.contractor and not order.team: if isinstance(answer.author, User): order.contractor = answer.author - order.save() - status = True + # order.status = 'process' + # order.save() + # status = True elif isinstance(answer.author, Team): order.team = answer.author - order.save() - status = True + order.status = 'process' + order.save() + status = True if status: hs_rating = HistoryRating() hs_rating.user = request.user diff --git a/reviews/signals.py b/reviews/signals.py index e47f225..ce50ce9 100644 --- a/reviews/signals.py +++ b/reviews/signals.py @@ -23,6 +23,7 @@ def add_rating_review(sender, instance, created, **kwargs): hs_rating.save() count_reviews = Review.objects.filter(project=instance.project).count() + print("count_reviews = ", count_reviews) if count_reviews == 2: order = instance.project.order order.status = 'completed' diff --git a/templates/home.html b/templates/home.html index 20ae8e4..da35f42 100644 --- a/templates/home.html +++ b/templates/home.html @@ -140,6 +140,7 @@ {% endblock %} {% block js_block %} + {{ block.super }} {% endblock %} diff --git a/templates/partials/base.html b/templates/partials/base.html index 0f7d67e..2e2060d 100644 --- a/templates/partials/base.html +++ b/templates/partials/base.html @@ -14,7 +14,6 @@ {# {% compress css %}#} {% block old_css %} - @@ -22,13 +21,14 @@ - {% endblock %} {% block common_css %} + + {% endblock %} {% block head_css %} @@ -76,7 +76,7 @@ {% block common_js %} -{# #} + {# #} {% endblock %} {#{% compress js %}#} {% block old_js %} @@ -98,21 +98,44 @@ - + +{% endblock %} + +{% block ws_block %} + {% endblock %} diff --git a/templates/partials/header.html b/templates/partials/header.html index 6bbe587..cea82c3 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -3,11 +3,12 @@ {% load user_tags %} {% load activeurl %} {% load sass_tags %} +{% load common_tags %} {% if request.user.is_contractor %} - {% url 'users:contractor-profile' pk=request.user.pk as profile_url %} + {% url 'users:contractor-profile' pk=request.user.pk as profile_url %} {% elif request.user.is_customer %} - {% url 'users:customer-profile-open-projects' pk=request.user.pk as profile_url %} + {% url 'users:customer-profile-open-projects' pk=request.user.pk as profile_url %} {% endif %} @@ -15,19 +16,22 @@
          -
          - + - + {% activeurl %} - {% if request.user.is_authenticated %} -
          +
          + {% if request.user.is_authenticated %} + -
          - {% else %} - - {% endif %} - {% endactiveurl %} - - {% if request.user.is_authenticated %} -
          + {% endif %} +
          + {% endactiveurl %} +
          + {% if request.user.is_authenticated %} {% if request.user.is_contractor %} {% contractor_indicator request.user %} {% endif %} @@ -84,30 +90,31 @@
          @@ -150,14 +162,25 @@ {% endif %}
          + {% if request.user.is_contractor %} + + {% endif %} -
          - {% else %} -
          + {% else %} Регистрация -
          -
          - {% endif %} + +
          +
          + {% endif %} +
          diff --git a/templates/partials/sass/header.sass b/templates/partials/sass/header.sass index 2b3e2f2..bba0857 100644 --- a/templates/partials/sass/header.sass +++ b/templates/partials/sass/header.sass @@ -7,14 +7,61 @@ .topMain width: 1200px margin: 0 auto + color: #ffffff + .dropdown-menu > li > a + display: inline-block .col-lg-7 width: 55% .col-lg-2 width: 19% .mainMenu li + cursor: pointer padding-right: 25px a font-size: 15px + //&:hover + cursor: pointer + + .user-info + float: right + height: 100% + a + display: block + color: white + cursor: pointer + &:hover + text-decoration: none + color: #FF0029 + .cash + text-align: right + padding-top: 4px + .icon_hand + padding-left: 26px + background: + image: url("#{$static}/img/icons/icon_hands.png") + size: 24px 24px + repeat: no-repeat + &:hover + background-image: url("#{$static}/img/icons/icon_hands_red.png") + .icon_chat + margin-top: 4px + padding-left: 26px + background: + image: url("#{$static}/img/icons/icon_speach-ball.png") + size: 18px 18px + repeat: no-repeat + &:hover + background-image: url("#{$static}/img/icons/icon_speach-ball_red.png") + +.circle + background-color: red + border-radius: 50% + width: 30px + height: 30px + line-height: 30px + display: inline-block + text-align: center + //align-items: center .welcomeMain width: 100% @@ -41,6 +88,7 @@ .mainMenu float: left margin: 26px 0 0 0 + padding-left: 60px li float: left position: relative @@ -161,14 +209,16 @@ &.icon_tm3.active span background: url('#{$static}/img/listMain2.png') no-repeat right !important -li.officeList.icon_tml > a > p +li.officeList.icon_tml > a > .count display: inline-block - padding: 5px 7px 3px 7px - background: #ff0000 - border-radius: 35px - position: absolute - right: -34px - top: -4px + color: red + font-family: 'pfbeausanspro-reg', sans-serif + //padding: 5px 7px 3px 7px + background: none + border-radius: 0 + position: inherit + //right: -34px + //top: -4px .reg, .reg:link, .reg:visited color: #fb1818 @@ -191,7 +241,8 @@ li.officeList.icon_tml > a > p width: 75px height: 75px float: right - margin: 0 0 0 -60px + margin: 0 + padding-left: 5px img display: block width: 100% @@ -282,6 +333,13 @@ li.officeList.icon_tml > a > p height: 20px background-size: contain background: url('#{$static}/img/user-5.png') no-repeat 0 0 + .icon_chat a span + height: 20px + background: + image: url("#{$static}/img/icons/icon_speach-ball.png") + size: contain + repeat: no-repeat + .icon_mm1 a:hover span height: 20px background: url('#{$static}/img/menu2.png') no-repeat center !important @@ -315,3 +373,9 @@ li.officeList.icon_tml > a > p height: 20px background-size: contain background: url('#{$static}/img/user-4.png') no-repeat 0 0 + .icon_chat a:hover span + height: 20px + background: + image: url("#{$static}/img/icons/icon_speach-ball_red.png") + size: contain + repeat: no-repeat \ No newline at end of file diff --git a/users/templates/templatetags/user_new_count.html b/users/templates/templatetags/user_new_count.html index 3c89bb0..c6a5d63 100644 --- a/users/templates/templatetags/user_new_count.html +++ b/users/templates/templatetags/user_new_count.html @@ -1 +1 @@ -{{ new_count }} +
          {{ new_count }}
          diff --git a/users/templates/templatetags/user_new_count_orders.html b/users/templates/templatetags/user_new_count_orders.html index 8b9b759..a34c0bb 100644 --- a/users/templates/templatetags/user_new_count_orders.html +++ b/users/templates/templatetags/user_new_count_orders.html @@ -1 +1 @@ -

          {{ new_count }}

          +
          {{ new_count }}
          diff --git a/users/templatetags/user_tags.py b/users/templatetags/user_tags.py index 48753b3..55e312b 100644 --- a/users/templatetags/user_tags.py +++ b/users/templatetags/user_tags.py @@ -10,7 +10,6 @@ from projects.models import Order from reviews.models import Review from users.helpers import get_projects_grouped - register = template.Library() @@ -50,7 +49,13 @@ def count_new_message(context, user): @register.inclusion_tag('templatetags/user_new_count_orders.html', takes_context=True) def count_new_message_orders(context, user): - new_count = NewMessage.objects.filter(user=user, message__order__in=user.orders.all(), + """ + + :param context: + :param user: + :return: + """ + new_count = NewMessage.objects.filter(user=user, message__order__in=user.orders.filter(status='created'), message__team__isnull=True).count() try: team = user.team @@ -58,23 +63,30 @@ def count_new_message_orders(context, user): team = None if team: - new_count_team = NewMessage.objects.filter(user=user, message__order__in=user.team.orders.all(), + new_count_team = NewMessage.objects.filter(user=user, + message__order__in=user.team.orders.filter(status='created'), message__team__isnull=True).count() new_count += new_count_team + + if new_count > 99: + new_count = '99+' return { 'new_count': new_count, } @register.simple_tag -def get_new_count_message(team_pk,user=None): +def get_new_count_message(team_pk, user=None): count = NewMessage.objects.filter(user=user, message__team=team_pk, message__order__isnull=True).count() return count @register.simple_tag def get_new_count_for_contact(contact, current_user): - count = current_user.new_messages.filter(message__sender=contact, message__order__isnull=True, message__team__isnull=True).count() + count = current_user.new_messages.filter(message__sender=contact, message__order__isnull=True, + message__team__isnull=True).count() + if count > 99: + new_count = '99+' return count @@ -114,14 +126,17 @@ def get_customer_chat_open_projects(user): @register.filter def get_project_message_count(user): if user.is_customer(): - projects = user.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, order__team__isnull=True) + projects = user.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, + order__team__isnull=True) return projects.aggregate(c=Count('answers__messages'))['c'] elif user.is_contractor(): - message_count = user.contractor_answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] - + message_count = \ + user.contractor_answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] + if util.has_related(user, 'team'): - message_count += user.team.answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] - + message_count += \ + user.team.answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] + return message_count diff --git a/wallets/models.py b/wallets/models.py index 1ef97fd..69f1529 100644 --- a/wallets/models.py +++ b/wallets/models.py @@ -41,7 +41,7 @@ class InvoiceHistory(models.Model): current_sum_info = InvoiceHistory.objects.filter(user=self.user, type="score").aggregate(Sum('sum')) current_sum = current_sum_info['sum__sum'] or 0 if self.type == "score": - self.balance = current_sum + self.sum + self.balavoids_atnce = current_sum + self.sum else: self.balance = current_sum super().save(*args, **kwargs) diff --git a/wallets/views.py b/wallets/views.py index 1cc245c..6170574 100644 --- a/wallets/views.py +++ b/wallets/views.py @@ -76,15 +76,15 @@ class ScoreView(LoginRequiredMixin, View): template_name = 'score-detail.html' def get(self, request, *args, **kwargs): - # transaction = Transaction.objects.get_or_create(customer=request.user, complete=False) - transaction = Transaction.objects.get_or_create(customer=request.user, type='add', complete=False) + transaction, created = Transaction.objects.get_or_create(customer=request.user, type='add', complete=False) + # transaction = Transaction.objects.filter(customer=request.user, type='add', complete=False) user_score = get_object_or_404(User.objects, pk=kwargs.get('pk')) current_sum_info = InvoiceHistory.objects.filter(user=user_score, type="score").aggregate(Sum('sum')) user_score_balance = current_sum_info['sum__sum'] or 0 form = WithDrawForm return render(request, self.template_name, { - 'transaction': transaction[0], + 'transaction': transaction, 'YANDEX_MONEY': settings.YANDEX_MONEY, 'user_score': user_score, 'user_score_balance': user_score_balance,