From 316356ceb94459c884b8fee64f4bb95d7eac98ca Mon Sep 17 00:00:00 2001 From: Dmitriy Shesterkin Date: Sun, 21 May 2017 20:22:56 +0300 Subject: [PATCH] fix bank short name --- src/customer/forms.py | 21 +++---- src/customer/models.py | 4 +- src/customer/views/bank_accounts_ajax.py | 11 ++-- src/customer/views/clients.py | 21 +++---- src/customer/views/clients_ajax.py | 11 ++-- src/dokumentor/static/css/style.css | 58 +++++++++---------- .../static/js/client/search-external-api.js | 4 +- src/dokumentor/static/js/dialogs.js | 37 +++++++----- .../js/profile/search-bank-external-api.js | 4 +- 9 files changed, 87 insertions(+), 84 deletions(-) diff --git a/src/customer/forms.py b/src/customer/forms.py index aed7f27..5000224 100644 --- a/src/customer/forms.py +++ b/src/customer/forms.py @@ -176,10 +176,8 @@ class UserProfileAdminForm(UserProfileForm): class BankAccountForm(forms.ModelForm): """Форма редактирования расчетных счетов.""" - # search_bank = forms.CharField(label=u'Поиск банка', required=False, initial='') class Meta: model = models.BankAccount - # fields = ('search_bank', 'bik', 'name', 'short_name', 'korr_account', 'account', 'is_main', 'company') fields = ('bik', 'name', 'short_name', 'korr_account', 'account', 'is_main', 'company') _textarea = forms.Textarea(attrs={'cols': 80, 'rows': 3}) widgets = { @@ -192,23 +190,19 @@ class BankAccountForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(BankAccountForm, self).__init__(*args, **kwargs) - # self.fields['bik'].widget.attrs.update(_numeric(self.fields['bik'])) - # self.fields['korr_account'].widget.attrs.update(_numeric(self.fields['korr_account'])) self.fields['account'].widget.attrs.update(_numeric(self.fields['account'])) - # self.fields['search_bank'].widget.attrs['class'] = 'search-bank' class BankAccountAdminForm(BankAccountForm): """Форма редактирования расчетных счетов - для админки.""" class Meta(BankAccountForm.Meta): - fields = None - exclude = ('address',) + fields = '__all__' class BankAccountListForm(forms.Form): """Форма со списком всех расчетных счетов пользователя.""" bank_account = forms.ModelChoiceField(queryset=models.BankAccount.objects.get_all(None), - empty_label=u'все контрагенты', required=False) + empty_label=u'все контрагенты', required=False) def __init__(self, user, *args, **kwargs): super(BankAccountListForm, self).__init__(*args, **kwargs) @@ -223,7 +217,7 @@ class ClientForm(forms.ModelForm): model = models.Client fields = ('name', 'name_short_self', 'name_short_dadata', 'inn', 'kpp', 'ogrn', 'okpo', 'address', # банковские реквизиты - 'bank_bik', 'bank_name', 'bank_korr_account', 'bank_account', + 'bank_bik', 'bank_name', 'bank_short_name', 'bank_korr_account', 'bank_account', # контакты 'contact_name', 'contact_email', 'contact_phone', 'contact_skype', 'contact_other', ) @@ -231,7 +225,7 @@ class ClientForm(forms.ModelForm): widgets = { 'bank_bik': forms.HiddenInput(), 'bank_name': forms.HiddenInput(), - 'short_name': forms.HiddenInput(), + 'bank_short_name': forms.HiddenInput(), 'bank_korr_account': forms.HiddenInput(), } @@ -244,6 +238,9 @@ class ClientForm(forms.ModelForm): self.fields['okpo'].widget.attrs.update(_numeric(self.fields['okpo'])) def clean(self): + if self.instance: + return self.cleaned_data + inn = self.cleaned_data.get('inn') partner_exists = models.Client.objects.filter(inn=inn, company=self.request.user.profile) if partner_exists: @@ -267,8 +264,8 @@ class ClientAdminForm(ClientForm): class ClientsListForm(forms.Form): """Форма со списком всех контрагентов пользователя.""" - client = forms.ModelChoiceField(queryset=models.Client.objects.get_all(None), empty_label=u'все контрагенты', - required=False) + client = forms.ModelChoiceField(queryset=models.Client.objects.get_all(None), + empty_label=u'все контрагенты', required=False) def __init__(self, user, *args, **kwargs): super(ClientsListForm, self).__init__(*args, **kwargs) diff --git a/src/customer/models.py b/src/customer/models.py index 23614d9..0d17c72 100644 --- a/src/customer/models.py +++ b/src/customer/models.py @@ -263,7 +263,6 @@ class UserProfile(models.Model): fax_code = u'(%s)' % fax_code if fax_code else fax_code return (u'%s %s' % (fax_code, self.fax,)).strip() - # TODO : test def validate_has_profile_account(self): """ Check there account from this profile @@ -282,7 +281,6 @@ class BankAccount(models.Model): bik = models.CharField(u'БИК', max_length=10) name = models.CharField(u'Наименование банка', max_length=256) short_name = models.CharField(u'Сокращенное название банка', max_length=100, blank=True, default='') - address = models.CharField(u'Местонахождение', max_length=256, blank=True, default='') # TODO delete field? korr_account = models.CharField(u'Корр. счет', max_length=20) account = models.CharField(u'Расчетный счет', max_length=20) @@ -342,7 +340,7 @@ class Client(models.Model): # банковские реквизиты bank_bik = models.CharField(u'БИК', max_length=10, blank=True, default='') bank_name = models.CharField(u'Наименование банка', max_length=256, blank=True, default='') - bank_address = models.CharField(u'Местонахождение', max_length=256, blank=True, default='') # TODO delete field? + bank_short_name = models.CharField(u'Сокращенное наименование банка', max_length=256, blank=True, default='') bank_korr_account = models.CharField(u'Корр. счет', max_length=20, blank=True, default='') bank_account = models.CharField(u'Расчетный счет', max_length=20, blank=True, default='') diff --git a/src/customer/views/bank_accounts_ajax.py b/src/customer/views/bank_accounts_ajax.py index 713a4cd..e8f44dd 100644 --- a/src/customer/views/bank_accounts_ajax.py +++ b/src/customer/views/bank_accounts_ajax.py @@ -11,7 +11,7 @@ from django.core.urlresolvers import reverse from commons.utils import dthandler from .. import models, forms -from ..decorators import license_required +from ..decorators import license_required from ..utils import raise_if_no_profile @@ -23,12 +23,12 @@ def bank_accounts_list_ajax(request): raise_if_no_profile(request) - fields_list = ['pk', 'bik', 'name', 'address', 'korr_account', 'account', 'is_main',] + fields_list = ['pk', 'bik', 'name', 'korr_account', 'account', 'is_main'] accounts = models.BankAccount.objects.get_all(company=request.user.profile).values(*fields_list) for a in accounts: - a['edit_url'] = reverse('customer_bank_accounts_edit', kwargs={'id': a['pk'],}) - a['delete_url'] = reverse('customer_bank_accounts_delete', kwargs={'id': a['pk'],}) + a['edit_url'] = reverse('customer_bank_accounts_edit', kwargs={'id': a['pk']}) + a['delete_url'] = reverse('customer_bank_accounts_delete', kwargs={'id': a['pk']}) data = json.dumps(list(accounts), default=dthandler) return HttpResponse(data, content_type='application/json') @@ -50,7 +50,8 @@ def bank_accounts_get_ajax(request, id): except AttributeError: fields_list = [] - account = get_object_or_404(models.BankAccount.objects.values(*fields_list), pk=id, company=request.user.profile) + account = get_object_or_404(models.BankAccount.objects.values(*fields_list), + pk=id, company=request.user.profile) data = json.dumps(account, default=dthandler) return HttpResponse(data, content_type='application/json') diff --git a/src/customer/views/clients.py b/src/customer/views/clients.py index 35702f8..b61c95b 100644 --- a/src/customer/views/clients.py +++ b/src/customer/views/clients.py @@ -5,9 +5,9 @@ from django.contrib.auth.decorators import login_required from commons.paginator import pagination, save_per_page_value -from .. import models, forms -from ..decorators import license_required -from ..utils import raise_if_no_profile +from customer import models, forms +from customer.decorators import license_required +from customer.utils import raise_if_no_profile from django.conf import settings @@ -19,9 +19,10 @@ def clients_list(request, page_num=None): raise_if_no_profile(request) - template_name='customer/clients/list.html' + template_name = 'customer/clients/list.html' - client_list = models.Client.objects.filter(company=request.user.profile).order_by('name', '-created_at') + client_list = models.Client.objects.filter(company=request.user.profile).\ + order_by('name', '-created_at') page, pagination_form = pagination(request, client_list, page_num) client_form = forms.ClientForm() @@ -43,7 +44,7 @@ def clients_add(request): """Добавить контрагента.""" raise_if_no_profile(request) - template_name='customer/clients/add.html' + template_name = 'customer/clients/add.html' success_url = 'customer_clients_list' form_class = forms.ClientForm @@ -61,7 +62,7 @@ def clients_add(request): else: form = form_class() - return render(request, template_name, {'form': form,}) + return render(request, template_name, {'form': form}) @login_required @@ -71,7 +72,7 @@ def clients_edit(request, id): """Редактировать контрагента.""" raise_if_no_profile(request) - template_name='customer/clients/edit.html' + template_name = 'customer/clients/edit.html' success_url = 'customer_clients_list' if request.method == 'POST' and '_cancel' in request.POST: @@ -103,7 +104,7 @@ def clients_delete(request, id): """Удалить контрагента.""" raise_if_no_profile(request) - template_name='customer/clients/delete.html' + template_name = 'customer/clients/delete.html' success_url = 'customer_clients_list' if request.method == 'POST' and '_cancel' in request.POST: @@ -116,4 +117,4 @@ def clients_delete(request, id): # TODO обработать ошибки удаления return redirect(success_url) - return render(request, template_name, {'client': client,}) + return render(request, template_name, {'client': client}) diff --git a/src/customer/views/clients_ajax.py b/src/customer/views/clients_ajax.py index 98a4bab..a405688 100644 --- a/src/customer/views/clients_ajax.py +++ b/src/customer/views/clients_ajax.py @@ -73,7 +73,7 @@ def clients_add_ajax(request): data = { 'success': form.is_valid(), 'field_errors': form.errors, - 'form_errors': non_field_errors, # ошибки формы + 'form_errors': non_field_errors, 'reload': False, 'id': new_client_id, 'name': new_client_str, @@ -93,11 +93,10 @@ def clients_edit_ajax(request, id): raise_if_no_profile(request) - form_class = forms.ClientForm - client = get_object_or_404(models.Client, pk=id, company=request.user.profile) - form = form_class(data=request.POST, instance=client) + form = forms.ClientForm(request.POST, request=request, instance=client) + if form.is_valid(): client = form.save() @@ -109,8 +108,8 @@ def clients_edit_ajax(request, id): data = { 'success': form.is_valid(), - 'field_errors': form.errors, # ошибки полей - 'form_errors': non_field_errors, # ошибки формы + 'field_errors': form.errors, + 'form_errors': non_field_errors, 'reload': False, 'id': client.id, 'name': client.name, diff --git a/src/dokumentor/static/css/style.css b/src/dokumentor/static/css/style.css index d17151d..cff22f2 100644 --- a/src/dokumentor/static/css/style.css +++ b/src/dokumentor/static/css/style.css @@ -66,7 +66,7 @@ body { .content-white {width:1200px;background:#fff;box-shadow: 0 0 5px #ddd;padding:15px;box-sizing:border-box;margin-bottom:70px;} #header {height:100px;width:100%;position:relative;} -#site_logo {font-family:"MyriadProRegular";display:block;overflow:hidden;margin-top:18px;} +#site_logo {font-family:"MyriadProRegular", sans-serif;display:block;overflow:hidden;margin-top:18px;} #site_logo .logo-bigfont {font-size:30px;line-height:30px;margin-top:12px;text-transform:uppercase;} .logo-text {margin-left:10px; font-size:18px;color:#3e454c;line-height:18px;} .auth_block {margin-top:30px;font-size: 13px;} @@ -78,32 +78,32 @@ body { .register:hover {background: url(../img/register-black.png) no-repeat 9px center;} .register_active {background: url(../img/register-black.png) no-repeat 9px center;} -.index-banner-text {height:551px;width:800px;color:#fff;font-size:24px;font-family:"MyriadPro-Light";position:relative;overflow:hidden;text-shadow:#000 0 0 6px;} +.index-banner-text {height:551px;width:800px;color:#fff;font-size:24px;font-family:"MyriadPro-Light",sans-serif;position:relative;overflow:hidden;text-shadow:#000 0 0 6px;} .index-banner-text h1 {font-size:40px;} .index-banner-btn {width:800px;display:table;text-shadow: none;} .index-register, .index-banner-btn p {display:table-cell;vertical-align:middle;padding:10px;} -.index-banner-btn p {width: 440px;font-size: 19px;background: #f0f0f0;color: #4e5661;font-family:"MyriadPro-Light";} -.index-register {font-size:28px;text-decoration:none;text-transform:uppercase;color:#4e5661;background:#fed13e;text-align:center;font-family:'MyriadProCondensed';} -.index-register:hover {font-size:28px;text-decoration:none;text-transform:uppercase;color:#4e5661;background:#ffca3e;text-align:center;font-family:'MyriadProCondensed';} +.index-banner-btn p {width: 440px;font-size: 19px;background: #f0f0f0;color: #4e5661;font-family:"MyriadPro-Light",sans-serif;} +.index-register {font-size:28px;text-decoration:none;text-transform:uppercase;color:#4e5661;background:#fed13e;text-align:center;font-family:'MyriadProCondensed',sans-serif;} +.index-register:hover {font-size:28px;text-decoration:none;text-transform:uppercase;color:#4e5661;background:#ffca3e;text-align:center;font-family:'MyriadProCondensed',sans-serif;} .index-promo {width:100%;position:relative;display:table-cell;vertical-align:middle;padding: 40px 0 0 0;} .index-promo .round {height:116px;width:116px;position:relative;border-radius:59px;float:left;margin-right:10px;} .index-promo .round1 {background:#fed13e url(../img/index-promo-1.png) no-repeat center center;} .index-promo .round2 {background:#fed13e url(../img/index-promo-2.png) no-repeat center center;} .index-promo .round3 {background:#fed13e url(../img/index-promo-3.png) no-repeat center center;} -.index-promo-text {float:left;overflow:hidden;width:390px;font-family:"MyriadPro-Light";} -.index-promo-text h2 {text-transform:uppercase;color:#fed13e;font-size:33px;margin:5px 0;font-family: "MyriadPro-Light";} +.index-promo-text {float:left;overflow:hidden;width:390px;font-family:"MyriadPro-Light", sans-serif;} +.index-promo-text h2 {text-transform:uppercase;color:#fed13e;font-size:33px;margin:5px 0;font-family: "MyriadPro-Light", sans-serif;} .index-promo-text .text {width:250px;} .index-promo-text .text p {color:#fff;margin:5px 0;font-size:18px;} #reasons {position:relative;margin-bottom:260px;} .extended-block {width:1200px;height:110px;overflow:visible;cursor:pointer;padding-right:650px;box-sizing:border-box;margin-bottom: 20px;} -.extended-block .order {font-family:"Times New Roman" serif;font-size:130px;line-height:110px;font-weight:normal;color:#e0e0e0;} +.extended-block .order {font-family:"Times New Roman",serif;font-size:130px;line-height:110px;font-weight:normal;color:#e0e0e0;} .extended-block.active .order {color:#ffd64f;} .extended-block-text .text {width:450px;height:110px;overflow:hidden;} -.extended-block-text h3 {font-size:18px;line-height:18px;color:#498dd0;margin:8px 0;font-family:"MyriadProRegular";font-weight: normal;} +.extended-block-text h3 {font-size:18px;line-height:18px;color:#498dd0;margin:8px 0;font-family:"MyriadProRegular", sans-serif;font-weight: normal;} .extended-block-text p {font-size:14px;line-height:14px;margin:4px 0;} -.extended-block-more {height:auto;background:#fff;box-shadow: 0 0 5px #ddd;border-radius:5px;font-size:13px;line-height:13px;margin:0;position:absolute;left:600px;top:0;width:550px;height:100%;box-sizing:border-box;padding:20px;} +.extended-block-more {background:#fff;box-shadow: 0 0 5px #ddd;border-radius:5px;font-size:13px;line-height:13px;margin:0;position:absolute;left:600px;top:0;width:550px;height:100%;box-sizing:border-box;padding:20px;} .extended-block-more .text {overflow:hidden;height:100%;position:relative;box-sizing:border-box;} .extended-block-more .text p {margin:0;} .extended-triangle {background: url(../img/triangle.png) no-repeat center center;width:9px;height:41px;position:relative;left:600px;top:40px;z-index:1;} @@ -113,9 +113,9 @@ body { #index-yellow-banner .lamp {background:url(../img/lamp-off.png) no-repeat center center;height:180px;width:160px;} #index-yellow-banner .lamp:hover {background:url(../img/lamp.png) no-repeat center center;height:180px;width:160px;} #index-yellow-banner .text {width:640px; margin-top: 10px;} -#index-yellow-banner .text a {font-size:24px;margin:0;font-family:"MyriadProRegular";display:inline-block;margin:25px 0 18px 0;color:#313942;text-decoration: none;} -#index-yellow-banner .text p {margin:0;font-size:15px;font-family:"Arial" sans-serif;color:#313942;} -#index-yellow-banner .btn {font-family:"MyriadProCondensed";width:400px;height:75px;margin-top:57px;font-weight:normal;} +#index-yellow-banner .text a {font-size:24px;font-family:"MyriadProRegular",sans-serif;display:inline-block;margin:25px 0 18px 0;color:#313942;text-decoration: none;} +#index-yellow-banner .text p {margin:0;font-size:15px;font-family:"Arial", sans-serif;color:#313942;} +#index-yellow-banner .btn {font-family:"MyriadProCondensed", sans-serif;width:400px;height:75px;margin-top:57px;font-weight:normal;} #index-yellow-banner .btn a {width:400px;height:75px;background:#313942;display:table-cell;vertical-align:middle;text-align:center;text-transform:uppercase;text-decoration:none;color:#fff;font-size:28px;} #index-yellow-banner .btn a:hover {width:400px;height:75px;background:#232e39;display:table-cell;vertical-align:middle;text-align:center;text-transform:uppercase;text-decoration:none;color:#fff;font-size:28px;} @@ -124,7 +124,7 @@ body { .register-arrow p {margin:5px;} .center-form .field input[type="text"], .center-form .field input[type="email"], .center-form .field input[type="password"]{color: #959595;width:300px;vertical-align:bottom;height:40px;margin-top:32px;font-size:26px;} -.center-form .field input[type="checkbox"] {height:20px;width:20px;vertical-align:middle;height:50px;} +.center-form .field input[type="checkbox"] {width:20px;vertical-align:middle;height:50px;} .center-form .field#captcha input[type="text"] {width:130px;height:50px;} .center-form .field label {display:inline-block;width:190px;text-align:right;line-height:50px;padding-right:5px;vertical-align:middle; font-size: 16px;} .center-form .field#profile_type label {width:200px;vertical-align:middle;height:50px;} @@ -180,7 +180,7 @@ body { width:142px; text-align:center; font-size:44px; - font-family:"MyriadPro-Light"; + font-family:"MyriadPro-Light", sans-serif; line-height:93px; color:#313942; background: #fbfbfb; /* Old browsers */ @@ -213,7 +213,7 @@ body { } .price-block .price-discount span{ font-size:14px; - font-family:'MyriadProRegular'; + font-family:'MyriadProRegular',sans-serif; font-weight:bold; display:block; height:10px; @@ -239,7 +239,7 @@ h2 {font-weight: normal;font-size:24px;font-family:"Arial Narrow", Arial, sans-s .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { - border-radius:none!important; + border-radius: 0!important; } .ui-widget-content { background:#fff; @@ -248,7 +248,7 @@ h2 {font-weight: normal;font-size:24px;font-family:"Arial Narrow", Arial, sans-s background:none!important; border:0; } -.ui-dialog .ui-dialog-content {font-size: 13px;font-family: Arial;} +.ui-dialog .ui-dialog-content {font-size: 13px;font-family: Arial,sans-serif;} .ui-widget-header {background:#fff;border:none;color:#646669;text-transform:uppercase;font-size:18px;font-weight:normal;font-stretch:ultra-condensed;font-family:"Arial Narrow", Arial, sans-serif;} .ui-state-default .ui-icon { background: url(../img/close.png) no-repeat top;opacity: 0.5;width:22px;height:22px;} .ui-state-default .ui-icon:hover { background: url(../img/close.png) no-repeat top;opacity: 1;} @@ -311,7 +311,7 @@ ul.messagelist li.error { background-image: url(../img/icon-error.gif); } form { font-size: small; padding: 0; margin: 0; } form label {font-style:italic;} -.label {width:120px;text-align:right;font-size:13px;color:#646669;line-height:30px;font-family:'Arial';} +.label {width:120px;text-align:right;font-size:13px;color:#646669;line-height:30px;font-family:'Arial', sans-serif;} /*.form-field: {width:210px;}*/ input, select, textarea { font-family: Arial,Helvetica,sans-serif;background:#f8f8f8;} @@ -344,17 +344,17 @@ input[type=text], input[type=number], input[type=email], input[type=password], t padding-right: 2px; margin-left: 2px; width: 200px; - font-family:'Arial'; + font-family:'Arial',sans-serif; line-height:20px; } -.client-form .bank-header {color: #646669;margin: 15px 0;font-family: Arial;font-size: 16px;font-style: italic;} +.client-form .bank-header {color: #646669;margin: 15px 0;font-family: Arial, sans-serif;font-size: 16px;font-style: italic;} /*.client-form .buttons { padding: 10px 0 6px 33px; }*/ .profile-table {width:100%;overflow:hidden;border-collapse: separate; display:table;border-spacing:15px;margin-bottom:85px;} .profile-row {display:table-row;} .profile-col1 {width: 785px;margin-right:15px;} .profile-col2 {width: 370px;} -.profile-col1, .profile-col2 {float: none;background:#fff; box-shadow: 0 0 5px #ddd;padding:0px;display:table-cell;} +.profile-col1, .profile-col2 {float: none;background:#fff; box-shadow: 0 0 5px #ddd;padding:0;display:table-cell;} #profile {position:relative;margin-bottom:85px;} #profile div {line-height: 20px;font-size: 14px;} .reqs_btns {position:absolute; bottom:215px;text-align:center;width:785px;} @@ -526,8 +526,8 @@ a.delete { vertical-align: top; } .doc-form .buttons input[name=submit]:hover {padding:25px 15px 25px 65px;background:url(../img/save.png) no-repeat left 25px center #ffca3e;color:#4e5661;font-family:"Arial Narrow", Arial, sans-serif;} #add-new {text-decoration: none;text-transform: uppercase;font-size: 22px;padding:10px 40px 10px 75px;background:url(../img/add-new.png) no-repeat left 30px center #fed13e;color:#4e5661;font-family:"Arial Narrow", Arial, sans-serif;} #add-new:hover {text-decoration: none;text-transform: uppercase;font-size: 22px;padding:10px 40px 10px 75px;background:url(../img/add-new.png) no-repeat left 30px center #ffca3e;color:#4e5661;font-family:"Arial Narrow", Arial, sans-serif;} -.doc-email-form input#id_to { width: 100%;margin-bottom: 10px;font-family: Arial; } -.doc-email-form textarea { width: 100%; margin-left: 2px;font-family: Arial; } +.doc-email-form input#id_to { width: 100%;margin-bottom: 10px;font-family: Arial, serif; } +.doc-email-form textarea { width: 100%; margin-left: 2px;font-family: Arial, serif; } .doc-email-form #doc_format ul li { display: inline; } .delete-row {display:inline-block;width:21px;height:21px;background:url(../img/close.png) no-repeat center center;opacity:0.5;} @@ -599,7 +599,7 @@ div.blockMsg { width: 100%; height: 100%; top: 0; left: 0; text-align: center; } .w200 {width:200px;min-height:5px;} .header {font-weight:bold;} -#footer {background:url('../img/footer-bg.jpg')#38424c;height:100px;bottom: 0px; width:100%;z-index:10;min-width:1200px;} +#footer {background:url('../img/footer-bg.jpg')#38424c;height:100px;bottom: 0; width:100%;z-index:10;min-width:1200px;} #footer-content {width:1200px;margin:0 auto;} #footer-content a {margin-right: 15px;text-decoration: none;color:#607c99;} #footer-content a:hover {margin-right: 15px;text-decoration: none;color:#4d94bd;} @@ -683,11 +683,11 @@ tr.doc-row:hover {cursor:pointer;} .license-form .field.orange_border {border: solid 1px #fed13e;position:relative;} .license-form .field.grey_border {border: solid 1px #9d9d9d;border-top:none;background:#faf9f9;position:relative;} .license-form input[type=submit]{border:none;background:url(../img/gotopay.png)center center no-repeat;width:145px;height:145px;margin:0 auto; display:block;} -.license-form input[type=submit:hover]{border:none;background:url(../img/gotopay-hover.png)center center no-repeat;width:145px;height:145px;margin:0 auto; display:block;} +.license-form input[type=submit]:hover{border:none;background:url(../img/gotopay-hover.png)center center no-repeat;width:145px;height:145px;margin:0 auto; display:block;} .orange-bottom-triangle {width:100%;height:20px;background:url(../img/triangle-orange-bottom.png)center center no-repeat;margin-top:-1px;position:absolute;top:0;left:0;} .grey-bottom-triangle {width:100%;height:20px;background:url(../img/triangle-grey-bottom.png)center center no-repeat;margin-top:-1px;position:relative;} .license-ways {width:585px;} -.license-ways .title {font-family:"MyriadPro-Light";font-size:28px;color:#313942;} +.license-ways .title {font-family:"MyriadPro-Light", sans-serif;font-size:28px;color:#313942;} .license-ways .col-title {font-size:15px;font-style:italic;padding-top:13px;padding-bottom:3px;font-weight:bold;} .license-ways .col {width:290px;} .license-ways .mr-5 {margin-right:5px;} @@ -696,9 +696,9 @@ tr.doc-row:hover {cursor:pointer;} #cabinet-popup h2 {font-size:16px;border-bottom:1px solid #fed13e;padding:0;margin:10px 0;} .yellow_round {padding: 10px;border-radius:100px;background:#fed13e;text-align:center;font-size:40px;font-weight:bold;display:inline-block;} .grey {color:#7d8084;} -a.popup-link {display:block;padding: 5px 0px 5px 25px;text-decoration:none;font-style:italic;color:#51558b;} +a.popup-link {display:block;padding: 5px 0 5px 25px;text-decoration:none;font-style:italic;color:#51558b;} a.popup-link:hover{text-decoration:underline;} -a.popup-buy-license {background:url(../img/popup-cart.png) no-repeat 0px center;} +a.popup-buy-license {background:url(../img/popup-cart.png) no-repeat 0 center;} a.popup-my-accs {background:url(../img/popup-list.png) no-repeat 3px center;} a.popup-history {background:url(../img/popup-clock.png) no-repeat 3px center;} a.popup-password {background:url(../img/popup-settings.png) no-repeat 3px center;} diff --git a/src/dokumentor/static/js/client/search-external-api.js b/src/dokumentor/static/js/client/search-external-api.js index 78a19f4..a0632ed 100644 --- a/src/dokumentor/static/js/client/search-external-api.js +++ b/src/dokumentor/static/js/client/search-external-api.js @@ -11,6 +11,7 @@ $(document).ready(function() { bankSearch = $("#searchClientBankInput", clientForm), bankBic = $("#id_bank_bik", clientForm), bankFullName = $("#id_bank_name", clientForm), + bankShortName = $("#id_bank_short_name", clientForm), bankCorrespondentAccount = $("#id_bank_korr_account", clientForm), contactName = $("#id_contact_name", clientForm), clientInputs = [clientName, clientNameShort, clientNameShortD, clientInn, clientOqrn, clientAddress]; @@ -96,11 +97,12 @@ $(document).ready(function() { clientAddress.val(data.address.value); } } else { + console.log(data); if (data.name && data.name.full || "") { bankFullName.val(data.name && data.name.full || ""); } if (data.name && data.name.payment || "") { - bankFullName.val(data.name && data.name.payment || ""); + bankShortName.val(data.name.payment || ""); } bankBic.val(data.bic); bankCorrespondentAccount.val(data.correspondent_account); diff --git a/src/dokumentor/static/js/dialogs.js b/src/dokumentor/static/js/dialogs.js index 8a8d757..3cf548a 100644 --- a/src/dokumentor/static/js/dialogs.js +++ b/src/dokumentor/static/js/dialogs.js @@ -42,8 +42,8 @@ $(document).ready(function() { if (data.success) { - // console.log('!!!!!!!!!!!!!!!!!!!'); - // console.log(data); + console.log('!!!!!!!!!!!!!!!!!!!'); + console.log(data); if (form[0].id == 'client-edit-form') { $('#id_client_text').hide(); @@ -254,23 +254,28 @@ function fillResultSearchBankTemplate(obj) { var newObj = {}; newObj['name'] = {}; - if (obj.hasOwnProperty('bik')) { + console.log(bankResultDiv); + console.log(obj); - newObj["bic"] = obj.bik; - newObj["name"]["full"] = obj.name; - newObj["name"]["payment"] = obj.short_name; - newObj["correspondent_account"] = obj.korr_account; - obj = newObj; - } + if (obj.hasOwnProperty('bik')) { - if (obj.hasOwnProperty('bank_bik')) { + newObj["bic"] = obj.bik; + newObj["name"]["full"] = obj.name; + newObj["name"]["payment"] = obj.bank_short_name || obj.short_name; + newObj["correspondent_account"] = obj.korr_account; + obj = newObj; - newObj["bic"] = obj.bank_bik; - newObj["name"]["full"] = obj.bank_name; - newObj["name"]["payment"] = obj.bank_name; - newObj["correspondent_account"] = obj.bank_korr_account; - obj = newObj; - } + } + + if (obj.hasOwnProperty('bank_bik')) { + + newObj["bic"] = obj.bank_bik; + newObj["name"]["full"] = obj.bank_name; + newObj["name"]["payment"] = obj.bank_short_name || obj.short_name; + newObj["correspondent_account"] = obj.bank_korr_account; + obj = newObj; + + } bankResultDiv.html(template(obj)); } diff --git a/src/dokumentor/static/js/profile/search-bank-external-api.js b/src/dokumentor/static/js/profile/search-bank-external-api.js index 8b8774d..d2ab7a4 100644 --- a/src/dokumentor/static/js/profile/search-bank-external-api.js +++ b/src/dokumentor/static/js/profile/search-bank-external-api.js @@ -10,8 +10,8 @@ $(document).ready(function() { var data = suggestion.data; if (!data) return; + bankFullName.val( data.name && data.name.full || ""); bankShortName.val(data.name && data.name.payment || ""); - bankFullName.val(data.name && data.name.full && data.name.payment || ""); bankBic.val(data.bic); bankCorrespondentAccount.val(data.correspondent_account); @@ -33,4 +33,4 @@ $(document).ready(function() { } })); -}); \ No newline at end of file +});