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