diff --git a/.gitignore b/.gitignore index c0144b7..1aafbea 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ env/ .ar/ ar/ archilance/settings/local.py +chat/settings/local.py media/* static/* diff --git a/README.md b/README.md index ca57e28..3970bcb 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,13 @@ python manage.py generate_reviews ``` ---------------------------------------- + +## Local smtp debug server +``` +sudo python3 -m smtpd -n -c DebuggingServer localhost:25 +``` + +## Local char server +``` +python3 -m tornado.autoreload chat/chat.py +``` \ No newline at end of file diff --git a/api/views.py b/api/views.py index 0a6c00f..bb9ab28 100755 --- a/api/views.py +++ b/api/views.py @@ -169,9 +169,11 @@ class RealtyViewSet(ModelViewSet): @list_route(methods=['get']) def current_user(self, request, *args, **kwargs): - queryset = self.queryset.filter(user=self.request.user) - serialiser = self.serializer_class(queryset, many=True) - return Response(serialiser.data) + if self.request.user.__dict__: + queryset = self.queryset.filter(user=self.request.user) + serialiser = self.serializer_class(queryset, many=True) + return Response(serialiser.data) + return Response([]) class BuildingClassificationViewSet(ModelViewSet): diff --git a/archilance/local.py b/archilance/local.py deleted file mode 100644 index b26e8e8..0000000 --- a/archilance/local.py +++ /dev/null @@ -1,12 +0,0 @@ -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'proekton2', - 'USER': 'postgres', - 'PASSWORD': 'gum1756', - 'HOST': 'localhost', - 'PORT': '', - } -} - -TEMPLATE_DEBUG = True diff --git a/archilance/settings/base.py b/archilance/settings/base.py index 6b27c14..29ae6c6 100644 --- a/archilance/settings/base.py +++ b/archilance/settings/base.py @@ -118,6 +118,7 @@ TEMPLATES = [ 'django.core.context_processors.request', 'social.apps.django_app.context_processors.backends', 'social.apps.django_app.context_processors.login_redirect', + 'context_processors.user_info.user_info' ], # Load these templatetags by default: @@ -339,6 +340,7 @@ SITE_ID = 1 # else: EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +# sudo python3 -m smtpd -n -c DebuggingServer localhost:25 EMAIL_HOST = 'localhost' EMAIL_HOST_PASSWORD = '' EMAIL_HOST_USER = '' @@ -377,4 +379,5 @@ DEFAULT_FILE_STORAGE = 'archilance.util.ASCIIFileSystemStorage' RECAPTCHA_PUBLIC_KEY = '6LftaQgUAAAAAG0oKrt1ORtop1jfIEzkTnCL4S3Q' RECAPTCHA_PRIVATE_KEY = '6LftaQgUAAAAAMaIK-YCL1u1AfakVXjblULQCvfa' +# CAPTCHA_AJAX = True NOCAPTCHA = True \ No newline at end of file diff --git a/archilance/views.py b/archilance/views.py index 2dab7fb..d80b2c8 100644 --- a/archilance/views.py +++ b/archilance/views.py @@ -1,17 +1,16 @@ -import pydash as _; from django.core.files.base import ContentFile from django.shortcuts import render from django.views.generic import View -_.map = _.map_; -_.filter = _.filter_ - from .mixins import BaseMixin from chat.models import Documents from common.models import MainPage from users.models import User from work_sell.models import Picture +import pydash as _; +_.map = _.map_; +_.filter = _.filter_ class HomeTemplateView(BaseMixin, View): diff --git a/assets/css/main.css b/assets/css/main.css index c21edf0..80ce79a 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -85,15 +85,15 @@ a, a:hover, a:focus, a:active { background-color: black; } -.logo { - width: 183px; - height: 36px; - background: url('../img/logo.png') no-repeat center; - background-size: cover; - float: left; - margin: 18px 0 21px 10px; - cursor: pointer; -} +/*.logo {*/ + /*width: 183px;*/ + /*height: 36px;*/ + /*background: url('../img/logo.png') no-repeat center;*/ + /*background-size: cover;*/ + /*float: left;*/ + /*margin: 18px 0 21px 10px;*/ + /*cursor: pointer;*/ +/*}*/ .mainMenu { float: left; diff --git a/assets/fonts/MyriadPro/MyriadPro-Bold.otf b/assets/fonts/MyriadPro/MyriadPro-Bold.otf new file mode 100644 index 0000000..e80b807 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-Bold.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-BoldCond.otf b/assets/fonts/MyriadPro/MyriadPro-BoldCond.otf new file mode 100644 index 0000000..c6864bd Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-BoldCond.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-BoldCondIt.otf b/assets/fonts/MyriadPro/MyriadPro-BoldCondIt.otf new file mode 100644 index 0000000..2179333 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-BoldCondIt.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-BoldIt.otf b/assets/fonts/MyriadPro/MyriadPro-BoldIt.otf new file mode 100644 index 0000000..9c37583 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-BoldIt.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-Cond.otf b/assets/fonts/MyriadPro/MyriadPro-Cond.otf new file mode 100644 index 0000000..fe187b8 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-Cond.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-CondIt.otf b/assets/fonts/MyriadPro/MyriadPro-CondIt.otf new file mode 100644 index 0000000..bbf4de8 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-CondIt.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-It.otf b/assets/fonts/MyriadPro/MyriadPro-It.otf new file mode 100644 index 0000000..0b74757 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-It.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-Regular.otf b/assets/fonts/MyriadPro/MyriadPro-Regular.otf new file mode 100644 index 0000000..f686221 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-Regular.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-Semibold.otf b/assets/fonts/MyriadPro/MyriadPro-Semibold.otf new file mode 100644 index 0000000..1b33d74 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-Semibold.otf differ diff --git a/assets/fonts/MyriadPro/MyriadPro-SemiboldIt.otf b/assets/fonts/MyriadPro/MyriadPro-SemiboldIt.otf new file mode 100644 index 0000000..e92ba39 Binary files /dev/null and b/assets/fonts/MyriadPro/MyriadPro-SemiboldIt.otf differ diff --git a/assets/images/Thumbs.db b/assets/images/Thumbs.db deleted file mode 100644 index b7d1473..0000000 Binary files a/assets/images/Thumbs.db and /dev/null differ diff --git a/assets/img/icons/icon_hands.png b/assets/img/icons/icon_hands.png new file mode 100644 index 0000000..2efeea0 Binary files /dev/null and b/assets/img/icons/icon_hands.png differ diff --git a/assets/img/icons/icon_hands_red.png b/assets/img/icons/icon_hands_red.png new file mode 100644 index 0000000..58ece00 Binary files /dev/null and b/assets/img/icons/icon_hands_red.png differ diff --git a/assets/img/icons/icon_speach-ball.png b/assets/img/icons/icon_speach-ball.png new file mode 100644 index 0000000..9768a3c Binary files /dev/null and b/assets/img/icons/icon_speach-ball.png differ diff --git a/assets/img/icons/icon_speach-ball_red.png b/assets/img/icons/icon_speach-ball_red.png new file mode 100644 index 0000000..2c3bbfd Binary files /dev/null and b/assets/img/icons/icon_speach-ball_red.png differ diff --git a/assets/img/main.png b/assets/img/main.png new file mode 100644 index 0000000..956d20d Binary files /dev/null and b/assets/img/main.png differ diff --git a/assets/images/main.jpg b/assets/img/old_main.jpg similarity index 100% rename from assets/images/main.jpg rename to assets/img/old_main.jpg diff --git a/assets/img/sprite.png b/assets/img/sprite.png new file mode 100644 index 0000000..be0fcf3 Binary files /dev/null and b/assets/img/sprite.png differ diff --git a/assets/img/youtube.png b/assets/img/youtube.png index 8d96412..e2de634 100644 Binary files a/assets/img/youtube.png and b/assets/img/youtube.png differ diff --git a/assets/js/build/create_project.js b/assets/js/build/create_project.js index 32a9589..dec3dd1 100644 --- a/assets/js/build/create_project.js +++ b/assets/js/build/create_project.js @@ -60,7 +60,9 @@ var _scroll_on_required = __webpack_require__(8); - var _test_seeds = __webpack_require__(9); + var _ajax_registration = __webpack_require__(9); + + var _test_seeds = __webpack_require__(10); function showHideRealry() { var check = $('#checkbox-sb-realty'); @@ -83,6 +85,7 @@ (0, _only_one_checkbox.onlyOneCheckboxInit)('#safe', '#by_agreement'); (0, _scroll_on_required.scrollOnRequiredInit)(); (0, _popups.showPopupsInit)(); + (0, _ajax_registration.ajaxRegistrationInit)('customer'); window.addMessage = _popups.addMessage; }); @@ -369,6 +372,104 @@ /***/ }, /* 9 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var $form = $('#form-registration'); + + function clearErrors() { + var $error_tags = $form.find('.errorlist'); + if ($error_tags.length > 0) $error_tags.remove(); + } + + function sendData(form_data) { + // console.log("form_data = ", form_data); + $.ajax({ + url: '/users/register/', + type: 'post', + data: form_data, + success: function success(data) { + // console.log("success data -->", data); + $('#registrationFormModal').modal('toggle'); + $('input[name=not_auth_user_id]').val(data.pk); + $('#not_customer').hide(); + $('#is_customer').show(); + }, + error: function error(xhr, ajaxOptions, thrownError) { + var status = xhr.status; + if (status == 400) { + var data = JSON.parse(xhr.responseText); + $.each(data, function (key, value) { + var ul = $(""); + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var error = _step.value; + + ul.append('
  • ' + error + '
  • '); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + var $field = void 0; + if (key == 'captcha_html') { + // console.log("captcha html = ", key, '/', value); + $form.find('.captcha').html(value); + return; + } else if (key == 'captcha') { + $field = $form.find('.g-recaptcha'); + } else if (key == 'tos') { + $field = $form.find('input[name=' + key + ']').parent(); + } else { + $field = $form.find('input[name=' + key + ']'); + if ($field.length == 0) console.log('!!!field ' + key + ' not found'); + } + if ($field.length > 0) $field.parent().append(ul); + }); + // console.log('captcha error = ', data.captcha); + // console.log('data type = ', typeof data); + } + // console.log("data = ", xhr.responseText); + // console.log(ajaxOptions); + // console.log(thrownError); + } + }); + } + + function ajaxRegistrationInit(user_type) { + // const $form = $('#form-registration'); + $form.on("submit", function (e) { + e.preventDefault(); + // get form data and add user_type + clearErrors(); + var form_data = $form.serialize() + "&user_type=" + encodeURIComponent(user_type); + sendData(form_data); + }); + } + + exports.ajaxRegistrationInit = ajaxRegistrationInit; + +/***/ }, +/* 10 */ /***/ function(module, exports) { "use strict"; diff --git a/assets/js/build/create_worksell.js b/assets/js/build/create_worksell.js index 49f7100..b66a6ff 100644 --- a/assets/js/build/create_worksell.js +++ b/assets/js/build/create_worksell.js @@ -48,18 +48,21 @@ var _file_upload = __webpack_require__(1); - var _image_upload = __webpack_require__(10); + var _image_upload = __webpack_require__(11); var _scroll_on_required = __webpack_require__(8); var _popups = __webpack_require__(7); + var _ajax_registration = __webpack_require__(9); + $(function () { // fileUploadInit(); // previewImg(); (0, _image_upload.imageUploadInit)(); (0, _scroll_on_required.scrollOnRequiredInit)(); (0, _popups.showPopupsInit)(); + (0, _ajax_registration.ajaxRegistrationInit)('contractor'); window.addMessage = _popups.addMessage; }); @@ -233,8 +236,106 @@ exports.scrollOnRequiredInit = scrollOnRequiredInit; /***/ }, -/* 9 */, -/* 10 */ +/* 9 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var $form = $('#form-registration'); + + function clearErrors() { + var $error_tags = $form.find('.errorlist'); + if ($error_tags.length > 0) $error_tags.remove(); + } + + function sendData(form_data) { + // console.log("form_data = ", form_data); + $.ajax({ + url: '/users/register/', + type: 'post', + data: form_data, + success: function success(data) { + // console.log("success data -->", data); + $('#registrationFormModal').modal('toggle'); + $('input[name=not_auth_user_id]').val(data.pk); + $('#not_customer').hide(); + $('#is_customer').show(); + }, + error: function error(xhr, ajaxOptions, thrownError) { + var status = xhr.status; + if (status == 400) { + var data = JSON.parse(xhr.responseText); + $.each(data, function (key, value) { + var ul = $(""); + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var error = _step.value; + + ul.append('
  • ' + error + '
  • '); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + + var $field = void 0; + if (key == 'captcha_html') { + // console.log("captcha html = ", key, '/', value); + $form.find('.captcha').html(value); + return; + } else if (key == 'captcha') { + $field = $form.find('.g-recaptcha'); + } else if (key == 'tos') { + $field = $form.find('input[name=' + key + ']').parent(); + } else { + $field = $form.find('input[name=' + key + ']'); + if ($field.length == 0) console.log('!!!field ' + key + ' not found'); + } + if ($field.length > 0) $field.parent().append(ul); + }); + // console.log('captcha error = ', data.captcha); + // console.log('data type = ', typeof data); + } + // console.log("data = ", xhr.responseText); + // console.log(ajaxOptions); + // console.log(thrownError); + } + }); + } + + function ajaxRegistrationInit(user_type) { + // const $form = $('#form-registration'); + $form.on("submit", function (e) { + e.preventDefault(); + // get form data and add user_type + clearErrors(); + var form_data = $form.serialize() + "&user_type=" + encodeURIComponent(user_type); + sendData(form_data); + }); + } + + exports.ajaxRegistrationInit = ajaxRegistrationInit; + +/***/ }, +/* 10 */, +/* 11 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -293,12 +394,9 @@ $fileUploadWidget.css('display', 'block'); if ($fileImg.length) { - console.log('+'); var reader = new FileReader(); reader.onload = function (e) { - // document.getElementById('clock').style.backgroundImage = "url(" + reader.result + ")"; $fileImg.css('background-image', 'url(' + e.target.result + ')'); - // $fileImg.attr('src', e.target.result); }; reader.readAsDataURL($fileInput[0].files[0]); diff --git a/assets/js/build/home_page.js b/assets/js/build/home_page.js new file mode 100644 index 0000000..c3b82b6 --- /dev/null +++ b/assets/js/build/home_page.js @@ -0,0 +1,81 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _popupYoutube = __webpack_require__(12); + + $(function () { + (0, _popupYoutube.popupYoutubeInit)(); + }); + +/***/ }, + +/***/ 12: +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + function popupYoutubeInit() { + $('.popup-youtube').magnificPopup({ + disableOn: 700, + type: 'iframe', + mainClass: 'mfp-fade', + removalDelay: 160, + preloader: false, + fixedContentPos: false + }); + } + + exports.popupYoutubeInit = popupYoutubeInit; + +/***/ } + +/******/ }); \ No newline at end of file diff --git a/assets/js/build/init_create_worksell.js b/assets/js/build/init_create_worksell.js index 6f48517..6dd5766 100644 --- a/assets/js/build/init_create_worksell.js +++ b/assets/js/build/init_create_worksell.js @@ -46,27 +46,27 @@ 'use strict'; - var _SelectedContainer = __webpack_require__(11); + var _SelectedContainer = __webpack_require__(13); var _SelectedContainer2 = _interopRequireDefault(_SelectedContainer); - var _SelectedContainerCreate = __webpack_require__(15); + var _SelectedContainerCreate = __webpack_require__(17); var _SelectedContainerCreate2 = _interopRequireDefault(_SelectedContainerCreate); - var _NoTreeSelect = __webpack_require__(16); + var _NoTreeSelect = __webpack_require__(18); var _NoTreeSelect2 = _interopRequireDefault(_NoTreeSelect); - var _TreeSelect = __webpack_require__(18); + var _TreeSelect = __webpack_require__(20); var _TreeSelect2 = _interopRequireDefault(_TreeSelect); - var _SingleTreeSelect = __webpack_require__(19); + var _SingleTreeSelect = __webpack_require__(21); var _SingleTreeSelect2 = _interopRequireDefault(_SingleTreeSelect); - var _SelectOrCreate = __webpack_require__(20); + var _SelectOrCreate = __webpack_require__(22); var _SelectOrCreate2 = _interopRequireDefault(_SelectOrCreate); @@ -177,7 +177,9 @@ /* 8 */, /* 9 */, /* 10 */, -/* 11 */ +/* 11 */, +/* 12 */, +/* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -192,15 +194,15 @@ var _desc, _value, _class; // ` - var _DataTree = __webpack_require__(12); + var _DataTree = __webpack_require__(14); var _DataTree2 = _interopRequireDefault(_DataTree); - var _NoTreeData = __webpack_require__(13); + var _NoTreeData = __webpack_require__(15); var _NoTreeData2 = _interopRequireDefault(_NoTreeData); - var _decorators = __webpack_require__(14); + var _decorators = __webpack_require__(16); var _decorators2 = _interopRequireDefault(_decorators); @@ -431,7 +433,7 @@ exports.default = SelectedContainer; /***/ }, -/* 12 */ +/* 14 */ /***/ function(module, exports) { "use strict"; @@ -586,7 +588,7 @@ exports.default = DataTree; /***/ }, -/* 13 */ +/* 15 */ /***/ function(module, exports) { "use strict"; @@ -642,7 +644,7 @@ exports.default = NoTreeData; /***/ }, -/* 14 */ +/* 16 */ /***/ function(module, exports) { "use strict"; @@ -726,7 +728,7 @@ // export {onBind}; /***/ }, -/* 15 */ +/* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -742,11 +744,11 @@ var _desc, _value, _class; - var _SelectedContainer2 = __webpack_require__(11); + var _SelectedContainer2 = __webpack_require__(13); var _SelectedContainer3 = _interopRequireDefault(_SelectedContainer2); - var _decorators = __webpack_require__(14); + var _decorators = __webpack_require__(16); var _decorators2 = _interopRequireDefault(_decorators); @@ -827,7 +829,7 @@ exports.default = SelectedContainerCreate; /***/ }, -/* 16 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -841,9 +843,9 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _AbsBaseSelect2 = __webpack_require__(17); + var _AbsBaseSelect2 = __webpack_require__(19); - var _NoTreeData = __webpack_require__(13); + var _NoTreeData = __webpack_require__(15); var _NoTreeData2 = _interopRequireDefault(_NoTreeData); @@ -910,7 +912,7 @@ exports.default = NoTreeSelect; /***/ }, -/* 17 */ +/* 19 */ /***/ function(module, exports) { "use strict"; @@ -1454,7 +1456,7 @@ exports.AbsBaseSelect = AbsBaseSelect; /***/ }, -/* 18 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1468,9 +1470,9 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _AbsBaseSelect2 = __webpack_require__(17); + var _AbsBaseSelect2 = __webpack_require__(19); - var _DataTree = __webpack_require__(12); + var _DataTree = __webpack_require__(14); var _DataTree2 = _interopRequireDefault(_DataTree); @@ -1579,7 +1581,7 @@ exports.default = TreeSelect; /***/ }, -/* 19 */ +/* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1591,9 +1593,9 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var _AbsBaseSelect = __webpack_require__(17); + var _AbsBaseSelect = __webpack_require__(19); - var _TreeSelect2 = __webpack_require__(18); + var _TreeSelect2 = __webpack_require__(20); var _TreeSelect3 = _interopRequireDefault(_TreeSelect2); @@ -1674,7 +1676,7 @@ exports.default = SingleTreeSelect; /***/ }, -/* 20 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1688,9 +1690,9 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _AbsBaseSelect2 = __webpack_require__(17); + var _AbsBaseSelect2 = __webpack_require__(19); - var _NoTreeData = __webpack_require__(13); + var _NoTreeData = __webpack_require__(15); var _NoTreeData2 = _interopRequireDefault(_NoTreeData); diff --git a/assets/js/build/init_customer_project_create.js b/assets/js/build/init_customer_project_create.js index db7b9c4..39cfa5d 100644 --- a/assets/js/build/init_customer_project_create.js +++ b/assets/js/build/init_customer_project_create.js @@ -46,27 +46,27 @@ 'use strict'; - var _SelectedContainer = __webpack_require__(11); + var _SelectedContainer = __webpack_require__(13); var _SelectedContainer2 = _interopRequireDefault(_SelectedContainer); - var _SelectedContainerCreate = __webpack_require__(15); + var _SelectedContainerCreate = __webpack_require__(17); var _SelectedContainerCreate2 = _interopRequireDefault(_SelectedContainerCreate); - var _NoTreeSelect = __webpack_require__(16); + var _NoTreeSelect = __webpack_require__(18); var _NoTreeSelect2 = _interopRequireDefault(_NoTreeSelect); - var _TreeSelect = __webpack_require__(18); + var _TreeSelect = __webpack_require__(20); var _TreeSelect2 = _interopRequireDefault(_TreeSelect); - var _SingleTreeSelect = __webpack_require__(19); + var _SingleTreeSelect = __webpack_require__(21); var _SingleTreeSelect2 = _interopRequireDefault(_SingleTreeSelect); - var _SelectOrCreate = __webpack_require__(20); + var _SelectOrCreate = __webpack_require__(22); var _SelectOrCreate2 = _interopRequireDefault(_SelectOrCreate); @@ -212,7 +212,9 @@ /* 8 */, /* 9 */, /* 10 */, -/* 11 */ +/* 11 */, +/* 12 */, +/* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -227,15 +229,15 @@ var _desc, _value, _class; // ` - var _DataTree = __webpack_require__(12); + var _DataTree = __webpack_require__(14); var _DataTree2 = _interopRequireDefault(_DataTree); - var _NoTreeData = __webpack_require__(13); + var _NoTreeData = __webpack_require__(15); var _NoTreeData2 = _interopRequireDefault(_NoTreeData); - var _decorators = __webpack_require__(14); + var _decorators = __webpack_require__(16); var _decorators2 = _interopRequireDefault(_decorators); @@ -466,7 +468,7 @@ exports.default = SelectedContainer; /***/ }, -/* 12 */ +/* 14 */ /***/ function(module, exports) { "use strict"; @@ -621,7 +623,7 @@ exports.default = DataTree; /***/ }, -/* 13 */ +/* 15 */ /***/ function(module, exports) { "use strict"; @@ -677,7 +679,7 @@ exports.default = NoTreeData; /***/ }, -/* 14 */ +/* 16 */ /***/ function(module, exports) { "use strict"; @@ -761,7 +763,7 @@ // export {onBind}; /***/ }, -/* 15 */ +/* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -777,11 +779,11 @@ var _desc, _value, _class; - var _SelectedContainer2 = __webpack_require__(11); + var _SelectedContainer2 = __webpack_require__(13); var _SelectedContainer3 = _interopRequireDefault(_SelectedContainer2); - var _decorators = __webpack_require__(14); + var _decorators = __webpack_require__(16); var _decorators2 = _interopRequireDefault(_decorators); @@ -862,7 +864,7 @@ exports.default = SelectedContainerCreate; /***/ }, -/* 16 */ +/* 18 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -876,9 +878,9 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _AbsBaseSelect2 = __webpack_require__(17); + var _AbsBaseSelect2 = __webpack_require__(19); - var _NoTreeData = __webpack_require__(13); + var _NoTreeData = __webpack_require__(15); var _NoTreeData2 = _interopRequireDefault(_NoTreeData); @@ -945,7 +947,7 @@ exports.default = NoTreeSelect; /***/ }, -/* 17 */ +/* 19 */ /***/ function(module, exports) { "use strict"; @@ -1489,7 +1491,7 @@ exports.AbsBaseSelect = AbsBaseSelect; /***/ }, -/* 18 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1503,9 +1505,9 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _AbsBaseSelect2 = __webpack_require__(17); + var _AbsBaseSelect2 = __webpack_require__(19); - var _DataTree = __webpack_require__(12); + var _DataTree = __webpack_require__(14); var _DataTree2 = _interopRequireDefault(_DataTree); @@ -1614,7 +1616,7 @@ exports.default = TreeSelect; /***/ }, -/* 19 */ +/* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1626,9 +1628,9 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - var _AbsBaseSelect = __webpack_require__(17); + var _AbsBaseSelect = __webpack_require__(19); - var _TreeSelect2 = __webpack_require__(18); + var _TreeSelect2 = __webpack_require__(20); var _TreeSelect3 = _interopRequireDefault(_TreeSelect2); @@ -1709,7 +1711,7 @@ exports.default = SingleTreeSelect; /***/ }, -/* 20 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1723,9 +1725,9 @@ var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; - var _AbsBaseSelect2 = __webpack_require__(17); + var _AbsBaseSelect2 = __webpack_require__(19); - var _NoTreeData = __webpack_require__(13); + var _NoTreeData = __webpack_require__(15); var _NoTreeData2 = _interopRequireDefault(_NoTreeData); diff --git a/assets/js/chat.js b/assets/js/chat.js index e541f8d..4e83512 100644 --- a/assets/js/chat.js +++ b/assets/js/chat.js @@ -28,7 +28,8 @@ window.confirm = function (message, callback, caption) { }; var SocketHandler = function () { - domain = domain.replace(':' + port, ''); + //TODO: получать порт с файла настроек + domain = domain.replace(':' + port, ':8888'); if (window.location.protocol == 'https:') { var ws = "wss://"; } else { @@ -112,6 +113,13 @@ var socket = new SocketHandler(); var csrftoken = getCookie('csrftoken'); +function updateCounts() { + var my_office = $('#my_office'); + var all_messages = $('.js-all-messages'); + my_office.html('0'); + all_messages.html('0'); +} + $(function () { function dialog (message, yesCallback, notCallback) { $("#dialog_delete .modal-title").html(message); @@ -146,6 +154,9 @@ function dialog (message, yesCallback, notCallback) { break; case 'tab2': + console.log("tab2"); + // /api/message?recipent__id=5 + updateCounts(); setTimeout(function () { if (liveHash.indexOf("#order") == 0) { var ordHashId = liveHash.replace("#order", ""); diff --git a/assets/js/src/create_worksell.js b/assets/js/src/create_worksell.js index e96f8e9..b16ce5e 100644 --- a/assets/js/src/create_worksell.js +++ b/assets/js/src/create_worksell.js @@ -2,6 +2,7 @@ import {fileUploadInit} from './seeds/file_upload' import {imageUploadInit} from './seeds/image_upload' import {scrollOnRequiredInit} from './seeds/scroll_on_required' import {showPopupsInit, addMessage} from './seeds/popups' +import {ajaxRegistrationInit} from './seeds/ajax_registration' $(function () { // fileUploadInit(); @@ -9,5 +10,6 @@ $(function () { imageUploadInit(); scrollOnRequiredInit(); showPopupsInit(); + ajaxRegistrationInit('contractor'); window.addMessage = addMessage; }); \ No newline at end of file diff --git a/assets/js/src/customer_project_create.js b/assets/js/src/customer_project_create.js index 89fc83f..0ac65d6 100644 --- a/assets/js/src/customer_project_create.js +++ b/assets/js/src/customer_project_create.js @@ -5,6 +5,7 @@ import {readMoreInit} from './seeds/read_more' import {onlyOneCheckboxInit} from './seeds/only_one_checkbox' import {showPopupsInit, addMessage} from './seeds/popups' import {scrollOnRequiredInit} from './seeds/scroll_on_required' +import {ajaxRegistrationInit} from './seeds/ajax_registration' import {print} from './seeds/test_seeds' function showHideRealry() { @@ -28,5 +29,6 @@ $(function () { onlyOneCheckboxInit('#safe', '#by_agreement'); scrollOnRequiredInit(); showPopupsInit(); + ajaxRegistrationInit('customer'); window.addMessage = addMessage; }); \ No newline at end of file diff --git a/assets/js/src/home_page.js b/assets/js/src/home_page.js new file mode 100644 index 0000000..db16370 --- /dev/null +++ b/assets/js/src/home_page.js @@ -0,0 +1,5 @@ +import {popupYoutubeInit} from './seeds/popup-youtube' + +$(function () { + popupYoutubeInit() +}); \ No newline at end of file diff --git a/assets/js/src/seeds/ajax_registration.js b/assets/js/src/seeds/ajax_registration.js new file mode 100644 index 0000000..fe9e483 --- /dev/null +++ b/assets/js/src/seeds/ajax_registration.js @@ -0,0 +1,67 @@ +const $form = $('#form-registration'); + +function clearErrors() { + let $error_tags = $form.find('.errorlist'); + if ($error_tags.length > 0) $error_tags.remove(); +} + +function sendData(form_data) { + // console.log("form_data = ", form_data); + $.ajax({ + url: '/users/register/', + type: 'post', + data: form_data, + success: function (data) { + // console.log("success data -->", data); + $('#registrationFormModal').modal('toggle'); + $('input[name=not_auth_user_id]').val(data.pk); + $('#not_customer').hide(); + $('#is_customer').show(); + }, + error: function (xhr, ajaxOptions, thrownError) { + let status = xhr.status; + if (status == 400) { + let data = JSON.parse(xhr.responseText); + $.each(data, function (key, value) { + let ul = $(""); + for (let error of value) { + ul.append(`
  • ${error}
  • `) + } + let $field; + if (key == 'captcha_html') { + // console.log("captcha html = ", key, '/', value); + $form.find('.captcha').html(value); + return; + } else if (key == 'captcha') { + $field = $form.find('.g-recaptcha'); + } else if (key == 'tos') { + $field = $form.find(`input[name=${key}]`).parent(); + } else { + $field = $form.find(`input[name=${key}]`); + if ($field.length == 0) console.log(`!!!field ${key} not found`); + } + if ($field.length > 0) $field.parent().append(ul); + + }); + // console.log('captcha error = ', data.captcha); + // console.log('data type = ', typeof data); + } + // console.log("data = ", xhr.responseText); + // console.log(ajaxOptions); + // console.log(thrownError); + } + }) +} + +function ajaxRegistrationInit(user_type) { + // const $form = $('#form-registration'); + $form.on("submit", function (e) { + e.preventDefault(); + // get form data and add user_type + clearErrors(); + let form_data = $form.serialize() + "&user_type=" + encodeURIComponent(user_type); + sendData(form_data); + }) +} + +export {ajaxRegistrationInit} \ No newline at end of file diff --git a/assets/js/src/seeds/popup-youtube.js b/assets/js/src/seeds/popup-youtube.js new file mode 100644 index 0000000..22d759b --- /dev/null +++ b/assets/js/src/seeds/popup-youtube.js @@ -0,0 +1,12 @@ +function popupYoutubeInit() { + $('.popup-youtube').magnificPopup({ + disableOn: 700, + type: 'iframe', + mainClass: 'mfp-fade', + removalDelay: 160, + preloader: false, + fixedContentPos: false + }); +} + +export {popupYoutubeInit} \ No newline at end of file diff --git a/assets/js/src/seeds/send_data.js b/assets/js/src/seeds/send_data.js index 29a9743..f069a4f 100644 --- a/assets/js/src/seeds/send_data.js +++ b/assets/js/src/seeds/send_data.js @@ -1,6 +1,17 @@ -function sendData(){ +function sendData(form_data) { + console.log("form_data = ", form_data); $.ajax({ - url: '', - + url: '/users/register/', + type: 'post', + data: form_data, + success: function (data) { + console.log("success data -->", data) + }, + error: function (xhr, ajaxOptions, thrownError) { + console.log("status = ", xhr.status); + console.log("data = ", xhr.responseText); + console.log(ajaxOptions); + console.log(thrownError); + } }) } \ No newline at end of file diff --git a/assets/lib/proekton-components/sass/parts/_select-box.sass b/assets/lib/proekton-components/sass/parts/_select-box.sass index 0708290..768b189 100644 --- a/assets/lib/proekton-components/sass/parts/_select-box.sass +++ b/assets/lib/proekton-components/sass/parts/_select-box.sass @@ -4,6 +4,9 @@ .select-box-container display: block + li, ul + margin: 0 + padding: 0 .select-box-header white-space: nowrap @@ -37,10 +40,6 @@ margin: 0 padding: 0 -.select-box-options li, ul - margin: 0 - padding: 0 - .select-box-options ul border-right: 1px solid #{map_get($component_colors, border)} diff --git a/assets/lib/proekton-components/sass/parts/_selected-container.sass b/assets/lib/proekton-components/sass/parts/_selected-container.sass index 07af5d8..fff89f4 100644 --- a/assets/lib/proekton-components/sass/parts/_selected-container.sass +++ b/assets/lib/proekton-components/sass/parts/_selected-container.sass @@ -4,7 +4,7 @@ min-height: 40px //padding-bottom: 20px .selected-element - padding: 5px 35px 5px 10px + padding: 7px 35px 3px 10px margin-top: 8px min-height: 45px background-color: #e3e3e3 @@ -19,6 +19,7 @@ text-overflow: ellipsis overflow: hidden width: 100% + display: block .header font-size: 7pt color: #676363 @@ -39,9 +40,9 @@ .horizontal &.selected-container //display: inline-block - .header, .name + //.header, .name //max-width: 300px - display: inline-block + //display: block .selected-element max-width: 300px display: inline-block \ No newline at end of file diff --git a/assets/sass/base/_fonts.sass b/assets/sass/base/_fonts.sass index be9d9e8..d740998 100644 --- a/assets/sass/base/_fonts.sass +++ b/assets/sass/base/_fonts.sass @@ -1,4 +1,4 @@ -$static : '/static' +$static: '/static' @font-face font-family: 'pfbeausanspro-reg' @@ -6,24 +6,39 @@ $static : '/static' font-weight: normal font-style: normal - @font-face font-family: 'pfbeausanspro-thin' src: url('#{$static}/fonts/PFBeauSansPro-Thin/PFBeauSansPro-Thin.eot?#iefix') format("embedded-opentype"), url('#{$static}/fonts/PFBeauSansPro-Thin/PFBeauSansPro-Thin.woff') format("woff"), url('#{$static}/fonts/PFBeauSansPro-Thin/PFBeauSansPro-Thin.ttf') format("truetype"), url('#{$static}/fonts/PFBeauSansPro-Thin/PFBeauSansPro-Thin.svg#PFBeauSansPro-Thin') format("svg") font-weight: normal font-style: normal - @font-face font-family: 'pfdintextcomppro-regular' src: url('#{$static}/fonts/PFDinTextCompPro-Regular/PFDinTextCompPro-Regular.eot?#iefix') format("embedded-opentype"), url('#{$static}/fonts/PFDinTextCompPro-Regular/PFDinTextCompPro-Regular.woff') format("woff"), url('#{$static}/fonts/PFDinTextCompPro-Regular/PFDinTextCompPro-Regular.ttf') format("truetype"), url('#{$static}/fonts/PFDinTextCompPro-Regular/PFDinTextCompPro-Regular.svg#PFDinTextCompPro-Regular') format("svg") font-weight: normal font-style: normal - @font-face font-family: 'Arial-MT-Regular' src: url('#{$static}/fonts/Arial-MT-Regular/Arial-MT-Regular.eot') src: url('#{$static}/fonts/Arial-MT-Regular/Arial-MT-Regular.eot?#iefix') format("embedded-opentype"), url('#{$static}/fonts/Arial-MT-Regular/Arial-MT-Regular.woff') format("woff"), url('#{$static}/fonts/Arial-MT-Regular/Arial-MT-Regular.ttf') format("truetype"), url('#{$static}/fonts/Arial-MT-Regular/Arial-MT-Regular.svg#Arial-MT-Regular') format("svg") font-weight: normal - font-style: normal \ No newline at end of file + font-style: normal + +@font-face + font-family: "Myriad" + src: url('#{$static}/fonts/MyriadPro/MyriadPro-Cond.otf') + font-weight: normal + font-style: normal + +@font-face + font-family: "Myriad" + src: url("#{$static}/fonts/MyriadPro/MyriadPro-BoldCond.otf") + font-weight: bold + font-style: normal + +@font-face + font-family: "Myriad" + src: url("#{$static}/fonts/MyriadPro/MyriadPro-CondIt.otf") + font-weight: normal + font-style: italic \ No newline at end of file diff --git a/assets/sass/components/custom-components.sass b/assets/sass/components/custom-components.sass index 7141ac2..7286af7 100644 --- a/assets/sass/components/custom-components.sass +++ b/assets/sass/components/custom-components.sass @@ -73,7 +73,11 @@ textarea.description font-weight: normal font-style: normal font-size: 14pt + display: inline-block + color: #000 &:hover + color: #000 + text-decoration: none box-shadow: 0 0 15px rgba(0, 0, 0, 0.2) -webkit-transform: scale(1.04) -moz-transform: scale(1.04) @@ -163,7 +167,7 @@ textarea.description .border flex: 1 1 auto - margin: 10px 0 0 25px + margin-top: 10px border-top: 1px solid #CFCFCF .btn-plus diff --git a/assets/sass/main.sass b/assets/sass/main.sass index bbd97df..5a00065 100644 --- a/assets/sass/main.sass +++ b/assets/sass/main.sass @@ -1,6 +1,8 @@ -@import "base/fonts.sass" -@import "base/colors.sass" +@import "base/fonts" +@import "base/colors" +@import "base/variavles" @import "common/parts" +@import "modules/mods" body font-size: 11pt @@ -39,34 +41,18 @@ body @extend %header max-width: 100% -// TODO: move to modules/_mods.sass -.mod-align-bottom - display: flex - //-ms-flex-align: center - //-webkit-align-items: center - //-webkit-box-align: center - align-items: flex-end - -.mod-align-center - display: flex - //-ms-flex-align: center - //-webkit-align-items: center - //-webkit-box-align: center - align-items: center - .logical-block $pad: 30px padding-top: $pad padding-bottom: $pad margin-top: $pad - border-top: 1px solid #{map_get($component_colors, border)} - border-bottom: 1px solid #{map_get($component_colors, border)} .select-text color: #{map_get($component_colors, select)} .slide display: none + margin-bottom: 20px .slide.active display: block diff --git a/assets/sass/modules/_mods.sass b/assets/sass/modules/_mods.sass index 261ac62..496a121 100644 --- a/assets/sass/modules/_mods.sass +++ b/assets/sass/modules/_mods.sass @@ -1,6 +1,24 @@ +.mod-align-bottom, .vertical-bottom + //deprecated + display: flex + -ms-flex-align: end + -webkit-align-items: flex-end + -webkit-box-align: end + align-items: flex-end + +.mod-align-center display: flex -ms-flex-align: center -webkit-align-items: center -webkit-box-align: center - align-items: flex-end \ No newline at end of file + align-items: center + +.mod-no-padding + padding: 0 !important + +.mod-row-eq-height + display: -webkit-box + display: -webkit-flex + display: -ms-flexbox + display: flex diff --git a/chat/chat.py b/chat/chat.py index 12a5d93..a26039b 100644 --- a/chat/chat.py +++ b/chat/chat.py @@ -1,7 +1,7 @@ import html import momoko -from settings import settings, PORT, DATABASE_DSN +from chat.settings.dev import settings, PORT, DATABASE_DSN from tornado import gen, web, websocket, escape from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop diff --git a/chat/settings/base.py b/chat/settings/base.py new file mode 100644 index 0000000..8600671 --- /dev/null +++ b/chat/settings/base.py @@ -0,0 +1,16 @@ +import os + +PORT = 8888 + +settings = { + 'cookie_secret': '__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__', + 'template_path': os.path.join(os.path.dirname(__file__), 'templates'), + 'static_path': os.path.join(os.path.dirname(__file__), 'static'), + 'login_url': '/login', + 'xsrf_cookies': True, + 'debug': True, + 'autoreload': True, + 'server_traceback': True, +} + +DATABASE_DSN = 'dbname=archilance user=postgres password=postgres host=localhost' diff --git a/chat/settings/dev.py b/chat/settings/dev.py new file mode 100644 index 0000000..b095fbd --- /dev/null +++ b/chat/settings/dev.py @@ -0,0 +1,6 @@ +from .base import * + +try: + from .local import * +except ImportError: + pass diff --git a/chat/templates/chat_contractor.html b/chat/templates/chat_contractor.html index 60de835..85860e3 100644 --- a/chat/templates/chat_contractor.html +++ b/chat/templates/chat_contractor.html @@ -17,15 +17,18 @@ @@ -40,29 +43,7 @@

    Контакты

    {% for contact in contacts_users %} -
    -
    - {% thumbnail contact.avatar "60x60" crop="center" as im %} - mess-image - {% endthumbnail %} -
    -

    - {% if contact.is_contractor %} - {% url "users:contractor-profile" pk=contact.pk as contact_url %} - {% else %} - {% url "users:customer-profile-open-projects" pk=contact.pk as contact_url %} - {% endif %} - -

    {{ contact.username }}
    -

    - - Контакты - - {% get_new_count_for_contact contact request.user %} - - Удалить контакт - -
    + {% include 'inc-contact-card.html' %} {% endfor %}
    @@ -74,12 +55,13 @@ - +
    - -

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

    + +

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

    отправить @@ -89,29 +71,30 @@
    -

    Прикрепленные документы

    -
      -
    - - Распечатать с помощью ресурса - -
    +

    Прикрепленные документы

    + + + Распечатать с помощью ресурса + +
    -

    Для заметок

    - - +

    Для заметок

    + + - - сохранить + + сохранить
    - + {% include 'contact-info.html' %} - +
    @@ -123,12 +106,15 @@

    Заказы

    {% for order in orders %}
    + id="orderBlock{{ order.id }}" + data-team-id="{% if order.team %}{{ order.team.pk }}{% else %}0{% endif %}" + data-recipent-id="{{ order.project.customer.pk }}" data-id="{{ order.id }}">

    {{ order }}

    - + Исполнитель: {{ request.user.get_full_name }}

    @@ -143,17 +129,17 @@ {% if archive_orders %} @@ -183,11 +170,12 @@ - +
    - -

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

    + +

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

    @@ -218,28 +206,28 @@
    -

    3 / Выполнение работы

    -

    - Процесс выполнения задания в заказе до получения +

    3 / Выполнение работы

    +

    + Процесс выполнения задания в заказе до получения заказчиком итогового результата работы. -

    +

    -
    +
    @@ -250,12 +238,12 @@
    -

    Прикрепленные документы

    -
      - - Распечатать с помощью ресурса - -
      +

      Прикрепленные документы

      + + + Распечатать с помощью ресурса + +
      - -
      -
      -
      -

      Заказы

      - {% for torder in team_orders %} -
      - -

      - {{ torder }} + +

      +
      +
      +

      Заказы

      + {% for torder in team_orders %} +
      + +

      + {{ torder }} +

      +
      +

      + + + Исполнитель: {{ torder.team.name }}

      -
      -

      - - - Исполнитель: {{ torder.team.name }} -

      -
        - {% for tuser in torder.team.users.all %} -
      • {{ tuser }}
      • - {% endfor %} -
      -

      - Чаты: - {% if request.user.pk != torder.team.owner.pk %} - {{ torder.team.owner.username }} - {% endif %} - {% for tuser in torder.team.contractors.all %} - {% if request.user.pk != tuser.pk %} - {{ tuser.username }} - {% endif %} - {% endfor %} -

      - - - Полное описание заказа - -
      +
        + {% for tuser in torder.team.users.all %} +
      • {{ tuser }}
      • + {% endfor %} +
      +

      + Чаты: + {% if request.user.pk != torder.team.owner.pk %} + {{ torder.team.owner.username }} + {% endif %} + {% for tuser in torder.team.contractors.all %} + {% if request.user.pk != tuser.pk %} + {{ tuser.username }} + {% endif %} + {% endfor %} +

      + + + Полное описание заказа +
      - {% endfor %} +
      + {% endfor %} - {% for yteam in your_teams %} -
      - -

      - {{ yteam }} + {% for yteam in your_teams %} +

      + +

      + {{ yteam }} +

      +
      +

      + + Владелец группы: {{ yteam.owner }} +

      +
        + {% for tuser in yteam.contractors.all %} +
      • {{ tuser }}
      • + {% endfor %} +
      +

      + Чаты: + {% if request.user.pk != torder.team.owner.pk %} + {{ yteam.owner.username }} + {% endif %} + {% for tuser in yteam.contractors.all %} + {% if request.user.pk != tuser.pk %} + {{ tuser.username }} + {% endif %} + {% endfor %}

      -
      -

      - - Владелец группы: {{ yteam.owner }} -

      -
        - {% for tuser in yteam.contractors.all %} -
      • {{ tuser }}
      • - {% endfor %} -
      -

      - Чаты: - {% if request.user.pk != torder.team.owner.pk %} - {{ yteam.owner.username }} - {% endif %} - {% for tuser in yteam.contractors.all %} - {% if request.user.pk != tuser.pk %} - {{ tuser.username }} - {% endif %} - {% endfor %} -

      -
      +
      - {% endfor %} -
      + {% endfor %}
      -
      -
      -
      - - - - - - - - -
      -
      - -

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

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

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

      +
      +
      +
      - -
      - + +
      +
      -

      Прикрепленные документы

      -
        - - Распечатать с помощью ресурса - -
        +

        Прикрепленные документы

        +
          + + Распечатать с помощью ресурса + +
            @@ -400,12 +395,12 @@
          -
          - - - {% include 'order_info.html' %} - +
          + + + {% include 'order_info.html' %} +
          {% include 'partials/footer.html' %}
          @@ -414,12 +409,12 @@ {% endblock %} {% block js_block %} - - - + + {% endblock %} diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html index 9755e5a..0f65f65 100644 --- a/chat/templates/chat_customer.html +++ b/chat/templates/chat_customer.html @@ -35,35 +35,7 @@

          Контакты

          {% for contact in contacts_users %} -
          -
          - {% if contact.avatar %} - {% thumbnail contact.avatar "60x60" crop="center" as im %} - mess-image - {% endthumbnail %} - {% else %} - mess-image - {% endif %} -
          -

          - {% if contact.is_contractor %} - {% url "users:contractor-profile" pk=contact.pk as contact_url %} - {% else %} - {% url "users:customer-profile-open-projects" pk=contact.pk as contact_url %} - {% endif %} -

          -

          - - Контакты - - - {% get_new_count_for_contact contact request.user %} - - - Удалить контакт - -
          + {% include 'inc-contact-card.html' %} {% endfor %}
          @@ -127,7 +99,8 @@

          Заказы

          {% for order in orders %}
          {{ order }}

          - + Исполнитель: {% if order.order.contractor %} {{ order.order.contractor.get_full_name }} @@ -152,9 +126,9 @@ Полное описание заказа -{# #} -{# Удалить заказ#} -{# #} + {# #} + {# Удалить заказ#} + {# #}

          @@ -164,17 +138,17 @@ {% if archive_projects %} diff --git a/chat/templates/inc-contact-card.html b/chat/templates/inc-contact-card.html new file mode 100644 index 0000000..fc3abbe --- /dev/null +++ b/chat/templates/inc-contact-card.html @@ -0,0 +1,56 @@ +{% load thumbnail %} +{% load static %} +{% load user_tags %} + +
          +
          + {% if contact.avatar %} + {% thumbnail contact.avatar "60x60" crop="center" as im %} + mess-image + {% endthumbnail %} + {% else %} + mess-image + {% endif %} +
          +

          + {% if contact.is_contractor %} + {% url "users:contractor-profile" pk=contact.pk as contact_url %} + {% else %} + {% url "users:customer-profile-open-projects" pk=contact.pk as contact_url %} + {% endif %} +

          + {% if request.user.is_contractor %} +
          + {% else %} +
          + {% endif %} + {{ contact.username }} +
          +

          + + Контакты + + {% get_new_count_for_contact contact request.user %} + + Удалить контакт + +
          \ No newline at end of file diff --git a/common/forms.py b/common/forms.py index 4d93dc2..3cff870 100644 --- a/common/forms.py +++ b/common/forms.py @@ -46,13 +46,15 @@ class CustomRegistrationForm(RegistrationFormTermsOfService): captcha = ReCaptchaField() def __init__(self, *args, **kwargs): - self.request = kwargs.pop('request') - super().__init__(*args, **kwargs) - - if self.request.GET.get('type') == 'customer': - self.fields['user_type'].initial = 'customer' - elif self.request.GET.get('type') == 'contractor': - self.fields['user_type'].initial = 'contractor' + try: + self.request = kwargs.pop('request') + super().__init__(*args, **kwargs) + if self.request.GET.get('type') == 'customer': + self.fields['user_type'].initial = 'customer' + elif self.request.GET.get('type') == 'contractor': + self.fields['user_type'].initial = 'contractor' + except KeyError: + super().__init__(*args, **kwargs) attrs = self.fields['user_type'].widget.attrs attrs['class'] = _.join(_.compact((attrs.get('class'), 'selectpicker3')), ' ') diff --git a/common/mixins.py b/common/mixins.py index f3b0433..f3aa9ab 100644 --- a/common/mixins.py +++ b/common/mixins.py @@ -1,8 +1,13 @@ +import json + +from django.http import HttpResponse from django.contrib.auth.mixins import LoginRequiredMixin +from django.contrib.auth import login from django.core.exceptions import PermissionDenied from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt from django.views.generic import View +from django.template import RequestContext, loader class NoCsrfMixin(View): @@ -25,3 +30,37 @@ class ContractorRequiredMixin(LoginRequiredMixin, View): return super().dispatch(request, *args, **kwargs) else: raise PermissionDenied + + +class AjaxUserAuthMixin: + """ + Mixin to add AJAX support to a form. + Must be used with an object-based FormView (e.g. CreateView) + """ + + def render_to_json_response(self, context, **response_kwargs): + user_form = self.form_class() + captcha_html = loader.render_to_string('partials/inc-captcha.html', {"user_form": user_form}) + context.update({"captcha_html": captcha_html}) + data = json.dumps(context, ensure_ascii=False) + response_kwargs['content_type'] = 'application/json' + return HttpResponse(data, **response_kwargs) + + def form_invalid(self, form): + response = super().form_invalid(form) + if self.request.is_ajax(): + return self.render_to_json_response(form.errors, status=400) + else: + return response + + def form_valid(self, form): + if self.request.is_ajax(): + new_user = self.register(form) + data = { + 'pk': new_user.pk, + } + + return self.render_to_json_response(data) + else: + response = super().form_valid(form) + return response diff --git a/common/templatetags/__init__.py b/common/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/common/templatetags/common_tags.py b/common/templatetags/common_tags.py index 28e7f56..27712f3 100644 --- a/common/templatetags/common_tags.py +++ b/common/templatetags/common_tags.py @@ -148,4 +148,11 @@ def get(dic, key): return dic.get(key) +@register.filter +def max_count(value, max_value): + value = int(value) or 0 + if value > max_value: + return '99+' + return str(value) + # import code; code.interact(local=dict(globals(), **locals())) diff --git a/common/views.py b/common/views.py index bc66f7d..d7de626 100644 --- a/common/views.py +++ b/common/views.py @@ -12,7 +12,7 @@ from sorl.thumbnail import get_thumbnail from archilance import util from archilance.mixins import BaseMixin -from common.mixins import NoCsrfMixin +from common.mixins import NoCsrfMixin, AjaxUserAuthMixin from users.models import ContractorResume from .forms import PrintOrderForm, CustomRegistrationForm from .models import PrintDocuments, PrintOrder, Settings, LiveImageUpload @@ -110,7 +110,7 @@ class LiveImageUploadDeleteView(NoCsrfMixin, LoginRequiredMixin, View): return JsonResponse({'status': 'error'}) -class CustomRegistrationView(RegistrationView): +class CustomRegistrationView(AjaxUserAuthMixin, RegistrationView): form_class = CustomRegistrationForm template_name = 'registration/registration_form.html' success_url = reverse_lazy('registration_complete') diff --git a/context_processors/user_info.py b/context_processors/user_info.py new file mode 100644 index 0000000..089fb6a --- /dev/null +++ b/context_processors/user_info.py @@ -0,0 +1,26 @@ +# from django.core.context_processors import request +from django.db.models import Sum +from wallets.models import InvoiceHistory +from chat.models import NewMessage +from projects.models import Order + + +def user_info(request): + if request.user.is_authenticated(): + current_sum_info = InvoiceHistory.objects.filter(user=request.user, type="score").aggregate(Sum('sum')) + user_balance = current_sum_info['sum__sum'] or 0 + + new_messages_count = NewMessage.objects.filter(user=request.user).count() + num_orders_in_work = request.user.orders.filter(status='process').count() + try: + fist_order_id = request.user.orders.all()[0].id + except IndexError: + fist_order_id = "" + return { + "user_balance": user_balance, + "new_messages_count": new_messages_count, + "num_orders_in_work": num_orders_in_work, + "fist_order_id": fist_order_id + } + + return {} diff --git a/projects/signals.py b/projects/signals.py index f03f9bc..6a68700 100644 --- a/projects/signals.py +++ b/projects/signals.py @@ -2,7 +2,7 @@ from django.db.models.signals import post_save from django.dispatch import receiver from django.utils import timezone -from .models import Stage +from .models import Stage, Order @receiver(post_save, sender=Stage) diff --git a/projects/templates/customer_project_create.html b/projects/templates/customer_project_create.html index 16ec958..bc6e0a1 100644 --- a/projects/templates/customer_project_create.html +++ b/projects/templates/customer_project_create.html @@ -9,11 +9,11 @@ - {% endblock %} {% block content %} {% include 'partials/modals/project_work_type_suggestion.html' %} + {% include 'partials/modals/modal-registration_form.html' %} {% include 'partials/header.html' %}
          @@ -53,6 +53,7 @@
          +
           
          Нет нужной специальности хочу добавить @@ -266,16 +267,15 @@
          - {#
          #} - {#
          #} - {#
          #} - {#
          #} - {#
          #} - {#
          #} - {#
          #} - -
          +
          +
          +
          +
          +
          +
          +
          +
          -
          +
          +
          +
          +
          +
          +
          +
          +
          -
          +
          - diff --git a/projects/views.py b/projects/views.py index 9d4bbe6..3ba92be 100644 --- a/projects/views.py +++ b/projects/views.py @@ -62,6 +62,7 @@ from .forms import ( from specializations.models import Specialization from common.models import Location +from common.forms import CustomRegistrationForm _.map = _.map_ _.filter = _.filter_ @@ -115,6 +116,7 @@ class ProjectDetailWithAnswerView(BaseMixin, View): return render(request, self.template_name, context) def post(self, request, *args, **kwargs): + # @Отклик на Проект(Project) if request.user.is_authenticated() and request.user.is_contractor(): context = self.get_context_data(**kwargs) answer_as_team = None @@ -137,6 +139,7 @@ class ProjectDetailWithAnswerView(BaseMixin, View): else: form = self.form_class(request.POST, request=request, project=project) + # FIXME: еще раз находим проект? project = get_object_or_404(Project, pk=kwargs.get('pk')) context.update({'project': project}) @@ -490,11 +493,18 @@ class CustomerProjectCreateView(BaseMixin, View): work_type_suggestion_form = ProjectWorkTypeSuggestionForm template_name = 'customer_project_create.html' - def dispatch(self, request, *args, **kwargs): - if request.user.is_authenticated() and request.user.is_customer(): - return super().dispatch(request, *args, **kwargs) - else: - raise PermissionDenied + # def dispatch(self, request, *args, **kwargs): + # if request.user.is_authenticated() and request.user.is_customer(): + # return super().dispatch(request, *args, **kwargs) + # else: + # raise PermissionDenied + + def get_context_data(self, **kwargs): + ctx = super().get_context_data() + # ctx['hide_user_type'] = False + user_form = CustomRegistrationForm() + ctx['user_form'] = user_form + return ctx def get(self, request, *args, **kwargs): context = self.get_context_data(**_.merge({}, request.GET, kwargs)) @@ -518,13 +528,20 @@ class CustomerProjectCreateView(BaseMixin, View): realty = form.cleaned_data.get('realty') if realty: + print("Has Realty") realty_form = self.realty_form(request.POST, instance=realty, request=request, prefix='realty_form') else: + print("Create new Realty") realty_form = self.realty_form(request.POST, request=request, prefix='realty_form') if form.is_valid() and realty_form.is_valid(): project = form.save(commit=False) - project.customer = request.user + unregister_user = request.POST.get('not_auth_user_id') + if unregister_user: + user = get_object_or_404(User, pk=unregister_user) + else: + user = request.user + project.customer = user project.save() form.save_m2m() @@ -533,14 +550,13 @@ class CustomerProjectCreateView(BaseMixin, View): for file in request.FILES.getlist('new_files'): ProjectFile.objects.create(file=file, project=project) - if realty: - realty_form.save() - else: + if not realty: realty = realty_form.save(commit=False) - realty.user = request.user - print('new_realty_name = ', request.POST.get('new_realty_name')) + realty.user = user if not request.POST.get('new_realty_name'): + print("Virtual!") realty.is_virtual = True + print("Set realty name -->", request.POST.get('new_realty_name')) realty.name = request.POST.get('new_realty_name') realty.save() realty_form.save_m2m() @@ -566,6 +582,10 @@ class CustomerProjectCreateView(BaseMixin, View): context = self.get_context_data(**kwargs) context.update({'form': form, 'realty_form': realty_form}) + + unregister_user = request.POST.get('not_auth_user_id') + if unregister_user: + context.update({'unregister_user': unregister_user}) return render(request, self.template_name, context) @@ -832,6 +852,7 @@ class CustomerOfferOrderView(View): template_name = 'chattest.html' def post(self, request, *args, **kwargs): + # @ Утверждение Исполнителя project_id = kwargs.get('project_id') answer_id = kwargs.get('answer_id') try: @@ -848,12 +869,14 @@ class CustomerOfferOrderView(View): if not order.contractor and not order.team: if isinstance(answer.author, User): order.contractor = answer.author - order.save() - status = True + # order.status = 'process' + # order.save() + # status = True elif isinstance(answer.author, Team): order.team = answer.author - order.save() - status = True + order.status = 'process' + order.save() + status = True if status: hs_rating = HistoryRating() hs_rating.user = request.user diff --git a/reviews/signals.py b/reviews/signals.py index e47f225..ce50ce9 100644 --- a/reviews/signals.py +++ b/reviews/signals.py @@ -23,6 +23,7 @@ def add_rating_review(sender, instance, created, **kwargs): hs_rating.save() count_reviews = Review.objects.filter(project=instance.project).count() + print("count_reviews = ", count_reviews) if count_reviews == 2: order = instance.project.order order.status = 'completed' diff --git a/templates/home.html b/templates/home.html index a0f08a1..cc83296 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,100 +1,150 @@ {% extends 'partials/base.html' %} +{% load staticfiles %} +{% load sass_tags %} +{% load thumbnail %} +{% block old_css %}{% endblock %} +{% block head_css %} + + + +{% endblock %} {% block content %} -
          - {% include 'partials/header.html' %} - -
          -
          -

          {{ main_settings.heading }}

          -
          -
          - -
          -
          -
          -
          + {% include 'partials/header.html' %} +
          +
          +
          +
          +

          {{ main_settings.heading }}

          +
          +
          + +
          +
          +
          {% if request.user.is_authenticated and request.user.is_customer %} - Я заказчик + Я заказчик {% else %} - Я заказчик + Я заказчик {% endif %} -

          - {{ main_settings.customer_text|safe }} +

          +

            +
          • +
            +
            + Ресурс для специалистов по проектированию, дизайну, оформлению и сопровождению + проектной документации +
            +
          • +
          • +
            +
            + Удобный и быстрый поиск исполнителей +
            +
          • +
          • +
            +
            + Готовые сформированные группы исполнителей +
            +
          • +
          • +
            +
            + Безопасная сделка (договор без риска) +
            +
          • +
          • +
            +
            + Адекватная оценка стоимости работы +
            +
          • +
          • +
            +
            + Возможность купить готовые проекты, работы +
            +
          • +

          -
          -
          -
          -
          -
          - +
          +
          {% if request.user.is_authenticated and request.user.is_contractor %} - Я исполнитель + Я + исполнитель {% else %} - Я исполнитель + Я + исполнитель {% endif %} -

          - {{ main_settings.contractor_text|safe }} +

          +

            +
          • +
            +
            + Большой выбор заказов для исполнителей +
            +
          • +
          • +
            +
            + Удобный и быстрый поиск заказчиков +
            +
          • +
          • +
            +
            + Безопасная сделка (договор без риска) +
            +
          • +
          • +
            +
            + Печать, брошюровка и доставка проектной документации +
            +
          • +
          • +
            +
            + Возможность продать готовые проекты, работы +
            +
          • +
          • +
            +
            + Платформа разработана для проектировщиков дизайнеров и технических заказчиков +
            +
          • +

          -
          - -
          - -
          -
          - -
          -
          - -
          -
          - -{# #} -{# #} -
          -
          -
          + Разместить проект +
          +
          + +
          +
          + + +
          +
          + + +
          +
          + {% include 'partials/footer.html' %} +
          +
          {% endblock %} +{% block old_js %} + +{% endblock %} {% block js_block %} - + {{ block.super }} + + {% endblock %} diff --git a/templates/partials/base.html b/templates/partials/base.html index 0f7d67e..5a506e4 100644 --- a/templates/partials/base.html +++ b/templates/partials/base.html @@ -1,4 +1,5 @@ -{% load staticfiles %} + +{% load staticfiles %} {#{% load compress %}#} @@ -14,7 +15,6 @@ {# {% compress css %}#} {% block old_css %} - @@ -22,13 +22,14 @@ - {% endblock %} {% block common_css %} + + {% endblock %} {% block head_css %} @@ -76,7 +77,7 @@ {% block common_js %} -{# #} + {# #} {% endblock %} {#{% compress js %}#} {% block old_js %} @@ -98,14 +99,37 @@ - + +{% endblock %} + +{% block ws_block %} + {% endblock %} diff --git a/templates/partials/header.html b/templates/partials/header.html index 6bbe587..e5193ac 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -3,161 +3,183 @@ {% load user_tags %} {% load activeurl %} {% load sass_tags %} +{% load common_tags %} {% if request.user.is_contractor %} - {% url 'users:contractor-profile' pk=request.user.pk as profile_url %} + {% url 'users:contractor-profile' pk=request.user.pk as profile_url %} {% elif request.user.is_customer %} - {% url 'users:customer-profile-open-projects' pk=request.user.pk as profile_url %} + {% url 'users:customer-profile-open-projects' pk=request.user.pk as profile_url %} {% endif %} - -
          -
          +
          +
          -
          - + - +
          + +
          {% activeurl %} - {% if request.user.is_authenticated %} -
          -
          - {% else %} - - {% endif %} + {% endactiveurl %}
          -
          +
          \ No newline at end of file diff --git a/templates/partials/inc-captcha.html b/templates/partials/inc-captcha.html new file mode 100644 index 0000000..06d211c --- /dev/null +++ b/templates/partials/inc-captcha.html @@ -0,0 +1,3 @@ +{{ form.captcha }} +{{ user_form.captcha }} +{{ form.captcha.errors }} \ No newline at end of file diff --git a/templates/partials/inc-registration_form.html b/templates/partials/inc-registration_form.html new file mode 100644 index 0000000..a94bd34 --- /dev/null +++ b/templates/partials/inc-registration_form.html @@ -0,0 +1,61 @@ +{% load sass_tags %} + + +
          +
          {% csrf_token %} + {{ form.non_field_errors }} + + {% if not hide_user_type %} +
          + {{ form.user_type }} + {{ form.user_type.errors }} +
          + {% endif %} + +
          + + {{ form.username.errors }} +
          +
          + + {{ form.email.errors }} +
          +
          + + {{ form.password1.errors }} +
          + +
          + + {{ form.password2.errors }} +
          + +
          + {% include 'partials/inc-captcha.html' %} +
          +
          + +
          +
          + + {% include 'registration/social.html' %} + +
          +
          + +

          Регистрируясь, я подтверждаю свое согласие у условиями пользовательского соглашения +

          + {{ form.tos.errors }} +
          +
          +
          + + +
          \ No newline at end of file diff --git a/templates/partials/modals/modal-registration_form.html b/templates/partials/modals/modal-registration_form.html new file mode 100644 index 0000000..b8f69f0 --- /dev/null +++ b/templates/partials/modals/modal-registration_form.html @@ -0,0 +1,19 @@ + diff --git a/templates/partials/sass/footer.sass b/templates/partials/sass/footer.sass index 34e0e32..0476f6f 100644 --- a/templates/partials/sass/footer.sass +++ b/templates/partials/sass/footer.sass @@ -7,6 +7,9 @@ footer width: 300px height: 3px background-color: black + ul + margin: 0 + padding: 0 .logoF @@ -88,4 +91,7 @@ footer &:link, &:visited font-family: 'Arial-MT-Regular', sans-serif color: #6c6c6c - font-size: 15px \ No newline at end of file + font-size: 15px + &:hover + text-decoration: none + color: #383838 \ No newline at end of file diff --git a/templates/partials/sass/header.sass b/templates/partials/sass/header.sass index 83f0788..7fc4ff5 100644 --- a/templates/partials/sass/header.sass +++ b/templates/partials/sass/header.sass @@ -1,393 +1,340 @@ -$static: '/static' +@import "base/variavles" -.wrTop - width: 100% - background-color: black -.topMain - width: 1200px - margin: 0 auto - .col-lg-7 - width: 55% - .col-lg-2 - width: 19% - .mainMenu li - padding-right: 25px - a - font-size: 15px -.welcomeMain - width: 100% - float: left - font-size: 48px - text-align: center - padding: 54px 0 39px 0 - font-family: 'pfbeausanspro-thin', sans-serif - -.welcomeMain - line-height: 48px - font-family: 'pfdintextcomppro-regular', sans-serif - font-size: 43px - -.logo - width: 183px - height: 36px - background: url('#{$static}/img/logo.png') no-repeat center +%icons + content: '' + display: inline-block + vertical-align: middle + margin-right: 5px background-size: cover - float: left - margin: 18px 0 21px 10px - cursor: pointer -.mainMenu - float: left - margin: 26px 0 0 0 - li +header + font-size: 11pt + ul + padding-left: 0 + margin: 0 + background-color: #000 + color: #FFF + .logo float: left - position: relative - padding-right: 30px - list-style: none - a - text-decoration: none - border-bottom: 3px solid transparent - -webkit-transition: all 0.4s ease-out - -moz-transition: all 0.4s ease-out - transition: all 0.4s ease-out - &:hover a - border-color: #ff0029 - span - content: '' - position: absolute - height: 23px - left: 0 - top: -1px - .icon_tm1 span - width: 26px - //background: url('../img/listMain.png') no-repeat left - background-size: cover - background: url('#{$static}/img/listMain.png') no-repeat 0 0 - .icon_tm2 span - width: 22px - background-size: cover - background: url('#{$static}/img/listMain.png') no-repeat -26px 0 - .icon_tm3 span - width: 24px - background-size: cover - background: url('#{$static}/img/listMain.png') no-repeat -48px 0 - - .icon_tml span - content: '' - position: absolute - width: 27px - height: 24px - //left: -35px - top: 0 - background: url('#{$static}/img/list4.png') no-repeat center !important - background-size: cover !important - -.icon_tml:hover span - background: url('#{$static}/img/list4tml.png') no-repeat center !important - background-size: cover !important - -.icon_tm1:hover span - width: 26px - background: url('#{$static}/img/listMain2.png') no-repeat left !important - background-size: cover - background-position: 0 0 !important - -.icon_tm2:hover span - width: 22px - background: url('#{$static}/img/listMain2.png') no-repeat left !important - background-size: cover - background-position: -26px 0 !important - -.icon_tm3:hover span - width: 26px !important - background: url('#{$static}/img/listMain2.png') no-repeat left !important - background-size: cover - background-position: -49px 0 !important - -.rating - width: 46px - height: 46px - float: right - border-radius: 100% - background-color: #4D4D4D - margin: 15px 0 0 10px - position: relative - -.ratingInset - width: 46px - height: 46px - border-radius: 100% - background-color: #FF0027 - position: absolute - /*left:-1.859px;*/ - /*bottom: 3px;*/ - clip: rect(0, 22px, 50px, 0) - transform: rotate(-90deg) - -.iconRating - width: 100% - height: 100% - position: absolute - left: 0 - top: 0 - background: url('#{$static}/img/button12.png') no-repeat center - -.ratingPer - color: #ff2c2c - font-size: 18px - font-family: 'pfdintextcomppro-regular', sans-serif - float: right - margin: 28px 0 0 9px - cursor: pointer - -.mainMenu li - &:last-child - padding-right: 0 - a - color: white - font-size: 18px - padding: 30px 0 27px 40px - font-family: 'pfbeausanspro-reg', sans-serif - &.active > a - border-color: #ff0029 - &.icon_tm1.active span - background: url('#{$static}/img/listMain2.png') no-repeat !important - &.officeList.active span - background: url('#{$static}/img/list4tml.png') no-repeat center !important - &.icon_tm2.active span - background: url('#{$static}/img/listMain2.png') no-repeat center !important - &.icon_tm3.active span - background: url('#{$static}/img/listMain2.png') no-repeat right !important - -li.officeList.icon_tml > a > p - display: inline-block - padding: 5px 7px 3px 7px - background: #ff0000 - border-radius: 35px - position: absolute - right: -34px - top: -4px - -.changeBlock - width: 485px - overflow: hidden - padding: 113px 0 0 0 - position: relative - &a - border: none - cursor: pointer - height: 40px - border-radius: 40px - font-size: 20px - text-transform: uppercase - font-family: 'pfdintextcomppro-regular', sans-serif - letter-spacing: 4px - position: relative - top: -60px - display: table - margin: auto - -.changeBlock1 - float: left - margin-left: -15px - background-color: rgba(255, 0, 6, 0.7) - &a - &:link, - &:visited - background: url('#{$static}/img/button1.png') no-repeat 25px, black - color: white - padding: 24px 26px 20px 72px + height: 75px + display: flex + align-items: center -.changeBlock2 - float: right - margin-right: -15px - background-color: rgba(0, 0, 0, 0.7) - &a - &:link, - &:visited - background: url('#{$static}/img/button2.png') no-repeat 27px, white - color: black - padding: 24px 26px 20px 72px - -.changeBlock - p - font-family: 'Arial-MT-Regular', sans-serif + .menu-nav + display: flex + justify-content: center + //align-items: center + height: 75px + a, a:hover + color: #FFF + text-decoration: none + padding-left: 4px + .menu-items + display: inline-flex + .count + display: inline-block + color: red + font-family: 'pfbeausanspro-reg', sans-serif + background: none + border-radius: 0 + position: inherit + padding-left: 5px + padding-bottom: 0 + line-height: 1em + line-break: auto + li + list-style: none + a + display: flex + align-items: center -.changeBlock1 - p - color: white + height: 75px + margin-right: 20px + cursor: pointer + border-bottom: 3px solid black + pointer-events: stroke + .icon_tm1 a:before + @extend %icons + width: 26px + height: 26px + background: url('#{$static}/img/listMain.png') no-repeat 0 0 + .icon_tm2 a:before + @extend %icons + width: 22px + height: 22px + background: url('#{$static}/img/listMain.png') no-repeat -26px 0 + .icon_tm3 a:before + @extend %icons + width: 24px + height: 24px + background: url('#{$static}/img/listMain.png') no-repeat -48px 0 + .icon_tml a:before + @extend %icons + width: 27px + height: 24px + background: url('#{$static}/img/list4.png') no-repeat center -.changeBlock2 - p - color: black + .icon_tml a:hover + border-bottom: 3px solid red + &:before + background: url('#{$static}/img/list4tml.png') no-repeat center + background-size: cover + .icon_tm1 a:hover + border-bottom: 3px solid red + &:before + background-size: cover + width: 26px + background: url('#{$static}/img/listMain2.png') no-repeat 0 0 + .icon_tm2 a:hover + border-bottom: 3px solid red + &:before + width: 22px + background-size: cover + background: url('#{$static}/img/listMain2.png') no-repeat -26px 0 -.changeBlock - min-height: 500px - display: table - padding: 143px 20px 120px 20px - &:after - content: '' - position: absolute - width: 66px - height: 1px - left: 50% - margin-left: -30px - background-color: white - bottom: 60px + .icon_tm3 a:hover + border-bottom: 3px solid red + &:before + background: + image: url('#{$static}/img/listMain2.png') + repeat: no-repeat + position: -50px 0 + background-size: cover + .user-nav + float: right + height: 75px + .user-items + display: flex + align-items: center + li + display: inline-block + .user-info + vertical-align: middle + padding-right: 5px + a + display: block + color: white + cursor: pointer + &:hover + text-decoration: none + color: #FF0029 + .cash + text-align: right + padding-top: 4px + .icon_hand + padding-left: 26px + background: + image: url("#{$static}/img/icons/icon_hands.png") + size: 24px 24px + repeat: no-repeat + &:hover + background-image: url("#{$static}/img/icons/icon_hands_red.png") + .icon_chat + margin-top: 4px + padding-left: 26px + background: + image: url("#{$static}/img/icons/icon_speach-ball.png") + size: 18px 18px + repeat: no-repeat + &:hover + background-image: url("#{$static}/img/icons/icon_speach-ball_red.png") + .imgProfile + margin: 0 //глушим main.css + img + width: 75px + height: 75px + .reg, .reg:link, .reg:visited + color: #fb1818 + font-size: 16px + text-transform: uppercase + float: left + line-height: 75px + font-family: 'pfdintextcomppro-regular', sans-serif + letter-spacing: 4px + text-decoration: none -.changeBlock2 - float: right - margin-right: -15px - background-color: rgba(0, 0, 0, 0.7) + .lock + width: 75px + height: 75px + background: url('#{$static}/img/lock.png') no-repeat center, white + float: right + cursor: pointer + margin-left: 20px + margin-right: 0 + .rating + display: flex + align-items: center + position: relative + cursor: pointer + margin-left: 10px -.square - width: 46px - height: 46px - position: absolute - right: -23px - top: 100px - z-index: 9 - -webkit-transform: rotate(135deg) - -moz-transform: rotate(135deg) - transform: rotate(135deg) - background-color: #DCDCDD + .ratingInset + width: 46px + height: 46px + border-radius: 100% + background-color: #FF0027 + display: inline-block + /* position: absolute; */ + /* left: -1.859px; */ + /* bottom: 3px; */ + clip: rect(0, 22px, 50px, 0) + transform: rotate(-90deg) - .insetSquare - width: 100% - height: 100% - position: relative - -webkit-transform: rotate(-135deg) - -moz-transform: rotate(-135deg) - transform: rotate(-135deg) - background: url('#{$static}/img/arrow.png') no-repeat center + .iconRating + width: 46px + height: 46px + position: absolute + left: 0 + top: 0 + background: url('#{$static}/img/button12.png') no-repeat center -.imgProfile - width: 75px - height: 75px - float: right - margin: 0 0 0 -60px - img - display: block - width: 100% - height: 100% + .ratingPer + color: #ff2c2c + font-size: 18px + font-family: 'pfdintextcomppro-regular', sans-serif + margin: 0 + padding-left: 8px -.infoProfile - float: right - .btn-group - .btn - width: 75px - height: 75px - float: left - border-radius: 0 !important + .infoProfile + .btn-group + .btn + width: 75px + height: 75px + float: left + border-radius: 0 !important + background-color: black + border: none + span + color: white + font-size: 26px + .dropdown-toggle + &:hover, &:active, &:focus + -webkit-box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) + -moz-box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) + box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) + background-color: rgb(255, 0, 39) + .dropdown-menu + border-radius: 0 background-color: black - border: none - span - color: white - font-size: 26px - .dropdown-toggle - &:hover, &:active, &:focus - -webkit-box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) - -moz-box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) - box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) - background-color: rgb(255, 0, 39) - .dropdown-menu - border-radius: 0 - background-color: black - left: -174px - margin: -1px 100% 0 0 - float: left - width: 250px - height: auto - padding: 30px 20px 15px 40px - border-top: 3px solid #ff2c2c - li - margin-bottom: 10px - &:last-child - margin-bottom: 0 - a - color: white - font-size: 17px - font-family: 'pfbeausanspro-reg', sans-serif - position: relative - &:link, &:visited + left: -174px + margin: -1px 100% 0 0 + float: left + width: 250px + height: auto + padding: 30px 20px 15px 40px + border-top: 3px solid #ff2c2c + li + display: block + margin-bottom: 10px + &:last-child + margin-bottom: 0 + a color: white font-size: 17px font-family: 'pfbeausanspro-reg', sans-serif position: relative - &:hover, &:active - background-color: black !important - color: #ff2c2c - span - content: '' - position: absolute - width: 20px - left: -18px - top: 4px - .icon_mm1 a span - height: 20px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 0 - .icon_mm2 a span - height: 22px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 -20px - .icon_mm3 a span - height: 13px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 -42px - top: 6px - .icon_mm4 a span - height: 20px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 -55px - .icon_mm5 a span - height: 20px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 -75px - .icon_mm6 a span - height: 20px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 -95px - .icon_mm7 a span - height: 20px - background-size: cover - background: url('#{$static}/img/menu.png') no-repeat 0 0 - .icon_mm8 a span - height: 20px - background-size: contain - background: url('#{$static}/img/user-5.png') no-repeat 0 0 - .icon_mm1 a:hover span - height: 20px - background: url('#{$static}/img/menu2.png') no-repeat center !important - background-size: cover !important - background-position: 0 0 !important - .icon_mm2 a:hover span - height: 22px - background-size: cover - background: url('#{$static}/img/menu2.png') no-repeat 0 -20px - .icon_mm3 a:hover span - height: 13px - background-size: cover - background: url('#{$static}/img/menu2.png') no-repeat 0 -42px - .icon_mm4 a:hover span - height: 20px - background-size: cover - background: url('#{$static}/img/menu2.png') no-repeat 0 -55px - .icon_mm5 a:hover span - height: 20px - background-size: cover - background: url('#{$static}/img/menu2.png') no-repeat 0 -75px - .icon_mm6 a:hover span - height: 20px - background-size: cover - background: url('#{$static}/img/menu2.png') no-repeat 0 -95px - .icon_mm7 a:hover span - height: 20px - background-size: cover - background: url('#{$static}/img/menu2.png') no-repeat 0 0 - .icon_mm8 a:hover span - height: 20px - background-size: contain - background: url('#{$static}/img/user-4.png') no-repeat 0 0 + &:link, &:visited + color: white + font-size: 17px + font-family: 'pfbeausanspro-reg', sans-serif + position: relative + &:hover, &:active + background-color: black !important + color: #ff2c2c + span + content: '' + position: absolute + width: 20px + left: -18px + top: 4px + .icon_mm1 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 0 + .icon_mm2 a span + height: 22px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -20px + .icon_mm3 a span + height: 13px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -42px + top: 6px + .icon_mm4 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -55px + .icon_mm5 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -75px + .icon_mm6 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -95px + .icon_mm7 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 0 + .icon_mm8 a span + height: 20px + background-size: contain + background: url('#{$static}/img/user-5.png') no-repeat 0 0 + .icon_chat a span + height: 20px + background: + image: url("#{$static}/img/icons/icon_speach-ball.png") + size: contain + repeat: no-repeat + .icon_chat a + display: inline-block + .circle + background-color: red + border-radius: 50% + width: 30px + height: 30px + line-height: 30px + display: inline-block + text-align: center + + .icon_mm1 a:hover span + height: 20px + background: url('#{$static}/img/menu2.png') no-repeat center !important + background-size: cover !important + background-position: 0 0 !important + .icon_mm2 a:hover span + height: 22px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -20px + .icon_mm3 a:hover span + height: 13px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -42px + .icon_mm4 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -55px + .icon_mm5 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -75px + .icon_mm6 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -95px + .icon_mm7 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 0 + .icon_mm8 a:hover span + height: 20px + background-size: contain + background: url('#{$static}/img/user-4.png') no-repeat 0 0 + .icon_chat a:hover span + height: 20px + background: + image: url("#{$static}/img/icons/icon_speach-ball_red.png") + size: contain + repeat: no-repeat \ No newline at end of file diff --git a/templates/partials/sass/home.sass b/templates/partials/sass/home.sass new file mode 100644 index 0000000..29713da --- /dev/null +++ b/templates/partials/sass/home.sass @@ -0,0 +1,174 @@ +@import "base/variavles" +@import "base/fonts" + +.home + background: + image: url("#{$static}/img/main.png") + repeat: no-repeat + position: center + size: cover + +.icons + display: inline-block + width: 24px + height: 24px + background: + image: url("#{$static}/img/sprite.png") + repeat: no-repeat + +.welcomeMain + width: 100% + float: left + font-size: 48px + text-align: center + padding: 54px 0 39px 0 + font-family: 'pfbeausanspro-thin', sans-serif + +.welcomeMain + line-height: 48px + font-family: 'pfdintextcomppro-regular', sans-serif + font-size: 43px + +.infoBlock + //padding: 113px 0 0 0 + height: 100% + text-align: center + padding: 80px 0 40px + ul + &.customer-list, + &.contractor-list + text-align: left + padding-left: 60px + padding-right: 20px + li + display: flex + align-items: center + padding-top: 10px + list-style: none + font-size: 12px + .text + padding-left: 10px + display: inline-block + .icon + &-1 + @extend .icons + width: 40px + background-position: 0 0 + &-2 + @extend .icons + background-position: 0 -24px + &-3 + @extend .icons + background-position: 0 -48px + &-4 + @extend .icons + background-position: 0 -72px + &-5 + @extend .icons + background-position: 0 -96px + &-6 + @extend .icons + background-position: 0 -120px + &-7 + @extend .icons + background-position: 0 -144px + &-8 + @extend .icons + background-position: 0 -168px + &-9 + @extend .icons + background-position: 0 -192px + &-10 + @extend .icons + background-position: 0 -216px + &-11 + @extend .icons + background-position: 0 -240px + &-12 + @extend .icons + background-position: 0 -264px + + &.customer-list + li + color: #c7c5c5 + &.contractor-list + li + color: #353434 + + + + a + text-decoration: none + border: none + cursor: pointer + & > a.to-profile + height: 40px + border-radius: 40px + font-size: 20px + text-transform: uppercase + font-family: 'pfdintextcomppro-regular', sans-serif + letter-spacing: 4px + position: relative + display: table + margin: 0 auto + a.create + font-family: Myriad, sans-serif + font-weight: normal + font-size: 20px + letter-spacing: 4px + display: inline-block + margin-top: 40px + text-transform: uppercase + &.customer + background-color: rgba(0, 0, 0, 0.7) + p, a.create + color: #c7c5c5 + &:hover + color: #f3f1f1 + & > a.to-profile + &:link, &:visited + background: url('#{$static}/img/button2.png') no-repeat 27px, white + color: black + padding: 24px 26px 20px 72px + &:hover + box-shadow: 0 0 15px rgba(255, 255, 255, 0.8) + -webkit-transform: scale(1.04) + -moz-transform: scale(1.04) + transform: scale(1.04) + &.contractor + background-color: rgba(255, 0, 6, 0.7) + p, a.create + color: #353434 + &:hover + color: #141313 + & > a.to-profile + &:link, &:visited + background: url('#{$static}/img/button1.png') no-repeat 25px, black + color: white + padding: 24px 26px 20px 72px + &: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) + +.youtube + display: block + border-radius: 50% + width: 80px + height: 80px + margin: 20px auto 40px + //border-radius: 100% + cursor: pointer + background: + image: url('#{$static}/img/youtube.png') + repeat: no-repeat + position: center + size: cover + &:hover + box-shadow: 0 0 15px rgba(255, 19, 19, 0.8) + -webkit-transform: scale(1.04) + -moz-transform: scale(1.04) + transform: scale(1.04) + &:focus + outline: none diff --git a/templates/partials/sass/registration.sass b/templates/partials/sass/registration.sass new file mode 100644 index 0000000..632a894 --- /dev/null +++ b/templates/partials/sass/registration.sass @@ -0,0 +1,119 @@ +@import "base/variavles" + +.form-regestration + display: table + width: 100% + float: left + margin: 0 0 80px 0 + padding: 67px 0 + //padding: 20px 0 67px 0 + background-color: #ddd + text-align: center + a, a:hover + text-decoration: none + a:hover + color: #6f7bff + +.select-reg + .btn-group + display: inline-block + vertical-align: top + &.captcha + text-align: center + .g-recaptcha + display: inline-table + margin: 25px 0 0 0 + input[type="checkbox"] + span + position: absolute + left: 0 + top: 0 + width: 100% + height: 100% + background: + image: url('#{$static}/img/check.png') + repeat: no-repeat + position: 0 0 + size: cover + cursor: pointer + label + width: 23px + height: 23px + display: block + position: relative + margin-right: 10px + + input[type="checkbox"]:checked + span + background-position: 0 -23px + +.email-reg, .pass-reg + width: 360px + height: 51px + display: inline-block + vertical-align: top + padding: 0 15px + font-size: 15px + background-color: white + color: black + margin: 20px 0 0 0 + font-family: 'Arial-MT-Regular', sans-serif + border: none !important + +.reg-sub + width: 360px + height: 51px + color: white + text-align: center + font-family: 'pfdintextcomppro-regular', sans-serif + letter-spacing: 2px + line-height: 51px + border: none + background-color: #42B476 + border-radius: 40px + display: inline-block + vertical-align: top + margin-top: 20px + font-size: 15px + text-transform: uppercase + &:active, &:focus + outline: none !important + +.check-reg + width: 360px + display: inline-block + vertical-align: top + margin-top: 20px + label + float: left + p + font-family: 'Arial-MT-Regular', sans-serif + color: #6c6c6c + font-size: 15px + float: left + /*margin: -2px 0 0 10px; + line-height: 18px + width: 90% + text-align: left + > a + color: #009DD9 + &:link, &:visited + color: #009DD9 + &:hover + color: #6f7bff + +.have-ac, .have-ac:link, .have-ac:visited + color: #009DD9 + font-size: 17px + font-family: 'Arial-MT-Regular', sans-serif + text-transform: uppercase + display: inline-block + +.form-regestration + .errorlist + color: red + //width: 360px + //margin: 0 auto + //text-align: left + font-family: 'Arial-MT-Regular', sans-serif + font-size: 15px + li + list-style: none \ No newline at end of file diff --git a/templates/partials/trash/header.html b/templates/partials/trash/header.html new file mode 100644 index 0000000..cea82c3 --- /dev/null +++ b/templates/partials/trash/header.html @@ -0,0 +1,186 @@ +{% load staticfiles %} +{% load thumbnail %} +{% load user_tags %} +{% load activeurl %} +{% load sass_tags %} +{% load common_tags %} + +{% if request.user.is_contractor %} + {% url 'users:contractor-profile' pk=request.user.pk as profile_url %} +{% elif request.user.is_customer %} + {% url 'users:customer-profile-open-projects' pk=request.user.pk as profile_url %} +{% endif %} + + + +
          +
          +
          +
          + + + +
          + + {% activeurl %} +
          + {% if request.user.is_authenticated %} + + +
          + {% else %} + + + {% endif %} +
          + {% endactiveurl %} +
          + {% if request.user.is_authenticated %} + {% if request.user.is_contractor %} + {% contractor_indicator request.user %} + {% endif %} + +
          +
          + + +
          +
          + + {% if request.user.is_contractor %} + + {% endif %} + + {% else %} + Регистрация + +
          +
          + {% endif %} +
          +
          +
          +
          diff --git a/templates/partials/trash/header.sass b/templates/partials/trash/header.sass new file mode 100644 index 0000000..fb63949 --- /dev/null +++ b/templates/partials/trash/header.sass @@ -0,0 +1,370 @@ +@import "base/variavles" + +.wrTop + width: 100% + background-color: black + +.topMain + width: 1200px + margin: 0 auto + color: #ffffff + .dropdown-menu > li > a + display: inline-block + .col-lg-7 + width: 55% + .col-lg-2 + width: 19% + .mainMenu li + cursor: pointer + padding-right: 25px + a + font-size: 15px + //&:hover + cursor: pointer + + .user-info + float: right + height: 100% + a + display: block + color: white + cursor: pointer + &:hover + text-decoration: none + color: #FF0029 + .cash + text-align: right + padding-top: 4px + .icon_hand + padding-left: 26px + background: + image: url("#{$static}/img/icons/icon_hands.png") + size: 24px 24px + repeat: no-repeat + &:hover + background-image: url("#{$static}/img/icons/icon_hands_red.png") + .icon_chat + margin-top: 4px + padding-left: 26px + background: + image: url("#{$static}/img/icons/icon_speach-ball.png") + size: 18px 18px + repeat: no-repeat + &:hover + background-image: url("#{$static}/img/icons/icon_speach-ball_red.png") + +.circle + background-color: red + border-radius: 50% + width: 30px + height: 30px + line-height: 30px + display: inline-block + text-align: center + //align-items: center + +.logo + width: 183px + height: 36px + background: url('#{$static}/img/logo.png') no-repeat center + background-size: cover + float: left + margin: 18px 0 21px 10px + cursor: pointer + +.mainMenu + float: left + margin: 26px 0 0 0 + padding-left: 60px + li + float: left + position: relative + padding-right: 30px + list-style: none + a + text-decoration: none + border-bottom: 3px solid transparent + -webkit-transition: all 0.4s ease-out + -moz-transition: all 0.4s ease-out + transition: all 0.4s ease-out + &:hover a + border-color: #ff0029 + span + content: '' + position: absolute + height: 23px + left: 0 + top: -1px + .icon_tm1 span + width: 26px + //background: url('../img/listMain.png') no-repeat left + background-size: cover + background: url('#{$static}/img/listMain.png') no-repeat 0 0 + .icon_tm2 span + width: 22px + background-size: cover + background: url('#{$static}/img/listMain.png') no-repeat -26px 0 + .icon_tm3 span + width: 24px + background-size: cover + background: url('#{$static}/img/listMain.png') no-repeat -48px 0 + + .icon_tml span + content: '' + position: absolute + width: 27px + height: 24px + //left: -35px + top: 0 + background: url('#{$static}/img/list4.png') no-repeat center !important + background-size: cover !important + +.icon_tml:hover span + background: url('#{$static}/img/list4tml.png') no-repeat center !important + background-size: cover !important + +.icon_tm1:hover span + width: 26px + background: url('#{$static}/img/listMain2.png') no-repeat left !important + background-size: cover + background-position: 0 0 !important + +.icon_tm2:hover span + width: 22px + background: url('#{$static}/img/listMain2.png') no-repeat left !important + background-size: cover + background-position: -26px 0 !important + +.icon_tm3:hover span + width: 26px !important + background: url('#{$static}/img/listMain2.png') no-repeat left !important + background-size: cover + background-position: -49px 0 !important + +.rating + width: 46px + height: 46px + float: right + border-radius: 100% + background-color: #4D4D4D + margin: 15px 0 0 10px + position: relative + +.ratingInset + width: 46px + height: 46px + border-radius: 100% + background-color: #FF0027 + position: absolute + /*left:-1.859px;*/ + /*bottom: 3px;*/ + clip: rect(0, 22px, 50px, 0) + transform: rotate(-90deg) + +.iconRating + width: 100% + height: 100% + position: absolute + left: 0 + top: 0 + background: url('#{$static}/img/button12.png') no-repeat center + +.ratingPer + color: #ff2c2c + font-size: 18px + font-family: 'pfdintextcomppro-regular', sans-serif + float: right + margin: 28px 0 0 9px + cursor: pointer + +.mainMenu li + &:last-child + padding-right: 0 + a + color: white + font-size: 18px + padding: 30px 0 27px 40px + font-family: 'pfbeausanspro-reg', sans-serif + &.active > a + border-color: #ff0029 + &.icon_tm1.active span + background: url('#{$static}/img/listMain2.png') no-repeat !important + &.officeList.active span + background: url('#{$static}/img/list4tml.png') no-repeat center !important + &.icon_tm2.active span + background: url('#{$static}/img/listMain2.png') no-repeat center !important + &.icon_tm3.active span + background: url('#{$static}/img/listMain2.png') no-repeat right !important + +li.officeList.icon_tml > a > .count + display: inline-block + color: red + font-family: 'pfbeausanspro-reg', sans-serif + //padding: 5px 7px 3px 7px + background: none + border-radius: 0 + position: inherit + //right: -34px + //top: -4px + +.reg, .reg:link, .reg:visited + color: #fb1818 + font-size: 16px + text-transform: uppercase + float: left + line-height: 75px + font-family: 'pfdintextcomppro-regular', sans-serif + letter-spacing: 4px + text-decoration: none + +.lock + width: 75px + height: 75px + background: url('#{$static}/img/lock.png') no-repeat center, white + float: right + cursor: pointer + margin-left: 20px + margin-right: 0 + +.imgProfile + width: 75px + height: 75px + float: right + margin: 0 + padding-left: 5px + img + display: block + width: 100% + height: 100% + +.infoProfile + float: right + .btn-group + .btn + width: 75px + height: 75px + float: left + border-radius: 0 !important + background-color: black + border: none + span + color: white + font-size: 26px + .dropdown-toggle + &:hover, &:active, &:focus + -webkit-box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) + -moz-box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) + box-shadow: inset 0 3px 5px rgba(255, 0, 39, 0.99) + background-color: rgb(255, 0, 39) + .dropdown-menu + border-radius: 0 + background-color: black + left: -174px + margin: -1px 100% 0 0 + float: left + width: 250px + height: auto + padding: 30px 20px 15px 40px + border-top: 3px solid #ff2c2c + li + margin-bottom: 10px + &:last-child + margin-bottom: 0 + a + color: white + font-size: 17px + font-family: 'pfbeausanspro-reg', sans-serif + position: relative + &:link, &:visited + color: white + font-size: 17px + font-family: 'pfbeausanspro-reg', sans-serif + position: relative + &:hover, &:active + background-color: black !important + color: #ff2c2c + span + content: '' + position: absolute + width: 20px + left: -18px + top: 4px + .icon_mm1 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 0 + .icon_mm2 a span + height: 22px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -20px + .icon_mm3 a span + height: 13px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -42px + top: 6px + .icon_mm4 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -55px + .icon_mm5 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -75px + .icon_mm6 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 -95px + .icon_mm7 a span + height: 20px + background-size: cover + background: url('#{$static}/img/menu.png') no-repeat 0 0 + .icon_mm8 a span + height: 20px + background-size: contain + background: url('#{$static}/img/user-5.png') no-repeat 0 0 + .icon_chat a span + height: 20px + background: + image: url("#{$static}/img/icons/icon_speach-ball.png") + size: contain + repeat: no-repeat + + .icon_mm1 a:hover span + height: 20px + background: url('#{$static}/img/menu2.png') no-repeat center !important + background-size: cover !important + background-position: 0 0 !important + .icon_mm2 a:hover span + height: 22px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -20px + .icon_mm3 a:hover span + height: 13px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -42px + .icon_mm4 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -55px + .icon_mm5 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -75px + .icon_mm6 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 -95px + .icon_mm7 a:hover span + height: 20px + background-size: cover + background: url('#{$static}/img/menu2.png') no-repeat 0 0 + .icon_mm8 a:hover span + height: 20px + background-size: contain + background: url('#{$static}/img/user-4.png') no-repeat 0 0 + .icon_chat a:hover span + height: 20px + background: + image: url("#{$static}/img/icons/icon_speach-ball_red.png") + size: contain + repeat: no-repeat \ No newline at end of file diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index 41428ef..f5f0449 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -6,75 +6,7 @@

          Регистрация

          -
          -
          {% csrf_token %} - {{ form.non_field_errors }} - - {% if not hide_user_type %} -
          -{# {% if request.GET.type == 'customer' %}#} -{# #} -{# {% elif request.GET.type == 'contractor' %}#} -{# #} -{# {% else %}#} -{# #} -{# {% endif %}#} - - {{ form.user_type }} - {{ form.user_type.errors }} -
          - {% endif %} - -
          - - {{ form.username.errors }} -
          -
          - - {{ form.email.errors }} -
          -
          - - {{ form.password1.errors }} -
          - -
          - - {{ form.password2.errors }} -
          - -
          - {{ form.captcha }} - {{ form.captcha.errors }} -
          -
          - -
          -
          - - {% include 'registration/social.html' %} - -
          -
          - -

          Регистрируясь, я подтверждаю свое согласие у условиями пользовательского соглашения

          - {{ form.tos.errors }} -
          -
          -
          - - -
          + {% include 'partials/inc-registration_form.html' %} {% include 'partials/footer.html' %}
          diff --git a/templates/trash/home.html b/templates/trash/home.html new file mode 100644 index 0000000..a0f08a1 --- /dev/null +++ b/templates/trash/home.html @@ -0,0 +1,100 @@ +{% extends 'partials/base.html' %} + +{% block content %} +
          + {% include 'partials/header.html' %} + +
          +
          +

          {{ main_settings.heading }}

          +
          +
          + +
          +
          +
          +
          + {% if request.user.is_authenticated and request.user.is_customer %} + Я заказчик + {% else %} + Я заказчик + {% endif %} +

          + {{ main_settings.customer_text|safe }} +

          +
          +
          +
          +
          +
          +
          +
          + {% if request.user.is_authenticated and request.user.is_contractor %} + Я исполнитель + {% else %} + Я исполнитель + {% endif %} +

          + {{ main_settings.contractor_text|safe }} +

          +
          + +
          + +
          +
          + +
          +
          + +
          +
          + +{# #} +{# #} +
          +
          +
          +{% endblock %} + +{% block js_block %} + +{% endblock %} diff --git a/users/templates/templatetags/contractor_indicator.html b/users/templates/templatetags/contractor_indicator.html index ee9bd03..838e613 100644 --- a/users/templates/templatetags/contractor_indicator.html +++ b/users/templates/templatetags/contractor_indicator.html @@ -1,5 +1,5 @@ -

          {{ current_indicator }}%

          +

          {{ current_indicator }}%

          diff --git a/users/templates/templatetags/user_new_count.html b/users/templates/templatetags/user_new_count.html index 3c89bb0..c6a5d63 100644 --- a/users/templates/templatetags/user_new_count.html +++ b/users/templates/templatetags/user_new_count.html @@ -1 +1 @@ -{{ new_count }} +
          {{ new_count }}
          diff --git a/users/templates/templatetags/user_new_count_orders.html b/users/templates/templatetags/user_new_count_orders.html index 8b9b759..a34c0bb 100644 --- a/users/templates/templatetags/user_new_count_orders.html +++ b/users/templates/templatetags/user_new_count_orders.html @@ -1 +1 @@ -

          {{ new_count }}

          +
          {{ new_count }}
          diff --git a/users/templatetags/user_tags.py b/users/templatetags/user_tags.py index 48753b3..55e312b 100644 --- a/users/templatetags/user_tags.py +++ b/users/templatetags/user_tags.py @@ -10,7 +10,6 @@ from projects.models import Order from reviews.models import Review from users.helpers import get_projects_grouped - register = template.Library() @@ -50,7 +49,13 @@ def count_new_message(context, user): @register.inclusion_tag('templatetags/user_new_count_orders.html', takes_context=True) def count_new_message_orders(context, user): - new_count = NewMessage.objects.filter(user=user, message__order__in=user.orders.all(), + """ + + :param context: + :param user: + :return: + """ + new_count = NewMessage.objects.filter(user=user, message__order__in=user.orders.filter(status='created'), message__team__isnull=True).count() try: team = user.team @@ -58,23 +63,30 @@ def count_new_message_orders(context, user): team = None if team: - new_count_team = NewMessage.objects.filter(user=user, message__order__in=user.team.orders.all(), + new_count_team = NewMessage.objects.filter(user=user, + message__order__in=user.team.orders.filter(status='created'), message__team__isnull=True).count() new_count += new_count_team + + if new_count > 99: + new_count = '99+' return { 'new_count': new_count, } @register.simple_tag -def get_new_count_message(team_pk,user=None): +def get_new_count_message(team_pk, user=None): count = NewMessage.objects.filter(user=user, message__team=team_pk, message__order__isnull=True).count() return count @register.simple_tag def get_new_count_for_contact(contact, current_user): - count = current_user.new_messages.filter(message__sender=contact, message__order__isnull=True, message__team__isnull=True).count() + count = current_user.new_messages.filter(message__sender=contact, message__order__isnull=True, + message__team__isnull=True).count() + if count > 99: + new_count = '99+' return count @@ -114,14 +126,17 @@ def get_customer_chat_open_projects(user): @register.filter def get_project_message_count(user): if user.is_customer(): - projects = user.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, order__team__isnull=True) + projects = user.customer_projects.filter(state='active').exclude(order__contractor__isnull=True, + order__team__isnull=True) return projects.aggregate(c=Count('answers__messages'))['c'] elif user.is_contractor(): - message_count = user.contractor_answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] - + message_count = \ + user.contractor_answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] + if util.has_related(user, 'team'): - message_count += user.team.answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] - + message_count += \ + user.team.answers.filter(project__state='active', rejected=False).aggregate(c=Count('messages'))['c'] + return message_count diff --git a/wallets/models.py b/wallets/models.py index 1ef97fd..69f1529 100644 --- a/wallets/models.py +++ b/wallets/models.py @@ -41,7 +41,7 @@ class InvoiceHistory(models.Model): current_sum_info = InvoiceHistory.objects.filter(user=self.user, type="score").aggregate(Sum('sum')) current_sum = current_sum_info['sum__sum'] or 0 if self.type == "score": - self.balance = current_sum + self.sum + self.balavoids_atnce = current_sum + self.sum else: self.balance = current_sum super().save(*args, **kwargs) diff --git a/wallets/views.py b/wallets/views.py index 1cc245c..6170574 100644 --- a/wallets/views.py +++ b/wallets/views.py @@ -76,15 +76,15 @@ class ScoreView(LoginRequiredMixin, View): template_name = 'score-detail.html' def get(self, request, *args, **kwargs): - # transaction = Transaction.objects.get_or_create(customer=request.user, complete=False) - transaction = Transaction.objects.get_or_create(customer=request.user, type='add', complete=False) + transaction, created = Transaction.objects.get_or_create(customer=request.user, type='add', complete=False) + # transaction = Transaction.objects.filter(customer=request.user, type='add', complete=False) user_score = get_object_or_404(User.objects, pk=kwargs.get('pk')) current_sum_info = InvoiceHistory.objects.filter(user=user_score, type="score").aggregate(Sum('sum')) user_score_balance = current_sum_info['sum__sum'] or 0 form = WithDrawForm return render(request, self.template_name, { - 'transaction': transaction[0], + 'transaction': transaction, 'YANDEX_MONEY': settings.YANDEX_MONEY, 'user_score': user_score, 'user_score_balance': user_score_balance, diff --git a/webpack.config.js b/webpack.config.js index da0cdaf..c7d2022 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,6 +14,8 @@ module.exports = { //worksell create_worksell: "./assets/js/src/create_worksell.js", init_create_worksell: './assets/js/src/init_create_worksell.js', + //home + home_page: "./assets/js/src/home_page.js", }, diff --git a/work_sell/templates/worksell_create.html b/work_sell/templates/worksell_create.html index 5cabe30..9e79e45 100644 --- a/work_sell/templates/worksell_create.html +++ b/work_sell/templates/worksell_create.html @@ -8,24 +8,12 @@ - {# #} {% endblock %} {% block content %} {% include 'partials/modals/project_work_type_suggestion.html' %} + {% include 'partials/modals/modal-registration_form.html' %} {% include 'partials/header.html' %}
          @@ -73,6 +61,7 @@
          +
           
          Нет нужной специальности хочу добавить @@ -132,7 +121,7 @@ style="position: absolute; top: -1000px; left: -1000px">
          ×
          -{#
          #} + {#
          #}
          @@ -192,17 +181,53 @@
          -
          -
           
          - + + - diff --git a/work_sell/views.py b/work_sell/views.py index 5bcad35..b19916c 100644 --- a/work_sell/views.py +++ b/work_sell/views.py @@ -6,7 +6,7 @@ import pydash as _; _.map = _.map_; _.filter = _.filter_ from pprint import pformat -from django.shortcuts import render, redirect +from django.shortcuts import render, redirect, get_object_or_404 from django.conf import settings from django.contrib import messages from django.db.models import Q @@ -20,11 +20,14 @@ from django.views.generic import ListView, DetailView, CreateView, View, \ from projects.models import BuildingClassfication, ConstructionType from projects.forms import ProjectWorkTypeSuggestionForm +from archilance.mixins import BaseMixin +from common.forms import CustomRegistrationForm +from users.models import User from .models import WorkSell, Picture, WorkSellPhoto, WorkSellPhoto from .forms import WorkSellForm, WorkSellFilterForm, ContractorWorkSellTrashForm from .serialize import serialize from .response import JSONResponse, response_mimetype -from archilance.mixins import BaseMixin + class PictureCreateView(CreateView): @@ -174,11 +177,17 @@ class WorkSellCreateView(BaseMixin, View): work_type_suggestion_form = ProjectWorkTypeSuggestionForm template_name = 'worksell_create.html' - def dispatch(self, request, *args, **kwargs): - if request.user.is_authenticated() and request.user.is_contractor(): - return super().dispatch(request, *args, **kwargs) - else: - raise PermissionDenied + # def dispatch(self, request, *args, **kwargs): + # if request.user.is_authenticated() and request.user.is_contractor(): + # return super().dispatch(request, *args, **kwargs) + # else: + # raise PermissionDenied + + def get_context_data(self, **kwargs): + ctx = super().get_context_data() + user_form = CustomRegistrationForm() + ctx['user_form'] = user_form + return ctx def get(self, request, *args, **kwargs): context = self.get_context_data(**_.merge({}, request.GET, kwargs)) @@ -207,10 +216,15 @@ class WorkSellCreateView(BaseMixin, View): else: request.POST.setlist('el_format', request.POST.get('el_format', "").split(',')) - print("POST before = ", request.POST) + # print("POST before = ", request.POST) if form.is_valid(): work_sell = form.save(commit=False) - work_sell.contractor = request.user + unregister_user = request.POST.get('not_auth_user_id') + if unregister_user: + user = get_object_or_404(User, pk=unregister_user) + else: + user = request.user + work_sell.contractor = user work_sell.save() form.save_m2m()