AdminViewModels.cs
9,375 bytes
| 1 | using App.BLL.DTO; |
|---|---|
| 2 | using Microsoft.AspNetCore.Mvc.Rendering; |
| 3 | |
| 4 | namespace WebApp.Areas.Admin.Models; |
| 5 | |
| 6 | // === BASE === |
| 7 | |
| 8 | public interface ITitledViewModel |
| 9 | { |
| 10 | string Title { get; set; } |
| 11 | } |
| 12 | |
| 13 | public abstract class AdminPageViewModel : ITitledViewModel |
| 14 | { |
| 15 | public string Title { get; set; } = ""; |
| 16 | } |
| 17 | |
| 18 | // Generic wrappers used for Details/Delete views so domain entities |
| 19 | // don't leak directly into views (keeps us strictly on ViewModels). |
| 20 | public class AdminDetailsViewModel<T> : AdminPageViewModel where T : class |
| 21 | { |
| 22 | public T Item { get; set; } = default!; |
| 23 | } |
| 24 | |
| 25 | public class AdminDeleteViewModel<T> : AdminPageViewModel where T : class |
| 26 | { |
| 27 | public T Item { get; set; } = default!; |
| 28 | } |
| 29 | |
| 30 | // === INDEX VIEWMODELS === |
| 31 | |
| 32 | public class AdminTripIndexViewModel : AdminPageViewModel |
| 33 | { |
| 34 | public List<TripBllDto> Items { get; set; } = new(); |
| 35 | public string? CurrentSearch { get; set; } |
| 36 | } |
| 37 | |
| 38 | public class AdminExpenseIndexViewModel : AdminPageViewModel |
| 39 | { |
| 40 | public List<ExpenseBllDto> Items { get; set; } = new(); |
| 41 | public List<TripBllDto> Trips { get; set; } = new(); |
| 42 | public Guid? CurrentTripId { get; set; } |
| 43 | public string? CurrentSearch { get; set; } |
| 44 | } |
| 45 | |
| 46 | public class AdminBudgetCategoryIndexViewModel : AdminPageViewModel |
| 47 | { |
| 48 | public List<BudgetCategoryBllDto> Items { get; set; } = new(); |
| 49 | public List<TripBllDto> Trips { get; set; } = new(); |
| 50 | public Guid? CurrentTripId { get; set; } |
| 51 | public string? CurrentSearch { get; set; } |
| 52 | } |
| 53 | |
| 54 | public class AdminSettlementPlanIndexViewModel : AdminPageViewModel |
| 55 | { |
| 56 | public List<SettlementPlanBllDto> Items { get; set; } = new(); |
| 57 | public List<TripBllDto> Trips { get; set; } = new(); |
| 58 | public Guid? CurrentTripId { get; set; } |
| 59 | } |
| 60 | |
| 61 | public class AdminTripParticipantIndexViewModel : AdminPageViewModel |
| 62 | { |
| 63 | public List<TripParticipantBllDto> Items { get; set; } = new(); |
| 64 | public List<TripBllDto> Trips { get; set; } = new(); |
| 65 | public Guid? CurrentTripId { get; set; } |
| 66 | public string? CurrentSearch { get; set; } |
| 67 | } |
| 68 | |
| 69 | public class AdminSettlementPaymentIndexViewModel : AdminPageViewModel |
| 70 | { |
| 71 | public List<SettlementPaymentBllDto> Items { get; set; } = new(); |
| 72 | public string? CurrentSearch { get; set; } |
| 73 | } |
| 74 | |
| 75 | public class AdminPollIndexViewModel : AdminPageViewModel |
| 76 | { |
| 77 | public List<TripPollBllDto> Items { get; set; } = new(); |
| 78 | public string? CurrentSearch { get; set; } |
| 79 | } |
| 80 | |
| 81 | public class AdminWishlistIndexViewModel : AdminPageViewModel |
| 82 | { |
| 83 | public List<TripWishlistItemBllDto> Items { get; set; } = new(); |
| 84 | public string? CurrentSearch { get; set; } |
| 85 | } |
| 86 | |
| 87 | public class AdminInvitationIndexViewModel : AdminPageViewModel |
| 88 | { |
| 89 | public List<TripInvitationBllDto> Items { get; set; } = new(); |
| 90 | public string? CurrentSearch { get; set; } |
| 91 | } |
| 92 | |
| 93 | public class AdminCurrencyIndexViewModel : AdminPageViewModel |
| 94 | { |
| 95 | public List<CurrencyBllDto> Items { get; set; } = new(); |
| 96 | public string? CurrentSearch { get; set; } |
| 97 | } |
| 98 | |
| 99 | public class AdminSplitPresetIndexViewModel : AdminPageViewModel |
| 100 | { |
| 101 | public List<SplitPresetBllDto> Items { get; set; } = new(); |
| 102 | public string? CurrentSearch { get; set; } |
| 103 | } |
| 104 | |
| 105 | public class AdminUserIndexViewModel : AdminPageViewModel |
| 106 | { |
| 107 | public List<AdminUserViewModel> Users { get; set; } = new(); |
| 108 | } |
| 109 | |
| 110 | // === FORM VIEWMODELS === |
| 111 | |
| 112 | public class AdminTripFormViewModel : AdminPageViewModel |
| 113 | { |
| 114 | public TripBllDto Trip { get; set; } = new(); |
| 115 | public SelectList CurrencyList { get; set; } = default!; |
| 116 | } |
| 117 | |
| 118 | public class AdminExpenseFormViewModel : AdminPageViewModel |
| 119 | { |
| 120 | public ExpenseBllDto Expense { get; set; } = new(); |
| 121 | public SelectList TripList { get; set; } = default!; |
| 122 | public SelectList UserList { get; set; } = default!; |
| 123 | public SelectList CurrencyList { get; set; } = default!; |
| 124 | public SelectList BudgetCategoryList { get; set; } = default!; |
| 125 | } |
| 126 | |
| 127 | public class AdminBudgetCategoryFormViewModel : AdminPageViewModel |
| 128 | { |
| 129 | public BudgetCategoryBllDto BudgetCategory { get; set; } = new(); |
| 130 | public SelectList TripList { get; set; } = default!; |
| 131 | } |
| 132 | |
| 133 | public class AdminSettlementPlanFormViewModel : AdminPageViewModel |
| 134 | { |
| 135 | public SettlementPlanBllDto SettlementPlan { get; set; } = new(); |
| 136 | public SelectList TripList { get; set; } = default!; |
| 137 | public SelectList UserList { get; set; } = default!; |
| 138 | } |
| 139 | |
| 140 | public class AdminTripParticipantFormViewModel : AdminPageViewModel |
| 141 | { |
| 142 | public TripParticipantBllDto TripParticipant { get; set; } = new(); |
| 143 | public SelectList TripList { get; set; } = default!; |
| 144 | public SelectList UserList { get; set; } = default!; |
| 145 | } |
| 146 | |
| 147 | public class AdminPollFormViewModel : AdminPageViewModel |
| 148 | { |
| 149 | public TripPollBllDto Poll { get; set; } = new(); |
| 150 | public SelectList TripList { get; set; } = default!; |
| 151 | public SelectList UserList { get; set; } = default!; |
| 152 | } |
| 153 | |
| 154 | public class AdminWishlistFormViewModel : AdminPageViewModel |
| 155 | { |
| 156 | public TripWishlistItemBllDto Item { get; set; } = new(); |
| 157 | public SelectList TripList { get; set; } = default!; |
| 158 | public SelectList UserList { get; set; } = default!; |
| 159 | } |
| 160 | |
| 161 | public class AdminCurrencyFormViewModel : AdminPageViewModel |
| 162 | { |
| 163 | public CurrencyBllDto Currency { get; set; } = new(); |
| 164 | } |
| 165 | |
| 166 | public class AdminSplitPresetFormViewModel : AdminPageViewModel |
| 167 | { |
| 168 | public SplitPresetBllDto SplitPreset { get; set; } = new(); |
| 169 | public SelectList TripList { get; set; } = default!; |
| 170 | public SelectList UserList { get; set; } = default!; |
| 171 | } |
| 172 | |
| 173 | public class AdminInvitationFormViewModel : AdminPageViewModel |
| 174 | { |
| 175 | public TripInvitationBllDto Invitation { get; set; } = new(); |
| 176 | public SelectList TripList { get; set; } = default!; |
| 177 | public SelectList UserList { get; set; } = default!; |
| 178 | } |
| 179 | |
| 180 | public class AdminSettlementPaymentFormViewModel : AdminPageViewModel |
| 181 | { |
| 182 | public SettlementPaymentBllDto Payment { get; set; } = new(); |
| 183 | public SelectList SettlementPlanList { get; set; } = default!; |
| 184 | public SelectList UserList { get; set; } = default!; |
| 185 | } |
| 186 | |
| 187 | public class AdminEditRolesViewModel : AdminPageViewModel |
| 188 | { |
| 189 | public string UserEmail { get; set; } = default!; |
| 190 | public string UserName { get; set; } = default!; |
| 191 | public List<RoleAssignmentViewModel> Roles { get; set; } = new(); |
| 192 | } |
| 193 | |
| 194 | public class AdminUserDetailsViewModel : AdminPageViewModel |
| 195 | { |
| 196 | public Guid Id { get; set; } |
| 197 | public string Email { get; set; } = default!; |
| 198 | public string FirstName { get; set; } = default!; |
| 199 | public string LastName { get; set; } = default!; |
| 200 | public List<string> Roles { get; set; } = new(); |
| 201 | } |
| 202 | |
| 203 | public class AdminUserEditViewModel : AdminPageViewModel |
| 204 | { |
| 205 | public Guid Id { get; set; } |
| 206 | public string Email { get; set; } = default!; |
| 207 | public string FirstName { get; set; } = default!; |
| 208 | public string LastName { get; set; } = default!; |
| 209 | } |
| 210 | |
| 211 | // === DASHBOARD === |
| 212 | |
| 213 | public class AdminDashboardViewModel : AdminPageViewModel |
| 214 | { |
| 215 | public int TripCount { get; set; } |
| 216 | public int UserCount { get; set; } |
| 217 | public int ExpenseCount { get; set; } |
| 218 | public int CategoryCount { get; set; } |
| 219 | public int SettlementCount { get; set; } |
| 220 | public int WishlistCount { get; set; } |
| 221 | public int PollCount { get; set; } |
| 222 | public int InvitationCount { get; set; } |
| 223 | public int CurrencyCount { get; set; } |
| 224 | public int ParticipantCount { get; set; } |
| 225 | public int ActiveTrips { get; set; } |
| 226 | public int SettledTrips { get; set; } |
| 227 | public int ArchivedTrips { get; set; } |
| 228 | public decimal TotalExpenseAmount { get; set; } |
| 229 | public int PendingSettlements { get; set; } |
| 230 | public int InProgressSettlements { get; set; } |
| 231 | public int CompletedSettlements { get; set; } |
| 232 | public int PendingInvitations { get; set; } |
| 233 | public int PendingPayments { get; set; } |
| 234 | public int MarkedPaidPayments { get; set; } |
| 235 | public List<TripBllDto> RecentTrips { get; set; } = new(); |
| 236 | public List<ExpenseBllDto> RecentExpenses { get; set; } = new(); |
| 237 | public List<AppUserBllDto> RecentUsers { get; set; } = new(); |
| 238 | |
| 239 | // Extended stats |
| 240 | public List<TopActiveTripItem> TopActiveTrips { get; set; } = new(); |
| 241 | public List<ExpenseBllDto> BiggestExpenses { get; set; } = new(); |
| 242 | public int NewUsersLast7Days { get; set; } |
| 243 | public int NewUsersLast30Days { get; set; } |
| 244 | public List<TopActiveUserItem> TopActiveUsers { get; set; } = new(); |
| 245 | public List<ActivityFeedItem> ActivityFeed { get; set; } = new(); |
| 246 | } |
| 247 | |
| 248 | public class TopActiveTripItem |
| 249 | { |
| 250 | public TripBllDto Trip { get; set; } = default!; |
| 251 | public int ParticipantCount { get; set; } |
| 252 | public decimal ExpenseSum { get; set; } |
| 253 | public int ExpenseCount { get; set; } |
| 254 | } |
| 255 | |
| 256 | public class TopActiveUserItem |
| 257 | { |
| 258 | public Guid UserId { get; set; } |
| 259 | public string Email { get; set; } = ""; |
| 260 | public string FullName { get; set; } = ""; |
| 261 | public int ExpenseCount { get; set; } |
| 262 | public decimal TotalAmount { get; set; } |
| 263 | } |
| 264 | |
| 265 | public class ActivityFeedItem |
| 266 | { |
| 267 | public string Type { get; set; } = ""; |
| 268 | public string Message { get; set; } = ""; |
| 269 | public DateTime Date { get; set; } |
| 270 | public string IconCssClass { get; set; } = "bi-circle"; |
| 271 | public string BadgeCssClass { get; set; } = "bg-secondary"; |
| 272 | } |
| 273 | |
| 274 | public class AdminUserViewModel |
| 275 | { |
| 276 | public Guid Id { get; set; } |
| 277 | public string Email { get; set; } = default!; |
| 278 | public string FirstName { get; set; } = default!; |
| 279 | public string LastName { get; set; } = default!; |
| 280 | public List<string> Roles { get; set; } = new(); |
| 281 | } |
| 282 | |
| 283 | public class RoleAssignmentViewModel |
| 284 | { |
| 285 | public string RoleName { get; set; } = default!; |
| 286 | public bool IsAssigned { get; set; } |
| 287 | } |
| 288 | |