mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 02:01:21 +00:00
[webshop] Place Order - submits Quotation, creates Customer if required, creates and submits Sales Order
This commit is contained in:
@@ -10,8 +10,10 @@
|
||||
<div class="pull-right hide" style="margin:4px;" id="user-tools-post-login">
|
||||
<a href="profile" title="My Profile" id="user-full-name"></a> |
|
||||
<a href="account" title="My Account">My Account</a> |
|
||||
{% if shopping_cart_enabled -%}
|
||||
<a href="cart" title="Shopping Cart"><i class="icon-shopping-cart"></i>
|
||||
<span class="cart-count"></span></a> |
|
||||
{%- endif %}
|
||||
<a href="server.py?cmd=web_logout" title="Sign Out"><i class="icon-signout"></i></a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<p class="help">Item Code: <span itemprop="productID">{{ name }}</span></p>
|
||||
<h4>Product Description</h4>
|
||||
<div itemprop="description">
|
||||
{{ web_long_description or web_short_description or
|
||||
{{ web_long_description or web_short_description or description or
|
||||
"[No description given]" }}
|
||||
</div>
|
||||
<div style="min-height: 100px; margin: 10px 0;">
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
// js inside blog page
|
||||
|
||||
$(document).ready(function() {
|
||||
// make list of items in the cart
|
||||
// wn.cart.render();
|
||||
wn.cart.bind_events();
|
||||
wn.call({
|
||||
type: "POST",
|
||||
@@ -36,6 +34,7 @@ $(document).ready(function() {
|
||||
wn.cart.show_error("Oops!", "Something went wrong.");
|
||||
}
|
||||
} else {
|
||||
wn.cart.set_cart_count();
|
||||
wn.cart.render(r.message);
|
||||
}
|
||||
}
|
||||
@@ -75,6 +74,10 @@ $.extend(wn.cart, {
|
||||
$("#cart-add-billing-address").on("click", function() {
|
||||
window.location.href = "address?address_fieldname=customer_address";
|
||||
});
|
||||
|
||||
$(".btn-place-order").on("click", function() {
|
||||
wn.cart.place_order();
|
||||
});
|
||||
},
|
||||
|
||||
render: function(out) {
|
||||
@@ -282,5 +285,27 @@ $.extend(wn.cart, {
|
||||
|
||||
$address_wrapper.find('.accordion-body[data-address-name="'+ address_name +'"]')
|
||||
.collapse("show");
|
||||
},
|
||||
|
||||
place_order: function() {
|
||||
wn.call({
|
||||
type: "POST",
|
||||
method: "website.helpers.cart.place_order",
|
||||
callback: function(r) {
|
||||
if(r.exc) {
|
||||
var msg = "";
|
||||
if(r._server_messages) {
|
||||
msg = JSON.parse(r._server_messages || []).join("<br>");
|
||||
}
|
||||
|
||||
$("#cart-error")
|
||||
.empty()
|
||||
.html(msg || "Something went wrong!")
|
||||
.toggle(true);
|
||||
} else {
|
||||
window.location.href = "order?name=" + encodeURIComponent(r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -112,12 +112,4 @@
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
fieldset {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
@@ -13,8 +13,9 @@
|
||||
<div class="progress-bar progress-bar-info" style="width: 100%;"></div>
|
||||
</div>
|
||||
<div id="cart-container" class="hide">
|
||||
<button class="btn btn-success pull-right" type="button">Place Order</button>
|
||||
<button class="btn btn-success pull-right btn-place-order" type="button">Place Order</button>
|
||||
<div class="clearfix"></div>
|
||||
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col col-lg-9 col-sm-9">
|
||||
@@ -50,7 +51,7 @@
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<button class="btn btn-success pull-right" type="button">Place Order</button>
|
||||
<button class="btn btn-success pull-right btn-place-order" type="button">Place Order</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -12,24 +12,28 @@
|
||||
<h2><i class="icon-user"></i> My Profile</h2>
|
||||
<hr>
|
||||
<div class="alert" id="message" style="display: none;"></div>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="fullname">Full Name</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="fullname" placeholder="Your Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="password">Password</label>
|
||||
<div class="controls">
|
||||
<input type="password" id="password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button id="update_profile" type="submit" class="btn btn-default">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
<form>
|
||||
<fieldset>
|
||||
<label>Full Name</label>
|
||||
<input type="text" id="fullname" placeholder="Your Name">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Password</label>
|
||||
<input type="password" id="password" placeholder="Password">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Company Name</label>
|
||||
<input type="text" id="company_name" placeholder="Company Name" value="{{ company_name }}">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Mobile No</label>
|
||||
<input type="text" id="mobile_no" placeholder="Mobile No" value="{{ mobile_no }}">
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>Phone</label>
|
||||
<input type="text" id="phone" placeholder="Phone" value="{{ phone }}">
|
||||
</fieldset>
|
||||
<button id="update_profile" type="submit" class="btn btn-default">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
@@ -37,11 +41,14 @@ $(document).ready(function() {
|
||||
$("#fullname").val(getCookie("full_name") || "");
|
||||
$("#update_profile").click(function() {
|
||||
wn.call({
|
||||
method: "core.doctype.profile.profile.update_profile",
|
||||
method: "startup.webutils.update_profile",
|
||||
type: "POST",
|
||||
args: {
|
||||
fullname: $("#fullname").val(),
|
||||
password: $("#password").val()
|
||||
password: $("#password").val(),
|
||||
company_name: $("#company_name").val(),
|
||||
mobile_no: $("#mobile_no").val(),
|
||||
phone: $("#phone").val()
|
||||
},
|
||||
btn: this,
|
||||
msg: $("#message"),
|
||||
@@ -53,4 +60,4 @@ $(document).ready(function() {
|
||||
})
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user