/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; var _ChatCustomerPageController = __webpack_require__(25); var _BINDS = __webpack_require__(17); var _parts = __webpack_require__(21); var _chats = __webpack_require__(23); var _wsChatConnect = __webpack_require__(24); var _archiveProjects = __webpack_require__(22); window.connect = _wsChatConnect.connect; window.socket = undefined; $(function () { $('body').on('focus', ".term-picker", function () { $(this).datepicker({ minDate: 0 }); }); (0, _BINDS.bindArbitrationSend)(); window.onhashchange = function (e) { // console.log("Change Hash!!! ", 'a[data-toggle="tab"][href="#' + location.hash.slice(1) + '"]'); $('a[data-toggle="tab"][href="#' + location.hash.slice(1) + '"]').trigger("click"); }; window.chatController = new _ChatCustomerPageController.ChatPageController(); (0, _BINDS.bindOrders)(); (0, _BINDS.bindOnTabs)(); (0, _parts.restoreTabFromHash)(); (0, _BINDS.bindUserContacts)(); (0, _BINDS.bindGetUserMessages)(); (0, _archiveProjects.bindArchiveProjects)(); (0, _BINDS.bindDeleteContact)(); //Chats (0, _chats.chatContactsInit)(); (0, _chats.chatOrdersInit)(); }); /***/ }, /* 1 */, /* 2 */, /* 3 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == name + '=') { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } function humanFileSize(bytes, si) { var thresh = si ? 1000 : 1024; if (Math.abs(bytes) < thresh) return bytes + ' B'; var units = si ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']; var u = -1; do { bytes /= thresh; ++u; } while (Math.abs(bytes) >= thresh && u < units.length - 1); return bytes.toFixed(1) + ' ' + units[u]; } exports.humanFileSize = humanFileSize; exports.getCookie = getCookie; /***/ }, /* 4 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadTemplate = undefined; var _stage_tmpl = __webpack_require__(5); var _stage_tmpl2 = _interopRequireDefault(_stage_tmpl); var _stage_approved_tmpl = __webpack_require__(6); var _stage_approved_tmpl2 = _interopRequireDefault(_stage_approved_tmpl); var _reserved_tmpl = __webpack_require__(7); var _reserved_tmpl2 = _interopRequireDefault(_reserved_tmpl); var _message_tmpl = __webpack_require__(8); var _message_tmpl2 = _interopRequireDefault(_message_tmpl); var _work_in_process_tmpl = __webpack_require__(9); var _work_in_process_tmpl2 = _interopRequireDefault(_work_in_process_tmpl); var _bntCompleteStage_tmpl = __webpack_require__(10); var _bntCompleteStage_tmpl2 = _interopRequireDefault(_bntCompleteStage_tmpl); var _btnSendReview_tmpl = __webpack_require__(11); var _btnSendReview_tmpl2 = _interopRequireDefault(_btnSendReview_tmpl); var _document_attach_file_tmpl = __webpack_require__(12); var _document_attach_file_tmpl2 = _interopRequireDefault(_document_attach_file_tmpl); var _note_tmpl = __webpack_require__(13); var _note_tmpl2 = _interopRequireDefault(_note_tmpl); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function loadTemplate(template_name) { var templates = { stage_tmpl: _stage_tmpl2.default, stage_approved_tmpl: _stage_approved_tmpl2.default, reserved_tmpl: _reserved_tmpl2.default, message_tmpl: _message_tmpl2.default, work_in_process_tmpl: _work_in_process_tmpl2.default, bntCompleteStage_tmpl: _bntCompleteStage_tmpl2.default, btnSendReview_tmpl: _btnSendReview_tmpl2.default, document_attach_file_tmpl: _document_attach_file_tmpl2.default, note_tmpl: _note_tmpl2.default }; if (!templates[template_name]) throw new Error('Template ' + template_name + ' does not exist'); return templates[template_name]; } exports.loadTemplate = loadTemplate; /***/ }, /* 5 */ /***/ 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

\u042D\u0422\u0410\u041F ' + this.stage_num + '

\n
\n \n \n

\n \n \n

\n \n

\n \n \n \n \n

\n \n \n

\n
\n
'; }; /***/ }, /* 6 */ /***/ 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
\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
"; }; /***/ }, /* 7 */ /***/ 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
  • \u0421\u0443\u043C\u043C\u0430 \u0437\u0430 \u044D\u0442\u0430\u043F " + this.stage.pos + "\n
    " + this.reserved_name + "
    \n
  • "; }; /***/ }, /* 8 */ /***/ 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
    \n

    " + this.senderName + "

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

    " + this.message.text + "

    \n
    "; }; /***/ }, /* 9 */ /***/ 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 \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
    "; }; /***/ }, /* 10 */ /***/ 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 " + this.text + " " + this.stage.pos + "\n \n
    "; }; /***/ }, /* 11 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = function (ctx) { return _template.call(ctx, ctx); }; 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
    "; }; /***/ }, /* 12 */ /***/ 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 " + this.text + "\n
    \n
  • \n\n"; }; /***/ }, /* 13 */ /***/ 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 " + this.text + "\n
  • \n
    \n
    \n"; }; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.StageInWork = exports.StageReserved = exports.StageForm = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _loaders = __webpack_require__(4); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // new-stages-form // update-stages-form // remove-stages-form var StageForm = function () { function StageForm($container, _ref) // kwargs - auto generate from name_attributes { var orderId = _ref.orderId, stage_num = _ref.stage_num, stage_status = _ref.stage_status, _ref$type = _ref.type, type = _ref$type === undefined ? 'new' : _ref$type, _ref$formNamePostfix = _ref.formNamePostfix, formNamePostfix = _ref$formNamePostfix === undefined ? '-stages-form' : _ref$formNamePostfix, template_name = _ref.template_name, _ref$data = _ref.data, data = _ref$data === undefined ? {} : _ref$data; var kwargs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { stage_num: stage_num, stage_status: stage_status, form_name: type + formNamePostfix, orderId: orderId, stage: data }; _classCallCheck(this, StageForm); // console.log('Stage form template_name = ', template_name); this.orderId = orderId; this._type = type; this.$container = $container; this.self_tmpl = (0, _loaders.loadTemplate)(template_name); this.data = data; this.$form = undefined; this.stageId = type != 'new' ? data.id : undefined; this.create(kwargs); } _createClass(StageForm, [{ key: 'create', value: function create(kwargs) { /** * Добавление шаблона-формы Этапа на страницу */ var el = $(this.self_tmpl(kwargs)); this.$container.append(el); this.$form = el.find('form'); // console.log("form --> ", this.$form); if (this.$form.length) this.$form.find('input[name=cost]').mask('000000000'); } }, { key: 'remove', value: function remove() { /** * Удаление, при уменьшении кол-ва этапов * return true - удаляем из [] stages */ if (this.type == 'new') { this.$form.parent().remove(); return true; } this.type = 'remove'; // this.$form.removeClass('update-stages-form').addClass('remove-stages-form'); return false; } }, { key: 'restore', value: function restore() { /** * Восстановление, при увеличении кол-ва этапов */ if (this.type == 'new') throw new Error("Попытка восстановить элемент с type='new'"); this.type = 'update'; // this.$form.removeClass('remove-stages-form').addClass('update-stages-form'); } }, { key: 'disable', value: function disable() { this.$form.find('input').attr('readonly', true); } }, { key: 'enable', value: function enable() { this.$form.find('input').attr('readonly', false); } }, { key: 'hide', value: function hide() { this.$form.parent().hide(); } }, { key: 'show', value: function show() { this.$form.parent().show(); } }, { key: 'is_valid', value: function is_valid() { var self = this; var mesage = 'Это поле обязательно'; var valid = true; //Очищаем старые ошибки this.$form.find('.error').html(""); // Отображаем новые this.$form.find(":input:not([type=hidden])").each(function (i, v) { if (!$(v).val()) { self.$form.find('.error-' + $(v).attr("name")).html(mesage).css('color', 'red'); valid = false; } }); return valid; } }, { key: 'sendAjax_approve', value: function sendAjax_approve() { /** * Отправка Этапа "на согласование" */ var self = this; // console.log("Send AJAX Approve"); if (this.type == 'new') { // console.log('new stages approve'); return Promise.resolve($.ajax({ // async: false, url: '/api/stages/', type: 'POST', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, data: this.$form.serialize(), dataType: 'json' }).done(function (json) { self.type = 'update'; self.disable(); self.$form.find('.error').html(""); // console.log("json -->", json); self.stageId = json.id; // console.log(json); }).fail(function (xhr, errorMsg, error) { console.log("ERROR, xhr", xhr); $.each(xhr.responseJSON, function (i, v) { self.$form.find('.error-' + i).html(v).css('color', 'red'); // console.log(self.$form); // console.log(v); // console.log(i); }); })); } else if (this.type == 'update') { this.$form.find('input[name=status]').val('send_approve'); return Promise.resolve($.ajax({ url: '/api/stages/' + this.stageId + '/', type: 'PUT', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, data: this.$form.serialize(), dataType: 'json' }).done(function (json) { self.$form.find('.error').html(""); self.disable(); }).fail(function (xhr, errorMsg, error) { $.each(xhr.responseJSON, function (i, v) { self.$form.find('.error-' + i).html(v).css('color', 'red'); console.log(v); console.log(i); }); })); } else if (this.type == 'remove') { return Promise.resolve($.ajax({ url: '/api/stages/' + this.stageId + '/', type: 'DELETE', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, dataType: 'json' }).done(function (json) {}).fail(function (xhr, errorMsg, error) { console.log("delete fail, json -->", xhr); })); } } }, { key: 'sendAjax_accept', value: function sendAjax_accept(secureOrder) { /** * "Согласовать" Этапы (Исполнителем) */ console.log("secureOrder = ", secureOrder); console.log("set new status =", secureOrder ? 'agreed' : 'in_process'); return Promise.resolve($.ajax({ url: '/api/stages/' + this.stageId + '/', type: 'PATCH', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, //TODO: слать только изменения data: { status: secureOrder ? 'agreed' : 'in_process' }, dataType: 'json' })); } }, { key: 'sendAjax_change', value: function sendAjax_change() { /** * Отправка Этапа "Внести изменения" */ var self = this; // this.$form.find('input[name=status]').val('not_agreed'); // console.log("ajax Change form -->", this.$form); return Promise.resolve($.ajax({ url: '/api/stages/' + this.stageId + '/', type: 'PATCH', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, //TODO: слать только изменения data: { status: 'not_agreed' }, dataType: 'json' }).done(function (json) { // enableStageFields(json.id); // $form.find('.error').html(""); self.enable(); }).fail(function (xhr) { console.log("Ошибка, которой не должно быть json -->", xhr.responseJSON); })); } }, { key: 'type', set: function set(newType) { this.$form.removeClass(this._type + '-stages-form').addClass(newType + '-stages-form'); if (newType == 'remove') this.hide(); if (newType == 'update') this.show(); this._type = newType; }, get: function get() { return this._type; } }]); return StageForm; }(); var StageReserved = function () { function StageReserved($container, _ref2) { var _ref2$template_name = _ref2.template_name, template_name = _ref2$template_name === undefined ? 'reserved_tmpl' : _ref2$template_name, data = _ref2.data; var kwargs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { reserved_cls: '', reserved_name: '', stage: data }; _classCallCheck(this, StageReserved); // Вывод текста резервирования в зависимости от статуса этапа var reserved_names = { agreed: 'Не зарезервирована', in_process: 'Зарезервирована', completed: 'Зарезервирована', closed: 'Переведена исполнителю' }; // Вывод текста резервирования в зависимости от статуса этапа var reserved_classes = { agreed: 'unreserved', in_process: 'reserved', completed: 'reserved', closed: 'closed' }; kwargs.reserved_cls = reserved_classes[data.status]; kwargs.reserved_name = reserved_names[data.status]; this.data = data; this.self_tmpl = (0, _loaders.loadTemplate)(template_name); this.$container = $container; this.create(kwargs); } _createClass(StageReserved, [{ key: 'create', value: function create(kwargs) { /** * Добавление шаблона "Резервирование" Этапа на страницу */ this.$self = $(this.self_tmpl(kwargs)); this.$container.append(this.$self); // console.log("form --> ", this.$form); // this.$form.find('input[name=cost]').mask('000000000'); } }]); return StageReserved; }(); var StageInWork = function () { function StageInWork($container, _ref3) { var _ref3$template_name = _ref3.template_name, template_name = _ref3$template_name === undefined ? 'work_in_process_tmpl' : _ref3$template_name, _ref3$note_text = _ref3.note_text, note_text = _ref3$note_text === undefined ? '' : _ref3$note_text, data = _ref3.data; var kwargs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { stage: data, note_text: note_text }; _classCallCheck(this, StageInWork); this.stageId = data.id; this.data = data; this.self_tmpl = (0, _loaders.loadTemplate)(template_name); this.$container = $container; this.create(kwargs); } _createClass(StageInWork, [{ key: 'create', value: function create(kwargs) { /** * Добавление шаблона "Выполнение работы" Этапа на страницу */ this.$self = $(this.self_tmpl(kwargs)); this.$container.append(this.$self); } }, { key: 'hide', value: function hide() { this.$self.hide(); } }, { key: 'sendAjax_complete', value: function sendAjax_complete() { /** * Отправка Этапа "Закрыть этап" */ var self = this; return Promise.resolve($.ajax({ url: '/api/stages/' + this.stageId + '/', type: 'PATCH', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, data: { status: 'completed' }, dataType: 'json' }).done(function (json) { // enableStageFields(json.id); // $form.find('.error').html(""); // self.enable(); }).fail(function (xhr) { console.log("Ошибка, которой не должно быть json -->", xhr.responseJSON); })); } }, { key: 'sendAjax_close', value: function sendAjax_close() { /** * Отправка Этапа "Закрыть этап" */ var self = this; return Promise.resolve($.ajax({ url: '/api/stages/' + this.stageId + '/', type: 'PATCH', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken')); }, //TODO: слать только изменения data: { status: 'closed' }, dataType: 'json' }).done(function (json) { // enableStageFields(json.id); // $form.find('.error').html(""); // self.enable(); }).fail(function (xhr) { console.log("Ошибка, которой не должно быть json -->", xhr.responseJSON); })); } }]); return StageInWork; }(); exports.StageForm = StageForm; exports.StageReserved = StageReserved; exports.StageInWork = StageInWork; /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.MessagesController = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _utils = __webpack_require__(3); var _loaders = __webpack_require__(4); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var MessagesController = function () { function MessagesController(orderId) { _classCallCheck(this, MessagesController); console.log('Create MessagesController'); var self = this; this.orderId = orderId; this.$inbox = $('#message-chat-order-space'); this.$inbox.html(""); this.messageTemplate = (0, _loaders.loadTemplate)('message_tmpl'); this.dataPromise = this.getMessagesData(); this.dataPromise.then(self._onLoadData.bind(self)); } _createClass(MessagesController, [{ key: 'getMessagesData', value: function getMessagesData() { var self = this; return Promise.resolve($.ajax({ url: '/api/message', type: 'GET', data: { 'order': self.orderId, 'team__isnull': 'true' }, beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, dataType: 'json', success: function success(json) { console.log('Success Messages'); } })); } }, { 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 = 'Вы'; var className = 'youChat'; if (v.sender.id !== userId) { senderName = v.sender.username; className = ''; } if (v.is_system) { senderName = 'Системное'; className = 'systemChat'; } var message = $(self.messageTemplate({ className: className, senderName: senderName, message: v })); self.$inbox.append(message); }); // console.log("messages render complete"); self.$inbox.scrollTop(self.$inbox.prop("scrollHeight")); } }]); return MessagesController; }(); exports.MessagesController = MessagesController; /***/ }, /* 16 */, /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.bindDeleteContact = exports.bindTeams = exports.bindGetUserMessages = exports.bindUserContacts = exports.bindOnTabs = exports.bindArbitrationSend = exports.bindOrders = undefined; var _utils = __webpack_require__(3); var _messageCounters = __webpack_require__(18); var _loaders = __webpack_require__(4); function dialog(message, yesCallback, notCallback) { $("#dialog_delete .modal-title").html(message); $("#dialog_delete").modal('show'); $("#btnYes").click(function (e) { e.preventDefault(); yesCallback(); $("#dialog_delete").modal('hide'); }); $("#btnNot").click(function (e) { e.preventDefault(); notCallback(); $("#dialog_delete").modal('hide'); }); } function bindOrders() { $('.order-block').on('click', function (event) { event.preventDefault(); var $this = $(this); (0, _messageCounters.onClickCardWithCount)($this); $('.order-block').each(function (i, v) { $(v).removeClass('orAct'); }); $this.addClass('orAct'); var orderId = $this.data('id'); var projectId = $this.data('project-id'); var recipentId = $this.data('recipent-id'); var orderName = $this.data('order-name'); var secureOrder = $(this).data('secure-deal'); secureOrder = Boolean(secureOrder); window.location.hash = 'order' + orderId; $("#chat-order-add #orderId").val(orderId); $("#add-form-order-note #orderNote").val(orderId); $("#orderArbitrationId").val(orderId); $("#projectReviewId").val(projectId); $("#reserve-button").attr('data-order-id', orderId); $("#chat-order-add #recipentId").val(recipentId); window.chatController.create(orderId, projectId, recipentId, orderName, secureOrder); }); $('.order-block .dimovChat').on('click', function (event) { event.preventDefault(); event.stopPropagation(); // console.log('click on tr'); }); } function bindTeams() { $('.team-block').on('click', function () { (0, _messageCounters.onClickCardWithCount)($(this)); $('.team-order-block, .team-block').each(function () { $(this).removeClass('orAct'); }); $(this).addClass('orAct'); var teamIds = ''; $.each($(this).find('.team-chat-user'), function (i, v) { teamIds += $(this).attr('data-id') + ";"; }); $("#team-chat-form #teamIds").val(teamIds); var inbox = document.getElementById('message-chat-team-space'); inbox.innerHTML = ''; var docList = document.getElementById('documentTeamSpace'); docList.innerHTML = ''; var teamId = $(this).attr('data-team-id'); location.hash = '#myteam' + teamId; // var newCount = parseInt($("#count-tab-team").text()); // var currNewCount = parseInt($(".team-count-" + teamId).text()); // var resCount = newCount - currNewCount; // $("#count-tab-team").text(resCount); $(".team-count-" + teamId).text(0); $("#team-chat-form #teamId").val(teamId); $("#add-form-team-note #teamNote").val(teamId); $("#team-chat-form #recipentTeamId").val(""); $("#team-chat-form #orderTeamId").val(""); $("#add-form-team-note #orderNote").val(""); $.ajax({ url: '/api/message', type: 'GET', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'team': teamId, 'order__isnull': 'true' }, dataType: 'json', success: function success(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; } }); $.ajax({ url: '/api/documents', type: 'GET', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'team': teamId, 'is_delete': false, 'is_send': true }, dataType: 'json', success: function success(json) { $.each(json.results, function (i, v) { docList.innerHTML += '
  • ' + v.file + '
  • '; }); }, error: function error(e) { console.log(e); } }); $.ajax({ url: '/api/note/', type: 'GET', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'team': teamId }, dataType: 'json', success: function success(json) { console.log(json.results); var noteHtmlInbox = ''; var note_tmpl = (0, _loaders.loadTemplate)('note_tmpl'); $.each(json.results, function (i, v) { noteHtmlInbox += note_tmpl({ text: v.text }); }); $(".team-notes-block").html(noteHtmlInbox); } }); }); } function bindArbitrationSend() { // TODO: Test it $('#order-arbitration-add').on('click', function (e) { e.preventDefault(); e.stopPropagation(); var formData = $("#arbitration-add-form").serialize(); $.ajax({ url: '/projects/arbitration/create/', type: 'POST', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: formData, dataType: 'json', success: function success(json) { console.log(json); $("#arbitration-add").modal('hide'); $.jGrowl("Обращение в арбитраж добавлено", { life: 4000 }); }, error: function error(e) { console.log('error'); console.log(e); } }); }); } function bindOnTabs() { /** * Биндит обработчики на Закладки */ $('a[data-toggle="tab"]').unbind().on('show.bs.tab', function (e) { console.log("TAB!"); var activeTab = $(this).attr('href').substring(1); var liveHash = URI(location.href).hash(); switch (activeTab) { case 'tab1': setTimeout(function () { if (liveHash.indexOf("#user") != -1) { var userHashId = liveHash.replace("#user", ""); $("#userBlock" + userHashId).trigger('click'); } else { $(".user-block").first().trigger('click'); } }, 100); break; case 'tab2': // console.log("tab2"); setTimeout(function () { if (liveHash.indexOf("#order") != -1) { var ordHashId = liveHash.replace("#order", ""); $("#orderBlock" + ordHashId).trigger('click'); } else { $(".order-block").first().trigger('click'); } }, 100); break; case 'tab3': setTimeout(function () { console.log("on active TAB team"); if (liveHash.indexOf("#teamorder") != -1) { var teamHashId = liveHash.replace("#teamorder", ""); $("#teamOrderBlock" + teamHashId).trigger('click'); } else if (liveHash.indexOf("#myteam") != -1) { var teamHashId = liveHash.replace("#myteam", ""); $("#teamMyBlock" + teamHashId).trigger('click'); } else { var firstTeamBlock = $(".team-block").first(); var firstTeamOrder = $(".team-order-block").first(); if (firstTeamOrder.length == 1) { firstTeamOrder.trigger('click'); } else if (firstTeamBlock.length == 1) { firstTeamBlock.trigger('click'); } } }, 100); } }); } function bindUserContacts() { $(".conMess").click('on', function (e) { e.preventDefault(); e.stopPropagation(); var userId = $(this).attr('data-id'); $.ajax({ url: '/api/users/' + userId + '/', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, dataType: 'json', success: function success(data) { var outTable = ''; if (data.username) { outTable += 'Ник' + data.username + ''; } if (data.fio) { outTable += 'Ф.И.О' + data.fio + ''; } if (data.skype) { outTable += 'Skype' + data.skype + ''; } if (data.website) { outTable += 'Сайт' + data.website + ''; } if (data.phone) { outTable += 'Телефон' + data.phone + ''; } $("#contact-info table").html(outTable); $("#contact-info").modal('show'); // console.log(data); }, error: function error(e, jqxhr) { console.log(e); } }); }); } function bindGetUserMessages() { $('.user-block').on('click', function () { (0, _messageCounters.onClickCardWithCount)($(this)); // var newCount = parseInt($("#count-tab-contact").text()); var contactId = $(this).attr('data-id'); location.hash = '#user' + contactId; $("#contact-chat-form #recipentContactId").val(contactId); $("#add-form-contractor-note #recipentNoteContractor").val(contactId); $('.user-block').each(function () { $(this).removeClass('mesAct'); }); $(this).addClass('mesAct'); var inbox = document.getElementById('message-chat-space'); 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 = ''; docList.innerHTML = ''; $.ajax({ url: '/api/message', type: 'GET', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'operand': 'in', 'sender_id': userId, 'recipent_id': contactId }, dataType: 'json', success: function success(json) { $.each(json.results, function (i, v) { var senderName = 'Вы'; var className = 'youChat'; if (v.sender.id == contactId) { senderName = v.sender.username; className = ''; } inbox.innerHTML += '
    ' + '

    ' + senderName + '

    ' + v.created + '
    ' + '

    ' + v.text + '

    '; }); var height = inbox.scrollHeight; inbox.scrollTop = height; } }); $.ajax({ url: '/api/documents', type: 'GET', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'operand': 'in', 'sender_id': userId, 'recipent_id': contactId, 'is_delete': false, 'is_send': true }, dataType: 'json', success: function success(json) { console.log(json); $.each(json.results, function (i, v) { docList.innerHTML += '
  • ' + v.file + '
  • '; }); }, error: function error(e) { console.log(e); } }); $.ajax({ url: '/api/note/', type: 'GET', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'operand': 'in', 'sender_id': userId, 'recipent_id': contactId }, dataType: 'json', success: function success(json) { console.log(json.results); var noteHtmlInbox = ''; var note_tmpl = (0, _loaders.loadTemplate)('note_tmpl'); $.each(json.results, function (i, v) { noteHtmlInbox += note_tmpl({ text: v.text }); }); $(".contractor-notes-block").html(noteHtmlInbox); } }); }); } function bindDeleteContact() { $('.deleteMess').on('click', function (e) { e.preventDefault(); e.stopPropagation(); var senderId = userId; var recipentId = $(this).attr('data-recipent-id'); var _this = $(this); dialog("Вы действительно хотите удалить сообщения этого пользователя?", function () { $.ajax({ url: '/chat/messages_delete/', type: 'POST', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { 'sender_id': senderId, 'recipent_id': recipentId }, dataType: 'json', success: function success(json) { if (json.status == 'ok') { _this.parent().remove(); $("#message-chat-space").html(""); } }, error: function error(e) { console.log('error'); console.log(e); } }); }.bind(null, senderId, recipentId, _this), function () {}); }); } exports.bindOrders = bindOrders; exports.bindArbitrationSend = bindArbitrationSend; exports.bindOnTabs = bindOnTabs; exports.bindUserContacts = bindUserContacts; exports.bindGetUserMessages = bindGetUserMessages; exports.bindTeams = bindTeams; exports.bindDeleteContact = bindDeleteContact; /***/ }, /* 18 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function recalculateTabsCounter() { // let tabs = [$('#count-tab-contact'), $('#count-tab-order'), $('#count-tab-team')] var tabs = [$('#tab1'), $('#tab2'), $('#tab3')]; var total_messages_count = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = tabs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var tab = _step.value; var count_sum = Array.from(tab.find('.js-count').map(function (i, el) { return parseInt($(el).html()); })).reduce(function (a, b) { return a + b; }, 0); var $tab_counter = $('a[href="#' + tab.attr('id') + '"]').find('.count-tab'); $tab_counter.html(count_sum); total_messages_count += count_sum; // console.log($tab_counter, 'new value -->', count_sum); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } var $header_counter = $('.js-all-messages'); $header_counter.html(total_messages_count); } function countPlus(message, place) { /** * Увеличиваем счетчик соответствующий сообщению(message) */ // console.log("MESSAGE = ", message); var $container = void 0; if (message.answer_type == "add_message_contact") { $container = $('.contact-count-' + message.sender_id); } else if (message.answer_type == "add_message_order") { $container = $('#count-order-' + message.order_id); } else if (message.answer_type == "add_message_team") { $container = $('#count-team-' + message.team_id); } // console.log("container = ", $container); $container.html(parseInt($container.html()) + 1); recalculateTabsCounter(); } function onClickCardWithCount($card) { /** * При нажатии на карточку со счетчиком новых сообщений */ // console.log('Обнулем счетчик ', $card); $card.find('.js-count').html(0); recalculateTabsCounter(); } exports.countPlus = countPlus; exports.onClickCardWithCount = onClickCardWithCount; /***/ }, /* 19 */, /* 20 */, /* 21 */ /***/ 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; /***/ }, /* 22 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.bindArchiveProjects = undefined; var _utils = __webpack_require__(3); function bindArchiveProjects() { // Нажимаем на кнопку архивные сообщения $("#trashed-button").on('click', function (e) { e.preventDefault(); var state = $(this).attr('data-show'); var trashedOrderHtml = ""; if (state == 'true') { $(this).attr('data-show', 'false'); $(this).text("Скрыть архивные заказы"); $("#archive-space").show(); $("#show-archive-label").show(); } else { $(this).attr('data-show', 'true'); $(this).text("Показать архивные заказы"); $("#archive-space").hide(); $("#show-archive-label").hide(); } }); // Нажимаем на заказ в архмвных заказах $(".messageBlock").on('click', '.trashedOrderBlock', function () { var $this = $(this); $("#chat-order-add").css("display", "none"); $('.order-block, .trashedOrderBlock').each(function () { $(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); // $.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(); }); } exports.bindArchiveProjects = bindArchiveProjects; /***/ }, /* 23 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); function chatContactsInit() { /** * Bind на кнопку "Отправить" в Закладке "Личные контакты" */ $('#contact-chat-add-message').on('click', function (e) { e.preventDefault(); var chatMessage = $("#chat").val(); var recipentId = $("#recipentContactId").val(); var senderId = $("#senderContactId").val(); 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 } } }); $("#chat").val(""); $("#document-send-contact").html(""); } else { $("#contact-chat-form .errorEmptyMessage").show(); } }); } function chatOrdersInit() { /** * Bind на кнопку "Отправить" в Закладке "Исполнители/Заказчики" */ $('#order-chat-add-message').on('click', function (e) { e.preventDefault(); var chatMessage = $("#chat-order-add #chat").val(); var recipentId = $("#chat-order-add #recipentId").val(); var senderId = $("#chat-order-add #senderId").val(); 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 } } }); $("#chat-order-add #chat").val(""); $("#document-send-order").html(""); } else { $("#chat-order-add .errorEmptyMessage").show(); } }); } function chatTeamsInit() { $("#add-team-chat-message").on('click', function (e) { e.preventDefault(); var chatMessage = $("#team-chat-form #chatText").val(); // var recipentId = $("#team-chat-form #recipentTeamId").val(); var senderId = $("#team-chat-form #senderTeamId").val(); var teamId = $("#team-chat-form #teamId").val(); // var orderId = $("#team-chat-form #orderTeamId").val(); var documentSendIds = $("#documentSendIds").val(); var teamIds = $("#team-chat-form #teamIds").val(); var sendLinks = $("#document-send 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_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(""); } else { $("#team-chat-form .errorEmptyMessage").show(); } }); } exports.chatContactsInit = chatContactsInit; exports.chatOrdersInit = chatOrdersInit; exports.chatTeamsInit = chatTeamsInit; /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.connect = undefined; var _loaders = __webpack_require__(4); var _messageCounters = __webpack_require__(18); function getUserPlace() { /** * Определяем в какой закладке Чата пользователь */ var hash = location.hash; var tab = void 0, id = void 0; var _arr = ["user", "order", "myteam"]; for (var _i = 0; _i < _arr.length; _i++) { var str = _arr[_i]; if (hash.indexOf('#' + str) != -1) { tab = str; id = hash.replace('#' + str, ''); } } return { tab: tab, id: id }; } function checkMessageInPlace(message, place) { /** * Проверяем, направлено ли входящее сообщение на текущую вкладку пользователя */ // message.answer_type=place.tab var eq = ['add_message_contact=user', 'add_message_order=order', 'add_message_team=myteam', 'approve_stages=order']; console.log([message.answer_type, place.tab].join('=')); console.log(message.order_id, '==', place.id, message.order_id == place.id); if (eq.indexOf([message.answer_type, place.tab].join('=')) != -1 && (message.order_id == place.id || message.recipent_id == place.id || message.sender_id == place.id || message.team_id == place.id)) { return true; } return false; } function connect() { wsConnect.then(function (_socket) { socket = _socket; // Onmessage in Chat page socket.addEventListener("message", function (event) { var data = JSON.parse(event.data); print.ws_print("new message on Chat page"); console.log(", message =", data); var user_place = getUserPlace(); // console.log("User place ", place.tab, place.id); if (checkMessageInPlace(data, user_place)) { console.log("Сообщение принято открытым чатом"); var chat_container_selectors = { "user": "#message-chat-space", "order": "#message-chat-order-space", "myteam": "#message-chat-team-space" }; var documents_container_seletors = { "user": "#documentSpace", "order": "#documentOrderSpace", "myteam": "#documentTeamSpace" }; var $chat_container = $(chat_container_selectors[user_place.tab]); var $documents_container = $(documents_container_seletors[user_place.tab]); var classMessage = 'youChat'; var senderName = 'Вы'; if (data.sender_id != userId) { senderName = data.sender_name; classMessage = ''; } if (data.is_system) { senderName = 'Системное'; classMessage = 'systemChat'; } var chat_message = (0, _loaders.loadTemplate)('message_tmpl')({ className: classMessage, senderName: senderName, message: { created: data.msg_time, text: data.msg } }); $chat_container.append(chat_message); $chat_container.scrollTop($chat_container.prop("scrollHeight")); $documents_container.append(data.docs_attach); if (data.answer_type == 'approve_stages') { window.chatController.statesController.redraw(); } } else { console.log("Сообщение учтено счетчиком"); (0, _messageCounters.countPlus)(data, user_place); } }); socket.addEventListener("close", function () { console.error("Connection Lost"); connect(); }); socket.send_message = function (messageData) { console.log('send message -->', messageData); socket.send(JSON.stringify(messageData)); }; socket.send_stages_approve = function (messageData) { // TODO: Пометить сообщения как "системные" socket.send(JSON.stringify(messageData)); }; }); wsConnect.catch(function (reason) { console.error("Server is not available", reason); }); } exports.connect = connect; /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChatPageController = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _StagesCustomerController = __webpack_require__(26); var _MessagesControllers = __webpack_require__(15); var _messageCounters = __webpack_require__(18); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ChatPageController = function () { function ChatPageController() { _classCallCheck(this, ChatPageController); var self = this; // console.log("NEW Chat CUSTOMER PageController"); this.statesController = undefined; this.messagesController = undefined; // TODO: не забыть! // recalculateMessages(); } _createClass(ChatPageController, [{ key: 'create', value: function create(orderId, projectId, recipentId, orderName, secureOrder) { this.statesController = new _StagesCustomerController.StagesController(orderId, projectId, recipentId, orderName, secureOrder); this.messagesController = new _MessagesControllers.MessagesController(orderId); } }]); return ChatPageController; }(); exports.ChatPageController = ChatPageController; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.StagesController = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _utils = __webpack_require__(3); var _loaders = __webpack_require__(4); var _Stages = __webpack_require__(14); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var message_format = { "format_type": "approve_stages", "data": { "sender_id": "", "recipent_id": "", "order_id": "", "msg": "", "is_system": true } }; var STATUSES = { 'not_agreed': 'не согласован', 'send_approve': 'на согласовании', 'agreed': 'согласовано', 'cancel_approve': 'исполнитель отказался', 'in_process': 'в процессе', 'completed': 'завершен', 'closed': 'закрыт' }; var StagesController = function () { function StagesController(orderId, projectId, recipentId, orderName, secureOrder) { _classCallCheck(this, StagesController); var self = this; this.orderId = orderId; this.orderName = orderName; this.projectId = projectId; this.recipentId = recipentId; this.secureOrder = secureOrder; this.data = {}; //JSON this.stages = []; this.stages_reserved = []; this.stages_work = []; this.STAGE_STATUSES = { 'not_agreed': this.buildNotAgreedStage.bind(self), 'send_approve': this.buildSendApproveStage.bind(self), 'agreed': this.buildAgreedStage.bind(self), 'in_process': this.buildProcessStage.bind(self), 'completed': this.buildProcessStage.bind(self), 'closed': this.buildProcessStage.bind(self) }; this.btnCompleteTmpl = (0, _loaders.loadTemplate)('bntCompleteStage_tmpl'); this.btnSendReviewTmpl = (0, _loaders.loadTemplate)('btnSendReview_tmpl'); this.$orderStagesContainer = $('#order-stages'); this.$orderStagesContainer.html(''); this.$stagesCount = $('#countStage'); this.$stagesCount.unbind().on("change", this._changeNumStages.bind(self)); this.$stagesCount.parent().show(); this.buttons = { btnApprove: $('#btnApprove'), btnChange: $('#btnChange'), btnToArchive: $('#btnToArchive'), btnReserve: $('#btnReserve'), btnsArbitration: $('.js-btnArbitration'), btnSendReview: $('#order-review-add') }; this.stages_elements = { $approve: $('#conditions-approve'), //1. Согласование условия $reserve: $('#reserveSpace'), //2. Резервирование $works: $('#completeWork') //3. Выполненная работа }; this.init(); } _createClass(StagesController, [{ key: 'init', value: function init() { var self = this; this.dataPromise = this.getOrderData({ orderId: this.orderId }); this.dataPromise.then(self._onLoadData.bind(self)).catch(self._onLoadDataError.bind(self)); } }, { key: 'getOrderData', value: function getOrderData(_ref) { var orderId = _ref.orderId; var self = this; return Promise.resolve($.ajax({ url: '/api/orders/' + orderId + '/', dataType: 'json', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); } })); } }, { key: 'redraw', value: function redraw() { /** * Полностью перерисовываем страницу Заказа */ console.log("Redraw customer stages"); // $("#orderBlock" + this.orderId).trigger('click'); this.init(); } }, { key: 'buildStartStage', value: function buildStartStage() { /** * Стадия: "Проект Предложен"(нет этапов) */ // Выделить цифру 1. красным // $('#conditions-approve').find('.select') this.$orderStagesContainer.show(); this.buttons.btnApprove.show(); this.buttons.btnChange.hide(); this.buttons.btnToArchive.hide(); this.$stagesCount.removeAttr('disabled'); this.$stagesCount.val(1); this.$stagesCount.trigger('change'); // this.stages_elements.$approve.find('.js-help-text').show(); // this.stages_elements.$reserve.find('.js-help-text').show(); // this.stages_elements.$reserve.find('.stages-paid').hide(); // this.stages_elements.$works.find('.js-help-text').show(); // this.stages_elements.$works.find('#stagesWork').show(); } // Нет Этапов }, { key: 'buildNotAgreedStage', value: function buildNotAgreedStage() { console.log("Stage: not_agreed"); this._renderStage('stage_tmpl'); this.buttons.btnApprove.show(); this.buttons.btnChange.hide(); this.buttons.btnToArchive.hide(); } // Статус "Не согласован" }, { key: 'buildSendApproveStage', value: function buildSendApproveStage() { console.log("Stage: send_approve"); this._renderStage('stage_tmpl', true); this.$stagesCount.attr('disabled', true); this.stages_elements.$reserve.hide(); this.stages_elements.$works.hide(); this.buttons.btnApprove.hide(); this.buttons.btnChange.show(); this.buttons.btnToArchive.show(); } // Статус "На согласовании" }, { key: 'buildAgreedStage', value: function buildAgreedStage() { console.log('Stage: agreed'); this.buttons.btnApprove.hide(); this.buttons.btnChange.hide(); this.buttons.btnToArchive.hide(); this.$stagesCount.parent().hide(); this._renderStage('stage_approved_tmpl', true); this.stages_elements.$approve.find('.js-help-text').hide(); this.stages_elements.$reserve.find('.js-help-text').show(); this.stages_elements.$reserve.show(); this.buttons.btnReserve.show(); this.buttons.btnsArbitration.show(); this._renderStageReserved('reserved_tmpl'); } // Статус "Согласован" }, { key: 'buildProcessStage', value: function buildProcessStage() { console.log('Stage: in_process'); this.buildAgreedStage(); this.stages_elements.$reserve.find('.js-btnArbitration').hide(); this.stages_elements.$works.show(); this._renderStageInWork('work_in_process_tmpl'); } // Статус "В процессе"/"Завершен"/"Закрыт" }, { key: '_buildPage', value: function _buildPage() { // console.log("Build PAge"); this.stages_elements.$reserve.hide(); this.stages_elements.$works.hide(); if (this.data.stages.length == 0) { this.buildStartStage(); } else { var stageStatus = this.data.stages[0].status; // console.log('stageStatus = ', stageStatus); this.STAGE_STATUSES[stageStatus](); } this._bindEvents(); } }, { key: '_renderStage', value: function _renderStage(template_name) { var disable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var i = 0; this.$orderStagesContainer.html(""); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = this.data.stages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var stage_data = _step.value; i++; var stage = new _Stages.StageForm(this.$orderStagesContainer, { orderId: this.orderId, stage_num: i, stage_status: STATUSES[stage_data.status], type: 'update', template_name: template_name, data: stage_data }); if (disable) stage.disable(); this.stages.push(stage); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } this.$stagesCount.val(i); } }, { key: '_renderStageReserved', value: function _renderStageReserved(template_name) { var $container = this.stages_elements.$reserve.find('.stages-paid'); $container.html(""); this.stages_reserved = []; // Нет незарезервированных Этапов var has_not_reserved_stages = false; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this.data.stages[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var stage_data = _step2.value; if (stage_data.status == 'agreed') has_not_reserved_stages = true; var stage = new _Stages.StageReserved($container, { template_name: template_name, data: stage_data }); this.stages_reserved.push(stage); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } if (!has_not_reserved_stages) { this.buttons.btnReserve.hide(); this.stages_elements.$reserve.find('.js-help-text').hide(); } } }, { key: '_renderStageInWork', value: function _renderStageInWork(template_name) { /** * Отрисовываем блок "Выволнение работы", включая "Выполненныа работа" и "Оставить отзыв" */ var $container = this.stages_elements.$works.find('#stagesWork'); $container.html(""); var all_closed = this.data.stages.every(function (el) { return el.status == 'closed'; }); if (all_closed) { this.stages_elements.$works.find('.titleStepss').html('3. Выполненная работа'); this.stages_elements.$works.find('.js-btnArbitration').hide(); this.stages_elements.$works.find('.js-help-text').hide(); var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = this.data.stages[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var stage_data = _step3.value; var stage = new _Stages.StageInWork($container, { template_name: template_name, data: stage_data, note_text: 'Закройте этап или подробно опишите замечания в чате' }); this.stages_work.push(stage); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } if (!this.data.has_user_review) { var btnReviewOpenModel = $(this.btnSendReviewTmpl()); btnReviewOpenModel.unbind().on('click', this._onBtnReviewOpenModal.bind(this)); // Если кнопка "Оставить отзыв" еще не добавлена - добавляем if (!this.stages_elements.$works.find('#send-review').length) this.stages_elements.$works.append(btnReviewOpenModel); } else { if (this.stages_elements.$works.find('#send-review').length) this.stages_elements.$works.find('#send-review').remove(); } } else { var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = this.data.stages[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var _stage_data = _step4.value; if (_stage_data.status == 'closed') continue; var _stage = new _Stages.StageInWork($container, { template_name: template_name, data: _stage_data }); if (_stage_data.status == 'completed') { var $btn = $(this.btnCompleteTmpl({ stage: _stage_data, text: 'Закрыть этап' })); $container.html(); $container.append($btn); $btn.on('click', this._onBtnClose.bind(this, _stage)); } this.stages_work.push(_stage); } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } } } }, { key: '_onLoadData', value: function _onLoadData(json) { this.data = json; this._buildPage(); } }, { key: '_changeNumStages', value: function _changeNumStages(event) { /** * Изменяет кол-во этапов(stages) */ var newNumStages = parseInt($(event.target).val()); if (newNumStages < 1 || isNaN(newNumStages)) { newNumStages = 1; this.$stagesCount.val(newNumStages); } var currentNumStages = $('.js-stage-form:not(.remove-stages-form)').length; if (currentNumStages == newNumStages) return; if (currentNumStages > newNumStages) { var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = this.stages.slice().reverse()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var stage = _step5.value; if (stage.remove()) { var index = this.stages.indexOf(stage); if (index >= 0) { this.stages.splice(index, 1); } } currentNumStages--; if (currentNumStages == newNumStages) break; } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } } else { var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = this.stages.slice()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var _stage3 = _step6.value; if (_stage3.type == 'remove') { _stage3.restore(); } else continue; currentNumStages++; if (currentNumStages == newNumStages) break; } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } while (currentNumStages < newNumStages) { currentNumStages++; var _stage2 = new _Stages.StageForm(this.$orderStagesContainer, { orderId: this.orderId, stage_num: currentNumStages, type: 'new', template_name: 'stage_tmpl' }); this.stages.push(_stage2); } } } //При изменении кол-ва этапов }, { key: '_bindEvents', value: function _bindEvents() { var self = this; this.buttons.btnApprove.unbind().on("click", this._onBtnApprove.bind(self)); this.buttons.btnChange.unbind().on("click", this._onBtnChange.bind(self)); this.buttons.btnToArchive.unbind().on("click", this._onBtnAToArchive.bind(self)); this.buttons.btnReserve.unbind().on("click", this._onBtnReserve.bind(self)); this.buttons.btnsArbitration.unbind().on("click", this._onBtnArbitration.bind(self)); 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); }); } // BINDS }, { key: '_onBtnApprove', value: function _onBtnApprove(event) { var _this = this; event.preventDefault(); var self = this; if (!this.stages.every(function (el) { return el.is_valid(); })) { console.error('Не все поля форм валидны'); return; } // При выполнении всех ajax запросов Promise.all(this.stages.map(function (el) { return el.sendAjax_approve(); })).then(function () { _this.buttons.btnApprove.hide(); _this.buttons.btnChange.show(); _this.buttons.btnToArchive.show(); _this.$stagesCount.attr('disabled', true); // var currentRecipentId = $(self).data('id'); // var secureOrder = true; // var message = message_format; message.data.sender_id = userId; message.data.recipent_id = self.recipentId; message.data.order_id = self.orderId; message.data.msg = '\u0423\u0441\u043B\u043E\u0432\u0438\u044F \u0437\u0430\u043A\u0430\u0437\u0430 ' + self.orderName + ' \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u044B \u043D\u0430 \u0441\u043E\u0433\u043B\u0430\u0441\u043E\u0432\u0430\u043D\u0438\u0435'; console.log("Send-WS Отправить на согласование"); socket.send_stages_approve(message); //TODO: раскомментировать дурацкое окно // $('#popupOk').modal('show'); // }) }); } // "Отправить на согласование" }, { key: '_onBtnChange', value: function _onBtnChange(event) { var _this2 = this; event.preventDefault(); var self = this; Promise.all(this.stages.map(function (el) { return el.sendAjax_change(); })).then(function () { _this2.buttons.btnApprove.show(); _this2.buttons.btnChange.hide(); _this2.buttons.btnToArchive.hide(); _this2.$stagesCount.attr('disabled', false); var message = message_format; message.data.sender_id = userId; message.data.recipent_id = self.recipentId; message.data.order_id = self.orderId; message.data.msg = '\u0417\u0430\u043A\u0430\u0437 ' + self.orderName + ' \u043E\u0442\u043E\u0437\u0432\u0430\u043D \u0434\u043B\u044F \u0432\u043D\u0435\u0441\u0435\u043D\u0438\u044F \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0439'; console.log("Send-WS Внести изменения"); socket.send_stages_approve(message); }); } // "Внести изменения" // TODO: test it }, { key: '_onBtnAToArchive', value: function _onBtnAToArchive(event) { event.preventDefault(); var self = this; $.ajax({ // async: false, url: '/api/orders/' + this.orderId + '/', type: 'DELETE', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, dataType: 'json' }).done(function (json) { console.log('delete complete'); window.location.href = window.location.href.replace(getHash(), ""); var message = message_format; message.data.sender_id = userId; message.data.recipent_id = self.recipentId; message.data.order_id = self.orderId; message.data.msg = '\u0417\u0430\u043A\u0430\u0437\u0430 ' + self.orderName + ' \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D \u0432 \u0430\u0440\u0445\u0438\u0432'; console.log("Send-WS Отправить в архив"); socket.send_stages_approve(message); }).fail(function (xhr, errorMsg, error) { console.log("delete fail, json -->", xhr); }); } // "Отказаться и отправить в архив" }, { key: '_onBtnReserve', value: function _onBtnReserve(event) { var self = this; event.preventDefault(); // Set modal-window params var $modal = $("#reserve-stage-modal"); var total_cost = this.stages.map(function (el) { return parseInt(el.data.cost); }).reduce(function (a, b) { return a + b; }, 0); // console.log('total cost = ', total_cost); $modal.find('#total-cost').html(total_cost); var $select_stageNum = $modal.find('#stage-num'); $select_stageNum.find('option').remove().end(); var _iteratorNormalCompletion7 = true; var _didIteratorError7 = false; var _iteratorError7 = undefined; try { for (var _iterator7 = this.stages[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { var stage = _step7.value; if (stage.data.is_paid) continue; $select_stageNum.append(''); } // let $stage_cost = $modal.find('#stage-cost'); // $stage_cost.html(self.stages[this.value - 1].data.cost); } catch (err) { _didIteratorError7 = true; _iteratorError7 = err; } finally { try { if (!_iteratorNormalCompletion7 && _iterator7.return) { _iterator7.return(); } } finally { if (_didIteratorError7) { throw _iteratorError7; } } } $modal.find('#stage-num').trigger('change'); $modal.modal('show'); } // "Зарезервировать" --> Открывает модальное окно для резервирования }, { key: '_onBtnPaymentFromSite', value: function _onBtnPaymentFromSite(event) { var self = this; event.preventDefault(); var $modal = $("#reserve-stage-modal"); var sum = void 0, stages_id = void 0; if ($modal.find('input[name=choice_way]:checked').val() == 'all_stages') { sum = $modal.find('#total-cost').html(); stages_id = this.stages.map(function (el) { return el.data.id; }); } else { sum = $modal.find('#stage-cost').html(); var num_stage = $modal.find('#stage-num').val() - 1; stages_id = [this.stages[num_stage].data.id]; } $.ajax({ url: '/wallets/payfromscore/', type: 'POST', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: { sum: sum, stages_id: stages_id.join(';') }, dataType: 'json', success: function success(json) { // console.log('success pay stage, json ', json); $("#reserve-stage-modal").modal('toggle'); var message = message_format; message.data.sender_id = userId; message.data.recipent_id = self.recipentId; message.data.order_id = self.orderId; message.data.msg = '\u0417\u0430\u043A\u0430\u0437\u0447\u0438\u043A \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043E\u0432\u0430\u043B \u0441\u0443\u043C\u043C\u0443 \u0434\u043B\u044F \u044D\u0442\u0430\u043F\u043E\u0432'; console.log("Send-WS Оплата Этапа/Этапов"); socket.send_stages_approve(message); self.redraw(); }, error: function error(xhr) { console.log('error pay stage, json', xhr.responseJSON); $.jGrowl(xhr.responseJSON.message_error); } }); } // Оплата с сайта(Счет на Proekton) }, { key: '_onBtnClose', value: function _onBtnClose(stage, event) { event.preventDefault(); var self = this; stage.sendAjax_close().then(function (json) { console.log("Этап закрыт успешно"); var message = message_format; message.data.sender_id = userId; message.data.recipent_id = self.recipentId; message.data.order_id = self.orderId; message.data.msg = '\u0417\u0430\u043A\u0430\u0437\u0447\u0438\u043A \u0437\u0430\u043A\u0440\u044B\u043B \u044D\u0442\u0430\u043F ' + json.name; console.log("Send-WS Оплата Этапа/Этапов"); socket.send_stages_approve(message); self.redraw(); }).catch(function (xhr) { console.log("При закрытии этапа произошла ошибка -->", xhr); }); } // "Закрыть этап" }, { key: '_onBtnReviewOpenModal', value: function _onBtnReviewOpenModal(event) { event.preventDefault(); $('#review-add').modal('show'); } // Открыть модальное окно "Оставить отзыв" }, { key: '_onBtnSendReview', value: function _onBtnSendReview(event) { event.preventDefault(); var self = this; $('#projectReviewId').val(this.projectId); $('#targetContractorId').val(this.recipentId); var formData = $("#review-adds-form").serialize(); $.ajax({ url: '/api/reviews/', type: 'POST', beforeSend: function beforeSend(xhr) { xhr.setRequestHeader("X-CSRFToken", (0, _utils.getCookie)('csrftoken')); }, data: formData, dataType: 'json', success: function success(json) { $('#review-add').modal('hide'); var message = message_format; message.data.sender_id = userId; message.data.recipent_id = self.recipentId; message.data.order_id = self.orderId; message.data.msg = '\u041E\u0442\u0437\u044B\u0432 \u043D\u0430 \u0437\u0430\u043A\u0430\u0437 ' + self.orderName + ' \u043E\u0441\u0442\u0430\u0432\u043B\u0435\u043D'; console.log("Send-WS Оставить отзыв"); socket.send_stages_approve(message); window.location = '/chat/#order'; location.reload(); // $("a[href='#tab2']").trigger('click'); }, error: function error(e) { console.log('error'); console.log(e); } }); } // "Оставить отзыв" }, { key: '_onBtnArbitration', value: function _onBtnArbitration(event) { event.preventDefault(); $("#arbitration-add").modal('show'); } // "Обратиться в арбитраж" }, { key: '_onLoadDataError', value: function _onLoadDataError(error) { console.log("Error loading data -->", error); } }]); return StagesController; }(); exports.StagesController = StagesController; /***/ } /******/ ]);