From 6740e6607df4fec77bdcd1bd67a7de45a37c6aea Mon Sep 17 00:00:00 2001 From: booblegum Date: Sat, 4 Feb 2017 19:08:13 +0300 Subject: [PATCH] chat v.0.3 Fix many bugs... and there are still... --- assets/css/extra.css | 2 +- assets/css/main.css | 21 +- assets/js/build/chat_contractor_oop.js | 477 +++++++++-------- assets/js/build/chat_customer_oop.js | 480 ++++++++++-------- assets/js/src/chat/BINDS.js | 87 +++- .../js/src/chat/StagesContractorController.js | 28 +- .../js/src/chat/StagesCustomerController.js | 31 +- assets/js/src/chat/chats.js | 30 +- assets/js/src/chat/loaders.js | 2 + assets/js/src/chat/parts.js | 27 - .../templates/buttons/btnSendReview_tmpl.html | 14 +- .../links/document_attach_file_tmpl.html | 11 +- .../templates/links/document_link_tmpl.html | 4 +- .../js/src/chat/templates/message_tmpl.html | 8 +- .../chat/templates/stage_approved_tmpl.html | 5 +- .../stage_contractor_approve_tmpl.html | 3 +- assets/js/src/chat/templates/stage_tmpl.html | 2 +- .../templates/switch_to_protected_tmpl.html | 2 +- .../chat/templates/work_in_process_tmpl.html | 4 +- assets/js/src/chat_contractor_oop.js | 2 +- assets/js/src/chat_customer_oop.js | 2 +- chat/chat.py | 2 +- chat/serializers.py | 2 +- chat/static/sass/chat_add.sass | 66 ++- chat/templates/chat_contractor.html | 54 +- chat/templates/chat_customer.html | 43 +- .../partials/inc-attach-documents.html | 15 +- .../partials/inc-websocket-connect.htm | 1 - chat/templates/review_add_modal.html | 2 +- projects/forms.py | 2 + projects/templates/project_detail.html | 3 +- projects/views.py | 4 +- users/templates/contractor_office.html | 15 +- users/templates/contractor_profile.html | 20 +- users/templates/trash/contractor_filter.html | 3 + users/views.py | 16 +- 36 files changed, 893 insertions(+), 597 deletions(-) delete mode 100644 assets/js/src/chat/parts.js diff --git a/assets/css/extra.css b/assets/css/extra.css index d9d2a3b..de39fe4 100644 --- a/assets/css/extra.css +++ b/assets/css/extra.css @@ -209,7 +209,7 @@ font-size: 14px; font-family: 'Arial-MT-Regular', sans-serif; position: absolute; - top: 14px; + top: 6px; cursor: pointer; -webkit-transition: all 0.3s ease-out; -moz-transition: all 0.3s ease-out; diff --git a/assets/css/main.css b/assets/css/main.css index d63ded3..75f7329 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1955,7 +1955,7 @@ footer:after { font-family: 'pfbeausanspro-reg', sans-serif; position: relative; text-align: left; - padding: 20px 61px 20px 21px; + padding: 15px 61px 15px 21px; /*height: 94px;*/ } @@ -1963,10 +1963,10 @@ footer:after { content: ''; position: absolute; width: 100%; - height: 3px; + height: 1px; top: -1px; left: 0; - background-color: black; + background-color: #545454; } .addWork { @@ -3690,6 +3690,7 @@ footer:after { float: left; border-top: 1px solid black; border-bottom: 1px solid black; + margin-bottom: 3px; } .documentsChat > p { @@ -3791,7 +3792,7 @@ footer:after { } .orderBlock { - width: 100%; + width: 260px; float: left; margin-bottom: -1px; padding: 15px; @@ -3983,8 +3984,7 @@ footer:after { .stepssBlock { width: 100%; float: left; - padding: 15px; - padding-bottom: 0; + padding: 5px 15px 0; /*border-top: 1px solid black;*/ /*border-bottom: 1px solid black;*/ z-index: 9; @@ -3995,16 +3995,17 @@ footer:after { .titleStepss { width: 100%; padding-left: 15px; + padding-top: 10px; font-size: 18px; font-family: 'Arial-MT-Regular', sans-serif; - margin: 0 0 15px 0; + margin: 0 0 5px 0; color: #2c2c2c; } .textStepss { width: 100%; padding-left: 15px; - font-size: 14px; + font-size: 12px; line-height: 17px; font-family: 'Arial-MT-Regular', sans-serif; color: #575757; @@ -4015,7 +4016,7 @@ footer:after { float: left; border-top: 1px solid transparent; border-bottom: 1px solid transparent; - padding: 15px; + padding: 15px 15px 5px; /*margin-bottom: -15px;*/ background-color: white; position: relative; @@ -5795,7 +5796,7 @@ input[type="radio"]:checked + span { } #order-stages label{ margin-bottom: 0; - margin-top: 8px; + margin-top: 0px; } #order-stages .checkbox label{ margin-top: 0; diff --git a/assets/js/build/chat_contractor_oop.js b/assets/js/build/chat_contractor_oop.js index af00718..e9855bd 100644 --- a/assets/js/build/chat_contractor_oop.js +++ b/assets/js/build/chat_contractor_oop.js @@ -48,13 +48,11 @@ var _ChatContractorPageController = __webpack_require__(1); - var _BINDS = __webpack_require__(21); + var _BINDS = __webpack_require__(22); - var _documents = __webpack_require__(24); + var _documents = __webpack_require__(25); - var _notes = __webpack_require__(23); - - var _parts = __webpack_require__(25); + var _notes = __webpack_require__(24); var _archiveProjects = __webpack_require__(26); @@ -98,7 +96,7 @@ (0, _notes.bindTeamNotes)(); //restore - (0, _parts.restoreTabFromHash)(); + (0, _BINDS.restoreTabFromHash)(); }); /***/ }, @@ -116,9 +114,9 @@ var _StagesContractorController = __webpack_require__(2); - var _MessagesControllers = __webpack_require__(19); + var _MessagesControllers = __webpack_require__(20); - var _DocumentsControllers = __webpack_require__(20); + var _DocumentsControllers = __webpack_require__(21); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -167,7 +165,7 @@ var _loaders = __webpack_require__(4); - var _Stages = __webpack_require__(18); + var _Stages = __webpack_require__(19); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -184,12 +182,12 @@ var STATUSES = { 'not_agreed': 'не согласован', - 'send_approve': 'на согласовании', - 'agreed': 'согласовано', - 'cancel_approve': 'исполнитель отказался', - 'in_process': 'в процессе', - 'completed': 'завершен', - 'closed': 'закрыт' + 'send_approve': '...на согласовании', + 'agreed': '...согласовано', + 'cancel_approve': '...исполнитель отказался', + 'in_process': '...в процессе', + 'completed': '...завершен', + 'closed': '...закрыт' }; @@ -293,6 +291,11 @@ this.stages_elements.$approve.find('.js-select').addClass("select"); this.stages_elements.$reserve.find('.js-select').addClass("select"); this.stages_elements.$works.find('.js-select').addClass("select"); + this.stages_elements.$reserve.css({ 'border-top': 'none' }); + this.stages_elements.$works.css({ 'border-top': 'none' }); + $('#stagesWork').find('.js-select').addClass('select'); + this.stages_elements.$reserve.find('.js-select').addClass('select'); + if ($('#send-review').length) $('#send-review').remove(); this.stages_elements.$reserve.hide(); this.stages_elements.$works.hide(); @@ -327,6 +330,7 @@ if (this.secureOrder) { this.stages_elements.$reserve.find('.js-help-text').show(); } else { + this.buttons.btnsArbitration.hide(); this.stages_elements.$reserve.find('.js-help-text').show(); this.stages_elements.$reserve.find('.js-select').removeClass('select'); this.stages_elements.$reserve.find('.js-help-text').html('Резервирование не предусмотрено, безопасная сделака не активна'); @@ -373,6 +377,7 @@ this._renderStageReserved('reserved_tmpl'); this.stages_elements.$reserve.find('.js-help-text').show(); } else { + this.buttons.btnsArbitration.hide(); this.stages_elements.$reserve.find('.stages-paid').html(""); this.stages_elements.$reserve.find('.js-help-text').hide(); } @@ -388,13 +393,16 @@ this.buildAgreedStage(); // Block-Stage-2 this.stages_elements.$reserve.find('.js-help-text').hide(); + this.stages_elements.$reserve.css({ 'border-top': '1px solid black' }); // Block-Stage-3 this.stages_elements.$works.show(); + this.stages_elements.$works.css({ 'border-top': '1px solid black' }); this._renderStageInWork('work_in_process_tmpl'); if (this.secureOrder) { // this._renderStageInWork('work_in_process_tmpl'); } else { + this.buttons.btnsArbitration.hide(); this.stages_elements.$reserve.hide(); } } // Статус "В процессе"/"Завершен"/"Закрыт" @@ -538,6 +546,8 @@ } else { if (this.stages_elements.$works.find('#send-review').length) this.stages_elements.$works.find('#send-review').remove(); } + $('#stagesWork').find('.js-select').removeClass('select'); + this.stages_elements.$reserve.find('.js-select').removeClass('select'); } else { var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; @@ -696,7 +706,11 @@ key: '_onBtnReviewOpenModal', value: function _onBtnReviewOpenModal(event) { event.preventDefault(); + + var review_type = $(event.target).data('review-type'); + $('#review-add').find('input[type=radio][value=' + review_type + ']').prop("checked", true); $('#review-add').modal('show'); + console.log('Modal show review_type = ', review_type); } // Открыть модальное окно "Оставить отзыв" }, { @@ -861,23 +875,27 @@ var _document_attach_file_tmpl2 = _interopRequireDefault(_document_attach_file_tmpl); - var _note_tmpl = __webpack_require__(13); + var _document_link_tmpl = __webpack_require__(13); + + var _document_link_tmpl2 = _interopRequireDefault(_document_link_tmpl); + + var _note_tmpl = __webpack_require__(14); var _note_tmpl2 = _interopRequireDefault(_note_tmpl); - var _order_info_tmpl = __webpack_require__(14); + var _order_info_tmpl = __webpack_require__(15); var _order_info_tmpl2 = _interopRequireDefault(_order_info_tmpl); - var _stage_contractor_approve_tmpl = __webpack_require__(15); + var _stage_contractor_approve_tmpl = __webpack_require__(16); var _stage_contractor_approve_tmpl2 = _interopRequireDefault(_stage_contractor_approve_tmpl); - var _document_before_upload_tmpl = __webpack_require__(16); + var _document_before_upload_tmpl = __webpack_require__(17); var _document_before_upload_tmpl2 = _interopRequireDefault(_document_before_upload_tmpl); - var _switch_to_protected_tmpl = __webpack_require__(17); + var _switch_to_protected_tmpl = __webpack_require__(18); var _switch_to_protected_tmpl2 = _interopRequireDefault(_switch_to_protected_tmpl); @@ -893,6 +911,7 @@ bntCompleteStage_tmpl: _bntCompleteStage_tmpl2.default, btnSendReview_tmpl: _btnSendReview_tmpl2.default, document_attach_file_tmpl: _document_attach_file_tmpl2.default, + document_link_tmpl: _document_link_tmpl2.default, note_tmpl: _note_tmpl2.default, order_info_tmpl: _order_info_tmpl2.default, stage_contractor_approve_tmpl: _stage_contractor_approve_tmpl2.default, @@ -921,7 +940,7 @@ }; function _template() { - return '\n
\n \n
\n
\n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
\n
\n ' + (this.stage_status ? this.stage_status : 'не согласован') + '\n
\n
\n
\n
\n \n \n

\n \n \n

\n \n

\n \n \n \n \n

\n \n \n

\n
\n
'; + return '\n
\n \n
\n
\n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
\n
\n ' + (this.stage_status ? this.stage_status : '') + '\n
\n
\n
\n
\n \n \n

\n \n \n

\n \n

\n \n \n \n \n

\n \n \n

\n
\n
'; }; /***/ }, @@ -939,7 +958,7 @@ }; function _template() { - return '\n
\n
\n
\n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
\n
\n ' + (this.stage_status ? this.stage_status : 'не согласован') + '\n
\n
\n
\n\n
\n ' + this.stage.name + '\n
\n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
\n ' + this.stage.result + '\n
\n \u0426\u0435\u043D\u0430\n
\n ' + this.stage.cost + ' \u20BD\n
\n \u0421\u0440\u043E\u043A\n
\n \u0434\u043E ' + this.stage.term + '\n
\n
\n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
\n\n
'; + return '\n
\n
\n
\n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
\n
\n ' + (this.stage_status ? this.stage_status : '') + '\n
\n
\n
\n\n
\n ' + this.stage.name + '\n
\n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
\n ' + this.stage.result + '\n
\n \u0426\u0435\u043D\u0430\n
\n ' + this.stage.cost + ' \u20BD\n
\n \u0421\u0440\u043E\u043A\n
\n \u0434\u043E ' + this.stage.term + '\n
\n
\n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
\n\n
'; }; /***/ }, @@ -975,7 +994,7 @@ }; function _template() { - return "\n
\n
\n

" + this.senderName + "

" + this.message.created + "\n
\n

" + this.message.text + "

\n
"; + return "\n
\n
\n
" + this.senderName + "
" + this.message.created + "
\n
\n
\n " + this.message.text + "\n
\n
"; }; /***/ }, @@ -993,7 +1012,7 @@ }; function _template() { - return "\n
\n \u0412 \u0440\u0430\u0431\u043E\u0442\u0435: " + this.stage.name + "
\n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430: " + this.stage.result + "
\n \u0421\u0440\u043E\u043A \u0441\u0434\u0430\u0447\u0438: " + this.stage.term + "
\n " + this.stage.cost + " \u0440\n
\n " + this.note_text + "\n
\n
"; + return "\n
\n \u0412 \u0440\u0430\u0431\u043E\u0442\u0435: " + this.stage.name + "
\n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430: " + this.stage.result + "
\n \u0421\u0440\u043E\u043A \u0441\u0434\u0430\u0447\u0438: " + this.stage.term + "
\n " + this.stage.cost + " \u0440\n
\n " + this.note_text + "\n
\n
"; }; /***/ }, @@ -1029,7 +1048,7 @@ }; function _template() { - return "
\n \u0417\u0410\u041A\u0420\u042B\u0422\u042C \u041F\u0420\u041E\u0415\u041A\u0422 \u0418 \u041E\u0421\u0422\u0410\u0412\u0418\u0422\u042C \u041E\u0422\u0417\u042B\u0412\n \n
"; + return "
\n \u0417\u0410\u041A\u0420\u042B\u0422\u042C \u041F\u0420\u041E\u0415\u041A\u0422 \u0418 \u041E\u0421\u0422\u0410\u0412\u0418\u0422\u042C \u041E\u0422\u0417\u042B\u0412\n \n \u0417\u0410\u041A\u0420\u042B\u0422\u042C \u041F\u0420\u041E\u0415\u041A\u0422 \u0418 \u041E\u0421\u0422\u0410\u0412\u0418\u0422\u042C \u041E\u0422\u0417\u042B\u0412\n \n
\n"; }; /***/ }, @@ -1047,7 +1066,7 @@ }; function _template() { - return "\n
  • \n " + this.text + "\n
    \n
  • \n\n"; + return "\n
  • \n " + this.text + "\n
    \n
  • "; }; /***/ }, @@ -1065,14 +1084,14 @@ }; function _template() { - return "\n
    \n
  • \n " + this.text + "\n
  • \n
    \n
    \n"; + return "\n
    \n \u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B. \u0441\u043A\u0430\u0447\u0430\u0442\u044C:
    \n \n " + this.text + "\n \n
    "; }; /***/ }, /* 14 */ /***/ function(module, exports) { - 'use strict'; + "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -1083,14 +1102,14 @@ }; function _template() { - return '\n\n \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\n ' + this.order.project.name + '\n\n\n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430\n ' + (this.order.secure ? 'Выбрана' : 'Не выбрана') + '\n\n\n \u0422\u0438\u043F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.building_classification ? this.order.project.realty.building_classification.name : 'не задан') + '\n\n \u041A\u043B\u0430\u0441\u0441\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.construction_type ? this.order.project.realty.construction_type.name : 'не задана') + '\n'; + return "\n
    \n
  • \n " + this.text + "\n
  • \n
    \n
    \n"; }; /***/ }, /* 15 */ /***/ function(module, exports) { - "use strict"; + 'use strict'; Object.defineProperty(exports, "__esModule", { value: true @@ -1101,7 +1120,7 @@ }; function _template() { - return "\n
    \n
    \n
    \n \u042D\u0422\u0410\u041F " + this.stage_num + "\n
    \n
    \n " + this.stage_status + "\n
    \n
    \n
    \n\n
    \n " + this.stage.name + "\n
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
    \n " + this.stage.result + "\n
    \n \u0426\u0435\u043D\u0430\n
    \n " + this.stage.cost + " \u20BD\n
    \n \u0421\u0440\u043E\u043A\n
    \n \u0434\u043E " + this.stage.term + "\n
    \n
    \n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
    \n\n
    "; + return '\n\n \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\n ' + this.order.project.name + '\n\n\n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430\n ' + (this.order.secure ? 'Выбрана' : 'Не выбрана') + '\n\n\n \u0422\u0438\u043F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.building_classification ? this.order.project.realty.building_classification.name : 'не задан') + '\n\n \u041A\u043B\u0430\u0441\u0441\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.construction_type ? this.order.project.realty.construction_type.name : 'не задана') + '\n'; }; /***/ }, @@ -1119,7 +1138,7 @@ }; function _template() { - return "\n
    \n " + this.file.name + " \n
    \n
    \n
    ;"; + return "\n
    \n
    \n
    \n \u042D\u0422\u0410\u041F " + this.stage_num + "\n
    \n
    \n " + this.stage_status + "\n
    \n
    \n
    \n\n
    \n " + this.stage.name + "\n
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
    \n " + this.stage.result + "\n
    \n \u0426\u0435\u043D\u0430\n
    \n " + this.stage.cost + " \u20BD\n
    \n \u0421\u0440\u043E\u043A\n
    \n \u0434\u043E " + this.stage.term + "\n
    \n
    \n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
    \n\n
    "; }; /***/ }, @@ -1137,11 +1156,29 @@ }; function _template() { - return "\n
    \n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430 \u043D\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u0430\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    "; + return "\n
    \n " + this.file.name + " \n
    \n
    \n
    ;"; }; /***/ }, /* 18 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.default = function (ctx) { + return _template.call(ctx, ctx); + }; + + function _template() { + return "\n
    \n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430 \u043D\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u0430\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    "; + }; + +/***/ }, +/* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1538,7 +1575,7 @@ exports.StageInWork = StageInWork; /***/ }, -/* 19 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1591,9 +1628,6 @@ key: '_onLoadData', value: function _onLoadData(json) { var self = this; - // console.log('mesages json = ', json); - // console.log('$inbox = ', this.$inbox); - // console.log("messages render start"); self.$inbox.html(""); $.each(json.results, function (i, v) { var senderName = 'Вы'; @@ -1621,7 +1655,7 @@ exports.MessagesController = MessagesController; /***/ }, -/* 20 */ +/* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1708,7 +1742,7 @@ exports.DocumentsController = DocumentsController; /***/ }, -/* 21 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1716,15 +1750,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.bindCtrlEnterSendMessage = exports.bindDeleteContact = exports.bindTeams = exports.bindGetUserMessages = exports.bindUserContacts = exports.bindOnTabs = exports.bindArbitrationSend = exports.bindOrderInfo = exports.bindOrders = undefined; + exports.restoreTabFromHash = exports.bindCtrlEnterSendMessage = exports.bindDeleteContact = exports.bindTeams = exports.bindGetUserMessages = exports.bindUserContacts = exports.bindOnTabs = exports.bindArbitrationSend = exports.bindOrderInfo = exports.bindOrders = undefined; var _utils = __webpack_require__(3); - var _messageCounters = __webpack_require__(22); + var _messageCounters = __webpack_require__(23); var _loaders = __webpack_require__(4); - var _notes = __webpack_require__(23); + var _notes = __webpack_require__(24); function dialog(message, yesCallback, notCallback) { $("#dialog_delete .modal-title").html(message); @@ -1741,6 +1775,62 @@ }); } + function isNullOrders() { + var buttons = { + btnApprove: $('#btnApprove'), // "Согласовать" + btnChange: $('#btnChange'), // "Отправить на внесение изменений" + btnsToArchive: $('.js-btnToArchive'), // "Отказаться от заказа" + btnToArchive: $('#btnToArchive'), // "Отказаться и отправить в Архив" + btnReserve: $('#btnReserve'), // "Зарезервировать" + btnsArbitration: $('.js-btnArbitration'), // "Обратиться в арбитраж" + btnSendReview: $('#order-review-add') // "Оставить отзыв" + }; + var stages_elements = { + $approve: $('#conditions-approve'), //1. Согласование условия + $reserve: $('#reserveSpace'), //2. Резервирование (Отобразить) + $works: $('#completeWork') //3. Выполненная работа + }; + + var $orderStagesContainer = $('#order-stages'); + + // hide all buttons + for (var key in buttons) { + if (buttons[key].length) buttons[key].hide(); + } + + for (var _key in stages_elements) { + stages_elements[_key].show(); + } + if ($orderStagesContainer.length) $orderStagesContainer.parent().hide(); + } + + function restoreTabFromHash() { + var currentHash = URI(location.href).hash(); + if (currentHash.indexOf("#order") == 0) { + $("a[href='#tab2']").trigger('click'); + // console.log("click on ", "#orderBlock" + currentHash.replace("#order", "")); + var obj_id = currentHash.replace("#order", ""); + // console.log("obj_id = ", obj_id); + if (obj_id) { + $("#orderBlock" + currentHash.replace("#order", "")).trigger('click'); + } else { + var $order_block = $(".order-block"); + if ($order_block.length) { + $order_block.first().trigger('click'); + } else { + window.location.hash = '#order'; + isNullOrders(); + } + } + } else if (currentHash.indexOf("#user") == 0) { + $("a[href='#tab1']").trigger('click'); + } else if (currentHash.indexOf("#teamorder") == 0 || currentHash.indexOf("#myteam") == 0) { + $("a[href='#tab3']").trigger('click'); + } else { + $("a[href='#tab1']").trigger('click'); + } + } + function bindOrders() { $('.order-block').on('click', function (event) { event.preventDefault(); @@ -1837,6 +1927,7 @@ } function bindTeams() { + var message_tmpl = (0, _loaders.loadTemplate)('message_tmpl'); $('.team-block').on('click', function () { (0, _messageCounters.onClickCardWithCount)($(this)); $('.team-order-block, .team-block').each(function () { @@ -1887,7 +1978,10 @@ senderName = v.sender.username; className = ''; } - inbox.innerHTML += '
    ' + '

    ' + senderName + '

    ' + v.created + '
    ' + '

    ' + v.text + '

    '; + inbox.innerHTML += message_tmpl({ className: className, senderName: senderName, message: v }); + // inbox.innerHTML += '
    ' + + // '

    ' + senderName + '

    ' + v.created + '
    ' + + // '

    ' + v.text + '

    '; }); var height = inbox.scrollHeight; inbox.scrollTop = height; @@ -1995,7 +2089,13 @@ var ordHashId = liveHash.replace("#order", ""); $("#orderBlock" + ordHashId).trigger('click'); } else { - $(".order-block").first().trigger('click'); + var $order_block = $(".order-block"); + if ($order_block.length) { + $order_block.first().trigger('click'); + } else { + window.location.hash = '#order'; + isNullOrders(); + } } }, 100); break; @@ -2069,6 +2169,7 @@ } function bindGetUserMessages() { + var message_tmpl = (0, _loaders.loadTemplate)('message_tmpl'); $('.user-block').on('click', function () { (0, _messageCounters.onClickCardWithCount)($(this)); // var newCount = parseInt($("#count-tab-contact").text()); @@ -2086,9 +2187,6 @@ var sumSenderRecipent = parseInt(userId) + parseInt(contactId); $("#message-chat-space").removeClass().addClass("contact-space" + sumSenderRecipent); - // var currNewCount = parseInt($(".contact-count-" + sumSenderRecipent).text()); - // var resCount = newCount - currNewCount; - // $("#count-tab-contact").text(resCount); $(".contact-count-" + sumSenderRecipent).text(0); var docList = document.getElementById('documentSpace'); inbox.innerHTML = ''; @@ -2114,7 +2212,10 @@ senderName = v.sender.username; className = ''; } - inbox.innerHTML += '
    ' + '

    ' + senderName + '

    ' + v.created + '
    ' + '

    ' + v.text + '

    '; + inbox.innerHTML += message_tmpl({ className: className, senderName: senderName, message: v }); + // '
    ' + + // '

    ' + senderName + '

    ' + v.created + '
    ' + + // '

    ' + v.text + '

    ' }); var height = inbox.scrollHeight; inbox.scrollTop = height; @@ -2228,9 +2329,10 @@ exports.bindTeams = bindTeams; exports.bindDeleteContact = bindDeleteContact; exports.bindCtrlEnterSendMessage = bindCtrlEnterSendMessage; + exports.restoreTabFromHash = restoreTabFromHash; /***/ }, -/* 22 */ +/* 23 */ /***/ function(module, exports) { 'use strict'; @@ -2310,7 +2412,7 @@ exports.onClickCardWithCount = onClickCardWithCount; /***/ }, -/* 23 */ +/* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -2440,7 +2542,7 @@ exports.bindRemoveNotes = bindRemoveNotes; /***/ }, -/* 24 */ +/* 25 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -2475,9 +2577,6 @@ dataType: 'json', done: function done(e, data) { $.each(data.result.files, function (index, file) { - // var htmlImg = '
    ' + file.name + '' + - // '
    ' + - // '
    '; var htmlImg = document_before_upload_tmpl({ file: file }); $(htmlImg).appendTo("#document-send-contact"); }); @@ -2499,7 +2598,6 @@ recipent: $("#chat-order-add #recipentId").val(), order: $("#chat-order-add #orderId").val() }; - // console.log(data.formData); }); $('#upload-document-order').fileupload({ @@ -2512,8 +2610,6 @@ dataType: 'json', done: function done(e, data) { $.each(data.result.files, function (index, file) { - // var htmlImg = '
    ' + file.name + '' + - // '
    '; var htmlImg = document_before_upload_tmpl({ file: file }); $(htmlImg).appendTo("#document-send-order"); }); @@ -2552,8 +2648,6 @@ var currentValue = $("#documentSendIds").val(); currentValue += file.id + ';'; $("#documentSendIds").val(currentValue); - // var htmlImg = '
    ' + file.name + '' + - // '
    '; var htmlImg = document_before_upload_tmpl({ file: file }); $(htmlImg).appendTo("#document-send"); }); @@ -2597,42 +2691,6 @@ exports.uploadDocumentsTeamInit = uploadDocumentsTeamInit; exports.bindRemoveDocuments = bindRemoveDocuments; -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.restoreTabFromHash = undefined; - - var _utils = __webpack_require__(3); - - function restoreTabFromHash() { - var currentHash = URI(location.href).hash(); - if (currentHash.indexOf("#order") == 0) { - $("a[href='#tab2']").trigger('click'); - // console.log("click on ", "#orderBlock" + currentHash.replace("#order", "")); - var obj_id = currentHash.replace("#order", ""); - // console.log("obj_id = ", obj_id); - if (obj_id) { - $("#orderBlock" + currentHash.replace("#order", "")).trigger('click'); - } else { - $('.order-block').first().trigger('click'); - } - } else if (currentHash.indexOf("#user") == 0) { - $("a[href='#tab1']").trigger('click'); - } else if (currentHash.indexOf("#teamorder") == 0 || currentHash.indexOf("#myteam") == 0) { - $("a[href='#tab3']").trigger('click'); - } else { - $("a[href='#tab1']").trigger('click'); - } - } - - exports.restoreTabFromHash = restoreTabFromHash; - /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { @@ -2675,54 +2733,9 @@ $(this).removeClass('orAct'); }); $this.addClass('orAct'); - // var inbox = document.getElementById('message-chat-order-space'); - // var docList = document.getElementById('documentOrderSpace'); - // inbox.innerHTML = ''; - // docList.innerHTML = ''; - - var orderId = $this.data('id'); - // let projectId = $this.data('project-id'); - // let recipentId = $this.data('recipent-id'); - // let orderName = $this.data('order-name'); location.hash = '#order' + orderId; - // console.log(orderId); window.chatController.create(orderId); - // hide all buttons - // console.log('chat-buttons -->', $(".chat-button")); - // $(".chat-button").hide(); - // $.ajax({ - // url: '/api/message', - // type: 'GET', - // beforeSend: function (xhr) { - // xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')) - // }, - // data: {'order': orderId, 'team__isnull': 'true'}, - // dataType: 'json', - // success: function (json) { - // $.each(json.results, function (i, v) { - // var senderName = 'Вы'; - // var className = 'youChat'; - // - // if (v.sender.id !== userId) { - // senderName = v.sender.username; - // className = ''; - // } - // - // inbox.innerHTML += '
    ' + - // '

    ' + senderName + '

    ' + v.created + '
    ' + - // '

    ' + v.text + '

    '; - // - // }); - // var height = inbox.scrollHeight; - // inbox.scrollTop = height; - // } - // }); - - // $("#order-stages").html(""); - // $("#completeWork").hide(); - // $("#add-form-order-note").hide(); - // $("#reserveSpace").hide(); }); } @@ -2730,13 +2743,17 @@ /***/ }, /* 27 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); + exports.chatTeamsInit = exports.chatOrdersInit = exports.chatContactsInit = undefined; + + var _loaders = __webpack_require__(4); + function chatContactsInit() { /** * Bind на кнопку "Отправить" в Закладке "Личные контакты" @@ -2749,33 +2766,40 @@ var sendLinks = $("#document-send-contact a"); if (chatMessage || sendLinks.length > 0) { - $("#contact-chat-form .errorEmptyMessage").hide(); - - var sendLinkIds = ""; - var documentLinks = ""; - var documentAttachFiles = ""; - - $.each(sendLinks, function (i, v) { - sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + '' + $(this).text() + '' + '
  • '; - }); - // console.log("sendLinkIds = ", sendLinkIds); - socket.send_message({ - "format_type": "add_message_contact", - "data": { - "sender_id": senderId, - "recipent_id": recipentId, - "chat_message": chatMessage, - "document_send_links": sendLinkIds, - "document_data": { - "document_links": documentLinks, - "document_attach_files": documentAttachFiles + var sendLinkIds; + var documentLinks; + var documentAttachFiles; + + (function () { + $("#contact-chat-form .errorEmptyMessage").hide(); + + sendLinkIds = ""; + documentLinks = ""; + documentAttachFiles = ""; + + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); + var document_link_tmpl = (0, _loaders.loadTemplate)('document_link_tmpl'); + $.each(sendLinks, function (i, v) { + sendLinkIds += $(this).attr('data-id') + ';'; + documentLinks += document_link_tmpl({ href: $(this).attr('href'), text: $(this).text() }); + documentAttachFiles += document_attach_file_tmpl({ href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text() }); + }); + socket.send_message({ + "format_type": "add_message_contact", + "data": { + "sender_id": senderId, + "recipent_id": recipentId, + "chat_message": chatMessage, + "document_send_links": sendLinkIds, + "document_data": { + "document_links": documentLinks, + "document_attach_files": documentAttachFiles + } } - } - }); - $("#chat").val(""); - $("#document-send-contact").html(""); + }); + $("#chat").val(""); + $("#document-send-contact").html(""); + })(); } else { $("#contact-chat-form .errorEmptyMessage").show(); } @@ -2794,31 +2818,40 @@ var orderId = $("#chat-order-add #orderId").val(); var sendLinks = $("#document-send-order a"); if (chatMessage || sendLinks.length > 0) { - var sendLinkIds = ""; - var documentLinks = ""; - var documentAttachFiles = ""; - $.each(sendLinks, function (i, v) { - sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + '' + $(this).text() + '' + '
  • '; - }); - socket.send_message({ - "format_type": "add_message_order", - "data": { - "sender_id": senderId, - "recipent_id": recipentId, - "chat_message": chatMessage, - "order_id": orderId, - "document_send_links": sendLinkIds, - "document_data": { - "document_links": documentLinks, - "document_attach_files": documentAttachFiles + var sendLinkIds; + var documentLinks; + var documentAttachFiles; + + (function () { + sendLinkIds = ""; + documentLinks = ""; + documentAttachFiles = ""; + + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); + var document_link_tmpl = (0, _loaders.loadTemplate)('document_link_tmpl'); + $.each(sendLinks, function (i, v) { + sendLinkIds += $(this).attr('data-id') + ';'; + documentLinks += document_link_tmpl({ href: $(this).attr('href'), text: $(this).text() }); + documentAttachFiles += document_attach_file_tmpl({ href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text() }); + }); + socket.send_message({ + "format_type": "add_message_order", + "data": { + "sender_id": senderId, + "recipent_id": recipentId, + "chat_message": chatMessage, + "order_id": orderId, + "document_send_links": sendLinkIds, + "document_data": { + "document_links": documentLinks, + "document_attach_files": documentAttachFiles + } } - } - }); - $("#chat-order-add #chat").val(""); - $("#document-send-order").html(""); + }); + $("#chat-order-add #chat").val(""); + $("#document-send-order").html(""); + })(); } else { $("#chat-order-add .errorEmptyMessage").show(); } @@ -2836,35 +2869,45 @@ var documentSendIds = $("#documentSendIds").val(); var teamIds = $("#team-chat-form #teamIds").val(); var sendLinks = $("#document-send a"); + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); if (chatMessage || sendLinks.length > 0) { - var sendLinkIds = ""; - var documentLinks = ""; - var documentAttachFiles = ""; - $.each(sendLinks, function (i, v) { - sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + '' + $(this).text() + '' + '
  • '; - }); - socket.send_message({ - "format_type": "add_message_team", - "data": { - "sender_id": senderId, - // "recipent_id": recipentId, - "chat_message": chatMessage, - "team_id": teamId, - "team_ids": teamIds, - // "order_id": orderId, - "document_send_links": sendLinkIds, - "document_data": { - "document_links": documentLinks, - "document_attach_files": documentAttachFiles + var sendLinkIds; + var documentLinks; + var documentAttachFiles; + + (function () { + sendLinkIds = ""; + documentLinks = ""; + documentAttachFiles = ""; + + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); + var document_link_tmpl = (0, _loaders.loadTemplate)('document_link_tmpl'); + $.each(sendLinks, function (i, v) { + sendLinkIds += $(this).attr('data-id') + ';'; + documentLinks += document_link_tmpl({ href: $(this).attr('href'), text: $(this).text() }); + documentAttachFiles += document_attach_file_tmpl({ href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text() }); + }); + socket.send_message({ + "format_type": "add_message_team", + "data": { + "sender_id": senderId, + // "recipent_id": recipentId, + "chat_message": chatMessage, + "team_id": teamId, + "team_ids": teamIds, + // "order_id": orderId, + "document_send_links": sendLinkIds, + "document_data": { + "document_links": documentLinks, + "document_attach_files": documentAttachFiles + } } - } - }); + }); - $("#team-chat-form #chatText").val(""); - $("#document-send").html(""); - $("#documentSendIds").val(""); + $("#team-chat-form #chatText").val(""); + $("#document-send").html(""); + $("#documentSendIds").val(""); + })(); } else { $("#team-chat-form .errorEmptyMessage").show(); } @@ -2888,7 +2931,7 @@ var _loaders = __webpack_require__(4); - var _messageCounters = __webpack_require__(22); + var _messageCounters = __webpack_require__(23); function getUserPlace() { /** diff --git a/assets/js/build/chat_customer_oop.js b/assets/js/build/chat_customer_oop.js index d4d5517..908a356 100644 --- a/assets/js/build/chat_customer_oop.js +++ b/assets/js/build/chat_customer_oop.js @@ -48,17 +48,15 @@ var _ChatCustomerPageController = __webpack_require__(29); - var _BINDS = __webpack_require__(21); - - var _parts = __webpack_require__(25); + var _BINDS = __webpack_require__(22); var _chats = __webpack_require__(27); - var _documents = __webpack_require__(24); + var _documents = __webpack_require__(25); var _wsChatConnect = __webpack_require__(28); - var _notes = __webpack_require__(23); + var _notes = __webpack_require__(24); var _archiveProjects = __webpack_require__(26); @@ -82,7 +80,7 @@ (0, _BINDS.bindOrders)(); (0, _BINDS.bindOrderInfo)(); (0, _BINDS.bindOnTabs)(); - (0, _parts.restoreTabFromHash)(); + (0, _BINDS.restoreTabFromHash)(); (0, _BINDS.bindUserContacts)(); (0, _BINDS.bindGetUserMessages)(); (0, _archiveProjects.bindArchiveProjects)(); @@ -191,23 +189,27 @@ var _document_attach_file_tmpl2 = _interopRequireDefault(_document_attach_file_tmpl); - var _note_tmpl = __webpack_require__(13); + var _document_link_tmpl = __webpack_require__(13); + + var _document_link_tmpl2 = _interopRequireDefault(_document_link_tmpl); + + var _note_tmpl = __webpack_require__(14); var _note_tmpl2 = _interopRequireDefault(_note_tmpl); - var _order_info_tmpl = __webpack_require__(14); + var _order_info_tmpl = __webpack_require__(15); var _order_info_tmpl2 = _interopRequireDefault(_order_info_tmpl); - var _stage_contractor_approve_tmpl = __webpack_require__(15); + var _stage_contractor_approve_tmpl = __webpack_require__(16); var _stage_contractor_approve_tmpl2 = _interopRequireDefault(_stage_contractor_approve_tmpl); - var _document_before_upload_tmpl = __webpack_require__(16); + var _document_before_upload_tmpl = __webpack_require__(17); var _document_before_upload_tmpl2 = _interopRequireDefault(_document_before_upload_tmpl); - var _switch_to_protected_tmpl = __webpack_require__(17); + var _switch_to_protected_tmpl = __webpack_require__(18); var _switch_to_protected_tmpl2 = _interopRequireDefault(_switch_to_protected_tmpl); @@ -223,6 +225,7 @@ bntCompleteStage_tmpl: _bntCompleteStage_tmpl2.default, btnSendReview_tmpl: _btnSendReview_tmpl2.default, document_attach_file_tmpl: _document_attach_file_tmpl2.default, + document_link_tmpl: _document_link_tmpl2.default, note_tmpl: _note_tmpl2.default, order_info_tmpl: _order_info_tmpl2.default, stage_contractor_approve_tmpl: _stage_contractor_approve_tmpl2.default, @@ -251,7 +254,7 @@ }; function _template() { - return '\n
    \n \n
    \n
    \n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
    \n
    \n ' + (this.stage_status ? this.stage_status : 'не согласован') + '\n
    \n
    \n
    \n
    \n \n \n

    \n \n \n

    \n \n

    \n \n \n \n \n

    \n \n \n

    \n
    \n
    '; + return '\n
    \n \n
    \n
    \n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
    \n
    \n ' + (this.stage_status ? this.stage_status : '') + '\n
    \n
    \n
    \n
    \n \n \n

    \n \n \n

    \n \n

    \n \n \n \n \n

    \n \n \n

    \n
    \n
    '; }; /***/ }, @@ -269,7 +272,7 @@ }; function _template() { - return '\n
    \n
    \n
    \n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
    \n
    \n ' + (this.stage_status ? this.stage_status : 'не согласован') + '\n
    \n
    \n
    \n\n
    \n ' + this.stage.name + '\n
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
    \n ' + this.stage.result + '\n
    \n \u0426\u0435\u043D\u0430\n
    \n ' + this.stage.cost + ' \u20BD\n
    \n \u0421\u0440\u043E\u043A\n
    \n \u0434\u043E ' + this.stage.term + '\n
    \n
    \n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
    \n\n
    '; + return '\n
    \n
    \n
    \n \u042D\u0422\u0410\u041F ' + this.stage_num + '\n
    \n
    \n ' + (this.stage_status ? this.stage_status : '') + '\n
    \n
    \n
    \n\n
    \n ' + this.stage.name + '\n
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
    \n ' + this.stage.result + '\n
    \n \u0426\u0435\u043D\u0430\n
    \n ' + this.stage.cost + ' \u20BD\n
    \n \u0421\u0440\u043E\u043A\n
    \n \u0434\u043E ' + this.stage.term + '\n
    \n
    \n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
    \n\n
    '; }; /***/ }, @@ -305,7 +308,7 @@ }; function _template() { - return "\n
    \n
    \n

    " + this.senderName + "

    " + this.message.created + "\n
    \n

    " + this.message.text + "

    \n
    "; + return "\n
    \n
    \n
    " + this.senderName + "
    " + this.message.created + "
    \n
    \n
    \n " + this.message.text + "\n
    \n
    "; }; /***/ }, @@ -323,7 +326,7 @@ }; function _template() { - return "\n
    \n \u0412 \u0440\u0430\u0431\u043E\u0442\u0435: " + this.stage.name + "
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430: " + this.stage.result + "
    \n \u0421\u0440\u043E\u043A \u0441\u0434\u0430\u0447\u0438: " + this.stage.term + "
    \n " + this.stage.cost + " \u0440\n
    \n " + this.note_text + "\n
    \n
    "; + return "\n
    \n \u0412 \u0440\u0430\u0431\u043E\u0442\u0435: " + this.stage.name + "
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430: " + this.stage.result + "
    \n \u0421\u0440\u043E\u043A \u0441\u0434\u0430\u0447\u0438: " + this.stage.term + "
    \n " + this.stage.cost + " \u0440\n
    \n " + this.note_text + "\n
    \n
    "; }; /***/ }, @@ -359,7 +362,7 @@ }; function _template() { - return "
    \n \u0417\u0410\u041A\u0420\u042B\u0422\u042C \u041F\u0420\u041E\u0415\u041A\u0422 \u0418 \u041E\u0421\u0422\u0410\u0412\u0418\u0422\u042C \u041E\u0422\u0417\u042B\u0412\n \n
    "; + return "
    \n \u0417\u0410\u041A\u0420\u042B\u0422\u042C \u041F\u0420\u041E\u0415\u041A\u0422 \u0418 \u041E\u0421\u0422\u0410\u0412\u0418\u0422\u042C \u041E\u0422\u0417\u042B\u0412\n \n \u0417\u0410\u041A\u0420\u042B\u0422\u042C \u041F\u0420\u041E\u0415\u041A\u0422 \u0418 \u041E\u0421\u0422\u0410\u0412\u0418\u0422\u042C \u041E\u0422\u0417\u042B\u0412\n \n
    \n"; }; /***/ }, @@ -377,7 +380,7 @@ }; function _template() { - return "\n
  • \n " + this.text + "\n
    \n
  • \n\n"; + return "\n
  • \n " + this.text + "\n
    \n
  • "; }; /***/ }, @@ -395,14 +398,14 @@ }; function _template() { - return "\n
    \n
  • \n " + this.text + "\n
  • \n
    \n
    \n"; + return "\n
    \n \u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u043D\u044B\u0439 \u0444\u0430\u0439\u043B. \u0441\u043A\u0430\u0447\u0430\u0442\u044C:
    \n \n " + this.text + "\n \n
    "; }; /***/ }, /* 14 */ /***/ function(module, exports) { - 'use strict'; + "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -413,14 +416,14 @@ }; function _template() { - return '\n\n \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\n ' + this.order.project.name + '\n\n\n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430\n ' + (this.order.secure ? 'Выбрана' : 'Не выбрана') + '\n\n\n \u0422\u0438\u043F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.building_classification ? this.order.project.realty.building_classification.name : 'не задан') + '\n\n \u041A\u043B\u0430\u0441\u0441\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.construction_type ? this.order.project.realty.construction_type.name : 'не задана') + '\n'; + return "\n
    \n
  • \n " + this.text + "\n
  • \n
    \n
    \n"; }; /***/ }, /* 15 */ /***/ function(module, exports) { - "use strict"; + 'use strict'; Object.defineProperty(exports, "__esModule", { value: true @@ -431,7 +434,7 @@ }; function _template() { - return "\n
    \n
    \n
    \n \u042D\u0422\u0410\u041F " + this.stage_num + "\n
    \n
    \n " + this.stage_status + "\n
    \n
    \n
    \n\n
    \n " + this.stage.name + "\n
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
    \n " + this.stage.result + "\n
    \n \u0426\u0435\u043D\u0430\n
    \n " + this.stage.cost + " \u20BD\n
    \n \u0421\u0440\u043E\u043A\n
    \n \u0434\u043E " + this.stage.term + "\n
    \n
    \n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
    \n\n
    "; + return '\n\n \u041D\u0430\u0437\u0432\u0430\u043D\u0438\u0435\n ' + this.order.project.name + '\n\n\n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430\n ' + (this.order.secure ? 'Выбрана' : 'Не выбрана') + '\n\n\n \u0422\u0438\u043F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.building_classification ? this.order.project.realty.building_classification.name : 'не задан') + '\n\n \u041A\u043B\u0430\u0441\u0441\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F \u0437\u0434\u0430\u043D\u0438\u044F\n ' + (this.order.project.realty.construction_type ? this.order.project.realty.construction_type.name : 'не задана') + '\n'; }; /***/ }, @@ -449,7 +452,7 @@ }; function _template() { - return "\n
    \n " + this.file.name + " \n
    \n
    \n
    ;"; + return "\n
    \n
    \n
    \n \u042D\u0422\u0410\u041F " + this.stage_num + "\n
    \n
    \n " + this.stage_status + "\n
    \n
    \n
    \n\n
    \n " + this.stage.name + "\n
    \n \u0420\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442 \u044D\u0442\u0430\u043F\u0430\n
    \n " + this.stage.result + "\n
    \n \u0426\u0435\u043D\u0430\n
    \n " + this.stage.cost + " \u20BD\n
    \n \u0421\u0440\u043E\u043A\n
    \n \u0434\u043E " + this.stage.term + "\n
    \n
    \n \u0421\u0440\u043E\u043A \u044D\u0442\u0430\u043F\u0430 \u0440\u0430\u0441\u0447\u0438\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0441 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u044F \u0441\u0440\u0435\u0434\u0441\u0442\u0432\n
    \n\n
    "; }; /***/ }, @@ -467,11 +470,29 @@ }; function _template() { - return "\n
    \n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430 \u043D\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u0430\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    "; + return "\n
    \n " + this.file.name + " \n
    \n
    \n
    ;"; }; /***/ }, /* 18 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + exports.default = function (ctx) { + return _template.call(ctx, ctx); + }; + + function _template() { + return "\n
    \n \u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0430\u044F \u0441\u0434\u0435\u043B\u043A\u0430 \u043D\u0435 \u0430\u043A\u0442\u0438\u0432\u043D\u0430\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    "; + }; + +/***/ }, +/* 19 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -868,7 +889,7 @@ exports.StageInWork = StageInWork; /***/ }, -/* 19 */ +/* 20 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -921,9 +942,6 @@ key: '_onLoadData', value: function _onLoadData(json) { var self = this; - // console.log('mesages json = ', json); - // console.log('$inbox = ', this.$inbox); - // console.log("messages render start"); self.$inbox.html(""); $.each(json.results, function (i, v) { var senderName = 'Вы'; @@ -951,7 +969,7 @@ exports.MessagesController = MessagesController; /***/ }, -/* 20 */ +/* 21 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1038,7 +1056,7 @@ exports.DocumentsController = DocumentsController; /***/ }, -/* 21 */ +/* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1046,15 +1064,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.bindCtrlEnterSendMessage = exports.bindDeleteContact = exports.bindTeams = exports.bindGetUserMessages = exports.bindUserContacts = exports.bindOnTabs = exports.bindArbitrationSend = exports.bindOrderInfo = exports.bindOrders = undefined; + exports.restoreTabFromHash = exports.bindCtrlEnterSendMessage = exports.bindDeleteContact = exports.bindTeams = exports.bindGetUserMessages = exports.bindUserContacts = exports.bindOnTabs = exports.bindArbitrationSend = exports.bindOrderInfo = exports.bindOrders = undefined; var _utils = __webpack_require__(3); - var _messageCounters = __webpack_require__(22); + var _messageCounters = __webpack_require__(23); var _loaders = __webpack_require__(4); - var _notes = __webpack_require__(23); + var _notes = __webpack_require__(24); function dialog(message, yesCallback, notCallback) { $("#dialog_delete .modal-title").html(message); @@ -1071,6 +1089,62 @@ }); } + function isNullOrders() { + var buttons = { + btnApprove: $('#btnApprove'), // "Согласовать" + btnChange: $('#btnChange'), // "Отправить на внесение изменений" + btnsToArchive: $('.js-btnToArchive'), // "Отказаться от заказа" + btnToArchive: $('#btnToArchive'), // "Отказаться и отправить в Архив" + btnReserve: $('#btnReserve'), // "Зарезервировать" + btnsArbitration: $('.js-btnArbitration'), // "Обратиться в арбитраж" + btnSendReview: $('#order-review-add') // "Оставить отзыв" + }; + var stages_elements = { + $approve: $('#conditions-approve'), //1. Согласование условия + $reserve: $('#reserveSpace'), //2. Резервирование (Отобразить) + $works: $('#completeWork') //3. Выполненная работа + }; + + var $orderStagesContainer = $('#order-stages'); + + // hide all buttons + for (var key in buttons) { + if (buttons[key].length) buttons[key].hide(); + } + + for (var _key in stages_elements) { + stages_elements[_key].show(); + } + if ($orderStagesContainer.length) $orderStagesContainer.parent().hide(); + } + + function restoreTabFromHash() { + var currentHash = URI(location.href).hash(); + if (currentHash.indexOf("#order") == 0) { + $("a[href='#tab2']").trigger('click'); + // console.log("click on ", "#orderBlock" + currentHash.replace("#order", "")); + var obj_id = currentHash.replace("#order", ""); + // console.log("obj_id = ", obj_id); + if (obj_id) { + $("#orderBlock" + currentHash.replace("#order", "")).trigger('click'); + } else { + var $order_block = $(".order-block"); + if ($order_block.length) { + $order_block.first().trigger('click'); + } else { + window.location.hash = '#order'; + isNullOrders(); + } + } + } else if (currentHash.indexOf("#user") == 0) { + $("a[href='#tab1']").trigger('click'); + } else if (currentHash.indexOf("#teamorder") == 0 || currentHash.indexOf("#myteam") == 0) { + $("a[href='#tab3']").trigger('click'); + } else { + $("a[href='#tab1']").trigger('click'); + } + } + function bindOrders() { $('.order-block').on('click', function (event) { event.preventDefault(); @@ -1167,6 +1241,7 @@ } function bindTeams() { + var message_tmpl = (0, _loaders.loadTemplate)('message_tmpl'); $('.team-block').on('click', function () { (0, _messageCounters.onClickCardWithCount)($(this)); $('.team-order-block, .team-block').each(function () { @@ -1217,7 +1292,10 @@ senderName = v.sender.username; className = ''; } - inbox.innerHTML += '
    ' + '

    ' + senderName + '

    ' + v.created + '
    ' + '

    ' + v.text + '

    '; + inbox.innerHTML += message_tmpl({ className: className, senderName: senderName, message: v }); + // inbox.innerHTML += '
    ' + + // '

    ' + senderName + '

    ' + v.created + '
    ' + + // '

    ' + v.text + '

    '; }); var height = inbox.scrollHeight; inbox.scrollTop = height; @@ -1325,7 +1403,13 @@ var ordHashId = liveHash.replace("#order", ""); $("#orderBlock" + ordHashId).trigger('click'); } else { - $(".order-block").first().trigger('click'); + var $order_block = $(".order-block"); + if ($order_block.length) { + $order_block.first().trigger('click'); + } else { + window.location.hash = '#order'; + isNullOrders(); + } } }, 100); break; @@ -1399,6 +1483,7 @@ } function bindGetUserMessages() { + var message_tmpl = (0, _loaders.loadTemplate)('message_tmpl'); $('.user-block').on('click', function () { (0, _messageCounters.onClickCardWithCount)($(this)); // var newCount = parseInt($("#count-tab-contact").text()); @@ -1416,9 +1501,6 @@ var sumSenderRecipent = parseInt(userId) + parseInt(contactId); $("#message-chat-space").removeClass().addClass("contact-space" + sumSenderRecipent); - // var currNewCount = parseInt($(".contact-count-" + sumSenderRecipent).text()); - // var resCount = newCount - currNewCount; - // $("#count-tab-contact").text(resCount); $(".contact-count-" + sumSenderRecipent).text(0); var docList = document.getElementById('documentSpace'); inbox.innerHTML = ''; @@ -1444,7 +1526,10 @@ senderName = v.sender.username; className = ''; } - inbox.innerHTML += '
    ' + '

    ' + senderName + '

    ' + v.created + '
    ' + '

    ' + v.text + '

    '; + inbox.innerHTML += message_tmpl({ className: className, senderName: senderName, message: v }); + // '
    ' + + // '

    ' + senderName + '

    ' + v.created + '
    ' + + // '

    ' + v.text + '

    ' }); var height = inbox.scrollHeight; inbox.scrollTop = height; @@ -1558,9 +1643,10 @@ exports.bindTeams = bindTeams; exports.bindDeleteContact = bindDeleteContact; exports.bindCtrlEnterSendMessage = bindCtrlEnterSendMessage; + exports.restoreTabFromHash = restoreTabFromHash; /***/ }, -/* 22 */ +/* 23 */ /***/ function(module, exports) { 'use strict'; @@ -1640,7 +1726,7 @@ exports.onClickCardWithCount = onClickCardWithCount; /***/ }, -/* 23 */ +/* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1770,7 +1856,7 @@ exports.bindRemoveNotes = bindRemoveNotes; /***/ }, -/* 24 */ +/* 25 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -1805,9 +1891,6 @@ dataType: 'json', done: function done(e, data) { $.each(data.result.files, function (index, file) { - // var htmlImg = '
    ' + file.name + '' + - // '
    ' + - // '
    '; var htmlImg = document_before_upload_tmpl({ file: file }); $(htmlImg).appendTo("#document-send-contact"); }); @@ -1829,7 +1912,6 @@ recipent: $("#chat-order-add #recipentId").val(), order: $("#chat-order-add #orderId").val() }; - // console.log(data.formData); }); $('#upload-document-order').fileupload({ @@ -1842,8 +1924,6 @@ dataType: 'json', done: function done(e, data) { $.each(data.result.files, function (index, file) { - // var htmlImg = '
    ' + file.name + '' + - // '
    '; var htmlImg = document_before_upload_tmpl({ file: file }); $(htmlImg).appendTo("#document-send-order"); }); @@ -1882,8 +1962,6 @@ var currentValue = $("#documentSendIds").val(); currentValue += file.id + ';'; $("#documentSendIds").val(currentValue); - // var htmlImg = '
    ' + file.name + '' + - // '
    '; var htmlImg = document_before_upload_tmpl({ file: file }); $(htmlImg).appendTo("#document-send"); }); @@ -1927,42 +2005,6 @@ exports.uploadDocumentsTeamInit = uploadDocumentsTeamInit; exports.bindRemoveDocuments = bindRemoveDocuments; -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.restoreTabFromHash = undefined; - - var _utils = __webpack_require__(3); - - function restoreTabFromHash() { - var currentHash = URI(location.href).hash(); - if (currentHash.indexOf("#order") == 0) { - $("a[href='#tab2']").trigger('click'); - // console.log("click on ", "#orderBlock" + currentHash.replace("#order", "")); - var obj_id = currentHash.replace("#order", ""); - // console.log("obj_id = ", obj_id); - if (obj_id) { - $("#orderBlock" + currentHash.replace("#order", "")).trigger('click'); - } else { - $('.order-block').first().trigger('click'); - } - } else if (currentHash.indexOf("#user") == 0) { - $("a[href='#tab1']").trigger('click'); - } else if (currentHash.indexOf("#teamorder") == 0 || currentHash.indexOf("#myteam") == 0) { - $("a[href='#tab3']").trigger('click'); - } else { - $("a[href='#tab1']").trigger('click'); - } - } - - exports.restoreTabFromHash = restoreTabFromHash; - /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { @@ -2005,54 +2047,9 @@ $(this).removeClass('orAct'); }); $this.addClass('orAct'); - // var inbox = document.getElementById('message-chat-order-space'); - // var docList = document.getElementById('documentOrderSpace'); - // inbox.innerHTML = ''; - // docList.innerHTML = ''; - - var orderId = $this.data('id'); - // let projectId = $this.data('project-id'); - // let recipentId = $this.data('recipent-id'); - // let orderName = $this.data('order-name'); location.hash = '#order' + orderId; - // console.log(orderId); window.chatController.create(orderId); - // hide all buttons - // console.log('chat-buttons -->', $(".chat-button")); - // $(".chat-button").hide(); - // $.ajax({ - // url: '/api/message', - // type: 'GET', - // beforeSend: function (xhr) { - // xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')) - // }, - // data: {'order': orderId, 'team__isnull': 'true'}, - // dataType: 'json', - // success: function (json) { - // $.each(json.results, function (i, v) { - // var senderName = 'Вы'; - // var className = 'youChat'; - // - // if (v.sender.id !== userId) { - // senderName = v.sender.username; - // className = ''; - // } - // - // inbox.innerHTML += '
    ' + - // '

    ' + senderName + '

    ' + v.created + '
    ' + - // '

    ' + v.text + '

    '; - // - // }); - // var height = inbox.scrollHeight; - // inbox.scrollTop = height; - // } - // }); - - // $("#order-stages").html(""); - // $("#completeWork").hide(); - // $("#add-form-order-note").hide(); - // $("#reserveSpace").hide(); }); } @@ -2060,13 +2057,17 @@ /***/ }, /* 27 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); + exports.chatTeamsInit = exports.chatOrdersInit = exports.chatContactsInit = undefined; + + var _loaders = __webpack_require__(4); + function chatContactsInit() { /** * Bind на кнопку "Отправить" в Закладке "Личные контакты" @@ -2079,33 +2080,40 @@ var sendLinks = $("#document-send-contact a"); if (chatMessage || sendLinks.length > 0) { - $("#contact-chat-form .errorEmptyMessage").hide(); - - var sendLinkIds = ""; - var documentLinks = ""; - var documentAttachFiles = ""; - - $.each(sendLinks, function (i, v) { - sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + '' + $(this).text() + '' + '
  • '; - }); - // console.log("sendLinkIds = ", sendLinkIds); - socket.send_message({ - "format_type": "add_message_contact", - "data": { - "sender_id": senderId, - "recipent_id": recipentId, - "chat_message": chatMessage, - "document_send_links": sendLinkIds, - "document_data": { - "document_links": documentLinks, - "document_attach_files": documentAttachFiles + var sendLinkIds; + var documentLinks; + var documentAttachFiles; + + (function () { + $("#contact-chat-form .errorEmptyMessage").hide(); + + sendLinkIds = ""; + documentLinks = ""; + documentAttachFiles = ""; + + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); + var document_link_tmpl = (0, _loaders.loadTemplate)('document_link_tmpl'); + $.each(sendLinks, function (i, v) { + sendLinkIds += $(this).attr('data-id') + ';'; + documentLinks += document_link_tmpl({ href: $(this).attr('href'), text: $(this).text() }); + documentAttachFiles += document_attach_file_tmpl({ href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text() }); + }); + socket.send_message({ + "format_type": "add_message_contact", + "data": { + "sender_id": senderId, + "recipent_id": recipentId, + "chat_message": chatMessage, + "document_send_links": sendLinkIds, + "document_data": { + "document_links": documentLinks, + "document_attach_files": documentAttachFiles + } } - } - }); - $("#chat").val(""); - $("#document-send-contact").html(""); + }); + $("#chat").val(""); + $("#document-send-contact").html(""); + })(); } else { $("#contact-chat-form .errorEmptyMessage").show(); } @@ -2124,31 +2132,40 @@ var orderId = $("#chat-order-add #orderId").val(); var sendLinks = $("#document-send-order a"); if (chatMessage || sendLinks.length > 0) { - var sendLinkIds = ""; - var documentLinks = ""; - var documentAttachFiles = ""; - $.each(sendLinks, function (i, v) { - sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + '' + $(this).text() + '' + '
  • '; - }); - socket.send_message({ - "format_type": "add_message_order", - "data": { - "sender_id": senderId, - "recipent_id": recipentId, - "chat_message": chatMessage, - "order_id": orderId, - "document_send_links": sendLinkIds, - "document_data": { - "document_links": documentLinks, - "document_attach_files": documentAttachFiles + var sendLinkIds; + var documentLinks; + var documentAttachFiles; + + (function () { + sendLinkIds = ""; + documentLinks = ""; + documentAttachFiles = ""; + + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); + var document_link_tmpl = (0, _loaders.loadTemplate)('document_link_tmpl'); + $.each(sendLinks, function (i, v) { + sendLinkIds += $(this).attr('data-id') + ';'; + documentLinks += document_link_tmpl({ href: $(this).attr('href'), text: $(this).text() }); + documentAttachFiles += document_attach_file_tmpl({ href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text() }); + }); + socket.send_message({ + "format_type": "add_message_order", + "data": { + "sender_id": senderId, + "recipent_id": recipentId, + "chat_message": chatMessage, + "order_id": orderId, + "document_send_links": sendLinkIds, + "document_data": { + "document_links": documentLinks, + "document_attach_files": documentAttachFiles + } } - } - }); - $("#chat-order-add #chat").val(""); - $("#document-send-order").html(""); + }); + $("#chat-order-add #chat").val(""); + $("#document-send-order").html(""); + })(); } else { $("#chat-order-add .errorEmptyMessage").show(); } @@ -2166,35 +2183,45 @@ var documentSendIds = $("#documentSendIds").val(); var teamIds = $("#team-chat-form #teamIds").val(); var sendLinks = $("#document-send a"); + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); if (chatMessage || sendLinks.length > 0) { - var sendLinkIds = ""; - var documentLinks = ""; - var documentAttachFiles = ""; - $.each(sendLinks, function (i, v) { - sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + '' + $(this).text() + '' + '
  • '; - }); - socket.send_message({ - "format_type": "add_message_team", - "data": { - "sender_id": senderId, - // "recipent_id": recipentId, - "chat_message": chatMessage, - "team_id": teamId, - "team_ids": teamIds, - // "order_id": orderId, - "document_send_links": sendLinkIds, - "document_data": { - "document_links": documentLinks, - "document_attach_files": documentAttachFiles + var sendLinkIds; + var documentLinks; + var documentAttachFiles; + + (function () { + sendLinkIds = ""; + documentLinks = ""; + documentAttachFiles = ""; + + var document_attach_file_tmpl = (0, _loaders.loadTemplate)('document_attach_file_tmpl'); + var document_link_tmpl = (0, _loaders.loadTemplate)('document_link_tmpl'); + $.each(sendLinks, function (i, v) { + sendLinkIds += $(this).attr('data-id') + ';'; + documentLinks += document_link_tmpl({ href: $(this).attr('href'), text: $(this).text() }); + documentAttachFiles += document_attach_file_tmpl({ href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text() }); + }); + socket.send_message({ + "format_type": "add_message_team", + "data": { + "sender_id": senderId, + // "recipent_id": recipentId, + "chat_message": chatMessage, + "team_id": teamId, + "team_ids": teamIds, + // "order_id": orderId, + "document_send_links": sendLinkIds, + "document_data": { + "document_links": documentLinks, + "document_attach_files": documentAttachFiles + } } - } - }); + }); - $("#team-chat-form #chatText").val(""); - $("#document-send").html(""); - $("#documentSendIds").val(""); + $("#team-chat-form #chatText").val(""); + $("#document-send").html(""); + $("#documentSendIds").val(""); + })(); } else { $("#team-chat-form .errorEmptyMessage").show(); } @@ -2218,7 +2245,7 @@ var _loaders = __webpack_require__(4); - var _messageCounters = __webpack_require__(22); + var _messageCounters = __webpack_require__(23); function getUserPlace() { /** @@ -2351,9 +2378,9 @@ var _StagesCustomerController = __webpack_require__(30); - var _MessagesControllers = __webpack_require__(19); + var _MessagesControllers = __webpack_require__(20); - var _DocumentsControllers = __webpack_require__(20); + var _DocumentsControllers = __webpack_require__(21); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -2401,7 +2428,7 @@ var _loaders = __webpack_require__(4); - var _Stages = __webpack_require__(18); + var _Stages = __webpack_require__(19); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -2418,12 +2445,12 @@ var STATUSES = { 'not_agreed': 'не согласован', - 'send_approve': 'на согласовании', - 'agreed': 'согласовано', - 'cancel_approve': 'исполнитель отказался', - 'in_process': 'в процессе', - 'completed': 'завершен', - 'closed': 'закрыт' + 'send_approve': '...на согласовании', + 'agreed': '...согласовано', + 'cancel_approve': '...исполнитель отказался', + 'in_process': '...в процессе', + 'completed': '...завершен', + 'closed': '...закрыт' }; @@ -2536,6 +2563,11 @@ this.stages_elements.$works.find('.js-select').addClass("select"); var $swith_to_protected = this.$orderStagesContainer.siblings('.switch'); if ($swith_to_protected.length) $swith_to_protected.remove(); + this.stages_elements.$reserve.css({ 'border-top': 'none' }); + this.stages_elements.$works.css({ 'border-top': 'none' }); + $('#stagesWork').find('.js-select').addClass('select'); + this.stages_elements.$reserve.find('.js-select').addClass('select'); + if ($('#send-review').length) $('#send-review').remove(); this.stages_elements.$reserve.hide(); this.stages_elements.$works.hide(); @@ -2573,6 +2605,7 @@ // console.log("add switch to protect"); this.$orderStagesContainer.after(this.switch_to_protected_tmpl()); $('#switch-to-protected').unbind().on('change', this._onChangeToProtect.bind(this)); + this.buttons.btnsArbitration.hide(); } } // Нет Этапов @@ -2588,6 +2621,7 @@ // console.log("add switch to protect"); this.$orderStagesContainer.after(this.switch_to_protected_tmpl()); $('#switch-to-protected').unbind().on('change', this._onChangeToProtect.bind(this)); + this.buttons.btnsArbitration.hide(); } } // Статус "Не согласован" @@ -2632,11 +2666,14 @@ // Block-Stage-2 this.stages_elements.$reserve.find('.js-select').removeClass('select'); this.stages_elements.$reserve.find('.js-btnArbitration').hide(); + this.stages_elements.$reserve.css({ 'border-top': '1px solid black' }); // Block-Stage-3 this.stages_elements.$works.show(); + this.stages_elements.$works.css({ 'border-top': '1px solid black' }); this._renderStageInWork('work_in_process_tmpl'); if (this.secureOrder) {} else { this.stages_elements.$reserve.hide(); + this.buttons.btnsArbitration.hide(); } } // Статус "В процессе"/"Завершен"/"Закрыт" @@ -2775,6 +2812,8 @@ } else { if (this.stages_elements.$works.find('#send-review').length) this.stages_elements.$works.find('#send-review').remove(); } + $('#stagesWork').find('.js-select').removeClass('select'); + this.stages_elements.$reserve.find('.js-select').removeClass('select'); } else { var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; @@ -2918,8 +2957,9 @@ this.buttons.btnSendReview.unbind().on("click", this._onBtnSendReview.bind(self)); $('#paymentfromSite').unbind().on('click', this._onBtnPaymentFromSite.bind(self)); $("#reserve-stage-modal").find('#stage-num').unbind().on('change', function (event) { - // console.log("select stage cost = ", self.stages[this.value - 1].data.cost); - $("#reserve-stage-modal").find('#stage-cost').html(self.stages[this.value - 1].data.cost); + console.log("this.value = ", this.value); + console.log(this.value ? this.value : 1 - 1); + $("#reserve-stage-modal").find('#stage-cost').html(self.stages[(this.value ? this.value : 1) - 1].data.cost); }); } @@ -3139,6 +3179,8 @@ key: '_onBtnReviewOpenModal', value: function _onBtnReviewOpenModal(event) { event.preventDefault(); + var review_type = $(event.target).data('review-type'); + $('#review-add').find('input[type=radio][value=' + review_type + ']').prop("checked", true); $('#review-add').modal('show'); } // Открыть модальное окно "Оставить отзыв" diff --git a/assets/js/src/chat/BINDS.js b/assets/js/src/chat/BINDS.js index 96f27f5..666e5d3 100644 --- a/assets/js/src/chat/BINDS.js +++ b/assets/js/src/chat/BINDS.js @@ -18,6 +18,65 @@ function dialog(message, yesCallback, notCallback) { }); } +function isNullOrders() { + let buttons = { + btnApprove: $('#btnApprove'), // "Согласовать" + btnChange: $('#btnChange'), // "Отправить на внесение изменений" + btnsToArchive: $('.js-btnToArchive'), // "Отказаться от заказа" + btnToArchive: $('#btnToArchive'), // "Отказаться и отправить в Архив" + btnReserve: $('#btnReserve'), // "Зарезервировать" + btnsArbitration: $('.js-btnArbitration'),// "Обратиться в арбитраж" + btnSendReview: $('#order-review-add') // "Оставить отзыв" + }; + let stages_elements = { + $approve: $('#conditions-approve'), //1. Согласование условия + $reserve: $('#reserveSpace'), //2. Резервирование (Отобразить) + $works: $('#completeWork') //3. Выполненная работа + }; + + let $orderStagesContainer = $('#order-stages'); + + // hide all buttons + for (let key in buttons) { + if (buttons[key].length)buttons[key].hide(); + } + + for (let key in stages_elements) { + stages_elements[key].show(); + } + if ($orderStagesContainer.length) $orderStagesContainer.parent().hide(); + + +} + +function restoreTabFromHash() { + var currentHash = URI(location.href).hash(); + if (currentHash.indexOf("#order") == 0) { + $("a[href='#tab2']").trigger('click'); + // console.log("click on ", "#orderBlock" + currentHash.replace("#order", "")); + let obj_id = currentHash.replace("#order", ""); + // console.log("obj_id = ", obj_id); + if (obj_id) { + $("#orderBlock" + currentHash.replace("#order", "")).trigger('click'); + } else { + let $order_block = $(".order-block"); + if ($order_block.length) { + $order_block.first().trigger('click'); + } else { + window.location.hash = '#order'; + isNullOrders(); + } + } + + } else if (currentHash.indexOf("#user") == 0) { + $("a[href='#tab1']").trigger('click'); + } else if (currentHash.indexOf("#teamorder") == 0 || currentHash.indexOf("#myteam") == 0) { + $("a[href='#tab3']").trigger('click'); + } else { + $("a[href='#tab1']").trigger('click'); + } +} + function bindOrders() { $('.order-block').on('click', function (event) { event.preventDefault(); @@ -114,6 +173,7 @@ function bindOrderInfo() { } function bindTeams() { + let message_tmpl = loadTemplate('message_tmpl'); $('.team-block').on('click', function () { onClickCardWithCount($(this)); $('.team-order-block, .team-block').each(function () { @@ -164,9 +224,10 @@ function bindTeams() { senderName = v.sender.username; className = ''; } - inbox.innerHTML += '
    ' + - '

    ' + senderName + '

    ' + v.created + '
    ' + - '

    ' + v.text + '

    '; + inbox.innerHTML += message_tmpl({className: className, senderName: senderName, message: v}); + // inbox.innerHTML += '
    ' + + // '

    ' + senderName + '

    ' + v.created + '
    ' + + // '

    ' + v.text + '

    '; }); var height = inbox.scrollHeight; inbox.scrollTop = height; @@ -276,7 +337,13 @@ function bindOnTabs() { var ordHashId = liveHash.replace("#order", ""); $("#orderBlock" + ordHashId).trigger('click'); } else { - $(".order-block").first().trigger('click'); + let $order_block = $(".order-block"); + if ($order_block.length) { + $order_block.first().trigger('click'); + } else { + window.location.hash = '#order'; + isNullOrders(); + } } }, 100); break; @@ -351,6 +418,7 @@ function bindUserContacts() { } function bindGetUserMessages() { + let message_tmpl = loadTemplate('message_tmpl'); $('.user-block').on('click', function () { onClickCardWithCount($(this)); // var newCount = parseInt($("#count-tab-contact").text()); @@ -368,9 +436,6 @@ function bindGetUserMessages() { var sumSenderRecipent = parseInt(userId) + parseInt(contactId); $("#message-chat-space").removeClass().addClass("contact-space" + sumSenderRecipent); - // var currNewCount = parseInt($(".contact-count-" + sumSenderRecipent).text()); - // var resCount = newCount - currNewCount; - // $("#count-tab-contact").text(resCount); $(".contact-count-" + sumSenderRecipent).text(0); var docList = document.getElementById('documentSpace'); inbox.innerHTML = ''; @@ -396,9 +461,10 @@ function bindGetUserMessages() { senderName = v.sender.username; className = ''; } - inbox.innerHTML += '
    ' + - '

    ' + senderName + '

    ' + v.created + '
    ' + - '

    ' + v.text + '

    '; + inbox.innerHTML += message_tmpl({className: className, senderName: senderName, message: v}); + // '
    ' + + // '

    ' + senderName + '

    ' + v.created + '
    ' + + // '

    ' + v.text + '

    ' }); var height = inbox.scrollHeight; inbox.scrollTop = height; @@ -520,4 +586,5 @@ export { bindTeams, bindDeleteContact, bindCtrlEnterSendMessage, + restoreTabFromHash, } \ No newline at end of file diff --git a/assets/js/src/chat/StagesContractorController.js b/assets/js/src/chat/StagesContractorController.js index 86842ba..004791a 100644 --- a/assets/js/src/chat/StagesContractorController.js +++ b/assets/js/src/chat/StagesContractorController.js @@ -15,12 +15,12 @@ let message_format = { const STATUSES = { 'not_agreed': 'не согласован', - 'send_approve': 'на согласовании', - 'agreed': 'согласовано', - 'cancel_approve': 'исполнитель отказался', - 'in_process': 'в процессе', - 'completed': 'завершен', - 'closed': 'закрыт', + 'send_approve': '...на согласовании', + 'agreed': '...согласовано', + 'cancel_approve': '...исполнитель отказался', + 'in_process': '...в процессе', + 'completed': '...завершен', + 'closed': '...закрыт', }; @@ -119,6 +119,11 @@ class StagesController { this.stages_elements.$approve.find('.js-select').addClass("select"); this.stages_elements.$reserve.find('.js-select').addClass("select"); this.stages_elements.$works.find('.js-select').addClass("select"); + this.stages_elements.$reserve.css({'border-top': 'none'}); + this.stages_elements.$works.css({'border-top': 'none'}); + $('#stagesWork').find('.js-select').addClass('select'); + this.stages_elements.$reserve.find('.js-select').addClass('select'); + if ($('#send-review').length)$('#send-review').remove(); this.stages_elements.$reserve.hide(); this.stages_elements.$works.hide(); @@ -152,6 +157,7 @@ class StagesController { if (this.secureOrder){ this.stages_elements.$reserve.find('.js-help-text').show(); } else { + this.buttons.btnsArbitration.hide(); this.stages_elements.$reserve.find('.js-help-text').show(); this.stages_elements.$reserve.find('.js-select').removeClass('select'); this.stages_elements.$reserve.find('.js-help-text').html( @@ -197,6 +203,7 @@ class StagesController { this._renderStageReserved('reserved_tmpl'); this.stages_elements.$reserve.find('.js-help-text').show(); }else{ + this.buttons.btnsArbitration.hide(); this.stages_elements.$reserve.find('.stages-paid').html(""); this.stages_elements.$reserve.find('.js-help-text').hide(); } @@ -210,13 +217,16 @@ class StagesController { this.buildAgreedStage(); // Block-Stage-2 this.stages_elements.$reserve.find('.js-help-text').hide(); + this.stages_elements.$reserve.css({'border-top': '1px solid black'}); // Block-Stage-3 this.stages_elements.$works.show(); + this.stages_elements.$works.css({'border-top': '1px solid black'}); this._renderStageInWork('work_in_process_tmpl'); if (this.secureOrder) { // this._renderStageInWork('work_in_process_tmpl'); } else { + this.buttons.btnsArbitration.hide(); this.stages_elements.$reserve.hide(); } } // Статус "В процессе"/"Завершен"/"Закрыт" @@ -292,6 +302,8 @@ class StagesController { } else { if (this.stages_elements.$works.find('#send-review').length) this.stages_elements.$works.find('#send-review').remove() } + $('#stagesWork').find('.js-select').removeClass('select'); + this.stages_elements.$reserve.find('.js-select').removeClass('select'); } else { for (let stage_data of this.data.stages) { @@ -422,7 +434,11 @@ class StagesController { _onBtnReviewOpenModal(event) { event.preventDefault(); + + let review_type = $(event.target).data('review-type'); + $('#review-add').find(`input[type=radio][value=${review_type}]`).prop("checked", true); $('#review-add').modal('show'); + console.log('Modal show review_type = ', review_type); } // Открыть модальное окно "Оставить отзыв" _onBtnSendReview(event) { diff --git a/assets/js/src/chat/StagesCustomerController.js b/assets/js/src/chat/StagesCustomerController.js index 0f4f9d2..b7bfa76 100644 --- a/assets/js/src/chat/StagesCustomerController.js +++ b/assets/js/src/chat/StagesCustomerController.js @@ -15,12 +15,12 @@ let message_format = { const STATUSES = { 'not_agreed': 'не согласован', - 'send_approve': 'на согласовании', - 'agreed': 'согласовано', - 'cancel_approve': 'исполнитель отказался', - 'in_process': 'в процессе', - 'completed': 'завершен', - 'closed': 'закрыт', + 'send_approve': '...на согласовании', + 'agreed': '...согласовано', + 'cancel_approve': '...исполнитель отказался', + 'in_process': '...в процессе', + 'completed': '...завершен', + 'closed': '...закрыт', }; @@ -126,6 +126,11 @@ class StagesController { this.stages_elements.$works.find('.js-select').addClass("select"); let $swith_to_protected = this.$orderStagesContainer.siblings('.switch'); if ($swith_to_protected.length) $swith_to_protected.remove(); + this.stages_elements.$reserve.css({'border-top': 'none'}); + this.stages_elements.$works.css({'border-top': 'none'}); + $('#stagesWork').find('.js-select').addClass('select'); + this.stages_elements.$reserve.find('.js-select').addClass('select'); + if ($('#send-review').length)$('#send-review').remove(); this.stages_elements.$reserve.hide(); this.stages_elements.$works.hide(); @@ -162,6 +167,7 @@ class StagesController { // console.log("add switch to protect"); this.$orderStagesContainer.after(this.switch_to_protected_tmpl()); $('#switch-to-protected').unbind().on('change', this._onChangeToProtect.bind(this)); + this.buttons.btnsArbitration.hide(); } } // Нет Этапов @@ -176,6 +182,7 @@ class StagesController { // console.log("add switch to protect"); this.$orderStagesContainer.after(this.switch_to_protected_tmpl()); $('#switch-to-protected').unbind().on('change', this._onChangeToProtect.bind(this)); + this.buttons.btnsArbitration.hide(); } } // Статус "Не согласован" @@ -215,13 +222,16 @@ class StagesController { // Block-Stage-2 this.stages_elements.$reserve.find('.js-select').removeClass('select'); this.stages_elements.$reserve.find('.js-btnArbitration').hide(); + this.stages_elements.$reserve.css({'border-top': '1px solid black'}); // Block-Stage-3 this.stages_elements.$works.show(); + this.stages_elements.$works.css({'border-top': '1px solid black'}); this._renderStageInWork('work_in_process_tmpl'); if (this.secureOrder) { } else { this.stages_elements.$reserve.hide(); + this.buttons.btnsArbitration.hide(); } } // Статус "В процессе"/"Завершен"/"Закрыт" @@ -290,6 +300,8 @@ class StagesController { } else { if (this.stages_elements.$works.find('#send-review').length) this.stages_elements.$works.find('#send-review').remove() } + $('#stagesWork').find('.js-select').removeClass('select'); + this.stages_elements.$reserve.find('.js-select').removeClass('select'); } else { for (let stage_data of this.data.stages) { @@ -369,8 +381,9 @@ class StagesController { this.buttons.btnSendReview.unbind().on("click", this._onBtnSendReview.bind(self)); $('#paymentfromSite').unbind().on('click', this._onBtnPaymentFromSite.bind(self)); $("#reserve-stage-modal").find('#stage-num').unbind().on('change', function (event) { - // console.log("select stage cost = ", self.stages[this.value - 1].data.cost); - $("#reserve-stage-modal").find('#stage-cost').html(self.stages[this.value - 1].data.cost); + console.log("this.value = ", this.value); + console.log(this.value?this.value:1 - 1); + $("#reserve-stage-modal").find('#stage-cost').html(self.stages[(this.value?this.value:1) - 1].data.cost); }); } @@ -546,6 +559,8 @@ class StagesController { _onBtnReviewOpenModal(event) { event.preventDefault(); + let review_type = $(event.target).data('review-type'); + $('#review-add').find(`input[type=radio][value=${review_type}]`).prop("checked", true); $('#review-add').modal('show'); } // Открыть модальное окно "Оставить отзыв" diff --git a/assets/js/src/chat/chats.js b/assets/js/src/chat/chats.js index 4b15a62..177d115 100644 --- a/assets/js/src/chat/chats.js +++ b/assets/js/src/chat/chats.js @@ -1,3 +1,5 @@ +import {loadTemplate} from './loaders' + function chatContactsInit() { /** * Bind на кнопку "Отправить" в Закладке "Личные контакты" @@ -15,15 +17,13 @@ function chatContactsInit() { var sendLinkIds = ""; var documentLinks = ""; var documentAttachFiles = ""; - + let document_attach_file_tmpl = loadTemplate('document_attach_file_tmpl'); + let document_link_tmpl = loadTemplate('document_link_tmpl'); $.each(sendLinks, function (i, v) { sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + - '' + $(this).text() + '' + - '
  • '; + documentLinks += document_link_tmpl({href: $(this).attr('href'), text: $(this).text()}); + documentAttachFiles += document_attach_file_tmpl({href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text()}); }); - // console.log("sendLinkIds = ", sendLinkIds); socket.send_message({ "format_type": "add_message_contact", "data": { @@ -61,12 +61,12 @@ function chatOrdersInit() { var sendLinkIds = ""; var documentLinks = ""; var documentAttachFiles = ""; + let document_attach_file_tmpl = loadTemplate('document_attach_file_tmpl'); + let document_link_tmpl = loadTemplate('document_link_tmpl'); $.each(sendLinks, function (i, v) { sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + - '' + $(this).text() + '' + - '
  • '; + documentLinks += document_link_tmpl({href: $(this).attr('href'), text: $(this).text()}); + documentAttachFiles += document_attach_file_tmpl({href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text()}); }); socket.send_message({ "format_type": "add_message_order", @@ -103,17 +103,17 @@ function chatTeamsInit() { var documentSendIds = $("#documentSendIds").val(); var teamIds = $("#team-chat-form #teamIds").val(); var sendLinks = $("#document-send a"); + let document_attach_file_tmpl = loadTemplate('document_attach_file_tmpl'); if (chatMessage || sendLinks.length > 0) { var sendLinkIds = ""; var documentLinks = ""; var documentAttachFiles = ""; + let document_attach_file_tmpl = loadTemplate('document_attach_file_tmpl'); + let document_link_tmpl = loadTemplate('document_link_tmpl'); $.each(sendLinks, function (i, v) { sendLinkIds += $(this).attr('data-id') + ';'; - documentLinks += 'Приложенный файл. скачать:
    ' + $(this).text() + '
    '; - documentAttachFiles += '
  • ' + - '' + $(this).text() + '' + - '
  • '; - + documentLinks += document_link_tmpl({href: $(this).attr('href'), text: $(this).text()}); + documentAttachFiles += document_attach_file_tmpl({href: $(this).attr('href'), document_id: $(this).attr('data-id'), text: $(this).text()}); }); socket.send_message({ "format_type": "add_message_team", diff --git a/assets/js/src/chat/loaders.js b/assets/js/src/chat/loaders.js index bbc86df..48c65d4 100644 --- a/assets/js/src/chat/loaders.js +++ b/assets/js/src/chat/loaders.js @@ -6,6 +6,7 @@ import work_in_process_tmpl from './templates/work_in_process_tmpl.html' import bntCompleteStage_tmpl from './templates/buttons/bntCompleteStage_tmpl.html' import btnSendReview_tmpl from './templates/buttons/btnSendReview_tmpl.html' import document_attach_file_tmpl from './templates/links/document_attach_file_tmpl.html' +import document_link_tmpl from './templates/links/document_link_tmpl.html' import note_tmpl from './templates/note_tmpl.html' import order_info_tmpl from './templates/order_info_tmpl.html' import stage_contractor_approve_tmpl from './templates/stage_contractor_approve_tmpl.html' @@ -22,6 +23,7 @@ function loadTemplate(template_name) { bntCompleteStage_tmpl: bntCompleteStage_tmpl, btnSendReview_tmpl: btnSendReview_tmpl, document_attach_file_tmpl: document_attach_file_tmpl, + document_link_tmpl: document_link_tmpl, note_tmpl: note_tmpl, order_info_tmpl: order_info_tmpl, stage_contractor_approve_tmpl: stage_contractor_approve_tmpl, diff --git a/assets/js/src/chat/parts.js b/assets/js/src/chat/parts.js deleted file mode 100644 index 0d06e61..0000000 --- a/assets/js/src/chat/parts.js +++ /dev/null @@ -1,27 +0,0 @@ -import {getCookie} from '../utils' - -function restoreTabFromHash() { - var currentHash = URI(location.href).hash(); - if (currentHash.indexOf("#order") == 0) { - $("a[href='#tab2']").trigger('click'); - // console.log("click on ", "#orderBlock" + currentHash.replace("#order", "")); - let obj_id = currentHash.replace("#order", ""); - // console.log("obj_id = ", obj_id); - if (obj_id) { - $("#orderBlock" + currentHash.replace("#order", "")).trigger('click'); - } else { - $('.order-block').first().trigger('click'); - } - - } else if (currentHash.indexOf("#user") == 0) { - $("a[href='#tab1']").trigger('click'); - } else if (currentHash.indexOf("#teamorder") == 0 || currentHash.indexOf("#myteam") == 0) { - $("a[href='#tab3']").trigger('click'); - } else { - $("a[href='#tab1']").trigger('click'); - } -} - - - -export {restoreTabFromHash} \ No newline at end of file diff --git a/assets/js/src/chat/templates/buttons/btnSendReview_tmpl.html b/assets/js/src/chat/templates/buttons/btnSendReview_tmpl.html index df81dfc..a0b1f02 100644 --- a/assets/js/src/chat/templates/buttons/btnSendReview_tmpl.html +++ b/assets/js/src/chat/templates/buttons/btnSendReview_tmpl.html @@ -1,6 +1,12 @@ -
    + \ No newline at end of file + ЗАКРЫТЬ ПРОЕКТ И ОСТАВИТЬ ОТЗЫВ + +
    diff --git a/assets/js/src/chat/templates/links/document_attach_file_tmpl.html b/assets/js/src/chat/templates/links/document_attach_file_tmpl.html index 73fd89e..bd0df37 100644 --- a/assets/js/src/chat/templates/links/document_attach_file_tmpl.html +++ b/assets/js/src/chat/templates/links/document_attach_file_tmpl.html @@ -1,12 +1,5 @@ - +
  • ${this.text}
    -
  • - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/js/src/chat/templates/links/document_link_tmpl.html b/assets/js/src/chat/templates/links/document_link_tmpl.html index f82849b..ce68ebc 100644 --- a/assets/js/src/chat/templates/links/document_link_tmpl.html +++ b/assets/js/src/chat/templates/links/document_link_tmpl.html @@ -1,7 +1,7 @@
    Приложенный файл. скачать:
    - - $(this.text) + + ${this.text}
    \ No newline at end of file diff --git a/assets/js/src/chat/templates/message_tmpl.html b/assets/js/src/chat/templates/message_tmpl.html index c7197e1..d87d7ac 100644 --- a/assets/js/src/chat/templates/message_tmpl.html +++ b/assets/js/src/chat/templates/message_tmpl.html @@ -1,7 +1,9 @@
    -
    -

    ${this.senderName}

    ${this.message.created} +
    +
    ${this.senderName}
    ${this.message.created}
    +
    +
    + ${this.message.text}
    -

    ${this.message.text}

    \ No newline at end of file diff --git a/assets/js/src/chat/templates/stage_approved_tmpl.html b/assets/js/src/chat/templates/stage_approved_tmpl.html index 4e93438..484410a 100644 --- a/assets/js/src/chat/templates/stage_approved_tmpl.html +++ b/assets/js/src/chat/templates/stage_approved_tmpl.html @@ -1,11 +1,12 @@ -
    +
    ЭТАП ${this.stage_num}
    - ${this.stage_status?this.stage_status:'не согласован'} + ${this.stage_status?this.stage_status:''}
    diff --git a/assets/js/src/chat/templates/stage_contractor_approve_tmpl.html b/assets/js/src/chat/templates/stage_contractor_approve_tmpl.html index 6857d6c..faabca8 100644 --- a/assets/js/src/chat/templates/stage_contractor_approve_tmpl.html +++ b/assets/js/src/chat/templates/stage_contractor_approve_tmpl.html @@ -1,5 +1,6 @@ -
    +
    ЭТАП ${this.stage_num} diff --git a/assets/js/src/chat/templates/stage_tmpl.html b/assets/js/src/chat/templates/stage_tmpl.html index 9101554..e236e4e 100644 --- a/assets/js/src/chat/templates/stage_tmpl.html +++ b/assets/js/src/chat/templates/stage_tmpl.html @@ -6,7 +6,7 @@ ЭТАП ${this.stage_num}
    - ${this.stage_status?this.stage_status:'не согласован'} + ${this.stage_status?this.stage_status:''}
    diff --git a/assets/js/src/chat/templates/switch_to_protected_tmpl.html b/assets/js/src/chat/templates/switch_to_protected_tmpl.html index b33c59c..093be6b 100644 --- a/assets/js/src/chat/templates/switch_to_protected_tmpl.html +++ b/assets/js/src/chat/templates/switch_to_protected_tmpl.html @@ -1,5 +1,5 @@ -
    +
    Безопасная сделка не активна
    diff --git a/assets/js/src/chat/templates/work_in_process_tmpl.html b/assets/js/src/chat/templates/work_in_process_tmpl.html index f14d97c..0e22453 100644 --- a/assets/js/src/chat/templates/work_in_process_tmpl.html +++ b/assets/js/src/chat/templates/work_in_process_tmpl.html @@ -2,8 +2,8 @@
    В работе: ${this.stage.name}
    Результат этапа: ${this.stage.result}
    - Срок сдачи: ${this.stage.term}
    - ${this.stage.cost} р + Срок сдачи: ${this.stage.term}
    + ${this.stage.cost} р
    ${this.note_text}
    diff --git a/assets/js/src/chat_contractor_oop.js b/assets/js/src/chat_contractor_oop.js index d018c8a..ee4bc72 100644 --- a/assets/js/src/chat_contractor_oop.js +++ b/assets/js/src/chat_contractor_oop.js @@ -9,6 +9,7 @@ import { bindTeams, bindDeleteContact, bindCtrlEnterSendMessage, + restoreTabFromHash, } from './chat/BINDS' import { @@ -20,7 +21,6 @@ import { import {bindContractorNotes, bindOrderNotes, bindTeamNotes} from './chat/notes' -import {restoreTabFromHash} from './chat/parts' import {bindArchiveProjects} from './chat/archiveProjects' diff --git a/assets/js/src/chat_customer_oop.js b/assets/js/src/chat_customer_oop.js index 960b045..7ed3bc6 100644 --- a/assets/js/src/chat_customer_oop.js +++ b/assets/js/src/chat_customer_oop.js @@ -8,9 +8,9 @@ import { bindGetUserMessages, bindDeleteContact, bindCtrlEnterSendMessage, + restoreTabFromHash } from './chat/BINDS' -import {restoreTabFromHash} from './chat/parts' import {chatContactsInit, chatOrdersInit} from './chat/chats' import {uploadDocumentsOrderInit, uploadDocumentsContactInit} from './chat/documents' diff --git a/chat/chat.py b/chat/chat.py index 8ee4175..021e2c4 100644 --- a/chat/chat.py +++ b/chat/chat.py @@ -130,7 +130,7 @@ class ChatHandler(websocket.WebSocketHandler): sender_name = msg_data[5] msg_time = msg_data[2].strftime("%Y-%m-%d %H:%M:%S") if docs_links: - message += '

    ' + docs_links + message += docs_links # if message_type: # waiters = tuple(w for c, w in self.waiters if c == recipent_id) diff --git a/chat/serializers.py b/chat/serializers.py index b30c8f8..3085161 100644 --- a/chat/serializers.py +++ b/chat/serializers.py @@ -66,7 +66,7 @@ class MessageSerializer(ModelSerializer): documents_str = '
    '.join([ 'Приложенный файл. скачать:
    ' + doc.file.name + '' for doc in documents]) - out += '

    ' + documents_str + out += documents_str return out diff --git a/chat/static/sass/chat_add.sass b/chat/static/sass/chat_add.sass index 021abfc..0bf3a22 100644 --- a/chat/static/sass/chat_add.sass +++ b/chat/static/sass/chat_add.sass @@ -15,6 +15,9 @@ position: relative left: -5px +ul.nav li.active + border-top: 2px solid black + .contractor-notes-block, .team-notes-block, .order-notes-block text-align: left padding-left: 45px @@ -55,12 +58,47 @@ ol .systemChat background-color: #ffe9ed +// Chat message +.insetCommChat + .message-header + padding-top: 10px + padding-bottom: 5px + .sender_name + display: inline-block + font-weight: bold + .created + display: inline-block + margin-left: 15px + .message-body + word-wrap: break-word + max-width: 500px + + .invite + white-space: nowrap + .group_name + display: inline-block + overflow: hidden + text-overflow: ellipsis + max-width: 150px + .btn.btn-chat + display: inline-block + padding: 5px 10px + font-size: 12pt + border: 1px solid #BEBEBE + margin-left: 5px + margin-right: 5px + &:hover + color: #4e4c4c + &:visited, &:link + color: #0b0b0b + .numberStepp border-bottom: 1px solid #CFCFCF &:last-child border-bottom: none .review-type + margin-bottom: 10px .alignleft float: left //width: 33% @@ -158,6 +196,27 @@ ol image: url("#{$static}/img/icons/icon_complete_stage.png") size: 25px 28px repeat: no-repeat + + &.icon-close_chat-positive + @extend %icons + &:before + width: 22px + height: 20px + background: + image: url("#{$static}/img/closeChat1.png") + size: 20px 20px + repeat: no-repeat + + &.icon-close_chat-negative + @extend %icons + &:before + width: 22px + height: 20px + background: + image: url("#{$static}/img/closeChat2.png") + size: 20px 20px + repeat: no-repeat + &.icon-check @extend %icons &:before @@ -286,7 +345,7 @@ a.btn.btn-send .bird position: absolute border: 30px solid transparent - border-top: 12px solid #CFCFCF + border-top: 15px solid #CFCFCF top: 0 left: 50% margin-left: -30px @@ -295,8 +354,8 @@ a.btn.btn-send display: block position: absolute border: 30px solid transparent - border-top: 12px solid white - top: -13px + border-top: 15px solid white + top: -16px left: 50% margin-left: -30px @@ -342,6 +401,7 @@ a.btn.btn-send a.docs &-more, &-less + font-style: italic color: #{map_get($component_colors, select)} cursor: pointer &:hover diff --git a/chat/templates/chat_contractor.html b/chat/templates/chat_contractor.html index 634d017..000d94f 100644 --- a/chat/templates/chat_contractor.html +++ b/chat/templates/chat_contractor.html @@ -89,7 +89,7 @@
    - {% include 'partials/inc-attach-documents.html' with class='documentSpace' %} + {% include 'partials/inc-attach-documents.html' with class='documentSpace' tab='contacts' %}
      @@ -135,6 +135,7 @@ {% if archive_orders %} {#
      {# 1.Согласование условий #} -
      +

      1. Согласование условий @@ -260,7 +274,7 @@

      Заказчик резервирует сумму на оплату работы. Деньги перечисляются и хранятся на сайте.
      - Заказ проходит по безопасной сделке +
      @@ -295,23 +309,23 @@
      - +{# #}
      - {% include 'partials/inc-attach-documents.html' with class='documentOrderSpace' %} + {% include 'partials/inc-attach-documents.html' with class='documentOrderSpace' tab='orders' %}
      @@ -397,7 +411,7 @@
      - {% include 'partials/inc-attach-documents.html' with class='documentTeamSpace' %} + {% include 'partials/inc-attach-documents.html' with class='documentTeamSpace' tab='teams' %}
      diff --git a/chat/templates/chat_customer.html b/chat/templates/chat_customer.html index 6564e4e..6670f71 100644 --- a/chat/templates/chat_customer.html +++ b/chat/templates/chat_customer.html @@ -148,12 +148,11 @@ {% endfor %}
      - - {% if archive_projects %} +
      + style="margin-top: 4px"> Показать архивные заказы
      -
      +
      +
      @@ -232,7 +232,7 @@
      {# 1.Согласование условий #}
      + style="border-bottom: none; border-top: 1px solid black">

      1. Согласование условий

      @@ -244,7 +244,8 @@

      -
      Количество этапов в данном проекте +
      + Количество этапов в данном проекте
      @@ -254,7 +255,7 @@ - +{# #}
      {% include 'partials/inc-attach-documents.html' with class='documentOrderSpace' %} diff --git a/chat/templates/partials/inc-attach-documents.html b/chat/templates/partials/inc-attach-documents.html index fb03f36..38a9c79 100644 --- a/chat/templates/partials/inc-attach-documents.html +++ b/chat/templates/partials/inc-attach-documents.html @@ -1,5 +1,16 @@ -
      -

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

      +
      + {% if tab == 'orders' %} +

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

      + {% else %} +
      +
      + + Прикрепленные документы + +
      +
      +
      + {% endif %}
        diff --git a/chat/templates/partials/inc-websocket-connect.htm b/chat/templates/partials/inc-websocket-connect.htm index 7001574..1a75495 100644 --- a/chat/templates/partials/inc-websocket-connect.htm +++ b/chat/templates/partials/inc-websocket-connect.htm @@ -77,7 +77,6 @@ this.socket.onclose = function (event) { print.ws_print("Websocket closed: " + JSON.stringify(event)); - // TODO: Сдеалть реконнект#} setTimeout(function () { console.log("reconnect to WS"); wsConnect = new WSConnection().connect(url); diff --git a/chat/templates/review_add_modal.html b/chat/templates/review_add_modal.html index 8e9102e..3683a13 100644 --- a/chat/templates/review_add_modal.html +++ b/chat/templates/review_add_modal.html @@ -18,7 +18,7 @@ Положительный -