diff --git a/.gitignore b/.gitignore index f2ef327..ef7b891 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ yandex_money.log /tmp_emails/ /tmp/ /celerybeat-schedule.db +/media/ +/static/ diff --git a/project/__init__.py b/project/__init__.py index 236a1a7..f125737 100644 --- a/project/__init__.py +++ b/project/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -from .celery import app as celery_app +#from .celery import app as celery_app diff --git a/project/celery.py b/project/_celery.py similarity index 97% rename from project/celery.py rename to project/_celery.py index cf03aec..394f722 100644 --- a/project/celery.py +++ b/project/_celery.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- - from __future__ import absolute_import import os -from celery import Celery - from django.conf import settings # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') +import celery +from celery import Celery app = Celery('proj') # Using a string here means the worker will not have to diff --git a/project/commons/context_processors.py b/project/commons/context_processors.py deleted file mode 100644 index bbf0ee5..0000000 --- a/project/commons/context_processors.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from django.conf import settings - - -def get_dadata_api_key(request): - return { - "dadata_api_key": settings.DADATA_API_KEY - } diff --git a/project/customer/!!forms.py b/project/customer/!!forms.py new file mode 100644 index 0000000..e7ef9d8 --- /dev/null +++ b/project/customer/!!forms.py @@ -0,0 +1,486 @@ +# -*- coding: utf-8 -*- +from django import forms +from django.utils.encoding import force_unicode +from django.utils.safestring import mark_safe +from django.conf import settings + +from yandex_money.forms import PaymentForm +from project.commons.forms import MyBaseModelForm, set_field_error + +from . import consts, models + + +FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(settings, 'FILE_UPLOAD_MAX_MEMORY_SIZE ', 2621440) # default 2.5Mb + + +def get_profile_form_class(profile_type): + """Возвращает класс формы редактирования профиля пользователя.""" + if profile_type == consts.IP_PROFILE: + return IpUserProfileForm + elif profile_type == consts.ORG_PROFILE: + return OrgUserProfileForm + return None + + +def get_profile_filters_form_class(profile_type): + """Возвращает класс формы фильтрации профиля пользователя.""" + if profile_type == consts.IP_PROFILE: + return IpUserProfileFiltersForm + elif profile_type == consts.ORG_PROFILE: + return OrgUserProfileFiltersForm + return None + + +### + +def _numeric(field): + real_maxlength = field.widget.attrs['maxlength'] + return { + 'maxlength': int(real_maxlength)*3, # set fake maxlength. otherwise browser would cut pasted values too early + 'data-type': 'number', # used by jquery selector + 'data-maxlength': real_maxlength, # save real maxlength + } + +# ----------------------------------------------------------------------------- + + +class UserProfileForm(MyBaseModelForm): + """Общая форма редактирования профиля пользователя. + + Специализированные формы для редактирования профилей ИП и Организаций - + ищи ниже в классах IpUserProfileForm и OrgUserProfileForm соответственно. + + Форму для админки ищи ниже в классе UserProfileAdminForm. + """ + tmb_logo = forms.CharField(required=False, widget=forms.HiddenInput) + tmb_boss_sign = forms.CharField(required=False, widget=forms.HiddenInput) + tmb_glavbuh_sign = forms.CharField(required=False, widget=forms.HiddenInput) + tmb_stamp = forms.CharField(required=False, widget=forms.HiddenInput) + + class Meta: + model = models.UserProfile + + def __init__(self, *args, **kwargs): + super(UserProfileForm, self).__init__(*args, **kwargs) + if 'ip_reg_date' in self.fields: + self.fields['ip_reg_date'].widget.attrs['class'] = 'has-datepicker' + # + self.fields['inn'].widget.attrs.update(_numeric(self.fields['inn'])) + self.fields['ogrn'].widget.attrs.update(_numeric(self.fields['ogrn'])) + self.fields['okpo'].widget.attrs.update(_numeric(self.fields['okpo'])) + if 'kpp' in self.fields: + self.fields['kpp'].widget.attrs.update(_numeric(self.fields['kpp'])) + + def _check_file_size(self, image): + """Ограничить максимальный размер загружаемого файла.""" + if image and image.size > FILE_UPLOAD_MAX_MEMORY_SIZE: + raise forms.ValidationError( + u'Размер изображения превышает %i Мб' % (FILE_UPLOAD_MAX_MEMORY_SIZE / (1024*1024))) + return image + + def clean_boss_sign(self): + image = self.cleaned_data.get('boss_sign') + return self._check_file_size(image) + + def clean_glavbuh_sign(self): + image = self.cleaned_data.get('glavbuh_sign') + return self._check_file_size(image) + + def clean_stamp(self): + image = self.cleaned_data.get('stamp') + return self._check_file_size(image) + + def clean_logo(self): + image = self.cleaned_data.get('logo') + return self._check_file_size(image) + + +class IpUserProfileForm(UserProfileForm): + """Форма редактирования профиля - ИП.""" + change_labels = {'ogrn': u'ОГРНИП'} + + class Meta(UserProfileForm.Meta): + fields = ( + # фио ип + 'boss_surname', 'boss_name', 'boss_midname', + # инн, огрнип, окпо + 'inn', 'ogrn', 'okpo', + # свид-во гос. регистрации и дата + 'svid_gos_reg', 'ip_reg_date', + # фио главбуха + 'glavbuh_surname', 'glavbuh_name', 'glavbuh_midname', + # контактная информация - адреса, телефон, факс, почта, сайт + 'address', 'jur_address', 'real_address', 'phone_code', 'phone', 'fax_code', 'fax', 'email', 'site', + # подписи, печать и логотип + 'boss_sign', 'glavbuh_sign', 'stamp', 'logo', + 'tmb_logo', 'tmb_boss_sign', 'tmb_glavbuh_sign', 'tmb_stamp', + ) + + +class OrgUserProfileForm(UserProfileForm): + """Форма редактирования профиля - Организация.""" + unset_required = {'ogrn': u'ОГРН'} + change_labels = {'ogrn': u'ОГРН'} + + class Meta(UserProfileForm.Meta): + fields = ( + # краткое и полное названия организации + 'name', 'full_name', + # инн, кпп, огрн, окпо + 'inn', 'kpp', 'ogrn', 'okpo', + # должность руководителя, его фио и на каком основании он действует + 'boss_title', 'boss_surname', 'boss_name', 'boss_midname', 'na_osnovanii', + # фио главбуха + 'glavbuh_surname', 'glavbuh_name', 'glavbuh_midname', + # контактная информация - адреса, телефон, факс, почта, сайт + 'address', 'jur_address', 'real_address', 'phone_code', 'phone', 'fax_code', 'fax', 'email', 'site', + # подписи, печать и логотип + 'boss_sign', 'glavbuh_sign', 'stamp', 'logo', + 'tmb_logo', 'tmb_boss_sign', 'tmb_glavbuh_sign', 'tmb_stamp', + ) + + +class UserProfileAdminForm(UserProfileForm): + """Форма редактирования профиля - для админки.""" + + # условно-обязательные поля, проверять отдельно - могут быть обязательны в зависимости от типа профиля + unset_required = [ + # для ИП + 'kpp', 'name' + # для Организаций + ] + + def clean(self): + super(UserProfileAdminForm, self).clean() + + cleaned_data = self.cleaned_data + + # тип профиля - ИП или Организация + profile_type = cleaned_data.get('profile_type') + + if profile_type == consts.IP_PROFILE: # поля, обязательные для ИП + pass + + elif profile_type == consts.ORG_PROFILE: # поля, обязательные для Организаций + org_boss_name = cleaned_data.get('org_boss_name') + kpp = cleaned_data.get('kpp') + + if not org_boss_name: set_field_error(self, 'org_boss_name') + if not kpp: set_field_error(self, 'kpp') + + return cleaned_data + +# ----------------------------------------------------------------------------- + + +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 = { + 'bik': forms.HiddenInput(), + 'name': forms.HiddenInput(), + 'short_name': forms.HiddenInput(), + 'korr_account': forms.HiddenInput(), + 'company': forms.HiddenInput(), + } + + 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',) + + +class BankAccountListForm(forms.Form): + """Форма со списком всех расчетных счетов пользователя.""" + bank_account = forms.ModelChoiceField(queryset=models.BankAccount.objects.get_all(None), + empty_label=u'все контрагенты', required=False) + + def __init__(self, user, *args, **kwargs): + super(BankAccountListForm, self).__init__(*args, **kwargs) + self.fields['bank_account'].queryset = models.BankAccount.objects.get_all(user.profile) + +# ----------------------------------------------------------------------------- + + +class ClientForm(forms.ModelForm): + """Форма редактирования контрагентов.""" + class Meta: + model = models.Client + fields = ('name', 'inn', 'kpp', 'ogrn', 'okpo', 'address', + # банковские реквизиты + 'bank_bik', 'bank_name', 'bank_korr_account', 'bank_account', + # контакты + 'contact_name', 'contact_email', 'contact_phone', 'contact_skype', 'contact_other', + ) + _textarea = forms.Textarea(attrs={'cols': 80, 'rows': 3}) + widgets = { + 'bank_bik': forms.HiddenInput(), + 'bank_name': forms.HiddenInput(), + 'short_name': forms.HiddenInput(), + 'bank_korr_account': forms.HiddenInput(), + } + + def __init__(self, *args, **kwargs): + super(ClientForm, self).__init__(*args, **kwargs) + self.fields['inn'].widget.attrs.update(_numeric(self.fields['inn'])) + self.fields['kpp'].widget.attrs.update(_numeric(self.fields['kpp'])) + self.fields['ogrn'].widget.attrs.update(_numeric(self.fields['ogrn'])) + self.fields['okpo'].widget.attrs.update(_numeric(self.fields['okpo'])) + # self.fields['bank_bik'].widget.attrs.update(_numeric(self.fields['bank_bik'])) + # self.fields['bank_korr_account'].widget.attrs.update(_numeric(self.fields['bank_korr_account'])) + # self.fields['bank_account'].widget.attrs.update(_numeric(self.fields['bank_account'])) + + +class ClientAdminForm(ClientForm): + """Форма редактирования контрагентов - для админки.""" + class Meta(ClientForm.Meta): + fields = None + exclude = ('bank_address',) + + +class ClientsListForm(forms.Form): + """Форма со списком всех контрагентов пользователя.""" + 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) + self.fields['client'].queryset = models.Client.objects.get_all(user.profile) + +# ----------------------------------------------------------------------------- + + +class UserProfileFiltersForm(MyBaseModelForm): + """Общая форма фильтрации реквизитов.""" + _profile_type = None # задать в наследнике! + + _is_admin = False + _user = None + + class Meta: + model = models.UserProfileFilters + widgets = { + 'bank_account': forms.RadioSelect(), + } + + def __init__(self, profile=None, accounts=None, *args, **kwargs): + instance = kwargs.get('instance') + initial = kwargs.get('initial') + + new_initial = { + # всегда включены + 'show_ip_boss_fio': True, + 'show_name': True, + } + + # TODO 1. переписать проверки в стиле new_initial['show_inn'] = bool(profile.inn) + # TODO 2. загнать условия в словарь вида {'show_inn': 'inn'}. потом в цикле обработать + if profile: + # сбросить чекбоксы, если не заполнены определенные поля в профиле или нет расчетных счетов + if instance: + new_initial['show_inn'] = bool(profile.inn) + new_initial['show_ogrn'] = bool(profile.ogrn) + new_initial['show_okpo'] = bool(profile.okpo) + new_initial['show_glavbuh'] = bool(profile.get_glavbuh_fio()) + new_initial['show_address'] = bool(profile.address) + new_initial['show_jur_address'] = bool(profile.jur_address) + new_initial['show_real_address'] = bool(profile.real_address) + new_initial['show_phone'] = bool(profile.get_full_phone()) + new_initial['show_fax'] = bool(profile.get_full_fax()) + new_initial['show_email'] = bool(profile.email) + new_initial['show_site'] = bool(profile.site) + new_initial['show_bank_account'] = bool(accounts) + new_initial['show_logo'] = bool(profile.logo) + + if self._profile_type == consts.IP_PROFILE: + new_initial['show_svid_gos_reg'] = bool(profile.svid_gos_reg) + new_initial['show_ip_reg_date'] = bool(profile.ip_reg_date) + elif self._profile_type == consts.ORG_PROFILE: + new_initial['show_full_name'] = bool(profile.full_name) + new_initial['show_kpp'] = bool(profile.kpp) + new_initial['show_na_osnovanii'] = bool(profile.na_osnovanii) + else: + new_initial['show_inn'] = bool(profile.inn) + new_initial['show_ogrn'] = bool(profile.ogrn) + new_initial['show_okpo'] = bool(profile.okpo) + new_initial['show_glavbuh'] = bool(profile.get_glavbuh_fio()) + new_initial['show_address'] = bool(profile.address) + new_initial['show_jur_address'] = bool(profile.jur_address) + new_initial['show_real_address'] = bool(profile.real_address) + new_initial['show_phone'] = bool(profile.get_full_phone()) + new_initial['show_fax'] = bool(profile.get_full_fax()) + new_initial['show_email'] = bool(profile.email) + new_initial['show_site'] = bool(profile.site) + new_initial['show_bank_account'] = bool(accounts) + new_initial['show_logo'] = bool(profile.logo) + + if self._profile_type == consts.IP_PROFILE: + new_initial['show_svid_gos_reg'] = bool(profile.svid_gos_reg) + new_initial['show_ip_reg_date'] = bool(profile.ip_reg_date) + elif self._profile_type == consts.ORG_PROFILE: + new_initial['show_full_name'] = bool(profile.full_name) + new_initial['show_kpp'] = bool(profile.kpp) + new_initial['show_na_osnovanii'] = bool(profile.na_osnovanii) + + if initial: + initial.update(new_initial) + else: + kwargs['initial'] = new_initial + + super(UserProfileFiltersForm, self).__init__(*args, **kwargs) + + # для админки + if self._is_admin: + # попробовать взять user из kwargs['instance'], а потом из self.data + try: + self._user = getattr(kwargs.get('instance'), 'user') + except AttributeError: + self._user = self.data.get('user') + if not accounts: + accounts = models.BankAccount.objects.get_all(self._user.profile) + + f = self.fields + + # только расчетные счета пользователя + f_acc = f['bank_account'] # TODO вынести настройку расчетных счетов в mixin? + f_acc.queryset = accounts + f_acc.empty_label = None + f_acc.label_from_instance = lambda obj: mark_safe( + force_unicode('%s
%s' % (obj.account, obj.name,))) # исправить метку + + # заблокировать чекбоксы, если: не заполнены определенные поля в профиле или нет расчетных счетов + if profile: + if not profile.inn: f['show_inn'].widget.attrs['disabled'] = 'disabled' + if not profile.ogrn: f['show_ogrn'].widget.attrs['disabled'] = 'disabled' + if not profile.okpo: f['show_okpo'].widget.attrs['disabled'] = 'disabled' + if not profile.get_glavbuh_fio(): f['show_glavbuh'].widget.attrs['disabled'] = 'disabled' + if not profile.address: f['show_address'].widget.attrs['disabled'] = 'disabled' + if not profile.jur_address: f['show_jur_address'].widget.attrs['disabled'] = 'disabled' + if not profile.real_address: f['show_real_address'].widget.attrs['disabled'] = 'disabled' + if not profile.get_full_phone(): f['show_phone'].widget.attrs['disabled'] = 'disabled' + if not profile.get_full_fax(): f['show_fax'].widget.attrs['disabled'] = 'disabled' + if not profile.email: f['show_email'].widget.attrs['disabled'] = 'disabled' + if not profile.site: f['show_site'].widget.attrs['disabled'] = 'disabled' + if not profile.logo: f['show_logo'].widget.attrs['disabled'] = 'disabled' + if not accounts: f['show_bank_account'].widget.attrs['disabled'] = 'disabled' + + if self._profile_type == consts.IP_PROFILE: + if not profile.svid_gos_reg: f['show_svid_gos_reg'].widget.attrs['disabled'] = 'disabled' + if not profile.ip_reg_date: f['show_ip_reg_date'].widget.attrs['disabled'] = 'disabled' + elif self._profile_type == consts.ORG_PROFILE: + if not profile.name: f['show_name'].widget.attrs['disabled'] = 'disabled' + if not profile.full_name: f['show_full_name'].widget.attrs['disabled'] = 'disabled' + if not profile.kpp: f['show_kpp'].widget.attrs['disabled'] = 'disabled' + if not profile.boss_title: f['show_org_boss_title_and_fio'].widget.attrs['disabled'] = 'disabled' + if not profile.na_osnovanii: f['show_na_osnovanii'].widget.attrs['disabled'] = 'disabled' + + # блокировать чекбоксы, т.к.эти реквизиты юзеру выключать нельзя + if self._profile_type == consts.IP_PROFILE: + f['show_ip_boss_fio'].widget.attrs['disabled'] = 'disabled' + elif self._profile_type == consts.ORG_PROFILE: + f['show_name'].widget.attrs['disabled'] = 'disabled' + + +class IpUserProfileFiltersForm(UserProfileFiltersForm): + """Форма фильтрации реквизитов - для ИП.""" + _profile_type = consts.IP_PROFILE + + change_labels = { + 'show_profile_type': dict(consts.PROFILE_TYPES)[_profile_type], + 'show_ogrn': u'ОГРНИП', + } + + class Meta(UserProfileFiltersForm.Meta): + fields = ( + 'show_profile_type', + 'show_ip_boss_fio', + 'show_inn', + 'show_ogrn', + 'show_okpo', + 'show_svid_gos_reg', + 'show_ip_reg_date', + 'show_glavbuh', + 'show_bank_account', + 'bank_account', + 'show_contact_info', + 'show_address', + 'show_jur_address', + 'show_real_address', + 'show_phone', + 'show_fax', + 'show_email', + 'show_site', + 'show_logo', + ) + + +class OrgUserProfileFiltersForm(UserProfileFiltersForm): + """Форма фильтрации реквизитов - для Организаций.""" + _profile_type = consts.ORG_PROFILE + + change_labels = { + 'show_profile_type': dict(consts.PROFILE_TYPES)[_profile_type], + 'show_ogrn': u'ОГРН', + } + + class Meta(UserProfileFiltersForm.Meta): + fields = ( + 'show_profile_type', + 'show_name', + 'show_full_name', + 'show_inn', + 'show_kpp', + 'show_ogrn', + 'show_okpo', + 'show_org_boss_title_and_fio', + 'show_na_osnovanii', + 'show_glavbuh', + 'show_bank_account', + 'bank_account', + 'show_contact_info', + 'show_address', + 'show_jur_address', + 'show_real_address', + 'show_phone', + 'show_fax', + 'show_email', + 'show_site', + 'show_logo', + ) + +# ----------------------------------------------------------------------------- + + +class EmailProfileForm(forms.Form): + """Форма отправки реквизитов пользователя по email.""" + to = forms.EmailField(label=u'E-mail получателя') + body = forms.CharField(label=u'Текст сообщения', max_length=1000, required=False, + widget=forms.Textarea(attrs={'cols': 80, 'rows': 3})) + + +class LicenseForm(forms.Form): + """Форма продления лицензии + """ + term = forms.ModelChoiceField(queryset=models.LicensePrice.objects.all(), + widget=forms.RadioSelect, label=u'Срок лицензии', empty_label = None) + payform = forms.ChoiceField(choices=consts.PAYFORMS[1:], widget=forms.RadioSelect, + label=u'Форма оплаты') + + +class YaForm(PaymentForm): + def get_display_field_names(self): + return () diff --git a/project/customer/forms.py b/project/customer/forms.py index e7ef9d8..8cf8349 100644 --- a/project/customer/forms.py +++ b/project/customer/forms.py @@ -220,7 +220,7 @@ class ClientForm(forms.ModelForm): """Форма редактирования контрагентов.""" class Meta: model = models.Client - fields = ('name', 'inn', 'kpp', 'ogrn', 'okpo', 'address', + fields = ('name', 'name_short_self', 'name_short_dadata', 'inn', 'kpp', 'ogrn', 'okpo', 'address', # банковские реквизиты 'bank_bik', 'bank_name', 'bank_korr_account', 'bank_account', # контакты diff --git a/project/customer/migrations/0006_auto__add_field_client_name_short_self__add_field_client_name_short_da.py b/project/customer/migrations/0006_auto__add_field_client_name_short_self__add_field_client_name_short_da.py new file mode 100644 index 0000000..bb7a1a1 --- /dev/null +++ b/project/customer/migrations/0006_auto__add_field_client_name_short_self__add_field_client_name_short_da.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Client.name_short_self' + db.add_column(u'customer_client', 'name_short_self', + self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True), + keep_default=False) + + # Adding field 'Client.name_short_dadata' + db.add_column(u'customer_client', 'name_short_dadata', + self.gf('django.db.models.fields.CharField')(max_length=256, null=True, blank=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting field 'Client.name_short_self' + db.delete_column(u'customer_client', 'name_short_self') + + # Deleting field 'Client.name_short_dadata' + db.delete_column(u'customer_client', 'name_short_dadata') + + + models = { + u'customer.bankaccount': { + 'Meta': {'ordering': "['-created_at']", 'object_name': 'BankAccount'}, + 'account': ('django.db.models.fields.CharField', [], {'max_length': '20'}), + 'address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'bik': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + 'company': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'bank_accounts'", 'to': u"orm['customer.UserProfile']"}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'korr_account': ('django.db.models.fields.CharField', [], {'max_length': '20'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'short_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + u'customer.client': { + 'Meta': {'ordering': "['name', '-created_at']", 'object_name': 'Client'}, + 'address': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'bank_account': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'bank_address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'bank_bik': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'bank_korr_account': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'bank_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'company': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clients'", 'to': u"orm['customer.UserProfile']"}), + 'contact_email': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}), + 'contact_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}), + 'contact_other': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'contact_phone': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}), + 'contact_skype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inn': ('django.db.models.fields.CharField', [], {'max_length': '12'}), + 'kpp': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '9', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '256', 'db_index': 'True'}), + 'name_short_dadata': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}), + 'name_short_self': ('django.db.models.fields.CharField', [], {'max_length': '256', 'null': 'True', 'blank': 'True'}), + 'ogrn': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '15'}), + 'okpo': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + u'customer.license': { + 'Meta': {'object_name': 'License'}, + 'company': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'licenses'", 'to': u"orm['customer.UserProfile']"}), + 'date_from': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'date_to': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'order_date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'paid_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'pay_sum': ('django.db.models.fields.IntegerField', [], {}), + 'payform': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'term': ('django.db.models.fields.IntegerField', [], {}) + }, + u'customer.licenseprice': { + 'Meta': {'object_name': 'LicensePrice'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'price': ('django.db.models.fields.IntegerField', [], {}), + 'term': ('django.db.models.fields.IntegerField', [], {}) + }, + u'customer.userprofile': { + 'Meta': {'object_name': 'UserProfile'}, + 'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}), + 'boss_midname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}), + 'boss_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}), + 'boss_sign': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'boss_surname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}), + 'boss_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '75', 'blank': 'True'}), + 'fax': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'fax_code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'full_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'glavbuh_midname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30', 'blank': 'True'}), + 'glavbuh_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30', 'blank': 'True'}), + 'glavbuh_sign': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'glavbuh_surname': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inn': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '12'}), + 'ip_reg_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), + 'jur_address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'kpp': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '9'}), + 'logo': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'na_osnovanii': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256'}), + 'ogrn': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '15'}), + 'okpo': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'phone': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '20', 'blank': 'True'}), + 'phone_code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10', 'blank': 'True'}), + 'profile_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {}), + 'real_address': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'site': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'stamp': ('django.db.models.fields.files.ImageField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'svid_gos_reg': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}), + 'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'user_session_key': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}) + }, + u'customer.userprofilefilters': { + 'Meta': {'object_name': 'UserProfileFilters'}, + 'bank_account': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'+'", 'null': 'True', 'blank': 'True', 'to': u"orm['customer.BankAccount']"}), + 'company': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile_filters'", 'unique': 'True', 'primary_key': 'True', 'to': u"orm['customer.UserProfile']"}), + 'show_address': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_bank_account': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_contact_info': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_email': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_fax': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_full_name': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_glavbuh': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_inn': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_ip_boss_fio': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_ip_reg_date': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_jur_address': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_kpp': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_logo': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_na_osnovanii': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_name': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_ogrn': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_okpo': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_org_boss_title_and_fio': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_phone': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_profile_type': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_real_address': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_site': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'show_svid_gos_reg': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) + } + } + + complete_apps = ['customer'] \ No newline at end of file diff --git a/project/customer/models.py b/project/customer/models.py index 0ecc6ce..9aa317f 100644 --- a/project/customer/models.py +++ b/project/customer/models.py @@ -305,6 +305,10 @@ class Client(models.Model): company = models.ForeignKey(UserProfile, related_name='clients') name = models.CharField(u'Наименование', max_length=256, db_index=True) + + name_short_self = models.CharField(u'Короткое наименование', max_length=256, null=True, blank=True,) + name_short_dadata = models.CharField(u'Наименование из Dadata', max_length=256, null=True, blank=True,) + inn = models.CharField(u'ИНН', max_length=12) kpp = models.CharField(u'КПП', max_length=9, blank=True, default='') # Организация ogrn = models.CharField(u'ОГРН', max_length=15, default='') @@ -336,7 +340,14 @@ class Client(models.Model): ordering = ['name', '-created_at'] def __unicode__(self): - return (u'%s, ИНН %s' % (self.name[0:30], self.inn or u'не указан',)).strip() + # return (u'%s, ИНН %s' % (self.name[0:30], self.inn or u'не указан',)).strip() + if self.name_short_self: + # return (u'%s, %s, ИНН %s' % (self.name_short_self, self.name, self.inn or u'не указан',)).strip() + return (u'%s, %s' % (self.name_short_dadata, self.name_short_self)).strip() + # return (u'%s, ИНН %s' % (self.name_short_self, self.inn or u'не указан',)).strip() + else: + return (u'%s, ИНН %s' % (self.name, self.inn or u'не указан',)).strip() + def save(self, *args, **kwargs): self.inn = only_numerics(self.inn) diff --git a/project/customer/views/clients.py b/project/customer/views/clients.py index 4402c59..1afe40f 100644 --- a/project/customer/views/clients.py +++ b/project/customer/views/clients.py @@ -25,11 +25,13 @@ def clients_list(request, page_num=None): page, pagination_form = pagination(request, client_list, page_num) client_form = forms.ClientForm() + dadata_api_key = settings.DADATA_API_KEY dictionary = { 'page': page, 'pagination_form': pagination_form, - 'client_form': client_form + 'client_form': client_form, + 'dadata_api_key': dadata_api_key } return render(request, template_name, dictionary) diff --git a/project/customer/views/profile.py b/project/customer/views/profile.py index 662d19f..8f4fc03 100644 --- a/project/customer/views/profile.py +++ b/project/customer/views/profile.py @@ -87,6 +87,7 @@ 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) @@ -112,7 +113,8 @@ def profile_edit(request): 'form': form, 'profile': profile, 'accounts': accounts, - 'bank_account_form': bank_account_form + 'bank_account_form': bank_account_form, + 'dadata_api_key': dadata_api_key } return render(request, template_name, dictionary) diff --git a/project/docs/autocomplete_light_registry.py b/project/docs/autocomplete_light_registry.py index 41d8783..01e6e68 100644 --- a/project/docs/autocomplete_light_registry.py +++ b/project/docs/autocomplete_light_registry.py @@ -15,7 +15,7 @@ class AutocompleteWithEmptyWidget(autocomplete_light.AutocompleteModelBase): class AutocompleteClient(autocomplete_light.AutocompleteModelBase): '''Автокомплит клиента в зависимости от юзера ''' - autocomplete_js_attributes = {'placeholder': u'Название предприятия или ИНН или ОКПО'} + autocomplete_js_attributes = {'placeholder': u'Название из добавленных ранее'} def choices_for_request(self): q = self.request.GET.get('q', '') diff --git a/project/settings.py b/project/settings.py index b4311e5..f0b852d 100644 --- a/project/settings.py +++ b/project/settings.py @@ -66,18 +66,16 @@ USE_TZ = True # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/var/www/example.com/media/" -MEDIA_ROOT = path('../_public_html/media') +#MEDIA_ROOT = path('../_public_html/media') +MEDIA_ROOT = path('../media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://example.com/media/", "http://media.example.com/" MEDIA_URL = '/m/' -# Absolute path to the directory static files should be collected to. -# Don't put anything in this directory yourself; store your static files -# in apps' "static/" subdirectories and in STATICFILES_DIRS. -# Example: "/var/www/example.com/static/" -STATIC_ROOT = path('../_public_html/static') +# STATIC_ROOT = path('../_public_html/static') +STATIC_ROOT = path('../static') # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" @@ -140,7 +138,6 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'sekizai.context_processors.sekizai', 'project.callback.context_processors.add_forms', 'project.customer.context_processors.license_check_soon_ends', - 'project.commons.context_processors.get_dadata_api_key', ) diff --git a/project/static/css/style.css b/project/static/css/style.css index eaaafb1..2544906 100644 --- a/project/static/css/style.css +++ b/project/static/css/style.css @@ -312,7 +312,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';} -.form-field: {width:210px;} +/*.form-field: {width:210px;}*/ input, select, textarea { font-family: Arial,Helvetica,sans-serif;background:#f8f8f8;} .buttons input {display:inline;font-stretch:ultra-condensed;font-family:"Arial Narrow", Arial, sans-serif;font-size:22px;text-transform:uppercase;padding:25px;border:none;cursor: pointer;} @@ -386,8 +386,24 @@ ul { clear: both; list-style: none; margin: 0; padding: 0; } .add-link, .add-row {background: url(../img/icon-add.png) no-repeat;padding: 0 50px 0;line-height:40px;display: inline-block;} .add-link, .add-row:hover {background: url(../img/icon-add.png) no-repeat ;padding: 0 50px 0;line-height: 40px;display: inline-block;} -.add-client-link {background: url(../img/icon-add.png) no-repeat;padding: 4px 50px 0 ;line-height: 40px;display: inline-block;} -.add-client-link:hover {background: url(../img/icon-add.png) no-repeat; text-decoration:none;} + +.add-client-link { + background: url(../img/icon-add.png) no-repeat; + padding: 4px 50px 0 ;line-height: 40px;display: inline-block; +} +.add-client-link:hover { + background: url(../img/icon-add.png) no-repeat; + text-decoration:none;} + + +.yellow-btn .add-client-link { + background-image: none!important; + padding: 16px 50px 0 ;line-height: 40px;display: inline-block; +} +.add-client-link2:hover { + /*background: url(../img/icon-add.png) no-repeat;*/ + text-decoration:none;} + .add-row {margin-top:4px;} .edit-link a, .delete-link a { text-decoration: none; } @@ -571,7 +587,6 @@ table.list tr td {font-size:14px;color:#313942;padding:7px;word-break: break-all .filters ul li a.selected { color:#646669;text-decoration:none;} .filters select {font-size:13px;margin-left:20px;} #filters_form {padding:10px 25px;overflow:hidden;} -#filters_form #id_doc_date {padding:10px 0 10px 20px; margin:0;font-size:13px;width:100%;height:auto;} .pagination {margin-top: 5px; padding-top: 1ex; width: 99%; color:#646669;font-size:13px;} .pagination select {font-size:13px;} @@ -625,13 +640,6 @@ tr.doc-row:hover {cursor:pointer;} .white_bg {background:#fff!important;} #req-avail-form {display:none;} -#req-avail-form #id_name, #id_phone{width: 260px;font-size: 16px;font-family: Arial;font-style: italic;height: 35px;} -#req-avail-form #id_message {width:260px;padding: 10px 0 0 10px;} -#req-avail-form #id_captcha_1{float: right;width: 90px;height: 35px;font-size: 18px;} -#req-avail-form .captcha_refresh {margin: 0 0 0 10px;} -#req-avail-form .green-btn2 {background: #fed13e;border: none;cursor: pointer;font-size: 22px;padding: 15px 40px;color: #4e5661;font-family: "Arial Narrow", Arial, sans-serif;font-stretch: ultra-condensed;font-weight: bold;text-transform: uppercase;} -#req-avail-form .green-btn2:hover {background: #ffca3e;} - .close-message {display:inline-block;float:right;} .profile_title {font-size:16px;height:33px;width:790px;border-bottom:solid 1px #fed13e;margin: 10px 0 25px 0;} .profile_label {float:left;width:285px;font-size:13px;height:36px;line-height:36px;color: #797979;} @@ -766,6 +774,16 @@ a.popup-unreg {background:url(../img/popup-trash.png) no-repeat 3px center;} } +#client-edit-form #id_name, +#client-edit-form #id_name_short_self, +#client-edit-form #id_name_short_dadata{ + width: 500px; +} #client-edit-form #id_address { - width: 550px; +width: 550px; } +P.help-block { + margin: 4px 0 2px 125px; + color: gray; + font-size: 11px; +} \ No newline at end of file diff --git a/project/static/css/suggestions.css b/project/static/css/suggestions.css old mode 100755 new mode 100644 diff --git a/project/static/js/client/search-external-api.js b/project/static/js/client/search-external-api.js index 0bbf45b..0f69cc6 100644 --- a/project/static/js/client/search-external-api.js +++ b/project/static/js/client/search-external-api.js @@ -2,6 +2,8 @@ $(document).ready(function() { var clientForm = $("#client-edit-form"), clientSearch = $("#searchClientInput", clientForm), clientName = $("#id_name", clientForm), + clientNameShort = $("#id_name_short_self", clientForm), + clientNameShortD = $("#id_name_short_dadata", clientForm), clientInn = $("#id_inn", clientForm), clientKpp = $("#id_kpp", clientForm), clientOqrn = $("#id_ogrn", clientForm), @@ -10,7 +12,8 @@ $(document).ready(function() { bankBic = $("#id_bank_bik", clientForm), bankFullName = $("#id_bank_name", clientForm), bankCorrespondentAccount = $("#id_bank_korr_account", clientForm), - clientInputs = [clientName, clientInn, clientOqrn, clientAddress]; + //clientInputs = [clientName, clientInn, clientOqrn, clientAddress]; + clientInputs = [clientName, clientNameShort, clientNameShortD, clientInn, clientOqrn, clientAddress]; function confirmChangeDataPromise(inputArray) { @@ -55,11 +58,18 @@ $(document).ready(function() { } function changeDataInInputs(data) { + if (data.type === "LEGAL"|| data.type === "INDIVIDUAL" ) { + 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) clientName.val(join([data.opf && data.opf.full || "", data.name.full], " ")); + clientNameShort.val(data.name.short); + clientNameShortD.val(data.name.short_with_opf); + clientInn.val(data.inn); clientKpp.val(data.kpp); clientOqrn.val(data.ogrn); @@ -116,6 +126,7 @@ $(document).ready(function() { })); clientSearch.on('keyup',(function () { + //console.log(clientSearch.val()); if (clientSearch.val().length === 0) { clearSearchInputs([clientName, clientInn, clientKpp, clientOqrn, clientAddress]); } else { diff --git a/project/static/js/dialogs.js b/project/static/js/dialogs.js index 19ba8d0..8e89e3c 100644 --- a/project/static/js/dialogs.js +++ b/project/static/js/dialogs.js @@ -25,9 +25,13 @@ $(document).ready(function() { clear_form_errors(form); if (data.success) { + console.log('!!!!!!!!!!!!!!!!!!!'); + console.log(data); if (form[0].id == 'client-edit-form') { - $('#id_client_text').hide() - $('#id_client-deck').html('X' + data.name + ''); + $('#id_client_text').hide(); + $('#id_client-deck').html( + 'X' + data.name + ''); $('#id_client').html(''); $('#id_client').trigger('change'); diff --git a/project/static/js/lib/jquery.suggestions.min.js b/project/static/js/lib/jquery.suggestions.min.js old mode 100755 new mode 100644 diff --git a/project/static/js/profile/search-main-external-api.js b/project/static/js/profile/search-main-external-api.js index e929809..cb4797f 100644 --- a/project/static/js/profile/search-main-external-api.js +++ b/project/static/js/profile/search-main-external-api.js @@ -65,10 +65,8 @@ $(document).ready(function() { if (data.name && data.name.full) profileOrgFullName.val(join([data.opf && data.opf.full || "", data.name.full], " ")); if (data.address) { - var address = data.address.value; - profileAddress.val(address); - profileLegalAddress.val(address); - profilePostalAddress.val(address); + profileAddress.val(data.address.value); + profileLegalAddress.val(data.address.value); } if (data.management) { @@ -133,7 +131,7 @@ $(document).ready(function() { profileInputs = [ profileOrgName, profileOrgFullName, profileInn, profileKpp, profileOqrn, profileBossName, profileBossSurname, profileBossMiddleName, - profileAddress, profileLegalAddress, profilePostalAddress + profileAddress, profileLegalAddress ]; } else { diff --git a/project/templates/callback/callback_form.html b/project/templates/callback/callback_form.html index 6e358fa..174362a 100644 --- a/project/templates/callback/callback_form.html +++ b/project/templates/callback/callback_form.html @@ -1,7 +1,7 @@
{% csrf_token %}
-
Оставьте свои контакты и мы перезвоним вам, ответим на все ваши вопросы
+
Оставьте свои контакты и мы перезвоним вам, ответим на все ваши вопросы

{{ reqf.name }}

{{ reqf.phone }}

{{ reqf.message }}

diff --git a/project/templates/callback/req_avail_done.txt b/project/templates/callback/req_avail_done.txt old mode 100755 new mode 100644 diff --git a/project/templates/callback/req_avail_new.txt b/project/templates/callback/req_avail_new.txt index fa9b224..15c26d2 100644 --- a/project/templates/callback/req_avail_new.txt +++ b/project/templates/callback/req_avail_new.txt @@ -1,5 +1,5 @@ {% load url from future %} -Запрос обратной связи с сайта dokumentor.ru +Заказ товара с сайта Имя клиента: {{ req.name }} Телефон/E-mail: {{ req.phone }} diff --git a/project/templates/customer/clients/!!form.html b/project/templates/customer/clients/!!form.html new file mode 100644 index 0000000..ff0e2cf --- /dev/null +++ b/project/templates/customer/clients/!!form.html @@ -0,0 +1,237 @@ +{% 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/project/templates/customer/clients/form.html b/project/templates/customer/clients/form.html index ff0e2cf..93e7d80 100644 --- a/project/templates/customer/clients/form.html +++ b/project/templates/customer/clients/form.html @@ -13,7 +13,8 @@ Поиск реквизитов:
- +
@@ -25,8 +26,7 @@ {% if is_ajax %}
{% endif %} -
- +
Наименование{% if form.name.field.required %}*{% endif %}: @@ -34,10 +34,40 @@
{{ form.name }} {% if not is_ajax %}{{ form.name.errors }}{% endif %} +

Полностью. Например: Общество с ограниченной ответственностью "Сетьинвест"

+
+
  +{# Наименование 2{% if form.name_short_self.field.required %}*{% endif %}:#} +
+
+ {{ form.name_short_dadata }} + {% if not is_ajax %}{{ form.name_short_dadata.errors }}{% endif %} +

Коротко. Например: ООО "Сетьинвест"

+
+
+
+ +
+
  +{# Наименование 3{% if form.name_short_dadata.field.required %}*{% endif %}:#} +
+
+ {{ form.name_short_self }} + {% if not is_ajax %}{{ form.name_short_self.errors }}{% endif %} +

Для себя. Как вам удобнее запомнить. Например: сайт "Документор"

+
+
+
+
+
+ + + +
ИНН{% if form.inn.field.required %}*{% endif %}: @@ -82,24 +112,89 @@
-
+
+ + +
+
- Юр. адрес{% if form.address.field.required %}*{% endif %}: + Имя{% if form.contact_name.field.required %}*{% endif %}: +
+
+ {{ form.contact_name }} + {% if not is_ajax %}{{ form.contact_name.errors }}{% endif %}
-
- {{ form.address }} - {% if not is_ajax %}{{ form.address.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 form.address.field.required %}*{% endif %}: +
+
+ {{ form.address }} + {% if not is_ajax %}{{ form.address.errors }}{% endif %} +
+
+
+ + +
+
Поиск банка:
- +
@@ -166,64 +261,6 @@
- -
-
-
- Имя{% 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 %} -
-
-
-
-
diff --git a/project/templates/customer/clients/list.html b/project/templates/customer/clients/list.html index 252cf77..5d8de80 100644 --- a/project/templates/customer/clients/list.html +++ b/project/templates/customer/clients/list.html @@ -7,6 +7,7 @@
diff --git a/project/templates/customer/clients/list_item.html b/project/templates/customer/clients/list_item.html index 11b6b76..4c308f3 100644 --- a/project/templates/customer/clients/list_item.html +++ b/project/templates/customer/clients/list_item.html @@ -1,8 +1,15 @@ - {{ obj.name }} + {% if obj.name_short_dadata %} + {{ obj.name_short_dadata }} + {% else %} + {{ obj.name }} + {% endif %} + {% if obj.name_short_self %} +
{{ obj.name_short_self }} + {% endif %} {{ obj.contact_name }} {{ obj.contact_phone }} diff --git a/project/templates/customer/profile/end_order.html b/project/templates/customer/profile/end_order.html old mode 100755 new mode 100644 diff --git a/project/templates/docs/!!stub_js.html b/project/templates/docs/!!stub_js.html new file mode 100644 index 0000000..0393266 --- /dev/null +++ b/project/templates/docs/!!stub_js.html @@ -0,0 +1,133 @@ +{# заглушка js #} + diff --git a/project/templates/docs/_base/base_add.html b/project/templates/docs/_base/base_add.html index 8a94f3b..913008e 100644 --- a/project/templates/docs/_base/base_add.html +++ b/project/templates/docs/_base/base_add.html @@ -23,9 +23,4 @@ {% include form_template_js %} - - - - - {% include 'hbs/bank-tpl.html' %} {% endblock %} diff --git a/project/templates/docs/parts/form_field_client.html b/project/templates/docs/parts/form_field_client.html index 8985f28..9112f18 100644 --- a/project/templates/docs/parts/form_field_client.html +++ b/project/templates/docs/parts/form_field_client.html @@ -6,6 +6,7 @@ is_ajax - ajax-форма? no_clear_after - не добавлять очистку float после блока {% endcomment %} +
{{ label|default:"Контрагент" }}:{% if required %} *{% endif %}

diff --git a/project/templates/docs/stub_js.html b/project/templates/docs/stub_js.html index 0393266..c3a6a37 100644 --- a/project/templates/docs/stub_js.html +++ b/project/templates/docs/stub_js.html @@ -45,7 +45,23 @@ } }); - $('#id_client').on('change', function() { + /* проверяем видимость блока */ + check_vis = function (block){ + if (block.is(":visible")){block.hide(); + } else{block.show()} + }; + + var add_block = $('.add-client-link'), // блок с кнопкой "Добавить контрагента" + client_block = $('#id_client'); + // прячем кнопку добавить контрагента если он уже есть в документе + if (client_block.val()){ + check_vis(add_block); + } else {} + + // отрабатываем изменение в блоке добавления контрагента + // как я понимаю основной блок на поиск и вывод "инвойсов" для автодобавления контрагента + client_block.on('change', function() { + check_vis(add_block); var client_id = $(this).val(); $.get('/my/docs/ajax_get_invoices/' + client_id, function(data) { var select = $('#id_invoice'); @@ -71,15 +87,19 @@ $(item).find('a.delete-row').trigger('click'); }); $.get('/my/docs/ajax_get_client_by_invoice/' + invoice_id, function(data) { + add_block.hide(); // прячем кнопку добавить var client = data[0]; $('#id_client_text').hide(); - $('#id_client-deck').html('X' + data[1] + ''); + $('#id_client-deck').html( + 'X' + data[1] + ''); $('#id_client').html(''); //$('#id_client').trigger('change'); }) $.get('/my/docs/ajax_get_tbl_items/' + invoice_id, function(data) { + console.log('==================='); var items = JSON.parse(data); $.each(items, function(index, item){ var name = item['fields']['name']; diff --git a/project/templates/xls/4pd.xls b/project/templates/xls/4pd.xls old mode 100755 new mode 100644 diff --git a/project/templates/xls/act.xls b/project/templates/xls/act.xls old mode 100755 new mode 100644 diff --git a/project/templates/xls/bill.xls b/project/templates/xls/bill.xls old mode 100755 new mode 100644 diff --git a/project/templates/xls/stamp.bmp b/project/templates/xls/stamp.bmp old mode 100755 new mode 100644 diff --git a/project/templates/xls/stamp1.bmp b/project/templates/xls/stamp1.bmp old mode 100755 new mode 100644