📑 MunicipalLicenseReport.cshtml Documentation


Path: IrbyImaging/Views/LegalImaging/MunicipalLicenseReport.cshtml


📖 Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Data Models & View Models
  4. Razor View Structure
  5. Key Functional Areas
  6. CSS Styles & Customization
  7. Syncfusion EJ2 Grid Configuration
  8. JavaScript & Client‑Side Logic
  9. Usage Workflow & Examples
  10. Error Handling & Edge Cases
  11. Third‑Party Integrations
  12. UML Diagrams
  13. Conclusion

🔍 Overview & Purpose

The MunicipalLicenseReport.cshtml is a Razor view in the LegalImaging area of the IrbyImaging application. Its main goal is to render a fully interactive, filterable, sortable, and exportable grid of municipal and county license data. It leverages the Syncfusion EJ2 JavaScript Grid to display a list of licenses with features like:

  • Excel export
  • Searching & filtering
  • Grouping & sorting
  • Paging & inline editing

This view is typically invoked by a corresponding controller action that populates the data source (ViewBag.datasource) and uses the domain model IrbyImaging.DomainClasses.LicenseReport.


🔗 Dependencies & Technologies

Category Details
Framework ASP.NET Core MVC / ASP.NET MVC (Razor)
UI Library Syncfusion EJ2 Grid
Namespaces Imported Syncfusion.JavaScript, Syncfusion.JavaScript.Models, Syncfusion.EJ2
Layout ~/Views/Shared/_LegalLayout.cshtml
CSS & Styling Inline <style> overrides for Syncfusion classes
Scripting Vanilla JavaScript event listeners & Syncfusion APIs

🛠 Data Models & View Models

Model

@model IrbyImaging.DomainClasses.LicenseReport

This view expects a LicenseReport domain object or, more commonly, a collection of them passed via ViewBag.datasource. Typical properties in LicenseReport include:

Property Type Description
State string Two‑letter state abbreviation
LicenseNumber string Unique license identifier
LicenseClassifications string List or comma‑separated classifications
ClassificationCodes string List of internal classification codes
IssuingParty string Agency or party that issued the license
DateAcquired DateTime When the license was acquired
Status string Active, Inactive, Suspended, etc.
ExpirationDate DateTime When the license expires
RenewalStatus string Renewal Due, Renewed, Overdue, etc.
Qualifiers string Special qualifiers or notes

🏗 Razor View Structure

@model IrbyImaging.DomainClasses.LicenseReport
@using Syncfusion.JavaScript
@using Syncfusion.JavaScript.Models
@using Syncfusion.EJ2

@{
    ViewData["Title"] = "List";
    Layout = "~/Views/Shared/_LegalLayout.cshtml";
}
  1. Model Declaration
  2. Namespace Imports for Syncfusion components
  3. ViewData & Layout configuration
<h2>Municipal/County Licenses</h2>
<div class="row">
  <div class="col-12">
    <div class="card">
      <div class="card-body">
        <div id="ControlRegion">
          <h4 class="card-title mb-4">License Report:</h4>
          <ejs-button id="clear" content="Clear Search"></ejs-button>
          <ejs-grid id="Grid" ...> ... </ejs-grid>
        </div>
      </div>
    </div>
  </div>
</div>
  • Bootstrap grid for responsive layout
  • Syncfusion Button for clearing search
  • Syncfusion Grid for main license table

🔑 Key Functional Areas

  1. Layout & Title
  2. CSS Overrides for styling Syncfusion grid header, icons, grouping
  3. Syncfusion EJ2 Grid configuration (columns, sorting, filtering, paging, Excel export)
  4. Client‑side Event Handlers (clear button, toolbarClick)
  5. Data Binding via ViewBag.datasource

🎨 CSS Styles & Customization

Inline <style> block at the top defines custom looks for the grid:

.e-grid .e-gridheader           { border: 2px solid black; }
.e-grid .e-headercell           { color: darkblue; }
.e-grid .e-icon-ascending::before   { content: '\e306'; }
.e-grid .e-icon-ascending::before   { content: '\e304'; }
.e-grid .e-sortnumber            { background-color: #deecf9; font-family: cursive; }
.e-grid .e-icon-gdownarrow::before { content: '\e916'; }
.e-grid .e-icon-grightarrow::before{ content: '\e913'; }
.e-grid .e-grouptext             { font-style: italic; }
.e-grid .e-groupcaption          { background-color: #add8e6; }
.e-grid .e-recordplusexpand      { background-color: #5968bf; }
.e-grid .e-recordpluscollapse    { background-color: aqua; }
.e-grid .e-indentcell            { background-color: lightblue; }

Tip: Customize these classes further in a separate SCSS/CSS file for maintainability.


🔢 Syncfusion EJ2 Grid Configuration

<ejs-grid id="Grid"
          dataSource="@ViewBag.datasource"
          allowSorting="true"
          allowFiltering="true"
          allowGrouping="true"
          allowPaging="true"
          allowTextWrap="true"
          allowRowDragAndDrop="true"
          allowExcelExport="true"
          toolbar="@(new List<string>() { "ExcelExport","Search" })"
          toolbarClick="toolbarClick">
  <e-grid-filterSettings type="Excel"></e-grid-filterSettings>
  <e-grid-editSettings allowAdding="true"
                       allowEditing="true"
                       allowDeleting="true"
                       edit-mode="@(EditMode.Normal)" />
  <e-grid-columns>
    <e-grid-column field="State" headerText="STATE" isPrimaryKey="true" textAlign="Left"></e-grid-column>
    <!-- More columns ... -->
    <e-grid-column field="Qualifiers" headerText="QUALIFIER(S)" textAlign="Left"></e-grid-column>
  </e-grid-columns>
</ejs-grid>

Key Attributes

  • dataSource
  • allowSorting, allowFiltering, allowPaging, allowGrouping
  • toolbar with ExcelExport & Search
  • Inline filterSettings & editSettings

Columns

Field Header Text Key Alignment
State STATE PrimaryKey Left
LicenseNumber LICENSE NUMBER PrimaryKey Center/Left
LicenseClassifications LICENSE CLASSIFICATION(S) — Left
ClassificationCodes CLASSIFICATION CODE(S) — Center
IssuingParty ISSUED BY — Left
DateAcquired ACQUIRED ON — Left
Status STATUS — Left
ExpirationDate EXPIRES ON — Left
RenewalStatus RENEWAL STATUS — Left
Qualifiers QUALIFIER(S) — Left

💻 JavaScript & Client‑Side Logic

// Clear Search Button
document.getElementById('clear').addEventListener('click', () => {
  var gridObj = document.getElementById("Grid").ej2_instances[0];
  gridObj.searchSettings.key = '';
});

// Toolbar Click Handler (Excel Export)
function toolbarClick(args) {
  var gridObj = document.getElementById("Grid").ej2_instances[0];
  if (args.item.id === 'Grid_excelexport') {
    gridObj.excelExport();
  }
}
  • Clear Search: Resets the search key on the grid
  • Excel Export: Intercepts toolbar clicks to trigger excelExport()

Note: Syncfusion grid instance is fetched via ej2_instances[0].


🏃‍♂️ Usage Workflow & Examples

  1. Controller Action
    public IActionResult MunicipalLicenseReport()
    {
      var data = _licenseService.GetAllMunicipalLicenses();
      ViewBag.datasource = data;
      return View();
    }
    
  2. Navigate to /LegalImaging/MunicipalLicenseReport
  3. Interact
    • Use Search toolbar to filter
    • Click Excel to export
    • Drag & drop rows to reorder
    • Inline add/edit/delete

⚠️ Error Handling & Edge Cases

  • Empty Data Source: Grid will render “No records to display.”
  • Invalid Data Types: Ensure DateAcquired & ExpirationDate are proper DateTime.
  • Large Data Sets: Use server‑side paging/filtering if performance degrades.

🔌 Third‑Party Integrations

  • Syncfusion EJ2 (essential grid features)
  • Bootstrap 4/5 (layout & responsiveness)

No external API endpoints are called directly in this view; data is expected to be prepared by the controller/service layer.


📊 UML Diagrams

1. Class Diagram

@startuml
class LicenseReport {
  + State: string
  + LicenseNumber: string
  + LicenseClassifications: string
  + ClassificationCodes: string
  + IssuingParty: string
  + DateAcquired: DateTime
  + Status: string
  + ExpirationDate: DateTime
  + RenewalStatus: string
  + Qualifiers: string
}
@enduml

2. Sequence Diagram

@startuml
actor User
participant Controller as MVC_Controller
participant View as RazorView
participant Grid as EJ2_Grid

User -> MVC_Controller: GET /MunicipalLicenseReport
MVC_Controller -> Service: Retrieve List<LicenseReport>
Service --> MVC_Controller: Return List<LicenseReport>
MVC_Controller -> RazorView: Pass data via ViewBag.datasource
RazorView -> Grid: Initialize with dataSource
Grid --> User: Render interactive license grid
@enduml

🏁 Conclusion

MunicipalLicenseReport.cshtml delivers a rich, interactive grid for municipal and county license data built on Syncfusion EJ2. It provides:

  • ✅ User-friendly filtering, sorting, grouping
  • 📄 Seamless Excel exports
  • ✏️ Inline editing & row operations
  • 🎨 Custom styling to align with Legal Imaging branding

By following the above documentation, you can extend, customize, and maintain this view to fit evolving business requirements.

Happy coding! 🚀