From facb3cf7441a9d6fc767dfd5a60da56bd71f2079 Mon Sep 17 00:00:00 2001 From: shishman Date: Fri, 26 Aug 2016 20:59:34 +0300 Subject: [PATCH 1/5] css edited --- assets/css/main.css | 46 ++++++++++++++++++++++++-- projects/templates/project_detail.html | 4 +-- users/templates/contractor_filter.html | 2 +- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index 23624e2..a422213 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -5524,7 +5524,7 @@ input[type="radio"]:checked + span { width: 216px; } .proj_answ_form .textAreaBlock2 input[name="term"]{ - width: 262px; + width: 258px; } .proj_answ_form .textAreaBlock2 p span{ position: absolute; @@ -5759,7 +5759,7 @@ input[type="radio"]:checked + span { margin-bottom: 0 !important } .infoProfile .dropdown-menu{ - height: 316px; + height: auto; } .form-regestration{ padding: 20px 0 40px 0; @@ -5819,4 +5819,46 @@ input[type="radio"]:checked + span { text-transform: initial; letter-spacing: normal; } +.fr_answer{ + width: 100%; + height: 110px; + border: 1px solid #cdcdcd; + resize: none; + padding: 10px 15px; + color: #3c1a06; + font-family: 'Arial-MT-Regular', sans-serif; + font-size: 14px; + float: left; + margin: 0px 0px 0px 55px; +} +.fr_answer_sen{ + float: left; + border-radius: 40px; + font-family: 'pfdintextcomppro-regular', sans-serif; + letter-spacing: 2px; + color: #373737; + margin: 20px 0 0 55px; + font-size: 15px; + border: 1px solid #BEBEBE; + padding: 17px 46px; + text-transform: uppercase; +} +.fa-pencil:before, .fa-times:before{ + color: #fff; +} +.mainMenu li.active > a { + border-color: #ff0029; +} +.mainMenu li.icon_tm1.active span{ + background: url('../img/listMain2.png') no-repeat !important; +} +.mainMenu li.officeList.active span { + background: url('../img/list4tml.png') no-repeat center !important; +} +.mainMenu li.icon_tm2.active span{ + background: url('../img/listMain2.png') no-repeat center !important; +} +.mainMenu li.icon_tm3.active span{ + background: url('../img/listMain2.png') no-repeat right !important; +} /*end_new*/ \ No newline at end of file diff --git a/projects/templates/project_detail.html b/projects/templates/project_detail.html index 6141576..5add600 100644 --- a/projects/templates/project_detail.html +++ b/projects/templates/project_detail.html @@ -313,8 +313,8 @@ {% csrf_token %} -
-
+
+
diff --git a/users/templates/contractor_filter.html b/users/templates/contractor_filter.html index 9bf6121..98bad17 100644 --- a/users/templates/contractor_filter.html +++ b/users/templates/contractor_filter.html @@ -42,7 +42,7 @@ -
+
найти исполнителя From 7107c55f66b3f70a7f9664ed7ab82bd3ca38d58e Mon Sep 17 00:00:00 2001 From: PekopT Date: Fri, 26 Aug 2016 21:18:30 +0300 Subject: [PATCH 2/5] various --- projects/models.py | 2 +- users/templates/contractor_profile.html | 8 ++++++-- work_sell/models.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/models.py b/projects/models.py index cfedcda..a4cebcd 100644 --- a/projects/models.py +++ b/projects/models.py @@ -287,7 +287,7 @@ class Portfolio(models.Model): budget = models.DecimalField(max_digits=10, decimal_places=0, default=0, null=True, blank=True) building_classification = models.ForeignKey(BuildingClassfication, related_name='portfolios', null=True, blank=True) construction_type = models.ForeignKey(ConstructionType, related_name='portfolios', null=True, blank=True) - created = models.DateTimeField(default=timezone.now, auto_now_add=True, auto_created=True) + created = models.DateTimeField(auto_now_add=True, auto_created=True) currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES, null=True, blank=True) description = models.TextField() location = TreeForeignKey('common.Location', related_name='portfolios', null=True, blank=True) diff --git a/users/templates/contractor_profile.html b/users/templates/contractor_profile.html index 89b546f..faa9a36 100644 --- a/users/templates/contractor_profile.html +++ b/users/templates/contractor_profile.html @@ -383,7 +383,9 @@ {% thumbnail diplom.img "210x334" crop="center" as im %} {% endthumbnail %}
@@ -414,7 +416,9 @@ {% thumbnail cro.img "210x334" crop="center" as im %}
-
+ +
+
{% endthumbnail %}
diff --git a/work_sell/models.py b/work_sell/models.py index b9f7d22..94f0ddc 100644 --- a/work_sell/models.py +++ b/work_sell/models.py @@ -17,7 +17,7 @@ class WorkSell(models.Model): building_classification = models.ForeignKey(BuildingClassfication, related_name='worksells', null=True, blank=True) construction_type = models.ForeignKey(ConstructionType, related_name='worksells', null=True, blank=True) contractor = models.ForeignKey(User, related_name='work_sell', null=True, blank=True) # TODO: Pluralize related name - created = models.DateTimeField(default=timezone.now, auto_now_add=True) + created = models.DateTimeField(auto_now_add=True) currency = models.CharField(max_length=20, default='rur', choices=CURRENCIES, null=True, blank=True) description = models.TextField(blank=True) location = TreeForeignKey('common.Location', related_name='worksells', null=True, blank=True) From bfb646ac0086a68bf15d4cf9e6e36a8a62d4dd64 Mon Sep 17 00:00:00 2001 From: shishman Date: Fri, 26 Aug 2016 21:59:05 +0300 Subject: [PATCH 3/5] css edited --- assets/css/main.css | 41 +++++++++++++++++++++++++++++ templates/cms_pages/cms_page.html | 36 ++++++++++++++++++------- wallets/templates/score-detail.html | 2 +- 3 files changed, 69 insertions(+), 10 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index a422213..3ed09cb 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -5861,4 +5861,45 @@ input[type="radio"]:checked + span { .mainMenu li.icon_tm3.active span{ background: url('../img/listMain2.png') no-repeat right !important; } +.faq_page_inn{ + padding: 40px 0; +} +.faq_page_inn h2 { + font-size: 32px; + font-weight: normal; + margin-bottom: 20px; + margin-top: 10px; +} +.faq_page_inn h3{ + font-weight: 600; + margin-bottom: 12px; + margin-top: 28px; + font-size: 1.17em; +} +.faq_page_inn ol, .faq_page_inn ul{ + padding-left: 40px; + margin-top: 20px; +} +.faq_page_inn ol li, .faq_page_inn ul li{ + padding-left: 8px; + list-style: inherit !important; + display: list-item; + list-style-type:inherit !important; + margin-top: 5px; +} +.faq_page_inn a{ + text-decoration: underline !important; +} +.faq_page_inn a:hover{ + text-decoration: none !important; +} +.faq_page_inn div{ + margin-top: 20px; +} +a.linkS2[data-target="#withdraw-money"]{ + float: none; + display: table; + margin: auto; + margin-bottom: 52px; +} /*end_new*/ \ No newline at end of file diff --git a/templates/cms_pages/cms_page.html b/templates/cms_pages/cms_page.html index a480c11..2a09343 100644 --- a/templates/cms_pages/cms_page.html +++ b/templates/cms_pages/cms_page.html @@ -9,14 +9,32 @@
+
+
+ {% for block in page.body %} + {% if block.block_type == 'heading' %} +

{{ block.value }}

+ {% else %} +
+ {{ block }} +

FAQ

+

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has

+

is simply dummy text of the printing and typesetting industry

+
    +
  1. Many desktop publishing packages and web page editors now use Lorem Ipsum
  2. +
  3. Many desktop publishing packages and web page editors now use Lorem Ipsum
  4. +
  5. Many desktop publishing packages and web page editors now use Lorem Ipsum
  6. +
+
    +
  • Many desktop publishing packages and web page editors now use Lorem Ipsum
  • +
  • Many desktop publishing packages and web page editors now use Lorem Ipsum.
  • +
  • Many desktop publishing packages and web page editors now use Lorem Ipsum
  • +
+
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum
+
+ {% endif %} + {% endfor %} +
+
- {% for block in page.body %} - {% if block.block_type == 'heading' %} -

{{ block.value }}

- {% else %} -
- {{ block }} -
- {% endif %} - {% endfor %} {% endblock %} \ No newline at end of file diff --git a/wallets/templates/score-detail.html b/wallets/templates/score-detail.html index 275e727..9e72082 100644 --- a/wallets/templates/score-detail.html +++ b/wallets/templates/score-detail.html @@ -22,7 +22,7 @@ {% endif %} -
+ From 10032e036aa72918b4211746b7777a49bfd2bbd3 Mon Sep 17 00:00:00 2001 From: PekopT Date: Mon, 29 Aug 2016 11:28:31 +0300 Subject: [PATCH 4/5] various --- templates/partials/header.html | 3 +++ users/templates/user_financial_info_edit.html | 11 +++++++---- users/views.py | 17 ++++++++--------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/templates/partials/header.html b/templates/partials/header.html index 248cd94..99be311 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -89,18 +89,21 @@
- +
@@ -165,7 +165,7 @@
- +
@@ -207,8 +207,11 @@
- {{ fin_info_form.passport_scan.value }} - + {% if fin_info_form.passport_scan.value %} +{# {{ fin_info_form.passport_scan.value }}#} + Скан-копия загружена + {% endif %} +

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

diff --git a/users/views.py b/users/views.py index 4b50b4b..eba8e72 100644 --- a/users/views.py +++ b/users/views.py @@ -188,8 +188,6 @@ class ContractorFilterView(BaseMixin, View): context.update({'last_party_types': last_party_types}) - - if get_contractors: contractors = User.contractor_objects.all() @@ -216,9 +214,7 @@ class ContractorFilterView(BaseMixin, View): if constr_type: contractors = contractors.filter(orders__project__realty__construction_type=constr_type) - - - + if get_teams: teams = Team.objects.all() @@ -278,7 +274,6 @@ class ContractorFilterView(BaseMixin, View): count = coll.count() display_msg = 'Найдено %s групп' % count if count > 0 else 'Ничего не найдено' - order_by = form.cleaned_data.get('order_by') last_order_by = form.cleaned_data.get('last_order_by') reverse_order = form.cleaned_data.get('reverse_order') @@ -421,9 +416,13 @@ class ContractorOfficeProjectsView(BaseMixin, View): private_open_projects = tuple(a.project for a in contractor.contractor_answers.filter(project__state='active', rejected=False)) private_archived_projects = tuple(a.project for a in contractor.contractor_answers.filter(project__state='active', rejected=True)) - - team_open_projects = tuple(a.project for a in contractor.team.answers.filter(project__state='active', rejected=False)) - team_archived_projects = tuple(a.project for a in contractor.team.answers.filter(project__state='active', rejected=True)) + + try: + team_open_projects = tuple(a.project for a in contractor.team.answers.filter(project__state='active', rejected=False)) + team_archived_projects = tuple(a.project for a in contractor.team.answers.filter(project__state='active', rejected=True)) + except: + team_open_projects = () + team_archived_projects = () context['all_project_count'] = \ len(private_open_projects) + len(private_archived_projects) + \ From c52d296305a0ca6b25c93ce42996694172cab0a2 Mon Sep 17 00:00:00 2001 From: Mukhtar Date: Mon, 29 Aug 2016 11:30:15 +0300 Subject: [PATCH 5/5] #ARC-18 Fix upload documents for customer --- api/views.py | 11 ++++ assets/js/chat.js | 66 +++++++++++++++++----- chat/migrations/0008_documents_created.py | 21 +++++++ chat/migrations/0009_auto_20160829_1120.py | 20 +++++++ chat/models.py | 1 + chat/serializers.py | 2 + chat/templates/chat_customer.html | 60 +++++++++++++++----- chat/views.py | 1 - 8 files changed, 155 insertions(+), 27 deletions(-) create mode 100644 chat/migrations/0008_documents_created.py create mode 100644 chat/migrations/0009_auto_20160829_1120.py diff --git a/api/views.py b/api/views.py index a998e92..4ebd8d6 100755 --- a/api/views.py +++ b/api/views.py @@ -64,6 +64,17 @@ class DocumentViewSet(ModelViewSet): # filter_class = DocumentsFilterSet # permission_classes = (permissions.IsAuthenticatedOrReadOnly,) + def get_queryset(self): + queryset = Documents.objects.all() + search_param = self.request.query_params.get('operand', None) + recipent_id = self.request.query_params.get('recipent_id', None) + sender_id = self.request.query_params.get('sender_id', None) + if search_param: + # import code; code.interact(local=dict(globals(), **locals())) + if search_param == 'in': + queryset = queryset.filter(Q(sender__in=[sender_id,recipent_id]),Q(recipent__in=[sender_id,recipent_id])).order_by('created') + return queryset + class ProjectViewSet(ModelViewSet): queryset = Project.objects.all() diff --git a/assets/js/chat.js b/assets/js/chat.js index 123ec42..047012e 100644 --- a/assets/js/chat.js +++ b/assets/js/chat.js @@ -101,12 +101,9 @@ function csrfSafeMethod(method) { var socket = new SocketHandler(); var csrftoken = getCookie('csrftoken'); $(function () { - - var currentHash = URI(location.href).hash(); - console.log(currentHash); - if (currentHash.indexOf("#order") == 0) { + if (currentHash.indexOf("#order") == 0) { var ordHashId = currentHash.replace("#order", ""); setTimeout(function () { $("#orderBlock" + ordHashId).trigger('click'); @@ -177,7 +174,6 @@ $(function () { }); }); - // Добавление сообщения для заказа. $('#order-chat-add-message').on('click', function (e) { e.preventDefault(); @@ -255,18 +251,17 @@ $(function () { }); }); - - - + $("#upload-document-order").bind('fileuploadsubmit', function(e, data){ + data.formData = { + sender: $("#chat-order-add #senderId").val(), + recipent: $("#chat-order-add #recipentId").val(), + order: $("#chat-order-add #orderId").val(), + } + }); //Загрузка документов $('#upload-document-order').fileupload({ url: '/chat/create/', - formData: { - sender: $("#chat-order-add #senderId").val(), - recipent: $("#chat-order-add #recipentId").val(), - order: $("#chat-order-add #orderId").val(), - }, crossDomain: false, beforeSend: function (xhr, settings) { $('#progress .progress-bar').css( @@ -297,6 +292,51 @@ $(function () { progress + '%' ); } + }).prop('disabled', !$.support.fileInput) + .parent().addClass($.support.fileInput ? undefined : 'disabled'); //Загрузка документов + + + + $("#upload-document-contact").bind('fileuploadsubmit', function(e, data){ + data.formData = { + sender: $("#contact-chat-form #senderContactId").val(), + recipent: $("#contact-chat-form #recipentContactId").val(), + } + + }); + + + + $('#upload-document-contact').fileupload({ + url: '/chat/create/', + crossDomain: false, + beforeSend: function (xhr, settings) { + console.log(this.formData); + $('#progress .progress-bar').css( + 'width', + '0%' + ); + if (!csrfSafeMethod(settings.type)) { + xhr.setRequestHeader("X-CSRFToken", csrftoken); + } + }, + dataType: 'json', + done: function (e, data) { + $.each(data.result.files, function (index, file) { + var htmlImg = '

' + file.name + '

'; + var document_send = $(htmlImg).appendTo("#document-send-contact"); + }); + }, + fail: function (e) { + console.log(e); + }, + progressall: function (e, data) { + var progress = parseInt(data.loaded / data.total * 100, 10); + $('#progress .progress-bar').css( + 'width', + progress + '%' + ); + } }).prop('disabled', !$.support.fileInput) .parent().addClass($.support.fileInput ? undefined : 'disabled'); diff --git a/chat/migrations/0008_documents_created.py b/chat/migrations/0008_documents_created.py new file mode 100644 index 0000000..e939141 --- /dev/null +++ b/chat/migrations/0008_documents_created.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-29 01:00 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('chat', '0007_auto_20160826_1458'), + ] + + operations = [ + migrations.AddField( + model_name='documents', + name='created', + field=models.DateTimeField(default=django.utils.timezone.now), + ), + ] diff --git a/chat/migrations/0009_auto_20160829_1120.py b/chat/migrations/0009_auto_20160829_1120.py new file mode 100644 index 0000000..f21eb4f --- /dev/null +++ b/chat/migrations/0009_auto_20160829_1120.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-08-29 08:20 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('chat', '0008_documents_created'), + ] + + operations = [ + migrations.AlterField( + model_name='documents', + name='created', + field=models.DateTimeField(auto_now_add=True), + ), + ] diff --git a/chat/models.py b/chat/models.py index dd7f79a..5cc9468 100644 --- a/chat/models.py +++ b/chat/models.py @@ -45,6 +45,7 @@ class Documents(models.Model): team = models.ForeignKey(Team, related_name='documents', null=True, blank=True) sender = models.ForeignKey(User, related_name='sender_documents') recipent = models.ForeignKey(User, related_name='recipent_documents', null=True, blank=True) + created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.file.url diff --git a/chat/serializers.py b/chat/serializers.py index e4d8467..6cb8c06 100644 --- a/chat/serializers.py +++ b/chat/serializers.py @@ -4,6 +4,7 @@ from rest_framework.serializers import ModelSerializer from .models import Message, Notes, Documents from users.serializers import UserSerializer + class DocumentsSerializer(ModelSerializer): class Meta: @@ -18,6 +19,7 @@ class DocumentsSerializer(ModelSerializer): ) + class MessageSerializer(ModelSerializer): sender = UserSerializer() recipent = UserSerializer() diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html index e4c6818..25c510c 100644 --- a/chat/templates/chat_customer.html +++ b/chat/templates/chat_customer.html @@ -65,25 +65,32 @@
- - + + +
-
-

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

- - Не более 10 файлов с общим объемом 500мб - +
+ +

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

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

Входящие документы

+
    +
+{# #} +{# Распечатать с помощью ресурса#} +{# #} +
@@ -619,7 +626,7 @@ // Вытащить сообщения для конактов $('.user-block').on('click', function () { var userId = $(this).attr('data-id'); - $("#contact-chat-form #recipentId").val(userId); + $("#contact-chat-form #recipentContactId").val(userId); $("#add-form-contractor-note #recipentNoteContractor").val(userId); $('.user-block').each(function () { @@ -628,7 +635,33 @@ $(this).addClass('mesAct'); var inbox = document.getElementById('message-chat-space'); + var docList = document.getElementById('documentSpace'); inbox.innerHTML = ''; + docList.innerHTML = ''; + + $.ajax({ + url:'/api/documents', + type: 'GET', + data:{ + csrfmiddlewaretoken: csrftoken, + 'operand': 'in', + 'sender_id': currentChatUser, + 'recipent_id': userId + }, + dataType: 'json', + + success: function (json){ + console.log(json); + + $.each(json.results, function (i, v) { + docList.innerHTML += '
  • '+ v.file+'
  • '; + }); + }, + error: function(e){ + console.log(e); + } + }); + $.ajax({ url: '/api/message', type: 'GET', @@ -659,8 +692,8 @@ $('#contact-chat-add-message').on('click', function (e) { e.preventDefault(); var chatMessage = $("#chat").val(); - var recipentId = $("#recipentId").val(); - var senderId = $("#senderId").val(); + var recipentId = $("#recipentContactId").val(); + var senderId = $("#senderContactId").val(); socket.add_contact_message({ "format_type": "add_message_contact", @@ -672,6 +705,7 @@ }); $("#chat").val(""); + $("#document-send-contact").html(""); }); diff --git a/chat/views.py b/chat/views.py index 9d5c090..dedf1be 100644 --- a/chat/views.py +++ b/chat/views.py @@ -19,7 +19,6 @@ class DocumentCreateView(CreateView): fields = '__all__' def form_valid(self, form): - # import code; code.interact(local=dict(globals(), **locals())) self.object = form.save() files = [serialize(self.object)] data = {'files': files}