●
LIVE DEMO
Generated using
Instruct UI - An AI for Blazor UI Generation
## What's implemented
- Lost-time wage calculation form with conditional fields (Hourly vs Salary, Dates vs Manual).
- EditForm validation using DataAnnotationsValidator and ValidationMessage for field-level feedback.
- Inputs: text, select, number, date, textarea and an input-group percent suffix.
- Calculation summary panel showing AWW, weeks lost, payable weeks, weekly benefit, total benefit payable, total wage loss and employer offset applied.
- Copy to clipboard and print actions implemented via IJSRuntime.
## Key components
- EditForm, DataAnnotationsValidator, ValidationMessage
- InputText, InputNumber, InputSelect, InputDate, InputTextArea
- @bind-Value bindings and OnValidSubmit handler
- Private CalculationResults DTO and injected IJSRuntime for clipboard/print
## How it works
The page binds a WageCalcModel instance to the EditForm; inputs use @bind-Value to update the model. OnValidSubmit triggers HandleValidSubmit which validates date order (when using dates), computes Average Weekly Wage (AWW) from hourly or salary inputs, derives days/weeks lost (from dates or manual entry), applies a waiting period, computes weekly benefit capped by MaxWeeklyBenefit, and applies employer offsets. Conditional rendering (if/else) shows relevant input groups based on model.PayType and model.CalculationMode. Validation relies on data annotations on WageCalcModel.
## Styling
- Uses Bootstrap utility and layout classes: container, row, col-*, card, btn, form-control, form-select, input-group.
- Responsive two-column layout (col-12 / col-lg-7 and col-lg-5) for form and summary.
- Font Awesome icons are referenced in the markup and require including FA assets in the host page.
## Reuse steps
1. Add the Razor page and WageCalcModel.cs to a Blazor project.
2. Ensure Bootstrap CSS and optional Font Awesome are included in index.html or _Host.cshtml.
3. Import Microsoft.AspNetCore.Components.Forms if not already available and keep data annotation attributes on the model.
4. Inject IJSRuntime (used for clipboard and print) and adapt JS interop for the hosting model (WASM/Server).
5. Extract calculation logic into a service for reuse and add unit tests for HandleValidSubmit.
## Limitations & next steps
- Page holds state in-memory; persistence, server-side rules or audit are not implemented.
- Currency formatting uses ToString("C") and may need culture handling for multi-region apps.
- Accessibility, print stylesheet, and additional validation (edge numeric ranges, time zone handling) require further work.
- Move core calculations into a testable service, add integration tests, and wire authentication/authorization if needed.