π _myModalProperty.cshtml Documentation
π Table of Contents
- π― Overview & Purpose
- π File Location
- βοΈ Dependencies & Technologies
- ποΈ View Model & Domain Class
- π οΈ Key Functional Areas
- π Helper Methods & Utilities
- β Error Handling & Return Types
- π‘ API Endpoints & Integration
- π Third-Party Integrations
- π» Code Snippets
- π¬ Usage Examples
- π UML Class Diagram
- π Conclusion
π― Overview & Purpose
This Razor Partial View (_myModalProperty.cshtml) is designed to display Property Details in a Bootstrap modal dialog. It lives under the AccountingImaging area of the IrbyImaging ASP.NET MVC application.
- Primary Purpose:
Provide an interactive, reusable popup for viewing key metadata about a real estate property (e.g., lease terms, rent, taxes). - Intended Usage:
Invoked from parent pagesβsuch as transaction lists or mapsβwhenever a user clicks to see more details about a given property.
π File Location
IrbyImaging
βββ Views
βββ AccountingImaging
βββ _myModalProperty.cshtml
βοΈ Dependencies & Technologies
| Technology | Purpose |
|---|---|
| ASP.NET MVC / Razor | Server-side view templating |
| Bootstrap 5 | Modal layout & styling |
| C# (Domain Model) | IrbyImaging.DomainClasses.GeoLocation model |
| HTML5 & CSS3 | Markup & minimal inline styling |
ποΈ View Model & Domain Class
The view is strongly typed to the GeoLocation domain class. Below is a summary of its most important properties:
| Property | Type | Description |
|---|---|---|
| Landlord | string |
Name of the property owner/landlord. |
| Address | string |
Full street address. |
| CommencementDate | DateTime |
Lease start date. |
| LeasePurpose | string |
Intended use of the lease. |
| LeaseCode | string |
Internal lease identifier. |
| RegionLead | string |
Assigned region lead for this property. |
| ExpiratinDate (typo) | DateTime |
Lease end date. |
| FullyExecuted | bool |
Is the lease fully executed? |
| SubjectToEscalation | bool |
Does the lease include escalation terms? |
| MonthlyBaseRent | decimal |
Base monthly rent amount ($). |
| MonthlySalesTax | decimal |
Monthly sales tax ($). |
| MonthlyAVTax | decimal |
Monthly ad valorem (AV) tax ($). |
| MonthlyInsurancePayment | decimal |
Insurance cost per month ($). |
| TotalCost | decimal |
Sum of all monthly costs ($). |
Note: The property
ExpiratinDateappears to have a small typo and could beExpirationDatefor clarity.
π οΈ Key Functional Areas
Modal Wrapper & Layout
<div class="modal-content">
...
</div>
.modal-content: Bootstrap 5 class that defines the overall structure of a modal dialog.
Modal Header
<div class="modal-header">
<h5 class="modal-title" id="transaction-detailModalLabel">Property Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
- Title: Displays βProperty Detailsβ.
- Close Button: Uses
data-bs-dismiss="modal"to close the dialog.
Inline Styles
<style>
.line-breaks { white-space: pre-line; }
</style>
.line-breaks: Utility class to preserve line breaks if multiline text is displayed.- Location: Placed inline; you may consider moving to a dedicated CSS file.
Modal Body
<div class="modal-body">
<p class="mb-2">
Property Name: <span class="text-primary">@Html.DisplayFor(m => m.Landlord)</span>
</p>
<div class="table-responsive">
<div style="background-color: #f5f5f5; padding: 10px; border: 1px solid #ccc;">
<!-- List of key/value pairs -->
</div>
</div>
</div>
- Property Name: Highlighted in text-primary.
- Details Container: Light grey background with borderβserves as a simple βtableβ layout without using an actual
<table>element. - Key/Value Pairs:
<strong>tags for labels followed by model bindings for values.
Modal Footer
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
- Close Button: Dismisses the modal.
- Commented-Out Print: Thereβs an unused
<button>for βPrint Documentβ which could be activated if print functionality is required.
π Helper Methods & Utilities
- @Html.DisplayFor
Renders the value of a model property with appropriate HTML encoding and formatting. - Bootstrap classes
btn-close,btn,btn-secondary,modal-title, etc.
- Inline styling
Quick adjustments; extractable into a central stylesheet.
β Error Handling & Return Types
- Error Handling
- No explicit error-handling logic in this view.
- Assumes the controller always provides a valid
GeoLocationobject.
- Return Type
- Renders HTML fragment for Bootstrap modal.
- No JSON or other data formats.
π‘ API Endpoints & Integration
This partial view does not directly call any API endpoints. It is expected that its parent view or controller action fetches a
GeoLocationinstance (possibly via a service or Web API) and passes it into the modal.
Example in Controller:
public IActionResult PropertyDetails(int id)
{
var geo = _geoLocationService.GetById(id);
return PartialView("_myModalProperty", geo);
}
π Third-Party Integrations
- Bootstrap 5
Included viabundleconfig.jsonor layout_Layout.cshtml. - jQuery / Vanilla JS
If you need advanced show/hide or dynamic data-loading, you can trigger this modal via:$('#myModalProperty').modal('show');
π» Code Snippets
Rendering the Partial
@Html.Partial("_myModalProperty", Model.SelectedGeoLocation)
Triggering the Modal (Bootstrap 5)
<button type="button"
class="btn btn-info"
data-bs-toggle="modal"
data-bs-target="#myModalProperty">
View Property
</button>
Make sure the partial viewβs outer container has:
<div class="modal fade" id="myModalProperty" tabindex="-1" aria-hidden="true">
@Html.Partial("_myModalProperty", Model.SelectedGeoLocation)
</div>
π¬ Usage Examples
-
In a List Page
Display a button next to each property in a table that opens the modal. -
Ajax Load
FetchGeoLocationvia AJAX, then insert the HTML into the modal body:$.get('/AccountingImaging/PropertyDetails', { id: propertyId }) .done(html => { $('#myModalProperty .modal-content').html(html); $('#myModalProperty').modal('show'); });
π UML Class Diagram
classDiagram
class GeoLocation {
+string Landlord
+string Address
+DateTime CommencementDate
+string LeasePurpose
+string LeaseCode
+string RegionLead
+DateTime ExpiratinDate
+bool FullyExecuted
+bool SubjectToEscalation
+decimal MonthlyBaseRent
+decimal MonthlySalesTax
+decimal MonthlyAVTax
+decimal MonthlyInsurancePayment
+decimal TotalCost
}
π Conclusion
The _myModalProperty.cshtml partial view provides a clean, lightweight, and reusable interface for displaying detailed property information in a modal. By leveraging ASP.NET MVCβs strong typing and Bootstrap 5 styling, it integrates seamlessly into various pagesβenhancing user experience without full-page reloads.
Next Steps & Recommendations
- Extract inline CSS to a shared stylesheet.
- Fix the typo in
ExpiratinDate. - Uncomment & implement the βPrint Documentβ button if print functionality is required.
- Add client-side validations or error placeholders in case model data is null or missing.
Enjoy integrating this component into your real estate accounting workflows! π β¨