Merge branch 'shop-locations-with-inventory' into 'master'

Buttons for new shop locations

See merge request engineering/make-post-sell/make_post_sell!11
This commit is contained in:
Russell Ballestrini 2024-06-19 17:32:24 +00:00
commit 068cc9b12d
4 changed files with 9 additions and 5 deletions

View file

@ -76,9 +76,9 @@ def includeme(config):
config.add_route("coupon2", "/s/{shop_id}/coupon/{coupon_id}/{slug:.*}")
# shop_location routes.
config.add_route("shop_location_new", "/s/{shop_id}/locations/new")
config.add_route("shop_location_new", "/s/locations/new")
config.add_route("shop_location_edit", "/s/{shop_id}/locations/{location_id}/edit")
config.add_route("shop_locations", "/s/{shop_id}/locations")
config.add_route("shop_locations", "/s/locations")
config.add_route(
"shop_location_switch", "/s/{shop_id}/location/{location_id}/switch"
)

View file

@ -20,6 +20,10 @@
<br/>
<a href="/p/new" class="shop-new-button mps-button">&#65291; New Product</a>
<br/>
<br/>
<a href="/s/locations/new" class="shop-new-button mps-button">&#65291; New Shop Location</a>
{% if request.is_saas_domain %}
<br />
<br />

View file

@ -30,7 +30,7 @@
<br/>
<br/>
<a href="/s/{{ request.shop.id }}/locations" class="product-edit-button mps-button">&#127968; &nbsp Shop Locations</a>
<a href="/s/locations" class="product-edit-button mps-button">&#127968; &nbsp Shop Locations</a>
{% if request.is_saas_domain %}
<br/>

View file

@ -17,7 +17,7 @@ def bool_to_checkbox(boolean):
@view_config(route_name="shop_location_new", renderer="shop_location_form.j2")
@shop_owner_required()
def shop_location_new(request):
shop = get_shop_by_id(request.dbsession, request.matchdict["shop_id"])
shop = request.shop
if not shop:
request.session.flash(("Shop not found.", "error"))
@ -188,7 +188,7 @@ def shop_location_switch(request):
request.session.flash(
("Location not found or does not belong to this shop.", "error")
)
return HTTPFound(request.route_url("shop_locations", shop_id=shop_id))
return HTTPFound(request.route_url("shop_locations"))
# Update the session with the selected location
request.session["shop_location_id"] = str(location.id)