Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions webshop/public/scss/webshop_cart.scss
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,13 @@ body.product-page {
}

.cart-table {
.cart-header {
display: none;
@media (min-width: 992px) {
display: table-header-group;
}
}
table-layout: fixed;
tr {
margin-bottom: 1rem;
}
Expand All @@ -675,10 +682,13 @@ body.product-page {

.cart-item-image {
width: 20%;
min-width: 100px;
min-width: 75px;
img {
max-height: 112px;
}
@media (min-width: 992px) {
min-width: 100px;
}
}

.cart-items {
Expand Down Expand Up @@ -712,6 +722,9 @@ body.product-page {
.item-rate {
font-size: 13px;
color: var(--text-muted);
@media screen and (max-width: 992px) {
font-size: 10px;
}
}

.free-tag {
Expand All @@ -722,8 +735,13 @@ body.product-page {

textarea {
width: 70%;
min-width: 105px;
height: 30px;
font-size: 14px;
@media screen and (max-width: 992px) {
width: 75%;
height: 35px;
}
}

}
Expand All @@ -745,7 +763,7 @@ body.product-page {
.item-column {
width: 50%;
@media (max-width: 992px) {
width: 70%;
width: 75%;
}
}

Expand Down Expand Up @@ -1401,7 +1419,6 @@ body.product-page {
transform: translate3d(0, 0, 0);
pointer-events: auto;
}

.w-fit {
width: fit-content !important;
}
60 changes: 12 additions & 48 deletions webshop/templates/includes/cart/cart_items.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% from "webshop/templates/includes/macros.html" import product_image %}
{% from "webshop/templates/includes/cart/cart_macros.html" import quantity_input %}

{% macro item_subtotal(item) %}
<div>
Expand All @@ -12,15 +13,15 @@
</span>
</div>
{% else %}
<span class="item-rate">
<span class="item-rate text-muted">
{{ _('Rate:') }} {{ item.get_formatted('rate') }}
</span>
{% endif %}
{% endmacro %}

{% for d in doc.items %}
<tr data-name="{{ d.name }}">
<td style="width: 60%;">
<td class="details-col">
<div class="d-flex">
<div class="cart-item-image mr-4">
{% if d.thumbnail %}
Expand Down Expand Up @@ -49,61 +50,24 @@
</span>
{% endif %}

<div class="mt-2 notes">
<textarea data-item-code="{{d.item_code}}" class="form-control" rows="2" placeholder="{{ _('Add notes') }}">{{d.additional_notes or ''}}</textarea>
</div>
<div class="d-lg-none">
{{ quantity_input(d) }}
</div>
<div class="mt-1 mt-lg-2 notes">
<textarea data-item-code="{{d.item_code}}" class="form-control" rows="2" placeholder="{{ _('Add notes') }}">{{d.additional_notes or ''}}</textarea>
</div>
</div>
</div>
</td>

<!-- Qty column -->
<td class="text-right" style="width: 25%;">
<div class="d-flex">
{% set disabled = 'disabled' if d.is_free_item else '' %}
<div class="input-group number-spinner mt-1 mb-4">
<span class="input-group-prepend d-sm-inline-block">
<button class="btn cart-btn" data-dir="dwn" {{ disabled }}>
{{ '–' if not d.is_free_item else ''}}
</button>
</span>

<input class="form-control text-center cart-qty" value="{{ d.get_formatted('qty') }}" data-item-code="{{ d.item_code }}"
style="max-width: 70px;" {{ disabled }}>

<span class="input-group-append d-sm-inline-block">
<button class="btn cart-btn" data-dir="up" {{ disabled }}>
{{ '+' if not d.is_free_item else ''}}
</button>
</span>
</div>

<div>
{% if not d.is_free_item %}
<div class="remove-cart-item column-sm-view d-flex" data-item-code="{{ d.item_code }}">
<span>
<svg class="icon sm remove-cart-item-logo"
width="18" height="18" viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg" id="icon-close">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.146 11.217a.5.5 0 1 0 .708.708l3.182-3.182 3.181 3.182a.5.5 0 1 0 .708-.708l-3.182-3.18 3.182-3.182a.5.5 0 1 0-.708-.708l-3.18 3.181-3.183-3.182a.5.5 0 0 0-.708.708l3.182 3.182-3.182 3.181z" stroke-width="0"></path>
</svg>
</span>
</div>
{% endif %}
</div>
</div>


<!-- Shown on mobile view, else hidden -->
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
<div class="text-right sm-item-subtotal">
{{ item_subtotal(d) }}
</div>
{% endif %}
<td class="text-right column-sm-view" style="width: 25%;">
{{ quantity_input(d) }}
</td>

<!-- Subtotal column -->
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
<td class="text-right item-subtotal column-sm-view w-100">
<td class="text-right item-subtotal w-100">
{{ item_subtotal(d) }}
</td>
{% endif %}
Expand Down
10 changes: 3 additions & 7 deletions webshop/templates/includes/cart/cart_items_total.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<!-- Total at the end of the cart items -->
<tr>
<th></th>
<th class="text-left item-grand-total" colspan="1">
{{ _("Total") }}
</th>
<th class="text-left item-grand-total totals" colspan="3">
{{ doc.get_formatted("total") }}
</th>
<td class="text-right item-grand-total" colspan="3">
{{ _("Total") }} {{ doc.get_formatted("total") }}
</td>
</tr>
36 changes: 36 additions & 0 deletions webshop/templates/includes/cart/cart_macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,39 @@
</div>
</div>
{% endmacro %}

{% macro quantity_input(item) %}
<div class="d-flex">
{% set disabled = 'disabled' if item.is_free_item else '' %}
<div class="input-group number-spinner mt-2 mt-lg-1 mb-0 mb-lg-4">
<span class="input-group-prepend d-sm-inline-block">
<button class="btn cart-btn" data-dir="dwn" {{ disabled }}>
{{ '–' if not item.is_free_item else ''}}
</button>
</span>

<input class="form-control text-center cart-qty" value="{{ item.get_formatted('qty') }}" data-item-code="{{ item.item_code }}"
style="max-width: 70px;" {{ disabled }}>

<span class="input-group-append d-sm-inline-block">
<button class="btn cart-btn" data-dir="up" {{ disabled }}>
{{ '+' if not item.is_free_item else ''}}
</button>
</span>
</div>

<div>
{% if not item.is_free_item %}
<div class="remove-cart-item column-sm-view d-flex" data-item-code="{{ item.item_code }}">
<span>
<svg class="icon sm remove-cart-item-logo"
width="18" height="18" viewBox="0 0 18 18"
xmlns="http://www.w3.org/2000/svg" id="icon-close">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.146 11.217a.5.5 0 1 0 .708.708l3.182-3.182 3.181 3.182a.5.5 0 1 0 .708-.708l-3.182-3.18 3.182-3.182a.5.5 0 1 0-.708-.708l-3.18 3.181-3.183-3.182a.5.5 0 0 0-.708.708l3.182 3.182-3.182 3.181z" stroke-width="0"></path>
</svg>
</span>
</div>
{% endif %}
</div>
</div>
{% endmacro %}
17 changes: 9 additions & 8 deletions webshop/templates/pages/cart.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="row m-0">
<!-- Left section -->
<div class="col-md-8">
<div class="frappe-card p-5 mb-4">
<div class="frappe-card p-3 p-lg-5 mb-4">
<div id="cart-error" class="alert alert-danger" style="display: none;"></div>
<div class="cart-items-header">
{{ _('Items') }}
Expand All @@ -25,11 +25,11 @@
<thead>
<tr>
<th class="item-column">{{ _('Item') }}</th>
<th width="20%">{{ _('Quantity') }}</th>
<th width="25%" class="column-sm-view">{{ _('Quantity') }}</th>
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
<th width="20" class="text-right column-sm-view">{{ _('Subtotal') }}</th>
<th width="25%" class="text-right">{{ _('Subtotal') }}</th>
{% endif %}
<th width="10%" class="column-sm-view"></th>
<!-- <th width="10%" class="column-sm-view"></th> -->
</tr>
</thead>
<tbody class="cart-items">
Expand All @@ -44,7 +44,7 @@
</table>

<div class="row mt-2">
<div class="col-3">
<div class="col-6 col-lg-3">
{% if cart_settings.enable_checkout %}
<a class="btn btn-primary-light font-md" href="/orders">
{{ _('Past Orders') }}
Expand All @@ -55,11 +55,12 @@
</a>
{% endif %}
</div>
<div class="col-9">
<div class="col-6 col-lg-9">
{% if doc.items %}
<div class="place-order-container">
<a class="btn btn-primary-light mr-2 font-md" href="/all-products">
{{ _('Continue Shopping') }}
<span class="d-inline d-sm-none">{{ _('Shop More') }}</span>
<span class="d-none d-sm-inline">{{ _('Continue Shopping') }}</span>
</a>
</div>
{% endif %}
Expand Down Expand Up @@ -95,7 +96,7 @@ <h5>{{ _("Terms and Conditions") }}</h5>
<input type="text" class="txtcoupon form-control mr-3 flex-grow-1 font-md" placeholder="{{ _("Enter coupon code") }}" name="txtcouponcode" ></input>
<button class="btn btn-secondary btn-sm bt-coupon font-md flex-shrink-0">{{ _("Apply") }}</button>
<input type="hidden" class="txtreferral_sales_partner font-md" placeholder="Enter Sales Partner" name="txtreferral_sales_partner" type="text"></input>
</div>
</div>
</div>
{% endif %}
{% endif %}
Expand Down
Loading