Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,6 +34,35 @@ st.markdown("""
|
|
| 34 |
display: none !important;
|
| 35 |
}
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
/* === BARRA DE NAVEGACIÓN CENTRADA === */
|
| 38 |
.nav-container {
|
| 39 |
display: flex;
|
|
@@ -88,29 +117,6 @@ st.markdown("""
|
|
| 88 |
border-right: 1px solid #eee;
|
| 89 |
}
|
| 90 |
|
| 91 |
-
[data-testid="stSidebar"] .stButton button {
|
| 92 |
-
width: 100%;
|
| 93 |
-
text-align: left;
|
| 94 |
-
background: transparent !important;
|
| 95 |
-
border: none !important;
|
| 96 |
-
border-bottom: 1px solid #f5f5f5 !important;
|
| 97 |
-
padding: 15px 0 !important;
|
| 98 |
-
border-radius: 0 !important;
|
| 99 |
-
font-size: 13px;
|
| 100 |
-
text-transform: uppercase;
|
| 101 |
-
letter-spacing: 2px;
|
| 102 |
-
color: black;
|
| 103 |
-
font-weight: 400;
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
[data-testid="stSidebar"] .stButton button:hover {
|
| 107 |
-
font-weight: 700;
|
| 108 |
-
padding-left: 10px !important;
|
| 109 |
-
transition: 0.2s;
|
| 110 |
-
background: transparent !important;
|
| 111 |
-
border-bottom: 1px solid #000 !important;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
/* === BOTONES === */
|
| 115 |
button[kind="primary"] {
|
| 116 |
background-color: #000000 !important;
|
|
@@ -126,10 +132,6 @@ st.markdown("""
|
|
| 126 |
width: 100%;
|
| 127 |
}
|
| 128 |
|
| 129 |
-
button[kind="primary"]:hover {
|
| 130 |
-
background-color: #333 !important;
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
button[kind="secondary"] {
|
| 134 |
background-color: #ffffff !important;
|
| 135 |
color: #000000 !important;
|
|
@@ -142,10 +144,6 @@ st.markdown("""
|
|
| 142 |
width: 100%;
|
| 143 |
}
|
| 144 |
|
| 145 |
-
button[kind="secondary"]:hover {
|
| 146 |
-
border-color: #000 !important;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
/* === INPUTS === */
|
| 150 |
[data-testid="stTextInput"] input {
|
| 151 |
border: none !important;
|
|
@@ -155,26 +153,28 @@ st.markdown("""
|
|
| 155 |
background: transparent !important;
|
| 156 |
box-shadow: none !important;
|
| 157 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
-
/
|
| 160 |
-
.
|
| 161 |
-
|
| 162 |
-
}
|
| 163 |
-
|
| 164 |
-
.stImage {
|
| 165 |
-
margin-bottom: 10px;
|
| 166 |
}
|
| 167 |
|
| 168 |
-
/
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
padding: 0 !important;
|
| 175 |
-
color: #000 !important;
|
| 176 |
-
}
|
| 177 |
-
</style>
|
| 178 |
""", unsafe_allow_html=True)
|
| 179 |
|
| 180 |
# --- 4. CONEXIÓN DATOS ---
|
|
@@ -203,22 +203,13 @@ def cargar_catalogo():
|
|
| 203 |
sh = client.open_by_url(SHEET_URL)
|
| 204 |
df = pd.DataFrame(sh.worksheet(HOJA_NOMBRE).get_all_records())
|
| 205 |
|
| 206 |
-
# Debug: Ver qué columnas tiene
|
| 207 |
-
st.sidebar.write("Columnas encontradas:", list(df.columns))
|
| 208 |
-
|
| 209 |
if 'Imagen' not in df.columns:
|
| 210 |
-
st.error("No se encontró la columna 'Imagen'")
|
| 211 |
return pd.DataFrame()
|
| 212 |
|
| 213 |
df['Imagen'] = df['Imagen'].astype(str)
|
| 214 |
df = df[df['Imagen'].str.strip().str.startswith(('http://', 'https://'))]
|
| 215 |
-
|
| 216 |
-
# Debug: Ver cuántos productos se cargaron
|
| 217 |
-
st.sidebar.write(f"Productos cargados: {len(df)}")
|
| 218 |
-
|
| 219 |
return df
|
| 220 |
except Exception as e:
|
| 221 |
-
st.error(f"Error cargando catálogo: {str(e)}")
|
| 222 |
return pd.DataFrame()
|
| 223 |
|
| 224 |
# --- ESTADOS ---
|
|
@@ -239,78 +230,59 @@ search_icon = get_image_base64("search.png")
|
|
| 239 |
wish_icon = get_image_base64("wish.png")
|
| 240 |
bag_icon = get_image_base64("bag.png")
|
| 241 |
|
| 242 |
-
#
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
</div>
|
| 269 |
-
""
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
nav_html = """
|
| 273 |
-
<div class="nav-container">
|
| 274 |
-
<div class="nav-left">
|
| 275 |
-
<span class="nav-icon" onclick="document.getElementById('nav_menu_btn').click();" style="font-size:24px;">☰</span>
|
| 276 |
-
<span class="nav-icon" onclick="document.getElementById('nav_search_btn').click();" style="font-size:24px;">🔍</span>
|
| 277 |
-
</div>
|
| 278 |
-
<div class="nav-center">
|
| 279 |
-
<span class="brand-logo" onclick="window.location.reload()">ARZON STUDIOS</span>
|
| 280 |
-
</div>
|
| 281 |
-
<div class="nav-right">
|
| 282 |
-
<span class="nav-icon" onclick="document.getElementById('nav_wish_btn').click();" style="font-size:24px;">🔖</span>
|
| 283 |
-
<span class="nav-icon" onclick="document.getElementById('nav_bag_btn').click();" style="font-size:24px;">🛍️</span>
|
| 284 |
-
</div>
|
| 285 |
</div>
|
| 286 |
-
|
|
|
|
| 287 |
|
| 288 |
st.markdown(nav_html, unsafe_allow_html=True)
|
| 289 |
|
| 290 |
-
# --- BOTONES OCULTOS ---
|
| 291 |
-
col1, col2, col3, col4 = st.columns(4)
|
| 292 |
-
with col1:
|
| 293 |
-
if st.button("menu_hidden", key="nav_menu_btn"):
|
| 294 |
-
st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None
|
| 295 |
-
st.session_state.search_open = False
|
| 296 |
-
st.rerun()
|
| 297 |
-
with col2:
|
| 298 |
-
if st.button("search_hidden", key="nav_search_btn"):
|
| 299 |
-
st.session_state.search_open = not st.session_state.search_open
|
| 300 |
-
st.session_state.active_drawer = None
|
| 301 |
-
st.rerun()
|
| 302 |
-
with col3:
|
| 303 |
-
if st.button("wish_hidden", key="nav_wish_btn"):
|
| 304 |
-
st.session_state.page = 'wishlist'
|
| 305 |
-
st.session_state.active_drawer = None
|
| 306 |
-
st.session_state.search_open = False
|
| 307 |
-
st.rerun()
|
| 308 |
-
with col4:
|
| 309 |
-
if st.button("bag_hidden", key="nav_bag_btn"):
|
| 310 |
-
st.session_state.active_drawer = 'cart' if st.session_state.active_drawer != 'cart' else None
|
| 311 |
-
st.session_state.search_open = False
|
| 312 |
-
st.rerun()
|
| 313 |
-
|
| 314 |
# === SEARCH OVERLAY ===
|
| 315 |
if st.session_state.search_open:
|
| 316 |
st.markdown("<br>", unsafe_allow_html=True)
|
|
@@ -355,7 +327,7 @@ if st.session_state.active_drawer:
|
|
| 355 |
cats += sorted([c for c in df['Categoria'].unique() if pd.notna(c)])
|
| 356 |
|
| 357 |
for cat in cats:
|
| 358 |
-
if st.button(cat, key=f"cat_{cat}"):
|
| 359 |
st.session_state.category_filter = cat
|
| 360 |
st.session_state.page = 'home'
|
| 361 |
st.session_state.active_drawer = None
|
|
@@ -364,7 +336,7 @@ if st.session_state.active_drawer:
|
|
| 364 |
elif st.session_state.active_drawer == 'cart':
|
| 365 |
if not st.session_state.cart:
|
| 366 |
st.markdown("<div style='text-align:center; margin:60px 0;'>Your bag is empty</div>", unsafe_allow_html=True)
|
| 367 |
-
if st.button("CONTINUE SHOPPING", key="cont_shop", type="primary"):
|
| 368 |
st.session_state.active_drawer = None
|
| 369 |
st.rerun()
|
| 370 |
else:
|
|
@@ -386,27 +358,16 @@ if st.session_state.active_drawer:
|
|
| 386 |
pass
|
| 387 |
st.divider()
|
| 388 |
|
| 389 |
-
st.markdown(f"<div style='display:flex; justify-content:space-between; font-weight:bold;'><span>TOTAL</span><span>${total:,.2f}</span></div>", unsafe_allow_html=True)
|
| 390 |
msg = f"PEDIDO ARZON: Total ${total}"
|
| 391 |
link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={quote_plus(msg)}"
|
| 392 |
st.link_button("CHECKOUT", link, type="primary", use_container_width=True)
|
| 393 |
|
| 394 |
# === VISTA PRINCIPAL - PRODUCTOS ===
|
| 395 |
if st.session_state.page == 'home':
|
| 396 |
-
st.markdown("<div class='product-grid'>", unsafe_allow_html=True)
|
| 397 |
-
|
| 398 |
if df.empty:
|
| 399 |
-
st.warning("
|
| 400 |
-
|
| 401 |
-
# Mostrar datos de ejemplo para debug
|
| 402 |
-
st.info("""
|
| 403 |
-
**Instrucciones:**
|
| 404 |
-
1. Asegúrate que tu Google Sheet tenga estas columnas exactas: ID, Producto, Precio, Imagen, Categoria, Tallas, Descripcion
|
| 405 |
-
2. La columna 'Imagen' debe contener URLs válidas de imágenes
|
| 406 |
-
3. Comparte el sheet con: gestor-rifa@trhhats.iam.gserviceaccount.com
|
| 407 |
-
""")
|
| 408 |
else:
|
| 409 |
-
# Filtrar productos
|
| 410 |
df_show = df.copy()
|
| 411 |
|
| 412 |
if st.session_state.category_filter != "VIEW ALL":
|
|
@@ -418,18 +379,15 @@ if st.session_state.page == 'home':
|
|
| 418 |
if df_show.empty:
|
| 419 |
st.info("No products found")
|
| 420 |
else:
|
| 421 |
-
# Grid de 3 columnas
|
| 422 |
cols = st.columns(3, gap="large")
|
| 423 |
|
| 424 |
for idx, row in df_show.iterrows():
|
| 425 |
with cols[idx % 3]:
|
| 426 |
-
# Imagen
|
| 427 |
try:
|
| 428 |
st.image(row['Imagen'], use_container_width=True)
|
| 429 |
except:
|
| 430 |
-
st.image("https://via.placeholder.com/400x500?text=ARZON
|
| 431 |
|
| 432 |
-
# Información del producto
|
| 433 |
st.markdown(f"""
|
| 434 |
<div style='text-align:center; margin-top:15px;'>
|
| 435 |
<div style='font-weight:600; font-size:14px; margin-bottom:5px;'>{row['Producto']}</div>
|
|
@@ -437,20 +395,15 @@ if st.session_state.page == 'home':
|
|
| 437 |
</div>
|
| 438 |
""", unsafe_allow_html=True)
|
| 439 |
|
| 440 |
-
# Botón Shop Now
|
| 441 |
if st.button("SHOP NOW", key=f"shop_{row['ID']}", type="secondary", use_container_width=True):
|
| 442 |
st.session_state.selected_product = row.to_dict()
|
| 443 |
st.session_state.page = 'product'
|
| 444 |
st.rerun()
|
| 445 |
-
|
| 446 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 447 |
|
| 448 |
-
# === VISTA DE PRODUCTO ===
|
| 449 |
elif st.session_state.page == 'product':
|
| 450 |
if st.session_state.selected_product:
|
| 451 |
p = st.session_state.selected_product
|
| 452 |
|
| 453 |
-
# Botón back
|
| 454 |
if st.button("← BACK TO SHOP", key="back_btn"):
|
| 455 |
st.session_state.page = 'home'
|
| 456 |
st.rerun()
|
|
@@ -461,17 +414,15 @@ elif st.session_state.page == 'product':
|
|
| 461 |
try:
|
| 462 |
st.image(p['Imagen'], use_container_width=True)
|
| 463 |
except:
|
| 464 |
-
st.image("https://via.placeholder.com/600x700?text=ARZON
|
| 465 |
|
| 466 |
with col_info:
|
| 467 |
st.markdown(f"<h1 style='font-size:32px; margin-bottom:10px;'>{p['Producto']}</h1>", unsafe_allow_html=True)
|
| 468 |
st.markdown(f"<h2 style='font-size:24px; font-weight:400; margin-bottom:20px;'>${p['Precio']} MXN</h2>", unsafe_allow_html=True)
|
| 469 |
|
| 470 |
-
# Tallas
|
| 471 |
tallas = [t.strip() for t in str(p.get('Tallas', 'ONE SIZE')).split(',')]
|
| 472 |
size = st.selectbox("SELECT SIZE", tallas)
|
| 473 |
|
| 474 |
-
# Botón Add to Bag
|
| 475 |
if st.button("ADD TO BAG", type="primary", use_container_width=True):
|
| 476 |
st.session_state.cart.append({
|
| 477 |
"id": p['ID'],
|
|
@@ -485,13 +436,9 @@ elif st.session_state.page == 'product':
|
|
| 485 |
st.rerun()
|
| 486 |
|
| 487 |
st.divider()
|
| 488 |
-
|
| 489 |
-
# Descripción
|
| 490 |
st.markdown("**DESCRIPTION**")
|
| 491 |
-
|
| 492 |
-
st.caption(descripcion)
|
| 493 |
|
| 494 |
-
# === VISTA WISHLIST ===
|
| 495 |
elif st.session_state.page == 'wishlist':
|
| 496 |
st.markdown("<h1 style='text-align:center; font-size:28px; margin:40px 0;'>WISHLIST</h1>", unsafe_allow_html=True)
|
| 497 |
|
|
|
|
| 34 |
display: none !important;
|
| 35 |
}
|
| 36 |
|
| 37 |
+
/* OCULTAR COMPLETAMENTE LOS BOTONES HIDDEN */
|
| 38 |
+
.hidden-buttons {
|
| 39 |
+
display: none !important;
|
| 40 |
+
visibility: hidden !important;
|
| 41 |
+
height: 0 !important;
|
| 42 |
+
width: 0 !important;
|
| 43 |
+
position: absolute !important;
|
| 44 |
+
top: -9999px !important;
|
| 45 |
+
left: -9999px !important;
|
| 46 |
+
pointer-events: none !important;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/* FORZAR OCULTAR CUALQUIER BOTÓN CON ESTAS CLASES */
|
| 50 |
+
button[key*="nav_menu_btn"],
|
| 51 |
+
button[key*="nav_search_btn"],
|
| 52 |
+
button[key*="nav_wish_btn"],
|
| 53 |
+
button[key*="nav_bag_btn"],
|
| 54 |
+
button[key*="_hidden"] {
|
| 55 |
+
display: none !important;
|
| 56 |
+
position: absolute !important;
|
| 57 |
+
opacity: 0 !important;
|
| 58 |
+
height: 0 !important;
|
| 59 |
+
width: 0 !important;
|
| 60 |
+
padding: 0 !important;
|
| 61 |
+
margin: 0 !important;
|
| 62 |
+
border: none !important;
|
| 63 |
+
pointer-events: none !important;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
/* === BARRA DE NAVEGACIÓN CENTRADA === */
|
| 67 |
.nav-container {
|
| 68 |
display: flex;
|
|
|
|
| 117 |
border-right: 1px solid #eee;
|
| 118 |
}
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
/* === BOTONES === */
|
| 121 |
button[kind="primary"] {
|
| 122 |
background-color: #000000 !important;
|
|
|
|
| 132 |
width: 100%;
|
| 133 |
}
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
button[kind="secondary"] {
|
| 136 |
background-color: #ffffff !important;
|
| 137 |
color: #000000 !important;
|
|
|
|
| 144 |
width: 100%;
|
| 145 |
}
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
/* === INPUTS === */
|
| 148 |
[data-testid="stTextInput"] input {
|
| 149 |
border: none !important;
|
|
|
|
| 153 |
background: transparent !important;
|
| 154 |
box-shadow: none !important;
|
| 155 |
}
|
| 156 |
+
</style>
|
| 157 |
+
|
| 158 |
+
<!-- JavaScript para manejar los clicks en los iconos -->
|
| 159 |
+
<script>
|
| 160 |
+
function handleNavClick(action) {
|
| 161 |
+
// Crear un evento personalizado que Streamlit pueda detectar
|
| 162 |
+
const event = new CustomEvent("streamlit:navClick", {
|
| 163 |
+
detail: { action: action }
|
| 164 |
+
});
|
| 165 |
+
window.dispatchEvent(event);
|
| 166 |
|
| 167 |
+
// También podemos enviar directamente a Streamlit
|
| 168 |
+
if (window.Streamlit) {
|
| 169 |
+
window.Streamlit.setComponentValue("nav_" + action, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
+
// Forzar rerun
|
| 173 |
+
setTimeout(function() {
|
| 174 |
+
window.location.reload();
|
| 175 |
+
}, 100);
|
| 176 |
+
}
|
| 177 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
""", unsafe_allow_html=True)
|
| 179 |
|
| 180 |
# --- 4. CONEXIÓN DATOS ---
|
|
|
|
| 203 |
sh = client.open_by_url(SHEET_URL)
|
| 204 |
df = pd.DataFrame(sh.worksheet(HOJA_NOMBRE).get_all_records())
|
| 205 |
|
|
|
|
|
|
|
|
|
|
| 206 |
if 'Imagen' not in df.columns:
|
|
|
|
| 207 |
return pd.DataFrame()
|
| 208 |
|
| 209 |
df['Imagen'] = df['Imagen'].astype(str)
|
| 210 |
df = df[df['Imagen'].str.strip().str.startswith(('http://', 'https://'))]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
return df
|
| 212 |
except Exception as e:
|
|
|
|
| 213 |
return pd.DataFrame()
|
| 214 |
|
| 215 |
# --- ESTADOS ---
|
|
|
|
| 230 |
wish_icon = get_image_base64("wish.png")
|
| 231 |
bag_icon = get_image_base64("bag.png")
|
| 232 |
|
| 233 |
+
# --- FUNCIONES PARA MANEJAR NAVEGACIÓN ---
|
| 234 |
+
def handle_menu():
|
| 235 |
+
st.session_state.active_drawer = 'menu' if st.session_state.active_drawer != 'menu' else None
|
| 236 |
+
st.session_state.search_open = False
|
| 237 |
+
st.rerun()
|
| 238 |
+
|
| 239 |
+
def handle_search():
|
| 240 |
+
st.session_state.search_open = not st.session_state.search_open
|
| 241 |
+
st.session_state.active_drawer = None
|
| 242 |
+
st.rerun()
|
| 243 |
+
|
| 244 |
+
def handle_wishlist():
|
| 245 |
+
st.session_state.page = 'wishlist'
|
| 246 |
+
st.session_state.active_drawer = None
|
| 247 |
+
st.session_state.search_open = False
|
| 248 |
+
st.rerun()
|
| 249 |
|
| 250 |
+
def handle_bag():
|
| 251 |
+
st.session_state.active_drawer = 'cart' if st.session_state.active_drawer != 'cart' else None
|
| 252 |
+
st.session_state.search_open = False
|
| 253 |
+
st.rerun()
|
| 254 |
+
|
| 255 |
+
# --- BOTONES INVISIBLES (solo para mantener el estado) ---
|
| 256 |
+
# Estos botones existen pero están ocultos por CSS
|
| 257 |
+
col_hidden = st.columns(4)
|
| 258 |
+
with col_hidden[0]:
|
| 259 |
+
st.button("menu", key="nav_menu_btn", on_click=handle_menu)
|
| 260 |
+
with col_hidden[1]:
|
| 261 |
+
st.button("search", key="nav_search_btn", on_click=handle_search)
|
| 262 |
+
with col_hidden[2]:
|
| 263 |
+
st.button("wish", key="nav_wish_btn", on_click=handle_wishlist)
|
| 264 |
+
with col_hidden[3]:
|
| 265 |
+
st.button("bag", key="nav_bag_btn", on_click=handle_bag)
|
| 266 |
+
|
| 267 |
+
# --- NAVEGACIÓN VISIBLE CON ICONOS PNG ---
|
| 268 |
+
nav_html = f"""
|
| 269 |
+
<div class="nav-container">
|
| 270 |
+
<div class="nav-left">
|
| 271 |
+
<img src="data:image/png;base64,{menu_icon}" class="nav-icon" onclick="document.getElementById('nav_menu_btn').click();" alt="Menu">
|
| 272 |
+
<img src="data:image/png;base64,{search_icon}" class="nav-icon" onclick="document.getElementById('nav_search_btn').click();" alt="Search">
|
| 273 |
+
</div>
|
| 274 |
+
<div class="nav-center">
|
| 275 |
+
<span class="brand-logo" onclick="window.location.reload()">ARZON STUDIOS</span>
|
| 276 |
</div>
|
| 277 |
+
<div class="nav-right">
|
| 278 |
+
<img src="data:image/png;base64,{wish_icon}" class="nav-icon" onclick="document.getElementById('nav_wish_btn').click();" alt="Wishlist">
|
| 279 |
+
<img src="data:image/png;base64,{bag_icon}" class="nav-icon" onclick="document.getElementById('nav_bag_btn').click();" alt="Bag">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
</div>
|
| 281 |
+
</div>
|
| 282 |
+
"""
|
| 283 |
|
| 284 |
st.markdown(nav_html, unsafe_allow_html=True)
|
| 285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
# === SEARCH OVERLAY ===
|
| 287 |
if st.session_state.search_open:
|
| 288 |
st.markdown("<br>", unsafe_allow_html=True)
|
|
|
|
| 327 |
cats += sorted([c for c in df['Categoria'].unique() if pd.notna(c)])
|
| 328 |
|
| 329 |
for cat in cats:
|
| 330 |
+
if st.button(cat, key=f"cat_{cat}", use_container_width=True):
|
| 331 |
st.session_state.category_filter = cat
|
| 332 |
st.session_state.page = 'home'
|
| 333 |
st.session_state.active_drawer = None
|
|
|
|
| 336 |
elif st.session_state.active_drawer == 'cart':
|
| 337 |
if not st.session_state.cart:
|
| 338 |
st.markdown("<div style='text-align:center; margin:60px 0;'>Your bag is empty</div>", unsafe_allow_html=True)
|
| 339 |
+
if st.button("CONTINUE SHOPPING", key="cont_shop", type="primary", use_container_width=True):
|
| 340 |
st.session_state.active_drawer = None
|
| 341 |
st.rerun()
|
| 342 |
else:
|
|
|
|
| 358 |
pass
|
| 359 |
st.divider()
|
| 360 |
|
| 361 |
+
st.markdown(f"<div style='display:flex; justify-content:space-between; font-weight:bold; margin-bottom:15px;'><span>TOTAL</span><span>${total:,.2f}</span></div>", unsafe_allow_html=True)
|
| 362 |
msg = f"PEDIDO ARZON: Total ${total}"
|
| 363 |
link = f"https://api.whatsapp.com/send?phone={WHATSAPP_VENTAS}&text={quote_plus(msg)}"
|
| 364 |
st.link_button("CHECKOUT", link, type="primary", use_container_width=True)
|
| 365 |
|
| 366 |
# === VISTA PRINCIPAL - PRODUCTOS ===
|
| 367 |
if st.session_state.page == 'home':
|
|
|
|
|
|
|
| 368 |
if df.empty:
|
| 369 |
+
st.warning("No se pudieron cargar los productos. Verifica la conexión con Google Sheets.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
else:
|
|
|
|
| 371 |
df_show = df.copy()
|
| 372 |
|
| 373 |
if st.session_state.category_filter != "VIEW ALL":
|
|
|
|
| 379 |
if df_show.empty:
|
| 380 |
st.info("No products found")
|
| 381 |
else:
|
|
|
|
| 382 |
cols = st.columns(3, gap="large")
|
| 383 |
|
| 384 |
for idx, row in df_show.iterrows():
|
| 385 |
with cols[idx % 3]:
|
|
|
|
| 386 |
try:
|
| 387 |
st.image(row['Imagen'], use_container_width=True)
|
| 388 |
except:
|
| 389 |
+
st.image("https://via.placeholder.com/400x500?text=ARZON", use_container_width=True)
|
| 390 |
|
|
|
|
| 391 |
st.markdown(f"""
|
| 392 |
<div style='text-align:center; margin-top:15px;'>
|
| 393 |
<div style='font-weight:600; font-size:14px; margin-bottom:5px;'>{row['Producto']}</div>
|
|
|
|
| 395 |
</div>
|
| 396 |
""", unsafe_allow_html=True)
|
| 397 |
|
|
|
|
| 398 |
if st.button("SHOP NOW", key=f"shop_{row['ID']}", type="secondary", use_container_width=True):
|
| 399 |
st.session_state.selected_product = row.to_dict()
|
| 400 |
st.session_state.page = 'product'
|
| 401 |
st.rerun()
|
|
|
|
|
|
|
| 402 |
|
|
|
|
| 403 |
elif st.session_state.page == 'product':
|
| 404 |
if st.session_state.selected_product:
|
| 405 |
p = st.session_state.selected_product
|
| 406 |
|
|
|
|
| 407 |
if st.button("← BACK TO SHOP", key="back_btn"):
|
| 408 |
st.session_state.page = 'home'
|
| 409 |
st.rerun()
|
|
|
|
| 414 |
try:
|
| 415 |
st.image(p['Imagen'], use_container_width=True)
|
| 416 |
except:
|
| 417 |
+
st.image("https://via.placeholder.com/600x700?text=ARZON", use_container_width=True)
|
| 418 |
|
| 419 |
with col_info:
|
| 420 |
st.markdown(f"<h1 style='font-size:32px; margin-bottom:10px;'>{p['Producto']}</h1>", unsafe_allow_html=True)
|
| 421 |
st.markdown(f"<h2 style='font-size:24px; font-weight:400; margin-bottom:20px;'>${p['Precio']} MXN</h2>", unsafe_allow_html=True)
|
| 422 |
|
|
|
|
| 423 |
tallas = [t.strip() for t in str(p.get('Tallas', 'ONE SIZE')).split(',')]
|
| 424 |
size = st.selectbox("SELECT SIZE", tallas)
|
| 425 |
|
|
|
|
| 426 |
if st.button("ADD TO BAG", type="primary", use_container_width=True):
|
| 427 |
st.session_state.cart.append({
|
| 428 |
"id": p['ID'],
|
|
|
|
| 436 |
st.rerun()
|
| 437 |
|
| 438 |
st.divider()
|
|
|
|
|
|
|
| 439 |
st.markdown("**DESCRIPTION**")
|
| 440 |
+
st.caption(p.get('Descripcion', 'No description available'))
|
|
|
|
| 441 |
|
|
|
|
| 442 |
elif st.session_state.page == 'wishlist':
|
| 443 |
st.markdown("<h1 style='text-align:center; font-size:28px; margin:40px 0;'>WISHLIST</h1>", unsafe_allow_html=True)
|
| 444 |
|