You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
8.3 KiB
192 lines
8.3 KiB
<!doctype html>
|
|
{% load staticfiles %}
|
|
{#{% load compress %}#}
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<meta http-equiv='X-UA-Compatible' content='IE=edge, chrome=1'>
|
|
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
|
<!--<meta name='viewport' content='initial-scale=1.0, user-scalable=no, maximum-scale=1'>-->
|
|
|
|
{% block head %}{% endblock %}
|
|
|
|
<title>PROEKTON</title>
|
|
|
|
{# {% compress css %}#}
|
|
{% block old_css %}
|
|
<link rel='stylesheet' href='{% static "css/reset.css" %}'>
|
|
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'>
|
|
<link rel='stylesheet' href='{% static "css/font-awesome.min.css" %}'>
|
|
<link rel='stylesheet' href='{% static "lib/bootstrap-select/css/bootstrap-select.css" %}'>
|
|
<link rel='stylesheet' href='{% static "lib/select2/select2.css" %}'> <!-- Tmp -->
|
|
<link rel='stylesheet' href='{% static "css/swiper.min.css" %}'>
|
|
<link rel='stylesheet' href='{% static "lib/jquery.fileupload/css/jquery.fileupload.css" %}'>
|
|
<link rel='stylesheet' href='{% static "js/magnific-popup.css" %}'>
|
|
<link rel='stylesheet' href='{% static "css/main.css" %}'>
|
|
<link rel='stylesheet' href='{% static "css/extra.css" %}'> <!-- Our additional CSS -->
|
|
{% endblock %}
|
|
{% block common_css %}
|
|
<link rel='stylesheet' href='{% static "css/bootstrap.css" %}'>
|
|
<link rel='stylesheet' href='{% static "css/font-awesome.min.css" %}'>
|
|
<link rel="stylesheet" href='{% static "lib/jquery-jgrowl/jquery.jgrowl.min.css" %}'>
|
|
<link rel='stylesheet' href='{% static "lib/jquery-ui/jquery-ui.css" %}'>
|
|
{% endblock %}
|
|
{% block head_css %}
|
|
|
|
{% endblock %}
|
|
{% if TEMPLATE_DEBUG %}
|
|
<link rel='stylesheet' href='{% static "css/dev-colors.css" %}'> <!-- Dev-time only, temporary!!! -->
|
|
{% endif %}
|
|
|
|
<link rel="icon" href="{% static 'img/favicon.jpg' %}" type="image/x-icon">
|
|
<link rel="shortcut icon" href="{% static 'img/favicon50.jpg' %}" type="image/x-icon">
|
|
<link rel="apple-touch-icon" href="{% static 'img/favicon128.jpg' %}" sizes="128x128">
|
|
<link rel="icon" type="image/png" href="{% static 'img/favicon50.jpg' %}" sizes="32x32">
|
|
<link rel="icon" type="image/png" href="{% static 'img/favicon18.jpg' %}" sizes="16x16">
|
|
|
|
{# {% endcompress %}#}
|
|
<meta name="keywords" content="">
|
|
<meta name="description" content="_TEXT_">
|
|
<meta name="yandex-verification" content="58d23691715ef942">
|
|
<link rel="canonical" href="_URL_">
|
|
</head>
|
|
|
|
<body>
|
|
{% if TEMPLATE_DEBUG %}
|
|
{% if messages %}
|
|
{% for message in messages %}
|
|
<div class="c"
|
|
style="position: relative; padding: 10px; margin-bottom: 6px; z-index: 100">{{ message|safe }}</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{#{% if TEMPLATE_DEBUG %}#}
|
|
{# <div ondblclick="$(this).css('display', 'none')"#}
|
|
{# style="position: absolute; left: 0; bottom: 0; padding: 6px; color: black; background-color: {% if request.user.is_contractor %}#BADA55{% else %}#C0FFEE{% endif %}; z-index: 50">#}
|
|
{# {{ request.user }}<br>#}
|
|
{##}
|
|
{# {% if request.user.is_authenticated %}#}
|
|
{# <b>PK:</b> {{ request.user.pk }}<br>#}
|
|
{# <b>Groups:</b> {{ request.user.groups.all }}#}
|
|
{# {% endif %}#}
|
|
{# </div>#}
|
|
{#{% endif %}#}
|
|
|
|
{% block content %}{% endblock %}
|
|
|
|
{% block common_js %}
|
|
<script src='{% static "js/jquery-2.2.3.min.js" %}'></script>
|
|
{# <script src='{% static "js/bootstrap.min.js" %}'></script>#}
|
|
{% endblock %}
|
|
{#{% compress js %}#}
|
|
{% block old_js %}
|
|
<script src='{% static "lib/lodash/lodash.js" %}'></script>
|
|
<script src='{% static "lib/lodash/lodash.fp.js" %}'></script>
|
|
|
|
<script src='{% static "js/jquery-2.2.3.min.js" %}'></script>
|
|
<script src='{% static "lib/jquery-ui/jquery-ui.js" %}'></script>
|
|
<script src='{% static "lib/jquery-ui/i18n/datepicker-ru.js" %}'></script> <!-- jQueryUI Datepicker i18n -->
|
|
<script src='{% static "js/bootstrap.min.js" %}'></script>
|
|
<script src='{% static "lib/bootstrap-select/js/bootstrap-select.js" %}'></script>
|
|
<script src='{% static "lib/select2/select2.js" %}'></script>
|
|
<script src='{% static "lib/urijs/URI.min.js" %}'></script>
|
|
|
|
<script src='{% static "lib/jquery.fileupload/js/vendor/jquery.ui.widget.js" %}'></script>
|
|
<script src='{% static "lib/jquery.fileupload/js/jquery.iframe-transport.js" %}'></script>
|
|
<script src='{% static "lib/jquery.fileupload/js/jquery.fileupload.js" %}'></script>
|
|
<script src='{% static "lib/jquery.fileupload/js/jquery.fileupload-process.js" %}'></script>
|
|
|
|
<script src='{% static "js/jquery.magnific-popup.min.js" %}'></script>
|
|
<script src='{% static "lib/jquery.cookie/jquery.cookie.min.js" %}'></script>
|
|
|
|
<script src='{% static "my-libs.js" %}'></script>
|
|
|
|
<script src='{% static "js/main.js" %}'></script> <!-- Файл верстальщика -->
|
|
<script src='{% static "index.js" %}'></script> <!-- Файл программистов -->
|
|
|
|
|
|
{% endblock %}
|
|
|
|
{% block ws_block %}
|
|
<script src='{% static "lib/jquery-jgrowl/jquery.jgrowl.min.js" %}'></script>
|
|
<script>
|
|
function getOpenOrdersList() {
|
|
$.ajax({
|
|
url: '/api/orders?status=created',
|
|
type: 'get',
|
|
success: function (data) {
|
|
$.each(data.results, function (key, value) {
|
|
open_order_list.push(parseInt(value.id))
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
function message_count_plus(selector) {
|
|
var all_messages = $(selector);
|
|
var count = parseInt(all_messages.html()) + 1;
|
|
if (count > 99) count = '99+';
|
|
all_messages.html(count);
|
|
|
|
}
|
|
var SocketHandlerMain = function (userId) {
|
|
var domain = '{{ request.META.HTTP_HOST }}';
|
|
var port = '{{ request.META.SERVER_PORT }}';
|
|
var queryString = '{{ request.get_full_path }}';
|
|
|
|
if ((queryString.indexOf('/chat') != 0) && (queryString.indexOf('/users/contractor-office/work-projects') != 0)) {
|
|
domain = domain.replace(':' + port, ':8888');
|
|
if (window.location.protocol == 'https:') {
|
|
var ws = "wss://";
|
|
} else {
|
|
var ws = "ws://";
|
|
}
|
|
|
|
var url = ws + domain + '/chat/' + userId + '/';
|
|
var sock = new WebSocket(url);
|
|
var intervalId;
|
|
sock.onopen = function () {
|
|
intervalId = setInterval(function () {
|
|
sock.send('{"dummy": 1}');
|
|
}, 15000);
|
|
};
|
|
|
|
sock.onmessage = function (event) {
|
|
var notificationData = JSON.parse(event.data);
|
|
if (open_order_list.indexOf(parseInt(notificationData.order_id)) != -1) {
|
|
{# console.log("in");#}
|
|
message_count_plus('#my_office');
|
|
}
|
|
message_count_plus('.js-all-messages');
|
|
var outMessage = "";
|
|
if (notificationData.answer_type == 'add_message_contact') {
|
|
outMessage += "<a href='/chat/?user_id=" + notificationData.sender_id + "'>" + notificationData.msg + "<a>";
|
|
} else if ((notificationData.answer_type == 'approve_stages') || (notificationData.answer_type == 'add_message_order')) {
|
|
outMessage += "<a href='/chat/#order" + notificationData.order_id + "'>" + notificationData.msg + "<a>";
|
|
}
|
|
console.log("Вам пришло новое сообщение!<br />" + outMessage);
|
|
$.jGrowl("Вам пришло новое сообщение!<br />" + outMessage, {life: 15000});
|
|
};
|
|
this.add_message = function (messageData) {
|
|
sock.send(JSON.stringify(messageData));
|
|
};
|
|
}
|
|
};
|
|
|
|
var userId = '{{ request.user.pk }}';
|
|
if (userId) {
|
|
var socketMain = new SocketHandlerMain(userId);
|
|
var open_order_list = [];
|
|
getOpenOrdersList();
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% block js_block %}
|
|
|
|
{% endblock %}
|
|
|
|
{#{% endcompress %}#}
|
|
</body>
|
|
</html>
|
|
|