Spaces:
Sleeping
Sleeping
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Saved Items</title> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"> | |
| <style> | |
| /* Empty State Styles */ | |
| .empty-state { | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| min-height: 400px; | |
| text-align: center; | |
| padding: 2rem; | |
| background-color: white; | |
| border-radius: 1rem; | |
| margin: 2rem auto; | |
| max-width: 600px; | |
| } | |
| .empty-state-icon { | |
| width: 80px; | |
| height: 80px; | |
| border: 2px solid #e5e5e5; | |
| border-radius: 50%; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| margin-bottom: 1.5rem; | |
| } | |
| .empty-state-icon i { | |
| font-size: 2rem; | |
| color: #9ca3af; | |
| } | |
| .empty-state h2 { | |
| font-size: 1.5rem; | |
| color: #1a1a1a; | |
| margin-bottom: 1rem; | |
| } | |
| .empty-state p { | |
| color: #6b7280; | |
| font-size: 1.1rem; | |
| max-width: 80%; | |
| margin: 0 auto; | |
| } | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; | |
| } | |
| body { | |
| background-color: #f5f5f5; | |
| } | |
| .container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 1rem; | |
| } | |
| /* Header Styles */ | |
| .header { | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; /* Ensures items are spaced out to the edges */ | |
| margin-bottom: 1.5rem; | |
| } | |
| .header h1 { | |
| font-size: 2rem; | |
| font-weight: bold; | |
| } | |
| .header .button-group { | |
| display: flex; | |
| gap: 0.5rem; /* Adds space between buttons */ | |
| } | |
| .login-items-btn, | |
| .saved-items-btn { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.5rem; | |
| padding: 0.5rem 1rem; | |
| background-color: #2563eb; | |
| color: white; | |
| border: none; | |
| border-radius: 0.5rem; | |
| cursor: pointer; | |
| } | |
| .saved-items-btn { | |
| margin-left: auto; | |
| } | |
| /* Search Bar Styles */ | |
| .search-container { | |
| position: relative; | |
| margin-bottom: 2rem; | |
| } | |
| .search-input { | |
| width: 100%; | |
| padding: 1rem; | |
| padding-left: 3rem; | |
| border: 1px solid #e5e5e5; | |
| border-radius: 0.5rem; | |
| font-size: 1rem; | |
| box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); | |
| } | |
| .search-icon { | |
| position: absolute; | |
| left: 1rem; | |
| top: 50%; | |
| transform: translateY(-50%); | |
| color: #9ca3af; | |
| } | |
| /* View Toggle Buttons */ | |
| .view-toggle { | |
| margin-bottom: 20px; | |
| text-align: right; | |
| } | |
| .view-btn { | |
| padding: 8px 16px; | |
| margin-left: 10px; | |
| border: none; | |
| background: #fff; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| box-shadow: 0 1px 3px rgba(0,0,0,0.1); | |
| } | |
| .view-btn.active { | |
| background: #2563eb; | |
| color: white; | |
| } | |
| /* Product Grid & List Styles */ | |
| .products.grid-view { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); | |
| gap: 1.5rem; | |
| } | |
| .products.list-view { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 20px; | |
| } | |
| .product-card { | |
| background-color: white; | |
| border-radius: 0.5rem; | |
| overflow: hidden; | |
| box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); | |
| transition: box-shadow 0.3s ease; | |
| } | |
| .product-card.grid { | |
| display: block; | |
| } | |
| .product-card.list { | |
| display: grid; | |
| grid-template-columns: 200px 1fr; | |
| } | |
| .product-card:hover { | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| } | |
| .product-image { | |
| position: relative; | |
| height: 200px; | |
| } | |
| .product-card .product-image img { | |
| object-fit: contain; /* Adjust image fit for better visibility */ | |
| background-color: #f9f9f9; /* Optional: add a background color */ | |
| } | |
| .product-image img { | |
| width: 100%; | |
| height: 100%; | |
| object-fit: cover; | |
| } | |
| .favorite-btn { | |
| position: absolute; | |
| top: 1rem; | |
| right: 1rem; | |
| padding: 0.5rem; | |
| background-color: white; | |
| border: none; | |
| border-radius: 9999px; | |
| box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | |
| cursor: pointer; | |
| } | |
| .product-content { | |
| padding: 1rem; | |
| } | |
| .product-header { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: flex-start; | |
| margin-bottom: 0.5rem; | |
| } | |
| .product-title { | |
| font-size: 1.25rem; | |
| font-weight: 600; | |
| } | |
| .rating { | |
| display: flex; | |
| align-items: center; | |
| gap: 0.25rem; | |
| } | |
| .star-icon { | |
| color: #fbbf24; | |
| } | |
| .price-comparison { | |
| margin-top: 1rem; | |
| } | |
| .price-item { | |
| padding: 0.75rem; | |
| border-radius: 0.5rem; | |
| margin-bottom: 0.75rem; | |
| background-color: #f9fafb; | |
| } | |
| .price-item:first-child { | |
| background-color: #ecfdf5; | |
| } | |
| .store-info { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .price { | |
| font-size: 1.25rem; | |
| font-weight: bold; | |
| color: #059669; | |
| } | |
| .view-offers-btn { | |
| width: 100%; | |
| padding: 0.5rem; | |
| margin-top: 1rem; | |
| background-color: #2563eb; | |
| color: white; | |
| border: none; | |
| border-radius: 0.5rem; | |
| cursor: pointer; | |
| transition: background-color 0.3s ease; | |
| } | |
| .view-offers-btn:hover { | |
| background-color: #1d4ed8; | |
| } | |
| @media (max-width: 768px) { | |
| .product-card.list { | |
| grid-template-columns: 1fr; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <!-- Header --> | |
| <div class="header"> | |
| <a href="{{ url_for('home') }}" style="color: inherit; text-decoration: none;"> | |
| <h1>Medicine Price Comparison</h1> | |
| </a> | |
| <div class="button-group"> | |
| <a href="{{ url_for('saved_items') }}"> | |
| <button class="saved-items-btn"> | |
| <i class="fas fa-shopping-cart"></i> Saved Items | |
| </button> | |
| </a> | |
| <button class="login-items-btn"> | |
| <i class="fas fa-user"></i> | |
| <a href="{{ url_for('login') if not username else '#' }}" style="color: inherit; text-decoration: none;"> | |
| Hello, {{ username if username else 'Login' }} | |
| </a> | |
| </button> | |
| {% if username %} | |
| <a href="{{ url_for('logout') }}"> | |
| <button class="login-items-btn"> | |
| Logout | |
| </button> | |
| </a> | |
| {% endif %} | |
| </div> | |
| </div> | |
| <!-- Search Bar --> | |
| <div class="search-container"> | |
| <form action="/search" method="post"> | |
| <input type="text" name="query" class="search-input" placeholder="Search for medicines ..."> | |
| <i class="fas fa-search search-icon"></i> | |
| </form> | |
| </div> | |
| <!-- View Toggle --> | |
| <div class="view-toggle"> | |
| <button class="view-btn grid-btn active" onclick="toggleView('grid')"> | |
| <i class="fas fa-th"></i> Grid | |
| </button> | |
| <button class="view-btn list-btn" onclick="toggleView('list')"> | |
| <i class="fas fa-list"></i> List | |
| </button> | |
| </div> | |
| <h1>Saved Items</h1><br><br> | |
| <div class="products grid-view" id="products-container"> | |
| {% if saved_items %} | |
| {% for item in saved_items %} | |
| <div class="product-card grid"> | |
| <div class="product-image"> | |
| <img src="{{ item['img'] }}" alt="{{ item['name'] }}"> | |
| <button class="favorite-btn"> | |
| <i class="fa-solid fa-heart"></i> | |
| </button> | |
| </div> | |
| <div class="product-content"> | |
| <div class="product-header"> | |
| <p><strong>{{ item['name'] }}</strong></p> | |
| </div> | |
| <div class="price-comparison"> | |
| {% if item.amazon.link %} | |
| <a href="{{ item.amazon.link }}" target="_blank" style="color: inherit; text-decoration: none;"> | |
| <div class="price-item"> | |
| <div class="store-info"> | |
| <div> | |
| <h3>Amazon:</h3> | |
| <div class="name-info"> | |
| {{ item.amazon.name }} | |
| </div> | |
| </div> | |
| <div class="price"> | |
| <p>Price:{{ item.amazon.price }}</p> | |
| </div> | |
| </div> | |
| </div> | |
| </a> | |
| {% endif %} | |
| {% if item.one_mg.link %} | |
| <a href="{{ item.one_mg.link }}" target="_blank" style="color: inherit; text-decoration: none;"> | |
| <div class="price-item"> | |
| <div class="store-info"> | |
| <div> | |
| <h3>Amazon:</h3> | |
| <div class="name-info"> | |
| {{ item.one_mg.name }} | |
| </div> | |
| </div> | |
| <div class="price"> | |
| <p>Price:{{ item.one_mg.price }}</p> | |
| </div> | |
| </div> | |
| </div> | |
| </a> | |
| {% endif %} | |
| {% if item.netmeds.link %} | |
| <a href="{{ item.netmeds.link }}" target="_blank" style="color: inherit; text-decoration: none;"> | |
| <div class="price-item"> | |
| <div class="store-info"> | |
| <div> | |
| <h3>Amazon:</h3> | |
| <div class="name-info"> | |
| {{ item.netmeds.name }} | |
| </div> | |
| </div> | |
| <div class="price"> | |
| <p>Price:{{ item.netmeds.price }}</p> | |
| </div> | |
| </div> | |
| </div> | |
| </a> | |
| {% endif %} | |
| {% if item.pharmeasy.link %} | |
| <a href="{{ item.pharmeasy.link }}" target="_blank" style="color: inherit; text-decoration: none;"> | |
| <div class="price-item"> | |
| <div class="store-info"> | |
| <div> | |
| <h3>Amazon:</h3> | |
| <div class="name-info"> | |
| {{ item.pharmeasy.name }} | |
| </div> | |
| </div> | |
| <div class="price"> | |
| <p>Price:{{ item.pharmeasy.price }}</p> | |
| </div> | |
| </div> | |
| </div> | |
| </a> | |
| {% endif %} | |
| </div> | |
| </div> | |
| </div> | |
| {% endfor %} | |
| {% else %} | |
| <!-- Empty State --> | |
| <div class="empty-state"> | |
| <div class="empty-state-icon"> | |
| <i class="fas fa-bookmark"></i> | |
| </div> | |
| <h2>Nothing saved yet</h2> | |
| <p>All the posts and items you've saved will show up here.</p> | |
| </div> | |
| {% endif %} | |
| </div> | |
| </div> | |
| <script> | |
| // Toggle between grid and list views | |
| function toggleView(viewType) { | |
| const productsContainer = document.getElementById("products-container"); | |
| const gridBtn = document.querySelector(".grid-btn"); | |
| const listBtn = document.querySelector(".list-btn"); | |
| if (viewType === 'grid') { | |
| productsContainer.classList.add("grid-view"); | |
| productsContainer.classList.remove("list-view"); | |
| gridBtn.classList.add("active"); | |
| listBtn.classList.remove("active"); | |
| } else { | |
| productsContainer.classList.remove("grid-view"); | |
| productsContainer.classList.add("list-view"); | |
| listBtn.classList.add("active"); | |
| gridBtn.classList.remove("active"); | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |