Anand Doshi | da858cc | 2015-02-24 17:50:44 +0530 | [diff] [blame] | 1 | {% macro product_image_square(website_image, css_class="") %} |
Summayya Hashmani | da43a5e | 2022-10-04 09:57:07 +0530 | [diff] [blame] | 2 | <div class="product-image product-image-square h-100 rounded |
Rushabh Mehta | 440650d | 2016-11-14 13:13:53 +0530 | [diff] [blame] | 3 | {% if not website_image -%} missing-image {%- endif %} {{ css_class }}" |
| 4 | {% if website_image -%} |
| 5 | style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');" |
| 6 | {%- endif %}> |
Anand Doshi | da858cc | 2015-02-24 17:50:44 +0530 | [diff] [blame] | 7 | </div> |
| 8 | {% endmacro %} |
| 9 | |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 10 | {% macro product_image(website_image, css_class="product-image", alt="", no_border=False) %} |
| 11 | <div class="{{ 'border' if not no_border else ''}} text-center rounded {{ css_class }}" style="overflow: hidden;"> |
marination | cb52c98 | 2021-06-09 00:11:48 +0530 | [diff] [blame] | 12 | {% if website_image %} |
| 13 | <img itemprop="image" class="website-image h-100 w-100" alt="{{ alt }}" src="{{ frappe.utils.quoted(website_image) | abs_url }}"> |
| 14 | {% else %} |
| 15 | <div class="card-img-top no-image-item"> |
| 16 | {{ frappe.utils.get_abbr(alt) or "NA" }} |
| 17 | </div> |
| 18 | {% endif %} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 19 | </div> |
Rushabh Mehta | 156ce60 | 2015-09-11 18:49:59 +0530 | [diff] [blame] | 20 | {% endmacro %} |
pratu16x7 | 60fe77c | 2017-02-13 21:52:43 +0530 | [diff] [blame] | 21 | |
| 22 | {% macro media_image(website_image, name, css_class="") %} |
pratu16x7 | 0e94b4b | 2017-02-14 16:32:48 +0530 | [diff] [blame] | 23 | <div class="product-image sidebar-image-wrapper {{ css_class }}"> |
| 24 | {% if not website_image -%} |
| 25 | <div class="sidebar-standard-image"> <div class="standard-image" style="background-color: rgb(250, 251, 252);">{{name}}</div> </div> |
| 26 | {%- endif %} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 27 | {% if website_image -%} |
pratu16x7 | 60fe77c | 2017-02-13 21:52:43 +0530 | [diff] [blame] | 28 | <a href="{{ frappe.utils.quoted(website_image) }}"> |
pratu16x7 | 0e94b4b | 2017-02-14 16:32:48 +0530 | [diff] [blame] | 29 | <img itemprop="image" src="{{ frappe.utils.quoted(website_image) | abs_url }}" |
| 30 | class="img-responsive img-thumbnail sidebar-image" style="min-height:100%; min-width:100%;"> |
pratu16x7 | 60fe77c | 2017-02-13 21:52:43 +0530 | [diff] [blame] | 31 | </a> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 32 | {%- endif %} |
| 33 | </div> |
pratu16x7 | 60fe77c | 2017-02-13 21:52:43 +0530 | [diff] [blame] | 34 | {% endmacro %} |
Faris Ansari | 5f8b358 | 2019-03-19 11:48:32 +0530 | [diff] [blame] | 35 | |
marination | 897c08c | 2021-05-17 20:44:41 +0530 | [diff] [blame] | 36 | {%- macro item_card(item, is_featured=False, is_full_width=False, align="Left") -%} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 37 | {%- set align_items_class = resolve_class({ |
| 38 | 'align-items-end': align == 'Right', |
| 39 | 'align-items-center': align == 'Center', |
| 40 | 'align-items-start': align == 'Left', |
| 41 | }) -%} |
| 42 | {%- set col_size = 3 if is_full_width else 4 -%} |
marination | 48b3ce8 | 2021-05-13 01:22:05 +0530 | [diff] [blame] | 43 | {%- set title = item.web_item_name or item.item_name or item.item_code -%} |
| 44 | {%- set title = title[:50] + "..." if title|len > 50 else title -%} |
marination | 9541354 | 2022-06-27 13:00:00 +0530 | [diff] [blame] | 45 | {%- set image = item.website_image -%} |
marination | 4f64d1c | 2021-03-11 21:24:47 +0530 | [diff] [blame] | 46 | {%- set description = item.website_description or item.description-%} |
| 47 | |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 48 | {% if is_featured %} |
| 49 | <div class="col-sm-{{ col_size*2 }} item-card"> |
marination | b29c5d6 | 2021-05-25 01:35:22 +0530 | [diff] [blame] | 50 | <div class="card featured-item {{ align_items_class }}" style="height: 360px;"> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 51 | {% if image %} |
| 52 | <div class="row no-gutters"> |
marination | b29c5d6 | 2021-05-25 01:35:22 +0530 | [diff] [blame] | 53 | <div class="col-md-5 ml-4"> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 54 | <img class="card-img" src="{{ image }}" alt="{{ title }}"> |
| 55 | </div> |
| 56 | <div class="col-md-6"> |
marination | 897c08c | 2021-05-17 20:44:41 +0530 | [diff] [blame] | 57 | {{ item_card_body(title, description, item, is_featured, align) }} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 58 | </div> |
| 59 | </div> |
| 60 | {% else %} |
| 61 | <div class="col-md-12"> |
marination | 897c08c | 2021-05-17 20:44:41 +0530 | [diff] [blame] | 62 | {{ item_card_body(title, description, item, is_featured, align) }} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 63 | </div> |
| 64 | {% endif %} |
| 65 | </div> |
| 66 | </div> |
| 67 | {% else %} |
| 68 | <div class="col-sm-{{ col_size }} item-card"> |
marination | b29c5d6 | 2021-05-25 01:35:22 +0530 | [diff] [blame] | 69 | <div class="card {{ align_items_class }}" style="height: 360px;"> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 70 | {% if image %} |
marination | 16b9c8c | 2021-03-11 10:56:00 +0530 | [diff] [blame] | 71 | <div class="card-img-container"> |
marination | 4f64d1c | 2021-03-11 21:24:47 +0530 | [diff] [blame] | 72 | <a href="/{{ item.route or '#' }}" style="text-decoration: none;"> |
marination | 16b9c8c | 2021-03-11 10:56:00 +0530 | [diff] [blame] | 73 | <img class="card-img" src="{{ image }}" alt="{{ title }}"> |
| 74 | </a> |
| 75 | </div> |
prssanna | b00eb1b | 2021-01-20 17:52:54 +0530 | [diff] [blame] | 76 | {% else %} |
marination | 4f64d1c | 2021-03-11 21:24:47 +0530 | [diff] [blame] | 77 | <a href="/{{ item.route or '#' }}" style="text-decoration: none;"> |
marination | 16b9c8c | 2021-03-11 10:56:00 +0530 | [diff] [blame] | 78 | <div class="card-img-top no-image"> |
| 79 | {{ frappe.utils.get_abbr(title) }} |
| 80 | </div> |
| 81 | </a> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 82 | {% endif %} |
marination | 897c08c | 2021-05-17 20:44:41 +0530 | [diff] [blame] | 83 | {{ item_card_body(title, description, item, is_featured, align) }} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 84 | </div> |
| 85 | </div> |
| 86 | {% endif %} |
| 87 | {%- endmacro -%} |
| 88 | |
marination | 897c08c | 2021-05-17 20:44:41 +0530 | [diff] [blame] | 89 | {%- macro item_card_body(title, description, item, is_featured, align) -%} |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 90 | {%- set align_class = resolve_class({ |
| 91 | 'text-right': align == 'Right', |
| 92 | 'text-center': align == 'Center' and not is_featured, |
| 93 | 'text-left': align == 'Left' or is_featured, |
| 94 | }) -%} |
marination | 16b9c8c | 2021-03-11 10:56:00 +0530 | [diff] [blame] | 95 | <div class="card-body {{ align_class }}" style="width:100%"> |
marination | b29c5d6 | 2021-05-25 01:35:22 +0530 | [diff] [blame] | 96 | <div class="mt-4"> |
marination | 4f64d1c | 2021-03-11 21:24:47 +0530 | [diff] [blame] | 97 | <a href="/{{ item.route or '#' }}"> |
marination | 48b3ce8 | 2021-05-13 01:22:05 +0530 | [diff] [blame] | 98 | <div class="product-title"> |
| 99 | {{ title or '' }} |
marination | 48b3ce8 | 2021-05-13 01:22:05 +0530 | [diff] [blame] | 100 | </div> |
marination | 16b9c8c | 2021-03-11 10:56:00 +0530 | [diff] [blame] | 101 | </a> |
marination | 16b9c8c | 2021-03-11 10:56:00 +0530 | [diff] [blame] | 102 | </div> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 103 | {% if is_featured %} |
marination | b29c5d6 | 2021-05-25 01:35:22 +0530 | [diff] [blame] | 104 | <div class="product-description ellipsis text-muted" style="white-space: normal;"> |
| 105 | {{ description or '' }} |
| 106 | </div> |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 107 | {% else %} |
| 108 | <div class="product-category">{{ item.item_group or '' }}</div> |
prssanna | eb0e596 | 2020-12-24 11:40:33 +0530 | [diff] [blame] | 109 | {% endif %} |
| 110 | </div> |
Ankush Menat | 4551d7d | 2021-08-19 13:41:10 +0530 | [diff] [blame] | 111 | {%- endmacro -%} |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 112 | |
| 113 | |
| 114 | {%- macro wishlist_card(item, settings) %} |
marination | d897062 | 2021-07-08 13:58:00 +0530 | [diff] [blame] | 115 | {%- set title = item.web_item_name or ''-%} |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 116 | {%- set title = title[:90] + "..." if title|len > 90 else title -%} |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 117 | <div class="col-sm-3 wishlist-card"> |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 118 | <div class="card text-center"> |
marination | aca3c8f | 2021-06-08 19:40:26 +0530 | [diff] [blame] | 119 | <div class="card-img-container"> |
| 120 | <a href="/{{ item.route or '#' }}" style="text-decoration: none;"> |
| 121 | {% if item.image %} |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 122 | <img class="card-img" src="{{ item.image }}" alt="{{ title }}"> |
marination | aca3c8f | 2021-06-08 19:40:26 +0530 | [diff] [blame] | 123 | {% else %} |
| 124 | <div class="card-img-top no-image"> |
| 125 | {{ frappe.utils.get_abbr(title) }} |
| 126 | </div> |
| 127 | {% endif %} |
| 128 | </a> |
| 129 | <div class="remove-wish" data-item-code="{{ item.item_code }}"> |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 130 | <svg class="icon icon-md remove-wish-icon"> |
| 131 | <use class="close" href="#icon-delete"></use> |
| 132 | </svg> |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 133 | </div> |
marination | aca3c8f | 2021-06-08 19:40:26 +0530 | [diff] [blame] | 134 | </div> |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 135 | |
marination | d897062 | 2021-07-08 13:58:00 +0530 | [diff] [blame] | 136 | {{ wishlist_card_body(item, title, settings) }} |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 137 | </div> |
| 138 | </div> |
| 139 | {%- endmacro -%} |
| 140 | |
marination | d897062 | 2021-07-08 13:58:00 +0530 | [diff] [blame] | 141 | {%- macro wishlist_card_body(item, title, settings) %} |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 142 | <div class="card-body card-body-flex text-left" style="width: 100%;"> |
| 143 | <div class="mt-4"> |
marination | d897062 | 2021-07-08 13:58:00 +0530 | [diff] [blame] | 144 | <div class="product-title">{{ title or ''}}</div> |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 145 | <div class="product-category">{{ item.item_group or '' }}</div> |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 146 | </div> |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 147 | <div class="product-price"> |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 148 | {{ item.get("formatted_price") or '' }} |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 149 | |
| 150 | {% if item.get("formatted_mrp") %} |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 151 | <small class="ml-1 striked-price"> |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 152 | <s>{{ item.formatted_mrp }}</s> |
| 153 | </small> |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 154 | <small class="ml-1 product-info-green" > |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 155 | {{ item.discount }} OFF |
| 156 | </small> |
| 157 | {% endif %} |
| 158 | </div> |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 159 | |
| 160 | {% if (item.available and settings.show_stock_availability) or (not settings.show_stock_availability) %} |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 161 | <!-- Show move to cart button if in stock or if showing stock availability is disabled --> |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 162 | <button data-item-code="{{ item.item_code}}" |
| 163 | class="btn btn-primary btn-add-to-cart-list btn-add-to-cart mt-2 w-100"> |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 164 | <span class="mr-2"> |
| 165 | <svg class="icon icon-md"> |
| 166 | <use href="#icon-assets"></use> |
| 167 | </svg> |
| 168 | </span> |
| 169 | {{ _("Move to Cart") }} |
| 170 | </button> |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 171 | {% else %} |
marination | ef4579e | 2021-07-14 01:36:50 +0530 | [diff] [blame] | 172 | <div class="out-of-stock"> |
| 173 | {{ _("Out of stock") }} |
marination | 6026185 | 2021-04-13 00:39:26 +0530 | [diff] [blame] | 174 | </div> |
marination | 5951440 | 2021-03-16 00:05:53 +0530 | [diff] [blame] | 175 | {% endif %} |
| 176 | </div> |
| 177 | {%- endmacro -%} |
marination | b15ff57 | 2021-03-25 11:52:50 +0530 | [diff] [blame] | 178 | |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 179 | {%- macro ratings_with_title(avg_rating, title, size, rating_header_class, for_summary=False) -%} |
| 180 | <div class="{{ 'd-flex' if not for_summary else '' }}"> |
| 181 | <p class="mr-4 {{ rating_header_class }}"> |
| 182 | <span>{{ title }}</span> |
| 183 | </p> |
| 184 | <div class="rating {{ 'ratings-pill' if for_summary else ''}}"> |
marination | b15ff57 | 2021-03-25 11:52:50 +0530 | [diff] [blame] | 185 | {% for i in range(1,6) %} |
| 186 | {% set fill_class = 'star-click' if i <= avg_rating else '' %} |
| 187 | <svg class="icon icon-{{ size }} {{ fill_class }}"> |
| 188 | <use href="#icon-star"></use> |
| 189 | </svg> |
| 190 | {% endfor %} |
| 191 | </div> |
marination | b15ff57 | 2021-03-25 11:52:50 +0530 | [diff] [blame] | 192 | </div> |
| 193 | {%- endmacro -%} |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 194 | |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 195 | {%- macro ratings_summary(reviews, reviews_per_rating, average_rating, average_whole_rating, for_summary=False, total_reviews=None)-%} |
| 196 | <div class="rating-summary-section mt-4"> |
| 197 | <div class="rating-summary-numbers col-3"> |
| 198 | <h2 style="font-size: 2rem;"> |
| 199 | {{ average_rating or 0 }} |
| 200 | </h2> |
| 201 | <div class="mb-2" style="margin-top: -.5rem;"> |
marination | b4529b8 | 2021-08-09 21:00:31 +0530 | [diff] [blame] | 202 | {{ frappe.utils.cstr(total_reviews or 0) + " " + _("ratings") }} |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 203 | </div> |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 204 | |
| 205 | <!-- Ratings Summary --> |
| 206 | {% if reviews %} |
| 207 | {% set rating_title = frappe.utils.cstr(average_rating) + " " + _("out of 5") if not for_summary else ''%} |
| 208 | {{ ratings_with_title(average_whole_rating, rating_title, "md", "rating-summary-title", for_summary) }} |
| 209 | {% endif %} |
| 210 | |
| 211 | <div class="mt-2">{{ frappe.utils.cstr(average_rating or 0) + " " + _("out of 5") }}</div> |
| 212 | </div> |
| 213 | |
| 214 | <!-- Rating Progress Bars --> |
| 215 | <div class="rating-progress-bar-section col-4 ml-4"> |
| 216 | {% for percent in reviews_per_rating %} |
| 217 | <div class="col-sm-4 small rating-bar-title"> |
| 218 | {{ loop.index }} star |
| 219 | </div> |
| 220 | <div class="row"> |
| 221 | <div class="col-md-7"> |
| 222 | <div class="progress rating-progress-bar" title="{{ percent }} % of reviews are {{ loop.index }} star"> |
| 223 | <div class="progress-bar progress-bar-cosmetic" role="progressbar" |
| 224 | aria-valuenow="{{ percent }}" |
| 225 | aria-valuemin="0" aria-valuemax="100" |
| 226 | style="width: {{ percent }}%;"> |
| 227 | </div> |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 228 | </div> |
| 229 | </div> |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 230 | <div class="col-sm-1 small"> |
| 231 | {{ percent }}% |
| 232 | </div> |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 233 | </div> |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 234 | {% endfor %} |
| 235 | </div> |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 236 | </div> |
| 237 | {%- endmacro -%} |
| 238 | |
| 239 | {%- macro user_review(reviews)-%} |
| 240 | <!-- User Reviews --> |
| 241 | <div class="user-reviews"> |
| 242 | {% for review in reviews %} |
| 243 | <div class="mb-3 review"> |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 244 | {{ ratings_with_title(review.rating, _(review.review_title), "sm", "user-review-title") }} |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 245 | |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 246 | <div class="product-description mb-4"> |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 247 | <p> |
| 248 | {{ _(review.comment) }} |
| 249 | </p> |
| 250 | </div> |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 251 | |
| 252 | <div class="review-signature mb-2"> |
| 253 | <span class="reviewer">{{ _(review.customer) }}</span> |
| 254 | <span class="indicator grey" style="--text-on-gray: var(--gray-300);"></span> |
| 255 | <span class="reviewer">{{ review.published_on }}</span> |
| 256 | </div> |
marination | c842305 | 2021-04-07 23:49:04 +0530 | [diff] [blame] | 257 | </div> |
| 258 | {% endfor %} |
| 259 | </div> |
| 260 | {%- endmacro -%} |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 261 | |
| 262 | {%- macro field_filter_section(filters)-%} |
| 263 | {% for field_filter in filters %} |
| 264 | {%- set item_field = field_filter[0] %} |
| 265 | {%- set values = field_filter[1] %} |
| 266 | <div class="mb-4 filter-block pb-5"> |
| 267 | <div class="filter-label mb-3">{{ item_field.label }}</div> |
| 268 | |
| 269 | {% if values | len > 20 %} |
| 270 | <!-- show inline filter if values more than 20 --> |
marination | f6e64c2 | 2022-03-21 17:53:18 +0530 | [diff] [blame] | 271 | <input type="text" class="form-control form-control-sm mb-2 filter-lookup-input" placeholder="Search {{ item_field.label + 's' }}"/> |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 272 | {% endif %} |
| 273 | |
| 274 | {% if values %} |
| 275 | <div class="filter-options"> |
| 276 | {% for value in values %} |
marination | f6e64c2 | 2022-03-21 17:53:18 +0530 | [diff] [blame] | 277 | <div class="filter-lookup-wrapper checkbox" data-value="{{ value }}"> |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 278 | <label for="{{value}}"> |
| 279 | <input type="checkbox" |
| 280 | class="product-filter field-filter" |
| 281 | id="{{value}}" |
| 282 | data-filter-name="{{ item_field.fieldname }}" |
marination | 24c8967 | 2021-06-08 22:14:20 +0530 | [diff] [blame] | 283 | data-filter-value="{{ value }}" |
| 284 | style="width: 14px !important"> |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 285 | <span class="label-area">{{ value }}</span> |
| 286 | </label> |
| 287 | </div> |
| 288 | {% endfor %} |
| 289 | </div> |
| 290 | {% else %} |
| 291 | <i class="text-muted">{{ _('No values') }}</i> |
| 292 | {% endif %} |
| 293 | </div> |
| 294 | {% endfor %} |
| 295 | {%- endmacro -%} |
| 296 | |
| 297 | {%- macro attribute_filter_section(filters)-%} |
| 298 | {% for attribute in filters %} |
| 299 | <div class="mb-4 filter-block pb-5"> |
marination | f6e64c2 | 2022-03-21 17:53:18 +0530 | [diff] [blame] | 300 | <div class="filter-label mb-3">{{ attribute.name }}</div> |
| 301 | {% if attribute.item_attribute_values | len > 20 %} |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 302 | <!-- show inline filter if values more than 20 --> |
marination | f6e64c2 | 2022-03-21 17:53:18 +0530 | [diff] [blame] | 303 | <input type="text" class="form-control form-control-sm mb-2 filter-lookup-input" placeholder="Search {{ attribute.name + 's' }}"/> |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 304 | {% endif %} |
| 305 | |
| 306 | {% if attribute.item_attribute_values %} |
| 307 | <div class="filter-options"> |
| 308 | {% for attr_value in attribute.item_attribute_values %} |
marination | f6e64c2 | 2022-03-21 17:53:18 +0530 | [diff] [blame] | 309 | <div class="filter-lookup-wrapper checkbox" data-value="{{ attr_value }}"> |
marination | 48b3ce8 | 2021-05-13 01:22:05 +0530 | [diff] [blame] | 310 | <label data-value="{{ attr_value }}"> |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 311 | <input type="checkbox" |
| 312 | class="product-filter attribute-filter" |
marination | 9eeddc2 | 2022-02-01 12:15:48 +0530 | [diff] [blame] | 313 | id="{{ attr_value }}" |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 314 | data-attribute-name="{{ attribute.name }}" |
marination | 9eeddc2 | 2022-02-01 12:15:48 +0530 | [diff] [blame] | 315 | data-attribute-value="{{ attr_value }}" |
marination | 24c8967 | 2021-06-08 22:14:20 +0530 | [diff] [blame] | 316 | style="width: 14px !important" |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 317 | {% if attr_value.checked %} checked {% endif %}> |
marination | 9eeddc2 | 2022-02-01 12:15:48 +0530 | [diff] [blame] | 318 | <span class="label-area">{{ attr_value }}</span> |
marination | 1d94914 | 2021-04-20 21:54:52 +0530 | [diff] [blame] | 319 | </label> |
| 320 | </div> |
| 321 | {% endfor %} |
| 322 | </div> |
| 323 | {% else %} |
| 324 | <i class="text-muted">{{ _('No values') }}</i> |
| 325 | {% endif %} |
| 326 | </div> |
| 327 | {% endfor %} |
| 328 | {%- endmacro -%} |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 329 | |
| 330 | {%- macro recommended_item_row(item)-%} |
| 331 | <div class="recommended-item mb-6 d-flex"> |
| 332 | <div class="r-item-image"> |
| 333 | {% if item.website_item_thumbnail %} |
marination | 45f64bd | 2021-09-01 14:57:50 +0530 | [diff] [blame] | 334 | {{ product_image(item.website_item_thumbnail, css_class="r-product-image", alt="item.website_item_name", no_border=True) }} |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 335 | {% else %} |
marination | 45f64bd | 2021-09-01 14:57:50 +0530 | [diff] [blame] | 336 | <div class="no-image-r-item"> |
marination | 2fec068 | 2021-07-13 23:46:24 +0530 | [diff] [blame] | 337 | {{ frappe.utils.get_abbr(item.website_item_name) or "NA" }} |
| 338 | </div> |
| 339 | {% endif %} |
| 340 | </div> |
| 341 | <div class="r-item-info"> |
| 342 | <a href="/{{ item.route or '#'}}" target="_blank"> |
| 343 | {% set title = item.website_item_name %} |
| 344 | {{ title[:70] + "..." if title|len > 70 else title }} |
| 345 | </a> |
| 346 | |
| 347 | {% if item.get('price_info') %} |
| 348 | {% set price = item.get('price_info') %} |
| 349 | <div class="mt-2"> |
| 350 | <span class="item-price"> |
| 351 | {{ price.get('formatted_price') or '' }} |
| 352 | </span> |
| 353 | |
| 354 | {% if price.get('formatted_mrp') %} |
| 355 | <br> |
| 356 | <span class="striked-item-price"> |
| 357 | <s>MRP {{ price.formatted_mrp }}</s> |
| 358 | </span> |
| 359 | <span class="in-green"> |
| 360 | - {{ price.get('formatted_discount_percent') or price.get('formatted_discount_rate')}} |
| 361 | </span> |
| 362 | {% endif %} |
| 363 | </div> |
| 364 | {% endif %} |
| 365 | </div> |
| 366 | </div> |
| 367 | {%- endmacro -%} |