diff --git a/assets/js/chat.js b/assets/js/chat.js
index fb25bba..5648c1b 100644
--- a/assets/js/chat.js
+++ b/assets/js/chat.js
@@ -1,6 +1,6 @@
var SocketHandler = function () {
domain = domain.replace(':' + port, '');
- var url = 'ws://' + domain + ':8888/chat/' + userId + '/';
+ var url = 'ws://' + domain + '/chat/' + userId + '/';
var sock = new WebSocket(url);
var intervalId;
sock.onopen = function () {
@@ -129,6 +129,20 @@ $(function () {
}
+
+ $(".full-order-info").click('on',function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ $("#order-info").modal('show');
+ });
+
+ $(".conMess").click('on',function(e){
+ e.preventDefault();
+ e.stopPropagation();
+ $("#contact-info").modal('show');
+ });
+
+
// Вытащить сообщения для конактов
$('.user-block').on('click', function () {
diff --git a/chat/templates/chat_contractor.html b/chat/templates/chat_contractor.html
index 40a4af6..88a4f5f 100644
--- a/chat/templates/chat_contractor.html
+++ b/chat/templates/chat_contractor.html
@@ -108,6 +108,10 @@
сохранить
+
+
+ {% include 'contact-info.html' %}
+
@@ -125,7 +129,7 @@
Исполнитель: {{ request.user.get_full_name }}
-
+
Полное описание заказа
@@ -201,6 +205,10 @@
{% include 'arbitration_modal.html' %}
+
+ {% include 'order_info.html' %}
+
+
@@ -253,7 +261,7 @@
{% endif %}
{% endfor %}
-
+
Полное описание заказа
diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html
index 988b678..aea0348 100644
--- a/chat/templates/chat_customer.html
+++ b/chat/templates/chat_customer.html
@@ -49,8 +49,7 @@
- Контакты
+ Контакты
0
@@ -103,6 +102,10 @@
+
+
+ {% include 'contact-info.html' %}
+
@@ -130,7 +133,7 @@
{{ order.order.team.name }}
{% endif %}
-
+
Полное описание заказа
@@ -223,6 +226,11 @@
{% include 'arbitration_modal.html' %}
+
+ {% include 'order_info.html' %}
+
+
+
@@ -249,6 +257,7 @@
$('body').on('focus',".term-picker", function(){
$(this).datepicker({
{# minDate: 0,#}
+
});
})
@@ -696,8 +705,6 @@
getStages(orderId,userId,recipentId, secureOrder);
});
-
-
});
var userId = '{{ request.user.pk }}';
diff --git a/chat/templates/contact-info.html b/chat/templates/contact-info.html
new file mode 100644
index 0000000..f82392c
--- /dev/null
+++ b/chat/templates/contact-info.html
@@ -0,0 +1,22 @@
+
diff --git a/chat/templates/order_info.html b/chat/templates/order_info.html
new file mode 100644
index 0000000..1017f84
--- /dev/null
+++ b/chat/templates/order_info.html
@@ -0,0 +1,34 @@
+
diff --git a/projects/serializers.py b/projects/serializers.py
index 123231b..183309b 100755
--- a/projects/serializers.py
+++ b/projects/serializers.py
@@ -48,7 +48,7 @@ class RealtySerializer(ModelSerializer):
class StageSerializer(ModelSerializer):
- # term = serializers.DateTimeField(format="%Y-%m-%d")
+ term = serializers.DateField(format="%d.%m.%Y", input_formats=['%d.%m.%Y',])
class Meta:
model = Stage
diff --git a/users/models.py b/users/models.py
index d693aa0..ee8ebd4 100644
--- a/users/models.py
+++ b/users/models.py
@@ -2,6 +2,7 @@ from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, AbstractUser, Group, PermissionsMixin
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
+from django.db.models import Sum
from django.utils import timezone, formats
from mptt.models import TreeForeignKey, TreeManyToManyField
from pprint import pprint
@@ -12,6 +13,7 @@ from archilance import util
from specializations.models import Specialization
+
GENDERS = (
('male', 'Мужской'),
('female', 'Женский'),
@@ -173,6 +175,12 @@ class User(AbstractBaseUser, PermissionsMixin):
def get_profile_image(self):
return self.avatar
+ def get_score(self):
+ from wallets.models import InvoiceHistory
+ current_sum_info = InvoiceHistory.objects.filter(user=self, type="score").aggregate(Sum('sum'))
+ current_sum = current_sum_info['sum__sum'] or 0
+ return current_sum
+
def summary(self):
if self.date_of_birth:
years = relativedelta(timezone.now(), util.to_local_datetime(self.date_of_birth)).years
diff --git a/wallets/admin.py b/wallets/admin.py
index e95a6f5..2fd0bf9 100644
--- a/wallets/admin.py
+++ b/wallets/admin.py
@@ -9,15 +9,12 @@ class InvoiceHistoryAdmin(admin.ModelAdmin):
list_display = ('comment', 'sum', 'user','balance',)
-# class WithDrawAdmin(admin.ModelAdmin):
-# list_display = ('sum','created','user',)
-
-class WithDrawResource(resources.ModelResource):
-
- class Meta:
- model = WithDraw
- export_order = ('id', 'sum', 'yandex_card', 'user')
+# class WithDrawResource(resources.ModelResource):
+#
+# class Meta:
+# model = WithDraw
+# export_order = ('id', 'sum', 'yandex_card', 'user')
class WithDrawAdmin(ImportExportModelAdmin):
diff --git a/wallets/models.py b/wallets/models.py
index 1f49eb8..e97ead3 100644
--- a/wallets/models.py
+++ b/wallets/models.py
@@ -54,7 +54,7 @@ class InvoiceHistory(models.Model):
class WithDraw(models.Model):
- sum = models.DecimalField(max_digits=10, decimal_places=0)
+ sum = models.DecimalField(max_digits=10, decimal_places=0, validators=[MinValueValidator(1)])
created = models.DateTimeField(default=timezone.now)
yandex_card = models.CharField(max_length=30)
user = models.ForeignKey(User, related_name='with_draw')
@@ -66,8 +66,10 @@ class WithDraw(models.Model):
def clean(self):
if not self.pk:
current_score_info = InvoiceHistory.objects.filter(user=self.user, type="score").aggregate(Sum('sum'))
- # withdraw_sum_not_complete = WithDraw.objects.filter(user=self.user,complete=False).aggregate(Sum('sum'))
+ withdraw_sum_not_complete = WithDraw.objects.filter(user=self.user, complete=False).aggregate(Sum('sum'))
current_score = current_score_info['sum__sum'] or 0
+ sum_not_complete = withdraw_sum_not_complete['sum__sum'] or 0
+ current_score -= sum_not_complete
if not self.sum is None and self.sum > current_score:
raise ValidationError("Сумма должна быть меньше " + str(current_score))