Merge branch 'PR-66'

remotes/origin/HEAD
booblegum 9 years ago
commit 972fafdf31
  1. BIN
      assets/img/icons/icon_contacts_gray.png
  2. BIN
      assets/img/icons/icon_contacts_red.png
  3. 37
      users/static/sass/customer-profile.sass
  4. 1
      users/templates/customer_profile.html
  5. 14
      users/templates/partials/inc-customer_profile-info.html
  6. 40
      users/templates/partials/modals/mod-customer-contacts.html
  7. 12
      users/views.py

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -83,7 +83,7 @@ table.projects
white-space: nowrap white-space: nowrap
%icons %icons
margin-left: 24px margin-left: 0px
display: flex display: flex
align-items: center align-items: center
&:before &:before
@ -171,3 +171,38 @@ table.projects
image: url('#{$static}/img/icons/icon_сertificate-512.png') image: url('#{$static}/img/icons/icon_сertificate-512.png')
repeat: no-repeat repeat: no-repeat
size: 18px 18px size: 18px 18px
.icon-contacts
display: inline-flex
align-items: center
padding-bottom: 2px
color: #0b0b0b
@extend %icons
&:before
width: 25px
height: 19px
background:
image: url('#{$static}/img/icons/icon_contacts_gray.png')
repeat: no-repeat
//size: 25px 19px
&:hover
text-decoration: none
color: #0b0b0b
cursor: pointer
border-bottom: 1px solid red
&:before
background:
image: url('#{$static}/img/icons/icon_contacts_red.png')
&:focus
outline: none
text-decoration: none
color: #0b0b0b
.list-contacts
padding-left: 0
list-style: none
li
margin-bottom: 10px
i
width: 50px

@ -13,6 +13,7 @@
{% block content %} {% block content %}
{% include 'partials/modals/mod-realty-edit.html' %} {% include 'partials/modals/mod-realty-edit.html' %}
{% include 'partials/modals/mod-customer-contacts.html' %}
<div class="container main-scope"> <div class="container main-scope">
<div class="row main-content"> <div class="row main-content">
<div class="col-lg-12"> <div class="col-lg-12">

@ -39,7 +39,7 @@
<table style="margin-top: 10px; margin-bottom: 10px"> <table style="margin-top: 10px; margin-bottom: 10px">
<tr> <tr>
<td style="min-width: 100px">На сайте:</td> <td style="min-width: 100px">На сайте:</td>
<td>{{ customer.created }}</td> <td>{{ on_site }}</td>
</tr> </tr>
<tr> <tr>
<td>Страна:</td> <td>Страна:</td>
@ -58,8 +58,16 @@
{% endif %} {% endif %}
</div> </div>
<div class="col-lg-7" style="border-bottom: 1px solid gainsboro; border-top: 1px solid gainsboro"> <div class="col-lg-7"
<table class="ratings" style="float: right; margin-top: 7px"> style="border-bottom: 1px solid gainsboro; border-top: 1px solid gainsboro; position: relative">
{% if request.user.is_authenticated %}
<a href="#" data-toggle="modal" data-target="#contact-customer-modal"
class="icon-contacts"
style="position: absolute;top: 20px;left: 5px;">
Показать контакты
</a>
{% endif %}
<table class="ratings" style="float: right; margin-top: 7px; border-left: 1px solid #dcdcdc">
<tr> <tr>
<td> <td>
<div class="icon-rating">Рейтинг:</div> <div class="icon-rating">Рейтинг:</div>

@ -0,0 +1,40 @@
<div id="contact-customer-modal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title">Контакты владельца </h4>
</div>
<div class="modal-body">
<div class="row" style="height: 180px;">
<div class="col-lg-8 col-lg-offset-1">
<ul class="list-contacts">
{% if customer.website %}
<li><i class="fa fa-globe" aria-hidden="true"></i>{{ customer.website }}</li>
{% endif %}
<li><i class="fa fa-envelope-o" aria-hidden="true"></i>{{ customer.email }}</li>
{% if customer.skype %}
<li><i class="fa fa-skype" aria-hidden="true"></i>{{ customer.skype }}</li>
{% endif %}
{% if customer.phone %}
<li><i class="fa fa-phone" aria-hidden="true"></i>{{ customer.phone }}</li>
{% endif %}
{% if customer.phone2 %}
<li><i class="fa fa-phone" aria-hidden="true"></i>{{ customer.phone2 }}</li>
{% endif %}
{% if customer.organization_name %}
<li><i class="fa fa-briefcase" aria-hidden="true"></i>{{ customer.organization_name }}</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>

@ -2,6 +2,7 @@ import itertools
import json import json
import re import re
from pprint import pformat from pprint import pformat
import datetime
from .signals import * from .signals import *
import natsort import natsort
@ -803,8 +804,19 @@ class CustomerProfileView(BaseMixin, DetailView):
context = super().get_context_data() context = super().get_context_data()
user_id = self.kwargs['pk'] user_id = self.kwargs['pk']
# profile-info # profile-info
user_created = self.model.objects.get(pk=user_id).created
now = datetime.datetime.now()
dt = now - user_created.replace(tzinfo=None)
# TODO: Реализация не учитывает разное кол-во дней в месяцах
if dt.days <= 30:
on_site = '{} {}'.format(dt.days, util.morph(dt.days, ["день", "дня", "дней"]))
else:
months = math.floor(dt.days / 30)
on_site = '{} {}'.format(months, util.morph(months, ["месяц", "месяца", "месяцев"]))
context.update( context.update(
{ {
'on_site': on_site,
'ratings': self.model.objects.get(pk=user_id).rating, 'ratings': self.model.objects.get(pk=user_id).rating,
'deals': Order.objects.filter(secure=True, contractor_id=user_id, status=1).count(), 'deals': Order.objects.filter(secure=True, contractor_id=user_id, status=1).count(),
'reviews_n': Review.objects.filter(target_contractor_id=user_id, type='neutral').count(), 'reviews_n': Review.objects.filter(target_contractor_id=user_id, type='neutral').count(),

Loading…
Cancel
Save