diff --git a/app/main.py b/app/main.py index dce845f..ddd8af9 100644 --- a/app/main.py +++ b/app/main.py @@ -1846,11 +1846,69 @@ async def admin_panel(request: Request, db: Session = Depends(get_db)): files_by_type[import_type] = [] files_by_type[import_type].append(file_info) + # Get record counts for all legacy and modern tables + from .models import ( + # Legacy tables + Rolodex, LegacyPhone, LegacyFile, FilesR, FilesV, FileNots, + Ledger, Deposits, LegacyPayment, TrnsType, TrnsLkup, + Footers, FileStat, Employee, GroupLkup, FileType, + Qdros, PlanInfo, Pensions, PensionMarriage, PensionDeath, + PensionSchedule, PensionSeparate, PensionResults, + RolexV, FVarLkup, RVarLkup, + # Modern tables + Client, Phone, Case, Transaction, Payment, Document + ) + + table_counts = { + 'reference': { + 'TrnsType': db.query(TrnsType).count(), + 'TrnsLkup': db.query(TrnsLkup).count(), + 'Footers': db.query(Footers).count(), + 'FileStat': db.query(FileStat).count(), + 'Employee': db.query(Employee).count(), + 'GroupLkup': db.query(GroupLkup).count(), + 'FileType': db.query(FileType).count(), + 'FVarLkup': db.query(FVarLkup).count(), + 'RVarLkup': db.query(RVarLkup).count(), + }, + 'core': { + 'Rolodex': db.query(Rolodex).count(), + 'LegacyPhone': db.query(LegacyPhone).count(), + 'RolexV': db.query(RolexV).count(), + 'LegacyFile': db.query(LegacyFile).count(), + 'FilesR': db.query(FilesR).count(), + 'FilesV': db.query(FilesV).count(), + 'FileNots': db.query(FileNots).count(), + 'Ledger': db.query(Ledger).count(), + 'Deposits': db.query(Deposits).count(), + 'LegacyPayment': db.query(LegacyPayment).count(), + }, + 'specialized': { + 'PlanInfo': db.query(PlanInfo).count(), + 'Qdros': db.query(Qdros).count(), + 'Pensions': db.query(Pensions).count(), + 'PensionMarriage': db.query(PensionMarriage).count(), + 'PensionDeath': db.query(PensionDeath).count(), + 'PensionSchedule': db.query(PensionSchedule).count(), + 'PensionSeparate': db.query(PensionSeparate).count(), + 'PensionResults': db.query(PensionResults).count(), + }, + 'modern': { + 'Client': db.query(Client).count(), + 'Phone': db.query(Phone).count(), + 'Case': db.query(Case).count(), + 'Transaction': db.query(Transaction).count(), + 'Payment': db.query(Payment).count(), + 'Document': db.query(Document).count(), + } + } + return templates.TemplateResponse("admin.html", { "request": request, "user": user, "recent_imports": recent_imports, "available_files": available_files, + "table_counts": table_counts, "files_by_type": files_by_type }) diff --git a/app/templates/admin.html b/app/templates/admin.html index 13ad864..37aeb4f 100644 --- a/app/templates/admin.html +++ b/app/templates/admin.html @@ -137,6 +137,162 @@ {% endif %} + + {% if table_counts %} +
+
+
+ Database Status - Imported Data +
+
+
+

View record counts for all tables to track import progress:

+ +
+ +
+
Reference Tables
+
+ + + + + + + + + {% for table_name, count in table_counts.reference.items() %} + + + + + {% endfor %} + +
TableRecords
+ {{ table_name }} + {% if count > 0 %} + + {% endif %} + + + {{ "{:,}".format(count) }} + +
+
+
+ + +
+
Core Data Tables
+
+ + + + + + + + + {% for table_name, count in table_counts.core.items() %} + + + + + {% endfor %} + +
TableRecords
+ {{ table_name }} + {% if count > 0 %} + + {% endif %} + + + {{ "{:,}".format(count) }} + +
+
+
+ + +
+
Specialized Tables
+
+ + + + + + + + + {% for table_name, count in table_counts.specialized.items() %} + + + + + {% endfor %} + +
TableRecords
+ {{ table_name }} + {% if count > 0 %} + + {% endif %} + + + {{ "{:,}".format(count) }} + +
+
+
+ + +
+
Modern Models
+
+ + + + + + + + + {% for table_name, count in table_counts.modern.items() %} + + + + + {% endfor %} + +
TableRecords
+ {{ table_name }} + {% if count > 0 %} + + {% endif %} + + + {{ "{:,}".format(count) }} + +
+
+
+
+ +
+
+
+ + Legend: + Green = Has data imported | + Gray = No data yet | + = Table populated +
+
+
+
+
+ {% endif %} +