LegalImaging/List.cshtml πŸ“„

Location: IrbyImaging/Views/LegalImaging/List.cshtml
Purpose: A rich Razor view for the Legal Imaging Dashboard, enabling users to search, track, visualize, and map legal documents and related leases/contracts.


Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. ViewModel & Data Models
  4. Page Layout & Razor Directives
  5. Key Functional Areas
  6. API Endpoints πŸ“‘
  7. Scripts & Utilities πŸ› 
  8. UML Diagram
  9. Usage Examples
  10. Conclusion πŸŽ‰

1. Overview & Purpose

This Razor view powers the Legal Dashboard for the IrbyImaging application. It provides:

  • A full‑text search across documents with advanced filters
  • A To‑Do list for quick notes
  • A live β€œExpiring Soon” panel that highlights upcoming document expirations
  • Key metrics (counts of contracts, leases, etc.)
  • Interactive charts (Syncfusion EJ2) for geographic and state‑by‑state analysis
  • A Recent Documents table with export options
  • A Bing Maps integration to visualize lease locations

✨ Designed for legal teams to monitor and manage important agreements in one place.


2. Dependencies & Technologies

Layer Technology / Library
UI Framework ASP.NET Core MVC, Razor
CSS / Layout Bootstrap 4, DataTables, Syncfusion EJ2 Styles
JavaScript jQuery, DataTables, Syncfusion EJ2, ApexCharts, Bing Maps API
Date Handling bootstrap-datepicker, Syncfusion DateRangePicker
Data Serialization Newtonsoft.Json
Maps & Geo Microsoft.Bing.Maps JavaScript SDK

3. ViewModel & Data Models

ViewModel: IrbyImaging.Models.DocumentImaging
This model carries both search filters and data collections:

public class DocumentImaging {
  public int DocumentImageId { get; set; }
  public string DocumentType { get; set; }
  public string FilePath { get; set; }
  public bool Preview { get; set; }
  public List<Guid> BatchIds { get; set; }
  public Guid ReferenceId { get; set; }
  public string IndexTag { get; set; }
  public string ContentType { get; set; }
  public bool IsLegalDocument { get; set; }
  public bool IsSafety { get; set; }
  public bool IsIT { get; set; }
  
  // Dropdown & Multi‑select sources
  public IEnumerable<SelectListItem> DocumentCategories { get; set; }
  public IEnumerable<SelectListItem> DocumentTypes { get; set; }
  public IEnumerable<SelectListItem> EmployeeData { get; set; }
  public IEnumerable<SelectListItem> JobData { get; set; }

  // Results
  public IEnumerable<ImagingDocument> ImagingList { get; set; }
  public bool OcrSearch { get; set; }
}

ViewBag Properties:

  • ViewBag.LeaseResults – Data for pie chart
  • ViewBag.DirectorDetails, ViewBag.ContractTypeDetails – Chart data
  • ViewBag.RecentDocuments – List of recent uploads
  • ViewBag.DocCount, ViewBag.ContractCount, etc. – Metric counts

4. Page Layout & Razor Directives

@model IrbyImaging.Models.DocumentImaging
@using Syncfusion.JavaScript.Models
@using Newtonsoft.Json
@{
    ViewData["Title"] = "Legal Dashboard";
    Layout = "~/Views/Shared/_LegalLayout.cshtml";
    // Initialize category, batch list, etc.
}
@section styles { /* CSS imports: datepicker, DataTables, Syncfusion */ }
  • Model binding at the top enables strongly‑typed access.
  • Layout specified as _LegalLayout.cshtml.
  • @section styles injects page‑specific CSS.

5. Key Functional Areas

5.1 Search Section πŸ”Ž

A <form> posts to SearchAll with these filters:

  • Text Search: <ejs-textbox id="searchString" placeholder="Search Anything" />
  • Category & Type: Syncfusion MultiSelect
  • Date Range: <ejs-daterangepicker>
  • Lead & Job: <ejs-dropdownlist>
  • OCR Search: @Html.CheckBoxFor(m => m.OcrSearch)
<form asp-action="SearchAll" method="post" target="_blank">
  @Html.HiddenFor(m => m.BatchIds, new { Value = lists })
  @Html.AntiForgeryToken()
  <div id="searchSection" class="row">
    <!-- Card wrapper -->
    <div class="card">
      <h4>Search all Documents</h4>
      <button type="submit" class="btn btn-primary">Search</button>
      <!-- Repeatable search filters -->
      <div data-repeater-list="outer-group">
        <div data-repeater-item>
          <!-- filters go here -->
        </div>
      </div>
    </div>
  </div>
</form>

5.2 To‑Do List πŸ“

Quick in‑page notes implemented with pure JS:

<div class="card">
  <h4>To-Do List</h4>
  <input id="todo" /><button id="addTodo">Add</button>
  <ul class="toDoList"></ul>
  <button id="RemoveCompleted">Remove Completed</button>
</div>

JS Logic (simplified):

// Add items
document.getElementById("addTodo").addEventListener("click", e => {
  e.preventDefault();
  const text = document.getElementById("todo").value;
  const li = document.createElement("li");
  li.innerText = text;
  document.querySelector(".toDoList").appendChild(li);
});
// Toggle & remove

5.3 Expiring Soon ⏰

Scans Model.ImagingList for expiration dates in the index, parses them, and lists items expiring in ≀ 90 days:

@foreach(var img in Model.ImagingList) {
  if(DateTime.TryParseExact(img.IndexList[0].IndexValue,…, out var dt)) {
    int days = (dt - DateTime.Today).Days;
    if(days is >= 0 and <= 90) {
      <li>@img.FileName – expires in @days days.
        @Html.ActionLink("View", "ViewDoc", new { id=img.DocumentImageId })
      </li>
    }
  }
}

5.4 Document Stats πŸ“Š

A sidebar card shows counts from ViewBag:

Metric Value
All Documents @ViewBag.DocCount
Contract Count @ViewBag.ContractCount
License Count @ViewBag.LicenseCount
Lease Count @ViewBag.LeaseCount
Certificate of Insurance Count @ViewBag.CoICount

5.5 Charts πŸ“ˆ

Powered by Syncfusion EJ2 Charts:

  1. Lease Location Overview
    • Type: StackingBar100
    • DataSource: ViewBag.DirectorDetails
  2. Contracts By State
    • Type: StackingBar100
    • DataSource: ViewBag.ContractTypeDetails
<ejs-chart id="splineContainer" title="Lease Location Overview">
  <e-chart-primaryxaxis valueType="Category" />
  <e-series-collection>
    <e-series dataSource="ViewBag.DirectorDetails" xName="Director" yName="Florida" type="StackingBar100" />
    <!-- more series for other states -->
  </e-series-collection>
  <e-chart-tooltipsettings enable="true" format="${point.x}: ${point.y}" />
</ejs-chart>

5.6 Recent Documents πŸ—‚

A DataTable listing the last N uploads:

<table id="recentTable" class="table table-striped">
  <thead>
    <tr>
      <th>Document Type</th><th>Name</th><th>Date Uploaded</th><th>By</th><th>View</th>
    </tr>
  </thead>
  <tbody>
    @for(int i=0; i<recentDocuments.Count; i++) {
      var doc = recentDocuments[i];
      <tr>
        <td>@doc.DocumentType</td>
        <td>@doc.FileName</td>
        <td>@doc.DocumentUploadedDate</td>
        <td>@doc.DocumentUploadedBy</td>
        <td>@Html.ActionLink("View","ViewDoc", new { id=doc.DocumentImageId })</td>
      </tr>
    }
  </tbody>
</table>

DataTable Initialization:

new DataTable('#recentTable', {
  paging: false,
  scrollY: '400px',
  order: [[2,'desc']]
});

5.7 Interactive Map πŸ—Ί

A Bing Maps integration that:

  1. Fetches lease locations from /Location/GetLocations
  2. Plots pushpins on the map
  3. Displays an infobox on pin click with lease details
fetch('/Location/GetLocations')
  .then(r=>r.json())
  .then(locations=>{
    locations.forEach(loc=>{
      const pin = new Microsoft.Maps.Pushpin(
        new Microsoft.Maps.Location(loc.Latitude, loc.Longitude)
      );
      Microsoft.Maps.Events.addHandler(pin,'click',()=>showInfobox(pin,loc));
      map.entities.push(pin);
    });
  });

function showInfobox(pin, data){
  infobox.setOptions({
    location: pin.getLocation(),
    htmlContent: `<strong>${data.Address}</strong><br/>Expires: ${data.ExpiratinDate}`,
    visible: true
  });
}

6. API Endpoints πŸ“‘

Endpoint HTTP Purpose
/LegalImaging/SearchAll POST Search documents with filters
/LegalImaging/ViewDoc/{id} GET View a specific document in new tab
/LegalImaging/Edit/{id} GET Edit document metadata
/Location/GetLocations GET Returns JSON array of lease locations

7. Scripts & Utilities πŸ› 

  • DataTables with Export Buttons (csv, excel, print)
  • To‑Do List JS for adding, toggling, and removing items
  • Conditional Row Styling (expired/expiresSoon/expireWarning) based on dates
  • Bing Maps Loader with async script injection
  • Syncfusion EJ2 initialization for charts & inputs

8. UML Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ DocumentImaging (Model) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ + DocumentImageId : int β”‚
β”‚ + BatchIds : List<Guid> β”‚
β”‚ + DocumentCategories    β”‚
β”‚ + DocumentTypes         β”‚
β”‚ + EmployeeData          β”‚
β”‚ + JobData               β”‚
β”‚ + ImagingList           β”‚
β”‚ + OcrSearch : bool      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   List.cshtml (View)    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ - Search Form           β”‚
β”‚ - To-Do List            β”‚
β”‚ - Expiring Soon Panel   β”‚
β”‚ - Document Stats Card   β”‚
β”‚ - Charts (Syncfusion)    β”‚
β”‚ - Recent Docs Table     β”‚
β”‚ - Bing Map Integration  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

9. Usage Examples

  1. Searching Documents

    • Enter keywords in Search Anything
    • Select Document Category / Type
    • Choose a Date Range or Lead/Job
    • Click Search β†’ Opens results in a new tab
  2. Monitoring Expirations

    • View the Expiring Soon card
    • Click View/Edit links for quick actions
  3. Mapping Leases

    • Scroll to the map
    • Browse by pin location and view lease metadata

10. Conclusion πŸŽ‰

This comprehensive Razor view centralizes all the tools a legal team needs:

  • Advanced search with multi‑criteria filters
  • Real‑time metrics & visualizations
  • Reminders for upcoming expirations
  • Geospatial intelligence via Bing Maps

All within a single, responsive dashboard!