k96beni commited on
Commit
fd92e6f
·
verified ·
1 Parent(s): c0f66bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -30
app.py CHANGED
@@ -1424,6 +1424,38 @@ if 'log_sheets' not in st.session_state:
1424
  if 'show_admin' not in st.session_state:
1425
  st.session_state.show_admin = False
1426
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1427
  # ============================================================================
1428
  # MAIN APP
1429
  # ============================================================================
@@ -1667,36 +1699,7 @@ else:
1667
  col_status = st.columns(1)[0]
1668
 
1669
  with col_status:
1670
- # Visa bara saving_in_progress för MANUELLA operationer (Excel upload)
1671
- if st.session_state.saving_in_progress:
1672
- st.markdown("""
1673
- <div class='auto-save-indicator saving'>
1674
- 💾 Sparar Excel-ändringar...
1675
- </div>
1676
- """, unsafe_allow_html=True)
1677
-
1678
- elif st.session_state.last_save_time:
1679
- time_diff = (datetime.now() - st.session_state.last_save_time).total_seconds()
1680
- print(f"[DEBUG] Time since last save: {time_diff} seconds")
1681
-
1682
- if time_diff < 3: # Visa "Sparad" i 3 sekunder
1683
- st.markdown("""
1684
- <div class='auto-save-indicator saved'>
1685
- ✅ Sparad automatiskt!
1686
- </div>
1687
- """, unsafe_allow_html=True)
1688
- else:
1689
- st.markdown("""
1690
- <div class='auto-save-indicator'>
1691
- 💾 Auto-sparar vid ändringar
1692
- </div>
1693
- """, unsafe_allow_html=True)
1694
- else:
1695
- st.markdown("""
1696
- <div class='auto-save-indicator'>
1697
- 💾 Auto-sparar vid ändringar
1698
- </div>
1699
- """, unsafe_allow_html=True)
1700
 
1701
  st.markdown("<br>", unsafe_allow_html=True)
1702
 
@@ -1891,6 +1894,11 @@ else:
1891
 
1892
  column_config = get_column_config(company_areas_display)
1893
 
 
 
 
 
 
1894
  # Container för att förhindra scroll-hopp
1895
  table_container = st.container()
1896
 
 
1424
  if 'show_admin' not in st.session_state:
1425
  st.session_state.show_admin = False
1426
 
1427
+ def show_save_status_indicator():
1428
+ """Visa status-indikator för auto-save med timestamp"""
1429
+ if st.session_state.saving_in_progress:
1430
+ st.markdown("""
1431
+ <div class='auto-save-indicator saving'>
1432
+ 💾 Sparar Excel-ändringar...
1433
+ </div>
1434
+ """, unsafe_allow_html=True)
1435
+
1436
+ elif st.session_state.last_save_time:
1437
+ time_diff = (datetime.now() - st.session_state.last_save_time).total_seconds()
1438
+ timestamp = st.session_state.last_save_time.strftime('%Y-%m-%d %H:%M:%S')
1439
+
1440
+ if time_diff < 3: # Visa "Sparad" i 3 sekunder
1441
+ st.markdown(f"""
1442
+ <div class='auto-save-indicator saved'>
1443
+ ✅ Sparad automatiskt! <span style='font-size: 0.85em; opacity: 0.8;'>({timestamp})</span>
1444
+ </div>
1445
+ """, unsafe_allow_html=True)
1446
+ else:
1447
+ st.markdown(f"""
1448
+ <div class='auto-save-indicator'>
1449
+ 💾 Auto-sparar vid ändringar <span style='font-size: 0.85em; opacity: 0.7;'>• Senast sparad: {timestamp}</span>
1450
+ </div>
1451
+ """, unsafe_allow_html=True)
1452
+ else:
1453
+ st.markdown("""
1454
+ <div class='auto-save-indicator'>
1455
+ 💾 Auto-sparar vid ändringar
1456
+ </div>
1457
+ """, unsafe_allow_html=True)
1458
+
1459
  # ============================================================================
1460
  # MAIN APP
1461
  # ============================================================================
 
1699
  col_status = st.columns(1)[0]
1700
 
1701
  with col_status:
1702
+ show_save_status_indicator()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1703
 
1704
  st.markdown("<br>", unsafe_allow_html=True)
1705
 
 
1894
 
1895
  column_config = get_column_config(company_areas_display)
1896
 
1897
+ # Status-indikator precis ovanför tabellen för bättre synlighet
1898
+ st.markdown("<br>", unsafe_allow_html=True)
1899
+ show_save_status_indicator()
1900
+ st.markdown("<br>", unsafe_allow_html=True)
1901
+
1902
  # Container för att förhindra scroll-hopp
1903
  table_container = st.container()
1904