Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve order details
Paweł Kowalewskid1160cacbe25
diff --git a/saleor/cart/templates/cart/index.html b/saleor/cart/templates/cart/index.htmlindex 8074e75653..163e2b6469 100644--- a/saleor/cart/templates/cart/index.html+++ b/saleor/cart/templates/cart/index.html@@ -20,7 +20,7 @@<thead><tr><th class="col-sm-6">{% trans "Product" %}</th>- <th class="col-sm-2 text-right">{% trans "Quantity" %}</th>+ <th class="col-sm-2">{% trans "Quantity" %}</th><th class="col-sm-2 text-right">{% trans "Price" %}</th><th class="col-sm-2 text-right">{% trans "Subtotal" %}</th></tr>@@ -45,7 +45,7 @@</a></td><td>- <div class="input-group cart-item-quantity{% if form.quantity.errors %} has-error{% endif %}">+ <div class="input-group cart-item-quantity hidden{% if form.quantity.errors %} has-error{% endif %}">{{ form.quantity }}<span class="input-group-btn"><button class="btn btn-info" type="submit">{% trans "Update" %}</button>diff --git a/saleor/order/forms.py b/saleor/order/forms.pyindex a08a5bb147..ec928521cd 100644--- a/saleor/order/forms.py+++ b/saleor/order/forms.py@@ -7,7 +7,8 @@ from .models import Paymentclass PaymentMethodsForm(forms.Form):- method = forms.ChoiceField(choices=settings.CHECKOUT_PAYMENT_CHOICES)+ method = forms.ChoiceField(choices=settings.CHECKOUT_PAYMENT_CHOICES, widget=forms.RadioSelect,+ initial=settings.CHECKOUT_PAYMENT_CHOICES[0][0])class PaymentDeleteForm(forms.Form):diff --git a/saleor/order/templates/order/details.html b/saleor/order/templates/order/details.htmlindex b9abceaea9..b6e744e7ab 100644--- a/saleor/order/templates/order/details.html+++ b/saleor/order/templates/order/details.html@@ -32,6 +32,54 @@</h1></div></div>++ {% if order.user == user or not order.is_fully_paid %}+ {% if not order.is_fully_paid %}+ <div class="row">+ <div class="col-sm-6">+ <div class="panel panel-default">+ <div class="panel-body">+ {% if waiting_payment %}+ <form method="post" action="{% url 'order:cancel-payment' token=order.token %}">+ {% csrf_token %}+ <legend>{% trans "Payment pending" %}</legend>+ <p>{% trans "We are currently waiting for an external service to authorize your payment for this order." %}</p>+ <p>{% trans "Current status" %}: <span class="label label-default">{{ waiting_payment.get_status_display }}</span></p>+ <p>{% trans "Unless you are absolutely sure that the process will not complete (for example you have closed the browser window before paying), you should wait before attempting a new payment. Please be warned that if you try again and the previous transaction succeeds you might end up being charged twice." %}</p>+ {{ waiting_payment_form|as_vertical_form }}+ <button type="submit" class="btn btn-danger">{% trans "I understand, allow me to pay again" %}</button>+ </form>+ {% elif payment_form %}+ <form method="post" action="{% url "order:details" token=order.token %}">+ {% csrf_token %}+ <legend>{% trans "Pay for your order" %}</legend>+ {{ payment_form }}+ <div class="form-group text-right">+ {% block form_submit %}+ <button type="submit" class="btn btn-primary">+ {% trans "Make a payment" %}+ </button>+ {% endblock %}+ </div>+ </form>+ {% else %}+ <p>{% trans "You've authorized transaction. Order is in processing" %}</p>+ {% endif %}+ </div>+ </div>+ </div>+ </div>+ {% endif %}+ {% if payments %}+ <h3>{% trans "Payment history" %}</h3>+ <ul>+ {% for payment in payments %}+ <li>{{ payment.created|date }}, {{ payment.created|time }} — <span class="label label-default">{{ payment.get_status_display }}</span></li>+ {% endfor %}+ </ul>+ {% endif %}+ {% endif %}+<div class="row">{% if order.user == user %}<div class="col-sm-6">@@ -102,52 +150,6 @@</table></div>{% endfor %}- {% if order.user == user or not order.is_fully_paid %}- {% if not order.is_fully_paid %}- <div class="row">- <div class="col-sm-6">- <div class="panel panel-default">- <div class="panel-body">- {% if waiting_payment %}- <form method="post" action="{% url 'order:cancel-payment' token=order.token %}">- {% csrf_token %}- <legend>{% trans "Payment pending" %}</legend>- <p>{% trans "We are currently waiting for an external service to authorize your payment for this order." %}</p>- <p>{% trans "Current status" %}: <span class="label label-default">{{ waiting_payment.get_status_display }}</span></p>- <p>{% trans "Unless you are absolutely sure that the process will not complete (for example you have closed the browser window before paying), you should wait before attempting a new payment. Please be warned that if you try again and the previous transaction succeeds you might end up being charged twice." %}</p>- {{ waiting_payment_form|as_vertical_form }}- <button type="submit" class="btn btn-danger">{% trans "I understand, allow me to pay again" %}</button>- </form>- {% elif payment_form %}- <form method="post" action="{% url "order:details" token=order.token %}">- {% csrf_token %}- <legend>{% trans "Pay for your order" %}</legend>- {{ payment_form|as_vertical_form }}- <div class="form-group">- {% block form_submit %}- <button type="submit" class="btn btn-primary">- {% trans "Make a payment" %}- </button>- {% endblock %}- </div>- </form>- {% else %}- <p>{% trans "You've authorized transaction. Order is in processing" %}</p>- {% endif %}- </div>- </div>- </div>- </div>- {% endif %}- {% if payments %}- <h3>{% trans "Payment history" %}</h3>- <ul>- {% for payment in payments %}- <li>{{ payment.created|date }}, {{ payment.created|time }} — <span class="label label-default">{{ payment.get_status_display }}</span></li>- {% endfor %}- </ul>- {% endif %}- {% endif %}{% endblock content %}{% block footer_scripts %}diff --git a/saleor/registration/templates/registration/login.html b/saleor/registration/templates/registration/login.htmlindex 86772a5473..4e1362ba12 100644--- a/saleor/registration/templates/registration/login.html+++ b/saleor/registration/templates/registration/login.html@@ -17,18 +17,20 @@<input type="hidden" name="next" value="{{ next }}" /></fieldset>- <div class="form-group">+ <div class="form-group text-right">+ <a class="btn btn-secondary" href="{% url 'registration:request_email_confirmation' %}">{% trans "I don't know my password" %}</a><button class="btn btn-primary">{% trans "Log in" %}</button>- <a class="btn btn-secondary" href="{% url 'registration:request_email_confirmation' %}">{% trans "I don't know my password" %}</a></div><hr>{% if facebook_login_url or google_login_url %}<p>{% trans "Want to use your social profile?" %}</p><p>{% if facebook_login_url %}- <a class="btn btn-default" href="{{ facebook_login_url }}"> {% trans "Log in using Facebook" %}</a>+ <a class="btn btn-default" href="{{ facebook_login_url }}">+ {% trans "Log in using Facebook" %}+ </a>{% endif %}{% if google_login_url %}<a class="btn btn-default" href="{{ google_login_url }}"> {% trans "Log in using Google" %}</a>diff --git a/saleor/registration/templates/registration/request_email_confirmation.html b/saleor/registration/templates/registration/request_email_confirmation.htmlindex 77830e5c74..1b5152a8fe 100644--- a/saleor/registration/templates/registration/request_email_confirmation.html+++ b/saleor/registration/templates/registration/request_email_confirmation.html@@ -21,7 +21,7 @@{{ form|as_vertical_form }}<input type="hidden" name="next" value="{{ next }}" /></fieldset>- <div class="form-group">+ <div class="form-group text-right"><button class="btn btn-primary">{% trans "Continue" %}</button>diff --git a/saleor/static/img/authorize_net-logo.png b/saleor/static/img/authorize_net-logo.pngnew file mode 100644index 0000000000..4664541760Binary files /dev/null and b/saleor/static/img/authorize_net-logo.png differdiff --git a/saleor/static/img/braintree-logo.png b/saleor/static/img/braintree-logo.pngnew file mode 100644index 0000000000..dfb325a036Binary files /dev/null and b/saleor/static/img/braintree-logo.png differdiff --git a/saleor/static/img/paypal-logo.png b/saleor/static/img/paypal-logo.pngnew file mode 100644index 0000000000..905039aff2Binary files /dev/null and b/saleor/static/img/paypal-logo.png differdiff --git a/saleor/static/js_src/storefront_react.js b/saleor/static/js_src/storefront_react.jsindex 003bde05c3..da5869ca53 100644--- a/saleor/static/js_src/storefront_react.js+++ b/saleor/static/js_src/storefront_react.js@@ -22,7 +22,7 @@ var CartItemAmount = React.createClass({render: function() {this.lastOptionValue = this.props.options[this.props.options.length - 1];var that = this;- return <select name={this.props.name} onChange={this.change} value={this.state.value} className="form-control">+ return <select name={this.props.name} onChange={this.change} value={this.state.value} className="form-control cart-item-quantity-select">{this.props.options.map(function(option) {return <CartItemAmountOption key={option} value={option} label={option == that.lastOptionValue ? option+" +" : option} />})}@@ -44,13 +44,15 @@ $(".cart-item-quantity").each(function() {var value = $input.val();var name = $input.attr("name");var hasErrors = $(this).hasClass("has-error");- textInput[name] = this;var options = [1,2,3,4,5,6,7,8,9,10];if (options.indexOf(parseInt(value)) != -1 && !hasErrors) {React.render(<CartItemAmount options={options} value={value} name={name}/>, this.parentNode);}++ $(this).removeClass("hidden");+ textInput[name] = this;});var FormShippingToggler = React.createClass({diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scssindex 45028430f9..8040ac5b61 100644--- a/saleor/static/scss/_app.scss+++ b/saleor/static/scss/_app.scss@@ -80,6 +80,10 @@ $icon-font-path: "../fonts/";border-top-right-radius: 0;}+ &-select {+ width: calc(100% - 71px);+ }+&.has-error {input {border-color: $state-danger-text;@@ -106,3 +110,31 @@ $icon-font-path: "../fonts/";}}}++#id_method {+ list-style: none;+ padding: 0;++ li:not(:first-child) {+ label {+ font-size: 0;++ @each $provider in (default, authorize_net, braintree, paypal) {+ input[value=#{$provider}] {+ margin: 6px 110px 6px 0;++ &:after {+ background: url("../img/#{$provider}-logo.png") no-repeat left;+ background-size: contain;+ content: "";+ display: block;+ float: left;+ height: 26px;+ margin: -6px 0 0 18px;+ width: 100px;+ }+ }+ }+ }+ }+}