From 6a3221d0cf569930f7a0a9b704b69f0bd13f91dd Mon Sep 17 00:00:00 2001 From: Dmitriy Shesterkin Date: Tue, 9 May 2017 15:56:28 +0300 Subject: [PATCH] add partner form, fix dadata api in docs add template --- .gitignore | 2 +- requirements/base.txt | 1 - requirements/local.txt | 3 +- src/customer/{!!forms.py => !!!del__forms.py} | 0 src/customer/forms.py | 2 +- src/customer/views/profile.py | 3 +- src/docs/views/__init__.py | 11 +- src/docs/views/base_views.py | 24 +- src/dokumentor/settings/base.py | 8 - src/dokumentor/settings/local.py | 18 +- .../static/js/client/search-external-api.js | 25 +- src/dokumentor/static/js/dialogs.js | 24 +- .../js/profile/search-main-external-api.js | 4 +- .../templates/customer/clients/!!form.html | 237 ------------------ .../templates/customer/clients/form.html | 15 +- .../templates/customer/profile/license.html | 38 +-- .../customer/profile/license_list.html | 4 +- .../{!!stub_js.html => !!del__stub_js.html} | 0 .../templates/docs/_base/base_add.html | 9 +- .../templates/docs/_base/base_edit.html | 9 +- src/dokumentor/templates/docs/stub_js.html | 14 +- 21 files changed, 107 insertions(+), 344 deletions(-) rename src/customer/{!!forms.py => !!!del__forms.py} (100%) delete mode 100644 src/dokumentor/templates/customer/clients/!!form.html rename src/dokumentor/templates/docs/{!!stub_js.html => !!del__stub_js.html} (100%) diff --git a/.gitignore b/.gitignore index e0f6642..e11ad0f 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,4 @@ yandex_money.log !local.py !parts !.gitkeep - +!form.html diff --git a/requirements/base.txt b/requirements/base.txt index eed5e99..32fb234 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -55,7 +55,6 @@ pytz==2017.2 reportlab==3.4.0 simplejson==3.3.1 six==1.10.0 -sqlparse==0.2.3 Unidecode==0.4.17 vine==1.1.3 webencodings==0.5.1 diff --git a/requirements/local.txt b/requirements/local.txt index 5aebb6b..f9dc1cb 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -1,6 +1,7 @@ -r base.txt ipython==2.1.0 -django-debug-toolbar==1.4 +django-debug-toolbar==1.5 +sqlparse==0.2.3 django-eml-email-backend==0.1 ipdb==0.10.3 ptpython==0.39 diff --git a/src/customer/!!forms.py b/src/customer/!!!del__forms.py similarity index 100% rename from src/customer/!!forms.py rename to src/customer/!!!del__forms.py diff --git a/src/customer/forms.py b/src/customer/forms.py index 6af2bdb..290922f 100644 --- a/src/customer/forms.py +++ b/src/customer/forms.py @@ -10,7 +10,7 @@ from commons.forms import MyBaseModelForm, set_field_error from customer import consts, models -FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(settings, 'FILE_UPLOAD_MAX_MEMORY_SIZE ', 2621440) # default 2.5Mb +FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(settings, 'FILE_UPLOAD_MAX_MEMORY_SIZE ', 2621440) # default 2.5Mb def get_profile_form_class(profile_type): diff --git a/src/customer/views/profile.py b/src/customer/views/profile.py index 2ca221f..c1f580c 100644 --- a/src/customer/views/profile.py +++ b/src/customer/views/profile.py @@ -86,7 +86,6 @@ def profile_edit(request): accounts = models.BankAccount.objects.get_all(profile) bank_account_form = forms.BankAccountForm(initial={'company': profile}) - dadata_api_key = settings.DADATA_API_KEY if request.method == 'POST': form = form_class(data=request.POST, files=request.FILES, instance=profile) @@ -118,7 +117,7 @@ def profile_edit(request): 'profile': profile, 'accounts': accounts, 'bank_account_form': bank_account_form, - 'dadata_api_key': dadata_api_key + 'dadata_api_key': settings.DADATA_API_KEY } return render(request, template_name, dictionary) diff --git a/src/docs/views/__init__.py b/src/docs/views/__init__.py index 86daa0e..22019e0 100644 --- a/src/docs/views/__init__.py +++ b/src/docs/views/__init__.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from django.shortcuts import render from django.contrib.auth.decorators import login_required -from django.http import Http404 -from django.conf import settings from docs.views.invoice import InvoiceViews from docs.views.aktrabot import AktRabotViews @@ -16,9 +14,12 @@ from docs.views.ajax import get_invoices, get_tbl_items, get_client_by_invoice, @login_required # важно!!! def getview(request, *args, **kwargs): - views = kwargs['klass'](request) # класс с вьюхами - handler = getattr(views, kwargs['oper']) # конкретная вьюха - return handler(request, *args, **kwargs) # передать управление во вьюху и вернуть ее результат + # класс с вьюхами + views = kwargs['klass'](request) + # конкретная вьюха + handler = getattr(views, kwargs['oper']) + # передать управление во вьюху и вернуть ее результат + return handler(request, *args, **kwargs) # ----------------------------------------------------------------------------- diff --git a/src/docs/views/base_views.py b/src/docs/views/base_views.py index 9e2e587..5113c2d 100644 --- a/src/docs/views/base_views.py +++ b/src/docs/views/base_views.py @@ -37,6 +37,7 @@ from docs import filters from customer.decorators import license_required from customer.utils import raise_if_no_profile +from django.conf import settings DEBUG = getattr(settings, 'DEBUG', False) @@ -91,7 +92,7 @@ class BaseViews(object): TEMPLATE_EMAIL = 'docs/email/base_email.html' TEMPLATE_EMAIL_FORM = 'docs/email/base_email_form.html' - EMAIL_MSG_TEMPLATE = 'docs/email/email.txt' # шаблон письма + EMAIL_MSG_TEMPLATE = 'docs/email/email.txt' # шаблон письма # для генерации pdf/xls PDF_TEMPLATE = '' @@ -184,7 +185,7 @@ class BaseViews(object): def get_filename(self, *args, **kwargs): obj = self.get_obj(kwargs['id']) - client = obj.client.name.replace('\n',' ').replace('\r',' ').strip() + client = obj.client.name.replace('\n', ' ').replace('\r', ' ').strip() return self.FILENAME % (obj.doc_num, client,) def update_list_dict(self, dictionary): @@ -200,7 +201,7 @@ class BaseViews(object): # фильтрация списка filters = self.get_filters(obj_list) - obj_list_count_before_filtering = 0 # сколько записей было в списке до его фильтрации + obj_list_count_before_filtering = 0 # сколько записей было в списке до его фильтрации if not filters.qs: obj_list_count_before_filtering = obj_list.count() obj_list = filters.qs @@ -344,13 +345,6 @@ class BaseViews(object): } return HttpResponse(json.dumps(result), content_type='application/json') - #dictionary = { - # 'padeji': self.PADEJI, - # 'padeji_mnoj': self.PADEJI_MNOJ, - # 'obj': obj, - #} - #return render(self.request, self.TEMPLATE_DELETE, dictionary) - def prepare(self, obj, export_to=None): """Изменить/подмешать дополнительные поля к документу.""" pass @@ -596,12 +590,12 @@ class BaseViews(object): class BaseItemsViews(BaseViews): """Базовые views для документов с табличной частью.""" - ITEM_MODEL = None # модель табличной части документа - ITEM_FORM_CLASS = None # форма табличной части документа - ITEM_FORM_PREFIX = None # префикс формы табличной части + ITEM_MODEL = None # модель табличной части документа + ITEM_FORM_CLASS = None # форма табличной части документа + ITEM_FORM_PREFIX = None # префикс формы табличной части # по какому полю суммировать табличную часть при показе списка документов - LIST_SUM_FIELD = None # None или строка + LIST_SUM_FIELD = None # None или строка def __init__(self, request): super(BaseItemsViews, self).__init__(request) @@ -696,6 +690,7 @@ class BaseItemsViews(BaseViews): 'client_form': ClientForm(), 'receiver_choice': receiver_choice, 'sender_choice': sender_choice, + 'dadata_api_key': settings.DADATA_API_KEY, } return render(self.request, self.TEMPLATE_ADD, dictionary) @@ -806,6 +801,7 @@ class BaseItemsViews(BaseViews): 'client_form': ClientForm(), 'receiver_choice': receiver_choice, 'sender_choice': sender_choice, + 'dadata_api_key': settings.DADATA_API_KEY, } return render(self.request, self.TEMPLATE_EDIT, dictionary) diff --git a/src/dokumentor/settings/base.py b/src/dokumentor/settings/base.py index dca1b52..41df835 100644 --- a/src/dokumentor/settings/base.py +++ b/src/dokumentor/settings/base.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- -# Django settings for project project. - import os import sys from datetime import timedelta @@ -22,12 +20,6 @@ SECRET_KEY = e.get('DJANGO_SECRET') DEBUG = False -ADMINS = ( - # ('Your Name', 'your_email@example.com'), -) - -MANAGERS = ADMINS - # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts diff --git a/src/dokumentor/settings/local.py b/src/dokumentor/settings/local.py index 8dcd243..12672b1 100644 --- a/src/dokumentor/settings/local.py +++ b/src/dokumentor/settings/local.py @@ -4,24 +4,26 @@ import dj_database_url from dokumentor.settings.base import * + +def custom_show_toolbar(self): + return True + DEBUG = True if DEBUG: INSTALLED_APPS.append('debug_toolbar') MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware') + INTERNAL_IPS = ['127.0.0.1', '0.0.0.0'] + + DEBUG_TOOLBAR_CONFIG = { + 'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar, + } DATABASES = { 'default': dj_database_url.parse(e.get('DJANGO_DB')), } -CACHES = { - 'default': { - 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', - 'LOCATION': '/tmp/django_cache_garpun', - } -} - EMAIL_BACKEND = 'eml_email_backend.EmailBackend' EMAIL_FILE_PATH = os.path.join(ROOT_DIR, 'tmp_emails') -INTERNAL_IPS = ['127.0.0.1'] + diff --git a/src/dokumentor/static/js/client/search-external-api.js b/src/dokumentor/static/js/client/search-external-api.js index 0f69cc6..e8c01a2 100644 --- a/src/dokumentor/static/js/client/search-external-api.js +++ b/src/dokumentor/static/js/client/search-external-api.js @@ -12,7 +12,7 @@ $(document).ready(function() { bankBic = $("#id_bank_bik", clientForm), bankFullName = $("#id_bank_name", clientForm), bankCorrespondentAccount = $("#id_bank_korr_account", clientForm), - //clientInputs = [clientName, clientInn, clientOqrn, clientAddress]; + contactName = $("#id_contact_name", clientForm), clientInputs = [clientName, clientNameShort, clientNameShortD, clientInn, clientOqrn, clientAddress]; @@ -60,15 +60,28 @@ $(document).ready(function() { function changeDataInInputs(data) { if (data.type === "LEGAL"|| data.type === "INDIVIDUAL" ) { - console.log(data); - if (data.name) + //console.log(data); + if (data.name) { clientName.val(join([data.opf && data.opf.short || "", data.name.short || data.name.full], " ")); clientNameShort.val(data.name.short); clientNameShortD.val(data.name.short); - if (data.name && data.name.full) + } + + if (data.name && data.name.full) { clientName.val(join([data.opf && data.opf.full || "", data.name.full], " ")); clientNameShort.val(data.name.short); clientNameShortD.val(data.name.short_with_opf); + } + + // fill contact name for organizations + if (data.management && data.management.name) { + contactName.val(getShortPersonName(data.management.name)); + } + + // fill contact name for individual entrepreneur + if (data.type === "INDIVIDUAL" && data.name && data.name.full) { + contactName.val(getShortPersonName(data.name.full)); + } clientInn.val(data.inn); clientKpp.val(data.kpp); @@ -126,7 +139,7 @@ $(document).ready(function() { })); clientSearch.on('keyup',(function () { - //console.log(clientSearch.val()); + if (clientSearch.val().length === 0) { clearSearchInputs([clientName, clientInn, clientKpp, clientOqrn, clientAddress]); } else { @@ -137,4 +150,4 @@ $(document).ready(function() { fillInput(clientSearch, "PARTY", 5); fillInput(bankSearch, "BANK", 1); -}); \ No newline at end of file +}); diff --git a/src/dokumentor/static/js/dialogs.js b/src/dokumentor/static/js/dialogs.js index 8e89e3c..b6b1944 100644 --- a/src/dokumentor/static/js/dialogs.js +++ b/src/dokumentor/static/js/dialogs.js @@ -23,7 +23,7 @@ $(document).ready(function() { },*/ success: function(data) { clear_form_errors(form); - + if (data.success) { console.log('!!!!!!!!!!!!!!!!!!!'); console.log(data); @@ -32,7 +32,7 @@ $(document).ready(function() { $('#id_client-deck').html( 'X' + data.name + ''); - + $('#id_client').html(''); $('#id_client').trigger('change'); } @@ -49,17 +49,17 @@ $(document).ready(function() { dlg_msg.dialog('open'); } } - if (data.action){ + if (data.action){ if (data.action == 'client-add'){ $(data.row_html).insertAfter('#clients_header_row'); window.clients_edit_del_update(); $('table#clients').show(); } - if (data.action == 'client-edit'){ + if (data.action == 'client-edit'){ $("tr#client_" + data.id).replaceWith(data.row_html); window.clients_edit_del_update(); } - if (data.action == 'client-delete'){ + if (data.action == 'client-delete'){ $("tr#client_" + data.id).remove(); } } @@ -71,7 +71,7 @@ $(document).ready(function() { // process form errors if (data.form_errors) { var captcha = $(form).find('img.captcha'); - if (captcha) { + if (captcha) { $(form).find('a.captcha_refresh').click(); } var errors = $('.errors-layout', form); @@ -111,8 +111,6 @@ $(document).ready(function() { dlg_msg.dialog({ modal: true, autoOpen: false, - //resizable: false, - //width: 310, buttons: { 'Закрыть': function() { $(this).dialog('close'); @@ -122,8 +120,6 @@ $(document).ready(function() { dlg_django_msg.dialog({ modal: true, autoOpen: true, - //resizable: false, - //width: 310, buttons: { 'Закрыть': function() { $(this).dialog('close'); @@ -172,6 +168,12 @@ function getPartOfPersonName(fullName, part) { } +function getShortPersonName(fullName) { + if (!fullName) return; + return getPartOfPersonName(fullName,0) + ' ' + getPartOfPersonName(fullName,1)[0] + '.' + getPartOfPersonName(fullName,2)[0] + '.'; +} + + function expandObject(obj, width, align) { obj["templateColWidth"] = width; obj["templateColAlign"] = align; @@ -236,4 +238,4 @@ function fillResultSearchBankTemplate(obj) { } bankResultDiv.html(template(obj)); -} \ No newline at end of file +} diff --git a/src/dokumentor/static/js/profile/search-main-external-api.js b/src/dokumentor/static/js/profile/search-main-external-api.js index cb4797f..492e046 100644 --- a/src/dokumentor/static/js/profile/search-main-external-api.js +++ b/src/dokumentor/static/js/profile/search-main-external-api.js @@ -73,6 +73,7 @@ $(document).ready(function() { var management = data.management; if (management.post) {profileBossTitle.val(data.management.post)} + if (management.name) { var fullName = management.name; profileBossSurname.val(getPartOfPersonName(fullName, 0)); @@ -111,7 +112,6 @@ $(document).ready(function() { var data = suggestion.data; if (!data) return; - confirmChangeDataPromise(profileInputs).then(function (answer) { if (answer) { changeDataInInputs(data) @@ -155,4 +155,4 @@ $(document).ready(function() { onSelect: showSuggestion }); -}); \ No newline at end of file +}); diff --git a/src/dokumentor/templates/customer/clients/!!form.html b/src/dokumentor/templates/customer/clients/!!form.html deleted file mode 100644 index ff0e2cf..0000000 --- a/src/dokumentor/templates/customer/clients/!!form.html +++ /dev/null @@ -1,237 +0,0 @@ -{% load my_tags %} - -
- {% if not is_ajax %} - {% if form.non_field_errors %}

{{ form.non_field_errors }}

{% endif %} - {% endif %} - -
- {% csrf_token %} -
-
-
- Поиск реквизитов: -
-
- -
-
-
-
- - {% for hidden in form.hidden_fields %} - {{ hidden }} - {% endfor %} - - {% if is_ajax %}
{% endif %} - -
- -
-
- Наименование{% if form.name.field.required %}*{% endif %}: -
-
- {{ form.name }} - {% if not is_ajax %}{{ form.name.errors }}{% endif %} -
-
-
- -
-
- ИНН{% if form.inn.field.required %}*{% endif %}: -
-
- {{ form.inn }} - {% if not is_ajax %}{{ form.inn.errors }}{% endif %} -
-
-
- -
-
- КПП{% if form.kpp.field.required %}*{% endif %}: -
-
- {{ form.kpp }} - {% if not is_ajax %}{{ form.kpp.errors }}{% endif %} -
-
-
- -
-
- ОГРН{% if form.ogrn.field.required %}*{% endif %}: -
-
- {{ form.ogrn }} - {% if not is_ajax %}{{ form.ogrn.errors }}{% endif %} -
-
-
- -
-
- ОКПО{% if form.okpo.field.required %}*{% endif %}: -
-
- {{ form.okpo }} - {% if not is_ajax %}{{ form.okpo.errors }}{% endif %} -
-
-
- -
-
- Юр. адрес{% if form.address.field.required %}*{% endif %}: -
-
- {{ form.address }} - {% if not is_ajax %}{{ form.address.errors }}{% endif %} -
-
-
- -
-
-
- Поиск банка: -
-
- -
-
-
-
- {% if not form.bank_bik.is_hidden %} -
- -
- БИК{% if form.bank_bik.field.required %}*{% endif %}: -
-
- {{ form.bank_bik }} - {% if not is_ajax %}{{ form.bank_bik.errors }}{% endif %} -
-
-
- {% endif %} - {% if not form.bank_name.is_hidden %} -
-
- Наименование банка{% if form.bank_name.field.required %}*{% endif %}: -
-
- {{ form.bank_name }} - {% if not is_ajax %}{{ form.bank_name.errors }}{% endif %} -
-
-
- {% endif %} - {% comment %} -
-
- Местонахождение{% if form.bank_address.field.required %}*{% endif %}: -
-
- {{ form.bank_address }} - {% if not is_ajax %}{{ form.bank_address.errors }}{% endif %} -
-
-
- {% endcomment %} - {% if not form.bank_korr_account.is_hidden %} -
- -
- К/сч.{% if form.bank_korr_account.field.required %}*{% endif %}: -
- -
- {{ form.bank_korr_account }} - {% if not is_ajax %}{{ form.bank_korr_account.errors }}{% endif %} -
-
-
- {% endif %} -
-
- Р/сч.{% if form.bank_account.field.required %}*{% endif %}: -
-
- {{ form.bank_account }} - {% if not is_ajax %}{{ form.bank_account.errors }}{% endif %} -
-
-
-
- -
-
-
- Имя{% if form.contact_name.field.required %}*{% endif %}: -
-
- {{ form.contact_name }} - {% if not is_ajax %}{{ form.contact_name.errors }}{% endif %} -
-
-
- -
-
- E-mail{% if form.contact_email.field.required %}*{% endif %}: -
-
- {{ form.contact_email }} - {% if not is_ajax %}{{ form.contact_email.errors }}{% endif %} -
-
-
- -
-
- Телефон{% if form.contact_phone.field.required %}*{% endif %}: -
-
- {{ form.contact_phone }} - {% if not is_ajax %}{{ form.contact_phone.errors }}{% endif %} -
-
-
- -
-
- Skype{% if form.contact_skype.field.required %}*{% endif %}: -
-
- {{ form.contact_skype }} - {% if not is_ajax %}{{ form.contact_skype.errors }}{% endif %} -
-
-
- -
-
- Другое{% if form.contact_other.field.required %}*{% endif %}: -
-
- {{ form.contact_other }} - {% if not is_ajax %}{{ form.contact_other.errors }}{% endif %} -
-
-
-
- -
- -
- {% if not is_ajax %} - - - {% endif %} -
-
- -
diff --git a/src/dokumentor/templates/customer/clients/form.html b/src/dokumentor/templates/customer/clients/form.html index 93e7d80..b2a4e89 100644 --- a/src/dokumentor/templates/customer/clients/form.html +++ b/src/dokumentor/templates/customer/clients/form.html @@ -118,7 +118,7 @@
- Имя{% if form.contact_name.field.required %}*{% endif %}: + ФИО руководителя{% if form.contact_name.field.required %}*{% endif %}:
{{ form.contact_name }} @@ -224,18 +224,7 @@
{% endif %} - {% comment %} -
-
- Местонахождение{% if form.bank_address.field.required %}*{% endif %}: -
-
- {{ form.bank_address }} - {% if not is_ajax %}{{ form.bank_address.errors }}{% endif %} -
-
-
- {% endcomment %} + {% if not form.bank_korr_account.is_hidden %}
diff --git a/src/dokumentor/templates/customer/profile/license.html b/src/dokumentor/templates/customer/profile/license.html index fb544ce..09ddd7a 100644 --- a/src/dokumentor/templates/customer/profile/license.html +++ b/src/dokumentor/templates/customer/profile/license.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load pytils_numeral %} +{% load pytils_numeral static %} {% block title %}Купить лицензию{% endblock %} {% block content %} @@ -57,42 +57,42 @@
Интернет-банкинг
-
-
-
-
+
+
+
+
Банковскими картами
-
-
-
+
+
+
Электронными деньгами
-
-
-
+
+
+
Со счёта телефона
-
-
-
+
+
+
Наличными
-
-
-
+
+
+
- +
{% endblock %} {% block js %} - + {% endblock %} diff --git a/src/dokumentor/templates/customer/profile/license_list.html b/src/dokumentor/templates/customer/profile/license_list.html index cbe2d8f..590bc29 100644 --- a/src/dokumentor/templates/customer/profile/license_list.html +++ b/src/dokumentor/templates/customer/profile/license_list.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load pytils_numeral %} +{% load pytils_numeral static %} {% block title %}Мои счета{% endblock %} {% block content %} @@ -33,5 +33,5 @@ {% endblock %} {% block js %} - + {% endblock %} diff --git a/src/dokumentor/templates/docs/!!stub_js.html b/src/dokumentor/templates/docs/!!del__stub_js.html similarity index 100% rename from src/dokumentor/templates/docs/!!stub_js.html rename to src/dokumentor/templates/docs/!!del__stub_js.html diff --git a/src/dokumentor/templates/docs/_base/base_add.html b/src/dokumentor/templates/docs/_base/base_add.html index 913008e..ffeadb9 100644 --- a/src/dokumentor/templates/docs/_base/base_add.html +++ b/src/dokumentor/templates/docs/_base/base_add.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load static %} {% block title %}Добавить {{ padeji.vinit }}{% endblock %} @@ -19,8 +20,10 @@ {% endblock %} {% block js %} - - - + + + + + {% include 'hbs/bank-tpl.html' %} {% include form_template_js %} {% endblock %} diff --git a/src/dokumentor/templates/docs/_base/base_edit.html b/src/dokumentor/templates/docs/_base/base_edit.html index a32f13b..67da8a3 100644 --- a/src/dokumentor/templates/docs/_base/base_edit.html +++ b/src/dokumentor/templates/docs/_base/base_edit.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load static %} {% block title %}Редактировать {{ padeji.vinit }}{% endblock %} @@ -22,8 +23,10 @@ {% endblock %} {% block js %} - - - + + + + + {% include 'hbs/bank-tpl.html' %} {% include form_template_js %} {% endblock %} diff --git a/src/dokumentor/templates/docs/stub_js.html b/src/dokumentor/templates/docs/stub_js.html index c3a6a37..e46896f 100644 --- a/src/dokumentor/templates/docs/stub_js.html +++ b/src/dokumentor/templates/docs/stub_js.html @@ -95,11 +95,11 @@ '>X' + data[1] + ''); $('#id_client').html(''); - //$('#id_client').trigger('change'); - }) + + }); $.get('/my/docs/ajax_get_tbl_items/' + invoice_id, function(data) { - console.log('==================='); + //console.log('==================='); var items = JSON.parse(data); $.each(items, function(index, item){ var name = item['fields']['name']; @@ -121,8 +121,8 @@ }); }) }) - }) - //var sender_val = $('input:radio[name=sender_group]:checked', '#doc-form').val(); + }); + var toggle_sender = function(client_type) { var sender_val = $('input:radio[name=' + client_type + '_group]:checked', '#doc-form').val(); if (sender_val == 'another') { @@ -130,14 +130,14 @@ } else { $('#' + client_type).hide() } - } + }; $.each(['sender', 'receiver'], function(i, client_type){ toggle_sender(client_type); $('input:radio[name=' + client_type + '_group]').change(function(){ toggle_sender(client_type); }) - }) + }); if ($('#id_fixes').is(':checked')){ $('#fix_block').show();