2026-05-20 02:35:48 +00:00

115 lines
5.4 KiB
HTML

<header class="fk-header">
<div class="fk-container">
<!-- TOP ROW -->
<div class="fk-top-row">
<div class="fk-top-left">
<a href="{% url 'home' %}" class="fk-brand-btn">
<span class="fk-brand-icon"></span>
<i>Hamro Karma</i>
</a>
</div>
<div class="fk-top-right">
<span class="fk-location-text">
<span class="fk-pin-icon">📍</span>
{% if delivery_location %}
{{ delivery_location }}
<a href="{% url 'settings' %}">Change location &gt;</a>
{% else %}
Location not set
<a href="{% url 'settings' %}">Select delivery location &gt;</a>
{% endif %}
</span>
</div>
</div>
<!-- MIDDLE ROW -->
<div class="fk-middle-row">
<form action="{% url 'product_list' %}" method="get" class="fk-search-bar">
<span class="fk-search-icon">🔍</span>
<input type="search" name="q" placeholder="Search for Products, Brands and More" value="{{ request.GET.q|default:'' }}">
</form>
<div class="fk-main-actions">
{% if user.is_authenticated %}
<div class="fk-dropdown-wrapper">
<a href="{% url 'profile' %}" class="fk-action-btn">
{% if user.profile.image %}
<img src="{{ user.profile.image.url }}" alt="{{ user.username }}" class="fk-user-avatar">
{% else %}
<span class="fk-user-avatar fk-avatar-fallback">👤</span>
{% endif %}
<span>{{ user.username|truncatechars:8 }}</span>
<span class="fk-caret"></span>
</a>
<div class="fk-dropdown-menu">
<a href="{% url 'profile' %}">{{ ui.my_profile|default:'My Profile' }}</a>
<a href="{% url 'my_orders' %}">{{ ui.my_orders|default:'Orders' }}</a>
<a href="{% url 'wishlist' %}">{{ ui.wishlist|default:'Wishlist' }}</a>
<a href="{% url 'logout' %}">{{ ui.logout|default:'Logout' }}</a>
</div>
</div>
{% else %}
<div class="fk-dropdown-wrapper">
<a href="{% url 'login' %}" class="fk-action-btn">
<span class="fk-user-avatar fk-avatar-fallback">👤</span>
<span>{{ ui.login|default:'Login' }}</span>
<span class="fk-caret"></span>
</a>
<div class="fk-dropdown-menu">
<a href="{% url 'register' %}">New customer? Sign Up</a>
<a href="{% url 'login' %}">{{ ui.my_profile|default:'My Profile' }}</a>
<a href="{% url 'my_orders' %}">{{ ui.my_orders|default:'Orders' }}</a>
<a href="{% url 'wishlist' %}">{{ ui.wishlist|default:'Wishlist' }}</a>
</div>
</div>
{% endif %}
<div class="fk-dropdown-wrapper">
<a href="{% url 'settings' %}" class="fk-action-btn">
More <span class="fk-caret"></span>
</a>
<div class="fk-dropdown-menu">
<a href="{% url 'settings' %}">Settings</a>
<a href="{% url 'support' %}">{{ ui.support|default:'Customer Care' }}</a>
<a href="{% url 'register' %}?seller=1">Advertise</a>
</div>
</div>
<a href="{% url 'cart' %}" class="fk-action-btn fk-cart-btn">
<span>🛒</span> {{ ui.cart|default:'Cart' }} {% if cart_count %}<span class="fk-badge">{{ cart_count }}</span>{% endif %}
</a>
</div>
</div>
</div>
</header>
<!-- BOTTOM ROW: CATEGORIES -->
<nav class="fk-category-bar">
<div class="fk-container fk-category-scroll">
<a href="{% url 'home' %}" class="fk-cat-item {% if request.resolver_match.url_name == 'home' and not request.GET.category %}active{% endif %}">
<span class="fk-cat-icon">🏠</span>
<span>{{ ui.for_you|default:'For You' }}</span>
</a>
<a href="{% url 'product_list' %}" class="fk-cat-item {% if not request.GET.category and request.resolver_match.url_name == 'product_list' %}active{% endif %}">
<span class="fk-cat-icon">🏷️</span>
<span>{{ ui.all_products|default:'All Products' }}</span>
</a>
{% for category in categories %}
<a href="{% url 'product_list' %}?category={{ category.value|urlencode }}" class="fk-cat-item {% if request.GET.category|default:''|lower == category.value|lower %}active{% endif %}">
<span class="fk-cat-icon">{{ category.icon }}</span>
<span>{{ category.name }}</span>
</a>
{% endfor %}
</div>
</nav>
<script>
window.addEventListener('scroll', function() {
if (window.scrollY > 40) {
document.body.classList.add('nav-scrolled');
} else {
document.body.classList.remove('nav-scrolled');
}
});
</script>