Resolve merge conflicts

remotes/origin/PR-39
ArturBaybulatov 9 years ago
commit eedc83690f
  1. 6
      api/views.py
  2. 113
      assets/css/main.css
  3. 18
      assets/js/chat.js
  4. 3
      assets/js/chat_contractor.js
  5. 1
      chat/chat.py
  6. 6
      chat/templates/chat_contractor.html
  7. 3
      chat/templates/chat_customer.html
  8. 8
      chat/views.py
  9. 8
      users/templates/contractor_filter.html
  10. 4
      users/templates/contractor_office.html
  11. 55
      users/templates/contractor_profile.html
  12. 3
      users/templatetags/user_tags.py

@ -1,5 +1,5 @@
from django.conf import settings
from django.db.models import Q
from django.db.models import Q, F
from rest_framework import permissions
from rest_framework.pagination import PageNumberPagination
from rest_framework.viewsets import ModelViewSet
@ -124,7 +124,9 @@ class MessageViewSet(ModelViewSet):
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])).filter(order__isnull=True).order_by('created')
queryset = queryset.filter(Q(sender__in=[sender_id,recipent_id]),Q(recipent__in=[sender_id,recipent_id])).\
filter(order__isnull=True).\
filter(~Q(sender=F('recipent'))).order_by('created')
return queryset

@ -213,14 +213,14 @@ ul li {
}
.changeBlock1 {
float: left;
margin-left: -15px;
float: right;
margin-right: -15px;
background-color: rgba(0,0,0,0.7);
}
.changeBlock2 {
float: right;
margin-right: -15px;
float: left;
margin-left: -15px;
background-color: rgba(255,0,6,0.7);
}
@ -825,7 +825,6 @@ footer:after {
.projectPro:hover {
transform: scale(1.02);
box-shadow: 0 0 10px rgba(0,0,0,0.7);
cursor: pointer;
}
.projectPro:hover .titlePro {
@ -1064,7 +1063,7 @@ footer:after {
}
.pagin nav ul li a {
background-color:unset;
background-color: none;
color: black;
font-size: 20px;
line-height: 50px;
@ -1090,6 +1089,7 @@ footer:after {
.pagin nav ul li a:hover,
.pagin nav ul li a:active {
color: black;
color: white;
background-color: #2c2c2c;
border-color: #2c2c2c;
@ -1271,7 +1271,7 @@ footer:after {
.valul .btn {
font-size: 20px !important;
padding: 11px 46px 11px 15px !important;
padding: 11px 28px 11px 15px !important;
}
.valul .btn span {
@ -2032,9 +2032,9 @@ input[type="checkbox"]:checked + span {
float: right;
}
.galleryWork2 .col-lg-4:hover {
/*.galleryWork2 .col-lg-4:hover {
cursor: pointer;
}
}*/
.linkElse {
text-align: center;
@ -2492,7 +2492,7 @@ input[type="checkbox"]:checked + span {
}
.exButton .btn-group .btn span {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-family: Arial. Verdana, Helvetica, sans-serif;
font-weight: bold;
}
@ -2946,18 +2946,18 @@ input[type="checkbox"]:checked + span {
background-position: 0 0;
}
.compTable tr td:nth-child(6) ul li:nth-child(2):before {
height: 20px;
.compTable tr td:nth-child(6) ul li:last-child:before {
height: 21px;
background: url('../img/listTable.png') no-repeat center;
background-size: cover;
background-position: 0 -17px;
background-position: 0 -39px;
}
.compTable tr td:nth-child(6) ul li:last-child:before {
height: 21px;
.compTable tr td:nth-child(6) ul li:nth-child(2):before {
height: 20px;
background: url('../img/listTable.png') no-repeat center;
background-size: cover;
background-position: 0 -39px;
background-position: 0 -17px;
}
.compTable tr td:nth-child(7) {
@ -3479,7 +3479,6 @@ input[type="checkbox"]:checked + span {
padding: 15px 0;
margin-bottom: -1px;
position: relative;
cursor: pointer;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
transition: all 0.3s ease-out
@ -3778,7 +3777,7 @@ input[type="checkbox"]:checked + span {
border-top: 1px solid black;
border-bottom: 1px solid black;
-webkit-transform: scale(1.03);
-moz-transform: scale(1.03);
-moz- transform: scale(1.03);
transform: scale(1.03);
box-shadow: 0 0 10px rgba(0,0,0,0.7);
z-index: 999;
@ -3855,7 +3854,7 @@ input[type="checkbox"]:checked + span {
border-top: 1px solid black;
border-bottom: 1px solid black;
-webkit-transform: scale(1.03);
-moz-transform: scale(1.03);
-moz- transform: scale(1.03);
transform: scale(1.03);
box-shadow: 0 0 10px rgba(0,0,0,0.7);
z-index: 999;
@ -3943,7 +3942,6 @@ input[type="checkbox"]:checked + span {
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
padding: 15px;
cursor: pointer;
margin-bottom: -15px;
background-color: white;
position: relative;
@ -3952,7 +3950,7 @@ input[type="checkbox"]:checked + span {
transition: all 0.3s ease-out;
}
.numberStepp:hover {
/*.numberStepp:hover {
z-index: 999;
border-top-color: black;
border-bottom-color: black;
@ -3960,11 +3958,11 @@ input[type="checkbox"]:checked + span {
-moz-transform: scale(1.02);
transform: scale(1.02);
box-shadow: 0 0 10px rgba(0,0,0,0.7);
}
}*/
.numberStepp:hover .insetNumStepp {
/*.numberStepp:hover .insetNumStepp {
border-color: white;
}
}*/
.insetNumStepp {
width: 100%;
@ -4154,6 +4152,18 @@ input[type="checkbox"]:checked + span {
background-size: cover;
background-position: 0 -95px;
}
.infoProfile .dropdown-menu .icon_mm7 a span {
height: 20px;
background: url('../img/menu.png') no-repeat center;
background-size: cover;
background-position: 0 0px;
}
.infoProfile .dropdown-menu .icon_mm8 a span {
height: 20px;
background: url('../img/user-5.png') no-repeat center;
background-size: contain;
background-position: 0 0px;
}
.infoProfile .dropdown-menu .icon_mm1 a:hover span {
height: 20px;
@ -4196,6 +4206,18 @@ input[type="checkbox"]:checked + span {
background-size: cover;
background-position: 0 -95px
}
.infoProfile .dropdown-menu .icon_mm7 a:hover span {
height: 20px;
background: url('../img/menu2.png') no-repeat center;
background-size: cover;
background-position: 0 0px
}
.infoProfile .dropdown-menu .icon_mm8 a:hover span {
height: 20px;
background: url('../img/user-4.png') no-repeat center;
background-size: contain;
background-position: 0 0px;
}
/* CHAT'S MODAL FORMS */
@ -5050,7 +5072,6 @@ input[type="radio"]:checked + span {
.pluss-block {
width: 100%;
float: left;
margin: 24px 0 0 0;
}
.pluss {
@ -5345,7 +5366,7 @@ input[type="radio"]:checked + span {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
font-weight: bold;
margin: 0 0 -15px 0;
margin: 0px 0 -15 0;
}
.inp-edit {
@ -5965,4 +5986,42 @@ a.linkS2[data-target="#withdraw-money"]{
input[type="radio"]{
opacity: 0;
}
/*end_new*/
.wr-inset-pluss{
margin-top: 24px;
}
.inset-gp .upload2{
float: left;
margin: -15px 15px 0 12px;
}
#jGrowl .jGrowl-notification{
background-color: #fff !important;
color: #000 !important;
opacity: 1 !important;
}
.titleScore{
line-height: 36px;
padding: 0 100px;
}
.welcomeMain{
line-height: 48px;
}
.menuUser > div{
padding: 10px 0;
display: table;
margin: auto;
}
.menuUser ul:nth-child(3) li a{
padding: 16px 0px 16px 0px !important;
text-align: center;
}
.addWork, .upload2, .documentsChat a{
transition: all 0.3s;
}
.changeBlock1 > a:hover, .changeBlock2 > a:hover, .addWork:hover,
.upload2:hover, .documentsChat a:hover{
box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
-webkit-transform: scale(1.04);
-moz-transform: scale(1.04);
transform: scale(1.04);
}
/*end_new*/

@ -100,14 +100,29 @@ $(function () {
$("#orderBlock" + ordHashId).trigger('click');
$("a[href='#tab2']").trigger('click');
}, 100);
} else if (currentHash.indexOf("#team") == 0) {
} else if(currentHash.indexOf("#user") == 0){
var userHashId = currentHash.replace("#user", "");
setTimeout(function () {
$("#userBlock" + userHashId).trigger('click');
//$("a[href='#tab1']").trigger('click');
}, 100);
} else if (currentHash.indexOf("#teamorder") == 0) {
var teamHashId = currentHash.replace("#teamorder", "");
$("#teamOrderBlock" + teamHashId).trigger('click');
$("a[href='#tab3']").trigger('click');
} else if (currentHash.indexOf("#myteam") == 0){
var teamHashId = currentHash.replace("#myteam", "");
$("#teamMyBlock" + teamHashId).trigger('click');
$("a[href='#tab3']").trigger('click');
} else {
setTimeout(function () {
$(".user-block").first().trigger('click');
location.hash = '';
}, 10);
setTimeout(function () {
$(".order-block").first().trigger('click');
location.hash = '';
}, 500);
}
// Информация о заказе
@ -231,6 +246,7 @@ $(function () {
// Вытащить сообщения для конактов
$('.user-block').on('click', function () {
var contactId = $(this).attr('data-id');
location.hash = '#user' + contactId;
$("#contact-chat-form #recipentContactId").val(contactId);
$("#add-form-contractor-note #recipentNoteContractor").val(contactId);

@ -142,6 +142,7 @@ $(function () {
$(this).addClass('orAct');
var teamId = $(this).attr('data-team-id');
location.hash = '#teamorder' + teamId;
var orderId = $(this).attr('data-order-id');
$("#team-chat-form #teamId").val(teamId);
$("#team-chat-form #orderTeamId").val(orderId);
@ -229,6 +230,7 @@ $(function () {
docList.innerHTML = '';
var teamId = $(this).attr('data-team-id');
location.hash = '#myteam' + teamId;
$("#team-chat-form #teamId").val(teamId);
$("#add-form-team-note #teamNote").val(teamId);
$("#team-chat-form #orderTeamId").val("");
@ -301,6 +303,7 @@ $(function () {
});
$(this).addClass('orAct');
var orderId = $(this).attr('data-id');
location.hash = '#order' + orderId;
var recipentId = $(this).attr('data-recipent-id');
var projectId = $(this).attr('data-project-id');

@ -54,6 +54,7 @@ class ChatHandler(websocket.WebSocketHandler):
@gen.coroutine
def add_message(self, message_data):
sender_id = message_data['data']['sender_id']
recipent_id = message_data['data']['recipent_id']
order_id = message_data['data'].get('order_id', None)

@ -39,7 +39,7 @@
<div class="messageBlock box-sizing disTab">
<p>Контакты</p>
{% for contact in contacts_users %}
<div class="message messd user-block" data-id="{{ contact.pk }}">
<div class="message messd user-block" id="userBlock{{ contact.pk }}" data-id="{{ contact.pk }}">
<div class="imgMess">
{% thumbnail contact.avatar "60x60" crop="center" as im %}
<img src="{{ im.url }}" alt="mess-image">
@ -235,7 +235,7 @@
<div class="messageBlock box-sizing disTab">
<p>Заказы</p>
{% for torder in team_orders %}
<div class="team-order-block orderBlock box-sizing"
<div class="team-order-block orderBlock box-sizing" id="teamOrderBlock{{ torder.pk }}"
data-team-id="{{ torder.team.pk }}" data-order-id="{{ torder.pk }}" data-id="{{ torder.pk }}">
<span class="dimovChat"></span>
<p class="titleOB">
@ -272,7 +272,7 @@
{% endfor %}
{% for yteam in your_teams %}
<div class="team-block orderBlock box-sizing" data-team-id="{{ yteam.pk }}">
<div class="team-block orderBlock box-sizing" id="teamMyBlock{{ yteam.pk }}" data-team-id="{{ yteam.pk }}">
<span class="dimovChat"></span>
<p class="titleOB">
{{ yteam }}

@ -31,7 +31,7 @@
<div class="messageBlock box-sizing disTab">
<p>Контакты</p>
{% for contact in contacts_users %}
<div class="message messd user-block" data-id="{{ contact.pk }}">
<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 %}
@ -664,6 +664,7 @@
$(this).addClass('orAct');
var orderId = $(this).attr('data-id');
location.hash = '#order' + orderId;
var projectId = $(this).attr('data-project-id');
var recipentId = $(this).attr('data-recipent-id');
var secureOrder = $(this).attr('data-secure-deal');

@ -37,11 +37,12 @@ class ChatUserView(LoginRequiredMixin, View):
template_name = ''
def get(self, request, *args, **kwargs):
# import code; code.interact(local=dict(globals(), **locals()))
user_id = request.GET.get('user_id',None)
if request.user.is_customer():
customer_contacts = Message.objects.values_list('sender_id', 'recipent_id'). \
filter(Q(recipent_id=request.user.pk) | Q(sender_id=request.user.pk)).filter(Q(team_id=None)).distinct()
filter(Q(recipent_id=request.user.pk) | Q(sender_id=request.user.pk)).\
filter(Q(team_id=None)).\
filter(is_delete=False).distinct()
users_ids = []
for msg in customer_contacts:
@ -52,7 +53,6 @@ class ChatUserView(LoginRequiredMixin, View):
users_ids.append(b)
if user_id:
users_ids.append(int(user_id))
# import code; code.interact(local=dict(globals(), **locals()))
contacts_users = User.objects.filter(pk__in=users_ids)
chat_messages = Message.objects.filter(Q(sender=request.user.pk) | Q(recipent=request.user.pk))
@ -70,7 +70,7 @@ class ChatUserView(LoginRequiredMixin, View):
if request.user.is_owner_team():
team_ids.append(request.user.team.pk)
team_orders = request.user.team.orders.all()
teams = Team.objects.filter(contractors__id=request.user.pk).all()
# teams = Team.objects.filter(contractors__id=request.user.pk).all()
else:
teams = Team.objects.filter(contractors__id=request.user.pk).all()
team_orders = Order.objects.filter(team_id__in=[team.pk for team in teams]).all()

@ -451,8 +451,8 @@
format_type: 'add_message_contact',
data: {
sender_id: customerId,
recipent_id: contractorId,
sender_id: String(customerId),
recipent_id: String(contractorId),
chat_message: msg,
},
})
@ -472,8 +472,8 @@
format_type: 'add_message_contact',
data: {
sender_id: customerId,
recipent_id: contractorId,
sender_id: String(customerId),
recipent_id: String(contractorId),
chat_message: msg,
},
})

@ -347,8 +347,8 @@
format_type: 'add_message_contact',
data: {
sender_id: {{ request.user.pk }},
recipent_id: $contractorSelect.select2('val'),
sender_id: '{{ request.user.pk }}',
recipent_id: String($contractorSelect.select2('val')),
chat_message: 'Приглашаю в группу http://{{ request.get_host }}{% url 'users:team-profile' pk=request.user.team.pk %}',
},
})

@ -354,6 +354,10 @@
<input type="file" name="upload" id="upload-resume">
<p>Загрузить резюме</p>
</div>
<div class="upload2 up-l2" id="remove-resume-file" style="display:{% if contractor.contractor_resume.resume_file %}block;{% else %}none;{% endif %}">
<p style="margin:0;">Удалить резюме</p>
</div>
</form>
</div>
@ -371,10 +375,8 @@
<div id="resume-success"></div>
{% if contractor.contractor_resume.resume_file %}
<a
style="display: {% if contractor.contractor_resume.resume_file %}block{% else %}none{% endif %};"
href="{% if contractor.contractor_resume.resume_file %}{{ contractor.contractor_resume.resume_file.url }}{% endif %}"
class="download-summ">
<a style="display:block;"
href="{{ contractor.contractor_resume.resume_file.url }}" class="download-summ">
скачать резюме
</a>
{% endif %}
@ -706,8 +708,8 @@
format_type: 'add_message_contact',
data: {
sender_id: {{ request.user.pk }},
recipent_id: {{ contractor.pk }},
sender_id: '{{ request.user.pk }}',
recipent_id: '{{ contractor.pk }}',
chat_message: 'Приглашаю в группу http://{{ request.get_host }}{% url 'users:team-profile' pk=request.user.team.pk %}',
},
})
@ -760,8 +762,8 @@
format_type: 'add_message_contact',
data: {
sender_id: customerId,
recipent_id: contractorId,
sender_id: String(customerId),
recipent_id: String(contractorId),
chat_message: msg,
},
})
@ -900,13 +902,36 @@
});
var url = '/work_sell/basic/';
var csrftoken = $.cookie('csrftoken');
$("body").on("click","#remove-resume-file", function(e) {
e.preventDefault();
var _this = $(this);
$.ajax({
url:'/api/contractorresume/{{ contractor.contractor_resume.pk }}/',
method:'PUT',
beforeSend: function (xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
},
data: {resume_file: null},
cache: false,
dataType: 'json',
success: function(data){
$("#resume-success").html("Файл для резюме удален!");
$(_this).css('display','none');
$('.download-summ').css('display','none');
console.log(data);
},
error: function(jqXHR){
console.log(jqXHR);
}
});
});
$("#upload-resume").on('change',function(e){
$("#resume-success").html("");
var formData = new FormData($(this).closest("form"));
var formData = new FormData();
formData.append('resume_file', e.target.files[0]);
console.log(formData);
console.log(e.target.files[0]);
$.ajax({
url:'/api/contractorresume/{{ contractor.contractor_resume.pk }}/',
method:'PUT',
@ -920,7 +945,13 @@
contentType: false,
success: function(data){
$("#resume-success").html("Файл для резюме успешно загружен!");
$(".download-summ").css('display','block').attr('href',data.resume_file);
var downloadSumm = $(".download-summ");
if(downloadSumm.length>0){
downloadSumm.css('display','block').attr('href',data.resume_file);
}else {
$('<a href="' + data.resume_file +'" class="download-summ">скачать резюме</a>').insertAfter('#resume-success');
}
$("#remove-resume-file").show();
console.log(data);
},
error: function(jqXHR){

@ -27,3 +27,6 @@ def contractor_indicator(context, contractor):
def has_group(user, group_name):
groups = user.groups.all().values_list('name', flat=True)
return True if group_name in groups else False
def count_new_message(user):
pass

Loading…
Cancel
Save