almost edit profile page

remotes/origin/yandex
Bachurin Sergey 11 years ago
parent b9683cfbab
commit be367f94b1
  1. 7
      project/customer/forms.py
  2. 8
      project/customer/models.py
  3. 4
      project/customer/urls.py
  4. 65
      project/customer/views/profile.py
  5. 30
      project/static/css/style.css
  6. BIN
      project/static/img/glavbuh_sign.png
  7. BIN
      project/static/img/upload-boss_sign.png
  8. BIN
      project/static/img/upload-glavbuh_sign.png
  9. BIN
      project/static/img/upload-logo.png
  10. BIN
      project/static/img/upload-stamp.png
  11. 2
      project/templates/base.html
  12. 2
      project/templates/customer/bank_accounts/list.html
  13. 20
      project/templates/customer/img_load.html
  14. 33
      project/templates/customer/img_load.png
  15. 271
      project/templates/customer/profile/edit.html

@ -40,6 +40,11 @@ class UserProfileForm(MyBaseModelForm):
Форму для админки ищи ниже в классе 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
@ -91,6 +96,7 @@ class IpUserProfileForm(UserProfileForm):
'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',
)
@ -113,6 +119,7 @@ class OrgUserProfileForm(UserProfileForm):
'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',
)

@ -16,10 +16,10 @@ from project.myauth.models import DokUser
PROFILE_IMAGES_UPLOAD_DIR = 'customer/profile/' # куда сохранять загруженные изображения
BOSS_SIGN_IMG_SIZE = (100, 75)
GLAVBUH_SIGN_IMG_SIZE = (100, 75)
STAMP_IMG_SIZE = (180, 180)
LOGO_SIZE = (100, 50)
BOSS_SIGN_IMG_SIZE = (159, 65)
GLAVBUH_SIGN_IMG_SIZE = (159, 65)
STAMP_IMG_SIZE = (121, 121)
LOGO_SIZE = (351, 121)
def get_profile(user):

@ -16,7 +16,7 @@ urlpatterns = patterns('',
url(r'^profile/edit/$', profile.profile_edit, name='customer_profile_edit'),
url(r'^profile/email/$', profile.profile_email, name='customer_profile_email'),
url(r'^license/$', license.order_license, name='customer_order_license'),
url(r'^delete_license/(?P<pk>\d+)/$', license.delete_license, name='customer_order_license'),
url(r'^delete_license/(?P<pk>\d+)/$', license.delete_license, name='customer_delete_license'),
url(r'^get_doc/(?P<order_num>\d+)/$', docs.get_doc, name='customer_license_get_doc'),
url(r'^robokassa/result/$', license.payment_result, name='robokassa_result'),
url(r'^robokassa/success/$', license.payment_success, name='robokassa_success'),
@ -57,4 +57,6 @@ urlpatterns = patterns('',
url(r'^clients/add/ajax/$', clients_ajax.clients_add_ajax, name='customer_clients_add_ajax'),
url(r'^clients/(?P<id>\d+)/edit/ajax/$', clients_ajax.clients_edit_ajax, name='customer_clients_edit_ajax'),
url(r'^clients/(?P<id>\d+)/delete/ajax/$', clients_ajax.clients_delete_ajax, name='customer_clients_delete_ajax'),
url(r'^tmp_upload/ajax/$', profile.tmp_upload, name='upload_tmp_file'),
)

@ -1,20 +1,26 @@
# -*- coding: utf-8 -*-
import os
import json
import tempfile
from email.header import Header
from django.shortcuts import render, redirect, get_object_or_404
from django.core.files import File
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth.decorators import login_required
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.utils.encoding import smart_str
from django.conf import settings
from django.http import Http404
from django.http import Http404, HttpResponse
from sorl.thumbnail import get_thumbnail
from project.commons.pdf_tools import render_pdf_to_string, pdf_to_response
from .. import models, forms
from ..decorators import license_required
from ..decorators import license_required
PDF_PROFILE_NAME = u'Реквизиты.pdf'
SUPPORT_EMAIL = getattr(settings, 'SUPPORT_EMAIL', '')
@ -83,7 +89,20 @@ def profile_edit(request):
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES, instance=profile)
if form.is_valid():
form.save()
item = form.save(commit=False)
for img_url in ('tmb_logo', 'tmb_boss_sign', 'tmb_glavbuh_sign', 'tmb_stamp'):
if form.cleaned_data[img_url]:
chg_file = open(settings.MEDIA_ROOT + '/cache/imgs/' + \
form.cleaned_data[img_url])
print chg_file
item_attr = img_url[4:]
getattr(item, item_attr).save('%s.%s' % \
(item_attr, form.cleaned_data[img_url].split('.')[-1]),
File(chg_file))
chg_file.close()
elif form.cleaned_data:
pass
item.save()
return redirect(success_url)
else:
form = form_class(instance=profile)
@ -97,6 +116,42 @@ def profile_edit(request):
return render(request, template_name, dictionary)
def tmp_upload(request):
SIZES = {'id_boss_sign': '159x65', 'id_glavbuh_sign': '159x65', 'id_stamp': '121x121', 'id_logo': '351x121'}
elm_id = request.REQUEST['elm_id']
file_ = request.FILES.values()[0]
if not file_.content_type.startswith('image'):
return {'res': 'bad'}
if not os.path.exists(settings.MEDIA_ROOT +
'/cache/imgs/'):
os.makedirs(settings.MEDIA_ROOT +
'/cache/imgs/')
tmp_dir = tempfile.mkdtemp('img_tmp', settings.MEDIA_ROOT +
'/cache/imgs/')
os.chmod(tmp_dir, 0755)
open(tmp_dir + '/' + file_.name, "w").write(file_.read())
tmp_url_partial = os.path.basename(tmp_dir) + '/' + file_.name
im = get_thumbnail(tmp_dir + '/' + file_.name, SIZES[elm_id], quality=75)
data = {'res': 'ok', 'pic': im.url, 'full_pic': tmp_url_partial}
print data
data.update(request.REQUEST)
return HttpResponse(json.dumps(data), mimetype='application/json')
def del_tmp_photo(request, article_pk):
# wedding, wedding_guests = get_wedding_n_guests(request)
try:
pass
# article = WedPage.objects.get(pk=article_pk)
# article.main_photo.delete()
except:
return {'res': 'bad'}
return {'res': 'ok'}
@login_required
def _profile_get_pdf(request, profile=None, account=None, filters=None):
"""Создать профиль пользователя в PDF и вернуть как строку."""
@ -119,7 +174,7 @@ def profile_as_pdf(request, profile=None, account=None, filters=None):
def _send_profile_email(subject, to, body, pdf_content):
"""Отправка письма."""
template_name = 'customer/profile/profile_email.txt'
dict_context = {'body': body, 'support_email': SUPPORT_EMAIL,}
dict_context = {'body': body, 'support_email': SUPPORT_EMAIL}
email_body = render_to_string(template_name, dict_context)
email = EmailMessage(
subject=subject,

@ -67,8 +67,8 @@ body {
.content-white {width:1200px;background:#fff;box-shadow: 0 0 5px #ddd;padding:15px 15px 0 15px;box-sizing:border-box;margin-bottom:70px;}
#header {height:100px;width:100%;position:relative;}
#logo {font-family:"MyriadProRegular";display:block;overflow:hidden;margin-top:18px;}
#logo .logo-bigfont {font-size:30px;line-height:30px;margin-top:12px;text-transform:uppercase;}
#site_logo {font-family:"MyriadProRegular";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;}
.login, .register {display:block;padding-left:34px;margin: 0 3px;height:36px;text-decoration:none;font-family:Arial,Helvetica,sans-serif;color:#36393f; line-height:36px;}
@ -350,7 +350,6 @@ ul { clear: both; list-style: none; margin: 0; padding: 0; }
.has-datepicker { background: url(../img/icon-calendar.png) no-repeat scroll right 5px center #f8f8f8; }
.profile-form input#id_ip_reg_date { background: url(../img/icon-calendar.png) no-repeat scroll right center transparent; }
#id_phone_code, #id_fax_code { width: 60px; }
#accounts .account-delete a { text-decoration: none; }
@ -569,3 +568,28 @@ tr.doc-row:hover {cursor:pointer;}
#req-avail-form {display:none;}
.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:14px;height:36px;line-height:36px;}
.profile_field {float:left;width:500px;}
.profile_field input[type=text], .profile_field input[type=email], .profile_field input[type=number], .profile_field input[type=password], .profile_field textarea, .profile_field option {padding-left:2px;margin-left:0;height:36px;font-size:14px;}
.profile_field.long-input input { width: 100%; }
.profile_field input { width: 300px; }
.profile-form .field {margin: 0 0 15px 0;}
.profile-form .help-text {margin: 0; padding:0 0 0 5px;color:#c5c5c5;}
#id_boss_surname, #id_boss_name, #id_boss_midname, #id_glavbuh_surname, #id_glavbuh_name, #id_glavbuh_midname{width:157px;}
#boss_sign, #glavbuh_sign {width:159px;height:65px;float:left;overflow:hidden;}
#glavbuh_sign {margin-left:30px;}
#stamp .profile_field {width:121px;height:121px;}
#logo .profile_field {width:351px;height:121px;}
.del_image {display:block;width:27px;height:20px;background:url(../img/icon-delete.png)7px center no-repeat;position:absolute;top:0;right:0;}
.rel {position:relative;}
.img_field {border:1px solid #f2f2f2;}
.profile_btns {margin: 10px; padding:10px;}
.profile_btns input {display:inline;font-family:"Arial Narrow", Arial, sans-serif;font-size:22px;text-transform:uppercase;font-weight:bold;padding:25px;border:none;}
.profile_btns .yellow-btn.save {background:#fed13e url(../img/save.png) no-repeat 25px center;padding:25px 15px 25px 60px;}
#blackbox {width:350px;position:absolute;top:60px;right:20px;}
#blackbox .bb-text {width:320px;background:#272b31;padding:20px;color:#fff;font-style:italic;line-height:1.7;}
#blackbox .bb-triangle {background: url(../img/triangle2.png) no-repeat center center;width:11px;height:25px;position:absolute;left:-8px;top:16px;}
#blackbox p {margin:0;padding:0;}
#blackbox a {color:#fff;font-weight:bold;margin: 10px 0 0 0; display:block;}

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

@ -37,7 +37,7 @@
<div id="w1200">
<div id="header">
<div class="left">
<a href="/" id="logo">
<a href="/" id="site_logo">
<img class='left' src='{{ STATIC_URL }}img/logo.png' />
<div class="left logo-text">
<div class="logo-bigfont">Документор</div>

@ -7,7 +7,7 @@
<div>
<a id="account_add_link" class="account add-link" href="{% url 'customer_bank_accounts_add' %}">
<img src="{{ STATIC_URL }}img/icon-add.png" alt="Добавить" title="Добавить расчётный счёт" />Добавить расчётный счёт
Добавить расчётный счёт
</a>
</div>

@ -0,0 +1,20 @@
{% load thumbnail %}
<div class='hidden-fileinput' data-width='300' data-height='240' data-form-id='{{ form.prefix }}'>{{ form.image }}</div>
<div id='{{ form.prefix }}-img' class='add_photo' data-form-id='{{ form.prefix }}' data-size='300x240'>
{% if form.tmp_tmb.value %}
<img src="{{ form.tmp_tmb.value }}" title="{{ item.name }}" />
{% else %}
{% if form.image.value %}
{% thumbnail form.image.value "300x240" format="PNG" as img %}
<img src="{{ img.url }}" width="{{ img.width }}" height="{{ img.height }}" title="{{ item.name }}" style="width: {{ img.width }}px; height: {{ img.height }}px;"/>
{% endthumbnail %}
{% endif %}
{% endif %}
{% csrf_token %}
{{ form.id }}
<div class='hidden'>
{{ form.tmp_image }}
{{ form.tmp_tmb }}
</div>
</div>

@ -0,0 +1,33 @@
{% load thumbnail %}
<div class='c'></div>
{{ load_img_formset.management_form }}
{% for form2 in load_img_formset %}
<div class='hidden-fileinput' data-width='{% if forloop.counter == 1 %}300{% else %}75{% endif %}' data-height='{% if forloop.counter == 1 %}240{% else %}60{% endif %}' data-form-id='{{ form2.prefix }}'>{{ form2.image }}</div>
<div id='{{ form2.prefix }}-img' class='add_photo {% if forloop.counter == 1 %}big-img{% else %}small-img{% endif %}' data-form-id='{{ form2.prefix }}' data-counter='{{ forloop.counter }}' {% if forloop.counter == 1 %}data-size='300x240'{% else %}data-size='75x60'{% endif %}>
{% if form2.tmp_tmb.value %}
<img src="{{ form2.tmp_tmb.value }}" title="{{ item.name }}" />
{% else %}
{% if form2.image.value %}
{% if forloop.counter == 1 %}
{% thumbnail form2.image.value "300x240" format="PNG" as img %}
<img src="{{ img.url }}" width="{{ img.width }}" height="{{ img.height }}" title="{{ item.name }}" style="width: {{ img.width }}px; height: {{ img.height }}px;"/>
{% endthumbnail %}
{% else %}
{% thumbnail form2.image.value "75x60" format="PNG" as img %}
<img src="{{ img.url }}" width="{{ img.width }}" height="{{ img.height }}" title="{{ item.name }}" style="width: {{ img.width }}px; height: {{ img.height }}px;"/>
{% endthumbnail %}
{% endif %}
{% endif %}
{% endif %}
{% csrf_token %}
{{ form2.id }}
<div class='hidden'>
<input id="id_{{ form2.prefix }}-ordering" type="text" name="{{ form2.prefix }}-ordering" value="{{ forloop.counter }}">
{{ form2.tmp_image }}
{{ form2.tmp_tmb }}
{{ form2.DELETE }}
</div>
</div>
{% endfor %}
<div class='c'></div>

@ -5,7 +5,18 @@
{% block content %}
<h2>Редактирование реквизитов{% if profile.is_ip %} ИП{% elif profile.is_org %} организации{% endif %}</h2>
<div class="profile-form">
<div class="profile-form content-white rel">
<div id="blackbox">
<div class='bb-triangle'></div>
<div class='bb-text'>
<p>
Поля, отмеченные * используются для создания ваших документов, поэтому их нужно заполнить обязательно.
Все остальные поля не обязательны к заполнению. Они требуются только для "Карточки компании", которую вы можете отправлять своим партнерам прямо из Документора.
</p>
<a href='#'>Подробнее о "Карточке компании"</a>
</div>
</div>
{% if form.non_field_errors %}
<p class="error">{{ form.non_field_errors }}</p>
{% endif %}
@ -17,16 +28,16 @@
{{ hidden }}
{% endfor %}
<div style="font-size: 15px; border-bottom: thin solid #000; padding: 0 0 5px; width: 620px;">
<div class='profile_title'>
{{ profile.get_profile_type_display }}
</div>
{% if profile.is_ip %}
<div id="boss_fio" class="field">
<div style="float: left; width: 200px;">
Фамилия, Имя, Отчество:
<div class='profile_label'>
Фамилия, Имя, Отчество
</div>
<div style="float: left; width: 480px;">
<div class='profile_field'>
{{ form.boss_surname }} {{ form.boss_name }} {{ form.boss_midname }}
<span class="help-text">Будет подставляться в создаваемые документы.</span>
{{ form.boss_surname.errors }} {{ form.boss_name.errors }} {{ form.boss_midname.errors }}
@ -37,10 +48,10 @@
{% if profile.is_org %}
<div id="name" class="field">
<div style="float: left; width: 200px;">
Краткое название организации:{% if form.name.field.required %} <span class="required">*</span>{% endif %}
<div style="profile_label">
Краткое название организации{% if form.name.field.required %} <span class="required">*</span>{% endif %}
</div>
<div class="long-input" style="float: left;">
<div class="profile_field long-input">
{{ form.name }}
{{ form.name.errors }}
<span class="help-text">Будет подставляться в создаваемые документы.</span>
@ -51,10 +62,10 @@
{% if profile.is_org %}
<div id="full_name" class="field">
<div style="float: left; width: 200px;">
Полное название организации:
<div class="profile_label">
Полное название организации
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field" class="profile_field">
{{ form.full_name }}
{{ form.full_name.errors }}
<span class="help-text">Как в учредительных документах.</span>
@ -64,10 +75,10 @@
{% endif %}
<div id="inn" class="field">
<div style="float: left; width: 200px;">
ИНН:{% if form.inn.field.required %} <span class="required">*</span>{% endif %}
<div class="profile_label">
ИНН{% if form.inn.field.required %} <span class="required">*</span>{% endif %}
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.inn }}
{{ form.inn.errors }}
</div>
@ -76,10 +87,10 @@
{% if profile.is_org %}
<div id="kpp" class="field">
<div style="float: left; width: 200px;">
КПП:{% if form.kpp.field.required %} <span class="required">*</span>{% endif %}
<div class="profile_label">
КПП{% if form.kpp.field.required %} <span class="required">*</span>{% endif %}
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.kpp }}
{{ form.kpp.errors }}
</div>
@ -88,10 +99,10 @@
{% endif %}
<div id="ogrn" class="field">
<div style="float: left; width: 200px;">
{% if profile.is_ip %}ОГРНИП{% else %}ОГРН{% endif %}:{% if form.ogrn.field.required %} <span class="required">*</span>{% endif %}
<div class="profile_label">
{% if profile.is_ip %}ОГРНИП{% else %}ОГРН{% endif %}{% if form.ogrn.field.required %} <span class="required">*</span>{% endif %}
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.ogrn }}
{{ form.ogrn.errors }}
</div>
@ -99,10 +110,10 @@
</div>
<div id="okpo" class="field">
<div style="float: left; width: 200px;">
ОКПО:
<div class="profile_label">
ОКПО
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.okpo }}
{{ form.okpo.errors }}
</div>
@ -111,10 +122,10 @@
{% if profile.is_ip %}
<div id="svid_gos_reg" class="field">
<div style="float: left; width: 200px;">
Свид-во о гос. регистрации:
<div class="profile_label">
Свид-во о гос. регистрации
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.svid_gos_reg }}
<span class="help-text">Требуется для счет-фактуры.</span>
{{ form.svid_gos_reg.errors }}
@ -123,10 +134,10 @@
</div>
<div id="ip_reg_date" class="field">
<div style="float: left; width: 200px;">
Дата регистрации ИП:
<div class="profile_label">
Дата регистрации ИП
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.ip_reg_date }}
{{ form.ip_reg_date.errors }}
</div>
@ -135,15 +146,15 @@
{% endif %}
{% if profile.is_org %}
<div style="font-size: 15px; border-bottom: thin solid #000; padding: 15px 0 5px; width: 620px;">
<div class='profile_title'>
Руководитель
</div>
<div id="boss_title" class="field">
<div style="float: left; width: 200px;">
Должность руководителя:
<div class="profile_label">
Должность руководителя
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.boss_title }}
{{ form.boss_title.errors }}
</div>
@ -151,10 +162,10 @@
</div>
<div id="boss_fio" class="field">
<div style="float: left; width: 200px;">
Фамилия, Имя, Отчество:{% if form.boss_surname.field.required %} <span class="required">*</span>{% endif %}
<div class="profile_label">
Фамилия, Имя, Отчество{% if form.boss_surname.field.required %} <span class="required">*</span>{% endif %}
</div>
<div style="float: left; width: 480px;">
<div class="profile_field">
{{ form.boss_surname }} {{ form.boss_name }} {{ form.boss_midname }}
<span class="help-text">Используется для строки "подпись" в документах.</span>
{{ form.boss_surname.errors }} {{ form.boss_name.errors }} {{ form.boss_midname.errors }}
@ -163,10 +174,10 @@
</div>
<div id="na_osnovanii" class="field">
<div style="float: left; width: 200px;">
Действует на основании:
<div class="profile_label">
Действует на основании
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.na_osnovanii }}
{{ form.na_osnovanii.errors }}
</div>
@ -174,15 +185,15 @@
</div>
{% endif %}
<div style="font-size: 15px; border-bottom: thin solid #000; padding: 15px 0 5px; width: 620px;">
<div class='profile_title'>
Главный бухгалтер{% if profile.is_ip %} (если есть){% endif %}
</div>
<div id="glavbuh_fio" class="field">
<div style="float: left; width: 200px;">
Фамилия, Имя, Отчество:
<div class="profile_label">
Фамилия, Имя, Отчество
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.glavbuh_surname }} {{ form.glavbuh_name }} {{ form.glavbuh_midname }}
<span class="help-text">Используется для строки "подпись" в документах.</span>
{{ form.glavbuh_surname.errors }} {{ form.glavbuh_name.errors }} {{ form.glavbuh_midname.errors }}
@ -190,31 +201,31 @@
<div class="clear"></div>
</div>
<div style="font-size: 15px; border-bottom: thin solid #000; padding: 15px 0 5px; width: 620px;">
<div class='profile_title'>
Банковские реквизиты
</div>
<div id="bank_accounts" class="field">
<table id="accounts" style="border: 0; border-collapse: collapse;">
<table id="accounts" class="" style="border: 0; border-collapse: collapse;">
<tbody>
{% for account in accounts %}
<tr class="account">
<td class="account-type" style="width: 200px; vertical-align: top; padding: 0;">
<td class="account-type profile_label">
{% if forloop.first %}
Основной счёт: <span class="required">*</span>
Основной счёт <span class="required">*</span>
{% elif forloop.counter == 2 %}
Дополнительные счета:
Дополнительные счета
{% endif %}
</td>
<td class="account-info" style="width: 350px; vertical-align: top; padding: 0;">
<td class="account-info" class="profile_field">
<a id="account_edit_link_{{ account.pk }}" href="{% url 'customer_bank_accounts_edit' id=account.pk %}" title="Редактировать расчётный счёт">{{ account.account }}</a>
в <span id="account_bank_name_{{ account.pk }}">{{ account.name }}</span>
</td>
<td class="account-delete" style="padding: 0;">
<a id="account_delete_link_{{ account.pk }}" href="{% url 'customer_bank_accounts_delete' id=account.pk %}" title="Удалить расчётный счёт">
<img src="{{ STATIC_URL }}img/icon-delete.gif" alt="[X]" title="Удалить расчётный счёт" />
<img src="{{ STATIC_URL }}img/icon-delete.png" alt="[X]" title="Удалить расчётный счёт" />
</a>
</td>
</tr>
@ -223,9 +234,9 @@
<tr class="account" style="display: none;">
<td class="account-type" style="width: 200px; vertical-align: top; padding: 0;">
{% if forloop.first %}
Основной счёт: <span class="required">*</span>
Основной счёт <span class="required">*</span>
{% elif forloop.counter == 2 %}
Дополнительные счета:
Дополнительные счета
{% endif %}
</td>
@ -247,7 +258,7 @@
<td></td>
<td class="account-add">
<a id="account_add_link" class="add-link" href="{% url 'customer_bank_accounts_add' %}" title="Добавить расчётный счёт">
<img src="{{ STATIC_URL }}img/icon-add.png" alt="Добавить" title="Добавить расчётный счёт" />Добавить расчётный счёт
Добавить расчётный счёт
</a>
</td>
<td></td>
@ -255,15 +266,16 @@
</table>
</div>
<div style="font-size: 15px; border-bottom: thin solid #000; padding: 15px 0 5px; width: 620px;">
<div class='clear'></div>
<div class='profile_title'>
Контактная информация
</div>
<div id="address" class="field">
<div style="float: left; width: 200px;">
Адрес для документов:{% if form.address.field.required %} <span class="required">*</span>{% endif %}
<div class="profile_label">
Адрес для документов{% if form.address.field.required %} <span class="required">*</span>{% endif %}
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.address }}
<span class="help-text">Будет подставляться в создаваемые счета, акты и накладные.</span>
{{ form.address.errors }}
@ -273,10 +285,10 @@
{% if profile.is_org %}
<div id="jur_address" class="field">
<div style="float: left; width: 200px;">
Юридический (почтовый) адрес:
<div class="profile_label">
Юридический (почтовый) адрес
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.jur_address }}
<span class="help-text">Как в учредительных документах.</span>
{{ form.jur_address.errors }}
@ -286,10 +298,10 @@
{% endif %}
<div id="real_address" class="field">
<div style="float: left; width: 200px;">
Фактический адрес:
<div class="profile_label">
Фактический адрес
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.real_address }}
<span class="help-text">Используется только для карточки компании.</span>
{{ form.real_address.errors }}
@ -298,10 +310,10 @@
</div>
<div id="phone" class="field">
<div style="float: left; width: 200px;">
Телефон:
<div class="profile_label">
Телефон
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.phone_code }} {{ form.phone }}
{{ form.phone_code.errors }} {{ form.phone.errors }}
</div>
@ -309,10 +321,10 @@
</div>
<div id="fax" class="field">
<div style="float: left; width: 200px;">
Факс:
<div class="profile_label">
Факс
</div>
<div style="float: left;">
<div class="profile_field">
{{ form.fax_code }} {{ form.fax }}
{{ form.fax_code.errors }} {{ form.fax.errors }}
</div>
@ -320,10 +332,10 @@
</div>
<div id="email" class="field">
<div style="float: left; width: 200px;">
Электронная почта:
<div class="profile_label">
Электронная почта
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.email }}
{{ form.email.errors }}
</div>
@ -331,83 +343,99 @@
</div>
<div id="site" class="field">
<div style="float: left; width: 200px;">
Сайт:
<div class="profile_label">
Сайт
</div>
<div class="long-input" style="float: left;">
<div class="long-input profile_field">
{{ form.site }}
{{ form.site.errors }}
</div>
<div class="clear"></div>
</div>
<div style="font-size: 15px; border-bottom: thin solid #000; padding: 15px 0 5px; width: 620px;">
<div class='profile_title'>
Логотип, печать и подписи
</div>
<div id="signs" class="field">
<div style="float: left; width: 200px;">
Подписи:
<div class="profile_label">
Подписи ответственных лиц
</div>
<div style="float: left;">
<div id="boss_sign">
<div class="profile_field img_load">
<div id="boss_sign" class='img_load rel img_field'>
{% if form.boss_sign.value %}
<p>
<img src="{{ form.boss_sign.value.url }}" /> {# если уже есть картинка, показать ее #}
</p>
{% else %}
<img src="/static/img/upload-boss_sign.png" />
{% endif %}
{{ form.boss_sign.errors }}
<a href="#" class='del_image'></a>
</div>
<div class='hidden'>
{{ form.boss_sign }}
{{ form.del_boss_sign }}
<span class="help-text">Подпись руководителя.</span>
{{ form.boss_sign.errors }}
</div>
<div id="glavbuh_sign" class="field">
<div id="glavbuh_sign" class="img_load rel img_field">
{% if form.glavbuh_sign.value %}
<p>
<img src="{{ form.glavbuh_sign.value.url }}" /> {# если уже есть картинка, показать ее #}
</p>
{% else %}
<img src="/static/img/upload-glavbuh_sign.png" />
{% endif %}
{{ form.glavbuh_sign }}
<span class="help-text">Подпись бухгалтера.</span>
{{ form.glavbuh_sign.errors }}
<a href="#" class='del_image'></a>
</div>
<div class='hidden'>
{{ form.glavbuh_sign }}
{{ form.del_glavbuh_sign }}
</div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div id="stamp" class="field">
<div style="float: left; width: 200px;">
Печать:
<div id="stamp" class="field img_load">
<div class="profile_label">
Печать
</div>
<div style="float: left;">
<div class="profile_field rel img_field">
{% if form.stamp.value %}
<p>
<img src="{{ form.stamp.value.url }}" /> {# если уже есть картинка, показать ее #}
</p>
{% else %}
<img src="/static/img/upload-stamp.png" />
{% endif %}
<a href="#" class='del_image'></a>
</div>
<div class='hidden'>
{{ form.stamp }}
{{ form.del_stamp }}
{{ form.stamp.errors }}
</div>
<div class="clear"></div>
</div>
<div id="logo" class="field">
<div style="float: left; width: 200px;">
Логотип:
<div id="logo" class="field img_load">
<div class="profile_label">
Логотип
</div>
<div style="float: left;">
<div class="profile_field rel img_field">
{% if form.logo.value %}
<p>
<img src="{{ form.logo.value.url }}" /> {# если уже есть картинка, показать ее #}
</p>
{% else %}
<img src="/static/img/upload-logo.png" />
{% endif %}
<a href="#" class='del_image'></a>
</div>
<div class='hidden'>
{{ form.logo }}
{{ form.logo.errors }}
</div>
<div class="clear"></div>
</div>
<div class="buttons field">
<input type="submit" name="submit" value="Сохранить" />
<div class="buttons field profile_btns">
<input type="submit" name="submit" class="save yellow-btn" value="Сохранить" />
<input type="submit" name="_cancel" value="Отмена" />
</div>
</form>
@ -440,6 +468,47 @@
'delete_id_prefix': "account_delete_link_",
'bank_id_prefix': "account_bank_name_"
}
$(function(){
$('.img_load img').on('click', function(e) {
var this_id = $(this).closest('.img_load').attr('id');
var tmb_id = 'id_tmb_' + this_id.substring(3);
$('#' + tmb_id).val('');
$('#id_' + this_id).click();
})
$('.img_load .del_image').on('click', function(e) {
e.preventDefault();
var this_id = $(this).closest('.img_load').attr('id');
var tmb_id = 'id_tmb_' + this_id.substring(3);
$('#' + tmb_id).val('');
$('#' + this_id + ' img').attr('src', '/static/img/upload-' + this_id + '.png');
$('#' + this_id + '-clear_id').attr('checked', true);
})
var getPic = function(data){
var elm_id = '#' + data['elm_id'].substring(3);
var tmb_id = '#id_tmb_' + data['elm_id'].substring(3);
$(elm_id + ' img').attr('src', data['pic'])
$(tmb_id).val(data['full_pic']);
}
$('.img_load input[type=file]').on('change', function(e){
e.preventDefault();
var formData = new FormData();
formData.append($(this).val(), $(this)[0].files[0]);
formData.append('elm_id', $(this).attr('id'));
$.ajax({
type: 'POST',
url: '/my/tmp_upload/ajax/',
success: getPic,
data: formData,
cache: false,
contentType: false,
processData: false
}).done(function() {
});
});
})
</script>
<script src="{{ STATIC_URL }}js/customer/profile.edit.js"></script>

Loading…
Cancel
Save