πŸ“‹ _myModalProperty.cshtml Documentation


πŸ“‘ Table of Contents

  1. 🎯 Overview & Purpose
  2. πŸ“‚ File Location
  3. βš™οΈ Dependencies & Technologies
  4. πŸ—ƒοΈ View Model & Domain Class
  5. πŸ› οΈ Key Functional Areas
  6. πŸ” Helper Methods & Utilities
  7. ❗ Error Handling & Return Types
  8. πŸ“‘ API Endpoints & Integration
  9. πŸ”— Third-Party Integrations
  10. πŸ’» Code Snippets
  11. 🎬 Usage Examples
  12. πŸ“ˆ UML Class Diagram
  13. πŸš€ 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 ExpiratinDate appears to have a small typo and could be ExpirationDate for clarity.


πŸ› οΈ Key Functional Areas

<div class="modal-content">
  ...
</div>
  • .modal-content: Bootstrap 5 class that defines the overall structure of a modal dialog.

<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.

<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.

<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 GeoLocation object.
  • 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 GeoLocation instance (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 via bundleconfig.json or 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

  1. In a List Page
    Display a button next to each property in a table that opens the modal.

  2. Ajax Load
    Fetch GeoLocation via 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! 🏠✨