Permalink
Browse files

fixed sending order by mail

  • Loading branch information...
1 parent 32ecfba commit a35b06fedb4303918f7d0511947d8ef5ab103143 @Guest007 committed Feb 23, 2014
Showing with 106 additions and 3,341 deletions.
  1. +1 −0 eurocard/urls.py
  2. +67 −0 orders/views.py
  3. +1 −1 templates/easy-form.html
  4. +27 −8 templates/helpers.html
  5. +3 −471 templates/home.html
  6. +1 −1 templates/ready-form.html
  7. +2 −2 theme/js/init.js
  8. +0 −1,584 theme/libs/jClever/jClever.js
  9. +0 −1 theme/libs/jClever/jClever.min.js
  10. +0 −96 theme/libs/jClever/jCleverTemplate/alice/css/PIE.htc
  11. +0 −549 theme/libs/jClever/jCleverTemplate/alice/css/jClever.css
  12. +0 −113 theme/libs/jClever/jCleverTemplate/alice/css/jquery.jscrollpane.css
  13. BIN theme/libs/jClever/jCleverTemplate/alice/images/arrow.png
  14. BIN theme/libs/jClever/jCleverTemplate/alice/images/checkbox.png
  15. BIN theme/libs/jClever/jCleverTemplate/alice/images/file-input.png
  16. BIN theme/libs/jClever/jCleverTemplate/alice/images/file.png
  17. BIN theme/libs/jClever/jCleverTemplate/alice/images/radio.png
  18. +0 −298 theme/libs/jClever/jCleverTemplate/default/css/jClever.css
  19. +0 −120 theme/libs/jClever/jCleverTemplate/default/css/jquery.jscrollpane.css
  20. BIN theme/libs/jClever/jCleverTemplate/default/images/checkbox.png
  21. BIN theme/libs/jClever/jCleverTemplate/default/images/file-input.png
  22. BIN theme/libs/jClever/jCleverTemplate/default/images/file.png
  23. BIN theme/libs/jClever/jCleverTemplate/default/images/radio.png
  24. +0 −11 theme/libs/jClever/jquery.jscrollpane.min.js
  25. +0 −84 theme/libs/jClever/jquery.mousewheel.js
  26. 0 theme/libs/jclever/jCleverTemplate/alice/css/jClever.css
  27. 0 theme/libs/jclever/jCleverTemplate/alice/css/jquery.jscrollpane.css
  28. +4 −2 theme/libs/jclever/jclever.js
View
@@ -29,6 +29,7 @@
url(r'^form_1/', orders.easyform, name='e_order'),
url(r'^form_3/', orders.readyform, name='r_order'),
url(r'^call-back/', orders.callback, name='call-back'),
+ url(r'^finish/', orders.finish, name='finish'),
url(r"^second/(?P<pk>\d+)/$", orders.nextstep_order, name="ajax-nextstep-order"),
url(r"^(?P<pk>\d+)/(?P<step>\d+)/$", orders.edit_fast, name="edit-fast"),
View
@@ -295,5 +295,72 @@ def callback(request):
except:
pass
+ response = http.HttpResponse('OK', content_type="text/html; charset=utf-8")
+ return response
+
+
+@csrf_exempt
+def finish(request):
+ time = datetime.datetime.now()
+
+ payment_status = request.POST.get('payment_status', False)
+ raschet = request.POST.get('raschet', False)
+ order = request.POST.get('id', False)
+
+ obj = Orders.objects.get(id=int(order))
+
+ items = {
+ u'с чипом': (u'да' if obj.template.chip else u'нет'),
+ u'скрэтч панель': (u'да' if obj.template.scratch else u'нет'),
+ u'магнитная полоса': (u'да' if obj.template.magnet else u'нет'),
+ u'эмбоссирование': (u'да' if obj.template.emboss else u'нет'),
+ u'ультрафиолетовые чернила': (u'да' if obj.template.uv else u'нет'),
+ u'печатный номер': (u'да' if obj.template.print_num else u'нет'),
+ u'полоса для подписи': (u'да' if obj.template.sign else u'нет'),
+ u'фольгирование': (u'да' if obj.template.foil else u'нет'),
+ u'штрихкод': (u'да' if obj.template.barcode else u'нет'),
+ u'индентная печать': (u'да' if obj.template.indent else u'нет'),
+ u'Материал': obj.template.material,
+ u'Ламинирование': obj.template.lamination,
+ u'Количество цветов лицевой стороны (или комбинация)': obj.template.color_front,
+ u'Количество цветов обратной стороны': obj.template.color_back
+ }
+
+ mail_content = {
+ 'fio': obj,
+ 'phone': obj.phone,
+ 'email': obj.email,
+ 'draw': obj.draw,
+ 'cost': obj.cost,
+ 'maket': obj.maket,
+ 'items': items,
+ 'payment_status': (u'Юр.лицо' if payment_status == 'u' else u'Физ.лицо'),
+ 'raschet': (u'Наличный' if raschet == '1' else u'Безналичный'),
+ 'time': time
+ }
+
+ # print obj.template.magnet
+ # for i in obj:
+ # print i
+ # message = request.POST.get('message', '')
+ # time = datetime.datetime.now()
+ #
+ email = Settings.objects.get(slug='order-mail').content
+ # # print email.content
+ #
+ try:
+ messages.ORDER_TO_CLIENT.send(obj.email,
+ **mail_content)
+ # print "SENT"
+ except:
+ pass
+
+ try:
+ messages.ORDER_TO_MANAGER.send(email,
+ **mail_content)
+ # print "SENT"
+ except:
+ pass
+
response = http.HttpResponse('OK', content_type="text/html; charset=utf-8")
return response
View
@@ -182,7 +182,7 @@
</li>
<li>
<label for="i_03"><i class="fa fa-asterisk"></i> Телефон:</label>
- <input type="text" name="phone_" id="i_03" value="{{ object.phone }}" class="for_valid">
+ <input type="text" name="phone" id="i_03" value="{{ object.phone }}" class="for_valid">
</li>
<li>
<label for="i_04"><i class="fa fa-asterisk"></i> Email:</label>
View
@@ -1,4 +1,5 @@
-<form class="jClever">
+<form id="final_form" class="jClever" method="post" action="{% url 'finish' %}">
+ <input type="hidden" name="id" value="{{ object.id }}">
<div class="order">
<span>Ваш заказ<small class="close_order"><i class="fa fa-times"></i></small></span>
<ul class="info">
@@ -29,19 +30,19 @@
<li>
<span>Способ оплаты</span>
<div class="radio">
- <input type="radio">
- <label>Физическое лицо</label>
+ <input type="radio" name="payment_status" value="f" id="r_01" checked>
+ <label for="r_01">Физическое лицо</label>
</div>
<div class="radio">
- <input type="radio">
- <label>Юридическое лицо</label>
+ <input type="radio" name="payment_status" value="u" id="r_02">
+ <label for="r_02">Юридическое лицо</label>
</div>
</li>
<li>
<div class="select">
- <select>
- <option value="1">Безналичный расчёт</option>
- <option value="2">Наличный расчёт</option>
+ <select name="raschet">
+ <option value="1">Наличный расчёт</option>
+ <option value="2">Безналичный расчёт</option>
</select>
</div>
<input type="submit" value="Отправить заказ">
@@ -52,3 +53,21 @@
</ul>
</div>
</form>
+
+<script type="application/javascript">
+$('#final_form').submit(function(){
+ var action = $(this).attr('action');
+ var that = $(this);
+ $.ajax({
+ url: action,
+ type: 'POST',
+ data: that.serialize(),
+ complete: function(result){
+{# $('#easy_form').trigger( 'reset' );#}
+{# $('#fast_form').trigger( 'reset' );#}
+ $('#final_form').addClass('hide');
+ }
+ });
+ return false;
+ });
+</script>
Oops, something went wrong.

0 comments on commit a35b06f

Please sign in to comment.