diff --git a/assets/js/build/init_create_worksell.js b/assets/js/build/init_create_worksell.js index 093d798..d44f06a 100644 --- a/assets/js/build/init_create_worksell.js +++ b/assets/js/build/init_create_worksell.js @@ -887,17 +887,13 @@ this._fillOptionsData(); this._bindEvents(); } - }, { - key: 'setElementById', - value: function setElementById(id) { - _get(NoTreeSelect.prototype.__proto__ || Object.getPrototypeOf(NoTreeSelect.prototype), 'setElementById', this).call(this, id); - this.selectedContainer.add(id); - } }, { key: '_onclickOptionsElement', value: function _onclickOptionsElement(e) { _get(NoTreeSelect.prototype.__proto__ || Object.getPrototypeOf(NoTreeSelect.prototype), '_onclickOptionsElement', this).call(this, e); this.clear(); + var id = $(e.target).data("id"); + this.selectedContainer.add(id); e.preventDefault(); return false; } diff --git a/assets/js/build/init_customer_project_create.js b/assets/js/build/init_customer_project_create.js index 136190a..7ebba90 100644 --- a/assets/js/build/init_customer_project_create.js +++ b/assets/js/build/init_customer_project_create.js @@ -179,15 +179,19 @@ } }); select_realty.on("add", function (args) { + console.log("realty add"); //TODO: Костыли!!! $('#checkbox-sb-realty').prop("checked", true); sb_realty.show(); var id = args[0]; if (id.text) return; var el = sb_realty.dataTree.getElementById(id); - sb_realty_top.$searchInput.val(el.name); - sb_realty_top.selectedEl.id = id; - sb_realty_top.selectedEl.value = el.name; + sb_realty_top.dataPromise.then(function () { + sb_realty_top.$searchInput.val(el.name); + sb_realty_top.selectedEl.id = id; + sb_realty_top.selectedEl.value = el.name; + }); + sb_realty.selectedEl.id = id; sb_realty._fillBoxes(); }); @@ -927,17 +931,13 @@ this._fillOptionsData(); this._bindEvents(); } - }, { - key: 'setElementById', - value: function setElementById(id) { - _get(NoTreeSelect.prototype.__proto__ || Object.getPrototypeOf(NoTreeSelect.prototype), 'setElementById', this).call(this, id); - this.selectedContainer.add(id); - } }, { key: '_onclickOptionsElement', value: function _onclickOptionsElement(e) { _get(NoTreeSelect.prototype.__proto__ || Object.getPrototypeOf(NoTreeSelect.prototype), '_onclickOptionsElement', this).call(this, e); this.clear(); + var id = $(e.target).data("id"); + this.selectedContainer.add(id); e.preventDefault(); return false; } diff --git a/assets/js/src/init_customer_project_create.js b/assets/js/src/init_customer_project_create.js index 20afee6..bad2d50 100644 --- a/assets/js/src/init_customer_project_create.js +++ b/assets/js/src/init_customer_project_create.js @@ -124,9 +124,12 @@ $(function () { let id = args[0]; if (id.text) return; let el = sb_realty.dataTree.getElementById(id); - sb_realty_top.$searchInput.val(el.name); - sb_realty_top.selectedEl.id = id; - sb_realty_top.selectedEl.value = el.name; + sb_realty_top.dataPromise.then(function () { + sb_realty_top.$searchInput.val(el.name); + sb_realty_top.selectedEl.id = id; + sb_realty_top.selectedEl.value = el.name; + }); + sb_realty.selectedEl.id = id; sb_realty._fillBoxes(); }) diff --git a/assets/lib/proekton-components/js/src/NoTreeSelect.js b/assets/lib/proekton-components/js/src/NoTreeSelect.js index 035af52..b5f2dfe 100644 --- a/assets/lib/proekton-components/js/src/NoTreeSelect.js +++ b/assets/lib/proekton-components/js/src/NoTreeSelect.js @@ -15,14 +15,11 @@ export default class NoTreeSelect extends AbsBaseSelect{ this._bindEvents(); } - setElementById(id) { - super.setElementById(id); - this.selectedContainer.add(id); - } - _onclickOptionsElement(e) { super._onclickOptionsElement(e); this.clear(); + let id = $(e.target).data("id"); + this.selectedContainer.add(id); e.preventDefault(); return false; } diff --git a/assets/sass/components/custom-components.sass b/assets/sass/components/custom-components.sass index ba9c82e..dc0dad9 100644 --- a/assets/sass/components/custom-components.sass +++ b/assets/sass/components/custom-components.sass @@ -273,6 +273,7 @@ textarea.description max-height: 68px .file-upload-widget + list-style: none .preview width: 100% height: 200px diff --git a/projects/forms.py b/projects/forms.py index fdbdd07..f3006ce 100644 --- a/projects/forms.py +++ b/projects/forms.py @@ -196,8 +196,8 @@ class CustomerProjectEditFormNew(forms.ModelForm): # self.fields['specialization'].queryset = Specialization.objects.root_nodes()[0].get_descendants() # self.fields['specialization'].queryset = Specialization.objects # Migrate with this enabled # print("files = ", self.instance.files) - # if self.instance.pk: - # self.fields['files'].queryset = self.instance.files + if self.instance.pk: + self.fields['files'].queryset = self.instance.files class RealtyForm(forms.ModelForm): diff --git a/projects/templates/customer_project_edit.html b/projects/templates/_trash/customer_project_edit.html similarity index 100% rename from projects/templates/customer_project_edit.html rename to projects/templates/_trash/customer_project_edit.html diff --git a/projects/templates/customer_project_create.html b/projects/templates/customer_project_create_or_edit.html similarity index 92% rename from projects/templates/customer_project_create.html rename to projects/templates/customer_project_create_or_edit.html index 20438ab..87272ae 100644 --- a/projects/templates/customer_project_create.html +++ b/projects/templates/customer_project_create_or_edit.html @@ -13,19 +13,26 @@ {% block content %} {% include 'partials/modals/project_work_type_suggestion.html' %} - {% include 'partials/modals/modal-registration_form.html' %} + {% include 'partials/modals/modal-registration_form.html' %} {% include 'partials/header.html' %}